f6ada01962876c082dc1d01e3db1d5286ebb0d4d
[mdictionary] / src / mdictionary / gui / SettingsWidget.h
1 /*******************************************************************************
2
3     This file is part of mDictionary.
4
5     mDictionary 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     mDictionary 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 mDictionary.  If not, see <http://www.gnu.org/licenses/>.
17
18     Copyright 2010 Comarch S.A.
19
20 *******************************************************************************/
21
22 /*! \file DictManagerWidget.h
23     \brief Implements applications settings widget
24     \author Mateusz Półrola <mateusz.polrola@comarch.pl>
25 */
26
27 #ifndef SETTINGSWIDGET_H
28 #define SETTINGSWIDGET_H
29
30 #include <QWidget>
31 #include <QtGui>
32 #include <QPushButton>
33 #include "../../include/GUIInterface.h"
34 #include "../../include/settings.h"
35 #include "SpinBox.h"
36
37 /*!
38   Shows settings that user can change.
39   It allows to change limit of searches and limit of history.
40   It also allows to select if application has to search in dictionaries or in
41   bookmarks or in both of them. All changes are saved automatically after
42   hiding of this widget.
43   */
44 class SettingsWidget : public QDialog
45 {
46     Q_OBJECT
47 public:
48     //! Constructor
49     /*!
50       \param parent parent of this widget, which must be a subclass of
51       GUIInterface, because it will use it to get current settings and
52       set new ones.
53       */
54     explicit SettingsWidget(GUIInterface *parent = 0);
55
56 Q_SIGNALS:
57     void notify(Notify::NotifyType, QString);
58
59 protected:
60     void showEvent(QShowEvent *);
61     void hideEvent(QHideEvent *);
62
63 private Q_SLOTS:
64     void changed();
65     #ifndef Q_WS_MAEMO_5
66         void save();
67     #endif
68     #ifdef Q_WS_MAEMO_5
69         void showSearchResultSizeInfo();
70         void showHistorySizeInfo();
71     #endif
72
73 private:
74     void initalizeUI();
75     SpinBox* historySizeSpinBox;
76     SpinBox* searchResultSizeSpinBox;
77     QVBoxLayout* verticalLayout;
78     QFormLayout* spinBoxesFormLayout;
79     QHBoxLayout* historySizeLayout;
80     QHBoxLayout* searchResultLayout;
81
82     #ifdef Q_WS_MAEMO_5
83         QToolButton* historySizeInfoToolButton;
84         QToolButton* searchResultSizeInfoToolButton;
85     #endif
86
87     QLabel* checkBoxesLabel;
88     QCheckBox* searchInDictionariesCheckBox;
89     QCheckBox* searchInBookmarksCheckBox;
90
91
92     GUIInterface* guiInterface;
93     Settings* settings;
94     bool _changed;
95
96     QString searchResultSizeToolTip;
97     QString historySizeToolTip;
98
99     #ifndef Q_WS_MAEMO_5
100         QPushButton* closeButton;
101         QHBoxLayout* footerLayout;
102         bool _save;
103     #endif
104
105
106
107 };
108
109 #endif // SETTINGSWIDGET_H