GUI code moved out of FeedsModel.
This commit is contained in:
parent
99e53c3309
commit
f5fe206a30
3 changed files with 3 additions and 5 deletions
|
@ -456,10 +456,7 @@ void FeedsModel::reloadChangedItem(RootItem *item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeedsModel::notifyWithCounts() {
|
void FeedsModel::notifyWithCounts() {
|
||||||
if (SystemTrayIcon::isSystemTrayActivated()) {
|
emit messageCountsChanged(countOfUnreadMessages(), hasAnyFeedNewMessages());
|
||||||
// TODO: Udělat přes signál, jádro by nemělo inkludovat GUI prvky.
|
|
||||||
qApp->trayIcon()->setNumber(countOfUnreadMessages(), hasAnyFeedNewMessages());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeedsModel::onItemDataChanged(const QList<RootItem *> &items) {
|
void FeedsModel::onItemDataChanged(const QList<RootItem *> &items) {
|
||||||
|
|
|
@ -155,7 +155,7 @@ class FeedsModel : public QAbstractItemModel {
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
// Emitted if counts of messages are changed.
|
// Emitted if counts of messages are changed.
|
||||||
void messageCountsChanged(int unread_messages, int total_messages, bool any_feed_has_unread_messages);
|
void messageCountsChanged(int unread_messages, bool any_feed_has_unread_messages);
|
||||||
|
|
||||||
// Emitted if any item requested that any view should expand it.
|
// Emitted if any item requested that any view should expand it.
|
||||||
void itemExpandRequested(QList<RootItem*> items, bool expand);
|
void itemExpandRequested(QList<RootItem*> items, bool expand);
|
||||||
|
|
|
@ -275,6 +275,7 @@ SystemTrayIcon *Application::trayIcon() {
|
||||||
if (m_trayIcon == nullptr) {
|
if (m_trayIcon == nullptr) {
|
||||||
m_trayIcon = new SystemTrayIcon(APP_ICON_PATH, APP_ICON_PLAIN_PATH, m_mainForm);
|
m_trayIcon = new SystemTrayIcon(APP_ICON_PATH, APP_ICON_PLAIN_PATH, m_mainForm);
|
||||||
connect(m_trayIcon, &SystemTrayIcon::shown, m_feedReader->feedsModel(), &FeedsModel::notifyWithCounts);
|
connect(m_trayIcon, &SystemTrayIcon::shown, m_feedReader->feedsModel(), &FeedsModel::notifyWithCounts);
|
||||||
|
connect(m_feedReader->feedsModel(), &FeedsModel::messageCountsChanged, m_trayIcon, &SystemTrayIcon::setNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_trayIcon;
|
return m_trayIcon;
|
||||||
|
|
Loading…
Add table
Reference in a new issue