Rename Library to History
This commit is contained in:
11 files changed
+102
-102
No files matched your search
@@ -1,42 +1,42 @@
|
||||
#include "LibraryBookModel.h"
|
||||
#include "HistoryBookModel.h"
|
||||
#include "FormatReader.h"
|
||||
#include "formats/ReaderFactory.h"
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
|
||||
LibraryBookModel::LibraryBookModel(ReaderFactory &factory, QObject *parent)
|
||||
HistoryBookModel::HistoryBookModel(ReaderFactory &factory, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_factory(factory)
|
||||
{
|
||||
connect(this, &LibraryBookModel::metadataLoaded, this, &LibraryBookModel::onMetadataLoaded);
|
||||
connect(this, &HistoryBookModel::metadataLoaded, this, &HistoryBookModel::onMetadataLoaded);
|
||||
}
|
||||
|
||||
LibraryBookModel::LibraryBookModel(const QString &filePath, double progress, const QString &lastOpened, ReaderFactory &factory, QObject *parent)
|
||||
HistoryBookModel::HistoryBookModel(const QString &filePath, double progress, const QString &lastOpened, ReaderFactory &factory, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_filePath(filePath)
|
||||
, m_progress(progress)
|
||||
, m_lastOpened(lastOpened)
|
||||
, m_factory(factory)
|
||||
{
|
||||
connect(this, &LibraryBookModel::metadataLoaded, this, &LibraryBookModel::onMetadataLoaded);
|
||||
connect(this, &HistoryBookModel::metadataLoaded, this, &HistoryBookModel::onMetadataLoaded);
|
||||
}
|
||||
|
||||
LibraryBookModel::~LibraryBookModel()
|
||||
HistoryBookModel::~HistoryBookModel()
|
||||
{
|
||||
if (m_metadataFuture.isRunning())
|
||||
m_metadataFuture.waitForFinished();
|
||||
}
|
||||
|
||||
QString LibraryBookModel::filePath() const
|
||||
QString HistoryBookModel::filePath() const
|
||||
{
|
||||
return m_filePath;
|
||||
}
|
||||
|
||||
double LibraryBookModel::progress() const
|
||||
double HistoryBookModel::progress() const
|
||||
{
|
||||
return m_progress;
|
||||
}
|
||||
|
||||
void LibraryBookModel::setProgress(double progress)
|
||||
void HistoryBookModel::setProgress(double progress)
|
||||
{
|
||||
if (qFuzzyCompare(m_progress, progress))
|
||||
return;
|
||||
@@ -44,12 +44,12 @@ void LibraryBookModel::setProgress(double progress)
|
||||
emit progressChanged();
|
||||
}
|
||||
|
||||
QString LibraryBookModel::lastOpened() const
|
||||
QString HistoryBookModel::lastOpened() const
|
||||
{
|
||||
return m_lastOpened;
|
||||
}
|
||||
|
||||
void LibraryBookModel::setLastOpened(const QString &lastOpened)
|
||||
void HistoryBookModel::setLastOpened(const QString &lastOpened)
|
||||
{
|
||||
if (m_lastOpened == lastOpened)
|
||||
return;
|
||||
@@ -57,27 +57,27 @@ void LibraryBookModel::setLastOpened(const QString &lastOpened)
|
||||
emit lastOpenedChanged();
|
||||
}
|
||||
|
||||
QString LibraryBookModel::title() const
|
||||
QString HistoryBookModel::title() const
|
||||
{
|
||||
return m_title;
|
||||
}
|
||||
|
||||
QString LibraryBookModel::author() const
|
||||
QString HistoryBookModel::author() const
|
||||
{
|
||||
return m_author;
|
||||
}
|
||||
|
||||
QString LibraryBookModel::coverImageUrl() const
|
||||
QString HistoryBookModel::coverImageUrl() const
|
||||
{
|
||||
return m_coverImageUrl;
|
||||
}
|
||||
|
||||
void LibraryBookModel::loadMetadata()
|
||||
void HistoryBookModel::loadMetadata()
|
||||
{
|
||||
if (m_metadataLoaded || m_filePath.isEmpty() || m_metadataFuture.isRunning())
|
||||
return;
|
||||
|
||||
QPointer<LibraryBookModel> self = this;
|
||||
QPointer<HistoryBookModel> self = this;
|
||||
QString filePath = m_filePath;
|
||||
|
||||
ReaderFactory *factory = &m_factory;
|
||||
@@ -104,12 +104,12 @@ void LibraryBookModel::loadMetadata()
|
||||
});
|
||||
}
|
||||
|
||||
void LibraryBookModel::onMetadataLoaded()
|
||||
void HistoryBookModel::onMetadataLoaded()
|
||||
{
|
||||
// This slot can be used for any post-processing after metadata is loaded
|
||||
}
|
||||
|
||||
void LibraryBookModel::loadCoverImage(const QString &epubBasePath)
|
||||
void HistoryBookModel::loadCoverImage(const QString &epubBasePath)
|
||||
{
|
||||
if (!m_coverImageUrl.isEmpty() || m_filePath.isEmpty())
|
||||
return;
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef LIBRARYBOOKMODEL_H
|
||||
#define LIBRARYBOOKMODEL_H
|
||||
#ifndef HISTORYBOOKMODEL_H
|
||||
#define HISTORYBOOKMODEL_H
|
||||
|
||||
#include <QString>
|
||||
#include <QObject>
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
class FormatReader;
|
||||
|
||||
class LibraryBookModel : public QObject {
|
||||
class HistoryBookModel : public QObject {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString filePath READ filePath CONSTANT)
|
||||
Q_PROPERTY(double progress READ progress WRITE setProgress NOTIFY progressChanged)
|
||||
@@ -20,9 +20,9 @@ class LibraryBookModel : public QObject {
|
||||
Q_PROPERTY(QString coverImageUrl READ coverImageUrl NOTIFY coverImageLoaded)
|
||||
|
||||
public:
|
||||
explicit LibraryBookModel(ReaderFactory &factory, QObject *parent = nullptr);
|
||||
explicit LibraryBookModel(const QString &filePath, double progress, const QString &lastOpened, ReaderFactory &factory, QObject *parent = nullptr);
|
||||
~LibraryBookModel() override;
|
||||
explicit HistoryBookModel(ReaderFactory &factory, QObject *parent = nullptr);
|
||||
explicit HistoryBookModel(const QString &filePath, double progress, const QString &lastOpened, ReaderFactory &factory, QObject *parent = nullptr);
|
||||
~HistoryBookModel() override;
|
||||
|
||||
QString filePath() const;
|
||||
double progress() const;
|
||||
@@ -59,4 +59,4 @@ private:
|
||||
ReaderFactory &m_factory;
|
||||
};
|
||||
|
||||
#endif // LIBRARYBOOKMODEL_H
|
||||
#endif // HISTORYBOOKMODEL_H
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "LibraryModel.h"
|
||||
#include "LibraryBookModel.h"
|
||||
#include "HistoryModel.h"
|
||||
#include "HistoryBookModel.h"
|
||||
#include <QDateTime>
|
||||
|
||||
LibraryModel::LibraryModel(ReaderFactory &factory, QObject *parent)
|
||||
HistoryModel::HistoryModel(ReaderFactory &factory, QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
, m_factory(factory)
|
||||
{
|
||||
@@ -15,24 +15,24 @@ LibraryModel::LibraryModel(ReaderFactory &factory, QObject *parent)
|
||||
m_roleNames[CoverImageUrlRole] = "coverImageUrl";
|
||||
}
|
||||
|
||||
LibraryModel::~LibraryModel()
|
||||
HistoryModel::~HistoryModel()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
int LibraryModel::rowCount(const QModelIndex &parent) const
|
||||
int HistoryModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
return m_books.count();
|
||||
}
|
||||
|
||||
QVariant LibraryModel::data(const QModelIndex &index, int role) const
|
||||
QVariant HistoryModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid() || index.row() < 0 || index.row() >= m_books.count())
|
||||
return QVariant();
|
||||
|
||||
LibraryBookModel* book = m_books.at(index.row());
|
||||
HistoryBookModel* book = m_books.at(index.row());
|
||||
if (!book)
|
||||
return QVariant();
|
||||
|
||||
@@ -54,12 +54,12 @@ QVariant LibraryModel::data(const QModelIndex &index, int role) const
|
||||
}
|
||||
}
|
||||
|
||||
bool LibraryModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
bool HistoryModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
if (!index.isValid() || index.row() < 0 || index.row() >= m_books.count())
|
||||
return false;
|
||||
|
||||
LibraryBookModel* book = m_books.at(index.row());
|
||||
HistoryBookModel* book = m_books.at(index.row());
|
||||
|
||||
switch (role) {
|
||||
case ProgressRole:
|
||||
@@ -75,17 +75,17 @@ bool LibraryModel::setData(const QModelIndex &index, const QVariant &value, int
|
||||
}
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> LibraryModel::roleNames() const
|
||||
QHash<int, QByteArray> HistoryModel::roleNames() const
|
||||
{
|
||||
return m_roleNames;
|
||||
}
|
||||
|
||||
void LibraryModel::addOrUpdateBook(const QString &filePath, double progress, const QString &lastOpened)
|
||||
void HistoryModel::addOrUpdateBook(const QString &filePath, double progress, const QString &lastOpened)
|
||||
{
|
||||
// Check if book already exists
|
||||
for (int i = 0; i < m_books.size(); i++) {
|
||||
if (m_books[i]->filePath() == filePath) {
|
||||
LibraryBookModel* existingBook = m_books[i];
|
||||
HistoryBookModel* existingBook = m_books[i];
|
||||
existingBook->setProgress(progress);
|
||||
existingBook->setLastOpened(lastOpened);
|
||||
|
||||
@@ -98,9 +98,9 @@ void LibraryModel::addOrUpdateBook(const QString &filePath, double progress, con
|
||||
}
|
||||
}
|
||||
|
||||
// New book — LibraryModel takes ownership via parent
|
||||
auto* book = new LibraryBookModel(filePath, progress, lastOpened, m_factory, this);
|
||||
connect(book, &LibraryBookModel::metadataLoaded, this, &LibraryModel::onBookMetadataLoaded);
|
||||
// New book — HistoryModel takes ownership via parent
|
||||
auto* book = new HistoryBookModel(filePath, progress, lastOpened, m_factory, this);
|
||||
connect(book, &HistoryBookModel::metadataLoaded, this, &HistoryModel::onBookMetadataLoaded);
|
||||
|
||||
beginInsertRows(QModelIndex(), 0, 0);
|
||||
m_books.prepend(book);
|
||||
@@ -110,14 +110,14 @@ void LibraryModel::addOrUpdateBook(const QString &filePath, double progress, con
|
||||
book->loadMetadata();
|
||||
}
|
||||
|
||||
void LibraryModel::removeBook(const QString &filePath)
|
||||
void HistoryModel::removeBook(const QString &filePath)
|
||||
{
|
||||
for (int i = 0; i < m_books.size(); i++) {
|
||||
if (m_books[i]->filePath() == filePath) {
|
||||
LibraryBookModel* book = m_books[i];
|
||||
HistoryBookModel* book = m_books[i];
|
||||
|
||||
// Disconnect signals
|
||||
disconnect(book, &LibraryBookModel::metadataLoaded, this, &LibraryModel::onBookMetadataLoaded);
|
||||
disconnect(book, &HistoryBookModel::metadataLoaded, this, &HistoryModel::onBookMetadataLoaded);
|
||||
|
||||
beginRemoveRows(QModelIndex(), i, i);
|
||||
m_books.removeAt(i);
|
||||
@@ -130,9 +130,9 @@ void LibraryModel::removeBook(const QString &filePath)
|
||||
}
|
||||
}
|
||||
|
||||
LibraryBookModel* LibraryModel::findBook(const QString &filePath) const
|
||||
HistoryBookModel* HistoryModel::findBook(const QString &filePath) const
|
||||
{
|
||||
for (LibraryBookModel* book : m_books) {
|
||||
for (HistoryBookModel* book : m_books) {
|
||||
if (book->filePath() == filePath) {
|
||||
return book;
|
||||
}
|
||||
@@ -140,7 +140,7 @@ LibraryBookModel* LibraryModel::findBook(const QString &filePath) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void LibraryModel::clear()
|
||||
void HistoryModel::clear()
|
||||
{
|
||||
if (m_books.isEmpty())
|
||||
return;
|
||||
@@ -148,8 +148,8 @@ void LibraryModel::clear()
|
||||
beginRemoveRows(QModelIndex(), 0, m_books.size() - 1);
|
||||
|
||||
// Disconnect and delete all books
|
||||
for (LibraryBookModel* book : m_books) {
|
||||
disconnect(book, &LibraryBookModel::metadataLoaded, this, &LibraryModel::onBookMetadataLoaded);
|
||||
for (HistoryBookModel* book : m_books) {
|
||||
disconnect(book, &HistoryBookModel::metadataLoaded, this, &HistoryModel::onBookMetadataLoaded);
|
||||
book->deleteLater();
|
||||
}
|
||||
|
||||
@@ -159,44 +159,44 @@ void LibraryModel::clear()
|
||||
emit countChanged();
|
||||
}
|
||||
|
||||
void LibraryModel::addOrUpdateBook(const QString &filePath, double progress)
|
||||
void HistoryModel::addOrUpdateBook(const QString &filePath, double progress)
|
||||
{
|
||||
// Sentinel: progress < 0 means "preserve the existing progress value"
|
||||
double resolvedProgress = progress;
|
||||
if (progress < 0.0) {
|
||||
LibraryBookModel *existing = findBook(filePath);
|
||||
HistoryBookModel *existing = findBook(filePath);
|
||||
resolvedProgress = existing ? existing->progress() : 0.0;
|
||||
}
|
||||
addOrUpdateBook(filePath, resolvedProgress,
|
||||
QDateTime::currentDateTime().toString(Qt::ISODate));
|
||||
}
|
||||
|
||||
QString LibraryModel::filePath(int index) const
|
||||
QString HistoryModel::filePath(int index) const
|
||||
{
|
||||
if (index < 0 || index >= m_books.size()) return {};
|
||||
return m_books.at(index)->filePath();
|
||||
}
|
||||
|
||||
double LibraryModel::progress(int index) const
|
||||
double HistoryModel::progress(int index) const
|
||||
{
|
||||
if (index < 0 || index >= m_books.size()) return 0.0;
|
||||
return m_books.at(index)->progress();
|
||||
}
|
||||
|
||||
QString LibraryModel::lastOpened(int index) const
|
||||
QString HistoryModel::lastOpened(int index) const
|
||||
{
|
||||
if (index < 0 || index >= m_books.size()) return {};
|
||||
return m_books.at(index)->lastOpened();
|
||||
}
|
||||
|
||||
QList<LibraryBookModel*> LibraryModel::books() const
|
||||
QList<HistoryBookModel*> HistoryModel::books() const
|
||||
{
|
||||
return m_books;
|
||||
}
|
||||
|
||||
void LibraryModel::onBookMetadataLoaded()
|
||||
void HistoryModel::onBookMetadataLoaded()
|
||||
{
|
||||
LibraryBookModel* book = qobject_cast<LibraryBookModel*>(sender());
|
||||
HistoryBookModel* book = qobject_cast<HistoryBookModel*>(sender());
|
||||
if (!book)
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef LIBRARYMODEL_H
|
||||
#define LIBRARYMODEL_H
|
||||
#ifndef HISTORYMODEL_H
|
||||
#define HISTORYMODEL_H
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QList>
|
||||
@@ -7,15 +7,15 @@
|
||||
|
||||
#include "formats/ReaderFactory.h"
|
||||
|
||||
class LibraryBookModel;
|
||||
class HistoryBookModel;
|
||||
|
||||
class LibraryModel : public QAbstractListModel
|
||||
class HistoryModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
|
||||
|
||||
public:
|
||||
enum LibraryRoles {
|
||||
enum HistoryRoles {
|
||||
FilePathRole = Qt::UserRole + 1,
|
||||
TitleRole,
|
||||
AuthorRole,
|
||||
@@ -23,10 +23,10 @@ public:
|
||||
LastOpenedRole,
|
||||
CoverImageUrlRole
|
||||
};
|
||||
Q_ENUM(LibraryRoles)
|
||||
Q_ENUM(HistoryRoles)
|
||||
|
||||
explicit LibraryModel(ReaderFactory &factory, QObject *parent = nullptr);
|
||||
~LibraryModel() override;
|
||||
explicit HistoryModel(ReaderFactory &factory, QObject *parent = nullptr);
|
||||
~HistoryModel() override;
|
||||
|
||||
// QAbstractItemModel interface
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
// Convenience overload: sentinel progress < 0 preserves the existing progress value.
|
||||
Q_INVOKABLE void addOrUpdateBook(const QString &filePath, double progress);
|
||||
Q_INVOKABLE void removeBook(const QString &filePath);
|
||||
Q_INVOKABLE LibraryBookModel* findBook(const QString &filePath) const;
|
||||
Q_INVOKABLE HistoryBookModel* findBook(const QString &filePath) const;
|
||||
Q_INVOKABLE void clear();
|
||||
|
||||
// Indexed accessors for persistence (e.g., main.cpp's aboutToQuit loop).
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
QString lastOpened(int index) const;
|
||||
|
||||
// Access to books for saving/loading
|
||||
QList<LibraryBookModel*> books() const;
|
||||
QList<HistoryBookModel*> books() const;
|
||||
|
||||
signals:
|
||||
void countChanged();
|
||||
@@ -59,9 +59,9 @@ private slots:
|
||||
void onBookMetadataLoaded();
|
||||
|
||||
private:
|
||||
QList<LibraryBookModel*> m_books;
|
||||
QList<HistoryBookModel*> m_books;
|
||||
QHash<int, QByteArray> m_roleNames;
|
||||
ReaderFactory &m_factory;
|
||||
};
|
||||
|
||||
#endif // LIBRARYMODEL_H
|
||||
#endif // HISTORYMODEL_H
|
||||
+13
-13
@@ -14,7 +14,7 @@
|
||||
#include "backend/formats/ImageLoaderFactory.h"
|
||||
#include "backend/formats/ImageProviderFactory.h"
|
||||
#include "backend/formats/WebImageProvider.h"
|
||||
#include "backend/LibraryModel.h"
|
||||
#include "backend/HistoryModel.h"
|
||||
#include "backend/ReadingModel.h"
|
||||
#include "backend/NativeFileDialogService.h"
|
||||
#include "backend/formats/ReaderFactory.h"
|
||||
@@ -103,14 +103,14 @@ int main(int argc, char *argv[])
|
||||
[] { return std::make_unique<EpubReader>(); },
|
||||
});
|
||||
|
||||
LibraryModel libraryModel(readerFactory);
|
||||
for (const QVariantMap &entry : appState.loadArray(QStringLiteral("library"))) {
|
||||
HistoryModel historyModel(readerFactory);
|
||||
for (const QVariantMap &entry : appState.loadArray(QStringLiteral("history"))) {
|
||||
const QString fp = entry.value(QStringLiteral("filePath")).toString();
|
||||
if (fp.isEmpty()) continue;
|
||||
double progress = entry.value(QStringLiteral("progress"), 0.0).toDouble();
|
||||
progress = qBound(0.0, progress, 1.0);
|
||||
const QString lo = entry.value(QStringLiteral("lastOpened")).toString();
|
||||
libraryModel.addOrUpdateBook(fp, progress, lo);
|
||||
historyModel.addOrUpdateBook(fp, progress, lo);
|
||||
}
|
||||
|
||||
// Command-line override: treat first argument as the file to open on startup
|
||||
@@ -149,7 +149,7 @@ int main(int argc, char *argv[])
|
||||
engine.rootContext()->setContextProperty(QStringLiteral("readingModel"), &readingModel);
|
||||
engine.rootContext()->setContextProperty(QStringLiteral("readingPreferences"), &readingPreferences);
|
||||
engine.rootContext()->setContextProperty(QStringLiteral("uiState"), &uiState);
|
||||
engine.rootContext()->setContextProperty(QStringLiteral("libraryModel"), &libraryModel);
|
||||
engine.rootContext()->setContextProperty(QStringLiteral("historyModel"), &historyModel);
|
||||
|
||||
// --- Cross-class signal wiring ---
|
||||
|
||||
@@ -168,7 +168,7 @@ int main(int argc, char *argv[])
|
||||
// Scroll position is handled by PageView's scroll tracker via book.saveCurrentPosition().
|
||||
QObject::connect(&book, &Book::willOpenNewBook, [&]{
|
||||
if (book.hasBook())
|
||||
libraryModel.addOrUpdateBook(book.filePath(), readingModel.progress());
|
||||
historyModel.addOrUpdateBook(book.filePath(), readingModel.progress());
|
||||
});
|
||||
|
||||
// After the new reader is installed: wire up image provider + ReadingModel
|
||||
@@ -201,7 +201,7 @@ int main(int argc, char *argv[])
|
||||
readingModel.measure(true);
|
||||
|
||||
uiState.setLastFilePath(filePath);
|
||||
libraryModel.addOrUpdateBook(filePath, -1.0);
|
||||
historyModel.addOrUpdateBook(filePath, -1.0);
|
||||
});
|
||||
|
||||
// Propagate content-width changes to image provider + reading model.
|
||||
@@ -216,7 +216,7 @@ int main(int argc, char *argv[])
|
||||
// Scroll position was last saved by PageView's scroll tracker; we save library progress here.
|
||||
QObject::connect(&app, &QCoreApplication::aboutToQuit, [&]{
|
||||
if (book.hasBook()) {
|
||||
libraryModel.addOrUpdateBook(book.filePath(), readingModel.progress());
|
||||
historyModel.addOrUpdateBook(book.filePath(), readingModel.progress());
|
||||
uiState.setLastFilePath(book.filePath());
|
||||
} else {
|
||||
uiState.setLastFilePath(QString());
|
||||
@@ -226,14 +226,14 @@ int main(int argc, char *argv[])
|
||||
uiState.save();
|
||||
|
||||
QList<QVariantMap> items;
|
||||
for (int i = 0; i < libraryModel.rowCount(); ++i) {
|
||||
for (int i = 0; i < historyModel.rowCount(); ++i) {
|
||||
items.append({
|
||||
{QStringLiteral("filePath"), libraryModel.filePath(i)},
|
||||
{QStringLiteral("progress"), libraryModel.progress(i)},
|
||||
{QStringLiteral("lastOpened"), libraryModel.lastOpened(i)},
|
||||
{QStringLiteral("filePath"), historyModel.filePath(i)},
|
||||
{QStringLiteral("progress"), historyModel.progress(i)},
|
||||
{QStringLiteral("lastOpened"), historyModel.lastOpened(i)},
|
||||
});
|
||||
}
|
||||
appState.saveArray(QStringLiteral("library"), items);
|
||||
appState.saveArray(QStringLiteral("history"), items);
|
||||
|
||||
qInfo() << "Settings saved to:" << settings.fileName();
|
||||
});
|
||||
|
||||
+4
-4
@@ -134,9 +134,9 @@ ApplicationWindow {
|
||||
visible: window.currentPage === "settings"
|
||||
}
|
||||
|
||||
LibraryPage {
|
||||
HistoryPage {
|
||||
anchors.fill: parent
|
||||
visible: window.currentPage === "library"
|
||||
visible: window.currentPage === "history"
|
||||
}
|
||||
|
||||
BusyIndicator {
|
||||
@@ -171,7 +171,7 @@ ApplicationWindow {
|
||||
if (window._startupRestore) {
|
||||
window._startupRestore = false
|
||||
var savedPage = uiState.lastPage
|
||||
if (savedPage === "library" || savedPage === "settings")
|
||||
if (savedPage === "history" || savedPage === "settings")
|
||||
window.currentPage = savedPage
|
||||
else
|
||||
window.currentPage = "reader"
|
||||
@@ -277,7 +277,7 @@ ApplicationWindow {
|
||||
book.openFromPath(uiState.lastFilePath)
|
||||
} else {
|
||||
var savedPage = uiState.lastPage
|
||||
if (savedPage === "library" || savedPage === "settings")
|
||||
if (savedPage === "history" || savedPage === "settings")
|
||||
window.currentPage = savedPage
|
||||
window.sidebarOpen = true
|
||||
}
|
||||
|
||||
@@ -62,8 +62,8 @@ Rectangle {
|
||||
|
||||
SideBarButton {
|
||||
iconText: "\ue02f"
|
||||
title: "Library"
|
||||
onClicked: sidebar.navigateTo("library")
|
||||
title: "History"
|
||||
onClicked: sidebar.navigateTo("history")
|
||||
}
|
||||
|
||||
SideBarButton {
|
||||
|
||||
@@ -6,9 +6,9 @@ Rectangle {
|
||||
color: ThemeManager.currentTheme.backgroundDefault
|
||||
|
||||
Text {
|
||||
visible: libraryModel.count === 0
|
||||
visible: historyModel.count === 0
|
||||
anchors.centerIn: parent
|
||||
text: "No books read yet.\nOpen a book to start your library."
|
||||
text: "No books read yet.\nOpen a book to start your history."
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
color: ThemeManager.currentTheme.dimText
|
||||
font.pixelSize: 14
|
||||
@@ -16,12 +16,12 @@ Rectangle {
|
||||
}
|
||||
|
||||
ListView {
|
||||
visible: libraryModel.count > 0
|
||||
visible: historyModel.count > 0
|
||||
anchors.fill: parent
|
||||
anchors.margins: 16
|
||||
spacing: 8
|
||||
clip: true
|
||||
model: libraryModel
|
||||
model: historyModel
|
||||
|
||||
delegate: Rectangle {
|
||||
id: bookRow
|
||||
@@ -92,7 +92,7 @@ Rectangle {
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
background: Item {}
|
||||
onClicked: libraryModel.removeBook(filePath)
|
||||
onClicked: historyModel.removeBook(filePath)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user