PCManFM-Qt
mainwindow.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 #ifndef FM_MAIN_WINDOW_H
21 #define FM_MAIN_WINDOW_H
22 
23 #include "ui_main-win.h"
24 #include <QMainWindow>
25 #include <QListView>
26 #include <QSortFilterProxyModel>
27 #include <QLineEdit>
28 #include <QTabWidget>
29 #include <libfm/fm.h>
30 #include <QMessageBox>
31 #include <QTabBar>
32 #include <QStackedWidget>
33 #include <QSplitter>
34 #include "launcher.h"
35 
36 namespace PCManFM {
37 
38 class TabPage;
39 class Settings;
40 
41 class MainWindow : public QMainWindow {
42 Q_OBJECT
43 public:
44  MainWindow(FmPath* path = NULL);
45  virtual ~MainWindow();
46 
47  void chdir(FmPath* path);
48  void addTab(FmPath* path);
49 
50  TabPage* currentPage() {
51  return reinterpret_cast<TabPage*>(ui.stackedWidget->currentWidget());
52  }
53 
54  void updateFromSettings(Settings& settings);
55 
56 protected Q_SLOTS:
57 
58  void onPathEntryReturnPressed();
59 
60  void on_actionNewTab_triggered();
61  void on_actionNewWin_triggered();
62  void on_actionNewFolder_triggered();
63  void on_actionNewBlankFile_triggered();
64  void on_actionCloseTab_triggered();
65  void on_actionCloseWindow_triggered();
66  void on_actionFileProperties_triggered();
67  void on_actionFolderProperties_triggered();
68 
69  void on_actionCut_triggered();
70  void on_actionCopy_triggered();
71  void on_actionPaste_triggered();
72  void on_actionDelete_triggered();
73  void on_actionRename_triggered();
74  void on_actionSelectAll_triggered();
75  void on_actionInvertSelection_triggered();
76  void on_actionPreferences_triggered();
77 
78  void on_actionGoBack_triggered();
79  void on_actionGoForward_triggered();
80  void on_actionGoUp_triggered();
81  void on_actionHome_triggered();
82  void on_actionReload_triggered();
83 
84  void on_actionIconView_triggered();
85  void on_actionCompactView_triggered();
86  void on_actionDetailedList_triggered();
87  void on_actionThumbnailView_triggered();
88 
89  void on_actionGo_triggered();
90  void on_actionShowHidden_triggered(bool check);
91 
92  void on_actionByFileName_triggered(bool checked);
93  void on_actionByMTime_triggered(bool checked);
94  void on_actionByOwner_triggered(bool checked);
95  void on_actionByFileType_triggered(bool checked);
96  void on_actionByFileSize_triggered(bool checked);
97  void on_actionAscending_triggered(bool checked);
98  void on_actionDescending_triggered(bool checked);
99  void on_actionFolderFirst_triggered(bool checked);
100  void on_actionCaseSensitive_triggered(bool checked);
101  void on_actionFilter_triggered(bool checked);
102 
103  void on_actionApplications_triggered();
104  void on_actionComputer_triggered();
105  void on_actionTrash_triggered();
106  void on_actionNetwork_triggered();
107  void on_actionDesktop_triggered();
108  void on_actionAddToBookmarks_triggered();
109  void on_actionEditBookmarks_triggered();
110 
111  void on_actionOpenTerminal_triggered();
112  void on_actionOpenAsRoot_triggered();
113  void on_actionFindFiles_triggered();
114 
115  void on_actionAbout_triggered();
116 
117  void onBookmarkActionTriggered();
118 
119  void onTabBarCloseRequested(int index);
120  void onTabBarCurrentChanged(int index);
121  void onTabBarTabMoved(int from, int to);
122 
123  void onFilterStringChanged(QString str);
124 
125  void onShortcutPrevTab();
126  void onShortcutNextTab();
127  void onShortcutJumpToTab();
128 
129  void onStackedWidgetWidgetRemoved(int index);
130 
131  void onTabPageTitleChanged(QString title);
132  void onTabPageStatusChanged(int type, QString statusText);
133  void onTabPageOpenDirRequested(FmPath* path, int target);
134  void onTabPageSortFilterChanged();
135 
136  void onSidePaneChdirRequested(int type, FmPath* path);
137  void onSidePaneOpenFolderInNewWindowRequested(FmPath* path);
138  void onSidePaneOpenFolderInNewTabRequested(FmPath* path);
139  void onSidePaneOpenFolderInTerminalRequested(FmPath* path);
140  void onSidePaneCreateNewFolderRequested(FmPath* path);
141  void onSidePaneModeChanged(Fm::SidePane::Mode mode);
142  void onSplitterMoved(int pos, int index);
143 
144  void onBackForwardContextMenu(QPoint pos);
145 
146 protected:
147  // void changeEvent( QEvent * event);
148  void closeTab(int index);
149  virtual void resizeEvent(QResizeEvent *event);
150  virtual void closeEvent(QCloseEvent *event);
151 
152 private:
153  static void onBookmarksChanged(FmBookmarks* bookmarks, MainWindow* pThis);
154  void loadBookmarksMenu();
155  void updateUIForCurrentPage();
156  void updateViewMenuForCurrentPage();
157  void updateStatusBarForCurrentPage();
158 
159 private:
160  Ui::MainWindow ui;
161  QLineEdit* pathEntry;
162  QLabel* fsInfoLabel;
163  FmBookmarks* bookmarks;
164  Launcher fileLauncher_;
165 };
166 
167 }
168 
169 #endif // FM_MAIN_WINDOW_H
Definition: settings.h:41
Definition: tabpage.h:60
Definition: application.h:39
Definition: launcher.h:30
Definition: mainwindow.h:41