summaryrefslogtreecommitdiffstats
path: root/src/server/mainwindow/mainwindow.cpp
diff options
context:
space:
mode:
authorManuel Schneider2014-06-03 16:04:58 +0200
committerManuel Schneider2014-06-03 16:04:58 +0200
commita84954b14912b0bbf23ee78ace1a652974ab007f (patch)
treef0d5902eb7ffc4f62e210e6f9f47cdd7f1a52431 /src/server/mainwindow/mainwindow.cpp
parentRemove MainWindow::isValidClient. Connect slots not queued. (diff)
downloadpvs2-a84954b14912b0bbf23ee78ace1a652974ab007f.tar.gz
pvs2-a84954b14912b0bbf23ee78ace1a652974ab007f.tar.xz
pvs2-a84954b14912b0bbf23ee78ace1a652974ab007f.zip
Lock the buttons until the new vnc server sent a reply about its state. If this fails, unlock the buttons after a timeout of 2 seconds
Diffstat (limited to 'src/server/mainwindow/mainwindow.cpp')
-rw-r--r--src/server/mainwindow/mainwindow.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp
index 489800f..28177d6 100644
--- a/src/server/mainwindow/mainwindow.cpp
+++ b/src/server/mainwindow/mainwindow.cpp
@@ -103,9 +103,12 @@ MainWindow::MainWindow(QString ipListUrl, QWidget* parent) :
/* Stuff for the button lock */
+ //Setup a timeout
_buttonLockTimer = new QTimer(this);
_buttonLockTimer->setSingleShot(true);
_buttonLockTimer->setInterval(_buttonBlockTime);
+ connect(_buttonLockTimer, SIGNAL(timeout()), this, SLOT(EnableButtons()));
+ // Define the locking buttons
_lockingButtons
<< ui->action_Lock
<< ui->action_BroadcastScreen
@@ -114,15 +117,6 @@ MainWindow::MainWindow(QString ipListUrl, QWidget* parent) :
<< ui->action_TutorToStudent
<< ui->action_StopProjection
<< ui->action_SetAsTutor;
- // Disable the buttons if a button is clicked
- foreach (QAction* a, _lockingButtons)
- connect(a, SIGNAL(triggered()), this, SLOT(DisableButtons()));
- // Start the timer a button is clicked
- foreach (QAction* a, _lockingButtons)
- connect(a, SIGNAL(triggered()), _buttonLockTimer, SLOT(start()));
- // Enable the buttons if the timer fires
- connect(_buttonLockTimer, SIGNAL(timeout()), this, SLOT(EnableButtons()));
-
// Clicking the session name label shows the edit field for it
connect(_sessionNameLabel, SIGNAL(clicked()), this, SLOT(onSessionNameClick()));
@@ -474,6 +468,8 @@ void MainWindow::onSessionNameUpdate()
*/
void MainWindow::changeProjection(Client *from, Mode mode, Client *to)
{
+ DisableButtons();
+
if (mode == Mode::Broadcast)
{
// Set all clients as watchers
@@ -853,6 +849,9 @@ void MainWindow::onClientAuthenticated(Client* client)
*/
void MainWindow::onVncServerStateChange(Client* client)
{
+ if (client == _streamingSource)
+ EnableButtons();
+
if (client->isActiveVncServer())
{
if (_mode == Mode::Broadcast)
@@ -931,6 +930,7 @@ void MainWindow::onVncClientStateChange(Client* client)
*/
void MainWindow::DisableButtons()
{
+ _buttonLockTimer->start();
foreach (QAction* a, _lockingButtons)
a->setDisabled(true);
}
@@ -940,6 +940,7 @@ void MainWindow::DisableButtons()
*/
void MainWindow::EnableButtons()
{
+ _buttonLockTimer->stop();
foreach (QAction* a, _lockingButtons)
a->setEnabled(true);
}