From 49f3903f316ab7363b4543615d3231e1407a67ab Mon Sep 17 00:00:00 2001 From: sr Date: Wed, 6 Feb 2013 19:21:04 +0100 Subject: [SERVER] Add "stop projection" button [SERVER] Don't show error message when VNC server stops as expected [SERVER/CLIENT] Implement connection timeout of 15 seconds --- src/server/mainwindow/mainwindow.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/server/mainwindow/mainwindow.cpp') diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index 710da3f..74e1e7d 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -65,6 +65,7 @@ MainWindow::MainWindow(QWidget* parent) : connect(ui->action_TutorToAll, SIGNAL(triggered()), this, SLOT(onButtonTutorToAll())); connect(ui->action_StudentToTutor, SIGNAL(triggered()), this, SLOT(onButtonStudentToTutor())); connect(ui->action_TutorToStudent, SIGNAL(triggered()), this, SLOT(onButtonTutorToStudent())); + connect(ui->action_StopProjection, SIGNAL(triggered()), this, SLOT(onButtonStopProjection())); connect(ui->action_Lock, SIGNAL(toggled(bool)), this, SLOT(onButtonLock(bool))); // Clicking the session name label shows the edit field for it connect(_sessionNameLabel, SIGNAL(clicked()), this, SLOT(onSessionNameClick())); @@ -565,6 +566,24 @@ void MainWindow::onButtonTutorToStudent() prepareForProjection(from, to); } +void MainWindow::onButtonStopProjection() +{ + const qint64 now = QDateTime::currentMSecsSinceEpoch(); + if (now < _buttonBlockTime) + return; + _buttonBlockTime = now + 3000; + // + NetworkMessage msg; + msg.setField(_ID, _VNCCLIENT); + for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) + { + Client *c = (**it).client(); + if (c == NULL) + continue; + c->sendMessage(msg); + } +} + void MainWindow::onButtonLock(bool checked) { NetworkMessage msg; @@ -769,7 +788,7 @@ void MainWindow::onVncServerStateChange(Client* client) c->setDesiredProjectionSource(0); } } - if (wasInterested) + if (wasInterested && QDateTime::currentMSecsSinceEpoch() < _buttonBlockTime) { QMessageBox::information(this, tr("Projection Error"), -- cgit v1.2.3-55-g7522