From 6348af586e80545cae112850ab369b1a93ba45c9 Mon Sep 17 00:00:00 2001
From: pvdk
Welcome to OpenMW!
\ -It is recommended to run the Installation Wizard.
\ -The Wizard will let you select an existing Morrowind installation, \ - or install Morrowind for OpenMW to use.
")); - QAbstractButton *wizardButton = - msgBox.addButton(tr("Run &Installation Wizard"), QMessageBox::AcceptRole); // ActionRole doesn't work?! - QAbstractButton *skipButton = - msgBox.addButton(tr("Skip"), QMessageBox::RejectRole); - Q_UNUSED(skipButton); // Surpress compiler unused warning - - msgBox.exec(); - - if (msgBox.clickedButton() == wizardButton) + if (!setupLauncherSettings()) + return false; + + if (mLauncherSettings.value(QString("General/firstrun"), QString("true")) == QLatin1String("true")) { - if (!mWizardInvoker->startProcess(QLatin1String("openmw-wizard"), false)) { - return false; - } else { - return true; + QMessageBox msgBox; + msgBox.setWindowTitle(tr("First run")); + msgBox.setIcon(QMessageBox::Question); + msgBox.setStandardButtons(QMessageBox::NoButton); + msgBox.setText(tr("Welcome to OpenMW!
\ +It is recommended to run the Installation Wizard.
\ +The Wizard will let you select an existing Morrowind installation, \ + or install Morrowind for OpenMW to use.
")); + + QAbstractButton *wizardButton = + msgBox.addButton(tr("Run &Installation Wizard"), QMessageBox::AcceptRole); // ActionRole doesn't work?! + QAbstractButton *skipButton = + msgBox.addButton(tr("Skip"), QMessageBox::RejectRole); + + Q_UNUSED(skipButton); // Surpress compiler unused warning + + msgBox.exec(); + + if (msgBox.clickedButton() == wizardButton) + { + if (!mWizardInvoker->startProcess(QLatin1String("openmw-wizard"), false)) { + return false; + } else { + return true; + } } } - show(); - return true; + return setup(); } bool Launcher::MainDialog::setup() { - if (!setupLauncherSettings()) - return false; - if (!setupGameSettings()) return false; @@ -214,17 +218,7 @@ bool Launcher::MainDialog::setup() loadSettings(); - // Check if we need to run the wizard - if (mLauncherSettings.value(QString("General/firstrun"), QString("true")) == QLatin1String("true")) - { - if (!showFirstRunDialog()) { - return false; - } else { - return true; - } - } - - show(); // Show ourselves if the wizard is not being run + show(); return true; } @@ -629,6 +623,9 @@ void Launcher::MainDialog::wizardFinished(int exitCode, QProcess::ExitStatus exi if (exitCode != 0 || exitStatus == QProcess::CrashExit) return qApp->quit(); + if (!setup()) + return; + reloadSettings(); show(); } diff --git a/apps/wizard/existinginstallationpage.cpp b/apps/wizard/existinginstallationpage.cpp index 7171cb26b..83ea20f5a 100644 --- a/apps/wizard/existinginstallationpage.cpp +++ b/apps/wizard/existinginstallationpage.cpp @@ -15,14 +15,16 @@ Wizard::ExistingInstallationPage::ExistingInstallationPage(QWidget *parent) : setupUi(this); + // Add a placeholder item to the list of installations + QListWidgetItem *emptyItem = new QListWidgetItem(tr("No existing installations detected")); + emptyItem->setFlags(Qt::NoItemFlags); + + installationsList->insertItem(0, emptyItem); + } void Wizard::ExistingInstallationPage::initializePage() { - QListWidgetItem *emptyItem = new QListWidgetItem(tr("No existing installations detected")); - emptyItem->setFlags(Qt::NoItemFlags); - installationsList->addItem(emptyItem); - // Add the available installation paths QStringList paths(mWizard->mInstallations.keys()); @@ -35,7 +37,9 @@ void Wizard::ExistingInstallationPage::initializePage() foreach (const QString &path, paths) { QListWidgetItem *item = new QListWidgetItem(path); - installationsList->addItem(item); + + if (installationsList->findItems(path, Qt::MatchExactly).isEmpty()) + installationsList->addItem(item); } connect(installationsList, SIGNAL(currentTextChanged(QString)), diff --git a/apps/wizard/mainwizard.cpp b/apps/wizard/mainwizard.cpp index 2469cfa8b..e587d77e5 100644 --- a/apps/wizard/mainwizard.cpp +++ b/apps/wizard/mainwizard.cpp @@ -37,9 +37,6 @@ Wizard::MainWizard::MainWizard(QWidget *parent) : setWindowIcon(QIcon(QLatin1String(":/images/openmw-wizard.png"))); setMinimumWidth(550); - // This prevents initializePage() being called multiple times - setOption(QWizard::IndependentPages); - // Set the property for comboboxes to the text instead of index setDefaultProperty("QComboBox", "currentText", "currentIndexChanged"); @@ -283,9 +280,6 @@ void Wizard::MainWizard::runSettingsImporter() if (!mImporterInvoker->startProcess(QLatin1String("mwiniimport"), arguments, false)) return qApp->quit(); - - // Re-read the game settings - setupGameSettings(); } void Wizard::MainWizard::addInstallation(const QString &path)