Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From d15a718f2457b6d1226cc949d4103a37a68d1ee6 Mon Sep 17 00:00:00 2001
- From: Armin Berres <armin.berres@basyskom.de>
- Date: Tue, 16 Nov 2010 11:02:01 +0100
- Subject: [PATCH] Changes: properly merge logical values
- RevBy: TrustMe
- Details:
- The inheritance hierarchy has not been respected.
- Values lower in the hierarchy have been overwriting ones
- from higher in the hierarchy.
- ---
- src/corelib/theme/mlogicalvalues.cpp | 23 +++++++++++++++++------
- src/corelib/theme/mlogicalvalues_p.h | 1 +
- 2 files changed, 18 insertions(+), 6 deletions(-)
- diff --git a/src/corelib/theme/mlogicalvalues.cpp b/src/corelib/theme/mlogicalvalues.cpp
- index 4882e1d..1107cf3 100644
- --- a/src/corelib/theme/mlogicalvalues.cpp
- +++ b/src/corelib/theme/mlogicalvalues.cpp
- @@ -185,6 +185,22 @@ QString MLogicalValuesPrivate::createBinaryFilename(const QFileInfo &fileInfo) c
- return binaryFilename;
- }
- +void MLogicalValuesPrivate::mergeGroups(const Groups &groups)
- +{
- + Groups::const_iterator i = groups.constBegin();
- + while (i != groups.constEnd()) {
- + Values &values = data[i.key()];
- + Values::const_iterator j = i.value().constBegin();
- + while (j != i.value().constEnd()) {
- + if (!values.contains(j.key())) {
- + values.insert(j.key(), j.value());
- + }
- + ++j;
- + }
- + ++i;
- + }
- +}
- +
- bool MLogicalValues::append(const QString &fileName)
- {
- Q_D(MLogicalValues);
- @@ -203,12 +219,7 @@ bool MLogicalValues::append(const QString &fileName)
- d->timestamps << fileInfo.lastModified().toTime_t();
- - Groups::const_iterator i = groups.constBegin();
- - while (i != groups.constEnd()) {
- - Values &values = d->data[i.key()];
- - values.unite(i.value());
- - ++i;
- - }
- + d->mergeGroups(groups);
- return true;
- }
- diff --git a/src/corelib/theme/mlogicalvalues_p.h b/src/corelib/theme/mlogicalvalues_p.h
- index 493c402..c50ae00 100644
- --- a/src/corelib/theme/mlogicalvalues_p.h
- +++ b/src/corelib/theme/mlogicalvalues_p.h
- @@ -36,6 +36,7 @@ public:
- bool loadFromBinaryCache(const QFileInfo &fileInfo, Groups &groups);
- bool saveToBinaryCache(const QFileInfo &fileInfo, const Groups &groups) const;
- QString createBinaryFilename(const QFileInfo &fileInfo) const;
- + void mergeGroups(const Groups &groups);
- Groups data;
- QList<uint> timestamps;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement