mirror of
https://github.com/tnodir/fort
synced 2024-11-15 03:46:13 +00:00
UI: About: Show last success check time
This commit is contained in:
parent
943bfdcba9
commit
1e2d944e28
@ -47,7 +47,10 @@ void AboutPage::onRetranslateUi()
|
||||
|
||||
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()
|
||||
@ -123,6 +126,7 @@ void AboutPage::setupNewVersionUpdate()
|
||||
auto taskInfo = taskManager()->taskInfoUpdateChecker();
|
||||
|
||||
m_isNewVersion = taskInfo->isNewVersion();
|
||||
m_lastCheckTime = taskInfo->lastSuccess();
|
||||
|
||||
m_labelArea->setVisible(m_isNewVersion);
|
||||
m_labelRelease->setText(taskInfo->releaseText());
|
||||
@ -138,6 +142,12 @@ void AboutPage::setupNewVersionUpdate()
|
||||
refreshNewVersion();
|
||||
|
||||
connect(taskManager(), &TaskManager::appVersionUpdated, this, refreshNewVersion);
|
||||
|
||||
connect(taskManager(), &TaskManager::taskFinished, this, [=, this](qint8 taskType) {
|
||||
if (taskType == TaskInfo::UpdateChecker) {
|
||||
refreshNewVersion();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void AboutPage::setupAutoUpdate()
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef ABOUTPAGE_H
|
||||
#define ABOUTPAGE_H
|
||||
|
||||
#include <QDateTime>
|
||||
|
||||
#include "homebasepage.h"
|
||||
|
||||
class AboutPage : public HomeBasePage
|
||||
@ -24,6 +26,7 @@ private:
|
||||
|
||||
private:
|
||||
bool m_isNewVersion = false;
|
||||
QDateTime m_lastCheckTime;
|
||||
|
||||
QGroupBox *m_gbNewVersion = nullptr;
|
||||
QLabel *m_labelRelease = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user