diff --git a/resources/desktop/com.github.rssguard.appdata.xml b/resources/desktop/com.github.rssguard.appdata.xml index 6afb82793..55b54f6a5 100644 --- a/resources/desktop/com.github.rssguard.appdata.xml +++ b/resources/desktop/com.github.rssguard.appdata.xml @@ -30,7 +30,7 @@ https://martinrotter.github.io/donate/ - + none diff --git a/resources/scripts/7za b/resources/scripts/7za index 9c10723bf..47f412575 160000 --- a/resources/scripts/7za +++ b/resources/scripts/7za @@ -1 +1 @@ -Subproject commit 9c10723bfbaf6cb85107d6ee16e0324e9e487749 +Subproject commit 47f4125753452eff8800dbd6600c5a05540b15d9 diff --git a/src/librssguard/gui/notifications/notificationseditor.cpp b/src/librssguard/gui/notifications/notificationseditor.cpp index a5d16252d..a93fe1e7c 100755 --- a/src/librssguard/gui/notifications/notificationseditor.cpp +++ b/src/librssguard/gui/notifications/notificationseditor.cpp @@ -39,7 +39,7 @@ void NotificationsEditor::loadNotifications(const QList& notificat } } - m_layout->addSpacerItem(new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding)); + m_layout->addSpacerItem(new QSpacerItem(20, 40, QSizePolicy::Policy::Minimum, QSizePolicy::Policy::Expanding)); } QList NotificationsEditor::allNotifications() const { diff --git a/src/librssguard/gui/notifications/singlenotificationeditor.cpp b/src/librssguard/gui/notifications/singlenotificationeditor.cpp index 199784c32..11331c26f 100755 --- a/src/librssguard/gui/notifications/singlenotificationeditor.cpp +++ b/src/librssguard/gui/notifications/singlenotificationeditor.cpp @@ -5,16 +5,21 @@ #include "miscellaneous/application.h" #include "miscellaneous/iconfactory.h" +#include + SingleNotificationEditor::SingleNotificationEditor(const Notification& notification, QWidget* parent) - : QWidget(parent), m_notificationEvent(Notification::Event::NoEvent) { + : QGroupBox(parent), m_notificationEvent(Notification::Event::NoEvent) { m_ui.setupUi(this); m_ui.m_btnBrowseSound->setIcon(qApp->icons()->fromTheme(QSL("document-open"))); + m_ui.m_btnClearSound->setIcon(qApp->icons()->fromTheme(QSL("edit-clear"))); m_ui.m_btnPlaySound->setIcon(qApp->icons()->fromTheme(QSL("media-playback-start"))); loadNotification(notification); connect(m_ui.m_btnPlaySound, &QPushButton::clicked, this, &SingleNotificationEditor::playSound); + connect(m_ui.m_btnBrowseSound, &QPushButton::clicked, this, &SingleNotificationEditor::selectSoundFile); + connect(m_ui.m_btnClearSound, &QPushButton::clicked, m_ui.m_txtSound, &QLineEdit::clear); connect(m_ui.m_txtSound, &QLineEdit::textChanged, this, &SingleNotificationEditor::notificationChanged); connect(m_ui.m_cbBalloon, &QCheckBox::toggled, this, &SingleNotificationEditor::notificationChanged); } @@ -23,6 +28,16 @@ Notification SingleNotificationEditor::notification() const { return Notification(m_notificationEvent, m_ui.m_cbBalloon->isChecked(), m_ui.m_txtSound->text()); } +void SingleNotificationEditor::selectSoundFile() { + auto fil = QFileDialog::getOpenFileName(window(), tr("Select sound file"), + qApp->homeFolder(), + tr("WAV files (*.wav)")); + + if (!fil.isEmpty()) { + m_ui.m_txtSound->setText(fil); + } +} + void SingleNotificationEditor::playSound() { Notification({}, {}, m_ui.m_txtSound->text()).playSound(qApp); } @@ -30,7 +45,7 @@ void SingleNotificationEditor::playSound() { void SingleNotificationEditor::loadNotification(const Notification& notification) { m_ui.m_txtSound->setText(notification.soundPath()); m_ui.m_cbBalloon->setChecked(notification.balloonEnabled()); - m_ui.m_gbNotification->setTitle(Notification::nameForEvent(notification.event())); + setTitle(Notification::nameForEvent(notification.event())); m_notificationEvent = notification.event(); } diff --git a/src/librssguard/gui/notifications/singlenotificationeditor.h b/src/librssguard/gui/notifications/singlenotificationeditor.h index e3c69cc1a..399498574 100755 --- a/src/librssguard/gui/notifications/singlenotificationeditor.h +++ b/src/librssguard/gui/notifications/singlenotificationeditor.h @@ -3,13 +3,13 @@ #ifndef SINGLENOTIFICATIONEDITOR_H #define SINGLENOTIFICATIONEDITOR_H -#include +#include #include "ui_singlenotificationeditor.h" #include "miscellaneous/notification.h" -class SingleNotificationEditor : public QWidget { +class SingleNotificationEditor : public QGroupBox { Q_OBJECT public: @@ -21,6 +21,7 @@ class SingleNotificationEditor : public QWidget { void notificationChanged(); private slots: + void selectSoundFile(); void playSound(); private: diff --git a/src/librssguard/gui/notifications/singlenotificationeditor.ui b/src/librssguard/gui/notifications/singlenotificationeditor.ui index af4d85ade..40c13c664 100755 --- a/src/librssguard/gui/notifications/singlenotificationeditor.ui +++ b/src/librssguard/gui/notifications/singlenotificationeditor.ui @@ -1,13 +1,13 @@ SingleNotificationEditor - + 0 0 - 400 - 125 + 353 + 65 @@ -16,74 +16,66 @@ 0 - - Form - - + - 0 + 6 - 0 + 6 - 0 + 6 - 0 + 6 - - - - - 0 - 0 - + + + + Sound + + + m_txtSound + + + + + + + + + Full path to your WAV sound file + + + + + + + &Clear + + + + + + + &Browse + + + + + + + &Play + + + + + + + + + Balloon notification - - - - - Sound - - - m_txtSound - - - - - - - - - Full path to your WAV sound file - - - - - - - &Browse - - - - - - - &Play - - - - - - - - - Balloon notification - - - - @@ -91,6 +83,7 @@ m_cbBalloon m_txtSound + m_btnClearSound m_btnBrowseSound m_btnPlaySound diff --git a/src/librssguard/miscellaneous/application.cpp b/src/librssguard/miscellaneous/application.cpp index 32f10f4ae..25c8df4e2 100755 --- a/src/librssguard/miscellaneous/application.cpp +++ b/src/librssguard/miscellaneous/application.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #if defined(USE_WEBENGINE) @@ -91,13 +92,17 @@ Application::Application(const QString& id, int& argc, char** argv) m_notifications->save({ Notification(Notification::Event::NewArticlesFetched, true, - QSL("%1/rooster.wav").arg(SOUNDS_BUILTIN_DIRECTORY)) + QSL("%1/rooster.wav").arg(SOUNDS_BUILTIN_DIRECTORY)), + Notification(Notification::Event::NewAppVersionAvailable, + true) }, settings()); } else { m_notifications->load(settings()); } + QTimer::singleShot(1000, system(), &SystemFactory::checkForUpdatesOnStartup); + qDebugNN << LOGSEC_CORE << "OpenSSL version:" << QUOTE_W_SPACE_DOT(QSslSocket::sslLibraryVersionString()); diff --git a/src/librssguard/miscellaneous/feedreader.cpp b/src/librssguard/miscellaneous/feedreader.cpp index d3c0d7c2f..97b829663 100644 --- a/src/librssguard/miscellaneous/feedreader.cpp +++ b/src/librssguard/miscellaneous/feedreader.cpp @@ -71,8 +71,8 @@ QList FeedReader::feedServices() { void FeedReader::updateFeeds(const QList& feeds) { if (!qApp->feedUpdateLock()->tryLock()) { qApp->showGuiMessage(Notification::Event::GeneralEvent, - tr("Cannot update all items"), - tr("You cannot download new messages for your items " + tr("Cannot fetch articles for all items"), + tr("You cannot fetch new articles for your items " "because another critical operation is ongoing."), QSystemTrayIcon::MessageIcon::Warning, true); diff --git a/src/librssguard/miscellaneous/notification.cpp b/src/librssguard/miscellaneous/notification.cpp index 17477b011..42175cd59 100755 --- a/src/librssguard/miscellaneous/notification.cpp +++ b/src/librssguard/miscellaneous/notification.cpp @@ -34,9 +34,11 @@ void Notification::playSound(Application* app) const { QList Notification::allEvents() { return { + Event::GeneralEvent, Event::NewArticlesFetched, Event::ArticlesFetchingStarted, - Event::LoginDataRefreshed + Event::LoginDataRefreshed, + Event::NewAppVersionAvailable, }; } @@ -51,12 +53,17 @@ QString Notification::nameForEvent(Notification::Event event) { case Notification::Event::LoginDataRefreshed: return QObject::tr("Login data refreshed"); + case Notification::Event::NewAppVersionAvailable: + return QObject::tr("New %1 version is available").arg(APP_NAME); + + case Notification::Event::GeneralEvent: + return QObject::tr("Miscellaneous events"); + default: return QObject::tr("Unknown event"); } } -bool Notification::balloonEnabled() const -{ +bool Notification::balloonEnabled() const { return m_balloonEnabled; } diff --git a/src/librssguard/miscellaneous/notification.h b/src/librssguard/miscellaneous/notification.h index 6e06ced11..45dbef121 100755 --- a/src/librssguard/miscellaneous/notification.h +++ b/src/librssguard/miscellaneous/notification.h @@ -28,7 +28,7 @@ class Notification { // OAuth or similar mechanism. LoginDataRefreshed = 4, - // TODO: app update is available + NewAppVersionAvailable = 5 }; explicit Notification(Event event = Event::NoEvent, bool balloon = {}, const QString& sound_path = {}); diff --git a/src/librssguard/miscellaneous/systemfactory.cpp b/src/librssguard/miscellaneous/systemfactory.cpp index 844024f0f..1548b7b86 100644 --- a/src/librssguard/miscellaneous/systemfactory.cpp +++ b/src/librssguard/miscellaneous/systemfactory.cpp @@ -224,9 +224,10 @@ void SystemFactory::checkForUpdatesOnStartup() { this, [&](QPair, QNetworkReply::NetworkError> updates) { QObject::disconnect(qApp->system(), &SystemFactory::updatesChecked, this, nullptr); - if (!updates.first.isEmpty() && updates.second == QNetworkReply::NetworkError::NoError && + if (!updates.first.isEmpty() && + updates.second == QNetworkReply::NetworkError::NoError && SystemFactory::isVersionNewer(updates.first.at(0).m_availableVersion, APP_VERSION)) { - qApp->showGuiMessage(Notification::Event::GeneralEvent, + qApp->showGuiMessage(Notification::Event::NewAppVersionAvailable, QObject::tr("New version available"), QObject::tr("Click the bubble for more information."), QSystemTrayIcon::Information, {}, {}, diff --git a/src/librssguard/miscellaneous/systemfactory.h b/src/librssguard/miscellaneous/systemfactory.h index ab67f2d64..9ea969a6e 100644 --- a/src/librssguard/miscellaneous/systemfactory.h +++ b/src/librssguard/miscellaneous/systemfactory.h @@ -11,6 +11,7 @@ #include #include #include +#include class UpdateUrl { public: @@ -26,7 +27,6 @@ class UpdateInfo { QString m_availableVersion; QString m_changes; QDateTime m_date; - QList m_urls; }; @@ -60,7 +60,6 @@ class SystemFactory : public QObject { #endif #if defined(Q_OS_LINUX) - // Returns standard location where auto-start .desktop files // should be placed. QString autostartDesktopFileLocation() const; @@ -72,6 +71,7 @@ class SystemFactory : public QObject { // Tries to download list with new updates. void checkForUpdates() const; + public slots: void checkForUpdatesOnStartup(); static QRegularExpression supportedUpdateFiles();