File indexing completed on 2024-05-19 04:59:20

0001 /* ============================================================
0002 * TabManager plugin for Falkon
0003 * Copyright (C) 2013-2017  S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
0004 * Copyright (C) 2018       David Rosca <nowrep@gmail.com>
0005 *
0006 * This program is free software: you can redistribute it and/or modify
0007 * it under the terms of the GNU General Public License as published by
0008 * the Free Software Foundation, either version 3 of the License, or
0009 * (at your option) any later version.
0010 *
0011 * This program is distributed in the hope that it will be useful,
0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014 * GNU General Public License for more details.
0015 *
0016 * You should have received a copy of the GNU General Public License
0017 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0018 * ============================================================ */
0019 #ifndef TABMANAGERWIDGETCONTROLLER_H
0020 #define TABMANAGERWIDGETCONTROLLER_H
0021 
0022 #include "sidebarinterface.h"
0023 #include "tabmanagerwidget.h"
0024 
0025 class WebPage;
0026 class AbstractButtonInterface;
0027 
0028 class TabManagerWidgetController : public SideBarInterface
0029 {
0030     Q_OBJECT
0031 public:
0032     explicit TabManagerWidgetController(QObject* parent = nullptr);
0033     ~TabManagerWidgetController() override;
0034 
0035     QString title() const override;
0036     QAction* createMenuAction() override;
0037     QWidget* createSideBarWidget(BrowserWindow* mainWindow) override;
0038 
0039     AbstractButtonInterface* createStatusBarIcon(BrowserWindow* mainWindow);
0040 
0041     TabManagerWidget::GroupType groupType();
0042     TabManagerWidget* createTabManagerWidget(BrowserWindow* mainClass, QWidget* parent = nullptr, bool defaultWidget = false);
0043 
0044     TabManagerWidget* defaultTabManager();
0045 
0046     void addStatusBarIcon(BrowserWindow* window);
0047     void removeStatusBarIcon(BrowserWindow* window);
0048 
0049 public Q_SLOTS:
0050     void setGroupType(TabManagerWidget::GroupType type);
0051     void mainWindowDeleted(BrowserWindow* window);
0052     void raiseTabManager();
0053     void showSideBySide();
0054     void emitRefreshTree();
0055 
0056 private:
0057     TabManagerWidget* m_defaultTabManager;
0058     TabManagerWidget::GroupType m_groupType;
0059 
0060     QHash<BrowserWindow*, AbstractButtonInterface*> m_statusBarIcons;
0061     QHash<BrowserWindow*, QAction*> m_actions;
0062 
0063 Q_SIGNALS:
0064     void requestRefreshTree(WebPage* p = nullptr);
0065 };
0066 
0067 #endif // TABMANAGERWIDGETCONTROLLER_H