File indexing completed on 2024-05-12 16:21:27
0001 /** 0002 * SPDX-FileCopyrightText: 2022 Bart De Vries <bart@mogwai.be> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #pragma once 0008 0009 #include <QDebug> 0010 #include <QObject> 0011 #include <QString> 0012 0013 #include "entry.h" 0014 0015 class Chapter : public QObject 0016 { 0017 Q_OBJECT 0018 0019 Q_PROPERTY(Entry *entry READ entry CONSTANT) 0020 Q_PROPERTY(QString title READ title NOTIFY titleChanged) 0021 Q_PROPERTY(QString link READ link NOTIFY linkChanged) 0022 Q_PROPERTY(QString image READ image NOTIFY imageChanged) 0023 Q_PROPERTY(QString cachedImage READ cachedImage NOTIFY cachedImageChanged) 0024 Q_PROPERTY(int start READ start NOTIFY startChanged) 0025 0026 public: 0027 Chapter(Entry *entry, const QString &title, const QString &link, const QString &image, const int &start, QObject *parent = nullptr); 0028 ~Chapter(); 0029 0030 Entry *entry() const; 0031 QString title() const; 0032 QString link() const; 0033 QString image() const; 0034 QString cachedImage() const; 0035 int start() const; 0036 0037 void setTitle(const QString &title, bool emitSignal = true); 0038 void setLink(const QString &link, bool emitSignal = true); 0039 void setImage(const QString &image, bool emitSignal = true); 0040 void setStart(const int &start, bool emitSignal = true); 0041 0042 Q_SIGNALS: 0043 void titleChanged(const QString &title); 0044 void linkChanged(const QString &link); 0045 void imageChanged(const QString &url); 0046 void cachedImageChanged(const QString &imagePath); 0047 void startChanged(const int &start); 0048 0049 private: 0050 Entry *m_entry = nullptr; 0051 QString m_title; 0052 QString m_link; 0053 QString m_image; 0054 int m_start; 0055 };