Skip to content
Permalink
Browse files

Add MumbleApplication::applicationVersionRootPath().

Also add MumbleApplication::instance() for easily getting
the MumbleApplication singleton.
  • Loading branch information...
mkrautz committed Jun 1, 2015
1 parent ced3bf8 commit 83da95640aa1b3de26e061fd62679a1ffae846fc
Showing with 36 additions and 1 deletion.
  1. +12 −0 src/mumble/MumbleApplication.cpp
  2. +24 −1 src/mumble/MumbleApplication.h
@@ -36,6 +36,10 @@
#include "GlobalShortcut.h"
#include "Global.h"

MumbleApplication *MumbleApplication::instance() {
return static_cast<MumbleApplication *>(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) {
@@ -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

0 comments on commit 83da956

Please sign in to comment.
You can’t perform that action at this time.