forked from teamnwah/openmw-tes3coop
Some renaming and ugly support for getPath
This commit is contained in:
parent
4ee748552b
commit
0fc4767846
6 changed files with 28 additions and 120 deletions
|
@ -11,6 +11,7 @@ set(LAUNCHER
|
|||
playpage.hpp
|
||||
combobox.hpp
|
||||
|
||||
../openmw/path.cpp
|
||||
)
|
||||
|
||||
set(MOC_HDRS
|
||||
|
|
|
@ -51,27 +51,29 @@ DataFilesPage::DataFilesPage(QWidget *parent) : QWidget(parent)
|
|||
|
||||
if (config.exists())
|
||||
{
|
||||
qDebug() << "Using config file from current directory";
|
||||
mLauncherConfig = new QSettings("launcher.cfg", QSettings::IniFormat);
|
||||
} else {
|
||||
QString path = QString::fromStdString(OMW::Path::getPath(OMW::Path::GLOBAL_CFG_PATH,
|
||||
"launcher",
|
||||
"openmw",
|
||||
"launcher.cfg"));
|
||||
qDebug() << "Using global config file from " << path;
|
||||
mLauncherConfig = new QSettings(path, QSettings::IniFormat);
|
||||
}
|
||||
|
||||
config.close();
|
||||
|
||||
QSettings settings("launcher.cfg", QSettings::IniFormat);
|
||||
settings.beginGroup("Profiles");
|
||||
mLauncherConfig->beginGroup("Profiles");
|
||||
|
||||
mProfileModel = new QStringListModel();
|
||||
mProfileModel->setStringList(settings.childGroups());
|
||||
mProfilesModel = new QStringListModel();
|
||||
mProfilesModel->setStringList(mLauncherConfig->childGroups());
|
||||
|
||||
|
||||
mProfileComboBox = new ComboBox(this);
|
||||
mProfileComboBox->setModel(mProfileModel);
|
||||
mProfilesComboBox = new ComboBox(this);
|
||||
mProfilesComboBox->setModel(mProfilesModel);
|
||||
|
||||
mProfileComboBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
|
||||
mProfileComboBox->setInsertPolicy(QComboBox::InsertAtBottom);
|
||||
mProfilesComboBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
|
||||
mProfilesComboBox->setInsertPolicy(QComboBox::InsertAtBottom);
|
||||
//mProfileComboBox->addItem(QString("New Profile"));
|
||||
|
||||
QToolButton *NewProfileToolButton = new QToolButton(this);
|
||||
|
@ -86,7 +88,7 @@ DataFilesPage::DataFilesPage(QWidget *parent) : QWidget(parent)
|
|||
QHBoxLayout *bottomLayout = new QHBoxLayout();
|
||||
|
||||
bottomLayout->addWidget(profileLabel);
|
||||
bottomLayout->addWidget(mProfileComboBox);
|
||||
bottomLayout->addWidget(mProfilesComboBox);
|
||||
bottomLayout->addWidget(NewProfileToolButton);
|
||||
bottomLayout->addWidget(CopyProfileToolButton);
|
||||
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(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();
|
||||
|
@ -391,7 +393,7 @@ void DataFilesPage::writeConfig()
|
|||
QSettings settings("launcher.cfg", QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup("Profiles");
|
||||
settings.beginGroup(mProfileComboBox->currentText());
|
||||
settings.beginGroup(mProfilesComboBox->currentText());
|
||||
|
||||
// First write all the masters to the config
|
||||
for (int r = 0; r < mMastersWidget->rowCount(); ++r) {
|
||||
|
|
|
@ -21,8 +21,8 @@ class DataFilesPage : public QWidget
|
|||
public:
|
||||
DataFilesPage(QWidget *parent = 0);
|
||||
|
||||
ComboBox *mProfileComboBox;
|
||||
QStringListModel *mProfileModel;
|
||||
ComboBox *mProfilesComboBox;
|
||||
QStringListModel *mProfilesModel;
|
||||
QSettings *mLauncherConfig;
|
||||
|
||||
const QStringList checkedPlugins();
|
||||
|
|
|
@ -135,13 +135,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->mProfileModel->setStringList(mDataFilesPage->mProfileModel->stringList());
|
||||
mPlayPage->mProfileComboBox->setCurrentIndex(mDataFilesPage->mProfileComboBox->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->mProfileComboBox->setCurrentIndex(mPlayPage->mProfileComboBox->currentIndex());
|
||||
mDataFilesPage->mProfilesComboBox->setCurrentIndex(mPlayPage->mProfilesComboBox->currentIndex());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,12 +26,12 @@ PlayPage::PlayPage(QWidget *parent) : QWidget(parent)
|
|||
profileLabel->setObjectName("ProfileLabel");
|
||||
|
||||
// TODO: Cleanup
|
||||
mProfileModel = new QStringListModel();
|
||||
mProfilesModel = new QStringListModel();
|
||||
|
||||
mProfileComboBox = new QComboBox(playBox);
|
||||
mProfileComboBox->setObjectName("ProfileComboBox");
|
||||
mProfilesComboBox = new QComboBox(playBox);
|
||||
mProfilesComboBox->setObjectName("ProfileComboBox");
|
||||
//mProfileComboBox->setMinimumWidth(200);
|
||||
mProfileComboBox->setModel(mProfileModel);
|
||||
mProfilesComboBox->setModel(mProfilesModel);
|
||||
|
||||
|
||||
QSpacerItem *vSpacer1 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
|
@ -40,7 +40,7 @@ PlayPage::PlayPage(QWidget *parent) : QWidget(parent)
|
|||
playLayout->addItem(vSpacer1);
|
||||
playLayout->addWidget(playButton);
|
||||
playLayout->addWidget(profileLabel);
|
||||
playLayout->addWidget(mProfileComboBox);
|
||||
playLayout->addWidget(mProfilesComboBox);
|
||||
playLayout->addItem(vSpacer2);
|
||||
|
||||
QHBoxLayout *pageLayout = new QHBoxLayout(this);
|
||||
|
@ -52,98 +52,3 @@ PlayPage::PlayPage(QWidget *parent) : QWidget(parent)
|
|||
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:
|
||||
PlayPage(QWidget *parent = 0);
|
||||
|
||||
QComboBox *mProfileComboBox;
|
||||
QStringListModel *mProfileModel;
|
||||
QComboBox *mProfilesComboBox;
|
||||
QStringListModel *mProfilesModel;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue