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 \ Graphs/gpiechart.cpp \
SleepLib/loader_plugins/sleep_database.cpp \ SleepLib/loader_plugins/sleep_database.cpp \
Graphs/gSessionTime.cpp \ Graphs/gSessionTime.cpp \
qextserialport/qextserialport.cpp qextserialport/qextserialport.cpp \
oximetry.cpp
unix:SOURCES += qextserialport/posix_qextserialport.cpp unix:SOURCES += qextserialport/posix_qextserialport.cpp
unix:!macx:SOURCES += qextserialport/qextserialenumerator_unix.cpp unix:!macx:SOURCES += qextserialport/qextserialenumerator_unix.cpp
@ -116,13 +117,15 @@ HEADERS += \
Graphs/gSessionTime.h \ Graphs/gSessionTime.h \
qextserialport/qextserialport_global.h \ qextserialport/qextserialport_global.h \
qextserialport/qextserialport.h \ qextserialport/qextserialport.h \
qextserialport/qextserialenumerator.h qextserialport/qextserialenumerator.h \
oximetry.h
FORMS += \ FORMS += \
daily.ui \ daily.ui \
overview.ui \ overview.ui \
mainwindow.ui mainwindow.ui \
oximetry.ui
RESOURCES += \ RESOURCES += \
Resources.qrc Resources.qrc

View File

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

View File

@ -16,24 +16,11 @@
#include "SleepLib/loader_plugins/cms50_loader.h" #include "SleepLib/loader_plugins/cms50_loader.h"
#include "SleepLib/loader_plugins/zeo_loader.h" #include "SleepLib/loader_plugins/zeo_loader.h"
#include "SleepLib/loader_plugins/resmed_loader.h" #include "SleepLib/loader_plugins/resmed_loader.h"
//#include "qextserialport/qextserialenumerator.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication a(argc, 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"); a.setApplicationName("SleepyHead");
int id=QFontDatabase::addApplicationFont(":/fonts/FreeSans.ttf"); int id=QFontDatabase::addApplicationFont(":/fonts/FreeSans.ttf");

View File

@ -76,6 +76,10 @@ MainWindow::~MainWindow()
overview->close(); overview->close();
delete overview; delete overview;
} }
if (oximetry) {
oximetry->close();
delete oximetry;
}
DoneGraphs(); DoneGraphs();
delete ui; delete ui;
Profiles::Done(); Profiles::Done();
@ -96,6 +100,9 @@ void MainWindow::Startup()
overview=new Overview(ui->tabWidget,shared_context); overview=new Overview(ui->tabWidget,shared_context);
ui->tabWidget->addTab(overview,tr("Overview")); ui->tabWidget->addTab(overview,tr("Overview"));
oximetry=new Oximetry(ui->tabWidget);
ui->tabWidget->addTab(oximetry,tr("Oximetry"));
qprogress->hide(); qprogress->hide();
qstatus->setText(tr("Ready")); qstatus->setText(tr("Ready"));
} }

View File

@ -12,6 +12,7 @@
#include "daily.h" #include "daily.h"
#include "overview.h" #include "overview.h"
#include "oximetry.h"
namespace Ui { namespace Ui {
class MainWindow; class MainWindow;
@ -66,6 +67,7 @@ private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
Daily * daily; Daily * daily;
Overview * overview; Overview * overview;
Oximetry * oximetry;
QGLContext *shared_context; QGLContext *shared_context;
bool first_load; bool first_load;
Profile *profile; Profile *profile;

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1089</width> <width>771</width>
<height>603</height> <height>420</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -354,6 +354,21 @@
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <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> <item>
<widget class="QToolButton" name="importButton"> <widget class="QToolButton" name="importButton">
<property name="sizePolicy"> <property name="sizePolicy">
@ -540,7 +555,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1089</width> <width>771</width>
<height>25</height> <height>25</height>
</rect> </rect>
</property> </property>

View File

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