From 1ebc9e8ea3486b3711256a1fa9a64697ef76b2f7 Mon Sep 17 00:00:00 2001 From: victor Date: Wed, 31 May 2017 15:55:18 +0900 Subject: [PATCH] =?UTF-8?q?=EC=8B=9C=EC=9E=91=ED=95=A0=20=EB=95=8C?= =?UTF-8?q?=EB=A7=88=EB=8B=A4=20=EC=B5=9C=EA=B7=BC=20=EC=9A=94=EB=A6=AC=20?= =?UTF-8?q?=EC=88=9C=EC=84=9C=EA=B0=80=20=EB=92=A4=EC=A7=91=ED=9E=88?= =?UTF-8?q?=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/gui/oven_control/cookhistory.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/app/gui/oven_control/cookhistory.cpp b/app/gui/oven_control/cookhistory.cpp index 5cf8843..604689b 100644 --- a/app/gui/oven_control/cookhistory.cpp +++ b/app/gui/oven_control/cookhistory.cpp @@ -390,6 +390,27 @@ void appendRecent(RecentsEntry e) } } + recentList.append(e); + + while (recentList.size() > maxRecents) + recentList.takeFirst(); +} + +void prependRecent(RecentsEntry e) +{ + if (e.type == RecentsEntry::Auto) + { + for (int i = 0; i < recentList.size(); i++) + { + RecentsEntry entry = recentList.at(i); + if (entry.autoCook.root == e.autoCook.root) + { + recentList.removeAt(i); + break; + } + } + } + recentList.prepend(e); while (recentList.size() > maxRecents) @@ -1036,7 +1057,7 @@ void CookHistory::record(ManualCookSetting cook) e.manualCook.coreTemp = cook.coreTempEnabled ? cook.coreTemp : -1; e.manualCook.cookedTime = QDateTime::currentDateTime(); - appendRecent(e); + prependRecent(e); saveRecents.start(); } @@ -1052,7 +1073,7 @@ void CookHistory::record(AutoCookSetting cook) for (int i = 0; i < 5; i++) e.autoCook.configs[i] = cook.configs[i]; - appendRecent(e); + prependRecent(e); saveRecents.start(); if (countMap.contains(cook.root)) -- 2.1.4