114 lines
2.9 KiB
C++
Executable File
114 lines
2.9 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Radio TreeModel
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
#pragma once
|
|
|
|
#include <AudioVideoManagement/logger.h>
|
|
#include <AudioVideoManagement/avm.hpp>
|
|
#include <AudioVideoManagement/avm_dtc.h>
|
|
#include <LtsSession/lts_session.h>
|
|
#include <InfrastructureManagement/ism_dtc.h>
|
|
#include <nglwidgets/ngltreemodel.h>
|
|
#include <QDataStream>
|
|
|
|
class NGLTreeItem;
|
|
|
|
|
|
namespace InfrastructureManagement
|
|
{
|
|
namespace Interface
|
|
{
|
|
class Dtc;
|
|
}
|
|
}
|
|
|
|
|
|
namespace AudioVideoManagement
|
|
{
|
|
|
|
class StreamNameMapping;
|
|
|
|
/**
|
|
* Used by AvailableStreamsModel and UsedStreamsModel.
|
|
*/
|
|
struct StreamModelData
|
|
{
|
|
qint64 id = 0;
|
|
qint64 parentId = 0;
|
|
bool isGroup = false;
|
|
QString name;
|
|
qint32 mountingPointId = 0;
|
|
|
|
static StreamModelData createFromServiceItem(const AvMenuEntry &entry, StreamNameMapping *streamNameMapping, const QMap<int, VideoTeam> &videoTeamList);
|
|
|
|
friend QDataStream &operator<<(QDataStream &out,
|
|
const StreamModelData &myObj)
|
|
{
|
|
out << myObj.id
|
|
<< myObj.parentId
|
|
<< myObj.isGroup
|
|
<< myObj.name
|
|
<< myObj.mountingPointId;
|
|
return out;
|
|
}
|
|
|
|
friend QDataStream &operator>>(QDataStream &in,
|
|
StreamModelData &myObj)
|
|
{
|
|
in >> myObj.id
|
|
>> myObj.parentId
|
|
>> myObj.isGroup
|
|
>> myObj.name
|
|
>> myObj.mountingPointId;
|
|
|
|
return in;
|
|
}
|
|
};
|
|
|
|
|
|
/**
|
|
* Used by MenuEdit.
|
|
*
|
|
* @see UsedStreamsModel
|
|
*/
|
|
class AvailableStreamsModel : public NGLTreeModel
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
static const QString s_MimeType;
|
|
|
|
AvailableStreamsModel(const std::shared_ptr<AudioVideoManagement::Interface::Dtc> &avmDtc,
|
|
const std::shared_ptr<InfrastructureManagement::Interface::Dtc> &ismDtc,
|
|
LtsSession::LtsSession *session,
|
|
StreamNameMapping *streamNameMapping,
|
|
QObject *parent,
|
|
bool isAudio);
|
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
|
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
|
QMimeData *mimeData(const QModelIndexList &indexes) const override;
|
|
bool dropMimeData(const QMimeData *data, Qt::DropAction action,
|
|
int row, int column, const QModelIndex &parent) override;
|
|
|
|
Qt::DropActions supportedDragActions() const override { return Qt::CopyAction; }
|
|
|
|
private:
|
|
void initModel();
|
|
|
|
const bool m_isAudio;
|
|
const std::shared_ptr<AudioVideoManagement::Interface::Dtc> m_avmDtc;
|
|
const std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_ismDtc;
|
|
LtsSession::LtsSession *m_session;
|
|
StreamNameMapping *m_streamNameMapping;
|
|
|
|
NGL::INGLLogger &m_logger;
|
|
};
|
|
} // namespace AudioVideoManagement
|
|
Q_DECLARE_METATYPE(AudioVideoManagement::StreamModelData)
|
|
|