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 //
0008 // Created by hamed on 25.03.22.
0009 //
0010 
0011 #pragma once
0012 #include "abstractgititemsmodel.h"
0013 #include "libkommit_export.h"
0014 
0015 namespace Git
0016 {
0017 class Remote;
0018 
0019 class LIBKOMMIT_EXPORT RemotesModel : public AbstractGitItemsModel
0020 {
0021     Q_OBJECT
0022 
0023 public:
0024     explicit RemotesModel(Manager *git, QObject *parent = nullptr);
0025     int columnCount(const QModelIndex &parent) const override;
0026     int rowCount(const QModelIndex &parent) const override;
0027     QVariant data(const QModelIndex &index, int role) const override;
0028     Remote *fromIndex(const QModelIndex &index);
0029     Remote *findByName(const QString &name);
0030 
0031     void rename(const QString &oldName, const QString &newName);
0032     void setUrl(const QString &remoteName, const QString &newUrl);
0033 
0034 protected:
0035     void fill() override;
0036 
0037 private:
0038     QList<Remote *> mData;
0039 };
0040 } // namespace Git