From 5acd0590258e9335cf4d3b1910a517efccd22a3e Mon Sep 17 00:00:00 2001 From: Fabian Schillinger Date: Fri, 9 Jul 2010 21:18:44 +0200 Subject: first commit to test git --- src/gui/ui/mainwindow.ui | 19 ++++++++++++++++--- src/gui/ui/mainwindowtouch.ui | 17 +++++++++++++++-- 2 files changed, 31 insertions(+), 5 deletions(-) (limited to 'src/gui/ui') diff --git a/src/gui/ui/mainwindow.ui b/src/gui/ui/mainwindow.ui index eb49d1b..b5ac0e3 100644 --- a/src/gui/ui/mainwindow.ui +++ b/src/gui/ui/mainwindow.ui @@ -28,8 +28,8 @@ 0 0 - 776 - 534 + 778 + 542 @@ -195,7 +195,7 @@ 0 0 838 - 28 + 23 @@ -286,6 +286,7 @@ + @@ -531,6 +532,18 @@ - + + + + :/finder:/finder + + + Show Processes + + + show processes of this client + + diff --git a/src/gui/ui/mainwindowtouch.ui b/src/gui/ui/mainwindowtouch.ui index 9030b17..f8e76c0 100644 --- a/src/gui/ui/mainwindowtouch.ui +++ b/src/gui/ui/mainwindowtouch.ui @@ -28,8 +28,8 @@ 0 0 - 1327 - 658 + 1329 + 660 @@ -365,6 +365,7 @@ + @@ -636,6 +637,18 @@ Ctrl+D + + + + :/finder:/finder + + + Show Processes + + + show processes of this client + + -- cgit v1.2.3-55-g7522 From d2d403a8dec0f65bb3665c2bd2dab69456cdee42 Mon Sep 17 00:00:00 2001 From: Johann Latocha Date: Sat, 10 Jul 2010 00:11:47 +0200 Subject: Revoke Fabians changes. --- i18n/pvs_ar_JO.ts | 8 +- i18n/pvs_de_DE.ts | 8 +- i18n/pvs_es_MX.ts | 8 +- i18n/pvs_fr_FR.ts | 8 +- i18n/pvs_pl_PL.ts | 8 +- i18n/pvsmgr_ar_JO.ts | 170 +++++++++++++++++--------------------- i18n/pvsmgr_de_DE.ts | 170 +++++++++++++++++--------------------- i18n/pvsmgr_es_MX.ts | 170 +++++++++++++++++--------------------- i18n/pvsmgr_fr_FR.ts | 170 +++++++++++++++++--------------------- i18n/pvsmgr_pl_PL.ts | 170 +++++++++++++++++--------------------- src/core/pvsConnectionManager.cpp | 10 --- src/gui/connectionList.cpp | 23 ------ src/gui/connectionList.h | 1 - src/gui/connectionWindow.cpp | 2 + src/gui/mainWindow.cpp | 35 -------- src/gui/mainWindow.h | 1 - src/gui/ui/mainwindow.ui | 19 +---- src/gui/ui/mainwindowtouch.ui | 17 +--- src/net/pvsListenServer.cpp | 4 +- src/net/pvsServerConnection.cpp | 8 -- src/pvs.cpp | 12 --- src/pvsDaemon.cpp | 21 ++--- src/util/util.cpp | 7 ++ src/util/util.h | 1 + src/version.h | 4 +- 25 files changed, 435 insertions(+), 620 deletions(-) (limited to 'src/gui/ui') diff --git a/i18n/pvs_ar_JO.ts b/i18n/pvs_ar_JO.ts index 7443e4b..0b4c72f 100644 --- a/i18n/pvs_ar_JO.ts +++ b/i18n/pvs_ar_JO.ts @@ -4,22 +4,22 @@ PVS - + Message - + VNC connection - + The host - + requested your screen! diff --git a/i18n/pvs_de_DE.ts b/i18n/pvs_de_DE.ts index 7443e4b..0b4c72f 100644 --- a/i18n/pvs_de_DE.ts +++ b/i18n/pvs_de_DE.ts @@ -4,22 +4,22 @@ PVS - + Message - + VNC connection - + The host - + requested your screen! diff --git a/i18n/pvs_es_MX.ts b/i18n/pvs_es_MX.ts index 7443e4b..0b4c72f 100644 --- a/i18n/pvs_es_MX.ts +++ b/i18n/pvs_es_MX.ts @@ -4,22 +4,22 @@ PVS - + Message - + VNC connection - + The host - + requested your screen! diff --git a/i18n/pvs_fr_FR.ts b/i18n/pvs_fr_FR.ts index 7443e4b..0b4c72f 100644 --- a/i18n/pvs_fr_FR.ts +++ b/i18n/pvs_fr_FR.ts @@ -4,22 +4,22 @@ PVS - + Message - + VNC connection - + The host - + requested your screen! diff --git a/i18n/pvs_pl_PL.ts b/i18n/pvs_pl_PL.ts index 7443e4b..0b4c72f 100644 --- a/i18n/pvs_pl_PL.ts +++ b/i18n/pvs_pl_PL.ts @@ -4,22 +4,22 @@ PVS - + Message - + VNC connection - + The host - + requested your screen! diff --git a/i18n/pvsmgr_ar_JO.ts b/i18n/pvsmgr_ar_JO.ts index cac57b4..bc5c69c 100644 --- a/i18n/pvsmgr_ar_JO.ts +++ b/i18n/pvsmgr_ar_JO.ts @@ -212,9 +212,9 @@ Perform an unprojection or remove remote help to get a target. - - - + + + You have to set a Superclient-machine before performing this action. @@ -314,376 +314,360 @@ Perform an unprojection or remove remote help to get a target. MainWindow - - + + Exit - + Remove the vnc-Connection for the selected client(s) - + Show the selected client in the whole window - + Make a screenshot for the selected client(s) - - + + Lock or Unlock all Clients - - Shows list of processes of this client - - - - + The pvs manager - - + This operation can only be performed for one selected Client! - + This operation can only be performed for at least one selected Client! - + You have to set a Superclient-machine before performing this action. - + Open Image - + Image Files (*.png *.jpg *.svg) - + PVSmgr - + Show Username - + Ctrl+3 - + Show IP - + Ctrl+2 - + VNC-Placeholders - + Show Log - + Ctrl+L - + Show Normal - + Ctrl+O - + Show Error - + Ctrl+E - + Show Network - + Ctrl+N - + Show Terminal - + Ctrl+T - + Show Chat - + Ctrl+G - + About pvs - + Ctrl+P - + 100 x 100 - + 200 x 200 - + 500 x 500 - + &Disconnect - + Ctrl+W - + &Exit - + Ctrl+Q - - + + Foto - + Ctrl+F - + view - + View - + Ctrl+V - + lock - + Ctrl+A - + Profile &manager - + Ctrl+M - + Show Name - + Ctrl+1 - + Chat - + Start Chat with client(s) - + Ctrl+D - + - - - Show Processes - - - - - show processes of this client - - - - + border-color: rgb(0, 0, 0); - + VNC quality - + HIGH - + MEDIUM - + LOW - + Set password - + Thumbnailratio - + Thumbnailrate - + 0 - + % - + background-color: rgb(255, 255, 255); - + background-color: rgb(150, 150, 150); - + &File - + Load profile - + &Clients - + &Logging - + &Help - + toolBar diff --git a/i18n/pvsmgr_de_DE.ts b/i18n/pvsmgr_de_DE.ts index 4393aa3..fd6d56b 100644 --- a/i18n/pvsmgr_de_DE.ts +++ b/i18n/pvsmgr_de_DE.ts @@ -212,9 +212,9 @@ Perform an unprojection or remove remote help to get a target. - - - + + + You have to set a Superclient-machine before performing this action. @@ -314,376 +314,360 @@ Perform an unprojection or remove remote help to get a target. MainWindow - - + + Exit - + Remove the vnc-Connection for the selected client(s) - + Show the selected client in the whole window - + Make a screenshot for the selected client(s) - - + + Lock or Unlock all Clients - - Shows list of processes of this client - - - - + The pvs manager - - + This operation can only be performed for one selected Client! - + This operation can only be performed for at least one selected Client! - + You have to set a Superclient-machine before performing this action. - + Open Image - + Image Files (*.png *.jpg *.svg) - + PVSmgr - + Show Username - + Ctrl+3 - + Show IP - + Ctrl+2 - + VNC-Placeholders - + Show Log - + Ctrl+L - + Show Normal - + Ctrl+O - + Show Error - + Ctrl+E - + Show Network - + Ctrl+N - + Show Terminal - + Ctrl+T - + Show Chat - + Ctrl+G - + About pvs - + Ctrl+P - + 100 x 100 - + 200 x 200 - + 500 x 500 - + &Disconnect - + Ctrl+W - + &Exit - + Ctrl+Q - - + + Foto - + Ctrl+F - + view - + View - + Ctrl+V - + lock - + Ctrl+A - + Profile &manager - + Ctrl+M - + Show Name - + Ctrl+1 - + Chat - + Start Chat with client(s) - + Ctrl+D - + - - - Show Processes - - - - - show processes of this client - - - - + border-color: rgb(0, 0, 0); - + VNC quality - + HIGH - + MEDIUM - + LOW - + Set password - + Thumbnailratio - + Thumbnailrate - + 0 - + % - + background-color: rgb(255, 255, 255); - + background-color: rgb(150, 150, 150); - + &File - + Load profile - + &Clients - + &Logging - + &Help - + toolBar diff --git a/i18n/pvsmgr_es_MX.ts b/i18n/pvsmgr_es_MX.ts index 758b277..fc53e6d 100644 --- a/i18n/pvsmgr_es_MX.ts +++ b/i18n/pvsmgr_es_MX.ts @@ -212,9 +212,9 @@ Perform an unprojection or remove remote help to get a target. &Agregar un dummy... - - - + + + You have to set a Superclient-machine before performing this action. Usted debe asignar un super cliente antes de iniciar esta acción. @@ -314,376 +314,360 @@ Perform an unprojection or remove remote help to get a target. MainWindow - - + + Exit Salir - + Remove the vnc-Connection for the selected client(s) Remover la conexión VNC de los clientes seleccionados - + Show the selected client in the whole window Mostrar el cliente seleccionado en toda la ventana - + Make a screenshot for the selected client(s) Capturar la pantalla de los clientes seleccionados - - + + Lock or Unlock all Clients Bloquear o desbloquear todos los clientes - - Shows list of processes of this client - - - - + The pvs manager PVS Manager - - + This operation can only be performed for one selected Client! Esta operación solamente puede ser realizada para un cliente! - + This operation can only be performed for at least one selected Client! Esta operación solamente puede ser realizada para el ultimo cliente seleccionado! - + You have to set a Superclient-machine before performing this action. Usted debe asignar un super cliente antes de realizar esta acción. - + Open Image Abrir imagen - + Image Files (*.png *.jpg *.svg) Extensión de imagenes (*.png *.jpg *.svg) - + PVSmgr PVSmgr - + Show Username Mostrar nombre de usuario - + Ctrl+3 Ctrl+3 - + Show IP Mostrar IP - + Ctrl+2 Ctrl+2 - + VNC-Placeholders VNC - Marcadores de posición - + Show Log Mostrar Log - + Ctrl+L Ctrl+L - + Show Normal Mostrar normal - + Ctrl+O Ctrl+O - + Show Error Mostrar Errores - + Ctrl+E Ctrl+E - + Show Network Mostrar Red - + Ctrl+N - + Show Terminal Mostrar Linea de comandos - + Ctrl+T Ctrl+T - + Show Chat Mostrar Chat - + Ctrl+G Ctrl+G - + About pvs Acerca de PVS - + Ctrl+P Ctrl+P - + 100 x 100 100 x 100 - + 200 x 200 200 x 200 - + 500 x 500 500 x 500 - + &Disconnect &Desconectar - + Ctrl+W Ctrl+W - + &Exit &Salir - + Ctrl+Q Ctrl+Q - - + + Foto Imagen - + Ctrl+F Ctrl+F - + view ver - + View Ver - + Ctrl+V Ctrl+V - + lock bloquear - + Ctrl+A Ctrl+A - + Profile &manager Perfil &manager - + Ctrl+M Ctrl+M - + Show Name Mostrar nombre - + Ctrl+1 Ctrl+1 - + Chat Chat - + Start Chat with client(s) Iniciar Chat con cliente(s) - + Ctrl+D Ctrl+D - + - - - - Show Processes - - - - - show processes of this client - - - - + border-color: rgb(0, 0, 0); border-color: rgb(0, 0, 0); - + VNC quality VNC calidad - + HIGH Alta - + MEDIUM Media - + LOW Baja - + Set password Asignar contraseña - + Thumbnailratio Radio de la vista en miniatura - + Thumbnailrate Frecuancia de actualización para las vistas en miniatura - + 0 0 - + % % - + background-color: rgb(255, 255, 255); background-color: rgb(255, 255, 255); - + background-color: rgb(150, 150, 150); background-color: rgb(150, 150, 150); - + &File &Archivo - + Load profile Cargar perfil - + &Clients &Clientes - + &Logging &Logging - + &Help &Ayuda - + toolBar Barra de herramientas diff --git a/i18n/pvsmgr_fr_FR.ts b/i18n/pvsmgr_fr_FR.ts index cac57b4..bc5c69c 100644 --- a/i18n/pvsmgr_fr_FR.ts +++ b/i18n/pvsmgr_fr_FR.ts @@ -212,9 +212,9 @@ Perform an unprojection or remove remote help to get a target. - - - + + + You have to set a Superclient-machine before performing this action. @@ -314,376 +314,360 @@ Perform an unprojection or remove remote help to get a target. MainWindow - - + + Exit - + Remove the vnc-Connection for the selected client(s) - + Show the selected client in the whole window - + Make a screenshot for the selected client(s) - - + + Lock or Unlock all Clients - - Shows list of processes of this client - - - - + The pvs manager - - + This operation can only be performed for one selected Client! - + This operation can only be performed for at least one selected Client! - + You have to set a Superclient-machine before performing this action. - + Open Image - + Image Files (*.png *.jpg *.svg) - + PVSmgr - + Show Username - + Ctrl+3 - + Show IP - + Ctrl+2 - + VNC-Placeholders - + Show Log - + Ctrl+L - + Show Normal - + Ctrl+O - + Show Error - + Ctrl+E - + Show Network - + Ctrl+N - + Show Terminal - + Ctrl+T - + Show Chat - + Ctrl+G - + About pvs - + Ctrl+P - + 100 x 100 - + 200 x 200 - + 500 x 500 - + &Disconnect - + Ctrl+W - + &Exit - + Ctrl+Q - - + + Foto - + Ctrl+F - + view - + View - + Ctrl+V - + lock - + Ctrl+A - + Profile &manager - + Ctrl+M - + Show Name - + Ctrl+1 - + Chat - + Start Chat with client(s) - + Ctrl+D - + - - - Show Processes - - - - - show processes of this client - - - - + border-color: rgb(0, 0, 0); - + VNC quality - + HIGH - + MEDIUM - + LOW - + Set password - + Thumbnailratio - + Thumbnailrate - + 0 - + % - + background-color: rgb(255, 255, 255); - + background-color: rgb(150, 150, 150); - + &File - + Load profile - + &Clients - + &Logging - + &Help - + toolBar diff --git a/i18n/pvsmgr_pl_PL.ts b/i18n/pvsmgr_pl_PL.ts index cac57b4..bc5c69c 100644 --- a/i18n/pvsmgr_pl_PL.ts +++ b/i18n/pvsmgr_pl_PL.ts @@ -212,9 +212,9 @@ Perform an unprojection or remove remote help to get a target. - - - + + + You have to set a Superclient-machine before performing this action. @@ -314,376 +314,360 @@ Perform an unprojection or remove remote help to get a target. MainWindow - - + + Exit - + Remove the vnc-Connection for the selected client(s) - + Show the selected client in the whole window - + Make a screenshot for the selected client(s) - - + + Lock or Unlock all Clients - - Shows list of processes of this client - - - - + The pvs manager - - + This operation can only be performed for one selected Client! - + This operation can only be performed for at least one selected Client! - + You have to set a Superclient-machine before performing this action. - + Open Image - + Image Files (*.png *.jpg *.svg) - + PVSmgr - + Show Username - + Ctrl+3 - + Show IP - + Ctrl+2 - + VNC-Placeholders - + Show Log - + Ctrl+L - + Show Normal - + Ctrl+O - + Show Error - + Ctrl+E - + Show Network - + Ctrl+N - + Show Terminal - + Ctrl+T - + Show Chat - + Ctrl+G - + About pvs - + Ctrl+P - + 100 x 100 - + 200 x 200 - + 500 x 500 - + &Disconnect - + Ctrl+W - + &Exit - + Ctrl+Q - - + + Foto - + Ctrl+F - + view - + View - + Ctrl+V - + lock - + Ctrl+A - + Profile &manager - + Ctrl+M - + Show Name - + Ctrl+1 - + Chat - + Start Chat with client(s) - + Ctrl+D - + - - - Show Processes - - - - - show processes of this client - - - - + border-color: rgb(0, 0, 0); - + VNC quality - + HIGH - + MEDIUM - + LOW - + Set password - + Thumbnailratio - + Thumbnailrate - + 0 - + % - + background-color: rgb(255, 255, 255); - + background-color: rgb(150, 150, 150); - + &File - + Load profile - + &Clients - + &Logging - + &Help - + toolBar diff --git a/src/core/pvsConnectionManager.cpp b/src/core/pvsConnectionManager.cpp index aabd869..8a35ca9 100644 --- a/src/core/pvsConnectionManager.cpp +++ b/src/core/pvsConnectionManager.cpp @@ -93,14 +93,6 @@ void PVSConnectionManager::onClientRemove(PVSClientConnection* removedConnection } // Inform all chat clients about a new event. -// hier eventuell prozesse anzeigen einbinden -// -// -// -// -// -// -// void PVSConnectionManager::sendEventToClients(QString event, PVSClientConnection* connection, QString clientName) { if(event.compare("addedConnection") == 0) @@ -117,8 +109,6 @@ void PVSConnectionManager::sendEventToClients(QString event, PVSClientConnection if(event.compare("addedClient") == 0) { // send name to everybody to all connected clients. - _pvsServer.sendToAll(PVSMsg(PVSCOMMAND, "SHOWPROCESSES", "")); - ConsoleLog writeNetwork("SHOWPROCESSES sent..."); _pvsServer.sendToAll(PVSMsg(PVSMESSAGE, "clientToAdd", ":" + clientName, 0)); connection->push_back_send(PVSMsg(PVSMESSAGE, "assignedName", ":" + clientName, 0)); connection->push_back_send(PVSMsg(PVSMESSAGE, "clientToAdd", ":PVSMGR:local", 0)); diff --git a/src/gui/connectionList.cpp b/src/gui/connectionList.cpp index 61be876..2f9829e 100644 --- a/src/gui/connectionList.cpp +++ b/src/gui/connectionList.cpp @@ -432,14 +432,6 @@ void ConnectionList::on_remoteHelp() } } -/* - * - */ -void ConnectionList::showProcesses() -{ - MainWindow::getConnectionWindow()->messageStations("BROADCAST","SHOWPROCESSES"); -} - void ConnectionList::on_lock() { MainWindow::getConnectionWindow()->lockStations(); @@ -450,21 +442,6 @@ void ConnectionList::on_unlock() MainWindow::getConnectionWindow()->unlockStations(); } -/* Hier werden Nachrichten vom Server versendet: -* Type: PVSMESSAGE -* Ident: BROADCAST -* Msg: die Nachricht -* -* Wenn Ident: LOCKSTATION -> locke Client -* -* -* -* -* -* -* -*/ - void ConnectionList::on_message() { Dialog msgD; diff --git a/src/gui/connectionList.h b/src/gui/connectionList.h index 29dd174..50d8924 100644 --- a/src/gui/connectionList.h +++ b/src/gui/connectionList.h @@ -108,7 +108,6 @@ public slots: virtual void on_projection(); virtual void on_unprojection(); virtual void on_lock(); - virtual void showProcesses(); virtual void on_unlock(); virtual void on_message(); virtual void on_lock_with_message(); diff --git a/src/gui/connectionWindow.cpp b/src/gui/connectionWindow.cpp index 9e7b370..cf51051 100644 --- a/src/gui/connectionWindow.cpp +++ b/src/gui/connectionWindow.cpp @@ -263,6 +263,8 @@ bool ConnectionWindow::remoteHelp(QString sname) { } + + bool ConnectionWindow::lockStations() { if (std::list* lockList = MainWindow::getConnectionList()->getSelectedClients()) { if (!lockList->empty()) { diff --git a/src/gui/mainWindow.cpp b/src/gui/mainWindow.cpp index 4cd6997..eb15e82 100644 --- a/src/gui/mainWindow.cpp +++ b/src/gui/mainWindow.cpp @@ -116,10 +116,6 @@ MainWindow::MainWindow(QWidget *parent) : // toolbar and actions in pvsmgr - - //testweise chat starten beim klicken auf processlist - connect(ui->actionShowProcesses, SIGNAL(triggered()), this, SLOT(showProcesses())); - ui->actionShowProcesses->setStatusTip(tr("Shows list of processes of this client")); connect(ui->action_Exit, SIGNAL(triggered()), this, SLOT(close())); ui->action_Exit->setStatusTip(tr("Exit")); connect(ui->action_Disconnect, SIGNAL(triggered()), this, SLOT(disconnect())); @@ -134,8 +130,6 @@ MainWindow::MainWindow(QWidget *parent) : 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())); @@ -801,35 +795,6 @@ void MainWindow::foto() // makes a screenshot of the selected client } } -/* - * test if a client is selected and then make him tell his processlist - * - * - * - * - * - */ - -void MainWindow::showProcesses() -{ - std::list* selectedClients = - MainWindow::getConnectionList()->getSelectedClients(); - if (selectedClients->size() == 1) - { - // do stuff - } - else - { - QString - message = - QString( - tr( - "This operation can only be performed for one selected Client!")); - QMessageBox::information(this, "PVS", message); - } -} - - void MainWindow::createProfile() { profileDialog proDiag; diff --git a/src/gui/mainWindow.h b/src/gui/mainWindow.h index 5e20af2..00bd927 100644 --- a/src/gui/mainWindow.h +++ b/src/gui/mainWindow.h @@ -171,7 +171,6 @@ public slots: void projecttoolbar(); void unprojecttoolbar(); void closeUp(); - void showProcesses(); void foto(); void backgroundpicture(); void repaintbackgroundpicture(); diff --git a/src/gui/ui/mainwindow.ui b/src/gui/ui/mainwindow.ui index b5ac0e3..eb49d1b 100644 --- a/src/gui/ui/mainwindow.ui +++ b/src/gui/ui/mainwindow.ui @@ -28,8 +28,8 @@ 0 0 - 778 - 542 + 776 + 534 @@ -195,7 +195,7 @@ 0 0 838 - 23 + 28 @@ -286,7 +286,6 @@ - @@ -532,18 +531,6 @@ - - - - - :/finder:/finder - - - Show Processes - - - show processes of this client - - diff --git a/src/gui/ui/mainwindowtouch.ui b/src/gui/ui/mainwindowtouch.ui index f8e76c0..9030b17 100644 --- a/src/gui/ui/mainwindowtouch.ui +++ b/src/gui/ui/mainwindowtouch.ui @@ -28,8 +28,8 @@ 0 0 - 1329 - 660 + 1327 + 658 @@ -365,7 +365,6 @@ - @@ -637,18 +636,6 @@ Ctrl+D - - - - :/finder:/finder - - - Show Processes - - - show processes of this client - - diff --git a/src/net/pvsListenServer.cpp b/src/net/pvsListenServer.cpp index 1dac9c0..f21303e 100644 --- a/src/net/pvsListenServer.cpp +++ b/src/net/pvsListenServer.cpp @@ -245,8 +245,8 @@ bool PVSListenServer::init() return false; } ConsoleLog writeNetwork( - QString("Server is listening. Socket: ").append(int2String( - (int) _listenSocket))); + QString("Server is listening. Socket: ").append(ptr2String( + _listenSocket))); connect(_listenSocket, SIGNAL(newConnection()), this, SLOT( server_connectionRequest())); diff --git a/src/net/pvsServerConnection.cpp b/src/net/pvsServerConnection.cpp index 1ce9904..04a1ef6 100644 --- a/src/net/pvsServerConnection.cpp +++ b/src/net/pvsServerConnection.cpp @@ -133,14 +133,6 @@ void PVSServerConnection::onPing(PVSMsg pingmsg) } } -/* Hier werden Nachrichten behandelt, die vom Client kommen - * - * - * - * - * - */ - void PVSServerConnection::handleClientMsg(PVSMsg receiver) { // FIXME: @SimonR, this line cuase problems with pvs in daemon mode and dbus diff --git a/src/pvs.cpp b/src/pvs.cpp index 1531c3d..2069e36 100644 --- a/src/pvs.cpp +++ b/src/pvs.cpp @@ -176,18 +176,6 @@ void PVS::onCommand(PVSMsg cmdMessage) unlock(); return; } - if (ident.compare("SHOWPROCESSES") == 0) - { - // show processes - // ConsoleLog writeNetwork(system("ps -f -N -U root")); - // emit showMessage("SHOWPROCESSES", "proce", true); - return; - } - if (ident.compare("KILLPROCESS") == 0) - { - // do stuff if process has to be killed - return; - } #ifdef never // prototype diff --git a/src/pvsDaemon.cpp b/src/pvsDaemon.cpp index 961e0f3..e87bfe7 100644 --- a/src/pvsDaemon.cpp +++ b/src/pvsDaemon.cpp @@ -66,11 +66,13 @@ int main(int argc, char** argv) { int frequency = 5; int port = -1; - QString homeDir("/home/"); - QString scriptPath = homeDir; - scriptPath.append(getUserName().append(QString("/.pvs/pvs-vncsrv"))); - QString scriptName; - scriptName = getFilenameFromPath(scriptPath); + + QFileInfo script; + script.setFile("/usr/bin/pvs-vncsrv"); + if (!script.exists()) + script.setFile("/usr/local/bin/pvs-vncsrv"); + if (!script.exists()) + script.setFile("/home/" + getUserName() + "/.pvs/pvs-vncsrv"); QCoreApplication app(argc, argv); app.setOrganizationName("openslx"); @@ -259,8 +261,7 @@ int main(int argc, char** argv) { if (option_index + 1 < argc) { - scriptPath = QString(argv[option_index + 1]); - scriptName = getFilenameFromPath(scriptPath); + script.setFile(QString(argv[option_index + 1])); option_index++; continue; } @@ -347,13 +348,13 @@ int main(int argc, char** argv) if (port <= 0) port = SERVER_PORT_INT; ConsoleLog writeLine(QString("TCP-Port: ").append(int2String(port))); - mainClient->setScriptPath(scriptPath); - ConsoleLog writeLine(QString("VNCScriptPath: ").append(scriptPath)); + mainClient->setScriptPath(script.filePath()); + ConsoleLog writeLine(QString("VNCScriptPath: ").append(script.filePath())); createPolicyDir(); createPolicyFiles(); // long int gr = 0; - mainClient->setScriptPath(scriptPath); + mainClient->setScriptPath(script.filePath()); app.exec(); delete mainClient; diff --git a/src/util/util.cpp b/src/util/util.cpp index c2d06a0..946168e 100644 --- a/src/util/util.cpp +++ b/src/util/util.cpp @@ -325,6 +325,13 @@ QString int2String(int intInt) return QString(tmp); } +QString ptr2String(void* ptr) +{ + char tmp[50]; + snprintf(tmp, 49, "%p", ptr); + return QString(tmp); +} + int string2Int(QString string) { return atoi(string.toUtf8().data()); diff --git a/src/util/util.h b/src/util/util.h index 37565cb..6ddefc6 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -46,6 +46,7 @@ QString readPassFromPassFile(); bool getAllowed(); QString int2String(int intInt); +QString ptr2String(void* ptr); int string2Int(QString string); int string2Int(QString string); //} // end namespace util diff --git a/src/version.h b/src/version.h index c217c07..ac24ac2 100644 --- a/src/version.h +++ b/src/version.h @@ -1,2 +1,2 @@ -#define VERSION_STRING "1.9.8.0" -#define VERSION_NUMBER 1980 +#define VERSION_STRING "2.0.1.0" +#define VERSION_NUMBER 2010 -- cgit v1.2.3-55-g7522 From 25305a6ef01120bf3b0d929bae0ba7693f41c46b Mon Sep 17 00:00:00 2001 From: Johann Latocha Date: Sat, 10 Jul 2010 01:54:35 +0200 Subject: Configuration by pvs via D-Bus. Old .allow ist now deprecated, config file: .config/openslx/pvs.conf --- i18n/pvs_ar_JO.ts | 6 +-- i18n/pvs_de_DE.ts | 6 +-- i18n/pvs_es_MX.ts | 6 +-- i18n/pvs_fr_FR.ts | 6 +-- i18n/pvs_pl_PL.ts | 6 +-- i18n/pvsgui_ar_JO.ts | 58 ++++++++++++----------------- i18n/pvsgui_de_DE.ts | 54 +++++++++++++-------------- i18n/pvsgui_es_MX.ts | 54 +++++++++++++-------------- i18n/pvsgui_fr_FR.ts | 58 ++++++++++++----------------- i18n/pvsgui_pl_PL.ts | 58 ++++++++++++----------------- src/gui/clientConfigDialog.cpp | 84 ++++++++++++++++++++++++++---------------- src/gui/clientConfigDialog.h | 2 + src/gui/ui/clientToolbar.ui | 31 +--------------- src/pvs.cpp | 33 ++++++++--------- src/pvs.h | 7 +++- src/pvsgui.cpp | 30 --------------- src/pvsgui.h | 1 - 17 files changed, 215 insertions(+), 285 deletions(-) (limited to 'src/gui/ui') diff --git a/i18n/pvs_ar_JO.ts b/i18n/pvs_ar_JO.ts index 0b4c72f..022cf92 100644 --- a/i18n/pvs_ar_JO.ts +++ b/i18n/pvs_ar_JO.ts @@ -9,17 +9,17 @@ - + VNC connection - + The host - + requested your screen! diff --git a/i18n/pvs_de_DE.ts b/i18n/pvs_de_DE.ts index 0b4c72f..022cf92 100644 --- a/i18n/pvs_de_DE.ts +++ b/i18n/pvs_de_DE.ts @@ -9,17 +9,17 @@ - + VNC connection - + The host - + requested your screen! diff --git a/i18n/pvs_es_MX.ts b/i18n/pvs_es_MX.ts index 0b4c72f..022cf92 100644 --- a/i18n/pvs_es_MX.ts +++ b/i18n/pvs_es_MX.ts @@ -9,17 +9,17 @@ - + VNC connection - + The host - + requested your screen! diff --git a/i18n/pvs_fr_FR.ts b/i18n/pvs_fr_FR.ts index 0b4c72f..022cf92 100644 --- a/i18n/pvs_fr_FR.ts +++ b/i18n/pvs_fr_FR.ts @@ -9,17 +9,17 @@ - + VNC connection - + The host - + requested your screen! diff --git a/i18n/pvs_pl_PL.ts b/i18n/pvs_pl_PL.ts index 0b4c72f..022cf92 100644 --- a/i18n/pvs_pl_PL.ts +++ b/i18n/pvs_pl_PL.ts @@ -9,17 +9,17 @@ - + VNC connection - + The host - + requested your screen! diff --git a/i18n/pvsgui_ar_JO.ts b/i18n/pvsgui_ar_JO.ts index f3e6d65..04d9717 100644 --- a/i18n/pvsgui_ar_JO.ts +++ b/i18n/pvsgui_ar_JO.ts @@ -331,42 +331,32 @@ ClientToolbarClass - + Form - + Menu - + Host: - + Click to connect - + - - - Enable/Disable VNC only for this session - - - - - Allow VNC - - - - + <!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; } @@ -409,77 +399,77 @@ p, li { white-space: pre-wrap; } - + &Disconnect - + C&hat - + &Send File - + &Config - + &Information - + &About - + &Quit - - - + + + PVS Connection - + Please enter password (If not needed leave blank): - + Are you sure you want to disconnect? - - + + PVS connection + - Connected to - - + + Disconnected - + New host available: diff --git a/i18n/pvsgui_de_DE.ts b/i18n/pvsgui_de_DE.ts index 9acab81..544ebff 100644 --- a/i18n/pvsgui_de_DE.ts +++ b/i18n/pvsgui_de_DE.ts @@ -331,42 +331,40 @@ ClientToolbarClass - + Form - + Menu Menü - + Host: - + Click to connect Zum Verbinden Klicken - + - - Enable/Disable VNC only for this session - VNC nur für diese Sitzung ein- und ausschalten + VNC nur für diese Sitzung ein- und ausschalten - Allow VNC - VNC erlauben + VNC erlauben - + <!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; } @@ -409,77 +407,77 @@ p, li { white-space: pre-wrap; } Verbinden - + &Disconnect &Trennen - + C&hat - + &Send File Datei &Senden - + &Config &Konfiguration - + &Information &Information - + &About &Über - + &Quit &Beenden - - - + + + PVS Connection PVS Verbindung - + Please enter password (If not needed leave blank): Bitte geben sie ein Passwor ein (Falls nicht erforderlich einfach leer lassen): - + Are you sure you want to disconnect? Sind sie sicher dass sie die Verbindung trennen möchten? - - + + PVS connection PVS Verbindung + - Connected to Verbunden mit - - + + Disconnected Getrennt - + New host available: Neuer Host verfügbar: diff --git a/i18n/pvsgui_es_MX.ts b/i18n/pvsgui_es_MX.ts index 32b6195..855ee9b 100644 --- a/i18n/pvsgui_es_MX.ts +++ b/i18n/pvsgui_es_MX.ts @@ -331,42 +331,40 @@ ClientToolbarClass - + Form de - + Menu Menu - + Host: Host: - + Click to connect Click para conectar - + - - - Enable/Disable VNC only for this session - Avilitar/Desavilitar VNC solamente para esta sesión + Avilitar/Desavilitar VNC solamente para esta sesión - Allow VNC - Permitir VNC + Permitir VNC - + <!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; } @@ -421,77 +419,77 @@ p, li { white-space: pre-wrap; } Conectar - + &Disconnect &Desconectar - + C&hat ??? - + &Send File &Enviar archivo - + &Config &Configuración - + &Information &Información - + &About &Acerca de - + &Quit &Cerrar - - - + + + PVS Connection PVS Connección - + Please enter password (If not needed leave blank): Porfavor ingrese una contraseña (Deje la seccion vacia si no lo necesita): - + Are you sure you want to disconnect? Realmente desea desconectarse? - - + + PVS connection PVS Connección + - Connected to Connectar a - - + + Disconnected Desconectado - + New host available: Nuevo Host disponible: diff --git a/i18n/pvsgui_fr_FR.ts b/i18n/pvsgui_fr_FR.ts index f3e6d65..04d9717 100644 --- a/i18n/pvsgui_fr_FR.ts +++ b/i18n/pvsgui_fr_FR.ts @@ -331,42 +331,32 @@ ClientToolbarClass - + Form - + Menu - + Host: - + Click to connect - + - - - Enable/Disable VNC only for this session - - - - - Allow VNC - - - - + <!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; } @@ -409,77 +399,77 @@ p, li { white-space: pre-wrap; } - + &Disconnect - + C&hat - + &Send File - + &Config - + &Information - + &About - + &Quit - - - + + + PVS Connection - + Please enter password (If not needed leave blank): - + Are you sure you want to disconnect? - - + + PVS connection + - Connected to - - + + Disconnected - + New host available: diff --git a/i18n/pvsgui_pl_PL.ts b/i18n/pvsgui_pl_PL.ts index f3e6d65..04d9717 100644 --- a/i18n/pvsgui_pl_PL.ts +++ b/i18n/pvsgui_pl_PL.ts @@ -331,42 +331,32 @@ ClientToolbarClass - + Form - + Menu - + Host: - + Click to connect - + - - - Enable/Disable VNC only for this session - - - - - Allow VNC - - - - + <!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; } @@ -409,77 +399,77 @@ p, li { white-space: pre-wrap; } - + &Disconnect - + C&hat - + &Send File - + &Config - + &Information - + &About - + &Quit - - - + + + PVS Connection - + Please enter password (If not needed leave blank): - + Are you sure you want to disconnect? - - + + PVS connection + - Connected to - - + + Disconnected - + New host available: diff --git a/src/gui/clientConfigDialog.cpp b/src/gui/clientConfigDialog.cpp index 76b4f5e..3e1ee50 100644 --- a/src/gui/clientConfigDialog.cpp +++ b/src/gui/clientConfigDialog.cpp @@ -26,6 +26,12 @@ ClientConfigDialog::ClientConfigDialog(QWidget *parent) : connect(radioButtonOtherRO, SIGNAL(clicked()), this, SLOT(checkPermissions())); + // connect to D-Bus and get interface + QDBusConnection dbus = QDBusConnection::sessionBus(); + dbus.registerObject("/config", this); + dbus.registerService("org.openslx.pvsgui"); + _ifaceDBus = new OrgOpenslxPvsInterface("org.openslx.pvs", "/", dbus, this); + } ClientConfigDialog::~ClientConfigDialog() @@ -49,50 +55,66 @@ 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 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")); + _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..98da54f 100644 --- a/src/gui/clientConfigDialog.h +++ b/src/gui/clientConfigDialog.h @@ -15,6 +15,7 @@ #define CLIENTCONFIGDIALOG_H_ #include +#include "pvsinterface.h" #include "ui_clientConfigDialog.h" class ClientConfigDialog: public QDialog, private Ui::ClientConfigDialogClass @@ -37,6 +38,7 @@ private Q_SLOTS: void checkPermissions(); private: + OrgOpenslxPvsInterface *_ifaceDBus; QSettings _settings; }; diff --git a/src/gui/ui/clientToolbar.ui b/src/gui/ui/clientToolbar.ui index 5a59c5f..51cb62e 100644 --- a/src/gui/ui/clientToolbar.ui +++ b/src/gui/ui/clientToolbar.ui @@ -6,7 +6,7 @@ 0 0 - 577 + 463 28 @@ -143,35 +143,6 @@ p, li { white-space: pre-wrap; } - - - - - 0 - 0 - - - - Enable/Disable VNC only for this session - - - Allow VNC - - - - - - - Qt::Horizontal - - - - 20 - 20 - - - - diff --git a/src/pvs.cpp b/src/pvs.cpp index 2069e36..124b257 100644 --- a/src/pvs.cpp +++ b/src/pvs.cpp @@ -317,24 +317,9 @@ bool PVS::allowExists() */ bool PVS::getVNCAllow() { - if (allowExists()) - { - if (getAllowed()) - { - _vncAllowed = true; - } - else - { - _vncAllowed = false; - } - } - else - { - ConsoleLog writeError("No .allow file found."); - _vncAllowed = false; - //make sure the vncsever is off - ConsoleLog writeError("Shutting down vnc-server because we have no .allow file."); - } + + QString value = getConfigValue("Permissions/vnc_lecturer"); + _vncAllowed = (value == "rw" || value == "ro"); if (_vncAllowed && _vncRequested) { @@ -627,3 +612,15 @@ void PVS::signalHandler(int signal) } +void PVS::setConfigValue(QString key, QString value) +{ + _settings.setValue(key, value); + _settings.sync(); + getVNCAllow(); +} + +QString PVS::getConfigValue(QString key) +{ + return _settings.value(key).toString(); +} + diff --git a/src/pvs.h b/src/pvs.h index 4b1e29e..ba696d8 100644 --- a/src/pvs.h +++ b/src/pvs.h @@ -80,6 +80,9 @@ public Q_SLOTS: QStringList getAvailableHosts(); QString getIpByNick(QString nick); + void setConfigValue(QString key, QString value); + QString getConfigValue(QString key); + Q_SIGNALS: void project(QString host, int port, QString passwd, bool fullscreen, bool smoothTransformation, int quality); @@ -131,8 +134,6 @@ private: PVSServerConnection* _pvsServerConnection; ///< our tcp connection object to the pvsserver - QSettings _settings; - PVSServiceDiscovery *_sdClient; PVSChatClient *_chat; @@ -142,5 +143,7 @@ private: int _timerLockTest; int _timerLockDelay; + QSettings _settings; + }; #endif /* PVSCLIENT_H_ */ diff --git a/src/pvsgui.cpp b/src/pvsgui.cpp index 25f1cd6..6fdd673 100644 --- a/src/pvsgui.cpp +++ b/src/pvsgui.cpp @@ -76,18 +76,6 @@ PVSGUI::PVSGUI(QWidget *parent) : if (dbus.isConnected()) qDebug("[%s] Connection to DBus successful!", metaObject()->className()); - // TODO: perhaps this can go if fadi does his work - // check if vnc is allowed and setup checkbox - QFile file(QDir::toNativeSeparators(QDir::homePath() + "/.pvs/.allow")); - if (file.open(QIODevice::ReadOnly | QIODevice::Text)) - { - QTextStream in(&file); - QString line = in.readLine(); - if (line == "1") - vncCheckBox->setChecked(true); - file.close(); - } - // listen on port 29481 for incoming file transfers _serverSocket = new QTcpServer(); _serverSocket->listen(QHostAddress::Any, 29481); @@ -108,8 +96,6 @@ PVSGUI::PVSGUI(QWidget *parent) : connect(_hostMenu, SIGNAL(aboutToHide()), this, SLOT(hide())); connect(_hostMenu, SIGNAL(triggered(QAction*)), this, SLOT(pvsConnect(QAction*))); - connect(vncCheckBox, SIGNAL(stateChanged(int)), this, - SLOT(setVncAllow(int))); // signals & slots - dbus connect(_ifaceDBus, SIGNAL(showMessage(QString, QString, bool)), this, @@ -392,22 +378,6 @@ void PVSGUI::delHost(QString host) } } -// TODO: perhaps this can go if fadi does his work -void PVSGUI::setVncAllow(int i) -{ - QFile file(QDir::toNativeSeparators(QDir::homePath() + "/.pvs/.allow")); - if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) - return; - - QTextStream out(&file); - if (i == 0) - out << 0; - else - out << 1; - - file.close(); -} - void PVSGUI::sendFile() { ClientFileSendDialog *d = new ClientFileSendDialog(); diff --git a/src/pvsgui.h b/src/pvsgui.h index f9a0ab8..90fe50e 100644 --- a/src/pvsgui.h +++ b/src/pvsgui.h @@ -62,7 +62,6 @@ private Q_SLOTS: void delHost(QString host); void pvsConnect(QAction *action); void pvsDisconnect(); - void setVncAllow(int i); void sendFile(); void receiveFile(); -- cgit v1.2.3-55-g7522 From bc678fdc76862050537669ed440e5ac1179cc1ec Mon Sep 17 00:00:00 2001 From: Fabian Schillinger Date: Sat, 10 Jul 2010 02:03:45 +0200 Subject: Inserted some Buttons in GUI and TouchGUI and modified handling of commands in pvs.cpp for later remote Command/Process enhancement --- i18n/pvs_ar_JO.ts | 8 +- i18n/pvs_de_DE.ts | 8 +- i18n/pvs_es_MX.ts | 8 +- i18n/pvs_fr_FR.ts | 8 +- i18n/pvs_pl_PL.ts | 8 +- i18n/pvsmgr_ar_JO.ts | 164 ++--- i18n/pvsmgr_de_DE.ts | 164 ++--- i18n/pvsmgr_es_MX.ts | 164 ++--- i18n/pvsmgr_fr_FR.ts | 164 ++--- i18n/pvsmgr_pl_PL.ts | 164 ++--- pvsmgr.qrc | 79 +-- src/gui/mainWindow.cpp | 1320 +++++++++++++++++++++-------------------- src/gui/mainWindow.h | 1 + src/gui/ui/mainwindow.ui | 19 +- src/gui/ui/mainwindowtouch.ui | 17 +- src/pvs.cpp | 13 + 16 files changed, 1231 insertions(+), 1078 deletions(-) (limited to 'src/gui/ui') diff --git a/i18n/pvs_ar_JO.ts b/i18n/pvs_ar_JO.ts index 0b4c72f..f5b5dc5 100644 --- a/i18n/pvs_ar_JO.ts +++ b/i18n/pvs_ar_JO.ts @@ -4,22 +4,22 @@ PVS - + Message - + VNC connection - + The host - + requested your screen! diff --git a/i18n/pvs_de_DE.ts b/i18n/pvs_de_DE.ts index 0b4c72f..f5b5dc5 100644 --- a/i18n/pvs_de_DE.ts +++ b/i18n/pvs_de_DE.ts @@ -4,22 +4,22 @@ PVS - + Message - + VNC connection - + The host - + requested your screen! diff --git a/i18n/pvs_es_MX.ts b/i18n/pvs_es_MX.ts index 0b4c72f..f5b5dc5 100644 --- a/i18n/pvs_es_MX.ts +++ b/i18n/pvs_es_MX.ts @@ -4,22 +4,22 @@ PVS - + Message - + VNC connection - + The host - + requested your screen! diff --git a/i18n/pvs_fr_FR.ts b/i18n/pvs_fr_FR.ts index 0b4c72f..f5b5dc5 100644 --- a/i18n/pvs_fr_FR.ts +++ b/i18n/pvs_fr_FR.ts @@ -4,22 +4,22 @@ PVS - + Message - + VNC connection - + The host - + requested your screen! diff --git a/i18n/pvs_pl_PL.ts b/i18n/pvs_pl_PL.ts index 0b4c72f..f5b5dc5 100644 --- a/i18n/pvs_pl_PL.ts +++ b/i18n/pvs_pl_PL.ts @@ -4,22 +4,22 @@ PVS - + Message - + VNC connection - + The host - + requested your screen! diff --git a/i18n/pvsmgr_ar_JO.ts b/i18n/pvsmgr_ar_JO.ts index bc5c69c..ba391d2 100644 --- a/i18n/pvsmgr_ar_JO.ts +++ b/i18n/pvsmgr_ar_JO.ts @@ -314,360 +314,376 @@ Perform an unprojection or remove remote help to get a target. MainWindow - - + + Exit - + Remove the vnc-Connection for the selected client(s) - + Show the selected client in the whole window - + Make a screenshot for the selected client(s) - - + + Lock or Unlock all Clients - + The pvs manager - + This operation can only be performed for one selected Client! - + + This operation can only be performed if you have selected a Client! + + + + This operation can only be performed for at least one selected Client! - + You have to set a Superclient-machine before performing this action. - + Open Image - + Image Files (*.png *.jpg *.svg) - + PVSmgr - + Show Username - + Ctrl+3 - + Show IP - + Ctrl+2 - + VNC-Placeholders - + Show Log - + Ctrl+L - + Show Normal - + Ctrl+O - + Show Error - + Ctrl+E - + Show Network - + Ctrl+N - + Show Terminal - + Ctrl+T - + Show Chat - + Ctrl+G - + About pvs - + Ctrl+P - + 100 x 100 - + 200 x 200 - + 500 x 500 - + &Disconnect - + Ctrl+W - + &Exit - + Ctrl+Q - - + + Foto - + Ctrl+F - + view - + View - + Ctrl+V - + lock - + Ctrl+A - + Profile &manager - + Ctrl+M - + Show Name - + Ctrl+1 - + Chat - + Start Chat with client(s) - + Ctrl+D - + - - + + showProcesses + + + + + + Show Processes of the selected Client + + + + border-color: rgb(0, 0, 0); - + VNC quality - + HIGH - + MEDIUM - + LOW - + Set password - + Thumbnailratio - + Thumbnailrate - + 0 - + % - + background-color: rgb(255, 255, 255); - + background-color: rgb(150, 150, 150); - + &File - + Load profile - + &Clients - + &Logging - + &Help - + toolBar diff --git a/i18n/pvsmgr_de_DE.ts b/i18n/pvsmgr_de_DE.ts index fd6d56b..e8d7001 100644 --- a/i18n/pvsmgr_de_DE.ts +++ b/i18n/pvsmgr_de_DE.ts @@ -314,360 +314,376 @@ Perform an unprojection or remove remote help to get a target. MainWindow - - + + Exit - + Remove the vnc-Connection for the selected client(s) - + Show the selected client in the whole window - + Make a screenshot for the selected client(s) - - + + Lock or Unlock all Clients - + The pvs manager - + This operation can only be performed for one selected Client! - + + This operation can only be performed if you have selected a Client! + + + + This operation can only be performed for at least one selected Client! - + You have to set a Superclient-machine before performing this action. - + Open Image - + Image Files (*.png *.jpg *.svg) - + PVSmgr - + Show Username - + Ctrl+3 - + Show IP - + Ctrl+2 - + VNC-Placeholders - + Show Log - + Ctrl+L - + Show Normal - + Ctrl+O - + Show Error - + Ctrl+E - + Show Network - + Ctrl+N - + Show Terminal - + Ctrl+T - + Show Chat - + Ctrl+G - + About pvs - + Ctrl+P - + 100 x 100 - + 200 x 200 - + 500 x 500 - + &Disconnect - + Ctrl+W - + &Exit - + Ctrl+Q - - + + Foto - + Ctrl+F - + view - + View - + Ctrl+V - + lock - + Ctrl+A - + Profile &manager - + Ctrl+M - + Show Name - + Ctrl+1 - + Chat - + Start Chat with client(s) - + Ctrl+D - + - - + + showProcesses + + + + + + Show Processes of the selected Client + + + + border-color: rgb(0, 0, 0); - + VNC quality - + HIGH - + MEDIUM - + LOW - + Set password - + Thumbnailratio - + Thumbnailrate - + 0 - + % - + background-color: rgb(255, 255, 255); - + background-color: rgb(150, 150, 150); - + &File - + Load profile - + &Clients - + &Logging - + &Help - + toolBar diff --git a/i18n/pvsmgr_es_MX.ts b/i18n/pvsmgr_es_MX.ts index fc53e6d..484d600 100644 --- a/i18n/pvsmgr_es_MX.ts +++ b/i18n/pvsmgr_es_MX.ts @@ -314,360 +314,376 @@ Perform an unprojection or remove remote help to get a target. MainWindow - - + + Exit Salir - + Remove the vnc-Connection for the selected client(s) Remover la conexión VNC de los clientes seleccionados - + Show the selected client in the whole window Mostrar el cliente seleccionado en toda la ventana - + Make a screenshot for the selected client(s) Capturar la pantalla de los clientes seleccionados - - + + Lock or Unlock all Clients Bloquear o desbloquear todos los clientes - + The pvs manager PVS Manager - + This operation can only be performed for one selected Client! Esta operación solamente puede ser realizada para un cliente! - + + This operation can only be performed if you have selected a Client! + + + + This operation can only be performed for at least one selected Client! Esta operación solamente puede ser realizada para el ultimo cliente seleccionado! - + You have to set a Superclient-machine before performing this action. Usted debe asignar un super cliente antes de realizar esta acción. - + Open Image Abrir imagen - + Image Files (*.png *.jpg *.svg) Extensión de imagenes (*.png *.jpg *.svg) - + PVSmgr PVSmgr - + Show Username Mostrar nombre de usuario - + Ctrl+3 Ctrl+3 - + Show IP Mostrar IP - + Ctrl+2 Ctrl+2 - + VNC-Placeholders VNC - Marcadores de posición - + Show Log Mostrar Log - + Ctrl+L Ctrl+L - + Show Normal Mostrar normal - + Ctrl+O Ctrl+O - + Show Error Mostrar Errores - + Ctrl+E Ctrl+E - + Show Network Mostrar Red - + Ctrl+N - + Show Terminal Mostrar Linea de comandos - + Ctrl+T Ctrl+T - + Show Chat Mostrar Chat - + Ctrl+G Ctrl+G - + About pvs Acerca de PVS - + Ctrl+P Ctrl+P - + 100 x 100 100 x 100 - + 200 x 200 200 x 200 - + 500 x 500 500 x 500 - + &Disconnect &Desconectar - + Ctrl+W Ctrl+W - + &Exit &Salir - + Ctrl+Q Ctrl+Q - - + + Foto Imagen - + Ctrl+F Ctrl+F - + view ver - + View Ver - + Ctrl+V Ctrl+V - + lock bloquear - + Ctrl+A Ctrl+A - + Profile &manager Perfil &manager - + Ctrl+M Ctrl+M - + Show Name Mostrar nombre - + Ctrl+1 Ctrl+1 - + Chat Chat - + Start Chat with client(s) Iniciar Chat con cliente(s) - + Ctrl+D Ctrl+D - + - - - + + showProcesses + + + + + + Show Processes of the selected Client + + + + border-color: rgb(0, 0, 0); border-color: rgb(0, 0, 0); - + VNC quality VNC calidad - + HIGH Alta - + MEDIUM Media - + LOW Baja - + Set password Asignar contraseña - + Thumbnailratio Radio de la vista en miniatura - + Thumbnailrate Frecuancia de actualización para las vistas en miniatura - + 0 0 - + % % - + background-color: rgb(255, 255, 255); background-color: rgb(255, 255, 255); - + background-color: rgb(150, 150, 150); background-color: rgb(150, 150, 150); - + &File &Archivo - + Load profile Cargar perfil - + &Clients &Clientes - + &Logging &Logging - + &Help &Ayuda - + toolBar Barra de herramientas diff --git a/i18n/pvsmgr_fr_FR.ts b/i18n/pvsmgr_fr_FR.ts index bc5c69c..ba391d2 100644 --- a/i18n/pvsmgr_fr_FR.ts +++ b/i18n/pvsmgr_fr_FR.ts @@ -314,360 +314,376 @@ Perform an unprojection or remove remote help to get a target. MainWindow - - + + Exit - + Remove the vnc-Connection for the selected client(s) - + Show the selected client in the whole window - + Make a screenshot for the selected client(s) - - + + Lock or Unlock all Clients - + The pvs manager - + This operation can only be performed for one selected Client! - + + This operation can only be performed if you have selected a Client! + + + + This operation can only be performed for at least one selected Client! - + You have to set a Superclient-machine before performing this action. - + Open Image - + Image Files (*.png *.jpg *.svg) - + PVSmgr - + Show Username - + Ctrl+3 - + Show IP - + Ctrl+2 - + VNC-Placeholders - + Show Log - + Ctrl+L - + Show Normal - + Ctrl+O - + Show Error - + Ctrl+E - + Show Network - + Ctrl+N - + Show Terminal - + Ctrl+T - + Show Chat - + Ctrl+G - + About pvs - + Ctrl+P - + 100 x 100 - + 200 x 200 - + 500 x 500 - + &Disconnect - + Ctrl+W - + &Exit - + Ctrl+Q - - + + Foto - + Ctrl+F - + view - + View - + Ctrl+V - + lock - + Ctrl+A - + Profile &manager - + Ctrl+M - + Show Name - + Ctrl+1 - + Chat - + Start Chat with client(s) - + Ctrl+D - + - - + + showProcesses + + + + + + Show Processes of the selected Client + + + + border-color: rgb(0, 0, 0); - + VNC quality - + HIGH - + MEDIUM - + LOW - + Set password - + Thumbnailratio - + Thumbnailrate - + 0 - + % - + background-color: rgb(255, 255, 255); - + background-color: rgb(150, 150, 150); - + &File - + Load profile - + &Clients - + &Logging - + &Help - + toolBar diff --git a/i18n/pvsmgr_pl_PL.ts b/i18n/pvsmgr_pl_PL.ts index bc5c69c..ba391d2 100644 --- a/i18n/pvsmgr_pl_PL.ts +++ b/i18n/pvsmgr_pl_PL.ts @@ -314,360 +314,376 @@ Perform an unprojection or remove remote help to get a target. MainWindow - - + + Exit - + Remove the vnc-Connection for the selected client(s) - + Show the selected client in the whole window - + Make a screenshot for the selected client(s) - - + + Lock or Unlock all Clients - + The pvs manager - + This operation can only be performed for one selected Client! - + + This operation can only be performed if you have selected a Client! + + + + This operation can only be performed for at least one selected Client! - + You have to set a Superclient-machine before performing this action. - + Open Image - + Image Files (*.png *.jpg *.svg) - + PVSmgr - + Show Username - + Ctrl+3 - + Show IP - + Ctrl+2 - + VNC-Placeholders - + Show Log - + Ctrl+L - + Show Normal - + Ctrl+O - + Show Error - + Ctrl+E - + Show Network - + Ctrl+N - + Show Terminal - + Ctrl+T - + Show Chat - + Ctrl+G - + About pvs - + Ctrl+P - + 100 x 100 - + 200 x 200 - + 500 x 500 - + &Disconnect - + Ctrl+W - + &Exit - + Ctrl+Q - - + + Foto - + Ctrl+F - + view - + View - + Ctrl+V - + lock - + Ctrl+A - + Profile &manager - + Ctrl+M - + Show Name - + Ctrl+1 - + Chat - + Start Chat with client(s) - + Ctrl+D - + - - + + showProcesses + + + + + + Show Processes of the selected Client + + + + border-color: rgb(0, 0, 0); - + VNC quality - + HIGH - + MEDIUM - + LOW - + Set password - + Thumbnailratio - + Thumbnailrate - + 0 - + % - + background-color: rgb(255, 255, 255); - + background-color: rgb(150, 150, 150); - + &File - + Load profile - + &Clients - + &Logging - + &Help - + toolBar diff --git a/pvsmgr.qrc b/pvsmgr.qrc index 171412e..667d71c 100644 --- a/pvsmgr.qrc +++ b/pvsmgr.qrc @@ -1,58 +1,59 @@ - + + icons/gears.png icons/projection.png icons/reset.png - icons/finder.png - icons/exit.png - icons/terminal.png - icons/photo.png - icons/photo2.png - icons/log-out.png - icons/view-restore.png - icons/lock.png - icons/profile.png - icons/dozent.svg - icons/offline.png - icons/online.png - icons/source.png - icons/target.png - icons/dozent.png - icons/chat.png - icons/cam32.svg + icons/finder.png + icons/exit.png + icons/terminal.png + icons/photo.png + icons/photo2.png + icons/log-out.png + icons/view-restore.png + icons/lock.png + icons/profile.png + icons/dozent.svg + icons/offline.png + icons/online.png + icons/source.png + icons/target.png + icons/dozent.png + icons/chat.png + icons/cam32.svg AUTHORS - TRANSLATION + TRANSLATION - + icons/unprojection.png icons/unlocksingle.png icons/locksingle.png - build/pvsmgr_de_DE.qm + build/pvsmgr_de_DE.qm - - build/pvsmgr_de_DE.qm + + build/pvsmgr_de_DE.qm - - build/pvsmgr_fr_FR.qm + + build/pvsmgr_fr_FR.qm - - build/pvsmgr_fr_FR.qm + + build/pvsmgr_fr_FR.qm - - build/pvsmgr_es_MX.qm + + build/pvsmgr_es_MX.qm - - build/pvsmgr_es_MX.qm + + build/pvsmgr_es_MX.qm - - build/pvsmgr_ar_JO.qm + + build/pvsmgr_ar_JO.qm - - build/pvsmgr_ar_JO.qm + + build/pvsmgr_ar_JO.qm - - build/pvsmgr_pl_PL.qm + + build/pvsmgr_pl_PL.qm - - build/pvsmgr_pl_PL.qm + + build/pvsmgr_pl_PL.qm diff --git a/src/gui/mainWindow.cpp b/src/gui/mainWindow.cpp index eb15e82..473c85b 100644 --- a/src/gui/mainWindow.cpp +++ b/src/gui/mainWindow.cpp @@ -10,7 +10,7 @@ # 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. # ----------------------------------------------------------------------------- */ @@ -37,131 +37,129 @@ using namespace std; #include MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), ui(new Ui::MainWindow) + QMainWindow(parent), ui(new Ui::MainWindow) { - ui->setupUi(this); + ui->setupUi(this); - 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->actionShowProcesses, SIGNAL(triggered()), this, SLOT(showProcesses())); - 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())); - - // Ui specific settings - - 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->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 +178,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 +224,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 +252,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; - - //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 - "; + 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 - "; 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; iaddFrameBySettings(keys.at(i), pos); - } - } - - MainWindow::getConnectionWindow()->showFrameFromSettings(); + 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(); #ifdef MAINWINDOW_USE_NORMALGUI - foreach (QString profile, getProfilList()) - addProfileInMenu(profile); + foreach (QString profile, getProfilList()) + addProfileInMenu(profile); #endif } @@ -329,17 +320,17 @@ void MainWindow::loadProfile(QAction* actiontriggered) void MainWindow::loadSettings(QString profilname) // loads the current profile { - QList 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) + QList 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 (cFrame->isDummy()) { @@ -348,90 +339,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 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()); - } + QList 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()); + } #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 +434,87 @@ void MainWindow::removeConnection(PVSClient* newCon) void MainWindow::onConnectionFailed(QString host) { #ifdef never - // 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? - - { - 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();*/ + // 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? + + { + 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();*/ #endif } void MainWindow::onConnectionTerminated(PVSClient* newConnection) { #ifdef never - // 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"; - - // now inform - QString caption, secondary; - - 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();*/ + // 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"; + + // now inform + QString caption, secondary; + + 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();*/ #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 +530,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 +578,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* 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++; + std::list* 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++; } 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,119 +700,153 @@ void MainWindow::lockUnlockAll() void MainWindow::closeUp() { - std::list* 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* 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); - - is_closeup = false; - conWin->setCloseupFrame(NULL); - } + } + 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* 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* selectedClients = - MainWindow::getConnectionList()->getSelectedClients(); - if (selectedClients->size() > 0) - { - QString format = "png"; - for (std::list::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* selectedClients = + MainWindow::getConnectionList()->getSelectedClients(); + if (selectedClients->size() > 0) + { + QString format = "png"; + for (std::list::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); + } } 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() @@ -838,15 +865,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* selClients = getConnectionList()->getSelectedClients(); + std::list* selClients = + getConnectionList()->getSelectedClients(); if (selClients->size() > 0) { for (std::list::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; @@ -861,46 +889,46 @@ void MainWindow::changeRatio(int ratio) // needed the change the size of the vnc QList 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* 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* selClients = getConnectionList()->getSelectedClients(); - if (selClients->size() > 0) + for (std::list::iterator client = selClients->begin(); client + != selClients->end(); client++) { - for (std::list::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 clients = PVSConnectionManager::getManager()->getConnections(); + foreach (PVSClient* client, clients) { - std::list 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); } - } + +} } /* @@ -914,18 +942,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* selClients = getConnectionList()->getSelectedClients(); + std::list* 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); @@ -941,16 +970,19 @@ void MainWindow::changeStatus(int index) { _isThumbnailrate = true; ui->label_3->setText("ms"); - std::list* selClients = getConnectionList()->getSelectedClients(); + std::list* 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); } @@ -963,7 +995,6 @@ void MainWindow::changeStatus(int index) } } - /* * Going to run a new vncthread with quality: quality */ @@ -973,47 +1004,48 @@ void MainWindow::setVNCQuality(int quality) if (selClients->size() > 0) { for (std::list::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 FrameList = MainWindow::getConnectionWindow()->getFrameList(); - foreach(ConnectionFrame* frame, FrameList) - { - frame->resetConnectionWithQuality(quality); - frame->update(); - } + QList 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); } } @@ -1023,153 +1055,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); - - img2.save(""+test+""); + QImage img2 = img.scaled(ui->widget->size(), Qt::IgnoreAspectRatio, + Qt::FastTransformation); - ui->widget->setStyleSheet("background-image: url(/tmp/test.png);background-repeat:no-repeat; background-position:center;"); + img2.save("" + test + ""); + 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 { @@ -1181,8 +1215,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(); } @@ -1197,9 +1231,7 @@ void MainWindow::startChatDialog() sChatDialog.raise();//show the chat dialog on top level } - - -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..1e4a18f 100644 --- a/src/gui/mainWindow.h +++ b/src/gui/mainWindow.h @@ -176,6 +176,7 @@ public slots: void repaintbackgroundpicture(); void setdozenttoolbar(); void startChatDialog(); + void showProcesses(); private slots: void onToggleLog(bool showtime); diff --git a/src/gui/ui/mainwindow.ui b/src/gui/ui/mainwindow.ui index eb49d1b..374177a 100644 --- a/src/gui/ui/mainwindow.ui +++ b/src/gui/ui/mainwindow.ui @@ -28,8 +28,8 @@ 0 0 - 776 - 534 + 778 + 542 @@ -195,7 +195,7 @@ 0 0 838 - 28 + 23 @@ -286,6 +286,7 @@ + @@ -531,6 +532,18 @@ - + + + + :/icons/gears.png:/icons/gears.png + + + showProcesses + + + Show Processes of the selected Client + + diff --git a/src/gui/ui/mainwindowtouch.ui b/src/gui/ui/mainwindowtouch.ui index 9030b17..8b76101 100644 --- a/src/gui/ui/mainwindowtouch.ui +++ b/src/gui/ui/mainwindowtouch.ui @@ -28,8 +28,8 @@ 0 0 - 1327 - 658 + 1329 + 660 @@ -365,6 +365,7 @@ + @@ -636,6 +637,18 @@ Ctrl+D + + + + :/icons/gears.png:/icons/gears.png + + + showProcesses + + + Show Processes of the selected Client + + diff --git a/src/pvs.cpp b/src/pvs.cpp index 2069e36..66a1c88 100644 --- a/src/pvs.cpp +++ b/src/pvs.cpp @@ -176,6 +176,19 @@ void PVS::onCommand(PVSMsg cmdMessage) unlock(); return; } + if (ident.compare("SHOWPROCESSES") == 0) + { + // do stuff to show processes + // to test if SHOWPROCESSES command is submitted correct uncomment following lines + // a messagebox will appear on the client + // emit showMessage("Show Processes", "", true); + return; + } + if (ident.compare("KILLPROCESS") == 0) + { + // do stuff to kill a process + return; + } #ifdef never // prototype -- cgit v1.2.3-55-g7522 From 2ad0ca683dfade47078a2aafce9921ca238a9436 Mon Sep 17 00:00:00 2001 From: Sebastien Braun Date: Sat, 17 Jul 2010 16:43:08 +0200 Subject: Implement UI and pvsDaemon components for outgoing Multicast Transfer --- CMakeLists.txt | 7 +- src/gui/clientFileSendDialog.cpp | 201 ++++++++++++++++++++++++++--- src/gui/clientFileSendDialog.h | 21 ++++ src/gui/ui/clientFileSendDialog.ui | 15 ++- src/gui/ui/clientNicklistDialog.ui | 7 ++ src/net/mcast/McastConfiguration.cpp | 39 ++++++ src/net/mcast/McastConfiguration.h | 5 + src/net/mcast/McastPGMSocket.cpp | 12 +- src/net/mcast/McastSender.cpp | 2 +- src/net/pvsOutgoingMulticastTransfer.cpp | 209 +++++++++++++++++++++++++++++++ src/net/pvsOutgoingMulticastTransfer.h | 92 ++++++++++++++ src/net/pvsServerConnection.h | 7 +- src/pvs.cpp | 60 +++++++++ src/pvs.h | 17 +++ 14 files changed, 661 insertions(+), 33 deletions(-) create mode 100644 src/net/pvsOutgoingMulticastTransfer.cpp create mode 100644 src/net/pvsOutgoingMulticastTransfer.h (limited to 'src/gui/ui') diff --git a/CMakeLists.txt b/CMakeLists.txt index 8eb1961..93e281e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,6 +99,7 @@ SET( PVS_SRCS src/net/pvsDiscoveredServer.cpp src/util/TextFile.cpp src/util/serviceDiscoveryUtil.cpp + src/net/pvsOutgoingMulticastTransfer.cpp ) # pvsgui @@ -192,6 +193,7 @@ SET( PVS_MOC_HDRS src/net/pvsServerConnection.h src/net/pvsServiceDiscovery.h src/net/pvsDiscoveredServer.h + src/net/pvsOutgoingMulticastTransfer.h ) SET( PVSGUI_MOC_HDRS @@ -313,27 +315,24 @@ TARGET_LINK_LIBRARIES( pvsmgr ${QT_LIBRARIES} ${VNC_LIBRARIES} ${X11_LIBRARIES} - pgm ) TARGET_LINK_LIBRARIES( pvsmgrtouch ${QT_LIBRARIES} ${VNC_LIBRARIES} ${X11_LIBRARIES} - pgm ) TARGET_LINK_LIBRARIES( pvs ${QT_LIBRARIES} ${VNC_LIBRARIES} ${X11_LIBRARIES} - pgm + pvsmcast ) TARGET_LINK_LIBRARIES( pvsgui ${QT_LIBRARIES} ${VNC_LIBRARIES} - pgm ) SET_PROPERTY(TARGET pvsmgrtouch PROPERTY COMPILE_DEFINITIONS MAINWINDOW_USE_TOUCHGUI) diff --git a/src/gui/clientFileSendDialog.cpp b/src/gui/clientFileSendDialog.cpp index ccb44b3..25e3eaa 100644 --- a/src/gui/clientFileSendDialog.cpp +++ b/src/gui/clientFileSendDialog.cpp @@ -22,6 +22,10 @@ ClientFileSendDialog::ClientFileSendDialog(QWidget *parent) : { setupUi(this); + _transferID = 0; + _error = false; + _isMulticast = false; + _file = NULL; _socket = NULL; _clientNicklistDialog = new ClientNicklistDialog(this); @@ -60,7 +64,15 @@ void ClientFileSendDialog::open() reject(); return; } - open(_clientNicklistDialog->getNick()); + + if (_clientNicklistDialog->isSendToAll()) + { + sendToAll(); + } + else + { + open(_clientNicklistDialog->getNick()); + } } void ClientFileSendDialog::open(QString nick) @@ -75,6 +87,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 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 +205,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 +238,30 @@ void ClientFileSendDialog::sendFile() void ClientFileSendDialog::close() { - if (_file && _file->isOpen()) - { - _file->close(); - qDebug("[%s] File closed.", metaObject()->className()); - } - - if (_socket && _socket->isOpen()) + if (!_isMulticast) { - 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 (_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()); + } } - 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 +271,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 +307,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 +379,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/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 @@ 0 0 - 186 - 108 + 528 + 144 @@ -33,7 +33,7 @@ - + @@ -61,10 +61,17 @@ + + + + + + + - + 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 @@ -28,6 +28,13 @@ + + + + Send to &all + + + diff --git a/src/net/mcast/McastConfiguration.cpp b/src/net/mcast/McastConfiguration.cpp index 1a1c0a8..489eb3f 100644 --- a/src/net/mcast/McastConfiguration.cpp +++ b/src/net/mcast/McastConfiguration.cpp @@ -5,5 +5,44 @@ * Author: brs */ +#include + #include "McastConfiguration.h" +void McastConfiguration::loadFrom(QSettings* _settings, char const* group) +{ + if (group) + _settings->beginGroup(group); + + _multicastAddress = _settings->value("groupAddress", DEFAULT_MULTICAST_ADDRESS).toString(); + _multicastInterface = _settings->value("interface", DEFAULT_MULTICAST_INTERFACE).toString(); + _multicastMTU = _settings->value("mtu", DEFAULT_MULTICAST_MTU).value(); + _multicastRate = _settings->value("rate", DEFAULT_MULTICAST_RATE).value(); + _multicastUseUDP = _settings->value("use-udp", DEFAULT_MULTICAST_USEUDP).toBool(); + _multicastWinSize = _settings->value("winsize", DEFAULT_MULTICAST_WSIZ).value(); + _multicastUDPPortBase = _settings->value("portbase", DEFAULT_MULTICAST_UDPPORT).value(); + _multicastDPort = _settings->value("dport", DEFAULT_MULTICAST_DPORT).value(); + _multicastSPort = _settings->value("sport", DEFAULT_MULTICAST_SPORT).value(); + + if (group) + _settings->endGroup(); +} + +void McastConfiguration::writeTo(QSettings* _settings, char const* group) const +{ + if (group) + _settings->beginGroup(group); + + _settings->setValue("groupAddress", _multicastAddress); + _settings->setValue("interface", _multicastInterface); + _settings->setValue("mtu", _multicastMTU); + _settings->setValue("rate", _multicastRate); + _settings->setValue("use-udp", _multicastUseUDP); + _settings->setValue("winsize", _multicastWinSize); + _settings->setValue("portbase", _multicastUDPPortBase); + _settings->setValue("dport", _multicastDPort); + _settings->setValue("sport", _multicastSPort); + + if (group) + _settings->endGroup(); +} diff --git a/src/net/mcast/McastConfiguration.h b/src/net/mcast/McastConfiguration.h index 2e64678..b010f60 100644 --- a/src/net/mcast/McastConfiguration.h +++ b/src/net/mcast/McastConfiguration.h @@ -23,6 +23,8 @@ #include "McastConstants.h" +class QSettings; + class McastConfiguration: public QObject { Q_OBJECT @@ -164,6 +166,9 @@ public: emit changed(); } + void loadFrom(QSettings* settings, char const* group = 0); + void writeTo(QSettings* settings, char const* group = 0) const; + signals: void changed(); diff --git a/src/net/mcast/McastPGMSocket.cpp b/src/net/mcast/McastPGMSocket.cpp index 105bea9..7952f00 100644 --- a/src/net/mcast/McastPGMSocket.cpp +++ b/src/net/mcast/McastPGMSocket.cpp @@ -567,6 +567,11 @@ void McastPGMSocket::sendPacket(QByteArray const& bytes) void McastPGMSocket::finish() { + if (_finished) + { + return; + } + qDebug() << "finish()"; Q_FOREACH(QSocketNotifier* notif, _priv->_notifs) @@ -582,8 +587,11 @@ void McastPGMSocket::finish() _priv->send_notif = 0; } - pgm_close(_priv->socket, 1); - _priv->socket = 0; + if (_priv->socket) + { + pgm_close(_priv->socket, 1); + _priv->socket = 0; + } _finished = true; diff --git a/src/net/mcast/McastSender.cpp b/src/net/mcast/McastSender.cpp index 322b751..e25ec86 100644 --- a/src/net/mcast/McastSender.cpp +++ b/src/net/mcast/McastSender.cpp @@ -111,6 +111,6 @@ void McastSender::close() void McastSender::socketFinished() { - delete _socket; + _socket->deleteLater(); emit finished(); } diff --git a/src/net/pvsOutgoingMulticastTransfer.cpp b/src/net/pvsOutgoingMulticastTransfer.cpp new file mode 100644 index 0000000..2f24d49 --- /dev/null +++ b/src/net/pvsOutgoingMulticastTransfer.cpp @@ -0,0 +1,209 @@ +/* +# Copyright (c) 2009 - OpenSLX Project, Computer Center University of Freiburg +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your suggestions, praise, or complaints to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org/ +# ----------------------------------------------------------------------------- +# src/net/pvsOutgoingMulticastTransfer.cpp +# - wrap McastSender functionality in PVS daemon +# ----------------------------------------------------------------------------- +*/ + +#include "pvsOutgoingMulticastTransfer.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +PVSOutgoingMulticastTransfer::PVSOutgoingMulticastTransfer(QString senderName, quint64 id, QString filename, QObject* parent) : + QObject(parent), + _file(0), + _progress(0), + _config(0), + _socket(0), + _progressTimer(0), + _prepareTimer(0), + _senderName(senderName), + _id(id), + _error(false) +{ + QFileInfo finfo(filename); + if(!finfo.exists()) + { + error("File does not exist"); + } + + if(!finfo.isReadable()) + { + error("File is not readable"); + } + + _file = new QFile(filename, this); + _length = _file->size(); +} + +PVSOutgoingMulticastTransfer::~PVSOutgoingMulticastTransfer() +{ + if(_file) + delete _file; + if(_config) + delete _config; +} + +void PVSOutgoingMulticastTransfer::prepare() +{ + if (_socket && !_socketInacceptable) + { + _prepareTimer->stop(); + delete _prepareTimer; + _prepareTimer = 0; + + QTimer::singleShot(0, this, SLOT(doStart())); + return; + } + else if (_socket) + { + delete _socket; + _socket = 0; + } + + QSettings settings; + quint16 portbase = settings.value("multicast/port-base", "6966").value(); + quint16 portlimit = settings.value("multicast/port-limit", "7966").value(); + + int tries_remaining = 5; + while(tries_remaining > 0) + { + quint16 port = portbase + (qrand() % (portlimit - portbase + 1)); + + if (!_config) + { + _config = new McastConfiguration(); + } + _config->loadFrom(&settings, "multicast"); + _config->multicastUDPPortBase(port); + + _socket = new McastPGMSocket(this); + if(_socket->open(_config, McastPGMSocket::PSOCK_WRITE)) + { + break; + } + else + { + delete _socket; + _socket = 0; + } + } + + if (!_socket) + { + emit failed(_id, "Could not open socket"); + delete _prepareTimer; + _prepareTimer = 0; + return; + } + else + { + _socketInacceptable = false; + // announce the transfer: + QFileInfo info(*_file); + QString message = QString("%1:%2:%3:%4:%5").arg(_senderName).arg(_id).arg(info.baseName()).arg(info.size()).arg(_config->multicastUDPPortBase()); + PVSMsg msg(PVSCOMMAND, "MCASTFTANNOUNCE", message); + emit announce(msg); + _prepareTimer->start(5000); + } +} + +void PVSOutgoingMulticastTransfer::doStart() +{ + ConsoleLog writeLine(QString("Starting multicast transfer %1").arg(_id)); + + _file->open(QIODevice::ReadOnly); + + _sender = new McastSender(_file, _config, this); + connect(_sender, SIGNAL(finished()), SLOT(senderFinished())); + connect(_sender, SIGNAL(progress(quint64)), SLOT(senderProgress(quint64))); + // connect(_sender, SIGNAL(allSent()), SIGNAL(allSent())); + _socket->setParent(_sender); + _sender->start(_socket); + + emit started(_id); + + _progressTimer = new QTimer(this); + connect(_progressTimer, SIGNAL(timeout()), SLOT(reportTimeout())); + _progressTimer->setInterval(333); + _progressTimer->start(); +} + +void PVSOutgoingMulticastTransfer::senderProgress(quint64 bytes) + +{ + _progress = bytes; +} + +void PVSOutgoingMulticastTransfer::senderFinished() +{ + if(_progressTimer) + { + _progressTimer->stop(); + delete _progressTimer; + _progressTimer = 0; + } + emit finished(_id); + _sender->close(); + delete _sender; +} + +void PVSOutgoingMulticastTransfer::reportTimeout() +{ + emit progress(_id, _progress, _length); +} + +void PVSOutgoingMulticastTransfer::retry() +{ + bool first = !_socketInacceptable; + _socketInacceptable = true; + + if(first) + { + _prepareTimer->setInterval(1000); + } +} + +void PVSOutgoingMulticastTransfer::start() +{ + if (!_prepareTimer) + { + _prepareTimer = new QTimer(this); + _prepareTimer->setSingleShot(true); + connect(_prepareTimer, SIGNAL(timeout()), SLOT(prepare())); + } + QTimer::singleShot(0, this, SLOT(prepare())); +} + +void PVSOutgoingMulticastTransfer::abort() +{ + if (_sender) + _sender->close(); +} + +void PVSOutgoingMulticastTransfer::error(QString const& reason) +{ + qCritical() << "Could not create an outgoing mcast transfer: " << reason; + _error = true; + _reason = reason; +} diff --git a/src/net/pvsOutgoingMulticastTransfer.h b/src/net/pvsOutgoingMulticastTransfer.h new file mode 100644 index 0000000..5fd6a3d --- /dev/null +++ b/src/net/pvsOutgoingMulticastTransfer.h @@ -0,0 +1,92 @@ +/* +# Copyright (c) 2009 - OpenSLX Project, Computer Center University of Freiburg +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your suggestions, praise, or complaints to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org/ +# ----------------------------------------------------------------------------- +# src/net/pvsOutgoingMulticastTransfer.h +# - wrap McastSender functionality in PVS daemon +# ----------------------------------------------------------------------------- +*/ + +#ifndef PVSOUTGOINGMULTICASTTRANSFER_H_ +#define PVSOUTGOINGMULTICASTTRANSFER_H_ + +#include +#include +#include + +#include + +class QFile; +class QTimer; +class McastConfiguration; +class McastPGMSocket; +class McastSender; + +class PVSOutgoingMulticastTransfer : public QObject +{ + Q_OBJECT +public: + PVSOutgoingMulticastTransfer(QString senderName, quint64 id, QString filename, QObject* parent = 0); + virtual ~PVSOutgoingMulticastTransfer(); + + quint64 id() const + { + return _id; + } + + bool isError() const + { + return _error; + } + + QString reason() const + { + return _reason; + } + +signals: + void started(qulonglong id); + void progress(qulonglong id, qulonglong bytes, qulonglong of); + void allSent(qulonglong id); + void finished(qulonglong id); + void failed(qulonglong id, QString const reason); + void announce(PVSMsg announcement); + +private slots: + void senderProgress(quint64 bytes); + void senderFinished(); + void reportTimeout(); + void doStart(); + void prepare(); + +public slots: + void start(); + void abort(); + void retry(); + +private: + QFile* _file; + quint64 _length; + quint64 _progress; + McastConfiguration* _config; + McastPGMSocket* _socket; + McastSender* _sender; + QTimer* _progressTimer; + QTimer* _prepareTimer; + QString _senderName; + quint64 _id; + bool _error; + QString _reason; + bool _socketInacceptable; + + void error(QString const& reason); +}; + +#endif /* PVSOUTGOINGMULTICASTTRANSFER_H_ */ diff --git a/src/net/pvsServerConnection.h b/src/net/pvsServerConnection.h index 0669d88..c6ef015 100644 --- a/src/net/pvsServerConnection.h +++ b/src/net/pvsServerConnection.h @@ -11,9 +11,9 @@ #define _PVSSERVERCONNECTION_H_ #include "src/util/dispatcher.h" +#include "src/net/pvsMsg.h" #include -class PVSMsg; class PVS; class PVSDiscoveredServer; @@ -30,8 +30,6 @@ public: return _socket != NULL && _socket->state() == QAbstractSocket::ConnectedState; } - void sendMessage(PVSMsg newMessage); - void ping(); QString getServerName(); @@ -63,6 +61,9 @@ public: _commandDispatcher.removeListener(ident, who, func); }; +public Q_SLOTS: + void sendMessage(PVSMsg newMessage); + protected: void timerEvent(QTimerEvent *event); diff --git a/src/pvs.cpp b/src/pvs.cpp index 2069e36..c7fe5ce 100644 --- a/src/pvs.cpp +++ b/src/pvs.cpp @@ -15,6 +15,8 @@ #include "src/net/pvsMsg.h" #include "src/net/pvsServiceDiscovery.h" #include "src/net/pvsDiscoveredServer.h" +#include "src/net/mcast/McastConfiguration.h" +#include "src/net/pvsOutgoingMulticastTransfer.h" // D-Bus #include "pvsadaptor.h" @@ -38,6 +40,7 @@ PVS::PVS() : loadCommands(); _blankScreen = NULL; _vncPort = -1; + _masterMcastConfig = new McastConfiguration(this); // add a notify to the allow file, so we get informed when the file is changed QString watchPath("/home/"); @@ -176,6 +179,17 @@ void PVS::onCommand(PVSMsg cmdMessage) unlock(); return; } + if (ident.compare("MCASTFTRETRY") == 0) + { + QStringList fields = message.split(':'); + if (fields[0].compare(getUserName()) == 0) + { + quint64 id = fields[0].toULongLong(); + PVSOutgoingMulticastTransfer* transfer = _outgoingTransfers.value(id, 0); + if (transfer) + transfer->retry(); + } + } #ifdef never // prototype @@ -627,3 +641,49 @@ void PVS::signalHandler(int signal) } +bool PVS::createMulticastTransfer(QString const& objectPath, quint64& transferID, QString& errorReason) +{ + transferID = generateMcastTransferID(); + + PVSOutgoingMulticastTransfer* transfer = new PVSOutgoingMulticastTransfer(getUserName(), transferID, objectPath, this); + if (transfer->isError()) + { + errorReason = transfer->reason(); + delete transfer; + return false; + } + + _outgoingTransfers.insert(transferID, transfer); + connect(transfer, SIGNAL(started(qulonglong)), SIGNAL(outgoingMulticastTransferStarted(qulonglong))); + connect(transfer, SIGNAL(finished(qulonglong)), SIGNAL(outgoingMulticastTransferFinished(qulonglong))); + connect(transfer, SIGNAL(failed(qulonglong, QString const)), SIGNAL(outgoingMulticastTransferFailed(qulonglong, QString const))); + connect(transfer, SIGNAL(progress(qulonglong, qulonglong, qulonglong)), SIGNAL(outgoingMulticastTransferProgress(qulonglong, qulonglong, qulonglong))); + connect(transfer, SIGNAL(announce(PVSMsg)), _pvsServerConnection, SLOT(sendMessage(PVSMsg))); + QTimer::singleShot(0, transfer, SLOT(start())); + errorReason = ""; + return true; +} + +void PVS::cancelOutgoingMulticastTransfer(quint64 transferID) +{ + PVSOutgoingMulticastTransfer* transfer = _outgoingTransfers.value(transferID, 0); + + if (transfer) + { + delete transfer; + } +} + +quint64 PVS::generateMcastTransferID() +{ + static quint64 nodeID = 0; + static quint16 counter = 0; + + if (!nodeID) + { + QDataStream(QCryptographicHash::hash(getUserName().toLocal8Bit(), QCryptographicHash::Md5)) >> nodeID; + } + + return (nodeID & Q_UINT64_C(0xffffffffffff0000)) | (quint64)(++counter); +} + diff --git a/src/pvs.h b/src/pvs.h index 4b1e29e..93596d2 100644 --- a/src/pvs.h +++ b/src/pvs.h @@ -28,6 +28,8 @@ class PVSServiceDiscovery; class PVSDiscoveredServer; +class McastConfiguration; +class PVSOutgoingMulticastTransfer; /** * PVSClient @@ -80,6 +82,11 @@ public Q_SLOTS: QStringList getAvailableHosts(); QString getIpByNick(QString nick); + // Multicast File Transfer + bool createMulticastTransfer(QString const& objectPath, quint64& transferID, QString& errorReason); + void cancelOutgoingMulticastTransfer(quint64 transferID); + + Q_SIGNALS: void project(QString host, int port, QString passwd, bool fullscreen, bool smoothTransformation, int quality); @@ -93,6 +100,12 @@ Q_SIGNALS: void addHost(QString host); void delHost(QString host); + // Multicast File Transfer + void outgoingMulticastTransferStarted(qulonglong transferID); + void outgoingMulticastTransferProgress(qulonglong transferID, qulonglong bytes, qulonglong of); + void outgoingMulticastTransferFinished(qulonglong transferID); + void outgoingMulticastTransferFailed(qulonglong transferID, QString reason); + protected: void timerEvent(QTimerEvent *event); @@ -142,5 +155,9 @@ private: int _timerLockTest; int _timerLockDelay; + McastConfiguration* _masterMcastConfig; + QHash _outgoingTransfers; + + static quint64 generateMcastTransferID(); }; #endif /* PVSCLIENT_H_ */ -- cgit v1.2.3-55-g7522 From 88dbb997a823ff77f752ac08105d12474345dfcb Mon Sep 17 00:00:00 2001 From: Sebastien Braun Date: Wed, 4 Aug 2010 17:24:21 +0200 Subject: Implement GUI for receiving incoming multicast transfers --- src/gui/clientFileReceiveDialog.cpp | 83 +++++++++++++++++++++++++++++++- src/gui/clientFileReceiveDialog.h | 14 ++++++ src/gui/ui/clientFileReceiveDialog.ui | 11 ++++- src/net/pvsIncomingMulticastTransfer.cpp | 37 +++++++------- src/net/pvsIncomingMulticastTransfer.h | 6 +-- src/pvs.cpp | 19 +++++++- src/pvs.h | 5 +- src/pvsgui.cpp | 7 +++ src/pvsgui.h | 1 + 9 files changed, 154 insertions(+), 29 deletions(-) (limited to 'src/gui/ui') diff --git a/src/gui/clientFileReceiveDialog.cpp b/src/gui/clientFileReceiveDialog.cpp index 669ca81..ff3226a 100644 --- a/src/gui/clientFileReceiveDialog.cpp +++ b/src/gui/clientFileReceiveDialog.cpp @@ -16,6 +16,9 @@ */ #include "clientFileReceiveDialog.h" +#include +#include +#include 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,49 @@ 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); +} + +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(!file->rename(filename)) + { + QMessageBox::warning(this, tr("Could not rename file"), tr("Failed to rename %1 to %2").arg(_filename).arg(filename)); + } + accept(); +} + +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(); +} + +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 #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/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 @@ 0 0 - 208 - 108 + 528 + 117 @@ -61,6 +61,13 @@ + + + + + + + diff --git a/src/net/pvsIncomingMulticastTransfer.cpp b/src/net/pvsIncomingMulticastTransfer.cpp index 01507a9..10b5307 100644 --- a/src/net/pvsIncomingMulticastTransfer.cpp +++ b/src/net/pvsIncomingMulticastTransfer.cpp @@ -21,7 +21,7 @@ #include "pvsIncomingMulticastTransfer.h" #include -PVSIncomingMulticastTransfer::PVSIncomingMulticastTransfer(QString const& sender, qulonglong transferID, qulonglong size, +PVSIncomingMulticastTransfer::PVSIncomingMulticastTransfer(QString const& sender, qulonglong transferID, qulonglong size, QString const& filename, ushort port, McastConfiguration const* configTemplate, QObject* parent) : QObject(parent), _sender(sender), @@ -29,19 +29,21 @@ PVSIncomingMulticastTransfer::PVSIncomingMulticastTransfer(QString const& sender _bytes(0), _size(size), _port(port), - _temporaryFile(new QTemporaryFile(QFileInfo(QDir::homePath(), "incoming.mcastft.XXXXXX").absolutePath(), this)), - _finalFile(0), + _file(new QFile(filename, this)), _receiver(0), _config(configTemplate ? new McastConfiguration(*configTemplate) : new McastConfiguration()), _progressTimer(new QTimer(this)) { + _file->open(QIODevice::WriteOnly); + _config->multicastUDPPortBase(port); - _config->multicastDPort(port); - _config->multicastSPort(port); + // _config->multicastDPort(port+1); + // _config->multicastSPort(port+2); connect(_progressTimer, SIGNAL(timeout()), SLOT(updateProgress())); + connect(this, SIGNAL(failed(qulonglong, QString const&)), SLOT(removeFile())); } PVSIncomingMulticastTransfer::~PVSIncomingMulticastTransfer() @@ -51,10 +53,10 @@ PVSIncomingMulticastTransfer::~PVSIncomingMulticastTransfer() bool PVSIncomingMulticastTransfer::start() { - QFile *dest = _finalFile ? _finalFile : _temporaryFile; - _receiver = new McastReceiver(dest, new McastConfiguration(*_config), this); + _file->open(QIODevice::WriteOnly); + _receiver = new McastReceiver(_file, new McastConfiguration(*_config), this); connect(_receiver, SIGNAL(finished(int)), SLOT(receiverFinished(int))); - connect(_receiver, SIGNAL(progress(quint64)), SLOT(receiverProgress(quint64))); + connect(_receiver, SIGNAL(progress(quint64)), SLOT(receiverProgressed(quint64))); if (!_receiver->start()) { @@ -76,17 +78,8 @@ void PVSIncomingMulticastTransfer::abort() delete _progressTimer; _progressTimer = 0; - if (_temporaryFile) - { - _temporaryFile->remove(); - } - delete _temporaryFile; - - if (_finalFile) - { - _finalFile->remove(); - } - delete _finalFile; + if(_file) + delete _file; } void PVSIncomingMulticastTransfer::updatePort(ushort port) @@ -124,6 +117,12 @@ void PVSIncomingMulticastTransfer::receiverFinished(int how) } } +void PVSIncomingMulticastTransfer::removeFile() +{ + if(_file) + _file->remove(); +} + void PVSIncomingMulticastTransfer::updateProgress() { if (!_started) diff --git a/src/net/pvsIncomingMulticastTransfer.h b/src/net/pvsIncomingMulticastTransfer.h index 9a33348..f96e176 100644 --- a/src/net/pvsIncomingMulticastTransfer.h +++ b/src/net/pvsIncomingMulticastTransfer.h @@ -31,7 +31,7 @@ class PVSIncomingMulticastTransfer : public QObject { Q_OBJECT public: - PVSIncomingMulticastTransfer(QString const& sender, qulonglong transferID, qulonglong size, ushort port, + PVSIncomingMulticastTransfer(QString const& sender, qulonglong transferID, qulonglong size, QString const& filename, ushort port, McastConfiguration const* configTemplate, QObject* parent = 0); virtual ~PVSIncomingMulticastTransfer(); @@ -53,6 +53,7 @@ private slots: void receiverProgressed(quint64 bytes); void receiverFinished(int reason); void updateProgress(); + void removeFile(); private: QString _sender; @@ -60,8 +61,7 @@ private: qulonglong _bytes; qulonglong _size; ushort _port; - QFile* _temporaryFile; - QFile* _finalFile; + QFile* _file; McastReceiver* _receiver; McastConfiguration* _config; bool _started; diff --git a/src/pvs.cpp b/src/pvs.cpp index 0e5aaf5..852c9f4 100644 --- a/src/pvs.cpp +++ b/src/pvs.cpp @@ -716,9 +716,23 @@ void PVS::cancelOutgoingMulticastTransfer(quint64 transferID) } } +void PVS::cancelIncomingMulticastTransfer(qulonglong transferID) +{ + PVSIncomingMulticastTransfer* transfer = _incomingTransfers.value(transferID, 0); + + if(transfer) + { + _incomingTransfers.remove(transferID); + delete transfer; + } +} + void PVS::onIncomingMulticastTransfer(QString const& sender, qulonglong transferID, QString const& basename, qulonglong size, ushort port) { + if (_outgoingTransfers.contains(transferID)) + return; + PVSIncomingMulticastTransfer* transfer; if (_incomingTransfers.value(transferID, 0)) { @@ -727,7 +741,8 @@ void PVS::onIncomingMulticastTransfer(QString const& sender, qulonglong transfer } else { - transfer = new PVSIncomingMulticastTransfer(sender, transferID, size, port, _masterMcastConfig, this); + QString filename = QFileInfo(QDir::home(), QString("%1.part.%2").arg(basename).arg(transferID, 0, 16)).absoluteFilePath(); + transfer = new PVSIncomingMulticastTransfer(sender, transferID, size, filename, port, _masterMcastConfig, this); _incomingTransfers.insert(transferID, transfer); connect(transfer, SIGNAL(retry(QString const&, qulonglong)), SLOT(onIncomingMulticastTransferRetry(QString const&, qulonglong))); @@ -738,7 +753,7 @@ void PVS::onIncomingMulticastTransfer(QString const& sender, qulonglong transfer connect(transfer, SIGNAL(finished(qulonglong)), SLOT(incomingMulticastTransferDelete(qulonglong))); connect(transfer, SIGNAL(failed(qulonglong, QString const&)), SLOT(incomingMulticastTransferDelete(qulonglong))); - emit incomingMulticastTransferNew(transferID, sender, basename, size); + emit incomingMulticastTransferNew(transferID, sender, filename, size); QTimer::singleShot(0, transfer, SLOT(start())); } } diff --git a/src/pvs.h b/src/pvs.h index dc272f0..ef6454e 100644 --- a/src/pvs.h +++ b/src/pvs.h @@ -86,6 +86,7 @@ public Q_SLOTS: // Multicast File Transfer bool createMulticastTransfer(QString const& objectPath, quint64& transferID, QString& errorReason); void cancelOutgoingMulticastTransfer(quint64 transferID); + void cancelIncomingMulticastTransfer(qulonglong transferID); Q_SIGNALS: @@ -106,7 +107,7 @@ Q_SIGNALS: void outgoingMulticastTransferProgress(qulonglong transferID, qulonglong bytes, qulonglong of); void outgoingMulticastTransferFinished(qulonglong transferID); void outgoingMulticastTransferFailed(qulonglong transferID, QString reason); - void incomingMulticastTransferNew(qulonglong transferID, QString sender, QString basename, qulonglong size); + void incomingMulticastTransferNew(qulonglong transferID, QString sender, QString filename, qulonglong size); void incomingMulticastTransferStarted(qulonglong transferID); void incomingMulticastTransferProgress(qulonglong transferID, qulonglong bytes, qulonglong of); void incomingMulticastTransferFinished(qulonglong transferID); @@ -166,12 +167,12 @@ private: QHash _incomingTransfers; void onIncomingMulticastTransfer(QString const& sender, qulonglong transferID, QString const& basename, qulonglong size, ushort port); - void onIncomingMulticastTransferRetry(QString const& sender, qulonglong transferID); static quint64 generateMcastTransferID(); private Q_SLOTS: // housekeeping void outgoingMulticastTransferDelete(qulonglong transferID); void incomingMulticastTransferDelete(qulonglong transferID); + void onIncomingMulticastTransferRetry(QString const& sender, qulonglong transferID); }; #endif /* PVSCLIENT_H_ */ diff --git a/src/pvsgui.cpp b/src/pvsgui.cpp index 25f1cd6..e949d5b 100644 --- a/src/pvsgui.cpp +++ b/src/pvsgui.cpp @@ -119,6 +119,7 @@ PVSGUI::PVSGUI(QWidget *parent) : connect(_ifaceDBus, SIGNAL(disconnected()), this, SLOT(disconnected())); connect(_ifaceDBus, SIGNAL(addHost(QString)), this, SLOT(addHost(QString))); connect(_ifaceDBus, SIGNAL(delHost(QString)), this, SLOT(delHost(QString))); + connect(_ifaceDBus, SIGNAL(incomingMulticastTransferNew(qulonglong, QString, QString, qulonglong)), SLOT(incomingMulticastFile(qulonglong, QString, QString, qulonglong))); // show toolbar setWindowFlags(Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint); @@ -421,6 +422,12 @@ void PVSGUI::receiveFile() d->open(); } +void PVSGUI::incomingMulticastFile(qulonglong transferID, QString sender, QString basename, qulonglong size) +{ + ClientFileReceiveDialog *d = new ClientFileReceiveDialog(sender, transferID, basename, size, _ifaceDBus, this); + d->open(); +} + //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// diff --git a/src/pvsgui.h b/src/pvsgui.h index f9a0ab8..2883b60 100644 --- a/src/pvsgui.h +++ b/src/pvsgui.h @@ -65,6 +65,7 @@ private Q_SLOTS: void setVncAllow(int i); void sendFile(); void receiveFile(); + void incomingMulticastFile(qulonglong, QString sender, QString basename, qulonglong size); private: void setupMenu(); -- cgit v1.2.3-55-g7522 From f8e6e94b25a092d51acdec600465074b4eb32cb8 Mon Sep 17 00:00:00 2001 From: Sebastien Braun Date: Wed, 4 Aug 2010 17:28:45 +0200 Subject: Make PGM interface configurable --- src/gui/clientConfigDialog.cpp | 61 +++++++++++++++++++++++++++++++++++++- src/gui/clientConfigDialog.h | 2 ++ src/gui/ui/clientConfigDialog.ui | 64 ++++++++++++++++++++++++++++++++++++++-- src/pvs.cpp | 7 +++++ src/pvs.h | 2 +- src/pvsgui.cpp | 3 ++ 6 files changed, 134 insertions(+), 5 deletions(-) (limited to 'src/gui/ui') diff --git a/src/gui/clientConfigDialog.cpp b/src/gui/clientConfigDialog.cpp index 76b4f5e..3867118 100644 --- a/src/gui/clientConfigDialog.cpp +++ b/src/gui/clientConfigDialog.cpp @@ -16,15 +16,32 @@ # ----------------------------------------------------------------------------- */ +#include #include "clientConfigDialog.h" +#include +#include +#include + +// For getting the network interface list: +#ifdef __linux +# include +# include +#endif + +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())); + connect(reloadInterfaceListButton, SIGNAL(clicked()), this, SLOT(reloadNetworkInterfaceList())); + reloadNetworkInterfaceList(); + interfaceList->setModel(_interfaceListModel); + interfaceList->setModelColumn(0); } @@ -66,6 +83,9 @@ void ClientConfigDialog::readSettings() checkBoxAllowFiletransfer->setChecked(_settings.value( "Permissions/allow_filetransfer").toBool()); + if(!_settings.value("Muticast/interface").isNull()) + interfaceList->setEditText(_settings.value("Multicast/interface").toString()); + qDebug("[%s] Setting read from: '%s'", metaObject()->className(), qPrintable(_settings.fileName())); } @@ -88,6 +108,7 @@ void ClientConfigDialog::writeSettings() _settings.setValue("Permissions/allow_chat", checkBoxAllowChat->isChecked()); _settings.setValue("Permissions/allow_filetransfer", checkBoxAllowFiletransfer->isChecked()); + _settings.setValue("Multicast/interface", interfaceList->currentText()); _settings.sync(); emit configChanged(); @@ -103,3 +124,41 @@ void ClientConfigDialog::checkPermissions() if (radioButtonLecturerNO->isChecked() && radioButtonOtherRO->isChecked()) radioButtonLecturerRO->setChecked(true); } + +void ClientConfigDialog::reloadNetworkInterfaceList() +{ +#ifdef __linux + static struct ifreq ifreqs[20]; + ifconf ifconfigs; + memset(&ifconfigs, 0, sizeof(ifconfigs)); + ifconfigs.ifc_len = sizeof(ifreqs); + ifconfigs.ifc_buf = (char*)&ifreqs; + + int nosock = socket(AF_INET, SOCK_STREAM, 0); + if (nosock < 0) + { + qWarning() << "Could not get a socket descriptor:" << strerror(errno); + } + int retval; + if ((retval = ioctl(nosock, SIOCGIFCONF, (char*)(&ifconfigs))) < 0) + { + qWarning() << "Could not get the list of interfaces:" << strerror(errno); + return; + } + + QStringList interfaces; + for(int i = 0; i < ifconfigs.ifc_len/sizeof(struct ifreq); i++) + { + char ifname[IFNAMSIZ + 1]; + strncpy(ifname, ifreqs[i].ifr_name, IFNAMSIZ); + ifname[IFNAMSIZ] = '\0'; + interfaces << QString::fromLocal8Bit(ifname); + } + if(!_interfaceListModel) + _interfaceListModel = new QStringListModel(interfaces, this); + else + _interfaceListModel->setStringList(interfaces); +#else +# warning "We have no way to get your system's network interface list. Some porting may be required." +#endif +} diff --git a/src/gui/clientConfigDialog.h b/src/gui/clientConfigDialog.h index 706bd8a..803f2c8 100644 --- a/src/gui/clientConfigDialog.h +++ b/src/gui/clientConfigDialog.h @@ -35,9 +35,11 @@ Q_SIGNALS: private Q_SLOTS: void checkPermissions(); + void reloadNetworkInterfaceList(); private: QSettings _settings; + QStringListModel* _interfaceListModel; }; 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 @@ 0 0 - 438 - 257 + 445 + 266 @@ -27,7 +27,7 @@ QTabWidget::North - 0 + 2 @@ -197,6 +197,64 @@ + + + + 0 + 0 + + + + false + + + Network + + + + + + + 0 + 0 + + + + true + + + QComboBox::NoInsert + + + true + + + + + + + + 0 + 0 + + + + Network Interface + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Reload List + + + + + diff --git a/src/pvs.cpp b/src/pvs.cpp index 202aa32..c217d52 100644 --- a/src/pvs.cpp +++ b/src/pvs.cpp @@ -728,6 +728,13 @@ void PVS::cancelIncomingMulticastTransfer(qulonglong transferID) } } +void PVS::setMulticastInterface(QString const& interfaceName) +{ + QSettings settings; + settings.setValue("multicast/interface", interfaceName); + settings.sync(); +} + void PVS::onIncomingMulticastTransfer(QString const& sender, qulonglong transferID, QString const& basename, qulonglong size, ushort port) { diff --git a/src/pvs.h b/src/pvs.h index ef6454e..4c61ffd 100644 --- a/src/pvs.h +++ b/src/pvs.h @@ -87,7 +87,7 @@ public Q_SLOTS: bool createMulticastTransfer(QString const& objectPath, quint64& transferID, QString& errorReason); void cancelOutgoingMulticastTransfer(quint64 transferID); void cancelIncomingMulticastTransfer(qulonglong transferID); - + void setMulticastInterface(QString const& interfaceName); Q_SIGNALS: void project(QString host, int port, QString passwd, bool fullscreen, diff --git a/src/pvsgui.cpp b/src/pvsgui.cpp index e949d5b..40112b4 100644 --- a/src/pvsgui.cpp +++ b/src/pvsgui.cpp @@ -143,6 +143,9 @@ void PVSGUI::updateConfig() setLocation(POSITION_TOP_CENTER); else setLocation(_settings.value("Display/location").toInt()); + + if (!_settings.value("Multicast/interface").isNull()) + _ifaceDBus->setMulticastInterface(_settings.value("Multicast/interface").toString()); } //////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3-55-g7522 From 5b9a6ed17851e635cda04d150e09dbf22cf0b19f Mon Sep 17 00:00:00 2001 From: jjl Date: Wed, 29 Sep 2010 19:51:59 +0200 Subject: [PVSGUI] smaler toolbar --- src/gui/ui/clientToolbar.ui | 13 +------------ src/version.h | 4 ++-- 2 files changed, 3 insertions(+), 14 deletions(-) (limited to 'src/gui/ui') diff --git a/src/gui/ui/clientToolbar.ui b/src/gui/ui/clientToolbar.ui index 51cb62e..d70857a 100644 --- a/src/gui/ui/clientToolbar.ui +++ b/src/gui/ui/clientToolbar.ui @@ -6,7 +6,7 @@ 0 0 - 463 + 328 28 @@ -143,17 +143,6 @@ p, li { white-space: pre-wrap; } - - - - <!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> - - - diff --git a/src/version.h b/src/version.h index d05a693..de5c6aa 100644 --- a/src/version.h +++ b/src/version.h @@ -1,2 +1,2 @@ -#define VERSION_STRING "2.0.4" -#define VERSION_NUMBER 204 +#define VERSION_STRING "2.0.5" +#define VERSION_NUMBER 205 -- cgit v1.2.3-55-g7522 From 5bcf831e1734be78d9468631926e875a5b05e11f Mon Sep 17 00:00:00 2001 From: Sebastien Braun Date: Sun, 3 Oct 2010 23:27:39 +0200 Subject: Implement Network-wide Configuration Interface for Multicast File Transfer --- CMakeLists.txt | 6 ++ pvsmgr.qrc | 1 + src/gui/mainWindow.cpp | 17 +++- src/gui/mainWindow.h | 1 + src/gui/multicastConfigDialog.cpp | 170 ++++++++++++++++++++++++++++++++++++ src/gui/multicastConfigDialog.h | 38 ++++++++ src/gui/ui/mainwindow.ui | 15 ++++ src/gui/ui/mainwindowtouch.ui | 11 +++ src/gui/ui/multicastConfigDialog.ui | 156 +++++++++++++++++++++++++++++++++ src/net/mcast/McastConfiguration.h | 17 ++++ src/net/pvsListenServer.cpp | 60 +++++++++++++ src/net/pvsListenServer.h | 10 +++ src/pvs.cpp | 58 +++++++++++- src/pvs.h | 1 + 14 files changed, 559 insertions(+), 2 deletions(-) create mode 100644 src/gui/multicastConfigDialog.cpp create mode 100644 src/gui/multicastConfigDialog.h create mode 100644 src/gui/ui/multicastConfigDialog.ui (limited to 'src/gui/ui') diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f2089a..0899bdf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,6 +80,7 @@ SET( PVSMGR_SRCS src/util/TextFile.cpp src/util/serviceDiscoveryUtil.cpp src/gui/aboutDialog.cpp + src/gui/multicastConfigDialog.cpp ) # pvs @@ -131,6 +132,7 @@ SET( PVSMGR_UIS src/gui/ui/aboutDialog.ui src/gui/ui/serverChatDialog.ui src/gui/ui/clientFileSendDialog.ui + src/gui/ui/multicastConfigDialog.ui ) SET( PVSMGRTOUCH_UIS @@ -140,6 +142,7 @@ SET( PVSMGRTOUCH_UIS src/gui/ui/projectionDialog.ui src/gui/ui/aboutDialog.ui src/gui/ui/serverChatDialog.ui + src/gui/ui/multicastConfigDialog.ui ) SET( PVSGUI_UIS @@ -186,6 +189,7 @@ SET( PVSMGR_MOC_HDRS src/net/pvsServiceBroadcast.h src/net/SslServer.h src/gui/aboutDialog.h + src/gui/multicastConfigDialog.h ) SET( PVS_MOC_HDRS @@ -317,12 +321,14 @@ TARGET_LINK_LIBRARIES( pvsmgr ${QT_LIBRARIES} ${VNC_LIBRARIES} ${X11_LIBRARIES} + pvsmcast ) TARGET_LINK_LIBRARIES( pvsmgrtouch ${QT_LIBRARIES} ${VNC_LIBRARIES} ${X11_LIBRARIES} + pvsmcast ) TARGET_LINK_LIBRARIES( pvs diff --git a/pvsmgr.qrc b/pvsmgr.qrc index 171412e..e0b6b51 100644 --- a/pvsmgr.qrc +++ b/pvsmgr.qrc @@ -19,6 +19,7 @@ icons/dozent.png icons/chat.png icons/cam32.svg + icons/network_configure.png AUTHORS TRANSLATION diff --git a/src/gui/mainWindow.cpp b/src/gui/mainWindow.cpp index eb15e82..c911721 100644 --- a/src/gui/mainWindow.cpp +++ b/src/gui/mainWindow.cpp @@ -16,7 +16,10 @@ #include #include +#include +#include #include +#include using namespace std; // setting the IF-DEF Block for the touchgui and the normal gui, for later use @@ -34,6 +37,7 @@ using namespace std; #include //#include #include +#include #include MainWindow::MainWindow(QWidget *parent) : @@ -129,6 +133,7 @@ MainWindow::MainWindow(QWidget *parent) : 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->actionShow_Username, SIGNAL(triggered()), this, SLOT(showusername())); connect(ui->actionShow_Hostname_IP, SIGNAL(triggered()), this, SLOT(showip())); @@ -1197,7 +1202,17 @@ 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; diff --git a/src/gui/mainWindow.h b/src/gui/mainWindow.h index 00bd927..41d9cfa 100644 --- a/src/gui/mainWindow.h +++ b/src/gui/mainWindow.h @@ -194,6 +194,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 +#include +#include +#include +#include "multicastConfigDialog.h" +#include +// #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( + "") + text + + ""); + if (widget) + widget->setStyleSheet("background-color: #ffcccc;"); +} + +void MulticastConfigDialog::setOK(QWidget* widget, QLabel* errorMessageLabel) +{ + if (errorMessageLabel) + errorMessageLabel->setText(QString( + "") + + tr("OK") + ""); + 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 +#include +#include "ui_multicastConfigDialog.h" +#include + +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/mainwindow.ui b/src/gui/ui/mainwindow.ui index eb49d1b..7b8f2b4 100644 --- a/src/gui/ui/mainwindow.ui +++ b/src/gui/ui/mainwindow.ui @@ -243,9 +243,16 @@ + + + Network + + + + @@ -531,6 +538,14 @@ - + + + &Configure... + + + Configure Network Parameters + + diff --git a/src/gui/ui/mainwindowtouch.ui b/src/gui/ui/mainwindowtouch.ui index 9030b17..cf7e411 100644 --- a/src/gui/ui/mainwindowtouch.ui +++ b/src/gui/ui/mainwindowtouch.ui @@ -365,6 +365,8 @@ + + @@ -636,6 +638,15 @@ Ctrl+D + + + + :/netconf:/netconf + + + Configure Network... + + 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 @@ + + + MulticastConfigDialogClass + + + + 0 + 0 + 331 + 314 + + + + + 0 + 0 + + + + PVS - Multicast Configuration + + + + + + + 0 + 0 + + + + <!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> + + + true + + + + + + + + + Multicast Group Address + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 009.009.009.009; + + + ... + + + + + + + <span style=" font-weight:600; color:#008800;">OK</span> + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Data Port (1024-65535) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 00009; + + + 5 + + + + + + + <span style=" font-weight:600; color:#008800;">OK</span> + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Transmission Rate + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + KiB/s + + + 10240 + + + 10 + + + 100 + + + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + diff --git a/src/net/mcast/McastConfiguration.h b/src/net/mcast/McastConfiguration.h index 6884036..53f7a54 100644 --- a/src/net/mcast/McastConfiguration.h +++ b/src/net/mcast/McastConfiguration.h @@ -166,6 +166,23 @@ public: emit changed(); } + McastConfiguration& operator=(McastConfiguration const& source) + { + if(this != &source) + { + _multicastInterface = source._multicastInterface; + _multicastAddress = source._multicastAddress; + _multicastRate = source._multicastRate; + _multicastSPort = source._multicastSPort; + _multicastDPort = source._multicastDPort; + _multicastWinSize = source._multicastWinSize; + _multicastMTU = source._multicastMTU; + _multicastUDPPortBase = source._multicastUDPPortBase; + _multicastUseUDP = source._multicastUseUDP; + } + return *this; + } + void loadFrom(QSettings* settings, char const* group = 0); void writeTo(QSettings* settings, char const* group = 0) const; diff --git a/src/net/pvsListenServer.cpp b/src/net/pvsListenServer.cpp index f21303e..1c1387b 100644 --- a/src/net/pvsListenServer.cpp +++ b/src/net/pvsListenServer.cpp @@ -21,9 +21,13 @@ #include "pvsClientConnection.h" #include "src/util/consoleLogger.h" #include +#include +#include +#include #include "SslServer.h" #include //#define verbose +#include "mcast/McastConfiguration.h" // Create listener PVSListenServer::PVSListenServer(int port, int clients) @@ -36,6 +40,7 @@ PVSListenServer::PVSListenServer(int port, int clients) else _clientsMax = clients; _port = port; + _mcastConfig = 0; init(); } @@ -178,6 +183,7 @@ void PVSListenServer::onClientConnected(PVSClientConnection* connected) { connected->setServerID(_id); connected->setID(generateID()); + connected->push_back_send(mcastConfigMessage()); } void PVSListenServer::onClientDisconnected(PVSClientConnection* disconnected) @@ -227,6 +233,11 @@ PVSClientConnection* PVSListenServer::getConnectionFromID(int id) // Initialize listening socket bool PVSListenServer::init() { + if (_mcastConfig) + delete _mcastConfig; + _mcastConfig = new McastConfiguration(this); + loadMcastConfig(); + if (_listenSocket != NULL) shutdown(); @@ -306,3 +317,52 @@ bool PVSListenServer::isListening() { return _listenSocket != NULL && _listenSocket->isListening(); } + +void PVSListenServer::loadMcastConfig() +{ + QSettings settings; + _mcastConfig->loadFrom(&settings, "multicast-filetransfer"); +} + +void PVSListenServer::saveMcastConfig() +{ + QSettings settings; + _mcastConfig->writeTo(&settings, "multicast-filetransfer"); + settings.sync(); +} + +PVSMsg PVSListenServer::mcastConfigMessage() +{ + // If anything is changed here, do not forget to + // 1. assign a new version number + // 2. adapt PVS::onCommand(PVSMsg) in pvs.cpp + QByteArray ba; + QDataStream strm(&ba, QIODevice::WriteOnly); + strm << (quint16)1 // version + << _mcastConfig->multicastAddress() + << _mcastConfig->multicastUDPPortBase() + << _mcastConfig->multicastDPort() + << _mcastConfig->multicastSPort() + << _mcastConfig->multicastMTU() + << _mcastConfig->multicastWinSize() + << _mcastConfig->multicastRate() + << _mcastConfig->multicastUseUDP(); + + QByteArray b64 = ba.toBase64(); + QString message = QString::fromAscii(b64.constData(), b64.length()); + PVSMsg msg(PVSCOMMAND, "MCASTFTCONFIG", message); + return msg; +} + +void PVSListenServer::multicastReconfigure(McastConfiguration const* source) +{ + _mcastConfig->multicastAddress(source->multicastAddress()); + *_mcastConfig = *source; + saveMcastConfig(); + sendToAll(mcastConfigMessage()); +} + +McastConfiguration const* PVSListenServer::getMulticastConfiguration() +{ + return _mcastConfig; +} diff --git a/src/net/pvsListenServer.h b/src/net/pvsListenServer.h index ab021c7..90d2a77 100644 --- a/src/net/pvsListenServer.h +++ b/src/net/pvsListenServer.h @@ -10,6 +10,7 @@ class SslServer; class PVSClientConnection; class PVSMsg; +class McastConfiguration; class PVSListenServer : public QObject { @@ -40,6 +41,12 @@ private: bool init(); unsigned int generateID(); + McastConfiguration* _mcastConfig; + + void loadMcastConfig(); + void saveMcastConfig(); + PVSMsg mcastConfigMessage(); + protected: void timerEvent(QTimerEvent *event); @@ -60,6 +67,9 @@ public: bool disconnectClient(PVSClientConnection* delinquent); void onConnectionRemoved(PVSClientConnection* delinquent); + void multicastReconfigure(McastConfiguration const* source); + McastConfiguration const* getMulticastConfiguration(); + std::list* getClientListPtr() { return &_clients; diff --git a/src/pvs.cpp b/src/pvs.cpp index 9bd36d6..df21468 100644 --- a/src/pvs.cpp +++ b/src/pvs.cpp @@ -45,7 +45,10 @@ PVS::PVS() : loadCommands(); _blankScreen = NULL; _vncPort = -1; + + QSettings settings; _masterMcastConfig = new McastConfiguration(this); + _masterMcastConfig->loadFrom(&settings); // add a notify to the allow file, so we get informed when the file is changed QString watchPath("/home/"); @@ -234,6 +237,11 @@ void PVS::onCommand(PVSMsg cmdMessage) qDebug() << "Ignoring malformed MCASTFTANNOUNCE command: " << message; return; } + if (ident.compare("MCASTFTCONFIG") == 0) + { + loadMcastConfig(message); + return; + } #ifdef never // prototype @@ -735,7 +743,8 @@ void PVS::cancelIncomingMulticastTransfer(qulonglong transferID) void PVS::setMulticastInterface(QString const& interfaceName) { QSettings settings; - settings.setValue("multicast/interface", interfaceName); + _masterMcastConfig->multicastInterface(interfaceName); + _masterMcastConfig->writeTo(&settings, "multicast"); settings.sync(); } @@ -814,3 +823,50 @@ void PVS::incomingMulticastTransferDelete(qulonglong transferID) _incomingTransfers.remove(transferID); transfer->deleteLater(); } + +void PVS::loadMcastConfig(QString const& message) +{ + QByteArray ba = QByteArray::fromBase64(message.toAscii()); + QDataStream d(&ba, QIODevice::ReadOnly); + quint16 ver, udpp, dp, sp, mtu, wsz; + quint32 rate; + QString addr; + bool useudp; + + d >> ver; + if(ver != 1) + { + ConsoleLog writeLine(QString("Unable to decode multicast configuration message: Unknown version %1").arg(ver)); + return; + } + + d >> addr + >> udpp + >> dp + >> sp + >> mtu + >> wsz + >> rate + >> useudp; + if(d.status() != QDataStream::Ok) + { + ConsoleLog writeLine(QString("Unable to decode multicast configuration message: There was an error reading")); + return; + } + + _masterMcastConfig->multicastUDPPortBase(udpp); + _masterMcastConfig->multicastDPort(dp); + _masterMcastConfig->multicastSPort(sp); + _masterMcastConfig->multicastMTU(mtu); + _masterMcastConfig->multicastWinSize(wsz); + _masterMcastConfig->multicastRate(rate); + _masterMcastConfig->multicastAddress(addr); + _masterMcastConfig->multicastUseUDP(useudp); + + QSettings settings; + _masterMcastConfig->writeTo(&settings, "multicast"); + settings.sync(); + + ConsoleLog writeLine(QString("Reconfigured multicast filetransfer to IP %1, UDP port base %2, destination port %3, source port %4, MTU %5, Window Size %6, rate %7, %8using UDP") + .arg(addr).arg(udpp).arg(dp).arg(sp).arg(mtu).arg(wsz).arg(rate).arg(useudp ? "" : "not ")); +} diff --git a/src/pvs.h b/src/pvs.h index 4c61ffd..3b3365c 100644 --- a/src/pvs.h +++ b/src/pvs.h @@ -88,6 +88,7 @@ public Q_SLOTS: void cancelOutgoingMulticastTransfer(quint64 transferID); void cancelIncomingMulticastTransfer(qulonglong transferID); void setMulticastInterface(QString const& interfaceName); + void loadMcastConfig(QString const& encoded); Q_SIGNALS: void project(QString host, int port, QString passwd, bool fullscreen, -- cgit v1.2.3-55-g7522