From 3dc679e08036ccd1ec34bae30fdc7d299ffae92e Mon Sep 17 00:00:00 2001 From: AnnaAK Date: Fri, 27 May 2016 12:22:41 +0300 Subject: [PATCH 1/7] Add gamepad indicator for status bar --- trikGui/backgroundWidget.cpp | 2 ++ trikGui/backgroundWidget.h | 2 ++ trikGui/controller.cpp | 5 +++ trikGui/controller.h | 3 ++ trikGui/gamepadIndicator.cpp | 53 +++++++++++++++++++++++++++ trikGui/gamepadIndicator.h | 58 ++++++++++++++++++++++++++++++ trikGui/resources/gamepad_off.png | Bin 0 -> 831 bytes trikGui/resources/gamepad_on.png | Bin 0 -> 828 bytes trikGui/trikGui.pro | 2 ++ trikGui/trikGui.qrc | 2 ++ 10 files changed, 127 insertions(+) create mode 100644 trikGui/gamepadIndicator.cpp create mode 100644 trikGui/gamepadIndicator.h create mode 100644 trikGui/resources/gamepad_off.png create mode 100644 trikGui/resources/gamepad_on.png diff --git a/trikGui/backgroundWidget.cpp b/trikGui/backgroundWidget.cpp index 6d97cf239..27680a085 100644 --- a/trikGui/backgroundWidget.cpp +++ b/trikGui/backgroundWidget.cpp @@ -32,6 +32,7 @@ BackgroundWidget::BackgroundWidget( , mController(configPath) , mBatteryIndicator(mController.brick()) , mWiFiIndicator(mController) + , mGamepadIndicator(mController, mController.gamepadConnectionStatus()) , mMailboxIndicator("://resources/mailboxConnected.png", mController.mailbox()->isConnected()) , mCommunicatorIndicator("://resources/communicatorConnected.png", mController.communicatorConnectionStatus()) , mStartWidget(mController) @@ -50,6 +51,7 @@ BackgroundWidget::BackgroundWidget( mStatusBarLayout.addWidget(&mMailboxIndicator); mStatusBarLayout.addWidget(&mCommunicatorIndicator); mStatusBarLayout.addWidget(&mWiFiIndicator); + mStatusBarLayout.addWidget(&mGamepadIndicator); addMainWidget(mStartWidget); mBrickDisplayWidgetWrapper.reset(new LazyMainWidgetWrapper(mController.brick().graphicsWidget())); addLazyWidget(*mBrickDisplayWidgetWrapper); diff --git a/trikGui/backgroundWidget.h b/trikGui/backgroundWidget.h index 28ab44ada..5a91b1e71 100644 --- a/trikGui/backgroundWidget.h +++ b/trikGui/backgroundWidget.h @@ -35,6 +35,7 @@ #include "controller.h" #include "batteryIndicator.h" #include "wiFiIndicator.h" +#include "gamepadIndicator.h" #include "openSocketIndicator.h" #include "startWidget.h" #include "runningWidget.h" @@ -114,6 +115,7 @@ private slots: QStackedLayout mMainWidgetsLayout; BatteryIndicator mBatteryIndicator; WiFiIndicator mWiFiIndicator; + GamepadIndicator mGamepadIndicator; OpenSocketIndicator mMailboxIndicator; OpenSocketIndicator mCommunicatorIndicator; StartWidget mStartWidget; diff --git a/trikGui/controller.cpp b/trikGui/controller.cpp index 9a0ac50f3..383354797 100644 --- a/trikGui/controller.cpp +++ b/trikGui/controller.cpp @@ -131,6 +131,11 @@ bool Controller::communicatorConnectionStatus() return mTelemetry->activeConnections() > 0 && mCommunicator->activeConnections() > 0; } +bool Controller::gamepadConnectionStatus() +{ + return mGamepad->isConnected(); +} + void Controller::updateCommunicatorStatus() { emit communicatorStatusChanged(communicatorConnectionStatus()); diff --git a/trikGui/controller.h b/trikGui/controller.h index 4ae00f0c9..9cffab578 100644 --- a/trikGui/controller.h +++ b/trikGui/controller.h @@ -64,6 +64,9 @@ class Controller : public QObject /// Returns communicator connection status (whether or not both Telemetry and Communicator servers are connected). bool communicatorConnectionStatus(); + /// Returns gamepad connection status. + bool gamepadConnectionStatus(); + public slots: /// Cancels execution of current program. void abortExecution(); diff --git a/trikGui/gamepadIndicator.cpp b/trikGui/gamepadIndicator.cpp new file mode 100644 index 000000000..3a7a2f748 --- /dev/null +++ b/trikGui/gamepadIndicator.cpp @@ -0,0 +1,53 @@ +/* Copyright 2015 CyberTech Labs Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ + +#include "gamepadIndicator.h" + +#include "trikKernel/paths.h" + +using namespace trikGui; + +GamepadIndicator::GamepadIndicator(Controller &controller, bool status, QWidget *parent) + : QLabel(parent) + , mController(controller) +{ + status ? setOn() : setOff(); + + updateStatus(); + connect(&mUpdateTimer, SIGNAL(timeout()), this, SLOT(updateStatus())); + mUpdateTimer.start(7000); +} + +void GamepadIndicator::setOn() +{ + QPixmap icon("://resources/gamepad_on.png"); + setPixmap(icon); +} + +void GamepadIndicator::setOff() +{ + QPixmap icon("://resources/gamepad_off.png"); + setPixmap(icon); +} + +void GamepadIndicator::connected(bool connected) +{ + connected ? setOn() : setOff(); +} + +void GamepadIndicator::updateStatus() +{ + connected(mController.gamepadConnectionStatus()); +} + diff --git a/trikGui/gamepadIndicator.h b/trikGui/gamepadIndicator.h new file mode 100644 index 000000000..1af9d4abc --- /dev/null +++ b/trikGui/gamepadIndicator.h @@ -0,0 +1,58 @@ +/* Copyright 2015 CyberTech Labs Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ + +#pragma once + +#include + +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + #include +#else + #include +#endif + +#include +#include + +namespace trikGui { + +/// A label that shows wifi connection status. +class GamepadIndicator : public QLabel +{ + Q_OBJECT +public: + /// @param controller is used to get the current network info + explicit GamepadIndicator(Controller &controller, bool status, QWidget *parent = 0); + +signals: + +public slots: + /// Updates the status to 'connect'. + void setOn(); + + /// Updates the status to 'disconnect'. + void setOff(); + + /// Requests connection info from the controller and updates the status. + void updateStatus(); + + ///Updates the status according to connected parameters. + void connected(bool connected); + +private: + QTimer mUpdateTimer; + Controller &mController; +}; + +} diff --git a/trikGui/resources/gamepad_off.png b/trikGui/resources/gamepad_off.png new file mode 100644 index 0000000000000000000000000000000000000000..02dcc1be230a308a69fff867ea83d369b6a0cfbf GIT binary patch literal 831 zcmV-F1Hk-=P)C z|3~}(|NsA=FPH0eTdj4gt!<@LY;2VPAq7gKD}k_3$YfENP$~pcK`LM^Wl16c5hw}@ zQh=(kq+yG;t*Y6&TyD-6ZLZad=m^)#^>RI*Pv_J5e7U$1_+#Wh*83tzJRXmMQmW5n zGC#VPWtlU^p4Zma9sz)7jpZB;4-eOBwb}tfNIRv}$QYy9pl@IR@Gvqmvj6h(vg-Hy zLl`FneLkO4lB88hl3LU0G`zmPf=;IcNs@r`T=Be6N?Y`LeY?-+^DHebUC4@}=p;!R zCxo;{A`ytiVo+681(%nXP*YO_MMXs)M6p0|aWS}DE;u0&ce(tX3<`%*?>@@-n1SDbVZn!Wkh1Iy*Z>fvv4AXl`zXwzf7{Utfo0 zGHH@!*)CH`%K<=(Gdn&$28~7o-QC>~3+5SMD=UM(zCPI7+k>;SGrU6R zT4IcqW6Kp7jP2NLHZczjYG`Q4wW@|vDh>`iz`4t^xF`b7d4+H&-T;JXX=y1g1=wOf za32o>O{gJ+2!}aA1cTps0)TDC*ew8LkC{#x+rf)cK>Fvi|E=l=Wq`?=3z2=1B9=2^4Z{Esm< zLB z|4S6_`~Ux6XJ%%1RWmho7o!XA(S07S$@3Zb+hgHS~j$ug|c)zx)(XX4y#Rnru}D*(%Jo_jrx^Ei%?*k#mR_H7bM znGc9OY9`#b!nW0`CXCM>+;48P02radRx7+#N1|-uswR=;*ND;0$e~MHVSs*C<5&6< zdb}=L8q1jw_X0wD1F5n^i>8q2@qlj*OyQuaV65iejIMwJ8Cn!s_6F>&B@C+$2WHuz zOp?i*oq+jq8#dbs#=mxwkPea28>K!VCJb`Zi+MZpl*t){H6u!=+~J^DH6J9^uW;V& zf{B3yj;9n*WG|wk!oruq4wBD-qO4UHZGot82-D(-v`9op8n~7~m&jQ;LYlg4AxVYU z#UF4nyO@H4%f!dWQ(b+ZrdIGQc3_DHSqDji3#T2(vdoL#D$X2B;mXOow00FT?k@V_MFL?K@txIWdhO9fiWlHCWTX}`*FEO>G^2K;{jw$ zl0v+y%UBfyC1M}UMEBDBS_gc57CEiDsvh`K?6jslUf>hl87P3ZuG20S4cNORc|7e^C(y<4I`UWdTuW=sWT^ z@xz>2nv=%yHZ|cEdx-e4resources/openWifi.png resources/passwordedWifi.png resources/wait.png + resources/gamepad_off.png + resources/gamepad_on.png From 8bc611acd05928115ac27888752189a315a59e63 Mon Sep 17 00:00:00 2001 From: AnnaAK Date: Fri, 27 May 2016 15:22:56 +0300 Subject: [PATCH 2/7] Update gamepadIndicator.h --- trikGui/gamepadIndicator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trikGui/gamepadIndicator.h b/trikGui/gamepadIndicator.h index 1af9d4abc..19d2f2241 100644 --- a/trikGui/gamepadIndicator.h +++ b/trikGui/gamepadIndicator.h @@ -47,7 +47,7 @@ public slots: /// Requests connection info from the controller and updates the status. void updateStatus(); - ///Updates the status according to connected parameters. + /// Updates the status according to connected parameters. void connected(bool connected); private: From 18ceec9a126eaa0b0c5b064cd36b53a78142a2a7 Mon Sep 17 00:00:00 2001 From: AnnaAK Date: Fri, 27 May 2016 15:24:02 +0300 Subject: [PATCH 3/7] Update gamepadIndicator.cpp --- trikGui/gamepadIndicator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trikGui/gamepadIndicator.cpp b/trikGui/gamepadIndicator.cpp index 3a7a2f748..0f02722a4 100644 --- a/trikGui/gamepadIndicator.cpp +++ b/trikGui/gamepadIndicator.cpp @@ -31,8 +31,8 @@ GamepadIndicator::GamepadIndicator(Controller &controller, bool status, QWidget void GamepadIndicator::setOn() { - QPixmap icon("://resources/gamepad_on.png"); - setPixmap(icon); + QPixmap icon("://resources/gamepad_on.png"); + setPixmap(icon); } void GamepadIndicator::setOff() From 01169ec8cad7e9fc61eacf5a83bf92ea33404657 Mon Sep 17 00:00:00 2001 From: AnnaAK Date: Sat, 28 May 2016 20:01:25 +0300 Subject: [PATCH 4/7] processing gamepad off trough signal --- trikGui/controller.cpp | 2 ++ trikGui/controller.h | 3 +++ trikGui/gamepadIndicator.cpp | 1 + trikGui/gamepadIndicator.h | 2 +- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/trikGui/controller.cpp b/trikGui/controller.cpp index 383354797..89ac1130b 100644 --- a/trikGui/controller.cpp +++ b/trikGui/controller.cpp @@ -49,6 +49,8 @@ Controller::Controller(const QString &configPath) , correctedConfigPath + "model-config.xml"); mGamepad.reset(trikNetwork::GamepadFactory::create(configurer)); + connect(mGamepad.data(), SIGNAL(disconnect()), this, SIGNAL(gamepadDisconnected())); + mMailbox.reset(trikNetwork::MailboxFactory::create(configurer)); mTelemetry.reset(new trikTelemetry::TrikTelemetry(*mBrick, *mGamepad)); mScriptRunner.reset(new trikScriptRunner::TrikScriptRunner(*mBrick, mMailbox.data(), mGamepad.data())); diff --git a/trikGui/controller.h b/trikGui/controller.h index 9cffab578..7a6c471e6 100644 --- a/trikGui/controller.h +++ b/trikGui/controller.h @@ -91,6 +91,9 @@ public slots: /// clutter from videosensors. void brickStopped(); + /// Emitted when a robot is disconnected to a gamepad. + void gamepadDisconnected(); + /// Emitted when a robot is connected to a network. void wiFiConnected(); diff --git a/trikGui/gamepadIndicator.cpp b/trikGui/gamepadIndicator.cpp index 3a7a2f748..c8ba5fe69 100644 --- a/trikGui/gamepadIndicator.cpp +++ b/trikGui/gamepadIndicator.cpp @@ -23,6 +23,7 @@ GamepadIndicator::GamepadIndicator(Controller &controller, bool status, QWidget , mController(controller) { status ? setOn() : setOff(); + connect(&mController, SIGNAL(gamepadDisconnected()), this, SLOT(setOff())); updateStatus(); connect(&mUpdateTimer, SIGNAL(timeout()), this, SLOT(updateStatus())); diff --git a/trikGui/gamepadIndicator.h b/trikGui/gamepadIndicator.h index 1af9d4abc..19d2f2241 100644 --- a/trikGui/gamepadIndicator.h +++ b/trikGui/gamepadIndicator.h @@ -47,7 +47,7 @@ public slots: /// Requests connection info from the controller and updates the status. void updateStatus(); - ///Updates the status according to connected parameters. + /// Updates the status according to connected parameters. void connected(bool connected); private: From a28ea6c563d408996fb0d4aab37364584152206f Mon Sep 17 00:00:00 2001 From: AnnaAK Date: Sun, 29 May 2016 19:46:05 +0300 Subject: [PATCH 5/7] fixed according comments except first --- trikGui/backgroundWidget.cpp | 4 ++-- trikGui/controller.cpp | 3 ++- trikGui/controller.h | 7 +++++-- trikGui/gamepadIndicator.cpp | 9 ++++----- trikGui/gamepadIndicator.h | 10 ++++------ trikGui/trikGui.pro | 4 ++-- 6 files changed, 19 insertions(+), 18 deletions(-) diff --git a/trikGui/backgroundWidget.cpp b/trikGui/backgroundWidget.cpp index 27680a085..00d575f8e 100644 --- a/trikGui/backgroundWidget.cpp +++ b/trikGui/backgroundWidget.cpp @@ -32,7 +32,7 @@ BackgroundWidget::BackgroundWidget( , mController(configPath) , mBatteryIndicator(mController.brick()) , mWiFiIndicator(mController) - , mGamepadIndicator(mController, mController.gamepadConnectionStatus()) + , mGamepadIndicator(mController) , mMailboxIndicator("://resources/mailboxConnected.png", mController.mailbox()->isConnected()) , mCommunicatorIndicator("://resources/communicatorConnected.png", mController.communicatorConnectionStatus()) , mStartWidget(mController) @@ -48,10 +48,10 @@ BackgroundWidget::BackgroundWidget( mStatusBarLayout.addWidget(&mBatteryIndicator); mStatusBarLayout.addStretch(); + mStatusBarLayout.addWidget(&mGamepadIndicator); mStatusBarLayout.addWidget(&mMailboxIndicator); mStatusBarLayout.addWidget(&mCommunicatorIndicator); mStatusBarLayout.addWidget(&mWiFiIndicator); - mStatusBarLayout.addWidget(&mGamepadIndicator); addMainWidget(mStartWidget); mBrickDisplayWidgetWrapper.reset(new LazyMainWidgetWrapper(mController.brick().graphicsWidget())); addLazyWidget(*mBrickDisplayWidgetWrapper); diff --git a/trikGui/controller.cpp b/trikGui/controller.cpp index 89ac1130b..ce464c916 100644 --- a/trikGui/controller.cpp +++ b/trikGui/controller.cpp @@ -50,6 +50,7 @@ Controller::Controller(const QString &configPath) mGamepad.reset(trikNetwork::GamepadFactory::create(configurer)); connect(mGamepad.data(), SIGNAL(disconnect()), this, SIGNAL(gamepadDisconnected())); + connect(mGamepad.data(), SIGNAL(connected()), this, SIGNAL(gamepadConnected())); mMailbox.reset(trikNetwork::MailboxFactory::create(configurer)); mTelemetry.reset(new trikTelemetry::TrikTelemetry(*mBrick, *mGamepad)); @@ -133,7 +134,7 @@ bool Controller::communicatorConnectionStatus() return mTelemetry->activeConnections() > 0 && mCommunicator->activeConnections() > 0; } -bool Controller::gamepadConnectionStatus() +bool Controller::gamepadConnectionStatus() const { return mGamepad->isConnected(); } diff --git a/trikGui/controller.h b/trikGui/controller.h index 7a6c471e6..9684d13f3 100644 --- a/trikGui/controller.h +++ b/trikGui/controller.h @@ -65,7 +65,7 @@ class Controller : public QObject bool communicatorConnectionStatus(); /// Returns gamepad connection status. - bool gamepadConnectionStatus(); + bool gamepadConnectionStatus() const; public slots: /// Cancels execution of current program. @@ -91,9 +91,12 @@ public slots: /// clutter from videosensors. void brickStopped(); - /// Emitted when a robot is disconnected to a gamepad. + /// Emitted when a robot is disconnected from a gamepad. void gamepadDisconnected(); + /// Emitted when a robot is connected to a gamepad. + void gamepadConnected(); + /// Emitted when a robot is connected to a network. void wiFiConnected(); diff --git a/trikGui/gamepadIndicator.cpp b/trikGui/gamepadIndicator.cpp index ecb060747..afc4c65e3 100644 --- a/trikGui/gamepadIndicator.cpp +++ b/trikGui/gamepadIndicator.cpp @@ -1,4 +1,4 @@ -/* Copyright 2015 CyberTech Labs Ltd. +/* Copyright 2016 Anna Kudryashova * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,12 +18,12 @@ using namespace trikGui; -GamepadIndicator::GamepadIndicator(Controller &controller, bool status, QWidget *parent) +GamepadIndicator::GamepadIndicator(Controller &controller, QWidget *parent) : QLabel(parent) , mController(controller) { - status ? setOn() : setOff(); connect(&mController, SIGNAL(gamepadDisconnected()), this, SLOT(setOff())); + connect(&mController, SIGNAL(gamepadConnected()), this, SLOT(setOn())); updateStatus(); connect(&mUpdateTimer, SIGNAL(timeout()), this, SLOT(updateStatus())); @@ -38,8 +38,7 @@ void GamepadIndicator::setOn() void GamepadIndicator::setOff() { - QPixmap icon("://resources/gamepad_off.png"); - setPixmap(icon); + hide(); } void GamepadIndicator::connected(bool connected) diff --git a/trikGui/gamepadIndicator.h b/trikGui/gamepadIndicator.h index 19d2f2241..4d28894f6 100644 --- a/trikGui/gamepadIndicator.h +++ b/trikGui/gamepadIndicator.h @@ -1,4 +1,4 @@ -/* Copyright 2015 CyberTech Labs Ltd. +/* Copyright 2016 Anna Kudryashova * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,15 +27,13 @@ namespace trikGui { -/// A label that shows wifi connection status. +/// A label that shows gamepad connection status. class GamepadIndicator : public QLabel { Q_OBJECT public: - /// @param controller is used to get the current network info - explicit GamepadIndicator(Controller &controller, bool status, QWidget *parent = 0); - -signals: + /// @param controller is used to get the current gamepad info + explicit GamepadIndicator(Controller &controller, QWidget *parent = 0); public slots: /// Updates the status to 'connect'. diff --git a/trikGui/trikGui.pro b/trikGui/trikGui.pro index 18a315798..d750bace4 100644 --- a/trikGui/trikGui.pro +++ b/trikGui/trikGui.pro @@ -49,7 +49,7 @@ HEADERS += \ $$PWD/wiFiModeWidget.h \ $$PWD/wiFiIndicator.h \ $$PWD/openSocketIndicator.h \ - gamepadIndicator.h + $$PWD/gamepadIndicator.h \ SOURCES += \ $$PWD/autoRunner.cpp \ @@ -84,7 +84,7 @@ SOURCES += \ $$PWD/wiFiModeWidget.cpp \ $$PWD/wiFiIndicator.cpp \ $$PWD/openSocketIndicator.cpp \ - gamepadIndicator.cpp + $$PWD/gamepadIndicator.cpp \ TRANSLATIONS = \ $$PWD/../translations/ru/trikGui_ru.ts \ From c86867286364cb70d7e55e46e3a9099e46c5ae58 Mon Sep 17 00:00:00 2001 From: AnnaAK Date: Sun, 29 May 2016 21:52:52 +0300 Subject: [PATCH 6/7] treatment disable gamepad --- trikGui/controller.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/trikGui/controller.cpp b/trikGui/controller.cpp index ce464c916..7a81c9c80 100644 --- a/trikGui/controller.cpp +++ b/trikGui/controller.cpp @@ -47,6 +47,7 @@ Controller::Controller(const QString &configPath) trikKernel::Configurer configurer(correctedConfigPath + "system-config.xml" , correctedConfigPath + "model-config.xml"); + //configurer.attributeByDevice("gamepad", "optional"); mGamepad.reset(trikNetwork::GamepadFactory::create(configurer)); connect(mGamepad.data(), SIGNAL(disconnect()), this, SIGNAL(gamepadDisconnected())); @@ -136,7 +137,10 @@ bool Controller::communicatorConnectionStatus() bool Controller::gamepadConnectionStatus() const { - return mGamepad->isConnected(); + if (mGamepad != nullptr){ + return mGamepad->isConnected(); + } + return false; } void Controller::updateCommunicatorStatus() From 49a4ab340ae4b2070f8f5d42e49f17e9320a49cc Mon Sep 17 00:00:00 2001 From: AnnaAK Date: Mon, 30 May 2016 09:20:10 +0300 Subject: [PATCH 7/7] fixed build --- trikGui/controller.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/trikGui/controller.cpp b/trikGui/controller.cpp index 7a81c9c80..a2e32fa4f 100644 --- a/trikGui/controller.cpp +++ b/trikGui/controller.cpp @@ -47,7 +47,6 @@ Controller::Controller(const QString &configPath) trikKernel::Configurer configurer(correctedConfigPath + "system-config.xml" , correctedConfigPath + "model-config.xml"); - //configurer.attributeByDevice("gamepad", "optional"); mGamepad.reset(trikNetwork::GamepadFactory::create(configurer)); connect(mGamepad.data(), SIGNAL(disconnect()), this, SIGNAL(gamepadDisconnected())); @@ -137,10 +136,11 @@ bool Controller::communicatorConnectionStatus() bool Controller::gamepadConnectionStatus() const { - if (mGamepad != nullptr){ + if (mGamepad != nullptr) { return mGamepad->isConnected(); - } + } else { return false; + } } void Controller::updateCommunicatorStatus()