- 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
<label>Bold</label>
<default>false</default>
</entry>
- <entry name="GridHeight" type="Int">
- <label>Grid height</label>
- <default code="true">K3Icon::SizeMedium + (KGlobalSettings::generalFont().pointSize() * 3)</default>
- </entry>
- <entry name="GridWidth" type="Int">
- <label>Grid width</label>
- <default>128</default>
+ <entry name="ItemHeight" type="Int">
+ <label>Item height</label>
+ <!--
+ check 'void IconsViewSettingsPage::applySettings()' as reference (iconsviewsettingspage.cpp):
+ itemHeight += fontHeight * numberOfTextlines + 16;
+ /-->
+ <default code="true">K3Icon::SizeMedium + (QFontMetrics(KGlobalSettings::generalFont()).height() * 2) + 16</default>
+ </entry>
+ <entry name="ItemWidth" type="Int">
+ <label>Item width</label>
+ <!--
+ check 'void IconsViewSettingsPage::applySettings()' as reference (iconsviewsettingspage.cpp):
+ itemWidth = TopToBottomBase + textSizeIndex * TopToBottomInc;
+ /-->
+ <default>96</default>
</entry>
<entry name="GridSpacing" type="Int">
<label>Grid spacing</label>
</entry>
<entry name="NumberOfTextlines" type="Int">
<label>Number of textlines</label>
- <default>1</default>
- </entry>
- <entry name="Preview" type="Bool">
- <label>Show preview</label>
- <default>true</default>
+ <default>2</default>
</entry>
<entry name="PreviewSize" type="Int">
<label>Preview size</label>
// 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());
}
// 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());
}
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());
const bool leftToRightArrangement = (settings->arrangement() == QListView::LeftToRight);
int textWidthIndex = 0;
- const int remainingWidth = settings->gridWidth() - settings->iconSize();
+ const int remainingWidth = settings->itemWidth() - settings->iconSize();
if (leftToRightArrangement) {
textWidthIndex = (remainingWidth - LeftToRightBase) / LeftToRightInc;
} else {
settings->setPreviewSize(m_previewSize);
const QFont font = m_fontRequester->font();
- const int fontSize = font.pointSize();
+ const int fontHeight = QFontMetrics(font).height();
const int arrangement = (m_arrangementBox->currentIndex() == 0) ?
QListView::LeftToRight :
const int numberOfTextlines = m_textlinesCountBox->value();
const int defaultSize = settings->iconSize();
- int gridWidth = defaultSize;
- int gridHeight = defaultSize;
+ int itemWidth = defaultSize;
+ int itemHeight = defaultSize;
const int textSizeIndex = m_textWidthBox->currentIndex();
if (arrangement == QListView::TopToBottom) {
- gridWidth += TopToBottomBase + textSizeIndex * TopToBottomInc;
- gridHeight += fontSize * (2 + numberOfTextlines);
+ itemWidth += TopToBottomBase + textSizeIndex * TopToBottomInc;
+ itemHeight += fontHeight * numberOfTextlines + 16;
} else {
- gridWidth += LeftToRightBase + textSizeIndex * LeftToRightInc;
+ itemWidth += LeftToRightBase + textSizeIndex * LeftToRightInc;
}
- settings->setGridWidth(gridWidth);
- settings->setGridHeight(gridHeight);
+ settings->setItemWidth(itemWidth);
+ settings->setItemHeight(itemHeight);
settings->setFontFamily(font.family());
- settings->setFontSize(fontSize);
+ settings->setFontSize(font.pointSize());
settings->setItalicFont(font.italic());
settings->setBoldFont(font.bold());
GridSpacingInc = 24,
LeftToRightBase = 128,
LeftToRightInc = 64,
- TopToBottomBase = 96,
+ TopToBottomBase = 64,
TopToBottomInc = 32
};