85 lines
3.3 KiB
C++
Executable File
85 lines
3.3 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 <InfrastructureManagement/ism_dtc.h>
|
|
#include <nglwidgets/ngltreemodel.h>
|
|
#include "avm_available_streams_model.h"
|
|
|
|
namespace AudioVideoManagement
|
|
{
|
|
|
|
class MenuStruct;
|
|
class StreamNameMapping;
|
|
|
|
/**
|
|
* Used by MenuEdit.
|
|
*
|
|
* @see AvailableStreamsModel.
|
|
*/
|
|
class UsedStreamsModel final : public NGLTreeModel
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
UsedStreamsModel(const std::shared_ptr<AudioVideoManagement::Interface::Dtc> avmDtc,
|
|
const std::shared_ptr<InfrastructureManagement::Interface::Dtc> ismDtc,
|
|
const MenuStruct &ms,
|
|
StreamNameMapping *streamNameMapping,
|
|
QObject *parent);
|
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
bool setData(const QModelIndex &idx, const QVariant &value,
|
|
int role = Qt::EditRole) 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;
|
|
bool canDropMimeData(const QMimeData *data, Qt::DropAction action,
|
|
int row, int column, const QModelIndex &parent) const override;
|
|
QStringList mimeTypes() const override;
|
|
Qt::DropActions supportedDragActions() const override { return Qt::MoveAction; }
|
|
|
|
|
|
MenuStruct getMenuStruct() const;
|
|
bool initModel();
|
|
|
|
protected:
|
|
NGLTreeItem *createItem(const QVariant &data, const QIcon &icon) const override;
|
|
|
|
private slots:
|
|
void onDataChanged(const InfrastructureManagement::MainStructureElement &data,
|
|
const DataModification modType);
|
|
void onDataChangedMvs(const AudioVideoManagement::VideoTeam &data,
|
|
const DataModification modType);
|
|
void onStreamNameDataChanged(int32_t mountingPointId, const QString &internalName, const QString &displayName);
|
|
private:
|
|
void updateStreamNames(const int mountingPointId, const QString &newName, NGLTreeItem *item);
|
|
|
|
void fixUpData(NGLTreeItem *item);
|
|
|
|
static const QString s_MimeTypeOI;
|
|
QString mimeType(const QModelIndex &index) const;
|
|
void insertNGLTreeItemChild(NGLTreeItem *item, NGLTreeItem *parent, bool asCopy);
|
|
void insertChildren(NGLTreeItem *parent, int parentId, const std::vector<AudioVideoManagement::AvMenuEntry> &entries);
|
|
const std::shared_ptr<AudioVideoManagement::Interface::Dtc> m_avmDtc;
|
|
const std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_ismDtc;
|
|
NGLTreeItem *getItemToCheck(const QModelIndex &index, const QModelIndex &parentIndex) const;
|
|
bool checkSingleItem(NGLTreeItem * target, StreamModelData & toCheck) const;
|
|
bool checkDrop(const QMimeData *data, const QModelIndex &index, const QModelIndex &parentIndex, Qt::DropAction action) const;
|
|
QSet<int> fillTakenCameras(NGLTreeItem *getItem) const;
|
|
int m_dummyId;
|
|
MenuStruct m_menuStruct;
|
|
StreamNameMapping *m_streamNameMapping;
|
|
NGL::INGLLogger &m_logger;
|
|
};
|
|
|
|
} // namespace AudioVideoManagement
|