From 9ced0bf69b84e9e09a584abe11138aec8e9cf681 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Mon, 26 Apr 2010 16:06:21 -0600 Subject: [PATCH] ENH: Add simple grouped view. --- Source/QtDialog/CMakeSetupDialog.cxx | 42 ++--- Source/QtDialog/CMakeSetupDialog.h | 3 +- Source/QtDialog/CMakeSetupDialog.ui | 240 +++++++++++++-------------- 3 files changed, 134 insertions(+), 151 deletions(-) diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index eb82f2a91..74a3d3594 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -81,11 +81,8 @@ CMakeSetupDialog::CMakeSetupDialog() this->Splitter->restoreState(p); bool groupView = settings.value("GroupView", false).toBool(); - if(groupView) - { - this->setViewType(2); - this->ViewType->setCurrentIndex(2); - } + this->setGroupedView(groupView); + this->groupedCheck->setCheckState(groupView ? Qt::Checked : Qt::Unchecked); QMenu* FileMenu = this->menuBar()->addMenu(tr("&File")); this->ReloadCacheAction = FileMenu->addAction(tr("&Reload Cache")); @@ -217,8 +214,10 @@ void CMakeSetupDialog::initialize() SIGNAL(outputMessage(QString)), this, SLOT(message(QString))); - QObject::connect(this->ViewType, SIGNAL(currentIndexChanged(int)), - this, SLOT(setViewType(int))); + QObject::connect(this->groupedCheck, SIGNAL(toggled(bool)), + this, SLOT(setGroupedView(bool))); + QObject::connect(this->advancedCheck, SIGNAL(toggled(bool)), + this, SLOT(setAdvancedView(bool))); QObject::connect(this->Search, SIGNAL(textChanged(QString)), this, SLOT(setSearchFilter(QString))); @@ -950,33 +949,22 @@ void CMakeSetupDialog::setDebugOutput(bool flag) "setDebugOutput", Qt::QueuedConnection, Q_ARG(bool, flag)); } -void CMakeSetupDialog::setViewType(int v) +void CMakeSetupDialog::setGroupedView(bool v) { - if(v == 0) // simple view - { - this->CacheValues->cacheModel()->setViewType(QCMakeCacheModel::FlatView); - this->CacheValues->setRootIsDecorated(false); - this->CacheValues->setShowAdvanced(false); - } - else if(v == 1) // advanced view - { - this->CacheValues->cacheModel()->setViewType(QCMakeCacheModel::FlatView); - this->CacheValues->setRootIsDecorated(false); - this->CacheValues->setShowAdvanced(true); - } - else if(v == 2) // grouped view - { - this->CacheValues->cacheModel()->setViewType(QCMakeCacheModel::GroupView); - this->CacheValues->setRootIsDecorated(true); - this->CacheValues->setShowAdvanced(true); - } + this->CacheValues->cacheModel()->setViewType(v ? QCMakeCacheModel::GroupView : QCMakeCacheModel::FlatView); + this->CacheValues->setRootIsDecorated(v); QSettings settings; settings.beginGroup("Settings/StartPath"); - settings.setValue("GroupView", v == 2); + settings.setValue("GroupView", v); } +void CMakeSetupDialog::setAdvancedView(bool v) +{ + this->CacheValues->setShowAdvanced(v); +} + void CMakeSetupDialog::showUserChanges() { QSet changes = diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h index de7922a45..0e3caec44 100644 --- a/Source/QtDialog/CMakeSetupDialog.h +++ b/Source/QtDialog/CMakeSetupDialog.h @@ -70,7 +70,8 @@ protected slots: void addCacheEntry(); void startSearch(); void setDebugOutput(bool); - void setViewType(int); + void setAdvancedView(bool); + void setGroupedView(bool); void showUserChanges(); void setSearchFilter(const QString& str); diff --git a/Source/QtDialog/CMakeSetupDialog.ui b/Source/QtDialog/CMakeSetupDialog.ui index ae0dca2bc..dc8ee3fbd 100644 --- a/Source/QtDialog/CMakeSetupDialog.ui +++ b/Source/QtDialog/CMakeSetupDialog.ui @@ -1,7 +1,8 @@ - + + CMakeSetupDialog - - + + 0 0 @@ -9,149 +10,126 @@ 582 - - + + 9 - + 6 - - - + + + 0 - + 6 - - - + + + Where is the source code: - - + + - - - + + + Browse &Source... - - - + + + Where to build the binaries: - - - - + + + + 0 0 - + true - - - + + + Browse &Build... - - - + + + Qt::Vertical - - + + QFrame::NoFrame - + QFrame::Raised - - - 0 - - + + 6 + + 0 + - - - 0 - - + + 6 + + 0 + - - - - 0 - 0 + + + 0 0 - + Search: - - - - 7 - 0 + + + 0 0 - - - - - Simple View - - - - - Advanced View - - - - - Grouped View - - - - - + Qt::Horizontal - + QSizePolicy::Minimum - + 40 23 @@ -160,33 +138,49 @@ - - + + + Grouped + + + + + + + Advanced + + + + + + Add New Entry - + &Add Entry - - :/Icons/Plus16.png + + + :/Icons/Plus16.png:/Icons/Plus16.png - + Qt::ToolButtonTextBesideIcon - - + + Remove Selected Entries - + &Remove Entry - - :/Icons/Delete16.png + + + :/Icons/Delete16.png:/Icons/Delete16.png - + Qt::ToolButtonTextBesideIcon @@ -194,69 +188,69 @@ - - + + true - + QAbstractItemView::ExtendedSelection - + QAbstractItemView::SelectRows - - + + Press Configure to update and display new values in red, then press Generate to generate selected build files. - + Qt::AlignCenter - + true - - - 0 - - + + 6 + + 0 + - - + + &Configure - - + + &Generate - - + + Current Generator: - + Qt::Horizontal - + QSizePolicy::Expanding - + 121 27 @@ -265,23 +259,23 @@ - - + + 0 - + 100 - + 0 - + false - + Qt::Horizontal - + QProgressBar::BottomToTop @@ -290,11 +284,11 @@ - - + + QTextEdit::NoWrap - + true @@ -310,7 +304,7 @@ - +