diff --git a/ProfileInterface.cpp b/ProfileInterface.cpp index 6050840..d8398eb 100755 --- a/ProfileInterface.cpp +++ b/ProfileInterface.cpp @@ -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) { diff --git a/ProfileInterface.h b/ProfileInterface.h index f9dbc93..9d769e8 100755 --- a/ProfileInterface.h +++ b/ProfileInterface.h @@ -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); diff --git a/config.h b/config.h index c855265..554fa5a 100755 --- a/config.h +++ b/config.h @@ -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 diff --git a/res/app.rc b/res/app.rc index e662ebc..d99ffe0 100755 --- a/res/app.rc +++ b/res/app.rc @@ -7,8 +7,8 @@ CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "gta5view.exe.manifest" #include 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