xref: /glogg/src/optionsdialog.h (revision bb02e0acf44ddb4e4f83d6127a1e488789162922)
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 
53   private:
54     void setupFontList();
55     void setupRegexp();
56     void setupIncremental();
57 
58     int getRegexpIndex( SearchRegexpType syntax ) const;
59     SearchRegexpType getRegexpTypeFromIndex( int index ) const;
60 
61     void updateDialogFromConfig();
62 };
63 
64 #endif
65