mirror of
https://github.com/tnodir/fort
synced 2024-11-15 06:32:56 +00:00
UI: TaskUpdateChecker: Show message about new version.
This commit is contained in:
parent
a296c50492
commit
e3554008d7
@ -216,9 +216,22 @@ void FortManager::exit(int retcode)
|
||||
qApp->exit(retcode);
|
||||
}
|
||||
|
||||
void FortManager::showErrorBox(const QString &text)
|
||||
void FortManager::showErrorBox(const QString &text,
|
||||
const QString &title)
|
||||
{
|
||||
QMessageBox::warning(&m_window, QString(), text);
|
||||
QMessageBox::warning(&m_window, title, text);
|
||||
}
|
||||
|
||||
void FortManager::showInfoBox(const QString &text,
|
||||
const QString &title)
|
||||
{
|
||||
QMessageBox box(&m_window);
|
||||
box.setIcon(QMessageBox::Information);
|
||||
box.setStandardButtons(QMessageBox::Ok);
|
||||
box.setWindowTitle(title);
|
||||
box.setText(text);
|
||||
box.setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
box.exec();
|
||||
}
|
||||
|
||||
bool FortManager::saveOriginConf(const QString &message)
|
||||
|
@ -49,7 +49,10 @@ public slots:
|
||||
|
||||
void exit(int retcode = 0);
|
||||
|
||||
void showErrorBox(const QString &text);
|
||||
void showErrorBox(const QString &text,
|
||||
const QString &title = QString());
|
||||
void showInfoBox(const QString &text,
|
||||
const QString &title = QString());
|
||||
|
||||
bool saveOriginConf(const QString &message);
|
||||
bool saveConf(bool onlyFlags = false);
|
||||
|
Binary file not shown.
@ -19,17 +19,17 @@
|
||||
<translation>Конфигурация слишком большая</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../util/confutil.cpp" line="114"/>
|
||||
<location filename="../util/confutil.cpp" line="113"/>
|
||||
<source>Number of Application Groups must be < %1</source>
|
||||
<translation>Количество групп приложений должно быть < %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../util/confutil.cpp" line="126"/>
|
||||
<location filename="../util/confutil.cpp" line="125"/>
|
||||
<source>Length of Application Group's Name must be < %1</source>
|
||||
<translation>Длина наименования группы приложения должна быть < %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../util/confutil.cpp" line="168"/>
|
||||
<location filename="../util/confutil.cpp" line="167"/>
|
||||
<source>Length of Application's Path must be < %1</source>
|
||||
<translation>Длина пути приложения должна быть < %1</translation>
|
||||
</message>
|
||||
@ -37,22 +37,22 @@
|
||||
<context>
|
||||
<name>FortManager</name>
|
||||
<message>
|
||||
<location filename="../fortmanager.cpp" line="387"/>
|
||||
<location filename="../fortmanager.cpp" line="394"/>
|
||||
<source>Options</source>
|
||||
<translation>Опции</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../fortmanager.cpp" line="392"/>
|
||||
<location filename="../fortmanager.cpp" line="399"/>
|
||||
<source>Filter Enabled</source>
|
||||
<translation>Фильтр включен</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../fortmanager.cpp" line="396"/>
|
||||
<location filename="../fortmanager.cpp" line="403"/>
|
||||
<source>Stop Traffic</source>
|
||||
<translation>Отключить трафик</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../fortmanager.cpp" line="411"/>
|
||||
<location filename="../fortmanager.cpp" line="418"/>
|
||||
<source>Quit</source>
|
||||
<translation>Выйти</translation>
|
||||
</message>
|
||||
@ -145,6 +145,14 @@
|
||||
<translation>TAS-IX адреса обновлены!</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>TaskUpdateChecker</name>
|
||||
<message>
|
||||
<location filename="../task/taskupdatechecker.cpp" line="35"/>
|
||||
<source>New version!</source>
|
||||
<translation>Новая версия!</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>TaskUzonline</name>
|
||||
<message>
|
||||
|
@ -75,10 +75,10 @@ bool TaskManager::saveSettings(FortSettings *fortSettings)
|
||||
|
||||
void TaskManager::handleTaskFinished(bool success)
|
||||
{
|
||||
TaskInfo *taskInfo = qobject_cast<TaskInfo *>(sender());
|
||||
|
||||
if (success) {
|
||||
TaskInfo *taskInfo = qobject_cast<TaskInfo *>(sender());
|
||||
TaskWorker *taskWorker = taskInfo->taskWorker();
|
||||
|
||||
taskWorker->processResult(m_fortManager);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "taskupdatechecker.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QJsonDocument>
|
||||
#include <QVariant>
|
||||
|
||||
@ -8,6 +9,7 @@
|
||||
#include "../fortmanager.h"
|
||||
#endif
|
||||
#include "../util/net/netdownloader.h"
|
||||
#include "../util/net/netutil.h"
|
||||
|
||||
TaskUpdateChecker::TaskUpdateChecker(QObject *parent) :
|
||||
TaskDownloader(parent)
|
||||
@ -31,7 +33,7 @@ void TaskUpdateChecker::downloadFinished(bool success)
|
||||
bool TaskUpdateChecker::processResult(FortManager *fortManager)
|
||||
{
|
||||
#ifndef TASK_TEST
|
||||
fortManager->showTrayMessage(m_releaseName);
|
||||
fortManager->showInfoBox(successMessage(), tr("New version!"));
|
||||
#else
|
||||
Q_UNUSED(fortManager)
|
||||
#endif
|
||||
@ -82,3 +84,17 @@ bool TaskUpdateChecker::parseBuffer(const QByteArray &buffer)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QString TaskUpdateChecker::successMessage() const
|
||||
{
|
||||
const QDateTime publishedTime = QDateTime::fromString(
|
||||
m_publishedAt, Qt::ISODate);
|
||||
|
||||
return "<b>" + m_releaseName + "</b> (<i>"
|
||||
+ publishedTime.toString("dd-MMM-yyyy hh:mm") + "</i>, "
|
||||
+ NetUtil::formatDataSize(m_downloadSize)
|
||||
+ ", #" + QString::number(m_downloadCount)
|
||||
+ "):<br/>\n"
|
||||
+ m_releaseNotes + "<br/><br/>\n"
|
||||
+ "<a href=\"" + m_downloadUrl + "\">" + m_downloadUrl + "</a>";
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ protected slots:
|
||||
private:
|
||||
bool parseBuffer(const QByteArray &buffer);
|
||||
|
||||
QString successMessage() const;
|
||||
|
||||
private:
|
||||
QString m_releaseName;
|
||||
QString m_publishedAt;
|
||||
|
Loading…
Reference in New Issue
Block a user