File indexing completed on 2025-01-19 04:22:44
0001 /* 0002 SPDX-FileCopyrightText: 2021 Hamed Masafi <hamed.masfi@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 // 0008 // Created by hamed on 25.03.22. 0009 // 0010 0011 #pragma once 0012 #include "libkommit_export.h" 0013 #include <QAbstractListModel> 0014 0015 namespace Git 0016 { 0017 0018 class Manager; 0019 class LIBKOMMIT_EXPORT AbstractGitItemsModel : public QAbstractListModel 0020 { 0021 Q_OBJECT 0022 Q_PROPERTY(Status status READ status NOTIFY statusChanged) 0023 0024 public: 0025 explicit AbstractGitItemsModel(Manager *git, QObject *parent = nullptr); 0026 0027 enum Status { NotLoaded, Loading, Loaded }; 0028 Q_ENUM(Status) 0029 Q_REQUIRED_RESULT bool isLoaded() const; 0030 Q_REQUIRED_RESULT Status status() const; 0031 0032 public Q_SLOTS: 0033 void load(); 0034 void reset(); 0035 0036 protected: 0037 void setStatus(Status newStatus); 0038 Manager *mGit{nullptr}; 0039 virtual void fill() = 0; 0040 0041 Q_SIGNALS: 0042 void loaded(); 0043 void statusChanged(); 0044 0045 private: 0046 Status m_status{NotLoaded}; 0047 }; 0048 } // namespace Git