From 2fcc2de524cdcf58909e03613807852fe4671441 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Fri, 5 Aug 2011 18:41:45 +1000 Subject: [PATCH] Cleanup to the previous stuff, allow longer ignore value --- SleepLib/machine.cpp | 11 ++++++----- preferencesdialog.cpp | 38 +++++++++++++++++++++++++++----------- preferencesdialog.ui | 2 +- 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/SleepLib/machine.cpp b/SleepLib/machine.cpp index bb051480..d462b5a4 100644 --- a/SleepLib/machine.cpp +++ b/SleepLib/machine.cpp @@ -366,10 +366,6 @@ Day *Machine::AddSession(Session *s,Profile *p) sessionlist[s->session()]=s; // To make sure it get's saved later even if it's not wanted. - if (session_lengthfirst()); QDate date=d2.date(); @@ -379,7 +375,7 @@ Day *Machine::AddSession(Session *s,Profile *p) bool combine_next_day=false; - int closest_session=-1; + int closest_session=0; if (time=60)) + return NULL; + } + if (!firstsession) { if (firstday>date) firstday=date; if (lastdaytimeEdit->setTime(t); } + int val; + if (pref.Exists("CombineCloserSessions")) { - int i=pref["CombineCloserSessions"].toInt(); - ui->combineSlider->setValue(i); - if (i>0) { - ui->combineLCD->display(i); - } else ui->combineLCD->display(tr("OFF")); + val=pref["CombineCloserSessions"].toInt(); + ui->combineSlider->setValue(val); + } else { + ui->combineSlider->setValue(val=0); + pref["CombineCloserSessions"]=val; } + if (val>0) { + ui->combineLCD->display(val); + } else ui->combineLCD->display(tr("OFF")); + + if (pref.Exists("IgnoreShorterSessions")) { - int i=pref["IgnoreShorterSessions"].toInt(); - ui->IgnoreSlider->setValue(i); - if (i>0) { - ui->IgnoreLCD->display(i); - } else ui->IgnoreLCD->display(tr("OFF")); + val=pref["IgnoreShorterSessions"].toInt(); + ui->IgnoreSlider->setValue(val); + } else { + ui->IgnoreSlider->setValue(val=0); + pref["IgnoreShorterSessions"]=val; } + if (val>0) { + ui->IgnoreLCD->display(val); + } else ui->IgnoreLCD->display(tr("OFF")); + + + bool b; if (pref.Exists("MemoryHog")) { - ui->memoryHogCheckbox->setChecked(pref["MemoryHog"].toBool()); + b=pref["MemoryHog"].toBool(); + } else { + pref["MemoryHog"]=b=false; } + ui->memoryHogCheckbox->setChecked(b); ui->eventTable->setColumnWidth(0,40); ui->eventTable->setColumnWidth(1,55); diff --git a/preferencesdialog.ui b/preferencesdialog.ui index 82d2d09e..306bdfbf 100644 --- a/preferencesdialog.ui +++ b/preferencesdialog.ui @@ -210,7 +210,7 @@ p, li { white-space: pre-wrap; } <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-style:italic;"></p></body></html> - 60 + 90 5