vpuzzlecommandline header the plan
This commit is contained in:
parent
3ce9de7181
commit
186a855cbd
|
@ -4,14 +4,16 @@
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/main.cpp \
|
$$PWD/main.cpp \
|
||||||
$$PWD/puzzlemainwindow.cpp \
|
$$PWD/puzzlemainwindow.cpp \
|
||||||
$$PWD/puzzleapplication.cpp
|
$$PWD/puzzleapplication.cpp \
|
||||||
|
$$PWD/vpuzzlecommandline.cpp
|
||||||
|
|
||||||
*msvc*:SOURCES += $$PWD/stable.cpp
|
*msvc*:SOURCES += $$PWD/stable.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
$$PWD/puzzlemainwindow.h \
|
$$PWD/puzzlemainwindow.h \
|
||||||
$$PWD/stable.h \
|
$$PWD/stable.h \
|
||||||
$$PWD/puzzleapplication.h
|
$$PWD/puzzleapplication.h \
|
||||||
|
$$PWD/vpuzzlecommandline.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
$$PWD/puzzlemainwindow.ui
|
$$PWD/puzzlemainwindow.ui
|
||||||
|
|
13
src/app/puzzle/vpuzzlecommandline.cpp
Normal file
13
src/app/puzzle/vpuzzlecommandline.cpp
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#include "vpuzzlecommandline.h"
|
||||||
|
|
||||||
|
VPuzzleCommandLine::VPuzzleCommandLine():
|
||||||
|
parser(),
|
||||||
|
isGuiEnabled(false)
|
||||||
|
{
|
||||||
|
parser.setApplicationDescription(tr("Valentina's manual layout editor."));
|
||||||
|
parser.addHelpOption();
|
||||||
|
parser.addVersionOption();
|
||||||
|
parser.addPositionalArgument("filename", tr("The raw layout file."));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
57
src/app/puzzle/vpuzzlecommandline.h
Normal file
57
src/app/puzzle/vpuzzlecommandline.h
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
#ifndef VPUZZLECOMMANDLINE_H
|
||||||
|
#define VPUZZLECOMMANDLINE_H
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <vector>
|
||||||
|
#include <QTextStream>
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QCommandLineParser>
|
||||||
|
|
||||||
|
class VPuzzleCommandLine: public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
virtual ~VPuzzleCommandLine() = default;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief if user enabled export from cmd
|
||||||
|
*/
|
||||||
|
bool IsExportEnabled() const;
|
||||||
|
/**
|
||||||
|
* @brief the base name of layout file or empty string if not
|
||||||
|
*/
|
||||||
|
QString OptionBaseName() const;
|
||||||
|
/**
|
||||||
|
* @brief if user enabled test mode from cmd
|
||||||
|
*/
|
||||||
|
bool IsTestModeEnabled() const;
|
||||||
|
/**
|
||||||
|
* @brief if gui enabled or not
|
||||||
|
*/
|
||||||
|
bool IsGuiEnabled() const;
|
||||||
|
/**
|
||||||
|
* @brief the file name which should be loaded
|
||||||
|
*/
|
||||||
|
QString OptionFileName() const;
|
||||||
|
protected:
|
||||||
|
VPuzzleCommandLine();
|
||||||
|
/**
|
||||||
|
* @brief create the single instance of the class inside puzzleapplication
|
||||||
|
*/
|
||||||
|
static std::shared_ptr<VPuzzleCommandLine> Instance(const QCoreApplication &app);
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(VPuzzleCommandLine)
|
||||||
|
static std::shared_ptr<VPuzzleCommandLine> instance;
|
||||||
|
QCommandLineParser parser;
|
||||||
|
bool isGuiEnabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief add options to the QCommandLineParser that there are in the cmd can be
|
||||||
|
*/
|
||||||
|
void InitCommandLineOptions();
|
||||||
|
bool IsOptionSet(const QString &option)const;
|
||||||
|
QString OptionValue(const QString &option) const;
|
||||||
|
QStringList OptionValues(const QString &option) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // VPUZZLECOMMANDLINE_H
|
Loading…
Reference in New Issue
Block a user