gepetto-viewer  4.12.0
An user-friendly Graphical Interface
settings.hh
Go to the documentation of this file.
1 // Copyright (c) 2015-2018, LAAS-CNRS
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3 //
4 // This file is part of gepetto-viewer.
5 // gepetto-viewer is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 //
10 // gepetto-viewer is distributed in the hope that it will be
11 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Lesser Public License for more details. You should have
14 // received a copy of the GNU Lesser General Public License along with
15 // gepetto-viewer. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef GEPETTO_GUI_SETTINGS_HH
18 #define GEPETTO_GUI_SETTINGS_HH
19 
20 #include <ostream>
21 #include <string>
22 #include <QString>
23 #include <QStringList>
24 
26 
27 namespace gepetto {
28  namespace gui {
29  class MainWindow;
30 
37  struct Settings {
38  std::string configurationFile;
39  std::string predifinedRobotConf;
40  std::string predifinedEnvConf;
41  std::string stateConf;
42 
43  std::string logFile;
44 
45  bool verbose;
46  bool noPlugin;
49 
51 
54 
57  QString avconv;
58  QStringList avConvInputOptions;
59  QStringList avConvOutputOptions;
61 
63 
64  QString appStyle;
65 
67  Settings (const char* installDirectory);
68 
73  void setupPaths () const;
74 
76  QString getQSettingsFileName (const std::string& settingsName) const;
77 
87  int initSettings (int argc, char * argv[]);
88 
90  void fromFiles ();
91 
93  void writeSettings ();
94 
96  QVariant getSetting (const QString & key,
97  const QVariant & defaultValue = QVariant());
98 
100  QStringList pluginsToInit_;
101  QStringList pyplugins_;
102  QStringList pyscripts_;
103 
104  void setMainWindow (MainWindow* main);
105 
106  void initPlugins ();
107 
108  std::ostream& print (std::ostream& os);
109 
111  void readRobotFile ();
113  void readEnvFile ();
134  void readSettingFile ();
135 
136  void saveState () const;
137  void restoreState () const;
138  void restoreDockWidgetsState () const;
139 
140  void writeRobotFile ();
141  void writeEnvFile ();
142  void writeSettingFile ();
143 
144  const char** makeOmniORBargs (int &argc);
145 
146  private:
147  void addRobotFromString (const std::string& rbtStr);
148  void addEnvFromString (const std::string& envStr);
149  void addPlugin (const QString& plg, bool init);
150  void addPyPlugin (const QString& plg, bool init);
151  void addPyScript (const QString& fileName);
152  void addOmniORB (const QString& arg, const QString& value);
153 
154  inline void log (const QString& t);
155  inline void logError (const QString& t);
156 
157  MainWindow* mw;
158  QStringList omniORBargv_;
159  };
160  } // namespace gui
161 } // namespace gepetto
162 
163 #endif // GEPETTO_GUI_SETTINGS_HH
int refreshRate
Definition: settings.hh:50
void setupPaths() const
QString getQSettingsFileName(const std::string &settingsName) const
Get the filename of a configuration file.
std::string predifinedRobotConf
Definition: settings.hh:39
void restoreState() const
bool autoWriteSettings
Definition: settings.hh:47
bool useNameService
Definition: settings.hh:48
QStringList avConvInputOptions
Definition: settings.hh:58
QString avconv
Definition: settings.hh:57
void fromFiles()
Update settings from setting files.
QStringList pyplugins_
Definition: settings.hh:101
Class.
Definition: mainwindow.hh:43
QVariant getSetting(const QString &key, const QVariant &defaultValue=QVariant())
Get a setting.
QString installDirectory
Definition: settings.hh:62
std::string captureDirectory
Path to avconv binary (maybe ffmpeg on some distributions).
Definition: settings.hh:53
Definition: settings.hh:37
Settings(const char *installDirectory)
Set up default values.
std::string configurationFile
Definition: settings.hh:38
void restoreDockWidgetsState() const
void saveState() const
Definition: action-search-bar.hh:27
std::string predifinedEnvConf
Definition: settings.hh:40
std::string stateConf
Definition: settings.hh:41
void writeSettings()
Write the settings to configuration files.
void setMainWindow(MainWindow *main)
QString appStyle
Definition: settings.hh:64
Definition: pluginmanagerdialog.hh:35
QStringList pyscripts_
Definition: settings.hh:102
int initSettings(int argc, char *argv[])
bool verbose
Definition: settings.hh:45
QStringList avConvOutputOptions
Definition: settings.hh:59
std::string captureExtension
Definition: settings.hh:53
std::string captureFilename
Definition: settings.hh:53
bool noPlugin
Definition: settings.hh:46
const char ** makeOmniORBargs(int &argc)
std::string logFile
Definition: settings.hh:43
PluginManager pluginManager_
Definition: settings.hh:99
QStringList pluginsToInit_
Definition: settings.hh:100
std::ostream & print(std::ostream &os)