diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-05-22 15:55:31 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-05-22 15:55:31 +0200 |
commit | 65bad699fc8472b49189a412f730409eb2e96311 (patch) | |
tree | 748a9ba239427447dc1cbf93815ed182f574998a /opentrack/options.hpp | |
parent | ca510926a258e0e332deb1dce427f4ff629c9348 (diff) |
all: implicitly cancel on form dialog close
Diffstat (limited to 'opentrack/options.hpp')
-rw-r--r-- | opentrack/options.hpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/opentrack/options.hpp b/opentrack/options.hpp index 23ce6f7b..c33c2f53 100644 --- a/opentrack/options.hpp +++ b/opentrack/options.hpp @@ -28,6 +28,8 @@ #include <QLabel> #include <QTabWidget> #include <QCoreApplication> +#include <QFileInfo> +#include <QDir> #include <cinttypes> @@ -135,6 +137,14 @@ namespace options { QSettings settings(group::org); return settings.value(filename_key, QCoreApplication::applicationDirPath() + default_path).toString(); } + + static const QStringList ini_list() + { + QFileInfo info(group::ini_pathname()); + QDir settings_dir(info.dir()); + return settings_dir.entryList( QStringList { "*.ini" } , QDir::Files, QDir::Name ); + } + static const mem<QSettings> ini_file() { return std::make_shared<QSettings>(ini_pathname(), QSettings::IniFormat); @@ -351,7 +361,19 @@ namespace options { *this = static_cast<t>(*this); } }; - + + struct opts + { + pbundle b; + + opts(const std::string& name) : b(bundle(name)) {} + + ~opts() + { + b->reload(); + } + }; + template<typename t, typename q> inline void tie_setting(value<t>&, q*); |