summaryrefslogtreecommitdiffhomepage
path: root/migration
diff options
context:
space:
mode:
Diffstat (limited to 'migration')
-rw-r--r--migration/20160906_00-mappings.cpp26
-rw-r--r--migration/20160906_01-axis-signs.cpp4
-rw-r--r--migration/20160906_02-modules.cpp4
-rw-r--r--migration/20170420_00-udp-naming.cpp2
-rw-r--r--migration/20171013_00-tracker-pt-threshold.cpp11
-rw-r--r--migration/20171020_00-max-pitch-output.cpp4
-rw-r--r--migration/20180102_00-process-detector-separator.cpp8
-rw-r--r--migration/20180118_00-reltrans.cpp4
-rw-r--r--migration/20180428_00-module-names.cpp92
-rw-r--r--migration/20220105_00-pt-grayscale.cpp38
-rw-r--r--migration/20220126_00-camera-name.cpp79
-rw-r--r--migration/CMakeLists.txt5
-rw-r--r--migration/lang/de_DE.ts4
-rw-r--r--migration/lang/zh_CN.ts2
-rw-r--r--migration/migration.cpp145
-rw-r--r--migration/migration.hpp67
16 files changed, 373 insertions, 122 deletions
diff --git a/migration/20160906_00-mappings.cpp b/migration/20160906_00-mappings.cpp
index 567fbdcb..2bc00084 100644
--- a/migration/20160906_00-mappings.cpp
+++ b/migration/20160906_00-mappings.cpp
@@ -18,6 +18,8 @@
#include <QDebug>
+using namespace options;
+using namespace options::globals;
using namespace migrations;
static const char* const old_names[] =
@@ -43,22 +45,22 @@ static QList<QList<QPointF>> get_old_splines()
{
QList<QList<QPointF>> ret;
- return group::with_settings_object([&](QSettings& settings) {
+ return with_settings_object([&](QSettings& settings) {
for (const char* name : old_names)
{
+ const int max = settings.value("point-count", 0).toInt();
+
+ if (max < 0 || max > 1 << 16)
+ return ret;
+
QList<QPointF> points;
+ points.reserve(max);
settings.beginGroup(QString("Curves-%1").arg(name));
- const int max = settings.value("point-count", 0).toInt();
-
for (int i = 0; i < max; i++)
- {
- QPointF new_point(settings.value(QString("point-%1-x").arg(i), 0).toDouble(),
- settings.value(QString("point-%1-y").arg(i), 0).toDouble());
-
- points.append(new_point);
- }
+ points.append({ settings.value(QString("point-%1-x").arg(i), 0).toDouble(),
+ settings.value(QString("point-%1-y").arg(i), 0).toDouble() });
settings.endGroup();
@@ -85,7 +87,7 @@ struct mappings_from_2_3_0_rc11 : migration
// run only if old splines exist
for (const QList<QPointF>& points : get_old_splines())
- if (points.size())
+ if (!points.empty())
return true;
}
@@ -95,7 +97,7 @@ struct mappings_from_2_3_0_rc11 : migration
void run() override
{
- group::with_settings_object([this](QSettings&) {
+ with_settings_object([](QSettings&) {
const QList<QList<QPointF>> old_mappings = get_old_splines();
for (int i = 0; i < 12; i++)
@@ -111,4 +113,4 @@ struct mappings_from_2_3_0_rc11 : migration
}
};
-OPENTRACK_MIGRATION(mappings_from_2_3_0_rc11);
+OPENTRACK_MIGRATION(mappings_from_2_3_0_rc11)
diff --git a/migration/20160906_01-axis-signs.cpp b/migration/20160906_01-axis-signs.cpp
index 7b0be70a..eeb6963d 100644
--- a/migration/20160906_01-axis-signs.cpp
+++ b/migration/20160906_01-axis-signs.cpp
@@ -41,7 +41,7 @@ struct axis_signs_split_rc11 : migration
void run() override;
};
-OPENTRACK_MIGRATION(axis_signs_split_rc11);
+OPENTRACK_MIGRATION(axis_signs_split_rc11)
bool axis_signs_split_rc11::should_run() const
{
@@ -73,7 +73,7 @@ void axis_signs_split_rc11::run()
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))));
+ old_bundle->get_variant(alt_sign_fmt.arg(name)));
new_bundle->save();
}
diff --git a/migration/20160906_02-modules.cpp b/migration/20160906_02-modules.cpp
index 9ce2b9dc..46745112 100644
--- a/migration/20160906_02-modules.cpp
+++ b/migration/20160906_02-modules.cpp
@@ -58,10 +58,10 @@ struct split_modules_rc11 : migration
bundle old_bundle = make_bundle("opentrack-ui");
for (const char* name : module_names)
- new_bundle->store_kv(name, QVariant(old_bundle->get<QString>(name)));
+ new_bundle->store_kv(name, old_bundle->get_variant(name));
new_bundle->save();
}
};
-OPENTRACK_MIGRATION(split_modules_rc11);
+OPENTRACK_MIGRATION(split_modules_rc11)
diff --git a/migration/20170420_00-udp-naming.cpp b/migration/20170420_00-udp-naming.cpp
index 0361b7b9..d8117526 100644
--- a/migration/20170420_00-udp-naming.cpp
+++ b/migration/20170420_00-udp-naming.cpp
@@ -51,4 +51,4 @@ struct rename_udp_stuff : migration
}
};
-OPENTRACK_MIGRATION(rename_udp_stuff);
+OPENTRACK_MIGRATION(rename_udp_stuff)
diff --git a/migration/20171013_00-tracker-pt-threshold.cpp b/migration/20171013_00-tracker-pt-threshold.cpp
index aab64de7..23f10659 100644
--- a/migration/20171013_00-tracker-pt-threshold.cpp
+++ b/migration/20171013_00-tracker-pt-threshold.cpp
@@ -24,7 +24,6 @@ struct move_int_to_slider : migration
return "20171013_00";
}
-
QString name() const override
{
return "tracker/pt threshold slider (int -> slider_value)";
@@ -32,22 +31,22 @@ struct move_int_to_slider : migration
bool should_run() const override
{
- bundle b = make_bundle("tracker-pt");
+ bundle b = make_bundle(bundle_name);
return b->contains(old_name) && !b->contains(new_name);
}
void run() override
{
- bundle b = make_bundle("tracker-pt");
+ bundle b = make_bundle(bundle_name);
value<int> old_val(b, old_name, 128);
- value<slider_value> new_val(b, new_name, slider_value(128, 0, 255));
+ value<slider_value> new_val(b, new_name, { 128, 0, 255 });
- new_val = slider_value(old_val.to<int>(), 0, 255);
+ new_val = { *old_val, 0, 255 };
b->save();
}
};
-OPENTRACK_MIGRATION(move_int_to_slider);
+OPENTRACK_MIGRATION(move_int_to_slider)
diff --git a/migration/20171020_00-max-pitch-output.cpp b/migration/20171020_00-max-pitch-output.cpp
index 0699ac48..868bb5b8 100644
--- a/migration/20171020_00-max-pitch-output.cpp
+++ b/migration/20171020_00-max-pitch-output.cpp
@@ -49,7 +49,7 @@ struct max_pitch_output : migration
spline& pitch_spline_2 = pitch_map.spline_alt;
for (const spline& spl : { pitch_spline_1, pitch_spline_2 })
- for (QPointF& point : spl.get_points())
+ for (const QPointF& point : spl.get_points())
if (point.y() - 1e-2 > 90)
return true;
@@ -67,4 +67,4 @@ struct max_pitch_output : migration
}
};
-OPENTRACK_MIGRATION(max_pitch_output);
+OPENTRACK_MIGRATION(max_pitch_output)
diff --git a/migration/20180102_00-process-detector-separator.cpp b/migration/20180102_00-process-detector-separator.cpp
index ddb01cb4..3656bf73 100644
--- a/migration/20180102_00-process-detector-separator.cpp
+++ b/migration/20180102_00-process-detector-separator.cpp
@@ -2,6 +2,7 @@
#include "options/options.hpp"
using namespace options;
+using namespace options::globals;
using namespace migrations;
static constexpr auto OLD_RECORD_SEPARATOR = QChar('|');
@@ -26,7 +27,7 @@ struct process_detector_record_separator : migration
bool should_run() const override
{
- return group::with_global_settings_object([](const QSettings& s)
+ return with_global_settings_object([](const QSettings& s)
{
const QString old_value = s.value(KEY_NAME).toString();
return old_value.contains(OLD_RECORD_SEPARATOR);
@@ -35,14 +36,15 @@ struct process_detector_record_separator : migration
void run() override
{
- return group::with_global_settings_object([](QSettings& s)
+ return with_global_settings_object([](QSettings& s)
{
QString value = s.value(KEY_NAME).toString();
value.replace(OLD_UNIT_SEPARATOR, NEW_UNIT_SEPARATOR);
value.replace(OLD_RECORD_SEPARATOR, NEW_RECORD_SEPARATOR);
s.setValue(KEY_NAME, value);
+ mark_global_ini_modified();
});
}
};
-OPENTRACK_MIGRATION(process_detector_record_separator);
+OPENTRACK_MIGRATION(process_detector_record_separator)
diff --git a/migration/20180118_00-reltrans.cpp b/migration/20180118_00-reltrans.cpp
index ba35e7f0..09e3847e 100644
--- a/migration/20180118_00-reltrans.cpp
+++ b/migration/20180118_00-reltrans.cpp
@@ -35,10 +35,10 @@ struct reltrans_enum : migration
void run() override
{
auto b = make_bundle("opentrack-ui");
- bool value = b->get<bool>(old_name);
+ bool value = b->get_variant(old_name).value<bool>();
b->store_kv(new_name, int(value ? reltrans_enabled : reltrans_disabled));
b->save();
}
};
-OPENTRACK_MIGRATION(reltrans_enum);
+OPENTRACK_MIGRATION(reltrans_enum)
diff --git a/migration/20180428_00-module-names.cpp b/migration/20180428_00-module-names.cpp
new file mode 100644
index 00000000..9558829f
--- /dev/null
+++ b/migration/20180428_00-module-names.cpp
@@ -0,0 +1,92 @@
+#include "migration.hpp"
+#include "options/options.hpp"
+
+using namespace migrations;
+using namespace options;
+
+#include "api/plugin-support.hpp"
+#include "compat/library-path.hpp"
+
+struct module_names : migration
+{
+ using dylib_ptr = Modules::dylib_ptr;
+ using dylib_list = Modules::dylib_list;
+
+ struct module_type {
+ QString name, def;
+ dylib_list const& list;
+ };
+
+ Modules m { OPENTRACK_BASE_PATH + OPENTRACK_LIBRARY_PATH, dylib_load_quiet };
+
+ module_type types[3] {
+ { "tracker-dll", "pt", m.trackers() },
+ { "protocol-dll", "freetrack", m.protocols() },
+ { "filter-dll", "accela", m.filters() },
+ };
+
+ bundle b { make_bundle("modules") };
+
+ QString unique_date() const override
+ {
+ return "20180428_00";
+ }
+
+ QString name() const override
+ {
+ return "module names";
+ }
+
+ bool should_run() const override
+ {
+ for (const module_type& type : types)
+ {
+ if (!b->contains(type.name))
+ continue;
+
+ const QString value = b->get_variant(type.name).value<QString>();
+
+ for (const dylib_ptr& lib : type.list)
+ {
+ if (value == lib->name && value != lib->module_name)
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ void run() override
+ {
+ for (module_type& type : types)
+ {
+ if (!b->contains(type.name))
+ continue;
+
+ const QString value = b->get_variant(type.name).value<QString>();
+
+ bool found = false;
+
+ for (const dylib_ptr& lib : type.list)
+ {
+ if (value == lib->name && value != lib->module_name)
+ {
+ qDebug() << type.name << value << "=>" << lib->module_name;
+ b->store_kv(type.name, lib->module_name);
+ found = true;
+ break;
+ }
+ }
+
+ if (!found)
+ {
+ qDebug() << type.name << value << "not found";
+ b->store_kv(type.name, QVariant());
+ }
+ }
+
+ b->save();
+ }
+};
+
+OPENTRACK_MIGRATION(module_names)
diff --git a/migration/20220105_00-pt-grayscale.cpp b/migration/20220105_00-pt-grayscale.cpp
new file mode 100644
index 00000000..44bdc470
--- /dev/null
+++ b/migration/20220105_00-pt-grayscale.cpp
@@ -0,0 +1,38 @@
+#include "migration.hpp"
+#include "options/options.hpp"
+
+using namespace migrations;
+using namespace options;
+
+#include "api/plugin-support.hpp"
+#include "compat/library-path.hpp"
+
+struct pt_color_grayscale : migration
+{
+ bundle b { make_bundle("tracker-pt") };
+ enum : int { pt_color_average = 5, pt_color_bt709 = 2, };
+
+ QString unique_date() const override
+ {
+ return "20220105_00";
+ }
+
+ QString name() const override
+ {
+ return "pt color enum";
+ }
+
+ bool should_run() const override
+ {
+ auto x = b->get_variant("blob-color").toInt();
+ return x == pt_color_average;
+ }
+
+ void run() override
+ {
+ b->store_kv("blob-color", QVariant::fromValue((int)pt_color_bt709));
+ b->save();
+ }
+};
+
+OPENTRACK_MIGRATION(pt_color_grayscale)
diff --git a/migration/20220126_00-camera-name.cpp b/migration/20220126_00-camera-name.cpp
new file mode 100644
index 00000000..adb6d718
--- /dev/null
+++ b/migration/20220126_00-camera-name.cpp
@@ -0,0 +1,79 @@
+#ifdef _WIN32
+#include "migration.hpp"
+#include "options/options.hpp"
+#include "compat/camera-names.hpp"
+
+using namespace migrations;
+using namespace options;
+
+#include "api/plugin-support.hpp"
+#include "compat/library-path.hpp"
+#include <tuple>
+#include <QString>
+
+static const std::tuple<const char*, const char*> modules[] = {
+ { "tracker-aruco", "camera-name" },
+ { "tracker-easy", "camera-name" },
+ { "neuralnet-tracker", "camera-name" },
+ { "tracker-pt", "camera-name" },
+};
+
+struct win32_camera_name : migration
+{
+ QString unique_date() const override
+ {
+ return "20220126_00";
+ }
+
+ QString name() const override
+ {
+ return "camera name";
+ }
+
+ bool should_run() const override
+ {
+ for (const auto& [name, prop] : modules)
+ {
+ bundle b { make_bundle(name) };
+ QString str = b->get_variant(prop).toString();
+ if (!str.isEmpty() && !str.contains(" ["))
+ return true;
+ }
+ return false;
+ }
+
+ void run() override
+ {
+ auto cameras = get_camera_names();
+
+ for (const auto& [bundle_name, prop] : modules)
+ {
+ bundle b { make_bundle(bundle_name) };
+ QString name = b->get_variant(prop).toString();
+ if (name.isEmpty() || name.contains(" ["))
+ continue;
+ auto full_name_of = [&](const QString& str) {
+ QString ret = str;
+ auto prefix = str + " [";
+ for (const auto& [x, _] : cameras)
+ {
+ if (x == str)
+ return str;
+ if (x.startsWith(prefix))
+ ret = x;
+ }
+ return ret;
+ };
+ auto full_name = full_name_of(name);
+ if (name != full_name)
+ {
+ b->store_kv(prop, full_name);
+ b->save();
+ }
+ }
+ }
+};
+
+OPENTRACK_MIGRATION(win32_camera_name)
+
+#endif
diff --git a/migration/CMakeLists.txt b/migration/CMakeLists.txt
index 9a7f7dc9..effeddcb 100644
--- a/migration/CMakeLists.txt
+++ b/migration/CMakeLists.txt
@@ -1,2 +1,5 @@
otr_module(migration BIN)
-target_link_libraries(opentrack-migration opentrack-logic opentrack-spline)
+target_link_libraries(${self} opentrack-logic opentrack-spline)
+if(CMAKE_COMPILER_IS_CLANGXX)
+ target_compile_options(${self} PRIVATE -Wno-weak-vtables)
+endif()
diff --git a/migration/lang/de_DE.ts b/migration/lang/de_DE.ts
new file mode 100644
index 00000000..1552582e
--- /dev/null
+++ b/migration/lang/de_DE.ts
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="de_DE">
+</TS>
diff --git a/migration/lang/zh_CN.ts b/migration/lang/zh_CN.ts
index 6401616d..e5ca8aa9 100644
--- a/migration/lang/zh_CN.ts
+++ b/migration/lang/zh_CN.ts
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
-<TS version="2.1">
+<TS version="2.1" language="zh_CN">
</TS>
diff --git a/migration/migration.cpp b/migration/migration.cpp
index b92d6384..f4b1739b 100644
--- a/migration/migration.cpp
+++ b/migration/migration.cpp
@@ -20,17 +20,31 @@
#include <memory>
+using namespace options::globals;
+
// individual migrations are run in the UI thread. they can be interactive if necessary.
-namespace migrations {
+namespace migrations::detail {
+
-namespace detail {
+std::vector<mptr>& migrator::migration_list()
+{
+ static std::vector<mptr> v;
+ return v;
+}
-void migrator::register_migration(migration* m)
+std::vector<mfun>& migrator::migration_thunks()
+{
+ static std::vector<mfun> v;
+ return v;
+}
+
+
+void migrator::register_migration(mptr const& m)
{
const QString date = m->unique_date();
- for (migration* m2 : migrations())
+ for (mptr const& m2 : migration_list())
if (m2->unique_date() == date)
std::abort();
@@ -47,15 +61,13 @@ void migrator::register_migration(migration* m)
bool ok = true;
- if (year < "2016")
- abort();
-
- const int month_ = to_int(month, ok), day_ = to_int(day, ok);
+ const int year_ = to_int(year, ok),
+ month_ = to_int(month, ok),
+ day_ = to_int(day, ok);
- (void) to_int(year, ok);
- (void) to_int(serial, ok);
+ (void)to_int(serial, ok);
- if (!ok)
+ if (!ok || year_ < 1970)
abort();
if (month_ < 1 || month_ > 12)
@@ -64,20 +76,45 @@ void migrator::register_migration(migration* m)
if (day_ < 1 || day_ > 31)
abort();
- migrations().push_back(m);
+ migration_list().push_back(m);
}
-std::vector<migration*>& migrator::migrations()
+void migrator::eval_thunks()
{
- static std::vector<migration*> ret;
- return ret;
+ for (auto& fun : migration_thunks())
+ {
+ mptr m = fun();
+ register_migration(m);
+ }
+ if (!migration_thunks().empty())
+ sort_migrations();
+ migration_thunks().clear();
+}
+
+void migrator::add_migration_thunk(mfun& thunk)
+{
+ migration_thunks().push_back(thunk);
+}
+
+std::vector<mptr>& migrator::migrations()
+{
+ eval_thunks();
+ return migration_list();
+}
+
+void migrator::sort_migrations()
+{
+ std::sort(migration_list().begin(), migration_list().end(),
+ [](const mptr x, const mptr y) {
+ return x->unique_date() < y->unique_date();
+ });
}
QString migrator::last_migration_time()
{
QString ret;
- options::group::with_settings_object([&](QSettings& s) {
+ with_settings_object([&](QSettings& s) {
s.beginGroup("migrations");
ret = s.value("last-migration-at", "19700101_00").toString();
s.endGroup();
@@ -88,9 +125,9 @@ QString migrator::last_migration_time()
QString migrator::time_after_migrations()
{
- const std::vector<migration*> list = sorted_migrations();
+ const std::vector<mptr>& list = migrations();
- if (list.size() == 0u)
+ if (list.empty())
return QStringLiteral("19700101_00");
QString ret = list[list.size() - 1]->unique_date();
@@ -101,28 +138,18 @@ QString migrator::time_after_migrations()
void migrator::set_last_migration_time(const QString& val)
{
- options::group::with_settings_object([&](QSettings& s) {
+ with_settings_object([&](QSettings& s) {
s.beginGroup("migrations");
const QString old_value = s.value("last-migration-at", "").toString();
if (val != old_value)
{
s.setValue("last-migration-at", val);
- options::group::mark_ini_modified();
+ options::globals::detail::mark_ini_modified();
}
s.endGroup();
});
}
-std::vector<migration*> migrator::sorted_migrations()
-{
- std::vector<migration*> list(migrations());
-
- using mm = migration*;
-
- std::sort(list.begin(), list.end(), [](const mm x, const mm y) { return x->unique_date() < y->unique_date(); });
- return list;
-}
-
int migrator::to_int(const QString& str, bool& ok)
{
bool tmp = false;
@@ -133,61 +160,55 @@ int migrator::to_int(const QString& str, bool& ok)
std::vector<QString> migrator::run()
{
- std::vector<migration*> migrations = sorted_migrations();
std::vector<QString> done;
const QString last_migration = last_migration_time();
- for (migration* m_ : migrations)
- {
- migration& m(*m_);
-
- const QString date = m.unique_date();
-
- if (date <= last_migration)
- continue;
-
- if (m.should_run())
+ with_settings_object([&](QSettings&) {
+ for (mptr const& m : migrations())
{
- m.run();
- done.push_back(m.name());
+ const QString date = m->unique_date();
+
+ if (date <= last_migration)
+ continue;
+
+ if (m->should_run())
+ {
+ const QByteArray name = m->name().toUtf8();
+ const QByteArray date = m->unique_date().toUtf8();
+ qDebug() << "migrate:" << date.constData() << name.constData();
+ m->run();
+ done.push_back(m->name());
+ }
}
- }
-
- mark_config_as_not_needing_migration();
-
- if (done.size())
- {
- for (const QString& name : done)
- {
- const QByteArray data = name.toUtf8();
- qDebug() << "migrate:" << data.constData();
- }
- }
+ mark_profile_as_not_needing_migration();
+ });
return done;
}
-}
+} // ns migrations::detail
+
+namespace migrations {
-migration::migration() {}
-migration::~migration() {}
+migration::migration() = default;
+migration::~migration() = default;
-} // ns
+} // ns migrations
std::vector<QString> run_migrations()
{
return migrations::detail::migrator::run();
}
-void mark_config_as_not_needing_migration()
+void mark_profile_as_not_needing_migration()
{
using m = migrations::detail::migrator;
- m::mark_config_as_not_needing_migration();
+ m::mark_profile_as_not_needing_migration();
}
-void migrations::detail::migrator::mark_config_as_not_needing_migration()
+void migrations::detail::migrator::mark_profile_as_not_needing_migration()
{
set_last_migration_time(time_after_migrations());
}
diff --git a/migration/migration.hpp b/migration/migration.hpp
index 5f99de7a..7fc18c97 100644
--- a/migration/migration.hpp
+++ b/migration/migration.hpp
@@ -9,29 +9,43 @@
#pragma once
#include <QString>
-#include <vector>
-
#include "export.hpp"
+#include <memory>
+#include <vector>
+#include <functional>
+
namespace migrations {
-class migration;
+struct migration;
class registrator;
namespace detail {
- class migrator final
+ using mptr = std::shared_ptr<migration>;
+ using mfun = std::function<mptr ()>;
+
+ struct migrator
{
- static std::vector<migration*>& migrations();
+ static std::vector<QString> run();
+ static void add_migration_thunk(std::function<mptr()>& thunk);
+ static void mark_profile_as_not_needing_migration();
+
+ private:
+ static void sort_migrations();
+
+ static void register_migration(const mptr& m);
+ static std::vector<mptr>& migrations();
+
+ static void eval_thunks();
+
static QString last_migration_time();
static QString time_after_migrations();
+
static void set_last_migration_time(const QString& val);
- migrator() = delete;
- static std::vector<migration*> sorted_migrations();
static int to_int(const QString& str, bool& ok);
- public:
- static std::vector<QString> run();
- static void register_migration(migration* m);
- static void mark_config_as_not_needing_migration();
+
+ static std::vector<mptr>& migration_list();
+ static std::vector<mfun>& migration_thunks();
};
template<typename t>
@@ -39,31 +53,28 @@ namespace detail {
{
registrator()
{
- static t m;
- migrator::register_migration(static_cast<migration*>(&m));
+ mfun f { [] { return std::shared_ptr<migration>(new t); } };
+
+ migrator::add_migration_thunk(f);
}
};
}
-#ifndef __COUNTER__
-# error "oops, need __COUNTER__ extension for preprocessor"
-#endif
+#define OPENTRACK_MIGRATION3(type, ctr) \
+ static const char init_##ctr = (::migrations::detail::registrator<type>{}, 0);
-#define OPENTRACK_MIGRATION(type) static ::migrations::detail::registrator<type> opentrack_migration_registrator__ ## __COUNTER__ ## _gensym
+#define OPENTRACK_MIGRATION2(type, ctr) \
+ OPENTRACK_MIGRATION3(type, ctr)
-#ifdef Q_CREATOR_RUN
-# pragma clang diagnostic ignored "-Wweak-vtables"
-#endif
+#define OPENTRACK_MIGRATION(type) \
+ OPENTRACK_MIGRATION2(type, __COUNTER__)
-class migration
+struct migration
{
- migration& operator=(const migration&) = delete;
+ migration();
migration(const migration&) = delete;
- migration& operator=(migration&&) = delete;
- migration(migration&&) = delete;
+ migration& operator=(const migration&) = delete;
-public:
- migration();
virtual ~migration();
virtual QString unique_date() const = 0;
virtual QString name() const = 0;
@@ -71,7 +82,7 @@ public:
virtual void run() = 0;
};
-}
+} // ns migrations
OTR_MIGRATION_EXPORT std::vector<QString> run_migrations();
-OTR_MIGRATION_EXPORT void mark_config_as_not_needing_migration();
+OTR_MIGRATION_EXPORT void mark_profile_as_not_needing_migration();