RTXI  3.0.0
The Real-Time eXperiment Interface Reference Manual
userprefs.hpp
Go to the documentation of this file.
1 /*
2  The Real-Time eXperiment Interface (RTXI)
3  Copyright (C) 2011 Georgia Institute of Technology, University of Utah,
4  Will Cornell Medical College
5 
6  This program 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  This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 */
20 
21 #ifndef USERPREFS_H
22 #define USERPREFS_H
23 
24 #include <QSettings>
25 
26 #include "widgets.hpp"
27 
28 namespace UserPrefs
29 {
30 
31 constexpr std::string_view MODULE_NAME = "User Preferences";
32 
33 class Plugin : public Widgets::Plugin
34 {
35 public:
36  explicit Plugin(Event::Manager* ev_manager);
37 
38 }; // class Prefs
39 
40 class Panel : public Widgets::Panel
41 {
42  Q_OBJECT
43 
44 public:
45  Panel(QMainWindow* mwindow, Event::Manager* ev_manager);
46 
47 public slots:
48  void apply(); // save and close
49  void reset(); // reset to defaults
50 
51  void chooseSettingsDir();
52  void chooseDataDir();
53 
54 private:
55  QLabel* status = nullptr;
56  QSettings userprefs;
57 
58  QGroupBox* dirGroup = nullptr;
59  QGroupBox* HDF = nullptr;
60  QGroupBox* buttons = nullptr;
61 
62  QLineEdit* settingsDirEdit = nullptr; // directory for settings files
63  QLineEdit* dataDirEdit = nullptr; // directory of most recent data file
64  QLineEdit* HDFBufferEdit = nullptr; // buffer size for HDF Data Recorder
65 }; // class Panel
66 
67 std::unique_ptr<Widgets::Plugin> createRTXIPlugin(Event::Manager* ev_manager);
68 
69 Widgets::Panel* createRTXIPanel(QMainWindow* main_window,
70  Event::Manager* ev_manager);
71 std::unique_ptr<Widgets::Component> createRTXIComponent(
72  Widgets::Plugin* host_plugin);
73 
75 
76 } // namespace UserPrefs
77 #endif /* USERPREFS */
void chooseSettingsDir()
Definition: userprefs.cpp:163
void chooseDataDir()
Definition: userprefs.cpp:174
Panel(QMainWindow *mwindow, Event::Manager *ev_manager)
Definition: userprefs.cpp:38
Plugin(Event::Manager *ev_manager)
Definition: userprefs.cpp:33
std::unique_ptr< Widgets::Component > createRTXIComponent(Widgets::Plugin *host_plugin)
Definition: userprefs.cpp:198
Widgets::Panel * createRTXIPanel(QMainWindow *main_window, Event::Manager *ev_manager)
Definition: userprefs.cpp:191
Widgets::FactoryMethods getFactories()
Definition: userprefs.cpp:204
std::unique_ptr< Widgets::Plugin > createRTXIPlugin(Event::Manager *ev_manager)
Definition: userprefs.cpp:185
constexpr std::string_view MODULE_NAME
Definition: userprefs.hpp:31