diff options
author | kh1 <karsten.heimrich@nokia.com> | 2012-09-28 10:50:46 +0200 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@digia.com> | 2012-10-01 12:12:51 +0200 |
commit | a1b2010ce87bd878f78acf01a5677875f34254ef (patch) | |
tree | 7200733299d690d2fea19ae7776b7c0270e7c4a1 /src/libs | |
parent | c266f5bdd600c07924e4b2ceca45c4ce2aae3ff2 (diff) |
Sort the child components.
The higher the value, the higher up in the list the component
is ordered. Currently we handled it the opposite, thus we had
to assign every component a value to get sorting work.
Change-Id: I6003cb95b69ba4160eb822565edf120dd0f0543f
Reviewed-by: Niels Weber <niels.weber@digia.com>
Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/installer/component.cpp | 5 | ||||
-rw-r--r-- | src/libs/installer/component.h | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp index 963dd55c6..9b583690c 100644 --- a/src/libs/installer/component.cpp +++ b/src/libs/installer/component.cpp @@ -276,13 +276,14 @@ Component *Component::parentComponent() const /*! Appends \a component as a child of this component. If \a component already has a parent, - it is removed from the previous parent. + it is removed from the previous parent. If the \a component has as sorting priority set, the child list + is sorted in case of multiple components (high goes on top). */ void Component::appendComponent(Component *component) { if (!component->isVirtual()) { d->m_childComponents.append(component); - std::sort(d->m_childComponents.begin(), d->m_childComponents.end(), Component::SortingPriorityLessThan()); + std::sort(d->m_childComponents.begin(), d->m_childComponents.end(), SortingPriorityGreaterThan()); } else { d->m_virtualChildComponents.append(component); } diff --git a/src/libs/installer/component.h b/src/libs/installer/component.h index 6ea05f397..f99ee8cd7 100644 --- a/src/libs/installer/component.h +++ b/src/libs/installer/component.h @@ -88,6 +88,14 @@ public: } }; + struct SortingPriorityGreaterThan + { + bool operator() (const Component *lhs, const Component *rhs) const + { + return lhs->value(scSortingPriority).toInt() > rhs->value(scSortingPriority).toInt(); + } + }; + void loadDataFromPackage(const Package &package); void loadDataFromPackage(const LocalPackage &package); |