diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-01-13 07:42:29 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-01-13 07:42:29 +0100 |
commit | 53e8b2d41988be69deb800e1ef3cbcfc699a3076 (patch) | |
tree | dc5a3a9098bf4172a52f0410a04274b997505ff0 /gui/main-window.hpp | |
parent | b0657c7ca495ac9d1d3938b3fdfddd9a8ed2d5f2 (diff) |
cmake, main: work toward introducing alternative UI
We're going to base opentrack derivatives on the same branch. Previously
merges were a living hell. Modularizing the UI code and having
continuously-built executables will do a lot.
First opentrack variant in progress is a TrackHat device for mouse and
scrolling control for people with spine and hand/arm disabilities.
Diffstat (limited to 'gui/main-window.hpp')
-rw-r--r-- | gui/main-window.hpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/gui/main-window.hpp b/gui/main-window.hpp index 253c1194..402202d6 100644 --- a/gui/main-window.hpp +++ b/gui/main-window.hpp @@ -21,8 +21,7 @@ #include "logic/state.hpp" #include "options/options.hpp" -#include <QObject> -#include <QWidget> +#include <QApplication> #include <QMainWindow> #include <QKeySequence> #include <QShortcut> @@ -53,12 +52,12 @@ class OTR_GUI_EXPORT main_window : public QMainWindow, private State module_settings m; std::unique_ptr<QSystemTrayIcon> tray; QMenu tray_menu; - QTimer pose_update_timer; + QTimer pose_update_timer { this }; QTimer det_timer; QTimer config_list_timer; std::unique_ptr<options_dialog> options_widget; std::unique_ptr<mapping_dialog> mapping_widget; - QShortcut kbd_quit; + QShortcut kbd_quit { QKeySequence("Ctrl+Q"), this }; std::unique_ptr<IFilterDialog> pFilterDialog; std::unique_ptr<IProtocolDialog> pProtocolDialog; std::unique_ptr<ITrackerDialog> pTrackerDialog; @@ -66,9 +65,14 @@ class OTR_GUI_EXPORT main_window : public QMainWindow, private State process_detector_worker det; QMenu profile_menu; - QAction menu_action_header, menu_action_show, menu_action_exit, - menu_action_tracker, menu_action_filter, menu_action_proto, - menu_action_options, menu_action_mappings; + QAction menu_action_header { &tray_menu }, + menu_action_show { &tray_menu }, + menu_action_exit { &tray_menu }, + menu_action_tracker { &tray_menu }, + menu_action_filter { &tray_menu }, + menu_action_proto { &tray_menu }, + menu_action_options { &tray_menu }, + menu_action_mappings { &tray_menu }; std::shared_ptr<dylib> current_tracker() { @@ -96,7 +100,7 @@ class OTR_GUI_EXPORT main_window : public QMainWindow, private State void init_tray_menu(); void changeEvent(QEvent* e) override; - void closeEvent(QCloseEvent*) override; + void closeEvent(QCloseEvent* ev) override; bool event(QEvent *event) override; bool maybe_hide_to_tray(QEvent* e); #if !defined _WIN32 && !defined __APPLE__ @@ -117,7 +121,7 @@ class OTR_GUI_EXPORT main_window : public QMainWindow, private State private slots: void save_modules(); - void exit(); + void exit(int status = 0); bool set_profile(const QString& new_name); void show_tracker_settings(); |