1 /************************************************************************
2 **
3 **  Copyright (C) 2019-2020  Kevin B. Hendricks, Stratford Ontario Canada
4 **  Copyright (C) 2011       John Schember <john@nachtimwald.com>
5 **
6 **  This file is part of Sigil.
7 **
8 **  Sigil is free software: you can redistribute it and/or modify
9 **  it under the terms of the GNU General Public License as published by
10 **  the Free Software Foundation, either version 3 of the License, or
11 **  (at your option) any later version.
12 **
13 **  Sigil is distributed in the hope that it will be useful,
14 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 **  GNU General Public License for more details.
17 **
18 **  You should have received a copy of the GNU General Public License
19 **  along with Sigil.  If not, see <http://www.gnu.org/licenses/>.
20 **
21 *************************************************************************/
22 
23 #pragma once
24 #ifndef PREFERENCESWIDGET_H
25 #define PREFERENCESWIDGET_H
26 
27 #include <cstdint>
28 #include <QWidget>
29 
30 class QString;
31 
32 
33 /**
34  * Base Interface for preferences widgets.
35  */
36 class PreferencesWidget : public QWidget
37 {
38     Q_OBJECT
39 
40 public:
41 
42     typedef uint32_t ResultActions;
43 
44     /**
45      * Describes the result actions to present to the user as a result
46      * of saving any changes made in the preferences widgets.
47      */
48     enum ResultAction {
49         ResultAction_None                    = 0,  // Default, no further action required
50         ResultAction_RefreshSpelling         = 1,  // Refresh spelling highlighting on any open tabs
51         ResultAction_ReloadTabs              = 2,  // All tabs need to be reloaded.
52         ResultAction_RefreshClipHistoryLimit = 4,  // Reload cliboard history saving limit
53         ResultAction_RefreshBookBrowser      = 8,  // Refresh BookBrowser window
54         ResultAction_ReloadPreview           = 16, // Reload Preview window
55         ResultAction_RestartSigil            = 32, // Warn user that Sigil needs to be restarted.
56         ResultAction_Mask                    = 63  // AND Mask of allowable values
57     };
58 
59     /**
60      * Save settings made available by the widget.
61      */
62     virtual PreferencesWidget::ResultActions saveSettings() = 0;
63 
64 };
65 
66 #endif // PREFERENCESWIDGET_H
67