Add an apply button to the settings dialog. Fixes issue 3575
This commit is contained in:
parent
7677b386bc
commit
ae7ec425f6
@ -78,6 +78,7 @@
|
||||
# include "internet/boxsettingspage.h"
|
||||
#endif
|
||||
|
||||
#include <QAbstractButton>
|
||||
#include <QDesktopWidget>
|
||||
#include <QPainter>
|
||||
#include <QPushButton>
|
||||
@ -253,12 +254,14 @@ void SettingsDialog::AddPage(Page id, SettingsPage* page, QTreeWidgetItem* paren
|
||||
pages_[id] = data;
|
||||
}
|
||||
|
||||
void SettingsDialog::accept() {
|
||||
// Save settings
|
||||
void SettingsDialog::Save() {
|
||||
foreach (const PageData& data, pages_.values()) {
|
||||
data.page_->Save();
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::accept() {
|
||||
Save();
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
@ -271,6 +274,13 @@ void SettingsDialog::reject() {
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
void SettingsDialog::DialogButtonClicked(QAbstractButton* button) {
|
||||
// While we only connect Apply at the moment, this might change in the future
|
||||
if (ui_->buttonBox->button(QDialogButtonBox::Apply) == button) {
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::showEvent(QShowEvent* e) {
|
||||
// Load settings
|
||||
loading_settings_ = true;
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "config.h"
|
||||
#include "widgets/osd.h"
|
||||
|
||||
class QAbstractButton;
|
||||
class QScrollArea;
|
||||
class QTreeWidgetItem;
|
||||
|
||||
@ -118,6 +119,7 @@ signals:
|
||||
|
||||
private slots:
|
||||
void CurrentItemChanged(QTreeWidgetItem* item);
|
||||
void DialogButtonClicked(QAbstractButton* button);
|
||||
|
||||
private:
|
||||
struct PageData {
|
||||
@ -129,6 +131,8 @@ private:
|
||||
QTreeWidgetItem* AddCategory(const QString& name);
|
||||
void AddPage(Page id, SettingsPage* page, QTreeWidgetItem* parent = NULL);
|
||||
|
||||
void Save();
|
||||
|
||||
private:
|
||||
Application* app_;
|
||||
LibraryDirectoryModel* model_;
|
||||
|
@ -83,7 +83,7 @@
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -131,5 +131,21 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>clicked(QAbstractButton*)</signal>
|
||||
<receiver>SettingsDialog</receiver>
|
||||
<slot>DialogButtonClicked(QAbstractButton*)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
Loading…
x
Reference in New Issue
Block a user