Display remaining time and better update status in tooltips.
This commit is contained in:
parent
b8f90c8365
commit
bb6ab9ee2f
@ -46,6 +46,19 @@ QList<Message> Feed::undeletedMessages() const {
|
|||||||
|
|
||||||
QVariant Feed::data(int column, int role) const {
|
QVariant Feed::data(int column, int role) const {
|
||||||
switch (role) {
|
switch (role) {
|
||||||
|
case Qt::ToolTipRole:
|
||||||
|
if (column == FDS_MODEL_TITLE_INDEX) {
|
||||||
|
//: Tooltip for feed.
|
||||||
|
return tr("%1"
|
||||||
|
"%2\n\n"
|
||||||
|
"Auto-update status: %3").arg(title(),
|
||||||
|
description().isEmpty() ? QString() : QString('\n') + description(),
|
||||||
|
getAutoUpdateStatusDescription());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return RootItem::data(column, role);
|
||||||
|
}
|
||||||
|
|
||||||
case Qt::ForegroundRole:
|
case Qt::ForegroundRole:
|
||||||
switch (status()) {
|
switch (status()) {
|
||||||
case NewMessages:
|
case NewMessages:
|
||||||
@ -201,3 +214,27 @@ int Feed::updateMessages(const QList<Message> &messages, bool error_during_obtai
|
|||||||
|
|
||||||
return updated_messages;
|
return updated_messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Feed::getAutoUpdateStatusDescription() const {
|
||||||
|
QString auto_update_string;
|
||||||
|
|
||||||
|
switch (autoUpdateType()) {
|
||||||
|
case DontAutoUpdate:
|
||||||
|
//: Describes feed auto-update status.
|
||||||
|
auto_update_string = tr("does not use auto-update");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DefaultAutoUpdate:
|
||||||
|
//: Describes feed auto-update status.
|
||||||
|
auto_update_string = tr("uses global settings (%n minute(s) to next auto-update)", 0, qApp->feedReader()->autoUpdateRemainingInterval());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SpecificAutoUpdate:
|
||||||
|
default:
|
||||||
|
//: Describes feed auto-update status.
|
||||||
|
auto_update_string = tr("uses specific settings (%n minute(s) to next auto-update)", 0, autoUpdateRemainingInterval());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return auto_update_string;
|
||||||
|
}
|
||||||
|
@ -85,6 +85,9 @@ class Feed : public RootItem, public QRunnable {
|
|||||||
void updateCounts(bool including_total_count);
|
void updateCounts(bool including_total_count);
|
||||||
int updateMessages(const QList<Message> &messages, bool error_during_obtaining);
|
int updateMessages(const QList<Message> &messages, bool error_during_obtaining);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QString getAutoUpdateStatusDescription() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void messagesObtained(QList<Message> messages, bool error_during_obtaining);
|
void messagesObtained(QList<Message> messages, bool error_during_obtaining);
|
||||||
|
|
||||||
|
@ -119,29 +119,6 @@ QVariant StandardFeed::data(int column, int role) const {
|
|||||||
switch (role) {
|
switch (role) {
|
||||||
case Qt::ToolTipRole:
|
case Qt::ToolTipRole:
|
||||||
if (column == FDS_MODEL_TITLE_INDEX) {
|
if (column == FDS_MODEL_TITLE_INDEX) {
|
||||||
QString auto_update_string;
|
|
||||||
|
|
||||||
switch (autoUpdateType()) {
|
|
||||||
case DontAutoUpdate:
|
|
||||||
//: Describes feed auto-update status.
|
|
||||||
auto_update_string = tr("does not use auto-update");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DefaultAutoUpdate:
|
|
||||||
//: Describes feed auto-update status.
|
|
||||||
auto_update_string = tr("uses global settings");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SpecificAutoUpdate:
|
|
||||||
default:
|
|
||||||
//: Describes feed auto-update status.
|
|
||||||
auto_update_string = tr("uses specific settings "
|
|
||||||
"(%n minute(s) to next auto-update)",
|
|
||||||
0,
|
|
||||||
autoUpdateRemainingInterval());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//: Tooltip for feed.
|
//: Tooltip for feed.
|
||||||
return tr("%1 (%2)"
|
return tr("%1 (%2)"
|
||||||
"%3\n\n"
|
"%3\n\n"
|
||||||
@ -151,11 +128,11 @@ QVariant StandardFeed::data(int column, int role) const {
|
|||||||
StandardFeed::typeToString(type()),
|
StandardFeed::typeToString(type()),
|
||||||
description().isEmpty() ? QString() : QString('\n') + description(),
|
description().isEmpty() ? QString() : QString('\n') + description(),
|
||||||
encoding(),
|
encoding(),
|
||||||
auto_update_string,
|
getAutoUpdateStatusDescription(),
|
||||||
NetworkFactory::networkErrorText(m_networkError));
|
NetworkFactory::networkErrorText(m_networkError));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return Feed::data(column, role);
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user