forked from teamnwah/openmw-tes3coop
Added a warning when stylesheet cannot be read and check if data paths contain masters/plugins
This commit is contained in:
parent
6eaaf20c94
commit
a0007325ad
7 changed files with 33 additions and 21 deletions
|
@ -226,7 +226,7 @@ void DataFilesPage::setupDataFiles()
|
||||||
QStringList profiles = mLauncherSettings.subKeys(QString("Profiles/"));
|
QStringList profiles = mLauncherSettings.subKeys(QString("Profiles/"));
|
||||||
QString profile = mLauncherSettings.value(QString("Profiles/currentprofile"));
|
QString profile = mLauncherSettings.value(QString("Profiles/currentprofile"));
|
||||||
|
|
||||||
mProfilesComboBox->setCurrentIndex(-1);
|
if (!profiles.isEmpty())
|
||||||
mProfilesComboBox->addItems(profiles);
|
mProfilesComboBox->addItems(profiles);
|
||||||
|
|
||||||
// Add the current profile if empty
|
// Add the current profile if empty
|
||||||
|
|
|
@ -78,10 +78,20 @@ MainDialog::MainDialog()
|
||||||
file.setFileName(QString::fromStdString((mCfgMgr.getLocalPath() / "launcher.qss").string()));
|
file.setFileName(QString::fromStdString((mCfgMgr.getLocalPath() / "launcher.qss").string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
file.open(QFile::ReadOnly);
|
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("<br><b>Could not open %0 for reading</b><br><br> \
|
||||||
|
Please make sure you have the right permissions \
|
||||||
|
and try again.<br>").arg(file.fileName()));
|
||||||
|
msgBox.exec();
|
||||||
|
} else {
|
||||||
QString styleSheet = QLatin1String(file.readAll());
|
QString styleSheet = QLatin1String(file.readAll());
|
||||||
qApp->setStyleSheet(styleSheet);
|
qApp->setStyleSheet(styleSheet);
|
||||||
file.close();
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
|
connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
|
||||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(play()));
|
connect(buttonBox, SIGNAL(accepted()), this, SLOT(play()));
|
||||||
|
@ -261,7 +271,6 @@ bool MainDialog::showFirstRunDialog()
|
||||||
|
|
||||||
// Add a new profile
|
// Add a new profile
|
||||||
if (msgBox.isChecked()) {
|
if (msgBox.isChecked()) {
|
||||||
qDebug() << "add a new profile";
|
|
||||||
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/master"));
|
||||||
|
@ -330,7 +339,7 @@ bool MainDialog::setupLauncherSettings()
|
||||||
paths.append(userPath + QString("launcher.cfg"));
|
paths.append(userPath + QString("launcher.cfg"));
|
||||||
|
|
||||||
foreach (const QString &path, paths) {
|
foreach (const QString &path, paths) {
|
||||||
qDebug() << "Loading: " << path;
|
qDebug() << "Loading config file:" << qPrintable(path);
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
|
@ -366,7 +375,8 @@ bool MainDialog::setupGameSettings()
|
||||||
paths.append(globalPath + QString("openmw.cfg"));
|
paths.append(globalPath + QString("openmw.cfg"));
|
||||||
|
|
||||||
foreach (const QString &path, paths) {
|
foreach (const QString &path, paths) {
|
||||||
qDebug() << "Loading: " << path;
|
qDebug() << "Loading config file:" << qPrintable(path);
|
||||||
|
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
|
@ -388,7 +398,19 @@ bool MainDialog::setupGameSettings()
|
||||||
file.close();
|
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;
|
QMessageBox msgBox;
|
||||||
msgBox.setWindowTitle(tr("Error detecting Morrowind installation"));
|
msgBox.setWindowTitle(tr("Error detecting Morrowind installation"));
|
||||||
|
@ -415,13 +437,11 @@ bool MainDialog::setupGameSettings()
|
||||||
if (selectedFile.isEmpty())
|
if (selectedFile.isEmpty())
|
||||||
return false; // Cancel was clicked;
|
return false; // Cancel was clicked;
|
||||||
|
|
||||||
qDebug() << selectedFile;
|
|
||||||
QFileInfo info(selectedFile);
|
QFileInfo info(selectedFile);
|
||||||
|
|
||||||
// Add the new dir to the settings file and to the data dir container
|
// Add the new dir to the settings file and to the data dir container
|
||||||
mGameSettings.setValue(QString("data"), info.absolutePath());
|
mGameSettings.setValue(QString("data"), info.absolutePath());
|
||||||
mGameSettings.addDataDir(info.absolutePath());
|
mGameSettings.addDataDir(info.absolutePath());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -454,7 +474,7 @@ bool MainDialog::setupGraphicsSettings()
|
||||||
paths.append(userPath + QString("settings.cfg"));
|
paths.append(userPath + QString("settings.cfg"));
|
||||||
|
|
||||||
foreach (const QString &path, paths) {
|
foreach (const QString &path, paths) {
|
||||||
qDebug() << "Loading: " << path;
|
qDebug() << "Loading config file:" << qPrintable(path);
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#include "graphicssettings.hpp"
|
#include "graphicssettings.hpp"
|
||||||
|
|
||||||
GraphicsSettings::GraphicsSettings()
|
GraphicsSettings::GraphicsSettings()
|
||||||
|
|
|
@ -66,7 +66,6 @@ bool LauncherSettings::writeFile(QTextStream &stream)
|
||||||
QString sectionPrefix;
|
QString sectionPrefix;
|
||||||
QRegExp sectionRe("([^/]+)/(.+)$");
|
QRegExp sectionRe("([^/]+)/(.+)$");
|
||||||
QMap<QString, QString> settings = SettingsBase::getSettings();
|
QMap<QString, QString> settings = SettingsBase::getSettings();
|
||||||
qDebug() << "writing " << settings;
|
|
||||||
|
|
||||||
QMapIterator<QString, QString> i(settings);
|
QMapIterator<QString, QString> i(settings);
|
||||||
i.toBack();
|
i.toBack();
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
|
|
||||||
#include "checkablemessagebox.hpp"
|
#include "checkablemessagebox.hpp"
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#include <QRegExpValidator>
|
#include <QRegExpValidator>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QDebug>
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
|
||||||
|
@ -67,8 +66,6 @@ void ProfilesComboBox::slotEditingFinished()
|
||||||
QString current = currentText();
|
QString current = currentText();
|
||||||
QString previous = itemText(currentIndex());
|
QString previous = itemText(currentIndex());
|
||||||
|
|
||||||
qDebug() << current << previous;
|
|
||||||
|
|
||||||
if (currentIndex() == -1)
|
if (currentIndex() == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QDebug>
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QValidator>
|
#include <QValidator>
|
||||||
|
|
Loading…
Reference in a new issue