diff --git a/PictureDialog.cpp b/PictureDialog.cpp index 241d29f..5c3b0fc 100755 --- a/PictureDialog.cpp +++ b/PictureDialog.cpp @@ -48,6 +48,7 @@ void PictureDialog::setJsonString(SnapmaticPicture *picture) QString locX = QString::number(picture->getLocationX()); QString locY = QString::number(picture->getLocationY()); QString locZ = QString::number(picture->getLocationZ()); + QString crewID = QString::number(picture->getCrewNumber()); QStringList plyrsList = picture->getPlayers(); QString plyrsStr; @@ -58,5 +59,5 @@ void PictureDialog::setJsonString(SnapmaticPicture *picture) } if (plyrsStr.length() >= 1) { plyrsStr.remove(0,2); } - ui->labJSON->setText(jsonDrawString.arg(locX, locY, locZ, plyrsStr)); + ui->labJSON->setText(jsonDrawString.arg(locX, locY, locZ, plyrsStr, crewID)); } diff --git a/PictureDialog.ui b/PictureDialog.ui index 30c2dd8..7a5cabe 100755 --- a/PictureDialog.ui +++ b/PictureDialog.ui @@ -37,7 +37,8 @@ Location: X: %1 Y: %2 Z: %3 -Players: %4 +Players: %4 +Crew ID: %5 diff --git a/SnapmaticPicture.cpp b/SnapmaticPicture.cpp index 9cae37a..3acc004 100755 --- a/SnapmaticPicture.cpp +++ b/SnapmaticPicture.cpp @@ -25,22 +25,32 @@ #include #include #include -int snapmaticHeaderLength = 278; -int snapmaticUsefulLength = 256; -int jpegPreHeaderLength = 14; -int jpegPicStreamLength = 524288; -int jsonStreamLength = 3076; SnapmaticPicture::SnapmaticPicture(QObject *parent, QString fileName) : QObject(parent) { - // Init + // PARSE INT INIT - DO NOT CHANGE THIS VALUES + snapmaticHeaderLength = 278; + snapmaticUsefulLength = 256; + jpegHeaderLineDifStr = 2; + jpegPreHeaderLength = 14; + jpegPicStreamLength = 524288; + jsonStreamLength = 3076; + + // INIT PIC cachePicture = QPixmap(0,0); picFileName = ""; pictureStr = ""; lastStep = ""; - jsonStr = ""; - // Set pic fileName + // INIT JSON + jsonStr = ""; + jsonLocX = 0; + jsonLocY = 0; + jsonLocZ = 0; + jsonCrewID = 0; + jsonPlyrsList = QStringList(); + + // SET PIC FILENAME if (fileName != "") { picFileName = fileName; @@ -77,7 +87,7 @@ bool SnapmaticPicture::readingPicture() QByteArray jpegHeaderLine = picFile->read(jpegPreHeaderLength); // Checking for JPEG - jpegHeaderLine.remove(0,2); + jpegHeaderLine.remove(0, jpegHeaderLineDifStr); if (jpegHeaderLine.left(4) != "JPEG") { lastStep = "2;/3,ReadingFile," + convertDrawStringForLog(picFileName) + ",2,NOJPEG"; @@ -183,6 +193,10 @@ void SnapmaticPicture::parseJsonContent() if (locMap.contains("y")) { jsonLocY = locMap["y"].toDouble(); } if (locMap.contains("z")) { jsonLocZ = locMap["z"].toDouble(); } } + if (jsonMap.contains("crewid")) + { + jsonCrewID = jsonMap["crewid"].toInt(); + } if (jsonMap.contains("plyrs")) { jsonPlyrsList = jsonMap["plyrs"].toStringList(); @@ -194,6 +208,11 @@ QString SnapmaticPicture::getJsonStr() return jsonStr; } +int SnapmaticPicture::getCrewNumber() +{ + return jsonCrewID; +} + double SnapmaticPicture::getLocationX() { return jsonLocX; diff --git a/SnapmaticPicture.h b/SnapmaticPicture.h index 0e85268..7d53055 100755 --- a/SnapmaticPicture.h +++ b/SnapmaticPicture.h @@ -39,6 +39,7 @@ public: QString getPictureStr(); // JSON + int getCrewNumber(); QString getJsonStr(); double getLocationX(); double getLocationY(); @@ -55,8 +56,17 @@ private: QString pictureStr; QString lastStep; + // PARSE INT + int snapmaticHeaderLength; + int snapmaticUsefulLength; + int jpegHeaderLineDifStr; + int jpegPreHeaderLength; + int jpegPicStreamLength; + int jsonStreamLength; + // JSON void parseJsonContent(); + int jsonCrewID; QString jsonStr; double jsonLocX; double jsonLocY;