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_actionCloseTab_triggered();
63  void on_actionCloseWindow_triggered();
64  void on_actionFileProperties_triggered();
65  void on_actionFolderProperties_triggered();
66 
67  void on_actionCut_triggered();
68  void on_actionCopy_triggered();
69  void on_actionPaste_triggered();
70  void on_actionDelete_triggered();
71  void on_actionRename_triggered();
72  void on_actionSelectAll_triggered();
73  void on_actionInvertSelection_triggered();
74  void on_actionPreferences_triggered();
75 
76  void on_actionGoBack_triggered();
77  void on_actionGoForward_triggered();
78  void on_actionGoUp_triggered();
79  void on_actionHome_triggered();
80  void on_actionReload_triggered();
81 
82  void on_actionIconView_triggered();
83  void on_actionCompactView_triggered();
84  void on_actionDetailedList_triggered();
85  void on_actionThumbnailView_triggered();
86 
87  void on_actionGo_triggered();
88  void on_actionShowHidden_triggered(bool check);
89 
90  void on_actionByFileName_triggered(bool checked);
91  void on_actionByMTime_triggered(bool checked);
92  void on_actionByOwner_triggered(bool checked);
93  void on_actionByFileType_triggered(bool checked);
94  void on_actionByFileSize_triggered(bool checked);
95  void on_actionAscending_triggered(bool checked);
96  void on_actionDescending_triggered(bool checked);
97  void on_actionFolderFirst_triggered(bool checked);
98  void on_actionCaseSensitive_triggered(bool checked);
99 
100  void on_actionApplications_triggered();
101  void on_actionComputer_triggered();
102  void on_actionTrash_triggered();
103  void on_actionNetwork_triggered();
104  void on_actionDesktop_triggered();
105  void on_actionAddToBookmarks_triggered();
106  void on_actionEditBookmarks_triggered();
107 
108  void on_actionOpenTerminal_triggered();
109  void on_actionOpenAsRoot_triggered();
110 
111  void on_actionAbout_triggered();
112 
113  void onBookmarkActionTriggered();
114 
115  void onTabBarCloseRequested(int index);
116  void onTabBarCurrentChanged(int index);
117  void onTabBarTabMoved(int from, int to);
118 
119  void onShortcutPrevTab();
120  void onShortcutNextTab();
121  void onShortcutJumpToTab();
122 
123  void onStackedWidgetWidgetRemoved(int index);
124 
125  void onTabPageTitleChanged(QString title);
126  void onTabPageStatusChanged(int type, QString statusText);
127  void onTabPageOpenDirRequested(FmPath* path, int target);
128  void onTabPageSortFilterChanged();
129 
130  void onSidePaneChdirRequested(int type, FmPath* path);
131  void onSplitterMoved(int pos, int index);
132 
133  void onBackForwardContextMenu(QPoint pos);
134 
135 protected:
136  // void changeEvent( QEvent * event);
137  void closeTab(int index);
138  virtual void resizeEvent(QResizeEvent *event);
139  virtual void closeEvent(QCloseEvent *event);
140 
141 private:
142  static void onBookmarksChanged(FmBookmarks* bookmarks, MainWindow* pThis);
143  void loadBookmarksMenu();
144  void updateUIForCurrentPage();
145  void updateViewMenuForCurrentPage();
146  void updateStatusBarForCurrentPage();
147 
148 private:
149  Ui::MainWindow ui;
150  QLineEdit* pathEntry;
151  QLabel* fsInfoLabel;
152  FmBookmarks* bookmarks;
153  Launcher fileLauncher_;
154 };
155 
156 }
157 
158 #endif // FM_MAIN_WINDOW_H
Definition: settings.h:33
Definition: tabpage.h:43
Definition: application.h:38
Definition: launcher.h:30
Definition: mainwindow.h:41