summaryrefslogtreecommitdiffhomepage
path: root/migration/20160906_02-modules.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-09-09 20:37:49 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-09-09 20:41:56 +0200
commit919bbd2aad26bd73b0dfbc9243ccb7d89fdb8fb1 (patch)
tree533a6add03546810bbbb204e37ea5f3b76087e9a /migration/20160906_02-modules.cpp
parent29c0a4009696fa25d01bf9ab868c961e11f8a174 (diff)
migration: new - move to module section
Diffstat (limited to 'migration/20160906_02-modules.cpp')
-rw-r--r--migration/20160906_02-modules.cpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/migration/20160906_02-modules.cpp b/migration/20160906_02-modules.cpp
new file mode 100644
index 00000000..ea635f67
--- /dev/null
+++ b/migration/20160906_02-modules.cpp
@@ -0,0 +1,61 @@
+#include "migration.hpp"
+#include "options/options.hpp"
+
+#include <QString>
+#include <QVariant>
+
+using namespace options;
+using namespace migrations;
+
+struct split_modules_rc11 : migration
+{
+ split_modules_rc11() = default;
+
+ static const char* names[3];
+
+ QString unique_date() const override
+ {
+ return "20160909_02";
+ }
+
+ QString name() const override
+ {
+ return "split modules to their own section";
+ }
+
+ bool should_run() const override
+ {
+ bundle new_bundle = make_bundle("modules");
+ bundle old_bundle = make_bundle("opentrack-ui");
+
+ for (const char* name : names)
+ if (new_bundle->contains(name))
+ return false;
+
+ for (const char* name : names)
+ if (old_bundle->contains(name))
+ return true;
+
+ return false;
+ }
+
+ void run() override
+ {
+ bundle new_bundle = make_bundle("modules");
+ bundle old_bundle = make_bundle("opentrack-ui");
+
+ for (const char* name : 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);