From f8b64fbc38eead48cbccff4f75d11d3224b400dd Mon Sep 17 00:00:00 2001
From: ctrlaltca
Date: Tue, 28 Nov 2023 10:38:17 +0100
Subject: [PATCH] Remove QWebEngine usage in core. Rewrite web package manager
(#2570)
* Remove use of QWebEngine from help module
* Rewrite the WebPackageManagementDialog to use an http/json API instead of a webpage; drop QWebEngine usage
* Edited repository urls to https://kvirc.github.io/
---
src/kvirc/ui/KviHtmlDialog.h | 1 -
.../ui/KviWebPackageManagementDialog.cpp | 380 +++++++++++-------
src/kvirc/ui/KviWebPackageManagementDialog.h | 66 +--
src/modules/addon/AddonManagementDialog.cpp | 28 +-
src/modules/addon/AddonManagementDialog.h | 5 +-
src/modules/addon/WebAddonInterfaceDialog.cpp | 9 +-
src/modules/addon/WebAddonInterfaceDialog.h | 4 -
src/modules/help/HelpWidget.cpp | 137 -------
src/modules/help/HelpWidget.h | 29 --
src/modules/help/HelpWindow.cpp | 16 -
src/modules/help/HelpWindow.h | 12 +-
src/modules/help/libkvihelp.cpp | 12 -
src/modules/theme/ThemeFunctions.cpp | 6 +-
src/modules/theme/ThemeManagementDialog.cpp | 17 +-
src/modules/theme/ThemeManagementDialog.h | 4 -
src/modules/theme/WebThemeInterfaceDialog.cpp | 8 +-
src/modules/theme/WebThemeInterfaceDialog.h | 4 -
17 files changed, 297 insertions(+), 441 deletions(-)
diff --git a/src/kvirc/ui/KviHtmlDialog.h b/src/kvirc/ui/KviHtmlDialog.h
index 538b112e3d..d5666e72d5 100644
--- a/src/kvirc/ui/KviHtmlDialog.h
+++ b/src/kvirc/ui/KviHtmlDialog.h
@@ -96,7 +96,6 @@ class KviTextBrowser : public QTextBrowser
virtual QVariant loadResource(int type, const QUrl & name)
{
QString p = m_pHt->htmlResource.value(name.path());
- qDebug("resource %s type %d and page %s", name.path().toUtf8().data(), type, p.toUtf8().data());
if(!p.isEmpty())
return QVariant(p);
else
diff --git a/src/kvirc/ui/KviWebPackageManagementDialog.cpp b/src/kvirc/ui/KviWebPackageManagementDialog.cpp
index d1c98e407f..5f247403fc 100644
--- a/src/kvirc/ui/KviWebPackageManagementDialog.cpp
+++ b/src/kvirc/ui/KviWebPackageManagementDialog.cpp
@@ -26,8 +26,6 @@
#include "KviWebPackageManagementDialog.h"
-#ifdef COMPILE_WEBENGINE_SUPPORT
-
#include "KviLocale.h"
#include "KviApplication.h"
#include "KviMessageBox.h"
@@ -39,12 +37,9 @@
#include
#include
-#include
#include
-#include
#include
#include
-#include
#include
#include
#include
@@ -52,6 +47,80 @@
#include
#include
#include
+#include
+#include
+#include
+#include
+
+#define KVI_WEBPACK_INDEX "index.json"
+
+KviWebPackageListItem::KviWebPackageListItem(KviTalListWidget * pBox, QJsonObject obj, const QString & szBaseUrl)
+ : KviTalListWidgetItem(pBox)
+{
+ m_szName = obj.value("name").toString();
+ m_szVersion = obj.value("version").toString();
+ m_szAuthor = obj.value("author").toString();
+ m_szDesc = obj.value("desc").toString();
+ m_szScreen = obj.value("screen").toString();
+ m_szDownload = obj.value("download").toString();
+
+ QString szText;
+ szText = "";
+ szText += m_szName;
+ szText += "";
+
+ if(!m_szVersion.isEmpty())
+ {
+ szText += "[";
+ szText += m_szVersion;
+ szText += "]";
+ }
+
+ if(!m_szAuthor.isEmpty())
+ {
+ szText += " ";
+ szText += __tr2qs("by");
+ szText += " ";
+ szText += m_szAuthor;
+ szText += "";
+ }
+
+ szText += "
";
+ szText += m_szDesc;
+ szText += "";
+ setText(szText);
+
+ if(!m_szScreen.isEmpty())
+ {
+ downloadIcon(szBaseUrl + m_szScreen);
+ }
+}
+
+void KviWebPackageListItem::downloadIcon(const QString & szIconUrl)
+{
+ QNetworkRequest req(szIconUrl);
+ QNetworkReply * pReply = KviNetworkAccessManager::getInstance()->get(req);
+ connect(pReply, &QNetworkReply::finished, [this, pReply]() {
+ if (pReply->error() == QNetworkReply::NoError) {
+ QPixmap pixImage;
+ if(pixImage.loadFromData(pReply->readAll()))
+ {
+ setIcon(pixImage);
+ }
+ }
+ pReply->deleteLater();
+ });
+}
+
+void KviWebPackageListItem::showPopupImage()
+{
+ QDialog dlg;
+ QHBoxLayout * l = new QHBoxLayout(&dlg);
+ QLabel * label = new QLabel;
+ l->addWidget(label);
+ label->setPixmap(icon().pixmap(800, 600));
+ dlg.exec();
+}
KviWebPackageManagementDialog::KviWebPackageManagementDialog(QWidget * pParent)
: QWidget(pParent)
@@ -60,125 +129,163 @@ KviWebPackageManagementDialog::KviWebPackageManagementDialog(QWidget * pParent)
setMinimumSize(600, 500);
setWindowIcon(QIcon(*(g_pIconManager->getBigIcon(KVI_BIGICON_WWW))));
- m_pLayout = new QVBoxLayout(this);
- m_pLayout->setContentsMargins(3, 3, 3, 3);
- m_pLayout->setSpacing(2);
-
- setLayout(m_pLayout);
m_bBusy = false;
-
- QWidget * pStatus = new QWidget(this);
- m_pLayout->addWidget(pStatus);
-
- QHBoxLayout * hbox = new QHBoxLayout(pStatus);
-
- m_pToolBar = new QToolBar(pStatus);
- m_pProgressBar = new QProgressBar(pStatus);
- m_pProgressBar->setMaximumWidth(220);
- m_pProgressBar->setMinimumWidth(220);
- hbox->addWidget(m_pToolBar);
- hbox->addWidget(m_pProgressBar);
- hbox->setAlignment(m_pProgressBar, Qt::AlignRight);
-
- m_pWebView = new QWebEngineView(this);
- // we managing the links
- m_pWebView->setPage(new KviWebPackagePage());
-
- m_pLayout->addWidget(m_pWebView);
- m_pLayout->setStretchFactor(m_pWebView, 10); // must take most space
- // disable context menu
- m_pWebView->setContextMenuPolicy(Qt::NoContextMenu);
- m_pToolBar->addAction(m_pWebView->pageAction(QWebEnginePage::Back));
- m_pToolBar->addAction(m_pWebView->pageAction(QWebEnginePage::Forward));
-
- //connect(pWebView,SIGNAL(loadStarted()),this,SLOT(slotLoadStarted()));
- connect(m_pWebView, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished(bool)));
- connect(m_pWebView, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
- connect(m_pWebView->page(), SIGNAL(linkClicked(const QUrl &)), this, SLOT(slotLinkClicked(const QUrl &)));
+ m_pContextPopup = new QMenu(this);
+
+ QVBoxLayout * pVBox = new QVBoxLayout(this);
+ KviTalHBox * pHBox = new KviTalHBox(this);
+ pHBox->setContentsMargins(1, 1, 1, 1);
+ pHBox->setSpacing(1);
+ pVBox->addWidget(pHBox);
+
+ m_pPreviewButton = new QToolButton(pHBox);
+ m_pPreviewButton->setIcon(*(g_pIconManager->getBigIcon(KVI_BIGICON_THEME)));
+ m_pPreviewButton->setIconSize(QSize(32, 32));
+ m_pPreviewButton->setToolTip(__tr2qs("Show item preview"));
+ connect(m_pPreviewButton, SIGNAL(clicked()), this, SLOT(showItemPreview()));
+
+ m_pDeleteButton = new QToolButton(pHBox);
+ m_pDeleteButton->setIcon(*(g_pIconManager->getBigIcon(KVI_BIGICON_PACK)));
+ m_pDeleteButton->setIconSize(QSize(32, 32));
+ m_pDeleteButton->setToolTip(__tr2qs("Download selected item"));
+ connect(m_pDeleteButton, SIGNAL(clicked()), this, SLOT(downloadItem()));
+
+ QWidget * w = new QWidget(pHBox);
+ w->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
+
+ m_pProgressBar = new QProgressBar(this);
+ pVBox->addWidget(m_pProgressBar);
+
+ m_pListWidget = new KviTalListWidget(this);
+ m_pListWidget->setContextMenuPolicy(Qt::CustomContextMenu);
+ m_pItemDelegate = new KviTalIconAndRichTextItemDelegate(m_pListWidget);
+ m_pItemDelegate->setDefaultIcon(g_pIconManager->getBigIcon(QString(KVI_BIGICON_THEME))->scaled(64, 64, Qt::KeepAspectRatio));
+ m_pItemDelegate->setMinimumSize(QSize(64, 64));
+ m_pItemDelegate->setIconSize(QSize(64, 64));
+ m_pListWidget->setItemDelegate(m_pItemDelegate);
+ m_pListWidget->setMinimumHeight(400);
+ m_pListWidget->setMinimumWidth(520);
+
+ m_pListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
+ m_pListWidget->setSortingEnabled(true);
+ // connect(m_pListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(applyTheme(QListWidgetItem *)));
+
+ connect(m_pListWidget, SIGNAL(customContextMenuRequested(const QPoint &)),
+ this, SLOT(contextMenuRequested(const QPoint &)));
+ connect(m_pListWidget, SIGNAL(itemSelectionChanged()), this, SLOT(enableDisableButtons()));
+
+ pVBox->addWidget(m_pListWidget);
}
KviWebPackageManagementDialog::~KviWebPackageManagementDialog()
{
- KviWebPackagePage *tmp = (KviWebPackagePage*) m_pWebView->page();
- m_pWebView->setPage(nullptr);
- tmp->deleteLater();
+ m_pItemDelegate->deleteLater();
+ m_pListWidget->deleteLater();
}
void KviWebPackageManagementDialog::setPackagePageUrl(const QString & szUrl)
{
m_szPackagePageUrl = szUrl;
- m_pWebView->load(QUrl(m_szPackagePageUrl));
+ QNetworkRequest req(m_szPackagePageUrl + KVI_WEBPACK_INDEX);
+ QNetworkReply * pReply = KviNetworkAccessManager::getInstance()->get(req);
+ connect(pReply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(slotDataTransferProgress(qint64, qint64)));
+ connect(pReply, &QNetworkReply::finished, [this, pReply]() {
+ m_pProgressBar->hide();
+ m_pProgressBar->setValue(0);
+
+ if (pReply->error() == QNetworkReply::NoError) {
+ QByteArray szJsonData = pReply->readAll();
+ QJsonParseError jsonError{};
+ QJsonDocument jsonResponse = QJsonDocument::fromJson(szJsonData, &jsonError);
+
+ if (jsonError.error == QJsonParseError::NoError && jsonResponse.isArray()) {
+ QJsonArray jsonArray = jsonResponse.array();
+
+ foreach(QJsonValue jsonValue, jsonArray)
+ {
+ if(!jsonValue.isObject())
+ continue;
+ KviWebPackageListItem * item = new KviWebPackageListItem(m_pListWidget, jsonValue.toObject(), m_szPackagePageUrl);
+ }
+ }
+ } else {
+ QMessageBox::critical(this, __tr2qs("Error"), __tr2qs("Network error: %1.").arg(pReply->errorString()));
+ }
+
+ pReply->deleteLater();
+ enableDisableButtons();
+ });
+
+ enableDisableButtons();
+ m_pProgressBar->show();
}
-void KviWebPackageManagementDialog::slotLoadFinished(bool bOk)
+void KviWebPackageManagementDialog::enableDisableButtons()
{
- if(!bOk)
+ QList itemsSelected = m_pListWidget->selectedItems();
+ if(itemsSelected.count() == 0)
{
- qDebug("Error loading page"); // fixme: add warning dialog
+ m_pPreviewButton->setEnabled(false);
+ m_pDeleteButton->setEnabled(false);
return;
}
- m_pProgressBar->hide();
- m_pProgressBar->setValue(0);
+ KviWebPackageListItem * pItem = dynamic_cast(itemsSelected.at(0));
- if(!isVisible())
- show();
-
- m_pWebView->page()->runJavaScript("var items = "" \
- Array.from(document.querySelectorAll(\"div.item_entry\")).forEach( \
- function(element, index, array) { \
- items += index + \"|\" + element.querySelector(\"span.item_id\").innerText + \"|\" + element.querySelector(\"span.item_version\").innerText + \"\\n\" \
- })",
- [this](const QVariant &items) {
- QStringList elementscollection = items.toString().split("\n", Qt::SkipEmptyParts);
- foreach(const QString element, elementscollection)
- {
- QStringList tmp = element.split("|");
- if(tmp.size() != 3)
- continue;
-
- // web element 'title'
- QString szIndex = tmp.at(0);
- // string title
- QString szId = tmp.at(1);
- // number version
- QString szVersion = tmp.at(2);
- // is the theme installed?
- if(packageIsInstalled(szId, szVersion))
- {
- // change the background color to highlight the item
- m_pWebView->page()->runJavaScript(QString("var item = document.querySelectorAll(\"div.item_entry\")[%1]; \
- item.querySelector(\"div.item_identification\").style.background = \"none repeat scroll 0 0 #3cd543\"; \
- item.querySelector(\"a.item_download_link\").innerText = \"Reinstall\";").arg(szIndex));
- }
+ m_pPreviewButton->setEnabled(!pItem->icon().isNull());
+ m_pDeleteButton->setEnabled(!packageIsInstalled(pItem->name(), pItem->version()));
+}
- }
- }
- );
+void KviWebPackageManagementDialog::contextMenuRequested(const QPoint & pos)
+{
+ KviWebPackageListItem * pItem = dynamic_cast(m_pListWidget->itemAt(pos));
+ if(pItem == nullptr)
+ return;
+
+ m_pListWidget->setCurrentItem(pItem);
+ m_pContextPopup->clear();
+
+ if(!pItem->icon().isNull())
+ {
+ m_pContextPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Canvas)), __tr2qs("Show Preview"), pItem, SLOT(showPopupImage()));
+ }
+
+ if(!packageIsInstalled(pItem->name(), pItem->version()))
+ m_pContextPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Package)), __tr2qs("Download"), this, SLOT(downloadItem()));
+
+ m_pContextPopup->popup(m_pListWidget->viewport()->mapToGlobal(pos));
+}
+
+void KviWebPackageManagementDialog::showItemPreview()
+{
+ QList itemsSelected = m_pListWidget->selectedItems();
+ if(itemsSelected.count() == 0)
+ return;
+
+ KviWebPackageListItem * pItem = dynamic_cast(itemsSelected.at(0));
+ pItem->showPopupImage();
}
-void KviWebPackageManagementDialog::slotLinkClicked(const QUrl & url)
+
+void KviWebPackageManagementDialog::downloadItem()
{
+ QList itemsSelected = m_pListWidget->selectedItems();
+ if(itemsSelected.count() == 0)
+ return;
+
+ KviWebPackageListItem * pItem = dynamic_cast(itemsSelected.at(0));
+
// check if one download is running
if(m_bBusy)
return;
- QString szScheme = url.scheme();
- // it's an ftp link?
- if(KviQString::equalCI(szScheme, "ftp"))
- {
- // one download at once
- m_bBusy = true;
- QNetworkRequest req(url);
- QNetworkReply * pReply = KviNetworkAccessManager::getInstance()->get(req);
- connect(pReply, SIGNAL(finished()), this, SLOT(slotCommandFinished()));
- connect(pReply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(slotDataTransferProgress(qint64, qint64)));
+ m_bBusy = true;
- m_pProgressBar->show();
- return;
- }
+ QNetworkRequest req(m_szPackagePageUrl + pItem->download());
+ QNetworkReply * pReply = KviNetworkAccessManager::getInstance()->get(req);
+ connect(pReply, SIGNAL(finished()), this, SLOT(slotDownloadFinished()));
+ connect(pReply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(slotDataTransferProgress(qint64, qint64)));
m_pProgressBar->show();
- m_pWebView->load(url);
}
void KviWebPackageManagementDialog::slotDataTransferProgress(qint64 iDone, qint64 iTotal)
@@ -188,58 +295,49 @@ void KviWebPackageManagementDialog::slotDataTransferProgress(qint64 iDone, qint6
m_pProgressBar->setFormat(__tr2qs("Downloading: %p%"));
}
-void KviWebPackageManagementDialog::slotLoadProgress(int iProgress)
+void KviWebPackageManagementDialog::slotDownloadFinished()
{
- m_pProgressBar->setMaximum(100);
- m_pProgressBar->setValue(iProgress);
- m_pProgressBar->setFormat(__tr2qs("Loading: %p%"));
-}
-
-void KviWebPackageManagementDialog::slotCommandFinished()
-{
- QNetworkReply * reply = qobject_cast(sender());
+ QNetworkReply * pReply = qobject_cast(sender());
m_pProgressBar->hide();
m_pProgressBar->setValue(0);
- if(reply)
+ if(pReply == nullptr)
+ return;
+
+ if(pReply->error() != QNetworkReply::NoError)
{
- if(reply->error() == QNetworkReply::NoError)
- {
- //read data from reply
- QString szUrl = reply->url().toString();
- int iIdx = szUrl.lastIndexOf("/");
- QString szFile = szUrl.right(szUrl.length() - iIdx - 1);
- QFile tmpFile;
- g_pApp->getLocalKvircDirectory(m_szLocalTemporaryPath, KviApplication::Tmp, szFile);
- tmpFile.setFileName(m_szLocalTemporaryPath);
- tmpFile.open(QIODevice::ReadWrite);
- tmpFile.write(reply->readAll());
- tmpFile.close();
-
- QString szError;
- if(!installPackage(m_szLocalTemporaryPath, szError))
- {
- KviMessageBox::information(szError);
- }
- else
- {
- m_pWebView->load(QUrl(m_szPackagePageUrl));
- }
- QFileInfo info(m_szLocalTemporaryPath);
+ // get http status code
+ int httpStatus = pReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
+ KviMessageBox::information(__tr2qs("Download failed: %1").arg(pReply->errorString()));
+ pReply->deleteLater();
+ return;
+ }
- if(info.exists())
- KviFileUtils::removeFile(m_szLocalTemporaryPath);
- m_bBusy = false;
- }
- else
- {
- //get http status code
- int httpStatus = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
- KviMessageBox::information(__tr2qs("Download failed: %1").arg(reply->errorString()));
- }
- reply->deleteLater();
+ // read data from reply
+ QString szUrl = pReply->url().toString();
+ int iIdx = szUrl.lastIndexOf("/");
+ QString szFile = szUrl.right(szUrl.length() - iIdx - 1);
+ QFile tmpFile;
+ g_pApp->getLocalKvircDirectory(m_szLocalTemporaryPath, KviApplication::Tmp, szFile);
+ tmpFile.setFileName(m_szLocalTemporaryPath);
+ tmpFile.open(QIODevice::ReadWrite);
+ tmpFile.write(pReply->readAll());
+ tmpFile.close();
+
+ QString szError;
+ if(!installPackage(m_szLocalTemporaryPath, szError))
+ {
+ KviMessageBox::information(szError);
}
+ QFileInfo info(m_szLocalTemporaryPath);
+
+ if(info.exists())
+ KviFileUtils::removeFile(m_szLocalTemporaryPath);
+
+ m_bBusy = false;
+ enableDisableButtons();
+ pReply->deleteLater();
}
void KviWebPackageManagementDialog::showEvent(QShowEvent *)
@@ -248,5 +346,3 @@ void KviWebPackageManagementDialog::showEvent(QShowEvent *)
QRect rect = g_pMainWindow->screen()->availableGeometry();
move(rect.x() + ((rect.width() - width()) / 2), rect.y() + ((rect.height() - height()) / 2));
}
-
-#endif //COMPILE_WEBENGINE_SUPPORT
diff --git a/src/kvirc/ui/KviWebPackageManagementDialog.h b/src/kvirc/ui/KviWebPackageManagementDialog.h
index ec4103b84f..ccbad15df0 100644
--- a/src/kvirc/ui/KviWebPackageManagementDialog.h
+++ b/src/kvirc/ui/KviWebPackageManagementDialog.h
@@ -27,37 +27,41 @@
#include "kvi_settings.h"
-#ifdef COMPILE_WEBENGINE_SUPPORT
-
#include
-#include
+#include
+#include "KviTalListWidget.h"
class QToolBar;
-class QVBoxLayout;
-class QWebEngineView;
+class QToolButton;
class QFile;
class QProgressBar;
class QUrl;
+class QTableWidget;
+class QMehu;
-class KviWebPackagePage : public QWebEnginePage
+class KviWebPackageListItem : public QObject, public KviTalListWidgetItem
{
- Q_OBJECT
-public:
- KviWebPackagePage(QObject* parent = 0) : QWebEnginePage(parent){}
-
- bool acceptNavigationRequest(const QUrl & url, QWebEnginePage::NavigationType type, bool)
- {
- if (type == QWebEnginePage::NavigationTypeLinkClicked)
- {
- emit linkClicked(url);
- return false;
- }
- return true;
- }
+ Q_OBJECT
-signals:
- void linkClicked(const QUrl&);
+public:
+ KviWebPackageListItem(KviTalListWidget * pBox, QJsonObject obj, const QString & szBaseUrl);
+ ~KviWebPackageListItem() {};
+protected:
+ QString m_szName;
+ QString m_szVersion;
+ QString m_szAuthor;
+ QString m_szDesc;
+ QString m_szScreen;
+ QString m_szDownload;
+
+ void downloadIcon(const QString & szIconUrl);
+public:
+ const QString & name() { return m_szName; };
+ const QString & version() { return m_szVersion; };
+ const QString & download() { return m_szDownload; };
+public slots:
+ void showPopupImage();
};
///
@@ -84,12 +88,15 @@ class KVIRC_API KviWebPackageManagementDialog : public QWidget
private:
QToolBar * m_pToolBar;
- QVBoxLayout * m_pLayout;
- QWebEngineView * m_pWebView;
+ KviTalIconAndRichTextItemDelegate * m_pItemDelegate;
+ KviTalListWidget * m_pListWidget;
bool m_bBusy;
QProgressBar * m_pProgressBar;
QString m_szPackagePageUrl;
QString m_szLocalTemporaryPath;
+ QMenu * m_pContextPopup;
+ QToolButton * m_pPreviewButton;
+ QToolButton * m_pDeleteButton;
protected:
void setPackagePageUrl(const QString & szUrl);
@@ -99,15 +106,12 @@ class KVIRC_API KviWebPackageManagementDialog : public QWidget
virtual bool installPackage(const QString & szPath, QString & szError) = 0;
protected slots:
-
- void slotLoadFinished(bool ok);
- void slotLoadProgress(int iProgress);
+ void enableDisableButtons();
+ void contextMenuRequested(const QPoint & pos);
+ void showItemPreview();
+ void downloadItem();
void slotDataTransferProgress(qint64 iDone, qint64 iTotal);
- void slotCommandFinished();
- void slotLinkClicked(const QUrl & url);
-
+ void slotDownloadFinished();
}; // class KviWebPackageManagementDialog
-#endif //COMPILE_WEBENGINE_SUPPORT
-
#endif //!_KviWebPackageManagementDialog_h_
diff --git a/src/modules/addon/AddonManagementDialog.cpp b/src/modules/addon/AddonManagementDialog.cpp
index 1e2316c7e9..bc67931f69 100644
--- a/src/modules/addon/AddonManagementDialog.cpp
+++ b/src/modules/addon/AddonManagementDialog.cpp
@@ -56,9 +56,7 @@
#include
#include
-#ifdef COMPILE_WEBENGINE_SUPPORT
#include "WebAddonInterfaceDialog.h"
-#endif //COMPILE_WEBENGINE_SUPPORT
AddonManagementDialog * AddonManagementDialog::m_pInstance = nullptr;
extern QRect g_rectManagementDialogGeometry;
@@ -98,9 +96,7 @@ AddonManagementDialog::AddonManagementDialog(QWidget * p)
setObjectName("Addon manager");
setWindowIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Addons)));
-#ifdef COMPILE_WEBENGINE_SUPPORT
m_pWebInterfaceDialog = nullptr;
-#endif //COMPILE_WEBENGINE_SUPPORT
m_pInstance = this;
QGridLayout * g = new QGridLayout(this);
@@ -200,10 +196,8 @@ AddonManagementDialog::AddonManagementDialog(QWidget * p)
AddonManagementDialog::~AddonManagementDialog()
{
-#ifdef COMPILE_WEBENGINE_SUPPORT
if(m_pWebInterfaceDialog)
delete m_pWebInterfaceDialog;
-#endif //COMPILE_WEBENGINE_SUPPORT
g_rectManagementDialogGeometry = QRect(pos().x(), pos().y(), size().width(), size().height());
m_pInstance = nullptr;
}
@@ -292,14 +286,22 @@ void AddonManagementDialog::uninstallScript()
void AddonManagementDialog::getMoreScripts()
{
-#ifdef COMPILE_WEBENGINE_SUPPORT
if(m_pWebInterfaceDialog)
- return;
- m_pWebInterfaceDialog = new WebAddonInterfaceDialog();
-#else //!COMPILE_WEBENGINE_SUPPORT
- // If change this introducing not-fixed text, remember to escape this using KviQString::escapeKvs()!
- KviKvsScript::run("openurl http://www.kvirc.net/?id=addons&version=" KVI_VERSION "." KVI_SOURCES_DATE, g_pActiveWindow);
-#endif //!COMPILE_WEBENGINE_SUPPORT
+ {
+ m_pWebInterfaceDialog->show();
+ }
+ else
+ {
+ m_pWebInterfaceDialog = new WebAddonInterfaceDialog();
+ QObject::connect(m_pWebInterfaceDialog, SIGNAL(destroyed()), this, SLOT(webInterfaceDialogDestroyed()));
+ m_pWebInterfaceDialog->show();
+ }
+}
+
+void AddonManagementDialog::webInterfaceDialogDestroyed()
+{
+ m_pWebInterfaceDialog = nullptr;
+ fillListView();
}
void AddonManagementDialog::installScript()
diff --git a/src/modules/addon/AddonManagementDialog.h b/src/modules/addon/AddonManagementDialog.h
index 698d87ac2d..b233c5630b 100644
--- a/src/modules/addon/AddonManagementDialog.h
+++ b/src/modules/addon/AddonManagementDialog.h
@@ -54,9 +54,7 @@ class AddonListViewItem : public KviTalListWidgetItem
KviKvsScriptAddon * addon() { return m_pAddon; };
};
-#ifdef COMPILE_WEBENGINE_SUPPORT
class WebAddonInterfaceDialog;
-#endif //COMPILE_WEBENGINE_SUPPORT
class AddonManagementDialog : public QWidget
{
@@ -74,9 +72,7 @@ class AddonManagementDialog : public QWidget
QToolButton * m_pHelpButton;
QToolButton * m_pPackButton;
QToolButton * m_pUninstallButton;
-#ifdef COMPILE_WEBENGINE_SUPPORT
QPointer m_pWebInterfaceDialog;
-#endif //COMPILE_WEBENGINE_SUPPORT
public:
static AddonManagementDialog * instance() { return m_pInstance; };
static void display(bool bTopLevel);
@@ -94,6 +90,7 @@ protected slots:
void uninstallScript();
void getMoreScripts();
void installScript();
+ void webInterfaceDialogDestroyed();
virtual void reject();
};
diff --git a/src/modules/addon/WebAddonInterfaceDialog.cpp b/src/modules/addon/WebAddonInterfaceDialog.cpp
index bf6ed8ced5..648e205973 100644
--- a/src/modules/addon/WebAddonInterfaceDialog.cpp
+++ b/src/modules/addon/WebAddonInterfaceDialog.cpp
@@ -24,8 +24,6 @@
#include "kvi_settings.h"
-#ifdef COMPILE_WEBENGINE_SUPPORT
-
#include "WebAddonInterfaceDialog.h"
#include "AddonFunctions.h"
@@ -41,10 +39,9 @@ WebAddonInterfaceDialog::WebAddonInterfaceDialog(QWidget * par)
{
setWindowTitle(__tr2qs_ctx("Download Addons - KVIrc", "theme"));
- setPackagePageUrl(
- QString::fromLatin1("https://www.kvirc.net/app/addons.php?version=" KVI_VERSION "&lang=%1")
- .arg(KviLocale::instance()->localeName()));
+ setPackagePageUrl("https://kvirc.github.io/kvirc-addons/");
}
+
WebAddonInterfaceDialog::~WebAddonInterfaceDialog()
= default;
@@ -65,5 +62,3 @@ bool WebAddonInterfaceDialog::packageIsInstalled(const QString & szId, const QSt
// FIXME: If the version of the installed addon is lower than allow upgrading!
return KviMiscUtils::compareVersions(pAddon->version(), szVersion) < 0;
}
-
-#endif //COMPILE_WEBENGINE_SUPPORT
diff --git a/src/modules/addon/WebAddonInterfaceDialog.h b/src/modules/addon/WebAddonInterfaceDialog.h
index 79e2c9180f..a1a202c371 100644
--- a/src/modules/addon/WebAddonInterfaceDialog.h
+++ b/src/modules/addon/WebAddonInterfaceDialog.h
@@ -26,8 +26,6 @@
#include "kvi_settings.h"
-#ifdef COMPILE_WEBENGINE_SUPPORT
-
#include "KviWebPackageManagementDialog.h"
///
@@ -58,6 +56,4 @@ class WebAddonInterfaceDialog : public KviWebPackageManagementDialog
}; // class WebAddonInterfaceDialog
-#endif //COMPILE_WEBENGINE_SUPPORT
-
#endif //!_WebAddonInterfaceDialog_h_
diff --git a/src/modules/help/HelpWidget.cpp b/src/modules/help/HelpWidget.cpp
index 5d9fdfd8ae..5ab827a82a 100644
--- a/src/modules/help/HelpWidget.cpp
+++ b/src/modules/help/HelpWidget.cpp
@@ -45,137 +45,6 @@ extern HelpIndex * g_pDocIndex;
extern KviPointerList * g_pHelpWindowList;
extern KviPointerList * g_pHelpWidgetList;
-#ifdef COMPILE_WEBENGINE_SUPPORT
-#include
-#include
-
-HelpWidget::HelpWidget(QWidget * par, bool bIsStandalone)
- : QWidget(par)
-{
- setObjectName("help_widget");
- setMinimumWidth(80);
- if(bIsStandalone)
- g_pHelpWidgetList->append(this);
- m_bIsStandalone = bIsStandalone;
-
- new QShortcut(QKeySequence::Copy, this, SLOT(slotCopy()), nullptr, Qt::WidgetWithChildrenShortcut);
- new QShortcut(QKeySequence::Find, this, SLOT(slotShowHideFind()), nullptr, bIsStandalone ? Qt::WidgetWithChildrenShortcut : Qt::WindowShortcut);
-
- // layout
- m_pLayout = new QVBoxLayout(this);
- m_pLayout->setContentsMargins(0, 0, 0, 0);
- m_pLayout->setSpacing(0);
- setLayout(m_pLayout);
-
- // upper toolbar
- m_pToolBar = new QToolBar(this);
- m_pLayout->addWidget(m_pToolBar);
-
- // webview
- m_pTextBrowser = new QWebEngineView(this);
- m_pTextBrowser->setObjectName("text_browser");
- m_pTextBrowser->setStyleSheet("QTextBrowser { background-color:white; color:black; }");
- m_pLayout->addWidget(m_pTextBrowser);
- connect(m_pTextBrowser, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished(bool)));
-
- // lower toolbar
- m_pToolBarHighlight = new QToolBar(this);
- m_pLayout->addWidget(m_pToolBarHighlight);
- m_pToolBarHighlight->hide();
-
- QLabel * pHighlightLabel = new QLabel();
- pHighlightLabel->setText(__tr2qs("Find: "));
- m_pToolBarHighlight->addWidget(pHighlightLabel);
-
- m_pFindText = new QLineEdit();
- m_pToolBarHighlight->addWidget(m_pFindText);
- connect(m_pFindText, SIGNAL(textChanged(const QString)), this, SLOT(slotTextChanged(const QString)));
-
- m_pToolBarHighlight->addAction(*g_pIconManager->getBigIcon(KVI_BIGICON_HELPBACK), __tr2qs("Find previous"), this, SLOT(slotFindPrev()));
- m_pToolBarHighlight->addAction(*g_pIconManager->getBigIcon(KVI_BIGICON_HELPFORWARD), __tr2qs("Find next"), this, SLOT(slotFindNext()));
- m_pToolBarHighlight->addAction(*g_pIconManager->getSmallIcon(KviIconManager::Discard), __tr2qs("Close"), this, SLOT(slotShowHideFind()));
-
- // upper toolbar contents (depends on webview)
- m_pToolBar->addAction(*g_pIconManager->getBigIcon(KVI_BIGICON_HELPINDEX), __tr2qs("Show index"), this, SLOT(showIndex()));
-
- QAction * pAction;
- pAction = m_pTextBrowser->pageAction(QWebEnginePage::Back);
- pAction->setIcon(*g_pIconManager->getBigIcon(KVI_BIGICON_HELPBACK));
- m_pToolBar->addAction(pAction);
- pAction = m_pTextBrowser->pageAction(QWebEnginePage::Forward);
- pAction->setIcon(*g_pIconManager->getBigIcon(KVI_BIGICON_HELPFORWARD));
- m_pToolBar->addAction(pAction);
-
- m_pToolBar->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Minus)), __tr2qs("Zoom out"), this, SLOT(slotZoomOut()));
- m_pToolBar->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Plus)), __tr2qs("Zoom in"), this, SLOT(slotZoomIn()));
-
- if(bIsStandalone)
- {
- setAttribute(Qt::WA_DeleteOnClose);
- m_pToolBar->addAction(*g_pIconManager->getBigIcon(KVI_BIGICON_HELPCLOSE), __tr2qs("Close"), this, SLOT(close()));
- }
-}
-
-void HelpWidget::slotCopy()
-{
- m_pTextBrowser->triggerPageAction(QWebEnginePage::Copy);
-}
-
-void HelpWidget::slotShowHideFind()
-{
- if(m_pToolBarHighlight->isVisible())
- {
- m_pToolBarHighlight->hide();
- m_pTextBrowser->findText("");
- }
- else
- {
- m_pToolBarHighlight->show();
- m_pFindText->setFocus();
- }
-}
-
-void HelpWidget::slotLoadFinished(bool)
-{
- m_pTextBrowser->findText(m_pFindText->text());
-}
-
-void HelpWidget::slotTextChanged(const QString szFind)
-{
- m_pTextBrowser->findText("");
- m_pTextBrowser->findText(szFind);
-}
-
-void HelpWidget::slotFindPrev()
-{
- m_pTextBrowser->findText(m_pFindText->text(), QWebEnginePage::FindBackward);
-}
-
-void HelpWidget::slotFindNext()
-{
- m_pTextBrowser->findText(m_pFindText->text());
-}
-
-void HelpWidget::slotZoomIn()
-{
- kvs_real_t dZoom = m_pTextBrowser->zoomFactor();
- if(dZoom >= 2)
- return;
- dZoom += 0.05;
- m_pTextBrowser->setZoomFactor(dZoom);
-}
-
-void HelpWidget::slotZoomOut()
-{
- kvs_real_t dZoom = m_pTextBrowser->zoomFactor();
- if(dZoom <= 0.5)
- return;
- dZoom -= 0.05;
- m_pTextBrowser->setZoomFactor(dZoom);
-}
-
-#else
-
HelpWidget::HelpWidget(QWidget * par, bool bIsStandalone)
: QWidget(par)
{
@@ -223,8 +92,6 @@ HelpWidget::HelpWidget(QWidget * par, bool bIsStandalone)
connect(m_pTextBrowser, SIGNAL(forwardAvailable(bool)), m_pForwardAction, SLOT(setEnabled(bool)));
}
-#endif
-
HelpWidget::~HelpWidget()
{
if(m_bIsStandalone)
@@ -238,9 +105,5 @@ void HelpWidget::showIndex()
g_pApp->getGlobalKvircDirectory(szHelpDir, KviApplication::Help);
dirHelp = QDir(szHelpDir);
-#ifdef COMPILE_WEBENGINE_SUPPORT
- m_pTextBrowser->load(QUrl::fromLocalFile(dirHelp.absoluteFilePath("index.html")));
-#else
m_pTextBrowser->setSource(QUrl::fromLocalFile(dirHelp.absoluteFilePath("index.html")));
-#endif
}
diff --git a/src/modules/help/HelpWidget.h b/src/modules/help/HelpWidget.h
index 732d7a118f..420511de02 100644
--- a/src/modules/help/HelpWidget.h
+++ b/src/modules/help/HelpWidget.h
@@ -27,11 +27,7 @@
#include "HelpIndex.h"
#include "kvi_settings.h"
-#ifdef COMPILE_WEBENGINE_SUPPORT
-#include
-#else
#include
-#endif
#include
#include
#include
@@ -48,45 +44,20 @@ class HelpWidget : public QWidget
~HelpWidget();
private:
-#ifdef COMPILE_WEBENGINE_SUPPORT
- QVBoxLayout * m_pLayout;
- QToolBar * m_pToolBar;
- QToolBar * m_pToolBarHighlight;
- QLineEdit * m_pFindText;
- QWebEngineView * m_pTextBrowser;
-#else
QVBoxLayout * m_pLayout;
QToolBar * m_pToolBar;
QAction * m_pBackAction;
QAction * m_pForwardAction;
QTextBrowser * m_pTextBrowser;
-#endif
bool m_bIsStandalone;
protected slots:
void showIndex();
-#ifdef COMPILE_WEBENGINE_SUPPORT
- void slotLoadFinished(bool ok);
- void slotFindNext();
- void slotFindPrev();
- void slotZoomIn();
- void slotZoomOut();
- void slotTextChanged(const QString);
- void slotCopy();
- void slotShowHideFind();
-#endif
public:
-#ifdef COMPILE_WEBENGINE_SUPPORT
- QWebEngineView * textBrowser()
- {
- return m_pTextBrowser;
- }
-#else
QTextBrowser * textBrowser()
{
return m_pTextBrowser;
}
-#endif
};
#endif //_HELPWIDGET_H_
diff --git a/src/modules/help/HelpWindow.cpp b/src/modules/help/HelpWindow.cpp
index 8c05461e0a..f48778a363 100644
--- a/src/modules/help/HelpWindow.cpp
+++ b/src/modules/help/HelpWindow.cpp
@@ -268,11 +268,7 @@ void HelpWindow::startSearch()
setCursor(Qt::ArrowCursor);
}
-#ifdef COMPILE_WEBENGINE_SUPPORT
-QWebEngineView * HelpWindow::textBrowser()
-#else
QTextBrowser * HelpWindow::textBrowser()
-#endif
{
return m_pHelpWidget->textBrowser();
}
@@ -282,11 +278,7 @@ void HelpWindow::showIndexTopic()
if(m_pIndexSearch->text().isEmpty() || !m_pIndexListWidget->selectedItems().count())
return;
int i = g_pDocIndex->titlesList().indexOf(m_pIndexListWidget->selectedItems().at(0)->text());
-#ifdef COMPILE_WEBENGINE_SUPPORT
- textBrowser()->load(QUrl(g_pDocIndex->documentList()[i]));
-#else
textBrowser()->setSource(QUrl(g_pDocIndex->documentList()[i]));
-#endif
}
void HelpWindow::searchInIndex(const QString & s)
@@ -311,11 +303,7 @@ void HelpWindow::indexSelected(QListWidgetItem * item)
if(!item)
return;
int i = g_pDocIndex->titlesList().indexOf(item->text());
-#ifdef COMPILE_WEBENGINE_SUPPORT
- textBrowser()->load(QUrl(g_pDocIndex->documentList()[i]));
-#else
textBrowser()->setSource(QUrl(g_pDocIndex->documentList()[i]));
-#endif
}
void HelpWindow::searchSelected(QListWidgetItem * item)
@@ -323,11 +311,7 @@ void HelpWindow::searchSelected(QListWidgetItem * item)
if(!item)
return;
int i = g_pDocIndex->titlesList().indexOf(item->text());
-#ifdef COMPILE_WEBENGINE_SUPPORT
- textBrowser()->load(QUrl(g_pDocIndex->documentList()[i]));
-#else
textBrowser()->setSource(QUrl(g_pDocIndex->documentList()[i]));
-#endif
}
QPixmap * HelpWindow::myIconPtr()
diff --git a/src/modules/help/HelpWindow.h b/src/modules/help/HelpWindow.h
index 25de74611a..4aee40f69d 100644
--- a/src/modules/help/HelpWindow.h
+++ b/src/modules/help/HelpWindow.h
@@ -31,17 +31,11 @@
#include "kvi_settings.h"
#include
-#ifdef COMPILE_WEBENGINE_SUPPORT
-#include
-#else
-class QTextBrowser;
-#endif
-
#include
+class QTextBrowser;
class QProgressBar;
class QPushButton;
-
class HelpWidget;
class HelpWindow : public KviWindow
@@ -79,11 +73,7 @@ class HelpWindow : public KviWindow
void loadProperties(KviConfigurationFile * cfg) override;
public:
-#ifdef COMPILE_WEBENGINE_SUPPORT
- QWebEngineView * textBrowser();
-#else
QTextBrowser * textBrowser();
-#endif
public slots:
void indexSelected(QListWidgetItem *);
void searchInIndex(const QString & s);
diff --git a/src/modules/help/libkvihelp.cpp b/src/modules/help/libkvihelp.cpp
index 7eeb4e57e2..9c0b5e5838 100644
--- a/src/modules/help/libkvihelp.cpp
+++ b/src/modules/help/libkvihelp.cpp
@@ -185,11 +185,7 @@ static bool help_kvs_cmd_open(KviKvsModuleCommandCall * c)
if(w)
{
-#ifdef COMPILE_WEBENGINE_SUPPORT
- w->textBrowser()->load(QUrl::fromLocalFile(f.absoluteFilePath()));
-#else
w->textBrowser()->setSource(QUrl::fromLocalFile(f.absoluteFilePath()));
-#endif
HelpWindow * pHelpWindow = g_pHelpWindowList->first();
if (pHelpWindow)
pHelpWindow->delayedAutoRaise();
@@ -199,21 +195,13 @@ static bool help_kvs_cmd_open(KviKvsModuleCommandCall * c)
if(c->switches()->find('m', "mdi"))
{
HelpWindow * w = new HelpWindow("Help browser");
-#ifdef COMPILE_WEBENGINE_SUPPORT
- w->textBrowser()->load(QUrl::fromLocalFile(f.absoluteFilePath()));
-#else
w->textBrowser()->setSource(QUrl::fromLocalFile(f.absoluteFilePath()));
-#endif
g_pMainWindow->addWindow(w);
}
else
{
HelpWidget * w = new HelpWidget(g_pMainWindow->splitter(), true);
-#ifdef COMPILE_WEBENGINE_SUPPORT
- w->textBrowser()->load(QUrl::fromLocalFile(f.absoluteFilePath()));
-#else
w->textBrowser()->setSource(QUrl::fromLocalFile(f.absoluteFilePath()));
-#endif
w->show();
}
diff --git a/src/modules/theme/ThemeFunctions.cpp b/src/modules/theme/ThemeFunctions.cpp
index 0583e9a5a5..0d458e4167 100644
--- a/src/modules/theme/ThemeFunctions.cpp
+++ b/src/modules/theme/ThemeFunctions.cpp
@@ -144,7 +144,7 @@ namespace ThemeFunctions
r.getStringInfoField("Date", szPackageDate);
QString szWarnings;
- QString szDetails = "";
+ QString szDetails = "";
QString szTmp;
int iIdx = 0;
@@ -237,8 +237,8 @@ namespace ThemeFunctions
// clang-format off
hd.szHtmlText = QString(
- "" \
- "" \
+ "" \
+ "" \
"" \
"%1 %2
" \
"
" \
diff --git a/src/modules/theme/ThemeManagementDialog.cpp b/src/modules/theme/ThemeManagementDialog.cpp
index fb6317000e..644197c16e 100644
--- a/src/modules/theme/ThemeManagementDialog.cpp
+++ b/src/modules/theme/ThemeManagementDialog.cpp
@@ -23,10 +23,7 @@
//=============================================================================
#include "kvi_settings.h"
-#if defined(COMPILE_WEBENGINE_SUPPORT)
#include "WebThemeInterfaceDialog.h"
-#endif
-
#include "ThemeManagementDialog.h"
#include "PackThemeDialog.h"
#include "SaveThemeDialog.h"
@@ -113,9 +110,8 @@ ThemeManagementDialog::ThemeManagementDialog(QWidget * parent)
: QWidget(parent)
{
m_pItemDelegate = nullptr;
-#ifdef COMPILE_WEBENGINE_SUPPORT
m_pWebThemeInterfaceDialog = nullptr;
-#endif
+
setObjectName("theme_options_widget");
setWindowTitle(__tr2qs_ctx("Manage Themes - KVIrc", "theme"));
setWindowIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Theme)));
@@ -144,7 +140,6 @@ ThemeManagementDialog::ThemeManagementDialog(QWidget * parent)
m_pPackThemeButton = new QToolButton(pHBox);
m_pPackThemeButton->setIcon(*(g_pIconManager->getBigIcon(KVI_BIGICON_PACK)));
-
m_pPackThemeButton->setIconSize(QSize(32, 32));
m_pPackThemeButton->setToolTip(__tr2qs_ctx("Export selected themes to a distributable package", "theme"));
connect(m_pPackThemeButton, SIGNAL(clicked()), this, SLOT(packTheme()));
@@ -241,13 +236,11 @@ ThemeManagementDialog::~ThemeManagementDialog()
delete m_pItemDelegate;
g_rectManagementDialogGeometry = QRect(pos().x(), pos().y(), size().width(), size().height());
m_pInstance = nullptr;
-#ifdef COMPILE_WEBENGINE_SUPPORT
if(m_pWebThemeInterfaceDialog)
{
m_pWebThemeInterfaceDialog->deleteLater();
m_pWebThemeInterfaceDialog = nullptr;
}
-#endif //COMPILE_WEBENGINE_SUPPORT
}
void ThemeManagementDialog::closeClicked()
@@ -418,7 +411,6 @@ void ThemeManagementDialog::installFromFile()
void ThemeManagementDialog::getMoreThemes()
{
-#ifdef COMPILE_WEBENGINE_SUPPORT
if(m_pWebThemeInterfaceDialog)
{
m_pWebThemeInterfaceDialog->show();
@@ -429,18 +421,11 @@ void ThemeManagementDialog::getMoreThemes()
QObject::connect(m_pWebThemeInterfaceDialog, SIGNAL(destroyed()), this, SLOT(webThemeInterfaceDialogDestroyed()));
m_pWebThemeInterfaceDialog->show();
}
-#else
- if(!g_pMainWindow)
- return;
- g_pMainWindow->executeInternalCommand(KVI_INTERNALCOMMAND_OPENURL_KVIRC_THEMES);
-#endif
}
void ThemeManagementDialog::webThemeInterfaceDialogDestroyed()
{
-#ifdef COMPILE_WEBENGINE_SUPPORT
m_pWebThemeInterfaceDialog = nullptr;
-#endif
fillThemeBox();
}
diff --git a/src/modules/theme/ThemeManagementDialog.h b/src/modules/theme/ThemeManagementDialog.h
index 743cd160af..e82dbbcded 100644
--- a/src/modules/theme/ThemeManagementDialog.h
+++ b/src/modules/theme/ThemeManagementDialog.h
@@ -39,9 +39,7 @@
#include
#include "kvi_settings.h"
-#if defined(COMPILE_WEBENGINE_SUPPORT) || defined(Q_MOC_RUN)
#include "WebThemeInterfaceDialog.h"
-#endif
class QLineEdit;
class QPushButton;
@@ -76,9 +74,7 @@ class ThemeManagementDialog : public QWidget
QMenu * m_pContextPopup;
QToolButton * m_pDeleteThemeButton;
QToolButton * m_pPackThemeButton;
-#if defined(COMPILE_WEBENGINE_SUPPORT) || defined(Q_MOC_RUN)
WebThemeInterfaceDialog * m_pWebThemeInterfaceDialog;
-#endif
public:
static ThemeManagementDialog * instance() { return m_pInstance; }
static void display(bool bTopLevel);
diff --git a/src/modules/theme/WebThemeInterfaceDialog.cpp b/src/modules/theme/WebThemeInterfaceDialog.cpp
index e6eb167115..84c1778456 100644
--- a/src/modules/theme/WebThemeInterfaceDialog.cpp
+++ b/src/modules/theme/WebThemeInterfaceDialog.cpp
@@ -24,8 +24,6 @@
#include "kvi_settings.h"
-#ifdef COMPILE_WEBENGINE_SUPPORT
-
#include "WebThemeInterfaceDialog.h"
#include "ThemeFunctions.h"
@@ -48,9 +46,7 @@ WebThemeInterfaceDialog::WebThemeInterfaceDialog(QWidget * par)
g_pApp->getGlobalKvircDirectory(m_szGlobalThemesPath, KviApplication::Themes);
m_szGlobalThemesPath += KVI_PATH_SEPARATOR_CHAR;
- setPackagePageUrl(
- QString::fromLatin1("https://www.kvirc.net/app/themes.php?version=" KVI_VERSION "&lang=%1")
- .arg(KviLocale::instance()->localeName()));
+ setPackagePageUrl("https://kvirc.github.io/kvirc-themes/");
}
WebThemeInterfaceDialog::~WebThemeInterfaceDialog()
= default;
@@ -67,5 +63,3 @@ bool WebThemeInterfaceDialog::packageIsInstalled(const QString & szId, const QSt
return KviFileUtils::fileExists(m_szGlobalThemesPath + szSubdir) || KviFileUtils::fileExists(m_szLocalThemesPath + szSubdir);
}
-
-#endif //COMPILE_WEBENGINE_SUPPORT
diff --git a/src/modules/theme/WebThemeInterfaceDialog.h b/src/modules/theme/WebThemeInterfaceDialog.h
index c718273914..1db0b18cb6 100644
--- a/src/modules/theme/WebThemeInterfaceDialog.h
+++ b/src/modules/theme/WebThemeInterfaceDialog.h
@@ -26,8 +26,6 @@
#include "kvi_settings.h"
-#ifdef COMPILE_WEBENGINE_SUPPORT
-
#include "KviWebPackageManagementDialog.h"
class WebThemeInterfaceDialog : public KviWebPackageManagementDialog
@@ -46,6 +44,4 @@ class WebThemeInterfaceDialog : public KviWebPackageManagementDialog
bool installPackage(const QString & szPath, QString & szError) override;
};
-#endif //COMPILE_WEBENGINE_SUPPORT
-
#endif //_WEBTHEMEINTERFACEDIALOG_H_