summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2018-07-18 15:20:17 +0200
committerSimon Rettberg2018-07-18 15:20:17 +0200
commit4a9499bbe5e6f3e95066ab2e6b98e1a58500010a (patch)
tree979ba63784735ed5713fa23114a20a5ccb8cc942
parent[client] Rewrite thread sync between VNC worker and VNC window (diff)
downloadpvs2-4a9499bbe5e6f3e95066ab2e6b98e1a58500010a.tar.gz
pvs2-4a9499bbe5e6f3e95066ab2e6b98e1a58500010a.tar.xz
pvs2-4a9499bbe5e6f3e95066ab2e6b98e1a58500010a.zip
[server] Don't do unnecessary lock resets on mode change
-rw-r--r--src/server/mainwindow/mainwindow.cpp33
-rw-r--r--src/server/mainwindow/mainwindow.h2
2 files changed, 14 insertions, 21 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp
index 9f71f93..568896c 100644
--- a/src/server/mainwindow/mainwindow.cpp
+++ b/src/server/mainwindow/mainwindow.cpp
@@ -388,8 +388,6 @@ void MainWindow::tellClientCurrentSituation(Client* client)
client->startVncClient(getClientFromId(_streamingSource));
}
}
-
-
}
/***************************************************************************//**
@@ -610,14 +608,14 @@ void MainWindow::mouseReleaseEvent(QMouseEvent* e)
/***************************************************************************//**
* @brief reset
*/
-void MainWindow::reset()
+void MainWindow::reset(bool lock)
{
_mode = Mode::None;
// Unlock all clients
for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it)
if ((*it)->client() != NULL) {
- (*it)->client()->lockScreen(false);
+ (*it)->client()->lockScreen(lock);
(*it)->client()->removeAttention();
}
@@ -676,11 +674,10 @@ void MainWindow::onSessionNameClick()
if (_countSessionNameUpdate > 1) {
int ret = QMessageBox::question(this, "Warning", tr("Sure, You want to change SessionName again?\n"
"All Clients will be deleted afterwards."), 0, 1, 2);
- if (ret == 1) {
- _sessionNameWindow->show(serverApp->sessionName());
- }
- } else
- _sessionNameWindow->show((serverApp->sessionName()));
+ if (ret != 1)
+ return;
+ }
+ _sessionNameWindow->show((serverApp->sessionName()));
}
/***************************************************************************//**
@@ -988,8 +985,10 @@ void MainWindow::onButtonStudentToTutorExclusive()
else if (getTutorFrame()->client() == NULL)
QMessageBox::critical(this, tr("Projection"), sStrTutorOffline);
else {
+ Client *selectedClient = getSelectedFrame()->client();
+ Client *tutorClient = getTutorFrame()->client();
// If this is not the first run in this mode and the current source is selected, stop the streaming.
- if (_mode == Mode::Unicast && getSelectedFrame()->client()->id() == _streamingSource) {
+ if ((_mode == Mode::Unicast || _mode == Mode::LockedUnicast) && selectedClient->id() == _streamingSource) {
// Stop reset everything
_mode = Mode::None;
reset();
@@ -999,11 +998,11 @@ void MainWindow::onButtonStudentToTutorExclusive()
// Unset all clients desired sources. Except the tutors desired source, this has to be the selecteds frame
for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it)
if ((*it)->client() != NULL)
- (*it)->client()->setDesiredProjectionSource(getTutorFrame()->client()->id() == (*it)->client()->id() ? getSelectedFrame()->client()->id() : NO_SOURCE);
+ (*it)->client()->setDesiredProjectionSource(tutorClient->id() == (*it)->client()->id() ? selectedClient->id() : NO_SOURCE);
disableButtons();
_mode = Mode::LockedUnicast;
- startVncServerIfNecessary(getSelectedFrame()->client()->id());
+ startVncServerIfNecessary(selectedClient->id());
}
}
@@ -1027,14 +1026,8 @@ void MainWindow::onButtonStopProjection()
*/
void MainWindow::onButtonLock(bool checked)
{
- // Stop all projections
- reset();
-
- for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) {
- if ((*it)->client() == NULL)
- continue;
- (*it)->client()->lockScreen(checked);
- }
+ // Stop all projections and lock if requested
+ reset(checked);
}
void MainWindow::onButtonLockSingle()
diff --git a/src/server/mainwindow/mainwindow.h b/src/server/mainwindow/mainwindow.h
index 4e880e6..cf7b068 100644
--- a/src/server/mainwindow/mainwindow.h
+++ b/src/server/mainwindow/mainwindow.h
@@ -85,7 +85,7 @@ private:
void savePosition(ConnectionFrame *cf);
void startVncServerIfNecessary(int from);
void tellClientCurrentSituation(Client* client);
- void reset();
+ void reset(bool lock = false);
Client* getClientFromId(int id);
ConnectionFrame* getTutorFrame();
ConnectionFrame* getSelectedFrame();