lang generate

This commit is contained in:
Martin Rotter 2023-09-25 09:44:22 +02:00
parent ff693de5bd
commit 6e0fe00d8d
4 changed files with 46 additions and 44 deletions

View File

@ -218,27 +218,27 @@ version by clicking this popup notification.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/librssguard/gui/notifications/articlelistnotification.ui" line="80"/>
<location filename="../src/librssguard/gui/notifications/articlelistnotification.ui" line="106"/>
<source>Go to previous page</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/librssguard/gui/notifications/articlelistnotification.ui" line="87"/>
<location filename="../src/librssguard/gui/notifications/articlelistnotification.ui" line="113"/>
<source>Go to next page</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/librssguard/gui/notifications/articlelistnotification.ui" line="123"/>
<location filename="../src/librssguard/gui/notifications/articlelistnotification.ui" line="120"/>
<source>Open article in article list</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/librssguard/gui/notifications/articlelistnotification.ui" line="130"/>
<location filename="../src/librssguard/gui/notifications/articlelistnotification.ui" line="127"/>
<source>Open article in web browser</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="../src/librssguard/gui/notifications/articlelistnotification.cpp" line="47"/>
<location filename="../src/librssguard/gui/notifications/articlelistnotification.cpp" line="65"/>
<source>%n feeds fetched</source>
<translation type="unfinished">
<numerusform></numerusform>
@ -7532,26 +7532,6 @@ Unread news: %2</translation>
</context>
<context>
<name>ToastNotification</name>
<message>
<location filename="../src/librssguard/gui/notifications/toastnotification.ui" line="44"/>
<source>...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/librssguard/gui/notifications/toastnotification.ui" line="59"/>
<source>11</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/librssguard/gui/notifications/toastnotification.ui" line="69"/>
<source>TextLabel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/librssguard/gui/notifications/toastnotification.ui" line="84"/>
<source>PushButton</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/librssguard/gui/notifications/toastnotification.cpp" line="36"/>
<source>Do it!</source>

View File

@ -4,6 +4,7 @@
#include "core/articlelistnotificationmodel.h"
#include "miscellaneous/iconfactory.h"
#include "network-web/webfactory.h"
#include <QTreeView>
@ -19,6 +20,8 @@ ArticleListNotification::ArticleListNotification(QWidget* parent)
m_ui.m_btnOpenArticleList->setIcon(qApp->icons()->fromTheme(QSL("view-list-details")));
m_ui.m_btnOpenWebBrowser->setIcon(qApp->icons()->fromTheme(QSL("document-open")));
m_ui.m_treeArticles->setModel(m_model);
connect(m_model,
&ArticleListNotificationModel::nextPagePossibleChanged,
m_ui.m_btnNextPage,
@ -29,6 +32,11 @@ ArticleListNotification::ArticleListNotification(QWidget* parent)
&PlainToolButton::setEnabled);
connect(m_ui.m_btnNextPage, &PlainToolButton::clicked, m_model, &ArticleListNotificationModel::nextPage);
connect(m_ui.m_btnPreviousPage, &PlainToolButton::clicked, m_model, &ArticleListNotificationModel::previousPage);
connect(m_ui.m_btnOpenWebBrowser, &PlainToolButton::clicked, this, &ArticleListNotification::openArticleInWebBrowser);
connect(m_ui.m_btnOpenArticleList,
&PlainToolButton::clicked,
this,
&ArticleListNotification::openArticleInArticleList);
connect(m_ui.m_treeArticles->selectionModel(),
&QItemSelectionModel::currentChanged,
this,
@ -42,7 +50,6 @@ ArticleListNotification::ArticleListNotification(QWidget* parent)
pal.setColor(QPalette::ColorRole::Base, Qt::transparent);
m_ui.m_treeArticles->setPalette(pal);
m_ui.m_treeArticles->setModel(m_model);
connect(m_ui.m_cmbFeeds,
QOverload<int>::of(&QComboBox::currentIndexChanged),
@ -57,20 +64,44 @@ void ArticleListNotification::loadResults(const QHash<Feed*, QList<Message>>& ne
m_ui.m_lblTitle->setText(tr("%n feeds fetched", nullptr, new_messages.size()));
m_ui.m_cmbFeeds->model()->sort(0, Qt::SortOrder::AscendingOrder);
m_ui.m_cmbFeeds->clear();
for (Feed* fd : new_messages.keys()) {
auto ks = new_messages.keys();
std::sort(ks.begin(), ks.end(), [](Feed* lhs, Feed* rhs) {
return QString::compare(lhs->sanitizedTitle(), rhs->sanitizedTitle(), Qt::CaseSensitivity::CaseInsensitive) < 0;
});
for (Feed* fd : ks) {
m_ui.m_cmbFeeds->addItem(fd->sanitizedTitle(), QVariant::fromValue(fd));
}
}
void ArticleListNotification::openArticleInArticleList() {
emit openingArticleInArticleListRequested(m_ui.m_cmbFeeds->currentData().value<Feed*>(), selectedMessage());
}
void ArticleListNotification::onMessageSelected(const QModelIndex& current, const QModelIndex& previous) {
m_ui.m_btnOpenArticleList->setEnabled(current.isValid());
m_ui.m_btnOpenWebBrowser->setEnabled(current.isValid());
try {
Message msg = selectedMessage();
m_ui.m_btnOpenWebBrowser->setEnabled(!msg.m_url.isEmpty());
}
catch (...) {
m_ui.m_btnOpenWebBrowser->setEnabled(false);
}
}
void ArticleListNotification::showFeed(int index) {
m_model->setArticles(m_newMessages.value(m_ui.m_cmbFeeds->itemData(index).value<Feed*>()));
onMessageSelected({}, {});
}
void ArticleListNotification::openArticleInWebBrowser() {
qApp->web()->openUrlInExternalBrowser(selectedMessage().m_url);
}
Message ArticleListNotification::selectedMessage() const {

View File

@ -20,9 +20,14 @@ class ArticleListNotification : public BaseToastNotification {
void loadResults(const QHash<Feed*, QList<Message>>& new_messages);
signals:
void openingArticleInArticleListRequested(Feed* feed, const Message& msg);
private slots:
void openArticleInArticleList();
void onMessageSelected(const QModelIndex& current, const QModelIndex& previous);
void showFeed(int index);
void openArticleInWebBrowser();
private:
Message selectedMessage() const;

View File

@ -39,11 +39,7 @@
</widget>
</item>
<item>
<widget class="PlainToolButton" name="m_btnClose">
<property name="text">
<string>...</string>
</property>
</widget>
<widget class="PlainToolButton" name="m_btnClose"/>
</item>
</layout>
</item>
@ -55,9 +51,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>11</string>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
@ -65,9 +58,6 @@
</item>
<item row="1" column="1">
<widget class="QLabel" name="m_lblBody">
<property name="text">
<string>TextLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
@ -79,11 +69,7 @@
<item row="2" column="1">
<layout class="QHBoxLayout" name="m_actionLayout">
<item>
<widget class="QPushButton" name="m_btnAction">
<property name="text">
<string>PushButton</string>
</property>
</widget>
<widget class="QPushButton" name="m_btnAction"/>
</item>
<item>
<spacer name="horizontalSpacer">