| 1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
|---|---|
| 2 | // |
| 3 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 4 | |
| 5 | #ifndef REPOSWIDGET_H |
| 6 | #define REPOSWIDGET_H |
| 7 | |
| 8 | #include "basetype.h" |
| 9 | |
| 10 | #include <QSplitter> |
| 11 | |
| 12 | class AmendsWidget; |
| 13 | class QSplitter; |
| 14 | class CommitHistoryWidget; |
| 15 | class ReposWidgetPrivate; |
| 16 | class ReposWidget : public QWidget |
| 17 | { |
| 18 | Q_OBJECT |
| 19 | ReposWidgetPrivate *const d; |
| 20 | public: |
| 21 | explicit ReposWidget(QWidget* parent = nullptr); |
| 22 | virtual ~ReposWidget(); |
| 23 | |
| 24 | QString getReposPath() const; |
| 25 | void setReposPath(const QString &path); |
| 26 | QString getName() const; |
| 27 | void setName(const QString &value); |
| 28 | QString getPasswd() const; |
| 29 | void setPasswd(const QString &value); |
| 30 | void setLogginDisplay(const QString &name = "", const QString &passwd = ""); |
| 31 | |
| 32 | public slots: |
| 33 | void doLoggin(); // main func |
| 34 | void doUpdateRepos(); |
| 35 | void doRefresh(); |
| 36 | void doAmendsCommit(); |
| 37 | void doAmendsRevertAll(); |
| 38 | void doDiffFileAtRevision(); |
| 39 | |
| 40 | private: |
| 41 | bool add(const QString &display); |
| 42 | bool revert(const QString &display); |
| 43 | |
| 44 | private slots: |
| 45 | void loadRevisionFiles(); |
| 46 | void reloadRevisionFiles(); |
| 47 | void loadHistory(); |
| 48 | void reloadHistory(); |
| 49 | void modFileMenu(const RevisionFile &file, const QPoint &pos); |
| 50 | void historyDataClicked(const QModelIndex &index); |
| 51 | void historyFileClicked(const QModelIndex &index); |
| 52 | void setSrcViewReviFiles(const QString &path); |
| 53 | |
| 54 | private: |
| 55 | void fileModifyMenu(); |
| 56 | static bool testUserLoggin(const QString &reposPath, |
| 57 | const QString &name, |
| 58 | const QString &passwd); |
| 59 | QWidget *initControlBar(); |
| 60 | }; |
| 61 | |
| 62 | #endif // REPOSWIDGET_H |
| 63 |