Changeset View
Changeset View
Standalone View
Standalone View
src/settings/general/behaviorsettingspage.cpp
Show All 15 Lines | |||||
16 | * along with this program; if not, write to the * | 16 | * along with this program; if not, write to the * | ||
17 | * Free Software Foundation, Inc., * | 17 | * Free Software Foundation, Inc., * | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * | 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * | ||
19 | ***************************************************************************/ | 19 | ***************************************************************************/ | ||
20 | 20 | | |||
21 | #include "behaviorsettingspage.h" | 21 | #include "behaviorsettingspage.h" | ||
22 | 22 | | |||
23 | #include "views/viewproperties.h" | 23 | #include "views/viewproperties.h" | ||
24 | 24 | | |||
elvisangelaccio: Please put it before viewproperties.h (again, to preserver sorting of includes) | |||||
25 | #include <KLocalizedString> | 25 | #include <KLocalizedString> | ||
26 | 26 | | |||
27 | #include <QButtonGroup> | ||||
27 | #include <QCheckBox> | 28 | #include <QCheckBox> | ||
28 | #include <QGroupBox> | 29 | #include <QGroupBox> | ||
30 | #include <QLabel> | ||||
29 | #include <QRadioButton> | 31 | #include <QRadioButton> | ||
elvisangelaccio: Please keep the sorting of includes | |||||
30 | #include <QVBoxLayout> | 32 | #include <QFormLayout> | ||
33 | #include <QSpacerItem> | ||||
31 | 34 | | |||
32 | BehaviorSettingsPage::BehaviorSettingsPage(const QUrl& url, QWidget* parent) : | 35 | BehaviorSettingsPage::BehaviorSettingsPage(const QUrl& url, QWidget* parent) : | ||
33 | SettingsPageBase(parent), | 36 | SettingsPageBase(parent), | ||
34 | m_url(url), | 37 | m_url(url), | ||
35 | m_localViewProps(nullptr), | 38 | m_localViewProps(nullptr), | ||
36 | m_globalViewProps(nullptr), | 39 | m_globalViewProps(nullptr), | ||
37 | m_showToolTips(nullptr), | 40 | m_showToolTips(nullptr), | ||
38 | m_showSelectionToggle(nullptr), | 41 | m_showSelectionToggle(nullptr), | ||
39 | m_naturalSorting(nullptr), | 42 | m_naturalSorting(nullptr), | ||
40 | m_caseSensitiveSorting(nullptr), | 43 | m_caseSensitiveSorting(nullptr), | ||
41 | m_caseInsensitiveSorting(nullptr), | 44 | m_caseInsensitiveSorting(nullptr), | ||
42 | m_renameInline(nullptr), | 45 | m_renameInline(nullptr), | ||
43 | m_useTabForSplitViewSwitch(nullptr) | 46 | m_useTabForSplitViewSwitch(nullptr) | ||
44 | { | 47 | { | ||
45 | QVBoxLayout* topLayout = new QVBoxLayout(this); | 48 | QFormLayout* topLayout = new QFormLayout(this); | ||
49 | topLayout->setSizeConstraint(QLayout::SetMinimumSize); | ||||
50 | | ||||
46 | 51 | | |||
47 | // View properties | 52 | // View properties | ||
48 | QGroupBox* viewPropsBox = new QGroupBox(i18nc("@title:group", "View"), this); | 53 | m_localViewProps = new QRadioButton(i18nc("@option:radio", "Remember properties for each folder")); | ||
49 | viewPropsBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); | 54 | m_globalViewProps = new QRadioButton(i18nc("@option:radio", "Use common properties for all folders")); | ||
55 | | ||||
56 | QButtonGroup* viewGroup = new QButtonGroup(this); | ||||
57 | viewGroup->addButton(m_localViewProps); | ||||
58 | viewGroup->addButton(m_globalViewProps); | ||||
59 | topLayout->addRow(i18nc("@title:group", "View: "), m_localViewProps); | ||||
60 | topLayout->addRow(QString(), m_globalViewProps); | ||||
61 | | ||||
50 | 62 | | |||
51 | m_localViewProps = new QRadioButton(i18nc("@option:radio", "Remember properties for each folder"), viewPropsBox); | 63 | topLayout->addItem(new QSpacerItem(0,12, QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
52 | m_globalViewProps = new QRadioButton(i18nc("@option:radio", "Use common properties for all folders"), viewPropsBox); | | |||
53 | 64 | | |||
54 | QVBoxLayout* viewPropsLayout = new QVBoxLayout(viewPropsBox); | | |||
55 | viewPropsLayout->addWidget(m_localViewProps); | | |||
56 | viewPropsLayout->addWidget(m_globalViewProps); | | |||
57 | 65 | | |||
58 | // Sorting properties | 66 | // Sorting properties | ||
59 | QGroupBox* sortingPropsBox = new QGroupBox(i18nc("@title:group", "Sorting Mode"), this); | 67 | m_naturalSorting = new QRadioButton(i18nc("option:radio", "Natural")); | ||
60 | sortingPropsBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); | 68 | m_caseInsensitiveSorting = new QRadioButton(i18nc("option:radio", "Alphabetical, case insensitive")); | ||
69 | m_caseSensitiveSorting = new QRadioButton(i18nc("option:radio", "Alphabetical, case sensitive")); | ||||
70 | | ||||
71 | QButtonGroup* sortingModeGroup = new QButtonGroup(this); | ||||
72 | sortingModeGroup->addButton(m_naturalSorting); | ||||
73 | sortingModeGroup->addButton(m_caseInsensitiveSorting); | ||||
74 | sortingModeGroup->addButton(m_caseSensitiveSorting); | ||||
75 | topLayout->addRow(i18nc("@title:group", "Sorting mode: "), m_naturalSorting); | ||||
76 | topLayout->addRow(QString(), m_caseInsensitiveSorting); | ||||
77 | topLayout->addRow(QString(), m_caseSensitiveSorting); | ||||
78 | | ||||
79 | | ||||
80 | topLayout->addItem(new QSpacerItem(0,12, QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||||
Please add a global variable instead of hardcoding 18 in different places. /OT elvisangelaccio: Please add a global variable instead of hardcoding 18 in different places.
/OT
Does this 18… | |||||
Yes, 18 comes from the HIG. That's the "default px representation" for plasmas and kirigamis gridUnit. fabianr: Yes, 18 comes from the HIG. That's the "default px representation" for plasmas and kirigamis… | |||||
I've added this to a Dolphin-wide global for now, but it seems like it might make more sense to put it in an even more global location. Maybe in KXMLGui? Or somewhere else? I can submit a patch for it if you think that makes sense. ngraham: @elvisangelaccio
I've added this to a Dolphin-wide global for now, but it seems like it might… | |||||
61 | 81 | | |||
62 | m_naturalSorting = new QRadioButton(i18nc("option:radio", "Natural sorting"), sortingPropsBox); | | |||
63 | m_caseInsensitiveSorting = new QRadioButton(i18nc("option:radio", "Alphabetical sorting, case insensitive"), sortingPropsBox); | | |||
64 | m_caseSensitiveSorting = new QRadioButton(i18nc("option:radio", "Alphabetical sorting, case sensitive"), sortingPropsBox); | | |||
65 | | ||||
66 | QVBoxLayout* sortingPropsLayout = new QVBoxLayout(sortingPropsBox); | | |||
67 | sortingPropsLayout->addWidget(m_naturalSorting); | | |||
68 | sortingPropsLayout->addWidget(m_caseInsensitiveSorting); | | |||
69 | sortingPropsLayout->addWidget(m_caseSensitiveSorting); | | |||
70 | 82 | | |||
71 | // 'Show tooltips' | 83 | // 'Show tooltips' | ||
72 | m_showToolTips = new QCheckBox(i18nc("@option:check", "Show tooltips"), this); | 84 | m_showToolTips = new QCheckBox(i18nc("@option:check", "Show tooltips")); | ||
85 | topLayout->addRow(i18nc("@title:group", "General: "), m_showToolTips); | ||||
73 | 86 | | |||
74 | // 'Show selection marker' | 87 | // 'Show selection marker' | ||
75 | m_showSelectionToggle = new QCheckBox(i18nc("@option:check", "Show selection marker"), this); | 88 | m_showSelectionToggle = new QCheckBox(i18nc("@option:check", "Show selection marker")); | ||
89 | topLayout->addRow(QString(), m_showSelectionToggle); | ||||
76 | 90 | | |||
77 | // 'Inline renaming of items' | 91 | // 'Inline renaming of items' | ||
78 | m_renameInline = new QCheckBox(i18nc("option:check", "Rename inline"), this); | 92 | m_renameInline = new QCheckBox(i18nc("option:check", "Rename inline")); | ||
79 | 93 | topLayout->addRow(QString(), m_renameInline); | |||
80 | // 'Use tab for switching between right and left split' | | |||
81 | m_useTabForSplitViewSwitch = new QCheckBox(i18nc("option:check", "Use tab for switching between right and left split view"), this); | | |||
82 | 94 | | |||
83 | topLayout->addWidget(viewPropsBox); | 95 | // 'Switch between split views with tab key' | ||
84 | topLayout->addWidget(sortingPropsBox); | 96 | m_useTabForSplitViewSwitch = new QCheckBox(i18nc("option:check", "Switch between split views with tab key")); | ||
85 | topLayout->addWidget(m_showToolTips); | 97 | topLayout->addRow(QString(), m_useTabForSplitViewSwitch); | ||
86 | topLayout->addWidget(m_showSelectionToggle); | | |||
87 | topLayout->addWidget(m_renameInline); | | |||
88 | topLayout->addWidget(m_useTabForSplitViewSwitch); | | |||
89 | topLayout->addStretch(); | | |||
90 | 98 | | |||
91 | loadSettings(); | 99 | loadSettings(); | ||
92 | 100 | | |||
93 | connect(m_localViewProps, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed); | 101 | connect(m_localViewProps, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed); | ||
94 | connect(m_globalViewProps, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed); | 102 | connect(m_globalViewProps, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed); | ||
95 | connect(m_showToolTips, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed); | 103 | connect(m_showToolTips, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed); | ||
96 | connect(m_showSelectionToggle, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed); | 104 | connect(m_showSelectionToggle, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed); | ||
97 | connect(m_naturalSorting, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed); | 105 | connect(m_naturalSorting, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed); | ||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |
Please put it before viewproperties.h (again, to preserver sorting of includes)