diff options
author | Christian Klinger | 2016-09-26 11:45:35 +0200 |
---|---|---|
committer | Christian Klinger | 2016-09-26 11:45:35 +0200 |
commit | f9d165687aac7423c86554b7e73ade99f9e1f3ea (patch) | |
tree | 27a8d541e2c510a09292d7240fb64f38f11218fc /src/server/main.cpp | |
parent | removed USER_SETTINGS etc. (diff) | |
download | pvs2-f9d165687aac7423c86554b7e73ade99f9e1f3ea.tar.gz pvs2-f9d165687aac7423c86554b7e73ade99f9e1f3ea.tar.xz pvs2-f9d165687aac7423c86554b7e73ade99f9e1f3ea.zip |
added the --config=FILE parameter and got rid of the SETTINGS macro.
Diffstat (limited to 'src/server/main.cpp')
-rw-r--r-- | src/server/main.cpp | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/src/server/main.cpp b/src/server/main.cpp index 2e5a32b..0c09f91 100644 --- a/src/server/main.cpp +++ b/src/server/main.cpp @@ -5,6 +5,21 @@ #include "util/global.h" #include "../shared/settings.h" +using std::cout; +using std::endl; + +void usage() { + cout << "USAGE pvsmgr [OPTIONS]" << endl; + cout << "OPTIONS: " << endl; + cout << "--manager-only" << endl; + cout << " pvsmgr terminates if this computer is not a manager of a room" << endl; + cout << "--config=INIFILE" << endl; + cout << " read configuration from INIFILE instead of default path (/opt/openslx/pvs2/pvs2.ini) " << endl; + cout << "--usage" << endl; + cout << " shows this message" << endl; +} + + int main(int argc, char** argv) { QApplication app(argc, argv); @@ -13,15 +28,19 @@ int main(int argc, char** argv) app.setOrganizationDomain("openslx.org"); app.setApplicationName("pvsmgr"); - qDebug() << "args are " << app.arguments() << "<END>"; - for (QString a : app.arguments()) { - if (a == "--manager-only") { - Global::manager_only = true; - break; - } else if (!a.endsWith("pvsmgr")) { - qDebug() << "ignoring unknown argument: \"" << a << "\""; - } - } + for (QString a : app.arguments()) { + if (a == "--manager-only") { + Global::manager_only = true; + break; + } else if (a.startsWith("--config=")) { + Global::setIniPath(a.mid(9)); + } else if (a == "--usage" || a == "--help") { + usage(); + exit(0); + } else if (!a.endsWith("pvsmgr")) { + qDebug() << "ignoring unknown argument: \"" << a << "\""; + } + } QStringList supportedStyles = QStyleFactory::keys(); for (QString style : PREFERRED_STYLES) { @@ -36,9 +55,9 @@ int main(int argc, char** argv) // Set the global path of the settings QSettings::setPath(QSettings::IniFormat, QSettings::SystemScope, "/opt/"); - SETTINGS(sys); - qDebug() << "System settings are in:" << sys.fileName(); - QFileInfo sysfi(sys.fileName()); + QSharedPointer<QSettings> sys = Global::getSettings(); + qDebug() << "System settings are in:" << sys->fileName(); + QFileInfo sysfi(sys->fileName()); // use system locale as language to translate gui |