move the universe data viewer to the platform library
This commit is contained in:
parent
b18823a009
commit
67e84624ee
|
@ -22,9 +22,6 @@ target_sources(${PROJECT_NAME}
|
||||||
multiversewindow.ui
|
multiversewindow.ui
|
||||||
sacnexplorer.h
|
sacnexplorer.h
|
||||||
sacnexplorer.cpp
|
sacnexplorer.cpp
|
||||||
universewindow.h
|
|
||||||
universewindow.cpp
|
|
||||||
universewindow.ui
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME}
|
target_link_libraries(${PROJECT_NAME}
|
||||||
|
|
|
@ -281,12 +281,16 @@ void MultiverseWindow::openUniverseEditor(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
auto univ = data.value<QSacnUniverse*>();
|
auto univ = data.value<QSacnUniverse*>();
|
||||||
foreach (const auto & inspector, mInspectors)
|
foreach (const auto & inspector, mInspectors)
|
||||||
if (inspector->universe() == univ)
|
if (inspector->universe() == univ->get())
|
||||||
return inspector->show();
|
return inspector->show();
|
||||||
auto view = new UniverseWindow(nullptr, univ);
|
auto view = new UniverseWindow(nullptr, univ->get());
|
||||||
mInspectors.insert(view);
|
mInspectors.insert(view);
|
||||||
connect(view, &QObject::destroyed, this, [this, view](){mInspectors.remove(view);});
|
connect(view, &QObject::destroyed, this, [this, view](){mInspectors.remove(view);});
|
||||||
connect(univ, &QObject::destroyed, view, &QMainWindow::close);
|
connect(univ, &QObject::destroyed, view, &QMainWindow::close);
|
||||||
|
view->setWindowTitle(QString("%1 '%2' : "+tr("Universe")+" %3").arg(
|
||||||
|
univ->isEditable() ? tr("Editing") : tr("Viewing"),
|
||||||
|
univ->sourceName(),
|
||||||
|
QString::number(univ->number())));
|
||||||
view->setAttribute(Qt::WA_DeleteOnClose, true);
|
view->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
view->show();
|
view->show();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "multiversemodel.h"
|
#include "multiversemodel.h"
|
||||||
#include "qsacnnode.h"
|
#include <qsacnnode.h>
|
||||||
#include "universewindow.h"
|
#include <universewindow.h>
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "qsacnuniverse.h"
|
|
||||||
#include <QMainWindow>
|
|
||||||
#include <QSpinBox>
|
|
||||||
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
namespace Ui {
|
|
||||||
class UniverseWindow;
|
|
||||||
}
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
class UniverseWindow
|
|
||||||
: public QMainWindow
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit UniverseWindow(QWidget *parent = nullptr,
|
|
||||||
QSacnUniverse* universe = nullptr);
|
|
||||||
virtual ~UniverseWindow();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief universe
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
QSacnUniverse * universe() { return mUniverse; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::UniverseWindow *ui;
|
|
||||||
QSpinBox *prioritySpinBox;
|
|
||||||
QSacnUniverse *mUniverse;
|
|
||||||
|
|
||||||
void update_status_();
|
|
||||||
};
|
|
|
@ -12,6 +12,7 @@ target_sources(${PROJECT_NAME}
|
||||||
qsacnuniverse.h
|
qsacnuniverse.h
|
||||||
universemodel.h
|
universemodel.h
|
||||||
universestatuswidget.h
|
universestatuswidget.h
|
||||||
|
universewindow.h
|
||||||
PRIVATE
|
PRIVATE
|
||||||
multiverseitem.h
|
multiverseitem.h
|
||||||
multiverseitem.cpp
|
multiverseitem.cpp
|
||||||
|
@ -21,6 +22,8 @@ target_sources(${PROJECT_NAME}
|
||||||
qsacnuniverse.cpp
|
qsacnuniverse.cpp
|
||||||
universemodel.cpp
|
universemodel.cpp
|
||||||
universestatuswidget.cpp
|
universestatuswidget.cpp
|
||||||
|
universewindow.cpp
|
||||||
|
universewindow.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME}
|
target_link_libraries(${PROJECT_NAME}
|
||||||
|
|
|
@ -1,3 +1,26 @@
|
||||||
|
/*
|
||||||
|
universewindow.h
|
||||||
|
|
||||||
|
Copyright (c) 2022 Kevin Matz (kevin.matz@gmail.com)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
*/
|
||||||
#include "universewindow.h"
|
#include "universewindow.h"
|
||||||
#include "ui_universewindow.h"
|
#include "ui_universewindow.h"
|
||||||
#include "universemodel.h"
|
#include "universemodel.h"
|
||||||
|
@ -12,14 +35,14 @@
|
||||||
* @brief UniverseWindow::UniverseWindow
|
* @brief UniverseWindow::UniverseWindow
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
UniverseWindow::UniverseWindow(QWidget *parent, QSacnUniverse *universe)
|
UniverseWindow::UniverseWindow(QWidget *parent, std::shared_ptr<DMX::Universe> universe)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
, ui(new Ui::UniverseWindow())
|
, ui(new Ui::UniverseWindow())
|
||||||
, mUniverse(universe)
|
, universe_(universe)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
auto model = new UniverseModel(this, universe->get());
|
auto model = new UniverseModel(this, universe);
|
||||||
ui->tableView->setModel(model);
|
ui->tableView->setModel(model);
|
||||||
|
|
||||||
// update the status bar whenever the universe refreshes
|
// update the status bar whenever the universe refreshes
|
||||||
|
@ -77,7 +100,7 @@ UniverseWindow::UniverseWindow(QWidget *parent, QSacnUniverse *universe)
|
||||||
});
|
});
|
||||||
|
|
||||||
// status indicator
|
// status indicator
|
||||||
auto indicator = new UniverseStatusWidget(this, mUniverse->get());
|
auto indicator = new UniverseStatusWidget(this, universe_);
|
||||||
ui->statusbar->addPermanentWidget(indicator);
|
ui->statusbar->addPermanentWidget(indicator);
|
||||||
|
|
||||||
update_status_();
|
update_status_();
|
||||||
|
@ -98,18 +121,12 @@ UniverseWindow::~UniverseWindow()
|
||||||
*/
|
*/
|
||||||
void UniverseWindow::update_status_()
|
void UniverseWindow::update_status_()
|
||||||
{
|
{
|
||||||
// window title
|
if (!universe_->isEditable())
|
||||||
this->setWindowTitle(QString("%1 '%2' : "+tr("Universe")+" %3").arg(
|
|
||||||
mUniverse->isEditable() ? tr("Editing") : tr("Viewing"),
|
|
||||||
mUniverse->sourceName(),
|
|
||||||
QString::number(mUniverse->number())));
|
|
||||||
|
|
||||||
if (!mUniverse->isEditable())
|
|
||||||
{
|
{
|
||||||
// status bar
|
// status bar
|
||||||
ui->statusbar->clearMessage();
|
ui->statusbar->clearMessage();
|
||||||
QString message = QString("%1 " + tr("Hz")).arg(
|
QString message = QString("%1 " + tr("Hz")).arg(
|
||||||
QString::number(mUniverse->rxRate()));
|
QString::number(universe_->rxRate()));
|
||||||
ui->statusbar->showMessage(message, 2500);
|
ui->statusbar->showMessage(message, 2500);
|
||||||
}
|
}
|
||||||
}
|
}
|
55
platform/qt/sacn/universewindow.h
Normal file
55
platform/qt/sacn/universewindow.h
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
/*
|
||||||
|
universewindow.h
|
||||||
|
|
||||||
|
Copyright (c) 2022 Kevin Matz (kevin.matz@gmail.com)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <universe.h>
|
||||||
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
namespace Ui {
|
||||||
|
class UniverseWindow;
|
||||||
|
}
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
class UniverseWindow
|
||||||
|
: public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit UniverseWindow(QWidget *parent = nullptr,
|
||||||
|
std::shared_ptr<DMX::Universe> universe = nullptr);
|
||||||
|
virtual ~UniverseWindow();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief universe
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
std::shared_ptr<DMX::Universe> universe() { return universe_; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::UniverseWindow *ui;
|
||||||
|
std::shared_ptr<DMX::Universe> universe_;
|
||||||
|
|
||||||
|
void update_status_();
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user