mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-21 09:39:56 +00:00
Make the launcher code conform to the coding standards and cleanup
This commit is contained in:
parent
c4ebdc230c
commit
9cd8dd39de
@ -1,3 +1,5 @@
|
|||||||
|
#include "datafilespage.hpp"
|
||||||
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
|
||||||
#include <components/esm/esmreader.hpp>
|
#include <components/esm/esmreader.hpp>
|
||||||
@ -17,8 +19,6 @@
|
|||||||
#include "utils/profilescombobox.hpp"
|
#include "utils/profilescombobox.hpp"
|
||||||
#include "utils/textinputdialog.hpp"
|
#include "utils/textinputdialog.hpp"
|
||||||
|
|
||||||
#include "datafilespage.hpp"
|
|
||||||
|
|
||||||
using namespace ESM;
|
using namespace ESM;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -216,9 +216,8 @@ void DataFilesPage::setupDataFiles()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString dataLocal = mGameSettings.getDataLocal();
|
QString dataLocal = mGameSettings.getDataLocal();
|
||||||
if (!dataLocal.isEmpty()) {
|
if (!dataLocal.isEmpty())
|
||||||
mDataFilesModel->addFiles(dataLocal);
|
mDataFilesModel->addFiles(dataLocal);
|
||||||
}
|
|
||||||
|
|
||||||
// Sort by date accessed for now
|
// Sort by date accessed for now
|
||||||
mDataFilesModel->sort(3);
|
mDataFilesModel->sort(3);
|
||||||
@ -236,7 +235,6 @@ void DataFilesPage::setupDataFiles()
|
|||||||
if (mProfilesComboBox->findText(QString("Default")) == -1)
|
if (mProfilesComboBox->findText(QString("Default")) == -1)
|
||||||
mProfilesComboBox->addItem(QString("Default"));
|
mProfilesComboBox->addItem(QString("Default"));
|
||||||
|
|
||||||
|
|
||||||
if (profile.isEmpty() || profile == QLatin1String("Default")) {
|
if (profile.isEmpty() || profile == QLatin1String("Default")) {
|
||||||
mProfilesComboBox->setCurrentIndex(mProfilesComboBox->findText(QString("Default")));
|
mProfilesComboBox->setCurrentIndex(mProfilesComboBox->findText(QString("Default")));
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include "graphicspage.hpp"
|
||||||
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
@ -10,7 +12,6 @@
|
|||||||
#include <components/fileorderlist/utils/naturalsort.hpp>
|
#include <components/fileorderlist/utils/naturalsort.hpp>
|
||||||
|
|
||||||
#include "settings/graphicssettings.hpp"
|
#include "settings/graphicssettings.hpp"
|
||||||
#include "graphicspage.hpp"
|
|
||||||
|
|
||||||
QString getAspect(int x, int y)
|
QString getAspect(int x, int y)
|
||||||
{
|
{
|
||||||
@ -183,22 +184,22 @@ bool GraphicsPage::setupOgre()
|
|||||||
void GraphicsPage::loadSettings()
|
void GraphicsPage::loadSettings()
|
||||||
{
|
{
|
||||||
if (mGraphicsSettings.value(QString("Video/vsync")) == QLatin1String("true"))
|
if (mGraphicsSettings.value(QString("Video/vsync")) == QLatin1String("true"))
|
||||||
mVSyncCheckBox->setCheckState(Qt::Checked);
|
mVSyncCheckBox->setCheckState(Qt::Checked);
|
||||||
|
|
||||||
if (mGraphicsSettings.value(QString("Video/fullscreen")) == QLatin1String("true"))
|
if (mGraphicsSettings.value(QString("Video/fullscreen")) == QLatin1String("true"))
|
||||||
mFullScreenCheckBox->setCheckState(Qt::Checked);
|
mFullScreenCheckBox->setCheckState(Qt::Checked);
|
||||||
|
|
||||||
int aaIndex = mAntiAliasingComboBox->findText(mGraphicsSettings.value(QString("Video/antialiasing")));
|
int aaIndex = mAntiAliasingComboBox->findText(mGraphicsSettings.value(QString("Video/antialiasing")));
|
||||||
if (aaIndex != -1)
|
if (aaIndex != -1)
|
||||||
mAntiAliasingComboBox->setCurrentIndex(aaIndex);
|
mAntiAliasingComboBox->setCurrentIndex(aaIndex);
|
||||||
|
|
||||||
QString resolution = mGraphicsSettings.value(QString("Video/resolution x"));
|
QString resolution = mGraphicsSettings.value(QString("Video/resolution x"));
|
||||||
resolution.append(QString(" x ") + mGraphicsSettings.value(QString("Video/resolution y")));
|
resolution.append(QString(" x ") + mGraphicsSettings.value(QString("Video/resolution y")));
|
||||||
|
|
||||||
int resIndex = mResolutionComboBox->findText(resolution, Qt::MatchStartsWith);
|
int resIndex = mResolutionComboBox->findText(resolution, Qt::MatchStartsWith);
|
||||||
|
|
||||||
if (resIndex != -1)
|
if (resIndex != -1)
|
||||||
mResolutionComboBox->setCurrentIndex(resIndex);
|
mResolutionComboBox->setCurrentIndex(resIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphicsPage::saveSettings()
|
void GraphicsPage::saveSettings()
|
||||||
@ -215,8 +216,8 @@ void GraphicsPage::saveSettings()
|
|||||||
QRegExp resolutionRe(QString("(\\d+) x (\\d+).*"));
|
QRegExp resolutionRe(QString("(\\d+) x (\\d+).*"));
|
||||||
|
|
||||||
if (resolutionRe.exactMatch(mResolutionComboBox->currentText().simplified())) {
|
if (resolutionRe.exactMatch(mResolutionComboBox->currentText().simplified())) {
|
||||||
mGraphicsSettings.setValue(QString("Video/resolution x"), resolutionRe.cap(1));
|
mGraphicsSettings.setValue(QString("Video/resolution x"), resolutionRe.cap(1));
|
||||||
mGraphicsSettings.setValue(QString("Video/resolution y"), resolutionRe.cap(2));
|
mGraphicsSettings.setValue(QString("Video/resolution y"), resolutionRe.cap(2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
|
#include "maindialog.hpp"
|
||||||
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
|
||||||
#include "utils/checkablemessagebox.hpp"
|
#include "utils/checkablemessagebox.hpp"
|
||||||
#include "utils/profilescombobox.hpp"
|
#include "utils/profilescombobox.hpp"
|
||||||
|
|
||||||
#include "maindialog.hpp"
|
|
||||||
#include "playpage.hpp"
|
#include "playpage.hpp"
|
||||||
#include "graphicspage.hpp"
|
#include "graphicspage.hpp"
|
||||||
#include "datafilespage.hpp"
|
#include "datafilespage.hpp"
|
||||||
@ -74,9 +75,8 @@ MainDialog::MainDialog()
|
|||||||
QString config = QString::fromStdString(mCfgMgr.getGlobalDataPath().string()) + QString("resources/launcher.qss");
|
QString config = QString::fromStdString(mCfgMgr.getGlobalDataPath().string()) + QString("resources/launcher.qss");
|
||||||
file.setFileName(config);
|
file.setFileName(config);
|
||||||
|
|
||||||
if (!file.exists()) {
|
if (!file.exists())
|
||||||
file.setFileName(QString::fromStdString(mCfgMgr.getLocalPath().string()) + QString("launcher.qss"));
|
file.setFileName(QString::fromStdString(mCfgMgr.getLocalPath().string()) + QString("launcher.qss"));
|
||||||
}
|
|
||||||
|
|
||||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
@ -101,9 +101,8 @@ MainDialog::MainDialog()
|
|||||||
|
|
||||||
void MainDialog::createIcons()
|
void MainDialog::createIcons()
|
||||||
{
|
{
|
||||||
if (!QIcon::hasThemeIcon("document-new")) {
|
if (!QIcon::hasThemeIcon("document-new"))
|
||||||
QIcon::setThemeName("tango");
|
QIcon::setThemeName("tango");
|
||||||
}
|
|
||||||
|
|
||||||
// We create a fallback icon because the default fallback doesn't work
|
// We create a fallback icon because the default fallback doesn't work
|
||||||
QIcon graphicsIcon = QIcon(":/icons/tango/video-display.png");
|
QIcon graphicsIcon = QIcon(":/icons/tango/video-display.png");
|
||||||
@ -733,4 +732,3 @@ bool MainDialog::startProgram(const QString &name, const QStringList &arguments,
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <QtGui>
|
|
||||||
|
|
||||||
#include "playpage.hpp"
|
#include "playpage.hpp"
|
||||||
|
|
||||||
|
#include <QtGui>
|
||||||
|
|
||||||
PlayPage::PlayPage(QWidget *parent) : QWidget(parent)
|
PlayPage::PlayPage(QWidget *parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
QWidget *playWidget = new QWidget(this);
|
QWidget *playWidget = new QWidget(this);
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include "gamesettings.hpp"
|
||||||
|
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
@ -25,7 +27,6 @@ namespace boost
|
|||||||
} /* namespace boost */
|
} /* namespace boost */
|
||||||
#endif /* (BOOST_VERSION <= 104600) */
|
#endif /* (BOOST_VERSION <= 104600) */
|
||||||
|
|
||||||
#include "gamesettings.hpp"
|
|
||||||
|
|
||||||
GameSettings::GameSettings(Files::ConfigurationManager &cfg)
|
GameSettings::GameSettings(Files::ConfigurationManager &cfg)
|
||||||
: mCfgMgr(cfg)
|
: mCfgMgr(cfg)
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
|
#include "graphicssettings.hpp"
|
||||||
|
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
|
||||||
#include "graphicssettings.hpp"
|
|
||||||
|
|
||||||
GraphicsSettings::GraphicsSettings()
|
GraphicsSettings::GraphicsSettings()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
|
#include "launchersettings.hpp"
|
||||||
|
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
|
||||||
#include "launchersettings.hpp"
|
|
||||||
|
|
||||||
LauncherSettings::LauncherSettings()
|
LauncherSettings::LauncherSettings()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user