summaryrefslogtreecommitdiffstats
path: root/src/client/toolbar/toolbar.cpp
diff options
context:
space:
mode:
authorManuel Schneider2014-05-07 16:57:01 +0200
committerManuel Schneider2014-05-07 16:57:01 +0200
commit9c4b902d536fbaccab46d85b403f43eb4274689f (patch)
treec9dbb113d62d798699ad4d56a127ce0d2e7b4b69 /src/client/toolbar/toolbar.cpp
parentComment source file and minor changes. (diff)
parentMerge branch 'master' of git.openslx.org:pvs2 (diff)
downloadpvs2-9c4b902d536fbaccab46d85b403f43eb4274689f.tar.gz
pvs2-9c4b902d536fbaccab46d85b403f43eb4274689f.tar.xz
pvs2-9c4b902d536fbaccab46d85b403f43eb4274689f.zip
Merge + comments
Diffstat (limited to 'src/client/toolbar/toolbar.cpp')
-rw-r--r--src/client/toolbar/toolbar.cpp35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/client/toolbar/toolbar.cpp b/src/client/toolbar/toolbar.cpp
index 5d5b045..67dcd13 100644
--- a/src/client/toolbar/toolbar.cpp
+++ b/src/client/toolbar/toolbar.cpp
@@ -23,7 +23,8 @@
* widget is deleted when its parent is deleted.
*/
Toolbar::Toolbar(QWidget *parent) :
- QWidget(parent), _ui(new Ui::Toolbar), _hideTimer(this), _connection(NULL)
+ QWidget(parent), _ui(new Ui::Toolbar), _hideTimer(this), _connection(NULL),
+ _blinkTimer(this),_cam32(":cam32.svg"), _camOff32(":cam_off32.svg")
{
/* Initialize the GUI */
_ui->setupUi(this);
@@ -70,6 +71,10 @@ Toolbar::Toolbar(QWidget *parent) :
_hideTimer.setSingleShot(true);
connect(&_hideTimer, SIGNAL(timeout()), this, SLOT(hideBar()));
_hideTimer.start(); // initially show PVS and hide later
+
+ /* Setup blink timer */
+ _blinkTimer.setInterval(500);
+ connect(&_blinkTimer, SIGNAL(timeout()), this, SLOT(cameraBlink()));
}
@@ -120,6 +125,25 @@ void Toolbar::enterEvent(QEvent* e)
*/
/***************************************************************************//**
+ * A slot for changing the camera icon. This slot should be called permanently
+ * if the vnc server is recording the screen.
+ */
+void Toolbar::cameraBlink()
+{
+ static bool showRedDot = false;
+ if (!showRedDot)
+ {
+ _ui->icon_cam->setPixmap(_camOff32);
+ showRedDot = true;
+ }
+ else
+ {
+ _ui->icon_cam->setPixmap(_cam32);
+ showRedDot = false;
+ }
+}
+
+/***************************************************************************//**
* A slot for the VncServerIsRunning signal. This slot will change the UI
* according to the state fo the VncServer.
* @param[in] port Indicates the state of the VncServer.
@@ -127,10 +151,13 @@ void Toolbar::enterEvent(QEvent* e)
void Toolbar::onVncServerIsRunning(int port)
{
if (port > 0){
+ _blinkTimer.start();
+
_ui->lblStatus->setStyleSheet("color:red");
_ui->lblStatus->setText(tr("Recording"));
showBar();
} else {
+ _blinkTimer.stop();
_ui->lblStatus->setStyleSheet("color:green");
_ui->lblStatus->setText(tr("Online"));
hideBar();
@@ -144,7 +171,7 @@ void Toolbar::onVncServerIsRunning(int port)
void Toolbar::onDisconnected()
{
_connectWindow->setConnected(false);
- if (_connection != NULL)
+ if (_connection != NULL)
_connection->blockSignals(true);
_connection = NULL;
_ui->lblStatus->setStyleSheet("color:red");
@@ -192,13 +219,12 @@ void Toolbar::onDoDisconnect()
*/
void Toolbar::hideBar()
{
- // // Don't hide window if any menu is open or VNC Server is running from this client.
+ // Don't hide window if any menu is open or VNC Server is running from this client.
if (_menu->isVisible() || VncServer::instance()->isVncServerRunning())
return;
const QDesktopWidget desktop;
const QRect primaryScreen = desktop.screenGeometry();
move(x(), primaryScreen.top() + 2 - height());
- //move(x(), primaryScreen.bottom() - 2);
}
/***************************************************************************//**
@@ -209,5 +235,4 @@ void Toolbar::showBar()
const QDesktopWidget desktop;
const QRect primaryScreen = desktop.screenGeometry();
move(x(), primaryScreen.top());
- //move(x(), primaryScreen.bottom() - height());
}