Refactor using Fable
This commit is contained in:
90 files changed
+2080
-2267
No files matched your search
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include <QFuture>
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
#include <QVector>
|
||||
#include <memory>
|
||||
|
||||
#include "backend/IImageLoader.h"
|
||||
|
||||
// Runs chunk height measurement off the GUI thread and reports the results
|
||||
// back on it. Owns the image loader used to resolve embedded images and the
|
||||
// lifetime of the in-flight measurement.
|
||||
class MeasurementController : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MeasurementController(QObject *parent = nullptr);
|
||||
~MeasurementController() override;
|
||||
|
||||
void setImageLoader(std::unique_ptr<IImageLoader> loader);
|
||||
|
||||
// isNew is passed through untouched to heightsReady so the owner knows
|
||||
// whether this measurement should trigger a position restore.
|
||||
void start(const QStringList &htmls, int contentWidth,
|
||||
int fontSize, qreal lineSpacing, bool isNew);
|
||||
|
||||
bool measuring() const;
|
||||
|
||||
signals:
|
||||
void measuringChanged();
|
||||
void heightsReady(QVector<int> heights, bool isNew);
|
||||
|
||||
private:
|
||||
std::unique_ptr<IImageLoader> m_imageLoader;
|
||||
bool m_measuring = false;
|
||||
QFuture<void> m_future;
|
||||
};
|
||||
Reference in new issue
Block a user