From 9e7c91fb77d340d0dee5201052adc0b2e474a428 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Wed, 13 Jul 2011 15:27:27 +1000 Subject: [PATCH] Start of Oximetry Page --- SleepyHeadQT.pro | 9 +- daily.ui | 2 +- main.cpp | 13 --- mainwindow.cpp | 7 ++ mainwindow.h | 2 + mainwindow.ui | 21 +++- overview.ui | 260 +++++++++++++++++++++++++---------------------- oximetry.cpp | 35 +++++++ oximetry.h | 25 +++++ oximetry.ui | 122 ++++++++++++++++++++++ 10 files changed, 354 insertions(+), 142 deletions(-) create mode 100644 oximetry.cpp create mode 100644 oximetry.h create mode 100644 oximetry.ui diff --git a/SleepyHeadQT.pro b/SleepyHeadQT.pro index ac0f6884..666cdc40 100644 --- a/SleepyHeadQT.pro +++ b/SleepyHeadQT.pro @@ -61,7 +61,8 @@ SOURCES += main.cpp\ Graphs/gpiechart.cpp \ SleepLib/loader_plugins/sleep_database.cpp \ Graphs/gSessionTime.cpp \ - qextserialport/qextserialport.cpp + qextserialport/qextserialport.cpp \ + oximetry.cpp unix:SOURCES += qextserialport/posix_qextserialport.cpp unix:!macx:SOURCES += qextserialport/qextserialenumerator_unix.cpp @@ -116,13 +117,15 @@ HEADERS += \ Graphs/gSessionTime.h \ qextserialport/qextserialport_global.h \ qextserialport/qextserialport.h \ - qextserialport/qextserialenumerator.h + qextserialport/qextserialenumerator.h \ + oximetry.h FORMS += \ daily.ui \ overview.ui \ - mainwindow.ui + mainwindow.ui \ + oximetry.ui RESOURCES += \ Resources.qrc diff --git a/daily.ui b/daily.ui index efffd290..203be80d 100644 --- a/daily.ui +++ b/daily.ui @@ -102,7 +102,7 @@ - 2 + 3 true diff --git a/main.cpp b/main.cpp index 61d28629..1ba332bb 100644 --- a/main.cpp +++ b/main.cpp @@ -16,24 +16,11 @@ #include "SleepLib/loader_plugins/cms50_loader.h" #include "SleepLib/loader_plugins/zeo_loader.h" #include "SleepLib/loader_plugins/resmed_loader.h" -//#include "qextserialport/qextserialenumerator.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); - /* QList ports = QextSerialEnumerator::getPorts(); - qDebug() << "List of ports:"; - for (int i = 0; i < ports.size(); i++) { - qDebug() << "port name:" << ports.at(i).portName; - qDebug() << "friendly name:" << ports.at(i).friendName; - qDebug() << "physical name:" << ports.at(i).physName; - qDebug() << "enumerator name:" << ports.at(i).enumName; - qDebug() << "vendor ID:" << QString::number(ports.at(i).vendorID, 16); - qDebug() << "product ID:" << QString::number(ports.at(i).productID, 16); - qDebug() << "==================================="; - } -*/ a.setApplicationName("SleepyHead"); int id=QFontDatabase::addApplicationFont(":/fonts/FreeSans.ttf"); diff --git a/mainwindow.cpp b/mainwindow.cpp index 78374d28..b9af67d9 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -76,6 +76,10 @@ MainWindow::~MainWindow() overview->close(); delete overview; } + if (oximetry) { + oximetry->close(); + delete oximetry; + } DoneGraphs(); delete ui; Profiles::Done(); @@ -96,6 +100,9 @@ void MainWindow::Startup() overview=new Overview(ui->tabWidget,shared_context); ui->tabWidget->addTab(overview,tr("Overview")); + oximetry=new Oximetry(ui->tabWidget); + ui->tabWidget->addTab(oximetry,tr("Oximetry")); + qprogress->hide(); qstatus->setText(tr("Ready")); } diff --git a/mainwindow.h b/mainwindow.h index 968afcfc..6d719b4c 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -12,6 +12,7 @@ #include "daily.h" #include "overview.h" +#include "oximetry.h" namespace Ui { class MainWindow; @@ -66,6 +67,7 @@ private: Ui::MainWindow *ui; Daily * daily; Overview * overview; + Oximetry * oximetry; QGLContext *shared_context; bool first_load; Profile *profile; diff --git a/mainwindow.ui b/mainwindow.ui index b39aa9d5..5e3071cd 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -6,8 +6,8 @@ 0 0 - 1089 - 603 + 771 + 420 @@ -354,6 +354,21 @@ QFrame::Raised + + 0 + + + 0 + + + 0 + + + 0 + + + 4 + @@ -540,7 +555,7 @@ 0 0 - 1089 + 771 25 diff --git a/overview.ui b/overview.ui index 9844d29a..af0fce6e 100644 --- a/overview.ui +++ b/overview.ui @@ -7,7 +7,7 @@ 0 0 1060 - 665 + 355 @@ -75,8 +75,8 @@ - - + + true @@ -87,7 +87,7 @@ 0 0 828 - 615 + 282 @@ -108,132 +108,148 @@ - - - - - 0 - 0 - - + + - - 830 - 40 - - - - - 524287 - 40 - - - 0 40 - - QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetVerticalTitleBar + + QFrame::StyledPanel - - Qt::BottomDockWidgetArea|Qt::TopDockWidgetArea + + QFrame::Raised - - - - - - Last Week - - - true - - - - - - - Last Month - - - - - - - Everything - - - - - - - Date Range - - - - - - - false - - - Start - - - - - - - false - - - dd/MM/yyyy - - - true - - - - - - - false - - - End - - - - - - - false - - - dd/MM/yyyy - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - + + + 0 + + + 4 + + + 0 + + + 0 + + + 0 + + + + + + + Date Range + + + + + + + Last Week + + + true + + + + + + + Last Month + + + + + + + Everything + + + + + + + Qt::Horizontal + + + + 277 + 23 + + + + + + + + + + + + false + + + Start + + + + + + + false + + + dd/MM/yyyy + + + true + + + + + + + false + + + End + + + + + + + false + + + dd/MM/yyyy + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + diff --git a/oximetry.cpp b/oximetry.cpp new file mode 100644 index 00000000..2706d097 --- /dev/null +++ b/oximetry.cpp @@ -0,0 +1,35 @@ +#include +#include "oximetry.h" +#include "ui_oximetry.h" +#include "qextserialport/qextserialenumerator.h" + +Oximetry::Oximetry(QWidget *parent) : + QWidget(parent), + ui(new Ui::Oximetry) +{ + ui->setupUi(this); + + on_RefreshPortsButton_clicked(); +} + +Oximetry::~Oximetry() +{ + delete ui; +} + +void Oximetry::on_RefreshPortsButton_clicked() +{ + QList ports = QextSerialEnumerator::getPorts(); + + ui->SerialPortsCombo->clear(); + for (int i = 0; i < ports.size(); i++) { + if (ports.at(i).friendName.toUpper().contains("USB")) + ui->SerialPortsCombo->addItem(ports.at(i).physName); + //qDebug() << "port name:" << ports.at(i).portName; + qDebug() << "Serial Port:" << ports.at(i).physName << ports.at(i).friendName; + //qDebug() << "enumerator name:" << ports.at(i).enumName; + //qDebug() << "vendor ID:" << QString::number(ports.at(i).vendorID, 16); + //qDebug() << "product ID:" << QString::number(ports.at(i).productID, 16); + //qDebug() << "==================================="; + } +} diff --git a/oximetry.h b/oximetry.h new file mode 100644 index 00000000..92f87b37 --- /dev/null +++ b/oximetry.h @@ -0,0 +1,25 @@ +#ifndef OXIMETRY_H +#define OXIMETRY_H + +#include + +namespace Ui { + class Oximetry; +} + +class Oximetry : public QWidget +{ + Q_OBJECT + +public: + explicit Oximetry(QWidget *parent = 0); + ~Oximetry(); + +private slots: + void on_RefreshPortsButton_clicked(); + +private: + Ui::Oximetry *ui; +}; + +#endif // OXIMETRY_H diff --git a/oximetry.ui b/oximetry.ui new file mode 100644 index 00000000..fc07d4de --- /dev/null +++ b/oximetry.ui @@ -0,0 +1,122 @@ + + + Oximetry + + + + 0 + 0 + 512 + 361 + + + + Form + + + + 0 + + + 0 + + + + + 2 + + + + + true + + + + + 0 + 0 + 508 + 304 + + + + + 0 + + + 0 + + + + + 0 + + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Serial Port + + + + + + + + 120 + 0 + + + + + + + + R + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Import from Device + + + + + + + + + + + + +