From 2d7f9bb2890dd60d47ea0c5641803a905f47cee8 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Fri, 25 Mar 2022 07:38:40 +0100 Subject: [PATCH] remove Qt < 5.12 code as Qt 5.12 is now minimal req. version --- src/librssguard/core/feedsproxymodel.cpp | 5 ----- src/librssguard/gui/feedsview.cpp | 4 ---- src/librssguard/gui/messagesview.cpp | 9 ++------ src/librssguard/gui/reusable/squeezelabel.cpp | 4 ---- src/librssguard/miscellaneous/textfactory.cpp | 4 ---- src/librssguard/network-web/webfactory.cpp | 22 ++++++------------- 6 files changed, 9 insertions(+), 39 deletions(-) diff --git a/src/librssguard/core/feedsproxymodel.cpp b/src/librssguard/core/feedsproxymodel.cpp index 2787dadb9..9fd4fc531 100644 --- a/src/librssguard/core/feedsproxymodel.cpp +++ b/src/librssguard/core/feedsproxymodel.cpp @@ -18,14 +18,9 @@ FeedsProxyModel::FeedsProxyModel(FeedsModel* source_model, QObject* parent) setSortRole(Qt::ItemDataRole::EditRole); setSortCaseSensitivity(Qt::CaseSensitivity::CaseInsensitive); - -#if QT_VERSION >= 0x050A00 // Qt >= 5.10.0 setRecursiveFilteringEnabled(true); -#endif - setFilterKeyColumn(FDS_MODEL_TITLE_INDEX); setFilterRole(LOWER_TITLE_ROLE); - setDynamicSortFilter(true); setSourceModel(m_sourceModel); diff --git a/src/librssguard/gui/feedsview.cpp b/src/librssguard/gui/feedsview.cpp index 07b4fdb14..be31b752f 100644 --- a/src/librssguard/gui/feedsview.cpp +++ b/src/librssguard/gui/feedsview.cpp @@ -532,11 +532,7 @@ void FeedsView::filterItems(const QString& pattern) { m_dontSaveExpandState = false; } -#if QT_VERSION < 0x050C00 // Qt < 5.12.0 - m_proxyModel->setFilterRegExp(pattern.toLower()); -#else m_proxyModel->setFilterRegularExpression(pattern.toLower()); -#endif if (pattern.isEmpty()) { loadAllExpandStates(); diff --git a/src/librssguard/gui/messagesview.cpp b/src/librssguard/gui/messagesview.cpp index 610617c3b..8fe035594 100644 --- a/src/librssguard/gui/messagesview.cpp +++ b/src/librssguard/gui/messagesview.cpp @@ -380,7 +380,6 @@ void MessagesView::initializeContextMenu() { << qApp->mainForm()->m_ui->m_actionSwitchImportanceOfSelectedMessages << qApp->mainForm()->m_ui->m_actionDeleteSelectedMessages); - if (m_sourceModel->loadedItem() != nullptr) { if (m_sourceModel->loadedItem()->kind() == RootItem::Kind::Bin) { m_contextMenu->addAction(qApp->mainForm()->m_ui->m_actionRestoreSelectedMessages); @@ -551,7 +550,7 @@ void MessagesView::openSelectedMessageUrl() { auto msg = m_sourceModel->messageAt(m_proxyModel->mapToSource(rws.at(0)).row()); if (!msg.m_url.isEmpty()) { - emit openLinkMiniBrowser(msg.m_url); + emit openLinkMiniBrowser(msg.m_url); } } } @@ -562,7 +561,7 @@ void MessagesView::sendSelectedMessageViaEmail() { if (!qApp->web()->sendMessageViaEmail(message)) { MsgBox::show(this, QMessageBox::Critical, tr("Problem with starting external e-mail client"), - tr("External e-mail client could not be started.")); + tr("External e-mail client could not be started.")); } } } @@ -771,11 +770,7 @@ void MessagesView::searchMessages(const QString& pattern) { << "Running search of messages with pattern" << QUOTE_W_SPACE_DOT(pattern); -#if QT_VERSION < 0x050C00 // Qt < 5.12.0 - m_proxyModel->setFilterRegExp(pattern.toLower()); -#else m_proxyModel->setFilterRegularExpression(pattern.toLower()); -#endif if (selectionModel()->selectedRows().isEmpty()) { emit currentMessageRemoved(); diff --git a/src/librssguard/gui/reusable/squeezelabel.cpp b/src/librssguard/gui/reusable/squeezelabel.cpp index 29620d216..35cd90f23 100644 --- a/src/librssguard/gui/reusable/squeezelabel.cpp +++ b/src/librssguard/gui/reusable/squeezelabel.cpp @@ -9,11 +9,7 @@ void SqueezeLabel::paintEvent(QPaintEvent* event) { m_squeezedTextCache = text(); QFontMetrics fm = fontMetrics(); -#if QT_VERSION >= 0x050B00 // Qt >= 5.11.0 if (fm.horizontalAdvance(m_squeezedTextCache) > contentsRect().width()) { -#else - if (fm.width(m_squeezedTextCache) > contentsRect().width()) { -#endif setText(fm.elidedText(text(), Qt::ElideMiddle, width())); } } diff --git a/src/librssguard/miscellaneous/textfactory.cpp b/src/librssguard/miscellaneous/textfactory.cpp index 54ca6ab2e..c99620698 100644 --- a/src/librssguard/miscellaneous/textfactory.cpp +++ b/src/librssguard/miscellaneous/textfactory.cpp @@ -53,11 +53,7 @@ int TextFactory::stringWidth(const QString& string, const QFontMetrics& metrics) int width = 0; for (const QString& line : lines) { -#if QT_VERSION >= 0x050B00 // Qt >= 5.11.0 int line_width = metrics.horizontalAdvance(line); -#else - int line_width = metrics.width(line); -#endif if (line_width > width) { width = line_width; diff --git a/src/librssguard/network-web/webfactory.cpp b/src/librssguard/network-web/webfactory.cpp index e1fc9676a..87bbf3792 100644 --- a/src/librssguard/network-web/webfactory.cpp +++ b/src/librssguard/network-web/webfactory.cpp @@ -102,13 +102,13 @@ bool WebFactory::openUrlInExternalBrowser(const QString& url) const { if (!result) { // We display GUI information that browser was not probably opened. MsgBox::show(qApp->mainFormWidget(), - QMessageBox::Icon::Critical, - tr("Navigate to website manually"), - tr("%1 was unable to launch your web browser with the given URL, you need to open the " - "below website URL in your web browser manually.").arg(QSL(APP_NAME)), - {}, - url, - QMessageBox::StandardButton::Ok); + QMessageBox::Icon::Critical, + tr("Navigate to website manually"), + tr("%1 was unable to launch your web browser with the given URL, you need to open the " + "below website URL in your web browser manually.").arg(QSL(APP_NAME)), + {}, + url, + QMessageBox::StandardButton::Ok); } return result; @@ -317,20 +317,12 @@ void WebFactory::createMenu(QMenu* menu) { actions << createEngineSettingsAction(tr("Allow geolocation on insecure origins"), QWebEngineSettings::WebAttribute::AllowGeolocationOnInsecureOrigins); #endif -#if QT_VERSION >= 0x050A00 // Qt >= 5.10.0 actions << createEngineSettingsAction(tr("JS can activate windows"), QWebEngineSettings::WebAttribute::AllowWindowActivationFromJavaScript); actions << createEngineSettingsAction(tr("Show scrollbars"), QWebEngineSettings::WebAttribute::ShowScrollBars); -#endif - -#if QT_VERSION >= 0x050B00 // Qt >= 5.11.0 actions << createEngineSettingsAction(tr("Media playback with gestures"), QWebEngineSettings::WebAttribute::PlaybackRequiresUserGesture); actions << createEngineSettingsAction(tr("WebRTC uses only public interfaces"), QWebEngineSettings::WebAttribute::WebRTCPublicInterfacesOnly); actions << createEngineSettingsAction(tr("JS can paste from clipboard"), QWebEngineSettings::WebAttribute::JavascriptCanPaste); -#endif - -#if QT_VERSION >= 0x050C00 // Qt >= 5.12.0 actions << createEngineSettingsAction(tr("DNS prefetch enabled"), QWebEngineSettings::WebAttribute::DnsPrefetchEnabled); -#endif #if QT_VERSION >= 0x050D00 // Qt >= 5.13.0 actions << createEngineSettingsAction(tr("PDF viewer enabled"), QWebEngineSettings::WebAttribute::PdfViewerEnabled);