mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2025-09-04 01:42:44 +00:00
WIP: HttpLoader seems to work, Model still borked
This commit is contained in:
parent
e421adf733
commit
729e343661
1412 changed files with 13967 additions and 33794 deletions
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <QAbstractListModel>
|
||||
#include <QObject>
|
||||
#include <QScopedPointer>
|
||||
|
||||
#include "propertyhelper.h"
|
||||
#include "../dto/baseitemdto.h"
|
||||
|
@ -70,6 +71,8 @@ public:
|
|||
FWDPROP(QStringList, artists, Artists)
|
||||
FWDPROP(bool, recursive, Recursive)
|
||||
//FWDPROP(bool, collapseBoxSetItems)
|
||||
protected:
|
||||
virtual bool canReload() const override;
|
||||
private slots:
|
||||
void apiClientChanged(ApiClient *newApiClient);
|
||||
void userIdChanged(const QString &newUserId);
|
||||
|
|
|
@ -159,8 +159,11 @@ public:
|
|||
QObject *data() const { return m_dataViewModel; }
|
||||
|
||||
void reload() override {
|
||||
if (m_futureWatcher->isRunning()) return;
|
||||
setStatus(Loading);
|
||||
QFuture<std::optional<R>> future = QtConcurrent::run(this, &Loader<T, R, P>::invokeLoader, m_parameters);
|
||||
m_loader.setParameters(m_parameters);
|
||||
m_loader.prepareLoad();
|
||||
QFuture<std::optional<R>> future = QtConcurrent::run(this, &Loader<T, R, P>::invokeLoader);
|
||||
m_futureWatcher->setFuture(future);
|
||||
}
|
||||
protected:
|
||||
|
@ -179,11 +182,11 @@ private:
|
|||
* @param parameters Parameters to forward to the loader
|
||||
* @return empty optional if an error occured, otherwise the result.
|
||||
*/
|
||||
std::optional<R> invokeLoader(P parameters) {
|
||||
std::optional<R> invokeLoader() {
|
||||
QMutexLocker(&this->m_mutex);
|
||||
this->m_loader.setApiClient(m_apiClient);
|
||||
try {
|
||||
return this->m_loader.load(parameters);
|
||||
return this->m_loader.load();
|
||||
} catch (Support::LoadException &e) {
|
||||
qWarning() << "Exception while loading an item: " << e.what();
|
||||
this->setErrorString(QString(e.what()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue