More messing around with the launcher config file

This commit is contained in:
Pieter van der Kloet 2011-04-25 07:02:07 +02:00
parent 5f6b4a853f
commit 4ee748552b
3 changed files with 32 additions and 4 deletions

View file

@ -10,9 +10,10 @@ set(LAUNCHER
maindialog.hpp maindialog.hpp
playpage.hpp playpage.hpp
combobox.hpp combobox.hpp
) )
SET(MOC_HDRS set(MOC_HDRS
datafilespage.hpp datafilespage.hpp
lineedit.hpp lineedit.hpp
maindialog.hpp maindialog.hpp

View file

@ -3,6 +3,7 @@
#include <QDebug> // TODO: Remove #include <QDebug> // TODO: Remove
#include <components/esm/esm_reader.hpp> #include <components/esm/esm_reader.hpp>
#include "../openmw/path.hpp"
#include "datafilespage.hpp" #include "datafilespage.hpp"
#include "lineedit.hpp" #include "lineedit.hpp"
@ -46,10 +47,24 @@ DataFilesPage::DataFilesPage(QWidget *parent) : QWidget(parent)
QLabel *profileLabel = new QLabel(tr("Current Profile:"), this); QLabel *profileLabel = new QLabel(tr("Current Profile:"), this);
// TEST // TEST
QFile config("launcher.cfg");
if (config.exists())
{
mLauncherConfig = new QSettings("launcher.cfg", QSettings::IniFormat);
} else {
QString path = QString::fromStdString(OMW::Path::getPath(OMW::Path::GLOBAL_CFG_PATH,
"launcher",
"launcher.cfg"));
mLauncherConfig = new QSettings(path, QSettings::IniFormat);
}
QSettings settings("launcher.cfg", QSettings::IniFormat);
settings.beginGroup("Profiles");
mProfileModel = new QStringListModel(); mProfileModel = new QStringListModel();
QStringList profileList; mProfileModel->setStringList(settings.childGroups());
profileList << "Default" << "New" << "Yeah" << "Cool story bro!";
mProfileModel->setStringList(profileList);
mProfileComboBox = new ComboBox(this); mProfileComboBox = new ComboBox(this);
@ -100,6 +115,9 @@ DataFilesPage::DataFilesPage(QWidget *parent) : QWidget(parent)
//connect(mProfileComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(profileChanged(const QString&))); //connect(mProfileComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(profileChanged(const QString&)));
connect(mProfileComboBox, SIGNAL(textChanged(const QString&, const QString&)), this, SLOT(profileChanged(const QString&, const QString&))); connect(mProfileComboBox, SIGNAL(textChanged(const QString&, const QString&)), this, SLOT(profileChanged(const QString&, const QString&)));
readConfig();
} }
void DataFilesPage::setupDataFiles() void DataFilesPage::setupDataFiles()
@ -361,6 +379,12 @@ void DataFilesPage::profileChanged(const QString &current, const QString &previo
} }
void DataFilesPage::readConfig()
{
// TODO: global etc
}
void DataFilesPage::writeConfig() void DataFilesPage::writeConfig()
{ {
// TODO: Testing the config here // TODO: Testing the config here

View file

@ -12,6 +12,7 @@ class QStandardItemModel;
class QItemSelection; class QItemSelection;
class QItemSelectionModel; class QItemSelectionModel;
class QStringListModel; class QStringListModel;
class QSettings;
class DataFilesPage : public QWidget class DataFilesPage : public QWidget
{ {
@ -22,8 +23,10 @@ public:
ComboBox *mProfileComboBox; ComboBox *mProfileComboBox;
QStringListModel *mProfileModel; QStringListModel *mProfileModel;
QSettings *mLauncherConfig;
const QStringList checkedPlugins(); const QStringList checkedPlugins();
void readConfig();
void writeConfig(); void writeConfig();
public slots: public slots: