3#include <QtCore/QElapsedTimer>
4#include <QtCore/QLoggingCategory>
8#include <QtCore/QTimer>
9#include <QtCore/QTranslator>
10#include <QtGui/QGuiApplication>
16class QQmlApplicationEngine;
28#define qApp (static_cast<QGCApplication*>(QGuiApplication::instance()))
33#define qGuiApp (static_cast<QGCApplication*>(QGuiApplication::instance()))
72 bool event(QEvent *e)
final;
83 QQmlApplicationEngine *
qmlAppEngine()
const {
return _qmlAppEngine; }
88 _qmlAppEngine = engine;
89 _mainRootWindow =
nullptr;
90 _uiTestMode = (engine !=
nullptr);
109 void showAppMessage(
const QString &message,
const QString &title = QString());
119 void _missingParamsDisplay();
120 void _showDelayedAppMessages();
123 bool compressEvent(QEvent *
event, QObject *receiver, QPostEventList *postedEvents)
final;
127 bool _initQmlRootWindow();
130 void _initForNormalAppBoot();
132 QObject *_rootQmlObject();
133 bool _rebootMessageDebounced();
135 bool _runningUnitTests =
false;
136 bool _simpleBootTest =
false;
137 bool _uiTestMode =
false;
138 bool _fakeMobile =
false;
139 bool _logOutput =
false;
140 quint8 _systemId = 0;
141 QTime _lastRebootMessageTime;
143 static constexpr int _missingParamsDelayedDisplayTimerTimeout = 1000;
144 QTimer _missingParamsDelayedDisplayTimer;
145 QList<QPair<int,QString>> _missingParams;
147 QQmlApplicationEngine *_qmlAppEngine =
nullptr;
148 bool _settingsUpgraded =
false;
149 QQuickWindow *_mainRootWindow =
nullptr;
150 QTranslator _qgcTranslatorSourceCode;
151 QTranslator _qgcTranslatorQtLibs;
154 bool _showErrorsInToolbar =
false;
155 QElapsedTimer _msecsElapsedTime;
156 bool _videoManagerInitialized =
false;
157 bool _bootTestPassed =
true;
159 QList<QPair<QString , QString >> _delayedAppMessages;
161 class CompressedSignalList
164 CompressedSignalList() {}
165 void add(
const QMetaMethod &method);
166 void remove(
const QMetaMethod &method);
167 bool contains(
const QMetaObject *metaObject,
int signalIndex);
171 static int _signalIndex(
const QMetaMethod &method);
173 QMap<const QMetaObject*, QSet<int>> _signalMap;
175 Q_DISABLE_COPY(CompressedSignalList)
178 CompressedSignalList _compressedSignals;
180 const QString _settingsVersionKey = QStringLiteral(
"SettingsVersion");
182 const QString _qgcImageProviderId = QStringLiteral(
"QGCImages");
185Q_DECLARE_LOGGING_CATEGORY(QGCAppMessageLog)
The main application and management class.
void qmlAttemptWindowClose()
void reportMissingParameter(int componentId, const QString &name)
void showRebootAppMessage(const QString &message, const QString &title=QString())
bool logOutput() const
Returns true if Qt debug output should be logged to a file.
void init()
Perform initialize which is common to both normal application running and unit tests.
static QString cachedParameterMetaDataFile()
QQuickWindow * mainRootWindow()
void removeCompressedSignal(const QMetaMethod &method)
void languageChanged(const QLocale &locale)
static QString cachedAirframeMetaDataFile()
void addCompressedSignal(const QMetaMethod &method)
Registers the signal such that only the last duplicate signal added is left in the queue.
QQmlApplicationEngine * qmlAppEngine() const
Although public, these methods are internal and should only be called by UnitTest code.
friend class UnitTest
Unit Test have access to creating and destroying singletons.
void showCriticalVehicleMessage(const QString &message)
Show non-modal vehicle message to the user.
bool runningUnitTests() const
QGCImageProvider * qgcImageProvider()
void setQmlAppEngine(QQmlApplicationEngine *engine)
uint64_t msecsSinceBoot() const
bool simpleBootTest() const
void resetRebootMessageDebounce()
void showAppMessage(const QString &message, const QString &title=QString())
Show modal application message to the user.
bool bootTestPassed() const
QLocale getCurrentLanguage() const
Get current language.
bool event(QEvent *e) final
This is used to expose images from ImageProtocolHandler.
Result of parsing command-line arguments.