diff options
author | Björn Hagemeister | 2014-05-07 16:59:25 +0200 |
---|---|---|
committer | Björn Hagemeister | 2014-05-07 16:59:25 +0200 |
commit | 56d2b5d060c4ddbab2f6816c5a1440a02115453d (patch) | |
tree | 46843377f9dbece36240317fc19b1513c93b1fcc /src | |
parent | Setting right pixmap after stopping vnc server on client. (diff) | |
parent | Merge + comments (diff) | |
download | pvs2-56d2b5d060c4ddbab2f6816c5a1440a02115453d.tar.gz pvs2-56d2b5d060c4ddbab2f6816c5a1440a02115453d.tar.xz pvs2-56d2b5d060c4ddbab2f6816c5a1440a02115453d.zip |
Merge branch 'master' of git.openslx.org:pvs2
Diffstat (limited to 'src')
-rw-r--r-- | src/client/toolbar/toolbar.cpp | 75 | ||||
-rw-r--r-- | src/client/toolbar/toolbar.h | 2 |
2 files changed, 61 insertions, 16 deletions
diff --git a/src/client/toolbar/toolbar.cpp b/src/client/toolbar/toolbar.cpp index b7fe6d3..6d9e9a5 100644 --- a/src/client/toolbar/toolbar.cpp +++ b/src/client/toolbar/toolbar.cpp @@ -13,8 +13,15 @@ #include "toolbar.h" #include "ui_toolbar.h" - -//______________________________________________________________________________ +/***************************************************************************//** + * Constructor of the Toolbar. Constructs a widget which is a child of parent. + * Initialize the GUI and sets up the menu, sets window properties, create the + * VNC- and connect-window, connects the necessary signals, sets the UI's + * position and configuires the timer for the UI to be hidden. + * @param parent If parent is 0, the new widget becomes a window. If parent is + * another widget, this widget becomes a child window inside parent. The new + * widget is deleted when its parent is deleted. + */ Toolbar::Toolbar(QWidget *parent) : QWidget(parent), _ui(new Ui::Toolbar), _hideTimer(this), _connection(NULL), _blinkTimer(this),_cam32(":cam32.svg"), _camOff32(":cam_off32.svg") @@ -51,7 +58,7 @@ Toolbar::Toolbar(QWidget *parent) : connect(_acnQuit, SIGNAL(triggered()), qApp, SLOT(quit())); /* Connect the signals from vnc server */ - connect(VncServer::instance(), SIGNAL(started(int, QString&, QString&)), this, SLOT(onVncServerIsRunning(int, QString&, QString&))); + connect(VncServer::instance(), SIGNAL(started(int, QString&, QString&)), this, SLOT(onVncServerIsRunning(int))); /* Set position */ const QDesktopWidget desktop; @@ -60,7 +67,7 @@ Toolbar::Toolbar(QWidget *parent) : qDebug() << primaryScreen.left() << primaryScreen.top() << primaryScreen.right() << primaryScreen.bottom(); /* Setup hide timer */ - _hideTimer.setInterval(600); + _hideTimer.setInterval(500); _hideTimer.setSingleShot(true); connect(&_hideTimer, SIGNAL(timeout()), this, SLOT(hideBar())); _hideTimer.start(); // initially show PVS and hide later @@ -70,7 +77,11 @@ Toolbar::Toolbar(QWidget *parent) : connect(&_blinkTimer, SIGNAL(timeout()), this, SLOT(cameraBlink())); } -//______________________________________________________________________________ + +/***************************************************************************//** + * Destructor of the Toolbar. Destroys the widget. All this widget's children + * are deleted first. + */ Toolbar::~Toolbar() { VncServer::instance()->stop(); @@ -79,17 +90,29 @@ Toolbar::~Toolbar() delete _ui; } -//______________________________________________________________________________ /* * Override */ + +/***************************************************************************//** + * This event is reimplemented to receive widget leave events. When the mouse + * cursor leaves the widget, a timer gets started which, when timed out, hides + * the Toolbar. + * @param e The leave event (Mouse leaves widget's boundaries.) + */ void Toolbar::leaveEvent(QEvent* e) { _hideTimer.start(); QWidget::leaveEvent(e); } -//______________________________________________________________________________ + +/***************************************************************************//** + * This event is reimplemented to receive widget enter events. When the mouse + * cursor enters the widget, the timer which, when timed out, hides + * the Toolbar, gets stopped. + * @param e The enter event (Mouse enters widget's boundaries.) + */ void Toolbar::enterEvent(QEvent* e) { _hideTimer.stop(); @@ -97,11 +120,14 @@ void Toolbar::enterEvent(QEvent* e) QWidget::enterEvent(e); } -//______________________________________________________________________________ /* * Slots */ +/***************************************************************************//** + * 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; @@ -115,10 +141,14 @@ void Toolbar::cameraBlink() _ui->icon_cam->setPixmap(_cam32); showRedDot = false; } - } -void Toolbar::onVncServerIsRunning(int port, QString&, QString&) +/***************************************************************************//** + * 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){ _blinkTimer.start(); @@ -134,7 +164,10 @@ void Toolbar::onVncServerIsRunning(int port, QString&, QString&) } } -//______________________________________________________________________________ +/***************************************************************************//** + * A slot for the onDisconnected signal of the ConnectWindow. This slot will + * change the UI according to the state fo the connection. + */ void Toolbar::onDisconnected() { _connectWindow->setConnected(false); @@ -145,7 +178,12 @@ void Toolbar::onDisconnected() _ui->lblStatus->setText(tr("Offline")); } -//______________________________________________________________________________ +/***************************************************************************//** + * A slot for the onConnected signal of the ConnectWindow. This slot will + * change the UI according to the state of the connection and connect the + * relevant signals and slots. + * @param connection Pointer to the ServerConnection + */ void Toolbar::onConnected(ServerConnection* connection) { _ui->lblStatus->setStyleSheet("color:green"); @@ -166,14 +204,19 @@ void Toolbar::onConnected(ServerConnection* connection) _connectWindow->setConnected(true); } -//______________________________________________________________________________ +/***************************************************************************//** + * + */ void Toolbar::onDoDisconnect() { if (_connection != NULL) _connection->disconnectFromServer(); } -//______________________________________________________________________________ +/***************************************************************************//** + * This slot hides the toolbar. Places the toolbar hidden behind the edge of the + * screen just showing 2 pixels. + */ void Toolbar::hideBar() { // Don't hide window if any menu is open or VNC Server is running from this client. @@ -184,7 +227,9 @@ void Toolbar::hideBar() move(x(), primaryScreen.top() + 2 - height()); } -//______________________________________________________________________________ +/***************************************************************************//** + * This slot shows the toolbar. Used after a hideBar(). + */ void Toolbar::showBar() { const QDesktopWidget desktop; diff --git a/src/client/toolbar/toolbar.h b/src/client/toolbar/toolbar.h index 8f57fba..de09b87 100644 --- a/src/client/toolbar/toolbar.h +++ b/src/client/toolbar/toolbar.h @@ -49,7 +49,7 @@ private: void enterEvent(QEvent* e); private slots: - void onVncServerIsRunning(int port, QString& ropass, QString& rwpass); + void onVncServerIsRunning(int port); void onDisconnected(); void onConnected(ServerConnection* connection); void onDoDisconnect(); |