Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
@@ -0,0 +1,50 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by hjl, SLSE, 2016-12-01
|
||||
#
|
||||
|
||||
SET(mvs_gui_SRCS
|
||||
avm_mvs_video_team_gui_plugin.h
|
||||
avm_mvs_video_team_gui_plugin.cpp
|
||||
avm_mvs_video_team_dialog.h
|
||||
avm_mvs_video_team_dialog.cpp
|
||||
avm_mvs_dialog.cpp
|
||||
avm_mvs_dialog.h
|
||||
avm_mvs_model.cpp
|
||||
avm_mvs_model.h
|
||||
avm_mvs_edit_dialog.cpp
|
||||
avm_mvs_edit_dialog.h
|
||||
receiveritem.cpp
|
||||
receiveritem.h
|
||||
receiverelement.cpp
|
||||
receiverelement.h
|
||||
)
|
||||
|
||||
QT5_WRAP_UI(mvs_gui_SRCS
|
||||
avm_mvs_video_team_dialog.ui
|
||||
avm_mvs_dialog.ui
|
||||
avm_mvs_edit_dialog.ui
|
||||
receiveritem.ui
|
||||
receiverelement.ui
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS MvsVideoTeamGuiPlugin MODULE ${mvs_gui_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(MvsVideoTeamGuiPlugin
|
||||
# LtsPrinting
|
||||
Qt5::Widgets
|
||||
LtsWidgets
|
||||
LtsDataView
|
||||
LtsPrinting
|
||||
AvmDataPluginInterface
|
||||
AvmMvsVideoTeamGuiPluginInterface
|
||||
IsmDataPluginInterface
|
||||
FlmDataPluginInterface
|
||||
|
||||
LtsSession
|
||||
LtsUtilsGuiDds
|
||||
LtsUtilsSettings
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(MvsVideoTeamGuiPlugin)
|
||||
@@ -0,0 +1,225 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* The MvsDialog provides interactions for TVC assignment
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-07-24
|
||||
*/
|
||||
|
||||
#include "avm_mvs_dialog.h"
|
||||
#include "ui_avm_mvs_dialog.h"
|
||||
#include "avm_mvs_edit_dialog.h"
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
#include <FileManagement/flm_translation.h>
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsPrinting/printing.h>
|
||||
#include <QTreeView>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
MvsDialog::MvsDialog(const QString &menuGroup, LtsSession::LtsSession *session, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_session(session)
|
||||
, m_ui(new Ui::MvsDialog)
|
||||
, m_menuGroup(menuGroup)
|
||||
, m_model(nullptr)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_avmDtc(nullptr)
|
||||
, m_avmFtc(nullptr)
|
||||
, m_logger(getLogger("MvsDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Configuration_Video_Teams"));
|
||||
}
|
||||
|
||||
MvsDialog::~MvsDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void MvsDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Configure Mobile Video Teams"));
|
||||
}
|
||||
|
||||
void MvsDialog::tableColumnOrganiserSetting()
|
||||
{
|
||||
//LtsColumnOrganiser
|
||||
m_ui->dataView->setColumnsOrganiserEnabled(identifier(), true);
|
||||
}
|
||||
|
||||
bool MvsDialog::init(const std::shared_ptr<AudioVideoManagement::Interface::Dtc> &avmDtc, const std::shared_ptr<AudioVideoManagement::Interface::Ftc> &avmFtc)
|
||||
{
|
||||
|
||||
delete m_model;
|
||||
m_model = new MvsModel(this);
|
||||
|
||||
m_avmDtc = avmDtc;
|
||||
m_avmFtc = avmFtc;
|
||||
|
||||
if (!m_model->init(m_session->exerciseId(), avmDtc))
|
||||
{
|
||||
delete m_model;
|
||||
m_model = nullptr;
|
||||
ERROR_LOG(m_logger) << "Could not init model";
|
||||
return false;
|
||||
}
|
||||
|
||||
m_ui->dataView->setModel(m_model);
|
||||
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Add, this, &MvsDialog::onAddClicked);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &MvsDialog::onEditClicked);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Remove, this, &MvsDialog::onRemoveClicked);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &MvsDialog::onPrint);
|
||||
|
||||
connect(m_ui->dataView, &LtsDataView::LtsDataView::signalSelectionChanged,
|
||||
this, &MvsDialog::onSelectionChanged);
|
||||
|
||||
onSelectionChanged();
|
||||
|
||||
connect(m_ui->dataView, &LtsDataView::LtsDataView::signalDoubleClicked,
|
||||
this, &MvsDialog::onEditClicked);
|
||||
|
||||
// Save/Load from Library Button
|
||||
m_buttonBox->connectLibraryButton(this,
|
||||
&MvsDialog::onImportButtonClicked,
|
||||
&MvsDialog::onExportButtonClicked);
|
||||
|
||||
if (!m_session->getForeignGuiInterface<FileManagement::ForeignGuiInterface>(m_flmGui))
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Library, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void MvsDialog::onVideoTeamModifyReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
}
|
||||
|
||||
|
||||
void MvsDialog::onAddClicked()
|
||||
{
|
||||
EditVideoTeamDialog *dialog = new EditVideoTeamDialog(m_avmDtc, m_session->exerciseId(), this);
|
||||
|
||||
connect(dialog, &EditVideoTeamDialog::modifyRequest, this, [this](const AudioVideoManagement::VideoTeamModifyRequest & request)
|
||||
{
|
||||
m_requestHelper->startSingleRequest([this, request]()
|
||||
{
|
||||
return m_avmFtc->videoTeamModifyRequest(request, this);
|
||||
});
|
||||
});
|
||||
|
||||
addDialog(dialog, m_menuGroup, QStringLiteral("NewVideoTeam"), LtsWidgets::LayoutArea::eDialogTab);
|
||||
}
|
||||
|
||||
void MvsDialog::onEditClicked()
|
||||
{
|
||||
QModelIndex currentIndex = m_ui->dataView->currentIndex();
|
||||
|
||||
if (!currentIndex.isValid())
|
||||
return;
|
||||
|
||||
AudioVideoManagement::VideoTeam config = m_model->getRowData(currentIndex.row());
|
||||
EditVideoTeamDialog *dialog = new EditVideoTeamDialog(config.id(),
|
||||
m_avmDtc,
|
||||
m_session->exerciseId(),
|
||||
config,
|
||||
this);
|
||||
|
||||
connect(dialog, &EditVideoTeamDialog::modifyRequest, this, [this](const AudioVideoManagement::VideoTeamModifyRequest & request)
|
||||
{
|
||||
m_requestHelper->startSingleRequest([this, request]()
|
||||
{
|
||||
return m_avmFtc->videoTeamModifyRequest(request, this);
|
||||
});
|
||||
});
|
||||
|
||||
addDialog(dialog, m_menuGroup, QStringLiteral("EditVideoTeam%1").arg(config.id()), LtsWidgets::LayoutArea::eDialogTab);
|
||||
}
|
||||
|
||||
void MvsDialog::onRemoveClicked()
|
||||
{
|
||||
QModelIndex currentIndex = m_ui->dataView->currentIndex();
|
||||
|
||||
if (!currentIndex.isValid())
|
||||
return;
|
||||
|
||||
AudioVideoManagement::VideoTeamModifyRequest request;
|
||||
const VideoTeam team = m_model->getRowData(currentIndex.row());
|
||||
request.id(team.id());
|
||||
request.name(team.name());
|
||||
request.ssrc(team.ssrc());
|
||||
request.streamName(team.streamName());
|
||||
request.vtPort(team.vtPort());
|
||||
request.exerciseId(0);
|
||||
|
||||
m_requestHelper->startSingleRequest([this, request]()
|
||||
{
|
||||
return m_avmFtc->videoTeamModifyRequest(request, this);
|
||||
});
|
||||
m_model->removeRow(currentIndex.row());
|
||||
}
|
||||
|
||||
void MvsDialog::onSelectionChanged()
|
||||
{
|
||||
QModelIndex currentIndex = m_ui->dataView->currentIndex();
|
||||
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, currentIndex.isValid());
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, currentIndex.isValid());
|
||||
}
|
||||
|
||||
void MvsDialog::onPrint()
|
||||
{
|
||||
LtsPrinting::printView(m_session, this, m_ui->dataView->treeView());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// library
|
||||
void MvsDialog::onExportButtonClicked()
|
||||
{
|
||||
QByteArray byteArray = m_model->modelToJson();
|
||||
|
||||
int fileId = m_flmGui->saveFileContent(this, FileManagement::FileType::Xml, m_session->exerciseId(), byteArray);
|
||||
if (fileId > 0)
|
||||
DEBUG_LOG(m_logger) << "Saved file with id = " << fileId;
|
||||
else
|
||||
ERROR_LOG(m_logger) << "Could not save file in library ";
|
||||
}
|
||||
|
||||
void MvsDialog::onImportButtonClicked()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << " onImportButtonClicked() ";
|
||||
|
||||
QByteArray content;
|
||||
int fileId = m_flmGui->loadFileContent(this, content, {FileManagement::FileType::Xml}, m_session->exerciseId(), FileManagement::toString(FileManagement::XmlType::AVMMvsDialog));
|
||||
if (fileId > 0)
|
||||
{
|
||||
if (!m_flmGui->isXmlType(content, FileManagement::toString(FileManagement::XmlType::AVMMvsDialog)))
|
||||
{
|
||||
QHash<LtsWidgets::Button, QString> texts({{LtsWidgets::Button::Yes, tr("Ok")}});
|
||||
LtsWidgets::LtsMessageDialog::showMessage(this,
|
||||
tr("Invalid xml file content"),
|
||||
windowTitle(),
|
||||
LtsWidgets::Behaviour::Modal,
|
||||
LtsWidgets::Button::Yes,
|
||||
texts);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QVector<VideoTeamModifyRequest> requests = m_model->jsonToVideoTeamVector(content);
|
||||
for (const auto &request : requests)
|
||||
{
|
||||
m_requestHelper->startSingleRequest([this, request]()
|
||||
{
|
||||
return m_avmFtc->videoTeamModifyRequest(request, this);
|
||||
});
|
||||
}
|
||||
INFO_LOG(m_logger) << "--- onImportButtonClicked() ";
|
||||
}
|
||||
}
|
||||
}
|
||||
}// namespace AudioVideoManagement
|
||||
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* The TrainingVoiceCommunicationDialog provides interactions for TVC assignment
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-07-24
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
|
||||
#include <AudioVideoManagement/logger.h>
|
||||
#include <AudioVideoManagement/avm_ftc.h>
|
||||
#include <Plugins/FileManagement/flm_explorer_gui_plugin_interface.h>
|
||||
|
||||
#include "avm_mvs_model.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class MvsDialog;
|
||||
}
|
||||
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSession;
|
||||
}
|
||||
|
||||
namespace LtsUtils
|
||||
{
|
||||
class RequestHelper;
|
||||
}
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
namespace Interface
|
||||
{
|
||||
class Dtc;
|
||||
}
|
||||
}
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
namespace Interface
|
||||
{
|
||||
class Dtc;
|
||||
}
|
||||
}
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class MvsDialog
|
||||
: public LtsWidgets::LtsDialog
|
||||
, protected AudioVideoManagement::Interface::Ftc::VideoTeamModifyReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MvsDialog(const QString &menuGroup, LtsSession::LtsSession *session, QWidget *parent = nullptr);
|
||||
~MvsDialog();
|
||||
|
||||
bool init(const std::shared_ptr<AudioVideoManagement::Interface::Dtc> &avmDtc, const std::shared_ptr<AudioVideoManagement::Interface::Ftc> &avmFtc);
|
||||
|
||||
void onVideoTeamModifyReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
|
||||
private Q_SLOTS:
|
||||
void onAddClicked();
|
||||
void onEditClicked();
|
||||
void onRemoveClicked();
|
||||
void onSelectionChanged();
|
||||
void onPrint();
|
||||
void onExportButtonClicked();
|
||||
void onImportButtonClicked();
|
||||
|
||||
private: // methods
|
||||
void retranslate() override;
|
||||
void tableColumnOrganiserSetting() override;
|
||||
|
||||
private: // attributes
|
||||
LtsSession::LtsSession *m_session;
|
||||
Ui::MvsDialog *m_ui;
|
||||
QString m_menuGroup;
|
||||
MvsModel *m_model;
|
||||
LtsUtils::RequestHelper *m_requestHelper;
|
||||
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Dtc> m_avmDtc;
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Ftc> m_avmFtc;
|
||||
std::shared_ptr<FileManagement::ForeignGuiInterface> m_flmGui;
|
||||
LOGGER_T m_logger;
|
||||
|
||||
}; // class TrainingVoiceCommunicationDialog
|
||||
} // namespace AudioVideoManagement
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MvsDialog</class>
|
||||
<widget class="QWidget" name="MvsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>692</width>
|
||||
<height>262</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="LtsDataView::LtsDataView" name="dataView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsDataView::LtsDataView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>LtsDataView/lts_data_view.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* The EditVideoTeamDialog allows to set data for a VideoTeam
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-07-25
|
||||
*/
|
||||
|
||||
#include "avm_mvs_edit_dialog.h"
|
||||
#include "ui_avm_mvs_edit_dialog.h"
|
||||
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
EditVideoTeamDialog::EditVideoTeamDialog(const std::shared_ptr<AudioVideoManagement::Interface::Dtc> &avmDtc, int32_t exerciseId, QWidget *parent)
|
||||
: EditVideoTeamDialog(0, avmDtc, exerciseId, parent)
|
||||
{
|
||||
slotChangesMade();
|
||||
init();
|
||||
m_uiRequirements->addRequirement({m_ui->lblStreamName, [this]() { return (m_ui->leStreamName->text().size() > 0); }});
|
||||
|
||||
onCurrentTeamChanged();
|
||||
}
|
||||
|
||||
EditVideoTeamDialog::EditVideoTeamDialog(int32_t id, const std::shared_ptr<AudioVideoManagement::Interface::Dtc> &avmDtc, int32_t exerciseId, const VideoTeam &team, QWidget *parent)
|
||||
: EditVideoTeamDialog(id, avmDtc, exerciseId, parent)
|
||||
{
|
||||
m_videoTeam = team;
|
||||
QString name = QString::fromStdString(m_videoTeam.name());
|
||||
if (!m_teamsToIndex.contains(name))
|
||||
{
|
||||
m_teamsToIndex.insert(name, m_ui->cbIdentifier->count());
|
||||
m_ui->cbIdentifier->addItem(name, m_takenTeams.value(name, 0));
|
||||
}
|
||||
|
||||
m_ui->cbIdentifier->setCurrentIndex(m_teamsToIndex.value(name, 0));
|
||||
m_uiRequirements->addRequirement({m_ui->lblStreamName, [this]() { return (m_ui->leStreamName->text().size() > 0); }});
|
||||
|
||||
m_ui->leStreamName->setText(QString::fromStdString((m_videoTeam.streamName())));
|
||||
}
|
||||
|
||||
EditVideoTeamDialog::EditVideoTeamDialog(int32_t id, const std::shared_ptr<AudioVideoManagement::Interface::Dtc> &avmDtc, int32_t exerciseId, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
|
||||
, m_ui(new Ui::EditVideoTeamDialog)
|
||||
, m_exerciseId(exerciseId)
|
||||
, m_id(id)
|
||||
, m_avmDtc(avmDtc)
|
||||
, m_logger(getLogger("EditVideoTeamDialog"))
|
||||
{
|
||||
Q_ASSERT(m_id >= 0);
|
||||
m_ui->setupUi(this);
|
||||
init();
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Configuration_Video_Teams"));
|
||||
}
|
||||
|
||||
EditVideoTeamDialog::~EditVideoTeamDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void EditVideoTeamDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, QString(), m_id == 0, tr("Mobile Video Team"));
|
||||
}
|
||||
|
||||
bool EditVideoTeamDialog::apply()
|
||||
{
|
||||
AudioVideoManagement::VideoTeamModifyRequest request;
|
||||
m_id = m_videoTeam.id();
|
||||
request.id(m_videoTeam.id());
|
||||
request.name(m_videoTeam.name());
|
||||
request.ssrc(m_videoTeam.ssrc());
|
||||
request.vtPort(m_videoTeam.vtPort());
|
||||
request.streamName() = m_ui->leStreamName->text().toStdString();
|
||||
request.exerciseId(m_exerciseId);
|
||||
emit modifyRequest(request);
|
||||
return true;
|
||||
}
|
||||
|
||||
void EditVideoTeamDialog::init()
|
||||
{
|
||||
onCheckTakenTeams();
|
||||
if (m_videoTeam.id() > 0)
|
||||
m_ui->cbIdentifier->setEnabled(false);
|
||||
|
||||
connect(m_avmDtc.get(), &AudioVideoManagement::Interface::Dtc::videoTeamChanged, this, &EditVideoTeamDialog::onCheckTakenTeams);
|
||||
connect(m_ui->cbIdentifier, QOverload<int>::of(&LtsWidgets::LtsComboBox::currentIndexChanged), this, &EditVideoTeamDialog::onCurrentTeamChanged);
|
||||
}
|
||||
|
||||
void EditVideoTeamDialog::onCheckTakenTeams()
|
||||
{
|
||||
|
||||
int currentTeam = m_ui->cbIdentifier->currentData().toInt();
|
||||
int index = -1;
|
||||
|
||||
if (m_ui->cbIdentifier->currentIndex() >= 0)
|
||||
return;
|
||||
|
||||
m_ui->cbIdentifier->clear();
|
||||
m_takenTeams.clear();
|
||||
m_teamsToIndex.clear();
|
||||
|
||||
QMap<int32_t, AudioVideoManagement::VideoTeam> teams = m_avmDtc->videoTeams();
|
||||
|
||||
for (auto it = teams.constBegin(); it != teams.constEnd(); ++it)
|
||||
{
|
||||
QString team = QString::fromStdString(it.value().name());
|
||||
|
||||
if (m_avmDtc->isFreeVideoTeam(m_exerciseId, it.key()))
|
||||
{
|
||||
if (currentTeam == it.key())
|
||||
index = m_ui->cbIdentifier->count();
|
||||
|
||||
m_teamsToIndex.insert(team, m_ui->cbIdentifier->count());
|
||||
m_ui->cbIdentifier->addItem(team, QVariant::fromValue(it.value().id()));
|
||||
}
|
||||
else
|
||||
m_takenTeams.insert(team, it.key());
|
||||
}
|
||||
|
||||
if (index > 0)
|
||||
m_ui->cbIdentifier->setCurrentIndex(index);
|
||||
|
||||
}
|
||||
|
||||
void EditVideoTeamDialog::onCurrentTeamChanged()
|
||||
{
|
||||
m_videoTeam = m_avmDtc->videoTeam(m_ui->cbIdentifier->currentData().toInt());
|
||||
}
|
||||
|
||||
} //namespace AudioVideoManagement
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* The EditVideoTeamDialog allows to set data for a VideoTeam
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-07-25
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
|
||||
#include <AudioVideoManagement/logger.h>
|
||||
#include <AudioVideoManagement/avm_dtc.h>
|
||||
#include <AudioVideoManagement/avm_ftc.h>
|
||||
|
||||
class QCheckBox;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class EditVideoTeamDialog;
|
||||
}
|
||||
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
class EditVideoTeamDialog
|
||||
: public LtsWidgets::LtsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit EditVideoTeamDialog(const std::shared_ptr<AudioVideoManagement::Interface::Dtc> &avmDtc,
|
||||
int32_t exerciseId,
|
||||
QWidget *parent = nullptr);
|
||||
explicit EditVideoTeamDialog(int32_t id,
|
||||
const std::shared_ptr<AudioVideoManagement::Interface::Dtc> &avmDtc,
|
||||
int32_t exerciseId,
|
||||
const VideoTeam &team,
|
||||
QWidget *parent);
|
||||
|
||||
~EditVideoTeamDialog();
|
||||
|
||||
void retranslate() override;
|
||||
|
||||
Q_SIGNALS:
|
||||
void modifyRequest(const AudioVideoManagement::VideoTeamModifyRequest &request);
|
||||
|
||||
protected:
|
||||
bool apply() override;
|
||||
|
||||
private: // methods
|
||||
EditVideoTeamDialog(int32_t id,
|
||||
const std::shared_ptr<AudioVideoManagement::Interface::Dtc> &avmDtc,
|
||||
int32_t exerciseId,
|
||||
QWidget *parent);
|
||||
|
||||
void init();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onCheckTakenTeams();
|
||||
void onCurrentTeamChanged();
|
||||
|
||||
private: // attributes
|
||||
Ui::EditVideoTeamDialog *m_ui;
|
||||
|
||||
int32_t m_exerciseId;
|
||||
int32_t m_id;
|
||||
VideoTeam m_videoTeam;
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Dtc> m_avmDtc;
|
||||
QMap<QString, int32_t> m_takenTeams;
|
||||
QMap<QString, int32_t> m_teamsToIndex;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
}; // class EditVideoTeamDialog
|
||||
} // namespace AudioVideoManagement
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EditVideoTeamDialog</class>
|
||||
<widget class="QWidget" name="EditVideoTeamDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>508</width>
|
||||
<height>275</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Asset Stocks</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblStreamName">
|
||||
<property name="text">
|
||||
<string>Stream Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="leStreamName"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Video Team:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbIdentifier"/>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsWidgets::LtsComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>LtsWidgets/lts_combo_box.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>cbIdentifier</tabstop>
|
||||
<tabstop>leStreamName</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,145 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* The MvsModel provices data for TrainingVoiceCommunicationDialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-07-24
|
||||
*/
|
||||
|
||||
#include "avm_mvs_dialog.h"
|
||||
#include <FileManagement/flm_translation.h>
|
||||
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
MvsModel::MvsModel(QObject *parent)
|
||||
: LtsAbstractTableModel<AudioVideoManagement::VideoTeam>(
|
||||
{
|
||||
tr("Video Team Name"),
|
||||
tr("Stream Name")
|
||||
}, parent)
|
||||
, m_exerciseId(-1)
|
||||
, m_logger(getLogger("MvsModel"))
|
||||
{}
|
||||
|
||||
QVariant MvsModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole || !indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
const AudioVideoManagement::VideoTeam &config = m_vecData.at(index.row());
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case CHANNEL:
|
||||
return QString::fromStdString(m_videoTeams.value(config.id()).name());
|
||||
case STREAM_NAME:
|
||||
return QString::fromStdString(config.streamName());
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
bool MvsModel::init(int32_t exerciseId, const std::shared_ptr<AudioVideoManagement::Interface::Dtc> &avmDtc)
|
||||
{
|
||||
m_avmDtc = avmDtc;
|
||||
m_exerciseId = exerciseId;
|
||||
|
||||
m_videoTeams = avmDtc->videoTeams();
|
||||
|
||||
connect(m_avmDtc.get(), &AudioVideoManagement::Interface::Dtc::videoTeamChanged,
|
||||
this, [this](const AudioVideoManagement::VideoTeam & data, DataModification modType)
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
|
||||
if (data.exerciseId() == m_exerciseId)
|
||||
onDataChanged(data, DataModification::eAdded);
|
||||
else
|
||||
onDataChanged(data, DataModification::eRemoved);
|
||||
}
|
||||
);
|
||||
|
||||
QVector<AudioVideoManagement::VideoTeam> configs;
|
||||
const QMap<int, AudioVideoManagement::VideoTeam> configMap = m_avmDtc->videoTeams();
|
||||
for (auto it = configMap.begin(); it != configMap.end(); ++it)
|
||||
{
|
||||
if (it.value().exerciseId() == m_exerciseId)
|
||||
configs.append(it.value());
|
||||
}
|
||||
setData(configs);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QByteArray MvsModel::modelToJson()
|
||||
{
|
||||
QJsonObject obj;
|
||||
QJsonArray arr;
|
||||
obj[QStringLiteral("XmlType")] = FileManagement::toString(FileManagement::XmlType::AVMMvsDialog);
|
||||
|
||||
for (int row = 0; row < rowCount(); row++)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "row =" << ": " << row;
|
||||
QJsonObject inner;
|
||||
const VideoTeam &config = m_vecData.at(row);
|
||||
inner[QStringLiteral("id")] = config.id();
|
||||
inner[QStringLiteral("exerciseId")] = config.exerciseId();
|
||||
inner[QStringLiteral("name")] = QString::fromStdString(config.name());
|
||||
inner[QStringLiteral("streamName")] = QString::fromStdString(config.streamName());
|
||||
arr += inner;
|
||||
}
|
||||
|
||||
obj[QStringLiteral("videoTeams")] = arr;
|
||||
QJsonDocument doc(obj);
|
||||
return doc.toJson(QJsonDocument::Compact);
|
||||
}
|
||||
|
||||
QVector<VideoTeamModifyRequest> MvsModel::jsonToVideoTeamVector(const QByteArray &content)
|
||||
{
|
||||
// already checked that content is not empty, parseable and contains proper XmlType (AVMMvsDialog)
|
||||
QVector<VideoTeamModifyRequest> result;
|
||||
const QJsonDocument doc(QJsonDocument::fromJson(content));
|
||||
const QJsonObject obj(doc.object());
|
||||
const QJsonArray arr(obj.value(QStringLiteral("videoTeams")).toArray());
|
||||
for (const auto &ele : arr)
|
||||
{
|
||||
const QJsonObject obj(ele.toObject());
|
||||
int id = obj[QStringLiteral("id")].toInt(); //TODO Library: check id = 0?
|
||||
if (id <= 0)
|
||||
return QVector<VideoTeamModifyRequest>();
|
||||
|
||||
const VideoTeam team = m_avmDtc->videoTeam(id);
|
||||
if (!m_avmDtc->isFreeVideoTeam(m_exerciseId, id))
|
||||
continue;
|
||||
|
||||
VideoTeamModifyRequest config;
|
||||
config.id(id);
|
||||
config.name(team.name());
|
||||
config.ssrc(team.ssrc());
|
||||
config.vtPort(team.vtPort());
|
||||
config.exerciseId(m_exerciseId);
|
||||
config.streamName(obj[QStringLiteral("streamName")].toString().toStdString());
|
||||
|
||||
INFO_LOG(m_logger) << "insertRow: " << config.name()
|
||||
<< " VideoTeamId=" << config.id();
|
||||
result.append(std::move(config));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool MvsModel::isFiltered(const VideoTeam &data, DataModification modType) const
|
||||
{
|
||||
|
||||
Q_UNUSED(modType)
|
||||
if (data.exerciseId() != m_exerciseId)
|
||||
return true;
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
} //namespace AudioVideoManagement
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* The MvsModel provices data for TrainingVoiceCommunicationDialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-07-24
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
|
||||
#include <AudioVideoManagement/logger.h>
|
||||
#include <AudioVideoManagement/avm_dtc.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class MvsModel final
|
||||
: public LtsWidgets::LtsAbstractTableModel<AudioVideoManagement::VideoTeam>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
CHANNEL,
|
||||
STREAM_NAME,
|
||||
COUNT
|
||||
};
|
||||
|
||||
explicit MvsModel(QObject *parent = nullptr);
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const override final;
|
||||
|
||||
bool init(int32_t exerciseId, const std::shared_ptr<AudioVideoManagement::Interface::Dtc> &avmDtc);
|
||||
QByteArray modelToJson();
|
||||
QVector<VideoTeamModifyRequest> jsonToVideoTeamVector(const QByteArray &content);
|
||||
bool isFiltered(const VideoTeam &data, DataModification modType) const override;
|
||||
private: // attributes
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Dtc> m_avmDtc;
|
||||
int32_t m_exerciseId;
|
||||
|
||||
QMap<int32_t, AudioVideoManagement::VideoTeam> m_videoTeams;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
}; // class MvsModel
|
||||
} // namespace AudioVideoManagement
|
||||
|
||||
Q_DECLARE_METATYPE(AudioVideoManagement::VideoTeam)
|
||||
+272
@@ -0,0 +1,272 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AudioVideoManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2016-12-01
|
||||
*/
|
||||
|
||||
#include "avm_mvs_video_team_dialog.h"
|
||||
#include "ui_avm_mvs_video_team_dialog.h"
|
||||
|
||||
#include "receiverelement.h"
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Plugins/AudioVideoManagement/avm_mvs_video_team_gui_plugin_interface.h>
|
||||
#include <AudioVideoManagement/avm_dtc.h>
|
||||
#include <QButtonGroup>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
MvsVideoTeamDialog::MvsVideoTeamDialog(QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
|
||||
, m_ui(new Ui::MvsVideoTeamDialog)
|
||||
, m_session(nullptr)
|
||||
, m_dtc(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
, m_flmGui(nullptr)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_logger(getLogger("MvsVideoTeamDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Mobile_Video_System"));
|
||||
|
||||
} // end of ctor()
|
||||
|
||||
MvsVideoTeamDialog::~MvsVideoTeamDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
} // end of dtor()
|
||||
|
||||
void MvsVideoTeamDialog::retranslate()
|
||||
{
|
||||
QString text = tr("Mobile Video System");
|
||||
translate(m_ui, text);
|
||||
}
|
||||
|
||||
void MvsVideoTeamDialog::enaDisa(bool enable)
|
||||
{
|
||||
Q_UNUSED(enable);
|
||||
|
||||
if (!m_flmGui)
|
||||
{
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Export, false);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Import, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool MvsVideoTeamDialog::init(LtsSession::LtsSession *session,
|
||||
const std::shared_ptr<AudioVideoManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<AudioVideoManagement::Interface::Ftc> &ftc)
|
||||
{
|
||||
m_session = session;
|
||||
|
||||
m_dtc = dtc;
|
||||
m_ftc = ftc;
|
||||
|
||||
session->getForeignGuiInterface<FileManagement::ForeignGuiInterface>(m_flmGui);
|
||||
session->getDtc<InfrastructureManagement::DataInterface>(m_ismDtc);
|
||||
|
||||
m_receiverMap = m_dtc->videoReceivers();
|
||||
|
||||
|
||||
//cb for adding VideoTeam to map AND grid
|
||||
int row = 1;
|
||||
int column = 2; // skip team column and "none" column
|
||||
|
||||
QMap<std::string , VideoTeam> teamMap;
|
||||
auto cbVt = [this, &row, &teamMap](const AudioVideoManagement::VideoTeam & vt)
|
||||
{
|
||||
if (vt.exerciseId() != m_session->exerciseId())
|
||||
return;
|
||||
//HACKY UAE: programId 3 = Team 2 so Row 2
|
||||
//HACKY UAE: programId 2 = Team 1 so Row 1
|
||||
m_teamToRow.insert(vt.programId() == 3 ? 2 : 1, vt.programId() == 3 ? 2 : 1);
|
||||
teamMap.insert(vt.name(), vt);
|
||||
};
|
||||
m_dtc->videoTeams(cbVt);
|
||||
|
||||
const QMap<int, AudioVideoManagement::VideoReceiver> vts = m_dtc->videoReceivers();
|
||||
QSet<int> teamId;
|
||||
for (auto rec : vts)
|
||||
{
|
||||
if (teamMap.value(rec.streamName()).id() > 0)
|
||||
teamId.insert(rec.teamId());
|
||||
}
|
||||
for (auto team: teamId)
|
||||
{
|
||||
QLabel *lbl = new QLabel(QStringLiteral("MLVS")+QString::number(team), this);
|
||||
m_ui->glMvs->addWidget(lbl, team == 1 ? 1 : 2, 0);
|
||||
}
|
||||
|
||||
auto cbMs = [this, &column](const InfrastructureManagement::MainStructureElement & mse)
|
||||
{
|
||||
if (mse.structureElementTypeId() == InfrastructureManagement::StructureElementType::RadioStation && !mse.isDeleted() && mse.id() > 0)
|
||||
{
|
||||
m_stationToColumn.insert(mse.id(), column);
|
||||
QLabel *lblStation = new QLabel(QString::fromStdString(mse.name()), this);
|
||||
lblStation->setProperty("RadioStation", true);
|
||||
lblStation->setProperty("column", column);
|
||||
lblStation->setProperty("name", QString::fromStdString(mse.name()));
|
||||
m_ui->glMvs->addWidget(lblStation, 0, column++);
|
||||
lblStation->hide();
|
||||
}
|
||||
};
|
||||
m_ismDtc->mainStructureElements(cbMs);
|
||||
|
||||
auto cbRec = [this, teamMap](const AudioVideoManagement::VideoReceiver & rec)
|
||||
{
|
||||
if (m_teamToRow.value(rec.teamId()) <= 0)
|
||||
return;
|
||||
if (!teamMap.contains(rec.streamName()))
|
||||
return;
|
||||
m_receiverMap.insert(rec.id(), rec);
|
||||
if (m_stationToColumn.value(rec.mainStructureElementId()) > 0 && m_teamToRow.value(rec.teamId()) > 0)
|
||||
{
|
||||
ReceiverElement *btn = createReceiverElement(rec);
|
||||
// Keine Ahnung, warum man das erst anlegen muss. [] sollte das eigentlich selbst machen...
|
||||
int row = m_teamToRow.value(rec.teamId());
|
||||
int column = m_stationToColumn.value(rec.mainStructureElementId());
|
||||
if (!m_videoTeamButtonGroup.contains(row))
|
||||
{
|
||||
QRadioButton *none = new QRadioButton(tr("None"), this);
|
||||
none->setChecked(true);
|
||||
|
||||
m_ui->glMvs->addWidget(none, row, 1);
|
||||
m_videoTeamButtonGroup.insert(row, new QButtonGroup(this));
|
||||
m_videoTeamButtonGroup[row]->addButton(none, 0);
|
||||
}
|
||||
m_videoTeamButtonGroup[row]->addButton(btn->radioButton(), rec.mainStructureElementId());
|
||||
m_videoTeamButtonGroup[row]->setProperty("teamId", rec.teamId());
|
||||
m_receiverIds.insert(QPair<int, int>(rec.mainStructureElementId(), rec.teamId()), rec.id());
|
||||
bool isActive = rec.isActive();
|
||||
btn->setButtonChecked(isActive);
|
||||
btn->radioButton()->setChecked(isActive);
|
||||
m_ui->glMvs->addWidget(btn, row, column);
|
||||
// Show only radio stations with a configured receiver
|
||||
for (int i = 0; i < m_ui->glMvs->count(); i++)
|
||||
{
|
||||
QWidget* widget = m_ui->glMvs->itemAt(i)->widget();
|
||||
if ( widget->property("RadioStation").toBool() && widget->property("column").toInt() == column)
|
||||
{
|
||||
widget->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
m_dtc->videoReceivers(cbRec);
|
||||
enaDisa(true);
|
||||
|
||||
|
||||
connect(m_dtc.get(), &AudioVideoManagement::Interface::Dtc::videoReceiverChanged, this, &MvsVideoTeamDialog::updateReceiverButton);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void MvsVideoTeamDialog::setData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool MvsVideoTeamDialog::apply()
|
||||
{
|
||||
VideoReceiverModifyActiveRequest req;
|
||||
DEBUG_LOG(m_logger) << "apply m_videoTeamButtonGroup.size=" << m_videoTeamButtonGroup.size();
|
||||
QMap<int, QButtonGroup *> ::const_iterator itBg;
|
||||
for (itBg = m_videoTeamButtonGroup.constBegin(); itBg != m_videoTeamButtonGroup.constEnd(); ++itBg)
|
||||
{
|
||||
int teamId = itBg.value()->property("teamId").toInt();
|
||||
int mainStructureElementId = itBg.value()->checkedId();
|
||||
int oldActiveId = m_dtc->getActiveVideoReceiver(teamId);
|
||||
|
||||
DEBUG_LOG(m_logger) << "Team id = " << teamId;
|
||||
DEBUG_LOG(m_logger) << "Main structure element id = " << mainStructureElementId;
|
||||
DEBUG_LOG(m_logger) << "Old active video receiver = " << oldActiveId;
|
||||
|
||||
if (itBg.value()->checkedId() == 0) // No active channel
|
||||
{
|
||||
req.isActive(false);
|
||||
req.id(0); // Not Valid
|
||||
QMapIterator<qint32, AudioVideoManagement::VideoReceiver> i(m_receiverMap);
|
||||
while (i.hasNext())
|
||||
{
|
||||
i.next();
|
||||
if ((i.value().isActive())
|
||||
&& i.value().teamId() == teamId)
|
||||
req.id(i.value().id());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
req.isActive(true);
|
||||
req.id(m_receiverIds.value(QPair<int, int>(mainStructureElementId, teamId)));
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "itBg.key=" << itBg.key()
|
||||
<< " mainStructureElementId=" << mainStructureElementId
|
||||
<< " teamId=" << teamId
|
||||
<< " id=" << req.id()
|
||||
<< " isActive=" << req.isActive();
|
||||
|
||||
// Only send, if Value Changed and valid Receiver
|
||||
if ((m_receiverMap.value(req.id()).isActive() != req.isActive())
|
||||
&& req.id() > 0)
|
||||
{
|
||||
// inactivate old video receiver
|
||||
if (oldActiveId > 0)
|
||||
{
|
||||
VideoReceiverModifyActiveRequest reqInactive;
|
||||
reqInactive.id(oldActiveId);
|
||||
reqInactive.isActive(false);
|
||||
m_requestHelper->addRequest([this, reqInactive]()
|
||||
{
|
||||
return m_ftc->videoReceiverModifyActiveRequest(reqInactive, this);
|
||||
});
|
||||
}
|
||||
m_requestHelper->addRequest([this, req]()
|
||||
{
|
||||
return m_ftc->videoReceiverModifyActiveRequest(req, this);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return m_requestHelper->startRequests();
|
||||
}
|
||||
|
||||
ReceiverElement *MvsVideoTeamDialog::createReceiverElement(const VideoReceiver &rec)
|
||||
{
|
||||
ReceiverElement *re = new ReceiverElement(this);
|
||||
re->init(rec);
|
||||
if (rec.isActive())
|
||||
m_oldActiveTeamToRec.insert(rec.teamId(), rec.id());
|
||||
m_elementList.insert(rec.teamId(), re);
|
||||
return re;
|
||||
}
|
||||
|
||||
void MvsVideoTeamDialog::updateReceiverButton(const AudioVideoManagement::VideoReceiver &rec, DataModification modType)
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
m_receiverMap.insert(rec.id(), rec);
|
||||
for (auto it = m_elementList.lowerBound(rec.teamId()) ; it != m_elementList.end(); ++it)
|
||||
{
|
||||
if (it.key() != rec.teamId())
|
||||
break;
|
||||
auto *receiverElement = it.value();
|
||||
if (receiverElement->property("recId").toInt() != rec.id())
|
||||
continue;
|
||||
|
||||
receiverElement->setButtonChecked(rec.isActive());
|
||||
receiverElement->setSnr(rec.snr());
|
||||
receiverElement->setDbm(rec.dbm());
|
||||
receiverElement->setStreamName(QString::fromStdString(rec.streamName()));
|
||||
receiverElement->setFrequency(rec.frequency());
|
||||
receiverElement->setIsLocked(rec.isLocked());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace AudioVideoManagement
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for MobileVideoSystem - Mobile Video System Overview Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2016-12-01
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
#include <Services/AudioVideoManagement/logger.h>
|
||||
|
||||
#include <Services/AudioVideoManagement/avm_ftc.h>
|
||||
#include <Services/AudioVideoManagement/avm_dtc.h>
|
||||
|
||||
#include <Plugins/FileManagement/flm_explorer_gui_plugin_interface.h>
|
||||
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
|
||||
|
||||
|
||||
namespace LtsWidgets
|
||||
{
|
||||
class LtsComboBox;
|
||||
}
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class MvsVideoTeamDialog;
|
||||
}
|
||||
|
||||
class ReceiverElement;
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class MvsVideoTeamDialog : public LtsWidgets::LtsDialog,
|
||||
private AudioVideoManagement::Interface::Ftc::VideoReceiverModifyActiveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MvsVideoTeamDialog(QWidget *parent = nullptr);
|
||||
~MvsVideoTeamDialog();
|
||||
|
||||
bool init(LtsSession::LtsSession *session,
|
||||
const std::shared_ptr<AudioVideoManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<AudioVideoManagement::Interface::Ftc> &ftc);
|
||||
|
||||
void onVideoReceiverModifyActiveReply(const Core::FunctionReplyObject &reply) override final { m_requestHelper->requestReply(reply); }
|
||||
|
||||
private:
|
||||
ReceiverElement *createReceiverElement(const VideoReceiver &rec);
|
||||
|
||||
private slots:
|
||||
bool apply() override;
|
||||
void updateReceiverButton(const AudioVideoManagement::VideoReceiver &rec, DataModification modType);
|
||||
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
void enaDisa(bool enable);
|
||||
void setData();
|
||||
|
||||
private:
|
||||
Ui::MvsVideoTeamDialog *m_ui;
|
||||
LtsSession::LtsSession *m_session;
|
||||
QString m_menuGroup;
|
||||
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Ftc> m_ftc;
|
||||
|
||||
std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_ismDtc;
|
||||
std::shared_ptr<FileManagement::ForeignGuiInterface> m_flmGui;
|
||||
|
||||
AudioVideoManagement::VideoReceiver m_data;
|
||||
|
||||
LtsUtils::RequestHelper *m_requestHelper;
|
||||
|
||||
QMap<qint32, AudioVideoManagement::VideoReceiver> m_receiverMap; // Key: ReceiverId
|
||||
QMap<int, QButtonGroup *> m_videoTeamButtonGroup;
|
||||
QMap<int, int> m_stationToColumn;
|
||||
QMap<int, int> m_teamToRow;
|
||||
QMultiMap<int, ReceiverElement *> m_elementList;
|
||||
QMap<int, int> m_oldActiveTeamToRec;
|
||||
|
||||
// First Key: MainStructureElementId
|
||||
// Second Key: TeamId
|
||||
// Value : ReceiverId
|
||||
QHash<QPair<int, int>, int> m_receiverIds;
|
||||
|
||||
QVector <int> mainStructureElementIds;
|
||||
LOGGER_T m_logger;
|
||||
|
||||
};
|
||||
} // namespace AudioVideoManagement
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MvsVideoTeamDialog</class>
|
||||
<widget class="QWidget" name="MvsVideoTeamDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>768</width>
|
||||
<height>512</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="lbHeader">
|
||||
<property name="text">
|
||||
<string>Video Team Assignments</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="glMvs"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for Mobile Video System
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2016-12-01
|
||||
*/
|
||||
|
||||
#include "avm_mvs_video_team_gui_plugin.h"
|
||||
|
||||
#include "avm_mvs_video_team_dialog.h"
|
||||
#include "avm_mvs_dialog.h"
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <Services/AudioVideoManagement/avm_operator_rights.h>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QProcess>
|
||||
#include <QScreen>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
|
||||
{
|
||||
return std::make_shared<InterfaceImpl>(session);
|
||||
} // end of createGuiInterface()
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
|
||||
: GuiPluginBase::Interface(session, getLogger("Plugins.Gui.Avm.MobileVideoSystem"))
|
||||
, m_dtc(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
{} // end of ctor()
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool InterfaceImpl::fetchInterfaces()
|
||||
{
|
||||
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
|
||||
const bool enableMobileVideoSystem = ps->value(QStringLiteral("avm"),
|
||||
QStringLiteral("enableMobileVideoSystem")).toBool();
|
||||
if (!enableMobileVideoSystem)
|
||||
return true;
|
||||
|
||||
if (!m_session->getDtc<AudioVideoManagement::DataInterface>(m_dtc))
|
||||
return false;
|
||||
if (!m_session->getFtc<AudioVideoManagement::DataInterface>(m_ftc))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void InterfaceImpl::clearInterfaces()
|
||||
{
|
||||
m_dtc = nullptr;
|
||||
m_ftc = nullptr;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
|
||||
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
|
||||
const bool enableMobileVideoSystem = ps->value(QStringLiteral("avm"),
|
||||
QStringLiteral("enableMobileVideoSystem")).toBool();
|
||||
if (!enableMobileVideoSystem)
|
||||
return ret;
|
||||
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("Mobile Video System");
|
||||
plData.identifier = QLatin1String("mvsMvsStart");
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:mobile_video.svg"));
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
|
||||
plData.operatorRight = OperatorRights::MobileVideoSystem::MvsStart;
|
||||
plData.createWidgetFunc = [this](QWidget * parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new MvsVideoTeamDialog(parent),
|
||||
m_session, m_dtc, m_ftc);
|
||||
};
|
||||
ret.append(plData);
|
||||
|
||||
plData.menuText = tr("Configure Mobile Video Teams");
|
||||
plData.identifier = QLatin1String("mvsVideoTeamConfig");
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:mobile_video_team_config.svg"));
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::ePlanning;
|
||||
plData.operatorRight = OperatorRights::MobileVideoSystem::MvsConfig;
|
||||
plData.createWidgetFunc = [this](QWidget * parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new MvsDialog(menuGroup(), m_session, parent),
|
||||
m_dtc, m_ftc);
|
||||
};
|
||||
ret.append(plData);
|
||||
|
||||
#ifndef Q_OS_WIN
|
||||
const QString rdesktopIP = ps->value(QStringLiteral("avm"), QStringLiteral("mvsRDesktopIP")).toString();
|
||||
if (!rdesktopIP.isEmpty())
|
||||
{
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("MVS remote desktop");
|
||||
plData.identifier = QStringLiteral("remoteDesktopMvs");
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:mvs_remote_desktop.svg"));
|
||||
plData.operatorRight = OperatorRights::MvsConfig;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::ePlanning;
|
||||
plData.createWidgetFunc = [this, rdesktopIP](QWidget *parent)
|
||||
{
|
||||
return onMvsRemoteDesktop(rdesktopIP, parent);
|
||||
};
|
||||
ret.append(plData);
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
} // end of getActions()
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onMvsRemoteDesktop(const QString &rdesktopIP, QWidget *parent)
|
||||
{
|
||||
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
|
||||
const QString username = ps->value(QStringLiteral("avm"), QStringLiteral("mvsUser")).toString();
|
||||
const QString password = ps->value(QStringLiteral("avm"), QStringLiteral("mvsPassword")).toString();
|
||||
QSize s = QApplication::desktop()->screenGeometry(parent).size();
|
||||
if (s.isEmpty())
|
||||
s = QSize(1920, 1080);
|
||||
s = s * 7 / 8;
|
||||
if (m_rdesktop && m_rdesktop->state() == QProcess::ProcessState::Running)
|
||||
{
|
||||
disconnect(m_rdesktop);
|
||||
m_rdesktop->close();
|
||||
m_rdesktop->deleteLater();
|
||||
}
|
||||
m_rdesktop = new QProcess(this);
|
||||
m_rdesktop->setProgram(QStringLiteral("rdesktop"));
|
||||
m_rdesktop->setArguments({rdesktopIP,
|
||||
QStringLiteral("-g%1x%2").arg(s.width()).arg(s.height()),
|
||||
QStringLiteral("-u%1").arg(username),
|
||||
QStringLiteral("-p%1").arg(password)});
|
||||
connect(m_rdesktop, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||
this, [this]() { m_rdesktop->deleteLater(); m_rdesktop = nullptr; });
|
||||
m_rdesktop->start();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
} // namespace AudioVideoManagement
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for MobileVideoSystem
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2016-12-01
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AudioVideoManagement/logger.h>
|
||||
#include <AudioVideoManagement/avm_dtc.h>
|
||||
#include <AudioVideoManagement/avm_ftc.h>
|
||||
#include <Plugins/AudioVideoManagement/avm_data_plugin_interface.h>
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Plugins/AudioVideoManagement/avm_mvs_video_team_gui_plugin_interface.h>
|
||||
|
||||
class QProcess;
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:avm.mvs")
|
||||
Q_INTERFACES(GuiPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
|
||||
QString pluginName() override { return QStringLiteral("AvmMvsVideoTeamGuiPlugin"); }
|
||||
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override
|
||||
{
|
||||
return (partition == IDL::PartitionType::Exercise);
|
||||
}
|
||||
};
|
||||
|
||||
class InterfaceImpl final : public QObject, public GuiPluginBase::Interface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
||||
|
||||
bool fetchInterfaces() override;
|
||||
void clearInterfaces() override;
|
||||
QString menuGroup() const override { return tr("Audio / Video"); }
|
||||
QVector<LtsWidgets::PluginData> getActions() override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override { return partition == IDL::PartitionType::Exercise; }
|
||||
|
||||
private:
|
||||
LtsWidgets::LtsDialog *onMvsRemoteDesktop(const QString &rdesktopIP, QWidget *parent);
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Ftc> m_ftc;
|
||||
QProcess *m_rdesktop = nullptr;
|
||||
};
|
||||
|
||||
} // namespace AudioVideoManagement
|
||||
@@ -0,0 +1,86 @@
|
||||
#include "receiverelement.h"
|
||||
#include "ui_receiverelement.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStyleOption>
|
||||
#include <QStyle>
|
||||
|
||||
ReceiverElement::ReceiverElement(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_ui(new Ui::ReceiverElement)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
connect(m_ui->receiverWidget, &ReceiverItem::clicked,
|
||||
this, &ReceiverElement::clicked);
|
||||
|
||||
setProperty("isChecked", false);
|
||||
}
|
||||
|
||||
ReceiverElement::~ReceiverElement()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void ReceiverElement::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QStyleOption opt;
|
||||
opt.initFrom(this);
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||
}
|
||||
|
||||
QRadioButton *ReceiverElement::radioButton()
|
||||
{
|
||||
return m_ui->radioButton;
|
||||
}
|
||||
|
||||
bool ReceiverElement::init(const AudioVideoManagement::VideoReceiver &rec)
|
||||
{
|
||||
setProperty("teamId", rec.teamId());
|
||||
setProperty("recId", rec.id());
|
||||
|
||||
setSnr(rec.snr());
|
||||
setDbm(rec.dbm());
|
||||
setButtonChecked(rec.isActive());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ReceiverElement::setButtonChecked(bool checked)
|
||||
{
|
||||
setProperty("isChecked", checked);
|
||||
|
||||
style()->unpolish(this);
|
||||
style()->polish(this);
|
||||
QEvent event(QEvent::StyleChange);
|
||||
QApplication::sendEvent(this, &event);
|
||||
update();
|
||||
updateGeometry();
|
||||
}
|
||||
|
||||
void ReceiverElement::setSnr(int snr)
|
||||
{
|
||||
m_ui->receiverWidget->setSnr(snr);
|
||||
}
|
||||
|
||||
void ReceiverElement::setDbm(int dbm)
|
||||
{
|
||||
m_ui->receiverWidget->setDbm(dbm);
|
||||
}
|
||||
|
||||
void ReceiverElement::setStreamName(const QString &streamName)
|
||||
{
|
||||
m_streamName = streamName;
|
||||
m_ui->receiverWidget->setStreamName(streamName);
|
||||
}
|
||||
|
||||
void ReceiverElement::setFrequency(int frequency)
|
||||
{
|
||||
m_ui->receiverWidget->setFrequency(frequency);
|
||||
}
|
||||
|
||||
void ReceiverElement::setIsLocked(bool isLocked)
|
||||
{
|
||||
m_ui->receiverWidget->setIsLocked(isLocked);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include <QRadioButton>
|
||||
#include <AudioVideoManagement/avm.hpp>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class ReceiverElement;
|
||||
}
|
||||
|
||||
class ReceiverElement : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ReceiverElement(QWidget *parent = nullptr);
|
||||
~ReceiverElement();
|
||||
|
||||
bool init(const AudioVideoManagement::VideoReceiver &rec);
|
||||
QRadioButton *radioButton();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
public slots:
|
||||
void setButtonChecked(bool checked);
|
||||
void setSnr(int snr);
|
||||
void setDbm(int dbm);
|
||||
void setStreamName(const QString &streamName);
|
||||
void setFrequency(int frequency);
|
||||
void setIsLocked(bool isLocked);
|
||||
|
||||
signals:
|
||||
void clicked(bool checked = false);
|
||||
|
||||
private:
|
||||
QString m_streamName;
|
||||
Ui::ReceiverElement *m_ui;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ReceiverElement</class>
|
||||
<widget class="QWidget" name="ReceiverElement">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>460</width>
|
||||
<height>80</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ReceiverItem" name="receiverWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ReceiverItem</class>
|
||||
<extends>QPushButton</extends>
|
||||
<header>receiveritem.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,57 @@
|
||||
#include "receiveritem.h"
|
||||
#include "ui_receiveritem.h"
|
||||
|
||||
ReceiverItem::ReceiverItem(QWidget *parent)
|
||||
: QGroupBox(parent)
|
||||
, m_ui(new Ui::ReceiverButton)
|
||||
, m_timer(new QTimer(this))
|
||||
{
|
||||
int updateDelay = 30000;
|
||||
m_ui->setupUi(this);
|
||||
|
||||
connect(m_timer, &QTimer::timeout,
|
||||
this, &ReceiverItem::availableTimerSlot);
|
||||
|
||||
// msec
|
||||
m_timer->start(updateDelay);
|
||||
}
|
||||
|
||||
ReceiverItem::~ReceiverItem()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void ReceiverItem::setSnr(int snr)
|
||||
{
|
||||
m_ui->pbSnr->setValue(snr);
|
||||
setStyleSheet(QStringLiteral("background-color: white"));
|
||||
m_timer->start();
|
||||
}
|
||||
|
||||
void ReceiverItem::setDbm(int dbm)
|
||||
{
|
||||
m_ui->pbDbm->setValue(dbm);
|
||||
}
|
||||
|
||||
void ReceiverItem::setStreamName(const QString &streamName)
|
||||
{
|
||||
setTitle(streamName);
|
||||
}
|
||||
|
||||
void ReceiverItem::setFrequency(int frequency)
|
||||
{
|
||||
m_ui->lblFrequency->setText(QString::number(frequency));
|
||||
}
|
||||
|
||||
void ReceiverItem::setIsLocked(bool isLocked)
|
||||
{
|
||||
if (isLocked)
|
||||
m_ui->lbIsLocked->setText(tr("connected"));
|
||||
else
|
||||
m_ui->lbIsLocked->setText(tr("not connected"));
|
||||
}
|
||||
|
||||
void ReceiverItem::availableTimerSlot()
|
||||
{
|
||||
setStyleSheet(QStringLiteral("background-color: red"));
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
#include <QGroupBox>
|
||||
#include <QTimer>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class ReceiverButton;
|
||||
}
|
||||
|
||||
class ReceiverItem : public QGroupBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ReceiverItem(QWidget *parent = nullptr);
|
||||
~ReceiverItem();
|
||||
|
||||
public slots:
|
||||
void setSnr(int snr);
|
||||
void setDbm(int dbm);
|
||||
void setStreamName(const QString &streamName);
|
||||
void setFrequency(int frequency);
|
||||
void setIsLocked(bool isLocked);
|
||||
void availableTimerSlot();
|
||||
|
||||
private:
|
||||
Ui::ReceiverButton *m_ui;
|
||||
QTimer *m_timer;
|
||||
};
|
||||
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ReceiverButton</class>
|
||||
<widget class="QGroupBox" name="ReceiverButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>295</width>
|
||||
<height>83</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>70</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="lbIsLocked">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblDbm">
|
||||
<property name="text">
|
||||
<string>dBm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Camera</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QProgressBar" name="pbDbm">
|
||||
<property name="value">
|
||||
<number>24</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Frequency</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QProgressBar" name="pbSnr">
|
||||
<property name="value">
|
||||
<number>24</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="lblFrequency">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblSnr">
|
||||
<property name="text">
|
||||
<string>S/N</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in new issue
Block a user