69 lines
1.6 KiB
C++
Executable File
69 lines
1.6 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Model for electronic warfare (Eloka)
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Astrid Mueller, SGAS, 2017-10-18
|
|
*/
|
|
|
|
#include "avm_eloka_model.h"
|
|
#include <ngltools/ngltools_dtg.h>
|
|
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
|
#include <ParticipantManagement/ppm_translation.h>
|
|
|
|
#include <QDateTime>
|
|
|
|
namespace AudioVideoManagement
|
|
{
|
|
ElokaModel::ElokaModel(LtsSession::LtsSession *session, QObject *parent)
|
|
: LtsWidgets::LtsAbstractTableModel<ElokaData>(
|
|
{
|
|
tr("Party"),
|
|
tr("Radio Circuit"),
|
|
tr("Action"),
|
|
tr("Endless Playback"),
|
|
tr("Start Time")
|
|
},
|
|
parent)
|
|
, m_logger(getLogger("ElokaModel"))
|
|
{
|
|
Q_ASSERT(session);
|
|
// optional
|
|
session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc);
|
|
}
|
|
|
|
QVariant ElokaModel::data(const QModelIndex &index,
|
|
int role) const
|
|
{
|
|
if (role != Qt::DisplayRole || !indexIsValid(index))
|
|
return QVariant();
|
|
|
|
const ElokaData &data = m_vecData.at(index.row());
|
|
|
|
switch (index.column())
|
|
{
|
|
case Party:
|
|
{
|
|
if (!m_ppmDtc)
|
|
return QString::number(data.party);
|
|
|
|
if (data.party >= 0)
|
|
return ParticipantManagement::trPartyName(m_ppmDtc->party(data.party).name());
|
|
return QVariant(QLatin1Char('-'));
|
|
}
|
|
case RadioCircuit:
|
|
return data.displayName;
|
|
case Action:
|
|
return data.action;
|
|
case EndlessPlayback:
|
|
return QVariant(data.mode == AvaElokaMode::EndlessLoop ? QLatin1Char('+') : QLatin1Char('-'));
|
|
case StartTime:
|
|
return QDateTime::fromMSecsSinceEpoch(data.startTime);
|
|
}
|
|
return QVariant();
|
|
}
|
|
|
|
|
|
} // namespace
|