summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt3
-rw-r--r--include/rsettings.hpp32
-rw-r--r--include/rview.hpp (renamed from src/plugins/rview.hpp)17
-rw-r--r--plugins/webengine/CMakeLists.txt2
-rw-r--r--plugins/webengine/WebEngine.json2
-rw-r--r--plugins/webengine/webengineplugin.cpp4
-rw-r--r--plugins/webengine/webengineplugin.hpp3
-rw-r--r--plugins/webengine/webview.cpp24
-rw-r--r--plugins/webengine/webview.h10
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/application.cpp2
-rw-r--r--src/application.hpp10
-rw-r--r--src/application_instance.cpp2
-rw-r--r--src/plugins/rplugininterface.hpp8
-rw-r--r--src/rekonqwindow.cpp (renamed from src/mainwindow/rekonqwindow.cpp)8
-rw-r--r--src/rekonqwindow.h (renamed from src/mainwindow/rekonqwindow.h)4
-rw-r--r--src/rekonqwindow.ui (renamed from src/mainwindow/rekonqwindow.ui)0
-rw-r--r--src/taskmanager.cpp (renamed from src/mainwindow/taskmanager.cpp)0
-rw-r--r--src/taskmanager.h (renamed from src/mainwindow/taskmanager.h)0
-rw-r--r--src/taskmanager.ui (renamed from src/mainwindow/taskmanager.ui)0
20 files changed, 105 insertions, 32 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1e582d88..154e39ba 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -110,7 +110,8 @@ feature_summary(WHAT ALL)
add_subdirectory(plugins/webengine)
add_subdirectory(src)
-add_executable(rekonq ${rekonq_SRCS})
+add_executable(rekonq ${rekonq_SRCS}
+ include/rsettings.hpp include/rview.hpp)
target_include_directories(rekonq PRIVATE src)
target_link_libraries(rekonq
Qt6::Widgets SingleApplication::SingleApplication
diff --git a/include/rsettings.hpp b/include/rsettings.hpp
new file mode 100644
index 00000000..2d90fe3b
--- /dev/null
+++ b/include/rsettings.hpp
@@ -0,0 +1,32 @@
+/* ============================================================
+ * The rekonq project
+ * ============================================================
+ * SPDX-License-Identifier: GPL-3.0-only
+ * Copyright (C) 2022 aqua <aqua@iserlohn-fortress.net>
+ * ============================================================
+ * Description: rekonq settings interface
+ * ============================================================ */
+
+#pragma once
+
+#include <QObject>
+#include <QVariant>
+
+class RekonqSettings : public QObject {
+ Q_OBJECT
+
+public:
+ explicit RekonqSettings(QObject *parent = nullptr) : QObject(parent) {}
+ virtual ~RekonqSettings() = default;
+
+ virtual void beginGroup(const QString &prefix) = 0;
+ virtual void endGroup() = 0;
+
+ virtual void setValue(const QString &key, const QVariant &value) = 0;
+ [[nodiscard]] virtual QVariant value(const QString &key, const QVariant &defaultValue = QVariant()) const = 0;
+
+ [[nodiscard]] virtual QString filePath() const = 0;
+
+signals:
+ void changed(QString, QVariant);
+};
diff --git a/src/plugins/rview.hpp b/include/rview.hpp
index 6f0652d5..46cba67c 100644
--- a/src/plugins/rview.hpp
+++ b/include/rview.hpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
* Copyright (C) 2022 aqua <aqua@iserlohn-fortress.net>
* ============================================================
- * Description: View Interface
+ * Description: rekonq View interface
* ============================================================ */
#pragma once
@@ -12,16 +12,25 @@
#include <QUrl>
#include <QWidget>
-class rView : public QWidget {
+class RekonqView : public QWidget {
Q_OBJECT
public:
- explicit rView(const QUrl &url = QUrl(), QWidget *parent = nullptr) : QWidget(parent) {}
+ explicit RekonqView(const QUrl & = QUrl(), QWidget *parent = nullptr) : QWidget(parent) {}
+ virtual void load(const QUrl &url) = 0;
+ [[nodiscard]] virtual int progress() const = 0;
+
+ [[nodiscard]] virtual QIcon icon() const = 0;
[[nodiscard]] virtual QString title() const = 0;
+ [[nodiscard]] virtual QUrl url() const = 0;
signals:
+ void loadStarted();
+ void loadProgress(int);
+ void loadFinished();
+
void iconChanged(const QIcon &);
- void urlChanged(const QUrl &);
void titleChanged(const QString &);
+ void urlChanged(const QUrl &);
};
diff --git a/plugins/webengine/CMakeLists.txt b/plugins/webengine/CMakeLists.txt
index f49d9c7c..c1f8145d 100644
--- a/plugins/webengine/CMakeLists.txt
+++ b/plugins/webengine/CMakeLists.txt
@@ -2,7 +2,7 @@ add_library(WebEnginePlugin MODULE
webengineplugin.cpp webengineplugin.hpp
webview.cpp webview.h
${PROJECT_SOURCE_DIR}/src/plugins/rplugininterface.hpp
- ${PROJECT_SOURCE_DIR}/src/plugins/rview.hpp
+ ${PROJECT_SOURCE_DIR}/include/rview.hpp
)
target_include_directories(WebEnginePlugin PRIVATE ${PROJECT_SOURCE_DIR}/src/plugins)
target_link_libraries(WebEnginePlugin PUBLIC Qt6::Core Qt6::WebEngineWidgets)
diff --git a/plugins/webengine/WebEngine.json b/plugins/webengine/WebEngine.json
index 03e2112c..8f197186 100644
--- a/plugins/webengine/WebEngine.json
+++ b/plugins/webengine/WebEngine.json
@@ -1,4 +1,4 @@
{
"name": "WebEngine",
- "schemes": [ "file", "http", "https" ]
+ "schemes": [ "about", "file", "http", "https" ]
}
diff --git a/plugins/webengine/webengineplugin.cpp b/plugins/webengine/webengineplugin.cpp
index cf6811dc..0c3f2dcd 100644
--- a/plugins/webengine/webengineplugin.cpp
+++ b/plugins/webengine/webengineplugin.cpp
@@ -10,4 +10,6 @@
#include "webengineplugin.hpp"
#include "webview.h"
-rView *WebEnginePlugin::view(const QUrl &url) { return new WebView(url, nullptr); }
+void WebEnginePlugin::init(RekonqSettings *) {}
+
+RekonqView *WebEnginePlugin::view(const QUrl &url) { return new WebView(url, nullptr); }
diff --git a/plugins/webengine/webengineplugin.hpp b/plugins/webengine/webengineplugin.hpp
index 3ee63ff8..dcbc2db8 100644
--- a/plugins/webengine/webengineplugin.hpp
+++ b/plugins/webengine/webengineplugin.hpp
@@ -19,5 +19,6 @@ class WebEnginePlugin final : public RekonqPluginInterface {
public:
WebEnginePlugin() = default;
- rView *view(const QUrl &url) override;
+ void init(RekonqSettings *settings) override;
+ RekonqView *view(const QUrl &url) override;
};
diff --git a/plugins/webengine/webview.cpp b/plugins/webengine/webview.cpp
index fab941a9..fc2e4642 100644
--- a/plugins/webengine/webview.cpp
+++ b/plugins/webengine/webview.cpp
@@ -11,7 +11,7 @@
#include <QVBoxLayout>
#include <QWebEngineView>
-WebView::WebView(const QUrl &url, QWidget *parent) : rView(url, parent), view(new QWebEngineView(this))
+WebView::WebView(const QUrl &url, QWidget *parent) : RekonqView(url, parent), view(new QWebEngineView(this))
{
auto *layout = new QVBoxLayout;
layout->setContentsMargins(0, 0, 0, 0);
@@ -19,8 +19,28 @@ WebView::WebView(const QUrl &url, QWidget *parent) : rView(url, parent), view(ne
setLayout(layout);
connect(view, &QWebEngineView::iconChanged, this, [this](const QIcon &icon) { emit iconChanged(icon); });
- connect(view, &QWebEngineView::urlChanged, this, [this](const QUrl &url) { emit urlChanged(url); });
+ connect(view, &QWebEngineView::urlChanged, this, [this](const QUrl &u) { emit urlChanged(u); });
connect(view, &QWebEngineView::titleChanged, this, [this](const QString &title) { emit titleChanged(title); });
+
+ // load progress
+ connect(view, &QWebEngineView::loadStarted, this, [this]() {
+ m_loadProgress = 0;
+ emit loadStarted();
+ });
+ connect(view, &QWebEngineView::loadProgress, this, [this](int progress) {
+ m_loadProgress = progress;
+ emit loadProgress(progress);
+ });
+ connect(view, &QWebEngineView::loadFinished, this, [this]() {
+ m_loadProgress = 100;
+ emit loadFinished();
+ });
+
view->load(url);
}
+
+void WebView::load(const QUrl &url) { view->load(url); }
+
+QUrl WebView::url() const { return view->url(); }
QString WebView::title() const { return view->title(); }
+QIcon WebView::icon() const { return view->icon(); }
diff --git a/plugins/webengine/webview.h b/plugins/webengine/webview.h
index 5bb90696..103b98b3 100644
--- a/plugins/webengine/webview.h
+++ b/plugins/webengine/webview.h
@@ -13,15 +13,21 @@
class QWebEngineView;
-class WebView final : public rView {
+class WebView final : public RekonqView {
Q_OBJECT
public:
explicit WebView(const QUrl &url = QUrl(), QWidget *parent = nullptr);
~WebView() final = default;
- QString title() const override;
+ void load(const QUrl &url) override;
+ [[nodiscard]] int progress() const override { return m_loadProgress; }
+
+ [[nodiscard]] QUrl url() const override;
+ [[nodiscard]] QString title() const override;
+ [[nodiscard]] QIcon icon() const override;
private:
QWebEngineView *view;
+ int m_loadProgress = 0;
};
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a48bed28..6bf47516 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -10,10 +10,10 @@ set(rekonq_SRCS
#----------------------------------------
main.cpp application.cpp application_instance.cpp application.hpp
#----------------------------------------
- mainwindow/rekonqwindow.cpp mainwindow/rekonqwindow.h mainwindow/rekonqwindow.ui
- mainwindow/taskmanager.cpp mainwindow/taskmanager.h mainwindow/taskmanager.ui
+ rekonqwindow.cpp rekonqwindow.h rekonqwindow.ui
+ taskmanager.cpp taskmanager.h taskmanager.ui
#----------------------------------------
- plugins/rplugininterface.hpp plugins/rview.hpp
+ plugins/rplugininterface.hpp
#----------------------------------------
)
list(TRANSFORM rekonq_SRCS PREPEND src/)
diff --git a/src/application.cpp b/src/application.cpp
index 126eb020..be4bb4fc 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -347,7 +347,7 @@ RekonqWindow *Application::newWindow()
return window;
}
-rView *Application::newView(const QUrl &url, RekonqWindow *window)
+RekonqView *Application::newView(const QUrl &url, RekonqWindow *window)
{
RekonqPluginInterface *interface = nullptr;
for (const auto &plugin : m_plugins)
diff --git a/src/application.hpp b/src/application.hpp
index ce4bbfd1..7d75af3a 100644
--- a/src/application.hpp
+++ b/src/application.hpp
@@ -11,15 +11,15 @@
#pragma once
-#include "mainwindow/rekonqwindow.h"
#include "rekonq.hpp"
+#include "rekonqwindow.h"
#include <QPointer>
#include <QUrl>
#include <QWidget>
#include <SingleApplication>
// Forward Declarations
-class rView;
+class RekonqView;
class PluginLoader;
// class WebTab;
@@ -27,7 +27,7 @@ class PluginLoader;
typedef QList<QPointer<PluginLoader>> RekonqPluginList;
typedef QList<QPointer<RekonqWindow>> RekonqWindowList;
-typedef QList<QPointer<rView>> RekonqViewList;
+typedef QList<QPointer<RekonqView>> RekonqViewList;
// ---------------------------------------------------------------------------------------------------------------
@@ -75,7 +75,7 @@ public slots:
* @param instanceId if the current instance, check QCoreApplication::arguments instead of @param message
* @param message the command line
*/
- void parseCommandLine(int instanceId, const QByteArray &message);
+ void parseCommandLine(quint32 instanceId, const QByteArray &message);
/**
* Save application's configuration
@@ -95,7 +95,7 @@ public slots:
// RekonqWindow *newWindow(bool withTab = true, bool PrivateBrowsingMode = false);
// RekonqWindow *newWindow(WebPage *pg);
RekonqWindow *newWindow();
- rView *newView(const QUrl &url = QUrl(), RekonqWindow *window = nullptr);
+ RekonqView *newView(const QUrl &url = QUrl(), RekonqWindow *window = nullptr);
// void createWebAppShortcut(const QString & urlString = QString(), const QString & titleString = QString());
diff --git a/src/application_instance.cpp b/src/application_instance.cpp
index 42c77dc1..53dd9885 100644
--- a/src/application_instance.cpp
+++ b/src/application_instance.cpp
@@ -13,7 +13,7 @@
static const char *description = "A lightweight Web Browser based on Qt WebEngine";
-void Application::parseCommandLine(int instanceId, const QByteArray &message)
+void Application::parseCommandLine(quint32 instanceId, const QByteArray &message)
{
// Initialize command line args
QCommandLineParser parser;
diff --git a/src/plugins/rplugininterface.hpp b/src/plugins/rplugininterface.hpp
index 16186591..e45f2422 100644
--- a/src/plugins/rplugininterface.hpp
+++ b/src/plugins/rplugininterface.hpp
@@ -9,15 +9,17 @@
#pragma once
-#include "rview.hpp"
#include <QtPlugin>
+#include <rsettings.hpp>
+#include <rview.hpp>
class RekonqPluginInterface : public QObject {
Q_OBJECT
public:
- virtual rView *view(const QUrl &url) = 0;
+ virtual void init(RekonqSettings *settings) = 0;
+ virtual RekonqView *view(const QUrl &url) = 0;
};
-#define RekonqPluginInterface_iid "rekonq.3.RekongPluginInterface"
+#define RekonqPluginInterface_iid "net.rekonq.3.RekonqPluginInterface/1"
Q_DECLARE_INTERFACE(RekonqPluginInterface, RekonqPluginInterface_iid)
diff --git a/src/mainwindow/rekonqwindow.cpp b/src/rekonqwindow.cpp
index d912bf2a..b1380154 100644
--- a/src/mainwindow/rekonqwindow.cpp
+++ b/src/rekonqwindow.cpp
@@ -10,10 +10,10 @@
* ============================================================ */
#include "rekonqwindow.h"
-#include "../plugins/rview.hpp"
#include "application.hpp"
#include "taskmanager.h"
#include "ui_rekonqwindow.h"
+#include <rview.hpp>
RekonqWindow::RekonqWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::RekonqWindow)
{
@@ -23,10 +23,10 @@ RekonqWindow::RekonqWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::Re
RekonqWindow::~RekonqWindow() { delete ui; }
-void RekonqWindow::addView(rView *view)
+void RekonqWindow::addView(RekonqView *view)
{
const auto tabId = ui->tabWidget->addTab(view, view->title());
- connect(view, &rView::titleChanged, this,
+ connect(view, &RekonqView::titleChanged, this,
[this, tabId](const QString &title) { ui->tabWidget->setTabText(tabId, title); });
}
@@ -158,4 +158,4 @@ SLOT(loadUrl(KUrl,Rekonq::OpenType)));
_historyPanel.clear();
}
}
-*/ \ No newline at end of file
+*/
diff --git a/src/mainwindow/rekonqwindow.h b/src/rekonqwindow.h
index 73d58c04..e6316819 100644
--- a/src/mainwindow/rekonqwindow.h
+++ b/src/rekonqwindow.h
@@ -20,7 +20,7 @@
#include <QSplitter>
// Forward Declarations
-class rView;
+class RekonqView;
// class TabBar;
// class WebPage;
// class WebWindow;
@@ -47,7 +47,7 @@ private:
// void init();
public slots:
- void addView(rView *view);
+ void addView(RekonqView *view);
// void loadUrl(const KUrl &, Rekonq::OpenType type = Rekonq::CurrentTab, TabHistory *history = 0);
private slots:
diff --git a/src/mainwindow/rekonqwindow.ui b/src/rekonqwindow.ui
index 9df36cf2..9df36cf2 100644
--- a/src/mainwindow/rekonqwindow.ui
+++ b/src/rekonqwindow.ui
diff --git a/src/mainwindow/taskmanager.cpp b/src/taskmanager.cpp
index 9025f461..9025f461 100644
--- a/src/mainwindow/taskmanager.cpp
+++ b/src/taskmanager.cpp
diff --git a/src/mainwindow/taskmanager.h b/src/taskmanager.h
index 073464b9..073464b9 100644
--- a/src/mainwindow/taskmanager.h
+++ b/src/taskmanager.h
diff --git a/src/mainwindow/taskmanager.ui b/src/taskmanager.ui
index 8242e43c..8242e43c 100644
--- a/src/mainwindow/taskmanager.ui
+++ b/src/taskmanager.ui