mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
renamed IconManager to KFilePreviewGenerator
svn path=/trunk/KDE/kdebase/apps/; revision=863324
This commit is contained in:
parent
711d1c0f0d
commit
4d886d083c
7 changed files with 51 additions and 51 deletions
|
@ -35,7 +35,7 @@ set(dolphinprivate_LIB_SRCS
|
|||
dolphinview.cpp
|
||||
dolphinviewactionhandler.cpp
|
||||
folderexpander.cpp
|
||||
iconmanager.cpp
|
||||
kfilepreviewgenerator.cpp
|
||||
ktooltip.cpp
|
||||
kballoontipdelegate.cpp
|
||||
kformattedballoontipdelegate.cpp
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "dolphin_generalsettings.h"
|
||||
#include "draganddrophelper.h"
|
||||
#include "folderexpander.h"
|
||||
#include "iconmanager.h"
|
||||
#include "kfilepreviewgenerator.h"
|
||||
#include "selectionmanager.h"
|
||||
#include "tooltipmanager.h"
|
||||
|
||||
|
@ -60,7 +60,7 @@ DolphinColumnWidget::DolphinColumnWidget(QWidget* parent,
|
|||
m_dirLister(0),
|
||||
m_dolphinModel(0),
|
||||
m_proxyModel(0),
|
||||
m_iconManager(0),
|
||||
m_previewGenerator(0),
|
||||
m_dropRect()
|
||||
{
|
||||
setMouseTracking(true);
|
||||
|
@ -131,8 +131,8 @@ DolphinColumnWidget::DolphinColumnWidget(QWidget* parent,
|
|||
m_selectionManager, SLOT(reset()));
|
||||
}
|
||||
|
||||
m_iconManager = new IconManager(this, m_proxyModel);
|
||||
m_iconManager->setShowPreview(m_view->m_controller->dolphinView()->showPreview());
|
||||
m_previewGenerator = new KFilePreviewGenerator(this, m_proxyModel);
|
||||
m_previewGenerator->setShowPreview(m_view->m_controller->dolphinView()->showPreview());
|
||||
|
||||
if (DolphinSettings::instance().generalSettings()->showToolTips()) {
|
||||
new ToolTipManager(this, m_proxyModel);
|
||||
|
@ -163,8 +163,8 @@ void DolphinColumnWidget::setDecorationSize(const QSize& size)
|
|||
setIconSize(size);
|
||||
m_decorationSize = size;
|
||||
doItemsLayout();
|
||||
if (m_iconManager != 0) {
|
||||
m_iconManager->updatePreviews();
|
||||
if (m_previewGenerator != 0) {
|
||||
m_previewGenerator->updatePreviews();
|
||||
}
|
||||
if (m_selectionManager != 0) {
|
||||
m_selectionManager->reset();
|
||||
|
@ -213,7 +213,7 @@ void DolphinColumnWidget::setShowHiddenFiles(bool show)
|
|||
|
||||
void DolphinColumnWidget::setShowPreview(bool show)
|
||||
{
|
||||
m_iconManager->setShowPreview(show);
|
||||
m_previewGenerator->setShowPreview(show);
|
||||
|
||||
m_dirLister->stop();
|
||||
m_dirLister->openUrl(m_url, KDirLister::Reload);
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
class DolphinColumnView;
|
||||
class DolphinModel;
|
||||
class DolphinSortFilterProxyModel;
|
||||
class IconManager;
|
||||
class KDirLister;
|
||||
class KFilePreviewGenerator;
|
||||
class KJob;
|
||||
class KFileItem;
|
||||
class KFileItemList;
|
||||
|
@ -153,7 +153,7 @@ private:
|
|||
DolphinModel* m_dolphinModel;
|
||||
DolphinSortFilterProxyModel* m_proxyModel;
|
||||
|
||||
IconManager* m_iconManager;
|
||||
KFilePreviewGenerator* m_previewGenerator;
|
||||
|
||||
QRect m_dropRect;
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
#include "dolphinsettings.h"
|
||||
#include "dolphin_generalsettings.h"
|
||||
#include "folderexpander.h"
|
||||
#include "iconmanager.h"
|
||||
#include "kfilepreviewgenerator.h"
|
||||
#include "renamedialog.h"
|
||||
#include "tooltipmanager.h"
|
||||
#include "viewproperties.h"
|
||||
|
@ -87,7 +87,7 @@ DolphinView::DolphinView(QWidget* parent,
|
|||
m_dolphinModel(dolphinModel),
|
||||
m_dirLister(dirLister),
|
||||
m_proxyModel(proxyModel),
|
||||
m_iconManager(0),
|
||||
m_previewGenerator(0),
|
||||
m_toolTipManager(0),
|
||||
m_rootUrl(),
|
||||
m_currentItemUrl()
|
||||
|
@ -373,7 +373,7 @@ void DolphinView::setZoomLevel(int level)
|
|||
|
||||
if (level != zoomLevel()) {
|
||||
m_controller->setZoomLevel(level);
|
||||
m_iconManager->updatePreviews();
|
||||
m_previewGenerator->updatePreviews();
|
||||
emit zoomLevelChanged(level);
|
||||
}
|
||||
}
|
||||
|
@ -452,7 +452,7 @@ void DolphinView::updateView(const KUrl& url, const KUrl& rootUrl)
|
|||
return;
|
||||
}
|
||||
|
||||
m_iconManager->cancelPreviews();
|
||||
m_previewGenerator->cancelPreviews();
|
||||
m_controller->setUrl(url); // emits urlChanged, which we forward
|
||||
|
||||
if (!rootUrl.isEmpty() && rootUrl.isParentOf(url)) {
|
||||
|
@ -657,7 +657,7 @@ void DolphinView::setShowPreview(bool show)
|
|||
props.setShowPreview(show);
|
||||
|
||||
m_showPreview = show;
|
||||
m_iconManager->setShowPreview(show);
|
||||
m_previewGenerator->setShowPreview(show);
|
||||
|
||||
const int oldZoomLevel = m_controller->zoomLevel();
|
||||
emit showPreviewChanged();
|
||||
|
@ -1107,7 +1107,7 @@ void DolphinView::applyViewProperties(const KUrl& url)
|
|||
const bool showPreview = props.showPreview();
|
||||
if (showPreview != m_showPreview) {
|
||||
m_showPreview = showPreview;
|
||||
m_iconManager->setShowPreview(showPreview);
|
||||
m_previewGenerator->setShowPreview(showPreview);
|
||||
|
||||
const int oldZoomLevel = m_controller->zoomLevel();
|
||||
emit showPreviewChanged();
|
||||
|
@ -1180,8 +1180,8 @@ void DolphinView::createView()
|
|||
|
||||
view->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
|
||||
m_iconManager = new IconManager(view, m_proxyModel);
|
||||
m_iconManager->setShowPreview(m_showPreview);
|
||||
m_previewGenerator = new KFilePreviewGenerator(view, m_proxyModel);
|
||||
m_previewGenerator->setShowPreview(m_showPreview);
|
||||
|
||||
if (DolphinSettings::instance().generalSettings()->showToolTips()) {
|
||||
m_toolTipManager = new ToolTipManager(view, m_proxyModel);
|
||||
|
@ -1215,7 +1215,7 @@ void DolphinView::deleteView()
|
|||
m_detailsView = 0;
|
||||
m_columnView = 0;
|
||||
m_fileItemDelegate = 0;
|
||||
m_iconManager = 0;
|
||||
m_previewGenerator = 0;
|
||||
m_toolTipManager = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ class DolphinIconsView;
|
|||
class DolphinMainWindow;
|
||||
class DolphinModel;
|
||||
class DolphinSortFilterProxyModel;
|
||||
class IconManager;
|
||||
class KFilePreviewGenerator;
|
||||
class KAction;
|
||||
class KActionCollection;
|
||||
class KDirLister;
|
||||
|
@ -709,7 +709,7 @@ private:
|
|||
KDirLister* m_dirLister;
|
||||
DolphinSortFilterProxyModel* m_proxyModel;
|
||||
|
||||
IconManager* m_iconManager;
|
||||
KFilePreviewGenerator* m_previewGenerator;
|
||||
ToolTipManager* m_toolTipManager;
|
||||
|
||||
KUrl m_rootUrl;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||
***************************************************************************/
|
||||
|
||||
#include "iconmanager.h"
|
||||
#include "kfilepreviewgenerator.h"
|
||||
|
||||
#include <kiconeffect.h>
|
||||
#include <kio/previewjob.h>
|
||||
|
@ -80,7 +80,7 @@ private:
|
|||
QListView* m_view;
|
||||
};
|
||||
|
||||
IconManager::IconManager(QAbstractItemView* parent, KDirSortFilterProxyModel* model) :
|
||||
KFilePreviewGenerator::KFilePreviewGenerator(QAbstractItemView* parent, KDirSortFilterProxyModel* model) :
|
||||
QObject(parent),
|
||||
m_showPreview(false),
|
||||
m_clearItemQueues(true),
|
||||
|
@ -127,7 +127,7 @@ IconManager::IconManager(QAbstractItemView* parent, KDirSortFilterProxyModel* mo
|
|||
this, SLOT(pausePreviews()));
|
||||
}
|
||||
|
||||
IconManager::~IconManager()
|
||||
KFilePreviewGenerator::~KFilePreviewGenerator()
|
||||
{
|
||||
killPreviewJobs();
|
||||
m_pendingItems.clear();
|
||||
|
@ -138,7 +138,7 @@ IconManager::~IconManager()
|
|||
}
|
||||
}
|
||||
|
||||
void IconManager::setShowPreview(bool show)
|
||||
void KFilePreviewGenerator::setShowPreview(bool show)
|
||||
{
|
||||
if (m_showPreview != show) {
|
||||
m_showPreview = show;
|
||||
|
@ -160,7 +160,7 @@ void IconManager::setShowPreview(bool show)
|
|||
}
|
||||
}
|
||||
|
||||
void IconManager::updatePreviews()
|
||||
void KFilePreviewGenerator::updatePreviews()
|
||||
{
|
||||
if (!m_showPreview) {
|
||||
return;
|
||||
|
@ -183,7 +183,7 @@ void IconManager::updatePreviews()
|
|||
updateCutItems();
|
||||
}
|
||||
|
||||
void IconManager::cancelPreviews()
|
||||
void KFilePreviewGenerator::cancelPreviews()
|
||||
{
|
||||
killPreviewJobs();
|
||||
m_cutItemsCache.clear();
|
||||
|
@ -191,7 +191,7 @@ void IconManager::cancelPreviews()
|
|||
m_dispatchedItems.clear();
|
||||
}
|
||||
|
||||
void IconManager::generatePreviews(const KFileItemList& items)
|
||||
void KFilePreviewGenerator::generatePreviews(const KFileItemList& items)
|
||||
{
|
||||
applyCutItemEffect();
|
||||
|
||||
|
@ -209,7 +209,7 @@ void IconManager::generatePreviews(const KFileItemList& items)
|
|||
startPreviewJob(orderedItems);
|
||||
}
|
||||
|
||||
void IconManager::addToPreviewQueue(const KFileItem& item, const QPixmap& pixmap)
|
||||
void KFilePreviewGenerator::addToPreviewQueue(const KFileItem& item, const QPixmap& pixmap)
|
||||
{
|
||||
if (!m_showPreview) {
|
||||
// the preview has been canceled in the meantime
|
||||
|
@ -261,7 +261,7 @@ void IconManager::addToPreviewQueue(const KFileItem& item, const QPixmap& pixmap
|
|||
}
|
||||
|
||||
// remember the preview and URL, so that it can be applied to the model
|
||||
// in IconManager::dispatchPreviewQueue()
|
||||
// in KFilePreviewGenerator::dispatchPreviewQueue()
|
||||
ItemInfo preview;
|
||||
preview.url = url;
|
||||
preview.pixmap = icon;
|
||||
|
@ -270,7 +270,7 @@ void IconManager::addToPreviewQueue(const KFileItem& item, const QPixmap& pixmap
|
|||
m_dispatchedItems.append(item);
|
||||
}
|
||||
|
||||
void IconManager::slotPreviewJobFinished(KJob* job)
|
||||
void KFilePreviewGenerator::slotPreviewJobFinished(KJob* job)
|
||||
{
|
||||
const int index = m_previewJobs.indexOf(job);
|
||||
m_previewJobs.removeAt(index);
|
||||
|
@ -283,7 +283,7 @@ void IconManager::slotPreviewJobFinished(KJob* job)
|
|||
}
|
||||
}
|
||||
|
||||
void IconManager::updateCutItems()
|
||||
void KFilePreviewGenerator::updateCutItems()
|
||||
{
|
||||
// restore the icons of all previously selected items to the
|
||||
// original state...
|
||||
|
@ -299,7 +299,7 @@ void IconManager::updateCutItems()
|
|||
applyCutItemEffect();
|
||||
}
|
||||
|
||||
void IconManager::dispatchPreviewQueue()
|
||||
void KFilePreviewGenerator::dispatchPreviewQueue()
|
||||
{
|
||||
const int previewsCount = m_previews.count();
|
||||
if (previewsCount > 0) {
|
||||
|
@ -331,7 +331,7 @@ void IconManager::dispatchPreviewQueue()
|
|||
}
|
||||
}
|
||||
|
||||
void IconManager::pausePreviews()
|
||||
void KFilePreviewGenerator::pausePreviews()
|
||||
{
|
||||
foreach (KJob* job, m_previewJobs) {
|
||||
Q_ASSERT(job != 0);
|
||||
|
@ -340,7 +340,7 @@ void IconManager::pausePreviews()
|
|||
m_scrollAreaTimer->start();
|
||||
}
|
||||
|
||||
void IconManager::resumePreviews()
|
||||
void KFilePreviewGenerator::resumePreviews()
|
||||
{
|
||||
// Before creating new preview jobs the m_pendingItems queue must be
|
||||
// cleaned up by removing the already dispatched items. Implementation
|
||||
|
@ -377,7 +377,7 @@ void IconManager::resumePreviews()
|
|||
startPreviewJob(orderedItems);
|
||||
}
|
||||
|
||||
bool IconManager::isCutItem(const KFileItem& item) const
|
||||
bool KFilePreviewGenerator::isCutItem(const KFileItem& item) const
|
||||
{
|
||||
const QMimeData* mimeData = QApplication::clipboard()->mimeData();
|
||||
const KUrl::List cutUrls = KUrl::List::fromMimeData(mimeData);
|
||||
|
@ -392,7 +392,7 @@ bool IconManager::isCutItem(const KFileItem& item) const
|
|||
return false;
|
||||
}
|
||||
|
||||
void IconManager::applyCutItemEffect()
|
||||
void KFilePreviewGenerator::applyCutItemEffect()
|
||||
{
|
||||
const QMimeData* mimeData = QApplication::clipboard()->mimeData();
|
||||
m_hasCutSelection = KonqMimeData::decodeIsCutSelection(mimeData);
|
||||
|
@ -432,7 +432,7 @@ void IconManager::applyCutItemEffect()
|
|||
}
|
||||
}
|
||||
|
||||
bool IconManager::applyImageFrame(QPixmap& icon)
|
||||
bool KFilePreviewGenerator::applyImageFrame(QPixmap& icon)
|
||||
{
|
||||
const QSize maxSize = m_view->iconSize();
|
||||
const bool applyFrame = (maxSize.width() > KIconLoader::SizeSmallMedium) &&
|
||||
|
@ -482,14 +482,14 @@ bool IconManager::applyImageFrame(QPixmap& icon)
|
|||
return true;
|
||||
}
|
||||
|
||||
void IconManager::limitToSize(QPixmap& icon, const QSize& maxSize)
|
||||
void KFilePreviewGenerator::limitToSize(QPixmap& icon, const QSize& maxSize)
|
||||
{
|
||||
if ((icon.width() > maxSize.width()) || (icon.height() > maxSize.height())) {
|
||||
icon = icon.scaled(maxSize, Qt::KeepAspectRatio, Qt::FastTransformation);
|
||||
}
|
||||
}
|
||||
|
||||
void IconManager::startPreviewJob(const KFileItemList& items)
|
||||
void KFilePreviewGenerator::startPreviewJob(const KFileItemList& items)
|
||||
{
|
||||
if (items.count() == 0) {
|
||||
return;
|
||||
|
@ -502,7 +502,7 @@ void IconManager::startPreviewJob(const KFileItemList& items)
|
|||
|
||||
// PreviewJob internally caches items always with the size of
|
||||
// 128 x 128 pixels or 256 x 256 pixels. A downscaling is done
|
||||
// by PreviewJob if a smaller size is requested. As the IconManager must
|
||||
// by PreviewJob if a smaller size is requested. As the KFilePreviewGenerator must
|
||||
// do a downscaling anyhow because of the frame, only the provided
|
||||
// cache sizes are requested.
|
||||
const int cacheSize = (size.width() > 128) || (size.height() > 128) ? 256 : 128;
|
||||
|
@ -516,7 +516,7 @@ void IconManager::startPreviewJob(const KFileItemList& items)
|
|||
m_previewTimer->start(200);
|
||||
}
|
||||
|
||||
void IconManager::killPreviewJobs()
|
||||
void KFilePreviewGenerator::killPreviewJobs()
|
||||
{
|
||||
foreach (KJob* job, m_previewJobs) {
|
||||
Q_ASSERT(job != 0);
|
||||
|
@ -525,7 +525,7 @@ void IconManager::killPreviewJobs()
|
|||
m_previewJobs.clear();
|
||||
}
|
||||
|
||||
void IconManager::orderItems(KFileItemList& items)
|
||||
void KFilePreviewGenerator::orderItems(KFileItemList& items)
|
||||
{
|
||||
// Order the items in a way that the preview for the visible items
|
||||
// is generated first, as this improves the feeled performance a lot.
|
||||
|
@ -593,4 +593,4 @@ void IconManager::orderItems(KFileItemList& items)
|
|||
}
|
||||
}
|
||||
|
||||
#include "iconmanager.moc"
|
||||
#include "kfilepreviewgenerator.moc"
|
|
@ -17,8 +17,8 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ICONMANAGER_H
|
||||
#define ICONMANAGER_H
|
||||
#ifndef KFILEPREVIEWGENERATOR_H
|
||||
#define KFILEPREVIEWGENERATOR_H
|
||||
|
||||
#include <kfileitem.h>
|
||||
#include <kurl.h>
|
||||
|
@ -49,13 +49,13 @@ class QAbstractItemView;
|
|||
* resumed. Also in this case the previews for the visible items
|
||||
* are generated first.
|
||||
*/
|
||||
class IconManager : public QObject
|
||||
class KFilePreviewGenerator : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
IconManager(QAbstractItemView* parent, KDirSortFilterProxyModel* model);
|
||||
virtual ~IconManager();
|
||||
KFilePreviewGenerator(QAbstractItemView* parent, KDirSortFilterProxyModel* model);
|
||||
virtual ~KFilePreviewGenerator();
|
||||
void setShowPreview(bool show);
|
||||
bool showPreview() const;
|
||||
|
||||
|
@ -101,7 +101,7 @@ private slots:
|
|||
void dispatchPreviewQueue();
|
||||
|
||||
/**
|
||||
* Pauses all preview jobs and invokes IconManager::resumePreviews()
|
||||
* Pauses all preview jobs and invokes KFilePreviewGenerator::resumePreviews()
|
||||
* after a short delay. Is invoked as soon as the user has moved
|
||||
* a scrollbar.
|
||||
*/
|
||||
|
@ -202,7 +202,7 @@ private:
|
|||
KFileItemList m_dispatchedItems;
|
||||
};
|
||||
|
||||
inline bool IconManager::showPreview() const
|
||||
inline bool KFilePreviewGenerator::showPreview() const
|
||||
{
|
||||
return m_showPreview;
|
||||
}
|
Loading…
Reference in a new issue