ENH: Add simple grouped view.

This commit is contained in:
Clinton Stimpson 2010-04-26 16:06:21 -06:00
parent 6e1b510319
commit 9ced0bf69b
3 changed files with 134 additions and 151 deletions

View File

@ -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<QCMakeProperty> changes =

View File

@ -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);

View File

@ -1,7 +1,8 @@
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CMakeSetupDialog</class>
<widget class="QWidget" name="CMakeSetupDialog" >
<property name="geometry" >
<widget class="QWidget" name="CMakeSetupDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
@ -9,149 +10,126 @@
<height>582</height>
</rect>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing" >
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0" >
<layout class="QGridLayout" >
<property name="margin" >
<item row="0" column="0">
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing" >
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Where is the source code:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLineEdit" name="SourceDirectory" />
<item row="0" column="1">
<widget class="QLineEdit" name="SourceDirectory"/>
</item>
<item row="0" column="2" >
<widget class="QPushButton" name="BrowseSourceDirectoryButton" >
<property name="text" >
<item row="0" column="2">
<widget class="QPushButton" name="BrowseSourceDirectoryButton">
<property name="text">
<string>Browse &amp;Source...</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Where to build the binaries:</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QComboBox" name="BinaryDirectory" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Ignored" >
<item row="1" column="1">
<widget class="QComboBox" name="BinaryDirectory">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="editable" >
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QPushButton" name="BrowseBinaryDirectoryButton" >
<property name="text" >
<item row="1" column="2">
<widget class="QPushButton" name="BrowseBinaryDirectoryButton">
<property name="text">
<string>Browse &amp;Build...</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" >
<widget class="QSplitter" name="Splitter" >
<property name="orientation" >
<item row="1" column="0">
<widget class="QSplitter" name="Splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QFrame" name="frame" >
<property name="frameShape" >
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_4" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string>Search:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="Search" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<widget class="QLineEdit" name="Search">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="ViewType" >
<item>
<property name="text" >
<string>Simple View</string>
</property>
</item>
<item>
<property name="text" >
<string>Advanced View</string>
</property>
</item>
<item>
<property name="text" >
<string>Grouped View</string>
</property>
</item>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>23</height>
@ -160,33 +138,49 @@
</spacer>
</item>
<item>
<widget class="QToolButton" name="AddEntry" >
<property name="toolTip" >
<widget class="QCheckBox" name="groupedCheck">
<property name="text">
<string>Grouped</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="advancedCheck">
<property name="text">
<string>Advanced</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="AddEntry">
<property name="toolTip">
<string>Add New Entry</string>
</property>
<property name="text" >
<property name="text">
<string>&amp;Add Entry</string>
</property>
<property name="icon" >
<iconset resource="CMakeSetup.qrc" >:/Icons/Plus16.png</iconset>
<property name="icon">
<iconset resource="CMakeSetup.qrc">
<normaloff>:/Icons/Plus16.png</normaloff>:/Icons/Plus16.png</iconset>
</property>
<property name="toolButtonStyle" >
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="RemoveEntry" >
<property name="toolTip" >
<widget class="QToolButton" name="RemoveEntry">
<property name="toolTip">
<string>Remove Selected Entries</string>
</property>
<property name="text" >
<property name="text">
<string>&amp;Remove Entry</string>
</property>
<property name="icon" >
<iconset resource="CMakeSetup.qrc" >:/Icons/Delete16.png</iconset>
<property name="icon">
<iconset resource="CMakeSetup.qrc">
<normaloff>:/Icons/Delete16.png</normaloff>:/Icons/Delete16.png</iconset>
</property>
<property name="toolButtonStyle" >
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
@ -194,69 +188,69 @@
</layout>
</item>
<item>
<widget class="QCMakeCacheView" name="CacheValues" >
<property name="alternatingRowColors" >
<widget class="QCMakeCacheView" name="CacheValues">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode" >
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="selectionBehavior" >
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3" >
<property name="text" >
<widget class="QLabel" name="label_3">
<property name="text">
<string>Press Configure to update and display new values in red, then press Generate to generate selected build files.</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap" >
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="ConfigureButton" >
<property name="text" >
<widget class="QPushButton" name="ConfigureButton">
<property name="text">
<string>&amp;Configure</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="GenerateButton" >
<property name="text" >
<widget class="QPushButton" name="GenerateButton">
<property name="text">
<string>&amp;Generate</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="Generator" >
<property name="text" >
<widget class="QLabel" name="Generator">
<property name="text">
<string>Current Generator:</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>121</width>
<height>27</height>
@ -265,23 +259,23 @@
</spacer>
</item>
<item>
<widget class="QProgressBar" name="ProgressBar" >
<property name="minimum" >
<widget class="QProgressBar" name="ProgressBar">
<property name="minimum">
<number>0</number>
</property>
<property name="maximum" >
<property name="maximum">
<number>100</number>
</property>
<property name="value" >
<property name="value">
<number>0</number>
</property>
<property name="textVisible" >
<property name="textVisible">
<bool>false</bool>
</property>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="textDirection" >
<property name="textDirection">
<enum>QProgressBar::BottomToTop</enum>
</property>
</widget>
@ -290,11 +284,11 @@
</item>
</layout>
</widget>
<widget class="QTextEdit" name="Output" >
<property name="lineWrapMode" >
<widget class="QTextEdit" name="Output">
<property name="lineWrapMode">
<enum>QTextEdit::NoWrap</enum>
</property>
<property name="readOnly" >
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
@ -310,7 +304,7 @@
</customwidget>
</customwidgets>
<resources>
<include location="CMakeSetup.qrc" />
<include location="CMakeSetup.qrc"/>
</resources>
<connections/>
</ui>