Reading the Raw Layout Data file in Puzzle.
This commit is contained in:
parent
3b37d22a0b
commit
b2fd02b510
|
@ -7,7 +7,7 @@
|
||||||
# File with common stuff for whole project
|
# File with common stuff for whole project
|
||||||
include(../../../common.pri)
|
include(../../../common.pri)
|
||||||
|
|
||||||
QT += core gui widgets network xml xmlpatterns printsupport
|
QT += core gui widgets network xml xmlpatterns printsupport concurrent
|
||||||
|
|
||||||
# Name of binary file
|
# Name of binary file
|
||||||
TARGET = puzzle
|
TARGET = puzzle
|
||||||
|
@ -187,7 +187,7 @@ noRunPath{ # For enable run qmake with CONFIG+=noRunPath
|
||||||
# When the GNU linker sees a library, it discards all symbols that it doesn't need.
|
# When the GNU linker sees a library, it discards all symbols that it doesn't need.
|
||||||
# Dependent library go first.
|
# Dependent library go first.
|
||||||
|
|
||||||
#VTools static library (depend on VWidgets, VMisc, VPatternDB)
|
##VTools static library (depend on VWidgets, VMisc, VPatternDB)
|
||||||
#unix|win32: LIBS += -L$$OUT_PWD/../../libs/vtools/$${DESTDIR}/ -lvtools
|
#unix|win32: LIBS += -L$$OUT_PWD/../../libs/vtools/$${DESTDIR}/ -lvtools
|
||||||
|
|
||||||
#INCLUDEPATH += $$PWD/../../libs/vtools
|
#INCLUDEPATH += $$PWD/../../libs/vtools
|
||||||
|
@ -215,14 +215,23 @@ noRunPath{ # For enable run qmake with CONFIG+=noRunPath
|
||||||
#win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vformat/$${DESTDIR}/vformat.lib
|
#win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vformat/$${DESTDIR}/vformat.lib
|
||||||
#else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vformat/$${DESTDIR}/libvformat.a
|
#else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vformat/$${DESTDIR}/libvformat.a
|
||||||
|
|
||||||
##VPatternDB static library (depend on vgeometry, vmisc, VLayout)
|
# VLayout static library (depend on VGeometry)
|
||||||
#unix|win32: LIBS += -L$$OUT_PWD/../../libs/vpatterndb/$${DESTDIR} -lvpatterndb
|
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vlayout/$${DESTDIR}/ -lvlayout
|
||||||
|
|
||||||
#INCLUDEPATH += $$PWD/../../libs/vpatterndb
|
INCLUDEPATH += $$PWD/../../libs/vlayout
|
||||||
#DEPENDPATH += $$PWD/../../libs/vpatterndb
|
DEPENDPATH += $$PWD/../../libs/vlayout
|
||||||
|
|
||||||
#win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/vpatterndb.lib
|
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vlayout/$${DESTDIR}/vlayout.lib
|
||||||
#else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/libvpatterndb.a
|
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vlayout/$${DESTDIR}/libvlayout.a
|
||||||
|
|
||||||
|
#VPatternDB static library (depend on vgeometry, vmisc)
|
||||||
|
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vpatterndb/$${DESTDIR} -lvpatterndb
|
||||||
|
|
||||||
|
INCLUDEPATH += $$PWD/../../libs/vpatterndb
|
||||||
|
DEPENDPATH += $$PWD/../../libs/vpatterndb
|
||||||
|
|
||||||
|
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/vpatterndb.lib
|
||||||
|
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/libvpatterndb.a
|
||||||
|
|
||||||
# Fervor static library (depend on VMisc, IFC)
|
# Fervor static library (depend on VMisc, IFC)
|
||||||
unix|win32: LIBS += -L$$OUT_PWD/../../libs/fervor/$${DESTDIR}/ -lfervor
|
unix|win32: LIBS += -L$$OUT_PWD/../../libs/fervor/$${DESTDIR}/ -lfervor
|
||||||
|
@ -251,31 +260,22 @@ DEPENDPATH += $$PWD/../../libs/vmisc
|
||||||
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vmisc/$${DESTDIR}/vmisc.lib
|
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vmisc/$${DESTDIR}/vmisc.lib
|
||||||
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vmisc/$${DESTDIR}/libvmisc.a
|
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vmisc/$${DESTDIR}/libvmisc.a
|
||||||
|
|
||||||
## VLayout static library (depend on VGeometry)
|
# VGeometry static library (depend on ifc)
|
||||||
#unix|win32: LIBS += -L$$OUT_PWD/../../libs/vlayout/$${DESTDIR}/ -lvlayout
|
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/ -lvgeometry
|
||||||
|
|
||||||
#INCLUDEPATH += $$PWD/../../libs/vlayout
|
INCLUDEPATH += $$PWD/../../libs/vgeometry
|
||||||
#DEPENDPATH += $$PWD/../../libs/vlayout
|
DEPENDPATH += $$PWD/../../libs/vgeometry
|
||||||
|
|
||||||
#win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vlayout/$${DESTDIR}/vlayout.lib
|
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/vgeometry.lib
|
||||||
#else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vlayout/$${DESTDIR}/libvlayout.a
|
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/libvgeometry.a
|
||||||
|
|
||||||
## VGeometry static library (depend on ifc)
|
# QMuParser library
|
||||||
#unix|win32: LIBS += -L$$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/ -lvgeometry
|
win32:CONFIG(release, debug|release): LIBS += -L$${OUT_PWD}/../../libs/qmuparser/$${DESTDIR} -lqmuparser2
|
||||||
|
else:win32:CONFIG(debug, debug|release): LIBS += -L$${OUT_PWD}/../../libs/qmuparser/$${DESTDIR} -lqmuparser2
|
||||||
|
else:unix: LIBS += -L$${OUT_PWD}/../../libs/qmuparser/$${DESTDIR} -lqmuparser
|
||||||
|
|
||||||
#INCLUDEPATH += $$PWD/../../libs/vgeometry
|
INCLUDEPATH += $${PWD}/../../libs/qmuparser
|
||||||
#DEPENDPATH += $$PWD/../../libs/vgeometry
|
DEPENDPATH += $${PWD}/../../libs/qmuparser
|
||||||
|
|
||||||
#win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/vgeometry.lib
|
|
||||||
#else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/libvgeometry.a
|
|
||||||
|
|
||||||
## QMuParser library
|
|
||||||
#win32:CONFIG(release, debug|release): LIBS += -L$${OUT_PWD}/../../libs/qmuparser/$${DESTDIR} -lqmuparser2
|
|
||||||
#else:win32:CONFIG(debug, debug|release): LIBS += -L$${OUT_PWD}/../../libs/qmuparser/$${DESTDIR} -lqmuparser2
|
|
||||||
#else:unix: LIBS += -L$${OUT_PWD}/../../libs/qmuparser/$${DESTDIR} -lqmuparser
|
|
||||||
|
|
||||||
#INCLUDEPATH += $${PWD}/../../libs/qmuparser
|
|
||||||
#DEPENDPATH += $${PWD}/../../libs/qmuparser
|
|
||||||
|
|
||||||
## VPropertyExplorer library
|
## VPropertyExplorer library
|
||||||
#win32:CONFIG(release, debug|release): LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpropertyexplorer
|
#win32:CONFIG(release, debug|release): LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpropertyexplorer
|
||||||
|
|
|
@ -337,7 +337,7 @@ PuzzleMainWindow *PuzzleApplication::MainWindow()
|
||||||
{
|
{
|
||||||
VPuzzleCommandLinePtr cmd;
|
VPuzzleCommandLinePtr cmd;
|
||||||
VPuzzleCommandLine::ProcessInstance(cmd, QStringList());
|
VPuzzleCommandLine::ProcessInstance(cmd, QStringList());
|
||||||
NewMainWindow(true);
|
NewMainWindow(VPuzzleCommandLinePtr());
|
||||||
}
|
}
|
||||||
return mainWindows[0];
|
return mainWindows[0];
|
||||||
}
|
}
|
||||||
|
@ -355,11 +355,11 @@ QList<PuzzleMainWindow *> PuzzleApplication::MainWindows()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
PuzzleMainWindow *PuzzleApplication::NewMainWindow(bool guiMode)
|
PuzzleMainWindow *PuzzleApplication::NewMainWindow(const VPuzzleCommandLinePtr &cmd)
|
||||||
{
|
{
|
||||||
PuzzleMainWindow *puzzle = new PuzzleMainWindow();
|
PuzzleMainWindow *puzzle = new PuzzleMainWindow(cmd);
|
||||||
mainWindows.prepend(puzzle);
|
mainWindows.prepend(puzzle);
|
||||||
if (guiMode)
|
if (cmd->IsGuiEnabled())
|
||||||
{
|
{
|
||||||
puzzle->show();
|
puzzle->show();
|
||||||
}
|
}
|
||||||
|
@ -505,7 +505,7 @@ void PuzzleApplication::ProcessArguments(const VPuzzleCommandLinePtr &cmd)
|
||||||
|
|
||||||
for (auto &arg : args)
|
for (auto &arg : args)
|
||||||
{
|
{
|
||||||
NewMainWindow(cmd->IsGuiEnabled());
|
NewMainWindow(cmd);
|
||||||
if (not MainWindow()->LoadFile(arg))
|
if (not MainWindow()->LoadFile(arg))
|
||||||
{
|
{
|
||||||
if (not cmd->IsGuiEnabled())
|
if (not cmd->IsGuiEnabled())
|
||||||
|
@ -516,10 +516,10 @@ void PuzzleApplication::ProcessArguments(const VPuzzleCommandLinePtr &cmd)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (rawLayouts.size() > 0)
|
if (rawLayouts.size() > 0)
|
||||||
// {
|
{
|
||||||
// MainWindow()->ImportRawLayouts(rawLayouts);
|
MainWindow()->ImportRawLayouts(rawLayouts);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -530,12 +530,12 @@ void PuzzleApplication::ProcessArguments(const VPuzzleCommandLinePtr &cmd)
|
||||||
cmd.get()->parser.showHelp(V_EX_USAGE);
|
cmd.get()->parser.showHelp(V_EX_USAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
NewMainWindow(cmd->IsGuiEnabled());
|
NewMainWindow(cmd);
|
||||||
// if (rawLayouts.size() > 0)
|
if (rawLayouts.size() > 0)
|
||||||
// {
|
{
|
||||||
// MainWindow()->New(); // prepare layout settings
|
// MainWindow()->New(); // prepare layout settings
|
||||||
// MainWindow()->ImportRawLayouts(rawLayouts);
|
MainWindow()->ImportRawLayouts(rawLayouts);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (not cmd->IsGuiEnabled())
|
if (not cmd->IsGuiEnabled())
|
||||||
|
|
|
@ -58,7 +58,7 @@ public:
|
||||||
virtual bool IsAppInGUIMode() const override;
|
virtual bool IsAppInGUIMode() const override;
|
||||||
PuzzleMainWindow *MainWindow();
|
PuzzleMainWindow *MainWindow();
|
||||||
QList<PuzzleMainWindow*> MainWindows();
|
QList<PuzzleMainWindow*> MainWindows();
|
||||||
PuzzleMainWindow *NewMainWindow(bool guiMode);
|
PuzzleMainWindow *NewMainWindow(const VPuzzleCommandLinePtr &cmd);
|
||||||
|
|
||||||
void InitOptions();
|
void InitOptions();
|
||||||
|
|
||||||
|
|
|
@ -28,12 +28,25 @@
|
||||||
#include "puzzlemainwindow.h"
|
#include "puzzlemainwindow.h"
|
||||||
#include "ui_puzzlemainwindow.h"
|
#include "ui_puzzlemainwindow.h"
|
||||||
#include "dialogs/dialogaboutpuzzle.h"
|
#include "dialogs/dialogaboutpuzzle.h"
|
||||||
|
#include "../vlayout/vrawlayout.h"
|
||||||
|
#include "../vmisc/vsysexits.h"
|
||||||
|
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
|
QT_WARNING_PUSH
|
||||||
|
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
|
||||||
|
QT_WARNING_DISABLE_INTEL(1418)
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(pWindow, "p.window")
|
||||||
|
|
||||||
|
QT_WARNING_POP
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
PuzzleMainWindow::PuzzleMainWindow(QWidget *parent) :
|
PuzzleMainWindow::PuzzleMainWindow(const VPuzzleCommandLinePtr &cmd, QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
ui(new Ui::PuzzleMainWindow),
|
ui(new Ui::PuzzleMainWindow),
|
||||||
pieceCarrousel(new VPieceCarrousel)
|
pieceCarrousel(new VPieceCarrousel),
|
||||||
|
m_cmd(cmd)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -59,7 +72,25 @@ bool PuzzleMainWindow::LoadFile(const QString &path)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void PuzzleMainWindow::ImportRawLayouts(const QStringList &layouts)
|
void PuzzleMainWindow::ImportRawLayouts(const QStringList &layouts)
|
||||||
{
|
{
|
||||||
Q_UNUSED(layouts)
|
VRawLayout layoutReader;
|
||||||
|
|
||||||
|
for(auto &path : layouts)
|
||||||
|
{
|
||||||
|
VRawLayoutData data;
|
||||||
|
if (layoutReader.ReadFile(path, data))
|
||||||
|
{
|
||||||
|
// Do somethinmg with raw layout data
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qCCritical(pWindow, "%s\n", qPrintable(tr("Could not extract data from file '%1'. %2")
|
||||||
|
.arg(path, layoutReader.ErrorString())));
|
||||||
|
if (m_cmd != nullptr && not m_cmd->IsGuiEnabled())
|
||||||
|
{
|
||||||
|
m_cmd->ShowHelp(V_EX_DATAERR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
#include "../vmisc/def.h"
|
#include "../vmisc/def.h"
|
||||||
#include "vpiececarrousel.h"
|
#include "vpiececarrousel.h"
|
||||||
|
#include "vpuzzlecommandline.h"
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
@ -44,7 +45,7 @@ class PuzzleMainWindow : public QMainWindow
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PuzzleMainWindow(QWidget *parent = nullptr);
|
PuzzleMainWindow(const VPuzzleCommandLinePtr &cmd, QWidget *parent = nullptr);
|
||||||
virtual ~PuzzleMainWindow();
|
virtual ~PuzzleMainWindow();
|
||||||
|
|
||||||
bool LoadFile(const QString &path);
|
bool LoadFile(const QString &path);
|
||||||
|
@ -58,6 +59,7 @@ private:
|
||||||
Q_DISABLE_COPY(PuzzleMainWindow)
|
Q_DISABLE_COPY(PuzzleMainWindow)
|
||||||
Ui::PuzzleMainWindow *ui;
|
Ui::PuzzleMainWindow *ui;
|
||||||
VPieceCarrousel *pieceCarrousel;
|
VPieceCarrousel *pieceCarrousel;
|
||||||
|
VPuzzleCommandLinePtr m_cmd;
|
||||||
|
|
||||||
void InitMenuBar();
|
void InitMenuBar();
|
||||||
void InitProperties();
|
void InitProperties();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user