From 186a855cbd308b2ec09499d02a15ed816015d81a Mon Sep 17 00:00:00 2001
From: vorzelmir <vorzelmir@gmail.com>
Date: Fri, 3 Apr 2020 23:05:03 +0300
Subject: [PATCH 1/7] vpuzzlecommandline header the plan

---
 src/app/puzzle/puzzle.pri             |  6 ++-
 src/app/puzzle/vpuzzlecommandline.cpp | 13 ++++++
 src/app/puzzle/vpuzzlecommandline.h   | 57 +++++++++++++++++++++++++++
 3 files changed, 74 insertions(+), 2 deletions(-)
 create mode 100644 src/app/puzzle/vpuzzlecommandline.cpp
 create mode 100644 src/app/puzzle/vpuzzlecommandline.h

diff --git a/src/app/puzzle/puzzle.pri b/src/app/puzzle/puzzle.pri
index 101fff4e3..c8db5a556 100644
--- a/src/app/puzzle/puzzle.pri
+++ b/src/app/puzzle/puzzle.pri
@@ -4,14 +4,16 @@
 SOURCES += \
         $$PWD/main.cpp \
         $$PWD/puzzlemainwindow.cpp \
-    $$PWD/puzzleapplication.cpp
+    $$PWD/puzzleapplication.cpp \
+    $$PWD/vpuzzlecommandline.cpp
 
 *msvc*:SOURCES += $$PWD/stable.cpp
 
 HEADERS += \
         $$PWD/puzzlemainwindow.h \
         $$PWD/stable.h \
-    $$PWD/puzzleapplication.h
+    $$PWD/puzzleapplication.h \
+    $$PWD/vpuzzlecommandline.h
 
 FORMS += \
         $$PWD/puzzlemainwindow.ui
diff --git a/src/app/puzzle/vpuzzlecommandline.cpp b/src/app/puzzle/vpuzzlecommandline.cpp
new file mode 100644
index 000000000..681d04f32
--- /dev/null
+++ b/src/app/puzzle/vpuzzlecommandline.cpp
@@ -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."));
+}
+
+
diff --git a/src/app/puzzle/vpuzzlecommandline.h b/src/app/puzzle/vpuzzlecommandline.h
new file mode 100644
index 000000000..a5148f666
--- /dev/null
+++ b/src/app/puzzle/vpuzzlecommandline.h
@@ -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

From b88e23697eb3e15137315b044cdd27be876a7064 Mon Sep 17 00:00:00 2001
From: vorzelmir <vorzelmir@gmail.com>
Date: Tue, 7 Apr 2020 00:57:01 +0300
Subject: [PATCH 2/7] puzzle command line initial options

---
 src/app/puzzle/puzzle.pro             |   2 +-
 src/app/puzzle/vpuzzlecommandline.cpp | 116 +++++++++++++++++++++++++-
 src/app/puzzle/vpuzzlecommandline.h   |   5 +-
 3 files changed, 117 insertions(+), 6 deletions(-)

diff --git a/src/app/puzzle/puzzle.pro b/src/app/puzzle/puzzle.pro
index 7463ba832..818e299dd 100644
--- a/src/app/puzzle/puzzle.pro
+++ b/src/app/puzzle/puzzle.pro
@@ -7,7 +7,7 @@
 # File with common stuff for whole project
 include(../../../common.pri)
 
-QT       += core gui widgets network xml xmlpatterns printsupport
+QT       += core gui widgets network xml xmlpatterns printsupport testlib
 
 # Name of binary file
 TARGET = puzzle
diff --git a/src/app/puzzle/vpuzzlecommandline.cpp b/src/app/puzzle/vpuzzlecommandline.cpp
index 681d04f32..1c826e341 100644
--- a/src/app/puzzle/vpuzzlecommandline.cpp
+++ b/src/app/puzzle/vpuzzlecommandline.cpp
@@ -1,13 +1,125 @@
 #include "vpuzzlecommandline.h"
+#include "../vmisc/commandoptions.h"
+#include "../vmisc/vsysexits.h"
+#include <QDebug>
+#include <QTest>
 
+std::shared_ptr<VPuzzleCommandLine> VPuzzleCommandLine::instance = nullptr;
+
+#define translate(context, source) QCoreApplication::translate((context), source)
+
+//------------------------------------------------------------------------------------------------
+bool VPuzzleCommandLine::IsExportEnabled() const
+{
+    const bool result = IsOptionSet(QStringLiteral("destination"));
+    int argSize = parser.positionalArguments().size();
+    if (result && argSize != 1)
+    {
+        qCritical() << translate("Puzzle", "Export options can be used with single input file only.") << "/n";
+        const_cast<VPuzzleCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
+    }
+    return result;
+}
+
+//----------------------------------------------------------------------------------------------
+QString VPuzzleCommandLine::OptionBaseName() const
+{
+    QString path;
+    if (IsExportEnabled())
+    {
+        path = OptionValue(QStringLiteral("destination"));
+    }
+
+    return path;
+}
+
+//--------------------------------------------------------------------------------------------
+bool VPuzzleCommandLine::IsTestModeEnabled() const
+{
+    const bool r = IsOptionSet(QStringLiteral("test"));
+    if (r && parser.positionalArguments().size() != 1)
+    {
+        qCritical() << translate("VCommandLine", "Test option can be used with single input file only.") << "/n";
+        const_cast<VPuzzleCommandLine*>(this)->parser.showHelp(V_EX_USAGE);
+    }
+    return r;
+}
+
+//--------------------------------------------------------------------------------------------
+bool VPuzzleCommandLine::IsGuiEnabled() const
+{
+    return isGuiEnabled;
+}
+
+//--------------------------------------------------------------------------------------------
+QStringList VPuzzleCommandLine::OptionFileNames() const
+{
+    return parser.positionalArguments();
+}
+
+//----------------------------------------------------------------------------------------------
 VPuzzleCommandLine::VPuzzleCommandLine():
     parser(),
     isGuiEnabled(false)
 {
-    parser.setApplicationDescription(tr("Valentina's manual layout editor."));
+    parser.setApplicationDescription(translate("Puzzle", "Valentina's manual layout editor."));
     parser.addHelpOption();
     parser.addVersionOption();
-    parser.addPositionalArgument("filename", tr("The raw layout file."));
+
+    InitCommandLineOptions();
+}
+
+//-------------------------------------------------------------------------------------------
+std::shared_ptr<VPuzzleCommandLine> VPuzzleCommandLine::Instance(const QCoreApplication &app)
+{
+    if (instance == nullptr)
+    {
+        instance.reset(new VPuzzleCommandLine);
+    }
+    instance->parser.process(app);
+
+    instance->isGuiEnabled = not (instance->IsGuiEnabled() || instance->IsExportEnabled());
+    return instance;
+}
+
+//-------------------------------------------------------------------------------------------
+void VPuzzleCommandLine::InitCommandLineOptions()
+{
+    if (IsExportEnabled())
+    {
+        QStringList args = parser.positionalArguments();
+        parser.setSingleDashWordOptionMode(
+                    QCommandLineParser::SingleDashWordOptionMode(args.takeFirst().toInt()));
+        QString source = args.isEmpty() ? QString() : args.at(0);
+        QString destination = args.isEmpty() ? QString() : args.at(1);
+        parser.clearPositionalArguments();
+        parser.addPositionalArgument(source,
+                                     translate("Puzzle", "The raw layout input file."));
+        parser.addPositionalArgument(destination,
+                                     translate("Puzzle", "The destination folder"));
+    }
+
+    QCommandLineOption forceOption(QStringList() << "f" << "force",
+                translate("Puzzle", "Overwrite existing files."));
+        parser.addOption(forceOption);
+}
+
+//--------------------------------------------------------------------------------------------
+bool VPuzzleCommandLine::IsOptionSet(const QString &option) const
+{
+    return parser.isSet(option);
+}
+
+//-------------------------------------------------------------------------------------------
+QString VPuzzleCommandLine::OptionValue(const QString &option) const
+{
+    return parser.value(option);
+}
+
+//--------------------------------------------------------------------------------------------
+QStringList VPuzzleCommandLine::OptionValues(const QString &option) const
+{
+    return parser.values(option);
 }
 
 
diff --git a/src/app/puzzle/vpuzzlecommandline.h b/src/app/puzzle/vpuzzlecommandline.h
index a5148f666..2735e6487 100644
--- a/src/app/puzzle/vpuzzlecommandline.h
+++ b/src/app/puzzle/vpuzzlecommandline.h
@@ -2,8 +2,6 @@
 #define VPUZZLECOMMANDLINE_H
 
 #include <memory>
-#include <vector>
-#include <QTextStream>
 #include <QCoreApplication>
 #include <QCommandLineParser>
 
@@ -32,7 +30,7 @@ public:
     /**
      * @brief the file name which should be loaded
      */
-    QString OptionFileName() const;
+    QStringList OptionFileNames() const;
 protected:
     VPuzzleCommandLine();
     /**
@@ -49,6 +47,7 @@ private:
      * @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;

From e1c945d02c8b24bf30f080e7829ad0480adea7d5 Mon Sep 17 00:00:00 2001
From: vorzelmir <vorzelmir@gmail.com>
Date: Sun, 12 Apr 2020 23:28:36 +0300
Subject: [PATCH 3/7] add VPuzzleCommandLine to Puzzleapplication

---
 src/app/puzzle/puzzle.pro             |  2 +-
 src/app/puzzle/puzzleapplication.cpp  | 51 ++++++++++++++++-----------
 src/app/puzzle/puzzleapplication.h    |  5 ++-
 src/app/puzzle/vpuzzlecommandline.cpp | 43 ++++++++++++++--------
 src/app/puzzle/vpuzzlecommandline.h   | 11 ++++++
 5 files changed, 75 insertions(+), 37 deletions(-)

diff --git a/src/app/puzzle/puzzle.pro b/src/app/puzzle/puzzle.pro
index 818e299dd..7463ba832 100644
--- a/src/app/puzzle/puzzle.pro
+++ b/src/app/puzzle/puzzle.pro
@@ -7,7 +7,7 @@
 # File with common stuff for whole project
 include(../../../common.pri)
 
-QT       += core gui widgets network xml xmlpatterns printsupport testlib
+QT       += core gui widgets network xml xmlpatterns printsupport
 
 # Name of binary file
 TARGET = puzzle
diff --git a/src/app/puzzle/puzzleapplication.cpp b/src/app/puzzle/puzzleapplication.cpp
index 9cb624b52..4c41359df 100644
--- a/src/app/puzzle/puzzleapplication.cpp
+++ b/src/app/puzzle/puzzleapplication.cpp
@@ -387,6 +387,8 @@ void PuzzleApplication::InitOptions()
 
     LoadTranslation(QLocale().name());// By default the console version uses system locale
 
+    VPuzzleCommandLine::Instance(*this);
+
     static const char * GENERIC_ICON_TO_CHECK = "document-open";
     if (QIcon::hasThemeIcon(GENERIC_ICON_TO_CHECK) == false)
     {
@@ -442,24 +444,26 @@ void PuzzleApplication::ActivateDarkMode()
 //---------------------------------------------------------------------------------------------------------------------
 void PuzzleApplication::ParseCommandLine(const SocketConnection &connection, const QStringList &arguments)
 {
-    QCommandLineParser parser;
-    parser.setApplicationDescription(tr("Valentina's manual layout editor."));
-    parser.addHelpOption();
-    parser.addVersionOption();
-    parser.addPositionalArgument("filename", tr("The raw layout file."));
-    //-----
-    QCommandLineOption testOption(QStringList() << "test",
-            tr("Use for unit testing. Run the program and open a file without showing the main window."));
-    parser.addOption(testOption);
-    //-----
-    QCommandLineOption scalingOption(QStringList() << LONG_OPTION_NO_HDPI_SCALING,
-            tr("Disable high dpi scaling. Call this option if has problem with scaling (by default scaling enabled). "
-               "Alternatively you can use the %1 environment variable.").arg("QT_AUTO_SCREEN_SCALE_FACTOR=0"));
-    parser.addOption(scalingOption);
-    //-----
-    parser.process(arguments);
+    std::shared_ptr<VPuzzleCommandLine>cmd = CommandLine();
+//    QCommandLineParser parser;
+//    parser.setApplicationDescription(tr("Valentina's manual layout editor."));
+//    parser.addHelpOption();
+//    parser.addVersionOption();
+//    parser.addPositionalArgument("filename", tr("The raw layout file."));
+//    //-----
+//    QCommandLineOption testOption(QStringList() << "test",
+//            tr("Use for unit testing. Run the program and open a file without showing the main window."));
+//    parser.addOption(testOption);
+//    //-----
+//    QCommandLineOption scalingOption(QStringList() << LONG_OPTION_NO_HDPI_SCALING,
+//            tr("Disable high dpi scaling. Call this option if has problem with scaling (by default scaling enabled). "
+//               "Alternatively you can use the %1 environment variable.").arg("QT_AUTO_SCREEN_SCALE_FACTOR=0"));
+//    parser.addOption(scalingOption);
+//    //-----
+//    parser.process(arguments);
 
-    testMode = parser.isSet(testOption);
+//    testMode = parser.isSet(testOption);
+    testMode = cmd->IsTestModeEnabled();
 
     if (not testMode && connection == SocketConnection::Client)
     {
@@ -499,13 +503,14 @@ void PuzzleApplication::ParseCommandLine(const SocketConnection &connection, con
         LoadTranslation(PuzzleSettings()->GetLocale());
     }
 
-    const QStringList args = parser.positionalArguments();
+//    const QStringList args = parser.positionalArguments();
+    const QStringList args = cmd->OptionFileNames();
     if (args.count() > 0)
     {
         if (testMode && args.count() > 1)
         {
             qCCritical(mApp, "%s\n", qPrintable(tr("Test mode doesn't support openning several files.")));
-            parser.showHelp(V_EX_USAGE);
+            cmd.get()->parser.showHelp(V_EX_USAGE);
         }
 
         for (auto &arg : args)
@@ -531,7 +536,7 @@ void PuzzleApplication::ParseCommandLine(const SocketConnection &connection, con
         else
         {
             qCCritical(mApp, "%s\n", qPrintable(tr("Please, provide one input file.")));
-            parser.showHelp(V_EX_USAGE);
+            cmd.get()->parser.showHelp(V_EX_USAGE);
         }
     }
 
@@ -634,3 +639,9 @@ void PuzzleApplication::Clean()
         }
     }
 }
+
+//--------------------------------------------------------------------------------------------
+const std::shared_ptr<VPuzzleCommandLine> PuzzleApplication::CommandLine()
+{
+    return VPuzzleCommandLine::instance;
+}
diff --git a/src/app/puzzle/puzzleapplication.h b/src/app/puzzle/puzzleapplication.h
index 9f2b15760..780ea0617 100644
--- a/src/app/puzzle/puzzleapplication.h
+++ b/src/app/puzzle/puzzleapplication.h
@@ -31,6 +31,9 @@
 #include "../vmisc/def.h"
 #include "../vmisc/vpuzzlesettings.h"
 #include "../vmisc/vabstractapplication.h"
+#include "vpuzzlecommandline.h"
+
+#include <memory>
 
 class PuzzleApplication;// use in define
 class PuzzleMainWindow;
@@ -68,7 +71,7 @@ public:
     void ActivateDarkMode();
 
     void ParseCommandLine(const SocketConnection &connection, const QStringList &arguments);
-
+    const std::shared_ptr<VPuzzleCommandLine> CommandLine();
 public slots:
     void ProcessCMD();
 
diff --git a/src/app/puzzle/vpuzzlecommandline.cpp b/src/app/puzzle/vpuzzlecommandline.cpp
index 1c826e341..4b54e9ad9 100644
--- a/src/app/puzzle/vpuzzlecommandline.cpp
+++ b/src/app/puzzle/vpuzzlecommandline.cpp
@@ -1,8 +1,8 @@
 #include "vpuzzlecommandline.h"
 #include "../vmisc/commandoptions.h"
 #include "../vmisc/vsysexits.h"
+#include "../vmisc/literals.h"
 #include <QDebug>
-#include <QTest>
 
 std::shared_ptr<VPuzzleCommandLine> VPuzzleCommandLine::instance = nullptr;
 
@@ -57,6 +57,12 @@ QStringList VPuzzleCommandLine::OptionFileNames() const
     return parser.positionalArguments();
 }
 
+//-------------------------------------------------------------------------------------------
+bool VPuzzleCommandLine::IsNoScalingEnabled() const
+{
+    return IsOptionSet(LONG_OPTION_NO_HDPI_SCALING);
+}
+
 //----------------------------------------------------------------------------------------------
 VPuzzleCommandLine::VPuzzleCommandLine():
     parser(),
@@ -85,23 +91,30 @@ std::shared_ptr<VPuzzleCommandLine> VPuzzleCommandLine::Instance(const QCoreAppl
 //-------------------------------------------------------------------------------------------
 void VPuzzleCommandLine::InitCommandLineOptions()
 {
-    if (IsExportEnabled())
-    {
-        QStringList args = parser.positionalArguments();
-        parser.setSingleDashWordOptionMode(
-                    QCommandLineParser::SingleDashWordOptionMode(args.takeFirst().toInt()));
-        QString source = args.isEmpty() ? QString() : args.at(0);
-        QString destination = args.isEmpty() ? QString() : args.at(1);
-        parser.clearPositionalArguments();
-        parser.addPositionalArgument(source,
-                                     translate("Puzzle", "The raw layout input file."));
-        parser.addPositionalArgument(destination,
-                                     translate("Puzzle", "The destination folder"));
-    }
+    QStringList args = parser.positionalArguments();
+    parser.setSingleDashWordOptionMode(
+                QCommandLineParser::SingleDashWordOptionMode(args.takeFirst().toInt()));
+    QString source = args.isEmpty() ? QString() : args.at(0);
+    QString destination = args.isEmpty() ? QString() : args.at(1);
+    parser.clearPositionalArguments();
+    parser.addPositionalArgument(source,
+                                 translate("Puzzle", "The raw layout input file."));
+    parser.addPositionalArgument(destination,
+                                 translate("Puzzle", "The destination folder"));
 
     QCommandLineOption forceOption(QStringList() << "f" << "force",
                 translate("Puzzle", "Overwrite existing files."));
-        parser.addOption(forceOption);
+    parser.addOption(forceOption);
+
+    QCommandLineOption testOption(QStringList() << "test",
+            tr("Use for unit testing. Run the program and open a file without showing the main window."));
+    parser.addOption(testOption);
+
+    QCommandLineOption scalingOption(QStringList() << LONG_OPTION_NO_HDPI_SCALING,
+            tr("Disable high dpi scaling. Call this option if has problem with scaling (by default scaling enabled). "
+               "Alternatively you can use the %1 environment variable.").arg("QT_AUTO_SCREEN_SCALE_FACTOR=0"));
+    parser.addOption(scalingOption);
+
 }
 
 //--------------------------------------------------------------------------------------------
diff --git a/src/app/puzzle/vpuzzlecommandline.h b/src/app/puzzle/vpuzzlecommandline.h
index 2735e6487..d802e3c73 100644
--- a/src/app/puzzle/vpuzzlecommandline.h
+++ b/src/app/puzzle/vpuzzlecommandline.h
@@ -7,6 +7,7 @@
 
 class VPuzzleCommandLine: public QObject
 {
+    friend class PuzzleApplication;
     Q_OBJECT
 public:   
     virtual ~VPuzzleCommandLine() = default;
@@ -15,24 +16,34 @@ public:
      * @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
      */
     QStringList OptionFileNames() const;
+
+    /**
+     * @brief if high dpi scaling is enabled
+     */
+    bool IsNoScalingEnabled() const;
 protected:
     VPuzzleCommandLine();
+
     /**
      * @brief create the single instance of the class inside puzzleapplication
      */

From aa81fa5ecfb0f5f0dfabc41c5f27959207359218 Mon Sep 17 00:00:00 2001
From: Roman Telezhynskyi <dismine@gmail.com>
Date: Mon, 13 Apr 2020 12:43:25 +0300
Subject: [PATCH 4/7] Improve code style. Use typedef.

---
 src/app/puzzle/puzzleapplication.cpp  |  4 ++--
 src/app/puzzle/puzzleapplication.h    |  2 +-
 src/app/puzzle/vpuzzlecommandline.cpp |  2 +-
 src/app/puzzle/vpuzzlecommandline.h   | 11 ++++++-----
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/app/puzzle/puzzleapplication.cpp b/src/app/puzzle/puzzleapplication.cpp
index 4c41359df..abcbc4f08 100644
--- a/src/app/puzzle/puzzleapplication.cpp
+++ b/src/app/puzzle/puzzleapplication.cpp
@@ -444,7 +444,7 @@ void PuzzleApplication::ActivateDarkMode()
 //---------------------------------------------------------------------------------------------------------------------
 void PuzzleApplication::ParseCommandLine(const SocketConnection &connection, const QStringList &arguments)
 {
-    std::shared_ptr<VPuzzleCommandLine>cmd = CommandLine();
+    VPuzzleCommandLinePtr cmd = CommandLine();
 //    QCommandLineParser parser;
 //    parser.setApplicationDescription(tr("Valentina's manual layout editor."));
 //    parser.addHelpOption();
@@ -641,7 +641,7 @@ void PuzzleApplication::Clean()
 }
 
 //--------------------------------------------------------------------------------------------
-const std::shared_ptr<VPuzzleCommandLine> PuzzleApplication::CommandLine()
+const VPuzzleCommandLinePtr PuzzleApplication::CommandLine()
 {
     return VPuzzleCommandLine::instance;
 }
diff --git a/src/app/puzzle/puzzleapplication.h b/src/app/puzzle/puzzleapplication.h
index 780ea0617..73d22c03b 100644
--- a/src/app/puzzle/puzzleapplication.h
+++ b/src/app/puzzle/puzzleapplication.h
@@ -71,7 +71,7 @@ public:
     void ActivateDarkMode();
 
     void ParseCommandLine(const SocketConnection &connection, const QStringList &arguments);
-    const std::shared_ptr<VPuzzleCommandLine> CommandLine();
+    const VPuzzleCommandLinePtr CommandLine();
 public slots:
     void ProcessCMD();
 
diff --git a/src/app/puzzle/vpuzzlecommandline.cpp b/src/app/puzzle/vpuzzlecommandline.cpp
index 4b54e9ad9..bd34962d6 100644
--- a/src/app/puzzle/vpuzzlecommandline.cpp
+++ b/src/app/puzzle/vpuzzlecommandline.cpp
@@ -76,7 +76,7 @@ VPuzzleCommandLine::VPuzzleCommandLine():
 }
 
 //-------------------------------------------------------------------------------------------
-std::shared_ptr<VPuzzleCommandLine> VPuzzleCommandLine::Instance(const QCoreApplication &app)
+VPuzzleCommandLinePtr VPuzzleCommandLine::Instance(const QCoreApplication &app)
 {
     if (instance == nullptr)
     {
diff --git a/src/app/puzzle/vpuzzlecommandline.h b/src/app/puzzle/vpuzzlecommandline.h
index d802e3c73..737592e89 100644
--- a/src/app/puzzle/vpuzzlecommandline.h
+++ b/src/app/puzzle/vpuzzlecommandline.h
@@ -5,6 +5,9 @@
 #include <QCoreApplication>
 #include <QCommandLineParser>
 
+class VPuzzleCommandLine;
+using VPuzzleCommandLinePtr = std::shared_ptr<VPuzzleCommandLine>;
+
 class VPuzzleCommandLine: public QObject
 {
     friend class PuzzleApplication;
@@ -44,13 +47,11 @@ public:
 protected:
     VPuzzleCommandLine();
 
-    /**
-     * @brief create the single instance of the class inside puzzleapplication
-     */
-    static std::shared_ptr<VPuzzleCommandLine> Instance(const QCoreApplication &app);
+    /** @brief create the single instance of the class inside puzzleapplication */
+    static VPuzzleCommandLinePtr Instance(const QCoreApplication &app);
 private:
     Q_DISABLE_COPY(VPuzzleCommandLine)
-    static std::shared_ptr<VPuzzleCommandLine> instance;
+    static VPuzzleCommandLinePtr instance;
     QCommandLineParser parser;
     bool isGuiEnabled;
 

From eba2ed695c7b0078d706880694def2573cb09d06 Mon Sep 17 00:00:00 2001
From: Roman Telezhynskyi <dismine@gmail.com>
Date: Mon, 13 Apr 2020 12:47:19 +0300
Subject: [PATCH 5/7] Better looking comments.

---
 src/app/puzzle/vpuzzlecommandline.h | 28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)

diff --git a/src/app/puzzle/vpuzzlecommandline.h b/src/app/puzzle/vpuzzlecommandline.h
index 737592e89..a7f403e80 100644
--- a/src/app/puzzle/vpuzzlecommandline.h
+++ b/src/app/puzzle/vpuzzlecommandline.h
@@ -15,34 +15,22 @@ class VPuzzleCommandLine: public QObject
 public:   
     virtual ~VPuzzleCommandLine() = default;
 
-    /**
-     * @brief if user enabled export from cmd
-     */
+    /** @brief if user enabled export from cmd */
     bool IsExportEnabled() const;
 
-    /**
-     * @brief the base name of layout file or empty string if not
-     */
+    /** @brief the base name of layout file or empty string if not */
     QString OptionBaseName() const;
 
-    /**
-     * @brief if user enabled test mode from cmd
-     */
+    /** @brief if user enabled test mode from cmd */
     bool IsTestModeEnabled() const;
 
-    /**
-     * @brief if gui enabled or not
-     */
+    /** @brief if gui enabled or not */
     bool IsGuiEnabled() const;
 
-    /**
-     * @brief the file name which should be loaded
-     */
+    /** @brief the file name which should be loaded */
     QStringList OptionFileNames() const;
 
-    /**
-     * @brief if high dpi scaling is enabled
-     */
+    /** @brief if high dpi scaling is enabled */
     bool IsNoScalingEnabled() const;
 protected:
     VPuzzleCommandLine();
@@ -55,9 +43,7 @@ private:
     QCommandLineParser parser;
     bool isGuiEnabled;
 
-    /**
-     * @brief add options to the QCommandLineParser that there are in the cmd can be
-     */
+    /** @brief add options to the QCommandLineParser that there are in the cmd can be */
     void InitCommandLineOptions();
 
     bool IsOptionSet(const QString &option)const;

From 5e5199f9f6a92f5bc81c64ccac973e0bf30de58b Mon Sep 17 00:00:00 2001
From: Roman Telezhynskyi <dismine@gmail.com>
Date: Mon, 13 Apr 2020 12:48:09 +0300
Subject: [PATCH 6/7] Fix crash. Added more keys we will need in future.

---
 src/app/puzzle/puzzle.pri             |  2 +
 src/app/puzzle/puzzlecommands.cpp     | 88 +++++++++++++++++++++++++
 src/app/puzzle/puzzlecommands.h       | 63 ++++++++++++++++++
 src/app/puzzle/vpuzzlecommandline.cpp | 94 ++++++++++++++++++---------
 src/app/puzzle/vpuzzlecommandline.h   |  9 ++-
 5 files changed, 224 insertions(+), 32 deletions(-)
 create mode 100644 src/app/puzzle/puzzlecommands.cpp
 create mode 100644 src/app/puzzle/puzzlecommands.h

diff --git a/src/app/puzzle/puzzle.pri b/src/app/puzzle/puzzle.pri
index c8db5a556..7cb2cf959 100644
--- a/src/app/puzzle/puzzle.pri
+++ b/src/app/puzzle/puzzle.pri
@@ -3,6 +3,7 @@
 
 SOURCES += \
         $$PWD/main.cpp \
+    $$PWD/puzzlecommands.cpp \
         $$PWD/puzzlemainwindow.cpp \
     $$PWD/puzzleapplication.cpp \
     $$PWD/vpuzzlecommandline.cpp
@@ -10,6 +11,7 @@ SOURCES += \
 *msvc*:SOURCES += $$PWD/stable.cpp
 
 HEADERS += \
+    $$PWD/puzzlecommands.h \
         $$PWD/puzzlemainwindow.h \
         $$PWD/stable.h \
     $$PWD/puzzleapplication.h \
diff --git a/src/app/puzzle/puzzlecommands.cpp b/src/app/puzzle/puzzlecommands.cpp
new file mode 100644
index 000000000..57134ad2d
--- /dev/null
+++ b/src/app/puzzle/puzzlecommands.cpp
@@ -0,0 +1,88 @@
+/************************************************************************
+ **
+ **  @file   commands.cpp
+ **  @author Roman Telezhynskyi <dismine(at)gmail.com>
+ **  @date   13 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/>.
+ **
+ *************************************************************************/
+#include "puzzlecommands.h"
+
+#include <QStringList>
+
+const QString LONG_OPTION_EXPORT_FILE   = QStringLiteral("exportFile");
+const QString SINGLE_OPTION_EXPORT_FILE = QStringLiteral("e");
+
+const QString LONG_OPTION_TEST          = QStringLiteral("test");
+const QString SINGLE_OPTION_TEST        = QStringLiteral("t");
+
+const QString LONG_OPTION_RAW_LAYOUT    = QStringLiteral("rawLayout");
+const QString SINGLE_OPTION_RAW_LAYOUT  = QStringLiteral("r");
+
+const QString LONG_OPTION_EXP2FORMAT    = QStringLiteral("format");
+const QString SINGLE_OPTION_EXP2FORMAT  = QStringLiteral("f");
+
+const QString LONG_OPTION_BINARYDXF     = QStringLiteral("bdxf");
+const QString LONG_OPTION_TEXT2PATHS    = QStringLiteral("text2paths");
+
+const QString LONG_OPTION_CROP_LENGTH   = QStringLiteral("crop");
+const QString SINGLE_OPTION_CROP_LENGTH = QStringLiteral("c");
+
+const QString LONG_OPTION_CROP_WIDTH    = QStringLiteral("cropWidth");
+
+const QString LONG_OPTION_TILED_PDF_PAGE_TEMPLATE = QStringLiteral("tiledPageformat");
+const QString LONG_OPTION_TILED_PDF_LEFT_MARGIN   = QStringLiteral("tiledlmargin");
+const QString LONG_OPTION_TILED_PDF_RIGHT_MARGIN  = QStringLiteral("tiledrmargin");
+const QString LONG_OPTION_TILED_PDF_TOP_MARGIN    = QStringLiteral("tiledtmargin");
+const QString LONG_OPTION_TILED_PDF_BOTTOM_MARGIN = QStringLiteral("tiledbmargin");
+const QString LONG_OPTION_TILED_PDF_LANDSCAPE     = QStringLiteral("tiledLandscape");
+
+//---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief AllKeys return list with all command line keys (short and long forms). Used for testing on conflicts.
+ * @return list with all command line keys
+ */
+QStringList AllKeys()
+{
+    return QStringList
+    {
+        LONG_OPTION_EXPORT_FILE,
+        SINGLE_OPTION_EXPORT_FILE,
+        LONG_OPTION_TEST,
+        SINGLE_OPTION_TEST,
+        LONG_OPTION_RAW_LAYOUT,
+        SINGLE_OPTION_RAW_LAYOUT,
+        LONG_OPTION_EXP2FORMAT,
+        SINGLE_OPTION_EXP2FORMAT,
+        LONG_OPTION_BINARYDXF,
+        LONG_OPTION_TEXT2PATHS,
+        LONG_OPTION_CROP_LENGTH,
+        SINGLE_OPTION_CROP_LENGTH,
+        LONG_OPTION_CROP_WIDTH,
+        LONG_OPTION_TILED_PDF_PAGE_TEMPLATE,
+        LONG_OPTION_TILED_PDF_LEFT_MARGIN,
+        LONG_OPTION_TILED_PDF_RIGHT_MARGIN,
+        LONG_OPTION_TILED_PDF_TOP_MARGIN,
+        LONG_OPTION_TILED_PDF_BOTTOM_MARGIN,
+        LONG_OPTION_TILED_PDF_LANDSCAPE
+    };
+}
diff --git a/src/app/puzzle/puzzlecommands.h b/src/app/puzzle/puzzlecommands.h
new file mode 100644
index 000000000..ae362b032
--- /dev/null
+++ b/src/app/puzzle/puzzlecommands.h
@@ -0,0 +1,63 @@
+/************************************************************************
+ **
+ **  @file   commands.h
+ **  @author Roman Telezhynskyi <dismine(at)gmail.com>
+ **  @date   13 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/>.
+ **
+ *************************************************************************/
+#ifndef COMMANDS_H
+#define COMMANDS_H
+
+
+#include <QString>
+
+extern const QString LONG_OPTION_EXPORT_FILE;
+extern const QString SINGLE_OPTION_EXPORT_FILE;
+
+extern const QString LONG_OPTION_TEST;
+extern const QString SINGLE_OPTION_TEST;
+
+extern const QString LONG_OPTION_RAW_LAYOUT;
+extern const QString SINGLE_OPTION_RAW_LAYOUT;
+
+extern const QString LONG_OPTION_EXP2FORMAT;
+extern const QString SINGLE_OPTION_EXP2FORMAT;
+
+extern const QString LONG_OPTION_BINARYDXF;
+extern const QString LONG_OPTION_TEXT2PATHS;
+
+extern const QString LONG_OPTION_CROP_LENGTH;
+extern const QString SINGLE_OPTION_CROP_LENGTH;
+
+extern const QString LONG_OPTION_CROP_WIDTH;
+
+extern const QString LONG_OPTION_TILED_PDF_PAGE_TEMPLATE;
+extern const QString LONG_OPTION_TILED_PDF_LEFT_MARGIN;
+extern const QString LONG_OPTION_TILED_PDF_RIGHT_MARGIN;
+extern const QString LONG_OPTION_TILED_PDF_TOP_MARGIN;
+extern const QString LONG_OPTION_TILED_PDF_BOTTOM_MARGIN;
+extern const QString LONG_OPTION_TILED_PDF_LANDSCAPE;
+
+QStringList AllKeys();
+
+#endif // COMMANDS_H
diff --git a/src/app/puzzle/vpuzzlecommandline.cpp b/src/app/puzzle/vpuzzlecommandline.cpp
index bd34962d6..0242e1356 100644
--- a/src/app/puzzle/vpuzzlecommandline.cpp
+++ b/src/app/puzzle/vpuzzlecommandline.cpp
@@ -1,5 +1,5 @@
 #include "vpuzzlecommandline.h"
-#include "../vmisc/commandoptions.h"
+#include "puzzlecommands.h"
 #include "../vmisc/vsysexits.h"
 #include "../vmisc/literals.h"
 #include <QDebug>
@@ -11,7 +11,7 @@ std::shared_ptr<VPuzzleCommandLine> VPuzzleCommandLine::instance = nullptr;
 //------------------------------------------------------------------------------------------------
 bool VPuzzleCommandLine::IsExportEnabled() const
 {
-    const bool result = IsOptionSet(QStringLiteral("destination"));
+    const bool result = IsOptionSet(LONG_OPTION_EXPORT_FILE);
     int argSize = parser.positionalArguments().size();
     if (result && argSize != 1)
     {
@@ -22,21 +22,27 @@ bool VPuzzleCommandLine::IsExportEnabled() const
 }
 
 //----------------------------------------------------------------------------------------------
-QString VPuzzleCommandLine::OptionBaseName() const
+QString VPuzzleCommandLine::OptionExportFile() const
 {
     QString path;
     if (IsExportEnabled())
     {
-        path = OptionValue(QStringLiteral("destination"));
+        path = OptionValue(LONG_OPTION_EXPORT_FILE);
     }
 
     return path;
 }
 
+//---------------------------------------------------------------------------------------------------------------------
+QStringList VPuzzleCommandLine::OptionRawLayouts() const
+{
+    return OptionValues(LONG_OPTION_RAW_LAYOUT);
+}
+
 //--------------------------------------------------------------------------------------------
 bool VPuzzleCommandLine::IsTestModeEnabled() const
 {
-    const bool r = IsOptionSet(QStringLiteral("test"));
+    const bool r = IsOptionSet(LONG_OPTION_TEST);
     if (r && parser.positionalArguments().size() != 1)
     {
         qCritical() << translate("VCommandLine", "Test option can be used with single input file only.") << "/n";
@@ -71,6 +77,7 @@ VPuzzleCommandLine::VPuzzleCommandLine():
     parser.setApplicationDescription(translate("Puzzle", "Valentina's manual layout editor."));
     parser.addHelpOption();
     parser.addVersionOption();
+    parser.addPositionalArgument(QStringLiteral("filename"), translate("Puzzle", "The manual layout file."));
 
     InitCommandLineOptions();
 }
@@ -91,30 +98,59 @@ VPuzzleCommandLinePtr VPuzzleCommandLine::Instance(const QCoreApplication &app)
 //-------------------------------------------------------------------------------------------
 void VPuzzleCommandLine::InitCommandLineOptions()
 {
-    QStringList args = parser.positionalArguments();
-    parser.setSingleDashWordOptionMode(
-                QCommandLineParser::SingleDashWordOptionMode(args.takeFirst().toInt()));
-    QString source = args.isEmpty() ? QString() : args.at(0);
-    QString destination = args.isEmpty() ? QString() : args.at(1);
-    parser.clearPositionalArguments();
-    parser.addPositionalArgument(source,
-                                 translate("Puzzle", "The raw layout input file."));
-    parser.addPositionalArgument(destination,
-                                 translate("Puzzle", "The destination folder"));
-
-    QCommandLineOption forceOption(QStringList() << "f" << "force",
-                translate("Puzzle", "Overwrite existing files."));
-    parser.addOption(forceOption);
-
-    QCommandLineOption testOption(QStringList() << "test",
-            tr("Use for unit testing. Run the program and open a file without showing the main window."));
-    parser.addOption(testOption);
-
-    QCommandLineOption scalingOption(QStringList() << LONG_OPTION_NO_HDPI_SCALING,
-            tr("Disable high dpi scaling. Call this option if has problem with scaling (by default scaling enabled). "
-               "Alternatively you can use the %1 environment variable.").arg("QT_AUTO_SCREEN_SCALE_FACTOR=0"));
-    parser.addOption(scalingOption);
-
+    //keep in mind order here - that is how user will see it, so group-up for usability
+    //=================================================================================================================
+    parser.addOptions({
+        {{SINGLE_OPTION_EXPORT_FILE, LONG_OPTION_EXPORT_FILE},
+         translate("VCommandLine", "The filename of exported layout file. Use it to enable console export mode."),
+         translate("VCommandLine", "The filename of layout file")},
+        {{SINGLE_OPTION_RAW_LAYOUT, LONG_OPTION_RAW_LAYOUT},
+         translate("VCommandLine", "Load pattern pieces form the raw layout data file."),
+         translate("VCommandLine", "The raw layout data file")},
+        {{SINGLE_OPTION_EXP2FORMAT, LONG_OPTION_EXP2FORMAT},
+         translate("VCommandLine", "Number corresponding to output format (default = 0, export mode): <not defined>"),
+         translate("VCommandLine", "Format number"), QChar('0')},
+        {LONG_OPTION_BINARYDXF, translate("VCommandLine", "Export dxf in binary form.")},
+        {LONG_OPTION_TEXT2PATHS, translate("VCommandLine", "Export text as paths.")},
+    //=================================================================================================================
+        {{SINGLE_OPTION_CROP_LENGTH, LONG_OPTION_CROP_LENGTH},
+         translate("VCommandLine", "Auto crop unused length (export mode).")},
+        {{LONG_OPTION_CROP_WIDTH},
+         translate("VCommandLine", "Auto crop unused width (export mode).")},
+    //=================================================================================================================
+        {LONG_OPTION_TILED_PDF_PAGE_TEMPLATE,
+         translate("VCommandLine", "Number corresponding to tiled pdf page template (default = 0, export mode with "
+                                   "tiled pdf format): <not defined>"),
+         translate("VCommandLine", "Template number"), QChar('0')},
+        {LONG_OPTION_TILED_PDF_LEFT_MARGIN,
+         translate("VCommandLine","Tiled page left margin in current units like 3.0 (export mode). If not set will be "
+                                   "used default value 1 cm."),
+         translate("VCommandLine", "The left margin")},
+        {LONG_OPTION_TILED_PDF_RIGHT_MARGIN,
+         translate("VCommandLine", "Tiled page right margin in current units like 3.0 (export mode). If not set will "
+                                   "be used default value 1 cm."),
+         translate("VCommandLine", "The right margin")},
+        {LONG_OPTION_TILED_PDF_TOP_MARGIN,
+         translate("VCommandLine", "Tiled page top margin in current units like 3.0 (export mode). If not set will be "
+                                   "used value default value 1 cm."),
+         translate("VCommandLine", "The top margin")},
+        {LONG_OPTION_TILED_PDF_BOTTOM_MARGIN,
+         translate("VCommandLine", "Tiled page bottom margin in current units like 3.0 (export mode). If not set will "
+                                   "be used value default value 1 cm."),
+         translate("VCommandLine", "The bottom margin")},
+        {LONG_OPTION_TILED_PDF_LANDSCAPE,
+         translate("VCommandLine", "Set tiled page orienatation to landscape (export mode). Default value if not set "
+                                   "portrait.")},
+    //=================================================================================================================
+        {{SINGLE_OPTION_TEST, LONG_OPTION_TEST},
+         translate("VCommandLine", "Run the program in a test mode. The program in this mode loads a single layout "
+                                   "file and silently quit without showing the main window. The key have priority "
+                                   "before key '%1'.").arg(LONG_OPTION_EXPORT_FILE)},
+        {LONG_OPTION_NO_HDPI_SCALING,
+         translate("VCommandLine", "Disable high dpi scaling. Call this option if has problem with scaling (by default "
+                                   "scaling enabled). Alternatively you can use the %1 environment variable.")
+             .arg(QStringLiteral("QT_AUTO_SCREEN_SCALE_FACTOR=0"))},
+    });
 }
 
 //--------------------------------------------------------------------------------------------
diff --git a/src/app/puzzle/vpuzzlecommandline.h b/src/app/puzzle/vpuzzlecommandline.h
index a7f403e80..52d0e6836 100644
--- a/src/app/puzzle/vpuzzlecommandline.h
+++ b/src/app/puzzle/vpuzzlecommandline.h
@@ -10,7 +10,6 @@ using VPuzzleCommandLinePtr = std::shared_ptr<VPuzzleCommandLine>;
 
 class VPuzzleCommandLine: public QObject
 {
-    friend class PuzzleApplication;
     Q_OBJECT
 public:   
     virtual ~VPuzzleCommandLine() = default;
@@ -18,8 +17,11 @@ public:
     /** @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 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;
 
     /** @brief if user enabled test mode from cmd */
     bool IsTestModeEnabled() const;
@@ -42,6 +44,7 @@ private:
     static VPuzzleCommandLinePtr instance;
     QCommandLineParser parser;
     bool isGuiEnabled;
+    friend class PuzzleApplication;
 
     /** @brief add options to the QCommandLineParser that there are in the cmd can be */
     void InitCommandLineOptions();

From fe281120d5a7ee2a6cffd58f72693bd0bff0c14e Mon Sep 17 00:00:00 2001
From: Roman Telezhynskyi <dismine@gmail.com>
Date: Mon, 13 Apr 2020 15:02:55 +0300
Subject: [PATCH 7/7] Remove comments.

---
 src/app/puzzle/puzzleapplication.cpp | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/src/app/puzzle/puzzleapplication.cpp b/src/app/puzzle/puzzleapplication.cpp
index abcbc4f08..b7ca164c9 100644
--- a/src/app/puzzle/puzzleapplication.cpp
+++ b/src/app/puzzle/puzzleapplication.cpp
@@ -445,24 +445,6 @@ void PuzzleApplication::ActivateDarkMode()
 void PuzzleApplication::ParseCommandLine(const SocketConnection &connection, const QStringList &arguments)
 {
     VPuzzleCommandLinePtr cmd = CommandLine();
-//    QCommandLineParser parser;
-//    parser.setApplicationDescription(tr("Valentina's manual layout editor."));
-//    parser.addHelpOption();
-//    parser.addVersionOption();
-//    parser.addPositionalArgument("filename", tr("The raw layout file."));
-//    //-----
-//    QCommandLineOption testOption(QStringList() << "test",
-//            tr("Use for unit testing. Run the program and open a file without showing the main window."));
-//    parser.addOption(testOption);
-//    //-----
-//    QCommandLineOption scalingOption(QStringList() << LONG_OPTION_NO_HDPI_SCALING,
-//            tr("Disable high dpi scaling. Call this option if has problem with scaling (by default scaling enabled). "
-//               "Alternatively you can use the %1 environment variable.").arg("QT_AUTO_SCREEN_SCALE_FACTOR=0"));
-//    parser.addOption(scalingOption);
-//    //-----
-//    parser.process(arguments);
-
-//    testMode = parser.isSet(testOption);
     testMode = cmd->IsTestModeEnabled();
 
     if (not testMode && connection == SocketConnection::Client)
@@ -503,7 +485,6 @@ void PuzzleApplication::ParseCommandLine(const SocketConnection &connection, con
         LoadTranslation(PuzzleSettings()->GetLocale());
     }
 
-//    const QStringList args = parser.positionalArguments();
     const QStringList args = cmd->OptionFileNames();
     if (args.count() > 0)
     {