Apply clang-format to Lts/Common and DTC/enum headers
- Formatted all CodeGen module files (9 files) - Formatted LtsAppDescriptor module files - Formatted LtsAppManager/AppChooser files - Applied clang-format to all DTC and enum headers across modules - Removed coordTransTests from CommonUnitTestsPlaceholder (moved to tests/) Cosmetic changes only, no functional modifications. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
848 files changed
+89305
-100020
No files matched your search
Executable → Regular
+108
-135
@@ -1,218 +1,191 @@
|
||||
|
||||
|
||||
|
||||
#include "avm_mvs_dialog.h"
|
||||
#include "ui_avm_mvs_dialog.h"
|
||||
#include "avm_mvs_edit_dialog.h"
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
#include <FileManagement/flm_translation.h>
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include "avm_mvs_edit_dialog.h"
|
||||
#include "ui_avm_mvs_dialog.h"
|
||||
|
||||
#include <FileManagement/flm_translation.h>
|
||||
#include <LtsPrinting/printing.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.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)
|
||||
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_ui->setupUi(this);
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Configuration_Video_Teams"));
|
||||
m_ui->setupUi(this);
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Configuration_Video_Teams"));
|
||||
}
|
||||
|
||||
MvsDialog::~MvsDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void MvsDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Configure Mobile Video Teams"));
|
||||
translate(m_ui, tr("Configure Mobile Video Teams"));
|
||||
}
|
||||
|
||||
void MvsDialog::tableColumnOrganiserSetting()
|
||||
{
|
||||
|
||||
m_ui->dataView->setColumnsOrganiserEnabled(identifier(), true);
|
||||
|
||||
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)
|
||||
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_model = new MvsModel(this);
|
||||
|
||||
m_ui->dataView->setModel(m_model);
|
||||
m_avmDtc = avmDtc;
|
||||
m_avmFtc = avmFtc;
|
||||
|
||||
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);
|
||||
if (!m_model->init(m_session->exerciseId(), avmDtc))
|
||||
{
|
||||
delete m_model;
|
||||
m_model = nullptr;
|
||||
ERROR_LOG(m_logger) << "Could not init model";
|
||||
return false;
|
||||
}
|
||||
|
||||
connect(m_ui->dataView, &LtsDataView::LtsDataView::signalSelectionChanged,
|
||||
this, &MvsDialog::onSelectionChanged);
|
||||
m_ui->dataView->setModel(m_model);
|
||||
|
||||
onSelectionChanged();
|
||||
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::signalDoubleClicked,
|
||||
this, &MvsDialog::onEditClicked);
|
||||
connect(m_ui->dataView, &LtsDataView::LtsDataView::signalSelectionChanged, this, &MvsDialog::onSelectionChanged);
|
||||
|
||||
|
||||
m_buttonBox->connectLibraryButton(this,
|
||||
&MvsDialog::onImportButtonClicked,
|
||||
&MvsDialog::onExportButtonClicked);
|
||||
onSelectionChanged();
|
||||
|
||||
if (!m_session->getForeignGuiInterface<FileManagement::ForeignGuiInterface>(m_flmGui))
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Library, false);
|
||||
connect(m_ui->dataView, &LtsDataView::LtsDataView::signalDoubleClicked, this, &MvsDialog::onEditClicked);
|
||||
|
||||
return true;
|
||||
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)
|
||||
void MvsDialog::onVideoTeamModifyReply(const Core::FunctionReplyObject& replyObject)
|
||||
{
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
}
|
||||
|
||||
|
||||
void MvsDialog::onAddClicked()
|
||||
{
|
||||
EditVideoTeamDialog *dialog = new EditVideoTeamDialog(m_avmDtc, m_session->exerciseId(), this);
|
||||
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);
|
||||
});
|
||||
});
|
||||
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);
|
||||
addDialog(dialog, m_menuGroup, QStringLiteral("NewVideoTeam"), LtsWidgets::LayoutArea::eDialogTab);
|
||||
}
|
||||
|
||||
void MvsDialog::onEditClicked()
|
||||
{
|
||||
QModelIndex currentIndex = m_ui->dataView->currentIndex();
|
||||
QModelIndex currentIndex = m_ui->dataView->currentIndex();
|
||||
|
||||
if (!currentIndex.isValid())
|
||||
return;
|
||||
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);
|
||||
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);
|
||||
});
|
||||
});
|
||||
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);
|
||||
addDialog(dialog, m_menuGroup, QStringLiteral("EditVideoTeam%1").arg(config.id()),
|
||||
LtsWidgets::LayoutArea::eDialogTab);
|
||||
}
|
||||
|
||||
void MvsDialog::onRemoveClicked()
|
||||
{
|
||||
QModelIndex currentIndex = m_ui->dataView->currentIndex();
|
||||
QModelIndex currentIndex = m_ui->dataView->currentIndex();
|
||||
|
||||
if (!currentIndex.isValid())
|
||||
return;
|
||||
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);
|
||||
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());
|
||||
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();
|
||||
QModelIndex currentIndex = m_ui->dataView->currentIndex();
|
||||
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, currentIndex.isValid());
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, currentIndex.isValid());
|
||||
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());
|
||||
LtsPrinting::printView(m_session, this, m_ui->dataView->treeView());
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MvsDialog::onExportButtonClicked()
|
||||
{
|
||||
QByteArray byteArray = m_model->modelToJson();
|
||||
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 ";
|
||||
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() ";
|
||||
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)))
|
||||
QByteArray content;
|
||||
int fileId = m_flmGui->loadFileContent(this, content, {FileManagement::FileType::Xml}, m_session->exerciseId(),
|
||||
FileManagement::toString(FileManagement::XmlType::AVMMvsDialog));
|
||||
if (fileId > 0)
|
||||
{
|
||||
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]()
|
||||
if (!m_flmGui->isXmlType(content, FileManagement::toString(FileManagement::XmlType::AVMMvsDialog)))
|
||||
{
|
||||
return m_avmFtc->videoTeamModifyRequest(request, this);
|
||||
});
|
||||
}
|
||||
INFO_LOG(m_logger) << "--- onImportButtonClicked() ";
|
||||
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
|
||||
Executable → Regular
+38
-42
@@ -1,16 +1,13 @@
|
||||
|
||||
|
||||
|
||||
#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 <AudioVideoManagement/avm_ftc.h>
|
||||
#include <AudioVideoManagement/logger.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <Plugins/FileManagement/flm_explorer_gui_plugin_interface.h>
|
||||
#include <memory>
|
||||
|
||||
namespace Ui
|
||||
@@ -34,7 +31,7 @@ namespace Interface
|
||||
{
|
||||
class Dtc;
|
||||
}
|
||||
}
|
||||
} // namespace AudioVideoManagement
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
@@ -42,48 +39,47 @@ namespace Interface
|
||||
{
|
||||
class Dtc;
|
||||
}
|
||||
}
|
||||
} // namespace ParticipantManagement
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class MvsDialog
|
||||
: public LtsWidgets::LtsDialog
|
||||
, protected AudioVideoManagement::Interface::Ftc::VideoTeamModifyReplyHandler
|
||||
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();
|
||||
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);
|
||||
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;
|
||||
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 Q_SLOTS:
|
||||
void onAddClicked();
|
||||
void onEditClicked();
|
||||
void onRemoveClicked();
|
||||
void onSelectionChanged();
|
||||
void onPrint();
|
||||
void onExportButtonClicked();
|
||||
void onImportButtonClicked();
|
||||
|
||||
private:
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
void retranslate() override;
|
||||
void tableColumnOrganiserSetting() override;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void retranslate() override;
|
||||
void tableColumnOrganiserSetting() override;
|
||||
private:
|
||||
LtsSession::LtsSession* m_session;
|
||||
Ui::MvsDialog* m_ui;
|
||||
QString m_menuGroup;
|
||||
MvsModel* m_model;
|
||||
LtsUtils::RequestHelper* m_requestHelper;
|
||||
|
||||
private:
|
||||
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;
|
||||
};
|
||||
}
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Dtc> m_avmDtc;
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Ftc> m_avmFtc;
|
||||
std::shared_ptr<FileManagement::ForeignGuiInterface> m_flmGui;
|
||||
};
|
||||
} // namespace AudioVideoManagement
|
||||
Executable → Regular
+33
-44
@@ -1,13 +1,11 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
|
||||
#include <AudioVideoManagement/logger.h>
|
||||
#include <AudioVideoManagement/avm_dtc.h>
|
||||
#include <AudioVideoManagement/avm_ftc.h>
|
||||
#include <AudioVideoManagement/logger.h>
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
|
||||
class QCheckBox;
|
||||
|
||||
@@ -16,55 +14,46 @@ namespace Ui
|
||||
class EditVideoTeamDialog;
|
||||
}
|
||||
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
class EditVideoTeamDialog
|
||||
: public LtsWidgets::LtsDialog
|
||||
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);
|
||||
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();
|
||||
~EditVideoTeamDialog();
|
||||
|
||||
void retranslate() override;
|
||||
void retranslate() override;
|
||||
|
||||
Q_SIGNALS:
|
||||
void modifyRequest(const AudioVideoManagement::VideoTeamModifyRequest &request);
|
||||
Q_SIGNALS:
|
||||
void modifyRequest(const AudioVideoManagement::VideoTeamModifyRequest& request);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
NGL::INGLLogger& m_logger;
|
||||
bool apply() override;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool apply() override;
|
||||
private:
|
||||
EditVideoTeamDialog(int32_t id, const std::shared_ptr<AudioVideoManagement::Interface::Dtc>& avmDtc,
|
||||
int32_t exerciseId, QWidget* parent);
|
||||
|
||||
private:
|
||||
EditVideoTeamDialog(int32_t id,
|
||||
const std::shared_ptr<AudioVideoManagement::Interface::Dtc> &avmDtc,
|
||||
int32_t exerciseId,
|
||||
QWidget *parent);
|
||||
void init();
|
||||
|
||||
void init();
|
||||
private Q_SLOTS:
|
||||
void onCheckTakenTeams();
|
||||
void onCurrentTeamChanged();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onCheckTakenTeams();
|
||||
void onCurrentTeamChanged();
|
||||
private:
|
||||
Ui::EditVideoTeamDialog* m_ui;
|
||||
|
||||
private:
|
||||
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;
|
||||
};
|
||||
}
|
||||
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;
|
||||
};
|
||||
} // namespace AudioVideoManagement
|
||||
Executable → Regular
+98
-106
@@ -1,138 +1,130 @@
|
||||
|
||||
|
||||
|
||||
#include "avm_mvs_dialog.h"
|
||||
#include <FileManagement/flm_translation.h>
|
||||
|
||||
#include <FileManagement/flm_translation.h>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
MvsModel::MvsModel(QObject *parent)
|
||||
: LtsAbstractTableModel<AudioVideoManagement::VideoTeam>(
|
||||
MvsModel::MvsModel(QObject* parent)
|
||||
: LtsAbstractTableModel<AudioVideoManagement::VideoTeam>({tr("Video Team Name"), tr("Stream Name")}, parent),
|
||||
m_exerciseId(-1)
|
||||
{
|
||||
tr("Video Team Name"),
|
||||
tr("Stream Name")
|
||||
}, parent)
|
||||
, m_exerciseId(-1)
|
||||
{}
|
||||
|
||||
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)
|
||||
QVariant MvsModel::data(const QModelIndex& index, int role) const
|
||||
{
|
||||
m_avmDtc = avmDtc;
|
||||
m_exerciseId = exerciseId;
|
||||
if (role != Qt::DisplayRole || !indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
m_videoTeams = avmDtc->videoTeams();
|
||||
const AudioVideoManagement::VideoTeam& config = m_vecData.at(index.row());
|
||||
|
||||
connect(m_avmDtc.get(), &AudioVideoManagement::Interface::Dtc::videoTeamChanged,
|
||||
this, [this](const AudioVideoManagement::VideoTeam & data, DataModification modType)
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
switch (index.column())
|
||||
{
|
||||
case CHANNEL:
|
||||
return QString::fromStdString(m_videoTeams.value(config.id()).name());
|
||||
case STREAM_NAME:
|
||||
return QString::fromStdString(config.streamName());
|
||||
}
|
||||
|
||||
if (data.exerciseId() == m_exerciseId)
|
||||
onDataChanged(data, DataModification::eAdded);
|
||||
else
|
||||
onDataChanged(data, DataModification::eRemoved);
|
||||
}
|
||||
);
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
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);
|
||||
bool MvsModel::init(int32_t exerciseId, const std::shared_ptr<AudioVideoManagement::Interface::Dtc>& avmDtc)
|
||||
{
|
||||
m_avmDtc = avmDtc;
|
||||
m_exerciseId = exerciseId;
|
||||
|
||||
return true;
|
||||
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);
|
||||
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;
|
||||
}
|
||||
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);
|
||||
obj[QStringLiteral("videoTeams")] = arr;
|
||||
QJsonDocument doc(obj);
|
||||
return doc.toJson(QJsonDocument::Compact);
|
||||
}
|
||||
|
||||
QVector<VideoTeamModifyRequest> MvsModel::jsonToVideoTeamVector(const QByteArray &content)
|
||||
{
|
||||
|
||||
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();
|
||||
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
|
||||
QVector<VideoTeamModifyRequest> MvsModel::jsonToVideoTeamVector(const QByteArray& content)
|
||||
{
|
||||
|
||||
Q_UNUSED(modType)
|
||||
if (data.exerciseId() != m_exerciseId)
|
||||
return true;
|
||||
return false;
|
||||
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();
|
||||
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
|
||||
Executable → Regular
+20
-28
@@ -1,46 +1,38 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
|
||||
#include <AudioVideoManagement/logger.h>
|
||||
#include <AudioVideoManagement/avm_dtc.h>
|
||||
|
||||
#include <AudioVideoManagement/logger.h>
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <memory>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class MvsModel final
|
||||
: public LtsWidgets::LtsAbstractTableModel<AudioVideoManagement::VideoTeam>
|
||||
class MvsModel final : public LtsWidgets::LtsAbstractTableModel<AudioVideoManagement::VideoTeam>
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
CHANNEL,
|
||||
STREAM_NAME,
|
||||
COUNT
|
||||
};
|
||||
public:
|
||||
enum Columns { CHANNEL, STREAM_NAME, COUNT };
|
||||
|
||||
explicit MvsModel(QObject *parent = nullptr);
|
||||
explicit MvsModel(QObject* parent = nullptr);
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const override final;
|
||||
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:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Dtc> m_avmDtc;
|
||||
int32_t m_exerciseId;
|
||||
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;
|
||||
|
||||
QMap<int32_t, AudioVideoManagement::VideoTeam> m_videoTeams;
|
||||
};
|
||||
}
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Dtc> m_avmDtc;
|
||||
int32_t m_exerciseId;
|
||||
|
||||
QMap<int32_t, AudioVideoManagement::VideoTeam> m_videoTeams;
|
||||
};
|
||||
} // namespace AudioVideoManagement
|
||||
|
||||
Q_DECLARE_METATYPE(AudioVideoManagement::VideoTeam)
|
||||
Executable → Regular
+173
-201
@@ -1,265 +1,237 @@
|
||||
|
||||
|
||||
|
||||
#include "avm_mvs_video_team_dialog.h"
|
||||
#include "ui_avm_mvs_video_team_dialog.h"
|
||||
|
||||
#include "receiverelement.h"
|
||||
#include "ui_avm_mvs_video_team_dialog.h"
|
||||
|
||||
#include <AudioVideoManagement/avm_dtc.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))
|
||||
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_ui->setupUi(this);
|
||||
m_ui->setupUi(this);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Mobile_Video_System"));
|
||||
|
||||
}
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Mobile_Video_System"));
|
||||
}
|
||||
|
||||
MvsVideoTeamDialog::~MvsVideoTeamDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void MvsVideoTeamDialog::retranslate()
|
||||
{
|
||||
QString text = tr("Mobile Video System");
|
||||
translate(m_ui, text);
|
||||
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);
|
||||
}
|
||||
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)
|
||||
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_session = session;
|
||||
|
||||
m_dtc = dtc;
|
||||
m_ftc = ftc;
|
||||
m_dtc = dtc;
|
||||
m_ftc = ftc;
|
||||
|
||||
session->getForeignGuiInterface<FileManagement::ForeignGuiInterface>(m_flmGui);
|
||||
session->getDtc<InfrastructureManagement::DataInterface>(m_ismDtc);
|
||||
session->getForeignGuiInterface<FileManagement::ForeignGuiInterface>(m_flmGui);
|
||||
session->getDtc<InfrastructureManagement::DataInterface>(m_ismDtc);
|
||||
|
||||
m_receiverMap = m_dtc->videoReceivers();
|
||||
m_receiverMap = m_dtc->videoReceivers();
|
||||
|
||||
int row = 1;
|
||||
int column = 2;
|
||||
|
||||
|
||||
int row = 1;
|
||||
int column = 2;
|
||||
QMap<std::string, VideoTeam> teamMap;
|
||||
auto cbVt = [this, &row, &teamMap](const AudioVideoManagement::VideoTeam& vt) {
|
||||
if (vt.exerciseId() != m_session->exerciseId())
|
||||
return;
|
||||
|
||||
QMap<std::string , VideoTeam> teamMap;
|
||||
auto cbVt = [this, &row, &teamMap](const AudioVideoManagement::VideoTeam & vt)
|
||||
{
|
||||
if (vt.exerciseId() != m_session->exerciseId())
|
||||
return;
|
||||
|
||||
|
||||
m_teamToRow.insert(vt.programId() == 3 ? 2 : 1, vt.programId() == 3 ? 2 : 1);
|
||||
teamMap.insert(vt.name(), vt);
|
||||
};
|
||||
m_dtc->videoTeams(cbVt);
|
||||
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)
|
||||
const QMap<int, AudioVideoManagement::VideoReceiver> vts = m_dtc->videoReceivers();
|
||||
QSet<int> teamId;
|
||||
for (auto rec : vts)
|
||||
{
|
||||
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();
|
||||
if (teamMap.value(rec.streamName()).id() > 0)
|
||||
teamId.insert(rec.teamId());
|
||||
}
|
||||
};
|
||||
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)
|
||||
for (auto team : teamId)
|
||||
{
|
||||
ReceiverElement *btn = createReceiverElement(rec);
|
||||
|
||||
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);
|
||||
QLabel* lbl = new QLabel(QStringLiteral("MLVS") + QString::number(team), this);
|
||||
m_ui->glMvs->addWidget(lbl, team == 1 ? 1 : 2, 0);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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)
|
||||
auto cbMs = [this, &column](const InfrastructureManagement::MainStructureElement& mse) {
|
||||
if (mse.structureElementTypeId() == InfrastructureManagement::StructureElementType::RadioStation &&
|
||||
!mse.isDeleted() && mse.id() > 0)
|
||||
{
|
||||
widget->show();
|
||||
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_dtc->videoReceivers(cbRec);
|
||||
enaDisa(true);
|
||||
};
|
||||
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);
|
||||
|
||||
connect(m_dtc.get(), &AudioVideoManagement::Interface::Dtc::videoReceiverChanged, this, &MvsVideoTeamDialog::updateReceiverButton);
|
||||
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);
|
||||
|
||||
return 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);
|
||||
|
||||
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()
|
||||
{
|
||||
|
||||
}
|
||||
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)
|
||||
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)
|
||||
{
|
||||
req.isActive(false);
|
||||
req.id(0);
|
||||
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();
|
||||
int teamId = itBg.value()->property("teamId").toInt();
|
||||
int mainStructureElementId = itBg.value()->checkedId();
|
||||
int oldActiveId = m_dtc->getActiveVideoReceiver(teamId);
|
||||
|
||||
|
||||
if ((m_receiverMap.value(req.id()).isActive() != req.isActive())
|
||||
&& req.id() > 0)
|
||||
{
|
||||
|
||||
if (oldActiveId > 0)
|
||||
{
|
||||
VideoReceiverModifyActiveRequest reqInactive;
|
||||
reqInactive.id(oldActiveId);
|
||||
reqInactive.isActive(false);
|
||||
m_requestHelper->addRequest([this, reqInactive]()
|
||||
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)
|
||||
{
|
||||
return m_ftc->videoReceiverModifyActiveRequest(reqInactive, this);
|
||||
});
|
||||
}
|
||||
m_requestHelper->addRequest([this, req]()
|
||||
{
|
||||
return m_ftc->videoReceiverModifyActiveRequest(req, this);
|
||||
});
|
||||
req.isActive(false);
|
||||
req.id(0);
|
||||
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();
|
||||
|
||||
if ((m_receiverMap.value(req.id()).isActive() != req.isActive()) && req.id() > 0)
|
||||
{
|
||||
|
||||
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();
|
||||
return m_requestHelper->startRequests();
|
||||
}
|
||||
|
||||
ReceiverElement *MvsVideoTeamDialog::createReceiverElement(const VideoReceiver &rec)
|
||||
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;
|
||||
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)
|
||||
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;
|
||||
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());
|
||||
}
|
||||
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
|
||||
Executable → Regular
+45
-53
@@ -1,21 +1,15 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
#include <Services/AudioVideoManagement/logger.h>
|
||||
|
||||
#include <Services/AudioVideoManagement/avm_ftc.h>
|
||||
#include <Services/AudioVideoManagement/avm_dtc.h>
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <Plugins/FileManagement/flm_explorer_gui_plugin_interface.h>
|
||||
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
|
||||
|
||||
#include <Services/AudioVideoManagement/avm_dtc.h>
|
||||
#include <Services/AudioVideoManagement/avm_ftc.h>
|
||||
#include <Services/AudioVideoManagement/logger.h>
|
||||
|
||||
namespace LtsWidgets
|
||||
{
|
||||
@@ -28,66 +22,64 @@ class MvsVideoTeamDialog;
|
||||
}
|
||||
|
||||
class ReceiverElement;
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
class MvsVideoTeamDialog : public LtsWidgets::LtsDialog,
|
||||
private AudioVideoManagement::Interface::Ftc::VideoReceiverModifyActiveReplyHandler
|
||||
private AudioVideoManagement::Interface::Ftc::VideoReceiverModifyActiveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MvsVideoTeamDialog(QWidget *parent = nullptr);
|
||||
~MvsVideoTeamDialog();
|
||||
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);
|
||||
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); }
|
||||
void onVideoReceiverModifyActiveReply(const Core::FunctionReplyObject& reply) override final
|
||||
{
|
||||
m_requestHelper->requestReply(reply);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
NGL::INGLLogger& m_logger;
|
||||
ReceiverElement* createReceiverElement(const VideoReceiver& rec);
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
ReceiverElement *createReceiverElement(const VideoReceiver &rec);
|
||||
private slots:
|
||||
bool apply() override;
|
||||
void updateReceiverButton(const AudioVideoManagement::VideoReceiver& rec, DataModification modType);
|
||||
|
||||
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;
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
void enaDisa(bool enable);
|
||||
void setData();
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Ftc> m_ftc;
|
||||
|
||||
private:
|
||||
Ui::MvsVideoTeamDialog *m_ui;
|
||||
LtsSession::LtsSession *m_session;
|
||||
QString m_menuGroup;
|
||||
std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_ismDtc;
|
||||
std::shared_ptr<FileManagement::ForeignGuiInterface> m_flmGui;
|
||||
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Ftc> m_ftc;
|
||||
AudioVideoManagement::VideoReceiver m_data;
|
||||
|
||||
std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_ismDtc;
|
||||
std::shared_ptr<FileManagement::ForeignGuiInterface> m_flmGui;
|
||||
LtsUtils::RequestHelper* m_requestHelper;
|
||||
|
||||
AudioVideoManagement::VideoReceiver m_data;
|
||||
QMap<qint32, AudioVideoManagement::VideoReceiver> m_receiverMap;
|
||||
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;
|
||||
|
||||
LtsUtils::RequestHelper *m_requestHelper;
|
||||
QHash<QPair<int, int>, int> m_receiverIds;
|
||||
|
||||
QMap<qint32, AudioVideoManagement::VideoReceiver> m_receiverMap;
|
||||
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;
|
||||
|
||||
|
||||
|
||||
|
||||
QHash<QPair<int, int>, int> m_receiverIds;
|
||||
|
||||
QVector <int> mainStructureElementIds;
|
||||
QVector<int> mainStructureElementIds;
|
||||
};
|
||||
}
|
||||
} // namespace AudioVideoManagement
|
||||
Reference in new issue
Block a user