xref: /glogg/src/optionsdialog.h (revision 80bca0a387968c28827e5f6a97058c7bbfcfbd38)
1 /*
2  * Copyright (C) 2009, 2010, 2013 Nicolas Bonnefon and other contributors
3  *
4  * This file is part of glogg.
5  *
6  * glogg is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * glogg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with glogg.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef OPTIONSDIALOG_H
21 #define OPTIONSDIALOG_H
22 
23 #include <QDialog>
24 
25 #include "configuration.h"
26 
27 #include "ui_optionsdialog.h"
28 
29 // Implements the main option dialog box
30 class OptionsDialog : public QDialog, public Ui::OptionsDialog
31 {
32     Q_OBJECT
33 
34   public:
35     OptionsDialog(QWidget* parent = 0);
36 
37   signals:
38     // Is emitted when new settings must be used
39     void optionsChanged();
40 
41   private slots:
42     // Clears and updates the font size box with the sizes allowed
43     // by the passed font family.
44     void updateFontSize(const QString& fontFamily);
45     // Update the content of the global Config() using parameters
46     // from the dialog box.
47     void updateConfigFromDialog();
48     // Called when a ok/cancel/apply button is clicked.
49     void onButtonBoxClicked( QAbstractButton* button );
50     // Called when the 'incremental' button is toggled.
51     void onIncrementalChanged();
52     // Called when the 'polling' checkbox is toggled.
53     void onPollingChanged();
54 
55   private:
56     void setupTabs();
57     void setupFontList();
58     void setupRegexp();
59     void setupIncremental();
60     void setupPolling();
61 
62     int getRegexpIndex( SearchRegexpType syntax ) const;
63     SearchRegexpType getRegexpTypeFromIndex( int index ) const;
64 
65     void updateDialogFromConfig();
66 
67     QValidator* polling_interval_validator_;
68 };
69 
70 #endif
71