diff --git a/SleepLib/calcs.cpp b/SleepLib/calcs.cpp index 9469fcc4..4d252e04 100644 --- a/SleepLib/calcs.cpp +++ b/SleepLib/calcs.cpp @@ -242,6 +242,7 @@ int filterFlow(EventList *in, EventList *out, EventList *tv, EventList *mv, doub int calcRespRate(Session *session) { if (session->machine()->GetType()!=MT_CPAP) return 0; + if (session->machine()->GetClass()!="PRS1") return 0; if (session->eventlist.contains(CPAP_RespRate)) return 0; // already exists? if (!session->eventlist.contains(CPAP_FlowRate)) return 0; //need flow waveform diff --git a/SleepLib/loader_plugins/resmed_loader.cpp b/SleepLib/loader_plugins/resmed_loader.cpp index f4eb4a75..f092ddf4 100644 --- a/SleepLib/loader_plugins/resmed_loader.cpp +++ b/SleepLib/loader_plugins/resmed_loader.cpp @@ -627,7 +627,7 @@ bool ResmedLoader::LoadBRP(Session *sess,EDFParser &edf) } return true; } -EventList * ResmedLoader::ToTimeDelta(Session *sess,EDFParser &edf, EDFSignal & es, ChannelID code, long recs, qint64 duration,EventDataType min,EventDataType max) +EventList * ResmedLoader::ToTimeDelta(Session *sess,EDFParser &edf, EDFSignal & es, ChannelID code, long recs, qint64 duration,EventDataType min,EventDataType max,bool square) { bool first=true; double rate=(duration/recs); // milliseconds per record @@ -650,6 +650,7 @@ EventList * ResmedLoader::ToTimeDelta(Session *sess,EDFParser &edf, EDFSignal & first=false; } else { if (last!=c) { + if (square) el->AddEvent(tt,last); // square waves look better on some charts. el->AddEvent(tt,c); } } @@ -747,7 +748,7 @@ bool ResmedLoader::LoadPLD(Session *sess,EDFParser &edf) code=CPAP_Leak; es.gain*=60; es.physical_dimension="L/M"; - a=ToTimeDelta(sess,edf,es, code,recs,duration,0,0); + a=ToTimeDelta(sess,edf,es, code,recs,duration,0,0,true); } else if (es.label=="FFL Index") { code=CPAP_FLG; a=ToTimeDelta(sess,edf,es, code,recs,duration,0,0); diff --git a/SleepLib/loader_plugins/resmed_loader.h b/SleepLib/loader_plugins/resmed_loader.h index 74df83e3..bb566b52 100644 --- a/SleepLib/loader_plugins/resmed_loader.h +++ b/SleepLib/loader_plugins/resmed_loader.h @@ -108,7 +108,7 @@ public: virtual int Version() { return resmed_data_version; } virtual const QString & ClassName() { return resmed_class_name; } - EventList * ToTimeDelta(Session *sess,EDFParser &edf, EDFSignal & es, ChannelID code, long recs,qint64 duration,EventDataType min=0,EventDataType max=0); + EventList * ToTimeDelta(Session *sess,EDFParser &edf, EDFSignal & es, ChannelID code, long recs,qint64 duration,EventDataType min=0,EventDataType max=0,bool square=false); Machine *CreateMachine(QString serial,Profile *profile); diff --git a/SleepLib/machine.cpp b/SleepLib/machine.cpp index 6a807d3c..aa997904 100644 --- a/SleepLib/machine.cpp +++ b/SleepLib/machine.cpp @@ -34,6 +34,7 @@ qint64 timezoneOffset() { return _TZ_offset; } + ////////////////////////////////////////////////////////////////////////////////////////// // Machine Base-Class implmementation ////////////////////////////////////////////////////////////////////////////////////////// @@ -225,7 +226,6 @@ bool Machine::Purge(int secret) } else could_not_kill++; } - dir.remove(path+"/channels.dat"); if (could_not_kill>0) { // qWarning() << "Could not purge path\n" << path << "\n\n" << could_not_kill << " file(s) remain.. Suggest manually deleting this path\n"; // return false; @@ -247,30 +247,6 @@ bool Machine::Load() if (!dir.exists() || !dir.isReadable()) return false; -/* QString fn=path+"/channels.dat"; - QFile cf(fn); - cf.open(QIODevice::ReadOnly); - QDataStream in(&cf); - in.setVersion(QDataStream::Qt_4_6); - in.setByteOrder(QDataStream::LittleEndian); - - quint32 tmp; - in >> tmp; - if (magic!=tmp) { - qDebug() << "Machine Channel file format is wrong" << fn; - } - in >> tmp; - if (tmp!=channel_version) { - qDebug() << "Machine Channel file format is wrong" << fn; - } - qint32 tmp2; - in >> tmp2; - if (tmp2!=m_id) { - qDebug() << "Machine Channel file format is wrong" << fn; - } - in >> m_channels; - cf.close(); */ - dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks); dir.setSorting(QDir::Name); @@ -369,7 +345,6 @@ bool Machine::Save() thread[i]->start(); } while (!savelistSem->tryAcquire(threads,250)) { - //qDebug() << savelistSem->available(); if (qprogress) { // qprogress->setValue(66.0+(float(savelistCnt)/float(savelistSize)*33.0)); QApplication::processEvents(); diff --git a/SleepLib/machine.h b/SleepLib/machine.h index 383cebf2..eba57b84 100644 --- a/SleepLib/machine.h +++ b/SleepLib/machine.h @@ -45,12 +45,12 @@ signals: void UpdateProgress(int i); }; + class Machine { public: Machine(Profile *p,MachineID id=0); virtual ~Machine(); -// virtual bool Open(QString path){}; bool Load(); bool Save(); @@ -61,38 +61,25 @@ public: QHash sessionlist; QHash properties; + Session * SessionExists(SessionID session); + Day *AddSession(Session *s,Profile *p); + + void SetClass(QString t) { m_class=t; } + void SetType(MachineType t) { m_type=t; } + const QString & GetClass() { return m_class; } + const MachineType & GetType() { return m_type; } + inline QString hexid() { return QString().sprintf("%08lx",m_id); } + SessionID CreateSessionID() { return highest_sessionid+1; } + const MachineID & id() { return m_id; } + const QDate & FirstDay() { return firstday; } + const QDate & LastDay() { return lastday; } + Session *popSaveList(); QList m_savelist; volatile int savelistCnt; int savelistSize; QMutex savelistMutex; QSemaphore *savelistSem; - Session * SessionExists(SessionID session); - Day *AddSession(Session *s,Profile *p); - - void SetClass(QString t) { - m_class=t; - } - void SetType(MachineType t) { - m_type=t; - } - const QString & GetClass() { - return m_class; - } - const MachineType & GetType() { - return m_type; - } - const QString hexid() { - QString s; - s.sprintf("%08lx",m_id); - return s; - } - SessionID CreateSessionID() { return highest_sessionid+1; } - const MachineID & id() { return m_id; } - const QDate & FirstDay() { return firstday; } - const QDate & LastDay() { return lastday; } - //bool hasChannel(QString id) { return m_channels.contains(id) && m_channels[id]; } - //void registerChannel(QString id,bool b=true) { m_channels[id]=b; } protected: QDate firstday,lastday; @@ -104,7 +91,6 @@ protected: Profile *profile; bool changed; bool firstsession; - //QHash m_channels; }; class CPAP:public Machine diff --git a/daily.cpp b/daily.cpp index 552f713e..a380e613 100644 --- a/daily.cpp +++ b/daily.cpp @@ -998,7 +998,7 @@ void Daily::Unload(QDate date) journal->settings[Journal_Notes]=jhtml; journal->SetChanged(true); } - double w=ui->weightSpinBox->value(); + //double w=ui->weightSpinBox->value(); if (journal->settings.contains("Weight") && ui->weightSpinBox->value()==0) { journal->settings.erase(journal->settings.find("Weight")); if (journal->settings.contains("BMI")) { diff --git a/mainwindow.cpp b/mainwindow.cpp index 78746b5c..499378fe 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -251,7 +251,7 @@ void MainWindow::on_action_Import_Data_triggered() file.close(); } - bool addnew=false; + //bool addnew=false; QString newdir; bool asknew=false; @@ -287,7 +287,7 @@ void MainWindow::on_action_Import_Data_triggered() QString newdir=w.selectedFiles().at(i); if (!importFrom.contains(newdir)) { importFrom.append(newdir); - addnew=true; + //addnew=true; } } } diff --git a/oximetry.cpp b/oximetry.cpp index 4623cf38..33454d0d 100644 --- a/oximetry.cpp +++ b/oximetry.cpp @@ -946,6 +946,7 @@ void Oximetry::on_SerialPortsCombo_activated(const QString &arg1) void Oximetry::live_stopped(Session * session) { + Q_UNUSED(session); mainwin->Notify("Oximetry live recording has been terminated due to timeout"); //qDebug () << "Live Stopped"; on_RunButton_toggled(false); @@ -1477,7 +1478,7 @@ void Oximetry::on_dateEdit_dateTimeChanged(const QDateTime &date) return; qint64 first=session->first(); - qint64 last=session->last(); + //qint64 last=session->last(); qint64 tt=qint64(date.toTime_t())*1000L; qint64 offset=tt-first; diff --git a/preferencesdialog.cpp b/preferencesdialog.cpp index 8c1f293f..d9d2ed1a 100644 --- a/preferencesdialog.cpp +++ b/preferencesdialog.cpp @@ -274,7 +274,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent,Profile * _profile) : PreferencesDialog::~PreferencesDialog() { - disconnect(graphModel,SIGNAL(itemChanged(QStandardItem*)),this,SLOT(on_graphModel_changed(QStandardItem*))); + disconnect(graphModel,SIGNAL(itemChanged(QStandardItem*)),this,SLOT(graphModel_changed(QStandardItem*))); delete ui; } @@ -555,7 +555,7 @@ bool MySortFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent); } -void PreferencesDialog::on_graphModel_changed(QStandardItem * item) +void PreferencesDialog::graphModel_changed(QStandardItem * item) { QModelIndex index=item->index(); @@ -564,7 +564,7 @@ void PreferencesDialog::on_graphModel_changed(QStandardItem * item) const QModelIndex & row=index.sibling(index.row(),0); bool checked=row.data(Qt::CheckStateRole)!=0; - QString name=row.data().toString(); + //QString name=row.data().toString(); int group=row.data(Qt::UserRole+1).toInt(); int id=row.data(Qt::UserRole+2).toInt(); @@ -632,7 +632,7 @@ void PreferencesDialog::resetGraphModel() graphModel->appendRow(daily); graphModel->appendRow(overview); - connect(graphModel,SIGNAL(itemChanged(QStandardItem*)),this,SLOT(on_graphModel_changed(QStandardItem*))); + connect(graphModel,SIGNAL(itemChanged(QStandardItem*)),this,SLOT(graphModel_changed(QStandardItem*))); ui->graphView->setAlternatingRowColors(true); @@ -753,10 +753,10 @@ void PreferencesDialog::on_resetGraphButton_clicked() } -void PreferencesDialog::on_genOpWidget_itemActivated(QListWidgetItem *item) +/*void PreferencesDialog::on_genOpWidget_itemActivated(QListWidgetItem *item) { item->setCheckState(item->checkState()==Qt::Checked ? Qt::Unchecked : Qt::Checked); -} +} */ void PreferencesDialog::on_maskTypeCombo_activated(int index) diff --git a/preferencesdialog.h b/preferencesdialog.h index 70d3ad51..d0b8670a 100644 --- a/preferencesdialog.h +++ b/preferencesdialog.h @@ -61,11 +61,11 @@ private slots: void on_graphFilter_textChanged(const QString &arg1); - void on_graphModel_changed(QStandardItem * item); + void graphModel_changed(QStandardItem * item); void on_resetGraphButton_clicked(); - void on_genOpWidget_itemActivated(QListWidgetItem *item); + //void on_genOpWidget_itemActivated(QListWidgetItem *item); void on_maskTypeCombo_activated(int index);