Make the launcher code conform to the coding standards and cleanup

pull/37/head
Pieter van der Kloet 12 years ago
parent c4ebdc230c
commit 9cd8dd39de

@ -1,3 +1,5 @@
#include "datafilespage.hpp"
#include <QtGui>
#include <components/esm/esmreader.hpp>
@ -17,8 +19,6 @@
#include "utils/profilescombobox.hpp"
#include "utils/textinputdialog.hpp"
#include "datafilespage.hpp"
using namespace ESM;
using namespace std;
@ -216,9 +216,8 @@ void DataFilesPage::setupDataFiles()
}
QString dataLocal = mGameSettings.getDataLocal();
if (!dataLocal.isEmpty()) {
if (!dataLocal.isEmpty())
mDataFilesModel->addFiles(dataLocal);
}
// Sort by date accessed for now
mDataFilesModel->sort(3);
@ -236,7 +235,6 @@ void DataFilesPage::setupDataFiles()
if (mProfilesComboBox->findText(QString("Default")) == -1)
mProfilesComboBox->addItem(QString("Default"));
if (profile.isEmpty() || profile == QLatin1String("Default")) {
mProfilesComboBox->setCurrentIndex(mProfilesComboBox->findText(QString("Default")));
} else {

@ -1,3 +1,5 @@
#include "graphicspage.hpp"
#include <QtGui>
#include <cstdlib>
@ -10,7 +12,6 @@
#include <components/fileorderlist/utils/naturalsort.hpp>
#include "settings/graphicssettings.hpp"
#include "graphicspage.hpp"
QString getAspect(int x, int y)
{
@ -183,22 +184,22 @@ bool GraphicsPage::setupOgre()
void GraphicsPage::loadSettings()
{
if (mGraphicsSettings.value(QString("Video/vsync")) == QLatin1String("true"))
mVSyncCheckBox->setCheckState(Qt::Checked);
mVSyncCheckBox->setCheckState(Qt::Checked);
if (mGraphicsSettings.value(QString("Video/fullscreen")) == QLatin1String("true"))
mFullScreenCheckBox->setCheckState(Qt::Checked);
if (mGraphicsSettings.value(QString("Video/fullscreen")) == QLatin1String("true"))
mFullScreenCheckBox->setCheckState(Qt::Checked);
int aaIndex = mAntiAliasingComboBox->findText(mGraphicsSettings.value(QString("Video/antialiasing")));
if (aaIndex != -1)
mAntiAliasingComboBox->setCurrentIndex(aaIndex);
int aaIndex = mAntiAliasingComboBox->findText(mGraphicsSettings.value(QString("Video/antialiasing")));
if (aaIndex != -1)
mAntiAliasingComboBox->setCurrentIndex(aaIndex);
QString resolution = mGraphicsSettings.value(QString("Video/resolution x"));
resolution.append(QString(" x ") + mGraphicsSettings.value(QString("Video/resolution y")));
QString resolution = mGraphicsSettings.value(QString("Video/resolution x"));
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)
mResolutionComboBox->setCurrentIndex(resIndex);
if (resIndex != -1)
mResolutionComboBox->setCurrentIndex(resIndex);
}
void GraphicsPage::saveSettings()
@ -215,8 +216,8 @@ void GraphicsPage::saveSettings()
QRegExp resolutionRe(QString("(\\d+) x (\\d+).*"));
if (resolutionRe.exactMatch(mResolutionComboBox->currentText().simplified())) {
mGraphicsSettings.setValue(QString("Video/resolution x"), resolutionRe.cap(1));
mGraphicsSettings.setValue(QString("Video/resolution y"), resolutionRe.cap(2));
mGraphicsSettings.setValue(QString("Video/resolution x"), resolutionRe.cap(1));
mGraphicsSettings.setValue(QString("Video/resolution y"), resolutionRe.cap(2));
}
}

@ -1,9 +1,10 @@
#include "maindialog.hpp"
#include <QtGui>
#include "utils/checkablemessagebox.hpp"
#include "utils/profilescombobox.hpp"
#include "maindialog.hpp"
#include "playpage.hpp"
#include "graphicspage.hpp"
#include "datafilespage.hpp"
@ -74,9 +75,8 @@ MainDialog::MainDialog()
QString config = QString::fromStdString(mCfgMgr.getGlobalDataPath().string()) + QString("resources/launcher.qss");
file.setFileName(config);
if (!file.exists()) {
if (!file.exists())
file.setFileName(QString::fromStdString(mCfgMgr.getLocalPath().string()) + QString("launcher.qss"));
}
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QMessageBox msgBox;
@ -101,9 +101,8 @@ MainDialog::MainDialog()
void MainDialog::createIcons()
{
if (!QIcon::hasThemeIcon("document-new")) {
if (!QIcon::hasThemeIcon("document-new"))
QIcon::setThemeName("tango");
}
// We create a fallback icon because the default fallback doesn't work
QIcon graphicsIcon = QIcon(":/icons/tango/video-display.png");
@ -733,4 +732,3 @@ bool MainDialog::startProgram(const QString &name, const QStringList &arguments,
return true;
}

@ -1,7 +1,7 @@
#include <QtGui>
#include "playpage.hpp"
#include <QtGui>
PlayPage::PlayPage(QWidget *parent) : QWidget(parent)
{
QWidget *playWidget = new QWidget(this);

@ -1,3 +1,5 @@
#include "gamesettings.hpp"
#include <QTextStream>
#include <QDir>
#include <QString>
@ -25,7 +27,6 @@ namespace boost
} /* namespace boost */
#endif /* (BOOST_VERSION <= 104600) */
#include "gamesettings.hpp"
GameSettings::GameSettings(Files::ConfigurationManager &cfg)
: mCfgMgr(cfg)

@ -1,10 +1,10 @@
#include "graphicssettings.hpp"
#include <QTextStream>
#include <QString>
#include <QRegExp>
#include <QMap>
#include "graphicssettings.hpp"
GraphicsSettings::GraphicsSettings()
{
}

@ -1,10 +1,10 @@
#include "launchersettings.hpp"
#include <QTextStream>
#include <QString>
#include <QRegExp>
#include <QMap>
#include "launchersettings.hpp"
LauncherSettings::LauncherSettings()
{
}

Loading…
Cancel
Save