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
// 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_save, SIGNAL(clicked()), SLOT(SaveShortcuts()));
connect(ui_.button_cancel, SIGNAL(clicked()), SLOT(CancelEvent()));
connect(ui_.button_box, SIGNAL(accepted()), SLOT(SaveShortcuts()));
connect(ui_.button_box, SIGNAL(rejected()), SLOT(CancelEvent()));
}
/**
@ -21,16 +21,13 @@ ShortcutsDialog::ShortcutsDialog(QWidget* parent)
void ShortcutsDialog::DefaultShortcuts() {
}
/**
* Save the shortcuts and close the window
*/
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() {
close();
}
}

View File

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

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>485</width>
<height>361</height>
<height>371</height>
</rect>
</property>
<property name="windowTitle">
@ -46,21 +46,6 @@
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</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>
<property name="text">
<string>Play</string>
@ -138,39 +123,13 @@
<x>10</x>
<y>330</y>
<width>80</width>
<height>26</height>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&amp;Defaults</string>
</property>
</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">
<property name="enabled">
<bool>true</bool>
@ -258,6 +217,19 @@
</property>
</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>
<tabstops>
<tabstop>tableWidget</tabstop>
@ -265,8 +237,6 @@
<tabstop>radio_default</tabstop>
<tabstop>radio_custom</tabstop>
<tabstop>button_custom</tabstop>
<tabstop>button_save</tabstop>
<tabstop>button_cancel</tabstop>
<tabstop>button_defaults</tabstop>
</tabstops>
<resources/>
@ -320,4 +290,7 @@
</hints>
</connection>
</connections>
<buttongroups>
<buttongroup name="buttonGroup"/>
</buttongroups>
</ui>