From e8387d8afac8019b3403a7302d9c211305cef68b Mon Sep 17 00:00:00 2001 From: clinton Date: Sat, 5 Jul 2008 17:25:04 +0000 Subject: [PATCH] ENH: Replace Advanced checkbox and group option in menu with a combo box to choose view type. --- Source/QtDialog/CMakeSetupDialog.cxx | 46 +++++++++++++++++++++++------------- Source/QtDialog/CMakeSetupDialog.h | 6 ++--- Source/QtDialog/CMakeSetupDialog.ui | 16 +++++++++++-- 3 files changed, 47 insertions(+), 21 deletions(-) diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index e08cbd681..4ecd2bd39 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: CMakeSetupDialog.cxx,v $ Language: C++ - Date: $Date: 2008-06-13 15:19:53 $ - Version: $Revision: 1.54 $ + Date: $Date: 2008-07-05 17:25:04 $ + Version: $Revision: 1.55 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -78,9 +78,11 @@ CMakeSetupDialog::CMakeSetupDialog() this->AddEntry->setEnabled(false); bool groupView = settings.value("GroupView", false).toBool(); - this->CacheValues->cacheModel()->setViewType(groupView ? - QCMakeCacheModel::GroupView : QCMakeCacheModel::FlatView); - this->CacheValues->setRootIsDecorated(groupView); + if(groupView) + { + this->setViewType(2); + this->ViewType->setCurrentIndex(2); + } QMenu* FileMenu = this->menuBar()->addMenu(tr("&File")); this->ReloadCacheAction = FileMenu->addAction(tr("&Reload Cache")); @@ -118,11 +120,6 @@ CMakeSetupDialog::CMakeSetupDialog() this, SLOT(setDebugOutput(bool))); OptionsMenu->addSeparator(); - QAction* groupAction = OptionsMenu->addAction(tr("&Group Entries")); - groupAction->setCheckable(true); - groupAction->setChecked(this->CacheValues->cacheModel()->viewType() == QCMakeCacheModel::GroupView); - QObject::connect(groupAction, SIGNAL(toggled(bool)), - this, SLOT(toggleGroupView(bool))); QAction* expandAction = OptionsMenu->addAction(tr("&Expand Grouped Entries")); QObject::connect(expandAction, SIGNAL(triggered(bool)), this->CacheValues, SLOT(expandAll())); @@ -214,8 +211,8 @@ void CMakeSetupDialog::initialize() SIGNAL(outputMessage(QString)), this, SLOT(message(QString))); - QObject::connect(this->Advanced, SIGNAL(clicked(bool)), - this->CacheValues, SLOT(setShowAdvanced(bool))); + QObject::connect(this->ViewType, SIGNAL(currentIndexChanged(int)), + this, SLOT(setViewType(int))); QObject::connect(this->Search, SIGNAL(textChanged(QString)), this->CacheValues, SLOT(setSearchFilter(QString))); @@ -931,13 +928,30 @@ void CMakeSetupDialog::setDebugOutput(bool flag) "setDebugOutput", Qt::QueuedConnection, Q_ARG(bool, flag)); } -void CMakeSetupDialog::toggleGroupView(bool f) +void CMakeSetupDialog::setViewType(int v) { - this->CacheValues->cacheModel()->setViewType(f ? QCMakeCacheModel::GroupView : QCMakeCacheModel::FlatView); - this->CacheValues->setRootIsDecorated(f); + 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); + } QSettings settings; settings.beginGroup("Settings/StartPath"); - settings.setValue("GroupView", this->CacheValues->cacheModel()->viewType() == QCMakeCacheModel::GroupView); + settings.setValue("GroupView", v == 2); + } diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h index 96b3cfc65..af4223c29 100644 --- a/Source/QtDialog/CMakeSetupDialog.h +++ b/Source/QtDialog/CMakeSetupDialog.h @@ -3,8 +3,8 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: CMakeSetupDialog.h,v $ Language: C++ - Date: $Date: 2008-06-13 15:19:53 $ - Version: $Revision: 1.28 $ + Date: $Date: 2008-07-05 17:25:04 $ + Version: $Revision: 1.29 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. @@ -75,7 +75,7 @@ protected slots: void addCacheEntry(); void startSearch(); void setDebugOutput(bool); - void toggleGroupView(bool); + void setViewType(int); protected: diff --git a/Source/QtDialog/CMakeSetupDialog.ui b/Source/QtDialog/CMakeSetupDialog.ui index 3f685552d..8fab9d58b 100644 --- a/Source/QtDialog/CMakeSetupDialog.ui +++ b/Source/QtDialog/CMakeSetupDialog.ui @@ -127,10 +127,22 @@ - + + - Show Ad&vanced Entries + Simple View + + + + Advanced View + + + + + Grouped View + + -- 2.11.4.GIT