mirror of
https://github.com/tnodir/fort
synced 2024-11-15 09:17:28 +00:00
UI: Tasks: Add debug outputs
This commit is contained in:
parent
412f42e5e6
commit
9161639eaa
@ -152,10 +152,9 @@ void TaskInfo::setupTaskWorker()
|
|||||||
|
|
||||||
void TaskInfo::runTaskWorker()
|
void TaskInfo::runTaskWorker()
|
||||||
{
|
{
|
||||||
if (aborted() || !taskWorker())
|
if (taskWorker()) {
|
||||||
return;
|
taskWorker()->run();
|
||||||
|
}
|
||||||
taskWorker()->run();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskInfo::abortTask()
|
void TaskInfo::abortTask()
|
||||||
|
@ -1,10 +1,18 @@
|
|||||||
#include "taskinfoapppurger.h"
|
#include "taskinfoapppurger.h"
|
||||||
|
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
#include <conf/confappmanager.h>
|
#include <conf/confappmanager.h>
|
||||||
#include <util/ioc/ioccontainer.h>
|
#include <util/ioc/ioccontainer.h>
|
||||||
|
|
||||||
#include "taskmanager.h"
|
#include "taskmanager.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
const QLoggingCategory LC("task.appPurger");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
TaskInfoAppPurger::TaskInfoAppPurger(TaskManager &taskManager) :
|
TaskInfoAppPurger::TaskInfoAppPurger(TaskManager &taskManager) :
|
||||||
TaskInfo(AppPurger, taskManager) { }
|
TaskInfo(AppPurger, taskManager) { }
|
||||||
|
|
||||||
@ -13,5 +21,7 @@ void TaskInfoAppPurger::runTaskWorker()
|
|||||||
// TODO: Use worker to run in a separate thread to not block the UI
|
// TODO: Use worker to run in a separate thread to not block the UI
|
||||||
const bool ok = IoC<ConfAppManager>()->purgeApps();
|
const bool ok = IoC<ConfAppManager>()->purgeApps();
|
||||||
|
|
||||||
|
qCDebug(LC) << "Purged:" << ok;
|
||||||
|
|
||||||
handleFinished(ok);
|
handleFinished(ok);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "taskinfoupdatechecker.h"
|
#include "taskinfoupdatechecker.h"
|
||||||
|
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
|
#include <QLoggingCategory>
|
||||||
#include <QVersionNumber>
|
#include <QVersionNumber>
|
||||||
|
|
||||||
#include <fort_version.h>
|
#include <fort_version.h>
|
||||||
@ -8,7 +9,13 @@
|
|||||||
#include "taskmanager.h"
|
#include "taskmanager.h"
|
||||||
#include "taskupdatechecker.h"
|
#include "taskupdatechecker.h"
|
||||||
|
|
||||||
#define TASK_INFO_VERSION 2
|
namespace {
|
||||||
|
|
||||||
|
const QLoggingCategory LC("task.updateChecker");
|
||||||
|
|
||||||
|
constexpr int TASK_INFO_VERSION = 2;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
TaskInfoUpdateChecker::TaskInfoUpdateChecker(TaskManager &taskManager) :
|
TaskInfoUpdateChecker::TaskInfoUpdateChecker(TaskManager &taskManager) :
|
||||||
TaskInfo(UpdateChecker, taskManager)
|
TaskInfo(UpdateChecker, taskManager)
|
||||||
@ -71,13 +78,17 @@ TaskUpdateChecker *TaskInfoUpdateChecker::updateChecker() const
|
|||||||
|
|
||||||
bool TaskInfoUpdateChecker::processResult(bool success)
|
bool TaskInfoUpdateChecker::processResult(bool success)
|
||||||
{
|
{
|
||||||
if (!success)
|
if (!success) {
|
||||||
|
qCDebug(LC) << "Failed";
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const auto worker = updateChecker();
|
const auto worker = updateChecker();
|
||||||
|
|
||||||
if (m_version == worker->version())
|
if (m_version == worker->version()) {
|
||||||
|
qCDebug(LC) << "Same version";
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
m_version = worker->version();
|
m_version = worker->version();
|
||||||
m_downloadUrl = worker->downloadUrl();
|
m_downloadUrl = worker->downloadUrl();
|
||||||
@ -86,7 +97,11 @@ bool TaskInfoUpdateChecker::processResult(bool success)
|
|||||||
emitAppVersionUpdated();
|
emitAppVersionUpdated();
|
||||||
|
|
||||||
if (isNewVersion()) {
|
if (isNewVersion()) {
|
||||||
|
qCDebug(LC) << "New version found:" << m_version;
|
||||||
|
|
||||||
emit taskManager()->appVersionDownloaded(m_version);
|
emit taskManager()->appVersionDownloaded(m_version);
|
||||||
|
} else {
|
||||||
|
qCDebug(LC) << "Old version found:" << m_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "taskinfozonedownloader.h"
|
#include "taskinfozonedownloader.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
#include <conf/confzonemanager.h>
|
#include <conf/confzonemanager.h>
|
||||||
#include <fortsettings.h>
|
#include <fortsettings.h>
|
||||||
@ -14,6 +15,12 @@
|
|||||||
#include "taskmanager.h"
|
#include "taskmanager.h"
|
||||||
#include "taskzonedownloader.h"
|
#include "taskzonedownloader.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
const QLoggingCategory LC("task.zoneDownloader");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
TaskInfoZoneDownloader::TaskInfoZoneDownloader(TaskManager &taskManager) :
|
TaskInfoZoneDownloader::TaskInfoZoneDownloader(TaskManager &taskManager) :
|
||||||
TaskInfo(ZoneDownloader, taskManager)
|
TaskInfo(ZoneDownloader, taskManager)
|
||||||
{
|
{
|
||||||
@ -31,8 +38,12 @@ ZoneListModel *TaskInfoZoneDownloader::zoneListModel() const
|
|||||||
|
|
||||||
bool TaskInfoZoneDownloader::processResult(bool success)
|
bool TaskInfoZoneDownloader::processResult(bool success)
|
||||||
{
|
{
|
||||||
if (!success)
|
if (!success) {
|
||||||
|
qCDebug(LC) << "No updates";
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
qCDebug(LC) << "Updated:" << m_zoneNames;
|
||||||
|
|
||||||
emit taskManager()->zonesDownloaded(m_zoneNames);
|
emit taskManager()->zonesDownloaded(m_zoneNames);
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#define DOWNLOAD_MAXSIZE (8 * 1024 * 1024)
|
#define DOWNLOAD_MAXSIZE (8 * 1024 * 1024)
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
const QLoggingCategory LC("util.net.netDownloader");
|
const QLoggingCategory LC("util.net.downloader");
|
||||||
}
|
}
|
||||||
|
|
||||||
NetDownloader::NetDownloader(QObject *parent) :
|
NetDownloader::NetDownloader(QObject *parent) :
|
||||||
@ -16,7 +16,7 @@ NetDownloader::NetDownloader(QObject *parent) :
|
|||||||
m_downloadTimer.setInterval(DOWNLOAD_TIMEOUT);
|
m_downloadTimer.setInterval(DOWNLOAD_TIMEOUT);
|
||||||
|
|
||||||
connect(&m_downloadTimer, &QTimer::timeout, this, [&] {
|
connect(&m_downloadTimer, &QTimer::timeout, this, [&] {
|
||||||
qCDebug(LC) << "NetDownloader: Error: Download timed out";
|
qCDebug(LC) << "Error: Download timed out";
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
});
|
});
|
||||||
@ -31,7 +31,7 @@ QByteArray NetDownloader::takeBuffer()
|
|||||||
|
|
||||||
void NetDownloader::start()
|
void NetDownloader::start()
|
||||||
{
|
{
|
||||||
qCDebug(LC) << "NetDownloader: Start:" << url() << data();
|
qCDebug(LC) << "Fetch:" << url() << data();
|
||||||
|
|
||||||
m_started = true;
|
m_started = true;
|
||||||
m_aborted = false;
|
m_aborted = false;
|
||||||
@ -85,7 +85,7 @@ void NetDownloader::onDownloadProgress(qint64 bytesReceived, qint64 /*bytesTotal
|
|||||||
|
|
||||||
m_buffer.append(data);
|
m_buffer.append(data);
|
||||||
if (m_buffer.size() >= DOWNLOAD_MAXSIZE) {
|
if (m_buffer.size() >= DOWNLOAD_MAXSIZE) {
|
||||||
qCWarning(LC) << "NetDownloader: Error: Too big file";
|
qCWarning(LC) << "Error: Too big file";
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ void NetDownloader::onErrorOccurred(QNetworkReply::NetworkError error)
|
|||||||
if (m_aborted)
|
if (m_aborted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
qCWarning(LC) << "NetDownloader: Error:" << error << m_reply->errorString();
|
qCWarning(LC) << "Error:" << error << m_reply->errorString();
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ void NetDownloader::onSslErrors(const QList<QSslError> &errors)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (const QSslError &error : errors) {
|
for (const QSslError &error : errors) {
|
||||||
qCWarning(LC) << "NetDownloader: SSL Error:" << error.errorString();
|
qCWarning(LC) << "SSL Error:" << error.errorString();
|
||||||
}
|
}
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
|
Loading…
Reference in New Issue
Block a user