UI: About: Show last success check time

This commit is contained in:
Nodir Temirkhodjaev 2024-08-17 13:48:02 +05:00
parent 943bfdcba9
commit 1e2d944e28
2 changed files with 14 additions and 1 deletions

View File

@ -47,7 +47,10 @@ void AboutPage::onRetranslateUi()
void AboutPage::retranslateNewVersionBox() void AboutPage::retranslateNewVersionBox()
{ {
m_gbNewVersion->setTitle(m_isNewVersion ? tr("New Version") : tr("No Update")); const auto title = m_isNewVersion ? tr("New Version") : tr("No Update");
const auto lastTime = DateUtil::localeDateTime(m_lastCheckTime);
m_gbNewVersion->setTitle(QString("%1 — %2").arg(lastTime, title));
} }
void AboutPage::setupUi() void AboutPage::setupUi()
@ -123,6 +126,7 @@ void AboutPage::setupNewVersionUpdate()
auto taskInfo = taskManager()->taskInfoUpdateChecker(); auto taskInfo = taskManager()->taskInfoUpdateChecker();
m_isNewVersion = taskInfo->isNewVersion(); m_isNewVersion = taskInfo->isNewVersion();
m_lastCheckTime = taskInfo->lastSuccess();
m_labelArea->setVisible(m_isNewVersion); m_labelArea->setVisible(m_isNewVersion);
m_labelRelease->setText(taskInfo->releaseText()); m_labelRelease->setText(taskInfo->releaseText());
@ -138,6 +142,12 @@ void AboutPage::setupNewVersionUpdate()
refreshNewVersion(); refreshNewVersion();
connect(taskManager(), &TaskManager::appVersionUpdated, this, refreshNewVersion); connect(taskManager(), &TaskManager::appVersionUpdated, this, refreshNewVersion);
connect(taskManager(), &TaskManager::taskFinished, this, [=, this](qint8 taskType) {
if (taskType == TaskInfo::UpdateChecker) {
refreshNewVersion();
}
});
} }
void AboutPage::setupAutoUpdate() void AboutPage::setupAutoUpdate()

View File

@ -1,6 +1,8 @@
#ifndef ABOUTPAGE_H #ifndef ABOUTPAGE_H
#define ABOUTPAGE_H #define ABOUTPAGE_H
#include <QDateTime>
#include "homebasepage.h" #include "homebasepage.h"
class AboutPage : public HomeBasePage class AboutPage : public HomeBasePage
@ -24,6 +26,7 @@ private:
private: private:
bool m_isNewVersion = false; bool m_isNewVersion = false;
QDateTime m_lastCheckTime;
QGroupBox *m_gbNewVersion = nullptr; QGroupBox *m_gbNewVersion = nullptr;
QLabel *m_labelRelease = nullptr; QLabel *m_labelRelease = nullptr;