2020-05-26 16:32:07 +02:00
|
|
|
/**
|
2020-08-14 20:56:04 +02:00
|
|
|
* SPDX-FileCopyrightText: 2020 Tobias Fella <fella@posteo.de>
|
2021-04-08 13:16:36 +02:00
|
|
|
* SPDX-FileCopyrightText: 2021 Bart De Vries <bart@mogwai.be>
|
2020-05-26 16:32:07 +02:00
|
|
|
*
|
2020-08-14 20:56:04 +02:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
2020-05-26 16:32:07 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ENTRY_H
|
|
|
|
#define ENTRY_H
|
|
|
|
|
|
|
|
#include <QDateTime>
|
|
|
|
#include <QDebug>
|
|
|
|
#include <QObject>
|
|
|
|
#include <QString>
|
|
|
|
#include <QStringList>
|
|
|
|
|
|
|
|
#include "author.h"
|
2021-02-21 19:54:10 +01:00
|
|
|
#include "enclosure.h"
|
2020-05-26 16:32:07 +02:00
|
|
|
#include "feed.h"
|
|
|
|
|
|
|
|
class Entry : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2021-02-21 19:54:10 +01:00
|
|
|
Q_PROPERTY(Feed *feed READ feed CONSTANT)
|
2020-06-06 00:05:32 +02:00
|
|
|
Q_PROPERTY(QString id READ id CONSTANT)
|
2020-05-26 16:32:07 +02:00
|
|
|
Q_PROPERTY(QString title READ title CONSTANT)
|
|
|
|
Q_PROPERTY(QString content READ content CONSTANT)
|
|
|
|
Q_PROPERTY(QVector<Author *> authors READ authors CONSTANT)
|
|
|
|
Q_PROPERTY(QDateTime created READ created CONSTANT)
|
|
|
|
Q_PROPERTY(QDateTime updated READ updated CONSTANT)
|
|
|
|
Q_PROPERTY(QString link READ link CONSTANT)
|
|
|
|
Q_PROPERTY(QString baseUrl READ baseUrl CONSTANT)
|
2020-06-06 00:05:32 +02:00
|
|
|
Q_PROPERTY(bool read READ read WRITE setRead NOTIFY readChanged);
|
2021-04-07 10:39:12 +02:00
|
|
|
Q_PROPERTY(bool new READ getNew WRITE setNew NOTIFY newChanged);
|
2021-02-21 19:54:10 +01:00
|
|
|
Q_PROPERTY(Enclosure *enclosure READ enclosure CONSTANT);
|
2021-04-03 21:39:20 +02:00
|
|
|
Q_PROPERTY(bool hasEnclosure READ hasEnclosure CONSTANT);
|
2021-04-05 14:15:44 +02:00
|
|
|
Q_PROPERTY(QString image READ image WRITE setImage NOTIFY imageChanged)
|
2021-04-29 21:51:04 +02:00
|
|
|
Q_PROPERTY(QString cachedImage READ cachedImage NOTIFY cachedImageChanged)
|
2021-04-16 20:38:13 +02:00
|
|
|
Q_PROPERTY(bool queueStatus READ queueStatus WRITE setQueueStatus NOTIFY queueStatusChanged)
|
2020-05-26 16:32:07 +02:00
|
|
|
|
|
|
|
public:
|
2021-04-02 22:31:34 +02:00
|
|
|
Entry(Feed *feed, QString id);
|
2020-05-26 16:32:07 +02:00
|
|
|
~Entry();
|
|
|
|
|
2020-06-06 00:05:32 +02:00
|
|
|
QString id() const;
|
2020-05-26 16:32:07 +02:00
|
|
|
QString title() const;
|
|
|
|
QString content() const;
|
|
|
|
QVector<Author *> authors() const;
|
|
|
|
QDateTime created() const;
|
|
|
|
QDateTime updated() const;
|
|
|
|
QString link() const;
|
2020-06-06 00:05:32 +02:00
|
|
|
bool read() const;
|
2021-04-07 10:39:12 +02:00
|
|
|
bool getNew() const;
|
2021-02-21 19:54:10 +01:00
|
|
|
Enclosure *enclosure() const;
|
2021-04-03 21:39:20 +02:00
|
|
|
bool hasEnclosure() const;
|
2021-04-05 14:15:44 +02:00
|
|
|
QString image() const;
|
2021-04-29 21:51:04 +02:00
|
|
|
QString cachedImage() const;
|
2021-04-07 22:10:39 +02:00
|
|
|
bool queueStatus() const;
|
2021-02-21 19:54:10 +01:00
|
|
|
Feed *feed() const;
|
2020-06-06 00:05:32 +02:00
|
|
|
|
2020-05-26 16:32:07 +02:00
|
|
|
QString baseUrl() const;
|
|
|
|
|
2021-04-16 20:38:13 +02:00
|
|
|
void setRead(const bool read);
|
|
|
|
void setNew(const bool state);
|
2021-04-05 14:15:44 +02:00
|
|
|
void setImage(const QString &url);
|
2021-04-16 20:38:13 +02:00
|
|
|
void setQueueStatus(const bool status);
|
2020-06-06 00:05:32 +02:00
|
|
|
|
2020-06-07 17:14:13 +02:00
|
|
|
Q_INVOKABLE QString adjustedContent(int width, int fontSize);
|
|
|
|
|
2020-06-06 00:05:32 +02:00
|
|
|
Q_SIGNALS:
|
|
|
|
void readChanged(bool read);
|
2021-04-07 10:39:12 +02:00
|
|
|
void newChanged(bool state);
|
2021-04-05 14:15:44 +02:00
|
|
|
void imageChanged(const QString &url);
|
2021-04-29 21:51:04 +02:00
|
|
|
void cachedImageChanged(const QString &imagePath);
|
2021-04-07 22:10:39 +02:00
|
|
|
void queueStatusChanged(bool queueStatus);
|
2020-06-06 00:05:32 +02:00
|
|
|
|
2020-05-26 16:32:07 +02:00
|
|
|
private:
|
|
|
|
Feed *m_feed;
|
2020-06-06 00:05:32 +02:00
|
|
|
QString m_id;
|
2020-05-26 16:32:07 +02:00
|
|
|
QString m_title;
|
|
|
|
QString m_content;
|
|
|
|
QVector<Author *> m_authors;
|
|
|
|
QDateTime m_created;
|
|
|
|
QDateTime m_updated;
|
|
|
|
QString m_link;
|
2020-06-06 00:05:32 +02:00
|
|
|
bool m_read;
|
2021-04-07 10:39:12 +02:00
|
|
|
bool m_new;
|
2021-02-21 19:54:10 +01:00
|
|
|
Enclosure *m_enclosure = nullptr;
|
2021-04-05 14:15:44 +02:00
|
|
|
QString m_image;
|
2021-04-03 21:39:20 +02:00
|
|
|
bool m_hasenclosure = false;
|
2020-05-26 16:32:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ENTRY_H
|