From 91f03ab07b894ef37864c9c5a1552b48b38f40ee Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Tue, 15 May 2007 20:24:56 +0000 Subject: some finetuning for the icons view: - rename gridWidth() and gridHeight() settings property to itemWidth() and itemHeight() to avoid confusion with the grid size property of QListView - assure that the grid spacing is respected - decrease default text width - allow having more than 1 text line doing a proper wrapping svn path=/trunk/KDE/kdebase/apps/; revision=665097 --- src/dolphiniconsview.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'src/dolphiniconsview.cpp') diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp index 6d2ca66a0..c80a58b6b 100644 --- a/src/dolphiniconsview.cpp +++ b/src/dolphiniconsview.cpp @@ -162,8 +162,8 @@ void DolphinIconsView::zoomIn() // increase also the grid size const int diff = newIconSize - oldIconSize; - settings->setGridWidth(settings->gridWidth() + diff); - settings->setGridHeight(settings->gridHeight() + diff); + settings->setItemWidth(settings->itemWidth() + diff); + settings->setItemHeight(settings->itemHeight() + diff); updateGridSize(showPreview, m_controller->showAdditionalInfo()); } @@ -193,8 +193,8 @@ void DolphinIconsView::zoomOut() // decrease also the grid size const int diff = oldIconSize - newIconSize; - settings->setGridWidth(settings->gridWidth() - diff); - settings->setGridHeight(settings->gridHeight() - diff); + settings->setItemWidth(settings->itemWidth() - diff); + settings->setItemHeight(settings->itemHeight() - diff); updateGridSize(showPreview, m_controller->showAdditionalInfo()); } @@ -249,26 +249,31 @@ void DolphinIconsView::updateGridSize(bool showPreview, bool showAdditionalInfo) const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings(); Q_ASSERT(settings != 0); - int gridWidth = settings->gridWidth(); - int gridHeight = settings->gridHeight(); + int itemWidth = settings->itemWidth(); + int itemHeight = settings->itemHeight(); int size = settings->iconSize(); if (showPreview) { const int previewSize = settings->previewSize(); const int diff = previewSize - size; Q_ASSERT(diff >= 0); - gridWidth += diff; - gridHeight += diff; + itemWidth += diff; + itemHeight += diff; size = previewSize; } if (showAdditionalInfo) { - gridHeight += m_viewOptions.font.pointSize() * 2; + itemHeight += m_viewOptions.font.pointSize() * 2; } - m_viewOptions.decorationSize = QSize(size, size); - setGridSize(QSize(gridWidth, gridHeight)); + // The decoration width indirectly defines the maximum + // width for the text wrapping. To use the maximum item width + // for text wrapping, it is used as decoration width. + m_viewOptions.decorationSize = QSize(itemWidth, size); + + const int spacing = settings->gridSpacing(); + setGridSize(QSize(itemWidth + spacing, itemHeight + spacing)); m_controller->setZoomInPossible(isZoomInPossible()); m_controller->setZoomOutPossible(isZoomOutPossible()); -- cgit v1.3