Changeset View
Changeset View
Standalone View
Standalone View
src/mergemode/mergecatalog.cpp
Show First 20 Lines • Show All 188 Lines • ▼ Show 20 Line(s) | 187 | while (i.entry < size) { | |||
---|---|---|---|---|---|
189 | const QList<int>& entries = mergeMap.values(key); | 189 | const QList<int>& entries = mergeMap.values(key); | ||
190 | QList<MatchItem> scores; | 190 | QList<MatchItem> scores; | ||
191 | 191 | | |||
192 | int k = entries.size(); | 192 | int k = entries.size(); | ||
193 | if (k) { | 193 | if (k) { | ||
194 | while (--k >= 0) | 194 | while (--k >= 0) | ||
195 | scores << calcMatchItem(i, DocPosition(entries.at(k))); | 195 | scores << calcMatchItem(i, DocPosition(entries.at(k))); | ||
196 | 196 | | |||
197 | qSort(scores.begin(), scores.end(), qGreater<MatchItem>()); | 197 | std::sort(scores.begin(), scores.end(), qGreater<MatchItem>()); | ||
198 | 198 | | |||
199 | m_map[i.entry] = scores.first().mergeEntry; | 199 | m_map[i.entry] = scores.first().mergeEntry; | ||
200 | backMap.insert(scores.first().mergeEntry, i.entry); | 200 | backMap.insert(scores.first().mergeEntry, i.entry); | ||
201 | 201 | | |||
202 | if (scores.first().translationIsDifferent) | 202 | if (scores.first().translationIsDifferent) | ||
203 | m_mergeDiffIndex.append(i.entry); | 203 | m_mergeDiffIndex.append(i.entry); | ||
204 | 204 | | |||
205 | } | 205 | } | ||
206 | ++(i.entry); | 206 | ++(i.entry); | ||
207 | } | 207 | } | ||
208 | 208 | | |||
209 | 209 | | |||
210 | //maintain one-to-one relation | 210 | //maintain one-to-one relation | ||
211 | const QList<int>& mergePositions = backMap.uniqueKeys(); | 211 | const QList<int>& mergePositions = backMap.uniqueKeys(); | ||
212 | foreach (int mergePosition, mergePositions) { | 212 | foreach (int mergePosition, mergePositions) { | ||
213 | const QList<int>& basePositions = backMap.values(mergePosition); | 213 | const QList<int>& basePositions = backMap.values(mergePosition); | ||
214 | if (basePositions.size() == 1) | 214 | if (basePositions.size() == 1) | ||
215 | continue; | 215 | continue; | ||
216 | 216 | | |||
217 | //qCDebug(LOKALIZE_LOG)<<"kv"<<mergePosition<<basePositions; | 217 | //qCDebug(LOKALIZE_LOG)<<"kv"<<mergePosition<<basePositions; | ||
218 | QList<MatchItem> scores; | 218 | QList<MatchItem> scores; | ||
219 | foreach (int value, basePositions) | 219 | foreach (int value, basePositions) | ||
220 | scores << calcMatchItem(DocPosition(value), mergePosition); | 220 | scores << calcMatchItem(DocPosition(value), mergePosition); | ||
221 | 221 | | |||
222 | qSort(scores.begin(), scores.end(), qGreater<MatchItem>()); | 222 | std::sort(scores.begin(), scores.end(), qGreater<MatchItem>()); | ||
223 | int i = scores.size(); | 223 | int i = scores.size(); | ||
224 | while (--i > 0) { | 224 | while (--i > 0) { | ||
225 | //qCDebug(LOKALIZE_LOG)<<"erasing"<<scores.at(i).baseEntry<<m_map[scores.at(i).baseEntry]<<",m_map["<<scores.at(i).baseEntry<<"]=-1"; | 225 | //qCDebug(LOKALIZE_LOG)<<"erasing"<<scores.at(i).baseEntry<<m_map[scores.at(i).baseEntry]<<",m_map["<<scores.at(i).baseEntry<<"]=-1"; | ||
226 | m_map[scores.at(i).baseEntry] = -1; | 226 | m_map[scores.at(i).baseEntry] = -1; | ||
227 | } | 227 | } | ||
228 | } | 228 | } | ||
229 | 229 | | |||
230 | //fuzzy match unmatched entries? | 230 | //fuzzy match unmatched entries? | ||
▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines |