diff options
Diffstat (limited to 'src/client/main.cpp')
-rw-r--r-- | src/client/main.cpp | 65 |
1 files changed, 36 insertions, 29 deletions
diff --git a/src/client/main.cpp b/src/client/main.cpp index cea9ae8..ebc6375 100644 --- a/src/client/main.cpp +++ b/src/client/main.cpp @@ -3,39 +3,46 @@ int main(int argc, char** argv) { - QApplication app(argc, argv); - app.setOrganizationName("openslx"); - app.setOrganizationDomain("openslx.org"); - app.setApplicationName("pvsclient"); + QByteArray sessionName; + if (argc != 2) + { + sessionName = ""; + } + else + sessionName = argv[1]; + QApplication app(argc, argv); + app.setOrganizationName("openslx"); + app.setOrganizationDomain("openslx.org"); + app.setApplicationName("pvsclient"); - qsrand((uint)QDateTime::currentMSecsSinceEpoch()); + qsrand((uint)QDateTime::currentMSecsSinceEpoch()); - // Make sure settings directory exists - do { - USER_SETTINGS(settings); - QFileInfo fi(settings.fileName()); - QDir path(fi.path()); - qDebug() << "Settings directory is " << fi.path(); - if (!path.exists()) - path.mkpath(path.absolutePath()); - // Now check if settings file exists. If not, copy system default (if available) - if (!fi.exists()) + // Make sure settings directory exists + do { + USER_SETTINGS(settings); + QFileInfo fi(settings.fileName()); + QDir path(fi.path()); + qDebug() << "Settings directory is " << fi.path(); + if (!path.exists()) + path.mkpath(path.absolutePath()); + // Now check if settings file exists. If not, copy system default (if available) + if (!fi.exists()) + { + SYSTEM_SETTINGS(sys); + QFileInfo sysfi(sys.fileName()); + if (sysfi.exists()) { - SYSTEM_SETTINGS(sys); - QFileInfo sysfi(sys.fileName()); - if (sysfi.exists()) - { - if (!QFile::copy(sys.fileName(), settings.fileName())) - qDebug() << "Copying default settings from " << sys.fileName() << " to " << settings.fileName() << " failed."; - } + if (!QFile::copy(sys.fileName(), settings.fileName())) + qDebug() << "Copying default settings from " << sys.fileName() << " to " << settings.fileName() << " failed."; } - } while (0); + } + } while (0); - // use system locale as language to translate gui - QTranslator translator; - translator.load(":pvsclient"); - app.installTranslator(&translator); + // use system locale as language to translate gui + QTranslator translator; + translator.load(":pvsclient"); + app.installTranslator(&translator); - Toolbar pvsclient; - return app.exec(); + Toolbar pvsclient(sessionName); + return app.exec(); } |