summaryrefslogtreecommitdiffstats
path: root/src/client/toolbar/toolbar.cpp
diff options
context:
space:
mode:
authorSimon Rettberg2016-10-28 16:14:07 +0200
committerSimon Rettberg2016-10-28 16:14:07 +0200
commit6decac6613fef21869784df0d83a0b7c7d1c2008 (patch)
treefa453e3262039851cf79809569a6446e91cfb595 /src/client/toolbar/toolbar.cpp
parent[client] Fix memleak (diff)
downloadpvs2-6decac6613fef21869784df0d83a0b7c7d1c2008.tar.gz
pvs2-6decac6613fef21869784df0d83a0b7c7d1c2008.tar.xz
pvs2-6decac6613fef21869784df0d83a0b7c7d1c2008.zip
[client] Allow ESC key to cancel projection in hybrid mode
Diffstat (limited to 'src/client/toolbar/toolbar.cpp')
-rw-r--r--src/client/toolbar/toolbar.cpp31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/client/toolbar/toolbar.cpp b/src/client/toolbar/toolbar.cpp
index d6bcf22..8af15f4 100644
--- a/src/client/toolbar/toolbar.cpp
+++ b/src/client/toolbar/toolbar.cpp
@@ -103,17 +103,13 @@ void Toolbar::init()
// Connect the signals
connect(clientApp->connectWindow(), SIGNAL(disconnect()), this, SLOT(onDoDisconnect()));
connect(clientApp->connectWindow(), SIGNAL(connected(ServerConnection*)), this, SLOT(onConnected(ServerConnection*)));
+ connect(_ui->btnManager, SIGNAL(toggled(bool)), this, SLOT(onBtnManager()));
+ connect(_ui->btnAttention, SIGNAL(toggled(bool)), this, SLOT(onBtnAttention()));
/* Setup menu */
initMenu();
- /* setup manager button */
- if (clientApp->isManagerPc()) {
- connect(_ui->btnManager, SIGNAL(toggled(bool)), this, SLOT(onBtnManager()));
- } else {
- setFixedWidth(width() - _ui->btnManager->width());
- _ui->btnManager->setVisible(false);
- }
+ updateButtonVisibility();
/* setup lock desktop button*/
bool showLock = clientApp->getSettings()->value("showLockDesktopButton").toBool();
@@ -126,8 +122,6 @@ void Toolbar::init()
/* hide attention button while disconnected */
_ui->btnAttention->setVisible(false);
-
- connect(_ui->btnAttention, SIGNAL(toggled(bool)), this, SLOT(onBtnAttention()));
_ui->btnAttention->setMaximumWidth(30);
/* Connect the signals from vnc server */
@@ -188,6 +182,23 @@ void Toolbar::initMenu()
connect(_acnQuit, SIGNAL(triggered()), this, SLOT(exit()));
}
+void Toolbar::updateButtonVisibility()
+{
+ // "Toggle to manager view" (switch between desktop 1 and 2)
+ bool showManagerToggle = clientApp->isConfiguredAsManager() || clientApp->isConnectedToLocalManager();
+ if (showManagerToggle == _ui->btnManager->isHidden()) {
+ // Visibility should change
+ if (showManagerToggle) {
+ connect(_ui->btnManager, SIGNAL(toggled(bool)), this, SLOT(onBtnManager()));
+ setFixedWidth(width() + _ui->btnManager->width());
+ } else {
+ disconnect(_ui->btnManager, SIGNAL(toggled(bool)), this, SLOT(onBtnManager()));
+ setFixedWidth(width() - _ui->btnManager->width());
+ }
+ _ui->btnManager->setVisible(showManagerToggle);
+ }
+}
+
/***************************************************************************//**
* Destructor of the Toolbar. Destroys the widget. All this widget's children
* are deleted first.
@@ -358,6 +369,7 @@ void Toolbar::onDisconnected(ServerConnection* connection)
_ui->btnAttention->setVisible(false);
onBtnAttention();
_hideTimer.start();
+ QTimer::singleShot(1, this, SLOT(updateButtonVisibility()));
}
/***************************************************************************//**
@@ -376,6 +388,7 @@ void Toolbar::onConnected(ServerConnection* connection)
_ui->lblStatus->setText(tr("Online"));
/* connected, show button */
_ui->btnAttention->setVisible(true);
+ QTimer::singleShot(1, this, SLOT(updateButtonVisibility()));
//
connect(connection, SIGNAL(disconnected(ServerConnection*)), this, SLOT(onDisconnected(ServerConnection*)));
connect(connection, SIGNAL(openVnc(const QString&, int, const QString&, bool, bool, const QString&, const int, const QByteArray&)),