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/util/util.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src/util/util.cpp') diff --git a/src/util/util.cpp b/src/util/util.cpp index 946168e..c2d06a0 100644 --- a/src/util/util.cpp +++ b/src/util/util.cpp @@ -325,13 +325,6 @@ 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()); -- 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/util/util.cpp') 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 19316e9142c5ab4a4e1603715fbbf555aac97826 Mon Sep 17 00:00:00 2001 From: Alexander Hoppe Date: Tue, 3 Aug 2010 18:23:24 +0200 Subject: Anpassungen fuer Win32-build. Aufspaltung der ClientGUIUtils in 2 Versionen Anpassungen des HomeDir Alle Aenderungen sollten unschaedlich fuer den Linux-build-Prozess sein. --- CMakeLists.txt | 100 +++++++++++++++++------ 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 +- src/pvs.cpp | 27 ++++-- src/pvs.h | 11 ++- src/pvsDaemon.cpp | 22 +++-- src/pvsgui.cpp | 2 +- src/util/clientGUIUtils.h | 25 ++---- src/util/clientGUIUtils_Win32.cpp | 46 +++++++++++ src/util/clientGUIUtils_X11.cpp | 168 ++++++++++++++++++++++++++++++++++++++ src/util/consoleLogger.cpp | 2 +- src/util/util.cpp | 62 ++++++++++---- src/util/util.h | 6 +- 16 files changed, 411 insertions(+), 100 deletions(-) mode change 100644 => 100755 CMakeLists.txt mode change 100644 => 100755 src/pvs.cpp mode change 100644 => 100755 src/pvs.h mode change 100644 => 100755 src/pvsDaemon.cpp mode change 100644 => 100755 src/util/clientGUIUtils.h create mode 100755 src/util/clientGUIUtils_Win32.cpp create mode 100755 src/util/clientGUIUtils_X11.cpp mode change 100644 => 100755 src/util/consoleLogger.cpp mode change 100644 => 100755 src/util/util.cpp mode change 100644 => 100755 src/util/util.h (limited to 'src/util/util.cpp') diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100644 new mode 100755 index 9570774..d2eae17 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,8 +11,8 @@ CMAKE_MINIMUM_REQUIRED( VERSION 2.6.2 ) # set compiler optimizations for debug and release SET(CMAKE_BUILD_TYPE Debug) SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -Wall") -SET(CMAKE_CXX_FLAGS_RELEASE "-O2") -# -march=native -DQT_NO_DEBUG_OUTPUT") +SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native") +# -DQT_NO_DEBUG_OUTPUT") # local cmake modules SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}) @@ -31,6 +31,15 @@ INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} ) +IF(WIN32) + SET(sysdep_suffix _Win32) + INCLUDE_DIRECTORIES( + /c/KDE4/tmp/LibVNCServer-0.9.7/ + ) +ELSEIF(UNIX) + SET(sysdep_suffix _X11) +ENDIF(WIN32) + ################################################################################ # Variables ################################################################################ @@ -78,7 +87,7 @@ SET( PVS_SRCS src/net/pvsLocalhostCommunicator.cpp src/util/util.cpp src/util/consoleLogger.cpp - src/util/clientGUIUtils.cpp + src/util/clientGUIUtils${sysdep_suffix}.cpp src/util/pvsSettingsManager.cpp src/core/pvsChatClient.cpp src/net/pvsServiceDiscovery.cpp @@ -262,6 +271,7 @@ QT4_CREATE_TRANSLATION( PVSGUI_QMS ${PVSGUI_SRCS} ${PVSGUI_UI_HDRS} ${PVSGUI_TSS ################################################################################ ## here we instruct CMake to build our executable from all of the source files +if(UNIX) ADD_EXECUTABLE( pvsmgr ${PVSMGR_SRCS} ${PVSMGR_MOC_SRCS} @@ -277,6 +287,7 @@ ADD_EXECUTABLE( pvsmgrtouch ${PVSMGR_RC_SRCS} ${PVSMGR_QMS} ) +ENDIF(UNIX) ADD_EXECUTABLE( pvs ${PVS_SRCS} @@ -295,35 +306,72 @@ ADD_EXECUTABLE( pvsgui # last thing we have to do is to tell CMake what libraries our executable needs, # luckily FIND_PACKAGE prepared variables for us: -TARGET_LINK_LIBRARIES( pvsmgr - ${QT_LIBRARIES} - ${VNC_LIBRARIES} - ${X11_LIBRARIES} -) - -TARGET_LINK_LIBRARIES( pvsmgrtouch - ${QT_LIBRARIES} - ${VNC_LIBRARIES} - ${X11_LIBRARIES} -) - -TARGET_LINK_LIBRARIES( pvs - ${QT_LIBRARIES} - ${VNC_LIBRARIES} - ${X11_LIBRARIES} -) - -TARGET_LINK_LIBRARIES( pvsgui - ${QT_LIBRARIES} - ${VNC_LIBRARIES} -) +IF(WIN32) + TARGET_LINK_LIBRARIES( pvsmgr + + ) +ELSEIF(UNIX) +TARGET_LINK_LIBRARIES( pvsmgr + ${QT_LIBRARIES} + ${VNC_LIBRARIES} + ${X11_LIBRARIES} + ) +ENDIF(WIN32) + +IF(WIN32) + TARGET_LINK_LIBRARIES( pvsmgrtouch + + ) +ELSEIF(UNIX) + TARGET_LINK_LIBRARIES( pvsmgrtouch + ${QT_LIBRARIES} + ${VNC_LIBRARIES} + ${X11_LIBRARIES} + ) +ENDIF(WIN32) + +IF(WIN32) + TARGET_LINK_LIBRARIES( pvs + ${QT_LIBRARIES} + ${VNC_LIBRARIES} + advapi32 + ws2_32 + ) +ELSEIF(UNIX) + TARGET_LINK_LIBRARIES( pvs + ${QT_LIBRARIES} + ${VNC_LIBRARIES} + ${X11_LIBRARIES} + ) +ENDIF(WIN32) + +IF(WIN32) + TARGET_LINK_LIBRARIES( pvsgui + ${QT_LIBRARIES} + ${VNC_LIBRARIES} + #advapi32 + ws2_32 + ) +ELSEIF(UNIX) + TARGET_LINK_LIBRARIES( pvsgui + ${QT_LIBRARIES} + ${VNC_LIBRARIES} + ) +ENDIF(WIN32) + +IF(UNIX) SET_PROPERTY(TARGET pvsmgrtouch PROPERTY COMPILE_DEFINITIONS MAINWINDOW_USE_TOUCHGUI) SET_PROPERTY(TARGET pvsmgr PROPERTY COMPILE_DEFINITIONS MAINWINDOW_USE_NORMALGUI) +ENDIF(UNIX) # add install target to our makefile CONFIGURE_FILE( org.openslx.pvs.service ${CMAKE_BINARY_DIR}/org.openslx.pvs.service ) -INSTALL( TARGETS pvsmgr pvs pvsgui pvsmgrtouch RUNTIME DESTINATION bin ) +IF(WIN32) + INSTALL( TARGETS pvs pvsgui RUNTIME DESTINATION bin ) +ELSEIF(UNIX) + INSTALL( TARGETS pvsmgr pvs pvsgui pvsmgrtouch RUNTIME DESTINATION bin ) +ENDIF(WIN32) INSTALL( PROGRAMS misc/pvs-vncsrv DESTINATION bin) INSTALL( FILES ${CMAKE_BINARY_DIR}/org.openslx.pvs.service DESTINATION share/dbus-1/services ) diff --git a/i18n/pvs_ar_JO.ts b/i18n/pvs_ar_JO.ts index c1b19cb..38bf578 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 c1b19cb..38bf578 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 c1b19cb..38bf578 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 c1b19cb..38bf578 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 c1b19cb..38bf578 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/src/pvs.cpp b/src/pvs.cpp old mode 100644 new mode 100755 index d09d407..1c08be5 --- a/src/pvs.cpp +++ b/src/pvs.cpp @@ -36,12 +36,14 @@ PVS::PVS() : _vncRequested = false; readPolicyFiles(); loadCommands(); - _blankScreen = NULL; + /*#ifndef __WIN32__*/ + _blankScreen = NULL; + /*#endif*/ _vncPort = -1; // add a notify to the allow file, so we get informed when the file is changed - QString watchPath("/home/"); - watchPath.append(getUserName().append(QString("/.pvs/.allow"))); + QString watchPath(getPolicyDir()); + watchPath.append(QString(".allow")); _notify = new QFileSystemWatcher(this); _notify->addPath(QString(watchPath.toUtf8().data())); @@ -64,6 +66,7 @@ PVS::PVS() : _timerLockTest = 0; _timerLockDelay = 0; + #ifndef __WIN32__ //add signalhandling for sigterm signals struct sigaction act; act.sa_handler = &PVS::signalHandler; @@ -75,7 +78,7 @@ PVS::PVS() : sigaction(SIGHUP, &act, 0); sigaction(SIGINT, &act, 0); sigaction(SIGQUIT, &act, 0); - + #endif /*__WIN32__*/ } PVS::~PVS() @@ -498,14 +501,19 @@ int PVS::startVNCScript(int port, QString pass, QString rwpass) commandLine.append(rwpass); if (!system(NULL)) ConsoleLog writeError("No Command processor available"); - int result = system(commandLine.toUtf8().data()); + #ifndef __WIN32__ +//TODO Win32 result = WEXITSTATUS(result); if (result != 0) ConsoleLog writeError(QString("VNC-Server is not running, code: ") + int2String(result)); else ConsoleLog writeLine("VNC-Server should be running"); return result; + #else + /*Code fuer VNC-Aufruf unter Windows einfuegen*/ + return 0; + #endif /*__WIN32__*/ } else { @@ -521,6 +529,7 @@ int PVS::stopVNCScript() { if (gotVNCScript()) { + #ifndef __WIN32__ ConsoleLog writeLine("Stopping VNC-Script"); QString commandLine(_vncScriptPath); commandLine.append(" "); @@ -532,6 +541,10 @@ int PVS::stopVNCScript() ConsoleLog writeLine("VNC-Server should be stopped"); int result = system(commandLine.toUtf8().data()); return WEXITSTATUS(result); + #else + /*Code fuer VNC-Server stoppen unter Windows einfuegen*/ + return 0; + #endif /*__WIN32__*/ } else { @@ -608,6 +621,7 @@ QString PVS::getIpByNick(QString nick) void PVS::signalHandler(int signal) { ConsoleLog writeLine(QString("Received Signal ").append (int2String(signal))); + #ifndef __WIN32__ switch (signal) { case SIGHUP: mainClient->quit(); @@ -622,6 +636,9 @@ void PVS::signalHandler(int signal) mainClient->quit(); break; } + #else + ConsoleLog writeLine("Abfang nicht definiert fuer Windows"); + #endif /*__WIN32__*/ } diff --git a/src/pvs.h b/src/pvs.h old mode 100644 new mode 100755 index ba696d8..b6b5e65 --- a/src/pvs.h +++ b/src/pvs.h @@ -13,8 +13,10 @@ #define PVSCLIENT_H_ #include -#include -#include +#ifndef __WIN32__ + #include + #include +#endif #include #include "setup.h" @@ -25,7 +27,6 @@ #include "src/util/consoleLogger.h" #include "src/util/clientGUIUtils.h" - class PVSServiceDiscovery; class PVSDiscoveredServer; @@ -116,7 +117,9 @@ private: bool _locked; ///< are we locked? QString _lockMsg; ///< message to display while we're locked bool _vncAllowed; ///< whether vncConnections to this client are allowed (dup?) - BlankScreen *_blankScreen;///< obhject to blank the screen + /*#ifndef __WIN32__*/ + BlankScreen *_blankScreen;///< object to blank the screen + /*#endif*/ QFileSystemWatcher* _notify; ///< used to get notifies about file changes //vnc-server diff --git a/src/pvsDaemon.cpp b/src/pvsDaemon.cpp old mode 100644 new mode 100755 index e87bfe7..e9479df --- a/src/pvsDaemon.cpp +++ b/src/pvsDaemon.cpp @@ -68,11 +68,17 @@ int main(int argc, char** argv) int port = -1; 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"); + #ifdef __WIN32__ + //TODO Win32 + if (!script.exists()) + script.setFile(getHomeDir() + "/.pvs/pvs-vncsrv_win32.bat"); + #else + script.setFile("/usr/bin/pvs-vncsrv"); + if (!script.exists()) + script.setFile("/usr/local/bin/pvs-vncsrv"); + if (!script.exists()) + script.setFile(getHomeDir() + "/.pvs/pvs-vncsrv"); + #endif //__WIN32__ QCoreApplication app(argc, argv); app.setOrganizationName("openslx"); @@ -293,6 +299,8 @@ int main(int argc, char** argv) #ifdef as_daemon + /*Alex: neu schreiben als pvsdaemon_win32.cpp und minimieren in Task-Leiste*/ + #ifndef __WIN32__ /* Our process ID and Session ID */ pid_t pid, sid; @@ -331,10 +339,10 @@ int main(int argc, char** argv) /* Close out the standard file descriptors */ close(STDIN_FILENO); - freopen ((QString("/home/").append(getUserName().append(QString("/.pvs/dump")))).toUtf8().data(),"w",stdout); + freopen ((QString(getHomeDir()).append(QString("/.pvs/dump"))).toUtf8().data(),"w",stdout); //close(STDOUT_FILENO); close(STDERR_FILENO); - + #endif /*__WIN32__*/ /* Daemon-specific initialization goes here */ /* The Big Loop */ diff --git a/src/pvsgui.cpp b/src/pvsgui.cpp index 6fdd673..b2f0a8f 100644 --- a/src/pvsgui.cpp +++ b/src/pvsgui.cpp @@ -107,7 +107,7 @@ PVSGUI::PVSGUI(QWidget *parent) : connect(_ifaceDBus, SIGNAL(delHost(QString)), this, SLOT(delHost(QString))); // show toolbar - setWindowFlags(Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint); + setWindowFlags(Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint | Qt::FramelessWindowHint); setAttribute(Qt::WA_AlwaysShowToolTips); updateConfig(); setVisible(true); diff --git a/src/util/clientGUIUtils.h b/src/util/clientGUIUtils.h old mode 100644 new mode 100755 index 28b05cc..b04d3fe --- a/src/util/clientGUIUtils.h +++ b/src/util/clientGUIUtils.h @@ -1,21 +1,20 @@ +#ifndef _BLANKSCREEN_H_ +#define _BLANKSCREEN_H_ + #include "src/util/consoleLogger.h" -#include // Every Xlib program must include this -#include #include #include #include - #define REFRESH_RATE 0.15 - -#ifndef _BLANKSCREEN_H_ -#define _BLANKSCREEN_H_ +class BlankScreen_Sysdep; class BlankScreen { public: BlankScreen(); + virtual ~BlankScreen(); void draw(bool force = false); bool lock(); bool unlock(); @@ -23,17 +22,7 @@ public: bool lock_inputs(); private: - Display *dpy; - Window win; - XEvent ev; - int scr; - - bool locked; - - - QString lockMsg; - int blackColor, whiteColor; - int offX, offY; + BlankScreen_Sysdep* _sysdep; }; -#endif +#endif \ No newline at end of file diff --git a/src/util/clientGUIUtils_Win32.cpp b/src/util/clientGUIUtils_Win32.cpp new file mode 100755 index 0000000..1b4d2ae --- /dev/null +++ b/src/util/clientGUIUtils_Win32.cpp @@ -0,0 +1,46 @@ + +#include "clientGUIUtils.h" +#include + +struct BlankScreen_Sysdep { + + bool locked; + QWidget* blankwin; + + QString lockMsg; + int blackColor, whiteColor; + int offX, offY; +}; + +BlankScreen::BlankScreen() +{ + _sysdep = new BlankScreen_Sysdep; + _sysdep->blankwin = new QWidget(0, Qt::X11BypassWindowManagerHint | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); + _sysdep->blankwin->setWindowState(Qt::WindowFullScreen); + _sysdep->blankwin->show(); +} + +BlankScreen::~BlankScreen() +{ + delete _sysdep; +} + +void BlankScreen::draw(bool force) +{ + +} + +bool BlankScreen::lock() +{ + return true; +} + +bool BlankScreen::lock_inputs() +{ + return true; +} + +bool BlankScreen::unlock() +{ + return true; +} diff --git a/src/util/clientGUIUtils_X11.cpp b/src/util/clientGUIUtils_X11.cpp new file mode 100755 index 0000000..29c96f0 --- /dev/null +++ b/src/util/clientGUIUtils_X11.cpp @@ -0,0 +1,168 @@ +#include "clientGUIUtils.h" +#include +#include + + +struct BlankScreen_Sysdep { + + Display *dpy; + Window win; + XEvent ev; + int scr; + + bool locked; + + + QString lockMsg; + int blackColor, whiteColor; + int offX, offY; +}; + +BlankScreen::BlankScreen() +{ + _sysdep = new BlankScreen_Sysdep; + _sysdep->dpy = XOpenDisplay(NULL); + _sysdep->scr = DefaultScreen(_sysdep->dpy); + assert(_sysdep->dpy); + _sysdep->blackColor = BlackPixel(_sysdep->dpy, DefaultScreen(_sysdep->dpy)); + _sysdep->whiteColor = WhitePixel(_sysdep->dpy, DefaultScreen(_sysdep->dpy)); +// win = XCreateSimpleWindow(_sysdep->dpy, DefaultRootWindow(_sysdep->dpy), 0, 0, 200, 100, 0, blackColor, whiteColor); + _sysdep->win = XCreateSimpleWindow(_sysdep->dpy, RootWindow(_sysdep->dpy, _sysdep->scr), 10, 10, 200, 200, 1, WhitePixel(_sysdep->dpy, _sysdep->scr), BlackPixel(_sysdep->dpy, _sysdep->scr)); + + XSelectInput(_sysdep->dpy, _sysdep->win, ExposureMask | KeyPressMask); + _sysdep->locked = false; + _sysdep->offX = _sysdep->offY = 0; +} + +BlankScreen::~BlankScreen() +{ + delete _sysdep; +} + +void BlankScreen::draw(bool force) +{ + if (_sysdep->locked)// no need to draw if we're not showing the window + { + XWindowAttributes xwa; + XGetWindowAttributes(_sysdep->dpy, DefaultRootWindow(_sysdep->dpy), &xwa); + int hx = (xwa.width)>>2, hy = (xwa.height)>>2; + + if (XCheckTypedEvent(_sysdep->dpy, Expose, &_sysdep->ev) || force ) + { + hx += _sysdep->offX; + hy += _sysdep->offY; + + GC gcc = XCreateGC(_sysdep->dpy, _sysdep->win, 0, NULL); + XSetForeground(_sysdep->dpy, gcc, _sysdep->whiteColor); +// XClearArea(_sysdep->dpy, _sysdep->win, 0, 0, xwa.width, xwa.height, false); + if (_sysdep->lockMsg.size() > 0) + { + char *msg = const_cast(_sysdep->lockMsg.toUtf8().data()); + XDrawString(_sysdep->dpy, _sysdep->win, gcc/*DefaultGC(dpy, scr)*/, hx, hy, msg, strlen(msg)); + } + else + { + } + } + } +} + +bool BlankScreen::lock() +{ +#define lock_test + + if (_sysdep->locked) + return _sysdep->locked; + + // We want to get MapNotify events + XSelectInput(_sysdep->dpy, _sysdep->win, StructureNotifyMask); + + // "Map" the window (that is, make it appear on the screen) + XMapWindow(_sysdep->dpy, _sysdep->win); + + // Create a "Graphics Context" + //GC gc = XCreateGC(dpy, win, 0, NULL); + + XEvent xev; + Atom wm_state = XInternAtom(_sysdep->dpy, "_NET_WM_STATE", False); + Atom fullscreen = XInternAtom(_sysdep->dpy, "_NET_WM_STATE_FULLSCREEN", False); + memset(&xev, 0, sizeof(xev)); + xev.type = ClientMessage; + xev.xclient.window = _sysdep->win; + xev.xclient.message_type = wm_state; + xev.xclient.format = 32; + xev.xclient.data.l[0] = 1; + xev.xclient.data.l[1] = fullscreen; + xev.xclient.data.l[2] = 0; + + XSendEvent(_sysdep->dpy, DefaultRootWindow(_sysdep->dpy), False, + SubstructureNotifyMask, &xev); + + + + + // Wait for the MapNotify event + for (;;) + { + XEvent e; + XNextEvent(_sysdep->dpy, &e); + if (e.type == MapNotify) + break; + } + //Flush it! + //XFlush(_sysdep->dpy); + +#ifndef lock_test + // load the locked cursor, so people dont think they can click anything + // TODO: Use some kind of invisible cursor instead of the wait-cursor + Cursor _sysdep->locked_cur = XCreateFontCursor(_sysdep->dpy, XC_watch); + XDefineCursor(_sysdep->dpy, DefaultRootWindow(_sysdep->dpy),_sysdep->locked_cur); +#endif + + // grabbing of keyboard and mouse and hide the cursor + XGrabKeyboard(_sysdep->dpy, DefaultRootWindow(_sysdep->dpy), false, GrabModeAsync, GrabModeAsync, CurrentTime); + XGrabPointer(_sysdep->dpy, DefaultRootWindow(_sysdep->dpy), false, 0, GrabModeAsync, GrabModeAsync, None, NULL, CurrentTime); + + if (!_sysdep->locked) + ConsoleLog writeLine(QString("Locked")); + + // see header for more information on this switch + return _sysdep->locked = true; +} + +bool BlankScreen::lock_inputs() +{ + // grabbing of keyboard and mouse and hide the cursor + XGrabKeyboard(_sysdep->dpy, DefaultRootWindow(_sysdep->dpy), false, GrabModeAsync, GrabModeAsync, CurrentTime); + XGrabPointer(_sysdep->dpy, DefaultRootWindow(_sysdep->dpy), false, 0, GrabModeAsync, GrabModeAsync, None, NULL, CurrentTime); + return true; +} + +bool BlankScreen::unlock() +{ + + if (_sysdep->dpy) + { + + int retval = -1; + + //reset cursor to arrow (no *real* default here...) + Cursor normal_cur = XCreateFontCursor(_sysdep->dpy, XC_arrow); + XDefineCursor(_sysdep->dpy, DefaultRootWindow(_sysdep->dpy), normal_cur); + + // ungrabbing of keyboard and mouse + XUngrabPointer(_sysdep->dpy, CurrentTime); + XUngrabKeyboard(_sysdep->dpy, CurrentTime); + + + retval = XUnmapWindow(_sysdep->dpy,_sysdep->win); + if (retval == BadWindow) + ConsoleLog writeError(QString("Bad window while unmapping. Badwindow: ").append(int2String(retval))); + XFlush(_sysdep->dpy); + } + if (_sysdep->locked) + ConsoleLog writeLine(QString("Unlocked")); + + _sysdep->lockMsg.clear(); + return !(_sysdep->locked = false); +} diff --git a/src/util/consoleLogger.cpp b/src/util/consoleLogger.cpp old mode 100644 new mode 100755 index b523b40..ae29989 --- a/src/util/consoleLogger.cpp +++ b/src/util/consoleLogger.cpp @@ -226,7 +226,7 @@ void ConsoleLogger::_prepareLog() _logFileGood = false; _readLog(); - mkdir(getPolicyFilePath(QString()).toUtf8().data(), 0777); + createPolicyDir(); QString fullpath; fullpath.append(_logPath); //TODO: handle wether path/ or path were entered? diff --git a/src/util/util.cpp b/src/util/util.cpp old mode 100644 new mode 100755 index 946168e..7463ae0 --- a/src/util/util.cpp +++ b/src/util/util.cpp @@ -6,7 +6,11 @@ #include #include #include - +#include +#ifdef __WIN32__ + #include + #include +#endif //__WIN32__ PVSServerEntry::PVSServerEntry(QString name) { @@ -45,7 +49,11 @@ int getRandom(int min, int max) if (init) { init = false; + #ifndef __WIN32__ srand ( time(NULL) + getpid() ); + #else + srand ( time(NULL) ); /*might be solved by another random factor*/ + #endif } if (min >= max) return rand(); return rand() % (max-min+1) + min; @@ -184,12 +192,29 @@ QString colonSplitter(QString line, bool first) QString getUserName() { - struct passwd* passUser = getpwuid(getuid()); QString username; - if (passUser) - { - username = QString(passUser->pw_name); - } + #ifdef __WIN32__ + WCHAR* lpszSystemInfo; // pointer to system information + DWORD cchBuff = 256; // size of user name + WCHAR tchBuffer[UNLEN + 1]; // buffer for expanded string + + lpszSystemInfo = tchBuffer; + + // Get and display the user name. + GetUserNameW(lpszSystemInfo, &cchBuff); + + //Unicode string needs to be converted + username = QString::fromWCharArray(lpszSystemInfo); + #elif defined __WIN32__ + struct passwd* passUser = getpwuid(getuid()); + + if (passwd) + username = passwd->pw_name; + if (passUser) + { + username = QString(passUser->pw_name); + } + #endif //#ifdef __WIN32__ if (username.isEmpty()) { printf("USERNAME COULDNT BE RETRIEVED!\n"); @@ -202,19 +227,21 @@ QString getUserName() QString getFullUsername() { QString fullname = getUserName(); - struct passwd *pd; + #ifndef __WIN32__ + struct passwd *pd; - if (NULL == (pd = getpwuid(getuid()))) - {ConsoleLog writeError("getpwuid() error.");} - else - { - QString tmp = pd->pw_gecos; - QStringList userData = tmp.split(","); - if(userData[0].length() > 0 ) + if (NULL == (pd = getpwuid(getuid()))) + {ConsoleLog writeError("getpwuid() error.");} + else { - fullname = userData[0]; + QString tmp = pd->pw_gecos; + QStringList userData = tmp.split(","); + if(userData[0].length() > 0 ) + { + fullname = userData[0]; + } } - } + #endif //__WIN32__ //might be completed some time to a full solution for WIN32 return fullname; } @@ -266,7 +293,8 @@ bool policyFileExists(QString fileName) void createPolicyDir() { - mkdir(getPolicyDir().toUtf8().data(), 0777); + QDir(QDesktopServices::storageLocation(QDesktopServices::HomeLocation)).mkdir(".pvs"); + //assuming PolicyDir is defined like in getPolicyDir() } void createPolicyFiles() diff --git a/src/util/util.h b/src/util/util.h old mode 100644 new mode 100755 index 6ddefc6..4f2d0ee --- a/src/util/util.h +++ b/src/util/util.h @@ -4,7 +4,11 @@ #include #include #include -#include +#ifndef __WIN32__ + #include +#else + /*#include "pwd_win32.h"*/ +#endif /*__WIN32*/ #include #include -- cgit v1.2.3-55-g7522 From 5f1e91c7808ebe97b06a5d2e483d06de37ef3a81 Mon Sep 17 00:00:00 2001 From: Johann Latocha Date: Mon, 30 Aug 2010 06:47:49 +0200 Subject: PVS output errors fixed --- src/pvs.cpp | 7 ++++--- src/util/util.cpp | 8 ++------ 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'src/util/util.cpp') diff --git a/src/pvs.cpp b/src/pvs.cpp index 20e9b3b..61df049 100755 --- a/src/pvs.cpp +++ b/src/pvs.cpp @@ -459,12 +459,13 @@ void PVS::setScriptPath(QString path) bool PVS::gotVNCScript() { - if (fileExists(_vncScriptPath)) + if (!_vncScriptPath.isEmpty() && fileExists(_vncScriptPath)) return true; - if (policyFileExists(_vncScriptName)) + + if (!_vncScriptName.isEmpty() && policyFileExists(_vncScriptName)) return true; - return false; + return false; } /** * setup password and port diff --git a/src/util/util.cpp b/src/util/util.cpp index 7463ae0..8b25b12 100755 --- a/src/util/util.cpp +++ b/src/util/util.cpp @@ -205,15 +205,11 @@ QString getUserName() //Unicode string needs to be converted username = QString::fromWCharArray(lpszSystemInfo); - #elif defined __WIN32__ + #else struct passwd* passUser = getpwuid(getuid()); - - if (passwd) - username = passwd->pw_name; if (passUser) - { username = QString(passUser->pw_name); - } + #endif //#ifdef __WIN32__ if (username.isEmpty()) { -- cgit v1.2.3-55-g7522 From f6fca1c3c5279c820be3860b0074831f920219d6 Mon Sep 17 00:00:00 2001 From: Johann Latocha Date: Wed, 1 Sep 2010 01:02:39 +0200 Subject: All printf() replaced with qDebug() --- CMakeLists.txt | 6 +----- src/gui/mainWindow.cpp | 2 +- src/net/SslServer.cpp | 4 ++-- src/net/pvsClientConnection.cpp | 2 +- src/net/pvsDiscoveredServer.cpp | 22 +++++++++++----------- src/net/pvsListenServer.cpp | 7 +++---- src/net/pvsListenServer.h | 2 +- src/net/pvsLocalhostCommunicator.cpp | 6 +++--- src/net/pvsServerConnection.cpp | 2 +- src/net/pvsServiceDiscovery.cpp | 2 +- src/pvs.cpp | 4 ++-- src/pvsDaemon.cpp | 29 ++++++++++++++--------------- src/util/consoleLogger.cpp | 2 +- src/util/consoleLogger.h | 2 +- src/util/util.cpp | 6 +++--- 15 files changed, 46 insertions(+), 52 deletions(-) (limited to 'src/util/util.cpp') diff --git a/CMakeLists.txt b/CMakeLists.txt index a98022d..fa4da6a 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,15 +11,11 @@ CMAKE_MINIMUM_REQUIRED( VERSION 2.6.2 ) # set compiler optimizations for debug and release SET(CMAKE_BUILD_TYPE Debug) SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -Wall") -SET(CMAKE_CXX_FLAGS_RELEASE "-O2" ) -#-march=native -DQT_NO_DEBUG_OUTPUT +SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -DQT_NO_DEBUG_OUTPUT" ) # local cmake modules SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}) -#Test -SET(CMAKE_EDIT_COMMAND ${CMAKE_SOURCE_DIR}) - # this command finds libraries and sets all required variables FIND_PACKAGE( Qt4 4.5.0 REQUIRED ) FIND_PACKAGE( X11 REQUIRED ) diff --git a/src/gui/mainWindow.cpp b/src/gui/mainWindow.cpp index bea636f..10c64d6 100644 --- a/src/gui/mainWindow.cpp +++ b/src/gui/mainWindow.cpp @@ -813,7 +813,7 @@ void MainWindow::foto() // makes a screenshot of the selected client img.save(path, format.toAscii()); } else - printf("Cannot save screen: Image is null.\n"); + qDebug("Cannot save screen: Image is null."); } } else diff --git a/src/net/SslServer.cpp b/src/net/SslServer.cpp index e353e0a..9940a61 100644 --- a/src/net/SslServer.cpp +++ b/src/net/SslServer.cpp @@ -59,7 +59,7 @@ void SslServer::incomingConnection(int socketDescriptor) void SslServer :: sslErrors ( const QList & errors ) { - printf("FIXME: SSL ERRORS on SERVER: %s\n", errors.begin()->errorString().toUtf8().data()); + qDebug("FIXME: SSL ERRORS on SERVER: %s", qPrintable(errors.begin()->errorString())); } void SslServer::timerEvent (QTimerEvent* event) @@ -98,7 +98,7 @@ bool SslServer::hasPendingConnections() { for (QList::iterator it = _pending.begin(); it != _pending.end(); it++) { - printf("State: %d - Encrypted: %d\n", (int)(*it)->state(), (*it)->isEncrypted()); + qDebug("State: %d - Encrypted: %d", (int)(*it)->state(), (*it)->isEncrypted()); if ((*it)->state() == QAbstractSocket::ConnectedState && (*it)->isEncrypted()) return true; } return false; diff --git a/src/net/pvsClientConnection.cpp b/src/net/pvsClientConnection.cpp index dff40d5..5354e95 100644 --- a/src/net/pvsClientConnection.cpp +++ b/src/net/pvsClientConnection.cpp @@ -134,7 +134,7 @@ bool PVSClientConnection::push_back_send(PVSMsg newMsg) char *tmp = data; if (!newMsg.getBinaryData(tmp, len)) { - printf("Message empty. Ignored.\n"); + qDebug("Message empty. Ignored."); return false; } QByteArray ba; diff --git a/src/net/pvsDiscoveredServer.cpp b/src/net/pvsDiscoveredServer.cpp index dddb5a0..efa1506 100644 --- a/src/net/pvsDiscoveredServer.cpp +++ b/src/net/pvsDiscoveredServer.cpp @@ -48,7 +48,7 @@ void PVSDiscoveredServer::ssl_Error( const QList & errors ) } //ConsoleLog writeNetwork(err.errorString().toUtf8().data()); //ConsoleLog writeNetwork("***** SSL ERROR, ABORTING *****"); - printf("Unhandled SSL Error in SD: %s\n", err.errorString().toUtf8().data()); + qDebug("Unhandled SSL Error in SD: %s", qPrintable(err.errorString())); return; } _socket->ignoreSslErrors(); @@ -70,30 +70,30 @@ void PVSDiscoveredServer::sock_connected() QByteArray cert = _socket->peerCertificate().digest(QCryptographicHash::Sha1); if (_socket->peerCertificate().isNull()) { - printf("**** WARNING - PEER CERTIFICATE IS NULL ****\n"); + qDebug("**** WARNING - PEER CERTIFICATE IS NULL ****"); } else { - printf("%s\n", _socket->peerCertificate().subjectInfo(QSslCertificate::Organization).toUtf8().data()); - printf("%s\n", _socket->peerCertificate().subjectInfo(QSslCertificate::CommonName).toUtf8().data()); - printf("%s\n", _socket->peerCertificate().subjectInfo(QSslCertificate::LocalityName).toUtf8().data()); - printf("%s\n", _socket->peerCertificate().subjectInfo(QSslCertificate::OrganizationalUnitName ).toUtf8().data()); - printf("%s\n", _socket->peerCertificate().subjectInfo(QSslCertificate::CountryName ).toUtf8().data()); - printf("%s\n", _socket->peerCertificate().subjectInfo(QSslCertificate::StateOrProvinceName ).toUtf8().data()); + qDebug("%s", qPrintable(_socket->peerCertificate().subjectInfo(QSslCertificate::Organization))); + qDebug("%s", qPrintable(_socket->peerCertificate().subjectInfo(QSslCertificate::CommonName))); + qDebug("%s", qPrintable(_socket->peerCertificate().subjectInfo(QSslCertificate::LocalityName))); + qDebug("%s", qPrintable(_socket->peerCertificate().subjectInfo(QSslCertificate::OrganizationalUnitName))); + qDebug("%s", qPrintable(_socket->peerCertificate().subjectInfo(QSslCertificate::CountryName))); + qDebug("%s", qPrintable(_socket->peerCertificate().subjectInfo(QSslCertificate::StateOrProvinceName))); } if (cert == _fingerprint && !_validated) { _validated = true; emit validated(this); - printf("Validated certificate of %s :)\n", _socket->peerAddress().toString().toUtf8().data()); + qDebug("Validated certificate of %s :)", qPrintable(_socket->peerAddress().toString())); } else { - printf("Certificate of %s is invalid :(\n", _socket->peerAddress().toString().toUtf8().data()); + qDebug("Certificate of %s is invalid :(", qPrintable(_socket->peerAddress().toString())); QByteArray is, should; is = cert.toBase64(); should = _fingerprint.toBase64(); - printf("Is %s and should be %s\n", is.data(), should.data()); + qDebug("Is %s and should be %s", is.data(), should.data()); } _socket->disconnectFromHost(); } diff --git a/src/net/pvsListenServer.cpp b/src/net/pvsListenServer.cpp index f21303e..58d4aee 100644 --- a/src/net/pvsListenServer.cpp +++ b/src/net/pvsListenServer.cpp @@ -137,7 +137,7 @@ void PVSListenServer::timerEvent(QTimerEvent *event) } if (client->lastData() < refval) { // ping timeout - printf("Ping timeout for client %s\n", client->getNameUser().toLocal8Bit().data()); + qDebug("Ping timeout for client %s", qPrintable(client->getNameUser())); if (disconnectClient(client)) break; // list was modified, iterator not valid anymore } @@ -283,9 +283,8 @@ void PVSListenServer::server_connectionRequest() void PVSListenServer::handleClientMsg(unsigned int clientID, PVSMsg msg) { - printf("Got Message for client %ud: [%c][%s][%s]\n", clientID, - (char) msg.getType(), msg.getIdent().toUtf8().data(), - msg.getMessage().toUtf8().data()); + qDebug("Got Message for client %ud: [%c][%s][%s]", clientID, + (char) msg.getType(), qPrintable(msg.getIdent()), qPrintable(msg.getMessage())); msg.setSndID(clientID); if (msg.getType() == PVSCOMMAND) _commandDispatcher.fire(msg.getIdent(), msg); diff --git a/src/net/pvsListenServer.h b/src/net/pvsListenServer.h index ab021c7..b43b730 100644 --- a/src/net/pvsListenServer.h +++ b/src/net/pvsListenServer.h @@ -73,7 +73,7 @@ public: template void addLoginHandler(QString ident, T* who, void (T :: *func)(PVSMsg)) { - printf("Listener got added to LoginHandler\n"); + qDebug("Listener got added to LoginHandler"); _loginDispatcher.addListener(ident, who, func); }; template void removeLoginHandler(QString ident, T* who, void (T :: *func)(PVSMsg)) diff --git a/src/net/pvsLocalhostCommunicator.cpp b/src/net/pvsLocalhostCommunicator.cpp index 199b39c..20783bb 100644 --- a/src/net/pvsLocalhostCommunicator.cpp +++ b/src/net/pvsLocalhostCommunicator.cpp @@ -83,7 +83,7 @@ void PVSLocalhostCommunicator::sendCommand(QString ident, QString cmd) int len; sender.getBinaryData(data, len); QByteArray qba(data, len); - printf("Sending %d bytes to daemon...\n", qba.length()); + qDebug("Sending %d bytes to daemon...", qba.length()); qint64 result = _sock->writeDatagram(qba, localhost, localport); _sock->waitForBytesWritten(100); @@ -92,11 +92,11 @@ void PVSLocalhostCommunicator::sendCommand(QString ident, QString cmd) { if (result == -1) { - printf("Error sending PVSMsg to daemon: %s\n", _sock->errorString().toUtf8().data()); + qDebug("Error sending PVSMsg to daemon: %s", qPrintable(_sock->errorString())); } else { - printf("Sent PVSMsg was incomplete.\n"); + qDebug("Sent PVSMsg was incomplete."); } stop(); } diff --git a/src/net/pvsServerConnection.cpp b/src/net/pvsServerConnection.cpp index 04a1ef6..d187ce3 100644 --- a/src/net/pvsServerConnection.cpp +++ b/src/net/pvsServerConnection.cpp @@ -70,7 +70,7 @@ void PVSServerConnection::sslErrors ( const QList & errors ) for (QList::const_iterator it = errors.begin(); it != errors.end(); it++) { QSslError err = *it; - printf("Connect SSL: %s\n", err.errorString().toUtf8().data()); + qDebug("Connect SSL: %s", qPrintable(err.errorString())); if (err.error() == QSslError::HostNameMismatch) continue; // We don't pay attention to hostnames for validation if (err.error() == QSslError::SelfSignedCertificate) continue; // Also, this will always be the case; we check the fingerprint later ConsoleLog writeNetwork(err.errorString().toUtf8().data()); diff --git a/src/net/pvsServiceDiscovery.cpp b/src/net/pvsServiceDiscovery.cpp index 0a99802..dd6b500 100644 --- a/src/net/pvsServiceDiscovery.cpp +++ b/src/net/pvsServiceDiscovery.cpp @@ -30,7 +30,7 @@ PVSServiceDiscovery::PVSServiceDiscovery(PVS* client) bool ret = _sock.bind(SD_PORT_CLIENT); if (!ret) { - printf("Could not open SERVICE DISCOVERY port\n"); + qDebug("Could not open SERVICE DISCOVERY port"); exit(1); } connect(&_sock, SIGNAL(readyRead()), this, SLOT(sock_dataArrival())); diff --git a/src/pvs.cpp b/src/pvs.cpp index 07b9005..2aaec8a 100755 --- a/src/pvs.cpp +++ b/src/pvs.cpp @@ -54,9 +54,9 @@ PVS::PVS() : new PvsAdaptor(this); QDBusConnection dbus = QDBusConnection::sessionBus(); if (!dbus.registerObject("/", this)) - printf("[ERROR] DBus: Could not register object\n"); + qDebug("[ERROR] DBus: Could not register object"); if (!dbus.registerService("org.openslx.pvs")) - printf("[ERROR] DBus: Could not register service\n"); + qDebug("[ERROR] DBus: Could not register service"); _sdClient = new PVSServiceDiscovery(this); diff --git a/src/pvsDaemon.cpp b/src/pvsDaemon.cpp index 4d3e146..cc11bd4 100755 --- a/src/pvsDaemon.cpp +++ b/src/pvsDaemon.cpp @@ -13,8 +13,8 @@ QTextStream qout(stdout); /// VERSION_STRING is defined in src/version.h void printVersion(bool doExit) { - QTextStream qout(stdout); - printf("Version:\t"VERSION_STRING"\n"); + qout << "Version:\t"VERSION_STRING"\n"; + qout.flush(); if (doExit) exit(0); } @@ -36,7 +36,7 @@ void printHelp() qout << QObject::tr("-v or --version") << "\n\t" << QObject::tr("Shows the current version and exits.") << "\n"; qout << QObject::tr("-d or --daemon") << "\n\t" << QObject::tr("Start as daemon.") << "\n"; qout << QObject::tr("-c :") << "\n\t" << QObject::tr("Sends the command and the optional value to a running PVS-Client.") << "\n\t" << QObject::tr("Command and value may not contain spaces or colons.") << "\n\t" << QObject::tr("The dividing colon is mandatory.") << "\n"; - qout << "-commands: \n\t" << QObject::tr("Prints out available commands to use with -c.") << "\n"; + qout << "--commands: \n\t" << QObject::tr("Prints out available commands to use with -c.") << "\n"; qout << "**************************************************************\n"; qout.flush(); exit(0); @@ -51,11 +51,10 @@ void printNotice() void printCommands() { - printf("**************************************************************\n"); - printf("chat:\n "); - printf("on = turns that chat option on\n off = turns the chat option off\n 1 = bossmode\n 2 = community\n 3 = private\n"); - printf("stop \n\t Stops the running PVS-Client.\n"); - printf("**************************************************************\n"); + qout << "**************************************************************\n"; + qout << "stop \n\t Stops the running PVS-Client.\n"; + qout << "**************************************************************\n"; + qout.flush(); exit(0); } @@ -102,7 +101,7 @@ int main(int argc, char** argv) com.run(); if (!(com.running())) { - printf("Error. UDS Communicator is not running. Exiting.\n"); + qDebug("Error. UDS Communicator is not running. Exiting."); exit(0); } @@ -151,20 +150,20 @@ int main(int argc, char** argv) if (com.server()) { // wont work, no daemon running - printf("Error. No running PVS-Client found. Exiting.\n"); + qDebug("Error. No running PVS-Client found. Exiting."); com.stop(); } else { - printf("Will send i: %s, m: %s\n", argv[option_index + 1], ""); + qDebug("Will send i: %s, m: %s\n", argv[option_index + 1], ""); com.sendCommand(QString(argv[option_index + 1]), ""); QCoreApplication::processEvents(QEventLoop::AllEvents); - printf("Sent command. Exiting.\n"); + qDebug("Sent command. Exiting."); } } else { - printf("Error. No command issued. Exiting.\n"); + qDebug("Error. No command issued. Exiting."); } exit(0); // and gone } @@ -211,7 +210,7 @@ int main(int argc, char** argv) { if (option_index + 1 < argc) { - printf("WARNING: -e is deprecated\n"); + qDebug("WARNING: -e is deprecated"); option_index++; continue; } @@ -243,7 +242,7 @@ int main(int argc, char** argv) if (!com.server()) { - printf("Error. PoolVSClient already running. Exiting\n"); + qDebug("Error. PoolVSClient already running. Exiting"); com.stop(); exit(0); } diff --git a/src/util/consoleLogger.cpp b/src/util/consoleLogger.cpp index 5d07dbe..9189543 100755 --- a/src/util/consoleLogger.cpp +++ b/src/util/consoleLogger.cpp @@ -235,7 +235,7 @@ void ConsoleLogger::_prepareLog() if (_logFile.good()) _logFileGood = true; else - printf("ERROR: Logfile ( %s ) not accessible/found. Logs will not be available.\n", _logPath.toUtf8().data()); + qDebug("ERROR: Logfile ( %s ) not accessible/found. Logs will not be available.", qPrintable(_logPath)); _logFile.close(); } diff --git a/src/util/consoleLogger.h b/src/util/consoleLogger.h index 3a0950d..e4cb291 100644 --- a/src/util/consoleLogger.h +++ b/src/util/consoleLogger.h @@ -116,7 +116,7 @@ public: _line.push_back('\n'); // add an explicit newline char, so it looks better in the logfile //#ifndef as_daemon if (_level == LOG_TERMINAL) // may look strange here, but its quite central :-) - printf("%s\n", _line.toUtf8().data()); + qDebug("%s", qPrintable(_line)); //#endif }; LOG_LEVEL getLevel() diff --git a/src/util/util.cpp b/src/util/util.cpp index 8b25b12..05a209f 100755 --- a/src/util/util.cpp +++ b/src/util/util.cpp @@ -213,7 +213,7 @@ QString getUserName() #endif //#ifdef __WIN32__ if (username.isEmpty()) { - printf("USERNAME COULDNT BE RETRIEVED!\n"); + qDebug("USERNAME COULDNT BE RETRIEVED!"); username = QString("USERNAMEERROR"); } return username; @@ -323,7 +323,7 @@ QString readPassFromPassFile() } bool getAllowed() { - printf("Checking %s\n", getPolicyFilePath(QString(".allow")).toUtf8().data()); + qDebug("Checking %s", qPrintable(getPolicyFilePath(QString(".allow")))); TextFile file(getPolicyFilePath(".allow")); if (file.good()) // should have been checked via exists before, but better be safe { @@ -338,7 +338,7 @@ bool getAllowed() (allowed.compare(QString("TRUE")) == 0) ) return true; } - printf("...negative\n"); + qDebug("...negative"); return false; } -- cgit v1.2.3-55-g7522