Issue #913: Merge --master and --plugin switches

Launcher part of master/plugin switches merge.

Signed-off-by: Lukasz Gromanowski <lgromanowski@gmail.com>
actorid
Lukasz Gromanowski 11 years ago
parent 3146af34d6
commit d51c9b64dd

@ -185,9 +185,6 @@ void DataFilesPage::loadSettings()
// mContentSelector.
mContentModel->uncheckAll();
QStringList gameFiles = mLauncherSettings.values(QString("Profiles/") + profile + QString("/master"), Qt::MatchExactly);
QStringList addons = mLauncherSettings.values(QString("Profiles/") + profile + QString("/plugin"), Qt::MatchExactly);
}
void DataFilesPage::saveSettings()
@ -202,27 +199,14 @@ void DataFilesPage::saveSettings()
mLauncherSettings.setValue(QString("Profiles/currentprofile"), profile);
}
mLauncherSettings.remove(QString("Profiles/") + profile + QString("/master"));
mLauncherSettings.remove(QString("Profiles/") + profile + QString("/plugin"));
mGameSettings.remove(QString("master"));
mGameSettings.remove(QString("plugins"));
mLauncherSettings.remove(QString("Profiles/") + profile + QString("/content"));
mGameSettings.remove(QString("content"));
ContentSelectorModel::ContentFileList items = mContentModel->checkedItems();
foreach(const ContentSelectorModel::EsmFile *item, items) {
if (item->gameFiles().size() == 0) {
mLauncherSettings.setMultiValue(QString("Profiles/") + profile + QString("/master"), item->fileName());
mGameSettings.setMultiValue(QString("content"), item->fileName());
} else {
mLauncherSettings.setMultiValue(QString("Profiles/") + profile + QString("/plugin"), item->fileName());
mGameSettings.setMultiValue(QString("content"), item->fileName());
}
mLauncherSettings.setMultiValue(QString("Profiles/") + profile + QString("/content"), item->fileName());
mGameSettings.setMultiValue(QString("content"), item->fileName());
}
}
void DataFilesPage::updateOkButton(const QString &text)
@ -281,8 +265,7 @@ void DataFilesPage::on_deleteProfileAction_triggered()
msgBox.exec();
if (msgBox.clickedButton() == deleteButton) {
mLauncherSettings.remove(QString("Profiles/") + profile + QString("/master"));
mLauncherSettings.remove(QString("Profiles/") + profile + QString("/plugin"));
mLauncherSettings.remove(QString("Profiles/") + profile + QString("/content"));
// Remove the profile from the combobox
profilesComboBox->removeItem(profilesComboBox->findText(profile));
@ -348,8 +331,7 @@ void DataFilesPage::profileRenamed(const QString &previous, const QString &curre
saveSettings();
// Remove the old one
mLauncherSettings.remove(QString("Profiles/") + previous + QString("/master"));
mLauncherSettings.remove(QString("Profiles/") + previous + QString("/plugin"));
mLauncherSettings.remove(QString("Profiles/") + previous + QString("/content"));
// Remove the profile from the combobox
profilesComboBox->removeItem(profilesComboBox->findText(previous));

@ -261,19 +261,11 @@ bool MainDialog::showFirstRunDialog()
// Add a new profile
if (msgBox.isChecked()) {
mLauncherSettings.setValue(QString("Profiles/currentprofile"), QString("Imported"));
mLauncherSettings.remove(QString("Profiles/Imported/content"));
mLauncherSettings.remove(QString("Profiles/Imported/master"));
mLauncherSettings.remove(QString("Profiles/Imported/plugin"));
QStringList masters = mGameSettings.values(QString("master"));
QStringList plugins = mGameSettings.values(QString("plugin"));
foreach (const QString &master, masters) {
mLauncherSettings.setMultiValue(QString("Profiles/Imported/master"), master);
}
foreach (const QString &plugin, plugins) {
mLauncherSettings.setMultiValue(QString("Profiles/Imported/plugin"), plugin);
QStringList contents = mGameSettings.values(QString("content"));
foreach (const QString &content, contents) {
mLauncherSettings.setMultiValue(QString("Profiles/Imported/content"), content);
}
}

@ -139,13 +139,13 @@ bool GameSettings::writeFile(QTextStream &stream)
while (i.hasPrevious()) {
i.previous();
if (i.key() == QLatin1String("master") || i.key() == QLatin1String("plugin"))
if (i.key() == QLatin1String("content"))
continue;
// Quote paths with spaces
if (i.key() == QLatin1String("data")
|| i.key() == QLatin1String("data-local")
|| i.key() == QLatin1String("resources"))
|| i.key() == QLatin1String("data-local")
|| i.key() == QLatin1String("resources"))
{
if (i.value().contains(QChar(' ')))
{
@ -161,15 +161,24 @@ bool GameSettings::writeFile(QTextStream &stream)
}
QStringList masters = mSettings.values(QString("master"));
for (int i = masters.count(); i--;) {
stream << "content=" << masters.at(i) << "\n";
QStringList content = mSettings.values(QString("content"));
for (int i = content.count(); i--;) {
stream << "content=" << content.at(i) << "\n";
}
QStringList plugins = mSettings.values(QString("plugin"));
for (int i = plugins.count(); i--;) {
stream << "content=" << plugins.at(i) << "\n";
return true;
}
bool GameSettings::hasMaster()
{
bool result = false;
QStringList content = mSettings.values(QString("content"));
for (int i = 0; i < content.count(); ++i) {
if (content.at(i).contains(".omwgame") || content.at(i).contains(".esm")) {
result = true;
break;
}
}
return true;
return result;
}

@ -8,8 +8,11 @@
#include <boost/filesystem/path.hpp>
namespace Files { typedef std::vector<boost::filesystem::path> PathContainer;
struct ConfigurationManager;}
namespace Files
{
typedef std::vector<boost::filesystem::path> PathContainer;
struct ConfigurationManager;
}
class GameSettings
{
@ -43,7 +46,8 @@ public:
inline QStringList getDataDirs() { return mDataDirs; }
inline void addDataDir(const QString &dir) { if(!dir.isEmpty()) mDataDirs.append(dir); }
inline QString getDataLocal() {return mDataLocal; }
inline bool hasMaster() { return mSettings.count(QString("master")) > 0; }
bool hasMaster();
QStringList values(const QString &key, const QStringList &defaultValues = QStringList());
bool readFile(QTextStream &stream);

@ -461,9 +461,17 @@ ContentSelectorModel::ContentFileList ContentSelectorModel::ContentModel::checke
{
ContentFileList list;
// First search for game files and next addons,
// so we get more or less correct game files vs addons order.
foreach (EsmFile *file, mFiles)
{
if (isChecked(file->fileName()))
if (isChecked(file->fileName()) && file->isGameFile())
list << file;
}
foreach (EsmFile *file, mFiles)
{
if (isChecked(file->fileName()) && !file->isGameFile())
list << file;
}

Loading…
Cancel
Save