Skip to content

Commit

Permalink
Implemented compatablility import of glabels-3 project files (#39).
Browse files Browse the repository at this point in the history
  • Loading branch information
hochwasser authored and jimevins committed Dec 2, 2018
1 parent 1cdb397 commit ba3c602
Show file tree
Hide file tree
Showing 28 changed files with 2,495 additions and 3 deletions.
1 change: 1 addition & 0 deletions glabels/ObjectEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ namespace glabels
loadTextPage();
loadPositionPage();
loadShadowPage();
loadRectSizePage();

setEnabled( true );
}
Expand Down
1 change: 1 addition & 0 deletions model/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ set (Model_sources
XmlCategoryParser.cpp
XmlLabelCreator.cpp
XmlLabelParser.cpp
XmlLabelParser_3.cpp
XmlPaperParser.cpp
XmlTemplateCreator.cpp
XmlTemplateParser.cpp
Expand Down
6 changes: 6 additions & 0 deletions model/Distance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,9 @@ namespace glabels

}
}
QDebug operator<<(QDebug dbg, const glabels::model::Distance &dist)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << dist.toString(glabels::model::Units::Enum::MM);
return dbg.maybeSpace();
}
1 change: 0 additions & 1 deletion model/Template.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ namespace glabels
mPaperId(paperId),
mPageWidth(pageWidth),
mPageHeight(pageHeight),
mIsUserDefined(isUserDefined),
mIsSizeIso(false),
mIsSizeUs(false),
mName("")
Expand Down
7 changes: 5 additions & 2 deletions model/XmlLabelParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#include "XmlUtil.h"
#include "DataCache.h"

#include "XmlLabelParser_3.h"

#include "barcode/Backends.h"
#include "merge/Factory.h"

Expand Down Expand Up @@ -77,7 +79,7 @@ namespace glabels
gunzip( rawData, unzippedData );
success = doc.setContent( unzippedData, false, &errorString, &errorLine, &errorColumn );
#else
qWarning() << "Warning: Cannot read compressed glabels project file! gLabels not build with ZLIB.";
qWarning() << "Warning: Cannot read compressed glabels project file! gLabels not built with ZLIB.";
return nullptr;
#endif
}
Expand Down Expand Up @@ -239,7 +241,8 @@ namespace glabels
QString version = XmlUtil::getStringAttr( node, "version", "" );
if ( version != "4.0" )
{
qWarning() << "TODO: compatibility mode.";
// Attempt to import as version 3.0 format (glabels 2.0 - glabels 3.4)
return XmlLabelParser_3::parseRootNode(node);
}

auto* label = new Model();
Expand Down
Loading

0 comments on commit ba3c602

Please sign in to comment.