1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-18 12:28:31 +01:00

Updated Shortcuts dialog to use native widget for OK/Cancel

This commit is contained in:
Andrew Udvare 2010-02-28 21:46:25 +00:00
parent b6330db85c
commit 235a015a6f
3 changed files with 25 additions and 54 deletions

View File

@ -8,11 +8,11 @@ ShortcutsDialog::ShortcutsDialog(QWidget* parent)
// Load settings // Load settings
// Check if settings exist first, if not create them // Check if settings exist first, if not create them
// TODO: How do we store the button values? Numbers, strings, especially when it comes to combinations? // TODO: QKeySequence::toString() to load/save values
connect(ui_.button_defaults, SIGNAL(clicked()), SLOT(DefaultShortcuts())); connect(ui_.button_defaults, SIGNAL(clicked()), SLOT(DefaultShortcuts()));
connect(ui_.button_save, SIGNAL(clicked()), SLOT(SaveShortcuts())); connect(ui_.button_box, SIGNAL(accepted()), SLOT(SaveShortcuts()));
connect(ui_.button_cancel, SIGNAL(clicked()), SLOT(CancelEvent())); connect(ui_.button_box, SIGNAL(rejected()), SLOT(CancelEvent()));
} }
/** /**
@ -21,15 +21,12 @@ ShortcutsDialog::ShortcutsDialog(QWidget* parent)
void ShortcutsDialog::DefaultShortcuts() { void ShortcutsDialog::DefaultShortcuts() {
} }
/**
* Save the shortcuts and close the window
*/
void ShortcutsDialog::SaveShortcuts() { void ShortcutsDialog::SaveShortcuts() {
close(); accept();
} }
/** /**
* Reset settings to original values taken from settings file and then close the window. * Reset back to original values found in settings file and close
*/ */
void ShortcutsDialog::CancelEvent() { void ShortcutsDialog::CancelEvent() {
close(); close();

View File

@ -17,6 +17,7 @@ class ShortcutsDialog : public QDialog {
void SaveShortcuts(); void SaveShortcuts();
void CancelEvent(); void CancelEvent();
private: private:
Ui::ShortcutsDialog ui_; Ui::ShortcutsDialog ui_;
QSettings settings_; QSettings settings_;

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>485</width> <width>485</width>
<height>361</height> <height>371</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -46,21 +46,6 @@
<attribute name="horizontalHeaderStretchLastSection"> <attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool> <bool>true</bool>
</attribute> </attribute>
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderMinimumSectionSize">
<number>24</number>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>116</number>
</attribute>
<row> <row>
<property name="text"> <property name="text">
<string>Play</string> <string>Play</string>
@ -138,39 +123,13 @@
<x>10</x> <x>10</x>
<y>330</y> <y>330</y>
<width>80</width> <width>80</width>
<height>26</height> <height>31</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>&amp;Defaults</string> <string>&amp;Defaults</string>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="button_save">
<property name="geometry">
<rect>
<x>300</x>
<y>330</y>
<width>80</width>
<height>26</height>
</rect>
</property>
<property name="text">
<string>&amp;OK</string>
</property>
</widget>
<widget class="QPushButton" name="button_cancel">
<property name="geometry">
<rect>
<x>390</x>
<y>330</y>
<width>80</width>
<height>26</height>
</rect>
</property>
<property name="text">
<string>&amp;Cancel</string>
</property>
</widget>
<widget class="QGroupBox" name="shortcut_options"> <widget class="QGroupBox" name="shortcut_options">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@ -258,6 +217,19 @@
</property> </property>
</widget> </widget>
</widget> </widget>
<widget class="QDialogButtonBox" name="button_box">
<property name="geometry">
<rect>
<x>300</x>
<y>330</y>
<width>166</width>
<height>32</height>
</rect>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</widget> </widget>
<tabstops> <tabstops>
<tabstop>tableWidget</tabstop> <tabstop>tableWidget</tabstop>
@ -265,8 +237,6 @@
<tabstop>radio_default</tabstop> <tabstop>radio_default</tabstop>
<tabstop>radio_custom</tabstop> <tabstop>radio_custom</tabstop>
<tabstop>button_custom</tabstop> <tabstop>button_custom</tabstop>
<tabstop>button_save</tabstop>
<tabstop>button_cancel</tabstop>
<tabstop>button_defaults</tabstop> <tabstop>button_defaults</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
@ -320,4 +290,7 @@
</hints> </hints>
</connection> </connection>
</connections> </connections>
<buttongroups>
<buttongroup name="buttonGroup"/>
</buttongroups>
</ui> </ui>