--- apps/plasma/applets/folderview/folderview.cpp.folderview 2010-09-12 21:29:57.000000000 +0200 +++ apps/plasma/applets/folderview/folderview.cpp 2010-09-15 02:59:08.000000000 +0200 @@ -343,6 +343,8 @@ m_filterFiles = cg.readEntry("filterFiles", "*"); m_filterType = cg.readEntry("filter", 0); m_filterFilesMimeList = cg.readEntry("mimeFilter", QStringList()); + m_firstLineFade = cg.readEntry("firstLineFade", true); + m_frameWidth = cg.readEntry("frameWidth", 0); m_userSelectedShowAllFiles = m_filterType; if (isContainment()) { @@ -524,6 +526,8 @@ uiDisplay.previewsAdvanced->setEnabled(m_showPreviews); uiDisplay.numLinesEdit->setValue(m_numTextLines); uiDisplay.colorButton->setColor(textColor()); + uiDisplay.firstLineFade->setChecked(m_firstLineFade); + uiDisplay.frameWidth->setValue(m_frameWidth); for (int i = 0; i < uiDisplay.sortCombo->maxCount(); i++) { if (m_sortColumn == uiDisplay.sortCombo->itemData(i).toInt()) { @@ -762,6 +766,14 @@ needReload = true; } + if (m_firstLineFade != uiDisplay.firstLineFade->isChecked()) { + m_firstLineFade = uiDisplay.firstLineFade->isChecked(); + cg.writeEntry("firstLineFade", m_firstLineFade); + } + + m_frameWidth = uiDisplay.frameWidth->value(); + cg.writeEntry("frameWidth", m_frameWidth); + if (m_iconView) { updateIconViewState(); } @@ -905,6 +917,8 @@ m_iconView->setWordWrap(m_numTextLines > 1); m_iconView->setAlignToGrid(m_alignToGrid); m_iconView->setIconsMoveable(!m_iconsLocked); + m_iconView->setFirstLineFade(m_firstLineFade); + m_iconView->setFrameWidth(m_frameWidth); if (m_label) { m_label->setPalette(palette); --- apps/plasma/applets/folderview/folderview.h.folderview 2010-08-11 12:08:04.000000000 +0200 +++ apps/plasma/applets/folderview/folderview.h 2010-09-15 02:59:08.000000000 +0200 @@ -191,6 +191,8 @@ bool m_iconsLocked; bool m_alignToGrid; bool m_userSelectedShowAllFiles; + bool m_firstLineFade; + int m_frameWidth; QString m_customLabel; QStringList m_previewPlugins; int m_customIconSize; --- apps/plasma/applets/folderview/folderviewDisplayConfig.ui.folderview 2010-05-27 19:22:58.000000000 +0200 +++ apps/plasma/applets/folderview/folderviewDisplayConfig.ui 2010-09-15 03:00:29.000000000 +0200 @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>442</width> - <height>401</height> + <width>454</width> + <height>405</height> </rect> </property> <layout class="QGridLayout" name="gridLayout"> @@ -65,7 +65,7 @@ </property> </widget> </item> - <item row="1" column="2" colspan="2"> + <item row="1" column="2"> <widget class="KLineEdit" name="labelEdit"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> @@ -105,7 +105,7 @@ </property> </widget> </item> - <item row="3" column="0" rowspan="6"> + <item row="3" column="0" rowspan="5"> <spacer name="horizontalSpacer_3"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -161,7 +161,7 @@ </property> </widget> </item> - <item row="4" column="3"> + <item row="4" column="3" colspan="2"> <spacer name="horizontalSpacer_7"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -231,6 +231,56 @@ </layout> </item> <item row="6" column="1"> + <widget class="QLabel" name="label_15"> + <property name="text"> + <string>Frame width:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="6" column="2" colspan="2"> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <item> + <widget class="QLabel" name="label_20"> + <property name="text"> + <string>Normal</string> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="frameWidth"> + <property name="whatsThis"> + <string>Use this icon to increase the width of the icon frame.</string> + </property> + <property name="maximum"> + <number>48</number> + </property> + <property name="singleStep"> + <number>4</number> + </property> + <property name="pageStep"> + <number>8</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksBelow</enum> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_21"> + <property name="text"> + <string>Large</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="7" column="1"> <widget class="QLabel" name="label_8"> <property name="text"> <string>Previews:</string> @@ -240,7 +290,7 @@ </property> </widget> </item> - <item row="6" column="2" colspan="2"> + <item row="7" column="2" colspan="3"> <layout class="QHBoxLayout" name="horizontalLayout_2"> <item> <widget class="QCheckBox" name="showPreviews"> @@ -277,7 +327,7 @@ </item> </layout> </item> - <item row="7" column="1"> + <item row="8" column="1"> <widget class="QLabel" name="label_11"> <property name="text"> <string>Lock in place:</string> @@ -287,7 +337,7 @@ </property> </widget> </item> - <item row="7" column="2"> + <item row="8" column="2"> <widget class="QCheckBox" name="lockInPlace"> <property name="whatsThis"> <string>Check this option if you do not want the icons to be moveable in the view. @@ -299,7 +349,7 @@ </property> </widget> </item> - <item row="8" column="1"> + <item row="9" column="1"> <widget class="QLabel" name="label_12"> <property name="text"> <string>Align to grid:</string> @@ -309,7 +359,7 @@ </property> </widget> </item> - <item row="8" column="2"> + <item row="9" column="2"> <widget class="QCheckBox" name="alignToGrid"> <property name="whatsThis"> <string>Check this option if you want the icons to be arranged in a grid. @@ -321,7 +371,7 @@ </property> </widget> </item> - <item row="9" column="0" colspan="2"> + <item row="10" column="0" colspan="2"> <widget class="QLabel" name="label_9"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> @@ -340,7 +390,7 @@ </property> </widget> </item> - <item row="10" column="1"> + <item row="11" column="1"> <widget class="QLabel" name="label_3"> <property name="text"> <string>Lines:</string> @@ -353,7 +403,7 @@ </property> </widget> </item> - <item row="10" column="2"> + <item row="11" column="2"> <widget class="KIntSpinBox" name="numLinesEdit"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> @@ -378,7 +428,7 @@ </property> </widget> </item> - <item row="11" column="0"> + <item row="12" column="0"> <spacer name="horizontalSpacer_4"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -394,7 +444,7 @@ </property> </spacer> </item> - <item row="11" column="1"> + <item row="12" column="1"> <widget class="QLabel" name="label_2"> <property name="text"> <string>Color:</string> @@ -407,7 +457,7 @@ </property> </widget> </item> - <item row="11" column="2"> + <item row="12" column="2"> <widget class="KColorButton" name="colorButton"> <property name="whatsThis"> <string>Click this button to choose the color which is used for the text labels in the view.</string> @@ -417,7 +467,7 @@ </property> </widget> </item> - <item row="12" column="1"> + <item row="13" column="1"> <widget class="QLabel" name="label_10"> <property name="text"> <string>Shadows:</string> @@ -430,7 +480,7 @@ </property> </widget> </item> - <item row="12" column="2"> + <item row="13" column="2"> <widget class="QCheckBox" name="drawShadows"> <property name="whatsThis"> <string><html><body><p>Check this option if you want the text labels to cast a shadow on the background.</p> @@ -444,7 +494,27 @@ </property> </widget> </item> - <item row="13" column="3"> + <item row="14" column="1"> + <widget class="QLabel" name="label_14"> + <property name="text"> + <string>First line fading: </string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="14" column="2"> + <widget class="QCheckBox" name="firstLineFade"> + <property name="whatsThis"> + <string>With this option enabled, the text of an icon will have the fadding effect on the first line.</string> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="15" column="4"> <spacer name="verticalSpacer_2"> <property name="orientation"> <enum>Qt::Vertical</enum> --- apps/plasma/applets/folderview/iconview.cpp.folderview 2010-09-12 21:29:57.000000000 +0200 +++ apps/plasma/applets/folderview/iconview.cpp 2010-09-15 03:02:09.000000000 +0200 @@ -63,6 +63,7 @@ IconView::IconView(QGraphicsWidget *parent) : AbstractItemView(parent), + m_frameWidth(0), m_itemFrame(0), m_columns(0), m_rows(0), @@ -78,6 +79,7 @@ m_alignToGrid(false), m_wordWrap(false), m_popupShowPreview(true), + m_firstLineFade(true), m_folderIsEmpty(false), m_clickToViewFolders(true), m_flow(layoutDirection() == Qt::LeftToRight ? LeftToRight : RightToLeft), @@ -313,7 +315,7 @@ int w = qMin(fm.width('x') * 15, m_iconSize.width() * 2); QSize size; - size.rwidth() = qMax(w, m_iconSize.width()) + left + right; + size.rwidth() = qMax(w, m_iconSize.width()) + left + right + m_frameWidth; size.rheight() = top + bottom + m_iconSize.height() + fm.lineSpacing() * textLineCount() + 4; // Update the minimum size hint @@ -981,6 +983,27 @@ } } +void IconView::setFirstLineFade(bool on) +{ + if (m_firstLineFade != on) + m_firstLineFade = on; + markAreaDirty(visibleArea()); + update(); +} + +bool IconView::firstLineFade() const +{ + return m_firstLineFade; +} + +void IconView::setFrameWidth(const int width) +{ + if (width != m_frameWidth){ + m_frameWidth = width; + updateGridSize(); + } +} + QSize IconView::itemSize(const QStyleOptionViewItemV4 &option, const QModelIndex &index) const { QSize size = option.decorationSize; @@ -1004,7 +1027,11 @@ layout.setFont(font); const QSize ts = doTextLayout(layout, QSize(grid.width() - left - right, grid.height() - size.height()), - Qt::AlignHCenter, QTextOption::WrapAtWordBoundaryOrAnywhere); + Qt::AlignHCenter, + (m_firstLineFade) + ? QTextOption::WordWrap + : QTextOption::WrapAtWordBoundaryOrAnywhere + ); size.rwidth() = qMax(size.width(), ts.width()); size.rheight() += ts.height(); @@ -1072,7 +1099,10 @@ layout.setText(KStringHandler::preProcessWrap(text)); layout.setFont(font); const QSize size = doTextLayout(layout, tr.size(), Qt::AlignHCenter, - QTextOption::WrapAtWordBoundaryOrAnywhere); + (m_firstLineFade) + ? QTextOption::WordWrap + : QTextOption::WrapAtWordBoundaryOrAnywhere + ); painter->setPen(option.palette.color(QPalette::Text)); drawTextLayout(painter, layout, tr); @@ -1331,7 +1361,10 @@ layout.setText(index.data(Qt::DisplayRole).toString()); layout.setFont(font()); const QSize ts = doTextLayout(layout, tr.size(), Qt::AlignHCenter, - QTextOption::WrapAtWordBoundaryOrAnywhere); + (m_firstLineFade) + ? QTextOption::WordWrap + : QTextOption::WrapAtWordBoundaryOrAnywhere + ); tr = QStyle::alignedRect(layoutDirection(), Qt::AlignTop | Qt::AlignHCenter, ts, tr); // Extend the icon rect so it touches the text rect --- apps/plasma/applets/folderview/iconview.h.folderview 2010-09-12 21:29:57.000000000 +0200 +++ apps/plasma/applets/folderview/iconview.h 2010-09-15 03:03:05.000000000 +0200 @@ -67,6 +67,7 @@ Q_PROPERTY(bool iconsMoveable READ iconsMoveable WRITE setIconsMoveable) Q_PROPERTY(bool customLayout READ customLayout WRITE setCustomLayout) Q_PROPERTY(Flow flow READ flow WRITE setFlow) + Q_PROPERTY(bool firstLineFade READ firstLineFade WRITE setFirstLineFade) public: IconView(QGraphicsWidget *parent); @@ -82,6 +83,11 @@ void setWordWrap(bool on); bool wordWrap() const; + void setFirstLineFade(bool on); + bool firstLineFade() const; + + void setFrameWidth(const int width); + void setTextLineCount(int rows); int textLineCount() const; @@ -233,6 +239,8 @@ bool m_popupShowPreview; bool m_folderIsEmpty; bool m_clickToViewFolders; + bool m_firstLineFade; + int m_frameWidth; QPersistentModelIndex m_hoveredIndex; QPersistentModelIndex m_pressedIndex; QPersistentModelIndex m_editorIndex;