latest commits from gta5sync

This commit is contained in:
Rafael 2017-01-27 04:33:27 +01:00
parent 6b1d5b6d1d
commit e031bcec59
14 changed files with 414 additions and 212 deletions

View file

@ -227,9 +227,9 @@ void ProfileInterface::dialogNextPictureRequested(QWidget *dialog)
{
QString newWidgetKey = pictureKeyList.at(picIndex);
SnapmaticWidget *picWidget = (SnapmaticWidget*)widgets.key(newWidgetKey);
picDialog->setMaximumSize(picDialog->width(), QWIDGETSIZE_MAX);
//picDialog->setMaximumHeight(QWIDGETSIZE_MAX);
picDialog->setSnapmaticPicture(picWidget->getPicture(), picIndex);
//picDialog->adaptNewDialogSize();
//picDialog->setMaximumHeight(picDialog->height());
}
}
}
@ -262,8 +262,9 @@ void ProfileInterface::dialogPreviousPictureRequested(QWidget *dialog)
picIndex--;
QString newWidgetKey = pictureKeyList.at(picIndex );
SnapmaticWidget *picWidget = (SnapmaticWidget*)widgets.key(newWidgetKey);
//picDialog->setMaximumHeight(QWIDGETSIZE_MAX);
picDialog->setSnapmaticPicture(picWidget->getPicture(), picIndex);
//picDialog->adaptNewDialogSize();
//picDialog->setMaximumHeight(picDialog->height());
}
}
}
@ -362,7 +363,8 @@ fileDialogPreOpen:
fileDialog.setLabelText(QFileDialog::Accept, tr("Import"));
QStringList filters;
filters << tr("All profile files (SGTA* PGTA*)");
filters << tr("All profile files (*.g5e SGTA* PGTA*)");
filters << tr("GTA V Export (*.g5e)");
filters << tr("Savegames files (SGTA*)");
filters << tr("Snapmatic pictures (PGTA*)");
filters << tr("All files (**)");
@ -421,7 +423,7 @@ bool ProfileInterface::importFile(QString selectedFile, bool warn)
QString selectedFileName = QFileInfo(selectedFile).fileName();
if (QFile::exists(selectedFile))
{
if (selectedFileName.left(4) == "PGTA")
if (selectedFileName.left(4) == "PGTA" || selectedFileName.right(4) == ".g5e")
{
SnapmaticPicture *picture = new SnapmaticPicture(selectedFile);
if (picture->readingPicture())
@ -493,6 +495,10 @@ bool ProfileInterface::importSnapmaticPicture(SnapmaticPicture *picture, QString
QFileInfo picFileInfo(picPath);
QString picFileName = picFileInfo.fileName();
QString adjustedFileName = picFileName;
if (adjustedFileName.right(4) == ".g5e")
{
adjustedFileName = picture->getPictureFileName();
}
if (adjustedFileName.right(7) == ".hidden") // for the hidden file system
{
adjustedFileName.remove(adjustedFileName.length() - 7, 7);
@ -501,9 +507,9 @@ bool ProfileInterface::importSnapmaticPicture(SnapmaticPicture *picture, QString
{
adjustedFileName.remove(adjustedFileName.length() - 4, 4);
}
if (picFileName.left(4) != "PGTA")
if (picFileName.left(4) != "PGTA" && picFileName.right(4) != ".g5e")
{
if (warn) QMessageBox::warning(this, tr("Import"), tr("Failed to import the Snapmatic picture, file not begin with PGTA"));
if (warn) QMessageBox::warning(this, tr("Import"), tr("Failed to import the Snapmatic picture, file not begin with PGTA or end with .g5e"));
return false;
}
else if (QFile::exists(profileFolder + QDir::separator() + adjustedFileName) || QFile::exists(profileFolder + QDir::separator() + adjustedFileName + ".hidden"))
@ -511,7 +517,7 @@ bool ProfileInterface::importSnapmaticPicture(SnapmaticPicture *picture, QString
if (warn) QMessageBox::warning(this, tr("Import"), tr("Failed to import the Snapmatic picture, the picture is already in the game"));
return false;
}
else if (QFile::copy(picPath, profileFolder + QDir::separator() + adjustedFileName))
else if (picture->exportPicture(profileFolder + QDir::separator() + adjustedFileName, false))
{
picture->setPicFileName(profileFolder + QDir::separator() + adjustedFileName);
pictureLoaded_f(picture, profileFolder + QDir::separator() + adjustedFileName, true);