|
|
@ -39,6 +39,7 @@ Launcher::SettingsPage::SettingsPage(Files::ConfigurationManager &cfg,
|
|
|
|
|
|
|
|
|
|
|
|
mWizardInvoker = new ProcessInvoker();
|
|
|
|
mWizardInvoker = new ProcessInvoker();
|
|
|
|
mImporterInvoker = new ProcessInvoker();
|
|
|
|
mImporterInvoker = new ProcessInvoker();
|
|
|
|
|
|
|
|
resetProgressBar();
|
|
|
|
|
|
|
|
|
|
|
|
connect(mWizardInvoker->getProcess(), SIGNAL(started()),
|
|
|
|
connect(mWizardInvoker->getProcess(), SIGNAL(started()),
|
|
|
|
this, SLOT(wizardStarted()));
|
|
|
|
this, SLOT(wizardStarted()));
|
|
|
@ -94,7 +95,7 @@ Launcher::SettingsPage::~SettingsPage()
|
|
|
|
|
|
|
|
|
|
|
|
void Launcher::SettingsPage::on_wizardButton_clicked()
|
|
|
|
void Launcher::SettingsPage::on_wizardButton_clicked()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
saveSettings();
|
|
|
|
mMain->writeSettings();
|
|
|
|
|
|
|
|
|
|
|
|
if (!mWizardInvoker->startProcess(QLatin1String("openmw-wizard"), false))
|
|
|
|
if (!mWizardInvoker->startProcess(QLatin1String("openmw-wizard"), false))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -102,7 +103,7 @@ void Launcher::SettingsPage::on_wizardButton_clicked()
|
|
|
|
|
|
|
|
|
|
|
|
void Launcher::SettingsPage::on_importerButton_clicked()
|
|
|
|
void Launcher::SettingsPage::on_importerButton_clicked()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
saveSettings();
|
|
|
|
mMain->writeSettings();
|
|
|
|
|
|
|
|
|
|
|
|
// Create the file if it doesn't already exist, else the importer will fail
|
|
|
|
// Create the file if it doesn't already exist, else the importer will fail
|
|
|
|
QString path(QString::fromUtf8(mCfgMgr.getUserConfigPath().string().c_str()));
|
|
|
|
QString path(QString::fromUtf8(mCfgMgr.getUserConfigPath().string().c_str()));
|
|
|
@ -141,8 +142,13 @@ void Launcher::SettingsPage::on_importerButton_clicked()
|
|
|
|
|
|
|
|
|
|
|
|
qDebug() << "arguments " << arguments;
|
|
|
|
qDebug() << "arguments " << arguments;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// start the progress bar as a "bouncing ball"
|
|
|
|
|
|
|
|
progressBar->setMaximum(0);
|
|
|
|
|
|
|
|
progressBar->setValue(0);
|
|
|
|
if (!mImporterInvoker->startProcess(QLatin1String("openmw-iniimporter"), arguments, false))
|
|
|
|
if (!mImporterInvoker->startProcess(QLatin1String("openmw-iniimporter"), arguments, false))
|
|
|
|
return;
|
|
|
|
{
|
|
|
|
|
|
|
|
resetProgressBar();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Launcher::SettingsPage::on_browseButton_clicked()
|
|
|
|
void Launcher::SettingsPage::on_browseButton_clicked()
|
|
|
@ -197,38 +203,35 @@ void Launcher::SettingsPage::importerStarted()
|
|
|
|
void Launcher::SettingsPage::importerFinished(int exitCode, QProcess::ExitStatus exitStatus)
|
|
|
|
void Launcher::SettingsPage::importerFinished(int exitCode, QProcess::ExitStatus exitStatus)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (exitCode != 0 || exitStatus == QProcess::CrashExit)
|
|
|
|
if (exitCode != 0 || exitStatus == QProcess::CrashExit)
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Importer may have changed settings, so refresh
|
|
|
|
|
|
|
|
mMain->reloadSettings();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Import selected data files from openmw.cfg
|
|
|
|
|
|
|
|
if (addonsCheckBox->isChecked())
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Because we've reloaded settings, the current content list matches content in OpenMW.cfg
|
|
|
|
resetProgressBar();
|
|
|
|
QString oldContentListName = mLauncherSettings.getCurrentContentListName();
|
|
|
|
|
|
|
|
if (mProfileDialog->exec() == QDialog::Accepted)
|
|
|
|
QMessageBox msgBox;
|
|
|
|
{
|
|
|
|
msgBox.setWindowTitle(tr("Importer finished"));
|
|
|
|
// remove the current content list to prevent duplication
|
|
|
|
msgBox.setStandardButtons(QMessageBox::Ok);
|
|
|
|
//... except, not allowed to delete the Default content list
|
|
|
|
msgBox.setIcon(QMessageBox::Warning);
|
|
|
|
if (oldContentListName.compare(DataFilesPage::mDefaultContentListName) != 0)
|
|
|
|
msgBox.setText(tr("Failed to import settings from INI file."));
|
|
|
|
{
|
|
|
|
msgBox.exec();
|
|
|
|
mLauncherSettings.removeContentList(oldContentListName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
const QString newContentListName(mProfileDialog->lineEdit()->text());
|
|
|
|
// indicate progress finished
|
|
|
|
const QStringList files(mGameSettings.getContentList());
|
|
|
|
progressBar->setMaximum(1);
|
|
|
|
mLauncherSettings.setCurrentContentListName(newContentListName);
|
|
|
|
progressBar->setValue(1);
|
|
|
|
mLauncherSettings.setContentList(newContentListName, files);
|
|
|
|
|
|
|
|
|
|
|
|
// Importer may have changed settings, so refresh
|
|
|
|
// Make DataFiles Page load the new content list.
|
|
|
|
mMain->reloadSettings();
|
|
|
|
mMain->reloadSettings();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
importerButton->setEnabled(true);
|
|
|
|
importerButton->setEnabled(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Launcher::SettingsPage::resetProgressBar()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// set progress bar to 0 %
|
|
|
|
|
|
|
|
progressBar->reset();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Launcher::SettingsPage::updateOkButton(const QString &text)
|
|
|
|
void Launcher::SettingsPage::updateOkButton(const QString &text)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// We do this here because we need to access the profiles
|
|
|
|
// We do this here because we need to access the profiles
|
|
|
|