From 6cb55b01dcd5306d5d17ff007085770ba5918ef4 Mon Sep 17 00:00:00 2001 From: Johann Latocha Date: Sun, 29 Aug 2010 00:59:36 +0200 Subject: Feature #633 --- misc/pvs.conf | 14 +++++--------- misc/pvsgui.conf | 3 +++ misc/pvsmgr.conf | 12 ------------ 3 files changed, 8 insertions(+), 21 deletions(-) create mode 100644 misc/pvsgui.conf (limited to 'misc') diff --git a/misc/pvs.conf b/misc/pvs.conf index a6fe1f0..f91a63c 100644 --- a/misc/pvs.conf +++ b/misc/pvs.conf @@ -1,10 +1,6 @@ -[General] -chatstate=on -chatmode=community -VNCPermit= +[Permissions] +vnc_lecturer=ro +vnc_other=no +allow_chat=T +allow_filetransfer=T -[room] -room=2 -background= -clientorder= -tag= diff --git a/misc/pvsgui.conf b/misc/pvsgui.conf new file mode 100644 index 0000000..9725bf5 --- /dev/null +++ b/misc/pvsgui.conf @@ -0,0 +1,3 @@ +[Display] +location=1 + diff --git a/misc/pvsmgr.conf b/misc/pvsmgr.conf index 3ff7b40..e69de29 100644 --- a/misc/pvsmgr.conf +++ b/misc/pvsmgr.conf @@ -1,12 +0,0 @@ -[Chat] -chatstate=on -chatmode=bossmode - -[Room] -roomId=123 - -[VNC] -quality=high - -[General] -chatmode=private -- cgit v1.2.3-55-g7522 From c1d871390c75e46bf2cbc71b38796b5c33e67c77 Mon Sep 17 00:00:00 2001 From: Johann Latocha Date: Mon, 30 Aug 2010 17:21:30 +0200 Subject: Defect #644 and cleanout some old code --- CMakeLists.txt | 2 - i18n/pvs_ar_JO.ts | 58 ++++++------- i18n/pvs_de_DE.ts | 58 ++++++------- i18n/pvs_es_MX.ts | 58 ++++++------- i18n/pvs_fr_FR.ts | 58 ++++++------- i18n/pvs_pl_PL.ts | 58 ++++++------- misc/pvs.conf | 3 + src/pvs.cpp | 11 +-- src/pvsDaemon.cpp | 107 ++++++----------------- src/pvsmgr.cpp | 2 - src/pvsmgrtouch.cpp | 3 - src/util/consoleLogger.cpp | 6 +- src/util/pvsSettingsManager.cpp | 185 ---------------------------------------- src/util/pvsSettingsManager.h | 50 ----------- 14 files changed, 177 insertions(+), 482 deletions(-) delete mode 100644 src/util/pvsSettingsManager.cpp delete mode 100644 src/util/pvsSettingsManager.h (limited to 'misc') diff --git a/CMakeLists.txt b/CMakeLists.txt index f829f33..a98022d 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,7 +68,6 @@ SET( PVSMGR_SRCS src/net/pvsClientConnection.cpp src/net/pvsServiceBroadcast.cpp src/util/consoleLogger.cpp - src/util/pvsSettingsManager.cpp src/util/util.cpp src/net/SslServer.cpp src/util/CertManager.cpp @@ -88,7 +87,6 @@ SET( PVS_SRCS src/util/util.cpp src/util/consoleLogger.cpp src/util/clientGUIUtils${sysdep_suffix}.cpp - src/util/pvsSettingsManager.cpp src/core/pvsChatClient.cpp src/net/pvsServiceDiscovery.cpp src/net/pvsDiscoveredServer.cpp diff --git a/i18n/pvs_ar_JO.ts b/i18n/pvs_ar_JO.ts index 4fe4627..2f5b77e 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! @@ -27,127 +27,127 @@ QObject - + Version: - + Usage: - + <<option> <value>, ... > - + Options: - + -vncScriptFile <fullpath\filename> - + Specifies a custom location for the vnc-start/stop-script. - + If not specified, /usr/bin/pvs-vncsrv is expected. - + -freq <seconds> - + Specifies how long to wait until a reconnection attempt is made. - + Default is 5. - + -port <port> - + Specifies on which port to run. - + Default is - + -h or --help - + Shows this help text and exits. - + -v or --version - + Shows the current version and exits. - + -d or --daemon - + Start as daemon. - + -c <string command>:<string value> - + Sends the command and the optional value to a running PVS-Client. - + Command and value may not contain spaces or colons. - + The dividing colon is mandatory. - + Prints out available commands to use with -c. - + Use -h or --help to get a listing of all options. -v or --version gives you the current version. diff --git a/i18n/pvs_de_DE.ts b/i18n/pvs_de_DE.ts index 7bd9dff..20da674 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! @@ -27,127 +27,127 @@ QObject - + Version: - + Usage: - + <<option> <value>, ... > - + Options: - + -vncScriptFile <fullpath\filename> - + Specifies a custom location for the vnc-start/stop-script. - + If not specified, /usr/bin/pvs-vncsrv is expected. - + -freq <seconds> - + Specifies how long to wait until a reconnection attempt is made. - + Default is 5. - + -port <port> - + Specifies on which port to run. - + Default is - + -h or --help - + Shows this help text and exits. - + -v or --version - + Shows the current version and exits. - + -d or --daemon - + Start as daemon. - + -c <string command>:<string value> - + Sends the command and the optional value to a running PVS-Client. - + Command and value may not contain spaces or colons. - + The dividing colon is mandatory. - + Prints out available commands to use with -c. - + Use -h or --help to get a listing of all options. -v or --version gives you the current version. diff --git a/i18n/pvs_es_MX.ts b/i18n/pvs_es_MX.ts index 4fe4627..2f5b77e 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! @@ -27,127 +27,127 @@ QObject - + Version: - + Usage: - + <<option> <value>, ... > - + Options: - + -vncScriptFile <fullpath\filename> - + Specifies a custom location for the vnc-start/stop-script. - + If not specified, /usr/bin/pvs-vncsrv is expected. - + -freq <seconds> - + Specifies how long to wait until a reconnection attempt is made. - + Default is 5. - + -port <port> - + Specifies on which port to run. - + Default is - + -h or --help - + Shows this help text and exits. - + -v or --version - + Shows the current version and exits. - + -d or --daemon - + Start as daemon. - + -c <string command>:<string value> - + Sends the command and the optional value to a running PVS-Client. - + Command and value may not contain spaces or colons. - + The dividing colon is mandatory. - + Prints out available commands to use with -c. - + Use -h or --help to get a listing of all options. -v or --version gives you the current version. diff --git a/i18n/pvs_fr_FR.ts b/i18n/pvs_fr_FR.ts index 4fe4627..2f5b77e 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! @@ -27,127 +27,127 @@ QObject - + Version: - + Usage: - + <<option> <value>, ... > - + Options: - + -vncScriptFile <fullpath\filename> - + Specifies a custom location for the vnc-start/stop-script. - + If not specified, /usr/bin/pvs-vncsrv is expected. - + -freq <seconds> - + Specifies how long to wait until a reconnection attempt is made. - + Default is 5. - + -port <port> - + Specifies on which port to run. - + Default is - + -h or --help - + Shows this help text and exits. - + -v or --version - + Shows the current version and exits. - + -d or --daemon - + Start as daemon. - + -c <string command>:<string value> - + Sends the command and the optional value to a running PVS-Client. - + Command and value may not contain spaces or colons. - + The dividing colon is mandatory. - + Prints out available commands to use with -c. - + Use -h or --help to get a listing of all options. -v or --version gives you the current version. diff --git a/i18n/pvs_pl_PL.ts b/i18n/pvs_pl_PL.ts index 4fe4627..2f5b77e 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! @@ -27,127 +27,127 @@ QObject - + Version: - + Usage: - + <<option> <value>, ... > - + Options: - + -vncScriptFile <fullpath\filename> - + Specifies a custom location for the vnc-start/stop-script. - + If not specified, /usr/bin/pvs-vncsrv is expected. - + -freq <seconds> - + Specifies how long to wait until a reconnection attempt is made. - + Default is 5. - + -port <port> - + Specifies on which port to run. - + Default is - + -h or --help - + Shows this help text and exits. - + -v or --version - + Shows the current version and exits. - + -d or --daemon - + Start as daemon. - + -c <string command>:<string value> - + Sends the command and the optional value to a running PVS-Client. - + Command and value may not contain spaces or colons. - + The dividing colon is mandatory. - + Prints out available commands to use with -c. - + Use -h or --help to get a listing of all options. -v or --version gives you the current version. diff --git a/misc/pvs.conf b/misc/pvs.conf index f91a63c..93c4ac5 100644 --- a/misc/pvs.conf +++ b/misc/pvs.conf @@ -1,3 +1,6 @@ +[VNC] +script=/usr/local/bin/pvs-vncsrv + [Permissions] vnc_lecturer=ro vnc_other=no diff --git a/src/pvs.cpp b/src/pvs.cpp index 61df049..07b9005 100755 --- a/src/pvs.cpp +++ b/src/pvs.cpp @@ -30,13 +30,6 @@ extern PVS *mainClient; PVS::PVS() : QObject() { - if (!QFile::exists(_settings.fileName())) - { - QDir::root().mkpath(QFileInfo(_settings.fileName()).path()); - QFile::copy("/etc/openslx/pvs.conf", _settings.fileName()); - } - - _pvsServerConnection = new PVSServerConnection(this); _locked = false; _vncAllowed = false; @@ -61,9 +54,9 @@ PVS::PVS() : new PvsAdaptor(this); QDBusConnection dbus = QDBusConnection::sessionBus(); if (!dbus.registerObject("/", this)) - qDebug("[ERROR] DBus: Could not register object"); + printf("[ERROR] DBus: Could not register object\n"); if (!dbus.registerService("org.openslx.pvs")) - qDebug("[ERROR] DBus: Could not register service"); + printf("[ERROR] DBus: Could not register service\n"); _sdClient = new PVSServiceDiscovery(this); diff --git a/src/pvsDaemon.cpp b/src/pvsDaemon.cpp index b23bc57..a0405d0 100755 --- a/src/pvsDaemon.cpp +++ b/src/pvsDaemon.cpp @@ -3,7 +3,6 @@ #include #include "pvs.h" #include "src/net/pvsLocalhostCommunicator.h" -#include "src/util/pvsSettingsManager.h" #include "setup.h" #include "src/net/pvsMsg.h" #include "src/core/pvsChatClient.h" @@ -67,19 +66,6 @@ int main(int argc, char** argv) int frequency = 5; int port = -1; - QFileInfo script; - #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"); app.setOrganizationDomain("openslx.org"); @@ -89,6 +75,27 @@ int main(int argc, char** argv) translator.load(":pvs"); 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())) + { + QDir::root().mkpath(QFileInfo(settings.fileName()).path()); + QFile::copy("/etc/openslx/pvs.conf", settings.fileName()); + } + QString s = settings.value("VNC/script").toString(); + script.setFile(s); + if (!script.exists()) + 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__ PVSLocalhostCommunicator com(getPolicyFilePath(QString( ".comfile"))); @@ -149,73 +156,17 @@ int main(int argc, char** argv) } else { - QStringList line = QString::fromLocal8Bit(argv[option_index - + 1]).split(":"); - QString &ident = line[0]; - QString message; - if (line.size() > 1) - message = line[1]; - if (ident.size() > 0) // no use sending empty idents... not even sure if this COULD happen - { - bool flag = false; - if (ident == "make") - PVSSettingsManager::getManager()->setConfigs(); - else if (ident == "chat" && message == "boss") - { - PVSSettingsManager::getManager()->reWriteConfigs("chatmode", "bossmode"); - flag = true; - - } - else if (ident == "chat" && message == "all") - { - PVSSettingsManager::getManager()->reWriteConfigs("chatmode", "community"); - flag = true; - } - else if (ident == "chat" && message == "private") - { - PVSSettingsManager::getManager()->reWriteConfigs("chatmode", "private"); - flag = true; - } - else if (ident == "chat" && message == "on") - { - PVSSettingsManager::getManager()->reWriteConfigs("chatstate", "on"); - flag = true; - } - else if (ident == "chat" && message == "off") - { - PVSSettingsManager::getManager()->reWriteConfigs("chatstate", "off"); - flag = true; - } - else if (ident == "room") - { - //PVSSettingsManager::getManager()->reWriteConfigs(ident, message); - flag = true; - } - else if (ident == "stop" && message == NULL) - flag = true; - else - printf("option %s doesn't exist\n", ident.toUtf8().data()); - - if (flag) - { - qDebug("Will send i: %s, m: %s\n", ident.toUtf8().data(), message.toUtf8().data()); - com.sendCommand(ident, message); - QCoreApplication::processEvents(QEventLoop::AllEvents); - printf("Sent command. Exiting.\n"); - } - } - - else - printf("Something went horribly wrong, since the ident is empty.\n"); - - } + printf("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"); + } } else { printf("Error. No command issued. Exiting.\n"); } exit(0); // and gone - break; } case 'f': { @@ -336,7 +287,6 @@ int main(int argc, char** argv) } mainClient = new PVS(); - PVSSettingsManager::getManager()->setConfigFile(getPolicyFilePath("clientconf")); com.getDispatcher()->addListener("*", mainClient, &PVS::onDaemonCommand); if (port <= 0) @@ -347,11 +297,6 @@ int main(int argc, char** argv) createPolicyDir(); createPolicyFiles(); - // long int gr = 0; - mainClient->setScriptPath(script.filePath()); app.exec(); - delete mainClient; - - return 0; } diff --git a/src/pvsmgr.cpp b/src/pvsmgr.cpp index 83f5fe0..dd00c0e 100644 --- a/src/pvsmgr.cpp +++ b/src/pvsmgr.cpp @@ -18,7 +18,6 @@ #include #include "gui/mainWindow.h" #include "util/consoleLogger.h" -#include "util/pvsSettingsManager.h" #include "util/CertManager.h" QApplication *qtApp; @@ -47,7 +46,6 @@ int main(int argc, char** argv) exit(123); } */ - PVSSettingsManager::getManager()->setConfigFile(getPolicyFilePath("serverconf")); MainWindow w; w.show(); return qtApp->exec(); diff --git a/src/pvsmgrtouch.cpp b/src/pvsmgrtouch.cpp index fa34294..d14ea56 100644 --- a/src/pvsmgrtouch.cpp +++ b/src/pvsmgrtouch.cpp @@ -16,9 +16,7 @@ #include #include -#include "gui/touchgui.h" #include "util/consoleLogger.h" -#include "util/pvsSettingsManager.h" #include "util/CertManager.h" QApplication *qtApp; @@ -47,7 +45,6 @@ int main(int argc, char** argv) exit(123); } */ - PVSSettingsManager::getManager()->setConfigFile(getPolicyFilePath("serverconf")); pvsMainWindow w; w.show(); return qtApp->exec(); diff --git a/src/util/consoleLogger.cpp b/src/util/consoleLogger.cpp index ae29989..5d07dbe 100755 --- a/src/util/consoleLogger.cpp +++ b/src/util/consoleLogger.cpp @@ -233,14 +233,10 @@ void ConsoleLogger::_prepareLog() fullpath.append(_logName); _logFile.open(fullpath.toUtf8().data(), std::ofstream::out | std::ofstream::app); if (_logFile.good()) - { _logFileGood = true; - writeTerminal(QString("LogPath/Name changed to: ").append(fullpath)); - } else - { printf("ERROR: Logfile ( %s ) not accessible/found. Logs will not be available.\n", _logPath.toUtf8().data()); - } + _logFile.close(); } diff --git a/src/util/pvsSettingsManager.cpp b/src/util/pvsSettingsManager.cpp deleted file mode 100644 index a6a742b..0000000 --- a/src/util/pvsSettingsManager.cpp +++ /dev/null @@ -1,185 +0,0 @@ -#include "pvsSettingsManager.h" -#include "TextFile.h" - -PVSSettingsManager* PVSSettingsManager::getManager() -{ - if (myself) - return myself; - else - return myself = new PVSSettingsManager; -} - -void PVSSettingsManager::setConfigFile(QString path) -{ - if (path.size() && fileExists(path)) - { - _path = path; - _parseFile(_path); - - } - else - ConsoleLog writeError(QString("Can't open config file \"").append(QString(path).append("\""))); -} - -bool PVSSettingsManager::hasEntry(QString name) -{ - for (SettingsIter it = settingsList.begin(); it != settingsList.end(); it++) - { - if ((*it).first.compare(name) == 0) - { - return true; - } - } - return false; -} - -QString PVSSettingsManager::getEntryString(QString name) -{ - for (SettingsIter it = settingsList.begin(); it != settingsList.end(); it++) - { - if ((*it).first.compare(name) == 0) - { - return (*it).second; - } - } - return QString(); -} - -void PVSSettingsManager::writeEntry(QString name, QString value) -{ - if (name.size() && value.size()) - return; - bool unique = true; - for (SettingsIter it = settingsList.begin(); it != settingsList.end(); it++) - { - if ((*it).first.compare(name) == 0) - { - unique = false; - (*it).second = value; - break; - } - } - if (unique) - { - SettingsEntry tmp(name, value); - settingsList.push_back(tmp); - } -} - - -PVSSettingsManager* PVSSettingsManager::myself = NULL; - -PVSSettingsManager::PVSSettingsManager() -{ - -} - -void PVSSettingsManager::setConfigs() -{ - //default settings - _configs.setValue("Chat/chatstate", "on"); - _configs.setValue("Chat/chatmode", "bossmode"); - _configs.setValue("Room/roomId", "0"); - _configs.setValue("VNC/permit", "off"); - _configs.setValue("VNC/quality", "high"); - _configs.sync(); -} -void PVSSettingsManager::reWriteConfigs(QString set, QString val) -{ - _configs.setValue(set, val); - _configs.sync(); -} - -void PVSSettingsManager::readConfigs(QString sett, QString vall) -{ - //TODO: read the config file.. - _configs.value("Chat/chatstate").toBool(); - _configs.value("Chat/chatmode").toString(); - _configs.value("Room/room").toInt(); - _configs.value("VNC/permit").toBool(); - _configs.value("VNC/quality").toString(); -} - -void PVSSettingsManager::_parseFile(QString path) -{ - QString line; - TextFile file(path); - - SettingsList tmpList; - - if (file.good()) - { - while (!file.eof()) - { - line = file.readLine(); - if (!(line.length() <=1)) // ignore blank - { - if (!(line[0] == '#' || line[0] == '/' || line[0] == '[')) // ignore comments and section headers - { - SettingsEntry tmp = _parseLine(line); - if (tmp.first.size() && tmp.second.size()) - { - bool unique = true; - for (SettingsIter it = tmpList.begin(); it != tmpList.end(); it++) - { - if ((*it).first.compare(tmp.first) == 0) - { - unique = false; - break; - } - } - if (unique) - tmpList.push_back(tmp); - } - } - } - } - } - else - { - ConsoleLog writeError(QString("No configfile \"").append(QString(path).append("\" found or file corrupt."))); - } - - if (tmpList.size()) - settingsList = tmpList; -} -#ifdef verbose -ConsoleLog writeLine(QString("Dumping Config Content of ").append(QString(path).append(" : "))); -for (SettingsIter it = settingsList.begin(); it != settingsList.end(); it++) -{ - ConsoleLog writeLine(QString("Option: ").append(QString((*it).first).append(QString(" | Value: ").append((*it).second)))); -} -ConsoleLog writeLine(QString("End of ").append(QString(path).append("."))); -#endif - -SettingsEntry PVSSettingsManager::_parseLine(QString line) -{ - QString name; - QString value; - - name = lineSplitter(line, "=\n\t", true); - value = lineSplitter(line, "=\n\t", false); - - if (!(name.size() && value.size())) - return SettingsEntry("",""); - - - // remove whitespaces in front of option name - for (int i = 0; i < name.size(); i++) - { - if (name[i] == '\t' || name[i] == ' ') - { - name.remove(i, 1); - i--; - } - else - break; - } - // whitespaces after the value are trimmed by the lineSplitter - - SettingsEntry tmp(name, value); - return tmp; -} - - - diff --git a/src/util/pvsSettingsManager.h b/src/util/pvsSettingsManager.h deleted file mode 100644 index 78607eb..0000000 --- a/src/util/pvsSettingsManager.h +++ /dev/null @@ -1,50 +0,0 @@ -/// documentation test 1 -/// line 2 -/// line 3 -#ifndef _PVSSETTINGSMANGER_H_ -#define _PVSSETTINGSMANGER_H_ - -#include -#include -#include -#include -#include - - -/// documentation test 1.1 -/// line 2.1 -/// line 3.1 - -typedef std::pair SettingsEntry; ///< first = option name, second = option value -typedef std::list SettingsList; ///< obvious -typedef std::list::iterator SettingsIter; - - -class PVSSettingsManager; -/// documentation test 1.2 -/// line 2.2 -/// line 3.2 -class PVSSettingsManager -{ -public: - static PVSSettingsManager* getManager(); - void setConfigFile(QString path); - bool hasEntry(QString name); - QString getEntryString(QString name); - void writeEntry(QString name, QString value); - void setConfigs(); - void reWriteConfigs(QString set, QString val); - void readConfigs(QString sett, QString vall); -private: - static PVSSettingsManager* myself; - PVSSettingsManager(); - void _parseFile(QString path); - SettingsEntry _parseLine(QString line); - QString _path; - SettingsList settingsList; - QSettings _configs; - -}; - - -#endif -- cgit v1.2.3-55-g7522 From b6e32a987be01ccd0331dc1f75b55c7095cb4011 Mon Sep 17 00:00:00 2001 From: jjl Date: Tue, 21 Sep 2010 23:43:32 +0200 Subject: pvsgui autostart --- CMakeLists.txt | 1 + misc/pvsgui.desktop | 3 +++ src/pvsDaemon.cpp | 36 ++++-------------------------------- 3 files changed, 8 insertions(+), 32 deletions(-) mode change 100755 => 100644 CMakeLists.txt create mode 100644 misc/pvsgui.desktop mode change 100755 => 100644 src/pvsDaemon.cpp (limited to 'misc') diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100755 new mode 100644 index fa4da6a..f53422e --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -368,6 +368,7 @@ ELSEIF(UNIX) INSTALL( PROGRAMS misc/pvs-vncsrv DESTINATION bin) INSTALL( FILES ${CMAKE_BINARY_DIR}/org.openslx.pvs.service DESTINATION share/dbus-1/services ) INSTALL( FILES misc/pvs.conf misc/pvsgui.conf misc/pvsmgr.conf DESTINATION /etc/openslx ) + INSTALL( FILES misc/pvsgui.desktop DESTINATION /etc/xdg/autostart ) ENDIF(WIN32) # add uninstall target to our makefile diff --git a/misc/pvsgui.desktop b/misc/pvsgui.desktop new file mode 100644 index 0000000..bb6408c --- /dev/null +++ b/misc/pvsgui.desktop @@ -0,0 +1,3 @@ +[Desktop Entry] +Exec=/usr/local/bin/pvsgui +Type=Application diff --git a/src/pvsDaemon.cpp b/src/pvsDaemon.cpp old mode 100755 new mode 100644 index cc11bd4..c975a9e --- a/src/pvsDaemon.cpp +++ b/src/pvsDaemon.cpp @@ -61,7 +61,7 @@ void printCommands() /// int main(int argc, char** argv) { - bool daemon = false; + bool _daemon = false; int frequency = 5; int port = -1; @@ -141,7 +141,7 @@ int main(int argc, char** argv) printVersion(true); break; case 'd': - daemon = true; + _daemon = true; break; case 'c': { @@ -250,38 +250,10 @@ int main(int argc, char** argv) ConsoleLog setLogName(QString("log.client")); ConsoleLog writeLine(QString("PVS-Client started.")); - if (daemon) + if (_daemon) { #ifndef __WIN32__ - pid_t pid, sid; // our process ID and session ID - - // fork off the parent process - pid = fork(); - if (pid < 0) - exit(-1); - - // if we got a good PID, then we can exit the parent process. - if (pid > 0) - exit(0); - - // change the file mode mask - umask(0); - - // create a new SID for the child process - sid = setsid(); - if (sid < 0) - exit(-1); - - // change the current working directory - if ((chdir("/")) < 0) - exit(-1); - - // close out the standard file descriptors - close(STDIN_FILENO); - freopen ((QString(getHomeDir()).append(QString("/.pvs/dump"))).toUtf8() - .data(),"w",stdout); - //close(STDOUT_FILENO); - close(STDERR_FILENO); + daemon(1, 1); #endif /*__WIN32__*/ } -- cgit v1.2.3-55-g7522 From 12e28c2d69d8e6509ec96aa2dfe91cf365421f2c Mon Sep 17 00:00:00 2001 From: jjl Date: Wed, 22 Sep 2010 19:49:33 +0200 Subject: Gnome autostart fixed --- misc/pvsgui.desktop | 1 + 1 file changed, 1 insertion(+) (limited to 'misc') diff --git a/misc/pvsgui.desktop b/misc/pvsgui.desktop index bb6408c..676248d 100644 --- a/misc/pvsgui.desktop +++ b/misc/pvsgui.desktop @@ -1,3 +1,4 @@ [Desktop Entry] Exec=/usr/local/bin/pvsgui Type=Application +Name=pvsgui -- cgit v1.2.3-55-g7522