From 8602764f8f069ec3cb6c8965262c016557bedb32 Mon Sep 17 00:00:00 2001 From: Björn Hagemeister Date: Tue, 17 Jun 2014 12:05:16 +0200 Subject: Removed _tutorFrame and _selectedFrame out of MainWindow to prevent possible SegFaults because of too many Pointers to ConnectionFrames. Wrote to getters getTutorFrame() and getSelectedFrame(), which are just iterating over ConnectionFrames and looking for flags _isTutor and _isSelected. --- src/server/connectionframe/connectionframe.cpp | 12 ++++++------ src/server/connectionframe/connectionframe.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/server/connectionframe') diff --git a/src/server/connectionframe/connectionframe.cpp b/src/server/connectionframe/connectionframe.cpp index b09139c..caf99fc 100644 --- a/src/server/connectionframe/connectionframe.cpp +++ b/src/server/connectionframe/connectionframe.cpp @@ -50,7 +50,7 @@ static QIcon *term = NULL, *cam = NULL, *eye = NULL, *lock = NULL; * @param height */ ConnectionFrame::ConnectionFrame(QWidget *parent, int width, int height) : - QGroupBox(parent), _client(NULL), _timerId(0), _timerCounter(0), _selected(false), _isTutor(false) + QGroupBox(parent), _client(NULL), _timerId(0), _timerCounter(0), _isSelected(false), _isTutor(false) { //defines the ui-stuff @@ -295,9 +295,9 @@ void ConnectionFrame::timerEvent(QTimerEvent* event) */ void ConnectionFrame::setSelection(bool selected) { - if (_selected == selected) + if (_isSelected == selected) return; - _selected = selected; + _isSelected = selected; this->updateAppearance(); } @@ -322,7 +322,7 @@ void ConnectionFrame::updateAppearance() if (_client == NULL) { // Unconnected Frame - if (_selected) + if (_isSelected) this->setStyleSheet(style_selectedStudent); else this->setStyleSheet(style_disconnected); @@ -336,13 +336,13 @@ void ConnectionFrame::updateAppearance() // Normal client, no special stuff active - if (_selected && _isTutor){ + if (_isSelected && _isTutor){ this->setStyleSheet(style_selectedTutor); } else if (_isTutor){ this->setStyleSheet(style_tutor); } - else if (_selected){ + else if (_isSelected){ this->setStyleSheet(style_selectedStudent); } diff --git a/src/server/connectionframe/connectionframe.h b/src/server/connectionframe/connectionframe.h index 72f641d..353ebb8 100644 --- a/src/server/connectionframe/connectionframe.h +++ b/src/server/connectionframe/connectionframe.h @@ -32,7 +32,7 @@ private: Client *_client; int _timerId, _timerCounter; - bool _selected; + bool _isSelected; bool _isTutor; static const int _startDragDistance = 40; @@ -53,7 +53,7 @@ public: void setSize(int width, int height); void assignClient(Client *client); void setSelection(bool selected); - const inline bool selected() const { return _selected; } + const inline bool isSelected() const { return _isSelected; } const QString& computerId() const { return _computerId; } Client* client() const { return _client; } -- cgit v1.2.3-55-g7522 From badab5545b2f51c5692fd03e5b3a657678880a66 Mon Sep 17 00:00:00 2001 From: Björn Hagemeister Date: Tue, 17 Jun 2014 15:05:28 +0200 Subject: Delete connected clients and connectionFrames after sessionName has changed. Surround camera and eye icon with borderline for better contrast on frames. --- icons/cf_icon_cam.svg | 28 +++++++++++++++++--------- icons/cf_icon_eye.svg | 18 ++++++++--------- icons/cf_icon_lock.svg | 18 ++++++++--------- src/server/connectionframe/connectionframe.cpp | 6 +++++- src/server/mainwindow/mainwindow.cpp | 11 +++++++++- 5 files changed, 51 insertions(+), 30 deletions(-) (limited to 'src/server/connectionframe') diff --git a/icons/cf_icon_cam.svg b/icons/cf_icon_cam.svg index cd1599d..c51ab6d 100644 --- a/icons/cf_icon_cam.svg +++ b/icons/cf_icon_cam.svg @@ -21,6 +21,14 @@ style="display:inline;enable-background:new"> + + + + inkscape:window-width="1280" + inkscape:window-height="1000" + inkscape:window-x="0" + inkscape:window-y="24" + inkscape:window-maximized="1"> diff --git a/icons/cf_icon_eye.svg b/icons/cf_icon_eye.svg index 06d6f85..6f7f3f8 100644 --- a/icons/cf_icon_eye.svg +++ b/icons/cf_icon_eye.svg @@ -36,23 +36,23 @@ guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" - inkscape:window-width="1920" - inkscape:window-height="1156" + inkscape:window-width="1280" + inkscape:window-height="1000" id="namedview8" showgrid="true" - inkscape:zoom="4.2142857" - inkscape:cx="-20.387675" - inkscape:cy="53.464011" - inkscape:window-x="-2" - inkscape:window-y="-3" + inkscape:zoom="5.9599" + inkscape:cx="42.050215" + inkscape:cy="67.037619" + inkscape:window-x="0" + inkscape:window-y="24" inkscape:window-maximized="1" inkscape:current-layer="svg2" showguides="false" inkscape:snap-page="false" inkscape:snap-grids="true" /> + d="m 118.02062,-192 q -10.67506,-16.11394 -26.757696,-24.10255 4.284038,7.10106 4.284038,15.3628 0,12.63167 -9.235251,21.61034 -9.235255,8.97875 -22.227825,8.97875 -12.992567,0 -22.227825,-8.97875 -9.23525,-8.97867 -9.23525,-21.61034 0,-8.26174 4.284038,-15.3628 -16.082688,7.98861 -26.757662,24.10255 9.340603,13.9972 23.42173,22.29316 14.081132,8.29593 30.514969,8.29593 16.433837,0 30.514972,-8.29593 Q 108.67994,-178.0028 118.02062,-192 z m -50.565695,-26.21926 q 0,-1.36558 -0.983217,-2.32142 -0.983214,-0.95593 -2.387822,-0.95593 -8.778759,0 -15.064353,6.11096 -6.285591,6.11102 -6.285591,14.6459 0,1.36556 0.983221,2.32151 0.983223,0.95595 2.387828,0.95595 1.4046,0 2.387817,-0.95595 0.983222,-0.95595 0.983222,-2.32151 0,-5.87193 4.284036,-10.03702 4.284033,-4.16506 10.32382,-4.16506 1.404608,0 2.387822,-0.95596 0.983217,-0.95585 0.983217,-2.32147 z M 127.01005,-192 q 0,2.32146 -1.40458,4.71127 -9.83222,15.7042 -26.441665,25.16096 -16.609408,9.45662 -35.079919,9.45662 -18.470509,0 -35.079922,-9.49091 -16.609413,-9.49077 -26.441625,-25.12667 -1.4046014,-2.38981 -1.4046014,-4.71127 0,-2.32149 1.4046014,-4.7113 9.832212,-15.63587 26.441625,-25.12664 16.609413,-9.49091 35.079922,-9.49091 18.470511,0 35.079919,9.49091 16.609445,9.49077 26.441665,25.12664 1.40458,2.38981 1.40458,4.7113 z" /> diff --git a/icons/cf_icon_lock.svg b/icons/cf_icon_lock.svg index 40eac88..ceff44b 100644 --- a/icons/cf_icon_lock.svg +++ b/icons/cf_icon_lock.svg @@ -36,25 +36,25 @@ guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" - inkscape:window-width="1920" - inkscape:window-height="1156" + inkscape:window-width="1280" + inkscape:window-height="1000" id="namedview2995" showgrid="false" - inkscape:zoom="0.26339286" - inkscape:cx="1103.7208" - inkscape:cy="559.2271" - inkscape:window-x="-2" - inkscape:window-y="-3" + inkscape:zoom="0.37249375" + inkscape:cx="377.5311" + inkscape:cy="1119.8752" + inkscape:window-x="0" + inkscape:window-y="24" inkscape:window-maximized="1" inkscape:current-layer="svg2989" /> + style="fill:#cccccc;stroke:none;stroke-opacity:1;stroke-width:7.87667644999999972;stroke-miterlimit:4;stroke-dasharray:none"> + style="fill:#cccccc;stroke:none;stroke-opacity:1;stroke-width:7.87667644999999972;stroke-miterlimit:4;stroke-dasharray:none" /> diff --git a/src/server/connectionframe/connectionframe.cpp b/src/server/connectionframe/connectionframe.cpp index caf99fc..dbe408c 100644 --- a/src/server/connectionframe/connectionframe.cpp +++ b/src/server/connectionframe/connectionframe.cpp @@ -101,7 +101,11 @@ ConnectionFrame::ConnectionFrame(QWidget *parent, int width, int height) : ConnectionFrame::~ConnectionFrame() { - // + if (_client != NULL) + { + _client->deleteLater(); + } + _iconLayout->deleteLater(); } /** diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index 5063df6..bbabc66 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -498,6 +498,14 @@ void MainWindow::onSessionNameClick() */ void MainWindow::onSessionNameUpdate() { + // Stop all projections and clear all clients, which where connected to old sessionName. + reset(); + for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) + { + (*it)->hide(); + (*it)->deleteLater(); + } + _clientFrames.clear(); _sessionNameLabel->setText(tr("Session Name: %1 [click to edit]").arg(Global::sessionName())); } @@ -992,7 +1000,8 @@ void MainWindow::onVncClientStateChange(Client* client) // VNC Client stopped -> remove from watchers if (!client->isActiveVncClient()){ // _watchers.remove(client->id()); - getClientFromId(client->id())->setWatcher(false); + if (getClientFromId(client->id()) != NULL) + getClientFromId(client->id())->setWatcher(false); // If noboody is watching the multicast stop VNC server // if (_watchers.isEmpty() && _mode != Mode::Broadcast) -- cgit v1.2.3-55-g7522 From e5c884b2b36f6ea4cadbe9e835b0b10f7ffbaf3b Mon Sep 17 00:00:00 2001 From: Björn Hagemeister Date: Thu, 19 Jun 2014 15:28:50 +0200 Subject: NEW feature: Possible to delete offline client by drag and drop to trash, which is positioned in the right bottom corner of manager. --- gui/server_normal/mainwindow.ui | 29 +- icons/trash.svg | 1187 ++++++++++++++++++++++++++ pvsmgr.qrc | 1 + src/server/connectionframe/connectionframe.h | 1 + src/server/mainwindow/mainwindow.cpp | 47 +- src/server/mainwindow/mainwindow.h | 2 + 6 files changed, 1260 insertions(+), 7 deletions(-) create mode 100644 icons/trash.svg (limited to 'src/server/connectionframe') diff --git a/gui/server_normal/mainwindow.ui b/gui/server_normal/mainwindow.ui index 6d29c97..8ab1c05 100644 --- a/gui/server_normal/mainwindow.ui +++ b/gui/server_normal/mainwindow.ui @@ -6,8 +6,8 @@ 0 0 - 838 - 607 + 1246 + 858 @@ -46,6 +46,28 @@ 2 + + + + 10 + 10 + 111 + 121 + + + + false + + + + + + :/trash + + + true + + @@ -181,7 +203,7 @@ - + :/reset:/reset @@ -218,7 +240,6 @@ - diff --git a/icons/trash.svg b/icons/trash.svg new file mode 100644 index 0000000..e217a09 --- /dev/null +++ b/icons/trash.svg @@ -0,0 +1,1187 @@ + + + + + trash + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + trash + + + hrum + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pvsmgr.qrc b/pvsmgr.qrc index 3837cee..40df258 100644 --- a/pvsmgr.qrc +++ b/pvsmgr.qrc @@ -15,6 +15,7 @@ icons/keyboard_key.svg icons/student2tutor_extension.svg icons/help.svg + icons/trash.svg AUTHORS TRANSLATION build/pvsmgr_de_DE.qm diff --git a/src/server/connectionframe/connectionframe.h b/src/server/connectionframe/connectionframe.h index 353ebb8..5a4e1df 100644 --- a/src/server/connectionframe/connectionframe.h +++ b/src/server/connectionframe/connectionframe.h @@ -51,6 +51,7 @@ public: const QPixmap& getFramePixmap() const { return _remoteScreen; } void setSize(int width, int height); + const inline QPoint& getPreviousPosition() const { return _previousPosition; } void assignClient(Client *client); void setSelection(bool selected); const inline bool isSelected() const { return _isSelected; } diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index bbabc66..a52690f 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -44,6 +44,8 @@ const QString MainWindow::sStrSourceOffline = tr("The projection source is offli const QString MainWindow::sStrDestNdef = tr("Please select a projection destination."); const QString MainWindow::sStrDestOffline = tr("The projection destination is offline."); const QString MainWindow::sStrSourceDestSame = tr("Selected projection target is tutor."); +const QString MainWindow::sStrClientOnline = tr("Selected client is currently online."); +const QString MainWindow::sStrNoDestAv = tr("No projection destination available."); /***************************************************************************//** * Initialize MainWindow and ListenServer. @@ -78,6 +80,9 @@ MainWindow::MainWindow(QString ipListUrl, QWidget* parent) : ui->action_Exit->setStatusTip(tr("Exit")); ui->action_Lock->setStatusTip(tr("Lock or Unlock all Clients")); + _tileWidth = 10; + _tileHeight = 10; + // Initialize FileDownloader. if (!ipListUrl.isEmpty()) { @@ -125,9 +130,6 @@ MainWindow::MainWindow(QString ipListUrl, QWidget* parent) : setUnifiedTitleAndToolBarOnMac(true); this->showMaximized(); // show the Mainwindow maximized - _tileWidth = 10; - _tileHeight = 10; - _listenServer = new ListenServer(CLIENT_PORT); connect(_listenServer, SIGNAL(newClient(Client*)), this, SLOT(onClientConnected(Client*))); _discoveryListener = new DiscoveryListener(); @@ -369,6 +371,14 @@ void MainWindow::resizeEvent(QResizeEvent* e) (*it)->move((oldpos.x() / _tileWidth) * nw, (oldpos.y() / _tileHeight) * nh); (*it)->setSize(nw, nh); } + + // Resize trash and set position. + const int width = ui->frmRoom->geometry().width() - (nw + 1); + const int height = ui->frmRoom->geometry().height() - (nh + 1); + ui->trash->move(width, height); + ui->trash->resize(nw, nh); + // qDebug() << "Trash pos: " << ui->trash->pos(); + _tileWidth = nw; _tileHeight = nh; } @@ -449,6 +459,35 @@ void MainWindow::onPlaceFrame(ConnectionFrame* frame) y = 0; else if (y > s.height() - _tileHeight) y = (_tilesY - 1) * _tileHeight; + + const QRect &trashCenter = ui->trash->geometry(); + // Check if x coordinate is in trash position. + if (trashCenter.contains(p)) + { + // Do not offer deleting online client. + if (frame->client() != NULL) + { + QMessageBox::critical(this, tr("Selection"), sStrClientOnline); + frame->move(frame->getPreviousPosition()); + return; + } + else + { + int ret = QMessageBox::question(this, "Warning", "Sure, You want to delete selected client?", 0, 1, 2); + if (ret == 1) + { + frame->hide(); + frame->deleteLater(); + _clientFrames.removeOne(frame); + return; + } + else + { + frame->move(frame->getPreviousPosition()); + return; + } + } + } qDebug("Move D"); frame->move(x, y); savePosition(frame); @@ -600,6 +639,8 @@ void MainWindow::onButtonTutorToAll() QMessageBox::critical(this, tr("Projection"), sStrTutorNdef); else if (getTutorFrame()->client() == NULL) QMessageBox::critical(this, tr("Projection"), sStrTutorOffline); + else if (_clientFrames.size() == 1) + QMessageBox::critical(this, tr("Projection"), sStrNoDestAv); else changeProjection(getTutorFrame()->client(), Mode::Broadcast); } diff --git a/src/server/mainwindow/mainwindow.h b/src/server/mainwindow/mainwindow.h index 851dc84..524a0b1 100644 --- a/src/server/mainwindow/mainwindow.h +++ b/src/server/mainwindow/mainwindow.h @@ -69,6 +69,8 @@ private: static const QString sStrDestNdef; static const QString sStrDestOffline; static const QString sStrSourceDestSame; + static const QString sStrClientOnline; + static const QString sStrNoDestAv; void placeFrameInFreeSlot(ConnectionFrame* frame); ConnectionFrame* createFrame(); -- cgit v1.2.3-55-g7522