summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-10-12 17:02:00 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-10-12 17:08:58 +0000
commit132350f8c5161a5daf4f202ac02cb5f4c0463915 (patch)
tree9a2048f17961d166bd511392143bde6bad5bbf05
parent7d1905251c12c27d7bc2caed03169b6a0fd9f83d (diff)
variant/trackmouse: copy-paste from default on short notice
-rw-r--r--logic/main-settings.cpp15
-rw-r--r--logic/main-settings.hpp1
-rw-r--r--variant/trackmouse/_variant.cmake6
-rw-r--r--variant/trackmouse/lang/nl_NL.ts67
-rw-r--r--variant/trackmouse/lang/ru_RU.ts67
-rw-r--r--variant/trackmouse/lang/stub.ts67
-rw-r--r--variant/trackmouse/lang/zh_CN.ts71
-rw-r--r--variant/trackmouse/trackmouse-settings.cpp27
-rw-r--r--variant/trackmouse/window.cpp332
-rw-r--r--variant/trackmouse/window.hpp81
-rw-r--r--variant/trackmouse/window.ui79
11 files changed, 770 insertions, 43 deletions
diff --git a/logic/main-settings.cpp b/logic/main-settings.cpp
index 53a5054c..901e1845 100644
--- a/logic/main-settings.cpp
+++ b/logic/main-settings.cpp
@@ -1,5 +1,7 @@
#include "main-settings.hpp"
+namespace main_settings_impl {
+
using namespace options;
main_settings::main_settings() :
@@ -61,3 +63,16 @@ key_opts::key_opts(bundle b, const QString& name) :
button(b, QString("button-%1").arg(name), -1)
{}
+key_opts& key_opts::operator=(const key_opts& x)
+{
+ if (&x != this)
+ {
+ keycode = x.keycode();
+ guid = x.guid();
+ button = x.button();
+ }
+
+ return *this;
+}
+
+} // ns main_settings_impl
diff --git a/logic/main-settings.hpp b/logic/main-settings.hpp
index b7a9fdce..41edf3e6 100644
--- a/logic/main-settings.hpp
+++ b/logic/main-settings.hpp
@@ -32,6 +32,7 @@ struct OTR_LOGIC_EXPORT key_opts
value<int> button;
key_opts(bundle b, const QString& name);
+ key_opts& operator=(const key_opts& x);
};
struct OTR_LOGIC_EXPORT module_settings
diff --git a/variant/trackmouse/_variant.cmake b/variant/trackmouse/_variant.cmake
index b54ecf52..404c28ec 100644
--- a/variant/trackmouse/_variant.cmake
+++ b/variant/trackmouse/_variant.cmake
@@ -11,9 +11,11 @@ function(otr_init_variant)
"logic"
"dinput"
"gui"
- "pose-widget"
"spline"
"cv"
- "migration")
+ "migration"
+ "executable"
+ "pose-widget"
+ )
set_property(GLOBAL PROPERTY opentrack-subprojects "${subprojects}")
endfunction()
diff --git a/variant/trackmouse/lang/nl_NL.ts b/variant/trackmouse/lang/nl_NL.ts
index 9e739505..572fd4e7 100644
--- a/variant/trackmouse/lang/nl_NL.ts
+++ b/variant/trackmouse/lang/nl_NL.ts
@@ -1,4 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="nl_NL">
+<context>
+ <name>main_window</name>
+ <message>
+ <source>The Octopus is sad</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source> :: </source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>trackmouse prototype</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Keyboard shortcuts</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>start/stop tracking</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Alt+F10</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>center</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Alt+F11</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>freeze</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Alt+F12</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Sensitivity</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>100%</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Start</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Stop</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Check permissions for your .ini directory:
+
+%1&quot;%2
+
+Exiting now.</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
</TS>
diff --git a/variant/trackmouse/lang/ru_RU.ts b/variant/trackmouse/lang/ru_RU.ts
index f62cf2e1..7b3b9d0b 100644
--- a/variant/trackmouse/lang/ru_RU.ts
+++ b/variant/trackmouse/lang/ru_RU.ts
@@ -1,4 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ru_RU">
+<context>
+ <name>main_window</name>
+ <message>
+ <source>The Octopus is sad</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source> :: </source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>trackmouse prototype</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Keyboard shortcuts</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>start/stop tracking</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Alt+F10</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>center</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Alt+F11</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>freeze</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Alt+F12</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Sensitivity</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>100%</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Start</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Stop</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Check permissions for your .ini directory:
+
+%1&quot;%2
+
+Exiting now.</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
</TS>
diff --git a/variant/trackmouse/lang/stub.ts b/variant/trackmouse/lang/stub.ts
index 6401616d..ce91cd32 100644
--- a/variant/trackmouse/lang/stub.ts
+++ b/variant/trackmouse/lang/stub.ts
@@ -1,4 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
+<context>
+ <name>main_window</name>
+ <message>
+ <source>The Octopus is sad</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source> :: </source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>trackmouse prototype</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Keyboard shortcuts</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>start/stop tracking</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Alt+F10</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>center</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Alt+F11</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>freeze</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Alt+F12</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Sensitivity</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>100%</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Start</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Stop</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Check permissions for your .ini directory:
+
+%1&quot;%2
+
+Exiting now.</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
</TS>
diff --git a/variant/trackmouse/lang/zh_CN.ts b/variant/trackmouse/lang/zh_CN.ts
new file mode 100644
index 00000000..ce91cd32
--- /dev/null
+++ b/variant/trackmouse/lang/zh_CN.ts
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1">
+<context>
+ <name>main_window</name>
+ <message>
+ <source>The Octopus is sad</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source> :: </source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>trackmouse prototype</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Keyboard shortcuts</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>start/stop tracking</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Alt+F10</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>center</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Alt+F11</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>freeze</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Alt+F12</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Sensitivity</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>100%</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Start</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Stop</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Check permissions for your .ini directory:
+
+%1&quot;%2
+
+Exiting now.</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/variant/trackmouse/trackmouse-settings.cpp b/variant/trackmouse/trackmouse-settings.cpp
index 1df88a2d..6d23438c 100644
--- a/variant/trackmouse/trackmouse-settings.cpp
+++ b/variant/trackmouse/trackmouse-settings.cpp
@@ -47,9 +47,9 @@ static void force_main_settings()
module_settings m;
- m.tracker_dll = "PointTracker 1.1";
- m.protocol_dll = "Mouse";
- m.filter_dll = "Accela";
+ m.tracker_dll = "pt";
+ m.protocol_dll = "win32-mouse";
+ m.filter_dll = "accela";
s.b->save();
s.b_map->save();
@@ -85,6 +85,7 @@ static void force_pt_settings()
static void force_mouse_settings()
{
+
mouse_settings s;
s.Mouse_X = Yaw + 1;
@@ -98,13 +99,29 @@ static void force_accela_settings()
// TODO
}
+static void force_shortcut_settings()
+{
+ main_settings s;
+ s.key_toggle_tracking1.keycode = "Alt+F10";
+ s.key_center1.keycode = "Alt+F11";
+ s.key_toggle_press1.keycode = "Alt+F12";
+
+ for (key_opts* k : { &s.key_toggle_tracking1, &s.key_center1, &s.key_toggle_press1 })
+ {
+ k->button = -1;
+ k->guid = {};
+ }
+ s.b->save();
+}
+
void force_trackmouse_settings()
{
- group::with_settings_object([](QSettings&) { // batch config save
+ options::globals::with_settings_object([](QSettings&) {
force_main_settings();
force_spline_settings();
force_pt_settings();
force_mouse_settings();
force_accela_settings();
- });
+ force_shortcut_settings();
+ });
}
diff --git a/variant/trackmouse/window.cpp b/variant/trackmouse/window.cpp
index 73f91c74..bb94f1da 100644
--- a/variant/trackmouse/window.cpp
+++ b/variant/trackmouse/window.cpp
@@ -1,22 +1,338 @@
+/* Copyright (c) 2013-2018, Stanislaw Halik <sthalik@misaki.pl>
+
+ * Permission to use, copy, modify, and/or distribute this
+ * software for any purpose with or without fee is hereby granted,
+ * provided that the above copyright notice and this permission
+ * notice appear in all copies.
+ */
+
#include "window.hpp"
+#include "options/options.hpp"
+#include "migration/migration.hpp"
+#include "compat/check-visible.hpp"
+#include "compat/sleep.hpp"
+#include "compat/macros.hpp"
+#include "compat/library-path.hpp"
+#include "compat/math.hpp"
+#include <algorithm>
+#include <iterator>
+#include <utility>
+
+#include <QMessageBox>
+#include <QDir>
+#include <QFile>
+#include <QString>
+#include <QList>
+#include <QEventLoop>
#include <QApplication>
-void force_trackmouse_settings();
+extern "C" const char* const opentrack_version;
-void window::closeEvent(QCloseEvent* e)
-{
- e->accept();
- QApplication::exit(0);
-}
+using namespace options::globals;
+using namespace options;
+
+#if !defined EXIT_SUCCESS
+# define EXIT_SUCCESS 0
+#endif
-window::window() : QMainWindow()
+#if !defined EXIT_FAILURE
+# define EXIT_FAILURE 1
+#endif
+
+/* FreeBSD sysexits(3)
+ *
+ * The input data was incorrect in some way. This
+ * should only be used for user's data and not system
+ * files.
+ */
+
+#if !defined EX_OSFILE
+# define EX_OSFILE 72
+#endif
+
+void force_trackmouse_settings();
+
+main_window::main_window() : State(OPENTRACK_BASE_PATH + OPENTRACK_LIBRARY_PATH)
{
ui.setupUi(this);
- setAttribute(Qt::WA_QuitOnClose);
+
+ update_button_state(false, false);
+
+ // ctrl+q exits
+ connect(&kbd_quit, SIGNAL(activated()), this, SLOT(exit()));
+
+ if (!set_profile())
+ {
+ die_on_config_not_writable();
+ exit(EX_OSFILE);
+ return;
+ }
+
+ // only tie and connect main screen options after migrations are done
+ // below is fine, set_profile() is called already
+
+ connect(this, &main_window::start_tracker,
+ this, [&] { qDebug() << "start tracker"; start_tracker_(); },
+ Qt::QueuedConnection);
+
+ connect(this, &main_window::stop_tracker,
+ this, [&] { qDebug() << "stop tracker"; stop_tracker_(); },
+ Qt::QueuedConnection);
+
+ connect(ui.btnStartTracker, SIGNAL(clicked()), this, SLOT(start_tracker_()));
+ connect(ui.btnStopTracker, SIGNAL(clicked()), this, SLOT(stop_tracker_()));
force_trackmouse_settings();
+ register_shortcuts();
+ kbd_quit.setEnabled(true);
+
+ setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | windowFlags());
+ setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ adjustSize();
+
+ setVisible(true);
show();
}
+void main_window::register_shortcuts()
+{
+ global_shortcuts.reload({
+ { s.key_toggle_tracking1, [this](bool) { main_window::toggle_tracker_(); }, true },
+ });
+
+ if (work)
+ work->reload_shortcuts();
+}
+
+void main_window::die_on_config_not_writable()
+{
+ stop_tracker_();
+
+ static const QString pad(16, QChar(' '));
+
+ QMessageBox::critical(this,
+ tr("The Octopus is sad"),
+ tr("Check permissions for your .ini directory:\n\n%1\"%2\n\n"
+ "Exiting now."
+ ).arg(ini_directory(), pad),
+ QMessageBox::Close, QMessageBox::NoButton);
+
+ exit(EX_OSFILE);
+}
+
+bool main_window::maybe_die_on_config_not_writable(const QString& current)
+{
+ const bool writable =
+ with_settings_object([&](QSettings& s) {
+ return s.isWritable();
+ });
+
+ if (writable)
+ return false;
+
+ if (!QFile(ini_combine(current)).open(QFile::ReadWrite))
+ {
+ die_on_config_not_writable();
+ return true;
+ }
+
+ return false;
+}
+
+main_window::~main_window()
+{
+ // stupid ps3 eye has LED issues
+ if (work)
+ {
+ stop_tracker_();
+ QEventLoop ev;
+ ev.processEvents();
+ portable::sleep(2000);
+ }
+
+ exit();
+}
+
+void main_window::set_working_directory()
+{
+ QDir::setCurrent(OPENTRACK_BASE_PATH);
+}
+
+void main_window::save_modules()
+{
+ m.b->save();
+}
+
+std::tuple<main_window::dylib_ptr, int>
+main_window::module_by_name(const QString& name, Modules::dylib_list& list)
+{
+ auto it = std::find_if(list.cbegin(), list.cend(), [&name](const dylib_ptr& lib) {
+ if (!lib)
+ return name.isEmpty();
+ else
+ return name == lib->module_name;
+ });
+
+ if (it == list.cend())
+ return { nullptr, -1 };
+ else
+ return { *it, std::distance(list.cbegin(), it) };
+}
+
+main_window::dylib_ptr main_window::current_tracker()
+{
+ auto [ptr, idx] = module_by_name(m.tracker_dll, modules.trackers());
+ return ptr;
+}
+
+main_window::dylib_ptr main_window::current_protocol()
+{
+ auto [ptr, idx] = module_by_name(m.protocol_dll, modules.protocols());
+ return ptr;
+}
+
+main_window::dylib_ptr main_window::current_filter()
+{
+ auto [ptr, idx] = module_by_name(m.filter_dll, modules.filters());
+ return ptr;
+}
+
+void main_window::update_button_state(bool running, bool inertialp)
+{
+ bool not_running = !running;
+#if 0
+ ui.iconcomboProfile->setEnabled(not_running);
+ ui.btnStartTracker->setEnabled(not_running);
+ ui.btnStopTracker->setEnabled(running);
+ ui.iconcomboProtocol->setEnabled(not_running);
+ ui.iconcomboFilter->setEnabled(not_running);
+ ui.iconcomboTrackerSource->setEnabled(not_running);
+ ui.profile_button->setEnabled(not_running);
+#endif
+ ui.video_frame_label->setVisible(not_running || inertialp);
+ if(not_running)
+ {
+ ui.video_frame_label->setPixmap(QPixmap(":/images/tracking-not-started.png"));
+ }
+ else {
+ ui.video_frame_label->setPixmap(QPixmap(":/images/no-feed.png"));
+ }
+}
+
+void main_window::start_tracker_()
+{
+ if (work)
+ return;
+
+ work = std::make_shared<Work>(pose, ev, ui.video_frame, current_tracker(), current_protocol(), current_filter());
+
+ if (!work->is_ok())
+ {
+ work = nullptr;
+ return;
+ }
+
+ if (pTrackerDialog)
+ pTrackerDialog->register_tracker(work->libs.pTracker.get());
+
+ if (pFilterDialog)
+ pFilterDialog->register_filter(work->libs.pFilter.get());
+
+ if (pProtocolDialog)
+ pProtocolDialog->register_protocol(work->libs.pProtocol.get());
+
+ // NB check valid since SelectedLibraries ctor called
+ // trackers take care of layout state updates
+ const bool is_inertial = ui.video_frame->layout() == nullptr;
+ update_button_state(true, is_inertial);
+
+ ui.btnStopTracker->setFocus();
+}
+
+void main_window::stop_tracker_()
+{
+ if (!work)
+ return;
+
+ with_tracker_teardown sentinel;
+
+ if (pTrackerDialog)
+ pTrackerDialog->unregister_tracker();
+
+ if (pProtocolDialog)
+ pProtocolDialog->unregister_protocol();
+
+ if (pFilterDialog)
+ pFilterDialog->unregister_filter();
+
+ work = nullptr;
+
+ update_button_state(false, false);
+ set_title();
+ ui.btnStartTracker->setFocus();
+
+ // ps3 eye issues
+ portable::sleep(1000);
+}
+
+void main_window::set_title(const QString& game_title)
+{
+ static const QString version{opentrack_version};
+ static const QString sep { tr(" :: ") };
+ static const QString pat1{ version + sep + "%1" + sep + "%2" };
+ static const QString pat2{ version + sep + "%1" };
+
+ const QString current = ini_filename();
+
+ if (game_title.isEmpty())
+ setWindowTitle(pat2.arg(current));
+ else
+ setWindowTitle(pat1.arg(current, game_title));
+}
+
+void main_window::exit(int status)
+{
+ QApplication::setQuitOnLastWindowClosed(true);
+ close();
+ QApplication::exit(status);
+}
+
+bool main_window::set_profile()
+{
+ if (maybe_die_on_config_not_writable(OPENTRACK_DEFAULT_CONFIG))
+ return false;
+
+ set_profile_in_registry();
+
+ options::detail::bundler::refresh_all_bundles();
+
+ // migrations are for config layout changes and other user-visible
+ // incompatibilities in future versions
+ run_migrations();
+
+ set_title();
+
+ return true;
+}
+
+void main_window::closeEvent(QCloseEvent*)
+{
+ exit();
+}
+
+void main_window::set_profile_in_registry()
+{
+ with_global_settings_object([&](QSettings& s) {
+ s.setValue(OPENTRACK_CONFIG_FILENAME_KEY, OPENTRACK_DEFAULT_CONFIG);
+ });
+}
+
+void main_window::toggle_tracker_()
+{
+ if (work)
+ stop_tracker();
+ else
+ start_tracker();
+}
diff --git a/variant/trackmouse/window.hpp b/variant/trackmouse/window.hpp
index e5c34410..af3a3043 100644
--- a/variant/trackmouse/window.hpp
+++ b/variant/trackmouse/window.hpp
@@ -1,17 +1,86 @@
#pragma once
-#include "ui_window.h"
+/* Copyright (c) 2013-2016, Stanislaw Halik <sthalik@misaki.pl>
+
+ * Permission to use, copy, modify, and/or distribute this
+ * software for any purpose with or without fee is hereby granted,
+ * provided that the above copyright notice and this permission
+ * notice appear in all copies.
+ */
+
+#pragma once
+
+#include "api/plugin-support.hpp"
+#include "logic/main-settings.hpp"
+#include "logic/pipeline.hpp"
+#include "logic/shortcuts.h"
+#include "logic/work.hpp"
+#include "logic/state.hpp"
+#include "options/options.hpp"
+
#include <QMainWindow>
-#include <QCloseEvent>
+#include <QKeySequence>
+#include <QShortcut>
+#include <QPixmap>
+#include <QTimer>
+#include <QString>
-class window : public QMainWindow
+#include <tuple>
+#include <memory>
+
+#include "ui_window.h"
+
+class main_window final : public QMainWindow, private State
{
Q_OBJECT
Ui::window ui;
- void closeEvent(QCloseEvent* e) override;
-public:
- window();
+ Shortcuts global_shortcuts;
+ module_settings m;
+
+ QShortcut kbd_quit { QKeySequence("Ctrl+Q"), this };
+ std::unique_ptr<IFilterDialog> pFilterDialog;
+ std::unique_ptr<IProtocolDialog> pProtocolDialog;
+ std::unique_ptr<ITrackerDialog> pTrackerDialog;
+
+ using dylib_ptr = Modules::dylib_ptr;
+ using dylib_list = Modules::dylib_list;
+ static std::tuple<dylib_ptr, int> module_by_name(const QString& name, Modules::dylib_list& list);
+
+ dylib_ptr current_tracker();
+ dylib_ptr current_protocol();
+ dylib_ptr current_filter();
+
+ void update_button_state(bool running, bool inertialp);
+
+ void set_title(const QString& game_title = QString());
+
+ void set_profile_in_registry();
+ void register_shortcuts();
+
+ void closeEvent(QCloseEvent *event) override;
+
+ bool maybe_die_on_config_not_writable(const QString& current);
+ void die_on_config_not_writable();
+
+private slots:
+ void save_modules();
+ void exit(int status = EXIT_SUCCESS);
+ bool set_profile();
+
+ void start_tracker_();
+ void stop_tracker_();
+ void toggle_tracker_();
+
+ static void set_working_directory();
+
+signals:
+ void start_tracker();
+ void stop_tracker();
+
+public:
+ main_window();
+ ~main_window() override;
};
diff --git a/variant/trackmouse/window.ui b/variant/trackmouse/window.ui
index 9501c5c2..f9a45daf 100644
--- a/variant/trackmouse/window.ui
+++ b/variant/trackmouse/window.ui
@@ -186,24 +186,6 @@
<string>Keyboard shortcuts</string>
</property>
<layout class="QGridLayout" name="gridLayout">
- <property name="leftMargin">
- <number>12</number>
- </property>
- <property name="topMargin">
- <number>6</number>
- </property>
- <property name="rightMargin">
- <number>40</number>
- </property>
- <property name="bottomMargin">
- <number>6</number>
- </property>
- <property name="horizontalSpacing">
- <number>30</number>
- </property>
- <property name="verticalSpacing">
- <number>6</number>
- </property>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
@@ -226,7 +208,7 @@
</property>
</widget>
</item>
- <item row="0" column="1" alignment="Qt::AlignRight">
+ <item row="0" column="1">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
@@ -246,6 +228,9 @@
<property name="text">
<string>Alt+F10</string>
</property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
</widget>
</item>
<item row="1" column="0">
@@ -270,7 +255,7 @@
</property>
</widget>
</item>
- <item row="1" column="1" alignment="Qt::AlignRight">
+ <item row="1" column="1">
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
@@ -288,8 +273,58 @@
</font>
</property>
<property name="text">
+ <string>Alt+F11</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>12</pointsize>
+ <weight>75</weight>
+ <bold>true</bold>
+ <stylestrategy>PreferAntialias</stylestrategy>
+ <kerning>false</kerning>
+ </font>
+ </property>
+ <property name="text">
+ <string>freeze</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLabel" name="label_7">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>12</pointsize>
+ <weight>75</weight>
+ <bold>true</bold>
+ <stylestrategy>PreferAntialias</stylestrategy>
+ <kerning>false</kerning>
+ </font>
+ </property>
+ <property name="text">
<string>Alt+F12</string>
</property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
</widget>
</item>
</layout>
@@ -364,7 +399,7 @@
<number>3</number>
</property>
<item>
- <widget class="QCommandLinkButton" name="start_button">
+ <widget class="QCommandLinkButton" name="btnStartTracker">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
@@ -387,7 +422,7 @@
</widget>
</item>
<item>
- <widget class="QCommandLinkButton" name="stop_button">
+ <widget class="QCommandLinkButton" name="btnStopTracker">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>