more work towards supporting RDR 2, some export changes
This commit is contained in:
parent
d6968792aa
commit
e7721404b6
10 changed files with 302 additions and 610 deletions
|
@ -78,6 +78,13 @@ QString AppEnv::getGTAVFolder(bool *ok)
|
||||||
GTAV_returnFolder = settings.value("dir", GTAV_defaultFolder).toString();
|
GTAV_returnFolder = settings.value("dir", GTAV_defaultFolder).toString();
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
|
settings.beginGroup("GameDirectory");
|
||||||
|
settings.beginGroup("GTA V");
|
||||||
|
forceDir = settings.value("ForceCustom", forceDir).toBool();
|
||||||
|
GTAV_returnFolder = settings.value("Directory", GTAV_returnFolder).toString();
|
||||||
|
settings.endGroup();
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
if (forceDir) {
|
if (forceDir) {
|
||||||
dir.setPath(GTAV_returnFolder);
|
dir.setPath(GTAV_returnFolder);
|
||||||
if (dir.exists()) {
|
if (dir.exists()) {
|
||||||
|
@ -108,13 +115,63 @@ QString AppEnv::getGTAVFolder(bool *ok)
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AppEnv::setGTAVFolder(QString gameFolder)
|
QString AppEnv::getRDR2Folder(bool *ok)
|
||||||
{
|
{
|
||||||
QDir dir;
|
QDir dir;
|
||||||
dir.setPath(gameFolder);
|
QString RDR2_FOLDER = QString::fromUtf8(qgetenv("RDR2_FOLDER"));
|
||||||
if (dir.exists())
|
if (!RDR2_FOLDER.isEmpty()) {
|
||||||
return true;
|
dir.setPath(RDR2_FOLDER);
|
||||||
return false;
|
if (dir.exists()) {
|
||||||
|
if (ok)
|
||||||
|
*ok = true;
|
||||||
|
return dir.absolutePath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef Q_OS_UNIX
|
||||||
|
// TODO: Try to locate the Steam Proton RDR 2 folder
|
||||||
|
const QString RDR2_defaultFolder = StandardPaths::documentsLocation() % "/Rockstar Games/Red Dead Redemption 2";
|
||||||
|
#else
|
||||||
|
const QString RDR2_defaultFolder = StandardPaths::documentsLocation() % "/Rockstar Games/Red Dead Redemption 2";
|
||||||
|
#endif
|
||||||
|
QString RDR2_returnFolder = RDR2_defaultFolder;
|
||||||
|
|
||||||
|
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
|
settings.beginGroup("GameDirectory");
|
||||||
|
settings.beginGroup("RDR 2");
|
||||||
|
bool forceDir = settings.value("ForceCustom", false).toBool();
|
||||||
|
RDR2_returnFolder = settings.value("Directory", RDR2_defaultFolder).toString();
|
||||||
|
settings.endGroup();
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
|
if (forceDir) {
|
||||||
|
dir.setPath(RDR2_returnFolder);
|
||||||
|
if (dir.exists()) {
|
||||||
|
if (ok)
|
||||||
|
*ok = true;
|
||||||
|
return dir.absolutePath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dir.setPath(RDR2_defaultFolder);
|
||||||
|
if (dir.exists()) {
|
||||||
|
if (ok)
|
||||||
|
*ok = true;
|
||||||
|
return dir.absolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!forceDir) {
|
||||||
|
dir.setPath(RDR2_returnFolder);
|
||||||
|
if (dir.exists()) {
|
||||||
|
if (ok)
|
||||||
|
*ok = true;
|
||||||
|
return dir.absolutePath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
*ok = false;
|
||||||
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AppEnv::getExLangFolder()
|
QString AppEnv::getExLangFolder()
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
|
|
||||||
// Folder Stuff
|
// Folder Stuff
|
||||||
static QString getGTAVFolder(bool *ok = 0);
|
static QString getGTAVFolder(bool *ok = 0);
|
||||||
static bool setGTAVFolder(QString gameFolder);
|
static QString getRDR2Folder(bool *ok = 0);
|
||||||
static QString getExLangFolder();
|
static QString getExLangFolder();
|
||||||
static QString getInLangFolder();
|
static QString getInLangFolder();
|
||||||
static QString getImagesFolder();
|
static QString getImagesFolder();
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QSaveFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
|
@ -38,122 +39,50 @@
|
||||||
ExportThread::ExportThread(QMap<ProfileWidget*,QString> profileMap, QString exportDirectory, bool pictureCopyEnabled, bool pictureExportEnabled, int exportCount, QObject *parent) : QThread(parent),
|
ExportThread::ExportThread(QMap<ProfileWidget*,QString> profileMap, QString exportDirectory, bool pictureCopyEnabled, bool pictureExportEnabled, int exportCount, QObject *parent) : QThread(parent),
|
||||||
profileMap(profileMap), exportDirectory(exportDirectory), pictureCopyEnabled(pictureCopyEnabled), pictureExportEnabled(pictureExportEnabled), exportCount(exportCount)
|
profileMap(profileMap), exportDirectory(exportDirectory), pictureCopyEnabled(pictureCopyEnabled), pictureExportEnabled(pictureExportEnabled), exportCount(exportCount)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExportThread::run()
|
void ExportThread::run()
|
||||||
{
|
{
|
||||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
size_t intExportProgress = 0;
|
||||||
|
for (ProfileWidget *widget : profileMap.keys()) {
|
||||||
// Picture Settings
|
if (widget->isSelected()) {
|
||||||
// Quality Settings
|
if (widget->getWidgetType() == "SnapmaticWidget") {
|
||||||
settings.beginGroup("Pictures");
|
|
||||||
int defaultQuality = 100;
|
|
||||||
int customQuality = settings.value("CustomQuality", defaultQuality).toInt();
|
|
||||||
if (customQuality < 1 || customQuality > 100)
|
|
||||||
customQuality = 100;
|
|
||||||
bool useCustomQuality = settings.value("CustomQualityEnabled", false).toBool();
|
|
||||||
|
|
||||||
// Size Settings
|
|
||||||
const QSize defExportSize = QSize(960, 536);
|
|
||||||
QSize cusExportSize = settings.value("CustomSize", defExportSize).toSize();
|
|
||||||
if (cusExportSize.width() > 7680) {
|
|
||||||
cusExportSize.setWidth(7680);
|
|
||||||
}
|
|
||||||
else if (cusExportSize.height() > 4320) {
|
|
||||||
cusExportSize.setHeight(4320);
|
|
||||||
}
|
|
||||||
if (cusExportSize.width() < 1) {
|
|
||||||
cusExportSize.setWidth(1);
|
|
||||||
}
|
|
||||||
else if (cusExportSize.height() < 1) {
|
|
||||||
cusExportSize.setHeight(1);
|
|
||||||
}
|
|
||||||
QString sizeMode = settings.value("ExportSizeMode", "Default").toString();
|
|
||||||
Qt::AspectRatioMode aspectRatio = (Qt::AspectRatioMode)settings.value("AspectRatio", Qt::KeepAspectRatio).toInt();
|
|
||||||
settings.endGroup();
|
|
||||||
// End Picture Settings
|
|
||||||
|
|
||||||
int intExportProgress = 0;
|
|
||||||
for (ProfileWidget *widget : profileMap.keys())
|
|
||||||
{
|
|
||||||
if (widget->isSelected())
|
|
||||||
{
|
|
||||||
if (widget->getWidgetType() == "SnapmaticWidget")
|
|
||||||
{
|
|
||||||
SnapmaticWidget *picWidget = qobject_cast<SnapmaticWidget*>(widget);
|
SnapmaticWidget *picWidget = qobject_cast<SnapmaticWidget*>(widget);
|
||||||
SnapmaticPicture *picture = picWidget->getPicture();
|
SnapmaticPicture *picture = picWidget->getPicture();
|
||||||
|
|
||||||
if (pictureExportEnabled)
|
if (pictureExportEnabled) {
|
||||||
{
|
|
||||||
QString exportFileName = PictureExport::getPictureFileName(picture);
|
QString exportFileName = PictureExport::getPictureFileName(picture);
|
||||||
if (exportFileName.right(4) != ".jpg" && exportFileName.right(4) != ".png")
|
if (!exportFileName.endsWith(".jpg"))
|
||||||
{
|
|
||||||
exportFileName += ".jpg";
|
exportFileName += ".jpg";
|
||||||
}
|
|
||||||
|
|
||||||
intExportProgress++;
|
intExportProgress++;
|
||||||
emit exportStringUpdate(ProfileInterface::tr("Export file %1 of %2 files").arg(QString::number(intExportProgress), QString::number(exportCount)));
|
emit exportStringUpdate(ProfileInterface::tr("Export file %1 of %2 files").arg(QString::number(intExportProgress), QString::number(exportCount)));
|
||||||
emit exportProgressUpdate(intExportProgress);
|
emit exportProgressUpdate(intExportProgress);
|
||||||
|
|
||||||
// Scale Picture
|
QSaveFile exportFile(exportDirectory % "/" % exportFileName);
|
||||||
QImage exportPicture = picture->getImage();
|
exportFile.write(picture->getPictureStream());
|
||||||
if (sizeMode == "Desktop")
|
bool isSaved = exportFile.commit();
|
||||||
{
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
qreal screenRatioPR = AppEnv::screenRatioPR();
|
|
||||||
QRect desktopResolution = QApplication::primaryScreen()->geometry();
|
|
||||||
int desktopSizeWidth = qRound((double)desktopResolution.width() * screenRatioPR);
|
|
||||||
int desktopSizeHeight = qRound((double)desktopResolution.height() * screenRatioPR);
|
|
||||||
#else
|
|
||||||
QRect desktopResolution = QApplication::desktop()->screenGeometry();
|
|
||||||
int desktopSizeWidth = desktopResolution.width();
|
|
||||||
int desktopSizeHeight = desktopResolution.height();
|
|
||||||
#endif
|
|
||||||
exportPicture = exportPicture.scaled(desktopSizeWidth, desktopSizeHeight, aspectRatio, Qt::SmoothTransformation);
|
|
||||||
}
|
|
||||||
else if (sizeMode == "Custom")
|
|
||||||
{
|
|
||||||
exportPicture = exportPicture.scaled(cusExportSize, aspectRatio, Qt::SmoothTransformation);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isSaved;
|
|
||||||
if (useCustomQuality)
|
|
||||||
{
|
|
||||||
isSaved = exportPicture.save(exportDirectory % "/" % exportFileName, "JPEG", customQuality);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
isSaved = exportPicture.save(exportDirectory % "/" % exportFileName, "JPEG", 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isSaved)
|
if (!isSaved)
|
||||||
{
|
|
||||||
failedExportPictures += exportFileName;
|
failedExportPictures += exportFileName;
|
||||||
}
|
}
|
||||||
}
|
if (pictureCopyEnabled) {
|
||||||
if (pictureCopyEnabled)
|
|
||||||
{
|
|
||||||
QString exportFileName = PictureExport::getPictureFileName(picture);
|
QString exportFileName = PictureExport::getPictureFileName(picture);
|
||||||
if (exportFileName.right(4) != ".g5e")
|
if (!exportFileName.endsWith(".g5e"))
|
||||||
{
|
|
||||||
exportFileName += ".g5e";
|
exportFileName += ".g5e";
|
||||||
}
|
|
||||||
|
|
||||||
intExportProgress++;
|
intExportProgress++;
|
||||||
emit exportStringUpdate(ProfileInterface::tr("Export file %1 of %2 files").arg(QString::number(intExportProgress), QString::number(exportCount)));
|
emit exportStringUpdate(ProfileInterface::tr("Export file %1 of %2 files").arg(QString::number(intExportProgress), QString::number(exportCount)));
|
||||||
emit exportProgressUpdate(intExportProgress);
|
emit exportProgressUpdate(intExportProgress);
|
||||||
|
|
||||||
QString exportFilePath = exportDirectory % "/" % exportFileName;
|
QString exportFilePath = exportDirectory % "/" % exportFileName;
|
||||||
if (QFile::exists(exportFilePath)) {QFile::remove(exportFilePath);}
|
if (QFile::exists(exportFilePath))
|
||||||
|
QFile::remove(exportFilePath);
|
||||||
if (!picture->exportPicture(exportDirectory % "/" % exportFileName, SnapmaticFormat::G5E_Format))
|
if (!picture->exportPicture(exportDirectory % "/" % exportFileName, SnapmaticFormat::G5E_Format))
|
||||||
{
|
|
||||||
failedCopyPictures += exportFileName;
|
failedCopyPictures += exportFileName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (widget->getWidgetType() == "SavegameWidget") {
|
||||||
else if (widget->getWidgetType() == "SavegameWidget")
|
|
||||||
{
|
|
||||||
SavegameWidget *sgdWidget = qobject_cast<SavegameWidget*>(widget);
|
SavegameWidget *sgdWidget = qobject_cast<SavegameWidget*>(widget);
|
||||||
SavegameData *savegame = sgdWidget->getSavegame();
|
SavegameData *savegame = sgdWidget->getSavegame();
|
||||||
|
|
||||||
|
@ -166,14 +95,13 @@ void ExportThread::run()
|
||||||
emit exportProgressUpdate(intExportProgress);
|
emit exportProgressUpdate(intExportProgress);
|
||||||
|
|
||||||
QString exportFilePath = exportDirectory % "/" % exportFileName;
|
QString exportFilePath = exportDirectory % "/" % exportFileName;
|
||||||
if (QFile::exists(exportFilePath)) {QFile::remove(exportFilePath);}
|
if (QFile::exists(exportFilePath))
|
||||||
|
QFile::remove(exportFilePath);
|
||||||
if (!QFile::copy(originalFileName, exportFilePath))
|
if (!QFile::copy(originalFileName, exportFilePath))
|
||||||
{
|
|
||||||
failedSavegames += exportFileName;
|
failedSavegames += exportFileName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
emit exportFinished();
|
emit exportFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,26 +60,10 @@ OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
|
||||||
// Setup User Interface
|
// Setup User Interface
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->tabWidget->setCurrentIndex(0);
|
ui->tabWidget->setCurrentIndex(0);
|
||||||
ui->labPicCustomRes->setVisible(false);
|
|
||||||
ui->cmdCancel->setDefault(true);
|
ui->cmdCancel->setDefault(true);
|
||||||
ui->cmdCancel->setFocus();
|
ui->cmdCancel->setFocus();
|
||||||
|
|
||||||
qreal screenRatioPR = AppEnv::screenRatioPR();
|
qreal screenRatioPR = AppEnv::screenRatioPR();
|
||||||
QRect desktopResolution = QApplication::primaryScreen()->geometry();
|
|
||||||
int desktopSizeWidth = qRound((double)desktopResolution.width() * screenRatioPR);
|
|
||||||
int desktopSizeHeight = qRound((double)desktopResolution.height() * screenRatioPR);
|
|
||||||
aspectRatio = Qt::KeepAspectRatio;
|
|
||||||
defExportSize = QSize(960, 536);
|
|
||||||
cusExportSize = defExportSize;
|
|
||||||
defaultQuality = 100;
|
|
||||||
customQuality = 100;
|
|
||||||
contentMode = 0;
|
|
||||||
settings = new QSettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
|
||||||
|
|
||||||
percentString = ui->labPicQuality->text();
|
|
||||||
ui->labPicQuality->setText(percentString.arg(QString::number(defaultQuality)));
|
|
||||||
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())));
|
|
||||||
|
|
||||||
// Set Icon for OK Button
|
// Set Icon for OK Button
|
||||||
if (QIcon::hasThemeIcon("dialog-ok")) {
|
if (QIcon::hasThemeIcon("dialog-ok")) {
|
||||||
|
@ -102,15 +86,15 @@ OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
|
||||||
ui->cmdCopyStatsID->setIcon(QIcon::fromTheme("edit-copy"));
|
ui->cmdCopyStatsID->setIcon(QIcon::fromTheme("edit-copy"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
setupTreeWidget();
|
setupTreeWidget();
|
||||||
setupLanguageBox();
|
setupLanguageBox(&settings);
|
||||||
setupRadioButtons();
|
setupRadioButtons(&settings);
|
||||||
setupDefaultProfile();
|
setupDefaultProfile(&settings);
|
||||||
setupPictureSettings();
|
setupCustomGameFolder(&settings);
|
||||||
setupCustomGTAFolder();
|
setupInterfaceSettings(&settings);
|
||||||
setupInterfaceSettings();
|
setupStatisticsSettings(&settings);
|
||||||
setupStatisticsSettings();
|
setupSnapmaticPictureViewer(&settings);
|
||||||
setupSnapmaticPictureViewer();
|
|
||||||
setupWindowsGameSettings();
|
setupWindowsGameSettings();
|
||||||
|
|
||||||
#ifndef Q_QS_ANDROID
|
#ifndef Q_QS_ANDROID
|
||||||
|
@ -126,7 +110,6 @@ OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
|
||||||
|
|
||||||
OptionsDialog::~OptionsDialog()
|
OptionsDialog::~OptionsDialog()
|
||||||
{
|
{
|
||||||
delete settings;
|
|
||||||
qDeleteAll(playerItems.begin(), playerItems.end());
|
qDeleteAll(playerItems.begin(), playerItems.end());
|
||||||
playerItems.clear();
|
playerItems.clear();
|
||||||
delete ui;
|
delete ui;
|
||||||
|
@ -158,7 +141,7 @@ void OptionsDialog::setupTreeWidget()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsDialog::setupLanguageBox()
|
void OptionsDialog::setupLanguageBox(QSettings *settings)
|
||||||
{
|
{
|
||||||
settings->beginGroup("Interface");
|
settings->beginGroup("Interface");
|
||||||
currentLanguage = settings->value("Language", "System").toString();
|
currentLanguage = settings->value("Language", "System").toString();
|
||||||
|
@ -259,7 +242,7 @@ void OptionsDialog::setupLanguageBox()
|
||||||
ui->labCurrentAreaLanguage->setText(tr("Current: %1").arg(currentLocale.nativeLanguageName() % " (" % currentLocale.nativeCountryName() % ") [" % aCurrentAreaLanguage % "]"));
|
ui->labCurrentAreaLanguage->setText(tr("Current: %1").arg(currentLocale.nativeLanguageName() % " (" % currentLocale.nativeCountryName() % ") [" % aCurrentAreaLanguage % "]"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsDialog::setupRadioButtons()
|
void OptionsDialog::setupRadioButtons(QSettings *settings)
|
||||||
{
|
{
|
||||||
bool contentModeOk;
|
bool contentModeOk;
|
||||||
settings->beginGroup("Profile");
|
settings->beginGroup("Profile");
|
||||||
|
@ -291,7 +274,7 @@ void OptionsDialog::setupRadioButtons()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsDialog::setupInterfaceSettings()
|
void OptionsDialog::setupInterfaceSettings(QSettings *settings)
|
||||||
{
|
{
|
||||||
settings->beginGroup("Startup");
|
settings->beginGroup("Startup");
|
||||||
const QString currentStyle = QApplication::style()->objectName();
|
const QString currentStyle = QApplication::style()->objectName();
|
||||||
|
@ -339,24 +322,25 @@ void OptionsDialog::on_cmdOK_clicked()
|
||||||
|
|
||||||
void OptionsDialog::applySettings()
|
void OptionsDialog::applySettings()
|
||||||
{
|
{
|
||||||
settings->beginGroup("Interface");
|
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
|
settings.beginGroup("Interface");
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
settings->setValue("Language", ui->cbLanguage->currentData());
|
settings.setValue("Language", ui->cbLanguage->currentData());
|
||||||
settings->setValue("AreaLanguage", ui->cbAreaLanguage->currentData());
|
settings.setValue("AreaLanguage", ui->cbAreaLanguage->currentData());
|
||||||
#else
|
#else
|
||||||
settings->setValue("Language", ui->cbLanguage->itemData(ui->cbLanguage->currentIndex()));
|
settings->setValue("Language", ui->cbLanguage->itemData(ui->cbLanguage->currentIndex()));
|
||||||
settings->setValue("AreaLanguage", ui->cbAreaLanguage->itemData(ui->cbAreaLanguage->currentIndex()));
|
settings->setValue("AreaLanguage", ui->cbAreaLanguage->itemData(ui->cbAreaLanguage->currentIndex()));
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#if QT_VERSION >= 0x050200
|
#if QT_VERSION >= 0x050200
|
||||||
settings->setValue("NavigationBar", ui->cbSnapmaticNavigationBar->isChecked());
|
settings.setValue("NavigationBar", ui->cbSnapmaticNavigationBar->isChecked());
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
settings->setValue("NavigationBar", ui->cbSnapmaticNavigationBar->isChecked());
|
settings.setValue("NavigationBar", ui->cbSnapmaticNavigationBar->isChecked());
|
||||||
#endif
|
#endif
|
||||||
settings->endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings->beginGroup("Profile");
|
settings.beginGroup("Profile");
|
||||||
int newContentMode = 20;
|
int newContentMode = 20;
|
||||||
if (ui->rbModern->isChecked()) {
|
if (ui->rbModern->isChecked()) {
|
||||||
newContentMode = 20;
|
newContentMode = 20;
|
||||||
|
@ -367,66 +351,56 @@ void OptionsDialog::applySettings()
|
||||||
if (ui->cbDoubleclick->isChecked()) {
|
if (ui->cbDoubleclick->isChecked()) {
|
||||||
newContentMode++;
|
newContentMode++;
|
||||||
}
|
}
|
||||||
settings->setValue("ContentMode", newContentMode);
|
settings.setValue("ContentMode", newContentMode);
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
settings->setValue("Default", ui->cbProfiles->currentData());
|
settings.setValue("Default", ui->cbProfiles->currentData());
|
||||||
#else
|
#else
|
||||||
settings->setValue("Default", ui->cbProfiles->itemData(ui->cbProfiles->currentIndex()));
|
settings->setValue("Default", ui->cbProfiles->itemData(ui->cbProfiles->currentIndex()));
|
||||||
#endif
|
#endif
|
||||||
settings->endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings->beginGroup("Pictures");
|
const bool forceCustomFolder = ui->cbForceCustomFolder->isChecked();
|
||||||
if (ui->cbPicCustomQuality->isChecked()) {
|
const bool forceCustomFolder_RDR2 = ui->cbForceCustomFolder_RDR2->isChecked();
|
||||||
settings->setValue("CustomQuality", ui->hsPicQuality->value());
|
settings.beginGroup("GameDirectory");
|
||||||
}
|
settings.beginGroup("GTA V");
|
||||||
settings->setValue("CustomQualityEnabled", ui->cbPicCustomQuality->isChecked());
|
settings.setValue("Directory", ui->txtFolder->text());
|
||||||
QString sizeMode = "Default";
|
settings.setValue("ForceCustom", forceCustomFolder);
|
||||||
if (ui->rbPicDesktopRes->isChecked()) {
|
settings.endGroup();
|
||||||
sizeMode = "Desktop";
|
settings.beginGroup("RDR 2");
|
||||||
}
|
settings.setValue("Directory", ui->txtFolder_RDR2->text());
|
||||||
else if (ui->rbPicCustomRes->isChecked()) {
|
settings.setValue("ForceCustom", forceCustomFolder_RDR2);
|
||||||
sizeMode = "Custom";
|
settings.endGroup();
|
||||||
settings->setValue("CustomSize", QSize(ui->sbPicExportWidth->value(), ui->sbPicExportHeight->value()));
|
settings.endGroup();
|
||||||
}
|
|
||||||
settings->setValue("ExportSizeMode", sizeMode);
|
|
||||||
settings->setValue("AspectRatio", aspectRatio);
|
|
||||||
settings->endGroup();
|
|
||||||
|
|
||||||
bool forceCustomFolder = ui->cbForceCustomFolder->isChecked();
|
const bool defaultStyle = ui->cbDefaultStyle->isChecked();
|
||||||
settings->beginGroup("dir");
|
settings.beginGroup("Startup");
|
||||||
settings->setValue("dir", ui->txtFolder->text());
|
|
||||||
settings->setValue("force", forceCustomFolder);
|
|
||||||
settings->endGroup();
|
|
||||||
|
|
||||||
bool defaultStyle = ui->cbDefaultStyle->isChecked();
|
|
||||||
settings->beginGroup("Startup");
|
|
||||||
if (!defaultStyle) {
|
if (!defaultStyle) {
|
||||||
QString newStyle = ui->cbStyleList->currentText();
|
QString newStyle = ui->cbStyleList->currentText();
|
||||||
settings->setValue("CustomStyle", true);
|
settings.setValue("CustomStyle", true);
|
||||||
settings->setValue("AppStyle", newStyle);
|
settings.setValue("AppStyle", newStyle);
|
||||||
QApplication::setStyle(QStyleFactory::create(newStyle));
|
QApplication::setStyle(QStyleFactory::create(newStyle));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
settings->setValue("CustomStyle", false);
|
settings.setValue("CustomStyle", false);
|
||||||
}
|
}
|
||||||
bool defaultFont = ui->cbDefaultFont->isChecked();
|
const bool defaultFont = ui->cbDefaultFont->isChecked();
|
||||||
if (!defaultFont) {
|
if (!defaultFont) {
|
||||||
QFont newFont = ui->cbFont->currentFont();
|
QFont newFont = ui->cbFont->currentFont();
|
||||||
settings->setValue("CustomFont", true);
|
settings.setValue("CustomFont", true);
|
||||||
settings->setValue("AppFont", newFont);
|
settings.setValue("AppFont", newFont);
|
||||||
QApplication::setFont(newFont);
|
QApplication::setFont(newFont);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
settings->setValue("CustomFont", false);
|
settings.setValue("CustomFont", false);
|
||||||
}
|
}
|
||||||
settings->endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
#ifdef GTA5SYNC_TELEMETRY
|
#ifdef GTA5SYNC_TELEMETRY
|
||||||
settings->beginGroup("Telemetry");
|
settings.beginGroup("Telemetry");
|
||||||
settings->setValue("PushAppConf", ui->cbAppConfigStats->isChecked());
|
settings.setValue("PushAppConf", ui->cbAppConfigStats->isChecked());
|
||||||
settings->setValue("PushUsageData", ui->cbUsageData->isChecked());
|
settings.setValue("PushUsageData", ui->cbUsageData->isChecked());
|
||||||
if (!Telemetry->isStateForced()) { settings->setValue("IsEnabled", ui->cbParticipateStats->isChecked()); }
|
if (!Telemetry->isStateForced()) { settings.setValue("IsEnabled", ui->cbParticipateStats->isChecked()); }
|
||||||
settings->endGroup();
|
settings.endGroup();
|
||||||
Telemetry->refresh();
|
Telemetry->refresh();
|
||||||
Telemetry->work();
|
Telemetry->work();
|
||||||
if (ui->cbUsageData->isChecked() && Telemetry->canPush()) {
|
if (ui->cbUsageData->isChecked() && Telemetry->canPush()) {
|
||||||
|
@ -459,7 +433,7 @@ void OptionsDialog::applySettings()
|
||||||
Translator->initUserLanguage();
|
Translator->initUserLanguage();
|
||||||
}
|
}
|
||||||
|
|
||||||
settings->sync();
|
settings.sync();
|
||||||
emit settingsApplied(newContentMode, languageChanged);
|
emit settingsApplied(newContentMode, languageChanged);
|
||||||
|
|
||||||
if ((forceCustomFolder && ui->txtFolder->text() != currentCFolder) || (forceCustomFolder != currentFFolder && forceCustomFolder)) {
|
if ((forceCustomFolder && ui->txtFolder->text() != currentCFolder) || (forceCustomFolder != currentFFolder && forceCustomFolder)) {
|
||||||
|
@ -467,14 +441,14 @@ void OptionsDialog::applySettings()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsDialog::setupDefaultProfile()
|
void OptionsDialog::setupDefaultProfile(QSettings *settings)
|
||||||
{
|
{
|
||||||
settings->beginGroup("Profile");
|
settings->beginGroup("Profile");
|
||||||
defaultProfile = settings->value("Default", "").toString();
|
defaultProfile = settings->value("Default", QString()).toString();
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
|
|
||||||
QString cbNoneStr = tr("No Profile", "No Profile, as default");
|
QString cbNoneStr = tr("No Profile", "No Profile, as default");
|
||||||
ui->cbProfiles->addItem(cbNoneStr, "");
|
ui->cbProfiles->addItem(cbNoneStr, QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsDialog::commitProfiles(const QStringList &profiles)
|
void OptionsDialog::commitProfiles(const QStringList &profiles)
|
||||||
|
@ -492,77 +466,7 @@ void OptionsDialog::commitProfiles(const QStringList &profiles)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsDialog::on_rbPicCustomRes_toggled(bool checked)
|
void OptionsDialog::setupStatisticsSettings(QSettings *settings)
|
||||||
{
|
|
||||||
ui->labPicCustomRes->setEnabled(checked);
|
|
||||||
ui->sbPicExportWidth->setEnabled(checked);
|
|
||||||
ui->sbPicExportHeight->setEnabled(checked);
|
|
||||||
ui->labPicXDescription->setEnabled(checked);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OptionsDialog::on_cbPicCustomQuality_toggled(bool checked)
|
|
||||||
{
|
|
||||||
ui->hsPicQuality->setEnabled(checked);
|
|
||||||
ui->labPicQuality->setEnabled(checked);
|
|
||||||
ui->labPicQualityDescription->setEnabled(checked);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OptionsDialog::on_hsPicQuality_valueChanged(int value)
|
|
||||||
{
|
|
||||||
customQuality = value;
|
|
||||||
ui->labPicQuality->setText(percentString.arg(QString::number(value)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void OptionsDialog::setupPictureSettings()
|
|
||||||
{
|
|
||||||
settings->beginGroup("Pictures");
|
|
||||||
|
|
||||||
// Quality Settings
|
|
||||||
customQuality = settings->value("CustomQuality", defaultQuality).toInt();
|
|
||||||
if (customQuality < 1 || customQuality > 100)
|
|
||||||
customQuality = 100;
|
|
||||||
ui->hsPicQuality->setValue(customQuality);
|
|
||||||
ui->cbPicCustomQuality->setChecked(settings->value("CustomQualityEnabled", false).toBool());
|
|
||||||
|
|
||||||
// Size Settings
|
|
||||||
cusExportSize = settings->value("CustomSize", defExportSize).toSize();
|
|
||||||
if (cusExportSize.width() > 7680) {
|
|
||||||
cusExportSize.setWidth(7680);
|
|
||||||
}
|
|
||||||
else if (cusExportSize.height() > 4320) {
|
|
||||||
cusExportSize.setHeight(4320);
|
|
||||||
}
|
|
||||||
if (cusExportSize.width() < 1) {
|
|
||||||
cusExportSize.setWidth(1);
|
|
||||||
}
|
|
||||||
else if (cusExportSize.height() < 1) {
|
|
||||||
cusExportSize.setHeight(1);
|
|
||||||
}
|
|
||||||
ui->sbPicExportWidth->setMaximum(7680);
|
|
||||||
ui->sbPicExportWidth->setValue(cusExportSize.width());
|
|
||||||
ui->sbPicExportHeight->setMaximum(4320);
|
|
||||||
ui->sbPicExportHeight->setValue(cusExportSize.height());
|
|
||||||
|
|
||||||
QString sizeMode = settings->value("ExportSizeMode", "Default").toString();
|
|
||||||
if (sizeMode == "Desktop") {
|
|
||||||
ui->rbPicDesktopRes->setChecked(true);
|
|
||||||
}
|
|
||||||
else if (sizeMode == "Custom") {
|
|
||||||
ui->rbPicCustomRes->setChecked(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ui->rbPicDefaultRes->setChecked(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
aspectRatio = static_cast<Qt::AspectRatioMode>(settings->value("AspectRatio", Qt::KeepAspectRatio).toInt());
|
|
||||||
if (aspectRatio == Qt::IgnoreAspectRatio) {
|
|
||||||
ui->cbIgnoreAspectRatio->setChecked(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
settings->endGroup();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OptionsDialog::setupStatisticsSettings()
|
|
||||||
{
|
{
|
||||||
#ifdef GTA5SYNC_TELEMETRY
|
#ifdef GTA5SYNC_TELEMETRY
|
||||||
ui->cbParticipateStats->setText(tr("Participate in %1 User Statistics").arg(GTA5SYNC_APPSTR));
|
ui->cbParticipateStats->setText(tr("Participate in %1 User Statistics").arg(GTA5SYNC_APPSTR));
|
||||||
|
@ -648,32 +552,36 @@ void OptionsDialog::setupWindowsGameSettings()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsDialog::on_cbIgnoreAspectRatio_toggled(bool checked)
|
void OptionsDialog::setupCustomGameFolder(QSettings *settings)
|
||||||
{
|
{
|
||||||
if (checked) {
|
bool ok_GTAV, ok_RDR2;
|
||||||
aspectRatio = Qt::IgnoreAspectRatio;
|
const QString defaultGameFolder = AppEnv::getGTAVFolder(&ok_GTAV);
|
||||||
}
|
const QString defaultGameFolderR = AppEnv::getRDR2Folder(&ok_RDR2);
|
||||||
else {
|
|
||||||
aspectRatio = Qt::KeepAspectRatio;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OptionsDialog::setupCustomGTAFolder()
|
|
||||||
{
|
|
||||||
bool ok;
|
|
||||||
QString defaultGameFolder = AppEnv::getGTAVFolder(&ok);
|
|
||||||
settings->beginGroup("dir");
|
settings->beginGroup("dir");
|
||||||
currentCFolder = settings->value("dir", "").toString();
|
currentCFolder = settings->value("dir", QString()).toString();
|
||||||
currentFFolder = settings->value("force", false).toBool();
|
currentFFolder = settings->value("force", false).toBool();
|
||||||
if (currentCFolder == "" && ok) {
|
settings->endGroup();
|
||||||
|
settings->beginGroup("GameDirectory");
|
||||||
|
settings->beginGroup("GTA V");
|
||||||
|
currentCFolder = settings->value("Directory", currentCFolder).toString();
|
||||||
|
currentFFolder = settings->value("ForceCustom", currentFFolder).toBool();
|
||||||
|
settings->endGroup();
|
||||||
|
settings->beginGroup("RDR 2");
|
||||||
|
currentCFolderR = settings->value("Directory", QString()).toString();
|
||||||
|
currentFFolderR = settings->value("ForceCustom", false).toBool();
|
||||||
|
settings->endGroup();
|
||||||
|
settings->endGroup();
|
||||||
|
if (currentCFolder.isEmpty() && ok_GTAV)
|
||||||
currentCFolder = defaultGameFolder;
|
currentCFolder = defaultGameFolder;
|
||||||
}
|
if (currentCFolderR.isEmpty() && ok_RDR2)
|
||||||
|
currentCFolderR = defaultGameFolderR;
|
||||||
ui->txtFolder->setText(currentCFolder);
|
ui->txtFolder->setText(currentCFolder);
|
||||||
ui->cbForceCustomFolder->setChecked(currentFFolder);
|
ui->cbForceCustomFolder->setChecked(currentFFolder);
|
||||||
settings->endGroup();
|
ui->txtFolder_RDR2->setText(currentCFolderR);
|
||||||
|
ui->cbForceCustomFolder_RDR2->setChecked(currentFFolderR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsDialog::setupSnapmaticPictureViewer()
|
void OptionsDialog::setupSnapmaticPictureViewer(QSettings *settings)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#if QT_VERSION >= 0x050200
|
#if QT_VERSION >= 0x050200
|
||||||
|
|
|
@ -41,10 +41,6 @@ public:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_cmdOK_clicked();
|
void on_cmdOK_clicked();
|
||||||
void on_rbPicCustomRes_toggled(bool checked);
|
|
||||||
void on_cbPicCustomQuality_toggled(bool checked);
|
|
||||||
void on_hsPicQuality_valueChanged(int value);
|
|
||||||
void on_cbIgnoreAspectRatio_toggled(bool checked);
|
|
||||||
void on_cmdExploreFolder_clicked();
|
void on_cmdExploreFolder_clicked();
|
||||||
void on_cbDefaultStyle_toggled(bool checked);
|
void on_cbDefaultStyle_toggled(bool checked);
|
||||||
void on_cbDefaultFont_toggled(bool checked);
|
void on_cbDefaultFont_toggled(bool checked);
|
||||||
|
@ -63,25 +59,21 @@ private:
|
||||||
QString currentAreaLanguage;
|
QString currentAreaLanguage;
|
||||||
QString currentLanguage;
|
QString currentLanguage;
|
||||||
QString currentCFolder;
|
QString currentCFolder;
|
||||||
|
QString currentCFolderR;
|
||||||
QString defaultProfile;
|
QString defaultProfile;
|
||||||
QString percentString;
|
QString percentString;
|
||||||
QSettings *settings;
|
|
||||||
bool withoutPlayers;
|
bool withoutPlayers;
|
||||||
bool currentFFolder;
|
bool currentFFolder;
|
||||||
|
bool currentFFolderR;
|
||||||
int contentMode;
|
int contentMode;
|
||||||
int customQuality;
|
|
||||||
int defaultQuality;
|
|
||||||
QSize defExportSize;
|
|
||||||
QSize cusExportSize;
|
|
||||||
void setupTreeWidget();
|
void setupTreeWidget();
|
||||||
void setupLanguageBox();
|
void setupLanguageBox(QSettings *settings);
|
||||||
void setupRadioButtons();
|
void setupRadioButtons(QSettings *settings);
|
||||||
void setupDefaultProfile();
|
void setupDefaultProfile(QSettings *settings);
|
||||||
void setupPictureSettings();
|
void setupCustomGameFolder(QSettings *settings);
|
||||||
void setupCustomGTAFolder();
|
void setupInterfaceSettings(QSettings *settings);
|
||||||
void setupInterfaceSettings();
|
void setupStatisticsSettings(QSettings *settings);
|
||||||
void setupStatisticsSettings();
|
void setupSnapmaticPictureViewer(QSettings *settings);
|
||||||
void setupSnapmaticPictureViewer();
|
|
||||||
void setupWindowsGameSettings();
|
void setupWindowsGameSettings();
|
||||||
void applySettings();
|
void applySettings();
|
||||||
};
|
};
|
||||||
|
|
|
@ -102,6 +102,36 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="gbDefaultFolder_RDR2">
|
||||||
|
<property name="title">
|
||||||
|
<string>Custom RDR 2 Folder</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="vlCustomRDR2Folder">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbForceCustomFolder_RDR2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Force using Custom Folder</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="hlDefaultFolder_RDR2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="txtFolder_RDR2"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="cmdExploreFolder_RDR2">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="vsProfile">
|
<spacer name="vsProfile">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -122,181 +152,6 @@
|
||||||
<string>Pictures</string>
|
<string>Pictures</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="vlTabPictures">
|
<layout class="QVBoxLayout" name="vlTabPictures">
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="gbPicResolution">
|
|
||||||
<property name="title">
|
|
||||||
<string>Export Size</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="vlGbPicRes">
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="rbPicDefaultRes">
|
|
||||||
<property name="text">
|
|
||||||
<string>Default: %1x%2</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="rbPicDesktopRes">
|
|
||||||
<property name="text">
|
|
||||||
<string>Screen Resolution: %1x%2</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="hlCustomRes">
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="rbPicCustomRes">
|
|
||||||
<property name="text">
|
|
||||||
<string>Custom Size:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="labPicCustomRes">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Custom Size:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="sbPicExportWidth">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>3840</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>960</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="labPicXDescription">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>x</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="sbPicExportHeight">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>2160</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>536</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="hsPicCustomSize">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="hlAspectRatio">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="cbIgnoreAspectRatio">
|
|
||||||
<property name="text">
|
|
||||||
<string>Ignore Aspect Ratio</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="gbPicQuality">
|
|
||||||
<property name="title">
|
|
||||||
<string>Export Quality</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="vlHlPicQuality">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="cbPicCustomQuality">
|
|
||||||
<property name="text">
|
|
||||||
<string>Enable Custom Quality</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="hlPicQuality">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="labPicQualityDescription">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Quality:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSlider" name="hsPicQuality">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="labPicQuality">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>%1%</string>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="gbSnapmaticPictureViewer">
|
<widget class="QGroupBox" name="gbSnapmaticPictureViewer">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
|
|
@ -26,16 +26,9 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#if QT_VERSION < 0x050000
|
|
||||||
#include <QDesktopWidget>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
#include <QSaveFile>
|
#include <QSaveFile>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#endif
|
#include <QDebug>
|
||||||
|
|
||||||
PictureExport::PictureExport()
|
PictureExport::PictureExport()
|
||||||
{
|
{
|
||||||
|
@ -48,29 +41,6 @@ void PictureExport::exportAsPicture(QWidget *parent, SnapmaticPicture *picture)
|
||||||
// Picture Settings
|
// Picture Settings
|
||||||
// Quality Settings
|
// Quality Settings
|
||||||
settings.beginGroup("Pictures");
|
settings.beginGroup("Pictures");
|
||||||
int defaultQuality = 100;
|
|
||||||
int customQuality = settings.value("CustomQuality", defaultQuality).toInt();
|
|
||||||
if (customQuality < 1 || customQuality > 100)
|
|
||||||
customQuality = 100;
|
|
||||||
bool useCustomQuality = settings.value("CustomQualityEnabled", false).toBool();
|
|
||||||
|
|
||||||
// Size Settings
|
|
||||||
const QSize defExportSize = QSize(960, 536);
|
|
||||||
QSize cusExportSize = settings.value("CustomSize", defExportSize).toSize();
|
|
||||||
if (cusExportSize.width() > 7680) {
|
|
||||||
cusExportSize.setWidth(7680);
|
|
||||||
}
|
|
||||||
else if (cusExportSize.height() > 4320) {
|
|
||||||
cusExportSize.setHeight(4320);
|
|
||||||
}
|
|
||||||
if (cusExportSize.width() < 1) {
|
|
||||||
cusExportSize.setWidth(1);
|
|
||||||
}
|
|
||||||
else if (cusExportSize.height() < 1) {
|
|
||||||
cusExportSize.setHeight(1);
|
|
||||||
}
|
|
||||||
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();
|
QString defaultExportFormat = settings.value("DefaultExportFormat", ".jpg").toString();
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
// End Picture Settings
|
// End Picture Settings
|
||||||
|
@ -87,7 +57,7 @@ fileDialogPreSave: //Work?
|
||||||
fileDialog.setOption(QFileDialog::DontUseNativeDialog, dontUseNativeDialog);
|
fileDialog.setOption(QFileDialog::DontUseNativeDialog, dontUseNativeDialog);
|
||||||
fileDialog.setOption(QFileDialog::DontConfirmOverwrite, true);
|
fileDialog.setOption(QFileDialog::DontConfirmOverwrite, true);
|
||||||
fileDialog.setDefaultSuffix("suffix");
|
fileDialog.setDefaultSuffix("suffix");
|
||||||
fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
|
fileDialog.setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
||||||
fileDialog.setWindowTitle(PictureDialog::tr("Export as Picture..."));
|
fileDialog.setWindowTitle(PictureDialog::tr("Export as Picture..."));
|
||||||
fileDialog.setLabelText(QFileDialog::Accept, PictureDialog::tr("Export"));
|
fileDialog.setLabelText(QFileDialog::Accept, PictureDialog::tr("Export"));
|
||||||
|
|
||||||
|
@ -107,16 +77,13 @@ fileDialogPreSave: //Work?
|
||||||
QString saveFileFormat;
|
QString saveFileFormat;
|
||||||
QString selectedFile = selectedFiles.at(0);
|
QString selectedFile = selectedFiles.at(0);
|
||||||
|
|
||||||
if (selectedFile.right(4) == ".jpg") {
|
if (selectedFile.endsWith(".jpg") || selectedFile.endsWith(".jpeg")) {
|
||||||
saveFileFormat = "JPEG";
|
saveFileFormat = "JPEG";
|
||||||
}
|
}
|
||||||
else if (selectedFile.right(4) == ".jpeg") {
|
else if (selectedFile.endsWith(".png")) {
|
||||||
saveFileFormat = "JPEG";
|
|
||||||
}
|
|
||||||
else if (selectedFile.right(4) == ".png") {
|
|
||||||
saveFileFormat = "PNG";
|
saveFileFormat = "PNG";
|
||||||
}
|
}
|
||||||
else if (selectedFile.right(7) == ".suffix") {
|
else if (selectedFile.endsWith(".suffix")) {
|
||||||
if (fileDialog.selectedNameFilter() == "JPEG picture (*.jpg)") {
|
if (fileDialog.selectedNameFilter() == "JPEG picture (*.jpg)") {
|
||||||
selectedFile.replace(".suffix", ".jpg");
|
selectedFile.replace(".suffix", ".jpg");
|
||||||
}
|
}
|
||||||
|
@ -134,49 +101,23 @@ fileDialogPreSave: //Work?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scale Picture
|
|
||||||
QImage exportPicture = picture->getImage();
|
QImage exportPicture = picture->getImage();
|
||||||
if (sizeMode == "Desktop") {
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
qreal screenRatioPR = AppEnv::screenRatioPR();
|
|
||||||
QRect desktopResolution = QApplication::primaryScreen()->geometry();
|
|
||||||
int desktopSizeWidth = qRound((double)desktopResolution.width() * screenRatioPR);
|
|
||||||
int desktopSizeHeight = qRound((double)desktopResolution.height() * screenRatioPR);
|
|
||||||
#else
|
|
||||||
QRect desktopResolution = QApplication::desktop()->screenGeometry();
|
|
||||||
int desktopSizeWidth = desktopResolution.width();
|
|
||||||
int desktopSizeHeight = desktopResolution.height();
|
|
||||||
#endif
|
|
||||||
exportPicture = exportPicture.scaled(desktopSizeWidth, desktopSizeHeight, aspectRatio, Qt::SmoothTransformation);
|
|
||||||
}
|
|
||||||
else if (sizeMode == "Custom") {
|
|
||||||
exportPicture = exportPicture.scaled(cusExportSize, aspectRatio, Qt::SmoothTransformation);
|
|
||||||
}
|
|
||||||
|
|
||||||
int errorId = 0;
|
int errorId = 0;
|
||||||
bool isSaved = false;
|
bool isSaved = false;
|
||||||
#if QT_VERSION >= 0x050000
|
QSaveFile picFile(selectedFile);
|
||||||
QSaveFile *picFile = new QSaveFile(selectedFile);
|
if (picFile.open(QIODevice::WriteOnly)) {
|
||||||
#else
|
isSaved = exportPicture.save(&picFile, saveFileFormat.toStdString().c_str(), 100);
|
||||||
QFile *picFile = new QFile(selectedFile);
|
|
||||||
#endif
|
|
||||||
if (picFile->open(QIODevice::WriteOnly)) {
|
|
||||||
isSaved = exportPicture.save(picFile, saveFileFormat.toStdString().c_str(), useCustomQuality ? customQuality : defaultQuality);
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
if (isSaved) {
|
if (isSaved) {
|
||||||
isSaved = picFile->commit();
|
isSaved = picFile.commit();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
errorId = 1;
|
errorId = 1;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
picFile->close();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
errorId = 2;
|
errorId = 2;
|
||||||
}
|
}
|
||||||
delete picFile;
|
|
||||||
|
|
||||||
if (!isSaved) {
|
if (!isSaved) {
|
||||||
switch (errorId) {
|
switch (errorId) {
|
||||||
|
@ -225,7 +166,7 @@ fileDialogPreSave: //Work?
|
||||||
fileDialog.setOption(QFileDialog::DontUseNativeDialog, dontUseNativeDialog);
|
fileDialog.setOption(QFileDialog::DontUseNativeDialog, dontUseNativeDialog);
|
||||||
fileDialog.setOption(QFileDialog::DontConfirmOverwrite, true);
|
fileDialog.setOption(QFileDialog::DontConfirmOverwrite, true);
|
||||||
fileDialog.setDefaultSuffix(".rem");
|
fileDialog.setDefaultSuffix(".rem");
|
||||||
fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
|
fileDialog.setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
||||||
fileDialog.setWindowTitle(PictureDialog::tr("Export as Snapmatic..."));
|
fileDialog.setWindowTitle(PictureDialog::tr("Export as Snapmatic..."));
|
||||||
fileDialog.setLabelText(QFileDialog::Accept, PictureDialog::tr("Export"));
|
fileDialog.setLabelText(QFileDialog::Accept, PictureDialog::tr("Export"));
|
||||||
|
|
||||||
|
@ -246,14 +187,14 @@ fileDialogPreSave: //Work?
|
||||||
QString selectedFile = selectedFiles.at(0);
|
QString selectedFile = selectedFiles.at(0);
|
||||||
bool isAutoExt = false;
|
bool isAutoExt = false;
|
||||||
#ifndef GTA5SYNC_FLATPAK
|
#ifndef GTA5SYNC_FLATPAK
|
||||||
if (selectedFile.right(5) == ".auto") {
|
if (selectedFile.endsWith(".auto")) {
|
||||||
isAutoExt = true;
|
isAutoExt = true;
|
||||||
QString dirPath = QFileInfo(selectedFile).dir().path();
|
QString dirPath = QFileInfo(selectedFile).dir().path();
|
||||||
QString stockFileName = sgdFileInfo.fileName();
|
QString stockFileName = sgdFileInfo.fileName();
|
||||||
selectedFile = dirPath % "/" % stockFileName;
|
selectedFile = dirPath % "/" % stockFileName;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (selectedFile.right(4) == ".rem") {
|
if (selectedFile.endsWith(".rem")) {
|
||||||
selectedFile.remove(selectedFile.length() - 4, 4);
|
selectedFile.remove(selectedFile.length() - 4, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +204,7 @@ fileDialogPreSave: //Work?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedFile.right(4) == ".g5e") {
|
if (selectedFile.endsWith(".g5e")) {
|
||||||
bool isExported = picture->exportPicture(selectedFile, SnapmaticFormat::G5E_Format);
|
bool isExported = picture->exportPicture(selectedFile, SnapmaticFormat::G5E_Format);
|
||||||
if (!isExported) {
|
if (!isExported) {
|
||||||
QMessageBox::warning(parent, PictureDialog::tr("Export as Snapmatic"), PictureDialog::tr("Failed to export current Snapmatic picture"));
|
QMessageBox::warning(parent, PictureDialog::tr("Export as Snapmatic"), PictureDialog::tr("Failed to export current Snapmatic picture"));
|
||||||
|
|
|
@ -309,32 +309,19 @@ UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, D
|
||||||
ui->vlUserInterface->setContentsMargins(9 * screenRatio, 9 * screenRatio, 9 * screenRatio, 9 * screenRatio);
|
ui->vlUserInterface->setContentsMargins(9 * screenRatio, 9 * screenRatio, 9 * screenRatio, 9 * screenRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserInterface::setupDirEnv(bool showFolderDialog)
|
void UserInterface::setupDirEnv(bool showFolderWindow)
|
||||||
{
|
{
|
||||||
// settings init
|
// settings init
|
||||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
|
|
||||||
bool folderExists;
|
bool folderExists_GTAV, folderExists_RDR2;
|
||||||
GTAV_Folder = AppEnv::getGTAVFolder(&folderExists);
|
GTAV_Folder = AppEnv::getGTAVFolder(&folderExists_GTAV);
|
||||||
if (!folderExists && showFolderDialog) {
|
RDR2_Folder = AppEnv::getRDR2Folder(&folderExists_RDR2);
|
||||||
const QString GTAV_Folder_Temp = QFileDialog::getExistingDirectory(this, tr("Select GTA V Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
|
|
||||||
if (!GTAV_Folder_Temp.isEmpty() && QDir(GTAV_Folder_Temp).exists()) {
|
|
||||||
GTAV_Folder = GTAV_Folder_Temp;
|
|
||||||
folderExists = true;
|
|
||||||
AppEnv::setGTAVFolder(GTAV_Folder);
|
|
||||||
|
|
||||||
// First time folder selection save
|
|
||||||
settings.beginGroup("dir");
|
|
||||||
if (settings.value("dir", "").toString().isEmpty()) {
|
|
||||||
settings.setValue("dir", GTAV_Folder);
|
|
||||||
}
|
|
||||||
settings.endGroup();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// profiles init
|
// profiles init
|
||||||
settings.beginGroup("Profile");
|
settings.beginGroup("Profile");
|
||||||
QString defaultProfile = settings.value("Default", "").toString();
|
QString defaultProfile = settings.value("Default", QString()).toString();
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
contentMode = settings.value("ContentMode", 0).toInt();
|
contentMode = settings.value("ContentMode", 0).toInt();
|
||||||
if (contentMode == 1) {
|
if (contentMode == 1) {
|
||||||
|
@ -344,51 +331,78 @@ void UserInterface::setupDirEnv(bool showFolderDialog)
|
||||||
contentMode = 20;
|
contentMode = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (folderExists) {
|
if (folderExists_GTAV) {
|
||||||
QDir GTAV_ProfilesDir;
|
QDir GTAV_ProfilesDir;
|
||||||
GTAV_ProfilesDir.setPath(GTAV_Folder % "/Profiles");
|
GTAV_ProfilesDir.setPath(GTAV_Folder % "/Profiles");
|
||||||
|
|
||||||
GTAV_Profiles = GTAV_ProfilesDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::NoSort);
|
GTAV_Profiles = GTAV_ProfilesDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::NoSort);
|
||||||
setupProfileUi();
|
|
||||||
|
|
||||||
if (GTAV_Profiles.length() == 1) {
|
|
||||||
openProfile(GTAV_Profiles.at(0), RagePhoto::PhotoFormat::GTA5);
|
|
||||||
}
|
|
||||||
else if(GTAV_Profiles.contains(defaultProfile)) {
|
|
||||||
openProfile(defaultProfile, RagePhoto::PhotoFormat::GTA5);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GTAV_Profiles = QStringList();
|
GTAV_Profiles = QStringList();
|
||||||
setupProfileUi();
|
|
||||||
}
|
}
|
||||||
settings.endGroup();
|
|
||||||
|
if (folderExists_RDR2) {
|
||||||
|
QDir RDR2_ProfilesDir;
|
||||||
|
RDR2_ProfilesDir.setPath(RDR2_Folder % "/Profiles");
|
||||||
|
RDR2_Profiles = RDR2_ProfilesDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::NoSort);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
RDR2_Profiles = QStringList();
|
||||||
|
}
|
||||||
|
|
||||||
|
setupProfileUi();
|
||||||
|
|
||||||
|
if (GTAV_Profiles.contains(defaultProfile)) {
|
||||||
|
openProfile(defaultProfile, RagePhoto::PhotoFormat::GTA5);
|
||||||
|
}
|
||||||
|
else if (GTAV_Profiles.length() == 1 && RDR2_Profiles.length() == 0) {
|
||||||
|
openProfile(GTAV_Profiles.at(0), RagePhoto::PhotoFormat::GTA5);
|
||||||
|
}
|
||||||
|
else if (GTAV_Profiles.length() == 0 && RDR2_Profiles.length() == 1) {
|
||||||
|
openProfile(RDR2_Profiles.at(0), RagePhoto::PhotoFormat::RDR2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserInterface::setupProfileUi()
|
void UserInterface::setupProfileUi()
|
||||||
{
|
{
|
||||||
qreal screenRatio = AppEnv::screenRatio();
|
qreal screenRatio = AppEnv::screenRatio();
|
||||||
if (GTAV_Profiles.isEmpty()) {
|
if (!GTAV_Profiles.isEmpty()) {
|
||||||
QPushButton *changeDirBtn = new QPushButton(tr("Select >A V Folder..."), ui->swSelection);
|
int row = 1;
|
||||||
changeDirBtn->setObjectName("cmdChangeDir");
|
for (const QString >AV_Profile : GTAV_Profiles) {
|
||||||
changeDirBtn->setMinimumSize(0, 40 * screenRatio);
|
QPushButton *profileBtn = new QPushButton(tr("Profile: %1").arg(GTAV_Profile), ui->swSelection);
|
||||||
changeDirBtn->setAutoDefault(true);
|
|
||||||
ui->vlButtons->addWidget(changeDirBtn);
|
|
||||||
profileBtns += changeDirBtn;
|
|
||||||
|
|
||||||
QObject::connect(changeDirBtn, SIGNAL(clicked(bool)), this, SLOT(changeFolder_clicked()));
|
|
||||||
}
|
|
||||||
else for (const QString >AV_Profile : GTAV_Profiles) {
|
|
||||||
QPushButton *profileBtn = new QPushButton(GTAV_Profile, ui->swSelection);
|
|
||||||
profileBtn->setObjectName(GTAV_Profile);
|
profileBtn->setObjectName(GTAV_Profile);
|
||||||
profileBtn->setMinimumSize(0, 40 * screenRatio);
|
profileBtn->setMinimumSize(0, 40 * screenRatio);
|
||||||
profileBtn->setAutoDefault(true);
|
profileBtn->setAutoDefault(true);
|
||||||
ui->vlButtons->addWidget(profileBtn);
|
ui->glProfiles->addWidget(profileBtn, row++, 0);
|
||||||
profileBtns += profileBtn;
|
profileBtns += profileBtn;
|
||||||
|
|
||||||
QObject::connect(profileBtn, SIGNAL(clicked(bool)), this, SLOT(profileButton_clicked()));
|
QObject::connect(profileBtn, &QPushButton::clicked, this, [=](){
|
||||||
|
openProfile(profileBtn->objectName(), RagePhoto::PhotoFormat::GTA5);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
ui->labGTAV->setVisible(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui->labGTAV->setVisible(false);
|
||||||
|
}
|
||||||
|
if (!RDR2_Profiles.isEmpty()) {
|
||||||
|
int row = 1;
|
||||||
|
for (const QString &RDR2_Profile : RDR2_Profiles) {
|
||||||
|
QPushButton *profileBtn = new QPushButton(tr("Profile: %1").arg(RDR2_Profile), ui->swSelection);
|
||||||
|
profileBtn->setObjectName(RDR2_Profile);
|
||||||
|
profileBtn->setMinimumSize(0, 40 * screenRatio);
|
||||||
|
profileBtn->setAutoDefault(true);
|
||||||
|
ui->glProfiles->addWidget(profileBtn, row++, 1);
|
||||||
|
profileBtns += profileBtn;
|
||||||
|
|
||||||
|
QObject::connect(profileBtn, &QPushButton::clicked, this, [=](){
|
||||||
|
openProfile(profileBtn->objectName(), RagePhoto::PhotoFormat::RDR2);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
ui->labRDR2->setVisible(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui->labRDR2->setVisible(false);
|
||||||
}
|
}
|
||||||
profileBtns.at(0)->setFocus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserInterface::changeFolder_clicked()
|
void UserInterface::changeFolder_clicked()
|
||||||
|
@ -399,19 +413,13 @@ void UserInterface::changeFolder_clicked()
|
||||||
void UserInterface::on_cmdReload_clicked()
|
void UserInterface::on_cmdReload_clicked()
|
||||||
{
|
{
|
||||||
for (QPushButton *profileBtn : profileBtns) {
|
for (QPushButton *profileBtn : profileBtns) {
|
||||||
ui->vlButtons->removeWidget(profileBtn);
|
ui->glProfiles->removeWidget(profileBtn);
|
||||||
delete profileBtn;
|
delete profileBtn;
|
||||||
}
|
}
|
||||||
profileBtns.clear();
|
profileBtns.clear();
|
||||||
setupDirEnv();
|
setupDirEnv();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserInterface::profileButton_clicked()
|
|
||||||
{
|
|
||||||
QPushButton *profileBtn = (QPushButton*)sender();
|
|
||||||
openProfile(profileBtn->objectName(), RagePhoto::PhotoFormat::GTA5);
|
|
||||||
}
|
|
||||||
|
|
||||||
void UserInterface::openProfile(const QString &profileName_, quint32 gameFormat)
|
void UserInterface::openProfile(const QString &profileName_, quint32 gameFormat)
|
||||||
{
|
{
|
||||||
profileOpen = true;
|
profileOpen = true;
|
||||||
|
@ -529,16 +537,13 @@ void UserInterface::on_actionDelete_selected_triggered()
|
||||||
|
|
||||||
void UserInterface::on_actionOptions_triggered()
|
void UserInterface::on_actionOptions_triggered()
|
||||||
{
|
{
|
||||||
OptionsDialog *optionsDialog = new OptionsDialog(profileDB, this);
|
OptionsDialog optionsDialog(profileDB, this);
|
||||||
optionsDialog->setWindowIcon(windowIcon());
|
optionsDialog.setWindowIcon(windowIcon());
|
||||||
optionsDialog->commitProfiles(GTAV_Profiles);
|
optionsDialog.commitProfiles(GTAV_Profiles); // TODO: Diff. GTA V and RDR 2 profiles
|
||||||
QObject::connect(optionsDialog, SIGNAL(settingsApplied(int, bool)), this, SLOT(settingsApplied(int, bool)));
|
QObject::connect(&optionsDialog, &OptionsDialog::settingsApplied, this, &UserInterface::settingsApplied);
|
||||||
|
optionsDialog.setModal(true);
|
||||||
optionsDialog->setModal(true);
|
optionsDialog.show();
|
||||||
optionsDialog->show();
|
optionsDialog.exec();
|
||||||
optionsDialog->exec();
|
|
||||||
|
|
||||||
delete optionsDialog;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserInterface::on_action_Import_triggered()
|
void UserInterface::on_action_Import_triggered()
|
||||||
|
@ -810,7 +815,6 @@ void UserInterface::on_actionSelect_GTA_Folder_triggered()
|
||||||
closeProfile_p();
|
closeProfile_p();
|
||||||
}
|
}
|
||||||
GTAV_Folder = GTAV_Folder_Temp;
|
GTAV_Folder = GTAV_Folder_Temp;
|
||||||
AppEnv::setGTAVFolder(GTAV_Folder);
|
|
||||||
on_cmdReload_clicked();
|
on_cmdReload_clicked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,14 +48,13 @@ public:
|
||||||
#else
|
#else
|
||||||
explicit UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent = 0);
|
explicit UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent = 0);
|
||||||
#endif
|
#endif
|
||||||
void setupDirEnv(bool showFolderDialog = true);
|
void setupDirEnv(bool showFolderWindow = true);
|
||||||
~UserInterface();
|
~UserInterface();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void closeProfile();
|
void closeProfile();
|
||||||
void profileLoaded();
|
void profileLoaded();
|
||||||
void changeFolder_clicked();
|
void changeFolder_clicked();
|
||||||
void profileButton_clicked();
|
|
||||||
void on_cmdReload_clicked();
|
void on_cmdReload_clicked();
|
||||||
void on_actionExit_triggered();
|
void on_actionExit_triggered();
|
||||||
void on_actionSelect_profile_triggered();
|
void on_actionSelect_profile_triggered();
|
||||||
|
|
|
@ -69,20 +69,28 @@
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labSelectProfile">
|
<layout class="QGridLayout" name="glProfiles">
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="labRDR2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Select profile</string>
|
<string>RDR 2</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
</widget>
|
||||||
<bool>true</bool>
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="labGTAV">
|
||||||
|
<property name="text">
|
||||||
|
<string>GTA V</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
</layout>
|
||||||
<layout class="QVBoxLayout" name="vlButtons"/>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="vsFooter">
|
<spacer name="vsFooter">
|
||||||
|
@ -171,7 +179,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>625</width>
|
<width>625</width>
|
||||||
<height>23</height>
|
<height>21</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuFile">
|
<widget class="QMenu" name="menuFile">
|
||||||
|
|
Loading…
Reference in a new issue