diff options
Diffstat (limited to 'src/client/toolbar')
-rw-r--r-- | src/client/toolbar/toolbar.cpp | 29 | ||||
-rw-r--r-- | src/client/toolbar/toolbar.h | 4 |
2 files changed, 30 insertions, 3 deletions
diff --git a/src/client/toolbar/toolbar.cpp b/src/client/toolbar/toolbar.cpp index 7f6d8ad..bfe4e24 100644 --- a/src/client/toolbar/toolbar.cpp +++ b/src/client/toolbar/toolbar.cpp @@ -24,7 +24,7 @@ */ Toolbar::Toolbar(QWidget *parent) : QWidget(parent), _ui(new Ui::Toolbar), _hideTimer(this), _connection(NULL), - _cam32(":cam32.svg"), _camOff32(":cam_off32.svg") + _blinkTimer(this),_cam32(":cam32.svg"), _beWatchedEye(":eye") { /* Initialize the GUI */ _ui->setupUi(this); @@ -71,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())); } @@ -121,17 +125,38 @@ 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 showEye = false; + if (!showEye) + { + _ui->icon_cam->setPixmap(_beWatchedEye); + showEye = true; + } + else + { + _ui->icon_cam->setPixmap(QPixmap()); // set empty pixmap for blinking effect + showEye = 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. */ void Toolbar::onVncServerIsRunning(int port) { - if (port > 0){ + if (port > 0) { + _blinkTimer.start(); _ui->lblStatus->setStyleSheet("color:red"); _ui->lblStatus->setText(tr("Streaming")); showBar(); } else { + _blinkTimer.stop(); _ui->icon_cam->setPixmap(_cam32); _ui->lblStatus->setStyleSheet("color:green"); _ui->lblStatus->setText(tr("Online")); diff --git a/src/client/toolbar/toolbar.h b/src/client/toolbar/toolbar.h index 2a19835..f01e4ef 100644 --- a/src/client/toolbar/toolbar.h +++ b/src/client/toolbar/toolbar.h @@ -40,9 +40,10 @@ private: QAction *_acnQuit; ConnectWindow *_connectWindow; QTimer _hideTimer; + QTimer _blinkTimer; ServerConnection *_connection; VncWindow *_vnc; - const QPixmap _cam32, _camOff32; + const QPixmap _cam32, _beWatchedEye; void leaveEvent(QEvent* e); void enterEvent(QEvent* e); @@ -53,6 +54,7 @@ private slots: void onConnected(ServerConnection* connection); void onDoDisconnect(); + void cameraBlink(); void showBar(); void hideBar(); }; |