aboutsummaryrefslogtreecommitdiff
path: root/src/webengine/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/webengine/widgets')
-rw-r--r--src/webengine/widgets/pagetoolsmenu.cpp62
-rw-r--r--src/webengine/widgets/pagetoolsmenu.h32
2 files changed, 0 insertions, 94 deletions
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 <QDialog>
-#include <QVBoxLayout>
-#include <QWebEnginePage>
-#include <QWebEngineProfile>
-#include <QWebEngineScriptCollection>
-#include <QWebEngineView>
-
-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 <QMenu>
-
-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