Welcome to mirror list, hosted at ThFree Co, Russian Federation.

MumbleApplication.h « mumble « src - github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fc7e933078a58e95088745df23176b9b530f1662 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Copyright 2005-2017 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#ifndef MUMBLE_MUMBLE_MUMBLEAPPLICATION_H
#define MUMBLE_MUMBLE_MUMBLEAPPLICATION_H

#include <QApplication>
#include <QUrl>

#if QT_VERSION >= 0x050000 && defined(Q_OS_WIN)
# include <QAbstractNativeEventFilter>
#endif

/**
 * @brief Implements custom system shutdown behavior as well as event filtering.
 */
#if QT_VERSION >= 0x050000 && defined(Q_OS_WIN)
class MumbleApplication : public QApplication, public QAbstractNativeEventFilter {
#else
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
		bool MumbleApplication::nativeEventFilter(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE;
# else
		bool winEventFilter(MSG *msg, long *result) Q_DECL_OVERRIDE;
# endif
#endif
		
		QUrl quLaunchURL;
		
	public slots:
		/// Saves state and suppresses ask on quit before system shutdown. 
		void onCommitDataRequest(QSessionManager&);
};

#endif // MUMBLE_MUMBLE_MUMBLEAPPLICATION_H