new dialog for altering tx parameters
This commit is contained in:
parent
5f331f262e
commit
2c394a1bc7
|
@ -14,6 +14,9 @@ target_sources(${PROJECT_NAME}
|
|||
devicewindow.h
|
||||
devicewindow.ui
|
||||
main.cpp
|
||||
metadatadialog.h
|
||||
metadatadialog.cpp
|
||||
metadatadialog.ui
|
||||
widgetexplorer.cpp
|
||||
widgetexplorer.h
|
||||
)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "devicewindow.h"
|
||||
#include "metadatadialog.h"
|
||||
#include "ui_devicewindow.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
@ -20,6 +21,15 @@ DeviceWindow::DeviceWindow(QWidget *parent)
|
|||
ui->widgetView->setSortingEnabled(true);
|
||||
ui->widgetView->sortByColumn(WidgetModel::Column::PortName, Qt::SortOrder::AscendingOrder);
|
||||
|
||||
// model connections
|
||||
connect(ui->actionParameter, &QAction::triggered,
|
||||
this, [this]() {
|
||||
auto selected = ui->widgetView->currentIndex();
|
||||
if (!selected.isValid())
|
||||
return;
|
||||
MetadataDialog dlg(selected.data(Qt::EditRole).value<DmxWidget*>(), this);
|
||||
dlg.exec();
|
||||
});
|
||||
// action connections
|
||||
connect(ui->actionAbout, &QAction::triggered,
|
||||
this, [this](){
|
||||
|
|
47
example/widgetExplorer/metadatadialog.cpp
Normal file
47
example/widgetExplorer/metadatadialog.cpp
Normal file
|
@ -0,0 +1,47 @@
|
|||
#include "metadatadialog.h"
|
||||
#include "ui_metadatadialog.h"
|
||||
#include <pro.h>
|
||||
#include <QPushButton>
|
||||
|
||||
MetadataDialog::MetadataDialog(DmxWidget *device, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::MetadataDialog)
|
||||
, dev(device)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->breakSpinBox->setSingleStep(ENTTEC::Pro::DMX_BREAK_INTERVAL);
|
||||
ui->breakSpinBox->setMinimum(ENTTEC::Pro::DMX_BREAK_INTERVAL * ENTTEC::Pro::DMX_BREAK_MIN);
|
||||
ui->breakSpinBox->setMaximum(ENTTEC::Pro::DMX_BREAK_INTERVAL * ENTTEC::Pro::DMX_BREAK_MAX);
|
||||
ui->breakSpinBox->setValue(device->txBreakTime());
|
||||
|
||||
ui->mabSpinBox->setSingleStep(ENTTEC::Pro::DMX_MAB_INTERVAL);
|
||||
ui->mabSpinBox->setMinimum(ENTTEC::Pro::DMX_MAB_INTERVAL * ENTTEC::Pro::DMX_MAB_MIN);
|
||||
ui->mabSpinBox->setMaximum(ENTTEC::Pro::DMX_MAB_INTERVAL * ENTTEC::Pro::DMX_MAB_MAX);
|
||||
ui->mabSpinBox->setValue(device->txMabTime());
|
||||
|
||||
ui->rateSpinBox->setSingleStep(1);
|
||||
ui->rateSpinBox->setMinimum(0); // zero rate for fastest tx possible
|
||||
ui->rateSpinBox->setMaximum(ENTTEC::Pro::DMX_RATE_MAX);
|
||||
ui->rateSpinBox->setValue(device->txRate());
|
||||
|
||||
connect(ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked,
|
||||
this, [this](){
|
||||
ui->breakSpinBox->setValue(17 * ENTTEC::Pro::DMX_BREAK_INTERVAL); // match OEM
|
||||
ui->mabSpinBox->setValue(10 * ENTTEC::Pro::DMX_MAB_INTERVAL); // match OEM
|
||||
ui->rateSpinBox->setValue(40); // match OEM
|
||||
});
|
||||
|
||||
connect(this, &QDialog::accepted, this, [this](){
|
||||
dev->setTxBreakTime(ui->breakSpinBox->value());
|
||||
dev->setTxMabTime(ui->mabSpinBox->value());
|
||||
dev->setTxRate(ui->rateSpinBox->value());
|
||||
dev->setParameters();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
MetadataDialog::~MetadataDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
22
example/widgetExplorer/metadatadialog.h
Normal file
22
example/widgetExplorer/metadatadialog.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include <dmxwidget.h>
|
||||
|
||||
namespace Ui {
|
||||
class MetadataDialog;
|
||||
}
|
||||
|
||||
class MetadataDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MetadataDialog(DmxWidget *device, QWidget *parent = nullptr);
|
||||
~MetadataDialog();
|
||||
|
||||
private:
|
||||
Ui::MetadataDialog *ui;
|
||||
DmxWidget * dev;
|
||||
};
|
||||
|
130
example/widgetExplorer/metadatadialog.ui
Normal file
130
example/widgetExplorer/metadatadialog.ui
Normal file
|
@ -0,0 +1,130 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MetadataDialog</class>
|
||||
<widget class="QDialog" name="MetadataDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>467</width>
|
||||
<height>151</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="breakSpinBox">
|
||||
<property name="toolTip">
|
||||
<string>The BREAK generated by a transmitter is defined as a mark-to-space transition followed by a low of this duration, followed by a low to high transition.</string>
|
||||
</property>
|
||||
<property name="correctionMode">
|
||||
<enum>QAbstractSpinBox::CorrectToNearestValue</enum>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> μs</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>10.670000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelMAB">
|
||||
<property name="toolTip">
|
||||
<string>The MARK separating the BREAK and the START Code</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>MAB Time</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="mabSpinBox">
|
||||
<property name="toolTip">
|
||||
<string>The MARK separating the BREAK and the START Code</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> μs</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelRate">
|
||||
<property name="text">
|
||||
<string>Rate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="rateSpinBox">
|
||||
<property name="suffix">
|
||||
<string> fps</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::RestoreDefaults</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelBreak">
|
||||
<property name="toolTip">
|
||||
<string>The BREAK indicates the start of a new packet.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Break Time</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>MetadataDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>MetadataDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Loading…
Reference in New Issue
Block a user