summaryrefslogtreecommitdiffstats
path: root/src/server/mainwindow/mainwindow.cpp
diff options
context:
space:
mode:
authorManuel Schneider2014-04-30 14:50:56 +0200
committerManuel Schneider2014-04-30 14:50:56 +0200
commitadbc49a0e2ad1b03558c6495cea49307c3db0381 (patch)
tree0651ab1c434590b9536d8c4ca6628d8c064deaae /src/server/mainwindow/mainwindow.cpp
parentcant fire the timer inside the button slots since they are called somewhere w... (diff)
downloadpvs2-adbc49a0e2ad1b03558c6495cea49307c3db0381.tar.gz
pvs2-adbc49a0e2ad1b03558c6495cea49307c3db0381.tar.xz
pvs2-adbc49a0e2ad1b03558c6495cea49307c3db0381.zip
KISS'n'DRY for more cohesion
Diffstat (limited to 'src/server/mainwindow/mainwindow.cpp')
-rw-r--r--src/server/mainwindow/mainwindow.cpp42
1 files changed, 16 insertions, 26 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp
index 29f4bc5..3d0d167 100644
--- a/src/server/mainwindow/mainwindow.cpp
+++ b/src/server/mainwindow/mainwindow.cpp
@@ -85,20 +85,20 @@ MainWindow::MainWindow(QString ipListUrl, QWidget* parent) :
_buttonLockTimer = new QTimer(this);
_buttonLockTimer->setSingleShot(true);
_buttonLockTimer->setInterval(_buttonBlockTime);
+ _lockingButtons
+ << ui->action_Lock
+ << ui->action_BroadcastScreen
+ << ui->action_TutorToAll
+ << ui->action_StudentToTutor
+ << ui->action_TutorToStudent
+ << ui->action_StopProjection
+ << ui->action_SetAsTutor;
// Disable the buttons if a button is clicked
- connect(ui->action_Lock, SIGNAL(triggered()), this, SLOT(DisableButtons()));
- connect(ui->action_BroadcastScreen, SIGNAL(triggered()), this, SLOT(DisableButtons()));
- connect(ui->action_TutorToAll, SIGNAL(triggered()), this, SLOT(DisableButtons()));
- connect(ui->action_StudentToTutor, SIGNAL(triggered()), this, SLOT(DisableButtons()));
- connect(ui->action_TutorToStudent, SIGNAL(triggered()), this, SLOT(DisableButtons()));
- connect(ui->action_StopProjection, SIGNAL(triggered()), this, SLOT(DisableButtons()));
+ foreach (QAction* a, _lockingButtons)
+ connect(a, SIGNAL(triggered()), this, SLOT(DisableButtons()));
// Start the timer a button is clicked
- connect(ui->action_Lock, SIGNAL(triggered()), _buttonLockTimer, SLOT(start()));
- connect(ui->action_BroadcastScreen, SIGNAL(triggered()), _buttonLockTimer, SLOT(start()));
- connect(ui->action_TutorToAll, SIGNAL(triggered()), _buttonLockTimer, SLOT(start()));
- connect(ui->action_StudentToTutor, SIGNAL(triggered()), _buttonLockTimer, SLOT(start()));
- connect(ui->action_TutorToStudent, SIGNAL(triggered()), _buttonLockTimer, SLOT(start()));
- connect(ui->action_StopProjection, SIGNAL(triggered()), _buttonLockTimer, SLOT(start()));
+ 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()));
@@ -1054,22 +1054,12 @@ void MainWindow::onVncClientStateChange(Client* client, int lastProjectionSource
void MainWindow::DisableButtons()
{
- ui->action_Lock->setDisabled(true);
- ui->action_BroadcastScreen->setDisabled(true);
- ui->action_TutorToAll->setDisabled(true);
- ui->action_StudentToTutor->setDisabled(true);
- ui->action_TutorToStudent->setDisabled(true);
- ui->action_StopProjection->setDisabled(true);
- ui->action_SetAsTutor->setEnabled(true);
+ foreach (QAction* a, _lockingButtons)
+ a->setDisabled(true);
}
void MainWindow::EnableButtons()
{
- ui->action_Lock->setEnabled(true);
- ui->action_BroadcastScreen->setEnabled(true);
- ui->action_TutorToAll->setEnabled(true);
- ui->action_StudentToTutor->setEnabled(true);
- ui->action_TutorToStudent->setEnabled(true);
- ui->action_StopProjection->setEnabled(true);
- ui->action_SetAsTutor->setEnabled(true);
+ foreach (QAction* a, _lockingButtons)
+ a->setEnabled(true);
}