mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-14 17:50:44 +00:00
Moved Overview Report to to Overview, added Print menu
This commit is contained in:
parent
d0d7c8d908
commit
b45fc5f273
@ -320,8 +320,10 @@ void SummaryChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
GetTextExtent(a,x,y);
|
GetTextExtent(a,x,y);
|
||||||
px-=30+x;
|
px-=30+x;
|
||||||
w.renderText(a,px+24,py+5);
|
w.renderText(a,px+24,py+5);
|
||||||
lines->add(px,py,px+20,py,m_colors[j]);
|
quads->add(px,py-3,px+20,py-3,px+20,py+4,px,py+4,m_colors[j]);
|
||||||
lines->add(px,py+1,px+20,py+1,m_colors[j]);
|
//quads->add(m_colors[j]);
|
||||||
|
//lines->add(px,py,px+20,py,m_colors[j]);
|
||||||
|
//lines->add(px,py+1,px+20,py+1,m_colors[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString z=m_label;
|
QString z=m_label;
|
||||||
|
@ -132,6 +132,40 @@ void GLBuffer::add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,QColor & color
|
|||||||
qDebug() << "GLBuffer overflow";
|
qDebug() << "GLBuffer overflow";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void GLBuffer::add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,GLshort x3, GLshort y3, GLshort x4, GLshort y4,QColor & color) // add with vertex colors
|
||||||
|
{
|
||||||
|
if (m_cnt<m_max+8) {
|
||||||
|
mutex.lock();
|
||||||
|
buffer[m_cnt++]=x1;
|
||||||
|
buffer[m_cnt++]=y1;
|
||||||
|
buffer[m_cnt++]=x2;
|
||||||
|
buffer[m_cnt++]=y2;
|
||||||
|
buffer[m_cnt++]=x3;
|
||||||
|
buffer[m_cnt++]=y3;
|
||||||
|
buffer[m_cnt++]=x4;
|
||||||
|
buffer[m_cnt++]=y4;
|
||||||
|
colors[m_colcnt++]=color.red();
|
||||||
|
colors[m_colcnt++]=color.green();
|
||||||
|
colors[m_colcnt++]=color.blue();
|
||||||
|
colors[m_colcnt++]=color.alpha();
|
||||||
|
colors[m_colcnt++]=color.red();
|
||||||
|
colors[m_colcnt++]=color.green();
|
||||||
|
colors[m_colcnt++]=color.blue();
|
||||||
|
colors[m_colcnt++]=color.alpha();
|
||||||
|
|
||||||
|
colors[m_colcnt++]=color.red();
|
||||||
|
colors[m_colcnt++]=color.green();
|
||||||
|
colors[m_colcnt++]=color.blue();
|
||||||
|
colors[m_colcnt++]=color.alpha();
|
||||||
|
colors[m_colcnt++]=color.red();
|
||||||
|
colors[m_colcnt++]=color.green();
|
||||||
|
colors[m_colcnt++]=color.blue();
|
||||||
|
colors[m_colcnt++]=color.alpha();
|
||||||
|
mutex.unlock();
|
||||||
|
} else {
|
||||||
|
qDebug() << "GLBuffer overflow";
|
||||||
|
}
|
||||||
|
}
|
||||||
void GLBuffer::draw()
|
void GLBuffer::draw()
|
||||||
{
|
{
|
||||||
if (m_cnt>0) {
|
if (m_cnt>0) {
|
||||||
|
@ -41,6 +41,7 @@ public:
|
|||||||
|
|
||||||
void add(GLshort x, GLshort y,QColor & col); // add with vertex color
|
void add(GLshort x, GLshort y,QColor & col); // add with vertex color
|
||||||
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,QColor & col); // add with vertex colors
|
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,QColor & col); // add with vertex colors
|
||||||
|
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,GLshort x3, GLshort y3, GLshort x4, GLshort y4,QColor & col); // add with vertex colors
|
||||||
|
|
||||||
void scissor(GLshort x1, GLshort y1, GLshort x2, GLshort y2) { s1=x1; s2=y1; s3=x2; s4=y2; m_scissor=true; }
|
void scissor(GLshort x1, GLshort y1, GLshort x2, GLshort y2) { s1=x1; s2=y1; s3=x2; s4=y2; m_scissor=true; }
|
||||||
void draw();
|
void draw();
|
||||||
|
@ -55,7 +55,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
qint64 total_time(); // in milliseconds
|
qint64 total_time(); // in milliseconds
|
||||||
double hours() { return double(total_time())/3600000.0; }
|
EventDataType hours() { return EventDataType(double(total_time())/3600000.0); }
|
||||||
|
|
||||||
Session *operator [](int i) { return sessions[i]; }
|
Session *operator [](int i) { return sessions[i]; }
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ License: GPL
|
|||||||
#include "SleepLib/machine_loader.h"
|
#include "SleepLib/machine_loader.h"
|
||||||
|
|
||||||
const QString cms50_class_name="CMS50";
|
const QString cms50_class_name="CMS50";
|
||||||
const int cms50_data_version=2;
|
const int cms50_data_version=3;
|
||||||
|
|
||||||
class CMS50Loader : public MachineLoader
|
class CMS50Loader : public MachineLoader
|
||||||
{
|
{
|
||||||
@ -23,8 +23,8 @@ class CMS50Loader : public MachineLoader
|
|||||||
virtual int Open(QString & path,Profile *profile);
|
virtual int Open(QString & path,Profile *profile);
|
||||||
static void Register();
|
static void Register();
|
||||||
|
|
||||||
virtual int Version() { return cms50_data_version; };
|
virtual int Version() { return cms50_data_version; }
|
||||||
virtual const QString & ClassName() { return cms50_class_name; };
|
virtual const QString & ClassName() { return cms50_class_name; }
|
||||||
|
|
||||||
Machine *CreateMachine(Profile *profile);
|
Machine *CreateMachine(Profile *profile);
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ License: GPL
|
|||||||
//********************************************************************************************
|
//********************************************************************************************
|
||||||
// Please INCREMENT the following value when making changes to this loaders implementation.
|
// Please INCREMENT the following value when making changes to this loaders implementation.
|
||||||
//
|
//
|
||||||
const int prs1_data_version=4;
|
const int prs1_data_version=5;
|
||||||
//
|
//
|
||||||
//********************************************************************************************
|
//********************************************************************************************
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ License: GPL
|
|||||||
//********************************************************************************************
|
//********************************************************************************************
|
||||||
// Please INCREMENT the following value when making changes to this loaders implementation.
|
// Please INCREMENT the following value when making changes to this loaders implementation.
|
||||||
//
|
//
|
||||||
const int resmed_data_version=2;
|
const int resmed_data_version=3;
|
||||||
//
|
//
|
||||||
//********************************************************************************************
|
//********************************************************************************************
|
||||||
|
|
||||||
|
@ -464,7 +464,9 @@ bool Machine::Purge(int secret)
|
|||||||
|
|
||||||
QDir dir(path);
|
QDir dir(path);
|
||||||
|
|
||||||
if (!dir.exists() || !dir.isReadable())
|
if (!dir.exists()) // It doesn't exist anyway.
|
||||||
|
return true;
|
||||||
|
if (!dir.isReadable())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
|
10
daily.cpp
10
daily.cpp
@ -31,17 +31,11 @@
|
|||||||
const int min_height=150;
|
const int min_height=150;
|
||||||
const int default_height=150;
|
const int default_height=150;
|
||||||
|
|
||||||
Daily::Daily(QWidget *parent,gGraphView * shared, MainWindow *mw)
|
Daily::Daily(QWidget *parent,Profile * _profile,gGraphView * shared, MainWindow *mw)
|
||||||
:QWidget(parent),mainwin(mw), ui(new Ui::Daily)
|
:QWidget(parent),mainwin(mw), ui(new Ui::Daily),profile(_profile)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
QString prof=pref["Profile"].toString();
|
|
||||||
profile=Profiles::Get(prof);
|
|
||||||
if (!profile) {
|
|
||||||
QMessageBox::critical(this,"Profile Error",QString("Couldn't get profile '%1'.. Have to abort!").arg(pref["Profile"].toString()));
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
QList<int> a;
|
QList<int> a;
|
||||||
a.push_back(300);
|
a.push_back(300);
|
||||||
a.push_back(this->width()-300);
|
a.push_back(this->width()-300);
|
||||||
|
2
daily.h
2
daily.h
@ -35,7 +35,7 @@ class Daily : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Daily(QWidget *parent,gGraphView *shared,MainWindow *mw);
|
explicit Daily(QWidget *parent, Profile * _profile, gGraphView *shared,MainWindow *mw);
|
||||||
~Daily();
|
~Daily();
|
||||||
void ReloadGraphs();
|
void ReloadGraphs();
|
||||||
void ResetGraphLayout();
|
void ResetGraphLayout();
|
||||||
|
@ -17,9 +17,13 @@ p,a,td,body { font-size: 14px }
|
|||||||
<li>Contec CMS50 Oximeters</li>
|
<li>Contec CMS50 Oximeters</li>
|
||||||
<p><a href='qrc:/docs/usage.html'>A few usage notes, plus some important information for Mac users.</a></p>
|
<p><a href='qrc:/docs/usage.html'>A few usage notes, plus some important information for Mac users.</a></p>
|
||||||
<p><i>This is a developer preview, features are missing and bugs will be plentyful.<i></p>
|
<p><i>This is a developer preview, features are missing and bugs will be plentyful.<i></p>
|
||||||
<p><b>Project Website:</b> <a href='http://sleepyhead.sourceforge.net'>http://sleepyhead.sourceforge.net</a><br>
|
<p><a href='http://www.sourceforge.net/projects/SleepyHead'>SleepyHead Project Website</a> on SourceForge<br/>
|
||||||
<b>About Sleep Apnea:</b> <a href='http://en.wikipedia.org/wiki/Sleep_apnea'>http://en.wikipedia.org/wiki/Sleep_apnea</a><br>
|
<a href='http://jedimark64.blogspot.com'>Jedimark's Personal Blog</a><br/>
|
||||||
<b>CPAPTalk Forum:</b> <a href='http://www.cpaptalk.com'>http://www.cpaptalk.com</a></p>
|
<a href='http://en.wikipedia.org/wiki/Sleep_apnea'>About Sleep Apnea</a> on Wikipedia</p>
|
||||||
|
<p>Friendly places to talk about Sleep Apnea<br/>
|
||||||
|
<a href='http://www.cpaptalk.com'>CPAPTalk Forum</a>,
|
||||||
|
<a href="http://s7.zetaboards.com/Apnea_Board/index/">Apnea Board</a>
|
||||||
|
</p>
|
||||||
</td>
|
</td>
|
||||||
<td><image src='qrc:/docs/sheep.png' width=220 height=220><br/>
|
<td><image src='qrc:/docs/sheep.png' width=220 height=220><br/>
|
||||||
<div align=center>This is a temporary logo</div>
|
<div align=center>This is a temporary logo</div>
|
||||||
|
@ -110,6 +110,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
|
|
||||||
if (!pref.Exists("Profile")) pref["Profile"]=getUserName();
|
if (!pref.Exists("Profile")) pref["Profile"]=getUserName();
|
||||||
|
|
||||||
|
profile=Profiles::Get(pref["Profile"].toString());
|
||||||
|
Q_ASSERT(profile!=NULL);
|
||||||
|
|
||||||
if (!pref.Exists("LinkGraphMovement")) pref["LinkGraphMovement"]=true;
|
if (!pref.Exists("LinkGraphMovement")) pref["LinkGraphMovement"]=true;
|
||||||
ui->action_Link_Graphs->setChecked(pref["LinkGraphMovement"].toBool());
|
ui->action_Link_Graphs->setChecked(pref["LinkGraphMovement"].toBool());
|
||||||
|
|
||||||
@ -142,6 +145,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
|
|
||||||
netmanager = new QNetworkAccessManager(this);
|
netmanager = new QNetworkAccessManager(this);
|
||||||
connect(netmanager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
|
connect(netmanager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
|
||||||
|
|
||||||
|
connect(ui->webView, SIGNAL(statusBarMessage(QString)), this, SLOT(updatestatusBarMessage(QString)));
|
||||||
}
|
}
|
||||||
extern MainWindow *mainwin;
|
extern MainWindow *mainwin;
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
@ -158,10 +163,6 @@ MainWindow::~MainWindow()
|
|||||||
oximetry->close();
|
oximetry->close();
|
||||||
delete oximetry;
|
delete oximetry;
|
||||||
}
|
}
|
||||||
if (report) {
|
|
||||||
report->close();
|
|
||||||
delete report;
|
|
||||||
}
|
|
||||||
DoneGraphs();
|
DoneGraphs();
|
||||||
Profiles::Done();
|
Profiles::Done();
|
||||||
mainwin=NULL;
|
mainwin=NULL;
|
||||||
@ -175,26 +176,19 @@ void MainWindow::Startup()
|
|||||||
qprogress->show();
|
qprogress->show();
|
||||||
//qstatusbar->showMessage(tr("Loading Data"),0);
|
//qstatusbar->showMessage(tr("Loading Data"),0);
|
||||||
|
|
||||||
profile=Profiles::Get(pref["Profile"].toString());
|
|
||||||
profile->LoadMachineData();
|
profile->LoadMachineData();
|
||||||
|
|
||||||
daily=new Daily(ui->tabWidget,NULL,this);
|
daily=new Daily(ui->tabWidget,profile,NULL,this);
|
||||||
ui->tabWidget->insertTab(1,daily,tr("Daily"));
|
ui->tabWidget->insertTab(1,daily,tr("Daily"));
|
||||||
|
|
||||||
overview=new Overview(ui->tabWidget,daily->SharedWidget());
|
overview=new Overview(ui->tabWidget,profile,daily->SharedWidget());
|
||||||
ui->tabWidget->insertTab(2,overview,tr("Overview"));
|
ui->tabWidget->insertTab(2,overview,tr("Overview"));
|
||||||
|
|
||||||
oximetry=new Oximetry(ui->tabWidget,daily->SharedWidget());
|
oximetry=new Oximetry(ui->tabWidget,profile,daily->SharedWidget());
|
||||||
ui->tabWidget->insertTab(3,oximetry,tr("Oximetry"));
|
ui->tabWidget->insertTab(3,oximetry,tr("Oximetry"));
|
||||||
|
|
||||||
report=new Report(ui->tabWidget,daily->SharedWidget(),daily,overview);
|
|
||||||
ui->tabWidget->insertTab(4,report,tr("Overview Report"));
|
|
||||||
|
|
||||||
|
|
||||||
if (daily) daily->ReloadGraphs();
|
if (daily) daily->ReloadGraphs();
|
||||||
if (overview) overview->ReloadGraphs();
|
if (overview) overview->ReloadGraphs();
|
||||||
if (report) report->ReloadGraphs();
|
|
||||||
|
|
||||||
qprogress->hide();
|
qprogress->hide();
|
||||||
qstatus->setText("");
|
qstatus->setText("");
|
||||||
//qstatusbar->clearMessage();
|
//qstatusbar->clearMessage();
|
||||||
@ -233,7 +227,6 @@ void MainWindow::on_action_Import_Data_triggered()
|
|||||||
profile->Save();
|
profile->Save();
|
||||||
if (daily) daily->ReloadGraphs();
|
if (daily) daily->ReloadGraphs();
|
||||||
if (overview) overview->ReloadGraphs();
|
if (overview) overview->ReloadGraphs();
|
||||||
if (report) report->ReloadGraphs();
|
|
||||||
//qDebug() << "overview->ReloadGraphs();";
|
//qDebug() << "overview->ReloadGraphs();";
|
||||||
}
|
}
|
||||||
qstatus->setText("");
|
qstatus->setText("");
|
||||||
@ -383,7 +376,7 @@ void MainWindow::on_action_Reset_Graph_Layout_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_action_Preferences_triggered()
|
void MainWindow::on_action_Preferences_triggered()
|
||||||
{
|
{
|
||||||
PreferencesDialog pd(this);
|
PreferencesDialog pd(this,profile);
|
||||||
if (pd.exec()==PreferencesDialog::Accepted) {
|
if (pd.exec()==PreferencesDialog::Accepted) {
|
||||||
qDebug() << "Preferences Accepted";
|
qDebug() << "Preferences Accepted";
|
||||||
pd.Save();
|
pd.Save();
|
||||||
@ -458,3 +451,17 @@ void MainWindow::on_actionView_O_ximetry_triggered()
|
|||||||
{
|
{
|
||||||
on_oximetryButton_clicked();
|
on_oximetryButton_clicked();
|
||||||
}
|
}
|
||||||
|
void MainWindow::updatestatusBarMessage (const QString & text)
|
||||||
|
{
|
||||||
|
ui->statusbar->showMessage(text,1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionPrint_Report_triggered()
|
||||||
|
{
|
||||||
|
if (ui->tabWidget->currentWidget()==overview) {
|
||||||
|
overview->on_printButton_clicked();
|
||||||
|
//} else if (ui->tabWidget->currentWidget()==daily) {
|
||||||
|
} else {
|
||||||
|
QMessageBox::information(this,"Not supported","Printing from this page is not supported yet",QMessageBox::Ok);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -28,6 +28,7 @@ extern QStatusBar *qstatusbar;
|
|||||||
|
|
||||||
class Daily;
|
class Daily;
|
||||||
class Report;
|
class Report;
|
||||||
|
class Overview;
|
||||||
class MainWindow : public QMainWindow
|
class MainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -92,13 +93,14 @@ private slots:
|
|||||||
void DelayedScreenshot();
|
void DelayedScreenshot();
|
||||||
|
|
||||||
void on_actionView_O_ximetry_triggered();
|
void on_actionView_O_ximetry_triggered();
|
||||||
|
void updatestatusBarMessage (const QString & text);
|
||||||
|
void on_actionPrint_Report_triggered();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
Daily * daily;
|
Daily * daily;
|
||||||
Overview * overview;
|
Overview * overview;
|
||||||
Oximetry * oximetry;
|
Oximetry * oximetry;
|
||||||
Report * report;
|
|
||||||
bool first_load;
|
bool first_load;
|
||||||
Profile *profile;
|
Profile *profile;
|
||||||
QNetworkAccessManager *netmanager;
|
QNetworkAccessManager *netmanager;
|
||||||
|
@ -582,6 +582,8 @@
|
|||||||
<addaction name="action_Import_Data"/>
|
<addaction name="action_Import_Data"/>
|
||||||
<addaction name="action_Preferences"/>
|
<addaction name="action_Preferences"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionPrint_Report"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
<addaction name="actionE_xit"/>
|
<addaction name="actionE_xit"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menu_View">
|
<widget class="QMenu" name="menu_View">
|
||||||
@ -771,6 +773,11 @@
|
|||||||
<string>F7</string>
|
<string>F7</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionPrint_Report">
|
||||||
|
<property name="text">
|
||||||
|
<string>Print &Report</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
302
overview.cpp
302
overview.cpp
@ -14,19 +14,15 @@
|
|||||||
#include "Graphs/gLineChart.h"
|
#include "Graphs/gLineChart.h"
|
||||||
#include "Graphs/gYAxis.h"
|
#include "Graphs/gYAxis.h"
|
||||||
|
|
||||||
Overview::Overview(QWidget *parent,gGraphView * shared) :
|
Overview::Overview(QWidget *parent,Profile * _profile,gGraphView * shared) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::Overview)
|
ui(new Ui::Overview),
|
||||||
|
profile(_profile),
|
||||||
|
m_shared(shared)
|
||||||
{
|
{
|
||||||
m_shared=shared;
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
Q_ASSERT(profile!=NULL);
|
||||||
|
|
||||||
QString prof=pref["Profile"].toString();
|
|
||||||
profile=Profiles::Get(prof);
|
|
||||||
if (!profile) {
|
|
||||||
qWarning("Couldn't get profile.. Have to abort!");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create dummy day & session for holding eventlists.
|
// Create dummy day & session for holding eventlists.
|
||||||
//day=new Day(mach);
|
//day=new Day(mach);
|
||||||
@ -117,265 +113,83 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
|
|||||||
NPB->AddLayer(gx,LayerBottom,0,gXAxis::Margin);
|
NPB->AddLayer(gx,LayerBottom,0,gXAxis::Margin);
|
||||||
NPB->AddLayer(new gXGrid());
|
NPB->AddLayer(new gXGrid());
|
||||||
|
|
||||||
//ReloadGraphs();
|
|
||||||
|
|
||||||
|
QLocale locale=QLocale::system();
|
||||||
|
QString shortformat=locale.dateFormat(QLocale::ShortFormat);
|
||||||
|
if (!shortformat.toLower().contains("yyyy")) {
|
||||||
|
shortformat.replace("yy","yyyy");
|
||||||
|
}
|
||||||
|
ui->dateStart->setDisplayFormat(shortformat);
|
||||||
|
ui->dateEnd->setDisplayFormat(shortformat);
|
||||||
|
|
||||||
|
report=NULL;
|
||||||
}
|
}
|
||||||
Overview::~Overview()
|
Overview::~Overview()
|
||||||
{
|
{
|
||||||
|
if (!report) {
|
||||||
|
report->close();
|
||||||
|
delete report;
|
||||||
|
}
|
||||||
//delete day;
|
//delete day;
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
void Overview::ReloadGraphs()
|
void Overview::ReloadGraphs()
|
||||||
{
|
{
|
||||||
/*bc->SetDay(NULL);
|
ui->dateStart->setDate(profile->FirstDay());
|
||||||
uc->SetDay(NULL);
|
ui->dateEnd->setDate(profile->LastDay());
|
||||||
pr->SetDay(NULL);
|
|
||||||
lk->SetDay(NULL); */
|
|
||||||
GraphView->setDay(NULL);
|
GraphView->setDay(NULL);
|
||||||
|
|
||||||
// GraphView->ResetBounds();
|
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
ui->setupUi(this);
|
|
||||||
profile=Profiles::Get(pref["Profile"].toString());
|
|
||||||
AddData(ahidata=new HistoryData(profile));
|
|
||||||
AddData(pressure=new HistoryCodeData(profile,CPAP_PressureAverage));
|
|
||||||
AddData(pressure_min=new HistoryCodeData(profile,CPAP_PressureMin));
|
|
||||||
AddData(pressure_max=new HistoryCodeData(profile,CPAP_PressureMax));
|
|
||||||
AddData(pressure_eap=new HistoryCodeData(profile,BIPAP_EAPAverage));
|
|
||||||
AddData(pressure_iap=new HistoryCodeData(profile,BIPAP_IAPAverage));
|
|
||||||
AddData(leak=new HistoryCodeData(profile,CPAP_LeakMedian));
|
|
||||||
AddData(usage=new UsageHistoryData(profile,UHD_Hours));
|
|
||||||
AddData(waketime=new UsageHistoryData(profile,UHD_Waketime));
|
|
||||||
AddData(bedtime=new UsageHistoryData(profile,UHD_Bedtime));
|
|
||||||
AddData(session_times=new SessionTimes(profile));
|
|
||||||
|
|
||||||
// pressure->ForceMinY(3);
|
void Overview::on_dateEnd_dateChanged(const QDate &date)
|
||||||
// pressure->ForceMaxY(12);
|
{
|
||||||
|
qint64 d1=qint64(QDateTime(ui->dateStart->date(),QTime(0,0,0),Qt::UTC).toTime_t())*1000L;
|
||||||
|
qint64 d2=qint64(QDateTime(date,QTime(23,59,59),Qt::UTC).toTime_t())*1000L;
|
||||||
|
GraphView->SetXBounds(d1,d2);
|
||||||
|
|
||||||
gSplitter=new QSplitter(Qt::Vertical,ui->SummaryGraphWindow);
|
}
|
||||||
gSplitter->setStyleSheet("QSplitter::handle { background-color: 'dark grey'; }");
|
|
||||||
gSplitter->setChildrenCollapsible(true);
|
|
||||||
gSplitter->setHandleWidth(3);
|
|
||||||
ui->graphLayout->addWidget(gSplitter);
|
|
||||||
|
|
||||||
AddGraph(AHI=new gGraphWindow(ui->SummaryGraphWindow,tr("AHI"),shared)); //(QGLContext *)NULL));
|
void Overview::on_dateStart_dateChanged(const QDate &date)
|
||||||
AHI->SetTopMargin(10);
|
{
|
||||||
AHI->SetBottomMargin(AHI->GetBottomMargin()+gXAxis::Margin+25);
|
qint64 d1=qint64(QDateTime(date,QTime(0,0,0),Qt::UTC).toTime_t())*1000L;
|
||||||
//AHI->AddLayer(new gFooBar(7));
|
qint64 d2=qint64(QDateTime(ui->dateEnd->date(),QTime(23,59,59),Qt::UTC).toTime_t())*1000L;
|
||||||
AHI->AddLayer(new gYAxis());
|
GraphView->SetXBounds(d1,d2);
|
||||||
AHI->AddLayer(new gBarChart(ahidata,QColor("red")));
|
|
||||||
AHI->setMinimumHeight(170);
|
|
||||||
|
|
||||||
AddGraph(PRESSURE=new gGraphWindow(ui->SummaryGraphWindow,tr("Pressure"),AHI));
|
}
|
||||||
//PRESSURE->SetMargins(10,15,65,80);
|
|
||||||
PRESSURE->AddLayer(new gYAxis());
|
|
||||||
PRESSURE->AddLayer(new gXAxis());
|
|
||||||
//PRESSURE->AddLayer(new gFooBar(7));
|
|
||||||
PRESSURE->AddLayer(prmax=new gLineChart(pressure_max,QColor("blue"),6192,false,true,true));
|
|
||||||
PRESSURE->AddLayer(prmin=new gLineChart(pressure_min,QColor("red"),6192,false,true,true));
|
|
||||||
PRESSURE->AddLayer(eap=new gLineChart(pressure_eap,QColor("blue"),6192,false,true,true));
|
|
||||||
PRESSURE->AddLayer(iap=new gLineChart(pressure_iap,QColor("red"),6192,false,true,true));
|
|
||||||
PRESSURE->AddLayer(pr=new gLineChart(pressure,QColor("dark green"),6192,false,true,true));
|
|
||||||
PRESSURE->SetBottomMargin(PRESSURE->GetBottomMargin()+25);
|
|
||||||
PRESSURE->setMinimumHeight(170);
|
|
||||||
|
|
||||||
AddGraph(LEAK=new gGraphWindow(ui->SummaryGraphWindow,tr("Leak"),AHI));
|
void Overview::on_toolButton_clicked()
|
||||||
LEAK->AddLayer(new gXAxis());
|
{
|
||||||
LEAK->AddLayer(new gYAxis());
|
qint64 d1=qint64(QDateTime(ui->dateStart->date(),QTime(0,0,0),Qt::UTC).toTime_t())*1000L;
|
||||||
//LEAK->AddLayer(new gFooBar(7));
|
qint64 d2=qint64(QDateTime(ui->dateEnd->date(),QTime(23,59,59),Qt::UTC).toTime_t())*1000L;
|
||||||
LEAK->AddLayer(new gLineChart(leak,QColor("purple"),6192,false,false,true));
|
GraphView->SetXBounds(d1,d2);
|
||||||
LEAK->SetBottomMargin(LEAK->GetBottomMargin()+25);
|
}
|
||||||
LEAK->setMinimumHeight(170);
|
|
||||||
|
|
||||||
AddGraph(USAGE=new gGraphWindow(ui->SummaryGraphWindow,tr("Usage (Hours)"),AHI));
|
void Overview::on_printButton_clicked()
|
||||||
//USAGE->AddLayer(new gFooBar(7));
|
{
|
||||||
USAGE->AddLayer(new gYAxis());
|
|
||||||
USAGE->AddLayer(new gBarChart(usage,QColor("green")));
|
|
||||||
USAGE->SetBottomMargin(USAGE->GetBottomMargin()+gXAxis::Margin+25);
|
|
||||||
//USAGE->AddLayer(new gXAxis());
|
|
||||||
//USAGE->AddLayer(new gLineChart(usage,QColor("green")));
|
|
||||||
USAGE->setMinimumHeight(170);
|
|
||||||
|
|
||||||
AddGraph(SESSTIMES=new gGraphWindow(ui->SummaryGraphWindow,tr("Session Times"),AHI));
|
if (!report) {
|
||||||
//SESSTIMES->SetMargins(10,15,65,80);
|
report=new Report(this,profile,m_shared,this);
|
||||||
//SESSTIMES->AddLayer(new gFooBar(7));
|
|
||||||
SESSTIMES->AddLayer(new gTimeYAxis());
|
|
||||||
SESSTIMES->AddLayer(new gSessionTime(session_times,QColor("green")));
|
|
||||||
SESSTIMES->SetBottomMargin(SESSTIMES->GetBottomMargin()+gXAxis::Margin+25);
|
|
||||||
//SESSTIMES->AddLayer(new gXAxis());
|
|
||||||
SESSTIMES->setMinimumHeight(270);
|
|
||||||
|
|
||||||
NoData=new QLabel(tr("No data"),gSplitter);
|
|
||||||
NoData->setAlignment(Qt::AlignCenter);
|
|
||||||
QFont font("FreeSans",20); //NoData->font();
|
|
||||||
//font.setBold(true);
|
|
||||||
NoData->setFont(font);
|
|
||||||
NoData->hide();
|
|
||||||
|
|
||||||
|
|
||||||
gGraphWindow * graphs[]={AHI,PRESSURE,LEAK,USAGE,SESSTIMES};
|
|
||||||
int ss=sizeof(graphs)/sizeof(gGraphWindow *);
|
|
||||||
|
|
||||||
for (int i=0;i<ss;i++) {
|
|
||||||
AddGraph(graphs[i]);
|
|
||||||
graphs[i]->AddLayer(new gFooBar(7));
|
|
||||||
for (int j=0;j<ss;j++) {
|
|
||||||
if (graphs[i]!=graphs[j])
|
|
||||||
graphs[i]->LinkZoom(graphs[j]);
|
|
||||||
}
|
|
||||||
gSplitter->addWidget(graphs[i]);
|
|
||||||
graphs[i]->SetSplitter(gSplitter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dummyday=new Day(NULL);
|
if (report) {
|
||||||
|
report->setMinimumSize(ui->graphArea->width(),ui->graphArea->height());
|
||||||
|
report->setMaximumSize(ui->graphArea->width(),ui->graphArea->height());
|
||||||
|
|
||||||
ReloadGraphs();
|
GraphView->hide();
|
||||||
}
|
report->show();
|
||||||
|
report->ReloadGraphs();
|
||||||
void Overview::RedrawGraphs()
|
report->GenerateReport(ui->dateStart->date(),ui->dateEnd->date());
|
||||||
{
|
report->on_printButton_clicked();
|
||||||
for (QList<gGraphWindow *>::iterator g=Graphs.begin();g!=Graphs.end();g++) {
|
report->hide();
|
||||||
(*g)->updateGL();
|
GraphView->show();
|
||||||
}
|
//report->connect(report->webview(),SIGNAL(loadFinished(bool)),this,SLOT(readyToPrint(bool)));
|
||||||
//SESSTIMES->updateGL();
|
|
||||||
}
|
|
||||||
void Overview::ReloadGraphs()
|
|
||||||
{
|
|
||||||
for (QList<HistoryData *>::iterator h=Data.begin();h!=Data.end();h++) {
|
|
||||||
if (HistoryData *hd=dynamic_cast<HistoryData *>(*h)){
|
|
||||||
hd->SetProfile(profile);
|
|
||||||
hd->ResetDateRange();
|
|
||||||
hd->Reload(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
// session_times->SetProfile(profile);
|
|
||||||
// session_times->ResetDateRange();
|
|
||||||
// session_times->Reload(NULL);
|
|
||||||
on_rbLastWeek_clicked();
|
|
||||||
}
|
|
||||||
void Overview::UpdateHTML()
|
|
||||||
{
|
|
||||||
QString html="<html><body><div align=center>";
|
|
||||||
html+="<table width='100%' cellpadding=2 cellspacing=0 border=0>";
|
|
||||||
html+="<tr align=center><td colspan=4><b><i>Statistics</i></b></td></tr>";
|
|
||||||
html+="<tr><td><b>Details</b></td><td><b>Min</b></td><td><b>Avg</b></td><td><b>Max</b></td></tr>";
|
|
||||||
html+=QString("<tr><td>AHI</td><td>%1</td><td>%2</td><td>%3</td></tr>\n")
|
|
||||||
.arg(ahidata->CalcMinY(),2,'f',2,'0')
|
|
||||||
.arg(ahidata->CalcAverage(),2,'f',2,'0')
|
|
||||||
.arg(ahidata->CalcMaxY(),2,'f',2,'0');
|
|
||||||
html+=QString("<tr><td>Leak</td><td>%1</td><td>%2</td><td>%3</td></tr>")
|
|
||||||
.arg(leak->CalcMinY(),2,'f',2,'0')
|
|
||||||
.arg(leak->CalcAverage(),2,'f',2,'0')
|
|
||||||
.arg(leak->CalcMaxY(),2,'f',2,'0');
|
|
||||||
html+=QString("<tr><td>Pressure</td><td>%1</td><td>%2</td><td>%3</td></tr>")
|
|
||||||
.arg(pressure->CalcMinY(),2,'f',2,'0')
|
|
||||||
.arg(pressure->CalcAverage(),2,'f',2,'0')
|
|
||||||
.arg(pressure->CalcMaxY(),2,'f',2,'0');
|
|
||||||
html+=QString("<tr><td>Usage</td><td>%1</td><td>%2</td><td>%3</td></tr>")
|
|
||||||
.arg(usage->CalcMinY(),2,'f',2,'0')
|
|
||||||
.arg(usage->CalcAverage(),2,'f',2,'0')
|
|
||||||
.arg(usage->CalcMaxY(),2,'f',2,'0');
|
|
||||||
|
|
||||||
html+="</table>"
|
|
||||||
"</div></body></html>";
|
|
||||||
ui->webView->setHtml(html);
|
|
||||||
}
|
|
||||||
void Overview::UpdateGraphs()
|
|
||||||
{
|
|
||||||
QDate first=ui->drStart->date();
|
|
||||||
QDate last=ui->drEnd->date();
|
|
||||||
for (QList<HistoryData *>::iterator h=Data.begin();h!=Data.end();h++) {
|
|
||||||
//(*h)->Update(dummyday);
|
|
||||||
(*h)->SetDateRange(first,last);
|
|
||||||
}
|
|
||||||
session_times->SetDateRange(first,last);
|
|
||||||
RedrawGraphs();
|
|
||||||
UpdateHTML();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpdateCal(QCalendarWidget *cal)
|
|
||||||
{
|
|
||||||
QDate d1=cal->minimumDate();
|
|
||||||
d1.setYMD(d1.year(),d1.month(),1);
|
|
||||||
QTextCharFormat fmt=cal->weekdayTextFormat(Qt::Monday);
|
|
||||||
fmt.setForeground(QBrush(Qt::gray));
|
|
||||||
for (QDate d=d1;d < cal->minimumDate();d=d.addDays(1)) {
|
|
||||||
cal->setDateTextFormat(d,fmt);
|
|
||||||
}
|
|
||||||
d1=cal->maximumDate();
|
|
||||||
d1.setYMD(d1.year(),d1.month(),d1.daysInMonth());
|
|
||||||
for (QDate d=cal->maximumDate().addDays(1);d <= d1;d=d.addDays(1)) {
|
|
||||||
cal->setDateTextFormat(d,fmt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//report->hide();
|
||||||
|
//ui->tabWidget->insertTab(4,report,tr("Overview Report"));
|
||||||
|
|
||||||
}
|
}
|
||||||
void Overview::on_drStart_dateChanged(const QDate &date)
|
|
||||||
|
void Overview::readyToPrint(bool)
|
||||||
{
|
{
|
||||||
ui->drEnd->setMinimumDate(date);
|
|
||||||
QCalendarWidget *cal=ui->drEnd->calendarWidget();
|
|
||||||
cal->setDateRange(date,profile->LastDay());
|
|
||||||
UpdateCal(cal);
|
|
||||||
UpdateGraphs();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Overview::on_drEnd_dateChanged(const QDate &date)
|
|
||||||
{
|
|
||||||
ui->drStart->setMaximumDate(date);
|
|
||||||
QCalendarWidget *cal=ui->drStart->calendarWidget();
|
|
||||||
cal->setDateRange(profile->FirstDay(),date);
|
|
||||||
UpdateCal(cal);
|
|
||||||
UpdateGraphs();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Overview::on_rbDateRange_toggled(bool checked)
|
|
||||||
{
|
|
||||||
ui->drStart->setEnabled(checked);
|
|
||||||
ui->drEnd->setEnabled(checked);
|
|
||||||
ui->drStartLabel->setEnabled(checked);
|
|
||||||
ui->drEndLabel->setEnabled(checked);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Overview::on_rbLastWeek_clicked()
|
|
||||||
{
|
|
||||||
ui->drStart->setDateRange(profile->FirstDay(),profile->LastDay());
|
|
||||||
ui->drEnd->setDateRange(profile->FirstDay(),profile->LastDay());
|
|
||||||
|
|
||||||
QDate d=profile->LastDay();
|
|
||||||
ui->drEnd->setDate(d);
|
|
||||||
d=d.addDays(-7);
|
|
||||||
if (d<profile->FirstDay()) d=profile->FirstDay();
|
|
||||||
ui->drStart->setDate(d);
|
|
||||||
UpdateGraphs();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Overview::on_rbLastMonth_clicked()
|
|
||||||
{
|
|
||||||
ui->drStart->setDateRange(profile->FirstDay(),profile->LastDay());
|
|
||||||
ui->drEnd->setDateRange(profile->FirstDay(),profile->LastDay());
|
|
||||||
|
|
||||||
QDate d=profile->LastDay();
|
|
||||||
ui->drEnd->setDate(d);
|
|
||||||
d=d.addDays(-30);
|
|
||||||
if (d<profile->FirstDay()) d=profile->FirstDay();
|
|
||||||
ui->drStart->setDate(d);
|
|
||||||
UpdateGraphs();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Overview::on_rbEverything_clicked()
|
|
||||||
{
|
|
||||||
ui->drStart->setDateRange(profile->FirstDay(),profile->LastDay());
|
|
||||||
ui->drEnd->setDateRange(profile->FirstDay(),profile->LastDay());
|
|
||||||
|
|
||||||
ui->drEnd->setDate(profile->LastDay());
|
|
||||||
ui->drStart->setDate(profile->FirstDay());
|
|
||||||
UpdateGraphs();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Overview::on_rbDateRange_clicked()
|
|
||||||
{
|
|
||||||
UpdateGraphs();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
15
overview.h
15
overview.h
@ -10,21 +10,22 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QGLContext>
|
#include <QGLContext>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
|
||||||
#include "SleepLib/profiles.h"
|
#include "SleepLib/profiles.h"
|
||||||
#include "Graphs/gGraphView.h"
|
#include "Graphs/gGraphView.h"
|
||||||
#include "Graphs/gBarChart.h"
|
#include "Graphs/gBarChart.h"
|
||||||
|
#include "report.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class Overview;
|
class Overview;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Report;
|
||||||
class Overview : public QWidget
|
class Overview : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Overview(QWidget *parent,gGraphView *shared=NULL);
|
explicit Overview(QWidget *parent,Profile *profile, gGraphView *shared=NULL);
|
||||||
~Overview();
|
~Overview();
|
||||||
|
|
||||||
void ReloadGraphs();
|
void ReloadGraphs();
|
||||||
@ -32,6 +33,8 @@ public:
|
|||||||
|
|
||||||
gGraph *AHI,*UC,*PR,*LK,*NPB;
|
gGraph *AHI,*UC,*PR,*LK,*NPB;
|
||||||
SummaryChart *bc,*uc,*pr,*lk,*npb;
|
SummaryChart *bc,*uc,*pr,*lk,*npb;
|
||||||
|
public slots:
|
||||||
|
void on_printButton_clicked();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
/* void on_drStart_dateChanged(const QDate &date);
|
/* void on_drStart_dateChanged(const QDate &date);
|
||||||
@ -42,6 +45,13 @@ private slots:
|
|||||||
void on_rbEverything_clicked();
|
void on_rbEverything_clicked();
|
||||||
void on_rbDateRange_clicked(); */
|
void on_rbDateRange_clicked(); */
|
||||||
|
|
||||||
|
void on_dateEnd_dateChanged(const QDate &date);
|
||||||
|
|
||||||
|
void on_dateStart_dateChanged(const QDate &date);
|
||||||
|
|
||||||
|
void on_toolButton_clicked();
|
||||||
|
|
||||||
|
void readyToPrint(bool);
|
||||||
private:
|
private:
|
||||||
Ui::Overview *ui;
|
Ui::Overview *ui;
|
||||||
Profile *profile;
|
Profile *profile;
|
||||||
@ -49,6 +59,7 @@ private:
|
|||||||
MyScrollBar *scrollbar;
|
MyScrollBar *scrollbar;
|
||||||
QHBoxLayout *layout;
|
QHBoxLayout *layout;
|
||||||
gGraphView * m_shared;
|
gGraphView * m_shared;
|
||||||
|
Report * report;
|
||||||
|
|
||||||
void UpdateHTML();
|
void UpdateHTML();
|
||||||
|
|
||||||
|
107
overview.ui
107
overview.ui
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>668</width>
|
<width>668</width>
|
||||||
<height>355</height>
|
<height>393</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
@ -28,8 +28,111 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="graphArea" native="true"/>
|
<widget class="QWidget" name="graphArea" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="frame">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>45</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Start:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDateEdit" name="dateStart">
|
||||||
|
<property name="calendarPopup">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="timeSpec">
|
||||||
|
<enum>Qt::UTC</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>End:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDateEdit" name="dateEnd">
|
||||||
|
<property name="calendarPopup">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="timeSpec">
|
||||||
|
<enum>Qt::UTC</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButton">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Reset view to selected date range</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="Resources.qrc">
|
||||||
|
<normaloff>:/icons/refresh.png</normaloff>:/icons/refresh.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>260</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="printButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Print</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources>
|
||||||
|
<include location="Resources.qrc"/>
|
||||||
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
14
oximetry.cpp
14
oximetry.cpp
@ -13,20 +13,18 @@
|
|||||||
#include "Graphs/gLineChart.h"
|
#include "Graphs/gLineChart.h"
|
||||||
#include "Graphs/gYAxis.h"
|
#include "Graphs/gYAxis.h"
|
||||||
|
|
||||||
Oximetry::Oximetry(QWidget *parent,gGraphView * shared) :
|
Oximetry::Oximetry(QWidget *parent,Profile * _profile,gGraphView * shared) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::Oximetry)
|
ui(new Ui::Oximetry),
|
||||||
|
profile(_profile)
|
||||||
{
|
{
|
||||||
m_shared=shared;
|
m_shared=shared;
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
Q_ASSERT(profile!=NULL);
|
||||||
|
|
||||||
port=NULL;
|
port=NULL;
|
||||||
portname="";
|
portname="";
|
||||||
QString prof=pref["Profile"].toString();
|
|
||||||
profile=Profiles::Get(prof);
|
|
||||||
if (!profile) {
|
|
||||||
qWarning("Couldn't get profile.. Have to abort!");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
mach=profile->GetMachine(MT_OXIMETER);
|
mach=profile->GetMachine(MT_OXIMETER);
|
||||||
if (!mach) {
|
if (!mach) {
|
||||||
CMS50Loader *l=dynamic_cast<CMS50Loader *>(GetLoader("CMS50"));
|
CMS50Loader *l=dynamic_cast<CMS50Loader *>(GetLoader("CMS50"));
|
||||||
|
@ -32,7 +32,7 @@ class Oximetry : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Oximetry(QWidget *parent,gGraphView * shared=NULL);
|
explicit Oximetry(QWidget *parent, Profile * _profile,gGraphView * shared=NULL);
|
||||||
~Oximetry();
|
~Oximetry();
|
||||||
|
|
||||||
void RedrawGraphs();
|
void RedrawGraphs();
|
||||||
|
@ -4,15 +4,13 @@
|
|||||||
#include "ui_preferencesdialog.h"
|
#include "ui_preferencesdialog.h"
|
||||||
#include "SleepLib/machine_common.h"
|
#include "SleepLib/machine_common.h"
|
||||||
|
|
||||||
PreferencesDialog::PreferencesDialog(QWidget *parent) :
|
PreferencesDialog::PreferencesDialog(QWidget *parent,Profile * _profile) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::PreferencesDialog)
|
ui(new Ui::PreferencesDialog),
|
||||||
|
profile(_profile)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
Q_ASSERT(profile!=NULL);
|
||||||
QString prof=pref["Profile"].toString();
|
|
||||||
profile=Profiles::Get(prof);
|
|
||||||
|
|
||||||
ui->firstNameEdit->setText((*profile)["FirstName"].toString());
|
ui->firstNameEdit->setText((*profile)["FirstName"].toString());
|
||||||
ui->lastNameEdit->setText((*profile)["LastName"].toString());
|
ui->lastNameEdit->setText((*profile)["LastName"].toString());
|
||||||
ui->addressEdit->clear();
|
ui->addressEdit->clear();
|
||||||
|
@ -20,11 +20,9 @@ class PreferencesDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PreferencesDialog(QWidget *parent = 0);
|
explicit PreferencesDialog(QWidget *parent, Profile * _profile);
|
||||||
~PreferencesDialog();
|
~PreferencesDialog();
|
||||||
void Save();
|
void Save();
|
||||||
protected:
|
|
||||||
Profile * profile;
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_eventTable_doubleClicked(const QModelIndex &index);
|
void on_eventTable_doubleClicked(const QModelIndex &index);
|
||||||
void on_combineSlider_sliderMoved(int position);
|
void on_combineSlider_sliderMoved(int position);
|
||||||
@ -33,6 +31,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::PreferencesDialog *ui;
|
Ui::PreferencesDialog *ui;
|
||||||
|
Profile * profile;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PREFERENCESDIALOG_H
|
#endif // PREFERENCESDIALOG_H
|
||||||
|
51
report.cpp
51
report.cpp
@ -8,19 +8,16 @@
|
|||||||
#include <QPrinter>
|
#include <QPrinter>
|
||||||
#include <QPrintDialog>
|
#include <QPrintDialog>
|
||||||
|
|
||||||
Report::Report(QWidget *parent, gGraphView * shared, Daily * daily, Overview * overview) :
|
Report::Report(QWidget *parent, Profile * _profile, gGraphView * shared, Overview * overview) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::Report),
|
ui(new Ui::Report),
|
||||||
m_daily(daily),
|
profile(_profile),
|
||||||
m_overview(overview)
|
m_overview(overview)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
QString prof=pref["Profile"].toString();
|
|
||||||
profile=Profiles::Get(prof);
|
Q_ASSERT(profile!=NULL);
|
||||||
if (!profile) {
|
|
||||||
QMessageBox::critical(this,"Profile Error",QString("Couldn't get profile '%1'.. Have to abort!").arg(pref["Profile"].toString()));
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
GraphView=new gGraphView(this,shared);
|
GraphView=new gGraphView(this,shared);
|
||||||
GraphView->hide();
|
GraphView->hide();
|
||||||
|
|
||||||
@ -72,20 +69,17 @@ Report::~Report()
|
|||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
void Report::showEvent (QShowEvent * event)
|
|
||||||
{
|
|
||||||
QTimer::singleShot(0,this,SLOT(on_refreshButton_clicked()));
|
|
||||||
}
|
|
||||||
void Report::ReloadGraphs()
|
void Report::ReloadGraphs()
|
||||||
{
|
{
|
||||||
for (int i=0;i<graphs.size();i++) {
|
for (int i=0;i<graphs.size();i++) {
|
||||||
graphs[i]->setDay(NULL);
|
graphs[i]->setDay(NULL);
|
||||||
}
|
}
|
||||||
ui->startDate->setDate(profile->FirstDay());
|
startDate=profile->FirstDay();
|
||||||
ui->endDate->setDate(profile->LastDay());
|
endDate=profile->LastDay();
|
||||||
for (int i=0;i<graphs.size();i++) {
|
for (int i=0;i<graphs.size();i++) {
|
||||||
graphs[i]->ResetBounds();
|
graphs[i]->ResetBounds();
|
||||||
}
|
}
|
||||||
|
m_ready=true;
|
||||||
|
|
||||||
}
|
}
|
||||||
void Report::resizeEvent(QResizeEvent *event)
|
void Report::resizeEvent(QResizeEvent *event)
|
||||||
@ -93,14 +87,14 @@ void Report::resizeEvent(QResizeEvent *event)
|
|||||||
QWidget::resizeEvent(event);
|
QWidget::resizeEvent(event);
|
||||||
GraphView->setMinimumSize(event->size().width()-20,240);
|
GraphView->setMinimumSize(event->size().width()-20,240);
|
||||||
GraphView->setMaximumSize(event->size().width()-20,240);
|
GraphView->setMaximumSize(event->size().width()-20,240);
|
||||||
Reload();
|
//GenerateReport(startDate,endDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap Report::Snapshot(gGraph * graph)
|
QPixmap Report::Snapshot(gGraph * graph)
|
||||||
{
|
{
|
||||||
QDateTime d1(ui->startDate->date(),QTime(0,0,0),Qt::UTC);
|
QDateTime d1(startDate,QTime(0,0,0),Qt::UTC);
|
||||||
qint64 first=qint64(d1.toTime_t())*1000L;
|
qint64 first=qint64(d1.toTime_t())*1000L;
|
||||||
QDateTime d2(ui->endDate->date(),QTime(0,0,0),Qt::UTC);
|
QDateTime d2(endDate,QTime(23,59,59),Qt::UTC);
|
||||||
qint64 last=qint64(d2.toTime_t())*1000L;
|
qint64 last=qint64(d2.toTime_t())*1000L;
|
||||||
|
|
||||||
GraphView->TrashGraphs();
|
GraphView->TrashGraphs();
|
||||||
@ -111,13 +105,14 @@ QPixmap Report::Snapshot(gGraph * graph)
|
|||||||
int w=this->width()-20;
|
int w=this->width()-20;
|
||||||
QPixmap pixmap=GraphView->renderPixmap(w,240,false); //gwwidth,gwheight,false);
|
QPixmap pixmap=GraphView->renderPixmap(w,240,false); //gwwidth,gwheight,false);
|
||||||
|
|
||||||
|
|
||||||
return pixmap;
|
return pixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Report::Reload()
|
void Report::GenerateReport(QDate start, QDate end)
|
||||||
{
|
{
|
||||||
if (!m_ready) return;
|
if (!m_ready) return;
|
||||||
|
startDate=start;
|
||||||
|
endDate=end;
|
||||||
|
|
||||||
//UC->ResetBounds();
|
//UC->ResetBounds();
|
||||||
QString html="<html><head><style type='text/css'>p,a,td,body { font-family: 'FreeSans', 'Sans Serif'; } p,a,td,body { font-size: 12px; } </style>"
|
QString html="<html><head><style type='text/css'>p,a,td,body { font-family: 'FreeSans', 'Sans Serif'; } p,a,td,body { font-size: 12px; } </style>"
|
||||||
@ -167,7 +162,7 @@ void Report::Reload()
|
|||||||
|
|
||||||
html+="</table></td></tr></table>";
|
html+="</table></td></tr></table>";
|
||||||
html+="<td ><div align=center><img src='qrc:/docs/sheep.png' width=100 height=100'><br/>SleepyHead v"+pref["VersionString"].toString()+"</div></td></tr></table> <br/>"
|
html+="<td ><div align=center><img src='qrc:/docs/sheep.png' width=100 height=100'><br/>SleepyHead v"+pref["VersionString"].toString()+"</div></td></tr></table> <br/>"
|
||||||
"Reporting from <b>"+ui->startDate->date().toString()+"</b> to <b>"+ui->endDate->date().toString()+"</b><br/>"
|
"Reporting from <b>"+startDate.toString()+"</b> to <b>"+endDate.toString()+"</b><br/>"
|
||||||
"<hr>";
|
"<hr>";
|
||||||
|
|
||||||
|
|
||||||
@ -186,22 +181,6 @@ void Report::Reload()
|
|||||||
ui->webView->setHtml(html);
|
ui->webView->setHtml(html);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Report::on_refreshButton_clicked()
|
|
||||||
{
|
|
||||||
m_ready=true;
|
|
||||||
Reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Report::on_startDate_dateChanged(const QDate &date)
|
|
||||||
{
|
|
||||||
Reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Report::on_endDate_dateChanged(const QDate &date)
|
|
||||||
{
|
|
||||||
Reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Report::on_printButton_clicked()
|
void Report::on_printButton_clicked()
|
||||||
{
|
{
|
||||||
QPrinter printer;
|
QPrinter printer;
|
||||||
|
23
report.h
23
report.h
@ -2,9 +2,9 @@
|
|||||||
#define REPORT_H
|
#define REPORT_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QWebView>
|
||||||
#include "SleepLib/profiles.h"
|
#include "SleepLib/profiles.h"
|
||||||
#include "Graphs/gGraphView.h"
|
#include "Graphs/gGraphView.h"
|
||||||
#include "daily.h"
|
|
||||||
#include "overview.h"
|
#include "overview.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
@ -12,32 +12,26 @@ namespace Ui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Daily;
|
class Daily;
|
||||||
|
class Overview;
|
||||||
class Report : public QWidget
|
class Report : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Report(QWidget *parent, gGraphView * shared, Daily * daily, Overview * overview);
|
explicit Report(QWidget *parent, Profile * _profile, gGraphView * shared, Overview * overview);
|
||||||
~Report();
|
~Report();
|
||||||
void Reload();
|
void GenerateReport(QDate start, QDate end);
|
||||||
void ReloadGraphs();
|
void ReloadGraphs();
|
||||||
QPixmap Snapshot(gGraph * graph);
|
QPixmap Snapshot(gGraph * graph);
|
||||||
|
public slots:
|
||||||
|
void on_printButton_clicked();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent (QShowEvent * event);
|
// virtual void showEvent (QShowEvent * event);
|
||||||
private slots:
|
|
||||||
void on_refreshButton_clicked();
|
|
||||||
|
|
||||||
void on_startDate_dateChanged(const QDate &date);
|
|
||||||
|
|
||||||
void on_endDate_dateChanged(const QDate &date);
|
|
||||||
|
|
||||||
void on_printButton_clicked();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::Report *ui;
|
Ui::Report *ui;
|
||||||
Profile * profile;
|
Profile * profile;
|
||||||
Daily * m_daily;
|
|
||||||
Overview * m_overview;
|
Overview * m_overview;
|
||||||
gGraphView * shared;
|
gGraphView * shared;
|
||||||
gGraphView * GraphView;
|
gGraphView * GraphView;
|
||||||
@ -45,6 +39,9 @@ private:
|
|||||||
SummaryChart *bc,*uc,*pr,*lk,*npb;
|
SummaryChart *bc,*uc,*pr,*lk,*npb;
|
||||||
QVector<gGraph *> graphs;
|
QVector<gGraph *> graphs;
|
||||||
|
|
||||||
|
QDate startDate;
|
||||||
|
QDate endDate;
|
||||||
|
|
||||||
bool m_ready;
|
bool m_ready;
|
||||||
virtual void resizeEvent(QResizeEvent *);
|
virtual void resizeEvent(QResizeEvent *);
|
||||||
};
|
};
|
||||||
|
72
report.ui
72
report.ui
@ -29,78 +29,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Start</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QDateEdit" name="startDate">
|
|
||||||
<property name="displayFormat">
|
|
||||||
<string>d/MM/yyyy</string>
|
|
||||||
</property>
|
|
||||||
<property name="calendarPopup">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>End</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QDateEdit" name="endDate">
|
|
||||||
<property name="displayFormat">
|
|
||||||
<string>d/MM/yyyy</string>
|
|
||||||
</property>
|
|
||||||
<property name="calendarPopup">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="refreshButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Refresh</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Temporary Page</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="printButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Print</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
Loading…
Reference in New Issue
Block a user