Remove partial support for QWebEngine

Printing never worked, none of this was ever included in test builds. Also, now
that there are official releases of QtWebKit again, this just doesn't seem worth
carrying along anymore.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2019-03-19 12:40:33 -07:00
parent b6c7abc1a7
commit 643f4a5726
7 changed files with 2 additions and 132 deletions

View file

@ -35,27 +35,6 @@ void SearchBar::enableButtons(const QString &s)
ui.findNext->setEnabled(s.length());
}
#ifdef USE_WEBENGINE
MyQWebEnginePage::MyQWebEnginePage(QObject* parent) : QWebEnginePage(parent)
{
}
bool MyQWebEnginePage::acceptNavigationRequest(const QUrl & url, QWebEnginePage::NavigationType type, bool)
{
if (type == QWebEnginePage::NavigationTypeLinkClicked)
{
QDesktopServices::openUrl(url);
return false;
}
return true;
}
MyQWebEngineView::MyQWebEngineView(QWidget* parent)
{
}
#endif
UserManual::UserManual(QWidget *parent) : QDialog(parent)
{
QShortcut *closeKey = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this);
@ -76,20 +55,12 @@ UserManual::UserManual(QWidget *parent) : QDialog(parent)
setWindowTitle(tr("User manual"));
setWindowIcon(QIcon(":subsurface-icon"));
#ifdef USE_WEBENGINE
userManual = new MyQWebEngineView(this);
MyQWebEnginePage *page = new MyQWebEnginePage();
userManual->setPage(page);
#else
userManual = new QWebView(this);
#endif
QString colorBack = palette().highlight().color().name(QColor::HexRgb);
QString colorText = palette().highlightedText().color().name(QColor::HexRgb);
userManual->setStyleSheet(QString("QWebView { selection-background-color: %1; selection-color: %2; }")
.arg(colorBack).arg(colorText));
#ifndef USE_WEBENGINE
userManual->page()->setLinkDelegationPolicy(QWebPage::DelegateExternalLinks);
#endif
QString searchPath = getSubsurfaceDataPath("Documentation");
if (searchPath.size()) {
// look for localized versions of the manual first
@ -114,9 +85,7 @@ UserManual::UserManual(QWidget *parent) : QDialog(parent)
searchBar->hide();
connect(actionShowSearch, SIGNAL(triggered(bool)), searchBar, SLOT(show()));
connect(actionHideSearch, SIGNAL(triggered(bool)), searchBar, SLOT(hide()));
#ifndef USE_WEBENGINE
connect(userManual, SIGNAL(linkClicked(QUrl)), this, SLOT(linkClickedSlot(QUrl)));
#endif
connect(searchBar, SIGNAL(searchTextChanged(QString)), this, SLOT(searchTextChanged(QString)));
connect(searchBar, SIGNAL(searchNext()), this, SLOT(searchNext()));
connect(searchBar, SIGNAL(searchPrev()), this, SLOT(searchPrev()));
@ -128,13 +97,6 @@ UserManual::UserManual(QWidget *parent) : QDialog(parent)
setLayout(vboxLayout);
}
#ifdef USE_WEBENGINE
void UserManual::search(QString text, QWebEnginePage::FindFlags flags = 0)
{
userManual->findText(text, flags,
[this, text](bool found) {searchBar->setStyleSheet(found || text.length() == 0 ? "" : "QLineEdit{background: red;}");});
}
#else
void UserManual::search(QString text, QWebPage::FindFlags flags = 0)
{
if (userManual->findText(text, QWebPage::FindWrapsAroundDocument | flags) || text.length() == 0) {
@ -143,7 +105,6 @@ void UserManual::search(QString text, QWebPage::FindFlags flags = 0)
searchBar->setStyleSheet("QLineEdit{background: red;}");
}
}
#endif
void UserManual::searchTextChanged(const QString& text)
{
@ -158,19 +119,13 @@ void UserManual::searchNext()
void UserManual::searchPrev()
{
#ifdef USE_WEBENGINE
search(mLastText, QWebEnginePage::FindBackward);
#else
search(mLastText, QWebPage::FindBackward);
#endif
}
#ifndef USE_WEBENGINE
void UserManual::linkClickedSlot(const QUrl& url)
{
QDesktopServices::openUrl(url);
}
#endif
#ifdef Q_OS_MAC
void UserManual::showEvent(QShowEvent *e) {