summaryrefslogtreecommitdiffhomepage
path: root/opentrack
diff options
context:
space:
mode:
Diffstat (limited to 'opentrack')
-rw-r--r--opentrack/main-settings.hpp5
-rw-r--r--opentrack/options.hpp24
-rw-r--r--opentrack/shortcuts.h5
3 files changed, 27 insertions, 7 deletions
diff --git a/opentrack/main-settings.hpp b/opentrack/main-settings.hpp
index 0468aeb1..27f9ee06 100644
--- a/opentrack/main-settings.hpp
+++ b/opentrack/main-settings.hpp
@@ -22,8 +22,7 @@ private:
}
};
-struct main_settings {
- pbundle b;
+struct main_settings : opts {
value<QString> tracker_dll, tracker2_dll, filter_dll, protocol_dll;
axis_opts a_x, a_y, a_z, a_yaw, a_pitch, a_roll;
value<bool> tcomp_p, tcomp_tz;
@@ -31,7 +30,7 @@ struct main_settings {
value<int> camera_yaw, camera_pitch;
value<bool> center_at_startup;
main_settings() :
- b(bundle("opentrack-ui")),
+ opts("opentrack-ui"),
tracker_dll(b, "tracker-dll", ""),
tracker2_dll(b, "tracker2-dll", ""),
filter_dll(b, "filter-dll", ""),
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*);
diff --git a/opentrack/shortcuts.h b/opentrack/shortcuts.h
index 4d4b19d3..d0aedec0 100644
--- a/opentrack/shortcuts.h
+++ b/opentrack/shortcuts.h
@@ -104,12 +104,11 @@ public:
mem<KeybindingWorker> keybindingWorker;
#endif
- struct settings {
- pbundle b;
+ struct settings : opts {
key_opts center, toggle, zero;
main_settings s_main;
settings() :
- b(bundle("keyboard-shortcuts")),
+ opts("keyboard-shortcuts"),
center(b, "center"),
toggle(b, "toggle"),
zero(b, "zero")