From c911f62e8b061fec21b30c62991d3dfb9e39a9f6 Mon Sep 17 00:00:00 2001 From: Pieter van der Kloet Date: Mon, 25 Apr 2011 06:08:05 +0200 Subject: [PATCH] Added ability to get the previous profile when a new one is selected --- apps/launcher/CMakeLists.txt | 2 ++ apps/launcher/datafilespage.cpp | 14 ++++++++------ apps/launcher/datafilespage.hpp | 7 ++++--- apps/launcher/maindialog.cpp | 2 -- apps/launcher/playpage.cpp | 1 - 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/apps/launcher/CMakeLists.txt b/apps/launcher/CMakeLists.txt index 92e8e212bc..43c45142cd 100644 --- a/apps/launcher/CMakeLists.txt +++ b/apps/launcher/CMakeLists.txt @@ -9,6 +9,7 @@ set(LAUNCHER lineedit.hpp maindialog.hpp playpage.hpp + combobox.hpp ) SET(MOC_HDRS @@ -16,6 +17,7 @@ SET(MOC_HDRS lineedit.hpp maindialog.hpp playpage.hpp + combobox.hpp ) source_group(apps\\launcher FILES ${ESMTOOL}) diff --git a/apps/launcher/datafilespage.cpp b/apps/launcher/datafilespage.cpp index 5cbe2e2b38..cc1f3d7caa 100644 --- a/apps/launcher/datafilespage.cpp +++ b/apps/launcher/datafilespage.cpp @@ -51,7 +51,8 @@ DataFilesPage::DataFilesPage(QWidget *parent) : QWidget(parent) profileList << "Default" << "New" << "Yeah" << "Cool story bro!"; mProfileModel->setStringList(profileList); - mProfileComboBox = new QComboBox(this); + + mProfileComboBox = new ComboBox(this); mProfileComboBox->setModel(mProfileModel); mProfileComboBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); @@ -77,7 +78,7 @@ DataFilesPage::DataFilesPage(QWidget *parent) : QWidget(parent) QVBoxLayout *pageLayout = new QVBoxLayout(this); // Add some space above and below the page items - QSpacerItem *vSpacer1 = new QSpacerItem(5, 5, QSizePolicy::Minimum, QSizePolicy::Minimum); + //QSpacerItem *vSpacer1 = new QSpacerItem(5, 5, QSizePolicy::Minimum, QSizePolicy::Minimum); QSpacerItem *vSpacer2 = new QSpacerItem(5, 5, QSizePolicy::Minimum, QSizePolicy::Minimum); QSpacerItem *vSpacer3 = new QSpacerItem(5, 5, QSizePolicy::Minimum, QSizePolicy::Minimum); @@ -97,8 +98,8 @@ DataFilesPage::DataFilesPage(QWidget *parent) : QWidget(parent) connect(mPluginsTable, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(setCheckstate(QModelIndex))); 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&))); } void DataFilesPage::setupDataFiles() @@ -349,12 +350,13 @@ void DataFilesPage::uncheckPlugins() void DataFilesPage::resizeRows() { // Contents changed + qDebug() << "test"; mPluginsTable->resizeRowsToContents(); } -void DataFilesPage::profileChanged(const QString &profile) +void DataFilesPage::profileChanged(const QString ¤t, const QString &previous) { - qDebug() << "Profile changed"; + qDebug() << "Profile changed " << current << previous; uncheckPlugins(); } diff --git a/apps/launcher/datafilespage.hpp b/apps/launcher/datafilespage.hpp index 03c6f84dda..61a8ca06e1 100644 --- a/apps/launcher/datafilespage.hpp +++ b/apps/launcher/datafilespage.hpp @@ -3,10 +3,11 @@ #include #include +#include "combobox.hpp" class QTableWidget; class QTableView; -class QComboBox; +class ComboBox; class QStandardItemModel; class QItemSelection; class QItemSelectionModel; @@ -19,7 +20,7 @@ class DataFilesPage : public QWidget public: DataFilesPage(QWidget *parent = 0); - QComboBox *mProfileComboBox; + ComboBox *mProfileComboBox; QStringListModel *mProfileModel; const QStringList checkedPlugins(); @@ -29,7 +30,7 @@ public slots: void masterSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected); void setCheckstate(QModelIndex index); void resizeRows(); - void profileChanged(const QString &profile); + void profileChanged(const QString ¤t, const QString &previous); private: QTableWidget *mMastersWidget; diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index 536fbe2621..97bf41582c 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -18,8 +18,6 @@ MainDialog::MainDialog() mIconWidget = new QListWidget; mIconWidget->setViewMode(QListView::IconMode); mIconWidget->setWrapping(false); - mIconWidget->setObjectName("IconWidget"); - qDebug() << mIconWidget->objectName(); mIconWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // Just to be sure diff --git a/apps/launcher/playpage.cpp b/apps/launcher/playpage.cpp index 451ecbb173..32bf8793ca 100644 --- a/apps/launcher/playpage.cpp +++ b/apps/launcher/playpage.cpp @@ -9,7 +9,6 @@ PlayPage::PlayPage(QWidget *parent) : QWidget(parent) file.open(QFile::ReadOnly); QString styleSheet = QLatin1String(file.readAll()); - qDebug() << styleSheet; setStyleSheet(styleSheet); QGroupBox *playBox = new QGroupBox(this);