diff options
author | Sebastien Braun | 2010-10-06 00:04:49 +0200 |
---|---|---|
committer | Sebastien Braun | 2010-10-06 00:04:49 +0200 |
commit | f07fc3b426815e28fde23313242fbbb998a08d45 (patch) | |
tree | ba9eda1a83135a1727d2d35661d6facabee53b95 /src/gui | |
parent | Fix recognition of letters in keyboard handler (diff) | |
parent | Merge remote branch 'openslx/master' into mcastft (diff) | |
download | pvs-f07fc3b426815e28fde23313242fbbb998a08d45.tar.gz pvs-f07fc3b426815e28fde23313242fbbb998a08d45.tar.xz pvs-f07fc3b426815e28fde23313242fbbb998a08d45.zip |
Merge remote branch 'openslx/mcastft' into input
Conflicts:
CMakeLists.txt
i18n/pvs_ar_JO.ts
i18n/pvs_de_DE.ts
i18n/pvs_es_MX.ts
i18n/pvs_fr_FR.ts
i18n/pvs_pl_PL.ts
i18n/pvsmgr_ar_JO.ts
i18n/pvsmgr_de_DE.ts
i18n/pvsmgr_es_MX.ts
i18n/pvsmgr_fr_FR.ts
i18n/pvsmgr_pl_PL.ts
icons/README
pvsmgr.qrc
src/gui/mainWindow.cpp
src/pvs.cpp
src/pvs.h
src/pvsDaemon.cpp
src/util/clientGUIUtils.h
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/clientChatDialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/clientConfigDialog.cpp | 104 | ||||
-rw-r--r-- | src/gui/clientConfigDialog.h | 5 | ||||
-rw-r--r-- | src/gui/clientFileReceiveDialog.cpp | 95 | ||||
-rw-r--r-- | src/gui/clientFileReceiveDialog.h | 14 | ||||
-rw-r--r-- | src/gui/clientFileSendDialog.cpp | 203 | ||||
-rw-r--r-- | src/gui/clientFileSendDialog.h | 21 | ||||
-rw-r--r-- | src/gui/clientVNCViewer.cpp | 2 | ||||
-rw-r--r-- | src/gui/mainWindow.cpp | 1320 | ||||
-rw-r--r-- | src/gui/mainWindow.h | 4 | ||||
-rw-r--r-- | src/gui/multicastConfigDialog.cpp | 170 | ||||
-rw-r--r-- | src/gui/multicastConfigDialog.h | 38 | ||||
-rw-r--r-- | src/gui/ui/clientConfigDialog.ui | 64 | ||||
-rw-r--r-- | src/gui/ui/clientFileReceiveDialog.ui | 11 | ||||
-rw-r--r-- | src/gui/ui/clientFileSendDialog.ui | 15 | ||||
-rw-r--r-- | src/gui/ui/clientNicklistDialog.ui | 7 | ||||
-rw-r--r-- | src/gui/ui/clientToolbar.ui | 42 | ||||
-rw-r--r-- | src/gui/ui/mainwindow.ui | 34 | ||||
-rw-r--r-- | src/gui/ui/mainwindowtouch.ui | 28 | ||||
-rw-r--r-- | src/gui/ui/multicastConfigDialog.ui | 156 |
20 files changed, 1587 insertions, 748 deletions
diff --git a/src/gui/clientChatDialog.cpp b/src/gui/clientChatDialog.cpp index 7c32790..163ac92 100644 --- a/src/gui/clientChatDialog.cpp +++ b/src/gui/clientChatDialog.cpp @@ -29,8 +29,6 @@ ClientChatDialog::ClientChatDialog(QWidget *parent) : // connect to D-Bus and get interface QDBusConnection dbus = QDBusConnection::sessionBus(); - dbus.registerObject("/chat", this); - dbus.registerService("org.openslx.pvsgui"); _ifaceDBus = new OrgOpenslxPvsInterface("org.openslx.pvs", "/", dbus, this); connect(_ifaceDBus, SIGNAL(chat_receive(QString, QString, QString)), this, SLOT(receive(QString, QString, QString))); diff --git a/src/gui/clientConfigDialog.cpp b/src/gui/clientConfigDialog.cpp index 76b4f5e..b7ba407 100644 --- a/src/gui/clientConfigDialog.cpp +++ b/src/gui/clientConfigDialog.cpp @@ -16,16 +16,33 @@ # ----------------------------------------------------------------------------- */ +#include <QtDebug> +#include <QNetworkInterface> +#include <QStandardItemModel> #include "clientConfigDialog.h" +#include <cerrno> +#include <cstdlib> +#include <cstring> +#include <src/net/pvsNetworkInterfaceListModel.h> + +using namespace std; ClientConfigDialog::ClientConfigDialog(QWidget *parent) : - QDialog(parent) + QDialog(parent), + _interfaceListModel(0) { setupUi(this); connect(this, SIGNAL(accepted()), this, SLOT(writeSettings())); connect(radioButtonOtherRO, SIGNAL(clicked()), this, SLOT(checkPermissions())); + _interfaceListModel = new PVSNetworkInterfaceListModel(this); + interfaceList->setModel(_interfaceListModel); + interfaceList->setModelColumn(0); + connect(reloadInterfaceListButton, SIGNAL(clicked()), _interfaceListModel, SLOT(reloadInterfaceList())); + // connect to D-Bus and get interface + QDBusConnection dbus = QDBusConnection::sessionBus(); + _ifaceDBus = new OrgOpenslxPvsInterface("org.openslx.pvs", "/", dbus, this); } ClientConfigDialog::~ClientConfigDialog() @@ -49,50 +66,73 @@ void ClientConfigDialog::readSettings() else comboBox->setCurrentIndex(_settings.value("Display/location").toInt()); - if (_settings.value("Permissions/vnc_lecturer").toString() == "rw") - radioButtonLecturerRW->setChecked(true); - else if (_settings.value("Permissions/vnc_lecturer").toString() == "ro") - radioButtonLecturerRO->setChecked(true); - else - radioButtonLecturerNO->setChecked(true); - if (_settings.value("Permissions/vnc_other").toString() == "rw") - radioButtonOtherRW->setChecked(true); - else if (_settings.value("Permissions/vnc_other").toString() == "ro") - radioButtonOtherRO->setChecked(true); - else - radioButtonOtherNO->setChecked(true); - checkBoxAllowChat->setChecked( - _settings.value("Permissions/allow_chat").toBool()); - checkBoxAllowFiletransfer->setChecked(_settings.value( - "Permissions/allow_filetransfer").toBool()); - - qDebug("[%s] Setting read from: '%s'", metaObject()->className(), - qPrintable(_settings.fileName())); + QDBusPendingReply<QString> reply = _ifaceDBus->getConfigValue("multicast/interface"); + reply.waitForFinished(); + if (reply.isValid()) + { + interfaceList->setEditText(reply.value()); + } + + reply = _ifaceDBus->getConfigValue("Permissions/vnc_lecturer"); + reply.waitForFinished(); + if (reply.isValid()) + { + if (reply.value() == "rw") + radioButtonLecturerRW->setChecked(true); + else if (reply.value() == "ro") + radioButtonLecturerRO->setChecked(true); + else + radioButtonLecturerNO->setChecked(true); + } + + reply = _ifaceDBus->getConfigValue("Permissions/vnc_other"); + reply.waitForFinished(); + if (reply.isValid()) + { + if (reply.value() == "rw") + radioButtonOtherRW->setChecked(true); + else if (reply.value() == "ro") + radioButtonOtherRO->setChecked(true); + else + radioButtonOtherNO->setChecked(true); + } + + reply = _ifaceDBus->getConfigValue("Permissions/allow_chat"); + reply.waitForFinished(); + if (reply.isValid()) + checkBoxAllowChat->setChecked(reply.value() == "T"); + + reply = _ifaceDBus->getConfigValue("Permissions/allow_filetransfer"); + reply.waitForFinished(); + if (reply.isValid()) + checkBoxAllowFiletransfer->setChecked(reply.value() == "T"); } void ClientConfigDialog::writeSettings() { _settings.setValue("Display/location", comboBox->currentIndex()); + if (radioButtonLecturerRW->isChecked()) - _settings.setValue("Permissions/vnc_lecturer", "rw"); + _ifaceDBus->setConfigValue("Permissions/vnc_lecturer", "rw"); else if (radioButtonLecturerRO->isChecked()) - _settings.setValue("Permissions/vnc_lecturer", "ro"); + _ifaceDBus->setConfigValue("Permissions/vnc_lecturer", "ro"); else - _settings.setValue("Permissions/vnc_lecturer", "no"); + _ifaceDBus->setConfigValue("Permissions/vnc_lecturer", "no"); if (radioButtonOtherRW->isChecked()) - _settings.setValue("Permissions/vnc_other", "rw"); + _ifaceDBus->setConfigValue("Permissions/vnc_other", "rw"); else if (radioButtonOtherRO->isChecked()) - _settings.setValue("Permissions/vnc_other", "ro"); + _ifaceDBus->setConfigValue("Permissions/vnc_other", "ro"); else - _settings.setValue("Permissions/vnc_other", "no"); - _settings.setValue("Permissions/allow_chat", checkBoxAllowChat->isChecked()); - _settings.setValue("Permissions/allow_filetransfer", - checkBoxAllowFiletransfer->isChecked()); + _ifaceDBus->setConfigValue("Permissions/vnc_other", "no"); + + _ifaceDBus->setConfigValue("Permissions/allow_chat", + QString(checkBoxAllowChat->isChecked() ? "T" : "F")); + _ifaceDBus->setConfigValue("Permissions/allow_filetransfer", + QString(checkBoxAllowFiletransfer->isChecked() ? "T" : "F")); + _ifaceDBus->setConfigValue("multicast/interface", interfaceList->currentText()); + _settings.sync(); emit configChanged(); - - qDebug("[%s] Settings written to: '%s'.", metaObject()->className(), - qPrintable(_settings.fileName())); } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/gui/clientConfigDialog.h b/src/gui/clientConfigDialog.h index 706bd8a..fd7529e 100644 --- a/src/gui/clientConfigDialog.h +++ b/src/gui/clientConfigDialog.h @@ -15,8 +15,11 @@ #define CLIENTCONFIGDIALOG_H_ #include <QtGui> +#include "pvsinterface.h" #include "ui_clientConfigDialog.h" +class QAbstractItemModel; + class ClientConfigDialog: public QDialog, private Ui::ClientConfigDialogClass { Q_OBJECT @@ -37,7 +40,9 @@ private Q_SLOTS: void checkPermissions(); private: + OrgOpenslxPvsInterface *_ifaceDBus; QSettings _settings; + QAbstractItemModel* _interfaceListModel; }; diff --git a/src/gui/clientFileReceiveDialog.cpp b/src/gui/clientFileReceiveDialog.cpp index 669ca81..fc6a1a3 100644 --- a/src/gui/clientFileReceiveDialog.cpp +++ b/src/gui/clientFileReceiveDialog.cpp @@ -16,6 +16,9 @@ */ #include "clientFileReceiveDialog.h" +#include <pvsinterface.h> +#include <QFileInfo> +#include <limits.h> ClientFileReceiveDialog::ClientFileReceiveDialog(QTcpSocket *socket, QWidget *parent) : QDialog(parent) @@ -37,9 +40,44 @@ ClientFileReceiveDialog::ClientFileReceiveDialog(QTcpSocket *socket, QWidget *pa connect(this, SIGNAL(finished(int)), this, SLOT(deleteLater())); } +ClientFileReceiveDialog::ClientFileReceiveDialog(QString const& sender, qulonglong transferID, + QString const& filename, qulonglong size, OrgOpenslxPvsInterface* ifaceDBus, QWidget* parent) +{ + setupUi(this); + + _transferID = transferID; + _filename = filename; + _ifaceDBus = ifaceDBus; + _bytesToRead = size; + _socket = 0; + _file = 0; + div = 1; + while((size / div) > INT_MAX) + { + div <<= 1; + } + + connect(ifaceDBus, SIGNAL(incomingMulticastTransferStarted(qulonglong)), SLOT(mcastTransferStarted(qulonglong))); + connect(ifaceDBus, SIGNAL(incomingMulticastTransferProgress(qulonglong, qulonglong, qulonglong)), + SLOT(mcastTransferProgress(qulonglong, qulonglong, qulonglong))); + connect(ifaceDBus, SIGNAL(incomingMulticastTransferFinished(qulonglong)), SLOT(mcastTransferFinished(qulonglong))); + connect(ifaceDBus, SIGNAL(incomingMulticastTransferFailed(qulonglong, QString)), SLOT(mcastTransferFailed(qulonglong, QString))); + connect(cancelButton, SIGNAL(clicked()), SLOT(cancelTransfer())); + + qDebug("[%s] New multicast incoming transfer: %s from %s", metaObject()->className(), + filename.toLocal8Bit().constData(), sender.toLocal8Bit().constData()); + + + filenameLabel->setText(QFileInfo(filename).baseName()); + labelNick->setText(sender); + progressBar->setRange(0, 0); +} + + ClientFileReceiveDialog::~ClientFileReceiveDialog() { - _socket->deleteLater(); + if(_socket) + _socket->deleteLater(); qDebug("[%s] Deleted!", metaObject()->className()); } @@ -168,6 +206,61 @@ void ClientFileReceiveDialog::error(QAbstractSocket::SocketError error) close(); } +void ClientFileReceiveDialog::mcastTransferStarted(qulonglong transferID) +{ + if(transferID != _transferID) + return; +} + +void ClientFileReceiveDialog::mcastTransferProgress(qulonglong transferID, qulonglong bytes, qulonglong of) +{ + if(transferID != _transferID) + return; + + progressBar->setRange(0, of); + progressBar->setValue(bytes); + + labelA->setText(formatSize(bytes)); + labelB->setText(formatSize(of)); +} + +void ClientFileReceiveDialog::mcastTransferFinished(qulonglong transferID) +{ + if(transferID != _transferID) + return; + + QString filename = QFileDialog::getSaveFileName(this, tr("Where should I save %1?").arg(_filename), _filename); + QFile* file = new QFile(_filename); + if(filename.isNull() || filename.isEmpty()) + { + file->remove(); + } + else + { + if(!file->rename(filename)) + { + QMessageBox::warning(this, tr("Could not rename file"), tr("Failed to rename %1 to %2").arg(_filename).arg(filename)); + } + } + accept(); + deleteLater(); +} + +void ClientFileReceiveDialog::mcastTransferFailed(qulonglong transferID, QString reason) +{ + if(transferID != _transferID) + return; + + QMessageBox::warning(this, tr("File transfer failed"), tr("File transfer failed for the following reason:\n%1").arg(reason)); + reject(); + deleteLater(); +} + +void ClientFileReceiveDialog::cancelTransfer() +{ + _ifaceDBus->cancelIncomingMulticastTransfer(_transferID); +} + QString ClientFileReceiveDialog::formatSize(qint64 size) { if (size >= 1000000000) // GB diff --git a/src/gui/clientFileReceiveDialog.h b/src/gui/clientFileReceiveDialog.h index c13d7b7..c9ed220 100644 --- a/src/gui/clientFileReceiveDialog.h +++ b/src/gui/clientFileReceiveDialog.h @@ -18,6 +18,8 @@ #include <QtNetwork> #include "ui_clientFileReceiveDialog.h" +class OrgOpenslxPvsInterface; + class ClientFileReceiveDialog: public QDialog, private Ui::ClientFileReceiveDialogClass { @@ -25,6 +27,7 @@ Q_OBJECT public: ClientFileReceiveDialog(QTcpSocket *socket, QWidget *parent = 0); + ClientFileReceiveDialog(QString const& sender, qulonglong transferID, QString const& basename, qulonglong size, OrgOpenslxPvsInterface* ifaceDBus, QWidget* parent = 0); ~ClientFileReceiveDialog(); private Q_SLOTS: @@ -33,6 +36,13 @@ private Q_SLOTS: void close(); void error(QAbstractSocket::SocketError error); + // multicast: + void mcastTransferStarted(qulonglong transferID); + void mcastTransferProgress(qulonglong transferID, qulonglong bytes, qulonglong of); + void mcastTransferFinished(qulonglong transferID); + void mcastTransferFailed(qulonglong transferID, QString reason); + void cancelTransfer(); + private: void sendAck(bool b); QString formatSize(qint64 size); @@ -42,6 +52,10 @@ private: qint64 _bytesToRead; int div; + // multicast: + OrgOpenslxPvsInterface* _ifaceDBus; + QString _filename; + qulonglong _transferID; }; #endif /* CLIENTFILERECEIVEDIALOG_H_ */ diff --git a/src/gui/clientFileSendDialog.cpp b/src/gui/clientFileSendDialog.cpp index ccb44b3..93da725 100644 --- a/src/gui/clientFileSendDialog.cpp +++ b/src/gui/clientFileSendDialog.cpp @@ -22,14 +22,16 @@ ClientFileSendDialog::ClientFileSendDialog(QWidget *parent) : { setupUi(this); + _transferID = 0; + _error = false; + _isMulticast = false; + _file = NULL; _socket = NULL; _clientNicklistDialog = new ClientNicklistDialog(this); // connect to D-Bus and get interface QDBusConnection dbus = QDBusConnection::sessionBus(); - dbus.registerObject("/filesend", this); - dbus.registerService("org.openslx.pvsgui"); _ifaceDBus = new OrgOpenslxPvsInterface("org.openslx.pvs", "/", dbus, this); // get current users name from backend @@ -60,7 +62,15 @@ void ClientFileSendDialog::open() reject(); return; } - open(_clientNicklistDialog->getNick()); + + if (_clientNicklistDialog->isSendToAll()) + { + sendToAll(); + } + else + { + open(_clientNicklistDialog->getNick()); + } } void ClientFileSendDialog::open(QString nick) @@ -75,6 +85,70 @@ void ClientFileSendDialog::open(QString nick) open(nick, filename); } +void ClientFileSendDialog::sendToAll() +{ + QString filename = QFileDialog::getOpenFileName(this, tr("Send File"), QDir::homePath(), ""); + if (filename == "") + { + reject(); + return; + } + sendToAll(filename); +} + +void ClientFileSendDialog::sendToAll(QString filename) +{ + _isMulticast = true; + + connect(_ifaceDBus, SIGNAL(outgoingMulticastTransferStarted(qulonglong)), SLOT(multicastTransferStarted(qulonglong))); + connect(_ifaceDBus, SIGNAL(outgoingMulticastTransferProgress(qulonglong,qulonglong,qulonglong)), SLOT(multicastTransferProgress(qulonglong, qulonglong, qulonglong))); + connect(_ifaceDBus, SIGNAL(outgoingMulticastTransferFinished(qulonglong)), SLOT(multicastTransferFinished(qulonglong))); + connect(_ifaceDBus, SIGNAL(outgoingMulticastTransferFailed(qulonglong, QString const&)), SLOT(multicastTransferFailed(qulonglong, QString const&))); + + filenameLabel->setText(filename); + progressBar->setRange(0, 0); + labelNick->setText(tr("all")); + labelStatus->setText(tr("Waiting to start")); + + QString errorMessage("Backend error"); + + // We need to jump through a lot of hoops because this call is prone to time out, and + // QtDBus does not support specifying timeouts in generated interfaces. + QDBusMessage call = QDBusMessage::createMethodCall("org.openslx.pvs", "/", "org.openslx.pvs", "createMulticastTransfer"); + call << filename; + + QDBusMessage reply = _ifaceDBus->connection().call(call, QDBus::Block, 5000); + if (reply.type() == QDBusMessage::ErrorMessage) + { + QMessageBox::critical(this, tr("File Send error"), tr("Error communicating with backend: %1: %2").arg(reply.errorName()).arg(reply.errorMessage())); + reject(); + return; + } + else if (reply.type() == QDBusMessage::InvalidMessage) + { + QMessageBox::critical(this, tr("File Send error"), tr("Something went wrong while communicating with backend, but I don't know what.")); + reject(); + return; + } + else if (reply.type() == QDBusMessage::ReplyMessage) + { + QList<QVariant> args = reply.arguments(); + bool created = args.at(0).toBool(); + _transferID = args.at(1).toULongLong(); + QString errorMessage = args.at(2).toString(); + if (!created) + { + QMessageBox::critical(this, tr("File Send error"), tr("Could not create a multicast transfer: %1").arg(errorMessage)); + reject(); + return; + } + } + + connect(cancelButton, SIGNAL(clicked()), SLOT(canceled())); + + show(); +} + void ClientFileSendDialog::open(QString nick, QString filename) { // open file @@ -129,6 +203,8 @@ void ClientFileSendDialog::receiveAck() QString ack = QString::fromUtf8(_socket->readLine()); if (ack != "ok\n") { + _error = true; + _reason = tr("Receiver declined"); qDebug("[%s] Received nack!", metaObject()->className()); close(); return; @@ -160,27 +236,30 @@ void ClientFileSendDialog::sendFile() void ClientFileSendDialog::close() { - if (_file && _file->isOpen()) + if (!_isMulticast) { - _file->close(); - qDebug("[%s] File closed.", metaObject()->className()); + if (_file && _file->isOpen()) + { + _file->close(); + qDebug("[%s] File closed.", metaObject()->className()); + } + + if (_socket && _socket->isOpen()) + { + disconnect(_socket, SIGNAL(readyRead()), this, SLOT(receiveAck())); + disconnect(_socket, SIGNAL(bytesWritten(qint64)), this, SLOT(sendFile())); + disconnect(_socket, SIGNAL(disconnected()), this, SLOT(close())); + disconnect(_socket, SIGNAL(connected()), this, SLOT(sendHeader())); + disconnect(_socket, SIGNAL(error(QAbstractSocket::SocketError)), + this, SLOT(error(QAbstractSocket::SocketError))); + _socket->disconnectFromHost(); + qDebug("[%s] Connection closed.", metaObject()->className()); + } } - if (_socket && _socket->isOpen()) - { - disconnect(_socket, SIGNAL(readyRead()), this, SLOT(receiveAck())); - disconnect(_socket, SIGNAL(bytesWritten(qint64)), this, SLOT(sendFile())); - disconnect(_socket, SIGNAL(disconnected()), this, SLOT(close())); - disconnect(_socket, SIGNAL(connected()), this, SLOT(sendHeader())); - disconnect(_socket, SIGNAL(error(QAbstractSocket::SocketError)), - this, SLOT(error(QAbstractSocket::SocketError))); - _socket->disconnectFromHost(); - qDebug("[%s] Connection closed.", metaObject()->className()); - } - - disconnect(cancelButton, SIGNAL(clicked()), this, SLOT(close())); + disconnect(cancelButton, SIGNAL(clicked()), this, SLOT(canceled())); - if (_bytesToWrite == 0) + if (!_error) { accept(); QMessageBox::information(0, tr("PVS - File Transfer"), @@ -190,12 +269,26 @@ void ClientFileSendDialog::close() { reject(); QMessageBox::warning(0, tr("PVS - File Transfer"), - tr("File Transfer canceled!")); + tr("File Transfer canceled: %1").arg(_reason)); + } +} + +void ClientFileSendDialog::canceled() +{ + if(_isMulticast) + { + _ifaceDBus->cancelOutgoingMulticastTransfer(_transferID); } + + _error = true; + _reason = tr("You clicked 'Cancel'"); + close(); } void ClientFileSendDialog::error(QAbstractSocket::SocketError error) { + _error = true; + _reason = tr("Socket Error"); qDebug("[%s] Socket error: %i", metaObject()->className(), error); close(); } @@ -212,6 +305,55 @@ QString ClientFileSendDialog::formatSize(qint64 size) return QString("%1B").arg((qreal)size, 0, 'f',1); } +void ClientFileSendDialog::multicastTransferStarted(qulonglong transferID) +{ + qDebug() << "multicastTransferStarted(" << transferID << ")"; + if (transferID != _transferID) + { + return; + } + labelStatus->setText("Started"); +} + +void ClientFileSendDialog::multicastTransferProgress(qulonglong transferID, qulonglong bytes, qulonglong of) +{ + qDebug() << "multicastTransferProgress(" << transferID << bytes << of << ")"; + if (transferID != _transferID) + { + return; + } + + if(bytes < of) + { + labelStatus->setText("Transferring"); + progressBar->setRange(0, of); + progressBar->setValue(bytes); + } + else + { + labelStatus->setText("Waiting to finish"); + progressBar->setRange(0, 0); + } + + labelA->setText(formatSize(bytes)); + labelB->setText(formatSize(of)); +} + +void ClientFileSendDialog::multicastTransferFinished(quint64 transferID) +{ + qDebug() << "multicastTransferFinished(" << transferID << ")"; + qDebug("[%s] MulticastTransfer finished", metaObject()->className()); + close(); +} + +void ClientFileSendDialog::multicastTransferFailed(quint64 transferID, QString const& reason) +{ + qDebug() << "multicastTransferFailed(" << transferID << reason << ")"; + _error = true; + _reason = reason; + close(); +} + //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// @@ -235,6 +377,25 @@ ClientNicklistDialog::ClientNicklistDialog(QWidget *parent) : listWidget->addItems(nicknames); listWidget->setCurrentRow(0); + + connect(sendToAllCheckBox, SIGNAL(stateChanged(int)), SLOT(sendToAllStateChanged(int))); + + sendToAllCheckBox->setCheckState(Qt::Unchecked); + _isSendToAll = false; +} + +void ClientNicklistDialog::sendToAllStateChanged(int state) +{ + if (state) + { + listWidget->setEnabled(false); + _isSendToAll = true; + } + else + { + listWidget->setEnabled(true); + _isSendToAll = false; + } } ClientNicklistDialog::~ClientNicklistDialog() diff --git a/src/gui/clientFileSendDialog.h b/src/gui/clientFileSendDialog.h index d8afc3a..7abdcc7 100644 --- a/src/gui/clientFileSendDialog.h +++ b/src/gui/clientFileSendDialog.h @@ -30,9 +30,17 @@ public: ~ClientNicklistDialog(); QString getNick(); + bool isSendToAll() const + { + return _isSendToAll; + } + +private Q_SLOTS: + void sendToAllStateChanged(int state); private: OrgOpenslxPvsInterface *_ifaceDBus; + bool _isSendToAll; }; @@ -51,14 +59,22 @@ public: void open(); void open(QString nick); void open(QString nick, QString filename); + void sendToAll(); + void sendToAll(QString filename); private Q_SLOTS: void sendHeader(); void receiveAck(); void sendFile(); void close(); + void canceled(); void error(QAbstractSocket::SocketError error); + void multicastTransferStarted(qulonglong transferID); + void multicastTransferProgress(qulonglong transferID, qulonglong bytes, qulonglong of); + void multicastTransferFinished(qulonglong transferID); + void multicastTransferFailed(qulonglong transferID, QString const& reason); + private: QString formatSize(qint64 size); @@ -71,6 +87,11 @@ private: OrgOpenslxPvsInterface *_ifaceDBus; QString _nickname; + quint64 _transferID; + bool _error; + QString _reason; + bool _isMulticast; + }; #endif /* CLIENTFILESENDDIALOG_H_ */ diff --git a/src/gui/clientVNCViewer.cpp b/src/gui/clientVNCViewer.cpp index d6a218b..d794b0b 100644 --- a/src/gui/clientVNCViewer.cpp +++ b/src/gui/clientVNCViewer.cpp @@ -22,8 +22,6 @@ ClientVNCViewer::ClientVNCViewer(QWidget *parent) : { // connect to D-Bus and get interface QDBusConnection dbus = QDBusConnection::sessionBus(); - dbus.registerObject("/vnc", this); - dbus.registerService("org.openslx.pvsgui"); _ifaceDBus = new OrgOpenslxPvsInterface("org.openslx.pvs", "/", dbus, this); connect(_ifaceDBus, SIGNAL(project(QString, int, QString, bool, bool, int)), this, SLOT(open(QString, int, QString, bool, bool, int))); diff --git a/src/gui/mainWindow.cpp b/src/gui/mainWindow.cpp index 8a2b512..0f2fd0e 100644 --- a/src/gui/mainWindow.cpp +++ b/src/gui/mainWindow.cpp @@ -10,13 +10,16 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # mainWindow.cpp - This is the Main class for the pvsManager. The GUI is contructed here. + This is the Main class for the pvsManager. The GUI is contructed here. # ----------------------------------------------------------------------------- */ #include <QtGui> #include <QFileDialog> +#include <QBuffer> +#include <QDataStream> #include <src/gui/mainWindow.h> +#include <src/net/mcast/McastConfiguration.h> using namespace std; // setting the IF-DEF Block for the touchgui and the normal gui, for later use @@ -34,134 +37,138 @@ using namespace std; #include <src/gui/profileDialog.h> //#include <src/gui/dialog.h> #include <src/core/pvsConnectionManager.h> +#include <src/gui/multicastConfigDialog.h> #include <iostream> MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), ui(new Ui::MainWindow) + QMainWindow(parent), ui(new Ui::MainWindow) { + ui->setupUi(this); - ui->setupUi(this); + if (!QFile::exists(_settings.fileName())) + { + QDir::root().mkpath(QFileInfo(_settings.fileName()).path()); + QFile::copy("/etc/openslx/pvsmgr.conf", _settings.fileName()); + } - ui->horizontalSlider->setValue(100); - ui->label_2->setText("100"); + ui->horizontalSlider->setValue(100); + ui->label_2->setText("100"); - ui->separator->setVisible(false); + ui->separator->setVisible(false); - myself = this; - conWin = new ConnectionWindow(ui->widget); - ui->VconWinLayout->addWidget(conWin); - conList = new ConnectionList(ui->ClWidget); - ui->ClientGLayout->addWidget(conList); + myself = this; + conWin = new ConnectionWindow(ui->widget); + ui->VconWinLayout->addWidget(conWin); + conList = new ConnectionList(ui->ClWidget); + ui->ClientGLayout->addWidget(conList); - bgimage = false; + bgimage = false; - _aboutDialog = new AboutDialog(this); + _aboutDialog = new AboutDialog(this); - PVSConnectionManager::getManager(); + PVSConnectionManager::getManager(); - //set the maximum width for list content - ui->ClWidget->setMaximumWidth(160); + //set the maximum width for list content + ui->ClWidget->setMaximumWidth(160); - ui->pvsLog->setReadOnly(true); - ui->pvsLog->hide(); + ui->pvsLog->setReadOnly(true); + ui->pvsLog->hide(); - onToggleLog(false); - // add ourself to the log listeners, so we can output them too - ConsoleLog addListener(this, &MainWindow::on_log_line); + onToggleLog(false); + // add ourself to the log listeners, so we can output them too + ConsoleLog addListener(this, &MainWindow::on_log_line); - _firstResize = 1; - _oldRatio = "100"; - _isThumbnailrate = false; - is_closeup = false; - is_fullscreen = false; - _isLockAll = false; - locked = false; + _firstResize = 1; + _oldRatio = "100"; + _isThumbnailrate = false; + is_closeup = false; + is_fullscreen = false; + _isLockAll = false; + locked = false; - /* - * _sessionName: The session name for this Connection - * _pwdCon: Password needed to connect to the session with the name _sessionName - */ - _pwdCon = PVSConnectionManager::getManager()->setNeedPassword(false); - _sessionName = PVSConnectionManager::getManager()->getSessionName(); + /* + * _sessionName: The session name for this Connection + * _pwdCon: Password needed to connect to the session with the name _sessionName + */ + _pwdCon = PVSConnectionManager::getManager()->setNeedPassword(false); + _sessionName = PVSConnectionManager::getManager()->getSessionName(); - ui->setPassword->setCheckState(Qt::Checked); + ui->setPassword->setCheckState(Qt::Checked); #ifdef MAINWINDOW_USE_TOUCHGUI //only used for the touchgui + // define the slots we want to use + connect(ui->comboBox_touch1, SIGNAL(currentIndexChanged(int)), this, SLOT(combobox1(int))); // Combobox 1 verknüpfen mit IndexChangend Signal + connect(ui->comboBox_touch1, SIGNAL(currentIndexChanged(int)), this, SLOT(setindexback())); - // define the slots we want to use - connect(ui->comboBox_touch1, SIGNAL(currentIndexChanged(int)), this, SLOT(combobox1(int))); // Combobox 1 verknüpfen mit IndexChangend Signal - connect(ui->comboBox_touch1, SIGNAL(currentIndexChanged(int)), this, SLOT(setindexback())); - - - connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(createProfile())); // profile button - connect(ui->pushButton_2, SIGNAL(clicked()), this, SLOT(clientlisthide())); // clienlist button - - // toolbar slots - connect(ui->actionresetall, SIGNAL(triggered()), this, SLOT(resetall())); - connect(ui->actionLocksingle, SIGNAL(triggered()), this, SLOT(locksingle())); - connect(ui->actionUnlocksingle, SIGNAL(triggered()), this, SLOT(unlocksingle())); - connect(ui->actionProjection, SIGNAL(triggered()), this, SLOT(projecttoolbar())); - connect(ui->actionUnprojection, SIGNAL(triggered()), this, SLOT(unprojecttoolbar())); - connect(ui->actionDozent, SIGNAL(triggered()), this, SLOT(setdozenttoolbar())); + connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(createProfile())); // profile button + connect(ui->pushButton_2, SIGNAL(clicked()), this, SLOT(clientlisthide())); // clienlist button - // Ui specific settings + // toolbar slots + connect(ui->actionresetall, SIGNAL(triggered()), this, SLOT(resetall())); + connect(ui->actionLocksingle, SIGNAL(triggered()), this, SLOT(locksingle())); + connect(ui->actionUnlocksingle, SIGNAL(triggered()), this, SLOT(unlocksingle())); + connect(ui->actionProjection, SIGNAL(triggered()), this, SLOT(projecttoolbar())); + connect(ui->actionUnprojection, SIGNAL(triggered()), this, SLOT(unprojecttoolbar())); + connect(ui->actionDozent, SIGNAL(triggered()), this, SLOT(setdozenttoolbar())); + connect(ui->actionShowProcesses, SIGNAL(triggered()), this, SLOT(showProcesses())); - ui->ClWidget->hide(); - ui->progressBar->hide(); - ui->pvsLog->hide(); + // Ui specific settings + ui->ClWidget->hide(); + ui->progressBar->hide(); + ui->pvsLog->hide(); #endif - - // toolbar and actions in pvsmgr - connect(ui->action_Exit, SIGNAL(triggered()), this, SLOT(close())); - ui->action_Exit->setStatusTip(tr("Exit")); - connect(ui->action_Disconnect, SIGNAL(triggered()), this, SLOT(disconnect())); - ui->action_Disconnect->setStatusTip(tr("Remove the vnc-Connection for the selected client(s)")); - ui->action_Disconnect->setVisible(false);//we need it only for debug - connect(ui->actionView, SIGNAL(triggered()), this, SLOT(closeUp())); - ui->actionView->setStatusTip(tr("Show the selected client in the whole window")); - connect(ui->actionFoto, SIGNAL(triggered()), this, SLOT(foto())); - connect(ui->actionLock, SIGNAL(triggered()), this, SLOT(lockalltoolbar())); - connect(ui->actionChat, SIGNAL(triggered()), this, SLOT(startChatDialog())); - ui->actionFoto->setStatusTip(tr("Make a screenshot for the selected client(s)")); - ui->actionLock->setStatusTip(tr("Lock or Unlock all Clients")); - connect(ui->actionCreate_profile, SIGNAL(triggered()), this, SLOT(createProfile())); - - connect(ui->actionShow_Username, SIGNAL(triggered()), this, SLOT(showusername())); - connect(ui->actionShow_Hostname_IP, SIGNAL(triggered()), this, SLOT(showip())); - connect(ui->actionShow_Fullname, SIGNAL(triggered()), this, SLOT(showname())); - connect(ui->horizontalSlider, SIGNAL(valueChanged (int)), this, SLOT(changeRatio(int))); - connect(ui->setPassword, SIGNAL(stateChanged (int)), this, SLOT(setPasswordForConnection(int))); - connect(ui->vncQuality, SIGNAL(currentIndexChanged (int)), this, SLOT(setVNCQuality(int))); - connect(ui->thumbStatus, SIGNAL(currentIndexChanged(int)), this, SLOT(changeStatus(int))); - connect(ui->actionShow_Log, SIGNAL(toggled(bool)), this, SLOT(setLogConsoleDisabled(bool))); - connect(ui->actionShow_Network, SIGNAL(toggled(bool)), this, SLOT(onToggleLog(bool))); - connect(ui->actionShow_Chat, SIGNAL(toggled(bool)), this, SLOT(onToggleLog(bool))); - connect(ui->actionShow_Terminal, SIGNAL(toggled(bool)), this, SLOT(onToggleLog(bool))); - connect(ui->actionShow_Normal, SIGNAL(toggled(bool)), this, SLOT(onToggleLog(bool))); - connect(ui->actionShow_Error, SIGNAL(toggled(bool)), this, SLOT(onToggleLog(bool))); - connect(ui->actionAbout_pvs, SIGNAL(triggered()), _aboutDialog, SLOT(open())); - - loadSettings(); //we load the appliocation settings - - setUnifiedTitleAndToolBarOnMac(true); - statusBar()->showMessage(tr("The pvs manager")); - this->showMaximized(); // show the Mainwindow maximized - - // listen on port 29481 for incoming file transfers + // toolbar and actions in pvsmgr + connect(ui->action_Exit, SIGNAL(triggered()), this, SLOT(close())); + ui->action_Exit->setStatusTip(tr("Exit")); + connect(ui->action_Disconnect, SIGNAL(triggered()), this, SLOT(disconnect())); + ui->action_Disconnect->setStatusTip(tr("Remove the vnc-Connection for the selected client(s)")); + ui->action_Disconnect->setVisible(false);//we need it only for debug + connect(ui->actionView, SIGNAL(triggered()), this, SLOT(closeUp())); + ui->actionView->setStatusTip(tr("Show the selected client in the whole window")); + connect(ui->actionFoto, SIGNAL(triggered()), this, SLOT(foto())); + connect(ui->actionLock, SIGNAL(triggered()), this, SLOT(lockalltoolbar())); + connect(ui->actionChat, SIGNAL(triggered()), this, SLOT(startChatDialog())); + ui->actionFoto->setStatusTip(tr("Make a screenshot for the selected client(s)")); + ui->actionLock->setStatusTip(tr("Lock or Unlock all Clients")); + connect(ui->actionCreate_profile, SIGNAL(triggered()), this, SLOT(createProfile())); + connect(ui->actionConfigure_Network, SIGNAL(triggered()), this, SLOT(configureNetwork())); + connect(ui->actionShowProcesses, SIGNAL(triggered()), this, SLOT(showProcesses())); + ui->actionShowProcesses->setStatusTip(tr("Show Processes of the selected Client")); + + connect(ui->actionShow_Username, SIGNAL(triggered()), this, SLOT(showusername())); + connect(ui->actionShow_Hostname_IP, SIGNAL(triggered()), this, SLOT(showip())); + connect(ui->actionShow_Fullname, SIGNAL(triggered()), this, SLOT(showname())); + connect(ui->horizontalSlider, SIGNAL(valueChanged (int)), this, SLOT(changeRatio(int))); + connect(ui->setPassword, SIGNAL(stateChanged (int)), this, SLOT(setPasswordForConnection(int))); + connect(ui->vncQuality, SIGNAL(currentIndexChanged (int)), this, SLOT(setVNCQuality(int))); + connect(ui->thumbStatus, SIGNAL(currentIndexChanged(int)), this, SLOT(changeStatus(int))); + connect(ui->actionShow_Log, SIGNAL(toggled(bool)), this, SLOT(setLogConsoleDisabled(bool))); + connect(ui->actionShow_Network, SIGNAL(toggled(bool)), this, SLOT(onToggleLog(bool))); + connect(ui->actionShow_Chat, SIGNAL(toggled(bool)), this, SLOT(onToggleLog(bool))); + connect(ui->actionShow_Terminal, SIGNAL(toggled(bool)), this, SLOT(onToggleLog(bool))); + connect(ui->actionShow_Normal, SIGNAL(toggled(bool)), this, SLOT(onToggleLog(bool))); + connect(ui->actionShow_Error, SIGNAL(toggled(bool)), this, SLOT(onToggleLog(bool))); + connect(ui->actionAbout_pvs, SIGNAL(triggered()), _aboutDialog, SLOT(open())); + + loadSettings(); //we load the appliocation settings + + setUnifiedTitleAndToolBarOnMac(true); + statusBar()->showMessage(tr("The pvs manager")); + this->showMaximized(); // show the Mainwindow maximized + + // listen on port 29481 for incoming file transfers _serverSocket = new QTcpServer(); _serverSocket->listen(QHostAddress::Any, 29481); connect(_serverSocket, SIGNAL(newConnection()), this, SLOT(incomingFile())); - - } MainWindow::~MainWindow() { - delete ui; + delete ui; } /* @@ -180,38 +187,38 @@ void MainWindow::closeEvent(QCloseEvent *e) MainWindow* MainWindow::getWindow() // catches the window { - if (myself) - { - return myself; - } - else - { - return myself = new MainWindow; - } + if (myself) + { + return myself; + } + else + { + return myself = new MainWindow; + } } ConnectionWindow* MainWindow::getConnectionWindow() // catches the ConnectionWindow { - if (conWin) - { - return conWin; - } - else - { - conWin = new ConnectionWindow; - return conWin; - } + if (conWin) + { + return conWin; + } + else + { + conWin = new ConnectionWindow; + return conWin; + } } ConnectionList* MainWindow::getConnectionList() // catches the ConnectionList { - if (conList) - return conList; - else - { - conList = new ConnectionList; - return conList; - } + if (conList) + return conList; + else + { + conList = new ConnectionList; + return conList; + } } int MainWindow::getConnectionWindowWidth() // returns the width of the ConnectionWindow @@ -226,9 +233,9 @@ int MainWindow::getConnectionWindowHeight() // returns the height of the Coonect QStringList MainWindow::getProfilList() // loads the profile list { - QSettings settings("openslx", "pvsmgr"); - profilList = settings.childGroups(); - return profilList; + QSettings settings("openslx", "pvsmgr"); + profilList = settings.childGroups(); + return profilList; } #ifdef MAINWINDOW_USE_NORMALGUI @@ -254,70 +261,63 @@ void MainWindow::removeProfileInMenu(QString name) #endif void MainWindow::loadSettings() { - QSettings settings("openslx", "pvsmgr"); - QString current = settings.value("current", "default").toString(); - currentProfi = current; - _profilName = current; + QSettings settings("openslx", "pvsmgr"); + QString current = settings.value("current", "default").toString(); + currentProfi = current; + _profilName = current; - //When no profile is available, we define a default one whith 9 dummy screens - if (current.compare("default") == 0) - { - setWindowTitle("PVSmgr - Default"); - QPoint pos1 = settings.value("default/1", QPoint(0, 0)).toPoint(); - MainWindow::getConnectionWindow()->addFrameBySettings("1", pos1); - QPoint pos2 = - settings.value("default/2", QPoint(194, 0)).toPoint(); - MainWindow::getConnectionWindow()->addFrameBySettings("2", pos2); - QPoint pos3 = - settings.value("default/3", QPoint(388, 0)).toPoint(); - MainWindow::getConnectionWindow()->addFrameBySettings("3", pos3); - QPoint pos4 = - settings.value("default/4", QPoint(582, 0)).toPoint(); - MainWindow::getConnectionWindow()->addFrameBySettings("4", pos4); - QPoint pos5 = - settings.value("default/5", QPoint(0, 173)).toPoint(); - MainWindow::getConnectionWindow()->addFrameBySettings("5", pos5); - QPoint pos6 = - settings.value("default/6", QPoint(194, 173)).toPoint(); - MainWindow::getConnectionWindow()->addFrameBySettings("6", pos6); - QPoint pos7 = - settings.value("default/7", QPoint(388, 173)).toPoint(); - MainWindow::getConnectionWindow()->addFrameBySettings("7", pos7); - QPoint pos8 = - settings.value("default/8", QPoint(582, 173)).toPoint(); - MainWindow::getConnectionWindow()->addFrameBySettings("8", pos8); - QPoint pos9 = - settings.value("default/9", QPoint(293, 346)).toPoint(); - MainWindow::getConnectionWindow()->addFrameBySettings("9", pos9); - - QString title = "PVSmgr - "; + //When no profile is available, we define a default one whith 9 dummy screens + if (current.compare("default") == 0) + { + setWindowTitle("PVSmgr - Default"); + QPoint pos1 = settings.value("default/1", QPoint(0, 0)).toPoint(); + MainWindow::getConnectionWindow()->addFrameBySettings("1", pos1); + QPoint pos2 = settings.value("default/2", QPoint(194, 0)).toPoint(); + MainWindow::getConnectionWindow()->addFrameBySettings("2", pos2); + QPoint pos3 = settings.value("default/3", QPoint(388, 0)).toPoint(); + MainWindow::getConnectionWindow()->addFrameBySettings("3", pos3); + QPoint pos4 = settings.value("default/4", QPoint(582, 0)).toPoint(); + MainWindow::getConnectionWindow()->addFrameBySettings("4", pos4); + QPoint pos5 = settings.value("default/5", QPoint(0, 173)).toPoint(); + MainWindow::getConnectionWindow()->addFrameBySettings("5", pos5); + QPoint pos6 = settings.value("default/6", QPoint(194, 173)).toPoint(); + MainWindow::getConnectionWindow()->addFrameBySettings("6", pos6); + QPoint pos7 = settings.value("default/7", QPoint(388, 173)).toPoint(); + MainWindow::getConnectionWindow()->addFrameBySettings("7", pos7); + QPoint pos8 = settings.value("default/8", QPoint(582, 173)).toPoint(); + MainWindow::getConnectionWindow()->addFrameBySettings("8", pos8); + QPoint pos9 = settings.value("default/9", QPoint(293, 346)).toPoint(); + MainWindow::getConnectionWindow()->addFrameBySettings("9", pos9); + + QString title = "PVSmgr - "; title.append(_profilName); - title.append(" ["+_sessionName + " : "); - title.append(_pwdCon+"]"); + title.append(" [" + _sessionName + " : "); + title.append(_pwdCon + "]"); setWindowTitle(title); - } - else - { - QString title = "PVSmgr - "; + } + else + { + QString title = "PVSmgr - "; title.append(_profilName); - title.append(" ["+_sessionName + " : "); - title.append(_pwdCon+"]"); + title.append(" [" + _sessionName + " : "); + title.append(_pwdCon + "]"); setWindowTitle(title); - settings.beginGroup(current); - QStringList keys = settings.childKeys(); - for (int i=0; i<keys.size(); i++) - { - QString profil = current; - profil = profil.append("/").append(keys.at(i)); - QPoint pos = settings.value(keys.at(i)).toPoint(); - MainWindow::getConnectionWindow()->addFrameBySettings(keys.at(i), pos); - } - } + settings.beginGroup(current); + QStringList keys = settings.childKeys(); + for (int i = 0; i < keys.size(); i++) + { + QString profil = current; + profil = profil.append("/").append(keys.at(i)); + QPoint pos = settings.value(keys.at(i)).toPoint(); + MainWindow::getConnectionWindow()->addFrameBySettings(keys.at(i), + pos); + } + } - MainWindow::getConnectionWindow()->showFrameFromSettings(); + MainWindow::getConnectionWindow()->showFrameFromSettings(); #ifdef MAINWINDOW_USE_NORMALGUI - foreach (QString profile, getProfilList()) - addProfileInMenu(profile); + foreach (QString profile, getProfilList()) + addProfileInMenu(profile); #endif } @@ -329,17 +329,17 @@ void MainWindow::loadProfile(QAction* actiontriggered) void MainWindow::loadSettings(QString profilname) // loads the current profile { - QList<ConnectionFrame*> AllFrameOnWindow = - MainWindow::getConnectionWindow()->getAllFrameOnWindow(); + QList<ConnectionFrame*> AllFrameOnWindow = + MainWindow::getConnectionWindow()->getAllFrameOnWindow(); - if (AllFrameOnWindow.size() > 0) - { - _profilName = profilname; - MainWindow::getConnectionWindow()->ClientLocationList.clear(); - QSettings settings("openslx", "pvsmgr"); - settings.setValue("current", _profilName); - ConnectionFrame* cFrame; - foreach (cFrame, AllFrameOnWindow) + if (AllFrameOnWindow.size() > 0) + { + _profilName = profilname; + MainWindow::getConnectionWindow()->ClientLocationList.clear(); + QSettings settings("openslx", "pvsmgr"); + settings.setValue("current", _profilName); + ConnectionFrame* cFrame; + foreach (cFrame, AllFrameOnWindow) { if (cFrame->isDummy()) { @@ -348,90 +348,91 @@ void MainWindow::loadSettings(QString profilname) // loads the current profile cFrame->deleteLater(); } } - settings.beginGroup(_profilName); - QStringList keys = settings.childKeys(); - int rest = AllFrameOnWindow.size(); - int init = 1; - for (int i = 0; i < keys.size(); i++) - { - if (init <= rest) - { - ConnectionFrame* cF = AllFrameOnWindow.at(i); - QString profil = _profilName; - profil = profil.append("/").append(cF->getTaskbarTitle()); - if (!cF->isDummy()) - cF->move(settings.value(keys.at(i)).toPoint()); - else - cF->move(settings.value(profil, QPoint(10,(10+(5*i)))).toPoint()); - - init += 1; - } - else - { - MainWindow::getConnectionWindow()->addFrameBySettings( - keys.at(i), settings.value(keys.at(i)).toPoint()); - } - } - - MainWindow::getConnectionWindow()->showFrameFromSettings(); - - QString title = "PVSmgr - "; - title.append(_profilName); - title.append(" ["+_sessionName + " : "); - title.append(_pwdCon+"]"); - setWindowTitle(title); - } + settings.beginGroup(_profilName); + QStringList keys = settings.childKeys(); + int rest = AllFrameOnWindow.size(); + int init = 1; + for (int i = 0; i < keys.size(); i++) + { + if (init <= rest) + { + ConnectionFrame* cF = AllFrameOnWindow.at(i); + QString profil = _profilName; + profil = profil.append("/").append(cF->getTaskbarTitle()); + if (!cF->isDummy()) + cF->move(settings.value(keys.at(i)).toPoint()); + else + cF->move( + settings.value(profil, QPoint(10, (10 + (5 * i)))).toPoint()); + + init += 1; + } + else + { + MainWindow::getConnectionWindow()->addFrameBySettings( + keys.at(i), settings.value(keys.at(i)).toPoint()); + } + } + + MainWindow::getConnectionWindow()->showFrameFromSettings(); + + QString title = "PVSmgr - "; + title.append(_profilName); + title.append(" [" + _sessionName + " : "); + title.append(_pwdCon + "]"); + setWindowTitle(title); + } } void MainWindow::saveSettings(QString profilname) { - QList<ConnectionFrame*> AllFrameOnWindow = - MainWindow::getConnectionWindow()->getAllFrameOnWindow(); - QSettings settings("openslx", "pvsmgr"); - settings.setValue("current", profilname); - settings.setValue("size", QString("%1").arg(AllFrameOnWindow.size())); + QList<ConnectionFrame*> AllFrameOnWindow = + MainWindow::getConnectionWindow()->getAllFrameOnWindow(); + QSettings settings("openslx", "pvsmgr"); + settings.setValue("current", profilname); + settings.setValue("size", QString("%1").arg(AllFrameOnWindow.size())); - for (int i = 0; i < AllFrameOnWindow.size(); i++) - { - ConnectionFrame* current = AllFrameOnWindow.at(i); - QString profil = ""; - profil = settings.value("current").toString().append("/"); - if (!current->isDummy()) - profil.append(QString(current->getTaskbarTitle())); - else - profil.append(QString("%1").arg(i + 1)); - settings.setValue(profil, current->pos()); - } + for (int i = 0; i < AllFrameOnWindow.size(); i++) + { + ConnectionFrame* current = AllFrameOnWindow.at(i); + QString profil = ""; + profil = settings.value("current").toString().append("/"); + if (!current->isDummy()) + profil.append(QString(current->getTaskbarTitle())); + else + profil.append(QString("%1").arg(i + 1)); + settings.setValue(profil, current->pos()); + } #ifdef MAINWINDOW_USE_NORMALGUI -addProfileInMenu(profilname); + addProfileInMenu(profilname); #endif } void MainWindow::removeProfil(QString profilname) { - QSettings settings("openslx", "pvsmgr"); - settings.remove(profilname); + QSettings settings("openslx", "pvsmgr"); + settings.remove(profilname); #ifdef MAINWINDOW_USE_NORMALGUI -removeProfileInMenu(profilname); + removeProfileInMenu(profilname); #endif } void MainWindow::addConnection(PVSClient* newCon) { - conWin->addConnection(newCon); - if (!_chatListClients.contains(newCon->getUserName())) - { - _chatListClients.append(newCon->getUserName()); - sChatDialog.chat_client_add(newCon->getUserName()); - sChatDialog.chat_nicklist_update(); - } - // sChatDialog->chat_nicklist_update(newCon->getUserName()); + conWin->addConnection(newCon); + if (!_chatListClients.contains(newCon->getUserName())) + { + _chatListClients.append(newCon->getUserName()); + sChatDialog.chat_client_add(newCon->getUserName()); + sChatDialog.chat_nicklist_update(); + } + // sChatDialog->chat_nicklist_update(newCon->getUserName()); } void MainWindow::removeConnection(PVSClient* newCon) { - conWin->removeConnection(newCon); - if (_chatListClients.contains(newCon->getUserName())) + conWin->removeConnection(newCon); + if (_chatListClients.contains(newCon->getUserName())) { _chatListClients.removeOne(newCon->getUserName()); sChatDialog.chat_client_remove(newCon->getUserName()); @@ -442,87 +443,87 @@ void MainWindow::removeConnection(PVSClient* newCon) void MainWindow::onConnectionFailed(QString host) { #ifdef never - // code is voided because the info-management will be overhauled sometime + // code is voided because the info-management will be overhauled sometime - if (pwDiag) // assume this thing failed after the pw-question... so a wrong password, ey? + if (pwDiag) // assume this thing failed after the pw-question... so a wrong password, ey? - { - onPasswordFailed(host); - return; - } + { + onPasswordFailed(host); + return; + } - QString caption, secondary; - if (host != "") - { - caption = ("PVSConnection with hostname \""); - caption.append(host); - caption.append("\" failed."); - secondary = "PVSConnection attempt for this hostname failed.Maybe the host is not prepared to accept vnc connections. Please make sure hostname and (if needed) password are correct."; - } - else - { - caption = "No IP given"; - secondary = "PVSConnection attempt for this host failed. There was either no or an errorous Hostname given."; - } - QMessageBox::information(*this, caption, secondary); - /* Gtk::MessageDialog dialog(*this, Glib::ustring(caption)); - dialog.set_secondary_text(secondary); - dialog.run();*/ + QString caption, secondary; + if (host != "") + { + caption = ("PVSConnection with hostname \""); + caption.append(host); + caption.append("\" failed."); + secondary = "PVSConnection attempt for this hostname failed.Maybe the host is not prepared to accept vnc connections. Please make sure hostname and (if needed) password are correct."; + } + else + { + caption = "No IP given"; + secondary = "PVSConnection attempt for this host failed. There was either no or an errorous Hostname given."; + } + QMessageBox::information(*this, caption, secondary); + /* Gtk::MessageDialog dialog(*this, Glib::ustring(caption)); + dialog.set_secondary_text(secondary); + dialog.run();*/ #endif } void MainWindow::onConnectionTerminated(PVSClient* newConnection) { #ifdef never - // code is voided because the info-management will be overhauled sometime + // code is voided because the info-management will be overhauled sometime - QString host; - if (newConnection) - { - host = newConnection->getIp(); // copy hostname for message - } - else - host = "spooky unknown"; + QString host; + if (newConnection) + { + host = newConnection->getIp(); // copy hostname for message + } + else + host = "spooky unknown"; - // now inform - QString caption, secondary; + // now inform + QString caption, secondary; - caption = "Hostname \""; - caption.append(host); - caption.append("\" terminated connection."); - secondary = "The server has closed the connection to your client."; + caption = "Hostname \""; + caption.append(host); + caption.append("\" terminated connection."); + secondary = "The server has closed the connection to your client."; - QMessageBox::information(*this, caption, secondary); - /*Gtk::MessageDialog dialog(*this, Glib::ustring(caption)); - dialog.set_secondary_text(secondary); - dialog.run();*/ + QMessageBox::information(*this, caption, secondary); + /*Gtk::MessageDialog dialog(*this, Glib::ustring(caption)); + dialog.set_secondary_text(secondary); + dialog.run();*/ #endif } void MainWindow::onConnectionRemoved(PVSClient* newConnection) { - // TODO this would be the place to handle the rest of the fullscreen issue - conWin->onConnectionRemoved(newConnection); + // TODO this would be the place to handle the rest of the fullscreen issue + conWin->onConnectionRemoved(newConnection); } void MainWindow::onPasswordFailed(QString Qhost) { #ifdef never - // code is voided because the info-management will be overhauled sometime - QString caption, secondary; - if (Qhost != "") - { - caption = "Hostname \""; - caption.append(Qhost); - caption.append("\" refused password."); - secondary = "You have entered no or a wrong password."; - } - else - return; // unknown connection was terminated? too spooky - QMessageBox::information(*this, caption, secondary); - /* Gtk::MessageDialog dialog(*this, Glib::ustring(caption)); - dialog.set_secondary_text(secondary); - Gtk::Main::run(dialog);*/ + // code is voided because the info-management will be overhauled sometime + QString caption, secondary; + if (Qhost != "") + { + caption = "Hostname \""; + caption.append(Qhost); + caption.append("\" refused password."); + secondary = "You have entered no or a wrong password."; + } + else + return; // unknown connection was terminated? too spooky + QMessageBox::information(*this, caption, secondary); + /* Gtk::MessageDialog dialog(*this, Glib::ustring(caption)); + dialog.set_secondary_text(secondary); + Gtk::Main::run(dialog);*/ #endif } @@ -538,41 +539,41 @@ void MainWindow::receiveChatMsg(QString nick_from, QString nick_to, QString msg) int MainWindow::getPrevWidth() // PVSConnectionManager::getManager()->getPrevWidth() { - return prev_width; + return prev_width; } void MainWindow::setPrevWidth(int newWidth) { - if (newWidth > 100) - prev_width = newWidth; - else - prev_width = 100; + if (newWidth > 100) + prev_width = newWidth; + else + prev_width = 100; } int MainWindow::getPrevHeight() { - return prev_height; + return prev_height; } void MainWindow::setPrevHeight(int newHeight) { - if (newHeight > 100) - prev_height = newHeight; - else - prev_height = 100; + if (newHeight > 100) + prev_height = newHeight; + else + prev_height = 100; } void MainWindow::changeEvent(QEvent *e) { - QMainWindow::changeEvent(e); - switch (e->type()) - { - case QEvent::LanguageChange: - ui->retranslateUi(this); - break; - default: - break; - } + QMainWindow::changeEvent(e); + switch (e->type()) + { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } } /* @@ -586,107 +587,108 @@ void MainWindow::changeEvent(QEvent *e) void MainWindow::resizeEvent(QResizeEvent *event) { - if (bgimage == true){ - repaintbackgroundpicture(); // repaint the backgroundpicture scaled to the window size + if (bgimage == true) + { + repaintbackgroundpicture(); // repaint the backgroundpicture scaled to the window size } if (_firstResize == 3) { QSize oldSize = event->oldSize(); - _initW = ui->widget->width(); - _initH = ui->widget->height(); + _initW = ui->widget->width(); + _initH = ui->widget->height(); _firstResize++; } - std::list<QString>* selectedClients = - MainWindow::getConnectionList()->getSelectedClients(); - if (is_closeup && selectedClients->size() == 1) - { - PVSClient* pvsClient = - PVSConnectionManager::getManager()->getClientFromIp( - selectedClients->front().toStdString().c_str()); - pvsClient->getConnectionFrame()->paintCloseUp(ui->widget->width(), - ui->widget->height()); - } - else if (!is_closeup && _firstResize > 3) - { - int ratio_w = (ui->widget->width()*100)/_initW; - int ratio_h = (ui->widget->height()*100)/_initH; - foreach (ConnectionFrame* cf, getConnectionWindow()->getFrameList()) - { - /*int margin = ui->widget->style()->pixelMetric(QStyle::PM_DefaultTopLevelMargin); - int x = ui->widget->width() - margin; - int y = ui->widget->height() - margin; - updatePos(cf, x, y);*/ - int w = (cf->init_w * ratio_w) / 100; - int h = (cf->init_h * ratio_h) / 100; - cf->paintCloseUp(w,h); - } - } + std::list<QString>* selectedClients = + MainWindow::getConnectionList()->getSelectedClients(); + if (is_closeup && selectedClients->size() == 1) + { + PVSClient* pvsClient = + PVSConnectionManager::getManager()->getClientFromIp( + selectedClients->front().toStdString().c_str()); + pvsClient->getConnectionFrame()->paintCloseUp(ui->widget->width(), + ui->widget->height()); + } + else if (!is_closeup && _firstResize > 3) + { + int ratio_w = (ui->widget->width() * 100) / _initW; + int ratio_h = (ui->widget->height() * 100) / _initH; +foreach (ConnectionFrame* cf, getConnectionWindow()->getFrameList()) + { + /*int margin = ui->widget->style()->pixelMetric(QStyle::PM_DefaultTopLevelMargin); + int x = ui->widget->width() - margin; + int y = ui->widget->height() - margin; + updatePos(cf, x, y);*/ + int w = (cf->init_w * ratio_w) / 100; + int h = (cf->init_h * ratio_h) / 100; + cf->paintCloseUp(w,h); + } +} - if (_firstResize < 3) - _firstResize++; +if (_firstResize < 3) +_firstResize++; } void MainWindow::updatePos(ConnectionFrame* cf, int x, int y) { - int posx = (x*cf->pos().x())/_initW; - int posy = (y*cf->pos().y())/_initH; + int posx = (x * cf->pos().x()) / _initW; + int posy = (y * cf->pos().y()) / _initH; cf->move(posx, posy); /*QSize size = cf->sizeHint(); - cf->setGeometry(x - size.rwidth(), y - size.rheight(), - size.rwidth(), size.rheight());*/ + cf->setGeometry(x - size.rwidth(), y - size.rheight(), + size.rwidth(), size.rheight());*/ } void MainWindow::on_log_line(LogEntry consoleEntry) { - ConsoleLogger::LOG_LEVEL level = consoleEntry.getLevel(); - if (level == ConsoleLogger::LOG_ERROR && !showError) - return; - if (level == ConsoleLogger::LOG_NORMAL && !showNormal) - return; - if (level == ConsoleLogger::LOG_NETWORK && !showNetwork) - return; - if (level == ConsoleLogger::LOG_TERMINAL && !showTerminal) - return; - if (level == ConsoleLogger::LOG_CHAT && !showChat) - return; - - ui->pvsLog->insertPlainText(consoleEntry.getLine()); + ConsoleLogger::LOG_LEVEL level = consoleEntry.getLevel(); + if (level == ConsoleLogger::LOG_ERROR && !showError) + return; + if (level == ConsoleLogger::LOG_NORMAL && !showNormal) + return; + if (level == ConsoleLogger::LOG_NETWORK && !showNetwork) + return; + if (level == ConsoleLogger::LOG_TERMINAL && !showTerminal) + return; + if (level == ConsoleLogger::LOG_CHAT && !showChat) + return; + + ui->pvsLog->insertPlainText(consoleEntry.getLine()); } void MainWindow::onToggleLog(bool showtime) { - if (showtime) - ;//to kill the system warning due "unused variable" - showError = ui->actionShow_Error->isChecked(); - showTerminal = ui->actionShow_Terminal->isChecked(); - showNetwork = ui->actionShow_Network->isChecked(); - showChat = ui->actionShow_Chat->isChecked(); - showNormal = ui->actionShow_Normal->isChecked(); - //showAtAll = ui->logAtAllAction->get_active(); + if (showtime) + ;//to kill the system warning due "unused variable" + showError = ui->actionShow_Error->isChecked(); + showTerminal = ui->actionShow_Terminal->isChecked(); + showNetwork = ui->actionShow_Network->isChecked(); + showChat = ui->actionShow_Chat->isChecked(); + showNormal = ui->actionShow_Normal->isChecked(); + //showAtAll = ui->logAtAllAction->get_active(); - ConsoleLog dump2Listener(this, &MainWindow::on_log_line); + ConsoleLog dump2Listener(this, &MainWindow::on_log_line); } void MainWindow::setLogConsoleDisabled(bool visible) { - if (!visible) - ui->pvsLog->hide(); - else - ui->pvsLog->show(); + if (!visible) + ui->pvsLog->hide(); + else + ui->pvsLog->show(); } /*void MainWindow::close() -{ - //sChatDialog.close(); - QApplication::closeAllWindows(); -}*/ + { + //sChatDialog.close(); + QApplication::closeAllWindows(); + }*/ void MainWindow::disconnect() { - conWin->removeVNC(); + conWin->removeVNC(); } void MainWindow::lockUnlockAll() @@ -707,122 +709,153 @@ void MainWindow::lockUnlockAll() void MainWindow::closeUp() { - std::list<QString>* selectedClients = - MainWindow::getConnectionList()->getSelectedClients(); - if (!is_closeup) - { - if (selectedClients->size() == 1) - { - PVSClient - * pvsClient = - PVSConnectionManager::getManager()->getClientFromIp( - selectedClients->front().toStdString().c_str()); - _framePosOnCloseUp = pvsClient->getConnectionFrame()->pos();//get the actualy position before run closeup - if (pvsClient->getVNCConnection()) - { - conWin->setCloseupFrame(pvsClient->getConnectionFrame()); - _updatefreq = pvsClient->getConnectionFrame()->getFrame()->getVNCClientThread()->getUpdatefreq(); - pvsClient->getConnectionFrame()->getFrame()->getVNCClientThread()->setUpdatefreq(50); - pvsClient->getConnectionFrame()->move(5,5); - pvsClient->getConnectionFrame()->setWindowFlags(Qt::WindowStaysOnTopHint); + std::list<QString>* selectedClients = + MainWindow::getConnectionList()->getSelectedClients(); + if (!is_closeup) + { + if (selectedClients->size() == 1) + { + PVSClient * pvsClient = + PVSConnectionManager::getManager()->getClientFromIp( + selectedClients->front().toStdString().c_str()); + _framePosOnCloseUp = pvsClient->getConnectionFrame()->pos();//get the actualy position before run closeup + if (pvsClient->getVNCConnection()) + { + conWin->setCloseupFrame(pvsClient->getConnectionFrame()); + _updatefreq + = pvsClient->getConnectionFrame()->getFrame()->getVNCClientThread()->getUpdatefreq(); + pvsClient->getConnectionFrame()->getFrame()->getVNCClientThread()->setUpdatefreq( + 50); + pvsClient->getConnectionFrame()->move(5, 5); + pvsClient->getConnectionFrame()->setWindowFlags( + Qt::WindowStaysOnTopHint); pvsClient->getConnectionFrame()->raise(); - pvsClient->getConnectionFrame()->paintCloseUp(ui->widget->width(),ui->widget->height()); + pvsClient->getConnectionFrame()->paintCloseUp( + ui->widget->width(), ui->widget->height()); is_closeup = true; conWin->setCloseupFrame(pvsClient->getConnectionFrame()); } - } - else - { - QString - message = - QString( - tr( - "This operation can only be performed for one selected Client!")); - QMessageBox::information(this, "PVS", message); - } - } - else - { - if (conWin->getCloseupFrame()) - { - /*PVSClient* pvsClient = - PVSConnectionManager::getManager()->getClientFromIp( - selectedClients->front().toStdString().c_str());*/ - conWin->getCloseupFrame()->setWindowFlags(Qt::Widget); - conWin->getCloseupFrame()->paintCloseUp(conWin->getCloseupFrame()->getPrevWidth(), conWin->getCloseupFrame()->getPrevHeight()); - conWin->getCloseupFrame()->move(_framePosOnCloseUp);//back to the position before the closeup - if (conWin->getCloseupFrame()->getConnection()->getVNCConnection()) - conWin->getCloseupFrame()->getFrame()->getVNCClientThread()->setUpdatefreq(_updatefreq); - conWin->setCloseupFrame(NULL); - } - - is_closeup = false; - } + } + else + { + QString + message = + QString( + tr( + "This operation can only be performed for one selected Client!")); + QMessageBox::information(this, "PVS", message); + } + } + else if (conWin->getCloseupFrame()) + { + /*PVSClient* pvsClient = + PVSConnectionManager::getManager()->getClientFromIp( + selectedClients->front().toStdString().c_str());*/ + conWin->getCloseupFrame()->setWindowFlags(Qt::Widget); + conWin->getCloseupFrame()->paintCloseUp( + conWin->getCloseupFrame()->getPrevWidth(), + conWin->getCloseupFrame()->getPrevHeight()); + conWin->getCloseupFrame()->move(_framePosOnCloseUp);//back to the position before the closeup + if (conWin->getCloseupFrame()->getConnection()->getVNCConnection()) + conWin->getCloseupFrame()->getFrame()->getVNCClientThread()->setUpdatefreq( + _updatefreq); + + is_closeup = false; + conWin->setCloseupFrame(NULL); + } +} + +/* Perform some action if actionShowProcesses button was pressed + * + */ +void MainWindow::showProcesses() +{ + std::list<QString>* selectedClients = + MainWindow::getConnectionList()->getSelectedClients(); + if (selectedClients->size() == 1) + { + // do stuff + PVSClient * pvsClient = + PVSConnectionManager::getManager()->getClientFromIp( + selectedClients->front().toStdString().c_str()); + pvsClient->sendMessage(PVSCOMMAND, "SHOWPROCESSES", ""); + } + else + { + QString + message = + QString( + tr( + "This operation can only be performed if you have selected a Client!")); + QMessageBox::information(this, "PVS", message); + } } void MainWindow::foto() // makes a screenshot of the selected client { - std::list<QString>* selectedClients = - MainWindow::getConnectionList()->getSelectedClients(); - if (selectedClients->size() > 0) - { - QString format = "png"; - for (std::list<QString>::iterator tmpIt = selectedClients->begin(); tmpIt - != selectedClients->end(); tmpIt++) - { - - QString path = QDir::homePath().append("/").append(*tmpIt).append( - ".png"); - PVSClient - * pvsClient = - PVSConnectionManager::getManager()->getClientFromIp( - (*tmpIt).toUtf8().data()); - if (pvsClient->getVNCConnection()) - { - const QImage img = pvsClient->getConnectionFrame()->getFrame()->getImageForFoto(); - if (!img.isNull()) - img.save(path, format.toAscii()); - } - else printf("Cannot save screen: Image is null.\n"); - } - } - else - { - QString - message = - QString( - tr( - "This operation can only be performed for at least one selected Client!")); - QMessageBox::information(this, "PVS", message); - } + std::list<QString>* selectedClients = + MainWindow::getConnectionList()->getSelectedClients(); + if (selectedClients->size() > 0) + { + QString format = "png"; + for (std::list<QString>::iterator tmpIt = selectedClients->begin(); tmpIt + != selectedClients->end(); tmpIt++) + { + + QString path = QDir::homePath().append("/").append(*tmpIt).append( + ".png"); + PVSClient * pvsClient = + PVSConnectionManager::getManager()->getClientFromIp( + (*tmpIt).toUtf8().data()); + if (pvsClient->getVNCConnection()) + { + const QImage + img = + pvsClient->getConnectionFrame()->getFrame()->getImageForFoto(); + if (!img.isNull()) + img.save(path, format.toAscii()); + } + else + qDebug("Cannot save screen: Image is null."); + } + } + else + { + QString + message = + QString( + tr( + "This operation can only be performed for at least one selected Client!")); + QMessageBox::information(this, "PVS", message); + } } void MainWindow::createProfile() { - profileDialog proDiag; - proDiag.exec(); + profileDialog proDiag; + proDiag.exec(); } void MainWindow::showusername() { - MainWindow::getConnectionList()->setColumnHidden(2, false); - MainWindow::getConnectionList()->setColumnHidden(0, true); - MainWindow::getConnectionList()->setColumnHidden(1, true); + MainWindow::getConnectionList()->setColumnHidden(2, false); + MainWindow::getConnectionList()->setColumnHidden(0, true); + MainWindow::getConnectionList()->setColumnHidden(1, true); } void MainWindow::showname() { - MainWindow::getConnectionList()->setColumnHidden(0, false); - MainWindow::getConnectionList()->setColumnHidden(1, true); - MainWindow::getConnectionList()->setColumnHidden(2, true); + MainWindow::getConnectionList()->setColumnHidden(0, false); + MainWindow::getConnectionList()->setColumnHidden(1, true); + MainWindow::getConnectionList()->setColumnHidden(2, true); } void MainWindow::showip() { - MainWindow::getConnectionList()->setColumnHidden(1, false); - MainWindow::getConnectionList()->setColumnHidden(2, true); - MainWindow::getConnectionList()->setColumnHidden(0, true); + MainWindow::getConnectionList()->setColumnHidden(1, false); + MainWindow::getConnectionList()->setColumnHidden(2, true); + MainWindow::getConnectionList()->setColumnHidden(0, true); } void MainWindow::incomingFile() @@ -841,15 +874,16 @@ void MainWindow::changeRatio(int ratio) // needed the change the size of the vnc str.append(QString("%1").arg(ratio)); ui->label_2->setText(str); - std::list<QString>* selClients = getConnectionList()->getSelectedClients(); + std::list<QString>* selClients = + getConnectionList()->getSelectedClients(); if (selClients->size() > 0) { for (std::list<QString>::iterator client = selClients->begin(); client != selClients->end(); client++) { PVSClient* pvsClient = - PVSConnectionManager::getManager()->getClientFromIp( - (*client).toUtf8().data()); + PVSConnectionManager::getManager()->getClientFromIp( + (*client).toUtf8().data()); ConnectionFrame *frame = pvsClient->getConnectionFrame(); int w = (frame->init_w * ratio) / 100; int h = (frame->init_h * ratio) / 100; @@ -864,46 +898,46 @@ void MainWindow::changeRatio(int ratio) // needed the change the size of the vnc QList<ConnectionFrame *> frameList = MainWindow::getConnectionWindow()->getFrameList(); ConnectionFrame *frame; - foreach(frame, frameList) - { - int w = (frame->init_w * ratio) / 100; - int h = (frame->init_h * ratio) / 100; - frame->setPrevWidth(w); - frame->setPrevHeight(h); - frame->paintCloseUp(w, h); - } +foreach (frame, frameList) + { + int w = (frame->init_w * ratio) / 100; + int h = (frame->init_h * ratio) / 100; + frame->setPrevWidth(w); + frame->setPrevHeight(h); + frame->paintCloseUp(w, h); } } - else +} +else +{ + int updatefreq = (ratio*500)/100; + QString str; + str.append(QString("%1").arg(updatefreq)); + ui->label_2->setText(str); + std::list<QString>* selClients = getConnectionList()->getSelectedClients(); + if (selClients->size() > 0) { - int updatefreq = (ratio*500)/100; - QString str; - str.append(QString("%1").arg(updatefreq)); - ui->label_2->setText(str); - std::list<QString>* selClients = getConnectionList()->getSelectedClients(); - if (selClients->size() > 0) + for (std::list<QString>::iterator client = selClients->begin(); client + != selClients->end(); client++) { - for (std::list<QString>::iterator client = selClients->begin(); client - != selClients->end(); client++) - { - PVSClient* pvsClient = - PVSConnectionManager::getManager()->getClientFromIp( - (*client).toUtf8().data()); - if (pvsClient->getVNCConnection()) - pvsClient->getConnectionFrame()->getFrame()->getVNCClientThread()->setUpdatefreq(updatefreq); - } + PVSClient* pvsClient = + PVSConnectionManager::getManager()->getClientFromIp( + (*client).toUtf8().data()); + if (pvsClient->getVNCConnection()) + pvsClient->getConnectionFrame()->getFrame()->getVNCClientThread()->setUpdatefreq(updatefreq); } - else + } + else + { + std::list<PVSClient*> clients = PVSConnectionManager::getManager()->getConnections(); + foreach (PVSClient* client, clients) { - std::list<PVSClient*> clients = PVSConnectionManager::getManager()->getConnections(); - foreach (PVSClient* client, clients) - { - if (client->getVNCConnection()) - client->getConnectionFrame()->getFrame()->getVNCClientThread()->setUpdatefreq(updatefreq); - } + if (client->getVNCConnection()) + client->getConnectionFrame()->getFrame()->getVNCClientThread()->setUpdatefreq(updatefreq); } - } + +} } /* @@ -917,18 +951,19 @@ void MainWindow::changeRatio(int ratio) // needed the change the size of the vnc */ void MainWindow::changeStatus(int index) { - QString status = ui->thumbStatus->currentText (); + QString status = ui->thumbStatus->currentText(); if (status == "Thumbnailratio") { _isThumbnailrate = false; ui->label_3->setText("%"); - std::list<QString>* selClients = getConnectionList()->getSelectedClients(); + std::list<QString>* selClients = + getConnectionList()->getSelectedClients(); if (selClients->size() == 1) { PVSClient* pvsClient = - PVSConnectionManager::getManager()->getClientFromIp( - selClients->front().toStdString().c_str()); + PVSConnectionManager::getManager()->getClientFromIp( + selClients->front().toStdString().c_str()); int ratio = pvsClient->getConnectionFrame()->getRatio(); ui->label_2->setText(QString::number(ratio)); ui->horizontalSlider->setValue(ratio); @@ -944,16 +979,19 @@ void MainWindow::changeStatus(int index) { _isThumbnailrate = true; ui->label_3->setText("ms"); - std::list<QString>* selClients = getConnectionList()->getSelectedClients(); + std::list<QString>* selClients = + getConnectionList()->getSelectedClients(); if (selClients->size() == 1) { PVSClient* pvsClient = - PVSConnectionManager::getManager()->getClientFromIp( - selClients->front().toStdString().c_str()); + PVSConnectionManager::getManager()->getClientFromIp( + selClients->front().toStdString().c_str()); if (pvsClient->getVNCConnection()) { - int updatefreq = pvsClient->getConnectionFrame()->getFrame()->getVNCClientThread()->getUpdatefreq(); - int showfreq = (updatefreq*100)/500; + int + updatefreq = + pvsClient->getConnectionFrame()->getFrame()->getVNCClientThread()->getUpdatefreq(); + int showfreq = (updatefreq * 100) / 500; ui->label_2->setText(QString::number(updatefreq)); ui->horizontalSlider->setValue(showfreq); } @@ -966,7 +1004,6 @@ void MainWindow::changeStatus(int index) } } - /* * Going to run a new vncthread with quality: quality */ @@ -976,47 +1013,48 @@ void MainWindow::setVNCQuality(int quality) if (selClients->size() > 0) { for (std::list<QString>::iterator client = selClients->begin(); client - != selClients->end(); client++) + != selClients->end(); client++) { PVSClient* pvsClient = - PVSConnectionManager::getManager()->getClientFromIp( - (*client).toUtf8().data()); + PVSConnectionManager::getManager()->getClientFromIp( + (*client).toUtf8().data()); pvsClient->getConnectionFrame()->resetConnectionWithQuality(quality); pvsClient->getConnectionFrame()->update(); } } else { - QList<ConnectionFrame*> FrameList = MainWindow::getConnectionWindow()->getFrameList(); - foreach(ConnectionFrame* frame, FrameList) - { - frame->resetConnectionWithQuality(quality); - frame->update(); - } + QList<ConnectionFrame*> FrameList = + MainWindow::getConnectionWindow()->getFrameList(); +foreach (ConnectionFrame* frame, FrameList) + { + frame->resetConnectionWithQuality(quality); + frame->update(); } - } +} void MainWindow::setPasswordForConnection(int enabled) { - if(enabled == 0)//the checkbox isn't checked, so no passowrd needed, we remove it in the titlebar + if (enabled == 0)//the checkbox isn't checked, so no passowrd needed, we remove it in the titlebar { - QString dummy = PVSConnectionManager::getManager()->setNeedPassword(false); - _sessionName = PVSConnectionManager::getManager()->getSessionName(); + QString dummy = PVSConnectionManager::getManager()->setNeedPassword( + false); + _sessionName = PVSConnectionManager::getManager()->getSessionName(); QString title = "PVSmgr - "; title.append(_profilName); - title.append(" ["+_sessionName + " : ]"); + title.append(" [" + _sessionName + " : ]"); setWindowTitle(title); } else if (enabled == 2) //password is needed, we show it in the titlebar { - _pwdCon = PVSConnectionManager::getManager()->setNeedPassword(true); + _pwdCon = PVSConnectionManager::getManager()->setNeedPassword(true); _sessionName = PVSConnectionManager::getManager()->getSessionName(); QString title = "PVSmgr - "; title.append(_profilName); - title.append(" ["+_sessionName + " : "); - title.append(_pwdCon+"]"); + title.append(" [" + _sessionName + " : "); + title.append(_pwdCon + "]"); setWindowTitle(title); } } @@ -1026,153 +1064,155 @@ void MainWindow::setPasswordForConnection(int enabled) void MainWindow::setindexback() //sets the index of the combobox back { #ifdef MAINWINDOW_USE_TOUCHGUI - ui->comboBox_touch1->setCurrentIndex(0); + ui->comboBox_touch1->setCurrentIndex(0); #endif } void MainWindow::clientlisthide() // hide or show the clientlist { - if (locked1 == false) - { - ui->ClWidget->show(); - locked1 = true; - } + if (locked1 == false) + { + ui->ClWidget->show(); + locked1 = true; + } - else - { - ui->ClWidget->hide(); - locked1 = false; - } + else + { + ui->ClWidget->hide(); + locked1 = false; + } } - void MainWindow::lockalltoolbar() // locks all if a dozent is set { + if (locked == false) + { + if (MainWindow::getConnectionWindow()->hasDozent) + { + MainWindow::getConnectionList()->on_lock_all(); + locked = true; + } + else + { + QString + message = + QString( + tr( + "You have to set a Superclient-machine before performing this action.")); + QMessageBox::information(this, "PVS", message); + } + } - if (locked == false) - { - if (MainWindow::getConnectionWindow()->hasDozent) - { - MainWindow::getConnectionList()->on_lock_all(); - locked = true; - } - else - { - QString message = QString(tr("You have to set a Superclient-machine before performing this action.")); - QMessageBox::information(this, "PVS", message); - } - } - - else - { - MainWindow::getConnectionList()->on_unlock_all(); - locked = false; - } + else + { + MainWindow::getConnectionList()->on_unlock_all(); + locked = false; + } } void MainWindow::locksingle() // locks a single client { - MainWindow::getConnectionList()->on_lock(); + MainWindow::getConnectionList()->on_lock(); } void MainWindow::unlocksingle() // unlocks a single client { - MainWindow::getConnectionList()->on_unlock(); + MainWindow::getConnectionList()->on_unlock(); } - void MainWindow::combobox1(int menuindex1) // defines the functions to call from the combobox { - switch (menuindex1) - // index comes from the slot definition - { - case 1: - // Lock all - MainWindow::getConnectionList()->on_lock_all(); - break; - - case 2: - // UnLock all - MainWindow::getConnectionList()->on_unlock_all(); - break; - - case 3: - // UnProject all - MainWindow::getConnectionList()->on_unproject_all(); - break; - - case 4: - //Background Picture - backgroundpicture(); - break; - } + switch (menuindex1) + // index comes from the slot definition + { + case 1: + // Lock all + MainWindow::getConnectionList()->on_lock_all(); + break; + + case 2: + // UnLock all + MainWindow::getConnectionList()->on_unlock_all(); + break; + + case 3: + // UnProject all + MainWindow::getConnectionList()->on_unproject_all(); + break; + + case 4: + //Background Picture + backgroundpicture(); + break; + } } void MainWindow::resetall() // unlock and unproject all in toolbar - { +{ MainWindow::getConnectionList()->on_unlock_all(); MainWindow::getConnectionList()->on_unproject_all(); - } - +} void MainWindow::projecttoolbar() // projection from toolbar button - { +{ MainWindow::getConnectionList()->on_projection(); - } +} void MainWindow::unprojecttoolbar() // unproject all in toolbar - { +{ MainWindow::getConnectionList()->on_unprojection(); - } +} void MainWindow::backgroundpicture() - { - +{ - fileName = QFileDialog::getOpenFileName(this, - tr("Open Image"), "/home", tr("Image Files (*.png *.jpg *.svg)")); // user chooses a file + fileName = QFileDialog::getOpenFileName(this, tr("Open Image"), "/home", + tr("Image Files (*.png *.jpg *.svg)")); // user chooses a file - QImage img(""+fileName+""); // set image + QImage img("" + fileName + ""); // set image QString test("/tmp/test.png"); // set path for saving the scaled picture - QImage img2 = img.scaled(ui->widget->size(),Qt::IgnoreAspectRatio,Qt::FastTransformation); // scale it + QImage img2 = img.scaled(ui->widget->size(), Qt::IgnoreAspectRatio, + Qt::FastTransformation); // scale it - img2.save(""+test+""); // save it + img2.save("" + test + ""); // save it - ui->widget->setStyleSheet("background-image: url(/tmp/test.png);background-repeat:no-repeat; background-position:center;"); //set the picture as background + ui->widget->setStyleSheet( + "background-image: url(/tmp/test.png);background-repeat:no-repeat; background-position:center;"); //set the picture as background foreach (ConnectionFrame* cf, MainWindow::getConnectionWindow()->getAllFrameOnWindow()) { cf->setStyleSheet(QString::fromUtf8("background-color: rgb(150, 150, 168);")); } - bgimage=true; // for the resize event, set background true + bgimage = true; // for the resize event, set background true - } +} void MainWindow::repaintbackgroundpicture() // same as backgroundpicture but called when mainwindow is resized - { +{ QImage img("/tmp/test.png"); QString test("/tmp/test.png"); - QImage img2 = img.scaled(ui->widget->size(),Qt::IgnoreAspectRatio,Qt::FastTransformation); + QImage img2 = img.scaled(ui->widget->size(), Qt::IgnoreAspectRatio, + Qt::FastTransformation); - img2.save(""+test+""); + img2.save("" + test + ""); - ui->widget->setStyleSheet("background-image: url(/tmp/test.png);background-repeat:no-repeat; background-position:center;"); + ui->widget->setStyleSheet( + "background-image: url(/tmp/test.png);background-repeat:no-repeat; background-position:center;"); - - } +} void MainWindow::setdozenttoolbar() // set the dozents pc which is not locked with lockedall { @@ -1184,8 +1224,8 @@ void MainWindow::setdozenttoolbar() // set the dozents pc which is not locked wi { PVSClient* pvsClient = - PVSConnectionManager::getManager()->getClientFromIp( - selectedClients->front().toStdString().c_str()); + PVSConnectionManager::getManager()->getClientFromIp( + selectedClients->front().toStdString().c_str()); if (pvsClient->getVNCConnection()) pvsClient->getConnectionFrame()->getFrame()->setDozent(); } @@ -1200,9 +1240,19 @@ void MainWindow::startChatDialog() sChatDialog.raise();//show the chat dialog on top level } +void MainWindow::configureNetwork() +{ + PVSServer* server = PVSConnectionManager::getManager()->getServer(); + McastConfiguration mc(*(server->getMulticastConfiguration())); + MulticastConfigDialog* mcd = new MulticastConfigDialog(&mc, this); + int result = mcd->exec(); + if(result == QDialog::Accepted) + { + server->multicastReconfigure(&mc); + } +} - -MainWindow* MainWindow::myself = NULL; -ConnectionList* MainWindow::conList = NULL; -ConnectionWindow* MainWindow::conWin = NULL; -bool MainWindow::_isLockAll = false; +MainWindow* MainWindow::myself = NULL; +ConnectionList* MainWindow::conList = NULL; +ConnectionWindow* MainWindow::conWin = NULL; +bool MainWindow::_isLockAll = false; diff --git a/src/gui/mainWindow.h b/src/gui/mainWindow.h index 00bd927..88756fd 100644 --- a/src/gui/mainWindow.h +++ b/src/gui/mainWindow.h @@ -159,6 +159,8 @@ private: QMenu* _profileMenuList; QMap<QString, QAction*> _mapProfileToAction; + QSettings _settings; + public slots: void loadProfile(QAction* actiontriggered); void setindexback(); @@ -176,6 +178,7 @@ public slots: void repaintbackgroundpicture(); void setdozenttoolbar(); void startChatDialog(); + void showProcesses(); private slots: void onToggleLog(bool showtime); @@ -194,6 +197,7 @@ private slots: void setPasswordForConnection(int enabled); void combobox1(int menuindex1); // Funktion um index der combobox auszulesen und weiterzuverarbeiten s. Ticker 671 //void combobox2(int menuindex2); // Funktion um index der combobox auszulesen und weiterzuverarbeiten + void configureNetwork(); }; diff --git a/src/gui/multicastConfigDialog.cpp b/src/gui/multicastConfigDialog.cpp new file mode 100644 index 0000000..ff370c7 --- /dev/null +++ b/src/gui/multicastConfigDialog.cpp @@ -0,0 +1,170 @@ +#include <QValidator> +#include <QIntValidator> +#include <QHostAddress> +#include <QPushButton> +#include "multicastConfigDialog.h" +#include <src/net/mcast/McastConfiguration.h> +// #include "multicastValidators.h" + +MulticastConfigDialog::MulticastConfigDialog(QWidget* parent) : + QDialog(parent) +{ + setupUi(); +} + +MulticastConfigDialog::MulticastConfigDialog(McastConfiguration* config, + QWidget *parent) : + QDialog(parent) +{ + setupUi(); + _config = config; + + _ui.groupAddressEdit->setText(config->multicastAddress()); + _ui.dataPortEdit->setText(QString::number(config->multicastUDPPortBase())); + + connect(_ui.buttonBox, SIGNAL(accepted()), this, SLOT(dialogAccepted())); + connect(_ui.buttonBox, SIGNAL(rejected()), this, SLOT(reject())); +} + +void MulticastConfigDialog::setupUi() +{ + _ui.setupUi(this); + + QIntValidator* portValidator = new QIntValidator(1024, 65535, this); + _ui.dataPortEdit->setValidator(portValidator); + + connect(_ui.groupAddressEdit, SIGNAL(textChanged(QString const&)), this, + SLOT(validateGroupAddress(QString const&))); + connect(_ui.dataPortEdit, SIGNAL(textChanged(QString const&)), this, + SLOT(validateDataPort(QString const&))); + + connect(_ui.buttonBox, SIGNAL(accepted()), this, SLOT(dialogAccepted())); + connect(_ui.buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + + validateGroupAddress(_ui.groupAddressEdit->text()); + validateDataPort(_ui.dataPortEdit->text()); +} + +MulticastConfigDialog::~MulticastConfigDialog() +{ +} + +void MulticastConfigDialog::dialogAccepted() +{ + QHostAddress addr; + bool addressParses = addr.setAddress(_ui.groupAddressEdit->text()); + _config->multicastAddress(_ui.groupAddressEdit->text()); + quint16 port = _ui.dataPortEdit->text().toInt(); + _config->multicastUDPPortBase(port); + _config->multicastDPort(port + 1); + _config->multicastSPort(port + 2); + _config->multicastRate(_ui.rateSpinbox->value() * 1024); + accept(); +} + +void MulticastConfigDialog::setError(QWidget* widget, + QLabel* errorMessageLabel, QString text) +{ + if (errorMessageLabel) + errorMessageLabel->setText(QString( + "<span style=\"font-weight: 600; color: #880000;\">") + text + + "</span>"); + if (widget) + widget->setStyleSheet("background-color: #ffcccc;"); +} + +void MulticastConfigDialog::setOK(QWidget* widget, QLabel* errorMessageLabel) +{ + if (errorMessageLabel) + errorMessageLabel->setText(QString( + "<span style=\"font-weight: 600; color: #008800;\">") + + tr("OK") + "</span>"); + if (widget) + widget->setStyleSheet("background-color: #ccffcc;"); +} + +void MulticastConfigDialog::validateGroupAddress(QString const& input) +{ + QHostAddress a; + + _isAddressValid = false; + + if (!a.setAddress(input)) + { + setError(_ui.groupAddressEdit, _ui.groupAddressMessage, tr( + "Not a valid IP Address")); + revalidateButtons(); + return; + } + + // check if it is IPv4 + if (a.protocol() != QAbstractSocket::IPv4Protocol) + { + setError(_ui.groupAddressEdit, _ui.groupAddressMessage, tr( + "Not a valid IPv4 Address")); + revalidateButtons(); + return; + } + + // check if it is a valid multicast address + quint32 addr = a.toIPv4Address(); + if ((addr & 0xf0000000) != 0xe0000000) + { + setError(_ui.groupAddressEdit, _ui.groupAddressMessage, tr( + "Not an IPv4 multicast address")); + revalidateButtons(); + return; + } + + _isAddressValid = true; + setOK(_ui.groupAddressEdit, _ui.groupAddressMessage); + revalidateButtons(); +} + +void MulticastConfigDialog::validateDataPort(QString const& input) +{ + bool ok; + int p = input.toInt(&ok, 0); + + _isPortValid = false; + + if (!ok) + { + setError(_ui.dataPortEdit, _ui.dataPortMessage, tr("Not a number")); + revalidateButtons(); + return; + } + + if (p < 0) + { + setError(_ui.dataPortEdit, _ui.dataPortMessage, tr("Must be positive")); + revalidateButtons(); + return; + } + + if (p < 1024) + { + setError(_ui.dataPortEdit, _ui.dataPortMessage, tr( + "Must not be a privileged port")); + revalidateButtons(); + return; + } + + if (p > 65535) + { + setError(_ui.dataPortEdit, _ui.dataPortMessage, tr( + "Port number too large")); + revalidateButtons(); + return; + } + + _isPortValid = true; + setOK(_ui.dataPortEdit, _ui.dataPortMessage); + revalidateButtons(); +} + +void MulticastConfigDialog::revalidateButtons() +{ + _ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(_isAddressValid + && _isPortValid); +} diff --git a/src/gui/multicastConfigDialog.h b/src/gui/multicastConfigDialog.h new file mode 100644 index 0000000..6421813 --- /dev/null +++ b/src/gui/multicastConfigDialog.h @@ -0,0 +1,38 @@ +#ifndef MULTICASTCONFIGDIALOG_H +#define MULTICASTCONFIGDIALOG_H + +#include <QtGui/QDialog> +#include <QPointer> +#include "ui_multicastConfigDialog.h" +#include <pvsinterface.h> + +class McastConfiguration; + +class MulticastConfigDialog : public QDialog +{ + Q_OBJECT + +public: + MulticastConfigDialog(QWidget* parent = 0); + MulticastConfigDialog(McastConfiguration* dbusIface, QWidget *parent = 0); + ~MulticastConfigDialog(); + +private: + Ui::MulticastConfigDialogClass _ui; + McastConfiguration* _config; + bool _isAddressValid; + bool _isPortValid; + + void setupUi(); + + void setError(QWidget* input, QLabel* messageLabel, QString text); + void setOK(QWidget* input, QLabel* messageLabel); + void revalidateButtons(); + +private slots: + void dialogAccepted(); + void validateGroupAddress(QString const&); + void validateDataPort(QString const&); +}; + +#endif // MULTICASTCONFIGDIALOG_H diff --git a/src/gui/ui/clientConfigDialog.ui b/src/gui/ui/clientConfigDialog.ui index 3262b6b..bb4bdc9 100644 --- a/src/gui/ui/clientConfigDialog.ui +++ b/src/gui/ui/clientConfigDialog.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>438</width> - <height>257</height> + <width>445</width> + <height>266</height> </rect> </property> <property name="windowTitle"> @@ -27,7 +27,7 @@ <enum>QTabWidget::North</enum> </property> <property name="currentIndex"> - <number>0</number> + <number>2</number> </property> <widget class="QWidget" name="tabPermissions"> <attribute name="title"> @@ -197,6 +197,64 @@ </item> </layout> </widget> + <widget class="QWidget" name="networkTab"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <attribute name="title"> + <string>Network</string> + </attribute> + <layout class="QFormLayout" name="formLayout"> + <item row="2" column="1"> + <widget class="QComboBox" name="interfaceList"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="editable"> + <bool>true</bool> + </property> + <property name="insertPolicy"> + <enum>QComboBox::NoInsert</enum> + </property> + <property name="frame"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Network Interface</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QPushButton" name="reloadInterfaceListButton"> + <property name="text"> + <string>Reload List</string> + </property> + </widget> + </item> + </layout> + </widget> </widget> </item> <item> diff --git a/src/gui/ui/clientFileReceiveDialog.ui b/src/gui/ui/clientFileReceiveDialog.ui index af3a135..a137def 100644 --- a/src/gui/ui/clientFileReceiveDialog.ui +++ b/src/gui/ui/clientFileReceiveDialog.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>208</width> - <height>108</height> + <width>528</width> + <height>117</height> </rect> </property> <property name="windowTitle"> @@ -61,6 +61,13 @@ </property> </spacer> </item> + <item> + <widget class="QLabel" name="labelStatus"> + <property name="text"> + <string/> + </property> + </widget> + </item> </layout> </item> <item> diff --git a/src/gui/ui/clientFileSendDialog.ui b/src/gui/ui/clientFileSendDialog.ui index d2d9c75..85462ba 100644 --- a/src/gui/ui/clientFileSendDialog.ui +++ b/src/gui/ui/clientFileSendDialog.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>186</width> - <height>108</height> + <width>528</width> + <height>144</height> </rect> </property> <property name="windowTitle"> @@ -33,7 +33,7 @@ </widget> </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> + <layout class="QHBoxLayout" name="horizontalLayout"> <item> <widget class="QLabel" name="label"> <property name="text"> @@ -61,10 +61,17 @@ </property> </spacer> </item> + <item> + <widget class="QLabel" name="labelStatus"> + <property name="text"> + <string/> + </property> + </widget> + </item> </layout> </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> <item> <widget class="QLabel" name="labelA"> <property name="text"> diff --git a/src/gui/ui/clientNicklistDialog.ui b/src/gui/ui/clientNicklistDialog.ui index afd84f1..3679b55 100644 --- a/src/gui/ui/clientNicklistDialog.ui +++ b/src/gui/ui/clientNicklistDialog.ui @@ -29,6 +29,13 @@ <widget class="QListWidget" name="listWidget"/> </item> <item> + <widget class="QCheckBox" name="sendToAllCheckBox"> + <property name="text"> + <string>Send to &all</string> + </property> + </widget> + </item> + <item> <layout class="QHBoxLayout" name="horizontalLayout"> <item> <spacer name="horizontalSpacer"> diff --git a/src/gui/ui/clientToolbar.ui b/src/gui/ui/clientToolbar.ui index 5a59c5f..d70857a 100644 --- a/src/gui/ui/clientToolbar.ui +++ b/src/gui/ui/clientToolbar.ui @@ -6,7 +6,7 @@ <rect> <x>0</x> <y>0</y> - <width>577</width> + <width>328</width> <height>28</height> </rect> </property> @@ -144,46 +144,6 @@ p, li { white-space: pre-wrap; } </spacer> </item> <item> - <widget class="QCheckBox" name="vncCheckBox"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="toolTip"> - <string>Enable/Disable VNC only for this session</string> - </property> - <property name="text"> - <string>Allow VNC</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QLabel" name="label"> - <property name="text"> - <string><!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"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600; font-style:italic; color:#0055ff;">Pool Video Switch</span></p></body></html></string> - </property> - </widget> - </item> - <item> <widget class="QLabel" name="label_3"> <property name="maximumSize"> <size> diff --git a/src/gui/ui/mainwindow.ui b/src/gui/ui/mainwindow.ui index eb49d1b..7913e38 100644 --- a/src/gui/ui/mainwindow.ui +++ b/src/gui/ui/mainwindow.ui @@ -28,8 +28,8 @@ <rect> <x>0</x> <y>0</y> - <width>776</width> - <height>534</height> + <width>778</width> + <height>542</height> </rect> </property> <layout class="QGridLayout" name="gridLayout_2"> @@ -195,7 +195,7 @@ <x>0</x> <y>0</y> <width>838</width> - <height>28</height> + <height>23</height> </rect> </property> <widget class="QMenu" name="menu_File"> @@ -243,9 +243,16 @@ </property> <addaction name="actionAbout_pvs"/> </widget> + <widget class="QMenu" name="menuNetwork"> + <property name="title"> + <string>Network</string> + </property> + <addaction name="actionConfigure_Network"/> + </widget> <addaction name="menu_File"/> <addaction name="menuClients"/> <addaction name="menuLogging"/> + <addaction name="menuNetwork"/> <addaction name="menu_Help"/> </widget> <widget class="QStatusBar" name="statusBar"/> @@ -286,6 +293,7 @@ <addaction name="actionView"/> <addaction name="actionLock"/> <addaction name="actionChat"/> + <addaction name="actionShowProcesses"/> </widget> <action name="actionShow_Username"> <property name="checkable"> @@ -531,6 +539,26 @@ <string>-</string> </property> </action> + <action name="actionConfigure_Network"> + <property name="text"> + <string>&Configure...</string> + </property> + <property name="toolTip"> + <string>Configure Network Parameters</string> + </property> + </action> + <action name="actionShowProcesses"> + <property name="icon"> + <iconset resource="../../../pvsmgr.qrc"> + <normaloff>:/icons/gears.png</normaloff>:/icons/gears.png</iconset> + </property> + <property name="text"> + <string>showProcesses</string> + </property> + <property name="toolTip"> + <string>Show Processes of the selected Client</string> + </property> + </action> </widget> <layoutdefault spacing="6" margin="11"/> <resources> diff --git a/src/gui/ui/mainwindowtouch.ui b/src/gui/ui/mainwindowtouch.ui index 9030b17..24f40b6 100644 --- a/src/gui/ui/mainwindowtouch.ui +++ b/src/gui/ui/mainwindowtouch.ui @@ -28,8 +28,8 @@ <rect> <x>0</x> <y>0</y> - <width>1327</width> - <height>658</height> + <width>1329</width> + <height>660</height> </rect> </property> <layout class="QGridLayout" name="gridLayout_3"> @@ -365,6 +365,9 @@ <addaction name="actionresetall"/> <addaction name="separator"/> <addaction name="actionDozent"/> + <addaction name="separator"/> + <addaction name="actionConfigure_Network"/> + <addaction name="actionShowProcesses"/> </widget> <action name="actionShow_Username"> <property name="checkable"> @@ -636,6 +639,27 @@ <string>Ctrl+D</string> </property> </action> + <action name="actionConfigure_Network"> + <property name="icon"> + <iconset resource="../../../pvsmgr.qrc"> + <normaloff>:/netconf</normaloff>:/netconf</iconset> + </property> + <property name="text"> + <string>Configure Network...</string> + </property> + </action> + <action name="actionShowProcesses"> + <property name="icon"> + <iconset resource="../../../pvsmgr.qrc"> + <normaloff>:/icons/gears.png</normaloff>:/icons/gears.png</iconset> + </property> + <property name="text"> + <string>showProcesses</string> + </property> + <property name="toolTip"> + <string>Show Processes of the selected Client</string> + </property> + </action> </widget> <layoutdefault spacing="6" margin="11"/> <resources> diff --git a/src/gui/ui/multicastConfigDialog.ui b/src/gui/ui/multicastConfigDialog.ui new file mode 100644 index 0000000..1ddf02c --- /dev/null +++ b/src/gui/ui/multicastConfigDialog.ui @@ -0,0 +1,156 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MulticastConfigDialogClass</class> + <widget class="QDialog" name="MulticastConfigDialogClass"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>331</width> + <height>314</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowTitle"> + <string>PVS - Multicast Configuration</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QLabel" name="label_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string><!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"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You need to specify connection parameters for multicast messaging on your network. These parameters will automatically be distributed to client computers, so you need to assign them only once.</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You will probably want to assign an address from the <span style=" text-decoration: underline;">239.0.0.0/8</span> &quot;Administratively Scoped&quot; range.</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Do not assign arbitrary numbers without checking with your network administrator!</span></p></td></tr></table></body></html></string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Multicast Group Address</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="groupAddressEdit"> + <property name="inputMask"> + <string notr="true">009.009.009.009; </string> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + <item row="1" column="0" colspan="2"> + <widget class="QLabel" name="groupAddressMessage"> + <property name="text"> + <string><span style=" font-weight:600; color:#008800;">OK</span></string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Data Port (1024-65535)</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="dataPortEdit"> + <property name="inputMask"> + <string notr="true">00009; </string> + </property> + <property name="maxLength"> + <number>5</number> + </property> + </widget> + </item> + <item row="3" column="0" colspan="2"> + <widget class="QLabel" name="dataPortMessage"> + <property name="text"> + <string><span style=" font-weight:600; color:#008800;">OK</span></string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Transmission Rate</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QSpinBox" name="rateSpinbox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="suffix"> + <string> KiB/s</string> + </property> + <property name="maximum"> + <number>10240</number> + </property> + <property name="singleStep"> + <number>10</number> + </property> + <property name="value"> + <number>100</number> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections/> +</ui> |