source: SMSSender/frontend/gui/ui/settingsdialog.h @ 319:1ec456878bcb

separation-frontend-backend
Last change on this file since 319:1ec456878bcb was 319:1ec456878bcb, checked in by Sämy Zehnder <saemy.zehnder@…>, 8 years ago
  • Adjusts header guards to follow common pattern based on the filename.
File size: 2.9 KB
Line 
1/*
2  smssender - A frontend for fast and easy SMS sending over different gateways.
3  Copyright (C) 2007-2014, gorrión. See http://smssender.gorrion.ch
4
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  GNU General Public License for more details.
14
15  You should have received a copy of the GNU General Public License
16  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef FRONTEND_GUI_UI_SETTINGSDIALOG_H
19#define FRONTEND_GUI_UI_SETTINGSDIALOG_H
20
21#include "ui_settingsdialog.h"
22
23#include <QtGui/QDialog>
24#include <QtGui/QListWidgetItem>
25#include <QtGui/QComboBox>
26#include <QKeySequence>
27#include <QLocale>
28#include <QNetworkProxy>
29
30#include "frontend/business/settings.h"
31#include "frontend/business/suffixmanager.h"
32#include "frontend/business/updatemanager.h"
33
34namespace UI {
35
36class SettingsDialog : public QDialog {
37    Q_OBJECT
38
39public:
40    SettingsDialog(QWidget* parent, Settings *settings, SuffixManager *suffixManager,
41             UpdateManager *updateManager);
42
43protected:
44    void closeEvent(QCloseEvent *e);
45
46private slots:
47    void onUpdateAvailable(const SVersion& version, UpdateManager::UpdateType updateType);
48    void onNoUpdateAvailable(UpdateManager::UpdateType);
49
50private slots:
51    void on_lstSettingGroups_currentItemChanged(QListWidgetItem* newGroup, QListWidgetItem*);
52    void on_btnSearchForUpdate_clicked();
53    void on_btnUseDefaultSuffix_clicked();
54    void on_ckbAddSuffix_stateChanged(int state);
55    void on_ckbUseProxy_stateChanged(int state);
56    void on_ckbUseProxyAuth_stateChanged(int state);
57    void on_selShortcut_currentIndexChanged();
58
59private:
60    Ui::SettingsDialogClass ui;
61
62    Settings * const m_settings;
63    SuffixManager * const m_suffixManager;
64    UpdateManager * const m_updateManager;
65
66    QMap<QString, QLocale> localeNameToLocale_;
67
68    QMap<int, QString>           shortcutKeys_;
69    QStringList                  shortcutChars_;
70    QMap<QComboBox*, QComboBox*> shortcutSelects_;
71
72    void initGeneralPage();
73    void initProxyPage();
74    void initShortcutsPage();
75
76    void setSelectionFromShortcutAccessKeys(QKeySequence shortcut, QComboBox* comboBox);
77    int  getShortcutAccessKeysFromSelection(QComboBox* comboBox);
78
79    bool validateGeneralPage();
80    bool validateProxyPage();
81    bool validateShortcutsPage();
82
83    void saveGeneralPage();
84    void saveProxyPage();
85    void saveShortcutsPage();
86
87private:
88    QMap<QNetworkProxy::ProxyType, QString> proxyTypes_;
89};
90
91} // namespace UI
92
93#endif // FRONTEND_GUI_UI_SETTINGSDIALOG_H
Note: See TracBrowser for help on using the repository browser.