This commit is contained in:
Martin Rotter 2025-04-16 13:29:43 +02:00
parent d0bf0d872b
commit eb8d258a09
9 changed files with 61 additions and 17 deletions

View file

@ -14,6 +14,7 @@
<file>scripts/gemini/style.css</file> <file>scripts/gemini/style.css</file>
<file>sounds/boing.wav</file> <file>sounds/boing.wav</file>
<file>sounds/error.wav</file>
<file>sounds/rooster.wav</file> <file>sounds/rooster.wav</file>
<file>sounds/sheep.wav</file> <file>sounds/sheep.wav</file>
<file>sounds/doorbell.wav</file> <file>sounds/doorbell.wav</file>

BIN
resources/sounds/error.wav Normal file

Binary file not shown.

View file

@ -23,5 +23,10 @@
"title": "GNU GPL v3.0 + Qt Company GPL Exception 1.0", "title": "GNU GPL v3.0 + Qt Company GPL Exception 1.0",
"file": "COPYING_QT", "file": "COPYING_QT",
"components": "Qt" "components": "Qt"
},
{
"title": "Attribution 3.0",
"text": "Error Bleep 4 by original_sound -- https://freesound.org/s/372197/ -- License: Attribution 3.0",
"components": "Error Bleep 4"
} }
] ]

View file

@ -447,6 +447,7 @@ void FeedDownloader::updateOneFeed(ServiceRoot* acc,
qCriticalNN << LOGSEC_NETWORK << "Error when fetching feed:" << QUOTE_W_SPACE(feed_ex.feedStatus()) qCriticalNN << LOGSEC_NETWORK << "Error when fetching feed:" << QUOTE_W_SPACE(feed_ex.feedStatus())
<< "message:" << QUOTE_W_SPACE_DOT(feed_ex.message()); << "message:" << QUOTE_W_SPACE_DOT(feed_ex.message());
m_results.appendErroredFeed(feed, feed_ex.message());
feed->setStatus(feed_ex.feedStatus(), feed_ex.message()); feed->setStatus(feed_ex.feedStatus(), feed_ex.message());
if (feed_ex.feedStatus() == Feed::Status::NetworkError && !feed_ex.data().isNull()) { if (feed_ex.feedStatus() == Feed::Status::NetworkError && !feed_ex.data().isNull()) {
@ -468,6 +469,7 @@ void FeedDownloader::updateOneFeed(ServiceRoot* acc,
qCriticalNN << LOGSEC_NETWORK << "Unknown error when fetching feed:" qCriticalNN << LOGSEC_NETWORK << "Unknown error when fetching feed:"
<< "message:" << QUOTE_W_SPACE_DOT(app_ex.message()); << "message:" << QUOTE_W_SPACE_DOT(app_ex.message());
m_results.appendErroredFeed(feed, app_ex.message());
feed->setStatus(Feed::Status::OtherError, app_ex.message()); feed->setStatus(Feed::Status::OtherError, app_ex.message());
} }
@ -484,6 +486,13 @@ void FeedDownloader::finalizeUpdate() {
m_feeds.clear(); m_feeds.clear();
if (!m_results.erroredFeeds().isEmpty()) {
qApp->showGuiMessage(Notification::Event::ArticlesFetchingError,
{QObject::tr("Some feed have error"),
QObject::tr("Some feeds threw an error when fetching articles."),
QSystemTrayIcon::MessageIcon::Critical});
}
// Update of feeds has finished. // Update of feeds has finished.
// NOTE: This means that now "update lock" can be unlocked // NOTE: This means that now "update lock" can be unlocked
// and feeds can be added/edited/deleted and application // and feeds can be added/edited/deleted and application
@ -632,8 +641,17 @@ void FeedDownloadResults::appendUpdatedFeed(Feed* feed, const QList<Message>& up
} }
} }
void FeedDownloadResults::appendErroredFeed(Feed* feed, const QString& error) {
m_erroredFeeds.insert(feed, error);
}
void FeedDownloadResults::clear() { void FeedDownloadResults::clear() {
m_updatedFeeds.clear(); m_updatedFeeds.clear();
m_erroredFeeds.clear();
}
QHash<Feed*, QString> FeedDownloadResults::erroredFeeds() const {
return m_erroredFeeds;
} }
QHash<Feed*, QList<Message>> FeedDownloadResults::updatedFeeds() const { QHash<Feed*, QList<Message>> FeedDownloadResults::updatedFeeds() const {

View file

@ -18,14 +18,18 @@ class MessageFilter;
// Represents results of batch feed updates. // Represents results of batch feed updates.
class FeedDownloadResults { class FeedDownloadResults {
public: public:
QHash<Feed*, QString> erroredFeeds() const;
QHash<Feed*, QList<Message>> updatedFeeds() const; QHash<Feed*, QList<Message>> updatedFeeds() const;
QString overview(int how_many_feeds) const; QString overview(int how_many_feeds) const;
void appendUpdatedFeed(Feed* feed, const QList<Message>& updated_unread_msgs); void appendUpdatedFeed(Feed* feed, const QList<Message>& updated_unread_msgs);
void appendErroredFeed(Feed* feed, const QString& error);
void clear(); void clear();
private: private:
// QString represents title if the feed, int represents count of newly downloaded messages. // QString represents title if the feed, int represents count of newly downloaded messages.
QHash<Feed*, QList<Message>> m_updatedFeeds; QHash<Feed*, QList<Message>> m_updatedFeeds;
QHash<Feed*, QString> m_erroredFeeds;
}; };
struct FeedUpdateRequest { struct FeedUpdateRequest {

View file

@ -107,10 +107,15 @@ void FormAbout::loadLicenseAndInformation() {
QJsonDocument licenses_index = QJsonDocument::fromJson(IOFactory::readFile(APP_INFO_PATH + QSL("/licenses.json"))); QJsonDocument licenses_index = QJsonDocument::fromJson(IOFactory::readFile(APP_INFO_PATH + QSL("/licenses.json")));
for (const QJsonValue& license : licenses_index.array()) { for (const QJsonValue& license : licenses_index.array()) {
const QJsonObject license_obj = license.toObject(); QJsonObject license_obj = license.toObject();
const QString license_text = QString license_text = license_obj.value(QSL("text")).toString();
QString::fromUtf8(IOFactory::readFile(APP_INFO_PATH + QSL("/") + license_obj[QSL("file")].toString()));
const QString license_title = if (license_text.isEmpty()) {
license_text =
QString::fromUtf8(IOFactory::readFile(APP_INFO_PATH + QSL("/") + license_obj[QSL("file")].toString()));
}
QString license_title =
license_obj[QSL("title")].toString() + QSL(": ") + license_obj[QSL("components")].toString(); license_obj[QSL("title")].toString() + QSL(": ") + license_obj[QSL("components")].toString();
m_ui.m_cbLicenses->addItem(license_title, license_text); m_ui.m_cbLicenses->addItem(license_title, license_text);

View file

@ -43,13 +43,13 @@
<string/> <string/>
</property> </property>
<property name="textFormat"> <property name="textFormat">
<enum>Qt::RichText</enum> <enum>Qt::TextFormat::RichText</enum>
</property> </property>
<property name="scaledContents"> <property name="scaledContents">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignmentFlag::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
@ -68,16 +68,16 @@
<string/> <string/>
</property> </property>
<property name="textFormat"> <property name="textFormat">
<enum>Qt::RichText</enum> <enum>Qt::TextFormat::RichText</enum>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
</property> </property>
<property name="margin"> <property name="margin">
<number>5</number> <number>5</number>
</property> </property>
<property name="textInteractionFlags"> <property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> <set>Qt::TextInteractionFlag::LinksAccessibleByMouse|Qt::TextInteractionFlag::TextSelectableByKeyboard|Qt::TextInteractionFlag::TextSelectableByMouse</set>
</property> </property>
</widget> </widget>
</item> </item>
@ -105,7 +105,7 @@
<locale language="English" country="UnitedStates"/> <locale language="English" country="UnitedStates"/>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="m_tabInfo"> <widget class="QWidget" name="m_tabInfo">
<attribute name="title"> <attribute name="title">
@ -118,7 +118,7 @@
<font/> <font/>
</property> </property>
<property name="contextMenuPolicy"> <property name="contextMenuPolicy">
<enum>Qt::DefaultContextMenu</enum> <enum>Qt::ContextMenuPolicy::DefaultContextMenu</enum>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true"/> <string notr="true"/>
@ -143,7 +143,7 @@ li.checked::marker { content: &quot;\2612&quot;; }
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="textInteractionFlags"> <property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set> <set>Qt::TextInteractionFlag::LinksAccessibleByMouse|Qt::TextInteractionFlag::TextSelectableByMouse</set>
</property> </property>
<property name="searchPaths"> <property name="searchPaths">
<stringlist/> <stringlist/>
@ -164,7 +164,11 @@ li.checked::marker { content: &quot;\2612&quot;; }
<widget class="QComboBox" name="m_cbLicenses"/> <widget class="QComboBox" name="m_cbLicenses"/>
</item> </item>
<item> <item>
<widget class="QPlainTextEdit" name="m_tbLicenses"/> <widget class="QPlainTextEdit" name="m_tbLicenses">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="m_lblLicenses"> <widget class="QLabel" name="m_lblLicenses">
@ -202,7 +206,7 @@ li.checked::marker { content: &quot;\2612&quot;; }
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="textInteractionFlags"> <property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set> <set>Qt::TextInteractionFlag::LinksAccessibleByMouse|Qt::TextInteractionFlag::TextSelectableByMouse</set>
</property> </property>
<property name="openExternalLinks"> <property name="openExternalLinks">
<bool>true</bool> <bool>true</bool>
@ -224,7 +228,7 @@ li.checked::marker { content: &quot;\2612&quot;; }
</attribute> </attribute>
<layout class="QFormLayout" name="formLayout"> <layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy"> <property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum> <enum>QFormLayout::FieldGrowthPolicy::ExpandingFieldsGrow</enum>
</property> </property>
<item row="0" column="0" colspan="2"> <item row="0" column="0" colspan="2">
<widget class="QPlainTextEdit" name="m_tbResources"> <widget class="QPlainTextEdit" name="m_tbResources">
@ -240,7 +244,7 @@ li.checked::marker { content: &quot;\2612&quot;; }
<item> <item>
<widget class="QDialogButtonBox" name="m_buttonBox"> <widget class="QDialogButtonBox" name="m_buttonBox">
<property name="standardButtons"> <property name="standardButtons">
<set>QDialogButtonBox::Ok</set> <set>QDialogButtonBox::StandardButton::Ok</set>
</property> </property>
</widget> </widget>
</item> </item>

View file

@ -119,6 +119,7 @@ QList<Notification::Event> Notification::allEvents() {
return {Event::GeneralEvent, return {Event::GeneralEvent,
Event::NewUnreadArticlesFetched, Event::NewUnreadArticlesFetched,
Event::ArticlesFetchingStarted, Event::ArticlesFetchingStarted,
Event::ArticlesFetchingError,
Event::LoginDataRefreshed, Event::LoginDataRefreshed,
Event::LoginFailure, Event::LoginFailure,
Event::NewAppVersionAvailable, Event::NewAppVersionAvailable,
@ -152,6 +153,9 @@ QString Notification::nameForEvent(Notification::Event event) {
case Notification::Event::NodePackageFailedToUpdate: case Notification::Event::NodePackageFailedToUpdate:
return QObject::tr("Node.js - package(s) failed to update"); return QObject::tr("Node.js - package(s) failed to update");
case Notification::Event::ArticlesFetchingError:
return QObject::tr("Error when fetching articles");
default: default:
return QObject::tr("Unknown event"); return QObject::tr("Unknown event");
} }

View file

@ -40,7 +40,10 @@ class Notification {
NodePackageUpdated = 7, NodePackageUpdated = 7,
// Node.js - package failde to update. // Node.js - package failde to update.
NodePackageFailedToUpdate = 8 NodePackageFailedToUpdate = 8,
// There was at least one error during fetching articles.
ArticlesFetchingError = 9
}; };
explicit Notification(Event event = Event::NoEvent, explicit Notification(Event event = Event::NoEvent,