|
|
@ -18,7 +18,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
#include <components/contentselector/model/naturalsort.hpp>
|
|
|
|
#include <components/contentselector/model/naturalsort.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
#include "settings/graphicssettings.hpp"
|
|
|
|
#include <components/settings/settings.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
QString getAspect(int x, int y)
|
|
|
|
QString getAspect(int x, int y)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -32,10 +32,10 @@ QString getAspect(int x, int y)
|
|
|
|
return QString(QString::number(xaspect) + ":" + QString::number(yaspect));
|
|
|
|
return QString(QString::number(xaspect) + ":" + QString::number(yaspect));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Launcher::GraphicsPage::GraphicsPage(Files::ConfigurationManager &cfg, GraphicsSettings &graphicsSetting, QWidget *parent)
|
|
|
|
Launcher::GraphicsPage::GraphicsPage(Files::ConfigurationManager &cfg, Settings::Manager &engineSettings, QWidget *parent)
|
|
|
|
: QWidget(parent)
|
|
|
|
: QWidget(parent)
|
|
|
|
, mCfgMgr(cfg)
|
|
|
|
, mCfgMgr(cfg)
|
|
|
|
, mGraphicsSettings(graphicsSetting)
|
|
|
|
, mEngineSettings(engineSettings)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
setObjectName ("GraphicsPage");
|
|
|
|
setObjectName ("GraphicsPage");
|
|
|
|
setupUi(this);
|
|
|
|
setupUi(this);
|
|
|
@ -80,25 +80,26 @@ bool Launcher::GraphicsPage::loadSettings()
|
|
|
|
if (!setupSDL())
|
|
|
|
if (!setupSDL())
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
if (mGraphicsSettings.value(QString("Video/vsync")) == QLatin1String("true"))
|
|
|
|
if (mEngineSettings.getBool("vsync", "Video"))
|
|
|
|
vSyncCheckBox->setCheckState(Qt::Checked);
|
|
|
|
vSyncCheckBox->setCheckState(Qt::Checked);
|
|
|
|
|
|
|
|
|
|
|
|
if (mGraphicsSettings.value(QString("Video/fullscreen")) == QLatin1String("true"))
|
|
|
|
if (mEngineSettings.getBool("fullscreen", "Video"))
|
|
|
|
fullScreenCheckBox->setCheckState(Qt::Checked);
|
|
|
|
fullScreenCheckBox->setCheckState(Qt::Checked);
|
|
|
|
|
|
|
|
|
|
|
|
if (mGraphicsSettings.value(QString("Video/window border")) == QLatin1String("true"))
|
|
|
|
if (mEngineSettings.getBool("window border", "Video"))
|
|
|
|
windowBorderCheckBox->setCheckState(Qt::Checked);
|
|
|
|
windowBorderCheckBox->setCheckState(Qt::Checked);
|
|
|
|
|
|
|
|
|
|
|
|
int aaIndex = antiAliasingComboBox->findText(mGraphicsSettings.value(QString("Video/antialiasing")));
|
|
|
|
// aaValue is the actual value (0, 1, 2, 4, 8, 16)
|
|
|
|
|
|
|
|
int aaValue = mEngineSettings.getInt("antialiasing", "Video");
|
|
|
|
|
|
|
|
// aaIndex is the index into the allowed values in the pull down.
|
|
|
|
|
|
|
|
int aaIndex = antiAliasingComboBox->findText(QString::number(aaValue));
|
|
|
|
if (aaIndex != -1)
|
|
|
|
if (aaIndex != -1)
|
|
|
|
antiAliasingComboBox->setCurrentIndex(aaIndex);
|
|
|
|
antiAliasingComboBox->setCurrentIndex(aaIndex);
|
|
|
|
|
|
|
|
|
|
|
|
QString width = mGraphicsSettings.value(QString("Video/resolution x"));
|
|
|
|
int width = mEngineSettings.getInt("resolution x", "Video");
|
|
|
|
QString height = mGraphicsSettings.value(QString("Video/resolution y"));
|
|
|
|
int height = mEngineSettings.getInt("resolution y", "Video");
|
|
|
|
QString resolution = width + QString(" x ") + height;
|
|
|
|
QString resolution = QString::number(width) + QString(" x ") + QString::number(height);
|
|
|
|
QString screen = mGraphicsSettings.value(QString("Video/screen"));
|
|
|
|
screenComboBox->setCurrentIndex(mEngineSettings.getInt("screen", "Video"));
|
|
|
|
|
|
|
|
|
|
|
|
screenComboBox->setCurrentIndex(screen.toInt());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int resIndex = resolutionComboBox->findText(resolution, Qt::MatchStartsWith);
|
|
|
|
int resIndex = resolutionComboBox->findText(resolution, Qt::MatchStartsWith);
|
|
|
|
|
|
|
|
|
|
|
@ -107,9 +108,8 @@ bool Launcher::GraphicsPage::loadSettings()
|
|
|
|
resolutionComboBox->setCurrentIndex(resIndex);
|
|
|
|
resolutionComboBox->setCurrentIndex(resIndex);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
customRadioButton->toggle();
|
|
|
|
customRadioButton->toggle();
|
|
|
|
customWidthSpinBox->setValue(width.toInt());
|
|
|
|
customWidthSpinBox->setValue(width);
|
|
|
|
customHeightSpinBox->setValue(height.toInt());
|
|
|
|
customHeightSpinBox->setValue(height);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
@ -117,31 +117,29 @@ bool Launcher::GraphicsPage::loadSettings()
|
|
|
|
|
|
|
|
|
|
|
|
void Launcher::GraphicsPage::saveSettings()
|
|
|
|
void Launcher::GraphicsPage::saveSettings()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
vSyncCheckBox->checkState() ? mGraphicsSettings.setValue(QString("Video/vsync"), QString("true"))
|
|
|
|
mEngineSettings.setBool("vsync", "Video", vSyncCheckBox->checkState());
|
|
|
|
: mGraphicsSettings.setValue(QString("Video/vsync"), QString("false"));
|
|
|
|
mEngineSettings.setBool("fullscreen", "Video", fullScreenCheckBox->checkState());
|
|
|
|
|
|
|
|
mEngineSettings.setBool("window border", "Video", windowBorderCheckBox->checkState());
|
|
|
|
fullScreenCheckBox->checkState() ? mGraphicsSettings.setValue(QString("Video/fullscreen"), QString("true"))
|
|
|
|
|
|
|
|
: mGraphicsSettings.setValue(QString("Video/fullscreen"), QString("false"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
windowBorderCheckBox->checkState() ? mGraphicsSettings.setValue(QString("Video/window border"), QString("true"))
|
|
|
|
|
|
|
|
: mGraphicsSettings.setValue(QString("Video/window border"), QString("false"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mGraphicsSettings.setValue(QString("Video/antialiasing"), antiAliasingComboBox->currentText());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// The atoi() call is safe because the pull down constrains the string values.
|
|
|
|
|
|
|
|
int aaValue = atoi(antiAliasingComboBox->currentText().toLatin1().data());
|
|
|
|
|
|
|
|
mEngineSettings.setInt("antialiasing", "Video", aaValue);
|
|
|
|
|
|
|
|
|
|
|
|
if (standardRadioButton->isChecked()) {
|
|
|
|
if (standardRadioButton->isChecked()) {
|
|
|
|
QRegExp resolutionRe(QString("(\\d+) x (\\d+).*"));
|
|
|
|
QRegExp resolutionRe(QString("(\\d+) x (\\d+).*"));
|
|
|
|
|
|
|
|
|
|
|
|
if (resolutionRe.exactMatch(resolutionComboBox->currentText().simplified())) {
|
|
|
|
if (resolutionRe.exactMatch(resolutionComboBox->currentText().simplified())) {
|
|
|
|
mGraphicsSettings.setValue(QString("Video/resolution x"), resolutionRe.cap(1));
|
|
|
|
// The atoi() call is safe because the pull down constrains the string values.
|
|
|
|
mGraphicsSettings.setValue(QString("Video/resolution y"), resolutionRe.cap(2));
|
|
|
|
int width = atoi(resolutionRe.cap(1).toLatin1().data());
|
|
|
|
|
|
|
|
int height = atoi(resolutionRe.cap(2).toLatin1().data());
|
|
|
|
|
|
|
|
mEngineSettings.setInt("resolution x", "Video", width);
|
|
|
|
|
|
|
|
mEngineSettings.setInt("resolution y", "Video", height);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
mGraphicsSettings.setValue(QString("Video/resolution x"), QString::number(customWidthSpinBox->value()));
|
|
|
|
mEngineSettings.setInt("resolution x", "Video", customWidthSpinBox->value());
|
|
|
|
mGraphicsSettings.setValue(QString("Video/resolution y"), QString::number(customHeightSpinBox->value()));
|
|
|
|
mEngineSettings.setInt("resolution y", "Video", customHeightSpinBox->value());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
mGraphicsSettings.setValue(QString("Video/screen"), QString::number(screenComboBox->currentIndex()));
|
|
|
|
mEngineSettings.setInt("screen", "Video", screenComboBox->currentIndex());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QStringList Launcher::GraphicsPage::getAvailableResolutions(int screen)
|
|
|
|
QStringList Launcher::GraphicsPage::getAvailableResolutions(int screen)
|
|
|
|