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/QStringList>
7
8namespace QGCCommandLineParser {
9
16{
23
24 std::unique_ptr<QCommandLineParser> parser;
25
26 std::optional<QString> errorString;
27 QString helpText;
28 QString versionText;
29
30 QStringList positional;
31 QStringList unknownOptions;
32
33 // --- Core options ---
34 std::optional<quint8> systemId;
36 bool clearCache = false;
37 std::optional<QString> loggingOptions;
38 bool logOutput = false;
39 bool simpleBootTest = false;
40
41 // --- Test options (command-line parsing only in QGC_UNITTEST_BUILD) ---
42 bool runningUnitTests = false;
43 QStringList unitTests;
44 bool stressUnitTests = false;
46 std::optional<QString> unitTestOutput;
47 std::optional<QString> labelFilter;
48 bool listTests = false;
49
50 // --- Desktop options (not on Android/iOS) ---
51 bool fakeMobile = false;
52 bool allowMultiple = false;
53
54 // --- Graphics options ---
55 bool useDesktopGL = false;
56 bool useSwRast = false;
57 bool quietWindowsAsserts = false;
58};
59
64
70CommandLineParseResult parse(int argc, char* argv[]);
71
75std::optional<int> handleParseResult(const CommandLineParseResult& result);
76
78enum class AppMode {
79 Gui,
80 BootTest,
81#ifdef QGC_UNITTEST_BUILD
82 Test,
83 ListTests
84#endif
85};
86
90AppMode determineAppMode(const CommandLineParseResult& args);
91
92#ifdef QGC_UNITTEST_BUILD
98void overrideCommandLine(int& argc, char**& argv);
99#endif
100
101} // namespace QGCCommandLineParser
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)