Add format text to history view

This commit is contained in:
Agel committed 2026-04-20 11:54:57 +02:00
1 parent 232d86716d
commit 94d4fe762c
5 files changed
+20

No files matched your search

+5
View File
@@ -70,6 +70,11 @@ QString HistoryBookModel::author() const
return m_author;
}
QString HistoryBookModel::format() const
{
return m_filePath.section('.', -1).toUpper();
}
QString HistoryBookModel::coverImageUrl() const
{
return m_coverImageUrl;
+2
View File
@@ -17,6 +17,7 @@ class HistoryBookModel : public QObject {
Q_PROPERTY(QString lastOpened READ lastOpened WRITE setLastOpened NOTIFY lastOpenedChanged)
Q_PROPERTY(QString title READ title NOTIFY metadataLoaded)
Q_PROPERTY(QString author READ author NOTIFY metadataLoaded)
Q_PROPERTY(QString format READ format NOTIFY metadataLoaded)
Q_PROPERTY(QString coverImageUrl READ coverImageUrl NOTIFY coverImageLoaded)
public:
@@ -33,6 +34,7 @@ public:
QString title() const;
QString author() const;
QString format() const;
QString coverImageUrl() const;
void loadMetadata();
+3
View File
@@ -10,6 +10,7 @@ HistoryModel::HistoryModel(ReaderFactory &factory, QObject *parent)
m_roleNames[FilePathRole] = "filePath";
m_roleNames[TitleRole] = "title";
m_roleNames[AuthorRole] = "author";
m_roleNames[FormatRole] = "format";
m_roleNames[ProgressRole] = "progress";
m_roleNames[LastOpenedRole] = "lastOpened";
m_roleNames[CoverImageUrlRole] = "coverImageUrl";
@@ -43,6 +44,8 @@ QVariant HistoryModel::data(const QModelIndex &index, int role) const
return book->title();
case AuthorRole:
return book->author();
case FormatRole:
return book->format();
case ProgressRole:
return book->progress();
case LastOpenedRole:
+1
View File
@@ -19,6 +19,7 @@ public:
FilePathRole = Qt::UserRole + 1,
TitleRole,
AuthorRole,
FormatRole,
ProgressRole,
LastOpenedRole,
CoverImageUrlRole
+9
View File
@@ -76,6 +76,15 @@ Rectangle {
elide: Text.ElideRight
}
Text {
visible: format !== ""
width: parent.width
text: format
color: ThemeManager.currentTheme.dimText
font.pixelSize: 12
elide: Text.ElideRight
}
Text {
visible: author !== ""
width: parent.width