Shortcut settings page cleanup.
- Group list and settings so they can be enabled/disabled together. - Make default selection shortcut list. Previous behavior set options for the first item, but didn't highlight selection. - Rename ItemClicked to CurrentItemChanged to reflect correct signal.
This commit is contained in:
parent
2179027a6d
commit
a8f656a933
|
@ -47,7 +47,7 @@ GlobalShortcutsSettingsPage::GlobalShortcutsSettingsPage(SettingsDialog* dialog)
|
||||||
|
|
||||||
connect(ui_->list,
|
connect(ui_->list,
|
||||||
SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
|
SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
|
||||||
SLOT(ItemClicked(QTreeWidgetItem*)));
|
SLOT(CurrentItemChanged(QTreeWidgetItem*)));
|
||||||
connect(ui_->radio_none, SIGNAL(clicked()), SLOT(NoneClicked()));
|
connect(ui_->radio_none, SIGNAL(clicked()), SLOT(NoneClicked()));
|
||||||
connect(ui_->radio_default, SIGNAL(clicked()), SLOT(DefaultClicked()));
|
connect(ui_->radio_default, SIGNAL(clicked()), SLOT(DefaultClicked()));
|
||||||
connect(ui_->radio_custom, SIGNAL(clicked()), SLOT(ChangeClicked()));
|
connect(ui_->radio_custom, SIGNAL(clicked()), SLOT(ChangeClicked()));
|
||||||
|
@ -86,7 +86,7 @@ void GlobalShortcutsSettingsPage::Load() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_->list->sortItems(0, Qt::AscendingOrder);
|
ui_->list->sortItems(0, Qt::AscendingOrder);
|
||||||
ItemClicked(ui_->list->topLevelItem(0));
|
ui_->list->setCurrentItem(ui_->list->topLevelItem(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const Shortcut& s : shortcuts_.values()) {
|
for (const Shortcut& s : shortcuts_.values()) {
|
||||||
|
@ -121,7 +121,7 @@ void GlobalShortcutsSettingsPage::Save() {
|
||||||
dialog()->global_shortcuts_manager()->ReloadSettings();
|
dialog()->global_shortcuts_manager()->ReloadSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalShortcutsSettingsPage::ItemClicked(QTreeWidgetItem* item) {
|
void GlobalShortcutsSettingsPage::CurrentItemChanged(QTreeWidgetItem* item) {
|
||||||
current_id_ = item->data(0, Qt::UserRole).toString();
|
current_id_ = item->data(0, Qt::UserRole).toString();
|
||||||
Shortcut& shortcut = shortcuts_[current_id_];
|
Shortcut& shortcut = shortcuts_[current_id_];
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ class GlobalShortcutsSettingsPage : public SettingsPage {
|
||||||
void Save();
|
void Save();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ItemClicked(QTreeWidgetItem*);
|
void CurrentItemChanged(QTreeWidgetItem*);
|
||||||
void NoneClicked();
|
void NoneClicked();
|
||||||
void DefaultClicked();
|
void DefaultClicked();
|
||||||
void ChangeClicked();
|
void ChangeClicked();
|
||||||
|
|
|
@ -21,7 +21,16 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="gnome_container" native="true">
|
<widget class="QWidget" name="gnome_container" native="true">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
|
@ -53,7 +62,16 @@
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
|
@ -82,6 +100,15 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="list_container" native="true">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTreeWidget" name="list">
|
<widget class="QTreeWidget" name="list">
|
||||||
<property name="editTriggers">
|
<property name="editTriggers">
|
||||||
|
@ -169,7 +196,13 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
|
<tabstop>gnome_checkbox</tabstop>
|
||||||
|
<tabstop>gnome_open</tabstop>
|
||||||
|
<tabstop>mac_open</tabstop>
|
||||||
<tabstop>list</tabstop>
|
<tabstop>list</tabstop>
|
||||||
<tabstop>radio_none</tabstop>
|
<tabstop>radio_none</tabstop>
|
||||||
<tabstop>radio_default</tabstop>
|
<tabstop>radio_default</tabstop>
|
||||||
|
@ -183,7 +216,7 @@
|
||||||
<connection>
|
<connection>
|
||||||
<sender>gnome_checkbox</sender>
|
<sender>gnome_checkbox</sender>
|
||||||
<signal>toggled(bool)</signal>
|
<signal>toggled(bool)</signal>
|
||||||
<receiver>list</receiver>
|
<receiver>list_container</receiver>
|
||||||
<slot>setDisabled(bool)</slot>
|
<slot>setDisabled(bool)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
|
@ -191,24 +224,8 @@
|
||||||
<y>25</y>
|
<y>25</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>82</x>
|
<x>253</x>
|
||||||
<y>63</y>
|
<y>247</y>
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>gnome_checkbox</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>shortcut_options</receiver>
|
|
||||||
<slot>setDisabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>244</x>
|
|
||||||
<y>26</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>122</x>
|
|
||||||
<y>298</y>
|
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
|
Loading…
Reference in New Issue