diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2021-12-15 15:29:46 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2021-12-16 15:32:03 +0100 |
commit | aa3d6dd09fb2ecf4a5bf91536ca67b4f71b24613 (patch) | |
tree | 50d55ab1822ba68733325955ce6be24d82752a87 | |
parent | 94cdd29400d739fcec664266537ecf3904a8476d (diff) |
many: switch from using std::unique_ptr<t>::get() to &*ptr
-rw-r--r-- | dinput/keybinding-worker.cpp | 4 | ||||
-rw-r--r-- | gui/settings.cpp | 2 | ||||
-rw-r--r-- | main-window/module-mixin.cpp | 12 | ||||
-rw-r--r-- | opentrack/main-window.cpp | 16 | ||||
-rw-r--r-- | proto-iokit-foohid/iokitprotocol.cpp | 12 | ||||
-rw-r--r-- | proto-udp/ftnoir_protocol_ftn.cpp | 2 | ||||
-rw-r--r-- | spline/spline-widget.cpp | 2 | ||||
-rw-r--r-- | spline/spline.cpp | 6 | ||||
-rw-r--r-- | tracker-aruco/ftnoir_tracker_aruco.cpp | 4 | ||||
-rw-r--r-- | tracker-easy/tracker-easy.cpp | 8 | ||||
-rw-r--r-- | tracker-fusion/fusion.cpp | 2 | ||||
-rw-r--r-- | tracker-kinect-face/kinect_face_tracker.cpp | 4 | ||||
-rw-r--r-- | tracker-neuralnet/ftnoir_tracker_neuralnet.cpp | 4 | ||||
-rw-r--r-- | tracker-pt/ftnoir_tracker_pt.cpp | 6 |
14 files changed, 41 insertions, 43 deletions
diff --git a/dinput/keybinding-worker.cpp b/dinput/keybinding-worker.cpp index 0ceca789..91b02428 100644 --- a/dinput/keybinding-worker.cpp +++ b/dinput/keybinding-worker.cpp @@ -225,7 +225,7 @@ KeybindingWorker::fun* KeybindingWorker::add_receiver(fun& receiver) { QMutexLocker l(&mtx); receivers.push_back(std::make_unique<fun>(receiver)); - fun* f = receivers[receivers.size() - 1].get(); + fun* f = &*receivers[receivers.size() - 1]; //qDebug() << "add receiver" << (long) f; joy_ctx.refresh(); return f; @@ -241,7 +241,7 @@ void KeybindingWorker::remove_receiver(KeybindingWorker::fun* pos) for (int i = s(receivers.size()) - 1; i >= 0; i--) { using u = unsigned; - if (receivers[u(i)].get() == pos) + if (&*receivers[u(i)] == pos) { ok = true; //qDebug() << "remove receiver" << (long) pos; diff --git a/gui/settings.cpp b/gui/settings.cpp index ff2114d3..907fe8f3 100644 --- a/gui/settings.cpp +++ b/gui/settings.cpp @@ -210,7 +210,7 @@ void options_dialog::bind_key(key_opts& kopts, QLabel* label) k->close(); } }); - connect(main.b.get(), &options::detail::bundle::reloading, k, &QDialog::close); + connect(&*main.b, &options::detail::bundle::reloading, k, &QDialog::close); pause_keybindings(true); k->exec(); pause_keybindings(false); diff --git a/main-window/module-mixin.cpp b/main-window/module-mixin.cpp index 18b2867d..5c4c3234 100644 --- a/main-window/module-mixin.cpp +++ b/main-window/module-mixin.cpp @@ -87,27 +87,27 @@ dylib_ptr module_mixin::current_filter() void module_mixin::show_tracker_settings_() { if (mk_dialog(tracker_dialog, current_tracker()) && state.work && state.work->libs.pTracker) - tracker_dialog->register_tracker(state.work->libs.pTracker.get()); + tracker_dialog->register_tracker(&*state.work->libs.pTracker); if (tracker_dialog) - QObject::connect(tracker_dialog.get(), &ITrackerDialog::closing, + QObject::connect(&*tracker_dialog, &ITrackerDialog::closing, &fuzz, [this] { tracker_dialog = nullptr; }); } void module_mixin::show_proto_settings_() { if (mk_dialog(proto_dialog, current_protocol()) && state.work && state.work->libs.pProtocol) - proto_dialog->register_protocol(state.work->libs.pProtocol.get()); + proto_dialog->register_protocol(&*state.work->libs.pProtocol); if (proto_dialog) - QObject::connect(proto_dialog.get(), &IProtocolDialog::closing, + QObject::connect(&*proto_dialog, &IProtocolDialog::closing, &fuzz, [this] { proto_dialog = nullptr; }); } void module_mixin::show_filter_settings_() { if (mk_dialog(filter_dialog, current_filter()) && state.work && state.work->libs.pFilter) - filter_dialog->register_filter(state.work->libs.pFilter.get()); + filter_dialog->register_filter(&*state.work->libs.pFilter); if (filter_dialog) - QObject::connect(filter_dialog.get(), &IFilterDialog::closing, + QObject::connect(&*filter_dialog, &IFilterDialog::closing, &fuzz, [this] { filter_dialog = nullptr; }); } diff --git a/opentrack/main-window.cpp b/opentrack/main-window.cpp index bd8c129a..d4587831 100644 --- a/opentrack/main-window.cpp +++ b/opentrack/main-window.cpp @@ -423,10 +423,10 @@ void main_window::start_tracker_() } if (pFilterDialog) - pFilterDialog->register_filter(work->libs.pFilter.get()); + pFilterDialog->register_filter(&*work->libs.pFilter); if (pProtocolDialog) - pProtocolDialog->register_protocol(work->libs.pProtocol.get()); + pProtocolDialog->register_protocol(&*work->libs.pProtocol); pose_update_timer.start(15); @@ -601,7 +601,7 @@ void main_window::show_tracker_settings_(bool show) { if (mk_dialog(pTrackerDialog, show, current_tracker()) && work && work->libs.pTracker) { - pTrackerDialog->register_tracker(work->libs.pTracker.get()); + pTrackerDialog->register_tracker(&*work->libs.pTracker); QObject::connect(&*pTrackerDialog, &ITrackerDialog::closing, this, [this] { pTrackerDialog = nullptr; }); } @@ -616,7 +616,7 @@ void main_window::show_proto_settings_(bool show) { if (mk_dialog(pProtocolDialog, show, current_protocol()) && work && work->libs.pProtocol) { - pProtocolDialog->register_protocol(work->libs.pProtocol.get()); + pProtocolDialog->register_protocol(&*work->libs.pProtocol); QObject::connect(&*pProtocolDialog, &IProtocolDialog::closing, this, [this] { pProtocolDialog = nullptr; }); } @@ -626,7 +626,7 @@ void main_window::show_filter_settings_(bool show) { if (mk_dialog(pFilterDialog, show, current_filter()) && work && work->libs.pFilter) { - pFilterDialog->register_filter(work->libs.pFilter.get()); + pFilterDialog->register_filter(&*work->libs.pFilter); QObject::connect(&*pFilterDialog, &IFilterDialog::closing, this, [this] { pFilterDialog = nullptr; }); } @@ -739,10 +739,8 @@ void main_window::ensure_tray() tray->setContextMenu(&tray_menu); tray->show(); - connect(tray.get(), - &QSystemTrayIcon::activated, - this, - &main_window::toggle_restore_from_tray); + connect(&*tray, &QSystemTrayIcon::activated, + this, &main_window::toggle_restore_from_tray); } QApplication::setQuitOnLastWindowClosed(false); diff --git a/proto-iokit-foohid/iokitprotocol.cpp b/proto-iokit-foohid/iokitprotocol.cpp index abc43a60..77a1e005 100644 --- a/proto-iokit-foohid/iokitprotocol.cpp +++ b/proto-iokit-foohid/iokitprotocol.cpp @@ -49,12 +49,12 @@ static uint8_t valueToStick(FooHIDJoystick *stick, double min, double value, dou void IOKitProtocol::pose(const double *headpose, const double*) { - const uint8_t x = valueToStick(joystick.get(), -75., headpose[0], +75.); - const uint8_t y = valueToStick(joystick.get(), -75., headpose[1], +75.); - const uint8_t z = valueToStick(joystick.get(), -75., headpose[2], +75.); - const uint8_t rx = valueToStick(joystick.get(), -180., headpose[3], +180.); - const uint8_t ry = valueToStick(joystick.get(), -180., headpose[4], +180.); - const uint8_t rz = valueToStick(joystick.get(), -180., headpose[5], +180.); + const uint8_t x = valueToStick(&*joystick, -75., headpose[0], +75.); + const uint8_t y = valueToStick(&*joystick, -75., headpose[1], +75.); + const uint8_t z = valueToStick(&*joystick, -75., headpose[2], +75.); + const uint8_t rx = valueToStick(&*joystick, -180., headpose[3], +180.); + const uint8_t ry = valueToStick(&*joystick, -180., headpose[4], +180.); + const uint8_t rz = valueToStick(&*joystick, -180., headpose[5], +180.); joystick->setValue({x, y, z, rx, ry, rz}); } diff --git a/proto-udp/ftnoir_protocol_ftn.cpp b/proto-udp/ftnoir_protocol_ftn.cpp index f04f4f4c..c67c39b8 100644 --- a/proto-udp/ftnoir_protocol_ftn.cpp +++ b/proto-udp/ftnoir_protocol_ftn.cpp @@ -16,7 +16,7 @@ udp::udp() { set_dest_address(); - QObject::connect(s.b.get(), &bundle_::changed, + QObject::connect(&*s.b, &bundle_::changed, this, &udp::set_dest_address, Qt::DirectConnection); } diff --git a/spline/spline-widget.cpp b/spline/spline-widget.cpp index 7a962182..d26fb13f 100644 --- a/spline/spline-widget.cpp +++ b/spline/spline-widget.cpp @@ -49,7 +49,7 @@ void spline_widget::set_config(base_spline* spl) if (spl) { std::shared_ptr<base_settings> s = spl->get_settings(); - connection = connect(s.get(), &base_settings::recomputed, + connection = connect(&*s, &base_settings::recomputed, this, [this] { reload_spline(); }, Qt::QueuedConnection); } diff --git a/spline/spline.cpp b/spline/spline.cpp index 9f92c074..ecbfc3a0 100644 --- a/spline/spline.cpp +++ b/spline/spline.cpp @@ -391,11 +391,11 @@ void spline::set_bundle(bundle b, const QString& axis_name, Axis axis) S = s; conn_points = QObject::connect(&s->points, value_::value_changed<QList<QPointF>>(), - ctx.get(), [this] { invalidate_settings(); }, Qt::DirectConnection); + &*ctx, [this] { invalidate_settings(); }, Qt::DirectConnection); conn_maxx = QObject::connect(&s->opts.clamp_x_, value_::value_changed<int>(), - ctx.get(), [this](double) { invalidate_settings(); }, Qt::DirectConnection); + &*ctx, [this](double) { invalidate_settings(); }, Qt::DirectConnection); conn_maxy = QObject::connect(&s->opts.clamp_y_, value_::value_changed<int>(), - ctx.get(), [this](double) { invalidate_settings(); }, Qt::DirectConnection); + &*ctx, [this](double) { invalidate_settings(); }, Qt::DirectConnection); } emit S->recomputed(); diff --git a/tracker-aruco/ftnoir_tracker_aruco.cpp b/tracker-aruco/ftnoir_tracker_aruco.cpp index a3678b46..4e31d90d 100644 --- a/tracker-aruco/ftnoir_tracker_aruco.cpp +++ b/tracker-aruco/ftnoir_tracker_aruco.cpp @@ -82,8 +82,8 @@ module_status aruco_tracker::start_tracker(QFrame* videoframe) videoWidget = std::make_unique<cv_video_widget>(videoframe); layout = std::make_unique<QHBoxLayout>(); layout->setContentsMargins(0, 0, 0, 0); - layout->addWidget(videoWidget.get()); - videoframe->setLayout(layout.get()); + layout->addWidget(&*videoWidget); + videoframe->setLayout(&*layout); videoWidget->show(); start(); diff --git a/tracker-easy/tracker-easy.cpp b/tracker-easy/tracker-easy.cpp index 0487d031..7046a918 100644 --- a/tracker-easy/tracker-easy.cpp +++ b/tracker-easy/tracker-easy.cpp @@ -56,8 +56,8 @@ namespace EasyTracker { opencv_init(); - connect(iSettings.b.get(), &bundle_::saving, this, &Tracker::CheckCamera, Qt::DirectConnection); - connect(iSettings.b.get(), &bundle_::reloading, this, &Tracker::CheckCamera, Qt::DirectConnection); + connect(&*iSettings.b, &bundle_::saving, this, &Tracker::CheckCamera, Qt::DirectConnection); + connect(&*iSettings.b, &bundle_::reloading, this, &Tracker::CheckCamera, Qt::DirectConnection); connect(&iSettings.fov, value_::value_changed<int>(), this, &Tracker::set_fov, Qt::DirectConnection); set_fov(iSettings.fov); @@ -842,8 +842,8 @@ namespace EasyTracker widget = std::make_unique<video_widget>(video_frame); layout = std::make_unique<QHBoxLayout>(video_frame); layout->setContentsMargins(0, 0, 0, 0); - layout->addWidget(widget.get()); - video_frame->setLayout(layout.get()); + layout->addWidget(&*widget); + video_frame->setLayout(&*layout); //video_widget->resize(video_frame->width(), video_frame->height()); video_frame->show(); diff --git a/tracker-fusion/fusion.cpp b/tracker-fusion/fusion.cpp index 56a5fa33..fba38d3d 100644 --- a/tracker-fusion/fusion.cpp +++ b/tracker-fusion/fusion.cpp @@ -115,7 +115,7 @@ module_status fusion_tracker::start_tracker(QFrame* frame) other_frame->setFixedSize(320, 240); // XXX magic frame size other_frame->setVisible(false); - rot_tracker->start_tracker(other_frame.get()); + rot_tracker->start_tracker(&*other_frame); } end: diff --git a/tracker-kinect-face/kinect_face_tracker.cpp b/tracker-kinect-face/kinect_face_tracker.cpp index e7b77133..4bab2eef 100644 --- a/tracker-kinect-face/kinect_face_tracker.cpp +++ b/tracker-kinect-face/kinect_face_tracker.cpp @@ -136,8 +136,8 @@ module_status KinectFaceTracker::start_tracker(QFrame* aFrame) iVideoWidget = std::make_unique<video_widget>(aFrame); iLayout = std::make_unique<QHBoxLayout>(aFrame); iLayout->setContentsMargins(0, 0, 0, 0); - iLayout->addWidget(iVideoWidget.get()); - aFrame->setLayout(iLayout.get()); + iLayout->addWidget(&*iVideoWidget); + aFrame->setLayout(&*iLayout); //video_widget->resize(video_frame->width(), video_frame->height()); aFrame->show(); diff --git a/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp b/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp index f5939cf6..afee8a68 100644 --- a/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp +++ b/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp @@ -540,8 +540,8 @@ module_status neuralnet_tracker::start_tracker(QFrame* videoframe) videoWidget = std::make_unique<cv_video_widget>(videoframe); layout = std::make_unique<QHBoxLayout>(); layout->setContentsMargins(0, 0, 0, 0); - layout->addWidget(videoWidget.get()); - videoframe->setLayout(layout.get()); + layout->addWidget(&*videoWidget); + videoframe->setLayout(&*layout); videoWidget->show(); start(); return status_ok(); diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp index 9201a2f6..d43e861f 100644 --- a/tracker-pt/ftnoir_tracker_pt.cpp +++ b/tracker-pt/ftnoir_tracker_pt.cpp @@ -34,7 +34,7 @@ Tracker_PT::Tracker_PT(pointer<pt_runtime_traits> const& traits) : { opencv_init(); - connect(s.b.get(), &bundle_::saving, this, [this]{ reopen_camera_flag = true; }, Qt::DirectConnection); + connect(&*s.b, &bundle_::saving, this, [this]{ reopen_camera_flag = true; }, Qt::DirectConnection); } Tracker_PT::~Tracker_PT() @@ -136,8 +136,8 @@ module_status Tracker_PT::start_tracker(QFrame* video_frame) widget = std::make_unique<video_widget>(video_frame); layout = std::make_unique<QHBoxLayout>(video_frame); layout->setContentsMargins(0, 0, 0, 0); - layout->addWidget(widget.get()); - video_frame->setLayout(layout.get()); + layout->addWidget(&*widget); + video_frame->setLayout(&*layout); //video_widget->resize(video_frame->width(), video_frame->height()); video_frame->show(); |