-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileTreeWidget.h
More file actions
74 lines (53 loc) · 1.74 KB
/
FileTreeWidget.h
File metadata and controls
74 lines (53 loc) · 1.74 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
64
65
66
67
68
69
70
71
72
73
74
#ifndef OPENNOTE_LINUX_FILETREEWIDGET_H
#define OPENNOTE_LINUX_FILETREEWIDGET_H
#pragma once
#include <QFileSystemModel>
#include <QHBoxLayout>
#include <QLabel>
#include <QToolButton>
#include <QTreeView>
#include <QVBoxLayout>
#include <QWidget>
class FileTreeWidget : public QWidget {
Q_OBJECT
public:
explicit FileTreeWidget(QWidget* parent = nullptr);
~FileTreeWidget() override = default;
void setRootPath(const QString& path);
void reloadRootPath();
signals :
void fileSelected(const QString& filePath);
void statusMessage(const QString& message, int timeoutMs);
void filePathChanged(const QString& oldPath, const QString& newPath);
void filePathDeleted(const QString& path);
private
slots :
void onItemDoubleClicked(const QModelIndex& index);
void onChooseFolder();
void onContextMenuRequested(const QPoint& pos);
void onOpenFile();
void onOpenWithDefault();
void onRenameItem();
void onMoveItem();
void onDeleteItem();
void onFileProperties();
void onExpandFolder();
void onCollapseFolder();
void onOpenInFileManager();
private:
void setupUi();
bool isContextMenuItemFile() const;
bool isContextMenuItemFolder() const;
QString contextMenuItemPath() const;
void updateTabPaths(const QString& oldPath, const QString& newPath);
void closeTabsWithPath(const QString& path);
bool hasTabsWithPath(const QString& path) const;
QVBoxLayout* m_layout = nullptr;
QLabel* m_label = nullptr;
QToolButton* m_folderBtn = nullptr;
QToolButton* m_refreshBtn = nullptr;
QTreeView* m_treeView = nullptr;
QFileSystemModel* m_model = nullptr;
QModelIndex m_contextMenuIndex;
};
#endif // OPENNOTE_LINUX_FILETREEWIDGET_H