summaryrefslogtreecommitdiffstats
path: root/Source/QtDialog/QCMakeCacheView.cxx
diff options
context:
space:
mode:
authorClinton Stimpson <clinton@elemtech.com>2008-06-10 22:53:22 (GMT)
committerClinton Stimpson <clinton@elemtech.com>2008-06-10 22:53:22 (GMT)
commit2d37d2a48d52cb3cb1afd3a0a29900db92214e95 (patch)
tree15d57363773a66ae4dc7c3eb7d7943e56c652e51 /Source/QtDialog/QCMakeCacheView.cxx
parent3e909b5908c1fe89d9e944364e951e25c7b14f88 (diff)
downloadCMake-2d37d2a48d52cb3cb1afd3a0a29900db92214e95.zip
CMake-2d37d2a48d52cb3cb1afd3a0a29900db92214e95.tar.gz
CMake-2d37d2a48d52cb3cb1afd3a0a29900db92214e95.tar.bz2
ENH: group together items with no prefix and items that won't be
grouped with others.
Diffstat (limited to 'Source/QtDialog/QCMakeCacheView.cxx')
-rw-r--r--Source/QtDialog/QCMakeCacheView.cxx27
1 files changed, 24 insertions, 3 deletions
diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx
index 24cbc2b..8d23fa3 100644
--- a/Source/QtDialog/QCMakeCacheView.cxx
+++ b/Source/QtDialog/QCMakeCacheView.cxx
@@ -211,23 +211,44 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
QString QCMakeCacheModel::prefix(const QString& s)
{
QString prefix = s.section('_', 0, 0);
+ if(prefix == s)
+ {
+ prefix = QString();
+ }
return prefix;
}
void QCMakeCacheModel::breakProperties(const QSet<QCMakeProperty>& props,
QMap<QString, QCMakePropertyList>& result)
{
+ QMap<QString, QCMakePropertyList> tmp;
// return a map of properties grouped by prefixes, and sorted
foreach(QCMakeProperty p, props)
{
QString prefix = QCMakeCacheModel::prefix(p.Key);
- result[prefix].append(p);
+ tmp[prefix].append(p);
}
+ // sort it and re-org any properties with only one sub item
+ QCMakePropertyList reorgProps;
QMap<QString, QCMakePropertyList>::iterator iter;
- for(iter = result.begin(); iter != result.end(); ++iter)
+ for(iter = tmp.begin(); iter != tmp.end();)
+ {
+ if(iter->count() == 1)
+ {
+ reorgProps.append((*iter)[0]);
+ iter = tmp.erase(iter);
+ }
+ else
+ {
+ qSort(*iter);
+ ++iter;
+ }
+ }
+ if(reorgProps.count())
{
- qSort(*iter);
+ tmp[QCMakeCacheModel::prefix("NOPREFIX")] += reorgProps;
}
+ result = tmp;
}
QCMakePropertyList QCMakeCacheModel::properties() const