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 #pragma once
0008 #include "abstractgititemsmodel.h"
0009 #include "libkommit_export.h"
0010 
0011 namespace Git
0012 {
0013 
0014 class Manager;
0015 class Stash;
0016 class LIBKOMMIT_EXPORT StashesModel : public AbstractGitItemsModel
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     enum StashesModelRoles {
0022         Subject,
0023         AuthorName,
0024         AuthorEmail,
0025         Time,
0026         LastColumn = Time,
0027     };
0028     explicit StashesModel(Manager *git, QObject *parent = nullptr);
0029 
0030     int rowCount(const QModelIndex &parent) const override;
0031     int columnCount(const QModelIndex &parent) const override;
0032     QVariant data(const QModelIndex &index, int role) const override;
0033     QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
0034     Stash *fromIndex(const QModelIndex &index) const;
0035 
0036 protected:
0037     void fill() override;
0038 
0039 private:
0040     QList<Stash *> mData;
0041 };
0042 
0043 }