diff options
author | Alex Zolotarev <deathbaba@gmail.com> | 2011-01-30 01:29:32 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:11:27 +0300 |
commit | d9a3242426f8749e7ad645cae159470153a6cb01 (patch) | |
tree | 64762a09bf032faf8cf3caea81c4b1fa4ed5072d /qt/preferences_dialog.cpp | |
parent | 6b45ce29cd66ef1327051e27e1d0371c691cca7d (diff) |
Added "Automatic update check" checkbox and Preferences dialog
Diffstat (limited to 'qt/preferences_dialog.cpp')
-rw-r--r-- | qt/preferences_dialog.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/qt/preferences_dialog.cpp b/qt/preferences_dialog.cpp new file mode 100644 index 0000000000..38d35630a0 --- /dev/null +++ b/qt/preferences_dialog.cpp @@ -0,0 +1,29 @@ +#include "preferences_dialog.hpp" + +#include <QtGui/QIcon> +#include <QtGui/QCheckBox> +#include <QtGui/QHBoxLayout> + +namespace qt +{ + PreferencesDialog::PreferencesDialog(QWidget * parent, bool & autoUpdatesEnabled) + : QDialog(parent), m_autoUpdatesEnabled(autoUpdatesEnabled) + { + QIcon icon(":logo.png"); + setWindowIcon(icon); + setWindowTitle(tr("Preferences")); + + QCheckBox * updateCheckbox = new QCheckBox("Automatically check for updates on startup", this); + updateCheckbox->setCheckState(autoUpdatesEnabled ? Qt::Checked : Qt::Unchecked); + connect(updateCheckbox, SIGNAL(stateChanged(int)), this, SLOT(OnCheckboxStateChanged(int))); + + QHBoxLayout * hBox = new QHBoxLayout(); + hBox->addWidget(updateCheckbox); + setLayout(hBox); + } + + void PreferencesDialog::OnCheckboxStateChanged(int state) + { + m_autoUpdatesEnabled = (state == Qt::Checked) ? true : false; + } +} |