diff options
| author | Peter Penz <[email protected]> | 2007-02-28 19:17:26 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2007-02-28 19:17:26 +0000 |
| commit | a46551d63efd09b34fe33766533f6f5333737f22 (patch) | |
| tree | 219c1a0793f47e43079a1e3d7f7a7e1caf2ca3a1 /src/dolphiniconsview.cpp | |
| parent | d38fc64a9f54747f07ca483f68b69f614abcf9f6 (diff) | |
Jippie: file previews are generated again! Thanks to Fredrik for giving me a hint how to do it (if I would have known that it is so easy, I'd have implemented it already some weeks ago...). It's very nice that the details view now also is able to show previews (Kudos to Interview & KDirModel).
svn path=/trunk/KDE/kdebase/apps/; revision=638081
Diffstat (limited to 'src/dolphiniconsview.cpp')
| -rw-r--r-- | src/dolphiniconsview.cpp | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp index a6da79836..a9328172d 100644 --- a/src/dolphiniconsview.cpp +++ b/src/dolphiniconsview.cpp @@ -34,24 +34,24 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle QListView(parent), m_controller(controller) { - assert(controller != 0); + Q_ASSERT(controller != 0); setViewMode(QListView::IconMode); setResizeMode(QListView::Adjust); connect(this, SIGNAL(clicked(const QModelIndex&)), controller, SLOT(triggerItem(const QModelIndex&))); + connect(controller, SIGNAL(showPreviewChanged(bool)), + this, SLOT(updateGridSize(bool))); // apply the icons mode settings to the widget const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings(); - assert(settings != 0); + Q_ASSERT(settings != 0); - setGridSize(QSize(settings->gridWidth(), settings->gridHeight())); setSpacing(settings->gridSpacing()); m_viewOptions = QListView::viewOptions(); m_viewOptions.font = QFont(settings->fontFamily(), settings->fontSize()); - const int iconSize = settings->iconSize(); - m_viewOptions.decorationSize = QSize(iconSize, iconSize); + updateGridSize(controller->showPreview()); if (settings->arrangement() == QListView::TopToBottom) { setFlow(QListView::LeftToRight); @@ -103,4 +103,28 @@ void DolphinIconsView::dropEvent(QDropEvent* event) } } +void DolphinIconsView::updateGridSize(bool showPreview) +{ + const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings(); + Q_ASSERT(settings != 0); + + int gridWidth = settings->gridWidth(); + int gridHeight = settings->gridHeight(); + int size = settings->iconSize(); + + if (showPreview) { + const int previewSize = settings->previewSize(); + const int diff = previewSize - size; + Q_ASSERT(diff >= 0); + gridWidth += diff; + gridHeight += diff; + + size = previewSize; + } + + + m_viewOptions.decorationSize = QSize(size, size); + setGridSize(QSize(gridWidth, gridHeight)); +} + #include "dolphiniconsview.moc" |
