diff options
author | sr | 2013-02-06 20:07:27 +0100 |
---|---|---|
committer | sr | 2013-02-06 20:07:27 +0100 |
commit | 27468a81da8c2d3c8c7fa5d1d3933b819ec81267 (patch) | |
tree | 95328c51a3e0d101defc520673c1ad9daa75b330 | |
parent | [SERVER] Add "stop projection" button (diff) | |
download | pvs2-27468a81da8c2d3c8c7fa5d1d3933b819ec81267.tar.gz pvs2-27468a81da8c2d3c8c7fa5d1d3933b819ec81267.tar.xz pvs2-27468a81da8c2d3c8c7fa5d1d3933b819ec81267.zip |
[SERVER] Get "stop projection" right
[CLIENT] Redraw whole screen on projection start
-rw-r--r-- | src/client/vnc/vncwindow.cpp | 4 | ||||
-rw-r--r-- | src/server/mainwindow/mainwindow.cpp | 20 |
2 files changed, 17 insertions, 7 deletions
diff --git a/src/client/vnc/vncwindow.cpp b/src/client/vnc/vncwindow.cpp index aea2362..6cbb23e 100644 --- a/src/client/vnc/vncwindow.cpp +++ b/src/client/vnc/vncwindow.cpp @@ -108,7 +108,7 @@ void VncWindow::onThreadFinished() void VncWindow::onProjectionStarted() { emit running(true, _clientId); - _redrawTimer = startTimer(200); + _redrawTimer = startTimer(2000); } //////////////////////////////////////////////////////////////////////////////// @@ -135,7 +135,7 @@ void VncWindow::paintEvent(QPaintEvent *event) void VncWindow::resizeEvent(QResizeEvent* event) { _vncWorker->setTargetSize(event->size()); - this->repaint(); + _redrawTimer = startTimer(1000); } void VncWindow::draw(const int x, const int y, const int w, const int h) diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index 74e1e7d..50f70cc 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -373,6 +373,7 @@ void MainWindow::prepareForProjection(Client * const from, Client * const to) qDebug("From is active client, stopping..."); from->stopVncClient(); } + from->setDesiredProjectionSource(0); if (to == NULL) { @@ -495,7 +496,7 @@ void MainWindow::onButtonStudentToTutor() else if (to == from) QMessageBox::critical(this, tr("Projection"), - tr("Selected projection target is tutor.") + tr("Selected projection source is tutor.") ); else prepareForProjection(from, to); @@ -547,12 +548,12 @@ void MainWindow::onButtonTutorToStudent() else if ((**it).isTutor()) from = c; } - if (from == NULL) + if (to == NULL) QMessageBox::critical(this, tr("Projection"), tr("No projection source selected.") ); - else if (to == NULL) + else if (from == NULL) QMessageBox::critical(this, tr("Projection"), tr("No tutor defined, or tutor is offline.") @@ -560,7 +561,7 @@ void MainWindow::onButtonTutorToStudent() else if (to == from) QMessageBox::critical(this, tr("Projection"), - tr("Selected projection source is tutor.") + tr("Selected projection target is tutor.") ); else prepareForProjection(from, to); @@ -573,6 +574,14 @@ void MainWindow::onButtonStopProjection() return; _buttonBlockTime = now + 3000; // + for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) + { + Client *c = (**it).client(); + if (c == NULL) + continue; + c->setDesiredProjectionSource(0); + c->setProjectionSource(false); + } NetworkMessage msg; msg.setField(_ID, _VNCCLIENT); for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) @@ -776,7 +785,8 @@ void MainWindow::onVncServerStateChange(Client* client) // If at least one other client seemed to be waiting for this client's screen, pop up a message // on the console bool wasInterested = client->isProjectionSource(); - client->setProjectionSource(true); + //qDebug() << "On VNC stop:" << client->ip() << "was projection source:" << wasInterested; + client->setProjectionSource(false); for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) { Client *c = (**it).client(); |