diff options
-rw-r--r-- | src/client/toolbar/toolbar.cpp | 36 | ||||
-rw-r--r-- | src/client/toolbar/toolbar.h | 2 |
2 files changed, 18 insertions, 20 deletions
diff --git a/src/client/toolbar/toolbar.cpp b/src/client/toolbar/toolbar.cpp index 47f246f..7b57c7e 100644 --- a/src/client/toolbar/toolbar.cpp +++ b/src/client/toolbar/toolbar.cpp @@ -29,7 +29,7 @@ * widget is deleted when its parent is deleted. */ Toolbar::Toolbar(const QByteArray sessionName, QWidget *parent) - : QWidget(parent), _showTimer(this), _hideTimer(this), _blinkTimer(this), _beWatchedEye(":eye") + : QWidget(parent), _showTimer(this), _hideTimer(this), _hideCountdown(10), _blinkTimer(this), _beWatchedEye(":eye") { qDebug() << "sessionName - constructor"; init(); @@ -74,7 +74,7 @@ Toolbar::Toolbar(const bool autoConnect, QWidget *parent) * widget is deleted when its parent is deleted. */ Toolbar::Toolbar(QWidget *parent) - : QWidget(parent), _showTimer(this), _hideTimer(this), _blinkTimer(this), _beWatchedEye(":eye") + : QWidget(parent), _showTimer(this), _hideTimer(this), _hideCountdown(10), _blinkTimer(this), _beWatchedEye(":eye") { init(); } @@ -136,11 +136,11 @@ void Toolbar::init() move(primaryScreen.left() + (primaryScreen.width() - this->width()) / 2 , primaryScreen.top()); /* Setup show & hide timer */ - _showTimer.setInterval(750); + _showTimer.setInterval(500); _showTimer.setSingleShot(true); connect(&_showTimer, SIGNAL(timeout()), this, SLOT(showBar())); - _hideTimer.setInterval(500); - _hideTimer.setSingleShot(true); + _hideTimer.setInterval(50); + _hideTimer.setSingleShot(false); connect(&_hideTimer, SIGNAL(timeout()), this, SLOT(hideBar())); setVisible(true); @@ -222,19 +222,6 @@ Toolbar::~Toolbar() */ /***************************************************************************//** - * 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) -{ - delayedHideBar(); - 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. @@ -430,8 +417,17 @@ void Toolbar::onServerAttentionChanged(const bool on) void Toolbar::hideBar() { // Don't hide window if any menu is open or VNC Server is running from this client. - if (_menu->isVisible() || _ui->btnAttention->isChecked() || VncServer::instance()->isVncServerRunning() || this->underMouse()) + if (_ui->btnAttention->isChecked() || VncServer::instance()->isVncServerRunning()) { + _hideTimer.stop(); + return; + } + // These don't qualify for hiding, but don't stop timer + if (_menu->isVisible() || this->underMouse()) return; + // Countdown + if (--_hideCountdown > 0) + return; + _hideTimer.stop(); const QDesktopWidget desktop; const QRect primaryScreen = desktop.screenGeometry(); move(x(), primaryScreen.top() + 2 - height()); @@ -441,6 +437,7 @@ void Toolbar::delayedHideBar() { _showTimer.stop(); if (!_hideTimer.isActive()) { + _hideCountdown = 10; _hideTimer.start(); } } @@ -453,6 +450,7 @@ void Toolbar::showBar() const QDesktopWidget desktop; const QRect primaryScreen = desktop.screenGeometry(); move(x(), primaryScreen.top()); + delayedHideBar(); } void Toolbar::delayedShowBar() diff --git a/src/client/toolbar/toolbar.h b/src/client/toolbar/toolbar.h index 347871f..a7cd5ad 100644 --- a/src/client/toolbar/toolbar.h +++ b/src/client/toolbar/toolbar.h @@ -47,12 +47,12 @@ private: QAction *_acnQuit; QTimer _showTimer; QTimer _hideTimer; + int _hideCountdown; QTimer _blinkTimer; VncWindow *_vnc; bool _isManagerPc; const QPixmap _cam32, _beWatchedEye; - void leaveEvent(QEvent* e); void enterEvent(QEvent* e); QList<Room> myRooms(); bool isManagerPc(); |