Projekt

Allgemein

Profil

Herunterladen als
Herunterladen (3,48 KB) Statistiken
| Zweig: | Revision:
9d05e414 Christian Ehringfeld
#ifndef PERSON_H
#define PERSON_H

#include <QDateTime>
#include <QString>
#include <QList>
#include <QObject>
#include <QAbstractListModel>
#include <QDebug>
b7446f4c Christian Ehringfeld
#include "../../entitymanager/src/entity.h"
9d05e414 Christian Ehringfeld
b7446f4c Christian Ehringfeld
using namespace CuteEntityManager;
class Group;
af84b9c4 Christian Ehringfeld
class Contact;
class Address;
3fd96253 Christian Ehringfeld
b7446f4c Christian Ehringfeld
class Person: public Entity {
9d05e414 Christian Ehringfeld
Q_OBJECT
b7446f4c Christian Ehringfeld
Q_PROPERTY(QString firstName READ getFirstName WRITE setFirstName)
Q_PROPERTY(QString familyName READ getFamilyName WRITE setFamilyName)
Q_PROPERTY(QString namePrefix READ getNamePrefix WRITE setNamePrefix)
Q_PROPERTY(QString nickName READ getNickName WRITE setNickName)
ba6f6521 Christian Ehringfeld
Q_PROPERTY(QString customPictureFileName READ getCustomPictureFileName WRITE
b7446f4c Christian Ehringfeld
setCustomPictureFileName)
Q_PROPERTY(QDate birthday READ getBirthday WRITE setBirthday)
5c3d9487 Christian Ehringfeld
Q_PROPERTY(Gender gender READ getGender WRITE setGender)
b7446f4c Christian Ehringfeld
Q_PROPERTY(QList<QSharedPointer<Group>> groups READ getGroups WRITE setGroups)
da565582 Christian Ehringfeld
Q_PROPERTY(QList<QSharedPointer<Group>> maintainedGroups READ
getMaintainedGroups WRITE setMaintainedGroups)
f682a8cb Christian Ehringfeld
Q_PROPERTY(QList<QSharedPointer<Contact>> contacts READ getContacts WRITE
setContacts)
Q_PROPERTY(QList<QSharedPointer<Address>> addresses READ
getAddresses WRITE setAddresses)
9d05e414 Christian Ehringfeld
public:
5c3d9487 Christian Ehringfeld
enum class Gender {MALE, FEMALE, UNKNOWNGENDER};
enum class NameOrder {FIRST_FAMILY_NAME_ORDER, FAMILY_FIRST_NAME_ORDER};
b7446f4c Christian Ehringfeld
Q_INVOKABLE explicit Person(QObject *parent = 0);
5c3d9487 Christian Ehringfeld
Person(QString firstName, QString familyName,
Gender gender = Gender::UNKNOWNGENDER,
abb9e8c5 Christian Ehringfeld
QString customPictureFileName = QString(), QString namePrefix = QString(),
QString nickName = QString(), QDate birthday = QDate(), QObject *parent = 0);
9d05e414 Christian Ehringfeld
f9cef58f Christian Ehringfeld
virtual const QHash<QString, CuteEntityManager::Relation> getRelations() const override;
9d05e414 Christian Ehringfeld
b7446f4c Christian Ehringfeld
bool isPresent(QDateTime date = QDateTime::currentDateTime());
5c3d9487 Christian Ehringfeld
QString fullName(NameOrder nameOrder = NameOrder::FAMILY_FIRST_NAME_ORDER)
const;
9d05e414 Christian Ehringfeld
b7446f4c Christian Ehringfeld
QString getFirstName() const;
void setFirstName(const QString &value);
9d05e414 Christian Ehringfeld
b7446f4c Christian Ehringfeld
QString getFamilyName() const;
void setFamilyName(const QString &value);
ba6f6521 Christian Ehringfeld
QString getNamePrefix() const;
void setNamePrefix(const QString &value);

b7446f4c Christian Ehringfeld
QString getNickName() const;
void setNickName(const QString &value);
ba6f6521 Christian Ehringfeld
b7446f4c Christian Ehringfeld
QDate getBirthday() const;
void setBirthday(const QDate &value);

5c3d9487 Christian Ehringfeld
Gender getGender() const;
void setGender(const Gender &value);
b7446f4c Christian Ehringfeld
QString getCustomPictureFileName() const;
void setCustomPictureFileName(const QString &value);

QList<QSharedPointer<Contact> > getContacts() const;
void setContacts(const QList<QSharedPointer<Contact> > &value);

QList<QSharedPointer<Address> > getAddresses() const;
void setAddresses(const QList<QSharedPointer<Address> > &value);

QList<QSharedPointer<Group> > getGroups() const;
void setGroups(const QList<QSharedPointer<Group> > &value);

void addContact(Contact *contact);
void addAddress(Address *address);
9d05e414 Christian Ehringfeld
da565582 Christian Ehringfeld
QList<QSharedPointer<Group> > getMaintainedGroups() const;
void setMaintainedGroups(const QList<QSharedPointer<Group> > &value);

9d05e414 Christian Ehringfeld
protected:
ba6f6521 Christian Ehringfeld
QString firstName;
QString familyName;
QString namePrefix;
QString nickName;
QDate birthday;
5c3d9487 Christian Ehringfeld
Gender gender;
ba6f6521 Christian Ehringfeld
QString customPictureFileName;
b7446f4c Christian Ehringfeld
QList <QSharedPointer<Contact>> contacts;
abb9e8c5 Christian Ehringfeld
QList <QSharedPointer<Address>> addresses;
QList <QSharedPointer<Group>> groups;
da565582 Christian Ehringfeld
QList <QSharedPointer<Group>> maintainedGroups;
38a2aaf2 Christian Ehringfeld
9d05e414 Christian Ehringfeld
};
ba6f6521 Christian Ehringfeld
b7446f4c Christian Ehringfeld
9d05e414 Christian Ehringfeld
#endif // PERSON_H