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:
torstenandCopilot committed 2026-08-19 14:46:29 +02:00
1 parent 1881d68aef
commit d6b6ffce7c
848 files changed
+89305 -100020

No files matched your search

@@ -1,250 +1,202 @@
#include "efm_sound_area_edit_dialog.h"
#include <utility>
#include "ui_efm_sound_area_edit_dialog.h"
#include "../logger.h"
#include "efm_sound_area.h"
#include "efm_sound_area_helper.h"
#include "efm_sound_area_edit_model_playlist.h"
#include "efm_sound_area_edit_model_tree.h"
#include "efm_sound_area_helper.h"
#include "efm_switch_item_delegate.h"
#include "../logger.h"
#include "ui_efm_sound_area_edit_dialog.h"
#include <EffectManagement/efm_data_plugin_interface.h>
#include <InfrastructureManagement/ism_dtc.h>
#include <LtsSession/lts_session.h>
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
#include <InfrastructureManagement/ism_dtc.h>
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
#include <LtsWidgets/lts_global_wait_dialog.h>
#include <QtWidgets/QGridLayout>
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
#include <QDialogButtonBox>
#include <QtWidgets/QGridLayout>
#include <utility>
using namespace SoundManagement;
namespace EffectManagement
{
SoundAreaEditDialog::SoundAreaEditDialog(const SoundArea &soundArea, QWidget *parent)
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
, m_soundArea(new SoundArea(soundArea))
, m_ui(new Ui::SoundAreaEditDialog)
SoundAreaEditDialog::SoundAreaEditDialog(const SoundArea& soundArea, QWidget* parent)
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly), m_soundArea(new SoundArea(soundArea)),
m_ui(new Ui::SoundAreaEditDialog)
{
m_ui->setupUi(this);
m_buttonBox->getButton(LtsWidgets::DialogButton::Hide)->setIcon(QIcon(QStringLiteral("icon:avm_stop.svg")));
setOnlineHelpFilename(QStringLiteral("Sound-Area_Edit_Dialog"));
m_ui->setupUi(this);
m_buttonBox->getButton(LtsWidgets::DialogButton::Hide)->setIcon(QIcon(QStringLiteral("icon:avm_stop.svg")));
setOnlineHelpFilename(QStringLiteral("Sound-Area_Edit_Dialog"));
}
SoundAreaEditDialog::~SoundAreaEditDialog()
{
delete m_ui;
delete m_ui;
}
void SoundAreaEditDialog::retranslate()
{
translate(m_ui, tr("Manage Sound Area #%1").arg(m_soundArea->id));
m_buttonBox->getButton(LtsWidgets::DialogButton::Hide)->setText(tr("Stop All Sounds"));
translate(m_ui, tr("Manage Sound Area #%1").arg(m_soundArea->id));
m_buttonBox->getButton(LtsWidgets::DialogButton::Hide)->setText(tr("Stop All Sounds"));
}
void SoundAreaEditDialog::onPlaySound(SoundManagement::SoundCategory category, int soundId, bool inLoop, int volume)
{
qWarning() << "onPlaySound" << volume;
qWarning() << "onPlaySound" << volume;
SoundManagement::PlayControl control = inLoop ? SoundManagement::PlayControl_def::PlayLoop : SoundManagement::PlayControl_def::PlaySingle;
SoundManagement::PlayControl control =
inLoop ? SoundManagement::PlayControl_def::PlayLoop : SoundManagement::PlayControl_def::PlaySingle;
for (const auto &egcuId : std::as_const(m_soundArea->egcuIds))
{
if (!m_egcuCheckBoxes.value(egcuId)->isChecked())
continue;
SoundManagement::ControlSoundRequest req(
egcuId,
soundId,
category,
volume,
control
);
auto *reqHandler = new ControlSoundRequester;
if (!m_somFtc->controlSoundRequest(req, reqHandler))
return;
connect(reqHandler, &ControlSoundRequester::finished,
this, [this, reqHandler](const QString &msg)
for (const auto& egcuId : std::as_const(m_soundArea->egcuIds))
{
if (!msg.isEmpty())
{
LtsWidgets::LtsMessageDialogNew(this, msg);
return;
}
if (!m_egcuCheckBoxes.value(egcuId)->isChecked())
continue;
reqHandler->deleteLater();
});
}
SoundManagement::ControlSoundRequest req(egcuId, soundId, category, volume, control);
auto* reqHandler = new ControlSoundRequester;
if (!m_somFtc->controlSoundRequest(req, reqHandler))
return;
connect(reqHandler, &ControlSoundRequester::finished, this, [this, reqHandler](const QString& msg) {
if (!msg.isEmpty())
{
LtsWidgets::LtsMessageDialogNew(this, msg);
return;
}
reqHandler->deleteLater();
});
}
}
void SoundAreaEditDialog::onStopAllSounds()
{
DEBUG_LOG(m_logger) << "onStopAllSounds";
DEBUG_LOG(m_logger) << "onStopAllSounds";
QList<int32_t> egcuIds;
QList<int32_t> egcuIds;
for (const auto &egcu : std::as_const(m_soundArea->egcuIds))
{
if (!m_egcuCheckBoxes.value(egcu)->isChecked())
continue;
DEBUG_LOG(m_logger) << "onStopAllSounds add egcu=" << egcu;
egcuIds.append(egcu);
}
for (const auto &egcu : std::as_const(egcuIds))
{
DEBUG_LOG(m_logger) << "onStopAllSounds egcu=" << egcu;
SoundManagement::StopAllSoundsRequest req(egcu);
m_somFtc->stopAllSoundsRequest(req, nullptr);
}
}
bool SoundAreaEditDialog::init(LtsSession::LtsSessionDataDds *session)
{
DEBUG_LOG(m_logger) << "init";
m_session = session;
std::shared_ptr<InfrastructureManagement::Interface::Dtc> ismDtc;
if (!m_session->getDtc<InfrastructureManagement::DataInterface>(ismDtc))
{
ERROR_LOG(m_logger) << "connection to ISM-DTC failed";
return false;
}
if (!m_session->getDtc<EffectManagement::DataInterface>(m_somDtc))
{
ERROR_LOG(m_logger) << "connection to SOM-DTC failed";
return false;
}
if (!m_session->getFtc<EffectManagement::DataInterface>(m_somFtc))
{
ERROR_LOG(m_logger) << "connection to SOM-FTC failed";
return false;
}
m_helper = std::make_shared<SoundAreaHelper>(new SoundAreaHelper(ismDtc, m_somDtc));
QGridLayout *layout = new QGridLayout();
int i = 0;
for (const auto &egcu : std::as_const(m_soundArea->egcuIds))
{
QCheckBox *chBox = new QCheckBox(m_helper->egcuName(egcu));
chBox->setChecked(true);
m_egcuCheckBoxes.insert(egcu, chBox);
layout->addWidget(m_egcuCheckBoxes.value(egcu), int(i / 2), i % 2);
++i;
}
m_ui->wEgcu->setLayout(layout);
delete m_treeModel;
m_treeModel = new SoundAreaTreeModel(m_soundArea->egcuIds, m_helper, this);
m_treeModel->init(m_somDtc);
m_ui->tvSounds->setModel(m_treeModel);
m_ui->tvSounds->expandAll();
m_ui->tvSounds->header()->resizeSection(SoundAreaTreeModel::Column::Loop, 50);
m_ui->tvSounds->header()->setSectionResizeMode(SoundAreaTreeModel::Column::Category, QHeaderView::Interactive);
m_ui->tvSounds->header()->setSectionResizeMode(SoundAreaTreeModel::Column::Sound, QHeaderView::Stretch);
m_ui->tvSounds->header()->setSectionResizeMode(SoundAreaTreeModel::Column::Loop, QHeaderView::Fixed);
delete m_playlistModel;
m_playlistModel = new SoundAreaPlaylistModel(m_soundArea->egcuIds, m_helper, this);
m_playlistModel->init(m_somDtc);
m_ui->tvPlaylist->setModel(m_playlistModel);
m_ui->tvPlaylist->horizontalHeader()->resizeSection(SoundAreaPlaylistModel::Column::Duration, 100);
m_ui->tvPlaylist->horizontalHeader()->resizeSection(SoundAreaPlaylistModel::Column::Option, 50);
m_ui->tvPlaylist->horizontalHeader()->setSectionResizeMode(SoundAreaPlaylistModel::Column::Sound, QHeaderView::Stretch);
m_ui->tvPlaylist->horizontalHeader()->setSectionResizeMode(SoundAreaPlaylistModel::Column::Option, QHeaderView::Fixed);
m_ui->tvSounds->setItemDelegateForColumn(SoundAreaTreeModel::Column::Loop, new SwitchItemDelegate(m_treeModel));
m_ui->tvSounds->setItemDelegateForColumn(SoundAreaTreeModel::Column::Volume, new SpinBoxDelegate(m_treeModel));
m_ui->tvPlaylist->setItemDelegate(new SoundAreaEditPlaylistDelegate(m_playlistModel));
connect(m_treeModel, &SoundAreaTreeModel::playSound, this, &SoundAreaEditDialog::onPlaySound);
connect(m_ui->tvSounds, &QTreeView::clicked, m_treeModel, &SoundAreaTreeModel::onSoundTreeItemActivated);
connect(m_ui->tvPlaylist, &QTableView::clicked, this, [this](const QModelIndex &index)
{
if (index.column() != SoundAreaPlaylistModel::Column::Option)
return;
const SoundState ss(m_playlistModel->getRowData(index.row()));
auto *reqHandler = new ControlSoundRequester;
if (!m_somFtc->controlSoundRequest(ControlSoundRequest(ss.egcuId(), ss.soundId(), ss.category(), 0, PlayControl::StopSound), reqHandler))
for (const auto& egcu : std::as_const(m_soundArea->egcuIds))
{
new LtsWidgets::LtsMessageDialogNew(this, tr("Stopping sound failed with unknown error"));
return;
if (!m_egcuCheckBoxes.value(egcu)->isChecked())
continue;
DEBUG_LOG(m_logger) << "onStopAllSounds add egcu=" << egcu;
egcuIds.append(egcu);
}
connect(reqHandler, &ControlSoundRequester::finished,
this, [this, reqHandler](const QString &msg)
for (const auto& egcu : std::as_const(egcuIds))
{
if (!msg.isEmpty())
{
new LtsWidgets::LtsMessageDialogNew(this, msg);
return;
}
DEBUG_LOG(m_logger) << "onStopAllSounds egcu=" << egcu;
SoundManagement::StopAllSoundsRequest req(egcu);
reqHandler->deleteLater();
m_somFtc->stopAllSoundsRequest(req, nullptr);
}
}
bool SoundAreaEditDialog::init(LtsSession::LtsSessionDataDds* session)
{
DEBUG_LOG(m_logger) << "init";
m_session = session;
std::shared_ptr<InfrastructureManagement::Interface::Dtc> ismDtc;
if (!m_session->getDtc<InfrastructureManagement::DataInterface>(ismDtc))
{
ERROR_LOG(m_logger) << "connection to ISM-DTC failed";
return false;
}
if (!m_session->getDtc<EffectManagement::DataInterface>(m_somDtc))
{
ERROR_LOG(m_logger) << "connection to SOM-DTC failed";
return false;
}
if (!m_session->getFtc<EffectManagement::DataInterface>(m_somFtc))
{
ERROR_LOG(m_logger) << "connection to SOM-FTC failed";
return false;
}
m_helper = std::make_shared<SoundAreaHelper>(new SoundAreaHelper(ismDtc, m_somDtc));
QGridLayout* layout = new QGridLayout();
int i = 0;
for (const auto& egcu : std::as_const(m_soundArea->egcuIds))
{
QCheckBox* chBox = new QCheckBox(m_helper->egcuName(egcu));
chBox->setChecked(true);
m_egcuCheckBoxes.insert(egcu, chBox);
layout->addWidget(m_egcuCheckBoxes.value(egcu), int(i / 2), i % 2);
++i;
}
m_ui->wEgcu->setLayout(layout);
delete m_treeModel;
m_treeModel = new SoundAreaTreeModel(m_soundArea->egcuIds, m_helper, this);
m_treeModel->init(m_somDtc);
m_ui->tvSounds->setModel(m_treeModel);
m_ui->tvSounds->expandAll();
m_ui->tvSounds->header()->resizeSection(SoundAreaTreeModel::Column::Loop, 50);
m_ui->tvSounds->header()->setSectionResizeMode(SoundAreaTreeModel::Column::Category, QHeaderView::Interactive);
m_ui->tvSounds->header()->setSectionResizeMode(SoundAreaTreeModel::Column::Sound, QHeaderView::Stretch);
m_ui->tvSounds->header()->setSectionResizeMode(SoundAreaTreeModel::Column::Loop, QHeaderView::Fixed);
delete m_playlistModel;
m_playlistModel = new SoundAreaPlaylistModel(m_soundArea->egcuIds, m_helper, this);
m_playlistModel->init(m_somDtc);
m_ui->tvPlaylist->setModel(m_playlistModel);
m_ui->tvPlaylist->horizontalHeader()->resizeSection(SoundAreaPlaylistModel::Column::Duration, 100);
m_ui->tvPlaylist->horizontalHeader()->resizeSection(SoundAreaPlaylistModel::Column::Option, 50);
m_ui->tvPlaylist->horizontalHeader()->setSectionResizeMode(SoundAreaPlaylistModel::Column::Sound,
QHeaderView::Stretch);
m_ui->tvPlaylist->horizontalHeader()->setSectionResizeMode(SoundAreaPlaylistModel::Column::Option,
QHeaderView::Fixed);
m_ui->tvSounds->setItemDelegateForColumn(SoundAreaTreeModel::Column::Loop, new SwitchItemDelegate(m_treeModel));
m_ui->tvSounds->setItemDelegateForColumn(SoundAreaTreeModel::Column::Volume, new SpinBoxDelegate(m_treeModel));
m_ui->tvPlaylist->setItemDelegate(new SoundAreaEditPlaylistDelegate(m_playlistModel));
connect(m_treeModel, &SoundAreaTreeModel::playSound, this, &SoundAreaEditDialog::onPlaySound);
connect(m_ui->tvSounds, &QTreeView::clicked, m_treeModel, &SoundAreaTreeModel::onSoundTreeItemActivated);
connect(m_ui->tvPlaylist, &QTableView::clicked, this, [this](const QModelIndex& index) {
if (index.column() != SoundAreaPlaylistModel::Column::Option)
return;
const SoundState ss(m_playlistModel->getRowData(index.row()));
auto* reqHandler = new ControlSoundRequester;
if (!m_somFtc->controlSoundRequest(
ControlSoundRequest(ss.egcuId(), ss.soundId(), ss.category(), 0, PlayControl::StopSound), reqHandler))
{
new LtsWidgets::LtsMessageDialogNew(this, tr("Stopping sound failed with unknown error"));
return;
}
connect(reqHandler, &ControlSoundRequester::finished, this, [this, reqHandler](const QString& msg) {
if (!msg.isEmpty())
{
new LtsWidgets::LtsMessageDialogNew(this, msg);
return;
}
reqHandler->deleteLater();
});
});
m_buttonBox->connectButton(LtsWidgets::DialogButton::Hide, this, &SoundAreaEditDialog::onStopAllSounds);
});
m_buttonBox->connectButton(LtsWidgets::DialogButton::Hide, this, &SoundAreaEditDialog::onStopAllSounds);
DEBUG_LOG(m_logger) << "init successful";
return true;
DEBUG_LOG(m_logger) << "init successful";
return true;
}
}
} // namespace EffectManagement
@@ -1,14 +1,12 @@
#pragma once
#include <LtsWidgets/lts_dialog.h>
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
#include <LtsWidgets/lts_dialog.h>
#include <SoundManagement/som_dtc.h>
#include <SoundManagement/som_ftc.h>
namespace NGL
{
class INGLLogger;
@@ -28,8 +26,7 @@ namespace Ui
{
class SoundAreaEditDialog;
class AddSoundProcessDialog;
}
} // namespace Ui
namespace EffectManagement
{
@@ -40,113 +37,60 @@ class SoundAreaTreeModel;
class SoundAreaPlaylistModel;
class SoundAreaEditDialog;
class ControlSoundRequester
: public QObject
, public SoundManagement::Interface::Ftc::ControlSoundReplyHandler
class ControlSoundRequester : public QObject, public SoundManagement::Interface::Ftc::ControlSoundReplyHandler
{
Q_OBJECT
public:
void onControlSoundReply(const Core::FunctionReplyObject &reply) override final
{
m_reply = reply;
emit finished(m_reply.translated());
deleteLater();
}
Q_OBJECT
public:
void onControlSoundReply(const Core::FunctionReplyObject& reply) override final
{
m_reply = reply;
emit finished(m_reply.translated());
deleteLater();
}
signals:
void finished(const QString &msg);
signals:
void finished(const QString& msg);
private:
NGL::INGLLogger &m_logger;
Core::FunctionReplyObject m_reply;
private:
NGL::INGLLogger& m_logger;
Core::FunctionReplyObject m_reply;
};
class SoundAreaEditDialog
: public LtsWidgets::LtsDialog
class SoundAreaEditDialog : public LtsWidgets::LtsDialog
{
Q_OBJECT
Q_OBJECT
public:
explicit SoundAreaEditDialog(const SoundArea &soundArea, QWidget *parent = nullptr);
~SoundAreaEditDialog();
public:
explicit SoundAreaEditDialog(const SoundArea& soundArea, QWidget* parent = nullptr);
~SoundAreaEditDialog();
private slots:
private slots:
void onPlaySound(SoundManagement::SoundCategory category, int soundId, bool inLoop, int volume);
void onPlaySound(SoundManagement::SoundCategory category, int soundId, bool inLoop, int volume);
void onStopAllSounds();
public:
bool init(LtsSession::LtsSessionDataDds* session);
void onStopAllSounds();
private:
void retranslate() override;
std::shared_ptr<SoundManagement::Interface::Dtc> m_somDtc{nullptr};
std::shared_ptr<SoundManagement::Interface::Ftc> m_somFtc{nullptr};
public:
bool init(LtsSession::LtsSessionDataDds *session);
std::shared_ptr<SoundAreaHelper> m_helper{nullptr};
private:
void retranslate() override;
QString m_menuGroup;
SoundArea* m_soundArea;
SoundAreaTreeModel* m_treeModel{nullptr};
SoundAreaPlaylistModel* m_playlistModel{nullptr};
std::shared_ptr<SoundManagement::Interface::Dtc> m_somDtc{nullptr};
std::shared_ptr<SoundManagement::Interface::Ftc> m_somFtc{nullptr};
QHash<int32_t, QCheckBox*> m_egcuCheckBoxes;
std::shared_ptr<SoundAreaHelper> m_helper{nullptr};
LtsSession::LtsSessionDataDds* m_session{nullptr};
Ui::SoundAreaEditDialog* m_ui{nullptr};
};
QString m_menuGroup;
SoundArea *m_soundArea;
SoundAreaTreeModel *m_treeModel{nullptr};
SoundAreaPlaylistModel *m_playlistModel{nullptr};
QHash<int32_t, QCheckBox *> m_egcuCheckBoxes;
LtsSession::LtsSessionDataDds *m_session{nullptr};
Ui::SoundAreaEditDialog *m_ui{nullptr};
};
}
} // namespace EffectManagement
@@ -1,268 +1,232 @@
#include "efm_sound_area_edit_model_playlist.h"
#include <utility>
#include "efm_sound_area_helper.h"
#include "../logger.h"
#include "efm_sound_area_helper.h"
#include <QMouseEvent>
#include <QApplication>
#include <QTimer>
#include <QTime>
#include <QSpinBox>
#include <QDebug>
#include <QMouseEvent>
#include <QSpinBox>
#include <QTime>
#include <QTimer>
#include <utility>
namespace EffectManagement
{
QIcon SoundAreaEditPlaylistDelegate::s_iconInf = QIcon(QStringLiteral("icon:infinity.svg"));
SoundAreaEditPlaylistDelegate::SoundAreaEditPlaylistDelegate(QObject *parent) : QStyledItemDelegate(parent),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
}
void SoundAreaEditPlaylistDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
const QVariant data(index.data(Qt::DisplayRole));
if ((index.column() == SoundAreaPlaylistModel::Column::Duration) && (data.toString().isEmpty()))
{
s_iconInf.paint(painter, option.rect, Qt::AlignCenter);
return;
}
if (index.column() != SoundAreaPlaylistModel::Column::Option)
{
QStyledItemDelegate::paint(painter, option, index);
return;
}
QStyleOptionButton button;
button.rect = option.rect;
button.state = QStyle::State_Enabled;
button.iconSize = QSize(25, 25);
button.icon = QIcon(QStringLiteral("icon:delete.svg"));
QApplication::style()->drawControl(QStyle::CE_PushButton, &button, painter);
}
SoundAreaPlaylistModel::SoundAreaPlaylistModel(const QVector<int32_t> &egcuIds, std::shared_ptr<SoundAreaHelper> &helper, QWidget *parent)
: LtsAbstractTableModel<SoundState>({tr("Category"),
tr("Sound"),
tr("EGCU"),
tr("Duration"),
tr("Option")},
parent)
, m_helper(helper)
, m_egcuIds(egcuIds)
SoundAreaEditPlaylistDelegate::SoundAreaEditPlaylistDelegate(QObject* parent)
: QStyledItemDelegate(parent), m_logger(NGL::NGLLoggerBootstrap::getLogger())
{
}
void SoundAreaEditPlaylistDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option,
const QModelIndex& index) const
{
const QVariant data(index.data(Qt::DisplayRole));
if ((index.column() == SoundAreaPlaylistModel::Column::Duration) && (data.toString().isEmpty()))
{
s_iconInf.paint(painter, option.rect, Qt::AlignCenter);
return;
}
if (index.column() != SoundAreaPlaylistModel::Column::Option)
{
QStyledItemDelegate::paint(painter, option, index);
return;
}
QStyleOptionButton button;
button.rect = option.rect;
button.state = QStyle::State_Enabled;
button.iconSize = QSize(25, 25);
button.icon = QIcon(QStringLiteral("icon:delete.svg"));
QApplication::style()->drawControl(QStyle::CE_PushButton, &button, painter);
}
SoundAreaPlaylistModel::SoundAreaPlaylistModel(const QVector<int32_t>& egcuIds,
std::shared_ptr<SoundAreaHelper>& helper, QWidget* parent)
: LtsAbstractTableModel<SoundState>({tr("Category"), tr("Sound"), tr("EGCU"), tr("Duration"), tr("Option")},
parent),
m_helper(helper), m_egcuIds(egcuIds)
{
}
void SoundAreaPlaylistModel::onTimeout()
{
for (int i = 0; i < m_vecData.count(); ++i)
m_vecData[i].duration(std::max(0, m_vecData[i].duration() - 1000));
emit dataChanged({}, {});
for (int i = 0; i < m_vecData.count(); ++i)
m_vecData[i].duration(std::max(0, m_vecData[i].duration() - 1000));
emit dataChanged({}, {});
}
bool SoundAreaPlaylistModel::init(std::shared_ptr<SoundManagement::Interface::Dtc> &somDtc)
bool SoundAreaPlaylistModel::init(std::shared_ptr<SoundManagement::Interface::Dtc>& somDtc)
{
DEBUG_LOG(m_logger) << "init";
DEBUG_LOG(m_logger) << "init";
const QMap<int32_t, SoundManagement::SoundState> soundStates = somDtc->soundStates();
for (const auto &data : std::as_const(soundStates))
{
if (!m_egcuIds.contains(data.egcuId()))
continue;
const QMap<int32_t, SoundManagement::SoundState> soundStates = somDtc->soundStates();
for (const auto& data : std::as_const(soundStates))
{
if (!m_egcuIds.contains(data.egcuId()))
continue;
addActiveSound(SoundState(data));
}
addActiveSound(SoundState(data));
}
somDtc->enableSoundState(true);
somDtc->enableSoundState(true);
connect(somDtc.get(), &SoundManagement::Interface::Dtc::soundStateChanged, this,
[this](const SoundManagement::SoundState &data, DataModification modType)
{
onDataChanged(SoundState(data), modType);
});
connect(somDtc.get(), &SoundManagement::Interface::Dtc::soundStateChanged, this,
[this](const SoundManagement::SoundState& data, DataModification modType) {
onDataChanged(SoundState(data), modType);
});
m_timer = new QTimer(this);
connect(m_timer, &QTimer::timeout, this, &SoundAreaPlaylistModel::onTimeout);
m_timer->start(1000);
m_timer = new QTimer(this);
connect(m_timer, &QTimer::timeout, this, &SoundAreaPlaylistModel::onTimeout);
m_timer->start(1000);
DEBUG_LOG(m_logger) << "init successful";
return true;
DEBUG_LOG(m_logger) << "init successful";
return true;
}
int SoundAreaPlaylistModel::indexOf(const SoundState &data) const
int SoundAreaPlaylistModel::indexOf(const SoundState& data) const
{
int idx = 0;
for (const auto &item : std::as_const(m_vecData))
{
if ( (item.category() == data.category()) &&
(item.soundId() == data.soundId()) &&
(item.egcuId() == data.egcuId()) )
return idx;
++idx;
}
return -1;
int idx = 0;
for (const auto& item : std::as_const(m_vecData))
{
if ((item.category() == data.category()) && (item.soundId() == data.soundId()) &&
(item.egcuId() == data.egcuId()))
return idx;
++idx;
}
return -1;
}
bool SoundAreaPlaylistModel::addActiveSound(SoundState data)
{
data.duration(m_helper->soundDuration(data.category(), data.soundId()));
const int row = indexOf(data);
const QString name(m_helper->soundName(data.category(), data.soundId()));
data.duration(m_helper->soundDuration(data.category(), data.soundId()));
const int row = indexOf(data);
const QString name(m_helper->soundName(data.category(), data.soundId()));
if (row != -1)
{
ERROR_LOG(m_logger) << "'" << name << "' is already active";
return false;
}
data.status(SoundState::Status::Active);
insertRow(data);
DEBUG_LOG(m_logger) << "adding '" << name << "' to active Sounds";
return true;
}
bool SoundAreaPlaylistModel::removeActiveSound(const QModelIndex &index)
{
if (!index.isValid())
return false;
return removeRow(index.row());
}
QVariant SoundAreaPlaylistModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
const SoundState &soundState = m_vecData.at(index.row());
switch (role)
{
case Qt::DisplayRole:
case Qt::EditRole:
switch (index.column())
if (row != -1)
{
case Column::Category:
return m_helper->categoryName(soundState.category());
ERROR_LOG(m_logger) << "'" << name << "' is already active";
return false;
}
case Column::Sound:
return m_helper->soundName(soundState.category(), soundState.soundId());
data.status(SoundState::Status::Active);
insertRow(data);
case Column::Egcu:
return m_helper->egcuName(soundState.egcuId());
case Column::Duration:
return soundState.inLoop() ? QString() : QTime(0, 0).addMSecs(soundState.duration()).toString(QStringLiteral("hh:mm:ss.zzz"));
case Column::Option:
default:
return soundState.status();
}
case Qt::BackgroundColorRole:
if ( (index.column() != Column::Category) && (index.column() != Column::Sound))
return QVariant();
return m_helper->soundCategoryBackgroundColor(static_cast<int32_t>(soundState.category().underlying()));
case Qt::TextColorRole:
if ( (index.column() != Column::Category) && (index.column() != Column::Sound))
return QVariant();
return m_helper->soundCategoryTextColor(static_cast<int32_t>(soundState.category().underlying()));
case Qt::TextAlignmentRole:
return index.column() == Column::Duration ? Qt::AlignCenter : Qt::AlignVCenter;
default:
return QVariant();
}
DEBUG_LOG(m_logger) << "adding '" << name << "' to active Sounds";
return true;
}
bool SoundAreaPlaylistModel::onDataChanged(const SoundState &data, DataModification modType)
bool SoundAreaPlaylistModel::removeActiveSound(const QModelIndex& index)
{
if (!m_egcuIds.contains(data.egcuId()))
return false;
if (!index.isValid())
return false;
int row;
QModelIndex idx;
return removeRow(index.row());
}
switch (modType)
{
case DataModification::eAdded:
return addActiveSound(data);
QVariant SoundAreaPlaylistModel::data(const QModelIndex& index, int role) const
{
if (!index.isValid())
return QVariant();
case DataModification::eModified:
WARNING_LOG(m_logger) << "handling eModified for sound states not implemented yet";
return false;
const SoundState& soundState = m_vecData.at(index.row());
case DataModification::eRemoved:
row = indexOf(data);
idx = SoundAreaPlaylistModel::index(m_vecData.indexOf(data), 0);
if (row == -1)
switch (role)
{
ERROR_LOG(m_logger) << "'" << m_helper->soundName(data.category(), data.soundId()) << "' is neither scheduled nor active";
return false;
}
return removeActiveSound(idx);
case Qt::DisplayRole:
case Qt::EditRole:
switch (index.column())
{
case Column::Category:
return m_helper->categoryName(soundState.category());
default:
Q_UNREACHABLE();
return false;
}
case Column::Sound:
return m_helper->soundName(soundState.category(), soundState.soundId());
case Column::Egcu:
return m_helper->egcuName(soundState.egcuId());
case Column::Duration:
return soundState.inLoop()
? QString()
: QTime(0, 0).addMSecs(soundState.duration()).toString(QStringLiteral("hh:mm:ss.zzz"));
case Column::Option:
default:
return soundState.status();
}
case Qt::BackgroundColorRole:
if ((index.column() != Column::Category) && (index.column() != Column::Sound))
return QVariant();
return m_helper->soundCategoryBackgroundColor(static_cast<int32_t>(soundState.category().underlying()));
case Qt::TextColorRole:
if ((index.column() != Column::Category) && (index.column() != Column::Sound))
return QVariant();
return m_helper->soundCategoryTextColor(static_cast<int32_t>(soundState.category().underlying()));
case Qt::TextAlignmentRole:
return index.column() == Column::Duration ? Qt::AlignCenter : Qt::AlignVCenter;
default:
return QVariant();
}
}
bool SoundAreaPlaylistModel::insertRow(const SoundState &item)
bool SoundAreaPlaylistModel::onDataChanged(const SoundState& data, DataModification modType)
{
beginInsertRows(QModelIndex(), m_vecData.size(), m_vecData.size());
m_vecData.push_back(item);
endInsertRows();
return true;
if (!m_egcuIds.contains(data.egcuId()))
return false;
int row;
QModelIndex idx;
switch (modType)
{
case DataModification::eAdded:
return addActiveSound(data);
case DataModification::eModified:
WARNING_LOG(m_logger) << "handling eModified for sound states not implemented yet";
return false;
case DataModification::eRemoved:
row = indexOf(data);
idx = SoundAreaPlaylistModel::index(m_vecData.indexOf(data), 0);
if (row == -1)
{
ERROR_LOG(m_logger) << "'" << m_helper->soundName(data.category(), data.soundId())
<< "' is neither scheduled nor active";
return false;
}
return removeActiveSound(idx);
default:
Q_UNREACHABLE();
return false;
}
}
bool SoundAreaPlaylistModel::insertRow(const SoundState& item)
{
beginInsertRows(QModelIndex(), m_vecData.size(), m_vecData.size());
m_vecData.push_back(item);
endInsertRows();
return true;
}
bool SoundAreaPlaylistModel::removeRow(int row)
{
return removeRows(row, 1);
return removeRows(row, 1);
}
}
} // namespace EffectManagement
@@ -1,15 +1,12 @@
#pragma once
#include "efm_sound_state.h"
#include <LtsWidgets/lts_abstract_table_model.h>
#include <SoundManagement/som_dtc.h>
#include <QStyledItemDelegate>
#include <SoundManagement/som_dtc.h>
class QTimer;
@@ -18,7 +15,6 @@ namespace NGL
class INGLLogger;
}
namespace EffectManagement
{
@@ -26,70 +22,52 @@ using SoundKey = QPair<int32_t, int32_t>;
class SoundAreaHelper;
class SoundAreaEditPlaylistDelegate
: public QStyledItemDelegate
class SoundAreaEditPlaylistDelegate : public QStyledItemDelegate
{
Q_OBJECT
Q_OBJECT
public:
SoundAreaEditPlaylistDelegate(QObject *parent = nullptr);
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
public:
SoundAreaEditPlaylistDelegate(QObject* parent = nullptr);
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
private:
private:
NGL::INGLLogger& m_logger;
static QIcon s_iconInf;
};
NGL::INGLLogger &m_logger;
static QIcon s_iconInf;
};
class SoundAreaPlaylistModel
: public LtsWidgets::LtsAbstractTableModel<SoundState>
class SoundAreaPlaylistModel : public LtsWidgets::LtsAbstractTableModel<SoundState>
{
Q_OBJECT
Q_OBJECT
public:
enum Column { Category, Sound, Egcu, Duration, Option };
public:
enum Column { Category, Sound, Egcu, Duration, Option };
explicit SoundAreaPlaylistModel(const QVector<int32_t> &egcuIds, std::shared_ptr<SoundAreaHelper> &helper, QWidget *parent = nullptr);
explicit SoundAreaPlaylistModel(const QVector<int32_t>& egcuIds, std::shared_ptr<SoundAreaHelper>& helper,
QWidget* parent = nullptr);
private slots:
private slots:
void onTimeout();
void onTimeout();
public:
bool init(std::shared_ptr<SoundManagement::Interface::Dtc> &somDtc);
public:
bool init(std::shared_ptr<SoundManagement::Interface::Dtc>& somDtc);
int indexOf(const SoundState& data) const;
int indexOf(const SoundState &data) const;
bool addActiveSound(SoundState data);
bool removeActiveSound(const QModelIndex& index);
bool addActiveSound(SoundState data);
protected:
QVariant data(const QModelIndex& index, int role) const override;
bool onDataChanged(const SoundState& data, DataModification modType) override;
bool insertRow(const SoundState& item) override;
bool removeRow(int row) override;
private:
std::shared_ptr<SoundAreaHelper> m_helper{nullptr};
QVector<int32_t> m_egcuIds;
QTimer* m_timer{nullptr};
};
bool removeActiveSound(const QModelIndex &index);
protected:
QVariant data(const QModelIndex &index, int role) const override;
bool onDataChanged(const SoundState &data, DataModification modType) override;
bool insertRow(const SoundState &item) override;
bool removeRow(int row) override;
private:
std::shared_ptr<SoundAreaHelper> m_helper{nullptr};
QVector<int32_t> m_egcuIds;
QTimer *m_timer{nullptr};
};
}
} // namespace EffectManagement
@@ -1,401 +1,356 @@
#include "efm_sound_area_edit_model_tree.h"
#include <utility>
#include "../logger.h"
#include "efm_sound_area.h"
#include "efm_sound_area_helper.h"
#include "../logger.h"
#include <QSpinBox>
#include <QApplication>
#include <algorithm>
#include <QDebug>
#include <QSpinBox>
#include <algorithm>
#include <utility>
namespace EffectManagement
{
SpinBoxDelegate::SpinBoxDelegate(QObject* parent) : QStyledItemDelegate(parent) {}
SpinBoxDelegate::SpinBoxDelegate(QObject *parent)
: QStyledItemDelegate(parent)
{}
QWidget *SpinBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
QWidget* SpinBoxDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option,
const QModelIndex& index) const
{
if (index.column() != SoundAreaTreeModel::Column::Volume)
return QStyledItemDelegate::createEditor(parent, option, index);
auto *sb = new QSpinBox(parent);
sb->setFrame(false);
sb->setSuffix(QStringLiteral(" %"));
sb->setRange(0, 100);
return sb;
if (index.column() != SoundAreaTreeModel::Column::Volume)
return QStyledItemDelegate::createEditor(parent, option, index);
auto* sb = new QSpinBox(parent);
sb->setFrame(false);
sb->setSuffix(QStringLiteral(" %"));
sb->setRange(0, 100);
return sb;
}
void SpinBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
void SpinBoxDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const
{
if (index.column() != SoundAreaTreeModel::Column::Volume)
{
QStyledItemDelegate::setEditorData(editor, index);
if (index.column() != SoundAreaTreeModel::Column::Volume)
{
QStyledItemDelegate::setEditorData(editor, index);
return;
}
qWarning() << index << index.data();
const int val = index.data(Qt::EditRole).toInt();
auto* sb = qobject_cast<QSpinBox*>(editor);
sb->setValue(val);
return;
}
qWarning() << index << index.data();
const int val = index.data(Qt::EditRole).toInt();
auto *sb = qobject_cast<QSpinBox *>(editor);
sb->setValue(val);
return;
}
void SpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
void SpinBoxDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const
{
if (index.column() != SoundAreaTreeModel::Column::Volume)
{
QStyledItemDelegate::setModelData(editor, model, index);
return;
}
if (index.column() != SoundAreaTreeModel::Column::Volume)
{
QStyledItemDelegate::setModelData(editor, model, index);
return;
}
auto *sb = qobject_cast<QSpinBox *>(editor);
const int val = sb->value();
model->setData(index, val, Qt::EditRole);
auto* sb = qobject_cast<QSpinBox*>(editor);
const int val = sb->value();
model->setData(index, val, Qt::EditRole);
}
void SpinBoxDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &) const
void SpinBoxDelegate::updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option,
const QModelIndex&) const
{
editor->setGeometry(option.rect);
editor->setGeometry(option.rect);
}
SoundTreeItem::SoundTreeItem(const QVector<QVariant> &data, const SoundKey &key, SoundTreeItem *parent) : m_parent(parent)
, m_data(data)
, m_soundKey(key),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
SoundTreeItem::SoundTreeItem(const QVector<QVariant>& data, const SoundKey& key, SoundTreeItem* parent)
: m_parent(parent), m_data(data), m_soundKey(key), m_logger(NGL::NGLLoggerBootstrap::getLogger())
{
}
SoundTreeItem::~SoundTreeItem()
{
qDeleteAll(m_children);
qDeleteAll(m_children);
}
void SoundTreeItem::appendChild(SoundTreeItem *item)
void SoundTreeItem::appendChild(SoundTreeItem* item)
{
m_children.append(item);
m_children.append(item);
}
void SoundTreeItem::toogleLoop()
{
if (isRepeatable())
m_data[SoundAreaTreeModel::Column::Loop] = -1 * m_data[SoundAreaTreeModel::Column::Loop].toInt();
if (isRepeatable())
m_data[SoundAreaTreeModel::Column::Loop] = -1 * m_data[SoundAreaTreeModel::Column::Loop].toInt();
}
void SoundTreeItem::toggleLoop(int inLoop)
{
if (isRepeatable())
{
if ( (inLoop != -1) && (inLoop != 1) )
return;
m_data[SoundAreaTreeModel::Column::Loop] = inLoop;
}
if (isRepeatable())
{
if ((inLoop != -1) && (inLoop != 1))
return;
m_data[SoundAreaTreeModel::Column::Loop] = inLoop;
}
}
QString SoundTreeItem::toString() const
{
return QStringLiteral("SoundTreeItem( category : ") + QString::number(m_soundKey.first) + QStringLiteral(" | id : ") +
QString::number(m_soundKey.second) + QStringLiteral(" )");
return QStringLiteral("SoundTreeItem( category : ") + QString::number(m_soundKey.first) +
QStringLiteral(" | id : ") + QString::number(m_soundKey.second) + QStringLiteral(" )");
}
SoundAreaTreeModel::SoundAreaTreeModel(const QVector<int> &egcuIds, std::shared_ptr<SoundAreaHelper> &helper, QWidget *parent)
: QAbstractItemModel(parent)
, m_helper(helper)
, m_root(new SoundTreeItem({tr("Category"), tr("Sound"), tr("Loop"), tr("Volume")}, SoundKey(0, 0)))
, m_egcuIds(egcuIds)
SoundAreaTreeModel::SoundAreaTreeModel(const QVector<int>& egcuIds, std::shared_ptr<SoundAreaHelper>& helper,
QWidget* parent)
: QAbstractItemModel(parent), m_helper(helper),
m_root(new SoundTreeItem({tr("Category"), tr("Sound"), tr("Loop"), tr("Volume")}, SoundKey(0, 0))),
m_egcuIds(egcuIds)
{
}
SoundAreaTreeModel::~SoundAreaTreeModel()
{
delete m_root;
delete m_root;
}
void SoundAreaTreeModel::onSoundTreeItemActivated(const QModelIndex &index)
void SoundAreaTreeModel::onSoundTreeItemActivated(const QModelIndex& index)
{
if (!index.isValid())
return;
if (!index.isValid())
return;
switch (index.column())
{
case Column::Loop:
{
onToggleLoop(index);
break;
}
case Column::Volume:
break;
default:
{
onPlaySound(index);
break;
}
}
}
bool SoundAreaTreeModel::onPlaySound(const QModelIndex &index)
{
SoundTreeItem *item = static_cast<SoundTreeItem *>(index.internalPointer());
emit playSound(m_helper->soundCategory(item->soundKey().first), item->soundKey().second, item->inLoop(), item->volume());
return true;
}
bool SoundAreaTreeModel::onToggleLoop(const QModelIndex &index)
{
SoundTreeItem *item = static_cast<SoundTreeItem *>(index.internalPointer());
item->toogleLoop();
emit dataChanged(index, index);
return true;
}
bool SoundAreaTreeModel::init(const std::shared_ptr<SoundManagement::Interface::Dtc> &somDtc)
{
DEBUG_LOG(m_logger) << "init";
SoundKey key;
QVector<SoundManagement::SoundCategory> categories = m_helper->soundCategories();
for (const auto &category : std::as_const(categories))
{
QString name{m_helper->categoryName(category)};
QVector<QVariant> data{QVector<QVariant>{name, QVariant(), 0, 100}};
key.first = static_cast<int32_t>(category.underlying());
key.second = 0;
m_root->appendChild(new SoundTreeItem(data, key, m_root));
}
SoundManagement::Sounds sounds = somDtc->sounds();
for (const auto &sound : std::as_const(sounds.sounds()))
{
for (auto &category : m_root->children())
{
if (category->soundKey().first == static_cast<int32_t>(sound.category().underlying()))
{
QString displayName = m_helper->soundName(sound.category(), sound.soundId());
QVector<QVariant> data{QVector<QVariant>{category->data(0).toString(), displayName, sound.isRepeatable() ? 1 : 0, 100}};
key.first = static_cast<int32_t>(sound.category().underlying());
key.second = sound.soundId();
category->appendChild(new SoundTreeItem(data, key, category));
break;
}
}
}
return true;
}
bool SoundAreaTreeModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
if (index.column() != SoundAreaTreeModel::Column::Volume
|| role != Qt::EditRole)
return QAbstractItemModel::setData(index, value, role);
bool k;
int val = value.toInt(&k);
if (!k)
return false;
static_cast<SoundTreeItem *>(index.internalPointer())->setVolume(val);
emit dataChanged(index, index);
return true;
}
SoundTreeItem * SoundAreaTreeModel::find(const SoundKey &key)
{
QVector<SoundTreeItem *> categories = m_root->children();
for (auto category : std::as_const(categories))
{
if (category->soundKey() == key)
return category;
QVector<SoundTreeItem *> sounds = category->children();
for (auto sound : std::as_const(sounds))
if (sound->soundKey() == key)
return sound;
}
return nullptr;
}
Qt::ItemFlags SoundAreaTreeModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return Qt::NoItemFlags;
if (index.column() != SoundAreaTreeModel::Column::Volume)
return QAbstractItemModel::flags(index);
return QAbstractItemModel::flags(index).setFlag(Qt::ItemFlag::ItemIsEditable);
}
QVariant SoundAreaTreeModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
if ( (role != Qt::DisplayRole) && (role != Qt::ToolTipRole) &&
(role != Qt::BackgroundColorRole) && (role != Qt::TextColorRole) &&
(role != Qt::EditRole))
return QVariant();
SoundTreeItem *item = static_cast<SoundTreeItem *>(index.internalPointer());
switch (role)
{
case Qt::EditRole:
switch (index.column())
{
case Column::Volume: return item->volume();
default:
Q_UNREACHABLE();
return QVariant();
case Column::Loop: {
onToggleLoop(index);
break;
}
case Column::Volume:
break;
default: {
onPlaySound(index);
break;
}
}
case Qt::DisplayRole:
if (item->soundKey().second == 0)
return index.column() == Column::Category ? item->data(index.column()) : QVariant();
switch (index.column())
}
bool SoundAreaTreeModel::onPlaySound(const QModelIndex& index)
{
SoundTreeItem* item = static_cast<SoundTreeItem*>(index.internalPointer());
emit playSound(m_helper->soundCategory(item->soundKey().first), item->soundKey().second, item->inLoop(),
item->volume());
return true;
}
bool SoundAreaTreeModel::onToggleLoop(const QModelIndex& index)
{
SoundTreeItem* item = static_cast<SoundTreeItem*>(index.internalPointer());
item->toogleLoop();
emit dataChanged(index, index);
return true;
}
bool SoundAreaTreeModel::init(const std::shared_ptr<SoundManagement::Interface::Dtc>& somDtc)
{
DEBUG_LOG(m_logger) << "init";
SoundKey key;
QVector<SoundManagement::SoundCategory> categories = m_helper->soundCategories();
for (const auto& category : std::as_const(categories))
{
case Column::Category: return QVariant();
case Column::Sound: return item->data(index.column());
case Column::Loop: return item->isRepeatable() ? item->data(index.column()) : QVariant();
case Column::Volume: return QStringLiteral("%1 %").arg(item->volume());
default:
Q_UNREACHABLE();
return QVariant();
}
QString name{m_helper->categoryName(category)};
QVector<QVariant> data{QVector<QVariant>{name, QVariant(), 0, 100}};
key.first = static_cast<int32_t>(category.underlying());
key.second = 0;
m_root->appendChild(new SoundTreeItem(data, key, m_root));
}
case Qt::ToolTipRole:
if ( (item->soundKey().second == 0) && (index.column() != Column::Category) )
return QVariant();
switch (index.column())
SoundManagement::Sounds sounds = somDtc->sounds();
for (const auto& sound : std::as_const(sounds.sounds()))
{
case Column::Category: return item->data(Column::Category).toString();
case Column::Sound: return item->data(Column::Sound).toString();
case Column::Loop: return item->inLoop() ? tr("play in loop") : tr("play once");
case Column::Volume: return tr("Volume: %1 %").arg(item->volume());
default:
Q_UNREACHABLE();
return QVariant();
}
for (auto& category : m_root->children())
{
if (category->soundKey().first == static_cast<int32_t>(sound.category().underlying()))
{
QString displayName = m_helper->soundName(sound.category(), sound.soundId());
QVector<QVariant> data{
QVector<QVariant>{category->data(0).toString(), displayName, sound.isRepeatable() ? 1 : 0, 100}};
key.first = static_cast<int32_t>(sound.category().underlying());
key.second = sound.soundId();
category->appendChild(new SoundTreeItem(data, key, category));
break;
}
}
}
case Qt::BackgroundRole:
if ( (index.column() == Column::Category) ||
( (index.column() == Column::Sound) && (item->soundKey().second != 0) ) )
return m_helper->soundCategoryBackgroundColor(item->soundKey().first);
return QVariant();
return true;
}
case Qt::TextColorRole:
if ((index.column() == Column::Category) || (index.column() == Column::Sound))
return m_helper->soundCategoryTextColor(item->soundKey().first);
return QVariant();
bool SoundAreaTreeModel::setData(const QModelIndex& index, const QVariant& value, int role)
{
if (index.column() != SoundAreaTreeModel::Column::Volume || role != Qt::EditRole)
return QAbstractItemModel::setData(index, value, role);
default:
Q_UNREACHABLE();
return QVariant();
}
bool k;
int val = value.toInt(&k);
if (!k)
return false;
static_cast<SoundTreeItem*>(index.internalPointer())->setVolume(val);
emit dataChanged(index, index);
return true;
}
SoundTreeItem* SoundAreaTreeModel::find(const SoundKey& key)
{
QVector<SoundTreeItem*> categories = m_root->children();
for (auto category : std::as_const(categories))
{
if (category->soundKey() == key)
return category;
QVector<SoundTreeItem*> sounds = category->children();
for (auto sound : std::as_const(sounds))
if (sound->soundKey() == key)
return sound;
}
return nullptr;
}
Qt::ItemFlags SoundAreaTreeModel::flags(const QModelIndex& index) const
{
if (!index.isValid())
return Qt::NoItemFlags;
if (index.column() != SoundAreaTreeModel::Column::Volume)
return QAbstractItemModel::flags(index);
return QAbstractItemModel::flags(index).setFlag(Qt::ItemFlag::ItemIsEditable);
}
QVariant SoundAreaTreeModel::data(const QModelIndex& index, int role) const
{
if (!index.isValid())
return QVariant();
if ((role != Qt::DisplayRole) && (role != Qt::ToolTipRole) && (role != Qt::BackgroundColorRole) &&
(role != Qt::TextColorRole) && (role != Qt::EditRole))
return QVariant();
SoundTreeItem* item = static_cast<SoundTreeItem*>(index.internalPointer());
switch (role)
{
case Qt::EditRole:
switch (index.column())
{
case Column::Volume:
return item->volume();
default:
Q_UNREACHABLE();
return QVariant();
}
case Qt::DisplayRole:
if (item->soundKey().second == 0)
return index.column() == Column::Category ? item->data(index.column()) : QVariant();
switch (index.column())
{
case Column::Category:
return QVariant();
case Column::Sound:
return item->data(index.column());
case Column::Loop:
return item->isRepeatable() ? item->data(index.column()) : QVariant();
case Column::Volume:
return QStringLiteral("%1 %").arg(item->volume());
default:
Q_UNREACHABLE();
return QVariant();
}
case Qt::ToolTipRole:
if ((item->soundKey().second == 0) && (index.column() != Column::Category))
return QVariant();
switch (index.column())
{
case Column::Category:
return item->data(Column::Category).toString();
case Column::Sound:
return item->data(Column::Sound).toString();
case Column::Loop:
return item->inLoop() ? tr("play in loop") : tr("play once");
case Column::Volume:
return tr("Volume: %1 %").arg(item->volume());
default:
Q_UNREACHABLE();
return QVariant();
}
case Qt::BackgroundRole:
if ((index.column() == Column::Category) ||
((index.column() == Column::Sound) && (item->soundKey().second != 0)))
return m_helper->soundCategoryBackgroundColor(item->soundKey().first);
return QVariant();
case Qt::TextColorRole:
if ((index.column() == Column::Category) || (index.column() == Column::Sound))
return m_helper->soundCategoryTextColor(item->soundKey().first);
return QVariant();
default:
Q_UNREACHABLE();
return QVariant();
}
}
QVariant SoundAreaTreeModel::headerData(int section, Qt::Orientation orientation, int role) const
{
return ( (orientation == Qt::Horizontal) && (role == Qt::DisplayRole) ) ? m_root->data(section) : QVariant();
return ((orientation == Qt::Horizontal) && (role == Qt::DisplayRole)) ? m_root->data(section) : QVariant();
}
QModelIndex SoundAreaTreeModel::index(int row, int column, const QModelIndex &parent) const
QModelIndex SoundAreaTreeModel::index(int row, int column, const QModelIndex& parent) const
{
if (!hasIndex(row, column, parent))
return {};
if (!hasIndex(row, column, parent))
return {};
SoundTreeItem *item;
if(!parent.isValid())
item = m_root;
else
item = static_cast<SoundTreeItem *>(parent.internalPointer());
SoundTreeItem *child = item->child(row);
return child ? createIndex(row, column, child) : QModelIndex();
SoundTreeItem* item;
if (!parent.isValid())
item = m_root;
else
item = static_cast<SoundTreeItem*>(parent.internalPointer());
SoundTreeItem* child = item->child(row);
return child ? createIndex(row, column, child) : QModelIndex();
}
QModelIndex SoundAreaTreeModel::parent(const QModelIndex &index) const
QModelIndex SoundAreaTreeModel::parent(const QModelIndex& index) const
{
if (!index.isValid())
return {};
if (!index.isValid())
return {};
SoundTreeItem *parent = static_cast<SoundTreeItem *>(index.internalPointer())->parent();
return parent == m_root ? QModelIndex() : createIndex(parent->row(), 0, parent);
SoundTreeItem* parent = static_cast<SoundTreeItem*>(index.internalPointer())->parent();
return parent == m_root ? QModelIndex() : createIndex(parent->row(), 0, parent);
}
int SoundAreaTreeModel::rowCount(const QModelIndex &index) const
int SoundAreaTreeModel::rowCount(const QModelIndex& index) const
{
if (index.column() > 0)
return 0;
if (index.column() > 0)
return 0;
SoundTreeItem *parent;
if (!index.isValid())
parent = m_root;
else
parent = static_cast<SoundTreeItem *>(index.internalPointer());
return parent->childCount();
SoundTreeItem* parent;
if (!index.isValid())
parent = m_root;
else
parent = static_cast<SoundTreeItem*>(index.internalPointer());
return parent->childCount();
}
int SoundAreaTreeModel::columnCount(const QModelIndex &index) const
int SoundAreaTreeModel::columnCount(const QModelIndex& index) const
{
return index.isValid() ? static_cast<SoundTreeItem *>(index.internalPointer())->columnCount() : m_root->columnCount();
return index.isValid() ? static_cast<SoundTreeItem*>(index.internalPointer())->columnCount()
: m_root->columnCount();
}
}
} // namespace EffectManagement
@@ -1,21 +1,17 @@
#pragma once
#include <LtsWidgets/lts_abstract_table_model.h>
#include <SoundManagement/som_dtc.h>
#include <QAbstractItemModel>
#include <QStyledItemDelegate>
#include <SoundManagement/som_dtc.h>
namespace NGL
{
class INGLLogger;
}
namespace EffectManagement
{
@@ -24,130 +20,151 @@ using SoundKey = QPair<int32_t, int32_t>;
struct SoundArea;
class SoundAreaHelper;
class SoundTreeItem
{
public:
enum Column { Category, Sound, Loop, Volume };
public:
enum Column { Category, Sound, Loop, Volume };
explicit SoundTreeItem(const QVector<QVariant> &data, const SoundKey &key, SoundTreeItem *parent = nullptr);
~SoundTreeItem();
explicit SoundTreeItem(const QVector<QVariant>& data, const SoundKey& key, SoundTreeItem* parent = nullptr);
~SoundTreeItem();
void appendChild(SoundTreeItem* item);
void appendChild(SoundTreeItem *item);
void toogleLoop();
void toogleLoop();
void toggleLoop(int inLoop);
void toggleLoop(int inLoop);
QVariant data(const int& column) const
{
return (column < 0 || column >= m_data.size()) ? QVariant() : m_data.at(column);
}
QVariant data(const int &column) const { return (column < 0 || column >= m_data.size()) ? QVariant() : m_data.at(column); }
SoundKey soundKey() const { return m_soundKey; }
SoundKey soundKey() const
{
return m_soundKey;
}
bool isRepeatable() const { return m_data[Column::Loop] != 0; }
bool inLoop() const { return m_data[Column::Loop] == 1; }
int volume() const { return m_data[Column::Volume].toInt(); }
void setVolume(int volume) { m_data[Column::Volume] = volume; }
bool isRepeatable() const
{
return m_data[Column::Loop] != 0;
}
SoundTreeItem *parent() { return m_parent; }
SoundTreeItem *child(int row) { return (row < 0 || row >= m_children.size()) ? nullptr : m_children.at(row); }
QVector<SoundTreeItem *> children() const { return m_children; }
bool inLoop() const
{
return m_data[Column::Loop] == 1;
}
int row() const { return m_parent ? m_parent->m_children.indexOf(const_cast<SoundTreeItem *>(this)) : 0; }
int columnCount() const { return m_data.count(); }
int childCount() const { return m_children.count(); }
int volume() const
{
return m_data[Column::Volume].toInt();
}
QString toString() const;
void setVolume(int volume)
{
m_data[Column::Volume] = volume;
}
private:
SoundTreeItem* parent()
{
return m_parent;
}
NGL::INGLLogger &m_logger;
QVector<SoundTreeItem *> m_children;
SoundTreeItem *m_parent{nullptr};
QVector<QVariant> m_data;
SoundKey m_soundKey;
SoundTreeItem* child(int row)
{
return (row < 0 || row >= m_children.size()) ? nullptr : m_children.at(row);
}
};
QVector<SoundTreeItem*> children() const
{
return m_children;
}
int row() const
{
return m_parent ? m_parent->m_children.indexOf(const_cast<SoundTreeItem*>(this)) : 0;
}
int columnCount() const
{
return m_data.count();
}
int childCount() const
{
return m_children.count();
}
QString toString() const;
private:
NGL::INGLLogger& m_logger;
QVector<SoundTreeItem*> m_children;
SoundTreeItem* m_parent{nullptr};
QVector<QVariant> m_data;
SoundKey m_soundKey;
};
class SpinBoxDelegate : public QStyledItemDelegate
{
Q_OBJECT
Q_OBJECT
public:
SpinBoxDelegate(QObject *parent = nullptr);
public:
SpinBoxDelegate(QObject* parent = nullptr);
protected:
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
void setEditorData(QWidget *editor, const QModelIndex &index) const override;
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
protected:
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
void setEditorData(QWidget* editor, const QModelIndex& index) const override;
void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override;
void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option,
const QModelIndex& index) const override;
};
class SoundAreaTreeModel
: public QAbstractItemModel
class SoundAreaTreeModel : public QAbstractItemModel
{
Q_OBJECT
Q_OBJECT
public:
enum Column { Category, Sound, Loop, Volume };
public:
enum Column { Category, Sound, Loop, Volume };
explicit SoundAreaTreeModel(const QVector<int> &egcuIds, std::shared_ptr<SoundAreaHelper> &helper, QWidget *parent = nullptr);
~SoundAreaTreeModel();
explicit SoundAreaTreeModel(const QVector<int>& egcuIds, std::shared_ptr<SoundAreaHelper>& helper,
QWidget* parent = nullptr);
~SoundAreaTreeModel();
signals:
signals:
void playSound(const SoundManagement::SoundCategory, const int, const bool, const int);
void playSound(const SoundManagement::SoundCategory, const int, const bool, const int);
public slots:
public slots:
void onSoundTreeItemActivated(const QModelIndex &index);
void onSoundTreeItemActivated(const QModelIndex& index);
private slots:
private slots:
bool onPlaySound(const QModelIndex &index);
bool onPlaySound(const QModelIndex& index);
bool onToggleLoop(const QModelIndex &index);
bool onToggleLoop(const QModelIndex& index);
public:
bool init(const std::shared_ptr<SoundManagement::Interface::Dtc>& somDtc);
public:
bool init(const std::shared_ptr<SoundManagement::Interface::Dtc> &somDtc);
SoundTreeItem* find(const SoundKey& key);
protected:
bool setData(const QModelIndex& index, const QVariant& value, int role) override;
Qt::ItemFlags flags(const QModelIndex& index) const override;
QVariant data(const QModelIndex& index, int role) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
QModelIndex index(int row, int column, const QModelIndex& parent) const override;
QModelIndex parent(const QModelIndex& index) const override;
int rowCount(const QModelIndex& index) const override;
int columnCount(const QModelIndex& index) const override;
SoundTreeItem * find(const SoundKey &key);
private:
std::shared_ptr<SoundAreaHelper> m_helper{nullptr};
protected:
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
QVariant data(const QModelIndex &index, int role) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
QModelIndex index(int row, int column, const QModelIndex &parent) const override;
QModelIndex parent(const QModelIndex &index) const override;
int rowCount(const QModelIndex &index) const override;
int columnCount(const QModelIndex &index) const override;
SoundTreeItem* m_root{nullptr};
QVector<int32_t> m_egcuIds;
};
private:
std::shared_ptr<SoundAreaHelper> m_helper{nullptr};
SoundTreeItem *m_root{nullptr};
QVector<int32_t> m_egcuIds;
};
}
} // namespace EffectManagement
@@ -1,279 +1,328 @@
#include "efm_sound_area_helper.h"
#include <utility>
#include "../logger.h"
#include <QVector>
#include <QColor>
#include <QVector>
#include <utility>
namespace EffectManagement
{
SoundAreaHelper::SoundAreaHelper(SoundAreaHelper *helper) : m_ismDtc(helper->ismDtc())
, m_somDtc(helper->somDtc()),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
QMap<int32_t, InfrastructureManagement::InstrumentationAsset> assets = m_ismDtc->instrumentationAssets();
for (const auto &asset : std::as_const(assets))
if (asset.mountingPointTypeId() == InfrastructureManagement::MountingPointType_def::EffectGenerationControlUnit)
m_egcuNames.insert(asset.id(), QString::fromStdString(asset.name()));
SoundManagement::Sounds sounds = m_somDtc->sounds();
for (const auto &sound : std::as_const(sounds.sounds()))
m_soundDuration.insert(SoundKey(sound.category().underlying(), sound.soundId()), sound.duration());
}
SoundAreaHelper::SoundAreaHelper(std::shared_ptr<InfrastructureManagement::Interface::Dtc> &ismDtc,
std::shared_ptr<SoundManagement::Interface::Dtc> &somDtc)
: m_ismDtc(ismDtc)
, m_somDtc(somDtc)
SoundAreaHelper::SoundAreaHelper(SoundAreaHelper* helper)
: m_ismDtc(helper->ismDtc()), m_somDtc(helper->somDtc()), m_logger(NGL::NGLLoggerBootstrap::getLogger())
{
QMap<int32_t, InfrastructureManagement::InstrumentationAsset> assets = m_ismDtc->instrumentationAssets();
for (const auto &asset : std::as_const(assets))
if (asset.mountingPointTypeId() == InfrastructureManagement::MountingPointType_def::EffectGenerationControlUnit)
m_egcuNames.insert(asset.id(), QString::fromStdString(asset.name()));
QMap<int32_t, InfrastructureManagement::InstrumentationAsset> assets = m_ismDtc->instrumentationAssets();
for (const auto& asset : std::as_const(assets))
if (asset.mountingPointTypeId() == InfrastructureManagement::MountingPointType_def::EffectGenerationControlUnit)
m_egcuNames.insert(asset.id(), QString::fromStdString(asset.name()));
SoundManagement::Sounds sounds = m_somDtc->sounds();
for (const auto &sound : std::as_const(sounds.sounds()))
m_soundDuration.insert(SoundKey(sound.category().underlying(), sound.soundId()), sound.duration());
SoundManagement::Sounds sounds = m_somDtc->sounds();
for (const auto& sound : std::as_const(sounds.sounds()))
m_soundDuration.insert(SoundKey(sound.category().underlying(), sound.soundId()), sound.duration());
}
SoundAreaHelper::SoundAreaHelper(std::shared_ptr<InfrastructureManagement::Interface::Dtc>& ismDtc,
std::shared_ptr<SoundManagement::Interface::Dtc>& somDtc)
: m_ismDtc(ismDtc), m_somDtc(somDtc)
{
QMap<int32_t, InfrastructureManagement::InstrumentationAsset> assets = m_ismDtc->instrumentationAssets();
for (const auto& asset : std::as_const(assets))
if (asset.mountingPointTypeId() == InfrastructureManagement::MountingPointType_def::EffectGenerationControlUnit)
m_egcuNames.insert(asset.id(), QString::fromStdString(asset.name()));
SoundManagement::Sounds sounds = m_somDtc->sounds();
for (const auto& sound : std::as_const(sounds.sounds()))
m_soundDuration.insert(SoundKey(sound.category().underlying(), sound.soundId()), sound.duration());
}
QVector<SoundManagement::SoundCategory> SoundAreaHelper::soundCategories()
{
QVector<SoundManagement::SoundCategory> categories = QVector<SoundManagement::SoundCategory>
{
SoundManagement::SoundCategory_def::Aircraft,
SoundManagement::SoundCategory_def::Battlefield,
SoundManagement::SoundCategory_def::Boat,
SoundManagement::SoundCategory_def::Explosion,
SoundManagement::SoundCategory_def::Helicopter,
SoundManagement::SoundCategory_def::MotorsAndUrbanTraffic,
SoundManagement::SoundCategory_def::Vehicle,
SoundManagement::SoundCategory_def::InsideBuilding
};
return categories;
QVector<SoundManagement::SoundCategory> categories = QVector<SoundManagement::SoundCategory>{
SoundManagement::SoundCategory_def::Aircraft, SoundManagement::SoundCategory_def::Battlefield,
SoundManagement::SoundCategory_def::Boat, SoundManagement::SoundCategory_def::Explosion,
SoundManagement::SoundCategory_def::Helicopter, SoundManagement::SoundCategory_def::MotorsAndUrbanTraffic,
SoundManagement::SoundCategory_def::Vehicle, SoundManagement::SoundCategory_def::InsideBuilding};
return categories;
}
QString SoundAreaHelper::categoryName(SoundManagement::SoundCategory category)
{
switch (category.underlying())
{
case SoundManagement::SoundCategory_def::Aircraft: return QStringLiteral("Aircraft");
case SoundManagement::SoundCategory_def::Battlefield: return QStringLiteral("Battlefield");
case SoundManagement::SoundCategory_def::Boat: return QStringLiteral("Boat");
case SoundManagement::SoundCategory_def::Explosion: return QStringLiteral("Explosion");
case SoundManagement::SoundCategory_def::Helicopter: return QStringLiteral("Helicopter");
case SoundManagement::SoundCategory_def::MotorsAndUrbanTraffic: return QStringLiteral("MotorsAndUrbanTraffic");
case SoundManagement::SoundCategory_def::Vehicle: return QStringLiteral("Vehicle");
case SoundManagement::SoundCategory_def::InsideBuilding: return QStringLiteral("InsideBuilding");
case SoundManagement::SoundCategory_def::Unknown: return QStringLiteral("Unknown");
default:
return QString();
}
}
QString SoundAreaHelper::categoryName(const int32_t &category)
{
return categoryName(soundCategory(category));
}
QString SoundAreaHelper::soundName(SoundManagement::SoundCategory category, const int &id)
{
switch (category.underlying())
{
case SoundManagement::SoundCategory_def::Aircraft:
switch (id)
switch (category.underlying())
{
case 1: return QStringLiteral("Jet_Pass_by_Military");
case 2: return QStringLiteral("Military_Aircraft_Fires");
case 3: return QStringLiteral("Military_Aircraft_Fly_By");
case 4: return QStringLiteral("Military_Airplane_Drops");
default:
return QStringLiteral("Error");
}
case SoundManagement::SoundCategory_def::Battlefield:
switch (id)
{
case 1: return QStringLiteral("Battlefield_Ambience_Noise");
case 2: return QStringLiteral("Battlefield_Ambience_Tank");
case 3: return QStringLiteral("Battlefield_Ambience_War");
case 4: return QStringLiteral("Explosions_Battlefield");
case 5: return QStringLiteral("Explosions_Battlefield_1");
case 6: return QStringLiteral("Ground_Battle_with_Machine_Guns");
case 7: return QStringLiteral("Modern_Battlefield");
default:
return QStringLiteral("Error");
}
case SoundManagement::SoundCategory_def::Boat:
switch (id)
{
default:
return QStringLiteral("Error");
}
case SoundManagement::SoundCategory_def::Explosion:
switch (id)
{
case 1: return QStringLiteral("Explosion_Building_Crash");
default:
return QStringLiteral("Error");
}
case SoundManagement::SoundCategory_def::Helicopter:
switch (id)
{
case 1: return QStringLiteral("Helicopter_Crash");
case 2: return QStringLiteral("Helicopter_Fly_Overhead");
case 3: return QStringLiteral("Helicopter_Landing");
case 4: return QStringLiteral("Helicopter_Pass_by_Military");
case 5: return QStringLiteral("Helicopter_Take_off");
default:
return QStringLiteral("Error");
}
case SoundManagement::SoundCategory_def::MotorsAndUrbanTraffic:
switch (id)
{
case 1: return QStringLiteral("Big_City_Street_Traffic");
case 2: return QStringLiteral("City_Crossroads_Traffic");
case 3: return QStringLiteral("City_Street_Heavy_Traffic");
case 4: return QStringLiteral("City_Street_Noisy_Walking");
case 5: return QStringLiteral("Construction_Building_Ambient");
case 6: return QStringLiteral("Demonstration_and_Rioting");
case 7: return QStringLiteral("Noisy_City_Street");
case 8: return QStringLiteral("Stadium_Crowd_Ambient");
case 9: return QStringLiteral("Stadium_Crowd_Applause");
case 10: return QStringLiteral("Traffic_from_Car");
case 11: return QStringLiteral("Muezzincalling");
default:
return QStringLiteral("Error");
}
case SoundManagement::SoundCategory_def::Vehicle:
switch (id)
{
case 1: return QStringLiteral("Tank_Starting_and_Stopping");
default:
return QStringLiteral("Error");
}
case SoundManagement::SoundCategory_def::InsideBuilding:
switch (id)
{
case 1: return QStringLiteral("Fire_quietly");
case 2: return QStringLiteral("Fire_a_little_louder");
case 3: return QStringLiteral("Fire_louder");
case 4: return QStringLiteral("Fire_loud");
case 5: return QStringLiteral("Extinguishing_Noise");
case 7: return QStringLiteral("This_Room_is_Destroyed");
case 8: return QStringLiteral("This_Building_is_Destroyed");
default:
return QStringLiteral("Error");
}
case SoundManagement::SoundCategory_def::Unknown:
switch(id)
{
default:
return QStringLiteral("Error");
}
default:
return QStringLiteral("Error");
}
case SoundManagement::SoundCategory_def::Aircraft:
return QStringLiteral("Aircraft");
case SoundManagement::SoundCategory_def::Battlefield:
return QStringLiteral("Battlefield");
case SoundManagement::SoundCategory_def::Boat:
return QStringLiteral("Boat");
case SoundManagement::SoundCategory_def::Explosion:
return QStringLiteral("Explosion");
case SoundManagement::SoundCategory_def::Helicopter:
return QStringLiteral("Helicopter");
case SoundManagement::SoundCategory_def::MotorsAndUrbanTraffic:
return QStringLiteral("MotorsAndUrbanTraffic");
case SoundManagement::SoundCategory_def::Vehicle:
return QStringLiteral("Vehicle");
case SoundManagement::SoundCategory_def::InsideBuilding:
return QStringLiteral("InsideBuilding");
case SoundManagement::SoundCategory_def::Unknown:
return QStringLiteral("Unknown");
default:
return QString();
}
}
QString SoundAreaHelper::soundName(const int &category, const int &id)
QString SoundAreaHelper::categoryName(const int32_t& category)
{
return soundName(soundCategory(category), id);
return categoryName(soundCategory(category));
}
int SoundAreaHelper::soundDuration(SoundManagement::SoundCategory category, const int &id) const
QString SoundAreaHelper::soundName(SoundManagement::SoundCategory category, const int& id)
{
return soundDuration(static_cast<int>(category.underlying()), id);
switch (category.underlying())
{
case SoundManagement::SoundCategory_def::Aircraft:
switch (id)
{
case 1:
return QStringLiteral("Jet_Pass_by_Military");
case 2:
return QStringLiteral("Military_Aircraft_Fires");
case 3:
return QStringLiteral("Military_Aircraft_Fly_By");
case 4:
return QStringLiteral("Military_Airplane_Drops");
default:
return QStringLiteral("Error");
}
case SoundManagement::SoundCategory_def::Battlefield:
switch (id)
{
case 1:
return QStringLiteral("Battlefield_Ambience_Noise");
case 2:
return QStringLiteral("Battlefield_Ambience_Tank");
case 3:
return QStringLiteral("Battlefield_Ambience_War");
case 4:
return QStringLiteral("Explosions_Battlefield");
case 5:
return QStringLiteral("Explosions_Battlefield_1");
case 6:
return QStringLiteral("Ground_Battle_with_Machine_Guns");
case 7:
return QStringLiteral("Modern_Battlefield");
default:
return QStringLiteral("Error");
}
case SoundManagement::SoundCategory_def::Boat:
switch (id)
{
default:
return QStringLiteral("Error");
}
case SoundManagement::SoundCategory_def::Explosion:
switch (id)
{
case 1:
return QStringLiteral("Explosion_Building_Crash");
default:
return QStringLiteral("Error");
}
case SoundManagement::SoundCategory_def::Helicopter:
switch (id)
{
case 1:
return QStringLiteral("Helicopter_Crash");
case 2:
return QStringLiteral("Helicopter_Fly_Overhead");
case 3:
return QStringLiteral("Helicopter_Landing");
case 4:
return QStringLiteral("Helicopter_Pass_by_Military");
case 5:
return QStringLiteral("Helicopter_Take_off");
default:
return QStringLiteral("Error");
}
case SoundManagement::SoundCategory_def::MotorsAndUrbanTraffic:
switch (id)
{
case 1:
return QStringLiteral("Big_City_Street_Traffic");
case 2:
return QStringLiteral("City_Crossroads_Traffic");
case 3:
return QStringLiteral("City_Street_Heavy_Traffic");
case 4:
return QStringLiteral("City_Street_Noisy_Walking");
case 5:
return QStringLiteral("Construction_Building_Ambient");
case 6:
return QStringLiteral("Demonstration_and_Rioting");
case 7:
return QStringLiteral("Noisy_City_Street");
case 8:
return QStringLiteral("Stadium_Crowd_Ambient");
case 9:
return QStringLiteral("Stadium_Crowd_Applause");
case 10:
return QStringLiteral("Traffic_from_Car");
case 11:
return QStringLiteral("Muezzincalling");
default:
return QStringLiteral("Error");
}
case SoundManagement::SoundCategory_def::Vehicle:
switch (id)
{
case 1:
return QStringLiteral("Tank_Starting_and_Stopping");
default:
return QStringLiteral("Error");
}
case SoundManagement::SoundCategory_def::InsideBuilding:
switch (id)
{
case 1:
return QStringLiteral("Fire_quietly");
case 2:
return QStringLiteral("Fire_a_little_louder");
case 3:
return QStringLiteral("Fire_louder");
case 4:
return QStringLiteral("Fire_loud");
case 5:
return QStringLiteral("Extinguishing_Noise");
case 7:
return QStringLiteral("This_Room_is_Destroyed");
case 8:
return QStringLiteral("This_Building_is_Destroyed");
default:
return QStringLiteral("Error");
}
case SoundManagement::SoundCategory_def::Unknown:
switch (id)
{
default:
return QStringLiteral("Error");
}
default:
return QStringLiteral("Error");
}
}
int SoundAreaHelper::soundDuration(const int &category, const int &id) const
QString SoundAreaHelper::soundName(const int& category, const int& id)
{
SoundKey key{category, id};
return m_soundDuration.contains(key) ? m_soundDuration.value(key) : 0;
return soundName(soundCategory(category), id);
}
QString SoundAreaHelper::egcuName(const int &id) const
int SoundAreaHelper::soundDuration(SoundManagement::SoundCategory category, const int& id) const
{
return m_egcuNames.contains(id) ? m_egcuNames.value(id) : QString();
return soundDuration(static_cast<int>(category.underlying()), id);
}
QColor SoundAreaHelper::soundCategoryTextColor(const int32_t &category)
int SoundAreaHelper::soundDuration(const int& category, const int& id) const
{
switch (category)
{
case SoundManagement::SoundCategory_def::Aircraft: return {Qt::white};
case SoundManagement::SoundCategory_def::Battlefield: return {Qt::white};
case SoundManagement::SoundCategory_def::Boat: return {Qt::black};
case SoundManagement::SoundCategory_def::Explosion: return {Qt::white};
case SoundManagement::SoundCategory_def::Helicopter: return {Qt::white};
case SoundManagement::SoundCategory_def::MotorsAndUrbanTraffic: return {Qt::white};
case SoundManagement::SoundCategory_def::Vehicle: return {Qt::black};
case SoundManagement::SoundCategory_def::InsideBuilding: return {Qt::black};
case SoundManagement::SoundCategory_def::Unknown: return {Qt::white};
default:
return {Qt::black};
}
SoundKey key{category, id};
return m_soundDuration.contains(key) ? m_soundDuration.value(key) : 0;
}
QColor SoundAreaHelper::soundCategoryBackgroundColor(const int32_t &category)
QString SoundAreaHelper::egcuName(const int& id) const
{
switch (category)
{
case SoundManagement::SoundCategory_def::Aircraft: return QColor::fromRgb( 25, 25, 112);
case SoundManagement::SoundCategory_def::Battlefield: return QColor::fromRgb(160, 82, 45);
case SoundManagement::SoundCategory_def::Boat: return QColor::fromRgb(127, 255, 212);
case SoundManagement::SoundCategory_def::Explosion: return QColor::fromRgb(255, 0, 0);
case SoundManagement::SoundCategory_def::Helicopter: return QColor::fromRgb(153, 50, 204);
case SoundManagement::SoundCategory_def::MotorsAndUrbanTraffic: return QColor::fromRgb( 85, 107, 47);
case SoundManagement::SoundCategory_def::Vehicle: return QColor::fromRgb(255, 255, 0);
case SoundManagement::SoundCategory_def::InsideBuilding: return QColor::fromRgb(255, 160, 122);
case SoundManagement::SoundCategory_def::Unknown: return QColor::fromRgb(119, 136, 153);
default:
return {Qt::white};
}
return m_egcuNames.contains(id) ? m_egcuNames.value(id) : QString();
}
SoundManagement::SoundCategory SoundAreaHelper::soundCategory(const int &i)
QColor SoundAreaHelper::soundCategoryTextColor(const int32_t& category)
{
switch (i)
{
case 1: return SoundManagement::SoundCategory_def::Aircraft;
case 2: return SoundManagement::SoundCategory_def::Battlefield;
case 3: return SoundManagement::SoundCategory_def::Boat;
case 4: return SoundManagement::SoundCategory_def::Explosion;
case 5: return SoundManagement::SoundCategory_def::Helicopter;
case 6: return SoundManagement::SoundCategory_def::MotorsAndUrbanTraffic;
case 7: return SoundManagement::SoundCategory_def::Vehicle;
case 8: return SoundManagement::SoundCategory_def::InsideBuilding;
case 9:
default:
return SoundManagement::SoundCategory_def::Unknown;
}
switch (category)
{
case SoundManagement::SoundCategory_def::Aircraft:
return {Qt::white};
case SoundManagement::SoundCategory_def::Battlefield:
return {Qt::white};
case SoundManagement::SoundCategory_def::Boat:
return {Qt::black};
case SoundManagement::SoundCategory_def::Explosion:
return {Qt::white};
case SoundManagement::SoundCategory_def::Helicopter:
return {Qt::white};
case SoundManagement::SoundCategory_def::MotorsAndUrbanTraffic:
return {Qt::white};
case SoundManagement::SoundCategory_def::Vehicle:
return {Qt::black};
case SoundManagement::SoundCategory_def::InsideBuilding:
return {Qt::black};
case SoundManagement::SoundCategory_def::Unknown:
return {Qt::white};
default:
return {Qt::black};
}
}
}
QColor SoundAreaHelper::soundCategoryBackgroundColor(const int32_t& category)
{
switch (category)
{
case SoundManagement::SoundCategory_def::Aircraft:
return QColor::fromRgb(25, 25, 112);
case SoundManagement::SoundCategory_def::Battlefield:
return QColor::fromRgb(160, 82, 45);
case SoundManagement::SoundCategory_def::Boat:
return QColor::fromRgb(127, 255, 212);
case SoundManagement::SoundCategory_def::Explosion:
return QColor::fromRgb(255, 0, 0);
case SoundManagement::SoundCategory_def::Helicopter:
return QColor::fromRgb(153, 50, 204);
case SoundManagement::SoundCategory_def::MotorsAndUrbanTraffic:
return QColor::fromRgb(85, 107, 47);
case SoundManagement::SoundCategory_def::Vehicle:
return QColor::fromRgb(255, 255, 0);
case SoundManagement::SoundCategory_def::InsideBuilding:
return QColor::fromRgb(255, 160, 122);
case SoundManagement::SoundCategory_def::Unknown:
return QColor::fromRgb(119, 136, 153);
default:
return {Qt::white};
}
}
SoundManagement::SoundCategory SoundAreaHelper::soundCategory(const int& i)
{
switch (i)
{
case 1:
return SoundManagement::SoundCategory_def::Aircraft;
case 2:
return SoundManagement::SoundCategory_def::Battlefield;
case 3:
return SoundManagement::SoundCategory_def::Boat;
case 4:
return SoundManagement::SoundCategory_def::Explosion;
case 5:
return SoundManagement::SoundCategory_def::Helicopter;
case 6:
return SoundManagement::SoundCategory_def::MotorsAndUrbanTraffic;
case 7:
return SoundManagement::SoundCategory_def::Vehicle;
case 8:
return SoundManagement::SoundCategory_def::InsideBuilding;
case 9:
default:
return SoundManagement::SoundCategory_def::Unknown;
}
}
} // namespace EffectManagement
@@ -1,91 +1,68 @@
#pragma once
#include <SoundManagement/som_dtc.h>
#include <InfrastructureManagement/ism_dtc.h>
#include <SoundManagement/som_dtc.h>
namespace NGL
{
class INGLLogger;
}
namespace EffectManagement
{
using SoundKey = QPair<int32_t, int32_t>;
class SoundAreaHelper
{
public:
explicit SoundAreaHelper(SoundAreaHelper *helper);
explicit SoundAreaHelper(std::shared_ptr<InfrastructureManagement::Interface::Dtc> &ismDtc,
std::shared_ptr<SoundManagement::Interface::Dtc> &somDtc);
public:
explicit SoundAreaHelper(SoundAreaHelper* helper);
explicit SoundAreaHelper(std::shared_ptr<InfrastructureManagement::Interface::Dtc>& ismDtc,
std::shared_ptr<SoundManagement::Interface::Dtc>& somDtc);
public:
std::shared_ptr<InfrastructureManagement::Interface::Dtc> ismDtc() const { return m_ismDtc; }
std::shared_ptr<SoundManagement::Interface::Dtc> somDtc() const { return m_somDtc; }
public:
std::shared_ptr<InfrastructureManagement::Interface::Dtc> ismDtc() const
{
return m_ismDtc;
}
std::shared_ptr<SoundManagement::Interface::Dtc> somDtc() const
{
return m_somDtc;
}
static QVector<SoundManagement::SoundCategory> soundCategories();
static QVector<SoundManagement::SoundCategory> soundCategories();
static QString categoryName(SoundManagement::SoundCategory category);
static QString categoryName(SoundManagement::SoundCategory category);
static QString categoryName(const int32_t& category);
static QString categoryName(const int32_t &category);
static QString soundName(SoundManagement::SoundCategory category, const int& id);
static QString soundName(const int& category, const int& id);
static QString soundName(SoundManagement::SoundCategory category, const int &id);
int soundDuration(SoundManagement::SoundCategory category, const int& id) const;
static QString soundName(const int &category, const int &id);
int soundDuration(const int& category, const int& id) const;
QString egcuName(const int& id) const;
static QColor soundCategoryTextColor(const int32_t& category);
int soundDuration(SoundManagement::SoundCategory category, const int &id) const;
static QColor soundCategoryBackgroundColor(const int32_t& category);
static SoundManagement::SoundCategory soundCategory(const int& i);
int soundDuration(const int &category, const int &id) const;
private:
NGL::INGLLogger& m_logger;
std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_ismDtc;
std::shared_ptr<SoundManagement::Interface::Dtc> m_somDtc;
QMap<int32_t, QString> m_egcuNames;
QMap<SoundKey, int> m_soundDuration;
};
QString egcuName(const int &id) const;
static QColor soundCategoryTextColor(const int32_t &category);
static QColor soundCategoryBackgroundColor(const int32_t &category);
static SoundManagement::SoundCategory soundCategory(const int &i);
private:
NGL::INGLLogger &m_logger;
std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_ismDtc;
std::shared_ptr<SoundManagement::Interface::Dtc> m_somDtc;
QMap<int32_t, QString> m_egcuNames;
QMap<SoundKey, int> m_soundDuration;
};
}
} // namespace EffectManagement
@@ -1,167 +1,150 @@
#include "efm_sound_area_select_dialog.h"
#include <utility>
#include "ui_efm_sound_area_select_dialog.h"
#include "efm_sound_area_select_model.h"
#include "efm_sound_area_edit_dialog.h"
#include "../logger.h"
#include "efm_sound_area_edit_dialog.h"
#include "efm_sound_area_select_model.h"
#include "ui_efm_sound_area_select_dialog.h"
#include <LtsSession/lts_session.h>
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
#include <Plugins/EffectManagement/efm_data_plugin_interface.h>
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
#include <utility>
namespace EffectManagement
{
SoundAreaSelectDialog::SoundAreaSelectDialog(QWidget *parent)
: LtsWidgets::LtsDialog(parent)
, m_requestHelper(new LtsUtils::RequestHelper(this))
, m_model(new SoundAreaSelectModel(this))
, m_ui(new Ui::SoundAreasDialog)
SoundAreaSelectDialog::SoundAreaSelectDialog(QWidget* parent)
: LtsWidgets::LtsDialog(parent), m_requestHelper(new LtsUtils::RequestHelper(this)),
m_model(new SoundAreaSelectModel(this)), m_ui(new Ui::SoundAreasDialog)
{
m_ui->setupUi(this);
m_ui->setupUi(this);
m_buttonBox->getButton(LtsWidgets::DialogButton::Edit)->setText(tr("Stop All Sounds"));
m_buttonBox->getButton(LtsWidgets::DialogButton::Edit)->setIcon(QIcon(QStringLiteral("icon:avm_stop.svg")));
m_buttonBox->getButton(LtsWidgets::DialogButton::Edit)->setText(tr("Stop All Sounds"));
m_buttonBox->getButton(LtsWidgets::DialogButton::Edit)->setIcon(QIcon(QStringLiteral("icon:avm_stop.svg")));
}
SoundAreaSelectDialog::~SoundAreaSelectDialog()
{
delete m_ui;
delete m_ui;
}
void SoundAreaSelectDialog::onSelectSoundArea(const QModelIndex &index)
void SoundAreaSelectDialog::onSelectSoundArea(const QModelIndex& index)
{
if (!index.isValid())
return;
if (!index.isValid())
return;
if (index.column() == SoundAreaSelectModel::Column::Stop)
{
onStopSounds(index);
return;
}
SoundArea soundArea = m_model->getRowData(index.row());
SoundAreaEditDialog *dialog = new SoundAreaEditDialog(soundArea);
dialog->init(m_session);
addDialog(dialog, menuGroup(), soundArea.displayName, LtsWidgets::LayoutArea::eDialogTab);
}
void SoundAreaSelectDialog::onStopSounds(const QModelIndex &index)
{
SoundArea soundArea = m_model->getRowData(index.row());
if ( soundArea.egcuIds.isEmpty())
return;
const QVector<int> &egcuIds = soundArea.egcuIds;
for (const auto &egcu : std::as_const(egcuIds))
{
SoundManagement::StopAllSoundsRequest req(egcu);
m_requestHelper->startSingleRequest([this, req]()
if (index.column() == SoundAreaSelectModel::Column::Stop)
{
return m_somFtc->stopAllSoundsRequest(req, this);
});
}
onStopSounds(index);
return;
}
SoundArea soundArea = m_model->getRowData(index.row());
SoundAreaEditDialog* dialog = new SoundAreaEditDialog(soundArea);
dialog->init(m_session);
addDialog(dialog, menuGroup(), soundArea.displayName, LtsWidgets::LayoutArea::eDialogTab);
}
void SoundAreaSelectDialog::onStopSounds(const QModelIndex& index)
{
SoundArea soundArea = m_model->getRowData(index.row());
if (soundArea.egcuIds.isEmpty())
return;
const QVector<int>& egcuIds = soundArea.egcuIds;
for (const auto& egcu : std::as_const(egcuIds))
{
SoundManagement::StopAllSoundsRequest req(egcu);
m_requestHelper->startSingleRequest([this, req]() { return m_somFtc->stopAllSoundsRequest(req, this); });
}
}
void SoundAreaSelectDialog::onStopAllSounds()
{
const QVector<SoundArea> &soundAreas = m_model->soundAreas();
for (const auto &soundArea : std::as_const(soundAreas))
{
const QVector<int> &egcuIds = soundArea.egcuIds;
for (const auto &egcu : std::as_const(egcuIds))
const QVector<SoundArea>& soundAreas = m_model->soundAreas();
for (const auto& soundArea : std::as_const(soundAreas))
{
SoundManagement::StopAllSoundsRequest req(egcu);
m_requestHelper->startSingleRequest([this, req]() {
return m_somFtc->stopAllSoundsRequest(req, this);
});
const QVector<int>& egcuIds = soundArea.egcuIds;
for (const auto& egcu : std::as_const(egcuIds))
{
SoundManagement::StopAllSoundsRequest req(egcu);
m_requestHelper->startSingleRequest([this, req]() { return m_somFtc->stopAllSoundsRequest(req, this); });
}
}
}
}
bool SoundAreaSelectDialog::init(LtsSession::LtsSessionDataDds *session, const QString &menuGroup)
bool SoundAreaSelectDialog::init(LtsSession::LtsSessionDataDds* session, const QString& menuGroup)
{
DEBUG_LOG(m_logger) << "init";
DEBUG_LOG(m_logger) << "init";
m_session = session;
setMenuGroup(menuGroup);
m_session = session;
setMenuGroup(menuGroup);
std::shared_ptr<InfrastructureManagement::Interface::Dtc> ismDtc;
std::shared_ptr<SoundManagement::Interface::Dtc> somDtc;
std::shared_ptr<InfrastructureManagement::Interface::Dtc> ismDtc;
std::shared_ptr<SoundManagement::Interface::Dtc> somDtc;
if (!m_session->getDtc<InfrastructureManagement::DataInterface>(ismDtc))
{
ERROR_LOG(m_logger) << "connection to ISM-DTC failed";
return false;
}
if (!m_session->getDtc<InfrastructureManagement::DataInterface>(ismDtc))
{
ERROR_LOG(m_logger) << "connection to ISM-DTC failed";
return false;
}
if (!m_session->getDtc<EffectManagement::DataInterface>(somDtc))
{
ERROR_LOG(m_logger) << "connection to SOM-DTC failed";
return false;
}
if (!m_session->getDtc<EffectManagement::DataInterface>(somDtc))
{
ERROR_LOG(m_logger) << "connection to SOM-DTC failed";
return false;
}
if (!m_session->getFtc<EffectManagement::DataInterface>(m_somFtc))
{
ERROR_LOG(m_logger) << "connection to SOM-FTC failed";
return false;
}
if (!m_session->getFtc<EffectManagement::DataInterface>(m_somFtc))
{
ERROR_LOG(m_logger) << "connection to SOM-FTC failed";
return false;
}
if (!m_model->init(ismDtc, somDtc))
{
ERROR_LOG(m_logger) << "sound area select model initialization failed";
return false;
}
if (!m_model->init(ismDtc, somDtc))
{
ERROR_LOG(m_logger) << "sound area select model initialization failed";
return false;
}
m_ui->tvSoundlist->setModel(m_model);
m_ui->tvSoundlist->setModel(m_model);
SoundAreaSelectDelegate *delegate = new SoundAreaSelectDelegate(m_model);
m_ui->tvSoundlist->setItemDelegate(delegate);
SoundAreaSelectDelegate* delegate = new SoundAreaSelectDelegate(m_model);
m_ui->tvSoundlist->setItemDelegate(delegate);
m_ui->tvSoundlist->horizontalHeader()->resizeSection(SoundAreaSelectModel::Column::Id, 50);
m_ui->tvSoundlist->horizontalHeader()->resizeSection(SoundAreaSelectModel::Column::Stop, 100);
m_ui->tvSoundlist->horizontalHeader()->setSectionResizeMode(SoundAreaSelectModel::Column::Id, QHeaderView::Fixed);
m_ui->tvSoundlist->horizontalHeader()->setSectionResizeMode(SoundAreaSelectModel::Column::Name, QHeaderView::ResizeToContents);
m_ui->tvSoundlist->horizontalHeader()->setSectionResizeMode(SoundAreaSelectModel::Column::AreaEgcu, QHeaderView::ResizeToContents);
m_ui->tvSoundlist->horizontalHeader()->setSectionResizeMode(SoundAreaSelectModel::Column::Egcus, QHeaderView::Stretch);
m_ui->tvSoundlist->horizontalHeader()->setSectionResizeMode(SoundAreaSelectModel::Column::ActiveSounds, QHeaderView::ResizeToContents);
m_ui->tvSoundlist->horizontalHeader()->setSectionResizeMode(SoundAreaSelectModel::Column::Stop, QHeaderView::Fixed);
m_ui->tvSoundlist->horizontalHeader()->resizeSection(SoundAreaSelectModel::Column::Id, 50);
m_ui->tvSoundlist->horizontalHeader()->resizeSection(SoundAreaSelectModel::Column::Stop, 100);
m_ui->tvSoundlist->horizontalHeader()->setSectionResizeMode(SoundAreaSelectModel::Column::Id, QHeaderView::Fixed);
m_ui->tvSoundlist->horizontalHeader()->setSectionResizeMode(SoundAreaSelectModel::Column::Name,
QHeaderView::ResizeToContents);
m_ui->tvSoundlist->horizontalHeader()->setSectionResizeMode(SoundAreaSelectModel::Column::AreaEgcu,
QHeaderView::ResizeToContents);
m_ui->tvSoundlist->horizontalHeader()->setSectionResizeMode(SoundAreaSelectModel::Column::Egcus,
QHeaderView::Stretch);
m_ui->tvSoundlist->horizontalHeader()->setSectionResizeMode(SoundAreaSelectModel::Column::ActiveSounds,
QHeaderView::ResizeToContents);
m_ui->tvSoundlist->horizontalHeader()->setSectionResizeMode(SoundAreaSelectModel::Column::Stop, QHeaderView::Fixed);
connect(m_ui->tvSoundlist, &QTableView::clicked, this, &SoundAreaSelectDialog::onSelectSoundArea);
m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &SoundAreaSelectDialog::onStopAllSounds);
connect(m_ui->tvSoundlist, &QTableView::clicked, this, &SoundAreaSelectDialog::onSelectSoundArea);
m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &SoundAreaSelectDialog::onStopAllSounds);
DEBUG_LOG(m_logger) << "init successful";
return true;
DEBUG_LOG(m_logger) << "init successful";
return true;
}
void SoundAreaSelectDialog::retranslate()
{
translate(m_ui, tr("Sound Area Select"));
translate(m_ui, tr("Sound Area Select"));
}
void SoundAreaSelectDialog::onStopAllSoundsReply(const Core::FunctionReplyObject &replyObject)
void SoundAreaSelectDialog::onStopAllSoundsReply(const Core::FunctionReplyObject& replyObject)
{
m_requestHelper->requestReply(replyObject);
m_requestHelper->requestReply(replyObject);
}
}
} // namespace EffectManagement
@@ -1,11 +1,9 @@
#pragma once
#include <SoundManagement/som_ftc.h>
#include <LtsWidgets/lts_dialog.h>
#include <SoundManagement/som_ftc.h>
namespace NGL
{
@@ -27,54 +25,43 @@ namespace Ui
class SoundAreasDialog;
}
namespace EffectManagement
{
class SoundAreaSelectModel;
class SoundAreaSelectDialog
: public LtsWidgets::LtsDialog
, protected SoundManagement::Interface::Ftc::StopAllSoundsReplyHandler
class SoundAreaSelectDialog : public LtsWidgets::LtsDialog,
protected SoundManagement::Interface::Ftc::StopAllSoundsReplyHandler
{
Q_OBJECT
Q_OBJECT
public:
explicit SoundAreaSelectDialog(QWidget *parent = nullptr);
~SoundAreaSelectDialog();
public:
explicit SoundAreaSelectDialog(QWidget* parent = nullptr);
~SoundAreaSelectDialog();
private slots:
private slots:
void onSelectSoundArea(const QModelIndex& index);
void onSelectSoundArea(const QModelIndex &index);
void onStopSounds(const QModelIndex& index);
void onStopSounds(const QModelIndex &index);
void onStopAllSounds();
void onStopAllSounds();
public:
bool init(LtsSession::LtsSessionDataDds* session, const QString& menuGroup);
private:
NGL::INGLLogger& m_logger;
void retranslate() override;
void onStopAllSoundsReply(const Core::FunctionReplyObject& replyObject) override final;
public:
bool init(LtsSession::LtsSessionDataDds *session, const QString &menuGroup);
std::shared_ptr<SoundManagement::Interface::Ftc> m_somFtc{nullptr};
LtsUtils::RequestHelper* m_requestHelper{nullptr};
private:
SoundAreaSelectModel* m_model{nullptr};
NGL::INGLLogger &m_logger;
void retranslate() override;
void onStopAllSoundsReply(const Core::FunctionReplyObject &replyObject) override final;
LtsSession::LtsSessionDataDds* m_session{nullptr};
Ui::SoundAreasDialog* m_ui{nullptr};
};
std::shared_ptr<SoundManagement::Interface::Ftc> m_somFtc{nullptr};
LtsUtils::RequestHelper *m_requestHelper{nullptr};
SoundAreaSelectModel *m_model{nullptr};
LtsSession::LtsSessionDataDds *m_session{nullptr};
Ui::SoundAreasDialog *m_ui{nullptr};
};
}
} // namespace EffectManagement
@@ -1,282 +1,239 @@
#include "efm_sound_area_select_model.h"
#include "efm_sound_area_helper.h"
#include "../logger.h"
#include <algorithm>
#include "../logger.h"
#include "efm_sound_area_helper.h"
#include <QApplication>
#include <QTime>
#include <algorithm>
namespace EffectManagement
{
SoundAreaSelectDelegate::SoundAreaSelectDelegate(QObject *parent) : QItemDelegate(parent),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
}
void SoundAreaSelectDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
SoundAreaSelectDelegate::SoundAreaSelectDelegate(QObject* parent)
: QItemDelegate(parent), m_logger(NGL::NGLLoggerBootstrap::getLogger())
{
if (index.column() != SoundAreaSelectModel::Column::Stop)
{
QItemDelegate::paint(painter, option, index);
return;
}
QStyleOptionButton button;
button.rect = option.rect;
button.state = index.data().toBool() ? QStyle::State_Enabled : QStyle::State_ReadOnly;
button.iconSize = QSize(25, 25);
button.icon = QIcon(QStringLiteral("icon:avm_stop.svg"));
QApplication::style()->drawControl(QStyle::CE_PushButton, &button, painter);
}
SoundAreaSelectModel::SoundAreaSelectModel(QWidget *parent)
: LtsWidgets::LtsAbstractTableModel<SoundArea>(
void SoundAreaSelectDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option,
const QModelIndex& index) const
{
if (index.column() != SoundAreaSelectModel::Column::Stop)
{
tr("ID"),
tr("Name"),
tr("Main EGCU"),
tr("Sound Area EGCUs"),
tr("Active Sounds"),
tr("Stop")
}, parent)
QItemDelegate::paint(painter, option, index);
return;
}
QStyleOptionButton button;
button.rect = option.rect;
button.state = index.data().toBool() ? QStyle::State_Enabled : QStyle::State_ReadOnly;
button.iconSize = QSize(25, 25);
button.icon = QIcon(QStringLiteral("icon:avm_stop.svg"));
QApplication::style()->drawControl(QStyle::CE_PushButton, &button, painter);
}
SoundAreaSelectModel::SoundAreaSelectModel(QWidget* parent)
: LtsWidgets::LtsAbstractTableModel<SoundArea>(
{tr("ID"), tr("Name"), tr("Main EGCU"), tr("Sound Area EGCUs"), tr("Active Sounds"), tr("Stop")}, parent)
{
}
bool SoundAreaSelectModel::onSoundStateChanged(const SoundManagement::SoundState &data, DataModification modType)
bool SoundAreaSelectModel::onSoundStateChanged(const SoundManagement::SoundState& data, DataModification modType)
{
for (auto &soundArea : m_vecData)
{
if (soundArea.egcuIds.contains(data.egcuId()))
for (auto& soundArea : m_vecData)
{
QHash<int32_t, SoundManagement::SoundState>::iterator it = soundArea.activeSounds.find(data.id());
switch (modType)
{
case DataModification::eAdded:
if (it != soundArea.activeSounds.end())
if (soundArea.egcuIds.contains(data.egcuId()))
{
DEBUG_LOG(m_logger) << "'" << m_helper->soundName(data.category(), data.soundId()) << "' is already active";
return false;
}
else
{
soundArea.activeSounds.insert(data.id(), data);
emit dataChanged(
SoundAreaSelectModel::index(0, Column::ActiveSounds),
SoundAreaSelectModel::index(m_vecData.size(), Column::ActiveSounds)
);
return true;
}
QHash<int32_t, SoundManagement::SoundState>::iterator it = soundArea.activeSounds.find(data.id());
switch (modType)
{
case DataModification::eAdded:
if (it != soundArea.activeSounds.end())
{
DEBUG_LOG(m_logger)
<< "'" << m_helper->soundName(data.category(), data.soundId()) << "' is already active";
return false;
}
else
{
soundArea.activeSounds.insert(data.id(), data);
emit dataChanged(SoundAreaSelectModel::index(0, Column::ActiveSounds),
SoundAreaSelectModel::index(m_vecData.size(), Column::ActiveSounds));
return true;
}
case DataModification::eRemoved:
if (it == soundArea.activeSounds.end())
{
DEBUG_LOG(m_logger) << "'" << m_helper->soundName(data.category(), data.soundId()) << "' is not active";
return false;
}
else
{
soundArea.activeSounds.remove(it.key());
emit dataChanged(
SoundAreaSelectModel::index(0, Column::ActiveSounds),
SoundAreaSelectModel::index(m_vecData.size(), Column::ActiveSounds)
);
return true;
}
case DataModification::eRemoved:
if (it == soundArea.activeSounds.end())
{
DEBUG_LOG(m_logger)
<< "'" << m_helper->soundName(data.category(), data.soundId()) << "' is not active";
return false;
}
else
{
soundArea.activeSounds.remove(it.key());
emit dataChanged(SoundAreaSelectModel::index(0, Column::ActiveSounds),
SoundAreaSelectModel::index(m_vecData.size(), Column::ActiveSounds));
return true;
}
case DataModification::eModified:
default:
return false;
}
}
}
case DataModification::eModified:
default:
return false;
}
}
}
return false;
return false;
}
bool SoundAreaSelectModel::init(const std::shared_ptr<InfrastructureManagement::Interface::Dtc> &ismDtc,
const std::shared_ptr<SoundManagement::Interface::Dtc> &somDtc)
bool SoundAreaSelectModel::init(const std::shared_ptr<InfrastructureManagement::Interface::Dtc>& ismDtc,
const std::shared_ptr<SoundManagement::Interface::Dtc>& somDtc)
{
DEBUG_LOG(m_logger) << "init";
DEBUG_LOG(m_logger) << "init";
m_ismDtc = ismDtc;
m_somDtc = somDtc;
m_ismDtc = ismDtc;
m_somDtc = somDtc;
m_helper = std::make_shared<SoundAreaHelper>(new SoundAreaHelper(m_ismDtc, m_somDtc));
m_helper = std::make_shared<SoundAreaHelper>(new SoundAreaHelper(m_ismDtc, m_somDtc));
connect(m_ismDtc.get(), &InfrastructureManagement::Interface::Dtc::effectAreaChanged, this,
[this](const InfrastructureManagement::EffectArea &data, DataModification modType)
{
return onDataChanged(SoundArea(data), modType);
});
connect(m_ismDtc.get(), &InfrastructureManagement::Interface::Dtc::effectAreaChanged, this,
[this](const InfrastructureManagement::EffectArea& data, DataModification modType) {
return onDataChanged(SoundArea(data), modType);
});
m_ismDtc->effectAreas([this](const InfrastructureManagement::EffectArea &effectArea)
{
insertRow(SoundArea(effectArea));
});
m_ismDtc->effectAreas(
[this](const InfrastructureManagement::EffectArea& effectArea) { insertRow(SoundArea(effectArea)); });
connect(m_somDtc.get(), &SoundManagement::Interface::Dtc::soundStateChanged, this,
[this](const SoundManagement::SoundState &data, DataModification modType)
{
return onSoundStateChanged(data, modType);
});
connect(m_somDtc.get(), &SoundManagement::Interface::Dtc::soundStateChanged, this,
[this](const SoundManagement::SoundState& data, DataModification modType) {
return onSoundStateChanged(data, modType);
});
m_somDtc->soundStates([this](const SoundManagement::SoundState &soundState)
{
onSoundStateChanged(soundState, DataModification::eAdded);
});
m_somDtc->soundStates([this](const SoundManagement::SoundState& soundState) {
onSoundStateChanged(soundState, DataModification::eAdded);
});
DEBUG_LOG(m_logger) << "init successful";
return true;
DEBUG_LOG(m_logger) << "init successful";
return true;
}
bool SoundAreaSelectModel::insertRow(const SoundArea &item)
bool SoundAreaSelectModel::insertRow(const SoundArea& item)
{
beginInsertRows(QModelIndex(), m_vecData.size(), m_vecData.size());
m_vecData.push_back(item);
endInsertRows();
return true;
beginInsertRows(QModelIndex(), m_vecData.size(), m_vecData.size());
m_vecData.push_back(item);
endInsertRows();
return true;
}
bool SoundAreaSelectModel::removeRow(int row)
{
removeRows(row, 1);
return true;
removeRows(row, 1);
return true;
}
QVariant SoundAreaSelectModel::data(const QModelIndex &index, int role) const
QVariant SoundAreaSelectModel::data(const QModelIndex& index, int role) const
{
if (!index.isValid())
return QVariant();
if (!index.isValid())
return QVariant();
if ( (role != Qt::DisplayRole) && (role != Qt::ToolTipRole) )
return QVariant{};
if ((role != Qt::DisplayRole) && (role != Qt::ToolTipRole))
return QVariant{};
const SoundArea &soundArea = m_vecData.at(index.row());
std::string str = "";
const SoundArea& soundArea = m_vecData.at(index.row());
std::string str = "";
switch (role)
{
case Qt::DisplayRole:
switch (index.column())
switch (role)
{
case Column::Id: return soundArea.id;
case Qt::DisplayRole:
switch (index.column())
{
case Column::Id:
return soundArea.id;
case Column::Name: return soundArea.displayName;
case Column::Name:
return soundArea.displayName;
case Column::AreaEgcu: return m_helper->egcuName(soundArea.areaEgcuId);
case Column::AreaEgcu:
return m_helper->egcuName(soundArea.areaEgcuId);
case Column::Egcus:
for (const auto &egcu : soundArea.egcuIds)
str += m_helper->egcuName(egcu).toStdString() + ", ";
if (str.size() > 1)
str = str.substr(0, str.length() - 2);
return QString::fromStdString(str);
case Column::Egcus:
for (const auto& egcu : soundArea.egcuIds)
str += m_helper->egcuName(egcu).toStdString() + ", ";
if (str.size() > 1)
str = str.substr(0, str.length() - 2);
return QString::fromStdString(str);
case Column::ActiveSounds:
if (soundArea.activeSounds.size() > 0)
{
SoundManagement::SoundState sound = soundArea.activeSounds.begin().value();
return m_helper->soundName(sound.category(), sound.soundId());
}
return QString();
case Column::ActiveSounds:
if (soundArea.activeSounds.size() > 0)
{
SoundManagement::SoundState sound = soundArea.activeSounds.begin().value();
return m_helper->soundName(sound.category(), sound.soundId());
}
return QString();
case Column::Stop:
return soundArea.activeSounds.size() > 0;
case Column::Stop:
return soundArea.activeSounds.size() > 0;
default:
Q_UNREACHABLE();
return QVariant{};
}
default:
Q_UNREACHABLE();
return QVariant{};
}
case Qt::ToolTipRole:
switch (index.column())
{
case Column::Id:
case Column::Name:
case Column::AreaEgcu:
return data(index, Qt::DisplayRole);
case Qt::ToolTipRole:
switch (index.column())
{
case Column::Id:
case Column::Name:
case Column::AreaEgcu:
return data(index, Qt::DisplayRole);
case Column::Egcus:
for (const auto &egcu : soundArea.egcuIds)
str += m_helper->egcuName(egcu).toStdString() + "\n";
if (str.size() > 1)
str = str.substr(0, str.length() - 1);
return QString::fromStdString(str);
case Column::Egcus:
for (const auto& egcu : soundArea.egcuIds)
str += m_helper->egcuName(egcu).toStdString() + "\n";
if (str.size() > 1)
str = str.substr(0, str.length() - 1);
return QString::fromStdString(str);
case Column::ActiveSounds:
for (const auto &sound : soundArea.activeSounds)
str += m_helper->soundName(sound.category(), sound.soundId()).toStdString() + "\n";
if (str.size() > 1)
str = str.substr(0, str.length() - 1);
return QString::fromStdString(str);
case Column::ActiveSounds:
for (const auto& sound : soundArea.activeSounds)
str += m_helper->soundName(sound.category(), sound.soundId()).toStdString() + "\n";
if (str.size() > 1)
str = str.substr(0, str.length() - 1);
return QString::fromStdString(str);
case Column::Stop:
return QStringLiteral("Stop all Sounds");
case Column::Stop:
return QStringLiteral("Stop all Sounds");
default:
Q_UNREACHABLE();
return QVariant();
}
default:
Q_UNREACHABLE();
return QVariant();
}
default:
Q_UNREACHABLE();
return QVariant();
}
default:
Q_UNREACHABLE();
return QVariant();
}
}
bool SoundAreaSelectModel::onDataChanged(const SoundArea &data, DataModification modType)
bool SoundAreaSelectModel::onDataChanged(const SoundArea& data, DataModification modType)
{
if (modType == DataModification::eAdded)
return insertRow(data);
if (modType == DataModification::eAdded)
return insertRow(data);
int row = indexOf(data);
if (modType == DataModification::eRemoved)
return removeRow(row);
int row = indexOf(data);
if (modType == DataModification::eRemoved)
return removeRow(row);
return setRowData(row, data);
return setRowData(row, data);
}
int SoundAreaSelectModel::indexOf(const SoundArea &data) const
int SoundAreaSelectModel::indexOf(const SoundArea& data) const
{
return m_vecData.indexOf(data);
return m_vecData.indexOf(data);
}
}
} // namespace EffectManagement
@@ -1,25 +1,21 @@
#pragma once
#include "efm_sound_area.h"
#include <LtsWidgets/lts_abstract_table_model.h>
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
#include <InfrastructureManagement/ism_dtc.h>
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
#include <LtsWidgets/lts_abstract_table_model.h>
#include <QItemDelegate>
#include <SoundManagement/som_dtc.h>
#include <SoundManagement/som_ftc.h>
#include <QItemDelegate>
namespace NGL
{
class INGLLogger;
}
namespace EffectManagement
{
@@ -27,65 +23,52 @@ using SoundKey = QPair<int32_t, int32_t>;
class SoundAreaHelper;
class SoundAreaSelectDelegate
: public QItemDelegate
class SoundAreaSelectDelegate : public QItemDelegate
{
Q_OBJECT
Q_OBJECT
public:
SoundAreaSelectDelegate(QObject *parent = nullptr);
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
public:
SoundAreaSelectDelegate(QObject* parent = nullptr);
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
};
};
class SoundAreaSelectModel final
: public LtsWidgets::LtsAbstractTableModel<SoundArea>
class SoundAreaSelectModel final : public LtsWidgets::LtsAbstractTableModel<SoundArea>
{
Q_OBJECT
Q_OBJECT
public:
enum Column { Id, Name, AreaEgcu, Egcus, ActiveSounds, Stop };
public:
enum Column { Id, Name, AreaEgcu, Egcus, ActiveSounds, Stop };
explicit SoundAreaSelectModel(QWidget *parent = nullptr);
explicit SoundAreaSelectModel(QWidget* parent = nullptr);
private slots:
private slots:
bool onSoundStateChanged(const SoundManagement::SoundState& data, DataModification modType);
bool onSoundStateChanged(const SoundManagement::SoundState &data, DataModification modType);
public:
bool init(const std::shared_ptr<InfrastructureManagement::Interface::Dtc>& ismDtc,
const std::shared_ptr<SoundManagement::Interface::Dtc>& somDtc);
QVector<SoundArea> soundAreas() const
{
return m_vecData;
}
public:
bool init(const std::shared_ptr<InfrastructureManagement::Interface::Dtc> &ismDtc,
const std::shared_ptr<SoundManagement::Interface::Dtc> &somDtc);
bool insertRow(const SoundArea& item) override;
bool removeRow(int row) override;
QVariant data(const QModelIndex& index, int role) const override;
QVector<SoundArea> soundAreas() const { return m_vecData; }
protected:
NGL::INGLLogger& m_logger;
bool onDataChanged(const SoundArea& data, DataModification modType) override;
bool insertRow(const SoundArea &item) override;
bool removeRow(int row) override;
QVariant data(const QModelIndex &index, int role) const override;
private:
int indexOf(const SoundArea& data) const;
protected:
std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_ismDtc{nullptr};
std::shared_ptr<SoundManagement::Interface::Dtc> m_somDtc{nullptr};
NGL::INGLLogger &m_logger;
bool onDataChanged(const SoundArea &data, DataModification modType) override;
std::shared_ptr<SoundAreaHelper> m_helper{nullptr};
};
private:
int indexOf(const SoundArea &data) const;
std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_ismDtc{nullptr};
std::shared_ptr<SoundManagement::Interface::Dtc> m_somDtc{nullptr};
std::shared_ptr<SoundAreaHelper> m_helper{nullptr};
};
}
} // namespace EffectManagement
@@ -1,29 +1,29 @@
#include "efm_switch_item_delegate.h"
#include "../logger.h"
#include <QDebug>
#include "../logger.h"
#include <QDebug>
namespace EffectManagement
{
const QIcon SwitchItemDelegate::s_iconOn = QIcon(QStringLiteral("icon:switch_on.svg"));
const QIcon SwitchItemDelegate::s_iconOn = QIcon(QStringLiteral("icon:switch_on.svg"));
const QIcon SwitchItemDelegate::s_iconOff = QIcon(QStringLiteral("icon:switch_off.svg"));
SwitchItemDelegate::SwitchItemDelegate(QObject *parent) : QStyledItemDelegate(parent),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
}
void SwitchItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
SwitchItemDelegate::SwitchItemDelegate(QObject* parent)
: QStyledItemDelegate(parent), m_logger(NGL::NGLLoggerBootstrap::getLogger())
{
if (index.data().toInt() == 1)
s_iconOn.paint(painter, option.rect, Qt::AlignCenter);
else if (index.data().toInt() == -1)
s_iconOff.paint(painter, option.rect, Qt::AlignCenter);
}
}
void SwitchItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
if (index.data().toInt() == 1)
s_iconOn.paint(painter, option.rect, Qt::AlignCenter);
else if (index.data().toInt() == -1)
s_iconOff.paint(painter, option.rect, Qt::AlignCenter);
}
} // namespace EffectManagement
@@ -1,35 +1,30 @@
#pragma once
#include <QStyledItemDelegate>
namespace NGL
{
class INGLLogger;
}
namespace EffectManagement
{
class SwitchItemDelegate
: public QStyledItemDelegate
class SwitchItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
Q_OBJECT
public:
SwitchItemDelegate(QObject *parent = nullptr);
public:
SwitchItemDelegate(QObject* parent = nullptr);
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
private:
private:
NGL::INGLLogger& m_logger;
static const QIcon s_iconOn;
static const QIcon s_iconOff;
};
NGL::INGLLogger &m_logger;
static const QIcon s_iconOn;
static const QIcon s_iconOff;
};
}
} // namespace EffectManagement
@@ -1,17 +1,15 @@
#pragma once
#include "efm_effect_area.h"
#include "efm_sound_helper.h"
#include <LtsWidgets/lts_dialog.h>
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
#include <LtsWidgets/lts_dialog.h>
#include <SoundManagement/som_dtc.h>
#include <SoundManagement/som_ftc.h>
namespace NGL
{
class INGLLogger;
@@ -32,54 +30,49 @@ namespace Ui
class SoundManagementDialog;
}
namespace EffectManagement
{
class SoundTreeModel;
class SoundPlaylistModel;
class SoundManagementDialog
: public LtsWidgets::LtsDialog
, protected SoundManagement::Interface::Ftc::ControlSoundReplyHandler
class SoundManagementDialog : public LtsWidgets::LtsDialog,
protected SoundManagement::Interface::Ftc::ControlSoundReplyHandler
{
Q_OBJECT
Q_OBJECT
public:
explicit SoundManagementDialog(const EffectAreaData &data, QWidget *parent = nullptr);
~SoundManagementDialog();
public:
explicit SoundManagementDialog(const EffectAreaData& data, QWidget* parent = nullptr);
~SoundManagementDialog();
private slots:
void onAddSoundToPlaylist(const SoundKey& key);
void onStopAllSounds();
private slots:
void onAddSoundToPlaylist(const SoundKey &key);
void onStopAllSounds();
public:
bool init(LtsSession::LtsSessionDataDds* session, const QString& menuGroup);
public:
bool init(LtsSession::LtsSessionDataDds *session, const QString &menuGroup);
private:
NGL::INGLLogger& m_logger;
void onControlSoundReply(const Core::FunctionReplyObject& replyObject) override final;
void retranslate() override;
bool apply() override;
private:
std::shared_ptr<SoundManagement::Interface::Dtc> m_somDtc{nullptr};
std::shared_ptr<SoundManagement::Interface::Ftc> m_somFtc{nullptr};
std::shared_ptr<SoundManagementHelper> m_helper{nullptr};
NGL::INGLLogger &m_logger;
void onControlSoundReply(const Core::FunctionReplyObject &replyObject) override final;
void retranslate() override;
bool apply() override;
LtsUtils::RequestHelper* m_requestHelper{nullptr};
LtsSession::LtsSessionDataDds* m_session{nullptr};
std::shared_ptr<SoundManagement::Interface::Dtc> m_somDtc{nullptr};
std::shared_ptr<SoundManagement::Interface::Ftc> m_somFtc{nullptr};
std::shared_ptr<SoundManagementHelper> m_helper{nullptr};
EffectAreaData* m_data{nullptr};
SoundTreeModel* m_treeModel{nullptr};
SoundPlaylistModel* m_playlistModel{nullptr};
LtsUtils::RequestHelper *m_requestHelper{nullptr};
LtsSession::LtsSessionDataDds *m_session{nullptr};
QHash<int32_t, QCheckBox*> m_egcuCheckBoxes;
QString m_menuGroup;
EffectAreaData *m_data{nullptr};
SoundTreeModel *m_treeModel{nullptr};
SoundPlaylistModel *m_playlistModel{nullptr};
Ui::SoundManagementDialog* m_ui{nullptr};
};
QHash<int32_t, QCheckBox *> m_egcuCheckBoxes;
QString m_menuGroup;
Ui::SoundManagementDialog *m_ui{nullptr};
};
}
} // namespace EffectManagement