File indexing completed on 2025-02-23 04:35:15
0001 // SPDX-FileCopyrightText: 2021 Linus Jahn <lnj@kaidan.im> 0002 // SPDX-License-Identifier: GPL-3.0-or-later 0003 0004 #pragma once 0005 0006 #include "abstractapi.h" 0007 #include "subscriptionwatcher.h" 0008 0009 #include <QtQml> 0010 0011 template<typename T> 0012 class QFutureWatcher; 0013 0014 class SubscriptionController : public SubscriptionWatcher 0015 { 0016 Q_OBJECT 0017 QML_ELEMENT 0018 0019 Q_PROPERTY(bool isLoading READ isLoading NOTIFY isLoadingChanged) 0020 0021 public: 0022 explicit SubscriptionController(QObject *parent = nullptr); 0023 0024 bool isLoading() const; 0025 0026 Q_INVOKABLE bool canToggleSubscription() const; 0027 Q_INVOKABLE void toggleSubscription(); 0028 0029 Q_SIGNALS: 0030 void isLoadingChanged(); 0031 void errorOccurred(const QString &errorText); 0032 0033 private: 0034 QFutureWatcher<QInvidious::Result> *m_watcher; 0035 };