mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 21:45:33 +00:00
Fix: Importer creates a single Content List (Fixes #2345)
This commit is contained in:
parent
e298589e7f
commit
9d9cabf40d
3 changed files with 27 additions and 8 deletions
|
@ -20,6 +20,9 @@
|
||||||
#include "utils/textinputdialog.hpp"
|
#include "utils/textinputdialog.hpp"
|
||||||
#include "utils/profilescombobox.hpp"
|
#include "utils/profilescombobox.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
const char *Launcher::DataFilesPage::mDefaultContentListName = "Default";
|
||||||
|
|
||||||
Launcher::DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, Config::GameSettings &gameSettings, Config::LauncherSettings &launcherSettings, QWidget *parent)
|
Launcher::DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, Config::GameSettings &gameSettings, Config::LauncherSettings &launcherSettings, QWidget *parent)
|
||||||
: mCfgMgr(cfg)
|
: mCfgMgr(cfg)
|
||||||
, mGameSettings(gameSettings)
|
, mGameSettings(gameSettings)
|
||||||
|
@ -48,9 +51,9 @@ void Launcher::DataFilesPage::buildView()
|
||||||
ui.deleteProfileButton->setToolTip ("Delete an existing Content List");
|
ui.deleteProfileButton->setToolTip ("Delete an existing Content List");
|
||||||
|
|
||||||
//combo box
|
//combo box
|
||||||
ui.profilesComboBox->addItem ("Default");
|
ui.profilesComboBox->addItem(mDefaultContentListName);
|
||||||
ui.profilesComboBox->setPlaceholderText (QString("Select a Content List..."));
|
ui.profilesComboBox->setPlaceholderText (QString("Select a Content List..."));
|
||||||
ui.profilesComboBox->setCurrentIndex(ui.profilesComboBox->findText(QLatin1String("Default")));
|
ui.profilesComboBox->setCurrentIndex(ui.profilesComboBox->findText(QLatin1String(mDefaultContentListName)));
|
||||||
|
|
||||||
// Add the actions to the toolbuttons
|
// Add the actions to the toolbuttons
|
||||||
ui.newProfileButton->setDefaultAction (ui.newProfileAction);
|
ui.newProfileButton->setDefaultAction (ui.newProfileAction);
|
||||||
|
@ -284,7 +287,7 @@ void Launcher::DataFilesPage::updateOkButton(const QString &text)
|
||||||
void Launcher::DataFilesPage::checkForDefaultProfile()
|
void Launcher::DataFilesPage::checkForDefaultProfile()
|
||||||
{
|
{
|
||||||
//don't allow deleting "Default" profile
|
//don't allow deleting "Default" profile
|
||||||
bool success = (ui.profilesComboBox->currentText() != "Default");
|
bool success = (ui.profilesComboBox->currentText() != mDefaultContentListName);
|
||||||
|
|
||||||
ui.deleteProfileAction->setEnabled (success);
|
ui.deleteProfileAction->setEnabled (success);
|
||||||
ui.profilesComboBox->setEditEnabled (success);
|
ui.profilesComboBox->setEditEnabled (success);
|
||||||
|
|
|
@ -58,6 +58,10 @@ namespace Launcher
|
||||||
void on_newProfileAction_triggered();
|
void on_newProfileAction_triggered();
|
||||||
void on_deleteProfileAction_triggered();
|
void on_deleteProfileAction_triggered();
|
||||||
|
|
||||||
|
public:
|
||||||
|
/// Content List that is aways present
|
||||||
|
const static char *mDefaultContentListName;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
TextInputDialog *mProfileDialog;
|
TextInputDialog *mProfileDialog;
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <components/config/launchersettings.hpp>
|
#include <components/config/launchersettings.hpp>
|
||||||
|
|
||||||
#include "utils/textinputdialog.hpp"
|
#include "utils/textinputdialog.hpp"
|
||||||
|
#include "datafilespage.hpp"
|
||||||
|
|
||||||
using namespace Process;
|
using namespace Process;
|
||||||
|
|
||||||
|
@ -198,22 +199,33 @@ void Launcher::SettingsPage::importerFinished(int exitCode, QProcess::ExitStatus
|
||||||
if (exitCode != 0 || exitStatus == QProcess::CrashExit)
|
if (exitCode != 0 || exitStatus == QProcess::CrashExit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Re-read the settings in their current state
|
// Importer may have changed settings, so refresh
|
||||||
mMain->reloadSettings();
|
mMain->reloadSettings();
|
||||||
|
|
||||||
// Import selected data files from openmw.cfg
|
// Import selected data files from openmw.cfg
|
||||||
if (addonsCheckBox->isChecked())
|
if (addonsCheckBox->isChecked())
|
||||||
{
|
{
|
||||||
|
// Because we've reloaded settings, the current content list matches content in OpenMW.cfg
|
||||||
|
QString oldContentListName = mLauncherSettings.getCurrentContentListName();
|
||||||
if (mProfileDialog->exec() == QDialog::Accepted)
|
if (mProfileDialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
const QString profile(mProfileDialog->lineEdit()->text());
|
// remove the current content list to prevent duplication
|
||||||
|
//... except, not allowed to delete the Default content list
|
||||||
|
if (oldContentListName.compare(DataFilesPage::mDefaultContentListName) != 0)
|
||||||
|
{
|
||||||
|
mLauncherSettings.removeContentList(oldContentListName);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString newContentListName(mProfileDialog->lineEdit()->text());
|
||||||
const QStringList files(mGameSettings.getContentList());
|
const QStringList files(mGameSettings.getContentList());
|
||||||
mLauncherSettings.setCurrentContentListName(profile);
|
mLauncherSettings.setCurrentContentListName(newContentListName);
|
||||||
mLauncherSettings.setContentList(profile, files);
|
mLauncherSettings.setContentList(newContentListName, files);
|
||||||
|
|
||||||
|
// Make DataFiles Page load the new content list.
|
||||||
|
mMain->reloadSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mMain->reloadSettings();
|
|
||||||
importerButton->setEnabled(true);
|
importerButton->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue