summaryrefslogtreecommitdiff
path: root/src/modinfodialogfiletree.h
blob: a7cfbcd684a686a2d37f36b5d379ad21be03f5b3 (plain)
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
#ifndef MODINFODIALOGFILETREE_H
#define MODINFODIALOGFILETREE_H

#include "modinfodialogtab.h"
#include <QFileSystemModel>

class FileTreeTab : public ModInfoDialogTab
{
  Q_OBJECT;

public:
  FileTreeTab(ModInfoDialogTabContext cx);

  void clear() override;
  void saveState(Settings& s);
  void restoreState(const Settings& s);
  void update() override;
  bool deleteRequested() override;

private:
  struct Actions
  {
    QAction* newFolder = nullptr;
    QAction* open      = nullptr;
    QAction* runHooked = nullptr;
    QAction* preview   = nullptr;
    QAction* explore   = nullptr;
    QAction* rename    = nullptr;
    QAction* del       = nullptr;
    QAction* hide      = nullptr;
    QAction* unhide    = nullptr;
  };

  QFileSystemModel* m_fs;
  Actions m_actions;

  void onCreateDirectory();
  void onActivated();
  void onOpen();
  void onRunHooked();
  void onPreview();
  void onExplore();
  void onRename();
  void onDelete();
  void onHide();
  void onUnhide();
  void onOpenInExplorer();
  void onContextMenu(const QPoint& pos);

  QModelIndex singleSelection() const;
  bool deleteFile(const QModelIndex& index);
  bool deleteFileRecursive(const QModelIndex& index);
  void changeVisibility(bool visible);
};

#endif  // MODINFODIALOGFILETREE_H