diff --git a/Software/PC_Application/Traces/tracemarker.cpp b/Software/PC_Application/Traces/tracemarker.cpp index 20307bb..42f0087 100644 --- a/Software/PC_Application/Traces/tracemarker.cpp +++ b/Software/PC_Application/Traces/tracemarker.cpp @@ -11,7 +11,7 @@ using namespace std; TraceMarker::TraceMarker(TraceMarkerModel *model, int number, TraceMarker *parent, QString descr) - : editingFrequeny(false), + : editingFrequency(false), model(model), parentTrace(nullptr), position(1000000000), diff --git a/Software/PC_Application/Traces/tracemarker.h b/Software/PC_Application/Traces/tracemarker.h index 3ec7f23..f41d191 100644 --- a/Software/PC_Application/Traces/tracemarker.h +++ b/Software/PC_Application/Traces/tracemarker.h @@ -33,7 +33,7 @@ public: int getNumber() const; void setNumber(int value); - bool editingFrequeny; + bool editingFrequency; Trace *getTrace() const; enum class Type { diff --git a/Software/PC_Application/Traces/tracemarkermodel.cpp b/Software/PC_Application/Traces/tracemarkermodel.cpp index 45a7779..bb5bf32 100644 --- a/Software/PC_Application/Traces/tracemarkermodel.cpp +++ b/Software/PC_Application/Traces/tracemarkermodel.cpp @@ -88,11 +88,15 @@ void TraceMarkerModel::addMarker(TraceMarker *t) connect(t, &TraceMarker::beginRemoveHelperMarkers, [=](TraceMarker *m) { auto row = find(markers.begin(), markers.end(), m) - markers.begin(); auto modelIndex = createIndex(row, 0, root); - beginRemoveRows(modelIndex, 0, m->getHelperMarkers().size() - 1); + if(!m->getHelperMarkers().empty()){ + beginRemoveRows(modelIndex, 0, m->getHelperMarkers().size() - 1); + } }); connect(t, &TraceMarker::endRemoveHelperMarkers, [=](TraceMarker *m) { markerDataChanged(m); - endRemoveRows(); + if(!m->getHelperMarkers().empty()){ + endRemoveRows(); + } }); connect(t, &TraceMarker::deleted, this, qOverload(&TraceMarkerModel::removeMarker)); emit markerAdded(t); @@ -118,7 +122,7 @@ void TraceMarkerModel::removeMarker(TraceMarker *m) void TraceMarkerModel::markerDataChanged(TraceMarker *m) { auto row = find(markers.begin(), markers.end(), m) - markers.begin(); - if(m->editingFrequeny) { + if(m->editingFrequency) { // only update the other columns, do not override editor data emit dataChanged(index(row, ColIndexData), index(row, ColIndexData)); } else { @@ -373,14 +377,14 @@ QSize MarkerSettingsDelegate::sizeHint(const QStyleOptionViewItem &, const QMode QWidget *MarkerSettingsDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &index) const { auto marker = static_cast(index.model())->markerFromIndex(index); - marker->editingFrequeny = true; + marker->editingFrequency = true; auto e = marker->getSettingsEditor(); if(e) { e->setMaximumHeight(rowHeight); e->setParent(parent); connect(e, &SIUnitEdit::valueUpdated, this, &MarkerSettingsDelegate::commitData); connect(e, &SIUnitEdit::focusLost, [=](){ - marker->editingFrequeny = false; + marker->editingFrequency = false; }); } return e; diff --git a/Software/PC_Application/appwindow.cpp b/Software/PC_Application/appwindow.cpp index ccee4f9..e6d0a0d 100644 --- a/Software/PC_Application/appwindow.cpp +++ b/Software/PC_Application/appwindow.cpp @@ -277,30 +277,21 @@ void AppWindow::CreateToolbars() { // Reference toolbar auto tb_reference = new QToolBar("Reference", this); - tb_reference->addWidget(new QLabel("Ref:")); + tb_reference->addWidget(new QLabel("Ref in:")); toolbars.reference.type = new QComboBox(); toolbars.reference.type->addItem("Int"); toolbars.reference.type->addItem("Ext"); - toolbars.reference.automatic = new QCheckBox("Auto"); - connect(toolbars.reference.automatic, &QCheckBox::clicked, [this](bool checked) { - toolbars.reference.type->setEnabled(!checked); - UpdateReference(); - }); - // toolbars.reference.automatic->setChecked(true); + toolbars.reference.type->addItem("Auto"); tb_reference->addWidget(toolbars.reference.type); - tb_reference->addWidget(toolbars.reference.automatic); tb_reference->addSeparator(); tb_reference->addWidget(new QLabel("Ref out:")); - toolbars.reference.outputEnabled = new QCheckBox(); toolbars.reference.outFreq = new QComboBox(); + toolbars.reference.outFreq->addItem("Off"); toolbars.reference.outFreq->addItem("10 MHz"); toolbars.reference.outFreq->addItem("100 MHz"); - tb_reference->addWidget(toolbars.reference.outputEnabled); tb_reference->addWidget(toolbars.reference.outFreq); connect(toolbars.reference.type, qOverload(&QComboBox::currentIndexChanged), this, &AppWindow::UpdateReference); connect(toolbars.reference.outFreq, qOverload(&QComboBox::currentIndexChanged), this, &AppWindow::UpdateReference); - connect(toolbars.reference.outputEnabled, &QCheckBox::clicked, this, &AppWindow::UpdateReference); - addToolBar(tb_reference); tb_reference->setObjectName("Reference Toolbar"); } @@ -352,22 +343,23 @@ void AppWindow::UpdateReference() return; } Protocol::ReferenceSettings s = {}; - if(toolbars.reference.automatic->isChecked()) { - s.AutomaticSwitch = 1; - } - if(toolbars.reference.type->currentText()=="Ext") { + + QString txt1 = toolbars.reference.type->currentText(); + if( (txt1=="Ext") || (txt1=="External") ) { s.UseExternalRef = 1; } - if(toolbars.reference.outputEnabled->isChecked()) { - switch(toolbars.reference.outFreq->currentIndex()) { - case 0: - s.ExtRefOuputFreq = 10000000; - break; - case 1: - s.ExtRefOuputFreq = 100000000; - break; - } + if( (txt1=="Auto") || (txt1=="Automatic") ) { + s.AutomaticSwitch = 1; } + + QString txt2 = toolbars.reference.outFreq->currentText(); + if(txt2=="10 MHz"){ + s.ExtRefOuputFreq = 10000000; + } + if(txt2=="100 MHz"){ + s.ExtRefOuputFreq = 100000000; + } + Protocol::PacketInfo p; p.type = Protocol::PacketType::Reference; p.reference = s; diff --git a/Software/PC_Application/appwindow.h b/Software/PC_Application/appwindow.h index 4d4beba..aaa96bb 100644 --- a/Software/PC_Application/appwindow.h +++ b/Software/PC_Application/appwindow.h @@ -61,8 +61,6 @@ private: struct { struct { QComboBox *type; - QCheckBox *automatic; - QCheckBox *outputEnabled; QComboBox *outFreq; } reference; } toolbars;