mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-06 11:10:44 +00:00
More stuff to that, plus the selection time display
This commit is contained in:
parent
3b87ae074a
commit
7f9e49c3d7
@ -259,27 +259,25 @@ void gGraphWindow::ZoomX(double mult,int origin_px)
|
|||||||
min=max-q;
|
min=max-q;
|
||||||
}
|
}
|
||||||
SetXBounds(min,max);
|
SetXBounds(min,max);
|
||||||
updateSelectionTime();
|
updateSelectionTime(max-min);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gGraphWindow::updateSelectionTime()
|
void gGraphWindow::updateSelectionTime(qint64 span) // in milliseconds
|
||||||
{
|
{
|
||||||
double f;
|
qint64 time=span % 86400000;
|
||||||
f=(max_x-min_x)/86400000.0;
|
int days,hours,minutes,seconds,milli;
|
||||||
|
milli=time % 1000;
|
||||||
int hours,minutes,seconds;
|
time/=1000;
|
||||||
hours=int(f*24.0);
|
seconds=time%60;
|
||||||
minutes=int(f*24*60.0) % 60;
|
time/=60;
|
||||||
seconds=int(f*24*3600.0) % 60;
|
minutes=time%60;
|
||||||
|
time/=60;
|
||||||
|
hours=time;
|
||||||
|
time/=24;
|
||||||
|
days=time;
|
||||||
QString s;
|
QString s;
|
||||||
if (f>1) {
|
|
||||||
s.sprintf("%.0f days",f);
|
s.sprintf("%02i:%02i:%02i:%04i",hours,minutes,seconds,milli);
|
||||||
} else if (f>(1.0/(24.0*12.0))) {
|
|
||||||
s.sprintf("%02i:%02i:%02i",hours,minutes,seconds);
|
|
||||||
} else {
|
|
||||||
int milli=int(f*24*3600000.0) % 1000;
|
|
||||||
s.sprintf("%02i:%02i:%02i:%04i",hours,minutes,seconds,milli);
|
|
||||||
}
|
|
||||||
qstatus2->setText(s);
|
qstatus2->setText(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,22 +399,8 @@ void gGraphWindow::mouseMoveEvent(QMouseEvent * event)
|
|||||||
} else {
|
} else {
|
||||||
z=max_x-min_x;
|
z=max_x-min_x;
|
||||||
}
|
}
|
||||||
double q=double(t2-t1)/width();
|
double q=double(t2-t1)/Width();
|
||||||
double f=((q*z)/3600000.0);
|
this->updateSelectionTime(q*z);
|
||||||
int hours,minutes,seconds;
|
|
||||||
hours=int(f);
|
|
||||||
minutes=int(f*60.0) % 60;
|
|
||||||
seconds=int(f*3600.0) % 60;
|
|
||||||
QString s;
|
|
||||||
if (z>1) {
|
|
||||||
s.sprintf("%.0f days",q*z);
|
|
||||||
} else if (z>(1.0/(24.0*12.0))) {
|
|
||||||
s.sprintf("%02i:%02i:%02i",hours,minutes,seconds);
|
|
||||||
} else {
|
|
||||||
int milli=int(f*3600000.0) % 1000;
|
|
||||||
s.sprintf("%02i:%02i:%02i:%04i",hours,minutes,seconds,milli);
|
|
||||||
}
|
|
||||||
qstatus2->setText(s);
|
|
||||||
m_mouseRBlast=m_mouseRBrect;
|
m_mouseRBlast=m_mouseRBrect;
|
||||||
m_mouseRBrect=r;
|
m_mouseRBrect=r;
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ public:
|
|||||||
void SetSplitter(QSplitter *s) { splitter=s; }
|
void SetSplitter(QSplitter *s) { splitter=s; }
|
||||||
bool isDraggingGraph() { return m_dragGraph; }
|
bool isDraggingGraph() { return m_dragGraph; }
|
||||||
protected:
|
protected:
|
||||||
void updateSelectionTime();
|
void updateSelectionTime(qint64 span);
|
||||||
|
|
||||||
void initializeGL();
|
void initializeGL();
|
||||||
QSplitter *splitter;
|
QSplitter *splitter;
|
||||||
|
43
daily.cpp
43
daily.cpp
@ -27,6 +27,7 @@
|
|||||||
#include "Graphs/gBarChart.h"
|
#include "Graphs/gBarChart.h"
|
||||||
#include "Graphs/gpiechart.h"
|
#include "Graphs/gpiechart.h"
|
||||||
|
|
||||||
|
const int default_height=150;
|
||||||
|
|
||||||
Daily::Daily(QWidget *parent,QGLWidget * shared) :
|
Daily::Daily(QWidget *parent,QGLWidget * shared) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
@ -42,14 +43,16 @@ Daily::Daily(QWidget *parent,QGLWidget * shared) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
gSplitter=new QSplitter(Qt::Vertical,ui->scrollArea);
|
gSplitter=new QSplitter(Qt::Vertical,ui->scrollArea);
|
||||||
gSplitter->setStyleSheet("QSplitter::handle { background-color: 'dark grey'; }");
|
gSplitter->setStyleSheet("QSplitter::handle { background-color: 'light grey'; }");
|
||||||
gSplitter->setHandleWidth(2);
|
gSplitter->setHandleWidth(2);
|
||||||
|
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||||
|
ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
ui->scrollArea->setWidget(gSplitter);
|
ui->scrollArea->setWidget(gSplitter);
|
||||||
//ui->graphSizer->addWidget(gSplitter);
|
//ui->graphSizer->addWidget(gSplitter);
|
||||||
ui->scrollArea->setAutoFillBackground(false);
|
ui->scrollArea->setAutoFillBackground(false);
|
||||||
gSplitter->setAutoFillBackground(false);
|
gSplitter->setAutoFillBackground(false);
|
||||||
ui->scrollArea->setWidgetResizable(true);
|
ui->scrollArea->setWidgetResizable(true);
|
||||||
gSplitter->setMinimumHeight(1600);
|
//gSplitter->setMinimumHeight(1600);
|
||||||
//gSplitter->setMinimumWidth(600);
|
//gSplitter->setMinimumWidth(600);
|
||||||
|
|
||||||
SF=new gGraphWindow(gSplitter,tr("Event Flags"),shared);
|
SF=new gGraphWindow(gSplitter,tr("Event Flags"),shared);
|
||||||
@ -79,8 +82,6 @@ Daily::Daily(QWidget *parent,QGLWidget * shared) :
|
|||||||
//fmt.setDefaultFormat(fmt);
|
//fmt.setDefaultFormat(fmt);
|
||||||
offscreen_context=new QGLContext(fmt); */
|
offscreen_context=new QGLContext(fmt); */
|
||||||
|
|
||||||
const int default_height=100;
|
|
||||||
|
|
||||||
SF->SetLeftMargin(SF->GetLeftMargin()+gYAxis::Margin);
|
SF->SetLeftMargin(SF->GetLeftMargin()+gYAxis::Margin);
|
||||||
SF->SetBlockZoom(true);
|
SF->SetBlockZoom(true);
|
||||||
SF->AddLayer(new gXAxis());
|
SF->AddLayer(new gXAxis());
|
||||||
@ -255,10 +256,10 @@ Daily::Daily(QWidget *parent,QGLWidget * shared) :
|
|||||||
}
|
}
|
||||||
AddGraph(PULSE);
|
AddGraph(PULSE);
|
||||||
// AddGraph(SPO2);
|
// AddGraph(SPO2);
|
||||||
/*QLabel *space=new QLabel(gSplitter);
|
spacer=new QWidget(gSplitter);
|
||||||
gSplitter->addWidget(space);
|
gSplitter->addWidget(spacer);
|
||||||
i=gSplitter->indexOf(space);
|
i=gSplitter->indexOf(spacer);
|
||||||
gSplitter->setStretchFactor(i,1); */
|
gSplitter->setStretchFactor(i,1);
|
||||||
|
|
||||||
//gSplitter->refresh();
|
//gSplitter->refresh();
|
||||||
|
|
||||||
@ -294,8 +295,8 @@ void Daily::AddGraph(gGraphWindow *w)
|
|||||||
}
|
}
|
||||||
void Daily::resizeEvent (QResizeEvent * event)
|
void Daily::resizeEvent (QResizeEvent * event)
|
||||||
{
|
{
|
||||||
const QSize &size=event->size();
|
//const QSize &size=event->size();
|
||||||
gSplitter->setMinimumWidth(size.width()-280);
|
// gSplitter->setMinimumWidth(size.width()-280);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Daily::ReloadGraphs()
|
void Daily::ReloadGraphs()
|
||||||
@ -378,8 +379,7 @@ void Daily::UpdateEventsTree(QTreeWidget *tree,Day *day)
|
|||||||
a.append(d.toString("yyyy-MM-dd HH:mm:ss"));
|
a.append(d.toString("yyyy-MM-dd HH:mm:ss"));
|
||||||
mcr->addChild(new QTreeWidgetItem(a));
|
mcr->addChild(new QTreeWidgetItem(a));
|
||||||
}
|
}
|
||||||
}
|
} }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
int cnt=0;
|
int cnt=0;
|
||||||
for (map<MachineCode,QTreeWidgetItem *>::iterator m=mcroot.begin();m!=mcroot.end();m++) {
|
for (map<MachineCode,QTreeWidgetItem *>::iterator m=mcroot.begin();m!=mcroot.end();m++) {
|
||||||
@ -429,7 +429,7 @@ void Daily::Load(QDate date)
|
|||||||
static Day * lastcpapday=NULL;
|
static Day * lastcpapday=NULL;
|
||||||
previous_date=date;
|
previous_date=date;
|
||||||
Day *cpap=profile->GetDay(date,MT_CPAP);
|
Day *cpap=profile->GetDay(date,MT_CPAP);
|
||||||
//Day *oxi=profile->GetDay(date,MT_OXIMETER);
|
Day *oxi=profile->GetDay(date,MT_OXIMETER);
|
||||||
// Day *sleepstage=profile->GetDay(date,MT_SLEEPSTAGE);
|
// Day *sleepstage=profile->GetDay(date,MT_SLEEPSTAGE);
|
||||||
|
|
||||||
if (!pref["MemoryHog"].toBool()) {
|
if (!pref["MemoryHog"].toBool()) {
|
||||||
@ -447,7 +447,7 @@ void Daily::Load(QDate date)
|
|||||||
QString tmp;
|
QString tmp;
|
||||||
const int gwwidth=240;
|
const int gwwidth=240;
|
||||||
const int gwheight=25;
|
const int gwheight=25;
|
||||||
//UpdateOXIGraphs(oxi);
|
UpdateOXIGraphs(oxi);
|
||||||
//gSplitter->blockSignals(true);
|
//gSplitter->blockSignals(true);
|
||||||
//ui->scrollArea->blockSignals(true);
|
//ui->scrollArea->blockSignals(true);
|
||||||
//ui->scrollArea->setUpdatesEnabled(false);
|
//ui->scrollArea->setUpdatesEnabled(false);
|
||||||
@ -457,27 +457,32 @@ void Daily::Load(QDate date)
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
UpdateCPAPGraphs(cpap);
|
UpdateCPAPGraphs(cpap);
|
||||||
//UpdateEventsTree(ui->treeWidget,cpap);
|
UpdateEventsTree(ui->treeWidget,cpap);
|
||||||
|
|
||||||
if (!cpap) {// && !oxi) {
|
if (!cpap && !oxi) {
|
||||||
gSplitter->setMinimumHeight(0);
|
gSplitter->setMinimumHeight(0);
|
||||||
NoData->setText(tr("No data for ")+date.toString(Qt::SystemLocaleLongDate));
|
NoData->setText(tr("No data for ")+date.toString(Qt::SystemLocaleLongDate));
|
||||||
if (!NoData->isVisible()) NoData->show();
|
if (!NoData->isVisible()) NoData->show();
|
||||||
for (unsigned i=0;i<Graphs.size();i++) {
|
for (unsigned i=0;i<Graphs.size();i++) {
|
||||||
Graphs[i]->hide();
|
Graphs[i]->hide();
|
||||||
}
|
}
|
||||||
|
spacer->hide();
|
||||||
//if (SF->isVisible()) SF->hide();
|
//if (SF->isVisible()) SF->hide();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
gSplitter->setMinimumHeight(1600);
|
|
||||||
if (NoData->isVisible()) NoData->hide();
|
if (NoData->isVisible()) NoData->hide();
|
||||||
|
int vis=1;
|
||||||
for (unsigned i=0;i<Graphs.size();i++) {
|
for (unsigned i=0;i<Graphs.size();i++) {
|
||||||
if (Graphs[i]->isEmpty()) {
|
if (Graphs[i]->isEmpty()) {
|
||||||
Graphs[i]->hide();
|
Graphs[i]->hide();
|
||||||
} else {
|
} else {
|
||||||
Graphs[i]->show();
|
Graphs[i]->show();
|
||||||
|
vis++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
gSplitter->setMinimumHeight(vis*default_height);
|
||||||
|
|
||||||
|
spacer->show();
|
||||||
//if (!SF->isVisible()) SF->show();
|
//if (!SF->isVisible()) SF->show();
|
||||||
}
|
}
|
||||||
/*for (unsigned i=0;i<Graphs.size();i++) {
|
/*for (unsigned i=0;i<Graphs.size();i++) {
|
||||||
@ -493,7 +498,7 @@ void Daily::Load(QDate date)
|
|||||||
RedrawGraphs();
|
RedrawGraphs();
|
||||||
//ui->scrollArea->update();
|
//ui->scrollArea->update();
|
||||||
|
|
||||||
/* QString epr,modestr;
|
QString epr,modestr;
|
||||||
float iap90,eap90;
|
float iap90,eap90;
|
||||||
CPAPMode mode=MODE_UNKNOWN;
|
CPAPMode mode=MODE_UNKNOWN;
|
||||||
PRTypes pr;
|
PRTypes pr;
|
||||||
@ -695,7 +700,7 @@ void Daily::Load(QDate date)
|
|||||||
if (journal) {
|
if (journal) {
|
||||||
ui->JournalNotes->setHtml(journal->summary[GEN_Notes].toString());
|
ui->JournalNotes->setHtml(journal->summary[GEN_Notes].toString());
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
void Daily::Unload(QDate date)
|
void Daily::Unload(QDate date)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user