1#pragma once
2
3/****************************************************************************************
4 ** GitQlient is an application to manage and operate one or several Git repositories. With
5 ** GitQlient you will be able to add commits, branches and manage all the options Git provides.
6 ** Copyright (C) 2021 Francesc Martinez
7 **
8 ** LinkedIn: www.linkedin.com/in/cescmm/
9 ** Web: www.francescmm.com
10 **
11 ** This program is free software; you can redistribute it and/or
12 ** modify it under the terms of the GNU Lesser General Public
13 ** License as published by the Free Software Foundation; either
14 ** version 2 of the License, or (at your option) any later version.
15 **
16 ** This program is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ** Lesser General Public License for more details.
20 **
21 ** You should have received a copy of the GNU Lesser General Public
22 ** License along with this library; if not, write to the Free Software
23 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 ***************************************************************************************/
25
26#include <CommitInfo.h>
27#include <GitExecResult.h>
28
29#include <QObject>
30#include <QSharedPointer>
31#include <QVector>
32
33class GitBase;
34class GitCache;
35struct WipRevisionInfo;
36class GitQlientSettings;
37
38class GitRepoLoader : public QObject
39{
40 Q_OBJECT
41
42signals:
43 void signalLoadingStarted();
44 void signalLoadingFinished(bool full);
45 void cancelAllProcesses(QPrivateSignal);
46
47public slots:
48 void loadLogHistory();
49 void loadReferences();
50 void loadAll();
51
52public:
53 explicit GitRepoLoader(QSharedPointer<GitBase> gitBase, QSharedPointer<GitCache> cache,
54 const QSharedPointer<GitQlientSettings> &settings, QObject *parent = nullptr);
55 void cancelAll();
56 void setShowAll(bool showAll = true) { mShowAll = showAll; }
57
58private:
59 bool mShowAll = true;
60 bool mLocked = false;
61 bool mRefreshReferences = true;
62 int mSteps = 0;
63 QSharedPointer<GitBase> mGitBase;
64 QSharedPointer<GitCache> mRevCache;
65 QSharedPointer<GitQlientSettings> mSettings;
66
67 bool configureRepoDirectory();
68 void requestReferences();
69 void processReferences(QByteArray ba);
70 void requestRevisions();
71 void processRevisions(QByteArray ba);
72 QVector<CommitInfo> processUnsignedLog(QByteArray &log) const;
73 QVector<CommitInfo> processSignedLog(QByteArray &log) const;
74};
75