Files
qt5-legatus-legacy/Lts/Plugins/EffectManagement/Gui/SoundArea/efm_sound_area_helper.h
T
2026-08-13 18:33:10 +02:00

137 lines
4.2 KiB
C++
Executable File

/**
* @RDE_HEADER@
* Helper class for SoundAreas.
* $Id$
* $HeadURL$
* $Author$
* Created by Filip Biedziak, NLE, 2020-08-10
*/
#pragma once
#include <SoundManagement/som_dtc.h>
#include <InfrastructureManagement/ism_dtc.h>
namespace NGL
{
class INGLLogger;
}
namespace EffectManagement
{
using SoundKey = QPair<int32_t, int32_t>;
/**
* @brief The SoundAreaHelper class provides utility functions for Infrastructure and Sound
* Management. Connections to the ISM-DTC and SOM-DTC are used.
*/
class SoundAreaHelper
{
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; }
/**
* @brief soundCategories returns a list with the SoundCategory enum from the Sound Management.
* @return a vector with all SoundCategory
*/
static QVector<SoundManagement::SoundCategory> soundCategories();
/**
* @brief categoryName returns the display name of a SoundCategory.
* @param category element of SoundCategory enum from Sound Management
* @return name of the SoundCategory
*/
static QString categoryName(SoundManagement::SoundCategory category);
/**
* @brief categoryName returns the display name of a SoundCategory.
* @param category integer corresponding to a SoundCategory enum element from Sound Management
* @return name of the SoundCategory
*/
static QString categoryName(const int32_t &category);
/**
* @brief soundName returns the display name of a Sound.
* @param category SoundCategory of the Sound
* @param id index of the Sound
* @return name of the Sound
*/
static QString soundName(SoundManagement::SoundCategory category, const int &id);
/**
* @brief soundName returns the display name of a Sound.
* @param category integer corresponding to a SoundCategory enum element from Sound Management
* @param id index of the Sound
* @return name of the Sound
*/
static QString soundName(const int &category, const int &id);
/**
* @brief soundDuration returns the duration of a Sound when played once.
* @param category SoundCategory of the Sound
* @param id ID of the Sound within its category
* @return duration of the Sound
*/
int soundDuration(SoundManagement::SoundCategory category, const int &id) const;
/**
* @brief soundDuraiton returns the duration of a Sound when played once.
* @param category SoundCategory of the Sound
* @param id ID of the Sound within its category
* @return duration of the Sound
*/
int soundDuration(const int &category, const int &id) const;
/**
* @brief egcuName returns the display name of an EGCU.
* @param id index of the EGCU
* @return name of the EGCU
*/
QString egcuName(const int &id) const;
/**
* @brief soundCategoryTextColor returns a QColor as background color of a SoundCategory.
* @param category integer corresponding to the SoundCategory enum value
* @return color of the SoundCategory background
*/
static QColor soundCategoryTextColor(const int32_t &category);
/**
* @brief soundCategoryTextColor returns a QColor as text color of a SoundCategory.
* @param category integer corresponding to the SoundCategory enum value
* @return color of the SoundCategory text
*/
static QColor soundCategoryBackgroundColor(const int32_t &category);
/**
* @brief soundCategory returns the index of a SoundCategory as a SoundCategory enum value.
* @param i integer index of a SoundCategory
* @return corresponding SoundCategory enum value
*/
static SoundManagement::SoundCategory soundCategory(const int &i);
private:
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;
NGL::INGLLogger &m_logger;
}; // class SoundManagementHelper
} // namespace EffectManagement