Some renaming and ugly support for getPath

pull/21/head
Pieter van der Kloet 14 years ago
parent 4ee748552b
commit 0fc4767846

@ -11,6 +11,7 @@ set(LAUNCHER
playpage.hpp playpage.hpp
combobox.hpp combobox.hpp
../openmw/path.cpp
) )
set(MOC_HDRS set(MOC_HDRS

@ -51,27 +51,29 @@ DataFilesPage::DataFilesPage(QWidget *parent) : QWidget(parent)
if (config.exists()) if (config.exists())
{ {
qDebug() << "Using config file from current directory";
mLauncherConfig = new QSettings("launcher.cfg", QSettings::IniFormat); mLauncherConfig = new QSettings("launcher.cfg", QSettings::IniFormat);
} else { } else {
QString path = QString::fromStdString(OMW::Path::getPath(OMW::Path::GLOBAL_CFG_PATH, QString path = QString::fromStdString(OMW::Path::getPath(OMW::Path::GLOBAL_CFG_PATH,
"launcher", "openmw",
"launcher.cfg")); "launcher.cfg"));
qDebug() << "Using global config file from " << path;
mLauncherConfig = new QSettings(path, QSettings::IniFormat); mLauncherConfig = new QSettings(path, QSettings::IniFormat);
} }
config.close();
QSettings settings("launcher.cfg", QSettings::IniFormat); mLauncherConfig->beginGroup("Profiles");
settings.beginGroup("Profiles");
mProfileModel = new QStringListModel(); mProfilesModel = new QStringListModel();
mProfileModel->setStringList(settings.childGroups()); mProfilesModel->setStringList(mLauncherConfig->childGroups());
mProfileComboBox = new ComboBox(this); mProfilesComboBox = new ComboBox(this);
mProfileComboBox->setModel(mProfileModel); mProfilesComboBox->setModel(mProfilesModel);
mProfileComboBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); mProfilesComboBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
mProfileComboBox->setInsertPolicy(QComboBox::InsertAtBottom); mProfilesComboBox->setInsertPolicy(QComboBox::InsertAtBottom);
//mProfileComboBox->addItem(QString("New Profile")); //mProfileComboBox->addItem(QString("New Profile"));
QToolButton *NewProfileToolButton = new QToolButton(this); QToolButton *NewProfileToolButton = new QToolButton(this);
@ -86,7 +88,7 @@ DataFilesPage::DataFilesPage(QWidget *parent) : QWidget(parent)
QHBoxLayout *bottomLayout = new QHBoxLayout(); QHBoxLayout *bottomLayout = new QHBoxLayout();
bottomLayout->addWidget(profileLabel); bottomLayout->addWidget(profileLabel);
bottomLayout->addWidget(mProfileComboBox); bottomLayout->addWidget(mProfilesComboBox);
bottomLayout->addWidget(NewProfileToolButton); bottomLayout->addWidget(NewProfileToolButton);
bottomLayout->addWidget(CopyProfileToolButton); bottomLayout->addWidget(CopyProfileToolButton);
bottomLayout->addWidget(DeleteProfileToolButton); bottomLayout->addWidget(DeleteProfileToolButton);
@ -114,7 +116,7 @@ DataFilesPage::DataFilesPage(QWidget *parent) : QWidget(parent)
connect(mPluginsModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), this, SLOT(resizeRows())); connect(mPluginsModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), this, SLOT(resizeRows()));
//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(mProfilesComboBox, SIGNAL(textChanged(const QString&, const QString&)), this, SLOT(profileChanged(const QString&, const QString&)));
readConfig(); readConfig();
@ -391,7 +393,7 @@ void DataFilesPage::writeConfig()
QSettings settings("launcher.cfg", QSettings::IniFormat); QSettings settings("launcher.cfg", QSettings::IniFormat);
settings.beginGroup("Profiles"); settings.beginGroup("Profiles");
settings.beginGroup(mProfileComboBox->currentText()); settings.beginGroup(mProfilesComboBox->currentText());
// First write all the masters to the config // First write all the masters to the config
for (int r = 0; r < mMastersWidget->rowCount(); ++r) { for (int r = 0; r < mMastersWidget->rowCount(); ++r) {

@ -21,8 +21,8 @@ class DataFilesPage : public QWidget
public: public:
DataFilesPage(QWidget *parent = 0); DataFilesPage(QWidget *parent = 0);
ComboBox *mProfileComboBox; ComboBox *mProfilesComboBox;
QStringListModel *mProfileModel; QStringListModel *mProfilesModel;
QSettings *mLauncherConfig; QSettings *mLauncherConfig;
const QStringList checkedPlugins(); const QStringList checkedPlugins();

@ -135,13 +135,13 @@ void MainDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
// The user switched from Data Files to Play // The user switched from Data Files to Play
if (previousPage == QString("Data Files") && currentPage == QString("Play")) { if (previousPage == QString("Data Files") && currentPage == QString("Play")) {
mPlayPage->mProfileModel->setStringList(mDataFilesPage->mProfileModel->stringList()); mPlayPage->mProfilesModel->setStringList(mDataFilesPage->mProfilesModel->stringList());
mPlayPage->mProfileComboBox->setCurrentIndex(mDataFilesPage->mProfileComboBox->currentIndex()); mPlayPage->mProfilesComboBox->setCurrentIndex(mDataFilesPage->mProfilesComboBox->currentIndex());
} }
// The user switched from Play to Data Files // The user switched from Play to Data Files
if (previousPage == QString("Play") && currentPage == QString("Data Files")) { if (previousPage == QString("Play") && currentPage == QString("Data Files")) {
mDataFilesPage->mProfileComboBox->setCurrentIndex(mPlayPage->mProfileComboBox->currentIndex()); mDataFilesPage->mProfilesComboBox->setCurrentIndex(mPlayPage->mProfilesComboBox->currentIndex());
} }
} }

@ -26,12 +26,12 @@ PlayPage::PlayPage(QWidget *parent) : QWidget(parent)
profileLabel->setObjectName("ProfileLabel"); profileLabel->setObjectName("ProfileLabel");
// TODO: Cleanup // TODO: Cleanup
mProfileModel = new QStringListModel(); mProfilesModel = new QStringListModel();
mProfileComboBox = new QComboBox(playBox); mProfilesComboBox = new QComboBox(playBox);
mProfileComboBox->setObjectName("ProfileComboBox"); mProfilesComboBox->setObjectName("ProfileComboBox");
//mProfileComboBox->setMinimumWidth(200); //mProfileComboBox->setMinimumWidth(200);
mProfileComboBox->setModel(mProfileModel); mProfilesComboBox->setModel(mProfilesModel);
QSpacerItem *vSpacer1 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); QSpacerItem *vSpacer1 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
@ -40,7 +40,7 @@ PlayPage::PlayPage(QWidget *parent) : QWidget(parent)
playLayout->addItem(vSpacer1); playLayout->addItem(vSpacer1);
playLayout->addWidget(playButton); playLayout->addWidget(playButton);
playLayout->addWidget(profileLabel); playLayout->addWidget(profileLabel);
playLayout->addWidget(mProfileComboBox); playLayout->addWidget(mProfilesComboBox);
playLayout->addItem(vSpacer2); playLayout->addItem(vSpacer2);
QHBoxLayout *pageLayout = new QHBoxLayout(this); QHBoxLayout *pageLayout = new QHBoxLayout(this);
@ -51,99 +51,4 @@ PlayPage::PlayPage(QWidget *parent) : QWidget(parent)
pageLayout->addWidget(playBox); pageLayout->addWidget(playBox);
pageLayout->addItem(hSpacer2); pageLayout->addItem(hSpacer2);
} }
// verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2"));
// listWidget = new QListWidget(Dialog);
// listWidget->setObjectName(QString::fromUtf8("listWidget"));
// listWidget->setMaximumSize(QSize(16777215, 100));
//
// verticalLayout_2->addWidget(listWidget);
//
// groupBox = new QGroupBox(Dialog);
// groupBox->setObjectName(QString::fromUtf8("groupBox"));
// gridLayout_2 = new QGridLayout(groupBox);
// gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2"));
// verticalSpacer_2 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
//
// gridLayout_2->addItem(verticalSpacer_2, 0, 1, 1, 1);
//
// horizontalSpacer_4 = new QSpacerItem(54, 90, QSizePolicy::Expanding, QSizePolicy::Minimum);
//
// gridLayout_2->addItem(horizontalSpacer_4, 1, 0, 1, 1);
//
// horizontalSpacer_3 = new QSpacerItem(53, 90, QSizePolicy::Expanding, QSizePolicy::Minimum);
//
// gridLayout_2->addItem(horizontalSpacer_3, 1, 2, 1, 1);
//
// verticalSpacer_3 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
//
// gridLayout_2->addItem(verticalSpacer_3, 2, 1, 1, 1);
//
// groupBox_2 = new QGroupBox(groupBox);
// groupBox_2->setObjectName(QString::fromUtf8("groupBox_2"));
// groupBox_2->setMinimumSize(QSize(404, 383));
// groupBox_2->setMaximumSize(QSize(404, 383));
//
// groupBox_2->setFlat(true);
// verticalLayout = new QVBoxLayout(groupBox_2);
// verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
// gridLayout = new QGridLayout();
// gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
// label = new QLabel(groupBox_2);
// label->setObjectName(QString::fromUtf8("label"));
// label->setStyleSheet(QString::fromUtf8(""));
//
// gridLayout->addWidget(label, 2, 1, 1, 1);
//
// comboBox = new QComboBox(groupBox_2);
// comboBox->setObjectName(QString::fromUtf8("comboBox"));
// comboBox->setMinimumSize(QSize(200, 0));
// comboBox->setStyleSheet(QString::fromUtf8(""));
//
// gridLayout->addWidget(comboBox, 3, 1, 1, 1);
//
// horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
//
// gridLayout->addItem(horizontalSpacer, 2, 2, 1, 1);
//
// horizontalSpacer_2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
//
// gridLayout->addItem(horizontalSpacer_2, 2, 0, 1, 1);
//
// verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Minimum);
//
// gridLayout->addItem(verticalSpacer, 1, 1, 1, 1);
//
// verticalSpacer_4 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
//
// gridLayout->addItem(verticalSpacer_4, 4, 1, 1, 1);
//
// pushButton = new QPushButton(groupBox_2);
// pushButton->setObjectName(QString::fromUtf8("pushButton"));
// pushButton->setMinimumSize(QSize(200, 50));
// pushButton->setMaximumSize(QSize(16777215, 16777215));
// pushButton->setAutoFillBackground(false);
// pushButton->setStyleSheet(QString::fromUtf8(""));
// pushButton->setIconSize(QSize(32, 32));
// pushButton->setAutoRepeat(false);
// pushButton->setFlat(false);
//
// gridLayout->addWidget(pushButton, 0, 1, 1, 1);
//
//
// verticalLayout->addLayout(gridLayout);
//
//
// gridLayout_2->addWidget(groupBox_2, 1, 1, 1, 1);
//
//
// verticalLayout_2->addWidget(groupBox);
//
// buttonBox = new QDialogButtonBox(Dialog);
// buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
// buttonBox->setOrientation(Qt::Horizontal);
// buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
//
// verticalLayout_2->addWidget(buttonBox);
//
//

@ -13,8 +13,8 @@ class PlayPage : public QWidget
public: public:
PlayPage(QWidget *parent = 0); PlayPage(QWidget *parent = 0);
QComboBox *mProfileComboBox; QComboBox *mProfilesComboBox;
QStringListModel *mProfileModel; QStringListModel *mProfilesModel;
}; };
#endif #endif
Loading…
Cancel
Save