2017-02-21 11:01:06 +00:00
|
|
|
#ifndef FG_GUI_LAUNCHCONFIG_HXX
|
|
|
|
#define FG_GUI_LAUNCHCONFIG_HXX
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QVariant>
|
|
|
|
|
|
|
|
namespace flightgear { class Options; }
|
|
|
|
|
|
|
|
class LaunchConfig : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
Q_PROPERTY(QString defaultDownloadDir READ defaultDownloadDir CONSTANT)
|
2017-07-19 18:24:33 +00:00
|
|
|
Q_PROPERTY(bool enableDownloadDirUI READ enableDownloadDirUI CONSTANT)
|
2017-02-21 11:01:06 +00:00
|
|
|
public:
|
|
|
|
class Arg
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit Arg(QString k, QString v = QString()) : arg(k), value(v) {}
|
|
|
|
|
|
|
|
QString arg;
|
|
|
|
QString value;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
LaunchConfig(QObject* parent = nullptr);
|
|
|
|
|
|
|
|
void reset();
|
|
|
|
void applyToOptions() const;
|
|
|
|
|
|
|
|
std::vector<Arg> values() const;
|
|
|
|
|
|
|
|
Q_INVOKABLE void setArg(QString name, QString value = QString());
|
|
|
|
|
|
|
|
Q_INVOKABLE void setArg(const std::string& name, const std::string& value = std::string());
|
|
|
|
|
|
|
|
Q_INVOKABLE void setProperty(QString path, QVariant value);
|
|
|
|
|
|
|
|
Q_INVOKABLE void setEnableDisableOption(QString name, bool value);
|
|
|
|
|
2018-06-22 11:09:35 +00:00
|
|
|
Q_INVOKABLE QString htmlForCommandLine();
|
2017-12-15 15:42:36 +00:00
|
|
|
|
|
|
|
|
2017-02-21 11:01:06 +00:00
|
|
|
// ensure a property is /not/ set?
|
|
|
|
|
|
|
|
// save and restore API?
|
|
|
|
|
2017-12-15 15:42:36 +00:00
|
|
|
Q_INVOKABLE QVariant getValueForKey(QString group, QString key, QVariant defaultValue = QVariant()) const;
|
|
|
|
Q_INVOKABLE void setValueForKey(QString group, QString key, QVariant var);
|
|
|
|
|
2017-02-21 11:01:06 +00:00
|
|
|
QString defaultDownloadDir() const;
|
|
|
|
|
2017-07-19 18:24:33 +00:00
|
|
|
bool enableDownloadDirUI() const;
|
|
|
|
|
|
|
|
static void setEnableDownloadDirUI(bool enableDownloadDirUI);
|
|
|
|
|
2017-02-21 11:01:06 +00:00
|
|
|
signals:
|
|
|
|
void collect();
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<Arg> m_values;
|
|
|
|
QString m_defaultDownloadDir;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|