make it all work with qt6
This commit is contained in:
parent
0c753b493d
commit
729453a06a
24 changed files with 131 additions and 37 deletions
|
@ -14,10 +14,10 @@ APP_URL_DOCUMENTATION = "https://github.com/martinrotter/rssguard/blob/m
|
||||||
APP_USERAGENT = "RSS Guard/$$APP_VERSION (github.com/martinrotter/rssguard)"
|
APP_USERAGENT = "RSS Guard/$$APP_VERSION (github.com/martinrotter/rssguard)"
|
||||||
APP_DONATE_URL = "https://martinrotter.github.io/donate"
|
APP_DONATE_URL = "https://martinrotter.github.io/donate"
|
||||||
|
|
||||||
message(rssguard: Welcome RSS Guard qmake script.)
|
message($$MSG_PREFIX: Welcome RSS Guard qmake script.)
|
||||||
|
|
||||||
lessThan(QT_MAJOR_VERSION, 5)|lessThan(QT_MINOR_VERSION, 9) {
|
!versionAtLeast(QT_VERSION, 5.9.0) {
|
||||||
warning(rssguard: At least Qt \"5.9.0\" is required!!!)
|
warning($$MSG_PREFIX: At least Qt \"5.9.0\" is required!!!)
|
||||||
}
|
}
|
||||||
|
|
||||||
isEmpty(USE_WEBENGINE) {
|
isEmpty(USE_WEBENGINE) {
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<url type="donation">https://github.com/sponsors/martinrotter</url>
|
<url type="donation">https://github.com/sponsors/martinrotter</url>
|
||||||
<content_rating type="oars-1.1" />
|
<content_rating type="oars-1.1" />
|
||||||
<releases>
|
<releases>
|
||||||
<release version="4.0.4" date="2021-10-21"/>
|
<release version="4.0.4" date="2021-10-29"/>
|
||||||
</releases>
|
</releases>
|
||||||
<content_rating type="oars-1.0">
|
<content_rating type="oars-1.0">
|
||||||
<content_attribute id="violence-cartoon">none</content_attribute>
|
<content_attribute id="violence-cartoon">none</content_attribute>
|
||||||
|
|
4
src/librssguard/3rd-party/sc/simplecrypt.cpp
vendored
4
src/librssguard/3rd-party/sc/simplecrypt.cpp
vendored
|
@ -104,7 +104,7 @@ QByteArray SimpleCrypt::encryptToByteArray(QByteArray plaintext) {
|
||||||
flags |= CryptoFlagChecksum;
|
flags |= CryptoFlagChecksum;
|
||||||
QDataStream s(&integrityProtection, QIODevice::WriteOnly);
|
QDataStream s(&integrityProtection, QIODevice::WriteOnly);
|
||||||
|
|
||||||
s << qChecksum(ba.constData(), ba.length());
|
s << qChecksum(ba);
|
||||||
}
|
}
|
||||||
else if (m_protectionMode == ProtectionHash) {
|
else if (m_protectionMode == ProtectionHash) {
|
||||||
flags |= CryptoFlagHash;
|
flags |= CryptoFlagHash;
|
||||||
|
@ -228,7 +228,7 @@ QByteArray SimpleCrypt::decryptToByteArray(QByteArray cypher) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ba = ba.mid(2);
|
ba = ba.mid(2);
|
||||||
quint16 checksum = qChecksum(ba.constData(), ba.length());
|
quint16 checksum = qChecksum(ba);
|
||||||
|
|
||||||
integrityOk = (checksum == storedChecksum);
|
integrityOk = (checksum == storedChecksum);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <QSqlError>
|
#include <QSqlError>
|
||||||
#include <QSqlField>
|
#include <QSqlField>
|
||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
||||||
|
#include <QSqlResult>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
DatabaseFactory::DatabaseFactory(QObject* parent)
|
DatabaseFactory::DatabaseFactory(QObject* parent)
|
||||||
|
@ -82,6 +83,8 @@ DatabaseDriver* DatabaseFactory::driverForType(DatabaseDriver::DriverType d) con
|
||||||
|
|
||||||
QString DatabaseFactory::lastExecutedQuery(const QSqlQuery& query) {
|
QString DatabaseFactory::lastExecutedQuery(const QSqlQuery& query) {
|
||||||
QString str = query.lastQuery();
|
QString str = query.lastQuery();
|
||||||
|
|
||||||
|
#if QT_VERSION_MAJOR == 5
|
||||||
QMapIterator<QString, QVariant> it(query.boundValues());
|
QMapIterator<QString, QVariant> it(query.boundValues());
|
||||||
|
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
|
@ -95,6 +98,7 @@ QString DatabaseFactory::lastExecutedQuery(const QSqlQuery& query) {
|
||||||
str.replace(it.key(), it.value().toString());
|
str.replace(it.key(), it.value().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1344,7 +1344,7 @@ QPair<int, int> DatabaseQueries::updateMessages(QSqlDatabase db,
|
||||||
|
|
||||||
for (int i = 0; i < msgs_to_insert.size(); i += 1000) {
|
for (int i = 0; i < msgs_to_insert.size(); i += 1000) {
|
||||||
QStringList vals;
|
QStringList vals;
|
||||||
int batch_length = std::min(1000, msgs_to_insert.size() - i);
|
int batch_length = std::min(1000, int(msgs_to_insert.size()) - i);
|
||||||
|
|
||||||
for (int l = i; l < (i + batch_length); l++) {
|
for (int l = i; l < (i + batch_length); l++) {
|
||||||
Message* msg = msgs_to_insert[l];
|
Message* msg = msgs_to_insert[l];
|
||||||
|
|
|
@ -594,7 +594,7 @@ RootItem* FormMessageFiltersManager::selectedCategoryFeed() const {
|
||||||
Message FormMessageFiltersManager::testingMessage() const {
|
Message FormMessageFiltersManager::testingMessage() const {
|
||||||
Message msg;
|
Message msg;
|
||||||
|
|
||||||
msg.m_feedId = NO_PARENT_CATEGORY;
|
msg.m_feedId = QString::number(NO_PARENT_CATEGORY);
|
||||||
msg.m_url = m_ui.m_txtSampleUrl->text();
|
msg.m_url = m_ui.m_txtSampleUrl->text();
|
||||||
msg.m_customId = m_ui.m_txtSampleUrl->text();
|
msg.m_customId = m_ui.m_txtSampleUrl->text();
|
||||||
msg.m_title = m_ui.m_txtSampleTitle->text();
|
msg.m_title = m_ui.m_txtSampleTitle->text();
|
||||||
|
|
|
@ -292,7 +292,7 @@ void MessagesView::initializeContextMenu() {
|
||||||
for (const ExternalTool& tool : qAsConst(tools)) {
|
for (const ExternalTool& tool : qAsConst(tools)) {
|
||||||
QAction* act_tool = new QAction(QFileInfo(tool.executable()).fileName(), menu_ext_tools);
|
QAction* act_tool = new QAction(QFileInfo(tool.executable()).fileName(), menu_ext_tools);
|
||||||
|
|
||||||
act_tool->setIcon(icon_provider.icon(tool.executable()));
|
act_tool->setIcon(icon_provider.icon(QFileInfo(tool.executable())));
|
||||||
act_tool->setToolTip(tool.executable());
|
act_tool->setToolTip(tool.executable());
|
||||||
act_tool->setData(QVariant::fromValue(tool));
|
act_tool->setData(QVariant::fromValue(tool));
|
||||||
menu_ext_tools->addAction(act_tool);
|
menu_ext_tools->addAction(act_tool);
|
||||||
|
|
|
@ -70,7 +70,12 @@ bool SettingsGui::eventFilter(QObject* obj, QEvent* e) {
|
||||||
if (e->type() == QEvent::Type::Drop) {
|
if (e->type() == QEvent::Type::Drop) {
|
||||||
auto* drop_event = static_cast<QDropEvent*>(e);
|
auto* drop_event = static_cast<QDropEvent*>(e);
|
||||||
|
|
||||||
if (drop_event->keyboardModifiers() != Qt::KeyboardModifier::NoModifier) {
|
#if QT_VERSION_MAJOR == 6
|
||||||
|
if (drop_event->modifiers() !=
|
||||||
|
#else
|
||||||
|
if (drop_event->keyboardModifiers() !=
|
||||||
|
#endif
|
||||||
|
Qt::KeyboardModifier::NoModifier) {
|
||||||
drop_event->setDropAction(Qt::DropAction::MoveAction);
|
drop_event->setDropAction(Qt::DropAction::MoveAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
#include <QToolTip>
|
#include <QToolTip>
|
||||||
|
#include <QWebEngineProfile>
|
||||||
#include <QWebEngineSettings>
|
#include <QWebEngineSettings>
|
||||||
#include <QWidgetAction>
|
#include <QWidgetAction>
|
||||||
|
|
||||||
|
@ -118,10 +119,10 @@ void WebBrowser::reloadFontSettings() {
|
||||||
fon.fromString(qApp->settings()->value(GROUP(Messages),
|
fon.fromString(qApp->settings()->value(GROUP(Messages),
|
||||||
SETTING(Messages::PreviewerFontStandard)).toString());
|
SETTING(Messages::PreviewerFontStandard)).toString());
|
||||||
|
|
||||||
QWebEngineSettings::defaultSettings()->setFontFamily(QWebEngineSettings::FontFamily::StandardFont, fon.family());
|
QWebEngineProfile::defaultProfile()->settings()->setFontFamily(QWebEngineSettings::FontFamily::StandardFont, fon.family());
|
||||||
QWebEngineSettings::defaultSettings()->setFontFamily(QWebEngineSettings::FontFamily::SerifFont, fon.family());
|
QWebEngineProfile::defaultProfile()->settings()->setFontFamily(QWebEngineSettings::FontFamily::SerifFont, fon.family());
|
||||||
QWebEngineSettings::defaultSettings()->setFontFamily(QWebEngineSettings::FontFamily::SansSerifFont, fon.family());
|
QWebEngineProfile::defaultProfile()->settings()->setFontFamily(QWebEngineSettings::FontFamily::SansSerifFont, fon.family());
|
||||||
QWebEngineSettings::defaultSettings()->setFontSize(QWebEngineSettings::DefaultFontSize, fon.pointSize());
|
QWebEngineProfile::defaultProfile()->settings()->setFontSize(QWebEngineSettings::DefaultFontSize, fon.pointSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebBrowser::increaseZoom() {
|
void WebBrowser::increaseZoom() {
|
||||||
|
@ -215,6 +216,12 @@ void WebBrowser::initializeLayout() {
|
||||||
m_actionForward->setText(tr("Forward"));
|
m_actionForward->setText(tr("Forward"));
|
||||||
m_actionReload->setText(tr("Reload"));
|
m_actionReload->setText(tr("Reload"));
|
||||||
m_actionStop->setText(tr("Stop"));
|
m_actionStop->setText(tr("Stop"));
|
||||||
|
|
||||||
|
m_actionBack->setIcon(qApp->icons()->fromTheme(QSL("go-previous")));
|
||||||
|
m_actionForward->setIcon(qApp->icons()->fromTheme(QSL("go-next")));
|
||||||
|
m_actionReload->setIcon(qApp->icons()->fromTheme(QSL("reload")));
|
||||||
|
m_actionStop->setIcon(qApp->icons()->fromTheme(QSL("process-stop")));
|
||||||
|
|
||||||
QWidgetAction* act_discover = new QWidgetAction(this);
|
QWidgetAction* act_discover = new QWidgetAction(this);
|
||||||
|
|
||||||
m_actionOpenInSystemBrowser->setEnabled(false);
|
m_actionOpenInSystemBrowser->setEnabled(false);
|
||||||
|
@ -228,6 +235,7 @@ void WebBrowser::initializeLayout() {
|
||||||
m_toolBar->addAction(m_actionOpenInSystemBrowser);
|
m_toolBar->addAction(m_actionOpenInSystemBrowser);
|
||||||
m_toolBar->addAction(act_discover);
|
m_toolBar->addAction(act_discover);
|
||||||
m_toolBar->addWidget(m_txtLocation);
|
m_toolBar->addWidget(m_txtLocation);
|
||||||
|
|
||||||
m_loadingProgress = new QProgressBar(this);
|
m_loadingProgress = new QProgressBar(this);
|
||||||
m_loadingProgress->setFixedHeight(5);
|
m_loadingProgress->setFixedHeight(5);
|
||||||
m_loadingProgress->setMinimum(0);
|
m_loadingProgress->setMinimum(0);
|
||||||
|
@ -240,7 +248,7 @@ void WebBrowser::initializeLayout() {
|
||||||
m_layout->addWidget(m_webView);
|
m_layout->addWidget(m_webView);
|
||||||
m_layout->addWidget(m_loadingProgress);
|
m_layout->addWidget(m_loadingProgress);
|
||||||
m_layout->addWidget(m_searchWidget);
|
m_layout->addWidget(m_searchWidget);
|
||||||
m_layout->setMargin(0);
|
m_layout->setContentsMargins({ 0, 0, 0, 0 });
|
||||||
m_layout->setSpacing(0);
|
m_layout->setSpacing(0);
|
||||||
|
|
||||||
m_searchWidget->hide();
|
m_searchWidget->hide();
|
||||||
|
|
|
@ -16,9 +16,15 @@
|
||||||
#include "network-web/webpage.h"
|
#include "network-web/webpage.h"
|
||||||
|
|
||||||
#include <QFileIconProvider>
|
#include <QFileIconProvider>
|
||||||
#include <QOpenGLWidget>
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
#if QT_VERSION_MAJOR == 6
|
||||||
|
#include <QWebEngineContextMenuRequest>
|
||||||
|
#else
|
||||||
|
#include <QOpenGLWidget>
|
||||||
#include <QWebEngineContextMenuData>
|
#include <QWebEngineContextMenuData>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
|
|
||||||
WebViewer::WebViewer(QWidget* parent) : QWebEngineView(parent), m_root(nullptr) {
|
WebViewer::WebViewer(QWidget* parent) : QWebEngineView(parent), m_root(nullptr) {
|
||||||
|
@ -186,13 +192,22 @@ void WebViewer::clear() {
|
||||||
|
|
||||||
void WebViewer::contextMenuEvent(QContextMenuEvent* event) {
|
void WebViewer::contextMenuEvent(QContextMenuEvent* event) {
|
||||||
event->accept();
|
event->accept();
|
||||||
|
|
||||||
|
#if QT_VERSION_MAJOR == 6
|
||||||
|
QMenu* menu = createStandardContextMenu();
|
||||||
|
auto* menu_pointer = lastContextMenuRequest();
|
||||||
|
QWebEngineContextMenuRequest& menu_data = *menu_pointer;
|
||||||
|
#else
|
||||||
QMenu* menu = page()->createStandardContextMenu();
|
QMenu* menu = page()->createStandardContextMenu();
|
||||||
QWebEngineContextMenuData menu_data = page()->contextMenuData();
|
QWebEngineContextMenuData menu_data = page()->contextMenuData();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (menu_data.linkUrl().isValid()) {
|
if (menu_data.linkUrl().isValid()) {
|
||||||
|
QString link_url = menu_data.linkUrl().toString();
|
||||||
|
|
||||||
// Add option to open link in external viewe
|
// Add option to open link in external viewe
|
||||||
menu->addAction(qApp->icons()->fromTheme(QSL("document-open")), tr("Open link in external browser"), [menu_data]() {
|
menu->addAction(qApp->icons()->fromTheme(QSL("document-open")), tr("Open link in external browser"), [link_url]() {
|
||||||
qApp->web()->openUrlInExternalBrowser(menu_data.linkUrl().toString());
|
qApp->web()->openUrlInExternalBrowser(link_url);
|
||||||
|
|
||||||
if (qApp->settings()->value(GROUP(Messages), SETTING(Messages::BringAppToFrontAfterMessageOpenedExternally)).toBool()) {
|
if (qApp->settings()->value(GROUP(Messages), SETTING(Messages::BringAppToFrontAfterMessageOpenedExternally)).toBool()) {
|
||||||
QTimer::singleShot(1000, qApp, []() {
|
QTimer::singleShot(1000, qApp, []() {
|
||||||
|
@ -203,6 +218,7 @@ void WebViewer::contextMenuEvent(QContextMenuEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menu_data.mediaUrl().isValid() || menu_data.linkUrl().isValid()) {
|
if (menu_data.mediaUrl().isValid() || menu_data.linkUrl().isValid()) {
|
||||||
|
QString media_link = menu_data.mediaUrl().isValid() ? menu_data.mediaUrl().toString() : menu_data.linkUrl().toString();
|
||||||
QFileIconProvider icon_provider;
|
QFileIconProvider icon_provider;
|
||||||
QMenu* menu_ext_tools = new QMenu(tr("Open with external tool"), menu);
|
QMenu* menu_ext_tools = new QMenu(tr("Open with external tool"), menu);
|
||||||
auto tools = ExternalTool::toolsFromSettings();
|
auto tools = ExternalTool::toolsFromSettings();
|
||||||
|
@ -212,13 +228,13 @@ void WebViewer::contextMenuEvent(QContextMenuEvent* event) {
|
||||||
for (const ExternalTool& tool : qAsConst(tools)) {
|
for (const ExternalTool& tool : qAsConst(tools)) {
|
||||||
QAction* act_tool = new QAction(QFileInfo(tool.executable()).fileName(), menu_ext_tools);
|
QAction* act_tool = new QAction(QFileInfo(tool.executable()).fileName(), menu_ext_tools);
|
||||||
|
|
||||||
act_tool->setIcon(icon_provider.icon(tool.executable()));
|
act_tool->setIcon(icon_provider.icon(QFileInfo(tool.executable())));
|
||||||
act_tool->setToolTip(tool.executable());
|
act_tool->setToolTip(tool.executable());
|
||||||
act_tool->setData(QVariant::fromValue(tool));
|
act_tool->setData(QVariant::fromValue(tool));
|
||||||
menu_ext_tools->addAction(act_tool);
|
menu_ext_tools->addAction(act_tool);
|
||||||
|
|
||||||
connect(act_tool, &QAction::triggered, this, [this, act_tool, menu_data]() {
|
connect(act_tool, &QAction::triggered, this, [this, act_tool, media_link]() {
|
||||||
openUrlWithExternalTool(act_tool->data().value<ExternalTool>(), menu_data);
|
openUrlWithExternalTool(act_tool->data().value<ExternalTool>(), media_link);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,8 +312,8 @@ bool WebViewer::eventFilter(QObject* object, QEvent* event) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebViewer::openUrlWithExternalTool(ExternalTool tool, const QWebEngineContextMenuData& target) {
|
void WebViewer::openUrlWithExternalTool(ExternalTool tool, const QString& target_url) {
|
||||||
tool.run(target.mediaUrl().isValid() ? target.mediaUrl().toString() : target.linkUrl().toString());
|
tool.run(target_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
RootItem* WebViewer::root() const {
|
RootItem* WebViewer::root() const {
|
||||||
|
|
|
@ -41,7 +41,7 @@ class WebViewer : public QWebEngineView {
|
||||||
virtual bool eventFilter(QObject* object, QEvent* event);
|
virtual bool eventFilter(QObject* object, QEvent* event);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void openUrlWithExternalTool(ExternalTool tool, const QWebEngineContextMenuData& target);
|
void openUrlWithExternalTool(ExternalTool tool, const QString& target_url);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RootItem* m_root;
|
RootItem* m_root;
|
||||||
|
|
|
@ -40,7 +40,12 @@
|
||||||
#include "network-web/adblock/adblockmanager.h"
|
#include "network-web/adblock/adblockmanager.h"
|
||||||
#include "network-web/networkurlinterceptor.h"
|
#include "network-web/networkurlinterceptor.h"
|
||||||
|
|
||||||
|
#if QT_VERSION_MAJOR == 6
|
||||||
|
#include <QWebEngineDownloadRequest>
|
||||||
|
#else
|
||||||
#include <QWebEngineDownloadItem>
|
#include <QWebEngineDownloadItem>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QWebEngineProfile>
|
#include <QWebEngineProfile>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -606,7 +611,11 @@ void Application::restart() {
|
||||||
|
|
||||||
#if defined(USE_WEBENGINE)
|
#if defined(USE_WEBENGINE)
|
||||||
|
|
||||||
|
#if QT_VERSION_MAJOR == 6
|
||||||
|
void Application::downloadRequested(QWebEngineDownloadRequest* download_item) {
|
||||||
|
#else
|
||||||
void Application::downloadRequested(QWebEngineDownloadItem* download_item) {
|
void Application::downloadRequested(QWebEngineDownloadItem* download_item) {
|
||||||
|
#endif
|
||||||
downloadManager()->download(download_item->url());
|
downloadManager()->download(download_item->url());
|
||||||
download_item->cancel();
|
download_item->cancel();
|
||||||
download_item->deleteLater();
|
download_item->deleteLater();
|
||||||
|
|
|
@ -33,7 +33,13 @@ class FormMain;
|
||||||
class IconFactory;
|
class IconFactory;
|
||||||
class QAction;
|
class QAction;
|
||||||
class Mutex;
|
class Mutex;
|
||||||
|
|
||||||
|
#if QT_VERSION_MAJOR == 6
|
||||||
|
class QWebEngineDownloadRequest;
|
||||||
|
#else
|
||||||
class QWebEngineDownloadItem;
|
class QWebEngineDownloadItem;
|
||||||
|
#endif
|
||||||
|
|
||||||
class WebFactory;
|
class WebFactory;
|
||||||
class NotificationFactory;
|
class NotificationFactory;
|
||||||
|
|
||||||
|
@ -140,7 +146,12 @@ class RSSGUARD_DLLSPEC Application : public SingleApplication {
|
||||||
void showMessagesNumber(int unread_messages, bool any_feed_has_unread_messages);
|
void showMessagesNumber(int unread_messages, bool any_feed_has_unread_messages);
|
||||||
|
|
||||||
#if defined(USE_WEBENGINE)
|
#if defined(USE_WEBENGINE)
|
||||||
|
#if QT_VERSION_MAJOR == 6
|
||||||
|
void downloadRequested(QWebEngineDownloadRequest* download_item);
|
||||||
|
#else
|
||||||
void downloadRequested(QWebEngineDownloadItem* download_item);
|
void downloadRequested(QWebEngineDownloadItem* download_item);
|
||||||
|
#endif
|
||||||
|
|
||||||
void onAdBlockFailure();
|
void onAdBlockFailure();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@
|
||||||
|
|
||||||
#if !defined(Q_OS_OS2)
|
#if !defined(Q_OS_OS2)
|
||||||
#include <QMediaPlayer>
|
#include <QMediaPlayer>
|
||||||
|
|
||||||
|
#if QT_VERSION_MAJOR == 6
|
||||||
|
#include <QAudioOutput>
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Notification::Notification(Notification::Event event, bool balloon, const QString& sound_path, int volume)
|
Notification::Notification(Notification::Event event, bool balloon, const QString& sound_path, int volume)
|
||||||
|
@ -34,6 +38,29 @@ void Notification::playSound(Application* app) const {
|
||||||
#if !defined(Q_OS_OS2)
|
#if !defined(Q_OS_OS2)
|
||||||
QMediaPlayer* play = new QMediaPlayer(app);
|
QMediaPlayer* play = new QMediaPlayer(app);
|
||||||
|
|
||||||
|
#if QT_VERSION_MAJOR == 6
|
||||||
|
QAudioOutput* out = new QAudioOutput(app);
|
||||||
|
|
||||||
|
play->setAudioOutput(out);
|
||||||
|
|
||||||
|
QObject::connect(play, &QMediaPlayer::playbackStateChanged, play, [play, out](QMediaPlayer::PlaybackState state) {
|
||||||
|
if (state == QMediaPlayer::PlaybackState::StoppedState) {
|
||||||
|
out->deleteLater();
|
||||||
|
play->deleteLater();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (m_soundPath.startsWith(QSL(":"))) {
|
||||||
|
play->setSource(QUrl(QSL("qrc") + m_soundPath));
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
play->setSource(QUrl::fromLocalFile(QDir::toNativeSeparators(app->replaceDataUserDataFolderPlaceholder(m_soundPath))));
|
||||||
|
}
|
||||||
|
|
||||||
|
play->audioOutput()->setVolume((m_volume * 1.0f) / 100.0f);
|
||||||
|
play->play();
|
||||||
|
#else
|
||||||
QObject::connect(play, &QMediaPlayer::stateChanged, play, [play](QMediaPlayer::State state) {
|
QObject::connect(play, &QMediaPlayer::stateChanged, play, [play](QMediaPlayer::State state) {
|
||||||
if (state == QMediaPlayer::State::StoppedState) {
|
if (state == QMediaPlayer::State::StoppedState) {
|
||||||
play->deleteLater();
|
play->deleteLater();
|
||||||
|
@ -52,6 +79,7 @@ void Notification::playSound(Application* app) const {
|
||||||
|
|
||||||
play->setVolume(m_volume);
|
play->setVolume(m_volume);
|
||||||
play->play();
|
play->play();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ QString RegexFactory::wildcardToRegularExpression(const QString& pattern) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
const QChar* wc = pattern.unicode();
|
const QChar* wc = pattern.unicode();
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#if defined(Q_OS_WIN)
|
||||||
const QLatin1Char nativePathSeparator('\\');
|
const QLatin1Char nativePathSeparator('\\');
|
||||||
const QLatin1String starEscape("[^/\\\\]*");
|
const QLatin1String starEscape("[^/\\\\]*");
|
||||||
const QLatin1String questionMarkEscape("[^/\\\\]");
|
const QLatin1String questionMarkEscape("[^/\\\\]");
|
||||||
|
@ -74,7 +74,7 @@ QString RegexFactory::wildcardToRegularExpression(const QString& pattern) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\\':
|
case '\\':
|
||||||
#ifdef Q_OS_WIN
|
#if defined(Q_OS_WIN)
|
||||||
case '/':
|
case '/':
|
||||||
rx += QLatin1String("[/\\\\]");
|
rx += QLatin1String("[/\\\\]");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -582,7 +582,7 @@ void DownloadManager::updateRow(DownloadItem* item) {
|
||||||
m_iconProvider.reset(new QFileIconProvider());
|
m_iconProvider.reset(new QFileIconProvider());
|
||||||
}
|
}
|
||||||
|
|
||||||
QIcon icon = m_iconProvider->icon(item->m_output.fileName());
|
QIcon icon = m_iconProvider->icon(QFileInfo(item->m_output.fileName()));
|
||||||
|
|
||||||
if (icon.isNull()) {
|
if (icon.isNull()) {
|
||||||
icon = style()->standardIcon(QStyle::StandardPixmap::SP_FileIcon);
|
icon = style()->standardIcon(QStyle::StandardPixmap::SP_FileIcon);
|
||||||
|
|
|
@ -17,7 +17,11 @@
|
||||||
#include "network-web/networkurlinterceptor.h"
|
#include "network-web/networkurlinterceptor.h"
|
||||||
#include "network-web/urlinterceptor.h"
|
#include "network-web/urlinterceptor.h"
|
||||||
|
|
||||||
|
#if QT_VERSION_MAJOR == 6
|
||||||
|
#include <QWebEngineDownloadRequest>
|
||||||
|
#else
|
||||||
#include <QWebEngineDownloadItem>
|
#include <QWebEngineDownloadItem>
|
||||||
|
#endif
|
||||||
#include <QWebEngineProfile>
|
#include <QWebEngineProfile>
|
||||||
#include <QWebEngineScript>
|
#include <QWebEngineScript>
|
||||||
#include <QWebEngineScriptCollection>
|
#include <QWebEngineScriptCollection>
|
||||||
|
@ -163,7 +167,7 @@ QString WebFactory::unescapeHtml(const QString& html) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Failed to convert to number, leave intact.
|
// Failed to convert to number, leave intact.
|
||||||
output.append(html.midRef(pos, pos_end - pos + 1));
|
output.append(html.mid(pos, pos_end - pos + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = pos_end + 1;
|
pos = pos_end + 1;
|
||||||
|
|
|
@ -24,7 +24,11 @@ WebPage::WebPage(QObject* parent) : QWebEnginePage(parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
WebViewer* WebPage::view() const {
|
WebViewer* WebPage::view() const {
|
||||||
|
#if QT_VERSION_MAJOR == 6
|
||||||
|
return qobject_cast<WebViewer*>(QWebEngineView::forPage(this));
|
||||||
|
#else
|
||||||
return qobject_cast<WebViewer*>(QWebEnginePage::view());
|
return qobject_cast<WebViewer*>(QWebEnginePage::view());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebPage::hideUnwantedElements() {
|
void WebPage::hideUnwantedElements() {
|
||||||
|
|
|
@ -289,10 +289,18 @@ class ServiceRoot : public RootItem {
|
||||||
QNetworkProxy m_networkProxy;
|
QNetworkProxy m_networkProxy;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if QT_VERSION_MAJOR == 6
|
||||||
|
inline size_t qHash(ServiceRoot::BagOfMessages key, size_t seed) {
|
||||||
|
return ::qHash(static_cast<uint>(key), seed);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
inline uint qHash(ServiceRoot::BagOfMessages key, uint seed) {
|
inline uint qHash(ServiceRoot::BagOfMessages key, uint seed) {
|
||||||
return ::qHash(static_cast<uint>(key), seed);
|
return ::qHash(static_cast<uint>(key), seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
ServiceRoot::LabelOperation operator|(ServiceRoot::LabelOperation lhs, ServiceRoot::LabelOperation rhs);
|
ServiceRoot::LabelOperation operator|(ServiceRoot::LabelOperation lhs, ServiceRoot::LabelOperation rhs);
|
||||||
ServiceRoot::LabelOperation operator&(ServiceRoot::LabelOperation lhs, ServiceRoot::LabelOperation rhs);
|
ServiceRoot::LabelOperation operator&(ServiceRoot::LabelOperation lhs, ServiceRoot::LabelOperation rhs);
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ QNetworkReply::NetworkError GreaderNetwork::editLabels(const QString& state,
|
||||||
trimmed_ids.append(QSL("i=") + id);
|
trimmed_ids.append(QSL("i=") + id);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList working_subset; working_subset.reserve(std::min(GREADER_API_EDIT_TAG_BATCH, trimmed_ids.size()));
|
QStringList working_subset; working_subset.reserve(std::min(GREADER_API_EDIT_TAG_BATCH, int(trimmed_ids.size())));
|
||||||
|
|
||||||
// Now, we perform messages update in batches (max X messages per batch).
|
// Now, we perform messages update in batches (max X messages per batch).
|
||||||
while (!trimmed_ids.isEmpty()) {
|
while (!trimmed_ids.isEmpty()) {
|
||||||
|
|
|
@ -73,8 +73,6 @@ Message AtomParser::extractMessage(const QDomElement& msg_element, const QDateTi
|
||||||
QString raw_contents;
|
QString raw_contents;
|
||||||
QTextStream str(&raw_contents);
|
QTextStream str(&raw_contents);
|
||||||
|
|
||||||
str.setCodec(DEFAULT_FEED_ENCODING);
|
|
||||||
|
|
||||||
msg_element.save(str, 0, QDomNode::EncodingPolicy::EncodingFromTextStream);
|
msg_element.save(str, 0, QDomNode::EncodingPolicy::EncodingFromTextStream);
|
||||||
new_message.m_rawContents = raw_contents;
|
new_message.m_rawContents = raw_contents;
|
||||||
|
|
||||||
|
|
|
@ -52,8 +52,6 @@ Message RdfParser::extractMessage(const QDomElement& msg_element, const QDateTim
|
||||||
QString raw_contents;
|
QString raw_contents;
|
||||||
QTextStream str(&raw_contents);
|
QTextStream str(&raw_contents);
|
||||||
|
|
||||||
str.setCodec(DEFAULT_FEED_ENCODING);
|
|
||||||
|
|
||||||
msg_element.save(str, 0, QDomNode::EncodingPolicy::EncodingFromTextStream);
|
msg_element.save(str, 0, QDomNode::EncodingPolicy::EncodingFromTextStream);
|
||||||
new_message.m_rawContents = raw_contents;
|
new_message.m_rawContents = raw_contents;
|
||||||
|
|
||||||
|
|
|
@ -86,8 +86,6 @@ Message RssParser::extractMessage(const QDomElement& msg_element, const QDateTim
|
||||||
QString raw_contents;
|
QString raw_contents;
|
||||||
QTextStream str(&raw_contents);
|
QTextStream str(&raw_contents);
|
||||||
|
|
||||||
str.setCodec(DEFAULT_FEED_ENCODING);
|
|
||||||
|
|
||||||
msg_element.save(str, 0, QDomNode::EncodingPolicy::EncodingFromTextStream);
|
msg_element.save(str, 0, QDomNode::EncodingPolicy::EncodingFromTextStream);
|
||||||
new_message.m_rawContents = raw_contents;
|
new_message.m_rawContents = raw_contents;
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,13 @@
|
||||||
#include "services/abstract/label.h"
|
#include "services/abstract/label.h"
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
|
#if QT_VERSION_MAJOR == 5
|
||||||
#include <QtPlatformHeaders/QWindowsWindowFunctions>
|
#include <QtPlatformHeaders/QWindowsWindowFunctions>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS)
|
#if defined(Q_OS_MACOS)
|
||||||
extern void disableWindowTabbing();
|
extern void disableWindowTabbing();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
|
@ -73,8 +74,10 @@ int main(int argc, char* argv[]) {
|
||||||
|
|
||||||
qApp->reactOnForeignNotifications();
|
qApp->reactOnForeignNotifications();
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#if defined(Q_OS_WIN)
|
||||||
|
#if QT_VERSION_MAJOR == 5
|
||||||
QWindowsWindowFunctions::setWindowActivationBehavior(QWindowsWindowFunctions::AlwaysActivateWindow);
|
QWindowsWindowFunctions::setWindowActivationBehavior(QWindowsWindowFunctions::AlwaysActivateWindow);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FormMain main_window;
|
FormMain main_window;
|
||||||
|
|
Loading…
Add table
Reference in a new issue