Start of Oximetry Page

This commit is contained in:
Mark Watkins 2011-07-13 15:27:27 +10:00
parent bb8fcc8563
commit 9e7c91fb77
10 changed files with 354 additions and 142 deletions

View File

@ -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

View File

@ -102,7 +102,7 @@
</font>
</property>
<property name="currentIndex">
<number>2</number>
<number>3</number>
</property>
<property name="movable">
<bool>true</bool>

View File

@ -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<QextPortInfo> 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");

View File

@ -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"));
}

View File

@ -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;

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1089</width>
<height>603</height>
<width>771</width>
<height>420</height>
</rect>
</property>
<property name="sizePolicy">
@ -354,6 +354,21 @@
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<widget class="QToolButton" name="importButton">
<property name="sizePolicy">
@ -540,7 +555,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1089</width>
<width>771</width>
<height>25</height>
</rect>
</property>

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1060</width>
<height>665</height>
<height>355</height>
</rect>
</property>
<property name="windowTitle">
@ -75,8 +75,8 @@
</widget>
</widget>
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QScrollArea" name="scrollArea_2">
<property name="widgetResizable">
<bool>true</bool>
@ -87,7 +87,7 @@
<x>0</x>
<y>0</y>
<width>828</width>
<height>615</height>
<height>282</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
@ -108,132 +108,148 @@
</widget>
</widget>
</item>
<item>
<widget class="QDockWidget" name="dockWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item row="1" column="0">
<widget class="QFrame" name="frame">
<property name="minimumSize">
<size>
<width>830</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>524287</width>
<height>40</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>40</height>
</size>
</property>
<property name="features">
<set>QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetVerticalTitleBar</set>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="allowedAreas">
<set>Qt::BottomDockWidgetArea|Qt::TopDockWidgetArea</set>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="rbLastWeek">
<property name="text">
<string>Last Week</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbLastMonth">
<property name="text">
<string>Last Month</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbEverything">
<property name="text">
<string>Everything</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbDateRange">
<property name="text">
<string>Date Range</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="drStartLabel">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Start</string>
</property>
</widget>
</item>
<item>
<widget class="QDateEdit" name="drStart">
<property name="enabled">
<bool>false</bool>
</property>
<property name="displayFormat">
<string>dd/MM/yyyy</string>
</property>
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="drEndLabel">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>End</string>
</property>
</widget>
</item>
<item>
<widget class="QDateEdit" name="drEnd">
<property name="enabled">
<bool>false</bool>
</property>
<property name="displayFormat">
<string>dd/MM/yyyy</string>
</property>
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="rbDateRange">
<property name="text">
<string>Date Range</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbLastWeek">
<property name="text">
<string>Last Week</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbLastMonth">
<property name="text">
<string>Last Month</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbEverything">
<property name="text">
<string>Everything</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>277</width>
<height>23</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="drStartLabel">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Start</string>
</property>
</widget>
</item>
<item>
<widget class="QDateEdit" name="drEnd">
<property name="enabled">
<bool>false</bool>
</property>
<property name="displayFormat">
<string>dd/MM/yyyy</string>
</property>
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="drEndLabel">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>End</string>
</property>
</widget>
</item>
<item>
<widget class="QDateEdit" name="drStart">
<property name="enabled">
<bool>false</bool>
</property>
<property name="displayFormat">
<string>dd/MM/yyyy</string>
</property>
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>

35
oximetry.cpp Normal file
View File

@ -0,0 +1,35 @@
#include <QDebug>
#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<QextPortInfo> 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() << "===================================";
}
}

25
oximetry.h Normal file
View File

@ -0,0 +1,25 @@
#ifndef OXIMETRY_H
#define OXIMETRY_H
#include <QWidget>
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

122
oximetry.ui Normal file
View File

@ -0,0 +1,122 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Oximetry</class>
<widget class="QWidget" name="Oximetry">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>512</width>
<height>361</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>508</width>
<height>304</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Serial Port</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="SerialPortsCombo">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="RefreshPortsButton">
<property name="text">
<string>R</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="ImportButton">
<property name="text">
<string>Import from Device</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>