File indexing completed on 2024-05-12 16:21:15

0001 // SPDX-FileCopyrightText: 2021 Jonah BrĂ¼chert <jbb@kaidan.im>
0002 //
0003 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 
0005 #pragma once
0006 
0007 #include <QAbstractListModel>
0008 
0009 ///
0010 /// Base class for all models that work with data from the AsyncYTMusic class.
0011 /// It provides a loading property, that is automatically set to false if a query fails.
0012 ///
0013 class AbstractYTMusicModel : public QAbstractListModel
0014 {
0015     Q_OBJECT
0016     Q_PROPERTY(bool loading READ loading WRITE setLoading NOTIFY loadingChanged)
0017 
0018 public:
0019     explicit AbstractYTMusicModel(QObject *parent = nullptr);
0020 
0021     bool loading() const;
0022     void setLoading(bool loading);
0023     Q_SIGNAL void loadingChanged();
0024 
0025 private:
0026     bool m_loading = false;
0027 };
0028