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); this->Splitter->restoreState(p);
bool groupView = settings.value("GroupView", false).toBool(); bool groupView = settings.value("GroupView", false).toBool();
if(groupView) this->setGroupedView(groupView);
{ this->groupedCheck->setCheckState(groupView ? Qt::Checked : Qt::Unchecked);
this->setViewType(2);
this->ViewType->setCurrentIndex(2);
}
QMenu* FileMenu = this->menuBar()->addMenu(tr("&File")); QMenu* FileMenu = this->menuBar()->addMenu(tr("&File"));
this->ReloadCacheAction = FileMenu->addAction(tr("&Reload Cache")); this->ReloadCacheAction = FileMenu->addAction(tr("&Reload Cache"));
@ -217,8 +214,10 @@ void CMakeSetupDialog::initialize()
SIGNAL(outputMessage(QString)), SIGNAL(outputMessage(QString)),
this, SLOT(message(QString))); this, SLOT(message(QString)));
QObject::connect(this->ViewType, SIGNAL(currentIndexChanged(int)), QObject::connect(this->groupedCheck, SIGNAL(toggled(bool)),
this, SLOT(setViewType(int))); this, SLOT(setGroupedView(bool)));
QObject::connect(this->advancedCheck, SIGNAL(toggled(bool)),
this, SLOT(setAdvancedView(bool)));
QObject::connect(this->Search, SIGNAL(textChanged(QString)), QObject::connect(this->Search, SIGNAL(textChanged(QString)),
this, SLOT(setSearchFilter(QString))); this, SLOT(setSearchFilter(QString)));
@ -950,33 +949,22 @@ void CMakeSetupDialog::setDebugOutput(bool flag)
"setDebugOutput", Qt::QueuedConnection, Q_ARG(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(v ? QCMakeCacheModel::GroupView : QCMakeCacheModel::FlatView);
{ this->CacheValues->setRootIsDecorated(v);
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; QSettings settings;
settings.beginGroup("Settings/StartPath"); 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() void CMakeSetupDialog::showUserChanges()
{ {
QSet<QCMakeProperty> changes = QSet<QCMakeProperty> changes =

View File

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