the source name is not a per/universe property
This commit is contained in:
parent
4ad13317fd
commit
d57a6a31ad
|
@ -183,7 +183,7 @@ QVariant MultiverseItem::data(int column, int role) const
|
|||
return active ? active - 1 : active;
|
||||
}
|
||||
case MultiverseModel::SourceName:
|
||||
return universe_->description();
|
||||
return universe_->sourceName();
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
@ -218,8 +218,6 @@ QVariant MultiverseItem::data(int column, int role) const
|
|||
{
|
||||
case MultiverseModel::Priority:
|
||||
return universe_->priority();
|
||||
case MultiverseModel::SourceName:
|
||||
return universe_->description();
|
||||
default:
|
||||
return QVariant(QVariant::fromValue(universe_));
|
||||
}
|
||||
|
@ -260,16 +258,6 @@ bool MultiverseItem::setData(int column, const QVariant &value, int role)
|
|||
universe_->setPriority(p);
|
||||
return true;
|
||||
}
|
||||
case MultiverseModel::SourceName:
|
||||
{
|
||||
if (!value.canConvert<QString>())
|
||||
return false;
|
||||
auto d = value.toString();
|
||||
if (d.size() > 64)
|
||||
return false;
|
||||
universe_->setDescription(d);
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -295,9 +283,9 @@ Qt::ItemFlags MultiverseItem::flags(int column, Qt::ItemFlags base) const
|
|||
{
|
||||
case MultiverseModel::Universe:
|
||||
case MultiverseModel::Channels:
|
||||
case MultiverseModel::SourceName:
|
||||
return base;
|
||||
case MultiverseModel::Priority:
|
||||
case MultiverseModel::SourceName:
|
||||
if (universe_ && universe_->isEditable())
|
||||
return base | Qt::ItemIsEditable;
|
||||
else
|
||||
|
|
|
@ -25,14 +25,6 @@ UniverseView::UniverseView(QWidget *parent, QSacnUniverse *universe)
|
|||
connect(model, &UniverseModel::recievedUpdate,
|
||||
this, &UniverseView::updateStatus);
|
||||
|
||||
// add universe description editor
|
||||
descriptionEdit = new QLineEdit(this);
|
||||
descriptionEdit->setMaxLength(64);
|
||||
descriptionEdit->setEnabled(false);
|
||||
ui->toolBar->addWidget(descriptionEdit);
|
||||
|
||||
ui->toolBar->addSeparator();
|
||||
|
||||
// add data format combobox to toolbar
|
||||
auto formatLabel = new QLabel(this);
|
||||
formatLabel->setText(tr("Data Format") + ": ");
|
||||
|
@ -61,10 +53,6 @@ UniverseView::UniverseView(QWidget *parent, QSacnUniverse *universe)
|
|||
updateStatus(universe);
|
||||
if (universe->isEditable())
|
||||
{
|
||||
descriptionEdit->setText(universe->description());
|
||||
descriptionEdit->setEnabled(true);
|
||||
connect(descriptionEdit, &QLineEdit::textChanged,
|
||||
universe, &QSacnUniverse::setDescription);
|
||||
prioritySpinBox->setValue(universe->priority());
|
||||
prioritySpinBox->setEnabled(true);
|
||||
connect(prioritySpinBox, &QSpinBox::valueChanged,
|
||||
|
@ -89,10 +77,10 @@ UniverseView::~UniverseView()
|
|||
void UniverseView::updateStatus(QSacnUniverse* universe)
|
||||
{
|
||||
// window title
|
||||
QString titlestring = QString("%1 " + tr("Universe") + " %2").arg(
|
||||
this->setWindowTitle(QString("%1 '%2' : "+tr("Universe")+" %3").arg(
|
||||
universe->isEditable() ? tr("Editing") : tr("Viewing"),
|
||||
QString::number(universe->number()));
|
||||
this->setWindowTitle(titlestring);
|
||||
universe->sourceName(),
|
||||
QString::number(universe->number())));
|
||||
|
||||
if (!universe->isEditable())
|
||||
{
|
||||
|
@ -101,10 +89,6 @@ void UniverseView::updateStatus(QSacnUniverse* universe)
|
|||
QString message = QString("%1 " + tr("Hz")).arg(
|
||||
QString::number(universe->rxRate()));
|
||||
ui->statusbar->showMessage(message, 2500);
|
||||
|
||||
// component name
|
||||
descriptionEdit->setText(universe->description());
|
||||
|
||||
// priority spinbox
|
||||
prioritySpinBox->setValue(universe->priority());
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include "qsacnuniverse.h"
|
||||
#include <QMainWindow>
|
||||
#include <QLineEdit>
|
||||
#include <QSpinBox>
|
||||
|
||||
|
||||
|
@ -27,6 +26,5 @@ public slots:
|
|||
|
||||
private:
|
||||
Ui::UniverseView *ui;
|
||||
QLineEdit *descriptionEdit;
|
||||
QSpinBox *prioritySpinBox;
|
||||
};
|
||||
|
|
|
@ -41,7 +41,7 @@ QSacnUniverse::~QSacnUniverse()
|
|||
* @brief QSacnUniverse::description
|
||||
* @return
|
||||
*/
|
||||
const QString QSacnUniverse::description() const
|
||||
const QString QSacnUniverse::sourceName() const
|
||||
{
|
||||
auto metadata = universe_->provenance();
|
||||
if (!metadata)
|
||||
|
@ -153,20 +153,6 @@ uint16_t QSacnUniverse::activeSlots() const
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief QSacnUniverse::setDescription
|
||||
* @param desc
|
||||
*/
|
||||
void QSacnUniverse::setDescription(const QString &desc)
|
||||
{
|
||||
if (!isEditable())
|
||||
return;
|
||||
|
||||
universe_->provenance()->source_name = desc.toStdString();
|
||||
emit changed();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief QSacnUniverse::setOptions
|
||||
* @param o
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
std::shared_ptr<sACN::Universe> universe = nullptr);
|
||||
virtual ~QSacnUniverse();
|
||||
|
||||
const QString description() const;
|
||||
const QString sourceName() const;
|
||||
uint16_t number() const;
|
||||
uint8_t priority() const;
|
||||
double rxRate() const;
|
||||
|
@ -33,7 +33,6 @@ public:
|
|||
QSacnUniverse* sourceUniverse(const sACN::DATA::data_header&);
|
||||
|
||||
public slots:
|
||||
void setDescription(const QString &desc);
|
||||
void setOptions(sACN::DATA::data_options o);
|
||||
void setPriority(uint8_t p);
|
||||
void setSyncAddress(uint16_t a);
|
||||
|
|
Loading…
Reference in New Issue