File indexing completed on 2024-04-28 04:34:31

0001 /*
0002     This file is part of KDevelop
0003 
0004     Copyright 2011 Andrey Batyiev <batyiev@gmail.com>
0005     Copyright 2017 Sergey Kalinichev <kalinichev.so.0@gmail.com>
0006 
0007     This library is free software; you can redistribute it and/or
0008     modify it under the terms of the GNU Library General Public
0009     License as published by the Free Software Foundation; either
0010     version 2 of the License, or (at your option) any later version.
0011 
0012     This library is distributed in the hope that it will be useful,
0013     but WITHOUT ANY WARRANTY; without even the implied warranty of
0014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015     Library General Public License for more details.
0016 
0017     You should have received a copy of the GNU Library General Public License
0018     along with this library; see the file COPYING.LIB.  If not, write to
0019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0020     Boston, MA 02110-1301, USA.
0021 */
0022 
0023 #ifndef MERCURIALHEADSMODEL_H
0024 #define MERCURIALHEADSMODEL_H
0025 
0026 #include "vcs/models/vcseventmodel.h"
0027 
0028 #include <QUrl>
0029 
0030 namespace KDevelop
0031 {
0032     class VcsJob;
0033 }
0034 
0035 class MercurialPlugin;
0036 
0037 class MercurialHeadsModel : public KDevelop::VcsBasicEventModel
0038 {
0039     Q_OBJECT
0040 public:
0041     MercurialHeadsModel(MercurialPlugin* plugin, const QUrl& url, QObject* parent);
0042     QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
0043 
0044     void update();
0045 
0046 signals:
0047     void updateComplete();
0048 
0049 private slots:
0050     void headsReceived(KDevelop::VcsJob* job);
0051     void identifyReceived(KDevelop::VcsJob* job);
0052 
0053 private:
0054     bool m_updating;
0055     MercurialPlugin* m_plugin;
0056     QUrl m_url;
0057     QList<KDevelop::VcsRevision> m_currentHeads;
0058 };
0059 
0060 #endif // MERCURIALHEADSMODEL_H