tripgroup.h 1.6 KB
Newer Older
Volker Krause's avatar
Volker Krause committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/*
    Copyright (C) 2018 Volker Krause <vkrause@kde.org>

    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU Library General Public License as published by
    the Free Software Foundation; either version 2 of the License, or (at your
    option) any later version.

    This program is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
    License for more details.

    You should have received a copy of the GNU General Public License
15
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
Volker Krause's avatar
Volker Krause committed
16 17 18 19 20
*/

#ifndef TRIPGROUP_H
#define TRIPGROUP_H

21
#include <QMetaType>
Volker Krause's avatar
Volker Krause committed
22 23 24 25 26
#include <QString>
#include <QVector>

class TripGroupManager;

27 28
class QDateTime;

Volker Krause's avatar
Volker Krause committed
29 30 31 32 33
/** Trip group object. */
class TripGroup
{
    Q_GADGET
    Q_PROPERTY(QString name READ name)
34 35
    Q_PROPERTY(QDateTime beginDateTime READ beginDateTime)
    Q_PROPERTY(QDateTime endDateTime READ endDateTime)
Volker Krause's avatar
Volker Krause committed
36 37 38 39 40 41 42 43 44
public:
    TripGroup();
    TripGroup(TripGroupManager *mgr);
    ~TripGroup();

    QString name() const;
    void setName(const QString &name);

    QVector<QString> elements() const;
Volker Krause's avatar
Volker Krause committed
45
    void setElements(const QVector<QString> &elems);
Volker Krause's avatar
Volker Krause committed
46

47 48 49
    QDateTime beginDateTime() const;
    QDateTime endDateTime() const;

Volker Krause's avatar
Volker Krause committed
50 51 52 53 54 55 56 57 58
    bool load(const QString &path);
    void store(const QString &path) const;

private:
    TripGroupManager *m_mgr = nullptr;
    QString m_name;
    QVector<QString> m_elements;
};

59 60
Q_DECLARE_METATYPE(TripGroup)

Volker Krause's avatar
Volker Krause committed
61
#endif // TRIPGROUP_H