mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-13 17:20:51 +00:00
Added Printer Dialog, variable cleanup
This commit is contained in:
parent
44d572fd7b
commit
6e64731b1f
@ -945,7 +945,6 @@ void Daily::Unload(QDate date)
|
|||||||
journal->settings["ZombieMeter"]=ui->ZombieMeter->value();
|
journal->settings["ZombieMeter"]=ui->ZombieMeter->value();
|
||||||
journal->SetChanged(true);
|
journal->SetChanged(true);
|
||||||
}
|
}
|
||||||
bool ok;
|
|
||||||
if (BookmarksChanged) {
|
if (BookmarksChanged) {
|
||||||
QVariantList start;
|
QVariantList start;
|
||||||
QVariantList end;
|
QVariantList end;
|
||||||
@ -1155,6 +1154,7 @@ void Daily::RedrawGraphs()
|
|||||||
|
|
||||||
void Daily::on_treeWidget_itemClicked(QTreeWidgetItem *item, int column)
|
void Daily::on_treeWidget_itemClicked(QTreeWidgetItem *item, int column)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(column);
|
||||||
QDateTime d;
|
QDateTime d;
|
||||||
if (!item->text(1).isEmpty()) {
|
if (!item->text(1).isEmpty()) {
|
||||||
d=d.fromString(item->text(1),"yyyy-MM-dd HH:mm:ss");
|
d=d.fromString(item->text(1),"yyyy-MM-dd HH:mm:ss");
|
||||||
@ -1315,10 +1315,6 @@ void Daily::on_bookmarkTable_itemClicked(QTableWidgetItem *item)
|
|||||||
GraphView->updateGL();
|
GraphView->updateGL();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Daily::on_bookmarkTable_itemActivated(QTableWidgetItem *item)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Daily::on_addBookmarkButton_clicked()
|
void Daily::on_addBookmarkButton_clicked()
|
||||||
{
|
{
|
||||||
qint64 st,et;
|
qint64 st,et;
|
||||||
@ -1350,8 +1346,8 @@ void Daily::on_removeBookmarkButton_clicked()
|
|||||||
|
|
||||||
void Daily::on_ZombieMeter_actionTriggered(int action)
|
void Daily::on_ZombieMeter_actionTriggered(int action)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(action);
|
||||||
ZombieMeterMoved=true;
|
ZombieMeterMoved=true;
|
||||||
qDebug() << "ZombieMeter" << action;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//void Daily::on_EnergySlider_sliderMoved(int position)
|
//void Daily::on_EnergySlider_sliderMoved(int position)
|
||||||
|
2
daily.h
2
daily.h
@ -82,8 +82,6 @@ private slots:
|
|||||||
|
|
||||||
void on_removeBookmarkButton_clicked();
|
void on_removeBookmarkButton_clicked();
|
||||||
|
|
||||||
void on_bookmarkTable_itemActivated(QTableWidgetItem *item);
|
|
||||||
|
|
||||||
void on_bookmarkTable_itemClicked(QTableWidgetItem *item);
|
void on_bookmarkTable_itemClicked(QTableWidgetItem *item);
|
||||||
|
|
||||||
void on_bookmarkTable_itemChanged(QTableWidgetItem *item);
|
void on_bookmarkTable_itemChanged(QTableWidgetItem *item);
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QListView>
|
#include <QListView>
|
||||||
#include <QPrinter>
|
#include <QPrinter>
|
||||||
|
#include <QPrintDialog>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
@ -662,16 +663,36 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString username=PROFILE.Get("_{Username}_");
|
QString username=PROFILE.Get("_{Username}_");
|
||||||
QString filename=QFileDialog::getSaveFileName(this,"Select filename to save PDF report to",PREF.Get("{home}/"+name+username+date.toString(Qt::ISODate)+".pdf"),"PDF Files (*.pdf)");
|
|
||||||
|
|
||||||
if (filename.isEmpty())
|
QPrinter printer(QPrinter::ScreenResolution);
|
||||||
return;
|
#ifdef Q_WS_X11
|
||||||
|
printer.setPrinterName("Print to File (PDF)");
|
||||||
Notify("Saving "+name+" report as \""+filename+"\".");
|
printer.setOutputFormat(QPrinter::PdfFormat);
|
||||||
//QString filename=PREF.Get("{home}/"+name+"_{user}.pdf");
|
#endif
|
||||||
QPrinter printer(QPrinter::ScreenResolution); //QPrinter::HighResolution); //QPrinter::ScreenResolution);
|
printer.setPrintRange(QPrinter::AllPages);
|
||||||
printer.setOutputFileName(filename);
|
|
||||||
printer.setOrientation(QPrinter::Portrait);
|
printer.setOrientation(QPrinter::Portrait);
|
||||||
|
printer.setFullPage(false); // This has nothing to do with scaling
|
||||||
|
printer.setNumCopies(1);
|
||||||
|
QString filename=PREF.Get("{home}/"+name+username+date.toString(Qt::ISODate)+".pdf");//QFileDialog::getSaveFileName(this,"Select filename to save PDF report to",,"PDF Files (*.pdf)");
|
||||||
|
|
||||||
|
printer.setOutputFileName(filename);
|
||||||
|
//printer.setPageMargins(10,10,10,10,QPrinter::Millimeter);
|
||||||
|
QPrintDialog *dialog = new QPrintDialog(&printer);
|
||||||
|
//printer.setOutputFileName("printYou.pdf");
|
||||||
|
if ( dialog->exec() != QDialog::Accepted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//if (filename.isEmpty())
|
||||||
|
// return;
|
||||||
|
|
||||||
|
//Notify("Saving "+name+" report as \""+filename+"\".");
|
||||||
|
//QString filename=PREF.Get("{home}/"+name+"_{user}.pdf");
|
||||||
|
//QPrinter printer(QPrinter::ScreenResolution); //QPrinter::HighResolution); //QPrinter::ScreenResolution);
|
||||||
|
//printer.setOutputFileName(filename);
|
||||||
|
//printer.setOrientation(QPrinter::Portrait);
|
||||||
QPainter painter;
|
QPainter painter;
|
||||||
painter.begin(&printer);
|
painter.begin(&printer);
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ public:
|
|||||||
Overview *getOverview() { return overview; }
|
Overview *getOverview() { return overview; }
|
||||||
Oximetry *getOximetry() { return oximetry; }
|
Oximetry *getOximetry() { return oximetry; }
|
||||||
void JumpDaily();
|
void JumpDaily();
|
||||||
|
void PrintReport(gGraphView *gv,QString name, QDate date=QDate::currentDate());
|
||||||
private slots:
|
private slots:
|
||||||
void on_action_Import_Data_triggered();
|
void on_action_Import_Data_triggered();
|
||||||
|
|
||||||
@ -114,7 +115,6 @@ private slots:
|
|||||||
void on_action_Rebuild_Oximetry_Index_triggered();
|
void on_action_Rebuild_Oximetry_Index_triggered();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void PrintReport(gGraphView *gv,QString name, QDate date=QDate::currentDate());
|
|
||||||
|
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
Daily * daily;
|
Daily * daily;
|
||||||
|
39
overview.cpp
39
overview.cpp
@ -22,8 +22,8 @@
|
|||||||
#include "Graphs/gYAxis.h"
|
#include "Graphs/gYAxis.h"
|
||||||
#include "Graphs/gSessionTime.h"
|
#include "Graphs/gSessionTime.h"
|
||||||
|
|
||||||
//#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
//extern MainWindow * mainwin;
|
extern MainWindow * mainwin;
|
||||||
//extern QProgressBar * qprogress;
|
//extern QProgressBar * qprogress;
|
||||||
|
|
||||||
Overview::Overview(QWidget *parent,gGraphView * shared) :
|
Overview::Overview(QWidget *parent,gGraphView * shared) :
|
||||||
@ -348,41 +348,10 @@ QString Overview::GetHTML()
|
|||||||
}
|
}
|
||||||
void Overview::on_printButton_clicked()
|
void Overview::on_printButton_clicked()
|
||||||
{
|
{
|
||||||
report->Print(GetHTML());
|
mainwin->PrintReport(GraphView,"Overview");
|
||||||
|
//report->Print(GetHTML());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Overview::on_htmlButton_clicked()
|
|
||||||
{
|
|
||||||
QString filename;
|
|
||||||
|
|
||||||
for (int i=0;i<GraphView->size();i++) {
|
|
||||||
gGraph *g=(*GraphView)[i];
|
|
||||||
if (g->isEmpty()) continue;
|
|
||||||
if (!g->visible()) continue;
|
|
||||||
|
|
||||||
g->deselect();
|
|
||||||
QPixmap pm=g->renderPixmap(1024,512);
|
|
||||||
filename=PREF.Get("{home}/graph_"+g->title()+".png");
|
|
||||||
pm.save(filename,"png");
|
|
||||||
}
|
|
||||||
|
|
||||||
//QString filename=QFileDialog::getSaveFileName(this,tr("Save PNG Test"),PREF.Get("{home}"),tr("PNG Pictures(*.png)"));
|
|
||||||
//if (!filename.isEmpty()) {
|
|
||||||
// pm.save(filename,"png");
|
|
||||||
// }
|
|
||||||
|
|
||||||
/*QString html=GetHTML();
|
|
||||||
QString filename=QFileDialog::getSaveFileName(this,tr("Save HTML Report"),PREF.Get("{home}"),tr("HTML Documents (*.html)"));
|
|
||||||
if (!filename.isEmpty()) {
|
|
||||||
QFile file(filename);
|
|
||||||
file.open(QIODevice::WriteOnly);
|
|
||||||
QByteArray ba;
|
|
||||||
ba.append(html);
|
|
||||||
file.write(ba);
|
|
||||||
file.close();
|
|
||||||
} */
|
|
||||||
|
|
||||||
}
|
|
||||||
void Overview::ResetGraphLayout()
|
void Overview::ResetGraphLayout()
|
||||||
{
|
{
|
||||||
GraphView->resetLayout();
|
GraphView->resetLayout();
|
||||||
|
@ -61,8 +61,6 @@ private slots:
|
|||||||
|
|
||||||
void on_toolButton_clicked();
|
void on_toolButton_clicked();
|
||||||
|
|
||||||
void on_htmlButton_clicked();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::Overview *ui;
|
Ui::Overview *ui;
|
||||||
gGraphView *GraphView;
|
gGraphView *GraphView;
|
||||||
|
10
overview.ui
10
overview.ui
@ -114,16 +114,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="htmlButton">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Save a HTML report</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>HTML</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="printButton">
|
<widget class="QPushButton" name="printButton">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
@ -165,7 +165,7 @@ void SerialOximeter::onReadyRead()
|
|||||||
void SerialOximeter::addPulse(qint64 time, EventDataType pr)
|
void SerialOximeter::addPulse(qint64 time, EventDataType pr)
|
||||||
{
|
{
|
||||||
static EventDataType lastpr=0;
|
static EventDataType lastpr=0;
|
||||||
EventDataType min=0,max=0;
|
//EventDataType min=0,max=0;
|
||||||
if (pr>0) {
|
if (pr>0) {
|
||||||
if (lastpr==0) {
|
if (lastpr==0) {
|
||||||
if (pulse->count()==0)
|
if (pulse->count()==0)
|
||||||
@ -195,7 +195,7 @@ void SerialOximeter::addPulse(qint64 time, EventDataType pr)
|
|||||||
void SerialOximeter::addSpO2(qint64 time, EventDataType o2)
|
void SerialOximeter::addSpO2(qint64 time, EventDataType o2)
|
||||||
{
|
{
|
||||||
static EventDataType lasto2=0;
|
static EventDataType lasto2=0;
|
||||||
EventDataType min=0,max=0;
|
//EventDataType min=0,max=0;
|
||||||
if (o2>0) {
|
if (o2>0) {
|
||||||
if (lasto2==0) {
|
if (lasto2==0) {
|
||||||
if (spo2->count()==0)
|
if (spo2->count()==0)
|
||||||
@ -385,6 +385,7 @@ void CMS50Serial::on_import_process()
|
|||||||
bool first=true;
|
bool first=true;
|
||||||
while (i<(size-3)) {
|
while (i<(size-3)) {
|
||||||
a=data.at(i++);
|
a=data.at(i++);
|
||||||
|
Q_UNUSED(a);
|
||||||
pl=data.at(i++) ^ 0x80;
|
pl=data.at(i++) ^ 0x80;
|
||||||
o2=data.at(i++);
|
o2=data.at(i++);
|
||||||
if (pl!=0) {
|
if (pl!=0) {
|
||||||
@ -581,7 +582,7 @@ void CMS50Serial::onReadyRead()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static unsigned char b1[6]={0xf5,0xf5,0xf5,0xf5,0xf5,0xf5};
|
//static unsigned char b1[6]={0xf5,0xf5,0xf5,0xf5,0xf5,0xf5};
|
||||||
if (import_mode && waitf6 && (cntf6==0)) {
|
if (import_mode && waitf6 && (cntf6==0)) {
|
||||||
failcnt++;
|
failcnt++;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user