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; current = previous;
int currentIndex = iconWidget->row(current); int currentIndex = iconWidget->row(current);
// int previousIndex = iconWidget->row(previous);
pagesWidget->setCurrentIndex(currentIndex); pagesWidget->setCurrentIndex(currentIndex);
mSettingsPage->resetProgressBar();
// 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();
// }
} }
bool Launcher::MainDialog::setupLauncherSettings() bool Launcher::MainDialog::setupLauncherSettings()

@ -4,6 +4,7 @@
#include <QMessageBox> #include <QMessageBox>
#include <QDebug> #include <QDebug>
#include <QDir> #include <QDir>
#include <QTimer>
#include <components/files/configurationmanager.hpp> #include <components/files/configurationmanager.hpp>
@ -39,6 +40,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()));
@ -141,8 +143,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 +204,36 @@ 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->setMaximum(1);
progressBar->setValue(0);
}
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

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

@ -105,6 +105,12 @@ void Config::LauncherSettings::setContentList(const GameSettings& gameSettings)
// obtain content list from game settings (if present) // obtain content list from game settings (if present)
const QStringList files(gameSettings.getContentList()); 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 // if any existing profile in launcher matches the content list, make that profile the default
foreach(const QString &listName, getContentLists()) foreach(const QString &listName, getContentLists())
{ {

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

Loading…
Cancel
Save