forked from mirror/openmw-tes3mp
Post-merge cleanups, using confignmanager for XDG paths now, thanks scrawl!
This commit is contained in:
parent
c54217d008
commit
2ccf4d6112
3 changed files with 15 additions and 27 deletions
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QDesktopServices>
|
|
||||||
|
|
||||||
#include "mainwizard.hpp"
|
#include "mainwizard.hpp"
|
||||||
|
|
||||||
Wizard::InstallationTargetPage::InstallationTargetPage(MainWizard *wizard) :
|
Wizard::InstallationTargetPage::InstallationTargetPage(MainWizard *wizard, const Files::ConfigurationManager &cfg) :
|
||||||
QWizardPage(wizard),
|
QWizardPage(wizard),
|
||||||
mWizard(wizard)
|
mWizard(wizard),
|
||||||
|
mCfgMgr(cfg)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
|
@ -17,24 +17,8 @@ Wizard::InstallationTargetPage::InstallationTargetPage(MainWizard *wizard) :
|
||||||
|
|
||||||
void Wizard::InstallationTargetPage::initializePage()
|
void Wizard::InstallationTargetPage::initializePage()
|
||||||
{
|
{
|
||||||
qDebug() << mWizard->field("installation.language");
|
QString path(QFile::decodeName(mCfgMgr.getUserDataPath().string().c_str()));
|
||||||
|
path.append(QDir::separator() + QLatin1String("data"));
|
||||||
#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)) {
|
if (!QFile::exists(path)) {
|
||||||
QDir dir;
|
QDir dir;
|
||||||
|
@ -43,8 +27,6 @@ void Wizard::InstallationTargetPage::initializePage()
|
||||||
|
|
||||||
QDir dir(path);
|
QDir dir(path);
|
||||||
targetLineEdit->setText(QDir::toNativeSeparators(dir.absolutePath()));
|
targetLineEdit->setText(QDir::toNativeSeparators(dir.absolutePath()));
|
||||||
|
|
||||||
qDebug() << path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wizard::InstallationTargetPage::on_browseButton_clicked()
|
void Wizard::InstallationTargetPage::on_browseButton_clicked()
|
||||||
|
|
|
@ -5,6 +5,11 @@
|
||||||
|
|
||||||
#include "ui_installationtargetpage.h"
|
#include "ui_installationtargetpage.h"
|
||||||
|
|
||||||
|
namespace Files
|
||||||
|
{
|
||||||
|
struct ConfigurationManager;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Wizard
|
namespace Wizard
|
||||||
{
|
{
|
||||||
class MainWizard;
|
class MainWizard;
|
||||||
|
@ -13,7 +18,7 @@ namespace Wizard
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
InstallationTargetPage(MainWizard *wizard);
|
InstallationTargetPage(MainWizard *wizard, const Files::ConfigurationManager &cfg);
|
||||||
|
|
||||||
int nextId() const;
|
int nextId() const;
|
||||||
|
|
||||||
|
@ -22,6 +27,7 @@ namespace Wizard
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MainWizard *mWizard;
|
MainWizard *mWizard;
|
||||||
|
const Files::ConfigurationManager &mCfgMgr;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initializePage();
|
void initializePage();
|
||||||
|
|
|
@ -41,7 +41,7 @@ Wizard::MainWizard::MainWizard(QWidget *parent) :
|
||||||
|
|
||||||
void Wizard::MainWizard::setupInstallations()
|
void Wizard::MainWizard::setupInstallations()
|
||||||
{
|
{
|
||||||
QString userPath(QFile::decodeName(mCfgMgr.getUserPath().string().c_str()));
|
QString userPath(QFile::decodeName(mCfgMgr.getUserConfigPath().string().c_str()));
|
||||||
QString globalPath(QFile::decodeName(mCfgMgr.getGlobalPath().string().c_str()));
|
QString globalPath(QFile::decodeName(mCfgMgr.getGlobalPath().string().c_str()));
|
||||||
|
|
||||||
QStringList paths;
|
QStringList paths;
|
||||||
|
@ -122,7 +122,7 @@ void Wizard::MainWizard::setupPages()
|
||||||
setPage(Page_MethodSelection, new MethodSelectionPage(this));
|
setPage(Page_MethodSelection, new MethodSelectionPage(this));
|
||||||
setPage(Page_LanguageSelection, new LanguageSelectionPage(this));
|
setPage(Page_LanguageSelection, new LanguageSelectionPage(this));
|
||||||
setPage(Page_ExistingInstallation, new ExistingInstallationPage(this));
|
setPage(Page_ExistingInstallation, new ExistingInstallationPage(this));
|
||||||
setPage(Page_InstallationTarget, new InstallationTargetPage(this));
|
setPage(Page_InstallationTarget, new InstallationTargetPage(this, mCfgMgr));
|
||||||
setPage(Page_ComponentSelection, new ComponentSelectionPage(this));
|
setPage(Page_ComponentSelection, new ComponentSelectionPage(this));
|
||||||
setPage(Page_Installation, new InstallationPage(this));
|
setPage(Page_Installation, new InstallationPage(this));
|
||||||
setPage(Page_Import, new ImportPage(this));
|
setPage(Page_Import, new ImportPage(this));
|
||||||
|
@ -137,7 +137,7 @@ void Wizard::MainWizard::accept()
|
||||||
|
|
||||||
void Wizard::MainWizard::writeSettings()
|
void Wizard::MainWizard::writeSettings()
|
||||||
{
|
{
|
||||||
QString userPath(QFile::decodeName(mCfgMgr.getUserPath().string().c_str()));
|
QString userPath(QFile::decodeName(mCfgMgr.getUserConfigPath().string().c_str()));
|
||||||
QFile file(userPath + QLatin1String("openmw.cfg"));
|
QFile file(userPath + QLatin1String("openmw.cfg"));
|
||||||
|
|
||||||
if (!file.open(QIODevice::ReadWrite | QIODevice::Text | QIODevice::Truncate)) {
|
if (!file.open(QIODevice::ReadWrite | QIODevice::Text | QIODevice::Truncate)) {
|
||||||
|
|
Loading…
Reference in a new issue