Falkon Develop
Cross-platform Qt-based web browser
sitesettingsview_controller.cpp
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2024 Juraj Oravec <jurajoravec@mailo.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
21
22#include "sitesettingsmanager.h"
23#include "mainapplication.h"
24#include "webpage.h"
25#include "webview.h"
26
27#include <QAction>
28#include <QLabel>
29#include <QPushButton>
30#include <QVBoxLayout>
31#include <QTreeWidget>
32
34 : SideBarInterface(parent)
35{
36}
37
39{
40 return tr("Site Settings");
41}
42
44{
45 // The action must be parented to some object from plugin, otherwise
46 // there may be a crash when unloading the plugin.
47
48 auto* act = new QAction(tr("Site Settings View"), this);
49 act->setCheckable(true);
50
51 return act;
52}
53
55{
56 auto *widget = new SiteSettingsView_Widget(mainWindow);
57 m_widgets[mainWindow] = widget;
58 return widget;
59}
60
62{
63 connect(page, &WebPage::loadFinished, this, [=]() {
64 QHash<BrowserWindow*, QPointer<SiteSettingsView_Widget>>::iterator it;
65 for (it = m_widgets.begin(); it != m_widgets.end(); ++it) {
66 it.value()->loadFinished(page);
67 }
68 });
69 connect(page->view(), &WebView::zoomLevelChanged, this, [=](){
70 QHash<BrowserWindow*, QPointer<SiteSettingsView_Widget>>::iterator it;
71 for (it = m_widgets.begin(); it != m_widgets.end(); ++it) {
72 it.value()->loadFinished(page);
73 }
74 });
75}
76
78{
79 m_widgets.remove(window);
80}
QWidget * createSideBarWidget(BrowserWindow *mainWindow) override
SiteSettingsView_Controller(QObject *parent=nullptr)
void mainWindowDeleted(BrowserWindow *window)
WebView * view() const
Definition: webpage.cpp:140
void zoomLevelChanged(int)