diff options
author | Björn Hagemeister | 2014-05-06 15:42:33 +0200 |
---|---|---|
committer | Björn Hagemeister | 2014-05-06 15:42:33 +0200 |
commit | 8e774982be169f33fe4f4c687885d96f1c4e5ab4 (patch) | |
tree | f4d8042b531ef15024cd9e56a9569f3939950e96 | |
parent | New Feature: Showing client toolbar while vnc server is running. (diff) | |
parent | Merge branch 'master' of git.openslx.org:pvs2 (diff) | |
download | pvs2-8e774982be169f33fe4f4c687885d96f1c4e5ab4.tar.gz pvs2-8e774982be169f33fe4f4c687885d96f1c4e5ab4.tar.xz pvs2-8e774982be169f33fe4f4c687885d96f1c4e5ab4.zip |
Merge branch 'master' of git.openslx.org:pvs2
Conflicts:
src/client/connectwindow/connectwindow.h
-rw-r--r-- | gui/client/connect.ui | 8 | ||||
-rw-r--r-- | gui/client/toolbar.ui | 16 | ||||
-rw-r--r-- | src/client/connectwindow/connectwindow.cpp | 58 | ||||
-rw-r--r-- | src/client/connectwindow/connectwindow.h | 11 | ||||
-rw-r--r-- | src/client/toolbar/toolbar.cpp | 23 | ||||
-rw-r--r-- | src/client/toolbar/toolbar.h | 13 | ||||
-rw-r--r-- | src/server/connectionframe/connectionframe.cpp | 14 | ||||
-rw-r--r-- | src/server/mainwindow/mainwindow.cpp | 2 | ||||
-rw-r--r-- | src/server/mainwindow/mainwindow.h | 5 | ||||
-rw-r--r-- | src/server/sessionnamewindow/sessionnamewindow.h | 5 | ||||
-rw-r--r-- | src/shared/settings.h | 2 |
11 files changed, 87 insertions, 70 deletions
diff --git a/gui/client/connect.ui b/gui/client/connect.ui index d334924..a7cb621 100644 --- a/gui/client/connect.ui +++ b/gui/client/connect.ui @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>Dialog</class> - <widget class="QDialog" name="Dialog"> + <class>ConnectWindow</class> + <widget class="QWidget" name="ConnectWindow"> <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>511</width> - <height>121</height> + <width>512</width> + <height>128</height> </rect> </property> <property name="windowTitle"> diff --git a/gui/client/toolbar.ui b/gui/client/toolbar.ui index 93d2dc9..3e39e16 100644 --- a/gui/client/toolbar.ui +++ b/gui/client/toolbar.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>ToolbarClass</class> - <widget class="QWidget" name="ToolbarClass"> + <class>Toolbar</class> + <widget class="QWidget" name="Toolbar"> <property name="geometry"> <rect> <x>0</x> @@ -66,7 +66,7 @@ QCheckBox::indicator:checked:pressed { } </string> </property> - <layout class="QHBoxLayout" name="horizontalLayout_2"> + <layout class="QHBoxLayout" name="horizontalLayout"> <property name="leftMargin"> <number>0</number> </property> @@ -87,7 +87,7 @@ QCheckBox::indicator:checked:pressed { <property name="frameShadow"> <enum>QFrame::Raised</enum> </property> - <layout class="QHBoxLayout" name="horizontalLayout"> + <layout class="QHBoxLayout" name="horizontalLayout2"> <item> <widget class="QPushButton" name="cmdMenu"> <property name="minimumSize"> @@ -105,7 +105,7 @@ QCheckBox::indicator:checked:pressed { </widget> </item> <item> - <spacer name="horizontalSpacer"> + <spacer name="spacer_left"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> @@ -128,7 +128,7 @@ QCheckBox::indicator:checked:pressed { </widget> </item> <item> - <spacer name="horizontalSpacer_3"> + <spacer name="spacer_right"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> @@ -141,7 +141,7 @@ QCheckBox::indicator:checked:pressed { </spacer> </item> <item> - <widget class="QLabel" name="label"> + <widget class="QLabel" name="icon_pvs"> <property name="text"> <string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> @@ -152,7 +152,7 @@ p, li { white-space: pre-wrap; } </widget> </item> <item> - <widget class="QLabel" name="label_3"> + <widget class="QLabel" name="icon_cam"> <property name="maximumSize"> <size> <width>16</width> diff --git a/src/client/connectwindow/connectwindow.cpp b/src/client/connectwindow/connectwindow.cpp index 07a1a76..61d375d 100644 --- a/src/client/connectwindow/connectwindow.cpp +++ b/src/client/connectwindow/connectwindow.cpp @@ -5,14 +5,13 @@ * Author: sr */ -#include "connectwindow.h" +#include <QNetworkInterface> #include "../../shared/settings.h" #include "../../shared/network.h" #include "../../shared/util.h" - #include "../net/serverconnection.h" - -#include <QNetworkInterface> +#include "connectwindow.h" +#include "ui_connect.h" #define UDPBUFSIZ 9000 #define SALT_LEN 18 @@ -22,13 +21,16 @@ * @param parent */ ConnectWindow::ConnectWindow(QWidget *parent) : - QDialog(parent), _connected(false), _timerDiscover(0), _timerHide(0), _connection(NULL), _state(Idle), - _hashErrorCount(0), _hashSslErrorCount(0), _certErrorCount(0), _ipErrorCount(0), _discoveryInterval(800) + QWidget(parent), _ui(new Ui::ConnectWindow), _connected(false), + _timerDiscover(0), _timerHide(0), _connection(NULL), _state(Idle), + _hashErrorCount(0), _hashSslErrorCount(0), _certErrorCount(0), + _ipErrorCount(0), _discoveryInterval(800) { - setupUi(this); - // - connect(cmdOK, SIGNAL(clicked()), this, SLOT(onOkClick())); - connect(cmdCancel, SIGNAL(clicked()), this, SLOT(onCancelClick())); + // Initialize the GUI + _ui->setupUi(this); + + connect(_ui->cmdOK, SIGNAL(clicked()), this, SLOT(onOkClick())); + connect(_ui->cmdCancel, SIGNAL(clicked()), this, SLOT(onCancelClick())); int tries = 10; while (tries-- != 0) { @@ -84,52 +86,52 @@ void ConnectWindow::setState(const ConnectionState state) */ void ConnectWindow::updateState() { - txtName->setEnabled(_state == Idle && !_connected); + _ui->txtName->setEnabled(_state == Idle && !_connected); if (_connected) { - lblCheckmark->setVisible(true); - cmdOK->setEnabled(true); - cmdOK->setText(tr("&Disconnect")); - lblStatus->setText(tr("Connected.")); - txtName->setEnabled(false); + _ui->lblCheckmark->setVisible(true); + _ui->cmdOK->setEnabled(true); + _ui->cmdOK->setText(tr("&Disconnect")); + _ui->lblStatus->setText(tr("Connected.")); + _ui->txtName->setEnabled(false); return; } if (_state != Idle) - cmdOK->setText(tr("&Stop")); + _ui->cmdOK->setText(tr("&Stop")); else - cmdOK->setText(tr("&Connect")); + _ui->cmdOK->setText(tr("&Connect")); switch (_state) { case Idle: - lblStatus->setText(tr("Ready to connect; please enter session name.")); + _ui->lblStatus->setText(tr("Ready to connect; please enter session name.")); break; case Scanning: - lblStatus->setText(tr("Scanning for session %1.").arg(txtName->text())); + _ui->lblStatus->setText(tr("Scanning for session %1.").arg(_ui->txtName->text())); _timerDiscover = startTimer(_discoveryInterval); break; case Connecting: - lblStatus->setText(tr("Found session, connecting...")); + _ui->lblStatus->setText(tr("Found session, connecting...")); break; case AwaitingChallenge: - lblStatus->setText(tr("Waiting for server challenge...")); + _ui->lblStatus->setText(tr("Waiting for server challenge...")); break; case AwaitingChallengeResponse: - lblStatus->setText(tr("Replied to challenge, sent own...")); + _ui->lblStatus->setText(tr("Replied to challenge, sent own...")); break; case LoggingIn: - lblStatus->setText(tr("Logging in...")); + _ui->lblStatus->setText(tr("Logging in...")); break; case Connected: - lblStatus->setText(tr("Connection established!")); + _ui->lblStatus->setText(tr("Connection established!")); break; case InvalidIpList: case InvalidHash: case InvalidCert: case InvalidSslHash: - lblError->setText(tr("Invalid hash: %1; invalid cert: %2; invalid iplist: %3; invalid sslhash: %4") + _ui->lblError->setText(tr("Invalid hash: %1; invalid cert: %2; invalid iplist: %3; invalid sslhash: %4") .arg(_hashErrorCount).arg(_certErrorCount).arg(_ipErrorCount).arg(_hashSslErrorCount)); break; } @@ -217,7 +219,7 @@ void ConnectWindow::closeEvent(QCloseEvent *e) */ void ConnectWindow::showEvent(QShowEvent* event) { - txtName->setFocus(); + _ui->txtName->setFocus(); } /* @@ -247,7 +249,7 @@ void ConnectWindow::onOkClick() { // Connect (scan for session) _discoveryInterval = 800; - _nameBytes = txtName->text().toUtf8(); + _nameBytes = _ui->txtName->text().toUtf8(); _timerDiscover = startTimer(_discoveryInterval); _hashErrorCount = _hashSslErrorCount = _certErrorCount = _ipErrorCount = 0; this->setState(Scanning); diff --git a/src/client/connectwindow/connectwindow.h b/src/client/connectwindow/connectwindow.h index 13983fa..8d4a436 100644 --- a/src/client/connectwindow/connectwindow.h +++ b/src/client/connectwindow/connectwindow.h @@ -19,10 +19,11 @@ #include <QtGui> #include <QUdpSocket> #include <QSslSocket> -#include "ui_connect.h" - #include "../../shared/networkmessage.h" +namespace Ui{ +class ConnectWindow; +} class ServerConnection; /** @@ -32,7 +33,7 @@ class ServerConnection; * For connecting with manager, user is able to set sessionName. If connection works * correctly flashy green checkmark is shown. */ -class ConnectWindow : public QDialog, private Ui_Dialog +class ConnectWindow : public QWidget { Q_OBJECT @@ -53,6 +54,8 @@ public: }; private: + Ui::ConnectWindow *_ui; + bool _connected; int _timerDiscover, _timerHide; ServerConnection *_connection; @@ -69,7 +72,7 @@ private: void updateState(); public: - ConnectWindow(QWidget *parent = NULL); + explicit ConnectWindow(QWidget *parent = NULL); virtual ~ConnectWindow(); void setConnected(const bool connected); diff --git a/src/client/toolbar/toolbar.cpp b/src/client/toolbar/toolbar.cpp index 8e80fe3..f45d63a 100644 --- a/src/client/toolbar/toolbar.cpp +++ b/src/client/toolbar/toolbar.cpp @@ -5,20 +5,26 @@ * Author: sr */ -#include "toolbar.h" #include "../../shared/settings.h" #include "../net/serverconnection.h" #include "../vnc/vncwindow.h" #include "../vnc/vncserver.h" +#include "toolbar.h" +#include "ui_toolbar.h" + Toolbar::Toolbar(QWidget *parent) : - QWidget(parent), _location(POSITION_TOP_CENTER), _hideTimer(0), _connection(NULL) + QWidget(parent), _ui(new Ui::Toolbar), _location(POSITION_TOP_CENTER), + _hideTimer(0), _connection(NULL) { - setupUi(this); + // Initialize the GUI + _ui->setupUi(this); + setWindowFlags(Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint | Qt::FramelessWindowHint); setAttribute(Qt::WA_AlwaysShowToolTips); setAttribute(Qt::WA_QuitOnClose); setVisible(true); + // VNC Window _vnc = new VncWindow(NULL); // Connect window @@ -45,7 +51,7 @@ void Toolbar::setupMenu() _menu->addSeparator(); _menu->addAction(_acnQuit); - cmdMenu->setMenu(_menu); + _ui->cmdMenu->setMenu(_menu); connect(_acnQuit, SIGNAL(triggered()), this, SLOT(onQuit())); connect(_acnDisconnect, SIGNAL(triggered()), _connectWindow, SLOT(show())); @@ -56,6 +62,7 @@ Toolbar::~Toolbar() VncServer::instance()->stop(); _vnc->deleteLater(); _connectWindow->deleteLater(); + delete _ui; } //###########\\/\/ @@ -177,14 +184,14 @@ void Toolbar::onDisconnected() if (_connection != NULL) _connection->blockSignals(true); _connection = NULL; - lblStatus->setStyleSheet("color:red"); - lblStatus->setText(tr("Offline")); + _ui->lblStatus->setStyleSheet("color:red"); + _ui->lblStatus->setText(tr("Offline")); } void Toolbar::onConnected(ServerConnection* connection) { - lblStatus->setStyleSheet("color:green"); - lblStatus->setText(tr("Online")); + _ui->lblStatus->setStyleSheet("color:green"); + _ui->lblStatus->setText(tr("Online")); // if (_connection != NULL) { diff --git a/src/client/toolbar/toolbar.h b/src/client/toolbar/toolbar.h index 8a9da6f..aabb596 100644 --- a/src/client/toolbar/toolbar.h +++ b/src/client/toolbar/toolbar.h @@ -15,18 +15,23 @@ #define PVSCLIENTGUI_H_ #include <QtGui> -#include "ui_toolbar.h" class ServerConnection; class VncWindow; class ConnectWindow; class BlankScreen; -class Toolbar : public QWidget, private Ui_ToolbarClass +namespace Ui{ +class Toolbar; +} + +class Toolbar : public QWidget { -Q_OBJECT + Q_OBJECT private: + Ui::Toolbar *_ui; + int _location; int _hideTimer; int _hideDelay; @@ -48,7 +53,7 @@ private: void timerEvent(QTimerEvent* event); public: - Toolbar(QWidget *parent = NULL); + explicit Toolbar(QWidget *parent = 0); virtual ~Toolbar(); int const static POSITION_TOP_LEFT = 0; diff --git a/src/server/connectionframe/connectionframe.cpp b/src/server/connectionframe/connectionframe.cpp index 4b3a7dd..75d24a4 100644 --- a/src/server/connectionframe/connectionframe.cpp +++ b/src/server/connectionframe/connectionframe.cpp @@ -21,20 +21,20 @@ #include <cassert> static QString style_student( - "QLabel{ background-color: #919191; border-radius: 2px; color: black;} \ - QGroupBox { background-color: #919191; margin: 2px; border-radius: 4px}" + "QLabel{ background-color: #FFF; border-radius: 2px; color: black;} \ + QGroupBox { background-color: #AAA; margin: 2px; border-radius: 4px}" ); static QString style_tutor( - "QLabel{ background-color: #70C670; border-radius: 2px; color: black;} \ + "QLabel{ background-color: #FFF; border-radius: 2px; color: black;} \ QGroupBox { background-color: #70C670; margin: 2px; border-radius: 4px}" ); static QString style_selectedStudent( - "QLabel{ background-color: #6C8CD5; border-radius: 2px; color: black; } \ - QGroupBox { background-color: #919191; margin: 0px; border-radius: 4px; border: 2px dashed #6C8CD5;}" + "QLabel{ background-color: #FFF; border-radius: 2px; color: black; } \ + QGroupBox { background-color: #AAA; margin: 0px; border-radius: 4px; border: 2px solid #6C8CD5;}" ); static QString style_selectedTutor( - "QLabel{ background-color: #6C8CD5; border-radius: 2px; color: black;} \ - QGroupBox { background-color: #70C670; margin: 0px; border-radius: 4px; border: 2px dashed #6C8CD5;}" + "QLabel{ background-color: #FFF; border-radius: 2px; color: black;} \ + QGroupBox { background-color: #70C670; margin: 0px; border-radius: 4px; border: 2px solid #6C8CD5;}" ); static QString style_disconnected( "QLabel{ background-color: #919191; color: black; } \ diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index 3d0d167..1844458 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -683,7 +683,7 @@ void MainWindow::onButtonTutorToStudent() continue; if ((**it).selected()) to = c; - else if ((**it).isTutor()) + if ((**it).isTutor()) from = c; } if (to == NULL) diff --git a/src/server/mainwindow/mainwindow.h b/src/server/mainwindow/mainwindow.h index 153eb5b..c06f8e9 100644 --- a/src/server/mainwindow/mainwindow.h +++ b/src/server/mainwindow/mainwindow.h @@ -11,8 +11,7 @@ class ConnectionFrame; class ListenServer; class DiscoveryListener; -namespace Ui -{ +namespace Ui{ class MainWindow; } @@ -43,7 +42,7 @@ private: // Button block stuff QTimer * _buttonLockTimer; QList<QAction*> _lockingButtons; - static const qint64 _buttonBlockTime = 1000; + static const qint64 _buttonBlockTime = 600; /** * Downloader for IP - List of possible tutors. diff --git a/src/server/sessionnamewindow/sessionnamewindow.h b/src/server/sessionnamewindow/sessionnamewindow.h index ed944c1..ee93ea2 100644 --- a/src/server/sessionnamewindow/sessionnamewindow.h +++ b/src/server/sessionnamewindow/sessionnamewindow.h @@ -4,8 +4,7 @@ #include <QtGui> -namespace Ui -{ +namespace Ui{ class SessionName; } @@ -14,7 +13,7 @@ class SessionNameWindow : public QDialog Q_OBJECT private: - Ui::SessionName *ui; + Ui::SessionName *ui; public: SessionNameWindow(QWidget *parent = 0); diff --git a/src/shared/settings.h b/src/shared/settings.h index c1c45c1..2713693 100644 --- a/src/shared/settings.h +++ b/src/shared/settings.h @@ -1,6 +1,8 @@ #ifndef _SETTINGS_H_ #define _SETTINGS_H_ +#include <QString> + #define CLIENT_PORT 5194 static const QString CLIENT_PORT_STR(QString::number(CLIENT_PORT)); static const QByteArray CLIENT_PORT_ARRAY(QString::number(CLIENT_PORT).toUtf8()); |