summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2018-07-13 15:35:29 +0200
committerSimon Rettberg2018-07-13 15:35:29 +0200
commitdc38d4c76aa94fb4dfa04794af89c95aafa178c0 (patch)
tree0f8db0869460692e1931b13fac38881c4f36fae1
parent[server] Unconditionally disable vnc server if no clients left (diff)
downloadpvs2-dc38d4c76aa94fb4dfa04794af89c95aafa178c0.tar.gz
pvs2-dc38d4c76aa94fb4dfa04794af89c95aafa178c0.tar.xz
pvs2-dc38d4c76aa94fb4dfa04794af89c95aafa178c0.zip
[server] Minor cleanups (naming, checks)
-rw-r--r--src/server/mainwindow/mainwindow.cpp50
-rw-r--r--src/server/mainwindow/mainwindow.h4
2 files changed, 26 insertions, 28 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp
index e442d1d..9f71f93 100644
--- a/src/server/mainwindow/mainwindow.cpp
+++ b/src/server/mainwindow/mainwindow.cpp
@@ -149,7 +149,7 @@ MainWindow::MainWindow(QWidget* parent) :
_buttonLockTimer = new QTimer(this);
_buttonLockTimer->setSingleShot(true);
_buttonLockTimer->setInterval(_buttonBlockTime);
- connect(_buttonLockTimer, SIGNAL(timeout()), this, SLOT(EnableButtons()));
+ connect(_buttonLockTimer, SIGNAL(timeout()), this, SLOT(enableButtons()));
// Define the locking buttons
_lockingButtons
<< ui->action_Lock
@@ -887,7 +887,7 @@ void MainWindow::onButtonTutorToAll()
if ((*it)->client() != NULL)
(*it)->client()->setDesiredProjectionSource((*it)->client() == getTutorFrame()->client() ? NO_SOURCE : getTutorFrame()->client()->id());
- DisableButtons();
+ disableButtons();
_mode = Mode::Broadcast;
startVncServerIfNecessary(getTutorFrame()->client()->id());
}
@@ -925,7 +925,7 @@ void MainWindow::onButtonTutorToStudent()
else
getSelectedFrame()->client()->setDesiredProjectionSource(getTutorFrame()->client()->id());
- DisableButtons();
+ disableButtons();
_mode = Mode::Multicast;
startVncServerIfNecessary(getTutorFrame()->client()->id());
}
@@ -963,7 +963,7 @@ void MainWindow::onButtonStudentToTutor()
if ((*it)->client() != NULL)
(*it)->client()->setDesiredProjectionSource(getTutorFrame()->client()->id() == (*it)->client()->id() ? getSelectedFrame()->client()->id() : NO_SOURCE);
- DisableButtons();
+ disableButtons();
_mode = Mode::Unicast;
startVncServerIfNecessary(getSelectedFrame()->client()->id());
}
@@ -1001,7 +1001,7 @@ void MainWindow::onButtonStudentToTutorExclusive()
if ((*it)->client() != NULL)
(*it)->client()->setDesiredProjectionSource(getTutorFrame()->client()->id() == (*it)->client()->id() ? getSelectedFrame()->client()->id() : NO_SOURCE);
- DisableButtons();
+ disableButtons();
_mode = Mode::LockedUnicast;
startVncServerIfNecessary(getSelectedFrame()->client()->id());
}
@@ -1210,7 +1210,7 @@ void MainWindow::onClientAuthenticated(Client* client)
void MainWindow::onVncServerStateChange(Client* client)
{
if (client == getClientFromId(_streamingSource))
- EnableButtons();
+ enableButtons();
if (client->isActiveVncServer()) {
// apply the desired projection sources
@@ -1292,23 +1292,25 @@ void MainWindow::onVncClientStateChange(Client* client)
/***************************************************************************//**
* DisableButtons.
*/
-void MainWindow::DisableButtons()
+void MainWindow::disableButtons()
{
qDebug() << "DisableButtons()";
_buttonLockTimer->start();
- foreach (QAction * a, _lockingButtons)
- a->setDisabled(true);
+ foreach (QAction * a, _lockingButtons) {
+ a->setDisabled(true);
+ }
}
/***************************************************************************//**
* EnableButtons.
*/
-void MainWindow::EnableButtons()
+void MainWindow::enableButtons()
{
qDebug() << "EnableButtons()";
_buttonLockTimer->stop();
- foreach (QAction * a, _lockingButtons)
- a->setEnabled(true);
+ foreach (QAction * a, _lockingButtons) {
+ a->setEnabled(true);
+ }
}
@@ -1323,19 +1325,15 @@ void MainWindow::onDeleteClient()
if (frame->client() != NULL) {
QMessageBox::critical(this, tr("Selection"), tr("This client is still connected."));
return;
- } else {
- qDebug() << "Now delete the client";
- int ret = QMessageBox::question(this, "Warning", tr("Sure, You want to delete selected client?"), 0, 1, 2);
- if (ret == 1) {
- frame->hide();
- frame->deleteLater();
- _clientFrames.removeAll(frame);
- lockContextButtons();
- clientCountChanged();
- return;
- }
}
-
-
-
+ qDebug() << "Now delete the client";
+ int ret = QMessageBox::question(this, "Warning", tr("Sure, You want to delete selected client?"), 0, 1, 2);
+ if (ret == 1) {
+ frame->hide();
+ frame->deleteLater();
+ _clientFrames.removeAll(frame);
+ lockContextButtons();
+ clientCountChanged();
+ return;
+ }
}
diff --git a/src/server/mainwindow/mainwindow.h b/src/server/mainwindow/mainwindow.h
index ba24bae..4e880e6 100644
--- a/src/server/mainwindow/mainwindow.h
+++ b/src/server/mainwindow/mainwindow.h
@@ -104,8 +104,8 @@ private:
void reloadCurrentRoom();
protected slots:
- void DisableButtons();
- void EnableButtons();
+ void disableButtons();
+ void enableButtons();
void clientCountChanged();
void onSessionNameClick();