diff options
Diffstat (limited to 'desktop-widgets/usermanual.cpp')
-rw-r--r-- | desktop-widgets/usermanual.cpp | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/desktop-widgets/usermanual.cpp b/desktop-widgets/usermanual.cpp index 445f3755d..f0a91c175 100644 --- a/desktop-widgets/usermanual.cpp +++ b/desktop-widgets/usermanual.cpp @@ -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) { |