Some refactor
This commit is contained in:
37 files changed
+1599
-981
No files matched your search
@@ -7,9 +7,11 @@
|
||||
#include <cmath>
|
||||
#include <QtConcurrent>
|
||||
|
||||
#include "AppState.h"
|
||||
|
||||
ReadingModel::ReadingModel(QObject *parent) : QAbstractListModel(parent) {}
|
||||
ReadingModel::ReadingModel(BookPositionStore &positions, QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
, m_positions(positions)
|
||||
{
|
||||
}
|
||||
|
||||
ReadingModel::~ReadingModel()
|
||||
{
|
||||
@@ -126,10 +128,8 @@ void ReadingModel::runMeasurement(const QStringList &htmls, const bool isNew)
|
||||
{PixelHeightRole});
|
||||
|
||||
if (isNew) {
|
||||
QVariantMap map = AppState::loadBookPosition(m_reader->filePath());
|
||||
int savedChunk = map.value(QStringLiteral("chunkIndex"), 0).toInt();
|
||||
qreal savedIntra = map.value(QStringLiteral("intraChunkOffset"), 0).toInt();
|
||||
restoreReady(savedChunk, savedIntra);
|
||||
const auto pos = m_positions.load(m_reader->contentHash());
|
||||
emit restoreReady(pos.chunkIndex, pos.intraOffset);
|
||||
}
|
||||
}, Qt::QueuedConnection);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user