From e5cc7c3131eeea6a7d5fed50dc80ad59eeba395b Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Wed, 31 Mar 2021 11:04:31 +0800 Subject: [PATCH 1/2] [Fix] There still will be rounder corner when kwin effect disabled. --- src/mainwindow.cpp | 6 ++++-- src/settings-widget.cpp | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b869465..43b2859 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -85,7 +85,8 @@ MainWindow::MainWindow(QWidget *parent) : QPainterPath path; auto rect = this->rect(); rect.adjust(1, 1, -1, -1); - path.addRoundedRect(rect, 6, 6); +// path.addRoundedRect(rect, 0, 0); + path.addRect(rect); setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); @@ -484,7 +485,8 @@ void MainWindow::paintEvent(QPaintEvent *event) { p.setBrush(opt.palette.color(QPalette::Base)); p.setOpacity(trans); p.setPen(Qt::NoPen); - p.drawRoundedRect(rect, 6, 6); +// p.drawRoundedRect(rect, 6, 6); + p.drawRect(rect); return QWidget::paintEvent(event); } diff --git a/src/settings-widget.cpp b/src/settings-widget.cpp index d4aefed..c0cae6e 100644 --- a/src/settings-widget.cpp +++ b/src/settings-widget.cpp @@ -439,7 +439,8 @@ void SettingsWidget::paintEvent(QPaintEvent *event) { QPainter p(this); p.setRenderHint(QPainter::Antialiasing); QPainterPath rectPath; - rectPath.addRoundedRect(this->rect(), 6, 6); +// rectPath.addRoundedRect(this->rect(), 6, 6); + rectPath.addRect(this->rect()); // // 画一个黑底 // QPixmap pixmap(this->rect().size()); From bd0db29579ca83a4452acbb9937aa00f6a1919f5 Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Wed, 31 Mar 2021 17:18:56 +0800 Subject: [PATCH 2/2] Remove web search page. --- debian/control | 3 +- src/control/search-detail-view.cpp | 97 +++++++++++++++--------------- src/control/search-detail-view.h | 10 +-- src/src.pro | 2 +- 4 files changed, 56 insertions(+), 56 deletions(-) diff --git a/debian/control b/debian/control index 23aa0fb..d58c01b 100644 --- a/debian/control +++ b/debian/control @@ -16,8 +16,7 @@ Build-Depends: debhelper (>=9.0.0), libkf5windowsystem-dev, libgsettings-qt-dev, libqt5x11extras5-dev, - libuchardet-dev, - qtwebengine5-dev + libuchardet-dev Standards-Version: 4.5.0 Homepage: https://www.ukui.org/ Vcs-Git: https://github.com/ukui/ukui-search.git diff --git a/src/control/search-detail-view.cpp b/src/control/search-detail-view.cpp index 0632c44..b2fc872 100644 --- a/src/control/search-detail-view.cpp +++ b/src/control/search-detail-view.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +//#include #include "config-file.h" SearchDetailView::SearchDetailView(QWidget *parent) : QWidget(parent) @@ -81,9 +81,9 @@ void SearchDetailView::clearLayout() { m_optionView->hide(); m_isEmpty = true; // closeWebWidget(); - if (m_webView) { - m_webView->hide(); - } +// if (m_webView) { +// m_webView->hide(); +// } // m_reload = false; } @@ -124,42 +124,42 @@ void SearchDetailView::setWebWidget(const QString& keyword) clearLayout(); m_isEmpty = false; m_reload = false; - if (m_webView) { - if (QString::compare(keyword, m_currentKeyword) == 0 && m_net_enable) { //关键词没有发生变化,只把原来的网页show出来 - m_webView->show(); - return; - } - } else { - m_webView = new QWebEngineView(this); - m_engineProfile = m_webView->page()->profile(); - m_webView->settings()->setAttribute(QWebEngineSettings::PluginsEnabled, true); - m_webView->setAttribute(Qt::WA_DeleteOnClose); - m_webView->move(0, 0); - m_webView->setFixedSize(378, 522); +// if (m_webView) { +// if (QString::compare(keyword, m_currentKeyword) == 0 && m_net_enable) { //关键词没有发生变化,只把原来的网页show出来 +// m_webView->show(); +// return; +// } +// } else { +// m_webView = new QWebEngineView(this); +// m_engineProfile = m_webView->page()->profile(); +// m_webView->settings()->setAttribute(QWebEngineSettings::PluginsEnabled, true); +// m_webView->setAttribute(Qt::WA_DeleteOnClose); +// m_webView->move(0, 0); +// m_webView->setFixedSize(378, 522); - connect(m_webView,&QWebEngineView::loadFinished, this, [ = ](bool is_successful){ - m_reload = true; - if (m_engineProfile){ - m_engineProfile->clearHttpCache(); // 清理缓存 - m_engineProfile->clearAllVisitedLinks(); // 清理浏览记录 - m_engineProfile->cookieStore()->deleteAllCookies(); // 清理cookie - m_engineProfile->cookieStore()->deleteSessionCookies(); // 清理会话cookie - } - if (is_successful) { - m_webView->show(); - m_net_enable = true; - } else { - m_noNetFrame->show(); - m_net_enable = false; - } - }); - connect(m_webView, &QWebEngineView::urlChanged, this, [ = ](const QUrl& url) { - if (m_reload) { - QDesktopServices::openUrl(url); - closeWebWidget(); - } - }); - } +// connect(m_webView,&QWebEngineView::loadFinished, this, [ = ](bool is_successful){ +// m_reload = true; +// if (m_engineProfile){ +// m_engineProfile->clearHttpCache(); // 清理缓存 +// m_engineProfile->clearAllVisitedLinks(); // 清理浏览记录 +// m_engineProfile->cookieStore()->deleteAllCookies(); // 清理cookie +// m_engineProfile->cookieStore()->deleteSessionCookies(); // 清理会话cookie +// } +// if (is_successful) { +// m_webView->show(); +// m_net_enable = true; +// } else { +// m_noNetFrame->show(); +// m_net_enable = false; +// } +// }); +// connect(m_webView, &QWebEngineView::urlChanged, this, [ = ](const QUrl& url) { +// if (m_reload) { +// QDesktopServices::openUrl(url); +// closeWebWidget(); +// } +// }); +// } //如果使用非手机版百度跳转,请使用RequestInterceptor类 // RequestInterceptor * interceptor = new RequestInterceptor(m_webView); // QWebEngineProfile * profile = new QWebEngineProfile(m_webView); @@ -173,20 +173,21 @@ void SearchDetailView::setWebWidget(const QString& keyword) QString engine = GlobalSettings::getInstance()->getValue(WEB_ENGINE).toString(); if (!engine.isEmpty()) { if (engine == "360") { - address = "https://m.so.com/s?q=" + keyword; //360 + address = "https://so.com/s?q=" + keyword; //360 } else if (engine == "sougou") { - address = "https://wap.sogou.com/web/searchList.jsp?&keyword=" + keyword; //搜狗 + address = "https://www.sogou.com/web?query=" + keyword; //搜狗 } else { - address = "http://m.baidu.com/s?word=" + keyword; //百度 + address = "http://baidu.com/s?word=" + keyword; //百度 } } else { //默认值 - address = "http://m.baidu.com/s?word=" + keyword; //百度 + address = "http://baidu.com/s?word=" + keyword; //百度 } + QDesktopServices::openUrl(address); // QString str = "http://m.baidu.com/s?word=" + keyword; //百度 // QString str = "https://m.so.com/s?q=" + keyword; //360 // QString str = "https://wap.sogou.com/web/searchList.jsp?&keyword=" + keyword; //搜狗 - m_webView->load(address); +// m_webView->load(address); // m_webView->show(); } @@ -236,10 +237,10 @@ void SearchDetailView::setAppWidget(const QString &appname, const QString &path, void SearchDetailView::closeWebWidget() { - if (m_webView) { - m_webView->close(); - m_webView = NULL; - } +// if (m_webView) { +// m_webView->close(); +// m_webView = NULL; +// } } QString SearchDetailView::getHtmlText(const QString & text, const QString & keyword) { diff --git a/src/control/search-detail-view.h b/src/control/search-detail-view.h index 506baf4..cbf89b5 100644 --- a/src/control/search-detail-view.h +++ b/src/control/search-detail-view.h @@ -22,9 +22,9 @@ #define SEARCHDETAILVIEW_H #include -#include -#include -#include +//#include +//#include +//#include //#include #include #include "option-view.h" @@ -94,8 +94,8 @@ private: QLabel * m_noNetIconLabel = nullptr; QLabel * m_noNetTipsLabel = nullptr; - QWebEngineView * m_webView = nullptr; - QWebEngineProfile * m_engineProfile = nullptr; +// QWebEngineView * m_webView = nullptr; +// QWebEngineProfile * m_engineProfile = nullptr; bool m_reload = false; bool m_net_enable = true; QString m_currentKeyword; diff --git a/src/src.pro b/src/src.pro index bb24369..9b1133f 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,4 +1,4 @@ -QT += core gui dbus KWindowSystem xml x11extras webenginewidgets +QT += core gui dbus KWindowSystem xml x11extras greaterThan(QT_MAJOR_VERSION, 4): QT += widgets