SavegameData, SnapmaticPicture and StringParser improved
This commit is contained in:
parent
cb3647df02
commit
a27e699cac
7 changed files with 100 additions and 59 deletions
|
@ -22,7 +22,7 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
SavegameData::SavegameData(QString fileName, QObject *parent) : QObject(parent), savegameFileName(fileName)
|
SavegameData::SavegameData(const QString &fileName, QObject *parent) : QObject(parent), savegameFileName(fileName)
|
||||||
{
|
{
|
||||||
// PARSE INT INIT - DO NOT CHANGE THIS VALUES
|
// PARSE INT INIT - DO NOT CHANGE THIS VALUES
|
||||||
savegameHeaderLength = 260;
|
savegameHeaderLength = 260;
|
||||||
|
@ -41,7 +41,7 @@ bool SavegameData::readingSavegame()
|
||||||
QFile *saveFile = new QFile(savegameFileName);
|
QFile *saveFile = new QFile(savegameFileName);
|
||||||
if (!saveFile->open(QFile::ReadOnly))
|
if (!saveFile->open(QFile::ReadOnly))
|
||||||
{
|
{
|
||||||
lastStep = "1;/1,OpenFile," + convertDrawStringForLog(savegameFileName);
|
lastStep = "1;/1,OpenFile," + StringParser::convertDrawStringForLog(savegameFileName);
|
||||||
saveFile->deleteLater();
|
saveFile->deleteLater();
|
||||||
delete saveFile;
|
delete saveFile;
|
||||||
return false;
|
return false;
|
||||||
|
@ -50,7 +50,7 @@ bool SavegameData::readingSavegame()
|
||||||
// Reading Savegame Header
|
// Reading Savegame Header
|
||||||
if (!saveFile->isReadable())
|
if (!saveFile->isReadable())
|
||||||
{
|
{
|
||||||
lastStep = "2;/3,ReadingFile," + convertDrawStringForLog(savegameFileName) + ",1,NOHEADER";
|
lastStep = "2;/3,ReadingFile," + StringParser::convertDrawStringForLog(savegameFileName) + ",1,NOHEADER";
|
||||||
saveFile->close();
|
saveFile->close();
|
||||||
saveFile->deleteLater();
|
saveFile->deleteLater();
|
||||||
delete saveFile;
|
delete saveFile;
|
||||||
|
@ -71,7 +71,7 @@ bool SavegameData::readingSavegame()
|
||||||
return savegameOk;
|
return savegameOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SavegameData::getSavegameDataString(QByteArray savegameHeader)
|
QString SavegameData::getSavegameDataString(const QByteArray &savegameHeader)
|
||||||
{
|
{
|
||||||
QByteArray savegameBytes = savegameHeader.left(savegameHeaderLength);
|
QByteArray savegameBytes = savegameHeader.left(savegameHeaderLength);
|
||||||
QList<QByteArray> savegameBytesList = savegameBytes.split(char(0x01));
|
QList<QByteArray> savegameBytesList = savegameBytes.split(char(0x01));
|
||||||
|
@ -80,7 +80,7 @@ QString SavegameData::getSavegameDataString(QByteArray savegameHeader)
|
||||||
return StringParser::parseTitleString(savegameBytes, savegameBytes.length());
|
return StringParser::parseTitleString(savegameBytes, savegameBytes.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SavegameData::readingSavegameFromFile(QString fileName)
|
bool SavegameData::readingSavegameFromFile(const QString &fileName)
|
||||||
{
|
{
|
||||||
if (fileName != "")
|
if (fileName != "")
|
||||||
{
|
{
|
||||||
|
@ -93,16 +93,6 @@ bool SavegameData::readingSavegameFromFile(QString fileName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SavegameData::convertDrawStringForLog(QString inputStr)
|
|
||||||
{
|
|
||||||
return inputStr.replace("&","&u;").replace(",","&c;");
|
|
||||||
}
|
|
||||||
|
|
||||||
QString SavegameData::convertLogStringForDraw(QString inputStr)
|
|
||||||
{
|
|
||||||
return inputStr.replace("&c;",",").replace("&u;","&");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SavegameData::isSavegameOk()
|
bool SavegameData::isSavegameOk()
|
||||||
{
|
{
|
||||||
return savegameOk;
|
return savegameOk;
|
||||||
|
|
|
@ -25,8 +25,8 @@ class SavegameData : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit SavegameData(QString fileName = "", QObject *parent = 0);
|
explicit SavegameData(const QString &fileName = "", QObject *parent = 0);
|
||||||
bool readingSavegameFromFile(QString fileName);
|
bool readingSavegameFromFile(const QString &fileName);
|
||||||
bool readingSavegame();
|
bool readingSavegame();
|
||||||
bool isSavegameOk();
|
bool isSavegameOk();
|
||||||
QString getLastStep();
|
QString getLastStep();
|
||||||
|
@ -34,9 +34,7 @@ public:
|
||||||
QString getSavegameFileName();
|
QString getSavegameFileName();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString getSavegameDataString(QByteArray savegameHeader);
|
QString getSavegameDataString(const QByteArray &savegameHeader);
|
||||||
QString convertDrawStringForLog(QString inputStr);
|
|
||||||
QString convertLogStringForDraw(QString inputStr);
|
|
||||||
QString savegameFileName;
|
QString savegameFileName;
|
||||||
QString savegameStr;
|
QString savegameStr;
|
||||||
QString lastStep;
|
QString lastStep;
|
||||||
|
|
|
@ -20,13 +20,14 @@
|
||||||
#include "StringParser.h"
|
#include "StringParser.h"
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
|
#include <QStringList>
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
SnapmaticPicture::SnapmaticPicture(QString fileName, QObject *parent) : QObject(parent), picFileName(fileName)
|
SnapmaticPicture::SnapmaticPicture(const QString &fileName, QObject *parent) : QObject(parent), picFileName(fileName)
|
||||||
{
|
{
|
||||||
// PARSE INT INIT - DO NOT CHANGE THIS VALUES
|
// PARSE INT INIT - DO NOT CHANGE THIS VALUES
|
||||||
snapmaticHeaderLength = 278;
|
snapmaticHeaderLength = 278;
|
||||||
|
@ -39,8 +40,12 @@ SnapmaticPicture::SnapmaticPicture(QString fileName, QObject *parent) : QObject(
|
||||||
|
|
||||||
// INIT PIC
|
// INIT PIC
|
||||||
cachePicture = QImage(0, 0, QImage::Format_RGB32);
|
cachePicture = QImage(0, 0, QImage::Format_RGB32);
|
||||||
|
picExportFileName = "";
|
||||||
pictureStr = "";
|
pictureStr = "";
|
||||||
lastStep = "";
|
lastStep = "";
|
||||||
|
sortStr = "";
|
||||||
|
titlStr = "";
|
||||||
|
descStr = "";
|
||||||
picOk = 0;
|
picOk = 0;
|
||||||
|
|
||||||
// INIT JSON
|
// INIT JSON
|
||||||
|
@ -61,7 +66,7 @@ bool SnapmaticPicture::readingPicture()
|
||||||
QFile *picFile = new QFile(picFileName);
|
QFile *picFile = new QFile(picFileName);
|
||||||
if (!picFile->open(QFile::ReadOnly))
|
if (!picFile->open(QFile::ReadOnly))
|
||||||
{
|
{
|
||||||
lastStep = "1;/1,OpenFile," + convertDrawStringForLog(picFileName);
|
lastStep = "1;/1,OpenFile," + StringParser::convertDrawStringForLog(picFileName);
|
||||||
picFile->deleteLater();
|
picFile->deleteLater();
|
||||||
delete picFile;
|
delete picFile;
|
||||||
return false;
|
return false;
|
||||||
|
@ -70,7 +75,7 @@ bool SnapmaticPicture::readingPicture()
|
||||||
// Reading Snapmatic Header
|
// Reading Snapmatic Header
|
||||||
if (!picFile->isReadable())
|
if (!picFile->isReadable())
|
||||||
{
|
{
|
||||||
lastStep = "2;/3,ReadingFile," + convertDrawStringForLog(picFileName) + ",1,NOHEADER";
|
lastStep = "2;/3,ReadingFile," + StringParser::convertDrawStringForLog(picFileName) + ",1,NOHEADER";
|
||||||
picFile->close();
|
picFile->close();
|
||||||
picFile->deleteLater();
|
picFile->deleteLater();
|
||||||
delete picFile;
|
delete picFile;
|
||||||
|
@ -82,7 +87,7 @@ bool SnapmaticPicture::readingPicture()
|
||||||
// Reading JPEG Header Line
|
// Reading JPEG Header Line
|
||||||
if (!picFile->isReadable())
|
if (!picFile->isReadable())
|
||||||
{
|
{
|
||||||
lastStep = "2;/3,ReadingFile," + convertDrawStringForLog(picFileName) + ",2,NOHEADER";
|
lastStep = "2;/3,ReadingFile," + StringParser::convertDrawStringForLog(picFileName) + ",2,NOHEADER";
|
||||||
picFile->close();
|
picFile->close();
|
||||||
picFile->deleteLater();
|
picFile->deleteLater();
|
||||||
delete picFile;
|
delete picFile;
|
||||||
|
@ -94,7 +99,7 @@ bool SnapmaticPicture::readingPicture()
|
||||||
jpegHeaderLine.remove(0, jpegHeaderLineDifStr);
|
jpegHeaderLine.remove(0, jpegHeaderLineDifStr);
|
||||||
if (jpegHeaderLine.left(4) != "JPEG")
|
if (jpegHeaderLine.left(4) != "JPEG")
|
||||||
{
|
{
|
||||||
lastStep = "2;/3,ReadingFile," + convertDrawStringForLog(picFileName) + ",2,NOJPEG";
|
lastStep = "2;/3,ReadingFile," + StringParser::convertDrawStringForLog(picFileName) + ",2,NOJPEG";
|
||||||
picFile->close();
|
picFile->close();
|
||||||
picFile->deleteLater();
|
picFile->deleteLater();
|
||||||
delete picFile;
|
delete picFile;
|
||||||
|
@ -104,7 +109,7 @@ bool SnapmaticPicture::readingPicture()
|
||||||
// Read JPEG Stream
|
// Read JPEG Stream
|
||||||
if (!picFile->isReadable())
|
if (!picFile->isReadable())
|
||||||
{
|
{
|
||||||
lastStep = "2;/3,ReadingFile," + convertDrawStringForLog(picFileName) + ",2,NOPIC";
|
lastStep = "2;/3,ReadingFile," + StringParser::convertDrawStringForLog(picFileName) + ",2,NOPIC";
|
||||||
picFile->close();
|
picFile->close();
|
||||||
picFile->deleteLater();
|
picFile->deleteLater();
|
||||||
delete picFile;
|
delete picFile;
|
||||||
|
@ -116,7 +121,7 @@ bool SnapmaticPicture::readingPicture()
|
||||||
// Read JSON Stream
|
// Read JSON Stream
|
||||||
if (!picFile->isReadable())
|
if (!picFile->isReadable())
|
||||||
{
|
{
|
||||||
lastStep = "2;/3,ReadingFile," + convertDrawStringForLog(picFileName) + ",3,NOJSON";
|
lastStep = "2;/3,ReadingFile," + StringParser::convertDrawStringForLog(picFileName) + ",3,NOJSON";
|
||||||
picFile->close();
|
picFile->close();
|
||||||
picFile->deleteLater();
|
picFile->deleteLater();
|
||||||
delete picFile;
|
delete picFile;
|
||||||
|
@ -124,7 +129,7 @@ bool SnapmaticPicture::readingPicture()
|
||||||
}
|
}
|
||||||
else if (picFile->read(4) != "JSON")
|
else if (picFile->read(4) != "JSON")
|
||||||
{
|
{
|
||||||
lastStep = "2;/3,ReadingFile," + convertDrawStringForLog(picFileName) + ",3,CTJSON";
|
lastStep = "2;/3,ReadingFile," + StringParser::convertDrawStringForLog(picFileName) + ",3,CTJSON";
|
||||||
picFile->close();
|
picFile->close();
|
||||||
picFile->deleteLater();
|
picFile->deleteLater();
|
||||||
delete picFile;
|
delete picFile;
|
||||||
|
@ -136,7 +141,7 @@ bool SnapmaticPicture::readingPicture()
|
||||||
|
|
||||||
if (!picFile->isReadable())
|
if (!picFile->isReadable())
|
||||||
{
|
{
|
||||||
lastStep = "2;/3,ReadingFile," + convertDrawStringForLog(picFileName) + ",4,NOTITL";
|
lastStep = "2;/3,ReadingFile," + StringParser::convertDrawStringForLog(picFileName) + ",4,NOTITL";
|
||||||
picFile->close();
|
picFile->close();
|
||||||
picFile->deleteLater();
|
picFile->deleteLater();
|
||||||
delete picFile;
|
delete picFile;
|
||||||
|
@ -144,7 +149,7 @@ bool SnapmaticPicture::readingPicture()
|
||||||
}
|
}
|
||||||
else if (picFile->read(4) != "TITL")
|
else if (picFile->read(4) != "TITL")
|
||||||
{
|
{
|
||||||
lastStep = "2;/3,ReadingFile," + convertDrawStringForLog(picFileName) + ",4,CTTITL";
|
lastStep = "2;/3,ReadingFile," + StringParser::convertDrawStringForLog(picFileName) + ",4,CTTITL";
|
||||||
picFile->close();
|
picFile->close();
|
||||||
picFile->deleteLater();
|
picFile->deleteLater();
|
||||||
delete picFile;
|
delete picFile;
|
||||||
|
@ -155,7 +160,7 @@ bool SnapmaticPicture::readingPicture()
|
||||||
|
|
||||||
if (!picFile->isReadable())
|
if (!picFile->isReadable())
|
||||||
{
|
{
|
||||||
lastStep = "2;/3,ReadingFile," + convertDrawStringForLog(picFileName) + ",5,NODESC";
|
lastStep = "2;/3,ReadingFile," + StringParser::convertDrawStringForLog(picFileName) + ",5,NODESC";
|
||||||
picFile->close();
|
picFile->close();
|
||||||
picFile->deleteLater();
|
picFile->deleteLater();
|
||||||
delete picFile;
|
delete picFile;
|
||||||
|
@ -163,7 +168,7 @@ bool SnapmaticPicture::readingPicture()
|
||||||
}
|
}
|
||||||
else if (picFile->read(4) != "DESC")
|
else if (picFile->read(4) != "DESC")
|
||||||
{
|
{
|
||||||
lastStep = "2;/3,ReadingFile," + convertDrawStringForLog(picFileName) + ",5,CTDESC";
|
lastStep = "2;/3,ReadingFile," + StringParser::convertDrawStringForLog(picFileName) + ",5,CTDESC";
|
||||||
picFile->close();
|
picFile->close();
|
||||||
picFile->deleteLater();
|
picFile->deleteLater();
|
||||||
delete picFile;
|
delete picFile;
|
||||||
|
@ -172,13 +177,15 @@ bool SnapmaticPicture::readingPicture()
|
||||||
QByteArray descRawContent = picFile->read(tideStreamLength);
|
QByteArray descRawContent = picFile->read(tideStreamLength);
|
||||||
descStr = getSnapmaticTIDEString(descRawContent);
|
descStr = getSnapmaticTIDEString(descRawContent);
|
||||||
|
|
||||||
|
parseSnapmaticExportAndSortString();
|
||||||
|
|
||||||
picFile->close();
|
picFile->close();
|
||||||
picFile->deleteLater();
|
picFile->deleteLater();
|
||||||
delete picFile;
|
delete picFile;
|
||||||
return picOk;
|
return picOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SnapmaticPicture::getSnapmaticPictureString(QByteArray snapmaticHeader)
|
QString SnapmaticPicture::getSnapmaticPictureString(const QByteArray &snapmaticHeader)
|
||||||
{
|
{
|
||||||
QByteArray snapmaticBytes = snapmaticHeader.left(snapmaticUsefulLength);
|
QByteArray snapmaticBytes = snapmaticHeader.left(snapmaticUsefulLength);
|
||||||
QList<QByteArray> snapmaticBytesList = snapmaticBytes.split(char(0x01));
|
QList<QByteArray> snapmaticBytesList = snapmaticBytes.split(char(0x01));
|
||||||
|
@ -187,7 +194,7 @@ QString SnapmaticPicture::getSnapmaticPictureString(QByteArray snapmaticHeader)
|
||||||
return StringParser::parseTitleString(snapmaticBytes, snapmaticBytes.length());
|
return StringParser::parseTitleString(snapmaticBytes, snapmaticBytes.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SnapmaticPicture::getSnapmaticJSONString(QByteArray jsonBytes)
|
QString SnapmaticPicture::getSnapmaticJSONString(const QByteArray &jsonBytes)
|
||||||
{
|
{
|
||||||
QByteArray jsonUsefulBytes = jsonBytes;
|
QByteArray jsonUsefulBytes = jsonBytes;
|
||||||
jsonUsefulBytes.replace((char)0x00, "");
|
jsonUsefulBytes.replace((char)0x00, "");
|
||||||
|
@ -195,7 +202,7 @@ QString SnapmaticPicture::getSnapmaticJSONString(QByteArray jsonBytes)
|
||||||
return QString::fromUtf8(jsonUsefulBytes).trimmed();
|
return QString::fromUtf8(jsonUsefulBytes).trimmed();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SnapmaticPicture::getSnapmaticTIDEString(QByteArray tideBytes)
|
QString SnapmaticPicture::getSnapmaticTIDEString(const QByteArray &tideBytes)
|
||||||
{
|
{
|
||||||
QByteArray tideUsefulBytes = tideBytes;
|
QByteArray tideUsefulBytes = tideBytes;
|
||||||
tideUsefulBytes.remove(0,4);
|
tideUsefulBytes.remove(0,4);
|
||||||
|
@ -203,7 +210,37 @@ QString SnapmaticPicture::getSnapmaticTIDEString(QByteArray tideBytes)
|
||||||
return QString::fromUtf8(tideUsefulBytesList.at(0)).trimmed();
|
return QString::fromUtf8(tideUsefulBytesList.at(0)).trimmed();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SnapmaticPicture::readingPictureFromFile(QString fileName)
|
void SnapmaticPicture::parseSnapmaticExportAndSortString()
|
||||||
|
{
|
||||||
|
QStringList pictureStrList = pictureStr.split(" - ");
|
||||||
|
if (pictureStrList.length() <= 2)
|
||||||
|
{
|
||||||
|
QString dtStr = pictureStrList.at(1);
|
||||||
|
QStringList dtStrList = dtStr.split(" ");
|
||||||
|
if (dtStrList.length() <= 2)
|
||||||
|
{
|
||||||
|
QString dayStr;
|
||||||
|
QString yearStr;
|
||||||
|
QString monthStr;
|
||||||
|
QString dateStr = dtStrList.at(0);
|
||||||
|
QString timeStr = dtStrList.at(1);
|
||||||
|
timeStr.replace(":","");
|
||||||
|
QStringList dateStrList = dateStr.split("/");
|
||||||
|
if (dateStrList.length() <= 3)
|
||||||
|
{
|
||||||
|
dayStr = dateStrList.at(1);
|
||||||
|
yearStr = dateStrList.at(2);
|
||||||
|
monthStr = dateStrList.at(0);
|
||||||
|
}
|
||||||
|
QString cmpPicTitl = titlStr;
|
||||||
|
cmpPicTitl.replace(" ", "_");
|
||||||
|
sortStr = yearStr + monthStr + dayStr + timeStr;
|
||||||
|
picExportFileName = sortStr + "_" + cmpPicTitl + ".jpg";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SnapmaticPicture::readingPictureFromFile(const QString &fileName)
|
||||||
{
|
{
|
||||||
if (fileName != "")
|
if (fileName != "")
|
||||||
{
|
{
|
||||||
|
@ -216,16 +253,26 @@ bool SnapmaticPicture::readingPictureFromFile(QString fileName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SnapmaticPicture::setPicture(QImage picture)
|
void SnapmaticPicture::setPicture(const QImage &picture)
|
||||||
{
|
{
|
||||||
cachePicture = picture;
|
cachePicture = picture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString SnapmaticPicture::getExportPictureFileName()
|
||||||
|
{
|
||||||
|
return picExportFileName;
|
||||||
|
}
|
||||||
|
|
||||||
QString SnapmaticPicture::getPictureFileName()
|
QString SnapmaticPicture::getPictureFileName()
|
||||||
{
|
{
|
||||||
return picFileName;
|
return picFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString SnapmaticPicture::getPictureSortStr()
|
||||||
|
{
|
||||||
|
return sortStr;
|
||||||
|
}
|
||||||
|
|
||||||
QString SnapmaticPicture::getPictureDesc()
|
QString SnapmaticPicture::getPictureDesc()
|
||||||
{
|
{
|
||||||
return descStr;
|
return descStr;
|
||||||
|
@ -251,16 +298,6 @@ QImage SnapmaticPicture::getPicture()
|
||||||
return cachePicture;
|
return cachePicture;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SnapmaticPicture::convertDrawStringForLog(QString inputStr)
|
|
||||||
{
|
|
||||||
return inputStr.replace("&","&u;").replace(",","&c;");
|
|
||||||
}
|
|
||||||
|
|
||||||
QString SnapmaticPicture::convertLogStringForDraw(QString inputStr)
|
|
||||||
{
|
|
||||||
return inputStr.replace("&c;",",").replace("&u;","&");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SnapmaticPicture::isPicOk()
|
bool SnapmaticPicture::isPicOk()
|
||||||
{
|
{
|
||||||
return picOk;
|
return picOk;
|
||||||
|
|
|
@ -29,17 +29,19 @@ class SnapmaticPicture : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit SnapmaticPicture(QString fileName = "", QObject *parent = 0);
|
explicit SnapmaticPicture(const QString &fileName = "", QObject *parent = 0);
|
||||||
bool readingPictureFromFile(QString fileName);
|
bool readingPictureFromFile(const QString &fileName);
|
||||||
bool readingPicture();
|
bool readingPicture();
|
||||||
void setPicture(QImage picture);
|
void setPicture(const QImage &picture);
|
||||||
bool isPicOk();
|
bool isPicOk();
|
||||||
QImage getPicture();
|
QImage getPicture();
|
||||||
QString getLastStep();
|
QString getLastStep();
|
||||||
QString getPictureStr();
|
QString getPictureStr();
|
||||||
QString getPictureTitl();
|
QString getPictureTitl();
|
||||||
QString getPictureDesc();
|
QString getPictureDesc();
|
||||||
|
QString getPictureSortStr();
|
||||||
QString getPictureFileName();
|
QString getPictureFileName();
|
||||||
|
QString getExportPictureFileName();
|
||||||
|
|
||||||
// JSON
|
// JSON
|
||||||
bool isJsonOk();
|
bool isJsonOk();
|
||||||
|
@ -51,15 +53,16 @@ public:
|
||||||
QStringList getPlayers();
|
QStringList getPlayers();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString getSnapmaticPictureString(QByteArray snapmaticHeader);
|
QString getSnapmaticPictureString(const QByteArray &snapmaticHeader);
|
||||||
QString getSnapmaticJSONString(QByteArray jsonBytes);
|
QString getSnapmaticJSONString(const QByteArray &jsonBytes);
|
||||||
QString getSnapmaticTIDEString(QByteArray tideBytes);
|
QString getSnapmaticTIDEString(const QByteArray &tideBytes);
|
||||||
QString convertDrawStringForLog(QString inputStr);
|
void parseSnapmaticExportAndSortString();
|
||||||
QString convertLogStringForDraw(QString inputStr);
|
|
||||||
QImage cachePicture;
|
QImage cachePicture;
|
||||||
|
QString picExportFileName;
|
||||||
QString picFileName;
|
QString picFileName;
|
||||||
QString pictureStr;
|
QString pictureStr;
|
||||||
QString lastStep;
|
QString lastStep;
|
||||||
|
QString sortStr;
|
||||||
QString titlStr;
|
QString titlStr;
|
||||||
QString descStr;
|
QString descStr;
|
||||||
bool picOk;
|
bool picOk;
|
||||||
|
|
|
@ -16,21 +16,33 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "StringParser.h"
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include "StringParser.h"
|
|
||||||
|
|
||||||
StringParser::StringParser()
|
StringParser::StringParser()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString StringParser::parseTitleString(QByteArray commitBytes, int maxLength)
|
QString StringParser::parseTitleString(const QByteArray &commitBytes, int maxLength)
|
||||||
{
|
{
|
||||||
Q_UNUSED(maxLength)
|
Q_UNUSED(maxLength)
|
||||||
QString retStr = QTextCodec::codecForName("UTF-16LE")->toUnicode(commitBytes).trimmed();
|
QString retStr = QTextCodec::codecForName("UTF-16LE")->toUnicode(commitBytes).trimmed();
|
||||||
retStr.remove(QChar((char)0x00));
|
retStr.remove(QChar((char)0x00));
|
||||||
return retStr;
|
return retStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString StringParser::convertDrawStringForLog(const QString &inputStr)
|
||||||
|
{
|
||||||
|
QString outputStr = inputStr;
|
||||||
|
return outputStr.replace("&","&u;").replace(",","&c;");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString StringParser::convertLogStringForDraw(const QString &inputStr)
|
||||||
|
{
|
||||||
|
QString outputStr = inputStr;
|
||||||
|
return outputStr.replace("&c;",",").replace("&u;","&");
|
||||||
|
}
|
||||||
|
|
|
@ -26,7 +26,9 @@ class StringParser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StringParser();
|
StringParser();
|
||||||
static QString parseTitleString(QByteArray commitBytes, int maxLength);
|
static QString parseTitleString(const QByteArray &commitBytes, int maxLength);
|
||||||
|
static QString convertDrawStringForLog(const QString &inputStr);
|
||||||
|
static QString convertLogStringForDraw(const QString &inputStr);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // STRINGPARSER_H
|
#endif // STRINGPARSER_H
|
||||||
|
|
|
@ -43,7 +43,6 @@ UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, D
|
||||||
ui->menuProfile->setEnabled(false);
|
ui->menuProfile->setEnabled(false);
|
||||||
defaultWindowTitle = this->windowTitle();
|
defaultWindowTitle = this->windowTitle();
|
||||||
|
|
||||||
this->setWindowIcon(QIcon(":/img/5sync.png"));
|
|
||||||
this->setWindowTitle(defaultWindowTitle.arg(tr("Select profile")));
|
this->setWindowTitle(defaultWindowTitle.arg(tr("Select profile")));
|
||||||
|
|
||||||
// init settings
|
// init settings
|
||||||
|
|
Loading…
Reference in a new issue