last changes from gta5sync
This commit is contained in:
parent
4fc5959f71
commit
88f43b55d3
3 changed files with 56 additions and 40 deletions
|
@ -1063,7 +1063,7 @@ void ProfileInterface::contextMenuTriggeredPIC(QContextMenuEvent *ev)
|
||||||
SnapmaticWidget *picWidget = (SnapmaticWidget*)sender();
|
SnapmaticWidget *picWidget = (SnapmaticWidget*)sender();
|
||||||
QMenu contextMenu(picWidget);
|
QMenu contextMenu(picWidget);
|
||||||
QMenu editMenu(SnapmaticWidget::tr("Edi&t"), picWidget);
|
QMenu editMenu(SnapmaticWidget::tr("Edi&t"), picWidget);
|
||||||
if (isHidden())
|
if (picWidget->isHidden())
|
||||||
{
|
{
|
||||||
editMenu.addAction(SnapmaticWidget::tr("Show &In-game"), picWidget, SLOT(makePictureVisibleSlot()));
|
editMenu.addAction(SnapmaticWidget::tr("Show &In-game"), picWidget, SLOT(makePictureVisibleSlot()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,27 +31,26 @@
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
|
// PARSER ALLOCATIONS
|
||||||
|
#define snapmaticHeaderLength 278
|
||||||
|
#define snapmaticUsefulLength 260
|
||||||
|
#define snapmaticFileMaxSize 528192
|
||||||
|
#define jpegHeaderLineDifStr 2
|
||||||
|
#define jpegPreHeaderLength 14
|
||||||
|
#define jpegPicStreamLength 524288
|
||||||
|
#define jsonStreamLength 3076
|
||||||
|
#define tideStreamLength 260
|
||||||
|
|
||||||
|
// EDITOR ALLOCATIONS
|
||||||
|
#define jpegStreamEditorBegin 292
|
||||||
|
#define jsonStreamEditorBegin 524588
|
||||||
|
#define jsonStreamEditorLength 3072
|
||||||
|
#define titlStreamEditorBegin 527668
|
||||||
|
#define titlStreamEditorLength 256
|
||||||
|
#define titlStreamCharacterMax 39
|
||||||
|
|
||||||
SnapmaticPicture::SnapmaticPicture(const QString &fileName, QObject *parent) : QObject(parent), picFilePath(fileName)
|
SnapmaticPicture::SnapmaticPicture(const QString &fileName, QObject *parent) : QObject(parent), picFilePath(fileName)
|
||||||
{
|
{
|
||||||
// PARSE INT INIT - DO NOT CHANGE THIS VALUES
|
|
||||||
snapmaticHeaderLength = 278;
|
|
||||||
snapmaticUsefulLength = 260;
|
|
||||||
snapmaticFileMaxSize = 528192;
|
|
||||||
jpegHeaderLineDifStr = 2;
|
|
||||||
jpegPreHeaderLength = 14;
|
|
||||||
jpegPicStreamLength = 524288;
|
|
||||||
jsonStreamLength = 3076;
|
|
||||||
tideStreamLength = 260;
|
|
||||||
|
|
||||||
// PARSE EDITOR INIT
|
|
||||||
jpegStreamEditorBegin = 292;
|
|
||||||
jsonStreamEditorBegin = 524588;
|
|
||||||
jsonStreamEditorLength = 3072;
|
|
||||||
titlStreamEditorBegin = 527668;
|
|
||||||
titlStreamEditorLength = 256;
|
|
||||||
titlStreamCharacterMax = 39;
|
|
||||||
rawPicContent = "";
|
|
||||||
|
|
||||||
// PREDEFINED PROPERTIES
|
// PREDEFINED PROPERTIES
|
||||||
snapmaticResolution = QSize(960, 536);
|
snapmaticResolution = QSize(960, 536);
|
||||||
|
|
||||||
|
@ -64,10 +63,8 @@ SnapmaticPicture::~SnapmaticPicture()
|
||||||
|
|
||||||
void SnapmaticPicture::reset()
|
void SnapmaticPicture::reset()
|
||||||
{
|
{
|
||||||
// PARSE EDITOR INIT
|
|
||||||
rawPicContent = "";
|
|
||||||
|
|
||||||
// INIT PIC
|
// INIT PIC
|
||||||
|
rawPicContent = "";
|
||||||
cachePicture = QImage(0, 0, QImage::Format_RGB888);
|
cachePicture = QImage(0, 0, QImage::Format_RGB888);
|
||||||
jpegRawContentSize = 0;
|
jpegRawContentSize = 0;
|
||||||
picExportFileName = "";
|
picExportFileName = "";
|
||||||
|
@ -362,6 +359,8 @@ void SnapmaticPicture::updateStrings()
|
||||||
cmpPicTitl.replace(" ", "_");
|
cmpPicTitl.replace(" ", "_");
|
||||||
cmpPicTitl.replace(":", "-");
|
cmpPicTitl.replace(":", "-");
|
||||||
cmpPicTitl.replace("\\", "");
|
cmpPicTitl.replace("\\", "");
|
||||||
|
cmpPicTitl.replace("{", "");
|
||||||
|
cmpPicTitl.replace("}", "");
|
||||||
cmpPicTitl.replace("/", "");
|
cmpPicTitl.replace("/", "");
|
||||||
cmpPicTitl.replace("<", "");
|
cmpPicTitl.replace("<", "");
|
||||||
cmpPicTitl.replace(">", "");
|
cmpPicTitl.replace(">", "");
|
||||||
|
@ -867,3 +866,30 @@ QSize SnapmaticPicture::getSnapmaticResolution()
|
||||||
{
|
{
|
||||||
return snapmaticResolution;
|
return snapmaticResolution;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VERIFY CONTENT
|
||||||
|
|
||||||
|
bool SnapmaticPicture::verifyTitle(const QString &title)
|
||||||
|
{
|
||||||
|
// VERIFY TITLE FOR BE A VALID SNAPMATIC TITLE
|
||||||
|
if (title.length() <= titlStreamCharacterMax)
|
||||||
|
{
|
||||||
|
foreach(const QChar &titleChar, title)
|
||||||
|
{
|
||||||
|
if (!verifyTitleChar(titleChar)) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SnapmaticPicture::verifyTitleChar(const QChar &titleChar)
|
||||||
|
{
|
||||||
|
// VERIFY CHAR FOR BE A VALID SNAPMATIC CHARACTER
|
||||||
|
if (titleChar.isLetterOrNumber() || titleChar.isPrint())
|
||||||
|
{
|
||||||
|
if (titleChar == '<' || titleChar == '>' || titleChar == '\\') return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
|
@ -96,6 +96,9 @@ public:
|
||||||
// PREDEFINED PROPERTIES
|
// PREDEFINED PROPERTIES
|
||||||
QSize getSnapmaticResolution();
|
QSize getSnapmaticResolution();
|
||||||
|
|
||||||
|
// VERIFY CONTENT
|
||||||
|
static bool verifyTitle(const QString &title);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString getSnapmaticHeaderString(const QByteArray &snapmaticHeader);
|
QString getSnapmaticHeaderString(const QByteArray &snapmaticHeader);
|
||||||
QString getSnapmaticJSONString(const QByteArray &jsonBytes);
|
QString getSnapmaticJSONString(const QByteArray &jsonBytes);
|
||||||
|
@ -116,23 +119,7 @@ private:
|
||||||
bool isCustomFormat;
|
bool isCustomFormat;
|
||||||
int jpegRawContentSize;
|
int jpegRawContentSize;
|
||||||
|
|
||||||
// PARSE INT
|
// PICTURE STREAM
|
||||||
int snapmaticHeaderLength;
|
|
||||||
int snapmaticUsefulLength;
|
|
||||||
int snapmaticFileMaxSize;
|
|
||||||
int jpegHeaderLineDifStr;
|
|
||||||
int jpegPreHeaderLength;
|
|
||||||
int jpegPicStreamLength;
|
|
||||||
int jsonStreamLength;
|
|
||||||
int tideStreamLength;
|
|
||||||
|
|
||||||
// PARSE EDITOR
|
|
||||||
int jpegStreamEditorBegin;
|
|
||||||
int jsonStreamEditorBegin;
|
|
||||||
int jsonStreamEditorLength;
|
|
||||||
int titlStreamEditorBegin;
|
|
||||||
int titlStreamEditorLength;
|
|
||||||
int titlStreamCharacterMax;
|
|
||||||
QByteArray rawPicContent;
|
QByteArray rawPicContent;
|
||||||
|
|
||||||
// PREDEFINED PROPERTIES
|
// PREDEFINED PROPERTIES
|
||||||
|
@ -144,6 +131,9 @@ private:
|
||||||
QString jsonStr;
|
QString jsonStr;
|
||||||
SnapmaticProperties localSpJson;
|
SnapmaticProperties localSpJson;
|
||||||
|
|
||||||
|
// VERIFY CONTENT
|
||||||
|
static bool verifyTitleChar(const QChar &titleChar);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
Loading…
Reference in a new issue