diff --git a/apps/launcher/datafilespage.cpp b/apps/launcher/datafilespage.cpp
index d08709a803..fc27ff7cdf 100644
--- a/apps/launcher/datafilespage.cpp
+++ b/apps/launcher/datafilespage.cpp
@@ -22,9 +22,6 @@ DataFilesPage::DataFilesPage(QWidget *parent) : QWidget(parent)
mPluginsProxyModel->setDynamicSortFilter(true);
mPluginsProxyModel->setSourceModel(mPluginsModel);
- // TODO: decide what to do with the selection model
- mPluginsSelectModel = new QItemSelectionModel(mPluginsModel);
-
QLabel *filterLabel = new QLabel(tr("Filter:"), this);
LineEdit *filterLineEdit = new LineEdit(this);
@@ -49,7 +46,6 @@ DataFilesPage::DataFilesPage(QWidget *parent) : QWidget(parent)
mMastersWidget->insertColumn(0);
mPluginsTable->setModel(mPluginsProxyModel);
- mPluginsTable->setSelectionModel(mPluginsSelectModel);
mPluginsTable->setSelectionBehavior(QAbstractItemView::SelectRows);
mPluginsTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
mPluginsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp
index 2e973a5ff1..51d3a3a0b4 100644
--- a/apps/launcher/maindialog.cpp
+++ b/apps/launcher/maindialog.cpp
@@ -100,9 +100,18 @@ void MainDialog::createPages()
// We can't use QSettings directly because it
// does not support multiple keys with the same name
QFile file(mGameConfig->fileName());
+ qDebug() << "createPages gamefilename: " << mGameConfig->fileName();
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
- return; // File cannot be opened or created TODO: throw error
+ QMessageBox msgBox;
+ msgBox.setWindowTitle("Error opening OpenMW configuration file");
+ msgBox.setIcon(QMessageBox::Critical);
+ msgBox.setStandardButtons(QMessageBox::Ok);
+ msgBox.setText(tr("
Could not open %0
\
+ Please make sure you have the right permissions and try again.
").arg(file.fileName()));
+ msgBox.exec();
+
+ QApplication::exit(); // File cannot be opened or created
}
QTextStream in(&file);
@@ -124,8 +133,20 @@ void MainDialog::createPages()
dataDirs.append(dataLocal);
}
- // Now pass the datadirs on to the DataFilesPage
- mDataFilesPage->setupDataFiles(dataDirs, mGameConfig->value("fs-strict").toBool());
+ if (!dataDirs.isEmpty()) {
+ // Now pass the datadirs on to the DataFilesPage
+ mDataFilesPage->setupDataFiles(dataDirs, mGameConfig->value("fs-strict").toBool());
+ } else {
+ QMessageBox msgBox;
+ msgBox.setWindowTitle("Error reading OpenMW configuration file");
+ msgBox.setIcon(QMessageBox::Critical);
+ msgBox.setStandardButtons(QMessageBox::Ok);
+ msgBox.setText(tr("
Could not read the location of the data files
\
+ Please make sure OpenMW is correctly configured and try again.
"));
+ msgBox.exec();
+
+ QApplication::exit(); // No data or data-local entries in openmw.cfg
+ }
// Set the combobox of the play page to imitate the comobox on the datafilespage
mPlayPage->mProfilesComboBox->setModel(mDataFilesPage->mProfilesComboBox->model());
@@ -192,7 +213,6 @@ void MainDialog::play()
writeConfig();
#ifdef Q_WS_WIN
- // Windows TODO: proper install path handling
QString game = "./openmw.exe";
QFile file(game);
#else
@@ -255,7 +275,7 @@ void MainDialog::setupConfig()
if (!file.exists()) {
config = QString::fromStdString(Files::getPath(Files::Path_ConfigUser,
- "openmw", "launcher.cfg"));
+ "openmw", "openmw.cfg"));
}
file.setFileName(config); // Just for displaying information
@@ -286,12 +306,19 @@ void MainDialog::writeConfig()
qDebug() << "Writing to openmw.cfg";
// Open the config as a QFile
+ QFile file(mGameConfig->fileName());
- QString cfgfile = "./openmw.cfg";
-
- QFile file(cfgfile);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
- // File cannot be opened or created TODO: throw error
+ // File cannot be opened or created
+ QMessageBox msgBox;
+ msgBox.setWindowTitle("Error opening OpenMW configuration file");
+ msgBox.setIcon(QMessageBox::Critical);
+ msgBox.setStandardButtons(QMessageBox::Ok);
+ msgBox.setText(tr("
Could not open %0
\
+ Please make sure you have the right permissions and try again.
").arg(file.fileName()));
+ msgBox.exec();
+
+ return;
}
QTextStream in(&file);
@@ -309,7 +336,15 @@ void MainDialog::writeConfig()
// Now we write back the other config entries
if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) {
- // File cannot be opened or created TODO: throw error
+ QMessageBox msgBox;
+ msgBox.setWindowTitle("Error writing OpenMW configuration file");
+ msgBox.setIcon(QMessageBox::Critical);
+ msgBox.setStandardButtons(QMessageBox::Ok);
+ msgBox.setText(tr("
Could not write to %0
\
+ Please make sure you have the right permissions and try again.
").arg(file.fileName()));
+ msgBox.exec();
+
+ return;
}
file.write(buffer);
@@ -317,15 +352,12 @@ void MainDialog::writeConfig()
// Write the list of game files to the config
foreach (const QString ¤tFile, dataFiles) {
- //QFileInfo dataFile = QFileInfo(QString(currentFile).prepend(dataPath));
- //if (dataFile.exists()) {
if (currentFile.endsWith(QString(".esm"), Qt::CaseInsensitive)) {
out << "master=" << currentFile << endl;
} else if (currentFile.endsWith(QString(".esp"), Qt::CaseInsensitive)) {
out << "plugin=" << currentFile << endl;
}
- //}
}
file.close();