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 <QFrame>
27
28class QPushButton;
29class QButtonGroup;
30class GitConfig;
31class ProgressDlg;
32class GitQlientSettings;
33class QVBoxLayout;
34
35/*!
36 \brief The ConfigWidget is the widget shown when the user access it from the tool icon. It gives the options of
37 initiate, clone and open repositories and also provides the layout to access the general GitQlient configuration.
38
39The widget also shows the list of most open repositories.
40
41*/
42class InitScreen : public QFrame
43{
44 Q_OBJECT
45
46signals:
47 /*!
48 \brief Signal triggered when the user tries to open a new repository.
49
50 \param repoPath The repository full path.
51 */
52 void signalOpenRepo(const QString &repoPath);
53
54public:
55 /*!
56 \brief Default constructor.
57
58 \param parent The parent widget if needed.
59 */
60 explicit InitScreen(QWidget *parent = nullptr);
61
62 /*!
63 * \brief onRepoOpened Increments the uses of the repo in the settings to update the lists.
64 *
65 * \param repo The absolute path to the repo.
66 */
67 void onRepoOpened();
68
69private:
70 QSharedPointer<GitConfig> mGit;
71 QPushButton *mOpenRepo = nullptr;
72 QPushButton *mCloneRepo = nullptr;
73 QPushButton *mInitRepo = nullptr;
74 QButtonGroup *mBtnGroup = nullptr;
75 ProgressDlg *mProgressDlg = nullptr;
76 QString mPathToOpen;
77 QVBoxLayout *mRecentProjectsLayout = nullptr;
78 QVBoxLayout *mUsedProjectsLayout = nullptr;
79 QWidget *mInnerWidget = nullptr;
80 QWidget *mMostUsedInnerWidget = nullptr;
81
82 /*!
83 \brief Opens an already cloned repository.
84
85 */
86 void openRepo();
87 /*!
88 \brief Clones a new repository.
89
90 */
91 void cloneRepo();
92 /*!
93 \brief Initiates a new local repository.
94
95 */
96 void initRepo();
97 /*!
98 \brief Creates the recent projects page.
99
100 \return QWidget The resultant widget.
101 */
102 QWidget *createRecentProjectsPage();
103
104 /*!
105 \brief Creates the most used projects page.
106
107 \return QWidget The resultant widget.
108 */
109 QWidget *createUsedProjectsPage();
110
111 /*!
112 \brief Updates the progress dialog for cloning repos.
113
114 \param stepDescription The description step.
115 \param value The numeric value.
116 */
117 void updateProgressDialog(QString stepDescription, int value);
118
119 /**
120 * @brief showError Shows an error occurred during any configuration time.
121 * @param error The error code.
122 * @param description The error description.
123 */
124 void showError(int error, QString description);
125
126 /**
127 * @brief showAbout Shows GitQlient about info.
128 */
129 void showAbout();
130
131 /**
132 * @brief openConfigDlg Opens the config dialog.
133 */
134 void openConfigDlg();
135};
136