FGx  1
xsettingsmodel.h
1 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-
2 // FGx FlightGear Launcher // xsettingsmodel.h
3 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-
4 // (c) 2010-2012
5 // Yves Sablonier, Pete Morgan
6 // Geoff McLane
7 // GNU GPLv2, see main.cpp and shipped licence.txt for further information
8 
9 #ifndef XSETTINGSMODEL_H
10 #define XSETTINGSMODEL_H
11 
12 #include <QString>
13 #include <QStringList>
14 
15 #include <QStandardItemModel>
16 #include <QModelIndex>
17 
18 #include "xobjects/xopt.h"
19 #include "xobjects/mainobject.h"
20 class MainObject;
21 
22 
23 class XSettingsModel : public QStandardItemModel
24 {
25 Q_OBJECT
26 public:
27 
28  enum COLS{
29  C_OPTION = 0,
30  C_ENABLED = 1,
31  C_VALUE = 2,
32  C_DEFAULT = 3,
33  C_LEVEL = 4,
34  C_DESCRIPTION = 5,
35  C_AREA = 6
36  };
37 
38  explicit XSettingsModel(MainObject *mob, QObject *parent = 0);
39 
40  MainObject *mainObject;
41  bool _loading;
42 
43  void add_option(QString option, bool enabled, QString value, QString preset, int level, QString description, QString area);
44 
45  QModelIndex get_index(QString option);
46 
47  QString getx(QString option);
48  QString getx(QString option, bool return_default);
49  QString getx(QString option, QString default_string);
50 
51  XOpt get_opt(QString option);
52  bool get_ena(QString option);
53 
54 
55  QStringList get_fgfs_args();
56  QStringList get_fgfs_list();
57  QString get_fgfs_command_string();
58  QStringList get_fgfs_env();
59 
60  QString terrasync_default_path();
61  QString fgfs_path();
62 
63 
64  QString fgroot();
65  QString fgroot(QString append_path);
66  bool fgroot_use_default();
67  QString fgroot_path();
68 
69  QString aircraft_path();
70  QString aircraft_path(QString dir);
71 
72  QString airports_path();
73 
74  QString scenery_path();
75 
76  bool terrasync_enabled();
77  QString terrasync_exe_path();
78  QString terrasync_data_path();
79 
80  bool custom_scenery_enabled();
81  QString custom_scenery_path();
82 
83  bool fgcom_enabled();
84  QString fgcom_exe_path();
85  QString jsdemo_exe_path();
86 
87 
88  bool paths_sane();
89 
90  void set_row_bg(int row_idx, QColor bgcolor);
91 
92  QString getLastUsed();
93  void setLastUsed(QString previous);
94 
95  QStringList getSceneryDirs(); // return list of 'valid' scenery directories
96 
97 signals:
98  void upx(QString option, bool enabled, QString value);
99  void updated(QStringList lines);
100 
101 
102 public slots:
103 
104  void set_option(QString option, bool enabled, QString value);
105  void set_enabled(QString option, bool enabled);
106  void set_value(QString option, QString value);
107 
108  QString profile();
109  void read_default_ini();
110  void load_last_profile(QString profile);
111  bool load_profile(); // true if load done, else false
112  bool save_profile(); // true if save done, else false
113 };
114 
115 #endif // XSETTINGSMODEL_H
XSettingsModel::terrasync_exe_path
QString terrasync_exe_path()
Path to terrasync executable.
Definition: xsettingsmodel.cpp:771
XSettingsModel::airports_path
QString airports_path()
Return the absolute path to the /Airports directory.
Definition: xsettingsmodel.cpp:936
XSettingsModel::fgfs_path
QString fgfs_path()
Path to fgfs executable.
Definition: xsettingsmodel.cpp:737
MainObject
The MainObject is an extended QObject, and the main "controller" for FGx.
Definition: mainobject.h:61
XSettingsModel::scenery_path
QString scenery_path()
Returns the absolute path to the /Scenery file.
Definition: xsettingsmodel.cpp:962
XOpt
Definition: xopt.h:14
XSettingsModel::load_profile
bool load_profile()
Opens Profile Dialog for loading a .ini File.
Definition: xsettingsmodel.cpp:460
XSettingsModel::paths_sane
bool paths_sane()
Checks whether the executablem FG_ROOT paths are sane.
Definition: xsettingsmodel.cpp:893
XSettingsModel::terrasync_enabled
bool terrasync_enabled()
Sert terrasync enabled/disabled.
Definition: xsettingsmodel.cpp:760
XSettingsModel::aircraft_path
QString aircraft_path()
The path to the /Aircraft directory.
Definition: xsettingsmodel.cpp:911
XSettingsModel::fgcom_exe_path
QString fgcom_exe_path()
Path to fgcom executable.
Definition: xsettingsmodel.cpp:811
XSettingsModel::save_profile
bool save_profile()
Opens Profile Dialog for loading a .ini File.
Definition: xsettingsmodel.cpp:513
XSettingsModel::profile
QString profile()
Path to fgfs executable.
Definition: xsettingsmodel.cpp:726
XSettingsModel::read_default_ini
void read_default_ini()
Read Values from ini.
Definition: xsettingsmodel.cpp:351
XSettingsModel
The XSettingsModel is an extended QStandardItemModel, and the main "setting and state" for FGx.
Definition: xsettingsmodel.h:23
XSettingsModel::terrasync_data_path
QString terrasync_data_path()
Path to terrasync executable.
Definition: xsettingsmodel.cpp:793
XSettingsModel::fgroot
QString fgroot()
Definition: xsettingsmodel.cpp:857
XSettingsModel::load_last_profile
void load_last_profile(QString profile)
Opens last used profile.
Definition: xsettingsmodel.cpp:400