From f13bfd8d7712a3865407ef3b22e3ea00734eab45 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Fri, 18 Nov 2011 18:33:31 +1000 Subject: [PATCH] Added 'Event Window' option in preferences to set how much surrounding data is shown when clicking on an event --- daily.cpp | 6 ++- mainwindow.cpp | 1 + preferencesdialog.cpp | 6 +++ preferencesdialog.ui | 95 +++++++++++++++++++++++++++++++++++++------ 4 files changed, 94 insertions(+), 14 deletions(-) diff --git a/daily.cpp b/daily.cpp index 58b0bb17..6d87830d 100644 --- a/daily.cpp +++ b/daily.cpp @@ -843,8 +843,10 @@ void Daily::on_treeWidget_itemSelectionChanged() QDateTime d; if (!item->text(1).isEmpty()) { d=d.fromString(item->text(1),"yyyy-MM-dd HH:mm:ss"); - double st=qint64((d.addSecs(-120)).toTime_t())*1000L; - double et=qint64((d.addSecs(120)).toTime_t())*1000L; + int winsize=PROFILE["EventWindowSize"].toInt()*60; + + double st=qint64((d.addSecs(-(winsize/2))).toTime_t())*1000L; + double et=qint64((d.addSecs(winsize/2)).toTime_t())*1000L; GraphView->SetXBounds(st,et); } } diff --git a/mainwindow.cpp b/mainwindow.cpp index 433f04cc..574bfb06 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -113,6 +113,7 @@ MainWindow::MainWindow(QWidget *parent) : if (!PROFILE.Exists("IgnoreShorterSessions")) PROFILE["IgnoreShorterSessions"]=0; if (!PROFILE.Exists("CombineCloserSessions")) PROFILE["CombineCloserSessions"]=0; if (!PROFILE.Exists("DaySplitTime")) PROFILE["DaySplitTime"]=QTime(12,0,0,0); + if (!PROFILE.Exists("EventWindowSize")) PROFILE["EventWindowSize"]=4; //ui->actionUse_AntiAliasing->setChecked(PROFILE["UseAntiAliasing"].toBool()); ui->action_Link_Graph_Groups->setChecked(PROFILE["LinkGroups"].toBool()); diff --git a/preferencesdialog.cpp b/preferencesdialog.cpp index f697bb88..7a78a4d2 100644 --- a/preferencesdialog.cpp +++ b/preferencesdialog.cpp @@ -74,6 +74,10 @@ PreferencesDialog::PreferencesDialog(QWidget *parent,Profile * _profile) : if (!(*profile).Exists("SquareWavePlots")) (*profile)["SquareWavePlots"]=true; ui->squareWavePlots->setChecked((*profile)["SquareWavePlots"].toBool()); + if (!(*profile).Exists("EventWindowSize")) (*profile)["EventWindowSize"]=4; + ui->eventWindowSlider->setValue((*profile)["EventWindowSize"].toInt()); + ui->eventWindowLCD->display((*profile)["EventWindowSize"].toInt()); + if (!PREF.Exists("Updates_AutoCheck")) PREF["Updates_AutoCheck"]=true; ui->automaticallyCheckUpdates->setChecked(PREF["Updates_AutoCheck"].toBool()); @@ -209,6 +213,8 @@ void PreferencesDialog::Save() (*profile)["SyncOximetry"]=ui->oximetrySync->isChecked(); (*profile)["OximeterType"]=ui->oximetryType->currentText(); + (*profile)["EventWindowSize"]=ui->eventWindowSlider->value(); + if (ui->squareWavePlots->isChecked() != (*profile)["SquareWavePlots"].toBool()) { needs_restart=true; } diff --git a/preferencesdialog.ui b/preferencesdialog.ui index 244625d3..e4d9fe5d 100644 --- a/preferencesdialog.ui +++ b/preferencesdialog.ui @@ -45,7 +45,7 @@ &CPAP/Visual - + @@ -58,7 +58,7 @@ - + @@ -71,7 +71,7 @@ - + @@ -84,7 +84,7 @@ - + @@ -102,7 +102,7 @@ - + The visual method of displaying waveform overlay flags. @@ -119,7 +119,7 @@ - + @@ -133,7 +133,7 @@ - + Qt::Vertical @@ -146,7 +146,7 @@ - + @@ -163,7 +163,7 @@ This takes extra space, and has been known to cause problems on certain computer - + @@ -179,7 +179,7 @@ This takes extra space, and has been known to cause problems on certain computer - + @@ -196,7 +196,7 @@ It has no effect on single cpu machines. - + Skip empty days with Prev & Next buttons above daily view calendar @@ -206,13 +206,65 @@ It has no effect on single cpu machines. - + Square Wave Plots + + + + Event Window + + + + + + + + + This adjusts how much surrounding data is shown when an event is selected in Daily Views Event tab. + + + 1 + + + 30 + + + 5 + + + Qt::Horizontal + + + false + + + QSlider::TicksAbove + + + 1 + + + + + + + + 50 + 16777215 + + + + 2 + + + + + @@ -353,6 +405,9 @@ It will be faster changing to days you've already been to if you leave it on. QFrame::Box + + 5 + QLCDNumber::Flat @@ -1211,5 +1266,21 @@ p, li { white-space: pre-wrap; } + + eventWindowSlider + sliderMoved(int) + eventWindowLCD + display(int) + + + 286 + 56 + + + 465 + 56 + + +