Initial UI
This commit is contained in:
1 parent
4d52c8cc60
commit
3c0037cfc9
29 files changed
+1367
-2
No files matched your search
@@ -0,0 +1,44 @@
|
||||
#ifndef READINGMODEL_H
|
||||
#define READINGMODEL_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
class FormatReader;
|
||||
|
||||
class ReadingModel : public QObject {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString chapterTitle READ chapterTitle NOTIFY chapterChanged)
|
||||
Q_PROPERTY(QString chapterContent READ chapterContent NOTIFY chapterChanged)
|
||||
Q_PROPERTY(int currentChapter READ currentChapter NOTIFY chapterChanged)
|
||||
Q_PROPERTY(int totalChapters READ totalChapters NOTIFY totalChaptersChanged)
|
||||
Q_PROPERTY(double progress READ progress NOTIFY chapterChanged)
|
||||
|
||||
public:
|
||||
explicit ReadingModel(QObject *parent = nullptr);
|
||||
|
||||
QString chapterTitle() const;
|
||||
QString chapterContent() const;
|
||||
int currentChapter() const;
|
||||
int totalChapters() const;
|
||||
double progress() const;
|
||||
|
||||
void setReader(FormatReader *reader);
|
||||
|
||||
Q_INVOKABLE void nextChapter();
|
||||
Q_INVOKABLE void previousChapter();
|
||||
Q_INVOKABLE void goToChapter(int index);
|
||||
|
||||
signals:
|
||||
void chapterChanged();
|
||||
void totalChaptersChanged();
|
||||
|
||||
private:
|
||||
FormatReader *m_reader = nullptr;
|
||||
int m_currentChapter = 0;
|
||||
int m_totalChapters = 0;
|
||||
QString m_chapterTitle;
|
||||
QString m_chapterContent;
|
||||
};
|
||||
|
||||
#endif // READINGMODEL_H
|
||||
Reference in new issue
Block a user