diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-26 17:09:17 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-26 17:19:19 +0200 |
commit | b008aefee41a21b24f1d2f1f23cd6c78b888ede5 (patch) | |
tree | fb1d42dbd30c937d956811796856453f29507382 | |
parent | 47dec53450dec0264489cddb0005e13593f43399 (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
34 files changed, 168 insertions, 183 deletions
diff --git a/filter-accela/ftnoir_filter_accela.h b/filter-accela/ftnoir_filter_accela.h index 289b84f0..8ee35da6 100644 --- a/filter-accela/ftnoir_filter_accela.h +++ b/filter-accela/ftnoir_filter_accela.h @@ -57,7 +57,6 @@ public: void unregister_filter(); private: Ui::AccelaUICFilterControls ui; - void discard(); void save(); FTNoIR_Filter* accela_filter; settings_accela s; diff --git a/filter-accela/ftnoir_filter_accela_dialog.cpp b/filter-accela/ftnoir_filter_accela_dialog.cpp index 599cb716..451f476e 100644 --- a/filter-accela/ftnoir_filter_accela_dialog.cpp +++ b/filter-accela/ftnoir_filter_accela_dialog.cpp @@ -20,7 +20,7 @@ FilterControls::FilterControls() : connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - + connect(ui.rotation_slider, SIGNAL(valueChanged(int)), this, SLOT(update_rot_display(int))); connect(ui.translation_slider, SIGNAL(valueChanged(int)), this, SLOT(update_trans_display(int))); connect(ui.ewma_slider, SIGNAL(valueChanged(int)), this, SLOT(update_ewma_display(int))); @@ -32,7 +32,7 @@ FilterControls::FilterControls() : tie_setting(s.ewma, ui.ewma_slider); tie_setting(s.rot_deadzone, ui.rot_dz_slider); tie_setting(s.trans_deadzone, ui.trans_dz_slider); - + update_rot_display(ui.rotation_slider->value()); update_trans_display(ui.translation_slider->value()); update_ewma_display(ui.ewma_slider->value()); @@ -61,19 +61,13 @@ void FilterControls::unregister_filter() void FilterControls::doOK() { save(); - this->close(); + close(); } void FilterControls::doCancel() { - discard(); close(); } -void FilterControls::discard() -{ - s.b->reload(); -} - void FilterControls::save() { s.b->save(); } diff --git a/filter-ewma2/ftnoir_filter_ewma2_dialog.cpp b/filter-ewma2/ftnoir_filter_ewma2_dialog.cpp index 30fb6003..5425fada 100644 --- a/filter-ewma2/ftnoir_filter_ewma2_dialog.cpp +++ b/filter-ewma2/ftnoir_filter_ewma2_dialog.cpp @@ -27,13 +27,13 @@ void FilterControls::unregister_filter() } void FilterControls::doOK() { - save(); - this->close(); + save(); + close(); } -void FilterControls::doCancel() { - s.b->reload(); - this->close(); +void FilterControls::doCancel() +{ + close(); } void FilterControls::save() { diff --git a/filter-kalman/kalman.cpp b/filter-kalman/kalman.cpp index 5af548ed..05731cb6 100644 --- a/filter-kalman/kalman.cpp +++ b/filter-kalman/kalman.cpp @@ -121,8 +121,8 @@ void FilterControls::doOK() { close(); } -void FilterControls::doCancel() { - s.b->reload(); +void FilterControls::doCancel() +{ close(); } 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); } diff --git a/opentrack/plugin-support.hpp b/opentrack/plugin-support.hpp index 573a8dd5..30c738bb 100644 --- a/opentrack/plugin-support.hpp +++ b/opentrack/plugin-support.hpp @@ -63,7 +63,7 @@ struct dylib final { if (filename.size() == 0) return; - QString fullPath = QCoreApplication::applicationDirPath() + "/" + this->filename; + QString fullPath = QCoreApplication::applicationDirPath() + "/" + filename; handle = new QLibrary(fullPath); struct _foo { diff --git a/opentrack/win32-joystick.cpp b/opentrack/win32-joystick.cpp index 5e6f2011..bf919f4a 100644 --- a/opentrack/win32-joystick.cpp +++ b/opentrack/win32-joystick.cpp @@ -7,9 +7,9 @@ void win32_joy_ctx::poll(fn f) { //refresh(false); - + QMutexLocker l(&mtx); - + for (auto& j : joys) { j.second->poll(f); @@ -19,41 +19,41 @@ void win32_joy_ctx::poll(fn f) bool win32_joy_ctx::poll_axis(const QString &guid, int axes[]) { //refresh(false); - + QMutexLocker l(&mtx); - + auto iter = joys.find(guid); - + if (iter == joys.end()) return false; - + auto& j = iter->second; - + auto& joy_handle = j->joy_handle; bool ok = false; HRESULT hr; - + (void) joy_handle->Acquire(); - + if (!FAILED(hr = joy_handle->Poll())) ok = true; - + if (!ok) { qDebug() << "joy acquire failed" << guid << hr; (void) joy_handle->Unacquire(); return false; } - + DIJOYSTATE2 js; memset(&js, 0, sizeof(js)); - + if (FAILED(hr = joy_handle->GetDeviceState(sizeof(js), &js))) { qDebug() << "joy get state failed" << guid << hr; return false; } - + const int values[] = { js.lX, js.lY, @@ -64,10 +64,10 @@ bool win32_joy_ctx::poll_axis(const QString &guid, int axes[]) js.rglSlider[0], js.rglSlider[1] }; - + for (int i = 0; i < 8; i++) axes[i] = values[i]; - + return true; } @@ -79,12 +79,12 @@ win32_joy_ctx::~win32_joy_ctx() std::vector<win32_joy_ctx::joy_info> win32_joy_ctx::get_joy_info() { QMutexLocker l(&mtx); - + std::vector<joy_info> ret; - + for (auto& j : joys) ret.push_back(joy_info { j.second->name, j.first }); - + return ret; } @@ -107,7 +107,7 @@ void win32_joy_ctx::release() void win32_joy_ctx::refresh() { QMutexLocker l(&mtx); - + qDebug() << "joy list refresh"; enum_state st(joys, fake_main_window, di); } @@ -116,10 +116,10 @@ QString win32_joy_ctx::guid_to_string(const GUID guid) { char buf[40] = {0}; wchar_t szGuidW[40] = {0}; - + StringFromGUID2(guid, szGuidW, 40); WideCharToMultiByte(0, 0, szGuidW, -1, buf, 40, NULL, NULL); - + return QString(buf); } @@ -139,28 +139,28 @@ bool win32_joy_ctx::joy::poll(fn f) { HRESULT hr; bool ok = false; - + (void) joy_handle->Acquire(); - + if (!FAILED(hr = joy_handle->Poll())) ok = true; - + if (!ok) { qDebug() << "joy acquire failed" << guid << hr; (void) joy_handle->Unacquire(); return false; } - + DIJOYSTATE2 js; memset(&js, 0, sizeof(js)); - + if (FAILED(hr = joy_handle->GetDeviceState(sizeof(js), &js))) { qDebug() << "joy get state failed" << guid << hr; return false; } - + for (int i = 0; i < 128; i++) { const bool state = !!(js.rgbButtons[i] & 0x80) && js.rgbButtons[i] != js_old.rgbButtons[i]; @@ -171,20 +171,20 @@ bool win32_joy_ctx::joy::poll(fn f) } pressed[i] = state; } - + js_old = js; - + return true; } -win32_joy_ctx::enum_state::enum_state(std::unordered_map<QString, std::shared_ptr<joy>> &joys, +win32_joy_ctx::enum_state::enum_state(std::unordered_map<QString, std::shared_ptr<joy>> &joys_, QMainWindow &fake_main_window, LPDIRECTINPUT8 di) : fake_main_window(fake_main_window), di(di) { - this->joys = joys; - + joys = joys_; + HRESULT hr; if(FAILED(hr = di->EnumDevices(DI8DEVCLASS_GAMECTRL, @@ -195,18 +195,16 @@ win32_joy_ctx::enum_state::enum_state(std::unordered_map<QString, std::shared_pt qDebug() << "failed enum joysticks" << hr; return; } - - auto& js = this->joys; - - for (auto it = js.begin(); it != js.end(); ) + + for (auto it = joys.begin(); it != joys.end(); ) { if (std::find_if(all.cbegin(), all.cend(), [&](const QString& guid2) -> bool { return it->second->guid == guid2; }) == all.cend()) - it = js.erase(it); + it = joys.erase(it); else it++; } - - joys = this->joys; + + joys_ = joys; } win32_joy_ctx::enum_state::EnumJoysticksCallback(const DIDEVICEINSTANCE *pdidInstance, void *pContext) @@ -214,12 +212,12 @@ win32_joy_ctx::enum_state::EnumJoysticksCallback(const DIDEVICEINSTANCE *pdidIns enum_state& state = *reinterpret_cast<enum_state*>(pContext); const QString guid = guid_to_string(pdidInstance->guidInstance); const QString name = QString(pdidInstance->tszInstanceName); - + auto it = state.joys.find(guid); const bool exists = it != state.joys.end(); - + state.all.push_back(guid); - + if (!exists) { HRESULT hr; @@ -235,7 +233,7 @@ win32_joy_ctx::enum_state::EnumJoysticksCallback(const DIDEVICEINSTANCE *pdidIns h->Release(); goto end; } - + if (FAILED(h->SetCooperativeLevel((HWND) state.fake_main_window.winId(), DISCL_NONEXCLUSIVE | DISCL_BACKGROUND))) { qDebug() << "coop"; @@ -248,7 +246,7 @@ win32_joy_ctx::enum_state::EnumJoysticksCallback(const DIDEVICEINSTANCE *pdidIns h->Release(); goto end; } - + qDebug() << "add joy" << guid; state.joys[guid] = std::make_shared<joy>(h, guid, name); } @@ -268,16 +266,16 @@ win32_joy_ctx::enum_state::EnumObjectsCallback(const DIDEVICEOBJECTINSTANCE *pdi diprg.diph.dwObj = pdidoi->dwType; diprg.lMax = joy_axis_size; diprg.lMin = -joy_axis_size; - + HRESULT hr; - + if (FAILED(hr = reinterpret_cast<LPDIRECTINPUTDEVICE8>(ctx)->SetProperty(DIPROP_RANGE, &diprg.diph))) { qDebug() << "DIPROP_RANGE" << hr; return DIENUM_STOP; } } - + return DIENUM_CONTINUE; } diff --git a/pose-widget/glwidget.cpp b/pose-widget/glwidget.cpp index a6425fde..b2ec68a7 100644 --- a/pose-widget/glwidget.cpp +++ b/pose-widget/glwidget.cpp @@ -28,7 +28,7 @@ GLWidget::~GLWidget() void GLWidget::paintEvent ( QPaintEvent * event ) { QPainter p(this); project_quad_texture(); - p.drawImage(event->rect(), texture); + p.drawImage(event->rect(), image); } void GLWidget::rotateBy(float xAngle, float yAngle, float zAngle, float x, float y, float z) @@ -231,7 +231,7 @@ void GLWidget::project_quad_texture() { } } } - this->texture = texture; + image = texture; } GLWidget::vec2 GLWidget::project(const vec3 &point) diff --git a/pose-widget/glwidget.h b/pose-widget/glwidget.h index 8896a3cf..25823985 100644 --- a/pose-widget/glwidget.h +++ b/pose-widget/glwidget.h @@ -41,5 +41,5 @@ private: vec3 translation; QImage front; QImage back; - QImage texture; + QImage image; }; diff --git a/proto-fg/ftnoir_protocol_fg_dialog.cpp b/proto-fg/ftnoir_protocol_fg_dialog.cpp index 1d583115..6a3463b4 100644 --- a/proto-fg/ftnoir_protocol_fg_dialog.cpp +++ b/proto-fg/ftnoir_protocol_fg_dialog.cpp @@ -22,7 +22,7 @@ // FGControls::FGControls() { - ui.setupUi( this ); + ui.setupUi( this ); tie_setting(s.ip1, ui.spinIPFirstNibble); tie_setting(s.ip2, ui.spinIPSecondNibble); @@ -36,11 +36,10 @@ FGControls::FGControls() void FGControls::doOK() { s.b->save(); - this->close(); + close(); } void FGControls::doCancel() { - s.b->reload(); - this->close(); + close(); } diff --git a/proto-fsuipc/ftnoir_protocol_fsuipc_dialog.cpp b/proto-fsuipc/ftnoir_protocol_fsuipc_dialog.cpp index d573420a..504b2dcb 100644 --- a/proto-fsuipc/ftnoir_protocol_fsuipc_dialog.cpp +++ b/proto-fsuipc/ftnoir_protocol_fsuipc_dialog.cpp @@ -23,11 +23,11 @@ FSUIPCControls::FSUIPCControls() void FSUIPCControls::doOK() { s.b->save(); - this->close(); + close(); } -void FSUIPCControls::doCancel() { - s.b->reload(); +void FSUIPCControls::doCancel() +{ close(); } diff --git a/proto-ft/ftnoir_protocol_ft.cpp b/proto-ft/ftnoir_protocol_ft.cpp index 9dba2bff..e5648250 100644 --- a/proto-ft/ftnoir_protocol_ft.cpp +++ b/proto-ft/ftnoir_protocol_ft.cpp @@ -82,7 +82,7 @@ void FTNoIR_Protocol::pose(const double* headpose) { } ft->GameID2 = id; intGameID = id; - QMutexLocker foo(&this->game_name_mutex); + QMutexLocker foo(&game_name_mutex); connected_game = gamename; } diff --git a/proto-ft/ftnoir_protocol_ft_dialog.cpp b/proto-ft/ftnoir_protocol_ft_dialog.cpp index da00a03a..36846273 100644 --- a/proto-ft/ftnoir_protocol_ft_dialog.cpp +++ b/proto-ft/ftnoir_protocol_ft_dialog.cpp @@ -41,12 +41,12 @@ FTControls::FTControls() void FTControls::doOK() { s.b->save(); - this->close(); + close(); } -void FTControls::doCancel() { - s.b->reload(); - this->close(); +void FTControls::doCancel() +{ + close(); } void FTControls::selectDLL() { diff --git a/proto-ftn/ftnoir_protocol_ftn_dialog.cpp b/proto-ftn/ftnoir_protocol_ftn_dialog.cpp index 77a1508a..7e191336 100644 --- a/proto-ftn/ftnoir_protocol_ftn_dialog.cpp +++ b/proto-ftn/ftnoir_protocol_ftn_dialog.cpp @@ -30,13 +30,13 @@ FTNControls::FTNControls() // void FTNControls::doOK() { s.b->save(); - this->close(); + close(); } // // Cancel clicked on server-dialog // -void FTNControls::doCancel() { - s.b->reload(); - this->close(); +void FTNControls::doCancel() +{ + close(); } diff --git a/proto-libevdev/ftnoir_protocol_libevdev_dialog.cpp b/proto-libevdev/ftnoir_protocol_libevdev_dialog.cpp index 70495a8f..bb63ba6a 100644 --- a/proto-libevdev/ftnoir_protocol_libevdev_dialog.cpp +++ b/proto-libevdev/ftnoir_protocol_libevdev_dialog.cpp @@ -10,11 +10,11 @@ LibevdevControls::LibevdevControls() void LibevdevControls::doOK() { save(); - this->close(); + close(); } void LibevdevControls::doCancel() { - this->close(); + close(); } void LibevdevControls::save() { diff --git a/proto-mouse/ftnoir_protocol_mouse_dialog.cpp b/proto-mouse/ftnoir_protocol_mouse_dialog.cpp index bb5fe3b8..89851b61 100644 --- a/proto-mouse/ftnoir_protocol_mouse_dialog.cpp +++ b/proto-mouse/ftnoir_protocol_mouse_dialog.cpp @@ -14,11 +14,11 @@ MOUSEControls::MOUSEControls() void MOUSEControls::doOK() { s.b->save(); - this->close(); + close(); } -void MOUSEControls::doCancel() { - s.b->reload(); - this->close(); +void MOUSEControls::doCancel() +{ + close(); } diff --git a/proto-sc/ftnoir_protocol_sc_dialog.cpp b/proto-sc/ftnoir_protocol_sc_dialog.cpp index 7c2ecfd4..e2ff82fc 100644 --- a/proto-sc/ftnoir_protocol_sc_dialog.cpp +++ b/proto-sc/ftnoir_protocol_sc_dialog.cpp @@ -14,9 +14,9 @@ SCControls::SCControls() { - ui.setupUi( this ); + ui.setupUi( this ); - // Connect Qt signals to member-functions + // Connect Qt signals to member-functions connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); @@ -25,11 +25,11 @@ SCControls::SCControls() void SCControls::doOK() { s.b->save(); - this->close(); + close(); } -void SCControls::doCancel() { - s.b->reload(); +void SCControls::doCancel() +{ close(); } diff --git a/proto-vjoy/ftnoir_protocol_vjoy_dialog.cpp b/proto-vjoy/ftnoir_protocol_vjoy_dialog.cpp index 08c65558..f02dac06 100644 --- a/proto-vjoy/ftnoir_protocol_vjoy_dialog.cpp +++ b/proto-vjoy/ftnoir_protocol_vjoy_dialog.cpp @@ -10,11 +10,11 @@ VJoyControls::VJoyControls() void VJoyControls::doOK() { save(); - this->close(); + close(); } void VJoyControls::doCancel() { - this->close(); + close(); } void VJoyControls::save() { diff --git a/proto-wine/ftnoir_protocol_wine_dialog.cpp b/proto-wine/ftnoir_protocol_wine_dialog.cpp index e4027c73..d5cb4494 100644 --- a/proto-wine/ftnoir_protocol_wine_dialog.cpp +++ b/proto-wine/ftnoir_protocol_wine_dialog.cpp @@ -10,10 +10,10 @@ FTControls::FTControls() } void FTControls::doOK() { - this->close(); + close(); } void FTControls::doCancel() { - this->close(); + close(); } diff --git a/tracker-aruco/ftnoir_tracker_aruco.cpp b/tracker-aruco/ftnoir_tracker_aruco.cpp index 7208f742..48dfeb61 100644 --- a/tracker-aruco/ftnoir_tracker_aruco.cpp +++ b/tracker-aruco/ftnoir_tracker_aruco.cpp @@ -52,17 +52,17 @@ void Tracker::start_tracker(QFrame* videoframe) { videoframe->show(); videoWidget = new ArucoVideoWidget(videoframe); - QHBoxLayout* layout = new QHBoxLayout(); - layout->setContentsMargins(0, 0, 0, 0); - layout->addWidget(videoWidget); + QHBoxLayout* layout_ = new QHBoxLayout(); + layout_->setContentsMargins(0, 0, 0, 0); + layout_->addWidget(videoWidget); if (videoframe->layout()) delete videoframe->layout(); - videoframe->setLayout(layout); + videoframe->setLayout(layout_); videoWidget->show(); start(); for (int i = 0; i < 6; i++) pose[i] = 0; - this->layout = layout; + layout = layout_; } #define HT_PI 3.1415926535 @@ -146,7 +146,7 @@ void Tracker::run() } cv::Mat grayscale; cv::cvtColor(color, grayscale, cv::COLOR_RGB2GRAY); - + const int scale = grayscale.cols > 480 ? 2 : 1; // param 2 ignored for Otsu thresholding. it's required to use our fork of Aruco. detector.setThresholdParams(5, -1); @@ -170,13 +170,13 @@ void Tracker::run() const double size_max = 0.3; bool roi_valid = false; - + auto time = cv::getTickCount(); - + const double dt = (time - last_time) / freq; last_time = time; cur_fps = cur_fps * 0.97 + 0.03 * (dt == 0 ? 0 : 1./dt); - + if (last_roi.width > 0 && last_roi.height) { detector.setMinMaxSize(std::min(1., std::max(0.01, size_min * grayscale.cols / last_roi.width)), @@ -239,7 +239,7 @@ void Tracker::run() obj_points.at<float>(x4,0)= -size + hx; obj_points.at<float>(x4,1)= size + hy; obj_points.at<float>(x4,2)= 0 + hz; - + std::vector<cv::Point2f> img_points = m; if (!cv::solvePnP(obj_points, img_points, intrinsics, dist_coeffs, rvec, tvec, false, cv::SOLVEPNP_ITERATIVE)) goto fail; @@ -387,7 +387,7 @@ void TrackerControls::toggleCalibrate() calib_timer.start(); } else { cleanupCalib(); - + auto pos = calibrator.get_estimate(); s.headpos_x = pos(0); s.headpos_y = pos(1); @@ -415,13 +415,12 @@ void TrackerControls::update_tracker_calibration() void TrackerControls::doOK() { s.b->save(); - this->close(); + close(); } void TrackerControls::doCancel() { - s.b->reload(); - this->close(); + close(); } void TrackerControls::camera_settings() diff --git a/tracker-freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp b/tracker-freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp index 55427d35..3ebe359f 100644 --- a/tracker-freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp +++ b/tracker-freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp @@ -20,11 +20,11 @@ TrackerDialog::TrackerDialog() void TrackerDialog::doOK() { s.b->save(); - this->close(); + close(); } -void TrackerDialog::doCancel() { - s.b->reload(); - this->close(); +void TrackerDialog::doCancel() +{ + close(); } diff --git a/tracker-hatire/ftnoir_tracker_hat_dialog.cpp b/tracker-hatire/ftnoir_tracker_hat_dialog.cpp index fdf366f5..7acada3f 100644 --- a/tracker-hatire/ftnoir_tracker_hat_dialog.cpp +++ b/tracker-hatire/ftnoir_tracker_hat_dialog.cpp @@ -124,9 +124,8 @@ TrackerControls::~TrackerControls() { void TrackerControls::Initialize(QWidget *parent) { QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } + if (parent) + move(parent->pos() + offsetpos); show(); } @@ -168,7 +167,7 @@ void TrackerControls::doSend() { // void TrackerControls::on_lineSend_returnPressed() { - this->doSend(); + doSend(); } // @@ -203,7 +202,6 @@ void TrackerControls::doOK() void TrackerControls::doCancel() { - s.b->reload(); close(); } diff --git a/tracker-ht/ftnoir_tracker_ht.cpp b/tracker-ht/ftnoir_tracker_ht.cpp index cc9d2ba1..1ffc387e 100644 --- a/tracker-ht/ftnoir_tracker_ht.cpp +++ b/tracker-ht/ftnoir_tracker_ht.cpp @@ -96,14 +96,14 @@ void Tracker::start_tracker(QFrame* videoframe) { videoframe->show(); videoWidget = new HTVideoWidget(videoframe); - QHBoxLayout* layout = new QHBoxLayout(); - layout->setContentsMargins(0, 0, 0, 0); - layout->addWidget(videoWidget); + QHBoxLayout* layout_ = new QHBoxLayout(); + layout_->setContentsMargins(0, 0, 0, 0); + layout_->addWidget(videoWidget); if (videoframe->layout()) delete videoframe->layout(); - videoframe->setLayout(layout); + videoframe->setLayout(layout_); videoWidget->show(); - this->layout = layout; + layout = layout_; load_settings(&conf); ht = ht_make_context(&conf, nullptr); @@ -185,7 +185,7 @@ void Tracker::data(double* data) TrackerControls::TrackerControls() : tracker(nullptr) { - ui.setupUi(this); + ui.setupUi(this); ui.cameraName->clear(); QList<QString> names = get_camera_names(); names.prepend("Any available"); @@ -202,13 +202,12 @@ TrackerControls::TrackerControls() : tracker(nullptr) void TrackerControls::doOK() { s.b->save(); - this->close(); + close(); } void TrackerControls::doCancel() { - s.b->reload(); - this->close(); + close(); } void TrackerControls::camera_settings() diff --git a/tracker-ht/ht_video_widget.cpp b/tracker-ht/ht_video_widget.cpp index 02fe71d1..b62b9892 100644 --- a/tracker-ht/ht_video_widget.cpp +++ b/tracker-ht/ht_video_widget.cpp @@ -7,15 +7,15 @@ #include "ht_video_widget.h" -void HTVideoWidget::update_image(unsigned char *frame, int width, int height) +void HTVideoWidget::update_image(unsigned char *frame, int width_, int height_) { QMutexLocker foo(&mtx); if (!fresh) { - memcpy(fb, frame, width * height * 3); - this->width = width; - this->height = height; + width = width_; + height = height_; fresh = true; + memcpy(fb, frame, width_ * height_ * 3); } } diff --git a/tracker-hydra/ftnoir_tracker_hydra_dialog.cpp b/tracker-hydra/ftnoir_tracker_hydra_dialog.cpp index 2c23ee46..773f8b50 100644 --- a/tracker-hydra/ftnoir_tracker_hydra_dialog.cpp +++ b/tracker-hydra/ftnoir_tracker_hydra_dialog.cpp @@ -3,20 +3,19 @@ TrackerControls::TrackerControls() { - ui.setupUi( this ); + ui.setupUi(this); - // Connect Qt signals to member-functions connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); } void TrackerControls::doOK() { s.b->save(); - this->close(); + close(); } -void TrackerControls::doCancel() { - s.b->reload(); +void TrackerControls::doCancel() +{ close(); } diff --git a/tracker-joystick/ftnoir_tracker_joystick_dialog.cpp b/tracker-joystick/ftnoir_tracker_joystick_dialog.cpp index a6fa6605..3bacc877 100644 --- a/tracker-joystick/ftnoir_tracker_joystick_dialog.cpp +++ b/tracker-joystick/ftnoir_tracker_joystick_dialog.cpp @@ -45,10 +45,10 @@ void TrackerControls::doOK() { auto val = _joys.value(idx, def); s.guid = val.guid; s.b->save(); - this->close(); + close(); } void TrackerControls::doCancel() { s.b->reload(); - this->close(); + close(); } diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp index 3415eecd..eafb8768 100644 --- a/tracker-pt/ftnoir_tracker_pt.cpp +++ b/tracker-pt/ftnoir_tracker_pt.cpp @@ -166,7 +166,7 @@ void Tracker_PT::apply_settings() void Tracker_PT::start_tracker(QFrame *parent_window) { - this->video_frame = parent_window; + video_frame = parent_window; video_frame->setAttribute(Qt::WA_NativeWindow); video_frame->show(); video_widget = new PTVideoWidget(video_frame); diff --git a/tracker-rift-025/ftnoir_tracker_rift_dialog_025.cpp b/tracker-rift-025/ftnoir_tracker_rift_dialog_025.cpp index 8100e362..3d7173fa 100644 --- a/tracker-rift-025/ftnoir_tracker_rift_dialog_025.cpp +++ b/tracker-rift-025/ftnoir_tracker_rift_dialog_025.cpp @@ -16,7 +16,7 @@ TrackerControls::TrackerControls() void TrackerControls::doOK() { s.b->save(); - this->close(); + close(); } void TrackerControls::doCancel() { diff --git a/tracker-rift-042/ftnoir_tracker_rift_dialog_042.cpp b/tracker-rift-042/ftnoir_tracker_rift_dialog_042.cpp index 9a8b7549..e5401aa1 100644 --- a/tracker-rift-042/ftnoir_tracker_rift_dialog_042.cpp +++ b/tracker-rift-042/ftnoir_tracker_rift_dialog_042.cpp @@ -16,7 +16,7 @@ TrackerControls::TrackerControls() void TrackerControls::doOK() { s.b->save(); - this->close(); + close(); } void TrackerControls::doCancel() { diff --git a/tracker-rift-080/ftnoir_tracker_rift_dialog_080.cpp b/tracker-rift-080/ftnoir_tracker_rift_dialog_080.cpp index 0bf797be..a91adeaf 100644 --- a/tracker-rift-080/ftnoir_tracker_rift_dialog_080.cpp +++ b/tracker-rift-080/ftnoir_tracker_rift_dialog_080.cpp @@ -16,7 +16,7 @@ TrackerControls::TrackerControls() void TrackerControls::doOK() { s.b->save(); - this->close(); + close(); } void TrackerControls::doCancel() { diff --git a/tracker-rs/ftnoir_tracker_rs_controls.cpp b/tracker-rs/ftnoir_tracker_rs_controls.cpp index baa01c91..9ef14c9e 100644 --- a/tracker-rs/ftnoir_tracker_rs_controls.cpp +++ b/tracker-rs/ftnoir_tracker_rs_controls.cpp @@ -19,15 +19,15 @@ void RSTrackerControls::doInstallRSRuntime() { bool pStarted = RSTracker::startSdkInstallationProcess(); if(pStarted == true) - this->close(); + close(); } void RSTrackerControls::doOK() { - this->close(); + close(); } void RSTrackerControls::doCancel() { - this->close(); + close(); } diff --git a/tracker-udp/ftnoir_tracker_udp_dialog.cpp b/tracker-udp/ftnoir_tracker_udp_dialog.cpp index 5e7d5437..2df81409 100644 --- a/tracker-udp/ftnoir_tracker_udp_dialog.cpp +++ b/tracker-udp/ftnoir_tracker_udp_dialog.cpp @@ -3,10 +3,10 @@ TrackerControls::TrackerControls() { - ui.setupUi( this ); + ui.setupUi( this ); - connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); - connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); + connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); + connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); tie_setting(s.port, ui.spinPortNumber); tie_setting(s.add_yaw, ui.add_yaw); @@ -16,11 +16,11 @@ TrackerControls::TrackerControls() void TrackerControls::doOK() { s.b->save(); - this->close(); + close(); } void TrackerControls::doCancel() { s.b->reload(); - this->close(); + close(); } |