NDE-FileMAN
view.h
1 /*
2 
3  Copyright (C) 2013 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 
20 
21 #ifndef NDEFILEMAN_FOLDERVIEW_H
22 #define NDEFILEMAN_FOLDERVIEW_H
23 
24 #include <libfm-qt/folderview.h>
25 #include <libfm-qt/core/filepath.h>
26 
27 
28 namespace Fm {
29 class FileMenu;
30 class FolderMenu;
31 }
32 
33 namespace NDEFileMAN {
34 
35 class Settings;
36 
37 class View : public Fm::FolderView {
38  Q_OBJECT
39 public:
40  enum DirectoryView {
41  IconView,
42  CompactView,
43  DetailedList,
44  ThumbnailView
45  };
46 
47  explicit View(Fm::FolderView::ViewMode _mode = IconMode, QWidget* parent = 0);
48  virtual ~View();
49 
50  void updateFromSettings(Settings& settings);
51 
52  QSize getMargins() const {
53  return Fm::FolderView::getMargins();
54  }
55  void setMargins(QSize size) {
56  Fm::FolderView::setMargins(size);
57  }
58 
59  void setDesktopPrepare(bool type = false) {
60  isDesktopPrepare_ = type;
61  }
62  void setFolderViewMode(Fm::FolderView::ViewMode mode);
63  bool getFolderReload() {
64  return isFolderReload_;
65  }
66  void setFolderReload(bool reload) {
67  isFolderReload_ = reload;
68  }
69 
70 Q_SIGNALS:
71  void openDirRequested(const Fm::FilePath& path, int target);
72  void folderViewMode(Fm::FolderView::ViewMode mode);
73 
74 protected Q_SLOTS:
75  void onNewWindow();
76  void onNewTab();
77  void onOpenInTerminal();
78  void onSearch();
79  void onCreateShortcutWithTriggered(); // 右键图标创建快捷方式
80  void onOpenFolderTerminal(); // 右键菜单打开终端
81  void onOpenAsRootTriggered(); // 以管理员权限运行应用
82  void onCopyToHomeTriggered(); // 发送到主文件夹
83  void onCopyToDesktopTriggered(); // 发送到桌面
84  void onFolderReload(); // 刷新
85  void DirectoryViewSlots(int mode); // 文件管理器查看功能信号接收
86  void onDesktopShortcutTriggered(); // 发送到桌面快捷方式
87 
88 protected:
89  virtual void onFileClicked(int type, const std::shared_ptr<const Fm::FileInfo>& fileInfo);
90  virtual void prepareFileMenu(Fm::FileMenu* menu);
91  virtual void prepareFolderMenu(Fm::FolderMenu* menu);
92 
93 private:
94  QMenu* createCopytoMenuSub(Fm::FileMenu* menu);
95  bool isDesktopPrepare_;
96  bool isFolderReload_;
97 };
98 
99 }
100 #endif // NDEFILEMAN_FOLDERVIEW_H
Definition: desktopwindow.h:38
Definition: view.h:37
Definition: settings.h:170
Definition: application.cpp:59