diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/curve-config.cpp | 4 | ||||
-rw-r--r-- | gui/options-dialog.cpp | 14 | ||||
-rw-r--r-- | gui/ui.cpp | 40 |
3 files changed, 29 insertions, 29 deletions
diff --git a/gui/curve-config.cpp b/gui/curve-config.cpp index 7cd78580..e4396e01 100644 --- a/gui/curve-config.cpp +++ b/gui/curve-config.cpp @@ -78,10 +78,10 @@ MapWidget::MapWidget(Mappings& m, main_settings& s) : void MapWidget::doOK() { m.save_mappings(); - this->close(); + close(); } void MapWidget::doCancel() { m.invalidate_unsaved(); - this->close(); + close(); } diff --git a/gui/options-dialog.cpp b/gui/options-dialog.cpp index e7a54bb2..49df4309 100644 --- a/gui/options-dialog.cpp +++ b/gui/options-dialog.cpp @@ -40,9 +40,9 @@ OptionsDialog::OptionsDialog(main_settings& main, connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); tie_setting(main.tray_enabled, ui.trayp); - + tie_setting(main.center_at_startup, ui.center_at_startup); - + tie_setting(main.tcomp_p, ui.tcomp_enable); tie_setting(main.tcomp_tz, ui.tcomp_rz); @@ -66,7 +66,7 @@ OptionsDialog::OptionsDialog(main_settings& main, tie_setting(main.a_x.src, ui.src_x); tie_setting(main.a_y.src, ui.src_y); tie_setting(main.a_z.src, ui.src_z); - + tie_setting(main.camera_yaw, ui.camera_yaw); tie_setting(main.camera_pitch, ui.camera_pitch); tie_setting(main.camera_roll, ui.camera_roll); @@ -89,7 +89,7 @@ OptionsDialog::OptionsDialog(main_settings& main, ui.toggle_held_text->setText(kopts_to_string(main.key_toggle_press)); ui.zero_text->setText(kopts_to_string(main.key_zero)); ui.zero_held_text->setText(kopts_to_string(main.key_zero_press)); - + ui.start_tracking_text->setText(kopts_to_string(main.key_start_tracking)); ui.stop_tracking_text->setText(kopts_to_string(main.key_stop_tracking)); ui.toggle_tracking_text->setText(kopts_to_string(main.key_toggle_tracking)); @@ -136,12 +136,12 @@ void OptionsDialog::bind_key(key_opts& kopts, QLabel* label) void OptionsDialog::doOK() { main.b->save(); ui.game_detector->save(); - this->close(); + close(); emit reload(); } -void OptionsDialog::doCancel() { - main.b->reload(); +void OptionsDialog::doCancel() +{ ui.game_detector->revert(); close(); } @@ -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); } |