Moved launcher settings stuff into components, so they can be reused in the wizard

pull/136/head
pvdk 11 years ago
parent 3a37761d76
commit 095ff4e17a

@ -6,9 +6,7 @@ set(LAUNCHER
playpage.cpp
textslotmsgbox.cpp
settings/gamesettings.cpp
settings/graphicssettings.cpp
settings/launchersettings.cpp
utils/checkablemessagebox.cpp
utils/profilescombobox.cpp
@ -28,10 +26,7 @@ set(LAUNCHER_HEADER
playpage.hpp
textslotmsgbox.hpp
settings/gamesettings.hpp
settings/graphicssettings.hpp
settings/launchersettings.hpp
settings/settingsbase.hpp
utils/checkablemessagebox.hpp
utils/profilescombobox.hpp

@ -9,18 +9,16 @@
#include <components/files/configurationmanager.hpp>
#include <components/contentselector/model/esmfile.hpp>
#include <components/contentselector/model/naturalsort.hpp>
#include <components/contentselector/view/contentselector.hpp>
#include <components/config/gamesettings.hpp>
#include <components/config/launchersettings.hpp>
#include "utils/textinputdialog.hpp"
#include "utils/profilescombobox.hpp"
#include "settings/gamesettings.hpp"
#include "settings/launchersettings.hpp"
#include "components/contentselector/view/contentselector.hpp"
Launcher::DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, GameSettings &gameSettings, LauncherSettings &launcherSettings, QWidget *parent)
Launcher::DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, Config::GameSettings &gameSettings, Config::LauncherSettings &launcherSettings, QWidget *parent)
: mCfgMgr(cfg)
, mGameSettings(gameSettings)
, mLauncherSettings(launcherSettings)

@ -14,12 +14,12 @@ class QMenu;
namespace Files { struct ConfigurationManager; }
namespace ContentSelectorView { class ContentSelector; }
namespace Config { class GameSettings;
class LauncherSettings; }
namespace Launcher
{
class TextInputDialog;
class GameSettings;
class LauncherSettings;
class ProfilesComboBox;
class DataFilesPage : public QWidget
@ -30,8 +30,8 @@ namespace Launcher
Ui::DataFilesPage ui;
public:
explicit DataFilesPage (Files::ConfigurationManager &cfg, GameSettings &gameSettings,
LauncherSettings &launcherSettings, QWidget *parent = 0);
explicit DataFilesPage (Files::ConfigurationManager &cfg, Config::GameSettings &gameSettings,
Config::LauncherSettings &launcherSettings, QWidget *parent = 0);
QAbstractItemModel* profilesModel() const;
@ -62,8 +62,8 @@ namespace Launcher
Files::ConfigurationManager &mCfgMgr;
GameSettings &mGameSettings;
LauncherSettings &mLauncherSettings;
Config::GameSettings &mGameSettings;
Config::LauncherSettings &mLauncherSettings;
QString mDataLocal;

@ -5,9 +5,10 @@
#ifndef Q_MOC_RUN
#include <components/files/configurationmanager.hpp>
#endif
#include "settings/gamesettings.hpp"
#include <components/config/gamesettings.hpp>
#include <components/config/launchersettings.hpp>
#include "settings/graphicssettings.hpp"
#include "settings/launchersettings.hpp"
#include "ui_mainwindow.h"
@ -60,9 +61,9 @@ namespace Launcher
Files::ConfigurationManager mCfgMgr;
GameSettings mGameSettings;
Config::GameSettings mGameSettings;
GraphicsSettings mGraphicsSettings;
LauncherSettings mLauncherSettings;
Config::LauncherSettings mLauncherSettings;
};
}

@ -1,11 +1,11 @@
#ifndef GRAPHICSSETTINGS_HPP
#define GRAPHICSSETTINGS_HPP
#include "settingsbase.hpp"
#include <components/config/settingsbase.hpp>
namespace Launcher
{
class GraphicsSettings : public SettingsBase<QMap<QString, QString> >
class GraphicsSettings : public Config::SettingsBase<QMap<QString, QString> >
{
public:
GraphicsSettings();

@ -75,8 +75,8 @@ add_component_dir (loadinglistener
)
add_component_dir (ogreinit
ogreinit ogreplugin
)
ogreinit ogreplugin
)
set (ESM_UI ${CMAKE_SOURCE_DIR}/files/ui/contentselector.ui
)
@ -84,11 +84,16 @@ set (ESM_UI ${CMAKE_SOURCE_DIR}/files/ui/contentselector.ui
find_package(Qt4 COMPONENTS QtCore QtGui)
if(QT_QTGUI_LIBRARY AND QT_QTCORE_LIBRARY)
add_component_qt_dir (contentselector
add_component_qt_dir (contentselector
model/modelitem model/esmfile
model/naturalsort model/contentmodel
view/combobox view/contentselector
)
)
add_component_qt_dir (config
gamesettings
launchersettings
settingsbase
)
include(${QT_USE_FILE})
QT4_WRAP_UI(ESM_UI_HDR ${ESM_UI})

@ -27,16 +27,16 @@ namespace boost
#endif /* (BOOST_VERSION <= 104600) */
Launcher::GameSettings::GameSettings(Files::ConfigurationManager &cfg)
Config::GameSettings::GameSettings(Files::ConfigurationManager &cfg)
: mCfgMgr(cfg)
{
}
Launcher::GameSettings::~GameSettings()
Config::GameSettings::~GameSettings()
{
}
void Launcher::GameSettings::validatePaths()
void Config::GameSettings::validatePaths()
{
if (mSettings.isEmpty() || !mDataDirs.isEmpty())
return; // Don't re-validate paths if they are already parsed
@ -82,14 +82,14 @@ void Launcher::GameSettings::validatePaths()
}
}
QStringList Launcher::GameSettings::values(const QString &key, const QStringList &defaultValues)
QStringList Config::GameSettings::values(const QString &key, const QStringList &defaultValues)
{
if (!mSettings.values(key).isEmpty())
return mSettings.values(key);
return defaultValues;
}
bool Launcher::GameSettings::readFile(QTextStream &stream)
bool Config::GameSettings::readFile(QTextStream &stream)
{
QMap<QString, QString> cache;
QRegExp keyRe("^([^=]+)\\s*=\\s*(.+)$");
@ -131,7 +131,7 @@ bool Launcher::GameSettings::readFile(QTextStream &stream)
return true;
}
bool Launcher::GameSettings::writeFile(QTextStream &stream)
bool Config::GameSettings::writeFile(QTextStream &stream)
{
// Iterate in reverse order to preserve insertion order
QMapIterator<QString, QString> i(mSettings);
@ -170,7 +170,7 @@ bool Launcher::GameSettings::writeFile(QTextStream &stream)
return true;
}
bool Launcher::GameSettings::hasMaster()
bool Config::GameSettings::hasMaster()
{
bool result = false;
QStringList content = mSettings.values(QString("content"));

@ -14,7 +14,7 @@ namespace Files
struct ConfigurationManager;
}
namespace Launcher
namespace Config
{
class GameSettings
{

@ -7,15 +7,15 @@
#include <QDebug>
Launcher::LauncherSettings::LauncherSettings()
Config::LauncherSettings::LauncherSettings()
{
}
Launcher::LauncherSettings::~LauncherSettings()
Config::LauncherSettings::~LauncherSettings()
{
}
QStringList Launcher::LauncherSettings::values(const QString &key, Qt::MatchFlags flags)
QStringList Config::LauncherSettings::values(const QString &key, Qt::MatchFlags flags)
{
QMap<QString, QString> settings = SettingsBase::getSettings();
@ -36,7 +36,7 @@ QStringList Launcher::LauncherSettings::values(const QString &key, Qt::MatchFlag
return result;
}
QStringList Launcher::LauncherSettings::subKeys(const QString &key)
QStringList Config::LauncherSettings::subKeys(const QString &key)
{
QMap<QString, QString> settings = SettingsBase::getSettings();
QStringList keys = settings.uniqueKeys();
@ -60,7 +60,7 @@ QStringList Launcher::LauncherSettings::subKeys(const QString &key)
return result;
}
bool Launcher::LauncherSettings::writeFile(QTextStream &stream)
bool Config::LauncherSettings::writeFile(QTextStream &stream)
{
QString sectionPrefix;
QRegExp sectionRe("([^/]+)/(.+)$");

@ -3,7 +3,7 @@
#include "settingsbase.hpp"
namespace Launcher
namespace Config
{
class LauncherSettings : public SettingsBase<QMap<QString, QString> >
{

@ -7,7 +7,7 @@
#include <QRegExp>
#include <QMap>
namespace Launcher
namespace Config
{
template <class Map>
class SettingsBase
Loading…
Cancel
Save