From aa5c44814f34d1c255ba6be3828d465e64f9cf2f Mon Sep 17 00:00:00 2001 From: Manuel Schneider Date: Mon, 26 May 2014 21:48:36 +0200 Subject: Replace states by two flags indicating the state --- src/server/mainwindow/mainwindow.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'src/server/mainwindow/mainwindow.cpp') diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index 8e260b4..97b4528 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -56,6 +56,8 @@ MainWindow::MainWindow(QString ipListUrl, QWidget* parent) : _tutorFrame = NULL; _selectedFrame = NULL; + _broadcast = false; + _lockOthers = false; _streamingSource = NULL; _sessionNameWindow = new SessionNameWindow(this); @@ -440,7 +442,8 @@ bool MainWindow::isValidClient(Client* client) */ void MainWindow::broadcast(Client *from) { - _state = State::Broadcast; + _broadcast = true; + _lockOthers = false; // if there is a server running which is not "from" stop it. if (_streamingSource != NULL && _streamingSource != from) @@ -472,7 +475,8 @@ void MainWindow::broadcast(Client *from) */ void MainWindow::multicast(Client *from, Client *to, bool blockOthers) { - _state = blockOthers ? State::ExclusiveUnicast : State::Unicast; + _broadcast = false; + _lockOthers = blockOthers; // if there is a server running which is not "from" stop it. if (_streamingSource != NULL && _streamingSource != from) @@ -615,8 +619,6 @@ void MainWindow::onButtonStudentToTutorExclusive() */ void MainWindow::onButtonStopProjection() { - _state = State::Idle; - for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) { Client *c = (**it).client(); @@ -837,19 +839,12 @@ void MainWindow::onClientAuthenticated(Client* client) if (ui->action_Lock->isChecked()) client->lockScreen(true); - switch (_state) { - case State::Idle:break; - case State::Unicast:break; - case State::ExclusiveUnicast: - client->lockScreen(true); - break; - case State::Broadcast: + if (_broadcast){ client->setDesiredProjectionSource(_streamingSource->id()); client->startVncClient(_streamingSource); - break; - default:break; + } else if (_lockOthers) + client->lockScreen(true); } -} /***************************************************************************//** * Handle if VNC Server State has changed. -- cgit v1.2.3-55-g7522