Falkon Develop
Cross-platform Qt-based web browser
tabcontextmenu.h
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2010-2018 David Rosca <nowrep@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 3 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
16* along with this program. If not, see <http://www.gnu.org/licenses/>.
17* ============================================================ */
18#ifndef TABCONTEXTMENU_H
19#define TABCONTEXTMENU_H
20
21#include <QMenu>
22
23#include "qzcommon.h"
24
25class BrowserWindow;
26class TabWidget;
27
28class FALKON_EXPORT TabContextMenu : public QMenu
29{
30 Q_OBJECT
31
32public:
33 enum Option {
34 InvalidOption = 0,
35 HorizontalTabs = 1 << 0,
36 VerticalTabs = 1 << 1,
37 ShowCloseOtherTabsActions = 1 << 2,
38 ShowDetachTabAction = 1 << 3,
39
40 DefaultOptions = HorizontalTabs | ShowCloseOtherTabsActions | ShowDetachTabAction
41 };
42 Q_DECLARE_FLAGS(Options, Option)
43
44 explicit TabContextMenu(int index, BrowserWindow *window, Options options = DefaultOptions);
45
46Q_SIGNALS:
47 void reloadTab(int index);
48 void stopTab(int index);
49 void tabCloseRequested(int index);
50 void closeAllButCurrent(int index);
51 void closeToRight(int index);
52 void closeToLeft(int index);
53 void duplicateTab(int index);
54 void detachTab(int index);
55 void loadTab(int index);
56 void unloadTab(int index);
57
58private Q_SLOTS:
59 void reloadTab() { Q_EMIT reloadTab(m_clickedTab); }
60 void stopTab() { Q_EMIT stopTab(m_clickedTab); }
61 void closeTab() { Q_EMIT tabCloseRequested(m_clickedTab); }
62 void duplicateTab() { Q_EMIT duplicateTab(m_clickedTab); }
63 void detachTab() { Q_EMIT detachTab(m_clickedTab); }
64 void loadTab() { Q_EMIT loadTab(m_clickedTab); }
65 void unloadTab() { Q_EMIT unloadTab(m_clickedTab); }
66
67 void pinTab();
68 void muteTab();
69
70 void closeAllButCurrent();
71 void closeToRight();
72 void closeToLeft();
73
74private:
75 void init();
76
77 int m_clickedTab;
78 BrowserWindow *m_window;
79 Options m_options = InvalidOption;
80};
81
82Q_DECLARE_OPERATORS_FOR_FLAGS(TabContextMenu::Options)
83
84#endif // TABCONTEXTMENU_H
void loadTab(int index)
void closeToRight(int index)
void tabCloseRequested(int index)
void unloadTab(int index)
void stopTab(int index)
void duplicateTab(int index)
void detachTab(int index)
void closeToLeft(int index)
void closeAllButCurrent(int index)
void reloadTab(int index)
#define FALKON_EXPORT
Definition: qzcommon.h:28