ORE Studio 0.0.4
Loading...
Searching...
No Matches
CommandLineParser.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2025 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_QT_COMMAND_LINE_PARSER_HPP
21#define ORES_QT_COMMAND_LINE_PARSER_HPP
22
23#include <cstdint>
24#include <optional>
25#include <QCoreApplication>
26#include <QCommandLineParser>
27#include <QString>
28#include <QColor>
29#include "ores.logging/logging_options.hpp"
30
31namespace ores::qt {
32
39class CommandLineParser final {
40public:
45
51 void process(const QCoreApplication& app);
52
60 [[nodiscard]] std::optional<logging::logging_options> loggingOptions() const;
61
65 [[nodiscard]] bool isLoggingEnabled() const;
66
70 [[nodiscard]] bool isCompressionEnabled() const;
71
82 [[nodiscard]] std::uint8_t supportedCompression() const;
83
92 [[nodiscard]] QString instanceName() const;
93
102 [[nodiscard]] QColor instanceColor() const;
103
104private:
105 void setupOptions();
106 void saveToSettings();
107
108 QCommandLineParser parser_;
109};
110
111}
112
113#endif
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:35
Encapsulates Qt command line parsing for the application.
Definition CommandLineParser.hpp:39
bool isCompressionEnabled() const
Check if compression is enabled.
Definition CommandLineParser.cpp:172
void process(const QCoreApplication &app)
Process command line arguments.
Definition CommandLineParser.cpp:103
bool isLoggingEnabled() const
Check if logging is enabled.
Definition CommandLineParser.cpp:136
CommandLineParser()
Construct the parser and configure all options.
Definition CommandLineParser.cpp:29
QColor instanceColor() const
Get the instance color for the title bar.
Definition CommandLineParser.cpp:218
std::optional< logging::logging_options > loggingOptions() const
Get logging configuration based on parsed options.
Definition CommandLineParser.cpp:140
QString instanceName() const
Get the instance name for identifying this application instance.
Definition CommandLineParser.cpp:214
std::uint8_t supportedCompression() const
Get the supported compression bitmask based on parsed options.
Definition CommandLineParser.cpp:176