mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 10:40:42 +00:00
Remove old Graph Tab in Preferences
This commit is contained in:
parent
76d8ce1052
commit
4f53a7312f
@ -333,6 +333,9 @@ void gGraph::paint(QPainter &painter, const QRegion ®ion)
|
|||||||
QString t = name().section(";", -1);
|
QString t = name().section(";", -1);
|
||||||
|
|
||||||
painter.drawText(m_rect, Qt::AlignHCenter | Qt::AlignTop, QObject::tr("Snapshot %1").arg(t));
|
painter.drawText(m_rect, Qt::AlignHCenter | Qt::AlignTop, QObject::tr("Snapshot %1").arg(t));
|
||||||
|
if (isPinned()) {
|
||||||
|
painter.drawPixmap(-5, originY-10, m_graphview->pin_icon);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -691,6 +694,14 @@ void gGraph::mouseMoveEvent(QMouseEvent *event)
|
|||||||
|
|
||||||
bool doredraw = false;
|
bool doredraw = false;
|
||||||
|
|
||||||
|
if (isSnapshot() && (x> m_graphview->titleWidth)) {
|
||||||
|
// this nag might be a little too much..
|
||||||
|
ToolTip(tr("Snapshot"),x+15,y, TT_AlignLeft);
|
||||||
|
timedRedraw(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < m_layers.size(); i++) {
|
for (int i = 0; i < m_layers.size(); i++) {
|
||||||
if (m_layers[i]->m_rect.contains(x, y))
|
if (m_layers[i]->m_rect.contains(x, y))
|
||||||
if (m_layers[i]->mouseMoveEvent(event, this)) {
|
if (m_layers[i]->mouseMoveEvent(event, this)) {
|
||||||
|
@ -272,15 +272,6 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Profile *_profile) :
|
|||||||
shortformat.replace("yy","yyyy");
|
shortformat.replace("yy","yyyy");
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
graphFilterModel = new MySortFilterProxyModel(this);
|
|
||||||
graphModel = new QStandardItemModel(this);
|
|
||||||
graphFilterModel->setSourceModel(graphModel);
|
|
||||||
graphFilterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
|
||||||
graphFilterModel->setFilterKeyColumn(0);
|
|
||||||
ui->graphView->setModel(graphFilterModel);
|
|
||||||
|
|
||||||
resetGraphModel();
|
|
||||||
|
|
||||||
chanFilterModel = new MySortFilterProxyModel(this);
|
chanFilterModel = new MySortFilterProxyModel(this);
|
||||||
chanModel = new QStandardItemModel(this);
|
chanModel = new QStandardItemModel(this);
|
||||||
chanFilterModel->setSourceModel(chanModel);
|
chanFilterModel->setSourceModel(chanModel);
|
||||||
@ -646,8 +637,6 @@ void PreferencesDialog::InitWaveInfo()
|
|||||||
|
|
||||||
PreferencesDialog::~PreferencesDialog()
|
PreferencesDialog::~PreferencesDialog()
|
||||||
{
|
{
|
||||||
disconnect(graphModel, SIGNAL(itemChanged(QStandardItem *)), this,
|
|
||||||
SLOT(graphModel_changed(QStandardItem *)));
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -997,12 +986,6 @@ void PreferencesDialog::on_graphView_activated(const QModelIndex &index)
|
|||||||
qDebug() << "Could do something here with" << a;
|
qDebug() << "Could do something here with" << a;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::on_graphFilter_textChanged(const QString &arg1)
|
|
||||||
{
|
|
||||||
graphFilterModel->setFilterFixedString(arg1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
MySortFilterProxyModel::MySortFilterProxyModel(QObject *parent)
|
MySortFilterProxyModel::MySortFilterProxyModel(QObject *parent)
|
||||||
: QSortFilterProxyModel(parent)
|
: QSortFilterProxyModel(parent)
|
||||||
{
|
{
|
||||||
@ -1021,211 +1004,47 @@ bool MySortFilterProxyModel::filterAcceptsRow(int source_row,
|
|||||||
return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
|
return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::graphModel_changed(QStandardItem *item)
|
|
||||||
{
|
|
||||||
QModelIndex index = item->index();
|
|
||||||
|
|
||||||
gGraphView *gv = nullptr;
|
//void PreferencesDialog::on_resetGraphButton_clicked()
|
||||||
bool ok;
|
//{
|
||||||
|
// QString title = tr("Confirmation");
|
||||||
|
// QString text = tr("Are you sure you want to reset your graph preferences to the defaults?");
|
||||||
|
// StandardButtons buttons = QMessageBox::Yes | QMessageBox::No;
|
||||||
|
// StandardButton defaultButton = QMessageBox::No;
|
||||||
|
|
||||||
const QModelIndex &row = index.sibling(index.row(), 0);
|
// // Display confirmation dialog.
|
||||||
bool checked = row.data(Qt::CheckStateRole) != 0;
|
// StandardButton choice = QMessageBox::question(this, title, text, buttons, defaultButton);
|
||||||
//QString name=row.data().toString();
|
|
||||||
|
|
||||||
int group = row.data(Qt::UserRole + 1).toInt();
|
// if (choice == QMessageBox::No) {
|
||||||
int id = row.data(Qt::UserRole + 2).toInt();
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
switch (group) {
|
// gGraphView *views[3] = {0};
|
||||||
case 0:
|
// views[0] = mainwin->getDaily()->graphView();
|
||||||
gv = mainwin->getDaily()->graphView();
|
// views[1] = mainwin->getOverview()->graphView();
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
// // Iterate over all graph containers.
|
||||||
gv = mainwin->getOverview()->graphView();
|
// for (unsigned j = 0; j < 3; j++) {
|
||||||
break;
|
// gGraphView *view = views[j];
|
||||||
|
|
||||||
default:
|
// if (!view) {
|
||||||
;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (!gv) {
|
// // Iterate over all contained graphs.
|
||||||
return;
|
// for (int i = 0; i < view->size(); i++) {
|
||||||
}
|
// gGraph *g = (*view)[i];
|
||||||
|
// g->setRecMaxY(0); // FIXME: should be g->reset(), but need other patches to land.
|
||||||
|
// g->setRecMinY(0);
|
||||||
|
// g->setVisible(true);
|
||||||
|
// }
|
||||||
|
|
||||||
gGraph *graph = (*gv)[id];
|
// view->updateScale();
|
||||||
|
// }
|
||||||
|
|
||||||
if (!graph) {
|
// resetGraphModel();
|
||||||
return;
|
// ui->graphView->update();
|
||||||
}
|
//}
|
||||||
|
|
||||||
if (graph->visible() != checked) {
|
|
||||||
graph->setVisible(checked);
|
|
||||||
}
|
|
||||||
|
|
||||||
EventDataType val;
|
|
||||||
|
|
||||||
if (index.column() == 1) {
|
|
||||||
val = index.data().toDouble(&ok);
|
|
||||||
|
|
||||||
if (!ok) {
|
|
||||||
graphModel->setData(index, QString::number(graph->rec_miny, 'f', 1));
|
|
||||||
ui->graphView->update();
|
|
||||||
} else {
|
|
||||||
//if ((val < graph->rec_maxy) || (val==0)) {
|
|
||||||
graph->setRecMinY(val);
|
|
||||||
/*} else {
|
|
||||||
graphModel->setData(index,QString::number(graph->rec_miny,'f',1));
|
|
||||||
ui->graphView->update();
|
|
||||||
} */
|
|
||||||
}
|
|
||||||
} else if (index.column() == 2) {
|
|
||||||
val = index.data().toDouble(&ok);
|
|
||||||
|
|
||||||
if (!ok) {
|
|
||||||
graphModel->setData(index, QString::number(graph->rec_maxy, 'f', 1));
|
|
||||||
ui->graphView->update();
|
|
||||||
} else {
|
|
||||||
//if ((val > graph->rec_miny) || (val==0)) {
|
|
||||||
graph->setRecMaxY(val);
|
|
||||||
/*} else {
|
|
||||||
graphModel->setData(index,QString::number(graph->rec_maxy,'f',1));
|
|
||||||
ui->graphView->update();
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
gv->updateScale();
|
|
||||||
// qDebug() << name << checked;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PreferencesDialog::resetGraphModel()
|
|
||||||
{
|
|
||||||
|
|
||||||
graphModel->clear();
|
|
||||||
QStandardItem *daily = new QStandardItem(tr("Daily Graphs"));
|
|
||||||
QStandardItem *overview = new QStandardItem(tr("Overview Graphs"));
|
|
||||||
daily->setEditable(false);
|
|
||||||
overview->setEditable(false);
|
|
||||||
|
|
||||||
graphModel->appendRow(daily);
|
|
||||||
graphModel->appendRow(overview);
|
|
||||||
|
|
||||||
ui->graphView->setAlternatingRowColors(true);
|
|
||||||
|
|
||||||
// ui->graphView->setFirstColumnSpanned(0,daily->index(),true); // Crashes on windows.. Why do I need this again?
|
|
||||||
graphModel->setColumnCount(3);
|
|
||||||
QStringList headers;
|
|
||||||
headers.append(tr("Graph"));
|
|
||||||
headers.append(STR_TR_Min);
|
|
||||||
headers.append(STR_TR_Max);
|
|
||||||
graphModel->setHorizontalHeaderLabels(headers);
|
|
||||||
ui->graphView->setColumnWidth(0, 250);
|
|
||||||
ui->graphView->setColumnWidth(1, 50);
|
|
||||||
ui->graphView->setColumnWidth(2, 50);
|
|
||||||
|
|
||||||
gGraphView *gv = mainwin->getDaily()->graphView();
|
|
||||||
|
|
||||||
for (int i = 0; i < gv->size(); i++) {
|
|
||||||
QList<QStandardItem *> items;
|
|
||||||
QString title = (*gv)[i]->title();
|
|
||||||
QStandardItem *it = new QStandardItem(title);
|
|
||||||
it->setCheckable(true);
|
|
||||||
it->setCheckState((*gv)[i]->visible() ? Qt::Checked : Qt::Unchecked);
|
|
||||||
it->setEditable(false);
|
|
||||||
it->setData(0, Qt::UserRole + 1);
|
|
||||||
it->setData(i, Qt::UserRole + 2);
|
|
||||||
items.push_back(it);
|
|
||||||
|
|
||||||
if (title != STR_TR_EventFlags) {
|
|
||||||
|
|
||||||
it = new QStandardItem(QString::number((*gv)[i]->rec_miny, 'f', 1));
|
|
||||||
it->setEditable(true);
|
|
||||||
items.push_back(it);
|
|
||||||
|
|
||||||
it = new QStandardItem(QString::number((*gv)[i]->rec_maxy, 'f', 1));
|
|
||||||
it->setEditable(true);
|
|
||||||
items.push_back(it);
|
|
||||||
} else {
|
|
||||||
it = new QStandardItem(tr("N/A")); // not applicable.
|
|
||||||
it->setEditable(false);
|
|
||||||
items.push_back(it);
|
|
||||||
items.push_back(it->clone());
|
|
||||||
}
|
|
||||||
|
|
||||||
daily->insertRow(i, items);
|
|
||||||
}
|
|
||||||
|
|
||||||
gv = mainwin->getOverview()->graphView();
|
|
||||||
|
|
||||||
for (int i = 0; i < gv->size(); i++) {
|
|
||||||
QList<QStandardItem *> items;
|
|
||||||
QStandardItem *it = new QStandardItem((*gv)[i]->title());
|
|
||||||
it->setCheckable(true);
|
|
||||||
it->setCheckState((*gv)[i]->visible() ? Qt::Checked : Qt::Unchecked);
|
|
||||||
it->setEditable(false);
|
|
||||||
items.push_back(it);
|
|
||||||
it->setData(1, Qt::UserRole + 1);
|
|
||||||
it->setData(i, Qt::UserRole + 2);
|
|
||||||
|
|
||||||
it = new QStandardItem(QString::number((*gv)[i]->rec_miny, 'f', 1));
|
|
||||||
it->setEditable(true);
|
|
||||||
items.push_back(it);
|
|
||||||
|
|
||||||
it = new QStandardItem(QString::number((*gv)[i]->rec_maxy, 'f', 1));
|
|
||||||
it->setEditable(true);
|
|
||||||
items.push_back(it);
|
|
||||||
|
|
||||||
overview->insertRow(i, items);
|
|
||||||
}
|
|
||||||
|
|
||||||
connect(graphModel, SIGNAL(itemChanged(QStandardItem *)), this,
|
|
||||||
SLOT(graphModel_changed(QStandardItem *)));
|
|
||||||
|
|
||||||
ui->graphView->expandAll();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void PreferencesDialog::on_resetGraphButton_clicked()
|
|
||||||
{
|
|
||||||
QString title = tr("Confirmation");
|
|
||||||
QString text = tr("Are you sure you want to reset your graph preferences to the defaults?");
|
|
||||||
StandardButtons buttons = QMessageBox::Yes | QMessageBox::No;
|
|
||||||
StandardButton defaultButton = QMessageBox::No;
|
|
||||||
|
|
||||||
// Display confirmation dialog.
|
|
||||||
StandardButton choice = QMessageBox::question(this, title, text, buttons, defaultButton);
|
|
||||||
|
|
||||||
if (choice == QMessageBox::No) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gGraphView *views[3] = {0};
|
|
||||||
views[0] = mainwin->getDaily()->graphView();
|
|
||||||
views[1] = mainwin->getOverview()->graphView();
|
|
||||||
|
|
||||||
// Iterate over all graph containers.
|
|
||||||
for (unsigned j = 0; j < 3; j++) {
|
|
||||||
gGraphView *view = views[j];
|
|
||||||
|
|
||||||
if (!view) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Iterate over all contained graphs.
|
|
||||||
for (int i = 0; i < view->size(); i++) {
|
|
||||||
gGraph *g = (*view)[i];
|
|
||||||
g->setRecMaxY(0); // FIXME: should be g->reset(), but need other patches to land.
|
|
||||||
g->setRecMinY(0);
|
|
||||||
g->setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
view->updateScale();
|
|
||||||
}
|
|
||||||
|
|
||||||
resetGraphModel();
|
|
||||||
ui->graphView->update();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*void PreferencesDialog::on_genOpWidget_itemActivated(QListWidgetItem *item)
|
/*void PreferencesDialog::on_genOpWidget_itemActivated(QListWidgetItem *item)
|
||||||
{
|
{
|
||||||
|
@ -74,12 +74,6 @@ class PreferencesDialog : public QDialog
|
|||||||
|
|
||||||
void on_graphView_activated(const QModelIndex &index);
|
void on_graphView_activated(const QModelIndex &index);
|
||||||
|
|
||||||
void on_graphFilter_textChanged(const QString &arg1);
|
|
||||||
|
|
||||||
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);
|
void on_maskTypeCombo_activated(int index);
|
||||||
@ -103,8 +97,6 @@ class PreferencesDialog : public QDialog
|
|||||||
void on_waveSearch_textChanged(const QString &arg1);
|
void on_waveSearch_textChanged(const QString &arg1);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! \brief Populates the Graph Model view with data from the Daily, Overview & Oximetry gGraphView objects
|
|
||||||
void resetGraphModel();
|
|
||||||
void InitChanInfo();
|
void InitChanInfo();
|
||||||
void InitWaveInfo();
|
void InitWaveInfo();
|
||||||
|
|
||||||
@ -118,9 +110,6 @@ private:
|
|||||||
QStringList importLocations;
|
QStringList importLocations;
|
||||||
QStringListModel *importModel;
|
QStringListModel *importModel;
|
||||||
|
|
||||||
MySortFilterProxyModel *graphFilterModel;
|
|
||||||
QStandardItemModel *graphModel;
|
|
||||||
|
|
||||||
MySortFilterProxyModel * chanFilterModel;
|
MySortFilterProxyModel * chanFilterModel;
|
||||||
QStandardItemModel *chanModel;
|
QStandardItemModel *chanModel;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>7</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="importTab">
|
<widget class="QWidget" name="importTab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@ -1305,90 +1305,6 @@ 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="graphTab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Graphs</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
|
||||||
<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>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_8">
|
|
||||||
<property name="text">
|
|
||||||
<string>Search</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="graphFilter">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Filters the graph list. Simply start typing the name of the graph your looking for.</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QTreeView" name="graphView"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="widget_3" native="true">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="resetGraphButton">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Reset &Defaults</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_9">
|
|
||||||
<property name="text">
|
|
||||||
<string>Double click on the (Y-axis) min/max values to edit them</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="oximetryTab">
|
<widget class="QWidget" name="oximetryTab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>&Oximetry</string>
|
<string>&Oximetry</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user