diff options
| author | Alexis Maiquez Murcia <almamu@almamu.com> | 2019-02-20 09:57:51 +0100 |
|---|---|---|
| committer | Alexis Maiquez Murcia <almamu@almamu.com> | 2019-02-20 09:57:51 +0100 |
| commit | 959357b391dc5d561788f50d0b84ddc11fefd478 (patch) | |
| tree | e4061246005f71644512f4ff6402a34814816faf /src/app.cpp | |
| parent | d843e6a66a11e07595c8c4964fb8a1d343172990 (diff) | |
| download | lead-959357b391dc5d561788f50d0b84ddc11fefd478.tar lead-959357b391dc5d561788f50d0b84ddc11fefd478.tar.gz lead-959357b391dc5d561788f50d0b84ddc11fefd478.zip | |
Added debug mode
This allows the user to display the screen names, the sensors activated and the status of those sensors:
red -> waiting for mouse to enter
yellow -> waiting for delay timer to reach 0
green -> fired the command
Signed-off-by: Alexis Maiquez Murcia <almamu@almamu.com>
Diffstat (limited to 'src/app.cpp')
| -rw-r--r-- | src/app.cpp | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/app.cpp b/src/app.cpp index bb7c777..a73b812 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -27,6 +27,7 @@ SOFTWARE. #include "app.h" #include "sensor.h" +#include "screenname.h" #include <QDebug> #include <QScreen> #include <QFileSystemWatcher> @@ -34,6 +35,7 @@ SOFTWARE. #define SENSOR_WIDTH 5 #define SENSOR_HEIGHT 5 +#define DEBUG_MODE_KEY "systemsettings/debug" namespace Lead { @@ -51,6 +53,7 @@ App::App(int &argc, char** argv) : App::~App() { qDeleteAll(sensors); + qDeleteAll(screenNames); } @@ -99,7 +102,9 @@ void App::reloadScreens() { qDeleteAll(sensors); + qDeleteAll(screenNames); sensors.clear(); + screenNames.clear(); loadScreens(); } @@ -108,6 +113,14 @@ App::reloadScreens() void App::loadScreens() { + // first load the debug mode flag + this->debugMode = false; + + if (settings.contains (DEBUG_MODE_KEY)) + { + this->debugMode = settings.value (DEBUG_MODE_KEY).toInt () > 0; + } + foreach (QScreen* screen, screens()) { loadScreen(screen); @@ -130,6 +143,8 @@ App::loadScreen(QScreen* screen) loadSensor(screen, "topRight", rec.x() + rec.width() - SENSOR_WIDTH, rec.y(), SENSOR_WIDTH, SENSOR_HEIGHT); loadSensor(screen, "bottomRight", rec.x() + rec.width() - SENSOR_WIDTH, rec.y() + rec.height() - SENSOR_HEIGHT, SENSOR_WIDTH, SENSOR_HEIGHT); loadSensor(screen, "bottomLeft", rec.x(), rec.y() + rec.height() - SENSOR_HEIGHT, SENSOR_WIDTH, SENSOR_HEIGHT); + + loadScreenNameDisplay (screen); } @@ -168,7 +183,7 @@ App::loadSensor(QScreen* screen, QString name, int x, int y, int w, int h) if (emptyCount == 2) { // to not make this a breaking change, keep compatibility with old configurations - sensors.append (new Sensor (x, y, w, h, sensorName, "", 0, 0)); + sensors.append (new Sensor (x, y, w, h, sensorName, "", 0, 0, this->debugMode)); return; } @@ -191,10 +206,24 @@ App::loadSensor(QScreen* screen, QString name, int x, int y, int w, int h) settings.value (sensorEnterAction).toString (), settings.value (sensorExitAction).toString (), settings.value (sensorEnterDelay).toInt (), - settings.value (sensorExitDelay).toInt () + settings.value (sensorExitDelay).toInt (), + this->debugMode ) ); } +void +App::loadScreenNameDisplay(QScreen* screen) +{ + if (!this->debugMode) + { + return; + } + + qDebug () << "App::loadScreenNameDisplay () loading widget for screen " << screen->name (); + + screenNames.append (new ScreenName (screen)); +} + } // namespace |
