#include #include #include "mainwindow/mainwindow.h" #include "util/util.h" #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); app.setOrganizationName("openslx"); app.setOrganizationDomain("openslx.org"); app.setApplicationName("pvsmgr"); 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) { if (supportedStyles.contains(style)) { qDebug() << "Setting style to: " << style; app.setStyle(style); break; } } qsrand((uint)QDateTime::currentMSecsSinceEpoch()); // Set the global path of the settings QSettings::setPath(QSettings::IniFormat, QSettings::SystemScope, "/opt/"); QSharedPointer sys = Global::getSettings(); qDebug() << "System settings are in:" << sys->fileName(); QFileInfo sysfi(sys->fileName()); // use system locale as language to translate gui QTranslator translator; translator.load(":pvsmgr"); app.installTranslator(&translator); MainWindow pvsmgr; return app.exec(); }