Fix for Daily export trashing open records, plus added progress bar to export process

This commit is contained in:
Mark Watkins 2011-11-15 17:53:22 +10:00
parent d6615d21e3
commit dc157c2657
3 changed files with 21 additions and 2 deletions

View File

@ -42,6 +42,7 @@ public:
gGraphView *SharedWidget() { return GraphView; }
void RedrawGraphs();
void LoadDate(QDate date);
QDate getDate() { return previous_date; }
private slots:
void on_calendar_currentPageChanged(int year, int month);

View File

@ -7,6 +7,9 @@
#include "SleepLib/day.h"
#include "exportcsv.h"
#include "ui_exportcsv.h"
#include "mainwindow.h"
extern MainWindow *mainwin;
ExportCSV::ExportCSV(QWidget *parent) :
QDialog(parent),
@ -160,7 +163,14 @@ void ExportCSV::on_exportButton_clicked()
header+=newline;
file.write(header.toAscii());
QDate date=ui->startDate->date();
Daily *daily=mainwin->getDaily();
QDate daily_date=daily->getDate();
ui->progressBar->setValue(0);
ui->progressBar->setMaximum(PROFILE.daylist.count());
do {
ui->progressBar->setValue(ui->progressBar->value()+1);
Day *day=PROFILE.GetDay(date,MT_CPAP);
if (day) {
QString data;
@ -241,6 +251,7 @@ void ExportCSV::on_exportButton_clicked()
}
}
}
if (daily_date!=date)
sess->TrashEvents();
}
}

View File

@ -82,7 +82,7 @@
</property>
</widget>
</item>
<item row="11" column="0" colspan="2">
<item row="12" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
@ -260,6 +260,13 @@
</property>
</spacer>
</item>
<item row="11" column="0" colspan="2">
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>24</number>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>