2020-04-15 23:12:07 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
2020-05-23 14:43:57 +02:00
|
|
|
** @file vpcommandline.h
|
2020-04-17 20:58:34 +02:00
|
|
|
** @author Dmytro Hladkykh <vorzelmir@gmail.com>
|
2020-04-15 23:12:07 +02:00
|
|
|
** @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
|
|
|
|
** <https://gitlab.com/smart-pattern/valentina> 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 <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
2020-05-23 14:43:57 +02:00
|
|
|
#ifndef VPCOMMANDLINE_H
|
|
|
|
#define VPCOMMANDLINE_H
|
2020-04-03 22:05:03 +02:00
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <QCoreApplication>
|
|
|
|
#include <QCommandLineParser>
|
|
|
|
|
2020-05-23 14:43:57 +02:00
|
|
|
class VPCommandLine;
|
|
|
|
using VPCommandLinePtr = std::shared_ptr<VPCommandLine>;
|
2020-04-13 11:43:25 +02:00
|
|
|
|
2020-05-23 14:43:57 +02:00
|
|
|
class VPCommandLine: public QObject
|
2020-04-03 22:05:03 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2020-05-23 14:43:57 +02:00
|
|
|
virtual ~VPCommandLine() = default;
|
2020-04-03 22:05:03 +02:00
|
|
|
|
2020-04-13 11:47:19 +02:00
|
|
|
/** @brief if user enabled export from cmd */
|
2020-04-03 22:05:03 +02:00
|
|
|
bool IsExportEnabled() const;
|
2020-04-12 22:28:36 +02:00
|
|
|
|
2020-04-13 11:48:09 +02:00
|
|
|
/** @brief path to export file or empty string if not */
|
|
|
|
QString OptionExportFile() const;
|
|
|
|
|
|
|
|
/** @brief list with paths to the raw layout data files */
|
|
|
|
QStringList OptionRawLayouts() const;
|
2020-04-12 22:28:36 +02:00
|
|
|
|
2020-04-13 11:47:19 +02:00
|
|
|
/** @brief if user enabled test mode from cmd */
|
2020-04-03 22:05:03 +02:00
|
|
|
bool IsTestModeEnabled() const;
|
2020-04-12 22:28:36 +02:00
|
|
|
|
2020-04-13 11:47:19 +02:00
|
|
|
/** @brief if gui enabled or not */
|
2020-04-03 22:05:03 +02:00
|
|
|
bool IsGuiEnabled() const;
|
2020-04-12 22:28:36 +02:00
|
|
|
|
2020-04-13 11:47:19 +02:00
|
|
|
/** @brief the file name which should be loaded */
|
2020-04-06 23:57:01 +02:00
|
|
|
QStringList OptionFileNames() const;
|
2020-04-12 22:28:36 +02:00
|
|
|
|
2020-04-13 11:47:19 +02:00
|
|
|
/** @brief if high dpi scaling is enabled */
|
2020-04-12 22:28:36 +02:00
|
|
|
bool IsNoScalingEnabled() const;
|
2020-04-21 17:58:01 +02:00
|
|
|
|
|
|
|
Q_NORETURN void ShowHelp(int exitCode = 0);
|
2020-04-03 22:05:03 +02:00
|
|
|
protected:
|
2020-05-23 14:43:57 +02:00
|
|
|
VPCommandLine();
|
2020-04-12 22:28:36 +02:00
|
|
|
|
2020-05-23 14:10:05 +02:00
|
|
|
/** @brief create the single instance of the class inside vpapplication */
|
2020-05-23 14:43:57 +02:00
|
|
|
static VPCommandLinePtr Instance(const QCoreApplication &app);
|
|
|
|
static void ProcessInstance(VPCommandLinePtr &instance, const QStringList &arguments);
|
2020-04-03 22:05:03 +02:00
|
|
|
private:
|
2020-05-23 14:43:57 +02:00
|
|
|
Q_DISABLE_COPY(VPCommandLine)
|
|
|
|
static VPCommandLinePtr instance;
|
2020-04-03 22:05:03 +02:00
|
|
|
QCommandLineParser parser;
|
|
|
|
bool isGuiEnabled;
|
2020-05-23 14:10:05 +02:00
|
|
|
friend class VPApplication;
|
2020-04-03 22:05:03 +02:00
|
|
|
|
2020-04-13 11:47:19 +02:00
|
|
|
/** @brief add options to the QCommandLineParser that there are in the cmd can be */
|
2020-04-03 22:05:03 +02:00
|
|
|
void InitCommandLineOptions();
|
2020-04-06 23:57:01 +02:00
|
|
|
|
2020-04-03 22:05:03 +02:00
|
|
|
bool IsOptionSet(const QString &option)const;
|
|
|
|
QString OptionValue(const QString &option) const;
|
|
|
|
QStringList OptionValues(const QString &option) const;
|
|
|
|
};
|
|
|
|
|
2020-05-23 14:43:57 +02:00
|
|
|
#endif // VPCOMMANDLINE_H
|