diff --git a/src/mumble/MumbleApplication.cpp b/src/mumble/MumbleApplication.cpp index 3af161273..81de17ed0 100644 --- a/src/mumble/MumbleApplication.cpp +++ b/src/mumble/MumbleApplication.cpp @@ -36,6 +36,10 @@ #include "GlobalShortcut.h" #include "Global.h" +MumbleApplication *MumbleApplication::instance() { + return static_cast(QCoreApplication::instance()); +} + MumbleApplication::MumbleApplication(int &pargc, char **pargv) : QApplication(pargc, pargv) { @@ -45,6 +49,14 @@ MumbleApplication::MumbleApplication(int &pargc, char **pargv) Qt::DirectConnection); } +QString MumbleApplication::applicationVersionRootPath() { + QByteArray versionRoot = qgetenv("MUMBLE_VERSION_ROOT"); + if (versionRoot.count() > 0) { + return QString::fromUtf8(versionRoot.constData()); + } + return this->applicationDirPath(); +} + void MumbleApplication::onCommitDataRequest(QSessionManager &) { // Make sure the config is saved and supress the ask on quit message if (g.mw) { diff --git a/src/mumble/MumbleApplication.h b/src/mumble/MumbleApplication.h index 6ad9fe772..5f13ba7ff 100644 --- a/src/mumble/MumbleApplication.h +++ b/src/mumble/MumbleApplication.h @@ -44,8 +44,31 @@ class MumbleApplication : public QApplication { #endif Q_OBJECT public: + + /// The instance function returns an instance + /// of the MumbleApplication singleton. + static MumbleApplication *instance(); + MumbleApplication(int &pargc, char **pargv); - + + /// applicationVersionRootPath returns + /// Mumble's "versioned root"-path. + /// + /// This is a version-specific path that contains + /// supplementary binaries and other products + /// that Mumble needs to function. + /// + /// In the current implementation, the versioned + /// root path is set by the MUMBLE_VERSION_ROOT + /// environment variable. This environment variable + /// is set in the mumble.exe launcher. + /// + /// If a versioned root path has not been + /// configured in the environment, the function + /// returns the same path as Qt's own + /// QApplication::applicationDirPath(). + QString applicationVersionRootPath(); + bool event(QEvent *e) Q_DECL_OVERRIDE; #ifdef Q_OS_WIN # if QT_VERSION >= 0x050000