Changeset View
Changeset View
Standalone View
Standalone View
src/output.cpp
Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Line(s) | 35 | public: | |||
---|---|---|---|---|---|
93 | bool primary; | 93 | bool primary; | ||
94 | bool followPreferredMode = false; | 94 | bool followPreferredMode = false; | ||
95 | 95 | | |||
96 | mutable QPointer<Edid> edid; | 96 | mutable QPointer<Edid> edid; | ||
97 | }; | 97 | }; | ||
98 | 98 | | |||
99 | bool Output::Private::compareModeList(const ModeList& before, const ModeList &after) | 99 | bool Output::Private::compareModeList(const ModeList& before, const ModeList &after) | ||
100 | { | 100 | { | ||
101 | if (before.keys() != after.keys()) { | 101 | if (before.count() != after.count()) { | ||
broulik: `count()` | |||||
The previous code also compared the contents of both, or does your new loop below do that? broulik: The previous code also compared the contents of both, or does your new loop below do that? | |||||
Yes, the check is in the loop below: after and before are of the same sizes, and if after contains each key from before, then their keys are equal. So return false if a key can't be found in after. volkov: Yes, the check is in the loop below: `after` and `before` are of the same sizes, and if `after`… | |||||
102 | return false; | 102 | return false; | ||
103 | } | 103 | } | ||
104 | for (const QString &key : before.keys()) { | 104 | | ||
105 | const auto mb = before.value(key); | 105 | for (auto itb = before.constBegin(); itb != before.constEnd(); ++itb) { | ||
106 | const auto ma = after.value(key); | 106 | auto ita = after.constFind(itb.key()); | ||
107 | if (ita == after.constEnd()) { | ||||
108 | return false; | ||||
109 | } | ||||
110 | const auto &mb = itb.value(); | ||||
111 | const auto &ma = ita.value(); | ||||
107 | if (mb->id() != ma->id()) { | 112 | if (mb->id() != ma->id()) { | ||
108 | return false; | 113 | return false; | ||
109 | } | 114 | } | ||
110 | if (mb->size() != ma->size()) { | 115 | if (mb->size() != ma->size()) { | ||
111 | return false; | 116 | return false; | ||
112 | } | 117 | } | ||
113 | if (!qFuzzyCompare(mb->refreshRate(), ma->refreshRate())) { | 118 | if (!qFuzzyCompare(mb->refreshRate(), ma->refreshRate())) { | ||
114 | return false; | 119 | return false; | ||
▲ Show 20 Lines • Show All 498 Lines • Show Last 20 Lines |
count()