Hide Overview print report..

This commit is contained in:
Mark Watkins 2011-09-12 12:24:58 +10:00
parent 94c0dc3702
commit a15ad7befa
4 changed files with 27 additions and 18 deletions

View File

@ -204,9 +204,9 @@ EventDataType Day::wavg(ChannelID code)
qint64 Day::total_time()
{
qint64 d_totaltime=0;
for (QVector<Session *>::iterator s=sessions.begin();s!=sessions.end();s++) {
for (QVector<Session *>::iterator s=begin();s!=end();s++) {
Session & sess=*(*s);
d_totaltime+=sess.last()-sess.first();
d_totaltime+=sess.length();
}
return d_totaltime;
}

View File

@ -806,11 +806,11 @@ void Daily::Load(QDate date)
}
html+="<tr><td align='center'><b>Date</b></td><td align='center'><b>"+tr("Sleep")+"</b></td><td align='center'><b>"+tr("Wake")+"</b></td><td align='center'><b>"+tr("Hours")+"</b></td></tr>";
int tt=cpap->total_time()/1000.0;
QDateTime date=QDateTime::fromTime_t(cpap->first()/1000);
QDateTime date2=QDateTime::fromTime_t(cpap->last()/1000);
int tt=qint64(cpap->total_time())/1000L;
QDateTime date=QDateTime::fromTime_t(cpap->first()/1000L);
QDateTime date2=QDateTime::fromTime_t(cpap->last()/1000L);
int h=tt/3600.0;
int h=tt/3600;
int m=(tt/60)%60;
int s=tt % 60;
html+=QString("<tr><td align='center'>%1</td><td align='center'>%2</td><td align='center'>%3</td><td align='center'>%4</td></tr>\n"
@ -946,8 +946,8 @@ void Daily::Load(QDate date)
QDateTime fd,ld;
bool corrupted_waveform=false;
for (QVector<Session *>::iterator s=cpap->begin();s!=cpap->end();s++) {
fd=QDateTime::fromTime_t((*s)->first()/1000);
ld=QDateTime::fromTime_t((*s)->last()/1000);
fd=QDateTime::fromTime_t((*s)->first()/1000L);
ld=QDateTime::fromTime_t((*s)->last()/1000L);
QHash<ChannelID,QVariant>::iterator i=(*s)->settings.find(CPAP_BrokenWaveform);
if ((i!=(*s)->settings.end()) && i.value().toBool()) corrupted_waveform=true;
tmp.sprintf(("<tr><td align=center>%08i</td><td align=center>"+fd.date().toString(Qt::SystemLocaleShortDate)+"</td><td align=center>"+fd.toString("HH:mm ")+"</td><td align=center>"+ld.toString("HH:mm")+"</td></tr>").toLatin1(),(*s)->session());

View File

@ -14,7 +14,7 @@
#include "Graphs/gLineChart.h"
#include "Graphs/gYAxis.h"
const int default_height=220;
const int default_height=180;
Overview::Overview(QWidget *parent,Profile * _profile,gGraphView * shared) :
QWidget(parent),
@ -170,24 +170,26 @@ void Overview::on_printButton_clicked()
if (!report) {
report=new Report(this,profile,m_shared,this);
//report->setMinimumSize(ui->graphArea->width(),ui->graphArea->height());
//report->setMaximumSize(ui->graphArea->width(),ui->graphArea->height());
//report->setMinimumSize(1280,800);
//report->setMaximumSize(1280,800);
report->hide();
}
if (report) {
report->setMinimumSize(ui->graphArea->width(),ui->graphArea->height());
report->setMaximumSize(ui->graphArea->width(),ui->graphArea->height());
bc->deselect();
uc->deselect();
pr->deselect();
lk->deselect();
npb->deselect();
GraphView->hide();
report->show();
//GraphView->hide();
//report->show();
report->ReloadGraphs();
report->GenerateReport(ui->dateStart->date(),ui->dateEnd->date());
report->on_printButton_clicked();
report->hide();
GraphView->show();
//GraphView->show();
//report->connect(report->webview(),SIGNAL(loadFinished(bool)),this,SLOT(readyToPrint(bool)));
}

View File

@ -19,8 +19,15 @@ Report::Report(QWidget *parent, Profile * _profile, gGraphView * shared, Overvie
Q_ASSERT(profile!=NULL);
GraphView=new gGraphView(this,shared);
setMaximumSize(1280,800);
setMinimumSize(1280,800);
GraphView->setMaximumSize(1280,graph_height);
GraphView->setMinimumSize(1280,graph_height);
GraphView->hide();
// Reusing the layer data from overview screen,
// (Can't reuse the graphs objects without breaking things)
@ -81,9 +88,9 @@ void Report::ReloadGraphs()
}
void Report::resizeEvent(QResizeEvent *event)
{
QWidget::resizeEvent(event);
GraphView->setMinimumSize(1280,graph_height);
GraphView->setMaximumSize(1280,graph_height);
// QWidget::resizeEvent(event);
//GraphView->setMinimumSize(1280,graph_height);
//GraphView->setMaximumSize(1280,graph_height);
//GenerateReport(startDate,endDate);
}