From ffbc94bb416bca403d91c903c4495edc0f429215 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Fri, 20 Jun 2014 12:21:56 +1000 Subject: [PATCH] Fix LoadSummary upgrade for m_cnt fix, and m_sum load error --- sleepyhead/SleepLib/session.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/sleepyhead/SleepLib/session.cpp b/sleepyhead/SleepLib/session.cpp index f3762cf5..5d424baf 100644 --- a/sleepyhead/SleepLib/session.cpp +++ b/sleepyhead/SleepLib/session.cpp @@ -282,12 +282,20 @@ bool Session::LoadSummary(QString filename) settings[code] = i.value(); } - QHash zcnt; - in >> zcnt; - - for (QHash::iterator i = zcnt.begin(); i != zcnt.end(); i++) { - code = schema::channel[i.key()].id(); - m_cnt[code] = i.value(); + if (version < 13) { + QHash zcnt; + in >> zcnt; + for (QHash::iterator i = zcnt.begin(); i != zcnt.end(); i++) { + code = schema::channel[i.key()].id(); + m_cnt[code] = i.value(); + } + } else { + QHash zcnt; + in >> zcnt; + for (QHash::iterator i = zcnt.begin(); i != zcnt.end(); i++) { + code = schema::channel[i.key()].id(); + m_cnt[code] = i.value(); + } } QHash zsum; @@ -295,7 +303,7 @@ bool Session::LoadSummary(QString filename) for (QHash::iterator i = zsum.begin(); i != zsum.end(); i++) { code = schema::channel[i.key()].id(); - m_cnt[code] = i.value(); + m_sum[code] = i.value(); } QHash ztmp;