diff --git a/apps/launcher/datafilespage.cpp b/apps/launcher/datafilespage.cpp
index 512c4b2f82..add3dea40e 100644
--- a/apps/launcher/datafilespage.cpp
+++ b/apps/launcher/datafilespage.cpp
@@ -147,7 +147,7 @@ void DataFilesPage::setupDataFiles()
profilesComboBox->addItems(profiles);
// Add the current profile if empty
- if (profilesComboBox->findText(profile) == -1)
+ if (profilesComboBox->findText(profile) == -1 && !profile.isEmpty())
profilesComboBox->addItem(profile);
if (profilesComboBox->findText(QString("Default")) == -1)
diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp
index e435bd391c..1a5b4d2e93 100644
--- a/apps/launcher/maindialog.cpp
+++ b/apps/launcher/maindialog.cpp
@@ -122,6 +122,51 @@ void MainDialog::createPages()
bool MainDialog::showFirstRunDialog()
{
+ QStringList iniPaths;
+
+ foreach (const QString &path, mGameSettings.getDataDirs()) {
+ QDir dir(path);
+ dir.setPath(dir.canonicalPath()); // Resolve symlinks
+
+ if (!dir.cdUp())
+ continue; // Cannot move from Data Files
+
+ if (dir.exists(QString("Morrowind.ini")))
+ iniPaths.append(dir.absoluteFilePath(QString("Morrowind.ini")));
+ }
+
+ // Ask the user where the Morrowind.ini is
+ if (iniPaths.empty()) {
+ QMessageBox msgBox;
+ msgBox.setWindowTitle(tr("Error detecting Morrowind configuration"));
+ msgBox.setIcon(QMessageBox::Warning);
+ msgBox.setStandardButtons(QMessageBox::Cancel);
+ msgBox.setText(QObject::tr("
Could not find Morrowind.ini
\
+ OpenMW needs to import settings from this file.
\
+ Press \"Browse...\" to specify the location manually.
"));
+
+ QAbstractButton *dirSelectButton =
+ msgBox.addButton(QObject::tr("B&rowse..."), QMessageBox::ActionRole);
+
+ msgBox.exec();
+
+ QString iniFile;
+ if (msgBox.clickedButton() == dirSelectButton) {
+ iniFile = QFileDialog::getOpenFileName(
+ NULL,
+ QObject::tr("Select configuration file"),
+ QDir::currentPath(),
+ QString(tr("Morrowind configuration file (*.ini)")));
+ }
+
+ if (iniFile.isEmpty())
+ return false; // Cancel was clicked;
+
+ QFileInfo info(iniFile);
+ iniPaths.clear();
+ iniPaths.append(info.absoluteFilePath());
+ }
+
CheckableMessageBox msgBox(this);
msgBox.setWindowTitle(tr("Morrowind installation detected"));
@@ -129,7 +174,6 @@ bool MainDialog::showFirstRunDialog()
int size = QApplication::style()->pixelMetric(QStyle::PM_MessageBoxIconSize);
msgBox.setIconPixmap(icon.pixmap(size, size));
-
QAbstractButton *importerButton =
msgBox.addButton(tr("Import"), QDialogButtonBox::AcceptRole); // ActionRole doesn't work?!
QAbstractButton *skipButton =
@@ -138,54 +182,27 @@ bool MainDialog::showFirstRunDialog()
Q_UNUSED(skipButton); // Surpress compiler unused warning
msgBox.setStandardButtons(QDialogButtonBox::NoButton);
-
- msgBox.setText(tr("
An existing Morrowind installation was detected
\
+ msgBox.setText(tr("
An existing Morrowind configuration was detected
\
Would you like to import settings from Morrowind.ini?
"));
-
msgBox.setCheckBoxText(tr("Include selected masters and plugins (creates a new profile)"));
msgBox.exec();
if (msgBox.clickedButton() == importerButton) {
- QStringList iniPaths;
-
- foreach (const QString &path, mGameSettings.getDataDirs()) {
- QDir dir(path);
- dir.setPath(dir.canonicalPath()); // Resolve symlinks
-
- if (!dir.cdUp())
- continue; // Cannot move from Data Files
-
- if (dir.exists(QString("Morrowind.ini")))
- iniPaths.append(dir.absoluteFilePath(QString("Morrowind.ini")));
- }
-
- if (iniPaths.isEmpty()) {
- QMessageBox msgBox;
- msgBox.setWindowTitle(tr("Error reading Morrowind configuration file"));
- msgBox.setIcon(QMessageBox::Warning);
- msgBox.setStandardButtons(QMessageBox::Ok);
- msgBox.setText(QObject::tr("
Could not find Morrowind.ini
\
- The problem may be due to an incomplete installation of Morrowind.
\
- Reinstalling Morrowind may resolve the problem."));
- msgBox.exec();
- return false;
- }
-
if (iniPaths.count() > 1) {
// Multiple Morrowind.ini files found
bool ok;
- QString path = QInputDialog::getItem(this, tr("Multiple configurations found"),
+ QString path = QInputDialog::getItem(this, tr("Multiple configurations found"),
tr("
There are multiple Morrowind.ini files found.
\
Please select the one you wish to import from:"), iniPaths, 0, false, &ok);
- if (ok && !path.isEmpty()) {
- iniPaths.clear();
- iniPaths.append(path);
- } else {
- // Cancel was clicked TODO: should we abort here?
- return false;
- }
+ if (ok && !path.isEmpty()) {
+ iniPaths.clear();
+ iniPaths.append(path);
+ } else {
+ // Cancel was clicked
+ return false;
+ }
}
// Create the file if it doesn't already exist, else the importer will fail
@@ -212,7 +229,6 @@ bool MainDialog::showFirstRunDialog()
// Construct the arguments to run the importer
QStringList arguments;
-
if (msgBox.isChecked())
arguments.append(QString("--game-files"));
@@ -232,7 +248,7 @@ bool MainDialog::showFirstRunDialog()
// Add a new profile
if (msgBox.isChecked()) {
- mLauncherSettings.setValue(QString("Profiles/CurrentProfile"), QString("Imported"));
+ mLauncherSettings.setValue(QString("Profiles/currentprofile"), QString("Imported"));
mLauncherSettings.remove(QString("Profiles/Imported/master"));
mLauncherSettings.remove(QString("Profiles/Imported/plugin"));