Allow switching the user from the command line

This is a feature that many people have asked for. This implementation is
somewhat simplistic because we simply use a different name for the
program settings - but interestingly enough this appears to be enough to
capture a lot of the core functionality that people are looking for in
multi-user support.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2016-04-29 06:17:02 -07:00
parent f536da0ee3
commit 3f63660267
3 changed files with 20 additions and 2 deletions

View file

@ -4,6 +4,8 @@
#include <QTextCodec>
#include "helpers.h"
char *settings_suffix = NULL;
void init_qt_late()
{
QApplication *application = qApp;
@ -19,7 +21,14 @@ void init_qt_late()
QCoreApplication::setOrganizationName("Subsurface");
QCoreApplication::setOrganizationDomain("subsurface.hohndel.org");
QCoreApplication::setApplicationName("Subsurface");
// enable user specific settings (based on command line argument)
if (settings_suffix) {
if (verbose)
qDebug() << "using custom config for" << QString("Subsurface-%1").arg(settings_suffix);
QCoreApplication::setApplicationName(QString("Subsurface-%1").arg(settings_suffix));
} else {
QCoreApplication::setApplicationName("Subsurface");
}
// find plugins installed in the application directory (without this SVGs don't work on Windows)
QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath());
QLocale loc;