From 0c6ed9a68d3f576da7af3ba49dba4993a6a4233a Mon Sep 17 00:00:00 2001 From: Vasily Date: Sat, 20 Jul 2019 10:38:52 +0200 Subject: [PATCH] Remove widget and parent pointers from UtilitiesTabController The pointers are not needed and are an anti pattern. --- src/overlaycontroller.cpp | 3 +-- src/tabcontrollers/UtilitiesTabController.cpp | 4 +--- src/tabcontrollers/UtilitiesTabController.h | 3 +-- src/tabcontrollers/VideoTabController.cpp | 7 ------- src/tabcontrollers/VideoTabController.h | 3 --- 5 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/overlaycontroller.cpp b/src/overlaycontroller.cpp index 57a0bf4..a2d191c 100644 --- a/src/overlaycontroller.cpp +++ b/src/overlaycontroller.cpp @@ -491,8 +491,7 @@ void OverlayController::SetWidget( QQuickItem* quickItem, m_statisticsTabController.initStage2( this ); m_settingsTabController.initStage2( this ); m_reviveTabController.initStage2( this ); - m_utilitiesTabController.initStage2( this, m_pWindow.get() ); - m_videoTabController.initStage2( this, m_pWindow.get() ); + m_utilitiesTabController.initStage2( this ); m_moveCenterTabController.initStage2( this, m_pWindow.get() ); } diff --git a/src/tabcontrollers/UtilitiesTabController.cpp b/src/tabcontrollers/UtilitiesTabController.cpp index fa72f27..55f1056 100644 --- a/src/tabcontrollers/UtilitiesTabController.cpp +++ b/src/tabcontrollers/UtilitiesTabController.cpp @@ -22,11 +22,9 @@ void UtilitiesTabController::initStage1() m_alarmTime = QTime( qAlarmHour.toInt(), qAlarmMinute.toInt() ); } -void UtilitiesTabController::initStage2( OverlayController* var_parent, - QQuickWindow* var_widget ) +void UtilitiesTabController::initStage2( OverlayController* var_parent ) { this->m_parent = var_parent; - this->m_widget = var_widget; } void UtilitiesTabController::sendKeyboardInput( QString input ) diff --git a/src/tabcontrollers/UtilitiesTabController.h b/src/tabcontrollers/UtilitiesTabController.h index 87f73a6..e52ced1 100644 --- a/src/tabcontrollers/UtilitiesTabController.h +++ b/src/tabcontrollers/UtilitiesTabController.h @@ -29,7 +29,6 @@ class UtilitiesTabController : public QObject private: OverlayController* m_parent; - QQuickWindow* m_widget; unsigned settingsUpdateCounter = 0; @@ -45,7 +44,7 @@ private: public: void initStage1(); - void initStage2( OverlayController* var_parent, QQuickWindow* var_widget ); + void initStage2( OverlayController* var_parent ); void eventLoopTick(); diff --git a/src/tabcontrollers/VideoTabController.cpp b/src/tabcontrollers/VideoTabController.cpp index 23800b5..fa36172 100644 --- a/src/tabcontrollers/VideoTabController.cpp +++ b/src/tabcontrollers/VideoTabController.cpp @@ -14,13 +14,6 @@ void VideoTabController::initStage1() reloadVideoConfig(); } -void VideoTabController::initStage2( OverlayController* var_parent, - QQuickWindow* var_widget ) -{ - this->parent = var_parent; - this->widget = var_widget; -} - void VideoTabController::initBrightnessOverlay() { std::string notifKey = std::string( application_strings::applicationKey ) diff --git a/src/tabcontrollers/VideoTabController.h b/src/tabcontrollers/VideoTabController.h index f53f4d7..e549bdd 100644 --- a/src/tabcontrollers/VideoTabController.h +++ b/src/tabcontrollers/VideoTabController.h @@ -45,8 +45,6 @@ private: // how wide overlay is, Increase this value if edges of view are not // dimmed. const float k_overlayWidth = 1.0f; - OverlayController* parent; - QQuickWindow* widget; vr::VROverlayHandle_t m_brightnessOverlayHandle = vr::k_ulOverlayHandleInvalid; @@ -105,7 +103,6 @@ public: float colorOpacityPerc() const; void initStage1(); - void initStage2( OverlayController* var_parent, QQuickWindow* var_widget ); void eventLoopTick(); public slots: