QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGCCommandLineParser.h
Go to the documentation of this file.
1#pragma once
2
3#include <optional>
4
5#include <QtCore/QCommandLineParser>
6#include <QtCore/QLoggingCategory>
7#include <QtCore/QStringList>
8
9Q_DECLARE_LOGGING_CATEGORY(QGCCommandLineParserLog)
10
11namespace QGCCommandLineParser {
12
19{
26
27 std::unique_ptr<QCommandLineParser> parser;
28
29 std::optional<QString> errorString;
30 QString helpText;
31 QString versionText;
32
33 QStringList positional;
34 QStringList unknownOptions;
35
36 // --- Core options ---
37 std::optional<quint8> systemId;
39 bool clearCache = false;
40 std::optional<QString> loggingOptions;
41 bool logOutput = false;
42 bool simpleBootTest = false;
43
44 // --- Test options (command-line parsing only in QGC_UNITTEST_BUILD) ---
45 bool runningUnitTests = false;
46 QStringList unitTests;
47 bool stressUnitTests = false;
49 std::optional<QString> unitTestOutput;
50 std::optional<QString> labelFilter;
51 bool listTests = false;
52
53 // --- Desktop options (not on Android/iOS) ---
54 bool fakeMobile = false;
55 bool allowMultiple = false;
56
57 // --- Graphics options ---
58 bool useDesktopGL = false;
59 bool useSwRast = false;
60 bool quietWindowsAsserts = false;
61};
62
67
73CommandLineParseResult parse(int argc, char* argv[]);
74
78std::optional<int> handleParseResult(const CommandLineParseResult& result);
79
81enum class AppMode {
82 Gui,
83 BootTest,
84#ifdef QGC_UNITTEST_BUILD
85 Test,
86 ListTests
87#endif
88};
89
94
95#ifdef QGC_UNITTEST_BUILD
101void overrideCommandLine(int& argc, char**& argv);
102#endif
103
104} // namespace QGCCommandLineParser
Q_DECLARE_LOGGING_CATEGORY(AndroidSerialLog)
CommandLineParseResult parse(int argc, char *argv[])
Parse command-line arguments with automatic QCoreApplication management.
AppMode determineAppMode(const CommandLineParseResult &args)
Determine the application mode from parsed arguments.
AppMode
Application execution mode.
@ Gui
Normal GUI application.
@ BootTest
Initialize and exit (for CI validation)
CommandLineParseResult parseCommandLine()
Parse command-line arguments (requires existing QCoreApplication)
std::optional< int > handleParseResult(const CommandLineParseResult &result)
Handle early exit conditions (help, version, error)
Result of parsing command-line arguments.
bool quietWindowsAsserts
Windows only: Disable assert dialogs.
std::unique_ptr< QCommandLineParser > parser
bool listTests
List available tests and exit.
bool useDesktopGL
Windows only: Force Desktop OpenGL.
enum QGCCommandLineParser::CommandLineParseResult::Status statusCode
std::optional< QString > labelFilter
Filter tests by label (comma-separated)
bool useSwRast
Windows/macOS: Force software OpenGL.
std::optional< QString > unitTestOutput
Output file for test results (JUnit XML)