inspect DMX data
This commit is contained in:
parent
cbd362b341
commit
373e6dbda5
|
@ -44,6 +44,13 @@ DeviceWindow::DeviceWindow(QWidget *parent)
|
||||||
if (selected.isValid())
|
if (selected.isValid())
|
||||||
selected.data(Qt::EditRole).value<DmxWidget*>()->close();
|
selected.data(Qt::EditRole).value<DmxWidget*>()->close();
|
||||||
});
|
});
|
||||||
|
connect(ui->actionDMX, &QAction::triggered,
|
||||||
|
this, [this]() {
|
||||||
|
auto selected = ui->widgetView->currentIndex();
|
||||||
|
if (!selected.isValid())
|
||||||
|
return;
|
||||||
|
openDmxWindow(selected);
|
||||||
|
});
|
||||||
connect(ui->actionParameter, &QAction::triggered,
|
connect(ui->actionParameter, &QAction::triggered,
|
||||||
this, [this]() {
|
this, [this]() {
|
||||||
auto selected = ui->widgetView->currentIndex();
|
auto selected = ui->widgetView->currentIndex();
|
||||||
|
@ -90,6 +97,7 @@ DeviceWindow::DeviceWindow(QWidget *parent)
|
||||||
|
|
||||||
DeviceWindow::~DeviceWindow()
|
DeviceWindow::~DeviceWindow()
|
||||||
{
|
{
|
||||||
|
qDeleteAll(inspectors_);
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,3 +129,27 @@ void DeviceWindow::selectionChanged(const QModelIndex ¤t, const QModelInde
|
||||||
ui->actionFirmware->setEnabled(false);
|
ui->actionFirmware->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief DeviceWindow::openDmxWindow
|
||||||
|
* @param index
|
||||||
|
*/
|
||||||
|
void DeviceWindow::openDmxWindow(const QModelIndex &index)
|
||||||
|
{
|
||||||
|
auto wdgt = index.data(Qt::EditRole).value<std::shared_ptr<DmxWidget>>();
|
||||||
|
auto univ = std::static_pointer_cast<DMX::Universe>(wdgt);
|
||||||
|
|
||||||
|
foreach (const auto & inspector, inspectors_)
|
||||||
|
if (inspector->universe() == univ)
|
||||||
|
return inspector->show();
|
||||||
|
auto view = new UniverseWindow(nullptr, univ);
|
||||||
|
inspectors_.insert(view);
|
||||||
|
connect(view, &QObject::destroyed, this, [this, view]() {
|
||||||
|
inspectors_.remove(view);
|
||||||
|
});
|
||||||
|
view->setWindowTitle(QString("%1 '%2'").arg(
|
||||||
|
wdgt->isEditable() ? tr("Editing") : tr("Viewing"),
|
||||||
|
wdgt->portName()));
|
||||||
|
view->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
view->show();
|
||||||
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
#include <universewindow.h>
|
||||||
#include <widgetmodel.h>
|
#include <widgetmodel.h>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
@ -18,10 +19,12 @@ public:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void selectionChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
void selectionChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
||||||
|
void openDmxWindow(const QModelIndex &index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::DeviceWindow *ui;
|
Ui::DeviceWindow *ui;
|
||||||
WidgetModel *model;
|
WidgetModel *model;
|
||||||
QSortFilterProxyModel *sortProxy;
|
QSortFilterProxyModel *sortProxy;
|
||||||
|
QSet<UniverseWindow*> inspectors_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user