2020-04-03 22:05:03 +02:00
|
|
|
#ifndef VPUZZLECOMMANDLINE_H
|
|
|
|
#define VPUZZLECOMMANDLINE_H
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <QCoreApplication>
|
|
|
|
#include <QCommandLineParser>
|
|
|
|
|
2020-04-13 11:43:25 +02:00
|
|
|
class VPuzzleCommandLine;
|
|
|
|
using VPuzzleCommandLinePtr = std::shared_ptr<VPuzzleCommandLine>;
|
|
|
|
|
2020-04-03 22:05:03 +02:00
|
|
|
class VPuzzleCommandLine: public QObject
|
|
|
|
{
|
2020-04-12 22:28:36 +02:00
|
|
|
friend class PuzzleApplication;
|
2020-04-03 22:05:03 +02:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
virtual ~VPuzzleCommandLine() = default;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief if user enabled export from cmd
|
|
|
|
*/
|
|
|
|
bool IsExportEnabled() const;
|
2020-04-12 22:28:36 +02:00
|
|
|
|
2020-04-03 22:05:03 +02:00
|
|
|
/**
|
|
|
|
* @brief the base name of layout file or empty string if not
|
|
|
|
*/
|
|
|
|
QString OptionBaseName() const;
|
2020-04-12 22:28:36 +02:00
|
|
|
|
2020-04-03 22:05:03 +02:00
|
|
|
/**
|
|
|
|
* @brief if user enabled test mode from cmd
|
|
|
|
*/
|
|
|
|
bool IsTestModeEnabled() const;
|
2020-04-12 22:28:36 +02:00
|
|
|
|
2020-04-03 22:05:03 +02:00
|
|
|
/**
|
|
|
|
* @brief if gui enabled or not
|
|
|
|
*/
|
|
|
|
bool IsGuiEnabled() const;
|
2020-04-12 22:28:36 +02:00
|
|
|
|
2020-04-03 22:05:03 +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
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief if high dpi scaling is enabled
|
|
|
|
*/
|
|
|
|
bool IsNoScalingEnabled() const;
|
2020-04-03 22:05:03 +02:00
|
|
|
protected:
|
|
|
|
VPuzzleCommandLine();
|
2020-04-12 22:28:36 +02:00
|
|
|
|
2020-04-13 11:43:25 +02:00
|
|
|
/** @brief create the single instance of the class inside puzzleapplication */
|
|
|
|
static VPuzzleCommandLinePtr Instance(const QCoreApplication &app);
|
2020-04-03 22:05:03 +02:00
|
|
|
private:
|
|
|
|
Q_DISABLE_COPY(VPuzzleCommandLine)
|
2020-04-13 11:43:25 +02:00
|
|
|
static VPuzzleCommandLinePtr instance;
|
2020-04-03 22:05:03 +02:00
|
|
|
QCommandLineParser parser;
|
|
|
|
bool isGuiEnabled;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief add options to the QCommandLineParser that there are in the cmd can be
|
|
|
|
*/
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VPUZZLECOMMANDLINE_H
|