1 /* ============================================================
2 * TabManager plugin for Falkon
3 * Copyright (C) 2013-2017  S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
4 * Copyright (C) 2018       David Rosca <nowrep@gmail.com>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 * ============================================================ */
19 #ifndef TABMANAGERWIDGETCONTROLLER_H
20 #define TABMANAGERWIDGETCONTROLLER_H
21 
22 #include "sidebarinterface.h"
23 #include "tabmanagerwidget.h"
24 
25 class WebPage;
26 class AbstractButtonInterface;
27 
28 class TabManagerWidgetController : public SideBarInterface
29 {
30     Q_OBJECT
31 public:
32     explicit TabManagerWidgetController(QObject* parent = 0);
33     ~TabManagerWidgetController();
34 
35     QString title() const override;
36     QAction* createMenuAction() override;
37     QWidget* createSideBarWidget(BrowserWindow* mainWindow) override;
38 
39     AbstractButtonInterface* createStatusBarIcon(BrowserWindow* mainWindow);
40 
41     TabManagerWidget::GroupType groupType();
42     TabManagerWidget* createTabManagerWidget(BrowserWindow* mainClass, QWidget* parent = 0, bool defaultWidget = false);
43 
44     TabManagerWidget* defaultTabManager();
45 
46     void addStatusBarIcon(BrowserWindow* window);
47     void removeStatusBarIcon(BrowserWindow* window);
48 
49 public Q_SLOTS:
50     void setGroupType(TabManagerWidget::GroupType type);
51     void mainWindowDeleted(BrowserWindow* window);
52     void raiseTabManager();
53     void showSideBySide();
54     void emitRefreshTree();
55 
56 private:
57     TabManagerWidget* m_defaultTabManager;
58     TabManagerWidget::GroupType m_groupType;
59 
60     QHash<BrowserWindow*, AbstractButtonInterface*> m_statusBarIcons;
61     QHash<BrowserWindow*, QAction*> m_actions;
62 
63 Q_SIGNALS:
64     void requestRefreshTree(WebPage* p = 0);
65 };
66 
67 #endif // TABMANAGERWIDGETCONTROLLER_H
68