diff --git a/apps/launcher/datafilespage.cpp b/apps/launcher/datafilespage.cpp
index a4992bc630..3128c7b759 100644
--- a/apps/launcher/datafilespage.cpp
+++ b/apps/launcher/datafilespage.cpp
@@ -1063,8 +1063,24 @@ void DataFilesPage::writeConfig(QString profile)
return;
}
+ QString pathStr = QString::fromStdString(mCfgMgr.getUserPath().string());
+ QDir userPath(pathStr);
+
+ if (!userPath.exists()) {
+ if (!userPath.mkpath(pathStr)) {
+ QMessageBox msgBox;
+ msgBox.setWindowTitle("Error creating OpenMW configuration directory");
+ msgBox.setIcon(QMessageBox::Critical);
+ msgBox.setStandardButtons(QMessageBox::Ok);
+ msgBox.setText(tr("
Could not create %0
\Please make sure you have the right permissions and try again.
").arg(pathStr));
+ msgBox.exec();
+
+ qApp->exit(1);
+ return;
+ }
+ }
// Open the OpenMW config as a QFile
- QFile file(QString::fromStdString((mCfgMgr.getUserPath() / "openmw.cfg").string()));
+ QFile file(pathStr.append("openmw.cfg"));
if (!file.open(QIODevice::ReadWrite | QIODevice::Text)) {
// File cannot be opened or created
diff --git a/apps/launcher/filedialog.cpp b/apps/launcher/filedialog.cpp
index 20ec3e234f..ead1cbc55b 100644
--- a/apps/launcher/filedialog.cpp
+++ b/apps/launcher/filedialog.cpp
@@ -17,7 +17,7 @@ FileDialog::FileDialog(QWidget *parent)
box->addButton(mChooseButton, QDialogButtonBox::AcceptRole);
connect(this, SIGNAL(directoryEntered(const QString&)), this, SLOT(updateChooseButton(const QString&)));
- emit directoryEntered(directory().absolutePath());
+ emit directoryEntered(QDir::currentPath());
}
QString FileDialog::getExistingDirectory(QWidget *parent,
diff --git a/apps/launcher/main.cpp b/apps/launcher/main.cpp
index bd29e2bcac..cbc1c4da36 100644
--- a/apps/launcher/main.cpp
+++ b/apps/launcher/main.cpp
@@ -31,8 +31,10 @@ int main(int argc, char *argv[])
QDir::setCurrent(dir.absolutePath());
- MainDialog dialog;
- return dialog.exec();
+ MainDialog mainWin;
+ mainWin.show();
+
+ return app.exec();
}
diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp
index d404fed8e7..63ea96b6f7 100644
--- a/apps/launcher/maindialog.cpp
+++ b/apps/launcher/maindialog.cpp
@@ -29,7 +29,10 @@ MainDialog::MainDialog()
mSettings.loadUser(globaldefault);
- mIconWidget = new QListWidget;
+ QWidget *centralWidget = new QWidget(this);
+ setCentralWidget(centralWidget);
+
+ mIconWidget = new QListWidget(centralWidget);
mIconWidget->setObjectName("IconWidget");
mIconWidget->setViewMode(QListView::IconMode);
mIconWidget->setWrapping(false);
@@ -43,7 +46,7 @@ MainDialog::MainDialog()
mIconWidget->setCurrentRow(0);
mIconWidget->setFlow(QListView::LeftToRight);
- QGroupBox *groupBox = new QGroupBox(this);
+ QGroupBox *groupBox = new QGroupBox(centralWidget);
QVBoxLayout *groupLayout = new QVBoxLayout(groupBox);
mPagesWidget = new QStackedWidget(groupBox);
@@ -51,16 +54,15 @@ MainDialog::MainDialog()
QPushButton *playButton = new QPushButton(tr("Play"));
- QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
+ QDialogButtonBox *buttonBox = new QDialogButtonBox(centralWidget);
buttonBox->setStandardButtons(QDialogButtonBox::Close);
buttonBox->addButton(playButton, QDialogButtonBox::AcceptRole);
- QVBoxLayout *dialogLayout = new QVBoxLayout(this);
+ QVBoxLayout *dialogLayout = new QVBoxLayout(centralWidget);
dialogLayout->addWidget(mIconWidget);
dialogLayout->addWidget(groupBox);
dialogLayout->addWidget(buttonBox);
-
setWindowTitle(tr("OpenMW Launcher"));
setWindowIcon(QIcon(":/images/openmw.png"));
// Remove what's this? button
diff --git a/apps/launcher/maindialog.hpp b/apps/launcher/maindialog.hpp
index 0065aa8c47..59c6cbd2d4 100644
--- a/apps/launcher/maindialog.hpp
+++ b/apps/launcher/maindialog.hpp
@@ -1,7 +1,7 @@
#ifndef MAINDIALOG_H
#define MAINDIALOG_H
-#include
+#include
#include
#include
@@ -17,7 +17,7 @@ class PlayPage;
class GraphicsPage;
class DataFilesPage;
-class MainDialog : public QDialog
+class MainDialog : public QMainWindow
{
Q_OBJECT