From 8aa707cfe56604f95c6d5c75e146b70a5272cc5d Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Wed, 11 Jul 2018 14:39:08 +0200 Subject: Remove PageToolsMenu --- src/webengine/widgets/pagetoolsmenu.cpp | 62 --------------------------------- src/webengine/widgets/pagetoolsmenu.h | 32 ----------------- 2 files changed, 94 deletions(-) delete mode 100644 src/webengine/widgets/pagetoolsmenu.cpp delete mode 100644 src/webengine/widgets/pagetoolsmenu.h (limited to 'src/webengine/widgets') diff --git a/src/webengine/widgets/pagetoolsmenu.cpp b/src/webengine/widgets/pagetoolsmenu.cpp deleted file mode 100644 index 6e48798..0000000 --- a/src/webengine/widgets/pagetoolsmenu.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This file is part of smolbote. It's copyrighted by the contributors recorded - * in the version control history of the file, available from its original - * location: https://neueland.iserlohn-fortress.net/smolbote.hg - * - * SPDX-License-Identifier: GPL-3.0 - */ - -#include "pagetoolsmenu.h" -#include "../webview.h" -#include -#include -#include -#include -#include -#include - -PageToolsMenu::PageToolsMenu(WebView *parent) - : QMenu(tr("Tools"), parent) -{ - Q_CHECK_PTR(parent); - parentView = parent; - - connect(this, &QMenu::aboutToShow, this, &PageToolsMenu::createEntries); -} - -void PageToolsMenu::createEntries() -{ - clear(); - - auto *scriptsMenu = new QMenu(tr("Injected Scripts"), this); - for(const auto &script : parentView->page()->scripts().toList()) { - scriptsMenu->addAction(script.name())->setEnabled(false); - } - addMenu(scriptsMenu); - - auto *devToolsAction = addAction(tr("Developer Tools")); - connect(devToolsAction, &QAction::triggered, this, [this]() { - createDevToolsDialog(parentView->page())->show(); - }); -} - -QDialog *PageToolsMenu::createDevToolsDialog(QWebEnginePage *page) -{ - Q_CHECK_PTR(page); - - auto *popup = new QDialog(nullptr); - popup->setWindowTitle(tr("Developer Tools")); - popup->setAttribute(Qt::WA_DeleteOnClose, true); - - auto *view = new QWebEngineView(popup); - auto *devPage = new QWebEnginePage(view); - - view->setPage(devPage); - // page->setDevToolsPage(devPage); - - auto *l = new QVBoxLayout(popup); - l->setContentsMargins(0, 0, 0, 0); - l->addWidget(view); - - return popup; -} diff --git a/src/webengine/widgets/pagetoolsmenu.h b/src/webengine/widgets/pagetoolsmenu.h deleted file mode 100644 index f234d0e..0000000 --- a/src/webengine/widgets/pagetoolsmenu.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This file is part of smolbote. It's copyrighted by the contributors recorded - * in the version control history of the file, available from its original - * location: https://neueland.iserlohn-fortress.net/smolbote.hg - * - * SPDX-License-Identifier: GPL-3.0 - */ - -#ifndef SMOLBOTE_PAGETOOLSMENU_H -#define SMOLBOTE_PAGETOOLSMENU_H - -#include - -class WebView; -class QDialog; -class QWebEnginePage; -class PageToolsMenu : public QMenu -{ - Q_OBJECT -public: - explicit PageToolsMenu(WebView *parent = nullptr); - -public slots: - void createEntries(); - -private: - QDialog *createDevToolsDialog(QWebEnginePage *page); - - WebView *parentView; -}; - -#endif //SMOLBOTE_PAGETOOLSMENU_H -- cgit v1.2.1