FGx  1
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
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