Add format text to history view
This commit is contained in:
5 files changed
+20
No files matched your search
@@ -70,6 +70,11 @@ QString HistoryBookModel::author() const
|
|||||||
return m_author;
|
return m_author;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString HistoryBookModel::format() const
|
||||||
|
{
|
||||||
|
return m_filePath.section('.', -1).toUpper();
|
||||||
|
}
|
||||||
|
|
||||||
QString HistoryBookModel::coverImageUrl() const
|
QString HistoryBookModel::coverImageUrl() const
|
||||||
{
|
{
|
||||||
return m_coverImageUrl;
|
return m_coverImageUrl;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ class HistoryBookModel : public QObject {
|
|||||||
Q_PROPERTY(QString lastOpened READ lastOpened WRITE setLastOpened NOTIFY lastOpenedChanged)
|
Q_PROPERTY(QString lastOpened READ lastOpened WRITE setLastOpened NOTIFY lastOpenedChanged)
|
||||||
Q_PROPERTY(QString title READ title NOTIFY metadataLoaded)
|
Q_PROPERTY(QString title READ title NOTIFY metadataLoaded)
|
||||||
Q_PROPERTY(QString author READ author 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)
|
Q_PROPERTY(QString coverImageUrl READ coverImageUrl NOTIFY coverImageLoaded)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -33,6 +34,7 @@ public:
|
|||||||
|
|
||||||
QString title() const;
|
QString title() const;
|
||||||
QString author() const;
|
QString author() const;
|
||||||
|
QString format() const;
|
||||||
QString coverImageUrl() const;
|
QString coverImageUrl() const;
|
||||||
|
|
||||||
void loadMetadata();
|
void loadMetadata();
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ HistoryModel::HistoryModel(ReaderFactory &factory, QObject *parent)
|
|||||||
m_roleNames[FilePathRole] = "filePath";
|
m_roleNames[FilePathRole] = "filePath";
|
||||||
m_roleNames[TitleRole] = "title";
|
m_roleNames[TitleRole] = "title";
|
||||||
m_roleNames[AuthorRole] = "author";
|
m_roleNames[AuthorRole] = "author";
|
||||||
|
m_roleNames[FormatRole] = "format";
|
||||||
m_roleNames[ProgressRole] = "progress";
|
m_roleNames[ProgressRole] = "progress";
|
||||||
m_roleNames[LastOpenedRole] = "lastOpened";
|
m_roleNames[LastOpenedRole] = "lastOpened";
|
||||||
m_roleNames[CoverImageUrlRole] = "coverImageUrl";
|
m_roleNames[CoverImageUrlRole] = "coverImageUrl";
|
||||||
@@ -43,6 +44,8 @@ QVariant HistoryModel::data(const QModelIndex &index, int role) const
|
|||||||
return book->title();
|
return book->title();
|
||||||
case AuthorRole:
|
case AuthorRole:
|
||||||
return book->author();
|
return book->author();
|
||||||
|
case FormatRole:
|
||||||
|
return book->format();
|
||||||
case ProgressRole:
|
case ProgressRole:
|
||||||
return book->progress();
|
return book->progress();
|
||||||
case LastOpenedRole:
|
case LastOpenedRole:
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public:
|
|||||||
FilePathRole = Qt::UserRole + 1,
|
FilePathRole = Qt::UserRole + 1,
|
||||||
TitleRole,
|
TitleRole,
|
||||||
AuthorRole,
|
AuthorRole,
|
||||||
|
FormatRole,
|
||||||
ProgressRole,
|
ProgressRole,
|
||||||
LastOpenedRole,
|
LastOpenedRole,
|
||||||
CoverImageUrlRole
|
CoverImageUrlRole
|
||||||
|
|||||||
@@ -76,6 +76,15 @@ Rectangle {
|
|||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
visible: format !== ""
|
||||||
|
width: parent.width
|
||||||
|
text: format
|
||||||
|
color: ThemeManager.currentTheme.dimText
|
||||||
|
font.pixelSize: 12
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
visible: author !== ""
|
visible: author !== ""
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|||||||
Reference in new issue
Block a user