Data classes and services for number series and seasons. Fixed release
build.
This commit is contained in:
@@ -4,11 +4,15 @@
|
||||
class User;
|
||||
class Permission;
|
||||
class Role;
|
||||
class Season;
|
||||
class NumberSeries;
|
||||
|
||||
#include "user.h"
|
||||
#include "role.h"
|
||||
#include "permission.h"
|
||||
#include "system.h"
|
||||
#include "search.h"
|
||||
#include "numberseries.h"
|
||||
|
||||
#endif // COREDATA_H
|
||||
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
#include "numberseries.h"
|
||||
#include "../context.h"
|
||||
#include "../iplugin.h"
|
||||
|
||||
NumberSeries::NumberSeries(QObject *parent) : QObject(parent)
|
||||
{
|
||||
m_id = 0;
|
||||
m_lastNumber = 0;
|
||||
}
|
||||
|
||||
int NumberSeries::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void NumberSeries::setId(int 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 != NULL ? plugin->pluginName() : "";
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
#ifndef NUMBERSERIES_H
|
||||
#define NUMBERSERIES_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QSharedPointer>
|
||||
|
||||
#include <odb/core.hxx>
|
||||
|
||||
#include "season.h"
|
||||
|
||||
#pragma db object
|
||||
class NumberSeries : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
|
||||
Q_PROPERTY(int lastNumber READ lastNumber WRITE setLastNumber)
|
||||
Q_PROPERTY(QString pluginName READ pluginName)
|
||||
Q_PROPERTY(QString seasonName READ seasonName)
|
||||
public:
|
||||
explicit NumberSeries(QObject *parent = 0);
|
||||
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
|
||||
QString prefix() const;
|
||||
void setPrefix(const QString &prefix);
|
||||
|
||||
int lastNumber() const;
|
||||
void setLastNumber(int lastNumber);
|
||||
|
||||
QString pluginId() const;
|
||||
void setPluginId(const QString &pluginId);
|
||||
|
||||
QSharedPointer<Season> season() const;
|
||||
void setSeason(const QSharedPointer<Season> &season);
|
||||
|
||||
QString seasonName() const;
|
||||
|
||||
QString pluginName() const;
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
|
||||
#pragma db id auto
|
||||
int m_id;
|
||||
QString m_prefix;
|
||||
int m_lastNumber;
|
||||
QString m_pluginId;
|
||||
QSharedPointer<Season> m_season;
|
||||
};
|
||||
|
||||
#endif // NUMBERSERIES_H
|
||||
@@ -0,0 +1,58 @@
|
||||
#include "season.h"
|
||||
|
||||
Season::Season(QObject *parent)
|
||||
:QObject(parent)
|
||||
{
|
||||
m_id = 0;
|
||||
m_active = false;
|
||||
}
|
||||
|
||||
QString Season::name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
void Season::setName(const QString &name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
QDate Season::validFrom() const
|
||||
{
|
||||
return m_validFrom;
|
||||
}
|
||||
|
||||
void Season::setValidFrom(const QDate &validFrom)
|
||||
{
|
||||
m_validFrom = validFrom;
|
||||
}
|
||||
|
||||
QDate Season::validTo() const
|
||||
{
|
||||
return m_validTo;
|
||||
}
|
||||
|
||||
void Season::setValidTo(const QDate &validTo)
|
||||
{
|
||||
m_validTo = validTo;
|
||||
}
|
||||
|
||||
bool Season::active() const
|
||||
{
|
||||
return m_active;
|
||||
}
|
||||
|
||||
void Season::setActive(bool active)
|
||||
{
|
||||
m_active = active;
|
||||
}
|
||||
|
||||
int Season::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void Season::setId(int id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
#ifndef SEASON_H
|
||||
#define SEASON_H
|
||||
|
||||
#include "core_global.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QDate>
|
||||
|
||||
#include <odb/core.hxx>
|
||||
|
||||
#pragma db object
|
||||
class CORESHARED_EXPORT Season : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString name READ name WRITE setName)
|
||||
Q_PROPERTY(QDate validFrom READ validFrom WRITE setValidFrom)
|
||||
Q_PROPERTY(QDate validTo READ validTo WRITE setValidTo)
|
||||
Q_PROPERTY(bool active READ active WRITE setActive)
|
||||
public:
|
||||
explicit Season(QObject *parent = 0);
|
||||
|
||||
QString name() const;
|
||||
void setName(const QString &name);
|
||||
|
||||
QDate validFrom() const;
|
||||
void setValidFrom(const QDate &validFrom);
|
||||
|
||||
QDate validTo() const;
|
||||
void setValidTo(const QDate &validTo);
|
||||
|
||||
bool active() const;
|
||||
void setActive(bool active);
|
||||
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
|
||||
#pragma db id auto
|
||||
int m_id;
|
||||
QString m_name;
|
||||
QDate m_validFrom;
|
||||
QDate m_validTo;
|
||||
bool m_active;
|
||||
};
|
||||
|
||||
#endif // SEASON_H
|
||||
Reference in New Issue
Block a user