Implement default installation path support for all platforms

loadfix
pvdk 11 years ago
parent c82f0ec35f
commit 7132b9b0c5

@ -52,9 +52,9 @@ void Wizard::ComponentSelectionPage::initializePage()
QString path = field("installation.path").toString();
QListWidgetItem *morrowindItem = new QListWidgetItem(QString("Morrowind"));
QListWidgetItem *tribunalItem = new QListWidgetItem(QString("Tribunal"));
QListWidgetItem *bloodmoonItem = new QListWidgetItem(QString("Bloodmoon"));
QListWidgetItem *morrowindItem = new QListWidgetItem(QLatin1String("Morrowind"));
QListWidgetItem *tribunalItem = new QListWidgetItem(QLatin1String("Tribunal"));
QListWidgetItem *bloodmoonItem = new QListWidgetItem(QLatin1String("Bloodmoon"));
if (field("installation.new").toBool() == true)
{

@ -2,6 +2,7 @@
#include <QDebug>
#include <QFileDialog>
#include <QDesktopServices>
#include "mainwizard.hpp"
@ -11,12 +12,37 @@ Wizard::InstallationTargetPage::InstallationTargetPage(MainWizard *wizard) :
{
setupUi(this);
registerField("installation.path*", targetLineEdit);
registerField(QLatin1String("installation.path*"), targetLineEdit);
}
void Wizard::InstallationTargetPage::initializePage()
{
#ifdef Q_OS_WIN
QString path = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
#endif
#ifdef Q_OS_MAC
QString path = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
#endif
#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
QString path = QFile::decodeName(qgetenv("XDG_DATA_HOME"));
if (path.isEmpty())
path = QDir::homePath() + QLatin1String("/.local/share");
#endif
path.append(QLatin1String("/openmw/data"));
if (!QFile::exists(path)) {
QDir dir;
dir.mkpath(path);
}
QDir dir(path);
targetLineEdit->setText(QDir::toNativeSeparators(dir.absolutePath()));
qDebug() << path;
}
void Wizard::InstallationTargetPage::on_browseButton_clicked()

@ -7,6 +7,8 @@ Wizard::LanguageSelectionPage::LanguageSelectionPage(MainWizard *wizard) :
mWizard(wizard)
{
setupUi(this);
registerField(QLatin1String("installation.language"), languagesComboBox);
}
int Wizard::LanguageSelectionPage::nextId() const

@ -26,11 +26,6 @@ Wizard::MainWizard::MainWizard(QWidget *parent) :
setWindowTitle(tr("OpenMW Wizard"));
setupInstallations();
setupPages();
QDir dir("/home/pvdk/data");
QFileInfo info(dir.absoluteFilePath("../Morrowind.ini"));
qDebug() << "exists? " << info.exists();
}
void Wizard::MainWizard::setupInstallations()

Loading…
Cancel
Save