show subscription update time

This commit is contained in:
arm64v8a
2022-08-05 17:13:59 +08:00
parent 22b042b55b
commit fac593b803
5 changed files with 16 additions and 2 deletions

View File

@@ -182,6 +182,7 @@ namespace NekoRay {
_add(new configItem("order", &order, itemType::integerList));
_add(new configItem("url", &url, itemType::string));
_add(new configItem("info", &info, itemType::string));
_add(new configItem("lastup", &last_update, itemType::integer64));
}
QSharedPointer<Group> ProfileManager::LoadGroup(const QString &jsonPath) {

View File

@@ -12,6 +12,7 @@ namespace NekoRay {
QList<int> order;
QString url = "";
QString info = "";
qint64 last_update = 0;
Group();

View File

@@ -306,6 +306,7 @@ namespace NekoRay::sub {
// 订阅解析前
if (group != nullptr) {
in = group->Profiles();
group->last_update = QDateTime::currentSecsSinceEpoch();
group->info = sub_user_info;
group->order.clear();
group->Save();

View File

@@ -634,6 +634,10 @@
<source>Update %1?</source>
<translation> %1 ?</translation>
</message>
<message>
<source>Last update: %1</source>
<translation> %1</translation>
</message>
</context>
<context>
<name>JsonEditor</name>

View File

@@ -73,12 +73,19 @@ void GroupItem::refresh_data() {
ui->update_sub->hide();
} else {
ui->url->setText(ent->url);
QStringList info;
if (ent->last_update != 0) {
info << tr("Last update: %1").arg(DisplayTime(ent->last_update, QLocale::ShortFormat));
}
auto subinfo = ParseSubInfo(ent->info);
if (subinfo.isEmpty()) {
if (!ent->info.isEmpty()) {
info << subinfo;
}
if (info.isEmpty()) {
ui->subinfo->hide();
} else {
ui->subinfo->show();
ui->subinfo->setText(subinfo);
ui->subinfo->setText(info.join(" | "));
}
}
runOnUiThread([=] {