forked from mirror/openmw-tes3mp
Preliminary support for new profiles and some other modifications and cleanups
This commit is contained in:
parent
557e659e15
commit
314bac7862
7 changed files with 169 additions and 94 deletions
|
@ -4,12 +4,14 @@ set(LAUNCHER
|
|||
main.cpp
|
||||
maindialog.cpp
|
||||
playpage.cpp
|
||||
graphicspage.cpp
|
||||
|
||||
datafilespage.hpp
|
||||
lineedit.hpp
|
||||
maindialog.hpp
|
||||
playpage.hpp
|
||||
combobox.hpp
|
||||
graphicspage.hpp
|
||||
)
|
||||
|
||||
set(MOC_HDRS
|
||||
|
@ -18,6 +20,7 @@ set(MOC_HDRS
|
|||
maindialog.hpp
|
||||
playpage.hpp
|
||||
combobox.hpp
|
||||
graphicspage.hpp
|
||||
)
|
||||
|
||||
find_package(Qt4 REQUIRED)
|
||||
|
|
|
@ -31,6 +31,32 @@ DataFilesPage::DataFilesPage(QWidget *parent) : QWidget(parent)
|
|||
mMastersWidget = new QTableWidget(this); // Contains the available masters
|
||||
mPluginsTable = new QTableView(this);
|
||||
|
||||
mMastersWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
mMastersWidget->setSelectionMode(QAbstractItemView::MultiSelection);
|
||||
mMastersWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
mMastersWidget->setAlternatingRowColors(true);
|
||||
mMastersWidget->horizontalHeader()->setStretchLastSection(true);
|
||||
mMastersWidget->horizontalHeader()->hide();
|
||||
mMastersWidget->verticalHeader()->hide();
|
||||
mMastersWidget->insertColumn(0);
|
||||
|
||||
mPluginsTable->setModel(mPluginsModel);
|
||||
mPluginsTable->setSelectionModel(mPluginsSelectModel);
|
||||
mPluginsTable->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
mPluginsTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
mPluginsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
mPluginsTable->setAlternatingRowColors(true);
|
||||
mPluginsTable->horizontalHeader()->setStretchLastSection(true);
|
||||
mPluginsTable->horizontalHeader()->hide();
|
||||
|
||||
mPluginsTable->setDragEnabled(true);
|
||||
mPluginsTable->setDragDropMode(QAbstractItemView::InternalMove);
|
||||
mPluginsTable->setDropIndicatorShown(true);
|
||||
mPluginsTable->setDragDropOverwriteMode(false);
|
||||
mPluginsTable->viewport()->setAcceptDrops(true);
|
||||
|
||||
mPluginsTable->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
// Add both tables to a splitter
|
||||
QSplitter *splitter = new QSplitter(this);
|
||||
splitter->setOrientation(Qt::Horizontal);
|
||||
|
@ -46,31 +72,31 @@ DataFilesPage::DataFilesPage(QWidget *parent) : QWidget(parent)
|
|||
// Bottom part with profile options
|
||||
QLabel *profileLabel = new QLabel(tr("Current Profile:"), this);
|
||||
|
||||
mProfilesModel = new QStringListModel();
|
||||
//mProfilesModel = new QStringListModel();
|
||||
|
||||
mProfilesComboBox = new ComboBox(this);
|
||||
mProfilesComboBox->setModel(mProfilesModel);
|
||||
//mProfilesComboBox->setModel(mProfilesModel);
|
||||
|
||||
mProfilesComboBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
|
||||
mProfilesComboBox->setInsertPolicy(QComboBox::InsertAtBottom);
|
||||
//mProfileComboBox->addItem(QString("New Profile"));
|
||||
|
||||
QToolButton *NewProfileToolButton = new QToolButton(this);
|
||||
NewProfileToolButton->setIcon(QIcon::fromTheme("document-new"));
|
||||
mNewProfileButton = new QPushButton(this);
|
||||
mNewProfileButton->setIcon(QIcon::fromTheme("document-new"));
|
||||
|
||||
QToolButton *CopyProfileToolButton = new QToolButton(this);
|
||||
CopyProfileToolButton->setIcon(QIcon::fromTheme("edit-copy"));
|
||||
mCopyProfileButton = new QPushButton(this);
|
||||
mCopyProfileButton->setIcon(QIcon::fromTheme("edit-copy"));
|
||||
|
||||
QToolButton *DeleteProfileToolButton = new QToolButton(this);
|
||||
DeleteProfileToolButton->setIcon(QIcon::fromTheme("document-close"));
|
||||
mDeleteProfileButton = new QPushButton(this);
|
||||
mDeleteProfileButton->setIcon(QIcon::fromTheme("document-close"));
|
||||
|
||||
QHBoxLayout *bottomLayout = new QHBoxLayout();
|
||||
|
||||
bottomLayout->addWidget(profileLabel);
|
||||
bottomLayout->addWidget(mProfilesComboBox);
|
||||
bottomLayout->addWidget(NewProfileToolButton);
|
||||
bottomLayout->addWidget(CopyProfileToolButton);
|
||||
bottomLayout->addWidget(DeleteProfileToolButton);
|
||||
bottomLayout->addWidget(mNewProfileButton);
|
||||
bottomLayout->addWidget(mCopyProfileButton);
|
||||
bottomLayout->addWidget(mDeleteProfileButton);
|
||||
|
||||
QVBoxLayout *pageLayout = new QVBoxLayout(this);
|
||||
// Add some space above and below the page items
|
||||
|
@ -95,43 +121,42 @@ DataFilesPage::DataFilesPage(QWidget *parent) : QWidget(parent)
|
|||
//connect(mProfileComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(profileChanged(const QString&)));
|
||||
connect(mProfilesComboBox, SIGNAL(textChanged(const QString&, const QString&)), this, SLOT(profileChanged(const QString&, const QString&)));
|
||||
|
||||
connect(mNewProfileButton, SIGNAL(pressed()), this, SLOT(newProfile()));
|
||||
|
||||
setupDataFiles();
|
||||
setupConfig();
|
||||
}
|
||||
|
||||
void DataFilesPage::setupDataFiles()
|
||||
void DataFilesPage::newProfile()
|
||||
{
|
||||
mMastersWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
mMastersWidget->setSelectionMode(QAbstractItemView::MultiSelection);
|
||||
mMastersWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
mMastersWidget->setAlternatingRowColors(true);
|
||||
mMastersWidget->horizontalHeader()->setStretchLastSection(true);
|
||||
mMastersWidget->horizontalHeader()->hide();
|
||||
mMastersWidget->verticalHeader()->hide();
|
||||
mMastersWidget->insertColumn(0);
|
||||
bool ok;
|
||||
QString text = QInputDialog::getText(this, tr("New Profile"),
|
||||
tr("Profile Name:"), QLineEdit::Normal,
|
||||
tr("New Profile"), &ok);
|
||||
if (ok && !text.isEmpty()) {
|
||||
if (mProfilesComboBox->findText(text) != -1)
|
||||
{
|
||||
QMessageBox::warning(this, tr("Profile already exists"),
|
||||
tr("the profile %0 already exists.").arg(text),
|
||||
QMessageBox::Ok);
|
||||
} else {
|
||||
// Add the new profile to the combobox
|
||||
mProfilesComboBox->addItem(text);
|
||||
mProfilesComboBox->setCurrentIndex(mProfilesComboBox->findText(text));
|
||||
|
||||
mPluginsTable->setModel(mPluginsModel);
|
||||
mPluginsTable->setSelectionModel(mPluginsSelectModel);
|
||||
mPluginsTable->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
mPluginsTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
mPluginsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
mPluginsTable->setAlternatingRowColors(true);
|
||||
mPluginsTable->horizontalHeader()->setStretchLastSection(true);
|
||||
mPluginsTable->horizontalHeader()->hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
mPluginsTable->setDragEnabled(true);
|
||||
mPluginsTable->setDragDropMode(QAbstractItemView::InternalMove);
|
||||
mPluginsTable->setDropIndicatorShown(true);
|
||||
mPluginsTable->setDragDropOverwriteMode(false);
|
||||
mPluginsTable->viewport()->setAcceptDrops(true);
|
||||
//textLabel->setText(text);
|
||||
|
||||
mPluginsTable->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
}
|
||||
|
||||
void DataFilesPage::setupDataFiles(const QString &path)
|
||||
{
|
||||
qDebug() << "setupDataFiles called!";
|
||||
// TODO: Add a warning when a master is missing
|
||||
|
||||
QDir dataFilesDir("data/");
|
||||
QDir dataFilesDir(path);
|
||||
|
||||
if (!dataFilesDir.exists())
|
||||
qWarning("Cannot find the plugin directory");
|
||||
|
@ -165,8 +190,10 @@ void DataFilesPage::setupDataFiles()
|
|||
QString currentFile = pluginFiles.at(i);
|
||||
QStringList availableMasters; // Will contain all found masters
|
||||
|
||||
QString path = QString("data/").append(currentFile);
|
||||
fileReader.open(path.toStdString());
|
||||
QString filePath = dataFilesDir.absolutePath();
|
||||
filePath.append("/");
|
||||
filePath.append(currentFile);
|
||||
fileReader.open(filePath.toStdString());
|
||||
|
||||
// First we fill the availableMasters and the mMastersWidget
|
||||
ESMReader::MasterList mlist = fileReader.getMasters();
|
||||
|
@ -203,6 +230,8 @@ void DataFilesPage::setupDataFiles()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
readConfig();
|
||||
}
|
||||
|
||||
void DataFilesPage::setupConfig()
|
||||
|
@ -230,7 +259,8 @@ void DataFilesPage::setupConfig()
|
|||
profiles.append("Default");
|
||||
}
|
||||
|
||||
mProfilesModel->setStringList(profiles);
|
||||
//mProfilesModel->setStringList(profiles);
|
||||
mProfilesComboBox->addItems(profiles);
|
||||
|
||||
QString currentProfile = mLauncherConfig->value("CurrentProfile").toString();
|
||||
if (currentProfile.isEmpty()) {
|
||||
|
@ -239,8 +269,6 @@ void DataFilesPage::setupConfig()
|
|||
mProfilesComboBox->setCurrentIndex(mProfilesComboBox->findText(currentProfile));
|
||||
|
||||
mLauncherConfig->endGroup();
|
||||
|
||||
readConfig();
|
||||
}
|
||||
|
||||
void DataFilesPage::masterSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
|
||||
|
@ -419,7 +447,8 @@ void DataFilesPage::profileChanged(const QString &previous, const QString &curre
|
|||
}
|
||||
|
||||
uncheckPlugins();
|
||||
|
||||
// Deselect the masters
|
||||
mMastersWidget->selectionModel()->clearSelection();
|
||||
readConfig();
|
||||
|
||||
}
|
||||
|
@ -438,7 +467,6 @@ void DataFilesPage::readConfig()
|
|||
mLauncherConfig->beginGroup(profile);
|
||||
|
||||
QStringList childKeys = mLauncherConfig->childKeys();
|
||||
qDebug() << childKeys << "SJILDKIEJS";
|
||||
|
||||
foreach (const QString &key, childKeys) {
|
||||
const QString keyValue = mLauncherConfig->value(key).toString();
|
||||
|
@ -456,7 +484,7 @@ void DataFilesPage::readConfig()
|
|||
|
||||
if (key.startsWith("Master")) {
|
||||
qDebug() << "Read master: " << keyValue;
|
||||
QList<QTableWidgetItem*> masterList = mMastersWidget->findItems(keyValue, Qt::MatchExactly);
|
||||
QList<QTableWidgetItem*> masterList = mMastersWidget->findItems(keyValue, Qt::MatchFixedString);
|
||||
|
||||
if (!masterList.isEmpty()) {
|
||||
foreach (QTableWidgetItem *currentMaster, masterList) {
|
||||
|
@ -486,11 +514,12 @@ void DataFilesPage::writeConfig(QString profile)
|
|||
|
||||
// Open the profile-name subgroup
|
||||
mLauncherConfig->beginGroup(profile);
|
||||
mLauncherConfig->remove("");
|
||||
mLauncherConfig->remove(""); // Clear the subgroup
|
||||
|
||||
// First write the masters to the config
|
||||
QList<QTableWidgetItem *> selectedMasters = mMastersWidget->selectedItems();
|
||||
|
||||
// We don't use foreach because we need i
|
||||
for (int i = 0; i < selectedMasters.size(); ++i) {
|
||||
const QTableWidgetItem *item = selectedMasters.at(i);
|
||||
mLauncherConfig->setValue(QString("Master%0").arg(i), item->data(Qt::DisplayRole).toString());
|
||||
|
@ -504,9 +533,7 @@ void DataFilesPage::writeConfig(QString profile)
|
|||
mLauncherConfig->setValue(QString("Plugin%1").arg(i), plugins.at(i));
|
||||
}
|
||||
|
||||
qDebug() << mLauncherConfig->childKeys();
|
||||
mLauncherConfig->endGroup();
|
||||
qDebug() << mLauncherConfig->childKeys();
|
||||
mLauncherConfig->endGroup();
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ class QItemSelection;
|
|||
class QItemSelectionModel;
|
||||
class QStringListModel;
|
||||
class QSettings;
|
||||
class QPushButton;
|
||||
|
||||
class DataFilesPage : public QWidget
|
||||
{
|
||||
|
@ -22,7 +23,7 @@ public:
|
|||
DataFilesPage(QWidget *parent = 0);
|
||||
|
||||
ComboBox *mProfilesComboBox;
|
||||
QStringListModel *mProfilesModel;
|
||||
//QStringListModel *mProfilesModel;
|
||||
QSettings *mLauncherConfig;
|
||||
|
||||
const QStringList checkedPlugins();
|
||||
|
@ -30,11 +31,14 @@ public:
|
|||
void readConfig();
|
||||
void writeConfig(QString profile = QString());
|
||||
|
||||
void setupDataFiles(const QString &path);
|
||||
|
||||
public slots:
|
||||
void masterSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
||||
void setCheckstate(QModelIndex index);
|
||||
void resizeRows();
|
||||
void profileChanged(const QString &previous, const QString ¤t);
|
||||
void newProfile();
|
||||
|
||||
private:
|
||||
QTableWidget *mMastersWidget;
|
||||
|
@ -45,7 +49,10 @@ private:
|
|||
|
||||
QItemSelectionModel *mPluginsSelectModel;
|
||||
|
||||
void setupDataFiles();
|
||||
QPushButton *mNewProfileButton;
|
||||
QPushButton *mCopyProfileButton;
|
||||
QPushButton *mDeleteProfileButton;
|
||||
|
||||
void addPlugins(const QModelIndex &index);
|
||||
void removePlugins(const QModelIndex &index);
|
||||
void uncheckPlugins();
|
||||
|
|
|
@ -1 +1,9 @@
|
|||
#include <QtGui>
|
||||
|
||||
#include "graphicspage.hpp"
|
||||
|
||||
GraphicsPage::GraphicsPage(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
|
||||
|
||||
}
|
|
@ -1 +1,15 @@
|
|||
#ifndef GRAPHICSPAGE_H
|
||||
#define GRAPHICSPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class GraphicsPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GraphicsPage(QWidget *parent = 0);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,30 +1,28 @@
|
|||
#include <QtGui>
|
||||
#include <QDebug>
|
||||
|
||||
#include <components/files/path.hpp>
|
||||
|
||||
#include "maindialog.hpp"
|
||||
#include "playpage.hpp"
|
||||
#include "graphicspage.hpp"
|
||||
#include "datafilespage.hpp"
|
||||
|
||||
MainDialog::MainDialog()
|
||||
{
|
||||
/* TODO: Should be an install path
|
||||
QFile file("apps/launcher/resources/launcher.qss");
|
||||
|
||||
file.open(QFile::ReadOnly);
|
||||
QString styleSheet = QLatin1String(file.readAll());
|
||||
qDebug() << styleSheet;
|
||||
setStyleSheet(styleSheet);*/
|
||||
|
||||
mIconWidget = new QListWidget;
|
||||
mIconWidget->setViewMode(QListView::IconMode);
|
||||
mIconWidget->setWrapping(false);
|
||||
|
||||
mIconWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // Just to be sure
|
||||
|
||||
|
||||
mIconWidget->setIconSize(QSize(48, 48));
|
||||
mIconWidget->setMovement(QListView::Static);
|
||||
|
||||
mIconWidget->setStyleSheet("background-image: url(:/images/openmw-header.png); \
|
||||
background-color: white; \
|
||||
background-repeat: no-repeat; \
|
||||
background-attachment: scroll; \
|
||||
background-position: right;");
|
||||
|
||||
mIconWidget->setMinimumWidth(400);
|
||||
mIconWidget->setFixedHeight(80);
|
||||
mIconWidget->setSpacing(4);
|
||||
|
@ -33,27 +31,8 @@ MainDialog::MainDialog()
|
|||
|
||||
QGroupBox *groupBox = new QGroupBox(this);
|
||||
QVBoxLayout *groupLayout = new QVBoxLayout(groupBox);
|
||||
// TODO: TESTING
|
||||
|
||||
/*mProfileModel = new QStringListModel();
|
||||
QStringList profileList;
|
||||
profileList << "Default" << "Warrior" << "Redemption" << "Cool stuff bro!";
|
||||
mProfileModel->setStringList(profileList);
|
||||
*/
|
||||
|
||||
// Various pages
|
||||
mPlayPage = new PlayPage(this);
|
||||
//mPlayPage->mProfileModel->setStringList(profileList);
|
||||
|
||||
mDataFilesPage = new DataFilesPage(this);
|
||||
//mDataFilesPage->mProfileComboBox->setModel(mProfileModel);
|
||||
|
||||
mPagesWidget = new QStackedWidget(groupBox);
|
||||
mPagesWidget->addWidget(mPlayPage);
|
||||
mPagesWidget->addWidget(new PlayPage);
|
||||
mPagesWidget->addWidget(mDataFilesPage);
|
||||
//mPagesWidget->addWidget(new QueryPage);
|
||||
|
||||
groupLayout->addWidget(mPagesWidget);
|
||||
|
||||
QPushButton *playButton = new QPushButton(tr("Play"));
|
||||
|
@ -76,46 +55,55 @@ MainDialog::MainDialog()
|
|||
setWindowTitle(tr("OpenMW Launcher"));
|
||||
setMinimumSize(QSize(550, 450));
|
||||
|
||||
createIcons();
|
||||
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(play()));
|
||||
|
||||
setupConfig();
|
||||
createIcons();
|
||||
createPages();
|
||||
}
|
||||
|
||||
void MainDialog::createIcons()
|
||||
{
|
||||
//QSize itemSize(80, 66);
|
||||
|
||||
QListWidgetItem *configButton = new QListWidgetItem(mIconWidget);
|
||||
configButton->setIcon(QIcon(":/images/openmw-icon.png"));
|
||||
configButton->setText(tr("Play"));
|
||||
configButton->setTextAlignment(Qt::AlignCenter);
|
||||
configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
|
||||
//configButton->setSizeHint(itemSize);
|
||||
QListWidgetItem *updateButton = new QListWidgetItem(mIconWidget);
|
||||
updateButton->setIcon(QIcon::fromTheme("video-display"));
|
||||
updateButton->setText(tr("Graphics"));
|
||||
updateButton->setTextAlignment(Qt::AlignHCenter | Qt::AlignBottom | Qt::AlignAbsolute);
|
||||
updateButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
|
||||
//updateButton->setSizeHint(itemSize);
|
||||
|
||||
QListWidgetItem *queryButton = new QListWidgetItem(mIconWidget);
|
||||
queryButton->setIcon(QIcon(":/images/openmw-plugin-icon.png"));
|
||||
queryButton->setText(tr("Data Files"));
|
||||
queryButton->setTextAlignment(Qt::AlignHCenter | Qt::AlignBottom);
|
||||
queryButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
|
||||
//queryButton->setSizeHint(itemSize);
|
||||
|
||||
connect(mIconWidget,
|
||||
SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(changePage(QListWidgetItem*,QListWidgetItem*)));
|
||||
|
||||
connect(mIconWidget,
|
||||
SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||
this, SLOT(changePage(QListWidgetItem*,QListWidgetItem*)));
|
||||
}
|
||||
|
||||
void MainDialog::createPages()
|
||||
{
|
||||
// Various pages
|
||||
mPlayPage = new PlayPage(this);
|
||||
mGraphicsPage = new GraphicsPage(this);
|
||||
mDataFilesPage = new DataFilesPage(this);
|
||||
|
||||
QString dataDir = mGameConfig->value("data").toString();
|
||||
mDataFilesPage->setupDataFiles(dataDir);
|
||||
|
||||
// Add the pages to the stacked widget
|
||||
mPagesWidget->addWidget(mPlayPage);
|
||||
mPagesWidget->addWidget(mGraphicsPage);
|
||||
mPagesWidget->addWidget(mDataFilesPage);
|
||||
|
||||
}
|
||||
|
||||
void MainDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
|
||||
|
@ -131,13 +119,13 @@ void MainDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
|
|||
|
||||
// The user switched from Data Files to Play
|
||||
if (previousPage == QString("Data Files") && currentPage == QString("Play")) {
|
||||
mPlayPage->mProfilesModel->setStringList(mDataFilesPage->mProfilesModel->stringList());
|
||||
mPlayPage->mProfilesComboBox->setCurrentIndex(mDataFilesPage->mProfilesComboBox->currentIndex());
|
||||
//mPlayPage->mProfilesModel->setStringList(mDataFilesPage->mProfilesModel->stringList());
|
||||
//mPlayPage->mProfilesComboBox->setCurrentIndex(mDataFilesPage->mProfilesComboBox->currentIndex());
|
||||
}
|
||||
|
||||
// The user switched from Play to Data Files
|
||||
if (previousPage == QString("Play") && currentPage == QString("Data Files")) {
|
||||
mDataFilesPage->mProfilesComboBox->setCurrentIndex(mPlayPage->mProfilesComboBox->currentIndex());
|
||||
//mDataFilesPage->mProfilesComboBox->setCurrentIndex(mPlayPage->mProfilesComboBox->currentIndex());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,3 +144,24 @@ void MainDialog::play()
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
void MainDialog::setupConfig()
|
||||
{
|
||||
// First we read the OpenMW config
|
||||
QString config = "openmw.cfg";
|
||||
QFile file(config);
|
||||
|
||||
if (!file.exists()) {
|
||||
config = QString::fromStdString(Files::getPath(Files::Path_ConfigUser,
|
||||
"openmw", "launcher.cfg"));
|
||||
}
|
||||
|
||||
file.setFileName(config); // Just for displaying information
|
||||
qDebug() << "Using config file from " << file.fileName();
|
||||
file.close();
|
||||
|
||||
// Open our config file
|
||||
mGameConfig = new QSettings(config, QSettings::IniFormat);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,8 +7,10 @@ class QListWidget;
|
|||
class QListWidgetItem;
|
||||
class QStackedWidget;
|
||||
class QStringListModel;
|
||||
class QSettings;
|
||||
|
||||
class PlayPage;
|
||||
class GraphicsPage;
|
||||
class DataFilesPage;
|
||||
|
||||
class MainDialog : public QDialog
|
||||
|
@ -27,13 +29,18 @@ public slots:
|
|||
|
||||
private:
|
||||
void createIcons();
|
||||
void createPages();
|
||||
void setupConfig();
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
||||
QListWidget *mIconWidget;
|
||||
QStackedWidget *mPagesWidget;
|
||||
|
||||
PlayPage *mPlayPage;
|
||||
GraphicsPage *mGraphicsPage;
|
||||
DataFilesPage *mDataFilesPage;
|
||||
|
||||
QSettings *mGameConfig;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue