diff --git a/apps/launcher/CMakeLists.txt b/apps/launcher/CMakeLists.txt index 43c45142c..22b0a175d 100644 --- a/apps/launcher/CMakeLists.txt +++ b/apps/launcher/CMakeLists.txt @@ -10,9 +10,10 @@ set(LAUNCHER maindialog.hpp playpage.hpp combobox.hpp + ) -SET(MOC_HDRS +set(MOC_HDRS datafilespage.hpp lineedit.hpp maindialog.hpp diff --git a/apps/launcher/datafilespage.cpp b/apps/launcher/datafilespage.cpp index cc1f3d7ca..463295f36 100644 --- a/apps/launcher/datafilespage.cpp +++ b/apps/launcher/datafilespage.cpp @@ -3,6 +3,7 @@ #include // TODO: Remove #include +#include "../openmw/path.hpp" #include "datafilespage.hpp" #include "lineedit.hpp" @@ -46,10 +47,24 @@ DataFilesPage::DataFilesPage(QWidget *parent) : QWidget(parent) QLabel *profileLabel = new QLabel(tr("Current Profile:"), this); // 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(); - QStringList profileList; - profileList << "Default" << "New" << "Yeah" << "Cool story bro!"; - mProfileModel->setStringList(profileList); + mProfileModel->setStringList(settings.childGroups()); 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(textChanged(const QString&, const QString&)), this, SLOT(profileChanged(const QString&, const QString&))); + + + readConfig(); } void DataFilesPage::setupDataFiles() @@ -361,6 +379,12 @@ void DataFilesPage::profileChanged(const QString ¤t, const QString &previo } +void DataFilesPage::readConfig() +{ + // TODO: global etc + +} + void DataFilesPage::writeConfig() { // TODO: Testing the config here diff --git a/apps/launcher/datafilespage.hpp b/apps/launcher/datafilespage.hpp index 61a8ca06e..af0ba5b43 100644 --- a/apps/launcher/datafilespage.hpp +++ b/apps/launcher/datafilespage.hpp @@ -12,6 +12,7 @@ class QStandardItemModel; class QItemSelection; class QItemSelectionModel; class QStringListModel; +class QSettings; class DataFilesPage : public QWidget { @@ -22,8 +23,10 @@ public: ComboBox *mProfileComboBox; QStringListModel *mProfileModel; + QSettings *mLauncherConfig; const QStringList checkedPlugins(); + void readConfig(); void writeConfig(); public slots: