Skip to content

Commit

Permalink
About: remove webengine
Browse files Browse the repository at this point in the history
  • Loading branch information
KangLin committed Oct 26, 2024
1 parent 73000d1 commit d7b1c05
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 100 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
ANDROID_ABI: ${{matrix.ANDROID_ABI}}
ANDROID_PLATFORM: android-28
ANDROID_NATIVE_API_LEVEL: 28
qt_modules: 'qtimageformats qtmultimedia qtscxml qtwebchannel qtwebsockets qtwebview'
qt_modules: 'qtscxml'

# Map the job outputs to step outputs
outputs:
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ jobs:
qt_arch: [clang_64]
include:
- qt_version: 6.6.2
qt_modules: qtscxml qtwebengine qtwebchannel qtwebsockets qtwebview qtpositioning
qt_modules: 'qtscxml'

- qt_version: 5.15.2
qt_modules: qtwebengine

- qt_version: 5.12.12
qt_modules: qtwebengine

# See: https://docs.github.com/zh/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners
# See: https://github.com/actions/runner-images/tree/main
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/msvc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
VCPKG_PLATFORM_TOOLSET: v143
qt_arch: win64_msvc2019_64
CMAKE_GENERATOR_PLATFORM: x64
qt_modules: qtscxml qtwebchannel qtwebsockets qtwebview qtpositioning
qt_modules: qtscxml

- qt_version: 5.15.2
VCPKG_TARGET_TRIPLET: x64-windows
Expand All @@ -49,7 +49,7 @@ jobs:
CMAKE_GENERATOR_PLATFORM: ${{matrix.CMAKE_GENERATOR_PLATFORM}}
RabbitCommon_VERSION: v2.2.6
VCPKGGITCOMMITID: 59aeb8fe8fe1c980de6bd5ba634cf21024522d81
qt_modules: qtwebengine ${{matrix.qt_modules}}
qt_modules: ${{matrix.qt_modules}}
artifact_name: build_msvc

# Map the job outputs to step outputs
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/qmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ jobs:
debhelper fakeroot \
qttools5-dev qttools5-dev-tools qtbase5-dev qtbase5-dev-tools \
qtmultimedia5-dev qtlocation5-dev libqt5svg5-dev \
qtpositioning5-dev qtwebengine5-dev \
libcmark-gfm-dev libcmark-gfm-extensions-dev
- name: Build RabbitCommon
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ jobs:
debhelper fakeroot \
qt6-tools-dev qt6-tools-dev-tools qt6-base-dev qt6-base-dev-tools \
qt6-l10n-tools qt6-translations-l10n qt6-scxml-dev \
qt6-webengine-dev qt6-webengine-dev-tools \
libcmark-gfm-dev libcmark-gfm-extensions-dev \
libcmark-dev cmark
Expand Down
8 changes: 0 additions & 8 deletions Src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,6 @@ if(WITH_CMARK_GFM)
endif()
endif(WITH_CMARK_GFM)

if(cmark_FOUND OR cmark-gfm_FOUND)
find_package(Qt${QT_VERSION_MAJOR}WebEngineWidgets)
if(Qt${QT_VERSION_MAJOR}WebEngineWidgets_FOUND)
list(APPEND RabbitCommon_PRIVATE_DEFINITIONS HAVE_WebEngineWidgets)
LIST(APPEND _QT_COMPONENTS WebEngineWidgets)
endif()
endif()

cmake_dependent_option(BUILD_UPDATE "Set to ON to build update function" ON
WITH_GUI OFF)
if(BUILD_UPDATE)
Expand Down
64 changes: 23 additions & 41 deletions Src/DlgAbout/DlgAbout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ Module Name:

#include "Information.h"

#ifdef HAVE_WebEngineWidgets
#include <QWebEngineView>
#endif
#include <QTextEdit>
#include <QFile>
#include <QDir>
Expand Down Expand Up @@ -99,26 +96,17 @@ CDlgAbout::CDlgAbout(QWidget *parent) :
Q_ASSERT(check);
m_Download->Start(urls);

#if (defined(HAVE_CMARK) || defined (HAVE_CMARK_GFM)) && defined(HAVE_WebEngineWidgets)
m_pLicense = new QWebEngineView(ui->tabWidget);
m_pChangeLog = new QWebEngineView(ui->tabWidget);
m_pThanks = new QWebEngineView(ui->tabWidget);
#endif
if(!m_pLicense) {
m_pLicense = new QTextEdit(ui->tabWidget);
if(m_pLicense)
qobject_cast<QTextEdit*>(m_pLicense)->setReadOnly(true);
}
if(!m_pChangeLog) {
m_pChangeLog = new QTextEdit(ui->tabWidget);
if(m_pChangeLog)
qobject_cast<QTextEdit*>(m_pChangeLog)->setReadOnly(false);
}
if(!m_pThanks) {
m_pThanks = new QTextEdit(ui->tabWidget);
if(m_pThanks)
qobject_cast<QTextEdit*>(m_pThanks)->setReadOnly(false);
}
m_pLicense = new QTextEdit(ui->tabWidget);
if(m_pLicense)
qobject_cast<QTextEdit*>(m_pLicense)->setReadOnly(true);

m_pChangeLog = new QTextEdit(ui->tabWidget);
if(m_pChangeLog)
qobject_cast<QTextEdit*>(m_pChangeLog)->setReadOnly(false);

m_pThanks = new QTextEdit(ui->tabWidget);
if(m_pThanks)
qobject_cast<QTextEdit*>(m_pThanks)->setReadOnly(false);

AppendFile(m_pChangeLog, "ChangeLog", tr("Change log"));
AppendFile(m_pLicense, "License", tr("License"));
Expand Down Expand Up @@ -196,25 +184,19 @@ int CDlgAbout::AppendFile(QWidget* pWidget, const QString &szFile, const QString
if(readme.open(QFile::ReadOnly))
{
QByteArray text;
QString szHtml;
text = readme.readAll();
#if (defined(HAVE_CMARK) || defined(HAVE_CMARK_GFM)) && defined(HAVE_WebEngineWidgets)
QWebEngineView* pEdit = qobject_cast<QWebEngineView*>(pWidget);
szHtml = MarkDownToHtml(text);
if(szHtml.isEmpty())
szHtml = text;

QTextEdit* pEdit = qobject_cast<QTextEdit*>(pWidget);
if(pEdit) {
QString szText = MarkDownToHtml(text);
if(szText.isEmpty())
szText = text;
pEdit->setHtml(szText);
} else
#endif
{
QTextEdit* pEdit = qobject_cast<QTextEdit*>(pWidget);
if(pEdit) {
pEdit->append(text);
//把光标移动文档开始处
QTextCursor cursor = pEdit->textCursor();
cursor.movePosition(QTextCursor::Start);
pEdit->setTextCursor(cursor);
}
pEdit->setHtml(szHtml);
//把光标移动文档开始处
QTextCursor cursor = pEdit->textCursor();
cursor.movePosition(QTextCursor::Start);
pEdit->setTextCursor(cursor);
}

readme.close();
Expand Down Expand Up @@ -337,7 +319,7 @@ QString CDlgAbout::Version()
m_szHomePage + "/tree/" + m_szVersionRevision;
}
szVersion = tr("Version: ") + m_szVersion + tr(" (From revision: ")
#if (defined(HAVE_CMARK) || defined(HAVE_CMARK_GFM)) && defined(HAVE_WebEngineWidgets)
#if (defined(HAVE_CMARK) || defined(HAVE_CMARK_GFM))
+ "<a href=\"" + m_szVersionRevisionUrl + "\">"
+ m_szVersionRevision + "</a>"
#else
Expand Down
35 changes: 11 additions & 24 deletions Src/DlgAbout/Information.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

#include <QLibraryInfo>
#include <QHostInfo>
#ifdef HAVE_WebEngineWidgets
#include <QWebEngineView>
#endif
#include <QTextEdit>
#include <QStandardPaths>
#include <QProcessEnvironment>
Expand Down Expand Up @@ -152,25 +149,15 @@ void CInformation::SetContext(const QString& szTitle, const QString& szContext)
return;
}

#if (defined(HAVE_CMARK) || defined(HAVE_CMARK_GFM)) && defined(HAVE_WebEngineWidgets)
QWebEngineView* pEdit = new QWebEngineView(ui->tabWidget);
if(pEdit) {
pEdit->setHtml(CDlgAbout::MarkDownToHtml(szContext));
pEdit->show();
ui->tabWidget->addTab(pEdit, szTitle);
} else
#endif
{
QTextEdit* pEdit = new QTextEdit(ui->tabWidget);
if(!pEdit) return;
pEdit->setReadOnly(true);
pEdit->setWordWrapMode(QTextOption::NoWrap);
ui->tabWidget->addTab(pEdit, szTitle);
pEdit->append(szContext);
//把光标移动文档开始处
QTextCursor cursor = pEdit->textCursor();
cursor.movePosition(QTextCursor::Start);
pEdit->setTextCursor(cursor);
pEdit->show();
}
QTextEdit* pEdit = new QTextEdit(ui->tabWidget);
if(!pEdit) return;
pEdit->setReadOnly(true);
pEdit->setWordWrapMode(QTextOption::NoWrap);
ui->tabWidget->addTab(pEdit, szTitle);
pEdit->setHtml(CDlgAbout::MarkDownToHtml(szContext));
//把光标移动文档开始处
QTextCursor cursor = pEdit->textCursor();
cursor.movePosition(QTextCursor::Start);
pEdit->setTextCursor(cursor);
pEdit->show();
}
22 changes: 8 additions & 14 deletions Src/RabbitCommonTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ QString CTools::Version()
szReturn = QObject::tr("Version: ") + szVersion;
} else {
szReturn = QObject::tr("Version: ") + szVersion + QObject::tr(" (From revision: ");
#if (defined(HAVE_CMARK) || defined(HAVE_CMARK_GFM)) && defined(HAVE_WebEngineWidgets)
szReturn += "[" + szRevision + "](http://github.com/KangLin/RabbitCommon/tree/" + szRevision + ")";
#if (defined(HAVE_CMARK) || defined(HAVE_CMARK_GFM))
szReturn += "[" + szRevision + "](http://github.com/KangLin/RabbitCommon/tree/" + szRevision + ")";
#else
szReturn += szRevision;
szReturn += szRevision;
#endif
szReturn += ") ";
}
Expand All @@ -170,14 +170,11 @@ QString CTools::Information()
#endif
#if defined(HAVE_ABOUT)
szInfo += QObject::tr(" - Have about diaglog") + "\n";
// #ifdef HAVE_CMARK_GFM
// szInfo += QObject::tr(" - Use cmark-gfm") + "\n";
// #elif HAVE_CMARK
// szInfo += QObject::tr(" - Use cmark") + "\n";
// #endif
// #ifdef HAVE_WebEngineWidgets
// szInfo += QObject::tr(" - Use WebEngineWidgets") + "\n";
// #endif
#ifdef HAVE_CMARK_GFM
szInfo += QObject::tr(" - Use cmark-gfm") + "\n";
#elif HAVE_CMARK
szInfo += QObject::tr(" - Use cmark") + "\n";
#endif
#endif
#if defined(HAVE_UPDATE)
szInfo += QObject::tr(" - Have update") + "\n";
Expand Down Expand Up @@ -234,9 +231,6 @@ QString CTools::Information()
szInfo += QObject::tr(" - cmark-gfm") + "\n";
#elif HAVE_CMARK
szInfo += QObject::tr(" - cmark") + "\n";
#endif
#ifdef HAVE_WebEngineWidgets
szInfo += QObject::tr(" - WebEngineWidgets") + "\n";
#endif
return szInfo;
}
Expand Down
5 changes: 0 additions & 5 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ parts:
- qttools5-dev
- qtbase5-dev
- libqt5scxml5-dev
# - qtwebengine5-dev
# - qtwebengine5-dev-tools
# - qtwebengine5-private-dev
- libqt5svg5-dev
- cmark
- libcmark-dev
Expand All @@ -47,8 +44,6 @@ parts:
- libssl3
- libcrypt1
- libqt5scxml5
#- libqt5webengine5
- libqt5webenginewidgets5
- libqt5svg5
- libqt5xml5
stage:
Expand Down

0 comments on commit d7b1c05

Please sign in to comment.