Commit fab5e460 authored by Rafael's avatar Rafael

latest commits from gta5sync

parent 51f53777
......@@ -31,8 +31,8 @@ AboutDialog::AboutDialog(QWidget *parent) :
QString appVersion = qApp->applicationVersion();
QString buildType = GTA5SYNC_BUILDTYPE;
buildType.replace("_", " ");
QString projectBuild = QString("%1, %2").arg(__DATE__, __TIME__);
QString buildStr = QString("%1, %2").arg(QT_VERSION_STR, GTA5SYNC_COMPILER);
QString projectBuild = GTA5SYNC_BUILDDATETIME;
QString buildStr = GTA5SYNC_BUILDSTRING;
#ifdef GTA5SYNC_ENABLED
QString projectDes = tr("A project for viewing and sync Grand Theft Auto V Snapmatic<br/>\nPictures and Savegames");
#else
......@@ -40,6 +40,11 @@ AboutDialog::AboutDialog(QWidget *parent) :
#endif
ui->labAbout->setText(aboutStr.arg(appVersion % " (" % buildType % ")", buildStr, qVersion(), projectBuild, GTA5SYNC_APPVENDORLINK, GTA5SYNC_APPVENDOR, GTA5SYNC_COPYRIGHT, GTA5SYNC_APPSTR, projectDes));
this->setWindowTitle(titleStr.arg(GTA5SYNC_APPSTR));
if (QIcon::hasThemeIcon("dialog-close"))
{
ui->cmdClose->setIcon(QIcon::fromTheme("dialog-close"));
}
}
AboutDialog::~AboutDialog()
......
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping
* Copyright (C) 2016-2017 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
......@@ -74,9 +74,6 @@ Copyright &amp;copy; &lt;a href=&quot;%5&quot;&gt;%6&lt;/a&gt; %7&lt;br/&gt;%8 i
<property name="text">
<string>&amp;Close</string>
</property>
<property name="icon">
<iconset theme="dialog-close"/>
</property>
</widget>
</item>
</layout>
......
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping
* Copyright (C) 2016-2017 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping
* Copyright (C) 2016-2017 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping
* Copyright (C) 2016-2017 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping
* Copyright (C) 2016-2017 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping
* Copyright (C) 2016-2017 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping
* Copyright (C) 2016-2017 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping
* Copyright (C) 2016-2017 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping
* Copyright (C) 2016-2017 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
......@@ -13,6 +13,9 @@
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="vlExport">
<property name="leftMargin">
<number>0</number>
......@@ -207,9 +210,6 @@
<property name="text">
<string>&amp;Close</string>
</property>
<property name="icon">
<iconset theme="dialog-close"/>
</property>
</widget>
</item>
</layout>
......
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping
* Copyright (C) 2016-2017 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -96,7 +96,7 @@ void ExportThread::run()
emit exportProgressUpdate(intExportProgress);
// Scale Picture
QImage exportPicture = picture->getPicture();
QImage exportPicture = picture->getImage();
if (sizeMode == "Desktop")
{
QRect desktopResolution = QApplication::desktop()->screenGeometry();
......
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping
* Copyright (C) 2016-2017 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping
* Copyright (C) 2016-2017 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping
* Copyright (C) 2016-2017 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping
* Copyright (C) 2016-2017 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping
* Copyright (C) 2016-2017 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
This diff is collapsed.
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping
* Copyright (C) 2016-2017 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -57,6 +57,15 @@ OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
ui->rbPicDesktopRes->setText(ui->rbPicDesktopRes->text().arg(QString::number(desktopSizeWidth), QString::number(desktopSizeHeight)));
ui->rbPicDefaultRes->setText(ui->rbPicDefaultRes->text().arg(QString::number(defExportSize.width()), QString::number(defExportSize.height())));
if (QIcon::hasThemeIcon("dialog-ok"))
{
ui->cmdOK->setIcon(QIcon::fromTheme("dialog-ok"));
}
if (QIcon::hasThemeIcon("dialog-cancel"))
{
ui->cmdCancel->setIcon(QIcon::fromTheme("dialog-cancel"));
}
setupTreeWidget();
setupLanguageBox();
setupRadioButtons();
......@@ -65,6 +74,10 @@ OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
setupCustomGTAFolder();
setupSnapmaticPictureViewer();
#ifdef GTA5SYNC_DISABLED
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabSync));
#endif
this->setWindowTitle(windowTitle().arg(GTA5SYNC_APPSTR));
}
......
/******************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping
* Copyright (C) 2016-2017 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
......@@ -414,6 +414,26 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tabSync">
<attribute name="title">
<string>Sync</string>
</attribute>
<layout class="QVBoxLayout" name="vlSync">
<item>
<widget class="QLabel" name="labSync">
<property name="text">
<string>Sync is not implemented at current time</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
......@@ -442,13 +462,10 @@
<property name="text">
<string extracomment="OK, Cancel, Apply">&amp;OK</string>
</property>
<property name="icon">
<iconset theme="dialog-ok"/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cmdClose">
<widget class="QPushButton" name="cmdCancel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
......@@ -458,9 +475,6 @@
<property name="text">
<string extracomment="OK, Cancel, Apply">&amp;Cancel</string>
</property>
<property name="icon">
<iconset theme="dialog-cancel"/>
</property>
</widget>
</item>
</layout>
......@@ -470,7 +484,7 @@
<resources/>
<connections>
<connection>
<sender>cmdClose</sender>
<sender>cmdCancel</sender>
<signal>clicked()</signal>
<receiver>OptionsDialog</receiver>
<slot>close()</slot>
......
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include "config.h"
#include "PictureCopy.h"
#include "PictureDialog.h"
#include "StandardPaths.h"
#include "SidebarGenerator.h"
#include <QMessageBox>
#include <QFileDialog>
#include <QSettings>
PictureCopy::PictureCopy()
{
}
void PictureCopy::copyPicture(QWidget *parent, QString picPath, SnapmaticPicture *picture)
{
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
settings.beginGroup("FileDialogs");
settings.beginGroup("PictureCopy");
QString adjustedPicPath = picPath;
if (adjustedPicPath.right(7) == ".hidden") // for the hidden file system
{
adjustedPicPath.remove(adjustedPicPath.length() - 7, 7);
}
fileDialogPreSave:
QFileInfo sgdFileInfo(adjustedPicPath);
QFileDialog fileDialog(parent);
fileDialog.setFileMode(QFileDialog::AnyFile);
fileDialog.setViewMode(QFileDialog::Detail);
fileDialog.setAcceptMode(QFileDialog::AcceptSave);
fileDialog.setOption(QFileDialog::DontUseNativeDialog, false);
fileDialog.setOption(QFileDialog::DontConfirmOverwrite, true);
fileDialog.setDefaultSuffix(".rem");
fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
fileDialog.setWindowTitle(PictureDialog::tr("Export as GTA Snapmatic..."));
fileDialog.setLabelText(QFileDialog::Accept, PictureDialog::tr("&Export"));
QStringList filters;
filters << PictureDialog::tr("GTA V Export (*.g5e)");
filters << PictureDialog::tr("GTA V Raw Export (*.auto)");
filters << PictureDialog::tr("Snapmatic pictures (PGTA*)");
fileDialog.setNameFilters(filters);
QList<QUrl> sidebarUrls = SidebarGenerator::generateSidebarUrls(fileDialog.sidebarUrls());
fileDialog.setSidebarUrls(sidebarUrls);
fileDialog.setDirectory(settings.value("Directory", StandardPaths::documentsLocation()).toString());
fileDialog.selectFile(QString(picture->getExportPictureFileName() + ".g5e"));
fileDialog.restoreGeometry(settings.value(parent->objectName() + "+Geomtery", "").toByteArray());
if (fileDialog.exec())
{
QStringList selectedFiles = fileDialog.selectedFiles();
if (selectedFiles.length() == 1)
{
QString selectedFile = selectedFiles.at(0);
if (QFile::exists(selectedFile))
{
if (QMessageBox::Yes == QMessageBox::warning(parent, PictureDialog::tr("Export as GTA Snapmatic"), PictureDialog::tr("Overwrite %1 with current Snapmatic picture?").arg("\""+selectedFile+"\""), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes))
{
if (!QFile::remove(selectedFile))
{
QMessageBox::warning(parent, PictureDialog::tr("Export as GTA Snapmatic"), PictureDialog::tr("Failed to overwrite %1 with current Snapmatic picture").arg("\""+selectedFile+"\""));
goto fileDialogPreSave;
}
}
else
{
goto fileDialogPreSave;
}
}
if (selectedFile.right(4) == ".g5e")
{
bool isExported = picture->exportPicture(selectedFile, true);
if (!isExported)
{
QMessageBox::warning(parent, PictureDialog::tr("Export as GTA Snapmatic"), PictureDialog::tr("Failed to export current Snapmatic picture"));
goto fileDialogPreSave;
}
}
else
{
bool isAutoExt = false;
if (selectedFile.right(5) == ".auto")
{
isAutoExt = true;
QString dirPath = QFileInfo(selectedFile).dir().path();
QString stockFileName = sgdFileInfo.fileName();
selectedFile = dirPath + "/" + stockFileName;
}
else if (selectedFile.right(4) == ".rem")
{
selectedFile.remove(".rem");
}
bool isCopied = picture->exportPicture(selectedFile, false);
if (!isCopied)
{
QMessageBox::warning(parent, PictureDialog::tr("Export as GTA Snapmatic"), PictureDialog::tr("Failed to export current Snapmatic picture"));
goto fileDialogPreSave;
}
else
{
if (isAutoExt) QMessageBox::information(parent, PictureDialog::tr("Export as GTA Snapmatic"), PictureDialog::tr("Exported Snapmatic to \"%1\" because of using the .auto extension.").arg(selectedFile));
}
}
}
else
{
QMessageBox::warning(parent, PictureDialog::tr("Export as GTA Snapmatic"), PictureDialog::tr("No valid file is selected"));
goto fileDialogPreSave;
}
}
settings.setValue(parent->objectName() + "+Geometry", fileDialog.saveGeometry());
settings.setValue("Directory", fileDialog.directory().absolutePath());
settings.endGroup();
}
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#ifndef PICTURECOPY_H
#define PICTURECOPY_H
#include "SnapmaticPicture.h"
#include <QWidget>
#include <QString>
class PictureCopy
{
public:
PictureCopy();
static void copyPicture(QWidget *parent, QString picPath, SnapmaticPicture *picture);
};
#endif // PICTURECOPY_H
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping
* Copyright (C) 2016-2017 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -24,7 +24,6 @@
#include "StandardPaths.h"
#include "PictureExport.h"
#include "GlobalString.h"
#include "PictureCopy.h"
#include "UiModLabel.h"
#ifdef GTA5SYNC_WIN
......@@ -103,6 +102,12 @@ PictureDialog::PictureDialog(ProfileDatabase *profileDB, CrewDatabase *crewDB, Q
// Event connects
connect(ui->labJSON, SIGNAL(resized(QSize)), this, SLOT(adaptNewDialogSize(QSize)));
// Dialog buttons
if (QIcon::hasThemeIcon("dialog-close"))
{
ui->cmdClose->setIcon(QIcon::fromTheme("dialog-close"));
}
installEventFilter(this);
installEventFilter(ui->labPicture);
ui->labPicture->setFocusPolicy(Qt::StrongFocus);
......@@ -340,12 +345,12 @@ void PictureDialog::renderOverlayPicture()
overlayTempImage = overlayTempPixmap.toImage();
}
void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, QString picturePath, bool readOk, bool _indexed, int _index)
void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk, bool _indexed, int _index)
{
snapmaticPicture = QImage();
indexed = _indexed;
index = _index;
picPath = picturePath;
picPath = picture->getPictureFilePath();
smpic = picture;
if (!readOk)
{
......@@ -354,7 +359,7 @@ void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, QString pictu
}
if (picture->isPicOk())
{
snapmaticPicture = picture->getPicture();
snapmaticPicture = picture->getImage();
renderPicture();
ui->cmdExport->setEnabled(true);
}
......@@ -367,7 +372,7 @@ void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, QString pictu
created = picture->getSnapmaticProperties().createdDateTime.toString(Qt::DefaultLocaleShortDate);
plyrsList = picture->getSnapmaticProperties().playersList;
picTitl = picture->getPictureTitl();
picArea = picture->getSnapmaticProperties().area;
picArea = picture->getSnapmaticProperties().location.area;
if (globalMap.contains(picArea))
{
picAreaStr = globalMap[picArea];
......@@ -411,24 +416,14 @@ void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, QString pictu
emit newPictureCommited(snapmaticPicture);
}
void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, QString picPath, bool readOk)
{
setSnapmaticPicture(picture, picPath, readOk, false, 0);
}
void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, QString picPath)
{
setSnapmaticPicture(picture, picPath, true);
}
void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk, int index)
{
setSnapmaticPicture(picture, picture->getPictureFileName(), readOk, true, index);
setSnapmaticPicture(picture, readOk, true, index);
}
void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk)
{
setSnapmaticPicture(picture, picture->getPictureFileName(), readOk);
setSnapmaticPicture(picture, readOk, false, 0);
}
void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, int index)
......@@ -509,11 +504,11 @@ void PictureDialog::exportSnapmaticPicture()
{
if (rqfullscreen && fullscreenWidget)
{
PictureExport::exportPicture(fullscreenWidget, smpic);
PictureExport::exportAsPicture(fullscreenWidget, smpic);
}
else
{
PictureExport::exportPicture(this, smpic);
PictureExport::exportAsPicture(this, smpic);
}
}
......@@ -521,11 +516,11 @@ void PictureDialog::copySnapmaticPicture()
{
if (rqfullscreen && fullscreenWidget)
{
PictureCopy::copyPicture(fullscreenWidget, picPath, smpic);
PictureExport::exportAsSnapmatic(fullscreenWidget, smpic);
}
else
{
PictureCopy::copyPicture(this, picPath, smpic);
PictureExport::exportAsSnapmatic(this, smpic);
}
}
......@@ -537,9 +532,9 @@ void PictureDialog::on_labPicture_mouseDoubleClicked(Qt::MouseButton button)
PictureWidget *pictureWidget = new PictureWidget(this);
pictureWidget->setObjectName("PictureWidget");
#if QT_VERSION >= 0x050600
pictureWidget->setWindowFlags(pictureWidget->windowFlags()^Qt::FramelessWindowHint^Qt::MaximizeUsingFullscreenGeometryHint);
pictureWidget->setWindowFlags(pictureWidget->windowFlags()^Qt::FramelessWindowHint^Qt::WindowStaysOnTopHint^Qt::MaximizeUsingFullscreenGeometryHint);
#else
pictureWidget->setWindowFlags(pictureWidget->windowFlags()^Qt::FramelessWindowHint);
pictureWidget->setWindowFlags(pictureWidget->windowFlags()^Qt::FramelessWindowHint^Qt::WindowStaysOnTopHint);
#endif
pictureWidget->setWindowTitle(this->windowTitle());
pictureWidget->setStyleSheet("QLabel#pictureLabel{background-color: black;}");
......
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping
* Copyright (C) 2016-2017 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -36,9 +36,7 @@ class PictureDialog : public QDialog
Q_OBJECT
public:
explicit PictureDialog(ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent = 0);
void setSnapmaticPicture(SnapmaticPicture *picture, QString picPath, bool readOk, bool indexed, int index);
void setSnapmaticPicture(SnapmaticPicture *picture, QString picPath, bool readOk);
void setSnapmaticPicture(SnapmaticPicture *picture, QString picPath);
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk, bool indexed, int index);
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk, int index);
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk);
void setSnapmaticPicture(SnapmaticPicture *picture, int index);
......
......@@ -188,9 +188,6 @@
<property name="text">
<string>&amp;Close</string>
</property>
<property name="icon">
<iconset theme="dialog-close"/>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
......
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping
* Copyright (C) 2016-2017 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -33,7 +33,7 @@ PictureExport::PictureExport()
}
void PictureExport::exportPicture(QWidget *parent, SnapmaticPicture *picture)
void PictureExport::exportAsPicture(QWidget *parent, SnapmaticPicture *picture)
{
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
......@@ -69,11 +69,12 @@ void PictureExport::exportPicture(QWidget *parent, SnapmaticPicture *picture)
}
QString sizeMode = settings.value("ExportSizeMode", "Default").toString();
Qt::AspectRatioMode aspectRatio = (Qt::AspectRatioMode)settings.value("AspectRatio", Qt::KeepAspectRatio).toInt();
QString defaultExportFormat = settings.value("DefaultExportFormat", ".jpg").toString();
settings.endGroup();
// End Picture Settings
settings.beginGroup("FileDialogs");
settings.beginGroup("ExportPicture");
settings.beginGroup("ExportAsPicture");
fileDialogPreSave:
QFileDialog fileDialog(parent);
......@@ -98,7 +99,7 @@ fileDialogPreSave:
fileDialog.setDirectory(settings.value("Directory", StandardPaths::picturesLocation()).toString());
fileDialog.restoreGeometry(settings.value(parent->objectName() + "+Geomtery", "").toByteArray());
QString newPictureFileName = getPictureFileName(picture);
QString newPictureFileName = getPictureFileName(picture) + defaultExportFormat;
fileDialog.selectFile(newPictureFileName);
if (fileDialog.exec())
......@@ -154,7 +155,7 @@ fileDialogPreSave:
}
// Scale Picture
QImage exportPicture = picture->getPicture();
QImage exportPicture = picture->getImage();
if (sizeMode == "Desktop")
{
QRect desktopResolution = QApplication::desktop()->screenGeometry();
......@@ -194,6 +195,115 @@ fileDialogPreSave:
settings.endGroup();
}
void PictureExport::exportAsSnapmatic(QWidget *parent, SnapmaticPicture *picture)
{
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
settings.beginGroup("FileDialogs");
settings.beginGroup("ExportAsSnapmatic");
QString adjustedPicPath = picture->getPictureFileName();
if (adjustedPicPath.right(7) == ".hidden") // for the hidden file system
{
adjustedPicPath.remove(adjustedPicPath.length() - 7, 7);
}
fileDialogPreSave:
QFileInfo sgdFileInfo(adjustedPicPath);
QFileDialog fileDialog(parent);
fileDialog.setFileMode(QFileDialog::AnyFile);
fileDialog.setViewMode(QFileDialog::Detail);
fileDialog.setAcceptMode(QFileDialog::AcceptSave);
fileDialog.setOption(QFileDialog::DontUseNativeDialog, false);
fileDialog.setOption(QFileDialog::DontConfirmOverwrite, true);
fileDialog.setDefaultSuffix(".rem");
fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
fileDialog.setWindowTitle(PictureDialog::tr("Export as GTA Snapmatic..."));
fileDialog.setLabelText(QFileDialog::Accept, PictureDialog::tr("&Export"));
QStringList filters;
filters << PictureDialog::tr("GTA V Export (*.g5e)");
filters << PictureDialog::tr("GTA V Raw Export (*.auto)");
filters << PictureDialog::tr("Snapmatic pictures (PGTA*)");
fileDialog.setNameFilters(filters);
QList<QUrl> sidebarUrls = SidebarGenerator::generateSidebarUrls(fileDialog.sidebarUrls());
fileDialog.setSidebarUrls(sidebarUrls);
fileDialog.setDirectory(settings.value("Directory", StandardPaths::documentsLocation()).toString());
fileDialog.selectFile(QString(picture->getExportPictureFileName() + ".g5e"));
fileDialog.restoreGeometry(settings.value(parent->objectName() + "+Geomtery", "").toByteArray());
if (fileDialog.exec())
{
QStringList selectedFiles = fileDialog.selectedFiles();
if (selectedFiles.length() == 1)