Picture Settings added

This commit is contained in:
Rafael 2016-04-26 14:59:14 +02:00
parent 556eb1b640
commit 25502d903e
5 changed files with 294 additions and 5 deletions

View file

@ -39,7 +39,7 @@
<item>
<widget class="QGroupBox" name="gbSnapmaticFormat">
<property name="title">
<string>Format</string>
<string>Export Format</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
@ -62,7 +62,7 @@
<item>
<widget class="QGroupBox" name="gbSnapmaticResolution">
<property name="title">
<string>Resolution</string>
<string>Export Size</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
@ -90,6 +90,9 @@
<layout class="QHBoxLayout" name="hlSnapmaticResolution">
<item>
<widget class="QLabel" name="labSnapmaticResolutionSize">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Custom Size:</string>
</property>

View file

@ -20,6 +20,8 @@
#include "ui_OptionsDialog.h"
#include "AppEnv.h"
#include "config.h"
#include <QDesktopWidget>
#include <QApplication>
#include <QMessageBox>
#include <QStringList>
#include <QLocale>
@ -34,13 +36,27 @@ OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
{
ui->setupUi(this);
ui->tabWidget->setCurrentIndex(0);
QRect desktopResolution = QApplication::desktop()->screenGeometry();
int desktopSizeWidth = desktopResolution.width();
int desktopSizeHeight = desktopResolution.height();
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())));
setupTreeWidget();
setupLanguageBox();
setupRadioButtons();
setupDefaultProfile();
setupPictureSettings();
}
OptionsDialog::~OptionsDialog()
@ -85,7 +101,7 @@ void OptionsDialog::setupLanguageBox()
if (langList.length() > 0)
{
QString cbSysStr = tr("%1 (%2 if available)", "System like PC System = %1, System Language like Deutsch = %2").arg(tr("System",
"System like PC System"), QLocale::languageToString(QLocale(langList.at(0)).language()));
"System like PC System"), QLocale::languageToString(QLocale(langList.at(0)).language()));
ui->cbLanguage->addItem(cbSysStr, "System");
}
@ -198,6 +214,25 @@ void OptionsDialog::applySettings()
#endif
settings->endGroup();
settings->beginGroup("Pictures");
if (ui->cbPicCustomQuality->isChecked())
{
settings->setValue("CustomQuality", ui->hsPicQuality->value());
}
settings->setValue("CustomQualityEnabled", ui->cbPicCustomQuality->isChecked());
QString sizeMode = "Default";
if (ui->rbPicDesktopRes->isChecked())
{
sizeMode = "Desktop";
}
else if (ui->rbPicCustomRes->isChecked())
{
sizeMode = "Custom";
settings->setValue("CustomSize", QSize(ui->sbPicExportWidth->value(), ui->sbPicExportHeight->value()));
}
settings->setValue("ExportSizeMode", sizeMode);
settings->endGroup();
#if QT_VERSION >= 0x050000
emit settingsApplied(newContentMode, ui->cbLanguage->currentData().toString());
#else
@ -241,3 +276,59 @@ void OptionsDialog::commitProfiles(QStringList profiles)
}
}
}
void OptionsDialog::on_rbPicCustomRes_toggled(bool checked)
{
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();
ui->sbPicExportWidth->setValue(cusExportSize.width());
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);
}
settings->endGroup();
}

View file

@ -19,6 +19,7 @@
#ifndef OPTIONSDIALOG_H
#define OPTIONSDIALOG_H
#include <QSize>
#include <QList>
#include <QDialog>
#include <QSettings>
@ -40,6 +41,9 @@ public:
private slots:
void on_cmdOK_clicked();
void on_rbPicCustomRes_toggled(bool checked);
void on_cbPicCustomQuality_toggled(bool checked);
void on_hsPicQuality_valueChanged(int value);
signals:
void settingsApplied(int contentMode, QString language);
@ -50,12 +54,18 @@ private:
QList<QTreeWidgetItem*> playerItems;
QString currentLanguage;
QString defaultProfile;
QString percentString;
QSettings *settings;
int contentMode;
int customQuality;
int defaultQuality;
QSize defExportSize;
QSize cusExportSize;
void setupTreeWidget();
void setupLanguageBox();
void setupRadioButtons();
void setupDefaultProfile();
void setupPictureSettings();
void applySettings();
};

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>350</height>
<width>435</width>
<height>375</height>
</rect>
</property>
<property name="windowTitle">
@ -87,6 +87,190 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tabPictures">
<attribute name="title">
<string>Pictures</string>
</attribute>
<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 Size: %1x%2</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbPicDesktopRes">
<property name="text">
<string>Desktop Size: %1x%2</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbPicCustomRes">
<property name="text">
<string>Custom Size</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="hlCustomRes">
<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>
</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>
<spacer name="vsTabPictures">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabPlayers">
<attribute name="title">
<string>Players</string>

View file

@ -29,6 +29,7 @@
#include <QDesktopWidget>
#include <QJsonDocument>
#include <QApplication>
#include <QFileDialog>
#include <QMessageBox>
#include <QJsonObject>