File indexing completed on 2024-05-12 04:57:53
0001 /* ============================================================ 0002 * Falkon - Qt web browser 0003 * Copyright (C) 2014-2018 David Rosca <nowrep@gmail.com> 0004 * 0005 * This program is free software: you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation, either version 3 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This program is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0017 * ============================================================ */ 0018 #ifndef MAINMENU_H 0019 #define MAINMENU_H 0020 0021 #include <QMenu> 0022 #include <QHash> 0023 #include <QPointer> 0024 0025 #include "qzcommon.h" 0026 0027 class QMenuBar; 0028 0029 class Preferences; 0030 class HistoryMenu; 0031 class BookmarksMenu; 0032 class BrowserWindow; 0033 0034 class FALKON_EXPORT MainMenu : public QMenu 0035 { 0036 Q_OBJECT 0037 0038 public: 0039 explicit MainMenu(BrowserWindow* window, QWidget* parent = nullptr); 0040 0041 0042 void initMenuBar(QMenuBar* menuBar) const; 0043 void initSuperMenu(QMenu* superMenu) const; 0044 0045 QAction* action(const QString &name) const; 0046 0047 public Q_SLOTS: 0048 void setWindow(BrowserWindow* window); 0049 0050 private Q_SLOTS: 0051 // Standard actions 0052 void showAboutDialog(); 0053 void showPreferences(); 0054 void quitApplication(); 0055 0056 // File menu 0057 void newTab(); 0058 void newWindow(); 0059 void newPrivateWindow(); 0060 void openLocation(); 0061 void openFile(); 0062 void closeWindow(); 0063 void savePageAs(); 0064 void sendLink(); 0065 void printPage(); 0066 0067 // Edit menu 0068 void editUndo(); 0069 void editRedo(); 0070 void editCut(); 0071 void editCopy(); 0072 void editPaste(); 0073 void editSelectAll(); 0074 void editFind(); 0075 0076 // View menu 0077 void showStatusBar(); 0078 void stop(); 0079 void reload(); 0080 void zoomIn(); 0081 void zoomOut(); 0082 void zoomReset(); 0083 void showPageSource(); 0084 void showFullScreen(); 0085 0086 // Tools menu 0087 void webSearch(); 0088 void showSiteInfo(); 0089 void showDownloadManager(); 0090 void showCookieManager(); 0091 void toggleWebInspector(); 0092 void showClearRecentHistoryDialog(); 0093 0094 // Help menu 0095 void aboutQt(); 0096 void showInfoAboutApp(); 0097 void showConfigInfo(); 0098 void reportIssue(); 0099 0100 // Other actions 0101 void restoreClosedTab(); 0102 0103 void aboutToShowFileMenu(); 0104 void aboutToShowViewMenu(); 0105 void aboutToShowEditMenu(); 0106 void aboutToShowToolsMenu(); 0107 void aboutToShowSuperMenu(); 0108 0109 void aboutToShowToolbarsMenu(); 0110 void aboutToShowSidebarsMenu(); 0111 void aboutToShowEncodingMenu(); 0112 0113 private: 0114 void init(); 0115 void addActionsToWindow(); 0116 void callSlot(const char* slot); 0117 0118 QHash<QString, QAction*> m_actions; 0119 QPointer<BrowserWindow> m_window; 0120 QPointer<Preferences> m_preferences; 0121 0122 QMenu* m_menuFile; 0123 QMenu* m_menuEdit; 0124 QMenu* m_menuView; 0125 QMenu* m_menuTools; 0126 QMenu* m_menuHelp; 0127 QMenu* m_submenuExtensions; 0128 HistoryMenu* m_menuHistory; 0129 BookmarksMenu* m_menuBookmarks; 0130 }; 0131 0132 #endif // MAINMENU_H