diff --git a/SleepLib/schema.cpp b/SleepLib/schema.cpp index 10c3754b..de910cf0 100644 --- a/SleepLib/schema.cpp +++ b/SleepLib/schema.cpp @@ -249,4 +249,4 @@ bool ChannelList::Save(QString filename) } -typedef schema::Channel * ChannelID; +//typedef schema::Channel * ChannelID; diff --git a/SleepLib/schema.h b/SleepLib/schema.h index 1f2b9ff2..e15c252c 100644 --- a/SleepLib/schema.h +++ b/SleepLib/schema.h @@ -5,6 +5,16 @@ #include #include #include +#include "machine_common.h" + +namespace GraphFlags { +const quint32 Shadow=1; +const quint32 Foobar=2; +const quint32 XTicker=4; +const quint32 YTicker=8; +const quint32 XGrid=16; +const quint32 YGrid=32; +} namespace schema { @@ -84,9 +94,98 @@ public: QHash > groups; QString m_doctype; }; - extern ChannelList channel; +enum LayerType { + UnspecifiedLayer, Waveform, Flag, Overlay, Group +}; + +class Layer +{ +public: + Layer(ChannelID code, QColor colour, QString label=QString()); + virtual ~Layer(); + Layer *addLayer(Layer *layer);// { m_layers.push_back(layer); return layer; } + void setMin(EventDataType min) { m_min=min; m_hasmin=true; } + void setMax(EventDataType max) { m_max=max; m_hasmax=true; } + EventDataType min() { return m_min; } + EventDataType max() { return m_max; } + bool visible() { return m_visible; } + void setVisible(bool b) { m_visible=b; } +protected: + LayerType m_type; + ChannelID m_code; + QColor m_colour; + QString m_label; + EventDataType m_min; + EventDataType m_max; + bool m_hasmin; + bool m_hasmax; + bool m_visible; + QVector m_layers; +}; + +class WaveformLayer: public Layer +{ +public: + WaveformLayer(ChannelID code, QColor colour, float min=0, float max=0); + virtual ~WaveformLayer(); +}; + +enum FlagVisual { Bar, Span, Dot }; +class OverlayLayer: public Layer +{ +public: + OverlayLayer(ChannelID code, QColor colour, FlagVisual visual=Bar); + virtual ~OverlayLayer(); +protected: + FlagVisual m_visual; +}; +class GroupLayer: public Layer // Effectively an empty Layer container +{ +public: + GroupLayer(); + virtual ~GroupLayer(); +}; +class FlagGroupLayer: public GroupLayer +{ +public: + FlagGroupLayer(); + virtual ~FlagGroupLayer(); +}; +class FlagLayer: public Layer +{ +public: + FlagLayer(ChannelID code, QColor colour, FlagVisual visual=Bar); + virtual ~FlagLayer(); +protected: + FlagVisual m_visual; +}; +class Graph +{ +public: + Graph(QString name,quint32 flags=GraphFlags::XTicker | GraphFlags::YTicker | GraphFlags::XGrid); + Layer *addLayer(Layer *layer) { m_layers.push_back(layer); return layer; } + int height() { if (m_visible) return m_height; else return 0;} + int setHeight(int h) { m_height=h; } + bool visible() { return m_visible; } + void setVisible(bool b) { m_visible=b; } +protected: + QString m_name; + int m_height; + QVector m_layers; + bool m_visible; +}; +class GraphGroup +{ +public: + GraphGroup(QString name); + GraphGroup(); + Graph *addGraph(Graph *graph) { m_graphs.push_back(graph); return graph; } +protected: + QVectorm_graphs; +}; + void init(); } // namespace diff --git a/daily.cpp b/daily.cpp index ebd2955e..3b16482e 100644 --- a/daily.cpp +++ b/daily.cpp @@ -38,7 +38,7 @@ Daily::Daily(QWidget *parent,Profile * _profile,gGraphView * shared, MainWindow QList a; a.push_back(300); a.push_back(this->width()-300); - ui->splitter_2->setStretchFactor(0,0); + ui->splitter_2->setStretchFactor(1,1); ui->splitter_2->setSizes(a); ui->splitter_2->setStretchFactor(1,1); diff --git a/docs/graphs.xml b/docs/graphs.xml index b56c5477..3961e880 100644 --- a/docs/graphs.xml +++ b/docs/graphs.xml @@ -1,21 +1,22 @@ - - - - - - - - - - - + + + + + + + + + + + + - + diff --git a/mainwindow.cpp b/mainwindow.cpp index 162cbdd0..78e450dd 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include "mainwindow.h" #include "ui_mainwindow.h" #include "preferencesdialog.h" @@ -59,7 +60,10 @@ MainWindow::MainWindow(QWidget *parent) : ui->setupUi(this); this->setWindowTitle(tr("SleepyHead")+QString(" v%1.%2.%3 (%4)").arg(major_version).arg(minor_version).arg(revision_number).arg(pref["Profile"].toString())); ui->tabWidget->setCurrentIndex(0); - + //move(0,0); + overview=NULL; + daily=NULL; + oximetry=NULL; /* QGLFormat fmt; fmt.setDepth(false); @@ -117,6 +121,8 @@ MainWindow::MainWindow(QWidget *parent) : first_load=true; + QSettings settings("Jedimark", "SleepyHead"); + this->restoreGeometry(settings.value("MainWindow/geometry").toByteArray()); ui->tabWidget->setCurrentWidget(ui->welcome); @@ -129,6 +135,11 @@ MainWindow::MainWindow(QWidget *parent) : extern MainWindow *mainwin; MainWindow::~MainWindow() { + if (!isMaximized()) { + QSettings settings("Jedimark", "SleepyHead"); + settings.setValue("MainWindow/geometry", saveGeometry()); + } + //QWidget::closeEvent(event); if (daily) { daily->close(); delete daily; @@ -149,6 +160,8 @@ MainWindow::~MainWindow() void MainWindow::Startup() { + + qDebug() << pref["AppName"].toString().toAscii()+" v"+pref["VersionString"].toString().toAscii() << "built with Qt"<< QT_VERSION_STR << "on" << __DATE__ << __TIME__; qstatus->setText(tr("Loading Data")); qprogress->show(); @@ -162,11 +175,11 @@ void MainWindow::Startup() daily=new Daily(ui->tabWidget,profile,NULL,this); ui->tabWidget->insertTab(1,daily,tr("Daily")); - overview=new Overview(ui->tabWidget,profile,daily->SharedWidget()); - ui->tabWidget->insertTab(2,overview,tr("Overview")); + //overview=new Overview(ui->tabWidget,profile,daily->SharedWidget()); + //ui->tabWidget->insertTab(2,overview,tr("Overview")); - oximetry=new Oximetry(ui->tabWidget,profile,daily->SharedWidget()); - ui->tabWidget->insertTab(3,oximetry,tr("Oximetry")); + //oximetry=new Oximetry(ui->tabWidget,profile,daily->SharedWidget()); + //ui->tabWidget->insertTab(3,oximetry,tr("Oximetry")); if (daily) daily->ReloadGraphs(); if (overview) overview->ReloadGraphs(); diff --git a/oximetry.ui b/oximetry.ui index 1c275768..08bad813 100644 --- a/oximetry.ui +++ b/oximetry.ui @@ -105,7 +105,7 @@ - &Import from Device + &Import diff --git a/preferencesdialog.cpp b/preferencesdialog.cpp index df474e63..d153f176 100644 --- a/preferencesdialog.cpp +++ b/preferencesdialog.cpp @@ -80,6 +80,23 @@ PreferencesDialog::PreferencesDialog(QWidget *parent,Profile * _profile) : shortformat.replace("yy","yyyy"); }*/ + QTreeWidget *tree=ui->graphTree; + tree->clear(); + tree->setColumnCount(1); // 1 visible common.. (1 hidden) + + QTreeWidgetItem *daily=new QTreeWidgetItem((QTreeWidget *)0,QStringList("Daily Graphs")); + QTreeWidgetItem *overview=new QTreeWidgetItem((QTreeWidget *)0,QStringList("Overview Graphs")); + tree->insertTopLevelItem(0,daily); + tree->insertTopLevelItem(0,overview); + QTreeWidgetItem *it=new QTreeWidgetItem(daily,QStringList("Event Flags"));//,QTreeWidgetItem::UserType); + it->setFlags(Qt::ItemIsUserCheckable|Qt::ItemIsSelectable|Qt::ItemIsEnabled); + it->setCheckState(0,Qt::Checked); + daily->addChild(it); + //QTreeWidgetItem *root=NULL;//new QTreeWidgetItem((QTreeWidget *)0,QStringList("Stuff")); + //=new QTreeWidgetItem(root,l); + //ui->graphTree->setModel( + tree->sortByColumn(0,Qt::AscendingOrder); + } diff --git a/preferencesdialog.ui b/preferencesdialog.ui index 8802aec6..73d7f524 100644 --- a/preferencesdialog.ui +++ b/preferencesdialog.ui @@ -9,8 +9,8 @@ 0 0 - 477 - 264 + 527 + 291 @@ -29,9 +29,9 @@ - 0 + 3 - + &CPAP/Visual @@ -177,7 +177,7 @@ It has no effect on single cpu machines. - + &Sessions @@ -396,7 +396,7 @@ p, li { white-space: pre-wrap; } - + &Events @@ -404,7 +404,7 @@ p, li { white-space: pre-wrap; } - This doesn't work yet.. The colours shown are random. + This doesn't work yet.. @@ -452,6 +452,54 @@ p, li { white-space: pre-wrap; } + + + Graphs + + + + 0 + + + 0 + + + + + + + + 0 + 0 + + + + Filter + + + 4 + + + + + + + + + + + + true + + + + 1 + + + + + +