File indexing completed on 2025-01-19 05:11:30

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         CommitHash,
0024         AuthorName,
0025         AuthorEmail,
0026         Time,
0027         LastColumn = Time,
0028     };
0029     explicit StashesModel(Manager *git, QObject *parent = nullptr);
0030 
0031     int rowCount(const QModelIndex &parent) const override;
0032     int columnCount(const QModelIndex &parent) const override;
0033     QVariant data(const QModelIndex &index, int role) const override;
0034     QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
0035     QSharedPointer<Stash> fromIndex(const QModelIndex &index) const;
0036 
0037 protected:
0038     void fill() override;
0039 
0040 private:
0041     QList<QSharedPointer<Stash>> mData;
0042 };
0043 
0044 }