From 3b7320ef4e2bd9f24b6dce72a8e8bf94c3695796 Mon Sep 17 00:00:00 2001 From: Johann Latocha Date: Wed, 2 Mar 2011 02:08:42 +0100 Subject: Win32 clean out --- src/gui/clientConfigDialog.cpp | 16 ------------- src/gui/ui/clientConfigDialog.ui | 30 +++-------------------- src/pvs.cpp | 22 +---------------- src/pvs.h | 10 +++----- src/pvsDaemon.cpp | 23 ------------------ src/pvsgui.cpp | 1 - src/util/clientGUIUtils.h | 2 -- src/util/clientGUIUtils_Win32.cpp | 46 ----------------------------------- src/util/util.cpp | 50 ++++++++++----------------------------- src/util/util.h | 9 +------ 10 files changed, 21 insertions(+), 188 deletions(-) mode change 100755 => 100644 src/pvs.cpp mode change 100755 => 100644 src/pvs.h delete mode 100755 src/util/clientGUIUtils_Win32.cpp (limited to 'src') diff --git a/src/gui/clientConfigDialog.cpp b/src/gui/clientConfigDialog.cpp index b7ba407..0ddada0 100644 --- a/src/gui/clientConfigDialog.cpp +++ b/src/gui/clientConfigDialog.cpp @@ -96,16 +96,6 @@ void ClientConfigDialog::readSettings() 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() @@ -125,12 +115,6 @@ void ClientConfigDialog::writeSettings() else _ifaceDBus->setConfigValue("Permissions/vnc_other", "no"); - _ifaceDBus->setConfigValue("Permissions/allow_chat", - QString(checkBoxAllowChat->isChecked() ? "T" : "F")); - _ifaceDBus->setConfigValue("Permissions/allow_filetransfer", - QString(checkBoxAllowFiletransfer->isChecked() ? "T" : "F")); - _ifaceDBus->setConfigValue("multicast/interface", interfaceList->currentText()); - _settings.sync(); emit configChanged(); } diff --git a/src/gui/ui/clientConfigDialog.ui b/src/gui/ui/clientConfigDialog.ui index bb4bdc9..aa73433 100644 --- a/src/gui/ui/clientConfigDialog.ui +++ b/src/gui/ui/clientConfigDialog.ui @@ -6,8 +6,8 @@ 0 0 - 445 - 266 + 366 + 195 @@ -27,7 +27,7 @@ QTabWidget::North - 2 + 0 @@ -130,30 +130,6 @@ - - - - - - Accept chat messages - - - true - - - - - - - Accept file transfers - - - true - - - - - diff --git a/src/pvs.cpp b/src/pvs.cpp old mode 100755 new mode 100644 index 1f751b8..cf45dd7 --- a/src/pvs.cpp +++ b/src/pvs.cpp @@ -46,9 +46,7 @@ PVS::PVS() : _vncRequested = false; readPolicyFiles(); loadCommands(); - /*#ifndef __WIN32__*/ - _blankScreen = NULL; - /*#endif*/ + _blankScreen = NULL; _vncPort = -1; _masterMcastConfig = new McastConfiguration(this); @@ -81,7 +79,6 @@ PVS::PVS() : _timerLockTest = 0; _timerLockDelay = 0; - #ifndef __WIN32__ //add signalhandling for sigterm signals struct sigaction act; act.sa_handler = &PVS::signalHandler; @@ -95,7 +92,6 @@ PVS::PVS() : sigaction(SIGQUIT, &act, 0); initializeInputEventHandling(); - #endif /*__WIN32__*/ } PVS::~PVS() @@ -593,18 +589,12 @@ int PVS::startVNCScript(int port, QString pass, QString 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 { @@ -620,7 +610,6 @@ int PVS::stopVNCScript() { if (gotVNCScript()) { - #ifndef __WIN32__ ConsoleLog writeLine("Stopping VNC-Script"); QString commandLine(_vncScriptPath); commandLine.append(" "); @@ -632,10 +621,6 @@ 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 { @@ -713,7 +698,6 @@ 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(); @@ -728,10 +712,6 @@ void PVS::signalHandler(int signal) mainClient->quit(); break; } - #else - ConsoleLog writeLine("Abfang nicht definiert fuer Windows"); - #endif /*__WIN32__*/ - } bool PVS::createMulticastTransfer(QString const& objectPath, quint64& transferID, QString& errorReason) diff --git a/src/pvs.h b/src/pvs.h old mode 100755 new mode 100644 index 49c2b4c..b2a84cf --- a/src/pvs.h +++ b/src/pvs.h @@ -13,10 +13,8 @@ #define PVSCLIENT_H_ #include -#ifndef __WIN32__ - #include - #include -#endif +#include +#include #include #include "setup.h" @@ -141,9 +139,7 @@ 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?) - /*#ifndef __WIN32__*/ - BlankScreen *_blankScreen;///< object to blank the screen - /*#endif*/ + BlankScreen *_blankScreen;///< object to blank the screen QFileSystemWatcher* _notify; ///< used to get notifies about file changes //vnc-server diff --git a/src/pvsDaemon.cpp b/src/pvsDaemon.cpp index 1784a14..9f2572c 100644 --- a/src/pvsDaemon.cpp +++ b/src/pvsDaemon.cpp @@ -64,9 +64,6 @@ int main(int argc, char** argv) bool _daemon = false; int frequency = 5; int port = -1; -#ifdef as_daemon - bool no_fork = false; -#endif QCoreApplication app(argc, argv); app.setOrganizationName("openslx"); @@ -78,11 +75,6 @@ int main(int argc, char** argv) app.installTranslator(&translator); QFileInfo script; -#ifdef __WIN32__ - //TODO Win32 - if (!script.exists()) - script.setFile(getHomeDir() + "/.pvs/pvs-vncsrv_win32.bat"); -#else QSettings settings; if (!QFile::exists(settings.fileName())) { @@ -97,7 +89,6 @@ int main(int argc, char** argv) script.setFile("/usr/local/bin/pvs-vncsrv"); if (!script.exists()) script.setFile(getHomeDir() + "/.pvs/pvs-vncsrv"); -#endif //__WIN32__ PVSLocalhostCommunicator com(getPolicyFilePath(QString( ".comfile"))); @@ -122,9 +113,6 @@ int main(int argc, char** argv) { "freq", required_argument, 0, 'f' }, { "client", required_argument, 0, 'e' }, { "script", required_argument, 0, 's' }, -#ifdef as_daemon - { "no-fork", no_argument, 0, 'F' }, -#endif { 0, 0, 0, 0 }, }; /* getopt_long stores the option index here. */ @@ -232,13 +220,6 @@ int main(int argc, char** argv) } break; } -#ifdef as_daemon - case 'F': - { - no_fork = true; - break; - } -#endif case '?': { ConsoleLog writeError( @@ -264,11 +245,7 @@ int main(int argc, char** argv) ConsoleLog writeLine(QString("PVS-Client started.")); if (_daemon) - { - #ifndef __WIN32__ daemon(1, 1); - #endif /*__WIN32__*/ - } mainClient = new PVS(); com.getDispatcher()->addListener("*", mainClient, &PVS::onDaemonCommand); diff --git a/src/pvsgui.cpp b/src/pvsgui.cpp index 1f11790..4294206 100644 --- a/src/pvsgui.cpp +++ b/src/pvsgui.cpp @@ -345,7 +345,6 @@ void PVSGUI::disconnected() { statusLabel->setText( "

Offline

"); - showMessage(tr("PVS connection"), tr("Disconnected")); if (_hosts->contains(hostButton->text())) _hosts->value(hostButton->text())->setChecked(false); hostButton->setText("-"); diff --git a/src/util/clientGUIUtils.h b/src/util/clientGUIUtils.h index 7f7ea47..e797ea0 100755 --- a/src/util/clientGUIUtils.h +++ b/src/util/clientGUIUtils.h @@ -25,7 +25,6 @@ private: BlankScreen_Sysdep* _sysdep; }; -#ifndef __WIN32__ # include class X11Info @@ -33,6 +32,5 @@ class X11Info public: static Display* display(); }; -#endif /* !__WIN32__ */ #endif diff --git a/src/util/clientGUIUtils_Win32.cpp b/src/util/clientGUIUtils_Win32.cpp deleted file mode 100755 index 1b4d2ae..0000000 --- a/src/util/clientGUIUtils_Win32.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -#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/util.cpp b/src/util/util.cpp index 05a209f..0fcfa84 100755 --- a/src/util/util.cpp +++ b/src/util/util.cpp @@ -7,10 +7,6 @@ #include #include #include -#ifdef __WIN32__ - #include - #include -#endif //__WIN32__ PVSServerEntry::PVSServerEntry(QString name) { @@ -49,11 +45,7 @@ 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; @@ -193,24 +185,10 @@ QString colonSplitter(QString line, bool first) QString getUserName() { QString username; - #ifdef __WIN32__ - WCHAR* lpszSystemInfo; // pointer to system information - DWORD cchBuff = 256; // size of user name - WCHAR tchBuffer[UNLEN + 1]; // buffer for expanded string + struct passwd* passUser = getpwuid(getuid()); + if (passUser) + username = QString(passUser->pw_name); - lpszSystemInfo = tchBuffer; - - // Get and display the user name. - GetUserNameW(lpszSystemInfo, &cchBuff); - - //Unicode string needs to be converted - username = QString::fromWCharArray(lpszSystemInfo); - #else - struct passwd* passUser = getpwuid(getuid()); - if (passUser) - username = QString(passUser->pw_name); - - #endif //#ifdef __WIN32__ if (username.isEmpty()) { qDebug("USERNAME COULDNT BE RETRIEVED!"); @@ -223,21 +201,19 @@ QString getUserName() QString getFullUsername() { QString fullname = getUserName(); - #ifndef __WIN32__ - struct passwd *pd; + struct passwd *pd; - if (NULL == (pd = getpwuid(getuid()))) - {ConsoleLog writeError("getpwuid() error.");} - else + if (NULL == (pd = getpwuid(getuid()))) + {ConsoleLog writeError("getpwuid() error.");} + else + { + QString tmp = pd->pw_gecos; + QStringList userData = tmp.split(","); + if(userData[0].length() > 0 ) { - QString tmp = pd->pw_gecos; - QStringList userData = tmp.split(","); - if(userData[0].length() > 0 ) - { - fullname = userData[0]; - } + fullname = userData[0]; } - #endif //__WIN32__ //might be completed some time to a full solution for WIN32 + } return fullname; } diff --git a/src/util/util.h b/src/util/util.h index 4f2d0ee..0fab33f 100755 --- a/src/util/util.h +++ b/src/util/util.h @@ -1,19 +1,12 @@ #include #include -//#include #include #include #include -#ifndef __WIN32__ - #include -#else - /*#include "pwd_win32.h"*/ -#endif /*__WIN32*/ +#include #include #include - - #ifndef _PVSSERVERENTRY_H_ #define _PVSSERVERENTRY_H_ class PVSServerEntry -- cgit v1.2.3-55-g7522