Improve code style. Use typedef.

This commit is contained in:
Roman Telezhynskyi 2020-04-13 12:43:25 +03:00
parent e1c945d02c
commit aa81fa5ecf
4 changed files with 10 additions and 9 deletions

View File

@ -444,7 +444,7 @@ void PuzzleApplication::ActivateDarkMode()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void PuzzleApplication::ParseCommandLine(const SocketConnection &connection, const QStringList &arguments) void PuzzleApplication::ParseCommandLine(const SocketConnection &connection, const QStringList &arguments)
{ {
std::shared_ptr<VPuzzleCommandLine>cmd = CommandLine(); VPuzzleCommandLinePtr cmd = CommandLine();
// QCommandLineParser parser; // QCommandLineParser parser;
// parser.setApplicationDescription(tr("Valentina's manual layout editor.")); // parser.setApplicationDescription(tr("Valentina's manual layout editor."));
// parser.addHelpOption(); // parser.addHelpOption();
@ -641,7 +641,7 @@ void PuzzleApplication::Clean()
} }
//-------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------
const std::shared_ptr<VPuzzleCommandLine> PuzzleApplication::CommandLine() const VPuzzleCommandLinePtr PuzzleApplication::CommandLine()
{ {
return VPuzzleCommandLine::instance; return VPuzzleCommandLine::instance;
} }

View File

@ -71,7 +71,7 @@ public:
void ActivateDarkMode(); void ActivateDarkMode();
void ParseCommandLine(const SocketConnection &connection, const QStringList &arguments); void ParseCommandLine(const SocketConnection &connection, const QStringList &arguments);
const std::shared_ptr<VPuzzleCommandLine> CommandLine(); const VPuzzleCommandLinePtr CommandLine();
public slots: public slots:
void ProcessCMD(); void ProcessCMD();

View File

@ -76,7 +76,7 @@ VPuzzleCommandLine::VPuzzleCommandLine():
} }
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------
std::shared_ptr<VPuzzleCommandLine> VPuzzleCommandLine::Instance(const QCoreApplication &app) VPuzzleCommandLinePtr VPuzzleCommandLine::Instance(const QCoreApplication &app)
{ {
if (instance == nullptr) if (instance == nullptr)
{ {

View File

@ -5,6 +5,9 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QCommandLineParser> #include <QCommandLineParser>
class VPuzzleCommandLine;
using VPuzzleCommandLinePtr = std::shared_ptr<VPuzzleCommandLine>;
class VPuzzleCommandLine: public QObject class VPuzzleCommandLine: public QObject
{ {
friend class PuzzleApplication; friend class PuzzleApplication;
@ -44,13 +47,11 @@ public:
protected: protected:
VPuzzleCommandLine(); VPuzzleCommandLine();
/** /** @brief create the single instance of the class inside puzzleapplication */
* @brief create the single instance of the class inside puzzleapplication static VPuzzleCommandLinePtr Instance(const QCoreApplication &app);
*/
static std::shared_ptr<VPuzzleCommandLine> Instance(const QCoreApplication &app);
private: private:
Q_DISABLE_COPY(VPuzzleCommandLine) Q_DISABLE_COPY(VPuzzleCommandLine)
static std::shared_ptr<VPuzzleCommandLine> instance; static VPuzzleCommandLinePtr instance;
QCommandLineParser parser; QCommandLineParser parser;
bool isGuiEnabled; bool isGuiEnabled;