Commit 1ebc9e8ea3486b3711256a1fa9a64697ef76b2f7
1 parent
fed46df714
Exists in
master
and in
2 other branches
시작할 때마다 최근 요리 순서가 뒤집히는 문제 수정
Showing
1 changed file
with
23 additions
and
2 deletions
Show diff stats
app/gui/oven_control/cookhistory.cpp
... | ... | @@ -390,6 +390,27 @@ void appendRecent(RecentsEntry e) |
390 | 390 | } |
391 | 391 | } |
392 | 392 | |
393 | + recentList.append(e); | |
394 | + | |
395 | + while (recentList.size() > maxRecents) | |
396 | + recentList.takeFirst(); | |
397 | +} | |
398 | + | |
399 | +void prependRecent(RecentsEntry e) | |
400 | +{ | |
401 | + if (e.type == RecentsEntry::Auto) | |
402 | + { | |
403 | + for (int i = 0; i < recentList.size(); i++) | |
404 | + { | |
405 | + RecentsEntry entry = recentList.at(i); | |
406 | + if (entry.autoCook.root == e.autoCook.root) | |
407 | + { | |
408 | + recentList.removeAt(i); | |
409 | + break; | |
410 | + } | |
411 | + } | |
412 | + } | |
413 | + | |
393 | 414 | recentList.prepend(e); |
394 | 415 | |
395 | 416 | while (recentList.size() > maxRecents) |
... | ... | @@ -1036,7 +1057,7 @@ void CookHistory::record(ManualCookSetting cook) |
1036 | 1057 | e.manualCook.coreTemp = cook.coreTempEnabled ? cook.coreTemp : -1; |
1037 | 1058 | e.manualCook.cookedTime = QDateTime::currentDateTime(); |
1038 | 1059 | |
1039 | - appendRecent(e); | |
1060 | + prependRecent(e); | |
1040 | 1061 | saveRecents.start(); |
1041 | 1062 | } |
1042 | 1063 | |
... | ... | @@ -1052,7 +1073,7 @@ void CookHistory::record(AutoCookSetting cook) |
1052 | 1073 | for (int i = 0; i < 5; i++) |
1053 | 1074 | e.autoCook.configs[i] = cook.configs[i]; |
1054 | 1075 | |
1055 | - appendRecent(e); | |
1076 | + prependRecent(e); | |
1056 | 1077 | saveRecents.start(); |
1057 | 1078 | |
1058 | 1079 | if (countMap.contains(cook.root)) | ... | ... |