Added tooltip for search limit
[mdictionary] / trunk / src / base / 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 Settings widget
24 //! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
25
26 #ifndef SETTINGSWIDGET_H
27 #define SETTINGSWIDGET_H
28
29 #include <QWidget>
30 #include <QtGui>
31 #include <QPushButton>
32 #include "../../includes/GUIInterface.h"
33 #include "../../includes/settings.h"
34
35 //! Implements applications settings widget
36 /*!
37   Shows settings that user can change.
38   It allow to change limit of searches and limit of history.
39   Also it allow to select if application have 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 subclass of
50       GUIInterface, because it will use it to get current settings and
51       sets new ones.
52       */
53     explicit SettingsWidget(GUIInterface *parent = 0);
54
55
56 protected:
57     void showEvent(QShowEvent *);
58     void hideEvent(QHideEvent *);
59
60 private:
61     QSpinBox* historySizeSpinBox;
62     QSpinBox* searchResultSizeSpinBox;
63     QVBoxLayout* verticalLayout;
64     QFormLayout* spinBoxesFormLayout;
65
66     QLabel* checkBoxesLabel;
67     QCheckBox* searchInDictionariesCheckBox;
68     QCheckBox* searchInBookmarksCheckBox;
69
70     GUIInterface* guiInterface;
71     Settings* settings;
72     bool _changed;
73     QString limitTip;
74     #ifndef Q_WS_MAEMO_5
75         QPushButton* closeButton;
76         QHBoxLayout* footerLayout;
77         bool _save;
78
79         private Q_SLOTS:
80             void save();
81     #endif
82
83 private Q_SLOTS:
84     void changed();
85
86 };
87
88 #endif // SETTINGSWIDGET_H