Commit 048979c4 authored by Syping's avatar Syping

fixed import time bug (21:47 to 00:00 32bit issue)

parent a81a5d47
......@@ -417,7 +417,7 @@ fileDialogPreOpen: //Work?
if (selectedFiles.length() == 1)
{
QString selectedFile = selectedFiles.at(0);
if (!importFile(selectedFile, true, 0)) goto fileDialogPreOpen; //Work?
if (!importFile(selectedFile, true)) goto fileDialogPreOpen; //Work?
}
else if (selectedFiles.length() > 1)
{
......@@ -440,7 +440,6 @@ void ProfileInterface::importFilesProgress(QStringList selectedFiles)
{
int maximumId = selectedFiles.length();
int overallId = 1;
int currentId = 0;
QString errorStr;
QStringList failedFiles;
......@@ -464,34 +463,11 @@ void ProfileInterface::importFilesProgress(QStringList selectedFiles)
{
pbDialog.setValue(overallId);
pbDialog.setLabelText(tr("Import file %1 of %2 files").arg(QString::number(overallId), QString::number(maximumId)));
if (currentId == 10)
{
// Break until two seconds are over (this prevent import failures)
int elapsedTime = t.elapsed();
if (elapsedTime > 2000)
{
}
else if (elapsedTime < 0)
{
QEventLoop loop;
QTimer::singleShot(2000, &loop, SLOT(quit()));
loop.exec();
}
else
{
QEventLoop loop;
QTimer::singleShot(2000 - elapsedTime, &loop, SLOT(quit()));
loop.exec();
}
currentId = 0;
t.restart();
}
if (!importFile(selectedFile, false, currentId))
if (!importFile(selectedFile, false))
{
failedFiles << QFileInfo(selectedFile).fileName();
}
overallId++;
currentId++;
}
pbDialog.close();
foreach (const QString &curErrorStr, failedFiles)
......@@ -505,7 +481,7 @@ void ProfileInterface::importFilesProgress(QStringList selectedFiles)
}
}
bool ProfileInterface::importFile(QString selectedFile, bool notMultiple, int currentId)
bool ProfileInterface::importFile(QString selectedFile, bool notMultiple)
{
QString selectedFileName = QFileInfo(selectedFile).fileName();
if (QFile::exists(selectedFile))
......@@ -603,10 +579,20 @@ bool ProfileInterface::importFile(QString selectedFile, bool notMultiple, int cu
delete picture;
return false;
}
QString currentTime = QTime::currentTime().toString("HHmmss");
SnapmaticProperties spJson = picture->getSnapmaticProperties();
spJson.uid = QString(QTime::currentTime().toString("HHmmss") +
QString::number(currentId) +
spJson.uid = QString(currentTime +
QString::number(QDate::currentDate().dayOfYear())).toInt();
bool fExists = QFile::exists(QString(profileFolder + QDir::separator() + "PGTA5" + QString::number(spJson.uid)));
int cEnough = 0;
while (fExists && cEnough < 5000)
{
currentTime = QString::number(currentTime.toInt() - 1);
spJson.uid = QString(currentTime +
QString::number(QDate::currentDate().dayOfYear())).toInt();
fExists = QFile::exists(QString(profileFolder + QDir::separator() + "PGTA5" + QString::number(spJson.uid)));
cEnough++;
}
spJson.createdDateTime = QDateTime::currentDateTime();
spJson.createdTimestamp = spJson.createdDateTime.toTime_t();
picture->setSnapmaticProperties(spJson);
......@@ -636,10 +622,20 @@ bool ProfileInterface::importFile(QString selectedFile, bool notMultiple, int cu
{
if (picture->setImage(importDialog->image()))
{
QString currentTime = QTime::currentTime().toString("HHmmss");
SnapmaticProperties spJson = picture->getSnapmaticProperties();
spJson.uid = QString(QTime::currentTime().toString("HHmmss") +
QString::number(currentId) +
spJson.uid = QString(currentTime +
QString::number(QDate::currentDate().dayOfYear())).toInt();
bool fExists = QFile::exists(QString( profileFolder + QDir::separator() + "PGTA5" + QString::number(spJson.uid) ));
int cEnough = 0;
while (fExists && cEnough < 25)
{
currentTime = QString::number(currentTime.toInt() - 1);
spJson.uid = QString(currentTime +
QString::number(QDate::currentDate().dayOfYear())).toInt();
fExists = QFile::exists(QString(profileFolder + QDir::separator() + "PGTA5" + QString::number(spJson.uid)));
cEnough++;
}
spJson.createdDateTime = QDateTime::currentDateTime();
spJson.createdTimestamp = spJson.createdDateTime.toTime_t();
picture->setSnapmaticProperties(spJson);
......@@ -1160,7 +1156,7 @@ void ProfileInterface::on_saProfileContent_dropped(const QMimeData *mimeData)
if (pathList.length() == 1)
{
QString selectedFile = pathList.at(0);
importFile(selectedFile, true, 0);
importFile(selectedFile, true);
}
else if (pathList.length() > 1)
{
......
......@@ -94,7 +94,7 @@ private:
int selectedWidgts;
int contentMode;
bool importFile(QString selectedFile, bool notMultiple, int currentId);
bool importFile(QString selectedFile, bool notMultiple);
void importFilesProgress(QStringList selectedFiles);
bool importSnapmaticPicture(SnapmaticPicture *picture, bool warn = true);
bool importSavegameData(SavegameData *savegame, QString sgdPath, bool warn = true);
......
......@@ -50,7 +50,7 @@
#ifndef GTA5SYNC_APPVER
#ifndef GTA5SYNC_DAILYB
#define GTA5SYNC_APPVER "1.4.0"
#define GTA5SYNC_APPVER "1.4.1"
#else
#define GTA5SYNC_APPVER QString("%1").arg(GTA5SYNC_DAILYB)
#endif
......
......@@ -7,8 +7,8 @@ CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "gta5view.exe.manifest"
#include <windows.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1, 4, 0, 6
PRODUCTVERSION 1, 4, 0, 6
FILEVERSION 1, 4, 1, 0
PRODUCTVERSION 1, 4, 1, 0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0
FILEOS VOS_NT_WINDOWS32
......@@ -25,12 +25,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Syping"
VALUE "FileDescription", "gta5view\0"
VALUE "FileVersion", "1.4.0-rc2\0"
VALUE "FileVersion", "1.4.1\0"
VALUE "InternalName", "gta5view\0"
VALUE "LegalCopyright", "Copyright 2016-2017 Syping\0"
VALUE "OriginalFilename", "gta5view.exe\0"
VALUE "ProductName", "gta5view\0"
VALUE "ProductVersion", "1.4.0-rc2\0"
VALUE "ProductVersion", "1.4.1\0"
END
END
END
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment