Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.14 KB | None | 0 0
  1. From d15a718f2457b6d1226cc949d4103a37a68d1ee6 Mon Sep 17 00:00:00 2001                                        
  2. From: Armin Berres <armin.berres@basyskom.de>                                                                  
  3. Date: Tue, 16 Nov 2010 11:02:01 +0100                                                                          
  4. Subject: [PATCH] Changes: properly merge logical values                                                        
  5.  
  6. RevBy: TrustMe
  7.  
  8. Details:
  9. The inheritance hierarchy has not been respected.
  10. Values lower in the hierarchy have been overwriting ones
  11. from higher in the hierarchy.                          
  12. ---                                                    
  13.  src/corelib/theme/mlogicalvalues.cpp |   23 +++++++++++++++++------
  14.  src/corelib/theme/mlogicalvalues_p.h |    1 +                      
  15.  2 files changed, 18 insertions(+), 6 deletions(-)                  
  16.  
  17. diff --git a/src/corelib/theme/mlogicalvalues.cpp b/src/corelib/theme/mlogicalvalues.cpp
  18. index 4882e1d..1107cf3 100644                                                          
  19. --- a/src/corelib/theme/mlogicalvalues.cpp                                              
  20. +++ b/src/corelib/theme/mlogicalvalues.cpp                                              
  21. @@ -185,6 +185,22 @@ QString MLogicalValuesPrivate::createBinaryFilename(const QFileInfo &fileInfo) c
  22.      return binaryFilename;                                                                          
  23.  }                                                                                                  
  24.                                                                                                      
  25. +void MLogicalValuesPrivate::mergeGroups(const Groups &groups)
  26. +{
  27. +    Groups::const_iterator i = groups.constBegin();
  28. +    while (i != groups.constEnd()) {
  29. +        Values &values = data[i.key()];
  30. +        Values::const_iterator j = i.value().constBegin();
  31. +        while (j != i.value().constEnd()) {
  32. +            if (!values.contains(j.key())) {
  33. +                values.insert(j.key(), j.value());
  34. +            }
  35. +            ++j;
  36. +        }
  37. +        ++i;
  38. +    }
  39. +}
  40. +
  41.  bool MLogicalValues::append(const QString &fileName)
  42.  {
  43.      Q_D(MLogicalValues);
  44. @@ -203,12 +219,7 @@ bool MLogicalValues::append(const QString &fileName)
  45.  
  46.      d->timestamps << fileInfo.lastModified().toTime_t();
  47.  
  48. -    Groups::const_iterator i = groups.constBegin();
  49. -    while (i != groups.constEnd()) {
  50. -        Values &values = d->data[i.key()];
  51. -        values.unite(i.value());
  52. -        ++i;
  53. -    }
  54. +    d->mergeGroups(groups);
  55.  
  56.      return true;
  57.  }
  58. diff --git a/src/corelib/theme/mlogicalvalues_p.h b/src/corelib/theme/mlogicalvalues_p.h
  59. index 493c402..c50ae00 100644
  60. --- a/src/corelib/theme/mlogicalvalues_p.h
  61. +++ b/src/corelib/theme/mlogicalvalues_p.h
  62. @@ -36,6 +36,7 @@ public:
  63.      bool loadFromBinaryCache(const QFileInfo &fileInfo, Groups &groups);
  64.      bool saveToBinaryCache(const QFileInfo &fileInfo, const Groups &groups) const;
  65.      QString createBinaryFilename(const QFileInfo &fileInfo) const;
  66. +    void mergeGroups(const Groups &groups);
  67.      Groups data;
  68.      QList<uint> timestamps;
  69.  };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement