Morrowind.ini import progress bar. (Fixes #2344)

1. Show a "bouncing ball" Progress bar when importing from morrowind.ini.
2. Removed dialog that asks for content list name when import game files from morrowind.ini. Instead, name is time stamp.
3. Removed commented out code.
4. Additional bugfix. No longer create a empty content list when OpenMW.cfg has no content files.
celladd
dteviot 10 years ago
parent 4c5bba2947
commit accc078e0e

@ -238,24 +238,8 @@ void Launcher::MainDialog::changePage(QListWidgetItem *current, QListWidgetItem
current = previous;
int currentIndex = iconWidget->row(current);
// int previousIndex = iconWidget->row(previous);
pagesWidget->setCurrentIndex(currentIndex);
// DataFilesPage *previousPage = dynamic_cast<DataFilesPage *>(pagesWidget->widget(previousIndex));
// DataFilesPage *currentPage = dynamic_cast<DataFilesPage *>(pagesWidget->widget(currentIndex));
// //special call to update/save data files page list view when it's displayed/hidden.
// if (previousPage)
// {
// if (previousPage->objectName() == "DataFilesPage")
// previousPage->saveSettings();
// }
// else if (currentPage)
// {
// if (currentPage->objectName() == "DataFilesPage")
// currentPage->loadSettings();
// }
mSettingsPage->resetProgressBar();
}
bool Launcher::MainDialog::setupLauncherSettings()

@ -4,6 +4,7 @@
#include <QMessageBox>
#include <QDebug>
#include <QDir>
#include <QTimer>
#include <components/files/configurationmanager.hpp>
@ -39,6 +40,7 @@ Launcher::SettingsPage::SettingsPage(Files::ConfigurationManager &cfg,
mWizardInvoker = new ProcessInvoker();
mImporterInvoker = new ProcessInvoker();
resetProgressBar();
connect(mWizardInvoker->getProcess(), SIGNAL(started()),
this, SLOT(wizardStarted()));
@ -141,8 +143,13 @@ void Launcher::SettingsPage::on_importerButton_clicked()
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))
return;
{
resetProgressBar();
}
}
void Launcher::SettingsPage::on_browseButton_clicked()
@ -197,38 +204,36 @@ void Launcher::SettingsPage::importerStarted()
void Launcher::SettingsPage::importerFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
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
QString oldContentListName = mLauncherSettings.getCurrentContentListName();
if (mProfileDialog->exec() == QDialog::Accepted)
{
// 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);
}
resetProgressBar();
const QString newContentListName(mProfileDialog->lineEdit()->text());
const QStringList files(mGameSettings.getContentList());
mLauncherSettings.setCurrentContentListName(newContentListName);
mLauncherSettings.setContentList(newContentListName, files);
QMessageBox msgBox;
msgBox.setWindowTitle(tr("Importer finished"));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setIcon(QMessageBox::Warning);
msgBox.setText(tr("Failed to import settings from INI file."));
msgBox.exec();
}
else
{
// indicate progress finished
progressBar->setMaximum(1);
progressBar->setValue(1);
// Make DataFiles Page load the new content list.
// Importer may have changed settings, so refresh
mMain->reloadSettings();
}
}
importerButton->setEnabled(true);
}
void Launcher::SettingsPage::resetProgressBar()
{
// set progress bar to 0 %
progressBar->setMaximum(1);
progressBar->setValue(0);
}
void Launcher::SettingsPage::updateOkButton(const QString &text)
{
// We do this here because we need to access the profiles

@ -30,6 +30,9 @@ namespace Launcher
void saveSettings();
bool loadSettings();
/// set progress bar on page to 0%
void resetProgressBar();
private slots:
void on_wizardButton_clicked();
@ -57,7 +60,6 @@ namespace Launcher
MainDialog *mMain;
TextInputDialog *mProfileDialog;
};
}

@ -105,6 +105,12 @@ void Config::LauncherSettings::setContentList(const GameSettings& gameSettings)
// obtain content list from game settings (if present)
const QStringList files(gameSettings.getContentList());
// if openmw.cfg has no content, exit so we don't create an empty content list.
if (files.isEmpty())
{
return;
}
// if any existing profile in launcher matches the content list, make that profile the default
foreach(const QString &listName, getContentLists())
{

@ -131,6 +131,13 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QProgressBar" name="progressBar">
<property name="maximum">
<number>4</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>

Loading…
Cancel
Save