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