diff --git a/apps/launcher/datafilespage.cpp b/apps/launcher/datafilespage.cpp index a0df2fb82..f8ccf3e83 100644 --- a/apps/launcher/datafilespage.cpp +++ b/apps/launcher/datafilespage.cpp @@ -226,8 +226,8 @@ void DataFilesPage::setupDataFiles() QStringList profiles = mLauncherSettings.subKeys(QString("Profiles/")); QString profile = mLauncherSettings.value(QString("Profiles/currentprofile")); - mProfilesComboBox->setCurrentIndex(-1); - mProfilesComboBox->addItems(profiles); + if (!profiles.isEmpty()) + mProfilesComboBox->addItems(profiles); // Add the current profile if empty if (mProfilesComboBox->findText(profile) == -1) diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index c03a31fd5..c1e70bb3f 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -78,10 +78,20 @@ MainDialog::MainDialog() file.setFileName(QString::fromStdString((mCfgMgr.getLocalPath() / "launcher.qss").string())); } - file.open(QFile::ReadOnly); - QString styleSheet = QLatin1String(file.readAll()); - qApp->setStyleSheet(styleSheet); - file.close(); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { + QMessageBox msgBox; + msgBox.setWindowTitle(tr("Error opening Launcher stylesheet")); + msgBox.setIcon(QMessageBox::Warning); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setText(QObject::tr("
Could not open %0 for reading

\ + Please make sure you have the right permissions \ + and try again.
").arg(file.fileName())); + msgBox.exec(); + } else { + QString styleSheet = QLatin1String(file.readAll()); + qApp->setStyleSheet(styleSheet); + file.close(); + } connect(buttonBox, SIGNAL(rejected()), this, SLOT(close())); connect(buttonBox, SIGNAL(accepted()), this, SLOT(play())); @@ -261,7 +271,6 @@ bool MainDialog::showFirstRunDialog() // Add a new profile if (msgBox.isChecked()) { - qDebug() << "add a new profile"; mLauncherSettings.setValue(QString("Profiles/CurrentProfile"), QString("Imported")); mLauncherSettings.remove(QString("Profiles/Imported/master")); @@ -330,7 +339,7 @@ bool MainDialog::setupLauncherSettings() paths.append(userPath + QString("launcher.cfg")); foreach (const QString &path, paths) { - qDebug() << "Loading: " << path; + qDebug() << "Loading config file:" << qPrintable(path); QFile file(path); if (file.exists()) { if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { @@ -366,7 +375,8 @@ bool MainDialog::setupGameSettings() paths.append(globalPath + QString("openmw.cfg")); foreach (const QString &path, paths) { - qDebug() << "Loading: " << path; + qDebug() << "Loading config file:" << qPrintable(path); + QFile file(path); if (file.exists()) { if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { @@ -388,7 +398,19 @@ bool MainDialog::setupGameSettings() file.close(); } - if (mGameSettings.getDataDirs().isEmpty()) + QStringList dataDirs; + + // Check if the paths actually contain data files + foreach (const QString path, mGameSettings.getDataDirs()) { + QDir dir(path); + QStringList filters; + filters << "*.esp" << "*.esm"; + + if (!dir.entryList(filters).isEmpty()) + dataDirs.append(path); + } + + if (dataDirs.isEmpty()) { QMessageBox msgBox; msgBox.setWindowTitle(tr("Error detecting Morrowind installation")); @@ -415,13 +437,11 @@ bool MainDialog::setupGameSettings() if (selectedFile.isEmpty()) return false; // Cancel was clicked; - qDebug() << selectedFile; QFileInfo info(selectedFile); // Add the new dir to the settings file and to the data dir container mGameSettings.setValue(QString("data"), info.absolutePath()); mGameSettings.addDataDir(info.absolutePath()); - } return true; @@ -454,7 +474,7 @@ bool MainDialog::setupGraphicsSettings() paths.append(userPath + QString("settings.cfg")); foreach (const QString &path, paths) { - qDebug() << "Loading: " << path; + qDebug() << "Loading config file:" << qPrintable(path); QFile file(path); if (file.exists()) { if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { diff --git a/apps/launcher/settings/graphicssettings.cpp b/apps/launcher/settings/graphicssettings.cpp index fd70917b5..a92477ebb 100644 --- a/apps/launcher/settings/graphicssettings.cpp +++ b/apps/launcher/settings/graphicssettings.cpp @@ -3,8 +3,6 @@ #include #include -#include - #include "graphicssettings.hpp" GraphicsSettings::GraphicsSettings() diff --git a/apps/launcher/settings/launchersettings.cpp b/apps/launcher/settings/launchersettings.cpp index ee529d891..1101a80b9 100644 --- a/apps/launcher/settings/launchersettings.cpp +++ b/apps/launcher/settings/launchersettings.cpp @@ -66,7 +66,6 @@ bool LauncherSettings::writeFile(QTextStream &stream) QString sectionPrefix; QRegExp sectionRe("([^/]+)/(.+)$"); QMap settings = SettingsBase::getSettings(); - qDebug() << "writing " << settings; QMapIterator i(settings); i.toBack(); diff --git a/apps/launcher/utils/checkablemessagebox.cpp b/apps/launcher/utils/checkablemessagebox.cpp index 990835594..41207a8de 100644 --- a/apps/launcher/utils/checkablemessagebox.cpp +++ b/apps/launcher/utils/checkablemessagebox.cpp @@ -29,7 +29,6 @@ #include "checkablemessagebox.hpp" -#include #include #include diff --git a/apps/launcher/utils/profilescombobox.cpp b/apps/launcher/utils/profilescombobox.cpp index 4c258dae6..c3ff953ae 100644 --- a/apps/launcher/utils/profilescombobox.cpp +++ b/apps/launcher/utils/profilescombobox.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include @@ -67,8 +66,6 @@ void ProfilesComboBox::slotEditingFinished() QString current = currentText(); QString previous = itemText(currentIndex()); - qDebug() << current << previous; - if (currentIndex() == -1) return; diff --git a/apps/launcher/utils/textinputdialog.cpp b/apps/launcher/utils/textinputdialog.cpp index 09b26ae75..011e51bf2 100644 --- a/apps/launcher/utils/textinputdialog.cpp +++ b/apps/launcher/utils/textinputdialog.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include