mirror of
https://github.com/mumble-voip/mumble.git
synced 2025-10-26 11:19:16 +00:00
Add MumbleApplication::applicationVersionRootPath().
Also add MumbleApplication::instance() for easily getting the MumbleApplication singleton.
This commit is contained in:
parent
ced3bf8d7c
commit
83da95640a
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user