lang generate
This commit is contained in:
parent
ff693de5bd
commit
6e0fe00d8d
4 changed files with 46 additions and 44 deletions
|
@ -218,27 +218,27 @@ version by clicking this popup notification.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<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>
|
<source>Go to previous page</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<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>
|
<source>Go to next page</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<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>
|
<source>Open article in article list</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<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>
|
<source>Open article in web browser</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message numerus="yes">
|
<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>
|
<source>%n feeds fetched</source>
|
||||||
<translation type="unfinished">
|
<translation type="unfinished">
|
||||||
<numerusform></numerusform>
|
<numerusform></numerusform>
|
||||||
|
@ -7532,26 +7532,6 @@ Unread news: %2</translation>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ToastNotification</name>
|
<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>
|
<message>
|
||||||
<location filename="../src/librssguard/gui/notifications/toastnotification.cpp" line="36"/>
|
<location filename="../src/librssguard/gui/notifications/toastnotification.cpp" line="36"/>
|
||||||
<source>Do it!</source>
|
<source>Do it!</source>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "core/articlelistnotificationmodel.h"
|
#include "core/articlelistnotificationmodel.h"
|
||||||
#include "miscellaneous/iconfactory.h"
|
#include "miscellaneous/iconfactory.h"
|
||||||
|
#include "network-web/webfactory.h"
|
||||||
|
|
||||||
#include <QTreeView>
|
#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_btnOpenArticleList->setIcon(qApp->icons()->fromTheme(QSL("view-list-details")));
|
||||||
m_ui.m_btnOpenWebBrowser->setIcon(qApp->icons()->fromTheme(QSL("document-open")));
|
m_ui.m_btnOpenWebBrowser->setIcon(qApp->icons()->fromTheme(QSL("document-open")));
|
||||||
|
|
||||||
|
m_ui.m_treeArticles->setModel(m_model);
|
||||||
|
|
||||||
connect(m_model,
|
connect(m_model,
|
||||||
&ArticleListNotificationModel::nextPagePossibleChanged,
|
&ArticleListNotificationModel::nextPagePossibleChanged,
|
||||||
m_ui.m_btnNextPage,
|
m_ui.m_btnNextPage,
|
||||||
|
@ -29,6 +32,11 @@ ArticleListNotification::ArticleListNotification(QWidget* parent)
|
||||||
&PlainToolButton::setEnabled);
|
&PlainToolButton::setEnabled);
|
||||||
connect(m_ui.m_btnNextPage, &PlainToolButton::clicked, m_model, &ArticleListNotificationModel::nextPage);
|
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_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(),
|
connect(m_ui.m_treeArticles->selectionModel(),
|
||||||
&QItemSelectionModel::currentChanged,
|
&QItemSelectionModel::currentChanged,
|
||||||
this,
|
this,
|
||||||
|
@ -42,7 +50,6 @@ ArticleListNotification::ArticleListNotification(QWidget* parent)
|
||||||
pal.setColor(QPalette::ColorRole::Base, Qt::transparent);
|
pal.setColor(QPalette::ColorRole::Base, Qt::transparent);
|
||||||
|
|
||||||
m_ui.m_treeArticles->setPalette(pal);
|
m_ui.m_treeArticles->setPalette(pal);
|
||||||
m_ui.m_treeArticles->setModel(m_model);
|
|
||||||
|
|
||||||
connect(m_ui.m_cmbFeeds,
|
connect(m_ui.m_cmbFeeds,
|
||||||
QOverload<int>::of(&QComboBox::currentIndexChanged),
|
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_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();
|
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));
|
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) {
|
void ArticleListNotification::onMessageSelected(const QModelIndex& current, const QModelIndex& previous) {
|
||||||
m_ui.m_btnOpenArticleList->setEnabled(current.isValid());
|
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) {
|
void ArticleListNotification::showFeed(int index) {
|
||||||
m_model->setArticles(m_newMessages.value(m_ui.m_cmbFeeds->itemData(index).value<Feed*>()));
|
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 {
|
Message ArticleListNotification::selectedMessage() const {
|
||||||
|
|
|
@ -20,9 +20,14 @@ class ArticleListNotification : public BaseToastNotification {
|
||||||
|
|
||||||
void loadResults(const QHash<Feed*, QList<Message>>& new_messages);
|
void loadResults(const QHash<Feed*, QList<Message>>& new_messages);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void openingArticleInArticleListRequested(Feed* feed, const Message& msg);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void openArticleInArticleList();
|
||||||
void onMessageSelected(const QModelIndex& current, const QModelIndex& previous);
|
void onMessageSelected(const QModelIndex& current, const QModelIndex& previous);
|
||||||
void showFeed(int index);
|
void showFeed(int index);
|
||||||
|
void openArticleInWebBrowser();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Message selectedMessage() const;
|
Message selectedMessage() const;
|
||||||
|
|
|
@ -39,11 +39,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="PlainToolButton" name="m_btnClose">
|
<widget class="PlainToolButton" name="m_btnClose"/>
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
@ -55,9 +51,6 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
|
||||||
<string>11</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
||||||
</property>
|
</property>
|
||||||
|
@ -65,9 +58,6 @@
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QLabel" name="m_lblBody">
|
<widget class="QLabel" name="m_lblBody">
|
||||||
<property name="text">
|
|
||||||
<string>TextLabel</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
</property>
|
</property>
|
||||||
|
@ -79,11 +69,7 @@
|
||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<layout class="QHBoxLayout" name="m_actionLayout">
|
<layout class="QHBoxLayout" name="m_actionLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="m_btnAction">
|
<widget class="QPushButton" name="m_btnAction"/>
|
||||||
<property name="text">
|
|
||||||
<string>PushButton</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
|
|
Loading…
Add table
Reference in a new issue