diff --git a/SleepLib/day.cpp b/SleepLib/day.cpp index 3f1ca97f..d045f091 100644 --- a/SleepLib/day.cpp +++ b/SleepLib/day.cpp @@ -204,9 +204,9 @@ EventDataType Day::wavg(ChannelID code) qint64 Day::total_time() { qint64 d_totaltime=0; - for (QVector::iterator s=sessions.begin();s!=sessions.end();s++) { + for (QVector::iterator s=begin();s!=end();s++) { Session & sess=*(*s); - d_totaltime+=sess.last()-sess.first(); + d_totaltime+=sess.length(); } return d_totaltime; } diff --git a/daily.cpp b/daily.cpp index f4a32118..b07ae38d 100644 --- a/daily.cpp +++ b/daily.cpp @@ -806,11 +806,11 @@ void Daily::Load(QDate date) } html+="Date"+tr("Sleep")+""+tr("Wake")+""+tr("Hours")+""; - 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("%1%2%3%4\n" @@ -946,8 +946,8 @@ void Daily::Load(QDate date) QDateTime fd,ld; bool corrupted_waveform=false; for (QVector::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::iterator i=(*s)->settings.find(CPAP_BrokenWaveform); if ((i!=(*s)->settings.end()) && i.value().toBool()) corrupted_waveform=true; tmp.sprintf(("%08i"+fd.date().toString(Qt::SystemLocaleShortDate)+""+fd.toString("HH:mm ")+""+ld.toString("HH:mm")+"").toLatin1(),(*s)->session()); diff --git a/overview.cpp b/overview.cpp index 21cd7db0..d1c89111 100644 --- a/overview.cpp +++ b/overview.cpp @@ -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))); } diff --git a/report.cpp b/report.cpp index 24b1b74e..5fe69385 100644 --- a/report.cpp +++ b/report.cpp @@ -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); }