| 1 | #pragma once |
|---|---|
| 2 | |
| 3 | #include <QFrame> |
| 4 | |
| 5 | class GitCache; |
| 6 | class GitBase; |
| 7 | class QPushButton; |
| 8 | class QToolButton; |
| 9 | class QMenu; |
| 10 | |
| 11 | class BranchesWidgetMinimal : public QFrame |
| 12 | { |
| 13 | Q_OBJECT |
| 14 | signals: |
| 15 | void showFullBranchesView(); |
| 16 | void commitSelected(const QString &sha); |
| 17 | void stashSelected(const QString &stashId); |
| 18 | |
| 19 | public: |
| 20 | explicit BranchesWidgetMinimal(const QSharedPointer<GitCache> &cache, const QSharedPointer<GitBase> git, |
| 21 | QWidget *parent = nullptr); |
| 22 | |
| 23 | void configureLocalMenu(const QString &sha, const QString &branch); |
| 24 | void configureRemoteMenu(const QString &sha, const QString &branch); |
| 25 | void configureTagsMenu(const QString &sha, const QString &tag); |
| 26 | void configureStashesMenu(const QString &stashId, const QString &name); |
| 27 | void configureSubmodulesMenu(const QString &name); |
| 28 | |
| 29 | void clearActions(); |
| 30 | |
| 31 | private: |
| 32 | QSharedPointer<GitBase> mGit; |
| 33 | QSharedPointer<GitCache> mCache; |
| 34 | QPushButton *mBack = nullptr; |
| 35 | QToolButton *mLocal = nullptr; |
| 36 | QMenu *mLocalMenu = nullptr; |
| 37 | QToolButton *mRemote = nullptr; |
| 38 | QMenu *mRemoteMenu = nullptr; |
| 39 | QToolButton *mTags = nullptr; |
| 40 | QMenu *mTagsMenu = nullptr; |
| 41 | QToolButton *mStashes = nullptr; |
| 42 | QMenu *mStashesMenu = nullptr; |
| 43 | QToolButton *mSubmodules = nullptr; |
| 44 | QMenu *mSubmodulesMenu = nullptr; |
| 45 | QMenu *mCurrentMenuShown = nullptr; |
| 46 | |
| 47 | bool eventFilter(QObject *obj, QEvent *event); |
| 48 | void addActionToMenu(const QString &sha, const QString &name, QMenu *menu); |
| 49 | }; |
| 50 |