You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
prodejna/core/data/numberseries.cpp

93 lines
1.7 KiB
C++

#include "numberseries.h"
#include "../context.h"
#include "../iplugin.h"
QX_REGISTER_CPP_CORE(NumberSeries)
namespace qx {
template<> void register_class(QxClass<NumberSeries>& t) {
t.setName("NumberSeries");
t.id(&NumberSeries::m_id, "id");
t.data(&NumberSeries::m_prefix, "prefix");
t.data(&NumberSeries::m_lastNumber, "lastNumber");
t.data(&NumberSeries::m_pluginId, "pluginId");
t.relationManyToOne(&NumberSeries::m_season, "season");
}
}
NumberSeries::NumberSeries(QObject *parent) : QObject(parent)
{
m_id = 0;
m_lastNumber = 0;
}
long NumberSeries::id() const
{
return m_id;
}
void NumberSeries::setId(long id)
{
m_id = id;
}
QString NumberSeries::prefix() const
{
return m_prefix;
}
void NumberSeries::setPrefix(const QString &prefix)
{
m_prefix = prefix;
}
int NumberSeries::lastNumber() const
{
return m_lastNumber;
}
void NumberSeries::setLastNumber(int lastNumber)
{
m_lastNumber = lastNumber;
}
QString NumberSeries::pluginId() const
{
return m_pluginId;
}
void NumberSeries::setPluginId(const QString &pluginId)
{
m_pluginId = pluginId;
}
QSharedPointer<Season> NumberSeries::season() const
{
return m_season;
}
void NumberSeries::setSeason(const QSharedPointer<Season> &season)
{
m_season = season;
}
QString NumberSeries::seasonName() const
{
if (!m_season.isNull())
{
return m_season->name();
}
return "";
}
QString NumberSeries::pluginName() const
{
IPlugin *plugin = Context::instance().plugin(m_pluginId);
return plugin != nullptr ? plugin->pluginName() : "";
}
QStringList NumberSeries::eagerLoad() {
return { "season" };
}