GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
FileTreeView.h
1 
29 #pragma once
30 
31 namespace GpgFrontend::UI {
32 
33 class FileTreeView : public QTreeView {
34  Q_OBJECT
35  public:
36  explicit FileTreeView(QWidget* parent, const QString& target_path);
37 
43  auto GetCurrentPath() -> QString;
44 
50  auto GetSelectedPath() -> QString;
51 
58  auto GetPathByClickPoint(const QPoint& point) -> QString;
59 
66  auto GetMousePointGlobal(const QPoint& point) -> QPoint;
67 
68  protected:
75  void selectionChanged(const QItemSelection& selected,
76  const QItemSelection& deselected) override;
77 
83  void keyPressEvent(QKeyEvent* event) override;
84 
89  void paintEvent(QPaintEvent* event) override;
90 
96  void mousePressEvent(QMouseEvent* event) override;
97 
98  signals:
99 
105  void SignalPathChanged(const QString&);
106 
111  void SignalSelectedChanged(const QString&);
112 
117  void SignalOpenFile(const QString&);
118 
119  public slots:
120 
125  void SlotGoPath(const QString&);
126 
131  void SlotUpLevel();
132 
137  void SlotShowSystemFile(bool);
138 
144  void SlotShowHiddenFile(bool);
145 
150  auto SlotDeleteSelectedItem() -> void;
151 
156  void SlotMkdir();
157 
162  void SlotMkdirBelowAtSelectedItem();
163 
168  void SlotTouch();
169 
174  void SlotTouchBelowAtSelectedItem();
175 
180  void SlotRenameSelectedItem();
181 
186  void SlotOpenSelectedItemBySystemApplication();
187 
188  private slots:
189 
195  void slot_file_tree_view_item_double_clicked(const QModelIndex& index);
196 
201  void slot_calculate_hash();
202 
207  void slot_compress_files();
208 
214  void slot_show_custom_context_menu(const QPoint& point);
215 
220  void slot_create_popup_menu();
221 
226  void slot_adjust_column_widths();
227 
228  private:
229  QFileSystemModel* dir_model_;
230  QString current_path_;
231  QString selected_path_;
232 
233  QMenu* popup_menu_;
234  QMenu* new_item_action_menu_;
235  QAction* action_open_file_;
236  QAction* action_rename_file_;
237  QAction* action_delete_file_;
238  QAction* action_calculate_hash_;
239  QAction* action_create_empty_file_;
240  QAction* action_make_directory_;
241  QAction* action_compress_files_;
242 
243  bool initial_resize_done_ = false;
244 };
245 } // namespace GpgFrontend::UI
Definition: FileTreeView.h:33
void mousePressEvent(QMouseEvent *event) override
Definition: FileTreeView.cpp:425
void slot_file_tree_view_item_double_clicked(const QModelIndex &index)
Definition: FileTreeView.cpp:98
void SignalPathChanged(const QString &)
void slot_compress_files()
compress directory into gpg-zip
Definition: FileTreeView.cpp:414
void slot_show_custom_context_menu(const QPoint &point)
Definition: FileTreeView.cpp:354
auto GetSelectedPath() -> QString
Get the Selected Path object.
Definition: FileTreeView.cpp:153
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override
Definition: FileTreeView.cpp:63
auto GetMousePointGlobal(const QPoint &point) -> QPoint
Get the Mouse Point Global object.
Definition: FileTreeView.cpp:287
auto GetCurrentPath() -> QString
Get the Current Path object.
Definition: FileTreeView.cpp:125
void keyPressEvent(QKeyEvent *event) override
Definition: FileTreeView.cpp:243
void slot_create_popup_menu()
Create a popup menu object.
Definition: FileTreeView.cpp:291
auto GetPathByClickPoint(const QPoint &point) -> QString
Get the Path By Click Point object.
Definition: FileTreeView.cpp:141
void SlotShowHiddenFile(bool)
Definition: FileTreeView.cpp:134
Definition: FileReadTask.cpp:31