-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathraventree.h
More file actions
63 lines (48 loc) · 1.58 KB
/
raventree.h
File metadata and controls
63 lines (48 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef RAVENTREE_H
#define RAVENTREE_H
#include "gitmanager.h"
#include "raventreemodel.h"
#include <QTreeView>
#include <QWidget>
class RavenLHSView;
class RavenTree : public QTreeView
{
Q_OBJECT
public:
explicit RavenTree(QWidget *parent = nullptr);
[[nodiscard]] RavenTreeModel *model() const;
int getMaxStatusFilesCount() { return MAX_STATUS_FILES_COUNT; }
signals:
void renderDiffItem(GitManager::GitDiffItem item);
public slots:
void buildTree(QString repoPath, GitManager::status_data payload);
void onFileOpened(const QModelIndex &index);
private:
RavenTreeModel *m_model;
RavenLHSView *m_lhsView;
GitManager *m_gitManager;
bool maxStatusFilesCountReached = false;
int MAX_STATUS_FILES_COUNT = 500;
void onStageItem(RavenTreeItem *treeItem);
void onUnstageItem(RavenTreeItem *treeItem);
void onDeleteRequested(RavenTreeItem *treeItem);
void onOpenNodeInFMRequested(RavenTreeItem *treeItem);
void mouseReleaseEvent(QMouseEvent *event) override;
struct RavenTreeBuildHelper {
QString repoPath;
RavenTreeItem *currentNode;
QString path;
GitManager::GitStatusItem status;
};
void _buildTree(RavenTreeBuildHelper& helper);
void initCustomActions();
void buildContextMenuForTreeItem(RavenTreeItem* treeItem);
void OnContextMenuRequested(const QPoint &pos);
QMenu *m_contextMenu;
QAction* m_deleteAction;
QAction* m_stageAction;
QAction* m_unstageAction;
QAction* m_openNodeInFMAction;
QList<QAction*> m_contextMenuActionsList;
};
#endif // RAVENTREE_H