mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-07 03:30:44 +00:00
Split waveform and event channels in preferences
This commit is contained in:
parent
35778aa1df
commit
630b77d8e8
@ -374,7 +374,7 @@ class ResmedLoader : public CPAPLoader
|
|||||||
bool LoadPLD(Session *sess, const QString & path);
|
bool LoadPLD(Session *sess, const QString & path);
|
||||||
|
|
||||||
virtual MachineInfo newInfo() {
|
virtual MachineInfo newInfo() {
|
||||||
return MachineInfo(MT_CPAP, 0, resmed_class_name, QObject::tr("ResMed"), QString(), QString(), QString(), QObject::tr("ResMed"), QDateTime::currentDateTime(), resmed_data_version);
|
return MachineInfo(MT_CPAP, 0, resmed_class_name, QObject::tr("ResMed"), QString(), QString(), QString(), QObject::tr("S9"), QDateTime::currentDateTime(), resmed_data_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void initChannels();
|
virtual void initChannels();
|
||||||
|
@ -48,7 +48,7 @@ enum SummaryType { ST_CNT, ST_SUM, ST_AVG, ST_WAVG, ST_PERC, ST_90P, ST_MIN, ST_
|
|||||||
/*! \enum MachineType
|
/*! \enum MachineType
|
||||||
\brief Generalized type of a machine
|
\brief Generalized type of a machine
|
||||||
*/
|
*/
|
||||||
enum MachineType { MT_UNKNOWN = 0, MT_CPAP, MT_OXIMETER, MT_SLEEPSTAGE, MT_JOURNAL, MT_POSITION };
|
enum MachineType { MT_UNKNOWN = 0, MT_CPAP, MT_OXIMETER, MT_SLEEPSTAGE, MT_JOURNAL, MT_POSITION, MT_UNCATEGORIZED = 99};
|
||||||
//void InitMapsWithoutAwesomeInitializerLists();
|
//void InitMapsWithoutAwesomeInitializerLists();
|
||||||
|
|
||||||
// PAP Device Capabilities
|
// PAP Device Capabilities
|
||||||
|
@ -411,12 +411,12 @@ void init()
|
|||||||
STR_UNIT_EventsPerHour, DEFAULT, QColor("dark red")));
|
STR_UNIT_EventsPerHour, DEFAULT, QColor("dark red")));
|
||||||
|
|
||||||
// Positional sensors
|
// Positional sensors
|
||||||
schema::channel.add(GRP_POS, new Channel(POS_Orientation = 0x2990, DATA, MT_POSITION, SESSION,
|
schema::channel.add(GRP_POS, new Channel(POS_Orientation = 0x2990, WAVEFORM, MT_POSITION, SESSION,
|
||||||
"Orientation", QObject::tr("Orientation"),
|
"Orientation", QObject::tr("Orientation"),
|
||||||
QObject::tr("Sleep position in degrees"), QObject::tr("Orientation"), STR_UNIT_Degrees,
|
QObject::tr("Sleep position in degrees"), QObject::tr("Orientation"), STR_UNIT_Degrees,
|
||||||
DEFAULT, QColor("dark blue")));
|
DEFAULT, QColor("dark blue")));
|
||||||
|
|
||||||
schema::channel.add(GRP_POS, new Channel(POS_Inclination = 0x2991, DATA, MT_POSITION, SESSION,
|
schema::channel.add(GRP_POS, new Channel(POS_Inclination = 0x2991, WAVEFORM, MT_POSITION, SESSION,
|
||||||
"Inclination", QObject::tr("Inclination"),
|
"Inclination", QObject::tr("Inclination"),
|
||||||
QObject::tr("Upright angle in degrees"), QObject::tr("Inclination"), STR_UNIT_Degrees,
|
QObject::tr("Upright angle in degrees"), QObject::tr("Inclination"), STR_UNIT_Degrees,
|
||||||
DEFAULT, QColor("dark magenta")));
|
DEFAULT, QColor("dark magenta")));
|
||||||
|
@ -115,6 +115,7 @@ class Channel
|
|||||||
|
|
||||||
void setFullname(QString fullname) { m_fullname = fullname; }
|
void setFullname(QString fullname) { m_fullname = fullname; }
|
||||||
void setLabel(QString label) { m_label = label; }
|
void setLabel(QString label) { m_label = label; }
|
||||||
|
void setType(ChanType type) { m_type = type; }
|
||||||
void setUnit(QString unit) { m_unit = unit; }
|
void setUnit(QString unit) { m_unit = unit; }
|
||||||
void setDescription(QString desc) { m_description = desc; }
|
void setDescription(QString desc) { m_description = desc; }
|
||||||
void setUpperThreshold(EventDataType value) { m_upperThreshold = value; }
|
void setUpperThreshold(EventDataType value) { m_upperThreshold = value; }
|
||||||
|
@ -114,6 +114,8 @@ Daily::Daily(QWidget *parent,gGraphView * shared)
|
|||||||
|
|
||||||
webView=new MyWebView(this);
|
webView=new MyWebView(this);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
|
QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
|
||||||
|
|
||||||
ui->tabWidget->insertTab(0,webView,QIcon(),"Details");
|
ui->tabWidget->insertTab(0,webView,QIcon(),"Details");
|
||||||
|
@ -33,6 +33,9 @@ extern MainWindow *mainwin;
|
|||||||
typedef QMessageBox::StandardButton StandardButton;
|
typedef QMessageBox::StandardButton StandardButton;
|
||||||
typedef QMessageBox::StandardButtons StandardButtons;
|
typedef QMessageBox::StandardButtons StandardButtons;
|
||||||
|
|
||||||
|
QHash<schema::ChanType, QString> channeltype;
|
||||||
|
|
||||||
|
|
||||||
MaskProfile masks[] = {
|
MaskProfile masks[] = {
|
||||||
{Mask_Unknown, QObject::tr("Unspecified"), {{4, 25}, {8, 25}, {12, 25}, {16, 25}, {20, 25}}},
|
{Mask_Unknown, QObject::tr("Unspecified"), {{4, 25}, {8, 25}, {12, 25}, {16, 25}, {20, 25}}},
|
||||||
{Mask_NasalPillows, QObject::tr("Nasal Pillows"), {{4, 20}, {8, 29}, {12, 37}, {16, 43}, {20, 49}}},
|
{Mask_NasalPillows, QObject::tr("Nasal Pillows"), {{4, 20}, {8, 29}, {12, 37}, {16, 43}, {20, 49}}},
|
||||||
@ -54,6 +57,12 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Profile *_profile) :
|
|||||||
ui->leakProfile->setColumnWidth(0, 100);
|
ui->leakProfile->setColumnWidth(0, 100);
|
||||||
ui->maskTypeCombo->clear();
|
ui->maskTypeCombo->clear();
|
||||||
|
|
||||||
|
channeltype.clear();
|
||||||
|
channeltype[schema::FLAG] = tr("Flag");
|
||||||
|
channeltype[schema::MINOR_FLAG] = tr("Minor Flag");
|
||||||
|
channeltype[schema::SPAN] = tr("Span");
|
||||||
|
channeltype[schema::UNKNOWN] = tr("Always Minor");
|
||||||
|
|
||||||
//ui->customEventGroupbox->setEnabled(false);
|
//ui->customEventGroupbox->setEnabled(false);
|
||||||
|
|
||||||
QString masktype = tr("Nasal Pillows");
|
QString masktype = tr("Nasal Pillows");
|
||||||
@ -281,68 +290,183 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Profile *_profile) :
|
|||||||
|
|
||||||
InitChanInfo();
|
InitChanInfo();
|
||||||
|
|
||||||
|
waveFilterModel = new MySortFilterProxyModel(this);
|
||||||
|
waveModel = new QStandardItemModel(this);
|
||||||
|
waveFilterModel->setSourceModel(waveModel);
|
||||||
|
waveFilterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||||
|
waveFilterModel->setFilterKeyColumn(0);
|
||||||
|
ui->waveView->setModel(waveFilterModel);
|
||||||
|
InitWaveInfo();
|
||||||
|
|
||||||
|
ui->waveView->setSortingEnabled(true);
|
||||||
|
ui->chanView->setSortingEnabled(true);
|
||||||
|
|
||||||
|
ui->waveView->sortByColumn(0, Qt::AscendingOrder);
|
||||||
|
ui->chanView->sortByColumn(0, Qt::AscendingOrder);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <QItemDelegate>
|
||||||
|
class SpinBoxDelegate : public QItemDelegate
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
SpinBoxDelegate(QObject *parent = 0):QItemDelegate(parent) {}
|
||||||
|
|
||||||
|
virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
|
|
||||||
|
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
|
||||||
|
virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
|
||||||
|
virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
QWidget *SpinBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &/* option */, const QModelIndex &/* index */) const
|
||||||
|
{
|
||||||
|
QDoubleSpinBox *editor = new QDoubleSpinBox(parent);
|
||||||
|
//editor->setMinimum(0);
|
||||||
|
//editor->setMaximum(100.0);
|
||||||
|
|
||||||
|
return editor;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpinBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
double value = index.model()->data(index, Qt::EditRole).toDouble();
|
||||||
|
|
||||||
|
QDoubleSpinBox *spinBox = static_cast<QDoubleSpinBox*>(editor);
|
||||||
|
spinBox->setMinimum(-9999999.0);
|
||||||
|
spinBox->setMaximum(9999999.0);
|
||||||
|
|
||||||
|
spinBox->setValue(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
QDoubleSpinBox *spinBox = static_cast<QDoubleSpinBox*>(editor);
|
||||||
|
spinBox->interpretText();
|
||||||
|
double value = spinBox->value();
|
||||||
|
|
||||||
|
model->setData(index, value, Qt::EditRole);
|
||||||
|
}
|
||||||
|
void SpinBoxDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
|
||||||
|
{
|
||||||
|
editor->setGeometry(option.rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#include <QItemDelegate>
|
||||||
|
class ComboBoxDelegate : public QItemDelegate
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
ComboBoxDelegate(QObject *parent = 0):QItemDelegate(parent) {}
|
||||||
|
|
||||||
|
virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
|
|
||||||
|
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
|
||||||
|
virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
|
||||||
|
virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
QWidget *ComboBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &/* option */, const QModelIndex &/* index */) const
|
||||||
|
{
|
||||||
|
QComboBox *combo = new QComboBox(parent);
|
||||||
|
|
||||||
|
QHash<schema::ChanType, QString>::iterator it;
|
||||||
|
for (it = channeltype.begin(); it != channeltype.end(); ++it) {
|
||||||
|
if (it.key() == schema::UNKNOWN) continue;
|
||||||
|
combo->addItem(it.value());
|
||||||
|
}
|
||||||
|
//editor->setMinimum(0);
|
||||||
|
//editor->setMaximum(100.0);
|
||||||
|
|
||||||
|
return combo;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ComboBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
QString value = index.model()->data(index, Qt::EditRole).toString();
|
||||||
|
|
||||||
|
QComboBox *combo = static_cast<QComboBox*>(editor);
|
||||||
|
|
||||||
|
combo->setCurrentText(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ComboBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
QComboBox *combo = static_cast<QComboBox*>(editor);
|
||||||
|
|
||||||
|
model->setData(index, combo->currentText(), Qt::EditRole);
|
||||||
|
}
|
||||||
|
void ComboBoxDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
|
||||||
|
{
|
||||||
|
editor->setGeometry(option.rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void PreferencesDialog::InitChanInfo()
|
void PreferencesDialog::InitChanInfo()
|
||||||
{
|
{
|
||||||
QHash<schema::ChanType, int> toprows;
|
QHash<MachineType, int> toprows;
|
||||||
|
|
||||||
chanModel->clear();
|
chanModel->clear();
|
||||||
toplevel.clear();
|
toplevel.clear();
|
||||||
toprows.clear();
|
toprows.clear();
|
||||||
|
|
||||||
QStandardItem *hdr = nullptr;
|
|
||||||
|
|
||||||
toplevel[schema::SPAN] = hdr = new QStandardItem(tr("Span Events"));
|
|
||||||
hdr->setEditable(false);
|
|
||||||
chanModel->appendRow(hdr);
|
|
||||||
|
|
||||||
toplevel[schema::FLAG] = hdr = new QStandardItem(tr("Flags"));
|
|
||||||
hdr->setEditable(false);
|
|
||||||
chanModel->appendRow(hdr);
|
|
||||||
|
|
||||||
toplevel[schema::MINOR_FLAG] = hdr = new QStandardItem(tr("Minor Flags"));
|
|
||||||
hdr->setEditable(false);
|
|
||||||
chanModel->appendRow(hdr);
|
|
||||||
|
|
||||||
toplevel[schema::WAVEFORM] = hdr = new QStandardItem(tr("Waveforms"));
|
|
||||||
hdr->setEditable(false);
|
|
||||||
chanModel->appendRow(hdr);
|
|
||||||
|
|
||||||
toplevel[schema::DATA] = hdr = new QStandardItem(tr("Data Channels"));
|
|
||||||
hdr->setEditable(false);
|
|
||||||
chanModel->appendRow(hdr);
|
|
||||||
|
|
||||||
toplevel[schema::SETTING] = hdr = new QStandardItem(tr("Settings Channels"));
|
|
||||||
hdr->setEditable(false);
|
|
||||||
chanModel->appendRow(hdr);
|
|
||||||
|
|
||||||
toplevel[schema::UNKNOWN] = hdr = new QStandardItem(tr("Unknown Channels"));
|
|
||||||
hdr->setEditable(false);
|
|
||||||
chanModel->appendRow(hdr);
|
|
||||||
|
|
||||||
ui->chanView->setAlternatingRowColors(true);
|
|
||||||
|
|
||||||
// ui->graphView->setFirstColumnSpanned(0,daily->index(),true); // Crashes on windows.. Why do I need this again?
|
|
||||||
chanModel->setColumnCount(4);
|
|
||||||
QStringList headers;
|
QStringList headers;
|
||||||
headers.append(tr("Name"));
|
headers.append(tr("Name"));
|
||||||
headers.append(tr("Color"));
|
headers.append(tr("Color"));
|
||||||
|
headers.append(tr("Flag Type"));
|
||||||
headers.append(tr("Label"));
|
headers.append(tr("Label"));
|
||||||
headers.append(tr("Details"));
|
headers.append(tr("Details"));
|
||||||
// headers.append(tr("ID"));
|
|
||||||
chanModel->setHorizontalHeaderLabels(headers);
|
chanModel->setHorizontalHeaderLabels(headers);
|
||||||
ui->chanView->setColumnWidth(0, 200);
|
ui->chanView->setColumnWidth(0, 200);
|
||||||
ui->chanView->setColumnWidth(1, 50);
|
ui->chanView->setColumnWidth(1, 50);
|
||||||
ui->chanView->setColumnWidth(2, 100);
|
ui->chanView->setColumnWidth(2, 100);
|
||||||
|
ui->chanView->setColumnWidth(3, 100);
|
||||||
ui->chanView->setSelectionMode(QAbstractItemView::SingleSelection);
|
ui->chanView->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
ui->chanView->setSelectionBehavior(QAbstractItemView::SelectItems);
|
ui->chanView->setSelectionBehavior(QAbstractItemView::SelectItems);
|
||||||
|
|
||||||
|
chanModel->setColumnCount(5);
|
||||||
|
|
||||||
|
QStandardItem *hdr = nullptr;
|
||||||
|
|
||||||
|
QMap<MachineType, QString> Section;
|
||||||
|
|
||||||
|
Section[MT_CPAP] = tr("CPAP Events");
|
||||||
|
Section[MT_OXIMETER] = tr("Oximeter Events");
|
||||||
|
Section[MT_POSITION] = tr("Positional Events");
|
||||||
|
Section[MT_SLEEPSTAGE] = tr("Sleep Stage Events");
|
||||||
|
Section[MT_UNCATEGORIZED] = tr("Unknown Events");
|
||||||
|
|
||||||
|
QMap<MachineType, QString>::iterator it;
|
||||||
|
|
||||||
QHash<QString, schema::Channel *>::iterator ci;
|
QHash<QString, schema::Channel *>::iterator ci;
|
||||||
|
|
||||||
|
for (it = Section.begin(); it != Section.end(); ++it) {
|
||||||
|
toplevel[it.key()] = hdr = new QStandardItem(it.value());
|
||||||
|
hdr->setEditable(false);
|
||||||
|
QList<QStandardItem *> list;
|
||||||
|
list.append(hdr);
|
||||||
|
for (int i=0; i<4; i++) {
|
||||||
|
QStandardItem *it = new QStandardItem();
|
||||||
|
it->setEnabled(false);
|
||||||
|
list.append(it);
|
||||||
|
}
|
||||||
|
chanModel->appendRow(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->chanView->setAlternatingRowColors(true);
|
||||||
|
|
||||||
|
// ui->graphView->setFirstColumnSpanned(0,daily->index(),true); // Crashes on windows.. Why do I need this again?
|
||||||
|
|
||||||
|
|
||||||
|
ComboBoxDelegate * combobox = new ComboBoxDelegate(ui->waveView);
|
||||||
|
|
||||||
|
ui->chanView->setItemDelegateForColumn(2,combobox);
|
||||||
|
|
||||||
int row = 0;
|
int row = 0;
|
||||||
for (ci = schema::channel.names.begin(); ci != schema::channel.names.end(); ci++) {
|
for (ci = schema::channel.names.begin(); ci != schema::channel.names.end(); ci++) {
|
||||||
schema::Channel * chan = ci.value();
|
schema::Channel * chan = ci.value();
|
||||||
|
if ((chan->type() == schema::DATA) || (chan->type() == schema::SETTING) || chan->type() == schema::WAVEFORM) continue;
|
||||||
|
|
||||||
QList<QStandardItem *> items;
|
QList<QStandardItem *> items;
|
||||||
QStandardItem *it = new QStandardItem(chan->fullname());
|
QStandardItem *it = new QStandardItem(chan->fullname());
|
||||||
@ -350,6 +474,7 @@ void PreferencesDialog::InitChanInfo()
|
|||||||
it->setCheckState(chan->enabled() ? Qt::Checked : Qt::Unchecked);
|
it->setCheckState(chan->enabled() ? Qt::Checked : Qt::Unchecked);
|
||||||
it->setEditable(true);
|
it->setEditable(true);
|
||||||
it->setData(chan->id(), Qt::UserRole);
|
it->setData(chan->id(), Qt::UserRole);
|
||||||
|
it->setToolTip(tr("Double click to change the descriptive name this channel."));
|
||||||
items.push_back(it);
|
items.push_back(it);
|
||||||
|
|
||||||
|
|
||||||
@ -357,27 +482,168 @@ void PreferencesDialog::InitChanInfo()
|
|||||||
it->setBackground(QBrush(chan->defaultColor()));
|
it->setBackground(QBrush(chan->defaultColor()));
|
||||||
it->setEditable(false);
|
it->setEditable(false);
|
||||||
it->setData(chan->defaultColor().rgba(), Qt::UserRole);
|
it->setData(chan->defaultColor().rgba(), Qt::UserRole);
|
||||||
|
it->setToolTip(tr("Double click to change the default color for this channel plot/flag/data."));
|
||||||
|
|
||||||
it->setSelectable(false);
|
it->setSelectable(false);
|
||||||
items.push_back(it);
|
items.push_back(it);
|
||||||
|
|
||||||
|
schema::ChanType type = chan->type();
|
||||||
|
|
||||||
|
it = new QStandardItem(channeltype[type]);
|
||||||
|
it->setToolTip(tr("Here you can change the type of flag shown for this event"));
|
||||||
|
it->setEditable(type != schema::UNKNOWN);
|
||||||
|
items.push_back(it);
|
||||||
|
|
||||||
it = new QStandardItem(chan->label());
|
it = new QStandardItem(chan->label());
|
||||||
|
it->setToolTip(tr("This is the short-form label to indicate this channel on screen."));
|
||||||
|
|
||||||
it->setEditable(true);
|
it->setEditable(true);
|
||||||
items.push_back(it);
|
items.push_back(it);
|
||||||
|
|
||||||
it = new QStandardItem(chan->description());
|
it = new QStandardItem(chan->description());
|
||||||
|
it->setToolTip(tr("This is a description of what this channel does."));
|
||||||
|
|
||||||
it->setEditable(true);
|
it->setEditable(true);
|
||||||
items.push_back(it);
|
items.push_back(it);
|
||||||
|
|
||||||
// it = new QStandardItem(QString().number(chan->id(),16));
|
MachineType mt = chan->machtype();
|
||||||
// it->setEditable(false);
|
if (chan->type() == schema::UNKNOWN) mt = MT_UNCATEGORIZED;
|
||||||
// items.push_back(it);
|
row = toprows[mt]++;
|
||||||
|
toplevel[mt]->insertRow(row, items);
|
||||||
|
}
|
||||||
|
|
||||||
row = toprows[chan->type()]++;
|
|
||||||
toplevel[chan->type()]->insertRow(row, items);
|
for(QHash<MachineType, QStandardItem *>::iterator i = toplevel.begin(); i != toplevel.end(); ++i) {
|
||||||
|
if (i.value()->rowCount() == 0) {
|
||||||
|
chanModel->removeRow(i.value()->row());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ui->chanView->expandAll();
|
ui->chanView->expandAll();
|
||||||
|
ui->chanView->setSortingEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PreferencesDialog::InitWaveInfo()
|
||||||
|
{
|
||||||
|
QHash<MachineType, int> toprows;
|
||||||
|
|
||||||
|
waveModel->clear();
|
||||||
|
machlevel.clear();
|
||||||
|
toprows.clear();
|
||||||
|
QStringList headers;
|
||||||
|
headers.append(tr("Name"));
|
||||||
|
headers.append(tr("Color"));
|
||||||
|
headers.append(tr("Lower"));
|
||||||
|
headers.append(tr("Upper"));
|
||||||
|
headers.append(tr("Label"));
|
||||||
|
headers.append(tr("Details"));
|
||||||
|
waveModel->setHorizontalHeaderLabels(headers);
|
||||||
|
ui->waveView->setColumnWidth(0, 200);
|
||||||
|
ui->waveView->setColumnWidth(1, 50);
|
||||||
|
ui->waveView->setColumnWidth(2, 50);
|
||||||
|
ui->waveView->setColumnWidth(3, 50);
|
||||||
|
ui->waveView->setColumnWidth(4, 100);
|
||||||
|
ui->waveView->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
|
ui->waveView->setSelectionBehavior(QAbstractItemView::SelectItems);
|
||||||
|
|
||||||
|
waveModel->setColumnCount(6);
|
||||||
|
|
||||||
|
QStandardItem *hdr = nullptr;
|
||||||
|
|
||||||
|
QMap<MachineType, QString> Section;
|
||||||
|
|
||||||
|
Section[MT_CPAP] = tr("CPAP Waveforms");
|
||||||
|
Section[MT_OXIMETER] = tr("Oximeter Waveforms");
|
||||||
|
Section[MT_POSITION] = tr("Positional Waveforms");
|
||||||
|
Section[MT_SLEEPSTAGE] = tr("Sleep Stage Waveforms");
|
||||||
|
|
||||||
|
QMap<MachineType, QString>::iterator it;
|
||||||
|
|
||||||
|
for (it = Section.begin(); it != Section.end(); ++it) {
|
||||||
|
machlevel[it.key()] = hdr = new QStandardItem(it.value());
|
||||||
|
hdr->setEditable(false);
|
||||||
|
QList<QStandardItem *> list;
|
||||||
|
list.append(hdr);
|
||||||
|
for (int i=0; i<5; i++) {
|
||||||
|
QStandardItem *it = new QStandardItem();
|
||||||
|
it->setEnabled(false);
|
||||||
|
list.append(it);
|
||||||
|
}
|
||||||
|
waveModel->appendRow(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->waveView->setAlternatingRowColors(true);
|
||||||
|
|
||||||
|
// ui->graphView->setFirstColumnSpanned(0,daily->index(),true); // Crashes on windows.. Why do I need this again?
|
||||||
|
|
||||||
|
QHash<QString, schema::Channel *>::iterator ci;
|
||||||
|
|
||||||
|
SpinBoxDelegate * spinbox = new SpinBoxDelegate(ui->waveView);
|
||||||
|
|
||||||
|
ui->waveView->setItemDelegateForColumn(2,spinbox);
|
||||||
|
ui->waveView->setItemDelegateForColumn(3,spinbox);
|
||||||
|
|
||||||
|
int row = 0;
|
||||||
|
for (ci = schema::channel.names.begin(); ci != schema::channel.names.end(); ci++) {
|
||||||
|
schema::Channel * chan = ci.value();
|
||||||
|
if (chan->type() != schema::WAVEFORM) continue;
|
||||||
|
|
||||||
|
QList<QStandardItem *> items;
|
||||||
|
QStandardItem *it = new QStandardItem(chan->fullname());
|
||||||
|
|
||||||
|
it->setCheckable(true);
|
||||||
|
it->setCheckState(chan->enabled() ? Qt::Checked : Qt::Unchecked);
|
||||||
|
it->setEditable(true);
|
||||||
|
it->setData(chan->id(), Qt::UserRole);
|
||||||
|
it->setToolTip(tr("Double click to change the descriptive name this channel."));
|
||||||
|
items.push_back(it);
|
||||||
|
|
||||||
|
it = new QStandardItem();
|
||||||
|
it->setBackground(QBrush(chan->defaultColor()));
|
||||||
|
it->setEditable(false);
|
||||||
|
it->setData(chan->defaultColor().rgba(), Qt::UserRole);
|
||||||
|
it->setToolTip(tr("Double click to change the default color for this channel plot/flag/data."));
|
||||||
|
|
||||||
|
it->setSelectable(false);
|
||||||
|
items.push_back(it);
|
||||||
|
|
||||||
|
it = new QStandardItem(QString::number(chan->lowerThreshold(),'f',1));
|
||||||
|
it->setToolTip(tr("Here you can set the <b>lower</b> threshold used for certain calculations on the %1 waveform").arg(chan->fullname()));
|
||||||
|
it->setEditable(true);
|
||||||
|
items.push_back(it);
|
||||||
|
|
||||||
|
it = new QStandardItem(QString::number(chan->upperThreshold(),'f',1));
|
||||||
|
it->setToolTip(tr("Here you can set the <b>upper</b> threshold used for certain calculations on the %1 waveform").arg(chan->fullname()));
|
||||||
|
it->setEditable(true);
|
||||||
|
items.push_back(it);
|
||||||
|
|
||||||
|
it = new QStandardItem(chan->label());
|
||||||
|
it->setToolTip(tr("This is the short-form label to indicate this channel on screen."));
|
||||||
|
|
||||||
|
it->setEditable(true);
|
||||||
|
items.push_back(it);
|
||||||
|
|
||||||
|
it = new QStandardItem(chan->description());
|
||||||
|
it->setToolTip(tr("This is a description of what this channel does."));
|
||||||
|
|
||||||
|
it->setEditable(true);
|
||||||
|
items.push_back(it);
|
||||||
|
|
||||||
|
row = toprows[chan->machtype()]++;
|
||||||
|
machlevel[chan->machtype()]->insertRow(row, items);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(QHash<MachineType, QStandardItem *>::iterator i = machlevel.begin(); i != machlevel.end(); ++i) {
|
||||||
|
if (i.value()->rowCount() == 0) {
|
||||||
|
waveModel->removeRow(i.value()->row());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->waveView->expandAll();
|
||||||
|
ui->waveView->setSortingEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PreferencesDialog::~PreferencesDialog()
|
PreferencesDialog::~PreferencesDialog()
|
||||||
{
|
{
|
||||||
disconnect(graphModel, SIGNAL(itemChanged(QStandardItem *)), this,
|
disconnect(graphModel, SIGNAL(itemChanged(QStandardItem *)), this,
|
||||||
@ -621,9 +887,33 @@ bool PreferencesDialog::Save()
|
|||||||
bigfont->setItalic(ui->bigFontItalic->isChecked());
|
bigfont->setItalic(ui->bigFontItalic->isChecked());
|
||||||
|
|
||||||
|
|
||||||
int toprows = chanModel->rowCount();
|
int toprows = waveModel->rowCount();
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
|
for (int i=0; i < toprows; i++) {
|
||||||
|
QStandardItem * topitem = waveModel->item(i,0);
|
||||||
|
|
||||||
|
if (!topitem) continue;
|
||||||
|
int rows = topitem->rowCount();
|
||||||
|
for (int j=0; j< rows; ++j) {
|
||||||
|
QStandardItem * item = topitem->child(j, 0);
|
||||||
|
if (!item) continue;
|
||||||
|
|
||||||
|
ChannelID id = item->data(Qt::UserRole).toUInt(&ok);
|
||||||
|
schema::Channel & chan = schema::channel[id];
|
||||||
|
if (chan.isNull()) continue;
|
||||||
|
chan.setEnabled(item->checkState() == Qt::Checked ? true : false);
|
||||||
|
chan.setFullname(item->text());
|
||||||
|
chan.setDefaultColor(QColor(topitem->child(j,1)->data(Qt::UserRole).toUInt()));
|
||||||
|
chan.setLowerThreshold(topitem->child(j,2)->text().toDouble());
|
||||||
|
chan.setUpperThreshold(topitem->child(j,3)->text().toDouble());
|
||||||
|
chan.setLabel(topitem->child(j,4)->text());
|
||||||
|
chan.setDescription(topitem->child(j,5)->text());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
toprows = chanModel->rowCount();
|
||||||
|
|
||||||
for (int i=0; i < toprows; i++) {
|
for (int i=0; i < toprows; i++) {
|
||||||
QStandardItem * topitem = chanModel->item(i,0);
|
QStandardItem * topitem = chanModel->item(i,0);
|
||||||
|
|
||||||
@ -639,8 +929,17 @@ bool PreferencesDialog::Save()
|
|||||||
chan.setEnabled(item->checkState() == Qt::Checked ? true : false);
|
chan.setEnabled(item->checkState() == Qt::Checked ? true : false);
|
||||||
chan.setFullname(item->text());
|
chan.setFullname(item->text());
|
||||||
chan.setDefaultColor(QColor(topitem->child(j,1)->data(Qt::UserRole).toUInt()));
|
chan.setDefaultColor(QColor(topitem->child(j,1)->data(Qt::UserRole).toUInt()));
|
||||||
chan.setLabel(topitem->child(j,2)->text());
|
QString ts = topitem->child(j,2)->text();
|
||||||
chan.setDescription(topitem->child(j,3)->text());
|
schema::ChanType type = schema::MINOR_FLAG;
|
||||||
|
for (QHash<schema::ChanType, QString>::iterator it = channeltype.begin(); it!= channeltype.end(); ++it) {
|
||||||
|
if (it.value() == ts) {
|
||||||
|
type = it.key();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
chan.setType(type);
|
||||||
|
chan.setLabel(topitem->child(j,3)->text());
|
||||||
|
chan.setDescription(topitem->child(j,4)->text());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1038,6 +1337,7 @@ void PreferencesDialog::on_chanView_doubleClicked(const QModelIndex &index)
|
|||||||
if (index.column() == 1) {
|
if (index.column() == 1) {
|
||||||
QColorDialog a;
|
QColorDialog a;
|
||||||
|
|
||||||
|
if (!(index.flags() & Qt::ItemIsEnabled)) return;
|
||||||
quint32 color = index.data(Qt::UserRole).toUInt();
|
quint32 color = index.data(Qt::UserRole).toUInt();
|
||||||
|
|
||||||
a.setCurrentColor(QColor((QRgb)color));
|
a.setCurrentColor(QColor((QRgb)color));
|
||||||
@ -1052,3 +1352,8 @@ void PreferencesDialog::on_chanView_doubleClicked(const QModelIndex &index)
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PreferencesDialog::on_waveSearch_textChanged(const QString &arg1)
|
||||||
|
{
|
||||||
|
waveFilterModel->setFilterFixedString(arg1);
|
||||||
|
}
|
||||||
|
@ -100,12 +100,16 @@ class PreferencesDialog : public QDialog
|
|||||||
|
|
||||||
void on_chanView_doubleClicked(const QModelIndex &index);
|
void on_chanView_doubleClicked(const QModelIndex &index);
|
||||||
|
|
||||||
|
void on_waveSearch_textChanged(const QString &arg1);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! \brief Populates the Graph Model view with data from the Daily, Overview & Oximetry gGraphView objects
|
//! \brief Populates the Graph Model view with data from the Daily, Overview & Oximetry gGraphView objects
|
||||||
void resetGraphModel();
|
void resetGraphModel();
|
||||||
void InitChanInfo();
|
void InitChanInfo();
|
||||||
|
void InitWaveInfo();
|
||||||
|
|
||||||
QHash<schema::ChanType, QStandardItem *> toplevel;
|
QHash<MachineType, QStandardItem *> toplevel;
|
||||||
|
QHash<MachineType, QStandardItem *> machlevel;
|
||||||
|
|
||||||
Ui::PreferencesDialog *ui;
|
Ui::PreferencesDialog *ui;
|
||||||
Profile *profile;
|
Profile *profile;
|
||||||
@ -113,11 +117,16 @@ private:
|
|||||||
|
|
||||||
QStringList importLocations;
|
QStringList importLocations;
|
||||||
QStringListModel *importModel;
|
QStringListModel *importModel;
|
||||||
|
|
||||||
MySortFilterProxyModel *graphFilterModel;
|
MySortFilterProxyModel *graphFilterModel;
|
||||||
QStandardItemModel *graphModel;
|
QStandardItemModel *graphModel;
|
||||||
|
|
||||||
MySortFilterProxyModel * chanFilterModel;
|
MySortFilterProxyModel * chanFilterModel;
|
||||||
QStandardItemModel *chanModel;
|
QStandardItemModel *chanModel;
|
||||||
|
|
||||||
|
MySortFilterProxyModel * waveFilterModel;
|
||||||
|
QStandardItemModel *waveModel;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>4</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="importTab">
|
<widget class="QWidget" name="importTab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@ -1163,7 +1163,7 @@ Try to sync it to your PC's clock (which should be synced to a timeserver)</stri
|
|||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="colourTab">
|
<widget class="QWidget" name="colourTab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>C&hannels</string>
|
<string>Events</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
@ -1233,6 +1233,78 @@ Try to sync it to your PC's clock (which should be synced to a timeserver)</stri
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="waveforms">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Waveforms</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>4</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>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_21">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_55">
|
||||||
|
<property name="text">
|
||||||
|
<string>Search</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="waveSearch"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTreeView" name="waveView"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_22">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="resetChannelDefaults_2">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Reset &Defaults</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_56">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p><span style=" font-weight:600;">Warning: </span>Just because you can, does not mean it's good practice.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
<widget class="QWidget" name="graphTab">
|
<widget class="QWidget" name="graphTab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Graphs</string>
|
<string>Graphs</string>
|
||||||
|
@ -91,9 +91,6 @@ win32 {
|
|||||||
# MingW needs this
|
# MingW needs this
|
||||||
LIBS += -lz
|
LIBS += -lz
|
||||||
}
|
}
|
||||||
|
|
||||||
QT += serialport
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include(3rdparty/quazip-0.5.1/quazip/quazip.pri)
|
#include(3rdparty/quazip-0.5.1/quazip/quazip.pri)
|
||||||
@ -286,30 +283,42 @@ mac {
|
|||||||
QMAKE_BUNDLE_DATA += TransFiles
|
QMAKE_BUNDLE_DATA += TransFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
bundlelibs = $$cat($$PWD/../Bundle3rdParty)
|
|
||||||
|
|
||||||
contains(bundlelibs, true) {
|
|
||||||
include(../3rdparty/quazip/quazip/quazip.pri)
|
|
||||||
INCLUDEPATH += $$PWD/../3rdparty/quazip
|
|
||||||
DEPENDPATH += $$PWD/../3rdparty/quazip
|
|
||||||
|
|
||||||
!win32 {
|
!win32 {
|
||||||
include(../3rdparty/qtserialport/src/serialport/serialport-lib.pri)
|
include(../3rdparty/qtserialport/src/serialport/serialport-lib.pri)
|
||||||
INCLUDEPATH += $$PWD/../3rdparty/qtserialport/include/QtSerialPort/5.3.1/QtSerialPort
|
INCLUDEPATH += $$PWD/../3rdparty/qtserialport/include/QtSerialPort/5.3.1/QtSerialPort
|
||||||
DEPENDPATH += $$PWD/../3rdparty/qtserialport/include/QtSerialPort/5.3.1/QtSerialPort
|
DEPENDPATH += $$PWD/../3rdparty/qtserialport/include/QtSerialPort/5.3.1/QtSerialPort
|
||||||
# DEPENDPATH += $$PWD/../3rdparty/qtserialport/src/serialport/include/QtSerialPort/5.3.1
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
unix {
|
QT += serialport
|
||||||
message("Attempting to build with system quazip.");
|
|
||||||
QMAKE_LFLAGS += -L/usr/lib -L/usr/local/lib
|
|
||||||
INCLUDEPATH += /usr/local/include
|
|
||||||
INCLUDEPATH += /usr/include
|
|
||||||
DEPENDPATH += /usr/local/include/quazip
|
|
||||||
DEPENDPATH += /usr/include/quazip
|
|
||||||
} else {
|
|
||||||
#Configure it if you need it...
|
|
||||||
warning("Building with externally linked quazip is unsupported on this platform");
|
|
||||||
}
|
|
||||||
LIBS += -lquazip
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
include(../3rdparty/quazip/quazip/quazip.pri)
|
||||||
|
INCLUDEPATH += $$PWD/../3rdparty/quazip
|
||||||
|
DEPENDPATH += $$PWD/../3rdparty/quazip
|
||||||
|
|
||||||
|
#bundlelibs = $$cat($$PWD/../Bundle3rdParty)
|
||||||
|
|
||||||
|
#contains(bundlelibs, true) {
|
||||||
|
# include(../3rdparty/quazip/quazip/quazip.pri)
|
||||||
|
# INCLUDEPATH += $$PWD/../3rdparty/quazip
|
||||||
|
# DEPENDPATH += $$PWD/../3rdparty/quazip
|
||||||
|
|
||||||
|
# !win32 {
|
||||||
|
# include(../3rdparty/qtserialport/src/serialport/serialport-lib.pri)
|
||||||
|
# INCLUDEPATH += $$PWD/../3rdparty/qtserialport/include/QtSerialPort/5.3.1/QtSerialPort
|
||||||
|
# DEPENDPATH += $$PWD/../3rdparty/qtserialport/include/QtSerialPort/5.3.1/QtSerialPort
|
||||||
|
# # DEPENDPATH += $$PWD/../3rdparty/qtserialport/src/serialport/include/QtSerialPort/5.3.1
|
||||||
|
# }
|
||||||
|
#} else {
|
||||||
|
# unix {
|
||||||
|
# message("Attempting to build with system quazip.");
|
||||||
|
# QMAKE_LFLAGS += -L/usr/lib -L/usr/local/lib
|
||||||
|
# INCLUDEPATH += /usr/local/include
|
||||||
|
# INCLUDEPATH += /usr/include
|
||||||
|
# DEPENDPATH += /usr/local/include/quazip
|
||||||
|
# DEPENDPATH += /usr/include/quazip
|
||||||
|
# } else {
|
||||||
|
# #Configure it if you need it...
|
||||||
|
# warning("Building with externally linked quazip is unsupported on this platform");
|
||||||
|
# }
|
||||||
|
# LIBS += -lquazip
|
||||||
|
#}
|
||||||
|
Loading…
Reference in New Issue
Block a user