summaryrefslogtreecommitdiffhomepage
path: root/migration
diff options
context:
space:
mode:
Diffstat (limited to 'migration')
-rw-r--r--migration/20160906_00-mappings.cpp4
-rw-r--r--migration/20160906_01-axis-signs.cpp77
-rw-r--r--migration/20160906_02-modules.cpp22
-rw-r--r--migration/20170420_00-udp-naming.cpp8
-rw-r--r--migration/20171013_00-tracker-pt-threshold.cpp6
5 files changed, 58 insertions, 59 deletions
diff --git a/migration/20160906_00-mappings.cpp b/migration/20160906_00-mappings.cpp
index 0712afca..567fbdcb 100644
--- a/migration/20160906_00-mappings.cpp
+++ b/migration/20160906_00-mappings.cpp
@@ -20,7 +20,7 @@
using namespace migrations;
-static const char* old_names[] =
+static const char* const old_names[] =
{
"tx", "tx_alt",
"ty", "ty_alt",
@@ -30,7 +30,7 @@ static const char* old_names[] =
"rz", "rz_alt",
};
-static const char* new_names[] = {
+static const char* const new_names[] = {
"spline-X", "alt-spline-X",
"spline-Y", "alt-spline-Y",
"spline-Z", "alt-spline-Z",
diff --git a/migration/20160906_01-axis-signs.cpp b/migration/20160906_01-axis-signs.cpp
index 6dfa0d7c..7b0be70a 100644
--- a/migration/20160906_01-axis-signs.cpp
+++ b/migration/20160906_01-axis-signs.cpp
@@ -15,13 +15,18 @@
using namespace options;
using namespace migrations;
+const char* const axis_names[] =
+{
+ "yaw", "pitch", "roll",
+ "x", "y", "z",
+};
+
+const QString alt_sign_fmt = QStringLiteral("%1-alt-axis-sign");
+
struct axis_signs_split_rc11 : migration
{
axis_signs_split_rc11() = default;
- static const char* axis_names[6];
- static const QString fmt;
-
QString unique_date() const override
{
return "20160909_01";
@@ -32,47 +37,43 @@ struct axis_signs_split_rc11 : migration
return "asymmetric axis option to other section";
}
- bool should_run() const override
+ bool should_run() const override;
+ void run() override;
+};
+
+OPENTRACK_MIGRATION(axis_signs_split_rc11);
+
+bool axis_signs_split_rc11::should_run() const
+{
+ bundle new_bundle = make_bundle("opentrack-mappings");
+ bundle old_bundle = make_bundle("opentrack-ui");
+
+ for (const char* name : axis_names)
{
- bundle new_bundle = make_bundle("opentrack-mappings");
- bundle old_bundle = make_bundle("opentrack-ui");
-
- for (const char* name : axis_names)
- {
- // new present, already applied
- if (new_bundle->contains(fmt.arg(name)))
- return false;
- }
-
- for (const char* name : axis_names)
- {
- // old present
- if (old_bundle->contains(fmt.arg(name)))
- return true;
- }
-
- // nothing to copy
- return false;
+ // new present, already applied
+ if (new_bundle->contains(alt_sign_fmt.arg(name)))
+ return false;
}
- void run() override
+ for (const char* name : axis_names)
{
- bundle new_bundle = make_bundle("opentrack-mappings");
- bundle old_bundle = make_bundle("opentrack-ui");
-
- for (const char* name : axis_names)
- new_bundle->store_kv(fmt.arg(name), QVariant(old_bundle->get<bool>(fmt.arg(name))));
-
- new_bundle->save();
+ // old present
+ if (old_bundle->contains(alt_sign_fmt.arg(name)))
+ return true;
}
-};
-const char* axis_signs_split_rc11::axis_names[] =
+ // nothing to copy
+ return false;
+}
+
+void axis_signs_split_rc11::run()
{
- "yaw", "pitch", "roll",
- "x", "y", "z",
-};
+ bundle new_bundle = make_bundle("opentrack-mappings");
+ bundle old_bundle = make_bundle("opentrack-ui");
-const QString axis_signs_split_rc11::fmt = QStringLiteral("%1-alt-axis-sign");
+ for (const char* name : axis_names)
+ new_bundle->store_kv(alt_sign_fmt.arg(name),
+ QVariant(old_bundle->get<bool>(alt_sign_fmt.arg(name))));
-OPENTRACK_MIGRATION(axis_signs_split_rc11);
+ new_bundle->save();
+}
diff --git a/migration/20160906_02-modules.cpp b/migration/20160906_02-modules.cpp
index 0f0951f1..9ce2b9dc 100644
--- a/migration/20160906_02-modules.cpp
+++ b/migration/20160906_02-modules.cpp
@@ -15,12 +15,17 @@
using namespace options;
using namespace migrations;
+static const char* const module_names[3] =
+{
+ "tracker-dll",
+ "protocol-dll",
+ "filter-dll",
+};
+
struct split_modules_rc11 : migration
{
split_modules_rc11() = default;
- static const char* names[3];
-
QString unique_date() const override
{
return "20160909_02";
@@ -36,11 +41,11 @@ struct split_modules_rc11 : migration
bundle new_bundle = make_bundle("modules");
bundle old_bundle = make_bundle("opentrack-ui");
- for (const char* name : names)
+ for (const char* name : module_names)
if (new_bundle->contains(name))
return false;
- for (const char* name : names)
+ for (const char* name : module_names)
if (old_bundle->contains(name))
return true;
@@ -52,18 +57,11 @@ struct split_modules_rc11 : migration
bundle new_bundle = make_bundle("modules");
bundle old_bundle = make_bundle("opentrack-ui");
- for (const char* name : names)
+ for (const char* name : module_names)
new_bundle->store_kv(name, QVariant(old_bundle->get<QString>(name)));
new_bundle->save();
}
};
-const char* split_modules_rc11::names[3] =
-{
- "tracker-dll",
- "protocol-dll",
- "filter-dll",
-};
-
OPENTRACK_MIGRATION(split_modules_rc11);
diff --git a/migration/20170420_00-udp-naming.cpp b/migration/20170420_00-udp-naming.cpp
index de4674bd..0361b7b9 100644
--- a/migration/20170420_00-udp-naming.cpp
+++ b/migration/20170420_00-udp-naming.cpp
@@ -13,11 +13,11 @@
using namespace migrations;
using namespace options;
-static constexpr const char* old_tracker_name = "UDP sender";
-static constexpr const char* old_proto_name = "UDP Tracker";
+static const char* const old_tracker_name = "UDP sender";
+static const char* const old_proto_name = "UDP Tracker";
-static constexpr const char* new_tracker_name = "UDP over network";
-static constexpr const char* new_proto_name = "UDP over network";
+static const char* const new_tracker_name = "UDP over network";
+static const char* const new_proto_name = "UDP over network";
struct rename_udp_stuff : migration
{
diff --git a/migration/20171013_00-tracker-pt-threshold.cpp b/migration/20171013_00-tracker-pt-threshold.cpp
index 32e69f6d..aab64de7 100644
--- a/migration/20171013_00-tracker-pt-threshold.cpp
+++ b/migration/20171013_00-tracker-pt-threshold.cpp
@@ -13,9 +13,9 @@
using namespace options;
using namespace migrations;
-static constexpr const char* old_name = "threshold-primary";
-static constexpr const char* new_name = "threshold-slider";
-static constexpr const char* bundle_name = "tracker-pt";
+static const char* const old_name = "threshold-primary";
+static const char* const new_name = "threshold-slider";
+static const char* const bundle_name = "tracker-pt";
struct move_int_to_slider : migration
{