/************************************************************************ ** ** @file vpcommandline.h ** @author Dmytro Hladkykh ** @date 12 4, 2020 ** ** @brief ** @copyright ** This source code is part of the Valentina project, a pattern making ** program, whose allow create and modeling patterns of clothing. ** Copyright (C) 2020 Valentina project ** All Rights Reserved. ** ** Valentina is free software: you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with Valentina. If not, see . ** *************************************************************************/ #ifndef VPCOMMANDLINE_H #define VPCOMMANDLINE_H #include #include #include // Header is removed in C++20. #if __cplusplus <= 201703L #include // and, not, or #endif #if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) #include "../vmisc/defglobal.h" #endif class VPCommandLine; using VPCommandLinePtr = std::shared_ptr; class VPCommandLine : public QObject { Q_OBJECT // NOLINT public: ~VPCommandLine() override = default; /** @brief list with paths to the raw layout data files */ auto OptionRawLayouts() const -> QStringList; /** @brief if gui enabled or not */ auto IsGuiEnabled() const -> bool; /** @brief the file name which should be loaded */ auto OptionFileNames() const -> QStringList; /** @brief if high dpi scaling is enabled */ auto IsNoScalingEnabled() const -> bool; Q_NORETURN void ShowHelp(int exitCode = 0); auto OptionStyle() const -> QString; protected: VPCommandLine(); /** @brief create the single instance of the class inside vpapplication */ static auto Instance() -> VPCommandLinePtr; static void ProcessInstance(VPCommandLinePtr &instance, const QStringList &arguments); private: // cppcheck-suppress unknownMacro Q_DISABLE_COPY_MOVE(VPCommandLine) // NOLINT static VPCommandLinePtr instance; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) QCommandLineParser parser{}; bool isGuiEnabled{true}; friend class VPApplication; /** @brief add options to the QCommandLineParser that there are in the cmd can be */ void InitCommandLineOptions(); auto IsOptionSet(const QString &option) const -> bool; auto OptionValue(const QString &option) const -> QString; auto OptionValues(const QString &option) const -> QStringList; }; #endif // VPCOMMANDLINE_H