summaryrefslogtreecommitdiffhomepage
path: root/gui/ui.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-05-26 17:09:17 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-05-26 17:19:19 +0200
commitb008aefee41a21b24f1d2f1f23cd6c78b888ede5 (patch)
treefb1d42dbd30c937d956811796856453f29507382 /gui/ui.cpp
parent47dec53450dec0264489cddb0005e13593f43399 (diff)
many modules: trivial cleanups only
- Remove "this->" where it's not needed. Possibly rename shadowed vars. - Don't reload the options bundle manually since `options::opts' exists for that very reason. - Remove '^ \+$' whitespace - :retab
Diffstat (limited to 'gui/ui.cpp')
-rw-r--r--gui/ui.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/gui/ui.cpp b/gui/ui.cpp
index 004b67c4..fabcb5e4 100644
--- a/gui/ui.cpp
+++ b/gui/ui.cpp
@@ -83,7 +83,7 @@ MainWindow::MainWindow() :
ui.profile_button->setMenu(&profile_menu);
kbd_quit.setEnabled(true);
-
+
connect(&det_timer, SIGNAL(timeout()), this, SLOT(maybe_start_profile_from_executable()));
det_timer.start(1000);
@@ -106,15 +106,15 @@ MainWindow::MainWindow() :
"Configuration not saved.",
"Can't create configuration directory! Expect major malfunction.",
QMessageBox::Ok, QMessageBox::NoButton);
-
+
connect(this, &MainWindow::emit_start_tracker,
this, [&]() -> void { qDebug() << "start tracker"; startTracker(); },
Qt::QueuedConnection);
-
+
connect(this, &MainWindow::emit_stop_tracker,
this, [&]() -> void { qDebug() << "stop tracker"; stopTracker(); },
Qt::QueuedConnection);
-
+
connect(this, &MainWindow::emit_toggle_tracker,
this, [&]() -> void { qDebug() << "toggle tracker"; if (work) stopTracker(); else startTracker(); },
Qt::QueuedConnection);
@@ -122,27 +122,27 @@ MainWindow::MainWindow() :
connect(this, &MainWindow::emit_restart_tracker,
this, [&]() -> void { qDebug() << "restart tracker"; stopTracker(); startTracker(); },
Qt::QueuedConnection);
-
+
register_shortcuts();
-
+
connect(this, &MainWindow::emit_minimized, this, &MainWindow::mark_minimized, Qt::QueuedConnection);
-
+
ui.btnStartTracker->setFocus();
}
void MainWindow::register_shortcuts()
{
using t_shortcut = std::tuple<key_opts&, Shortcuts::fun, bool>;
-
+
std::vector<t_shortcut> keys {
t_shortcut(s.key_start_tracking, [&](bool) -> void { emit_start_tracker(); }, true),
t_shortcut(s.key_stop_tracking, [&](bool) -> void { emit_stop_tracker(); }, true),
t_shortcut(s.key_toggle_tracking, [&](bool) -> void { emit_toggle_tracker(); }, true),
t_shortcut(s.key_restart_tracking, [&](bool) -> void { emit_restart_tracker(); }, true),
};
-
+
global_shortcuts.reload(keys);
-
+
if (work)
work->reload_shortcuts();
}
@@ -304,7 +304,7 @@ void MainWindow::reload_options()
void MainWindow::startTracker() {
if (work)
return;
-
+
// tracker dtor needs run first
work = nullptr;
@@ -324,20 +324,20 @@ void MainWindow::startTracker() {
libs = SelectedLibraries();
return;
}
-
+
work = std::make_shared<Work>(s, pose, libs, winId());
-
+
reload_options();
if (pTrackerDialog)
pTrackerDialog->register_tracker(libs.pTracker.get());
-
+
if (pFilterDialog)
pFilterDialog->register_filter(libs.pFilter.get());
-
+
if (pProtocolDialog)
pProtocolDialog->register_protocol(libs.pProtocol.get());
-
+
pose_update_timer.start(50);
// NB check valid since SelectedLibraries ctor called
@@ -353,7 +353,7 @@ void MainWindow::startTracker() {
void MainWindow::stopTracker() {
if (!work)
return;
-
+
//ui.game_name->setText("Not connected");
pose_update_timer.stop();
@@ -567,17 +567,17 @@ void MainWindow::changeEvent(QEvent* e)
if (e->type() == QEvent::WindowStateChange)
{
const bool is_minimized = windowState() & Qt::WindowMinimized;
-
+
if (s.tray_enabled && is_minimized)
{
if (!tray)
ensure_tray();
hide();
}
-
+
emit_minimized(is_minimized);
}
-
+
QMainWindow::changeEvent(e);
}