mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 22:15:35 +00:00
Implement default installation path support for all platforms
This commit is contained in:
parent
c82f0ec35f
commit
7132b9b0c5
4 changed files with 32 additions and 9 deletions
|
@ -52,9 +52,9 @@ void Wizard::ComponentSelectionPage::initializePage()
|
||||||
|
|
||||||
QString path = field("installation.path").toString();
|
QString path = field("installation.path").toString();
|
||||||
|
|
||||||
QListWidgetItem *morrowindItem = new QListWidgetItem(QString("Morrowind"));
|
QListWidgetItem *morrowindItem = new QListWidgetItem(QLatin1String("Morrowind"));
|
||||||
QListWidgetItem *tribunalItem = new QListWidgetItem(QString("Tribunal"));
|
QListWidgetItem *tribunalItem = new QListWidgetItem(QLatin1String("Tribunal"));
|
||||||
QListWidgetItem *bloodmoonItem = new QListWidgetItem(QString("Bloodmoon"));
|
QListWidgetItem *bloodmoonItem = new QListWidgetItem(QLatin1String("Bloodmoon"));
|
||||||
|
|
||||||
if (field("installation.new").toBool() == true)
|
if (field("installation.new").toBool() == true)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
#include <QDesktopServices>
|
||||||
|
|
||||||
#include "mainwizard.hpp"
|
#include "mainwizard.hpp"
|
||||||
|
|
||||||
|
@ -11,12 +12,37 @@ Wizard::InstallationTargetPage::InstallationTargetPage(MainWizard *wizard) :
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
registerField("installation.path*", targetLineEdit);
|
registerField(QLatin1String("installation.path*"), targetLineEdit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wizard::InstallationTargetPage::initializePage()
|
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()
|
void Wizard::InstallationTargetPage::on_browseButton_clicked()
|
||||||
|
|
|
@ -7,6 +7,8 @@ Wizard::LanguageSelectionPage::LanguageSelectionPage(MainWizard *wizard) :
|
||||||
mWizard(wizard)
|
mWizard(wizard)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
|
registerField(QLatin1String("installation.language"), languagesComboBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Wizard::LanguageSelectionPage::nextId() const
|
int Wizard::LanguageSelectionPage::nextId() const
|
||||||
|
|
|
@ -26,11 +26,6 @@ Wizard::MainWizard::MainWizard(QWidget *parent) :
|
||||||
setWindowTitle(tr("OpenMW Wizard"));
|
setWindowTitle(tr("OpenMW Wizard"));
|
||||||
setupInstallations();
|
setupInstallations();
|
||||||
setupPages();
|
setupPages();
|
||||||
|
|
||||||
QDir dir("/home/pvdk/data");
|
|
||||||
QFileInfo info(dir.absoluteFilePath("../Morrowind.ini"));
|
|
||||||
|
|
||||||
qDebug() << "exists? " << info.exists();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wizard::MainWizard::setupInstallations()
|
void Wizard::MainWizard::setupInstallations()
|
||||||
|
|
Loading…
Reference in a new issue