add a "Sort order" combo to the Display config page

Allow the user to change sorting order using the Settings dialog.
This commit is contained in:
Ignat Semenov 2013-03-26 14:12:50 +04:00
parent 35da405097
commit 7e2883afcf
2 changed files with 360 additions and 306 deletions

View file

@ -737,6 +737,9 @@ void FolderView::createConfigurationInterface(KConfigDialog *parent)
uiDisplay.sortCombo->addItem(KGlobal::locale()->removeAcceleratorMarker(m_actionCollection.action("sort_type")->text()), KDirModel::Type);
uiDisplay.sortCombo->addItem(KGlobal::locale()->removeAcceleratorMarker(m_actionCollection.action("sort_date")->text()), KDirModel::ModifiedTime);
uiDisplay.directionCombo->addItem(KGlobal::locale()->removeAcceleratorMarker(m_actionCollection.action("sort_ascending")->text()), QVariant::fromValue(Qt::AscendingOrder));
uiDisplay.directionCombo->addItem(KGlobal::locale()->removeAcceleratorMarker(m_actionCollection.action("sort_descending")->text()), QVariant::fromValue(Qt::DescendingOrder));
uiDisplay.flowCombo->addItem(KGlobal::locale()->removeAcceleratorMarker(m_actionCollection.action("arrange_ver_ltr")->text()), QVariant::fromValue(IconView::VerLeftToRight));
uiDisplay.flowCombo->addItem(KGlobal::locale()->removeAcceleratorMarker(m_actionCollection.action("arrange_ver_rtl")->text()), QVariant::fromValue(IconView::VerRightToLeft));
uiDisplay.flowCombo->addItem(KGlobal::locale()->removeAcceleratorMarker(m_actionCollection.action("arrange_hor_ltr")->text()), QVariant::fromValue(IconView::HorLeftToRight));
@ -822,6 +825,7 @@ void FolderView::createConfigurationInterface(KConfigDialog *parent)
connect(uiDisplay.flowCombo, SIGNAL(currentIndexChanged(int)), parent, SLOT(settingsModified()));
connect(uiDisplay.sortCombo, SIGNAL(currentIndexChanged(int)), parent, SLOT(settingsModified()));
connect(uiDisplay.directionCombo, SIGNAL(currentIndexChanged(int)), parent, SLOT(settingsModified()));
connect(uiDisplay.sizeSlider, SIGNAL(valueChanged(int)), parent, SLOT(settingsModified()));
connect(uiDisplay.showPreviews, SIGNAL(toggled(bool)), parent, SLOT(settingsModified()));
connect(uiDisplay.lockInPlace, SIGNAL(toggled(bool)), parent, SLOT(settingsModified()));
@ -893,6 +897,9 @@ void FolderView::configAccepted()
const int sortColumn = uiDisplay.sortCombo->itemData(uiDisplay.sortCombo->currentIndex()).toInt();
cg.writeEntry("sortColumn", sortColumn);
const Qt::SortOrder order = uiDisplay.directionCombo->itemData(uiDisplay.directionCombo->currentIndex()).value<Qt::SortOrder>();
cg.writeEntry("sortOrder", sortOrderEnumToString(order));
const IconView::Flow flow = uiDisplay.flowCombo->itemData(uiDisplay.flowCombo->currentIndex()).value<IconView::Flow>();
cg.writeEntry("flow", static_cast<int>(flow));

View file

@ -7,67 +7,10 @@
<x>0</x>
<y>0</y>
<width>442</width>
<height>401</height>
<height>430</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="5" column="1">
<widget class="QLabel" name="lockInPlaceLabel">
<property name="text">
<string>Lock in place:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="previewsAdvancedLabel">
<property name="text">
<string>Previews:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLabel" name="numLinesEditLabel">
<property name="text">
<string>Lines:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>numLinesEdit</cstring>
</property>
</widget>
</item>
<item row="5" 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.
This option is useful if you want to avoid accidentally moving the icons while interacting with them.</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" 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.
When this option is checked, icons will automatically snap to the nearest grid cell when you move them around in the view.</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="iconsTitle">
<property name="sizePolicy">
@ -87,249 +30,6 @@ When this option is checked, icons will automatically snap to the nearest grid c
</property>
</widget>
</item>
<item row="4" column="2" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QCheckBox" name="showPreviews">
<property name="whatsThis">
<string>Check this option if you want to see previews of the file contents in the icons.</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="previewsAdvanced">
<property name="whatsThis">
<string>Click this button to choose for which types of files previews will be shown.</string>
</property>
<property name="text">
<string>More Preview Options...</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="11" column="1">
<widget class="QLabel" name="drawShadowsLabel">
<property name="text">
<string>Shadows:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>numLinesEdit</cstring>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QCheckBox" name="clickToView">
<property name="whatsThis">
<string>Check this option if you want folder previews to appear only when clicked. When this option is turned off, folder previews will appear automatically when the mouse hovers over a folder.</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="alignToGridLabel">
<property name="text">
<string>Align to grid:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="KComboBox" name="flowCombo">
<property name="whatsThis">
<string>Use this control to choose if you want the icons to be arranged top to bottom starting on the left side of the view, or arranged left to right starting at the top of the view.</string>
</property>
</widget>
</item>
<item row="10" 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>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="KComboBox" name="sortCombo">
<property name="whatsThis">
<string>Use this control to choose the criteria by which the icons will be sorted in the view.</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QLabel" name="colorButtonLabel">
<property name="text">
<string>Color:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>colorButton</cstring>
</property>
</widget>
</item>
<item row="2" column="3">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>160</width>
<height>23</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QLabel" name="flowLabel">
<property name="text">
<string>Arrangement:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>flowCombo</cstring>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="clickToViewLabel">
<property name="text">
<string>Click to view folder:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="11" column="2">
<widget class="QCheckBox" name="drawShadows">
<property name="whatsThis">
<string>&lt;html&gt;&lt;body&gt;&lt;p&gt;Check this option if you want the text labels to cast a shadow on the background.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Shadows help make the text easier to read by making it stand out more from the background.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Note that with dark text colors, this option will cause the text to glow with a bright halo, instead of casting a shadow.&lt;/i&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="12" column="3">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>44</width>
<height>216</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<widget class="QLabel" name="sizeSliderLabel">
<property name="text">
<string>Size:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>sizeSlider</cstring>
</property>
</widget>
</item>
<item row="9" column="2">
<widget class="KIntSpinBox" name="numLinesEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="whatsThis">
<string>Use this control to choose how many lines of text will be shown below the icons.</string>
</property>
<property name="specialValueText">
<string>1 line</string>
</property>
<property name="suffix">
<string> lines</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>10</number>
</property>
</widget>
</item>
<item row="10" column="0">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>12</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="8" column="0" colspan="2">
<widget class="QLabel" name="iconTextTitle">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Icon Text</string>
</property>
</widget>
</item>
<item row="1" column="0" rowspan="6">
<spacer name="horizontalSpacer_3">
<property name="orientation">
@ -346,7 +46,106 @@ When this option is checked, icons will automatically snap to the nearest grid c
</property>
</spacer>
</item>
<item row="3" column="2" colspan="2">
<item row="1" column="2">
<widget class="QLabel" name="flowLabel">
<property name="text">
<string>Arrangement:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>flowCombo</cstring>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="KComboBox" name="flowCombo">
<property name="whatsThis">
<string>Use this control to choose if you want the icons to be arranged top to bottom starting on the left side of the view, or arranged left to right starting at the top of the view.</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="sortLabel">
<property name="text">
<string>Sorting:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>sortCombo</cstring>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="KComboBox" name="sortCombo">
<property name="whatsThis">
<string>Use this control to choose the criteria by which the icons will be sorted in the view.</string>
</property>
</widget>
</item>
<item row="2" column="4" colspan="2">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>160</width>
<height>23</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2">
<widget class="QLabel" name="directionLabel">
<property name="text">
<string>Direction:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>directionCombo</cstring>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="KComboBox" name="directionCombo">
<property name="whatsThis">
<string>Use this control to choose the criteria by which the icons will be sorted in the view.</string>
</property>
</widget>
</item>
<item row="3" column="4" colspan="2">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>208</width>
<height>23</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="1">
<widget class="QLabel" name="sizeSliderLabel">
<property name="text">
<string>Size:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>sizeSlider</cstring>
</property>
</widget>
</item>
<item row="4" column="3" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_5">
@ -389,19 +188,253 @@ When this option is checked, icons will automatically snap to the nearest grid c
</item>
</layout>
</item>
<item row="2" column="1">
<widget class="QLabel" name="sortLabel">
<item row="5" column="1" colspan="2">
<widget class="QLabel" name="previewsAdvancedLabel">
<property name="text">
<string>Sorting:</string>
<string>Previews:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="3" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QCheckBox" name="showPreviews">
<property name="whatsThis">
<string>Check this option if you want to see previews of the file contents in the icons.</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="previewsAdvanced">
<property name="whatsThis">
<string>Click this button to choose for which types of files previews will be shown.</string>
</property>
<property name="text">
<string>More Preview Options...</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="6" column="1" colspan="2">
<widget class="QLabel" name="lockInPlaceLabel">
<property name="text">
<string>Lock in place:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="3">
<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.
This option is useful if you want to avoid accidentally moving the icons while interacting with them.</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="7" column="1" colspan="2">
<widget class="QLabel" name="alignToGridLabel">
<property name="text">
<string>Align to grid:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="7" column="3">
<widget class="QCheckBox" name="alignToGrid">
<property name="whatsThis">
<string>Check this option if you want the icons to be arranged in a grid.
When this option is checked, icons will automatically snap to the nearest grid cell when you move them around in the view.</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="8" column="1" colspan="2">
<widget class="QLabel" name="clickToViewLabel">
<property name="text">
<string>Click to view folder:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="8" column="3">
<widget class="QCheckBox" name="clickToView">
<property name="whatsThis">
<string>Check this option if you want folder previews to appear only when clicked. When this option is turned off, folder previews will appear automatically when the mouse hovers over a folder.</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="9" column="0" colspan="3">
<widget class="QLabel" name="iconTextTitle">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Icon Text</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QLabel" name="numLinesEditLabel">
<property name="text">
<string>Lines:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>sortCombo</cstring>
<cstring>numLinesEdit</cstring>
</property>
</widget>
</item>
<item row="10" column="3">
<widget class="KIntSpinBox" name="numLinesEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="whatsThis">
<string>Use this control to choose how many lines of text will be shown below the icons.</string>
</property>
<property name="specialValueText">
<string>1 line</string>
</property>
<property name="suffix">
<string> lines</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>10</number>
</property>
</widget>
</item>
<item row="11" column="0">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>12</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="11" column="1">
<widget class="QLabel" name="colorButtonLabel">
<property name="text">
<string>Color:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>colorButton</cstring>
</property>
</widget>
</item>
<item row="11" column="3">
<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>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="12" column="1" colspan="2">
<widget class="QLabel" name="drawShadowsLabel">
<property name="text">
<string>Shadows:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>numLinesEdit</cstring>
</property>
</widget>
</item>
<item row="12" column="3">
<widget class="QCheckBox" name="drawShadows">
<property name="whatsThis">
<string>&lt;html&gt;&lt;body&gt;&lt;p&gt;Check this option if you want the text labels to cast a shadow on the background.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Shadows help make the text easier to read by making it stand out more from the background.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Note that with dark text colors, this option will cause the text to glow with a bright halo, instead of casting a shadow.&lt;/i&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="13" column="5">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>44</width>
<height>216</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
@ -421,6 +454,20 @@ When this option is checked, icons will automatically snap to the nearest grid c
<header>knuminput.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>flowCombo</tabstop>
<tabstop>sortCombo</tabstop>
<tabstop>directionCombo</tabstop>
<tabstop>sizeSlider</tabstop>
<tabstop>showPreviews</tabstop>
<tabstop>previewsAdvanced</tabstop>
<tabstop>lockInPlace</tabstop>
<tabstop>alignToGrid</tabstop>
<tabstop>clickToView</tabstop>
<tabstop>numLinesEdit</tabstop>
<tabstop>colorButton</tabstop>
<tabstop>drawShadows</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>