Post-merge cleanups, using confignmanager for XDG paths now, thanks scrawl!

loadfix
pvdk 11 years ago
parent c54217d008
commit 2ccf4d6112

@ -2,13 +2,13 @@
#include <QDebug>
#include <QFileDialog>
#include <QDesktopServices>
#include "mainwizard.hpp"
Wizard::InstallationTargetPage::InstallationTargetPage(MainWizard *wizard) :
Wizard::InstallationTargetPage::InstallationTargetPage(MainWizard *wizard, const Files::ConfigurationManager &cfg) :
QWizardPage(wizard),
mWizard(wizard)
mWizard(wizard),
mCfgMgr(cfg)
{
setupUi(this);
@ -17,24 +17,8 @@ Wizard::InstallationTargetPage::InstallationTargetPage(MainWizard *wizard) :
void Wizard::InstallationTargetPage::initializePage()
{
qDebug() << mWizard->field("installation.language");
#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"));
QString path(QFile::decodeName(mCfgMgr.getUserDataPath().string().c_str()));
path.append(QDir::separator() + QLatin1String("data"));
if (!QFile::exists(path)) {
QDir dir;
@ -43,8 +27,6 @@ void Wizard::InstallationTargetPage::initializePage()
QDir dir(path);
targetLineEdit->setText(QDir::toNativeSeparators(dir.absolutePath()));
qDebug() << path;
}
void Wizard::InstallationTargetPage::on_browseButton_clicked()

@ -5,6 +5,11 @@
#include "ui_installationtargetpage.h"
namespace Files
{
struct ConfigurationManager;
}
namespace Wizard
{
class MainWizard;
@ -13,7 +18,7 @@ namespace Wizard
{
Q_OBJECT
public:
InstallationTargetPage(MainWizard *wizard);
InstallationTargetPage(MainWizard *wizard, const Files::ConfigurationManager &cfg);
int nextId() const;
@ -22,6 +27,7 @@ namespace Wizard
private:
MainWizard *mWizard;
const Files::ConfigurationManager &mCfgMgr;
protected:
void initializePage();

@ -41,7 +41,7 @@ Wizard::MainWizard::MainWizard(QWidget *parent) :
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()));
QStringList paths;
@ -122,7 +122,7 @@ void Wizard::MainWizard::setupPages()
setPage(Page_MethodSelection, new MethodSelectionPage(this));
setPage(Page_LanguageSelection, new LanguageSelectionPage(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_Installation, new InstallationPage(this));
setPage(Page_Import, new ImportPage(this));
@ -137,7 +137,7 @@ void Wizard::MainWizard::accept()
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"));
if (!file.open(QIODevice::ReadWrite | QIODevice::Text | QIODevice::Truncate)) {

Loading…
Cancel
Save