fix regression in new version testing upon startup, enhance notifications
This commit is contained in:
parent
52017bbeb9
commit
5f339db411
@ -30,7 +30,7 @@
|
|||||||
<url type="donation">https://martinrotter.github.io/donate/</url>
|
<url type="donation">https://martinrotter.github.io/donate/</url>
|
||||||
<content_rating type="oars-1.1" />
|
<content_rating type="oars-1.1" />
|
||||||
<releases>
|
<releases>
|
||||||
<release version="3.9.2" date="2021-06-18"/>
|
<release version="3.9.2" date="2021-06-21"/>
|
||||||
</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>
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 9c10723bfbaf6cb85107d6ee16e0324e9e487749
|
Subproject commit 47f4125753452eff8800dbd6600c5a05540b15d9
|
@ -39,7 +39,7 @@ void NotificationsEditor::loadNotifications(const QList<Notification>& 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<Notification> NotificationsEditor::allNotifications() const {
|
QList<Notification> NotificationsEditor::allNotifications() const {
|
||||||
|
@ -5,16 +5,21 @@
|
|||||||
#include "miscellaneous/application.h"
|
#include "miscellaneous/application.h"
|
||||||
#include "miscellaneous/iconfactory.h"
|
#include "miscellaneous/iconfactory.h"
|
||||||
|
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
SingleNotificationEditor::SingleNotificationEditor(const Notification& notification, QWidget* parent)
|
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.setupUi(this);
|
||||||
|
|
||||||
m_ui.m_btnBrowseSound->setIcon(qApp->icons()->fromTheme(QSL("document-open")));
|
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")));
|
m_ui.m_btnPlaySound->setIcon(qApp->icons()->fromTheme(QSL("media-playback-start")));
|
||||||
|
|
||||||
loadNotification(notification);
|
loadNotification(notification);
|
||||||
|
|
||||||
connect(m_ui.m_btnPlaySound, &QPushButton::clicked, this, &SingleNotificationEditor::playSound);
|
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_txtSound, &QLineEdit::textChanged, this, &SingleNotificationEditor::notificationChanged);
|
||||||
connect(m_ui.m_cbBalloon, &QCheckBox::toggled, 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());
|
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() {
|
void SingleNotificationEditor::playSound() {
|
||||||
Notification({}, {}, m_ui.m_txtSound->text()).playSound(qApp);
|
Notification({}, {}, m_ui.m_txtSound->text()).playSound(qApp);
|
||||||
}
|
}
|
||||||
@ -30,7 +45,7 @@ void SingleNotificationEditor::playSound() {
|
|||||||
void SingleNotificationEditor::loadNotification(const Notification& notification) {
|
void SingleNotificationEditor::loadNotification(const Notification& notification) {
|
||||||
m_ui.m_txtSound->setText(notification.soundPath());
|
m_ui.m_txtSound->setText(notification.soundPath());
|
||||||
m_ui.m_cbBalloon->setChecked(notification.balloonEnabled());
|
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();
|
m_notificationEvent = notification.event();
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
#ifndef SINGLENOTIFICATIONEDITOR_H
|
#ifndef SINGLENOTIFICATIONEDITOR_H
|
||||||
#define SINGLENOTIFICATIONEDITOR_H
|
#define SINGLENOTIFICATIONEDITOR_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QGroupBox>
|
||||||
|
|
||||||
#include "ui_singlenotificationeditor.h"
|
#include "ui_singlenotificationeditor.h"
|
||||||
|
|
||||||
#include "miscellaneous/notification.h"
|
#include "miscellaneous/notification.h"
|
||||||
|
|
||||||
class SingleNotificationEditor : public QWidget {
|
class SingleNotificationEditor : public QGroupBox {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -21,6 +21,7 @@ class SingleNotificationEditor : public QWidget {
|
|||||||
void notificationChanged();
|
void notificationChanged();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void selectSoundFile();
|
||||||
void playSound();
|
void playSound();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>SingleNotificationEditor</class>
|
<class>SingleNotificationEditor</class>
|
||||||
<widget class="QWidget" name="SingleNotificationEditor">
|
<widget class="QGroupBox" name="SingleNotificationEditor">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>353</width>
|
||||||
<height>125</height>
|
<height>65</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -16,74 +16,66 @@
|
|||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<string>Form</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item row="1" column="0">
|
||||||
<widget class="QGroupBox" name="m_gbNotification">
|
<widget class="QLabel" name="label">
|
||||||
<property name="sizePolicy">
|
<property name="text">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
<string>Sound</string>
|
||||||
<horstretch>0</horstretch>
|
</property>
|
||||||
<verstretch>0</verstretch>
|
<property name="buddy">
|
||||||
</sizepolicy>
|
<cstring>m_txtSound</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="m_txtSound">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Full path to your WAV sound file</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="m_btnClearSound">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Clear</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="m_btnBrowseSound">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Browse</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="m_btnPlaySound">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Play</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="m_cbBalloon">
|
||||||
|
<property name="text">
|
||||||
|
<string>Balloon notification</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Sound</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>m_txtSound</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="m_txtSound">
|
|
||||||
<property name="placeholderText">
|
|
||||||
<string>Full path to your WAV sound file</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="m_btnBrowseSound">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Browse</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="m_btnPlaySound">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Play</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="m_cbBalloon">
|
|
||||||
<property name="text">
|
|
||||||
<string>Balloon notification</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -91,6 +83,7 @@
|
|||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>m_cbBalloon</tabstop>
|
<tabstop>m_cbBalloon</tabstop>
|
||||||
<tabstop>m_txtSound</tabstop>
|
<tabstop>m_txtSound</tabstop>
|
||||||
|
<tabstop>m_btnClearSound</tabstop>
|
||||||
<tabstop>m_btnBrowseSound</tabstop>
|
<tabstop>m_btnBrowseSound</tabstop>
|
||||||
<tabstop>m_btnPlaySound</tabstop>
|
<tabstop>m_btnPlaySound</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QSessionManager>
|
#include <QSessionManager>
|
||||||
#include <QSslSocket>
|
#include <QSslSocket>
|
||||||
|
#include <QtConcurrent/QtConcurrentRun>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#if defined(USE_WEBENGINE)
|
#if defined(USE_WEBENGINE)
|
||||||
@ -91,13 +92,17 @@ Application::Application(const QString& id, int& argc, char** argv)
|
|||||||
m_notifications->save({
|
m_notifications->save({
|
||||||
Notification(Notification::Event::NewArticlesFetched,
|
Notification(Notification::Event::NewArticlesFetched,
|
||||||
true,
|
true,
|
||||||
QSL("%1/rooster.wav").arg(SOUNDS_BUILTIN_DIRECTORY))
|
QSL("%1/rooster.wav").arg(SOUNDS_BUILTIN_DIRECTORY)),
|
||||||
|
Notification(Notification::Event::NewAppVersionAvailable,
|
||||||
|
true)
|
||||||
}, settings());
|
}, settings());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_notifications->load(settings());
|
m_notifications->load(settings());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QTimer::singleShot(1000, system(), &SystemFactory::checkForUpdatesOnStartup);
|
||||||
|
|
||||||
qDebugNN << LOGSEC_CORE
|
qDebugNN << LOGSEC_CORE
|
||||||
<< "OpenSSL version:"
|
<< "OpenSSL version:"
|
||||||
<< QUOTE_W_SPACE_DOT(QSslSocket::sslLibraryVersionString());
|
<< QUOTE_W_SPACE_DOT(QSslSocket::sslLibraryVersionString());
|
||||||
|
@ -71,8 +71,8 @@ QList<ServiceEntryPoint*> FeedReader::feedServices() {
|
|||||||
void FeedReader::updateFeeds(const QList<Feed*>& feeds) {
|
void FeedReader::updateFeeds(const QList<Feed*>& feeds) {
|
||||||
if (!qApp->feedUpdateLock()->tryLock()) {
|
if (!qApp->feedUpdateLock()->tryLock()) {
|
||||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||||
tr("Cannot update all items"),
|
tr("Cannot fetch articles for all items"),
|
||||||
tr("You cannot download new messages for your items "
|
tr("You cannot fetch new articles for your items "
|
||||||
"because another critical operation is ongoing."),
|
"because another critical operation is ongoing."),
|
||||||
QSystemTrayIcon::MessageIcon::Warning,
|
QSystemTrayIcon::MessageIcon::Warning,
|
||||||
true);
|
true);
|
||||||
|
@ -34,9 +34,11 @@ void Notification::playSound(Application* app) const {
|
|||||||
|
|
||||||
QList<Notification::Event> Notification::allEvents() {
|
QList<Notification::Event> Notification::allEvents() {
|
||||||
return {
|
return {
|
||||||
|
Event::GeneralEvent,
|
||||||
Event::NewArticlesFetched,
|
Event::NewArticlesFetched,
|
||||||
Event::ArticlesFetchingStarted,
|
Event::ArticlesFetchingStarted,
|
||||||
Event::LoginDataRefreshed
|
Event::LoginDataRefreshed,
|
||||||
|
Event::NewAppVersionAvailable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,12 +53,17 @@ QString Notification::nameForEvent(Notification::Event event) {
|
|||||||
case Notification::Event::LoginDataRefreshed:
|
case Notification::Event::LoginDataRefreshed:
|
||||||
return QObject::tr("Login data refreshed");
|
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:
|
default:
|
||||||
return QObject::tr("Unknown event");
|
return QObject::tr("Unknown event");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Notification::balloonEnabled() const
|
bool Notification::balloonEnabled() const {
|
||||||
{
|
|
||||||
return m_balloonEnabled;
|
return m_balloonEnabled;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ class Notification {
|
|||||||
// OAuth or similar mechanism.
|
// OAuth or similar mechanism.
|
||||||
LoginDataRefreshed = 4,
|
LoginDataRefreshed = 4,
|
||||||
|
|
||||||
// TODO: app update is available
|
NewAppVersionAvailable = 5
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit Notification(Event event = Event::NoEvent, bool balloon = {}, const QString& sound_path = {});
|
explicit Notification(Event event = Event::NoEvent, bool balloon = {}, const QString& sound_path = {});
|
||||||
|
@ -224,9 +224,10 @@ void SystemFactory::checkForUpdatesOnStartup() {
|
|||||||
this, [&](QPair<QList<UpdateInfo>, QNetworkReply::NetworkError> updates) {
|
this, [&](QPair<QList<UpdateInfo>, QNetworkReply::NetworkError> updates) {
|
||||||
QObject::disconnect(qApp->system(), &SystemFactory::updatesChecked, this, nullptr);
|
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)) {
|
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("New version available"),
|
||||||
QObject::tr("Click the bubble for more information."),
|
QObject::tr("Click the bubble for more information."),
|
||||||
QSystemTrayIcon::Information, {}, {},
|
QSystemTrayIcon::Information, {}, {},
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
|
#include <QRegularExpression>
|
||||||
|
|
||||||
class UpdateUrl {
|
class UpdateUrl {
|
||||||
public:
|
public:
|
||||||
@ -26,7 +27,6 @@ class UpdateInfo {
|
|||||||
QString m_availableVersion;
|
QString m_availableVersion;
|
||||||
QString m_changes;
|
QString m_changes;
|
||||||
QDateTime m_date;
|
QDateTime m_date;
|
||||||
|
|
||||||
QList<UpdateUrl> m_urls;
|
QList<UpdateUrl> m_urls;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -60,7 +60,6 @@ class SystemFactory : public QObject {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_LINUX)
|
#if defined(Q_OS_LINUX)
|
||||||
|
|
||||||
// Returns standard location where auto-start .desktop files
|
// Returns standard location where auto-start .desktop files
|
||||||
// should be placed.
|
// should be placed.
|
||||||
QString autostartDesktopFileLocation() const;
|
QString autostartDesktopFileLocation() const;
|
||||||
@ -72,6 +71,7 @@ class SystemFactory : public QObject {
|
|||||||
// Tries to download list with new updates.
|
// Tries to download list with new updates.
|
||||||
void checkForUpdates() const;
|
void checkForUpdates() const;
|
||||||
|
|
||||||
|
public slots:
|
||||||
void checkForUpdatesOnStartup();
|
void checkForUpdatesOnStartup();
|
||||||
|
|
||||||
static QRegularExpression supportedUpdateFiles();
|
static QRegularExpression supportedUpdateFiles();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user