added isPicOk
This commit is contained in:
parent
93f023b89e
commit
53430d82c1
3 changed files with 23 additions and 3 deletions
|
@ -41,8 +41,10 @@ SnapmaticPicture::SnapmaticPicture(QObject *parent, QString fileName) : QObject(
|
||||||
picFileName = "";
|
picFileName = "";
|
||||||
pictureStr = "";
|
pictureStr = "";
|
||||||
lastStep = "";
|
lastStep = "";
|
||||||
|
picOk = 0;
|
||||||
|
|
||||||
// INIT JSON
|
// INIT JSON
|
||||||
|
jsonOk = 0;
|
||||||
jsonStr = "";
|
jsonStr = "";
|
||||||
jsonLocX = 0;
|
jsonLocX = 0;
|
||||||
jsonLocY = 0;
|
jsonLocY = 0;
|
||||||
|
@ -101,21 +103,25 @@ bool SnapmaticPicture::readingPicture()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QByteArray jpegRawContent = picFile->read(jpegPicStreamLength);
|
QByteArray jpegRawContent = picFile->read(jpegPicStreamLength);
|
||||||
|
picOk = cachePicture.loadFromData(jpegRawContent);
|
||||||
|
|
||||||
// Read JSON Stream
|
// Read JSON Stream
|
||||||
if (!picFile->isReadable())
|
if (!picFile->isReadable())
|
||||||
{
|
{
|
||||||
lastStep = "2;/3,ReadingFile," + convertDrawStringForLog(picFileName) + ",3,NOJSON";
|
lastStep = "2;/3,ReadingFile," + convertDrawStringForLog(picFileName) + ",3,NOJSON";
|
||||||
|
return picOk;
|
||||||
}
|
}
|
||||||
else if (picFile->read(4) != "JSON")
|
else if (picFile->read(4) != "JSON")
|
||||||
{
|
{
|
||||||
lastStep = "2;/3,ReadingFile," + convertDrawStringForLog(picFileName) + ",3,CTJSON";
|
lastStep = "2;/3,ReadingFile," + convertDrawStringForLog(picFileName) + ",3,CTJSON";
|
||||||
|
return picOk;
|
||||||
}
|
}
|
||||||
QByteArray jsonRawContent = picFile->read(jsonStreamLength);
|
QByteArray jsonRawContent = picFile->read(jsonStreamLength);
|
||||||
jsonStr = getSnapmaticJSONString(jsonRawContent);
|
jsonStr = getSnapmaticJSONString(jsonRawContent);
|
||||||
parseJsonContent(); // JSON parsing is own function
|
parseJsonContent(); // JSON parsing is own function
|
||||||
|
|
||||||
return cachePicture.loadFromData(jpegRawContent);
|
return picOk;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SnapmaticPicture::getSnapmaticPictureString(QByteArray snapmaticHeader)
|
QString SnapmaticPicture::getSnapmaticPictureString(QByteArray snapmaticHeader)
|
||||||
|
@ -177,6 +183,11 @@ QString SnapmaticPicture::convertLogStringForDraw(QString inputStr)
|
||||||
return inputStr.replace("&c;",",").replace("&u;","&");
|
return inputStr.replace("&c;",",").replace("&u;","&");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SnapmaticPicture::isPicOk()
|
||||||
|
{
|
||||||
|
return picOk;
|
||||||
|
}
|
||||||
|
|
||||||
// JSON part
|
// JSON part
|
||||||
|
|
||||||
void SnapmaticPicture::parseJsonContent()
|
void SnapmaticPicture::parseJsonContent()
|
||||||
|
@ -201,6 +212,13 @@ void SnapmaticPicture::parseJsonContent()
|
||||||
{
|
{
|
||||||
jsonPlyrsList = jsonMap["plyrs"].toStringList();
|
jsonPlyrsList = jsonMap["plyrs"].toStringList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jsonOk = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SnapmaticPicture::isJsonOk()
|
||||||
|
{
|
||||||
|
return jsonOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SnapmaticPicture::getJsonStr()
|
QString SnapmaticPicture::getJsonStr()
|
||||||
|
|
|
@ -34,11 +34,13 @@ public:
|
||||||
bool readingPicture();
|
bool readingPicture();
|
||||||
void setPixmap(QPixmap pixmap);
|
void setPixmap(QPixmap pixmap);
|
||||||
void resetValues();
|
void resetValues();
|
||||||
|
bool isPicOk();
|
||||||
QPixmap getPixmap();
|
QPixmap getPixmap();
|
||||||
QString getLastStep();
|
QString getLastStep();
|
||||||
QString getPictureStr();
|
QString getPictureStr();
|
||||||
|
|
||||||
// JSON
|
// JSON
|
||||||
|
bool isJsonOk();
|
||||||
int getCrewNumber();
|
int getCrewNumber();
|
||||||
QString getJsonStr();
|
QString getJsonStr();
|
||||||
double getLocationX();
|
double getLocationX();
|
||||||
|
@ -55,6 +57,7 @@ private:
|
||||||
QString picFileName;
|
QString picFileName;
|
||||||
QString pictureStr;
|
QString pictureStr;
|
||||||
QString lastStep;
|
QString lastStep;
|
||||||
|
bool picOk;
|
||||||
|
|
||||||
// PARSE INT
|
// PARSE INT
|
||||||
int snapmaticHeaderLength;
|
int snapmaticHeaderLength;
|
||||||
|
@ -66,6 +69,7 @@ private:
|
||||||
|
|
||||||
// JSON
|
// JSON
|
||||||
void parseJsonContent();
|
void parseJsonContent();
|
||||||
|
bool jsonOk;
|
||||||
int jsonCrewID;
|
int jsonCrewID;
|
||||||
QString jsonStr;
|
QString jsonStr;
|
||||||
double jsonLocX;
|
double jsonLocX;
|
||||||
|
|
2
main.cpp
2
main.cpp
|
@ -52,8 +52,6 @@ int main(int argc, char *argv[])
|
||||||
picDialog.show();
|
picDialog.show();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
|
|
||||||
qDebug() << "showpic runned";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
|
|
Loading…
Reference in a new issue