From 959357b391dc5d561788f50d0b84ddc11fefd478 Mon Sep 17 00:00:00 2001 From: Alexis Maiquez Murcia Date: Wed, 20 Feb 2019 09:57:51 +0100 Subject: 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 --- src/sensor.cpp | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'src/sensor.cpp') diff --git a/src/sensor.cpp b/src/sensor.cpp index 597d4f9..e33a9ac 100644 --- a/src/sensor.cpp +++ b/src/sensor.cpp @@ -34,12 +34,13 @@ SOFTWARE. namespace Lead { -Sensor::Sensor(int x, int y, int w, int h, QString enterAction, QString exitAction, int enterInterval, int exitInterval): +Sensor::Sensor(int x, int y, int w, int h, QString enterAction, QString exitAction, int enterInterval, int exitInterval, bool debugMode): QWidget(), enterAction(enterAction), exitAction(exitAction), enterInterval(enterInterval), - exitInterval(exitInterval) + exitInterval(exitInterval), + debugMode(debugMode) { qDebug() << "lead::Sensor() " << x << "," << y << "," << w << "," << h @@ -61,9 +62,16 @@ Sensor::Sensor(int x, int y, int w, int h, QString enterAction, QString exitActi connect(this->enterTimer, SIGNAL(timeout()), this, SLOT(activateEnter())); connect(this->exitTimer, SIGNAL(timeout()), this, SLOT(activateExit())); - //setStyleSheet("background-color:red;"); - setGeometry(x, y, w, h); - setAttribute(Qt::WA_TranslucentBackground, true); + if (this->debugMode) + { + setStyleSheet ("background-color: red"); + } + else + { + setAttribute(Qt::WA_TranslucentBackground, true); + } + + setGeometry(x, y, w, h); setWindowFlags(windowFlags() | Qt::X11BypassWindowManagerHint | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint ); show(); @@ -87,6 +95,9 @@ Sensor::enterEvent(QEvent * event) this->enterTimer->start(); this->exitTimer->start(); + + if (this->debugMode) + setStyleSheet ("background-color: yellow"); } @@ -103,6 +114,9 @@ Sensor::leaveEvent(QEvent * event) QProcess::startDetached(exitAction); } + if (this->debugMode) + setStyleSheet ("background-color: red"); + this->enterTimer->stop(); this->exitTimer->stop(); this->canTriggerExit = false; @@ -114,6 +128,9 @@ Sensor::activateEnter() { qDebug() << "lead::Sensor::activateEnter() " << this->x() << ":" << this->y() << " action: " << this->enterAction; + if (this->debugMode) + setStyleSheet ("background-color: green"); + QProcess::startDetached(enterAction); } -- cgit v1.2.3 From 2321c26ccd7d1243f8abfac62fea4790402f301a Mon Sep 17 00:00:00 2001 From: Alexis Maiquez Murcia Date: Wed, 20 Feb 2019 09:59:41 +0100 Subject: ~ Fixed errors in the README.md file Signed-off-by: Alexis Maiquez Murcia --- README.md | 2 ++ src/sensor.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/sensor.cpp') diff --git a/README.md b/README.md index 75d2085..6b8dc36 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ If none of these exists, it will create `~/.config/lead/lead.conf` with default topRight= Sensors have their own sections in the configuration, so if you want to add an action to a corner you can do so: + [eDP1] bottomLeft=SensorName @@ -83,6 +84,7 @@ If still your program doesn't run please check lead's output to get a better ide In debug mode the screen names are shown on the top-left corner of each screen. To enable the debug mode add the following section in the config file: + [systemsettings] debug=1 diff --git a/src/sensor.cpp b/src/sensor.cpp index e33a9ac..4789175 100644 --- a/src/sensor.cpp +++ b/src/sensor.cpp @@ -130,7 +130,7 @@ Sensor::activateEnter() if (this->debugMode) setStyleSheet ("background-color: green"); - + QProcess::startDetached(enterAction); } -- cgit v1.2.3