mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-23 05:45:35 +08:00
Ref T28, using background updater in mapping tool
This commit is contained in:
committed by
Mathew Sutcliffe
parent
f4af5e6cc1
commit
66e729b090
@@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "swiftdata.h"
|
#include "swiftdata.h"
|
||||||
|
#include "blackcore/db/backgrounddataupdater.h"
|
||||||
#include "blackcore/data/globalsetup.h"
|
#include "blackcore/data/globalsetup.h"
|
||||||
#include "blackgui/components/datamaininfoareacomponent.h"
|
#include "blackgui/components/datamaininfoareacomponent.h"
|
||||||
#include "blackgui/components/dbmappingcomponent.h"
|
#include "blackgui/components/dbmappingcomponent.h"
|
||||||
@@ -36,6 +37,7 @@ using namespace BlackMisc::Network;
|
|||||||
using namespace BlackMisc::Simulation;
|
using namespace BlackMisc::Simulation;
|
||||||
using namespace BlackCore;
|
using namespace BlackCore;
|
||||||
using namespace BlackCore::Data;
|
using namespace BlackCore::Data;
|
||||||
|
using namespace BlackCore::Db;
|
||||||
using namespace BlackGui;
|
using namespace BlackGui;
|
||||||
using namespace BlackGui::Components;
|
using namespace BlackGui::Components;
|
||||||
using namespace BlackConfig;
|
using namespace BlackConfig;
|
||||||
@@ -151,6 +153,28 @@ void CSwiftData::performGracefulShutdown()
|
|||||||
// void
|
// void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSwiftData::consolidationSettingChanged()
|
||||||
|
{
|
||||||
|
int consolidationSecs = m_consolidationSettings.get();
|
||||||
|
if (consolidationSecs < 0)
|
||||||
|
{
|
||||||
|
if (m_updater)
|
||||||
|
{
|
||||||
|
m_updater->gracefulShutdown();
|
||||||
|
m_updater.reset(nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!m_updater)
|
||||||
|
{
|
||||||
|
m_updater.reset(new CBackgroundDataUpdater(this));
|
||||||
|
m_updater->start(QThread::LowestPriority);
|
||||||
|
}
|
||||||
|
m_updater->startUpdating(consolidationSecs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CSwiftData::displayConsole()
|
void CSwiftData::displayConsole()
|
||||||
{
|
{
|
||||||
ui->comp_MainInfoArea->displayConsole();
|
ui->comp_MainInfoArea->displayConsole();
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#ifndef SWIFTDATA_H
|
#ifndef SWIFTDATA_H
|
||||||
#define SWIFTDATA_H
|
#define SWIFTDATA_H
|
||||||
|
|
||||||
|
#include "blackgui/settings/guisettings.h"
|
||||||
#include "blackgui/mainwindowaccess.h"
|
#include "blackgui/mainwindowaccess.h"
|
||||||
#include "blackgui/managedstatusbar.h"
|
#include "blackgui/managedstatusbar.h"
|
||||||
#include "blackmisc/identifiable.h"
|
#include "blackmisc/identifiable.h"
|
||||||
@@ -24,7 +25,14 @@
|
|||||||
class QWidget;
|
class QWidget;
|
||||||
|
|
||||||
namespace Ui { class CSwiftData; }
|
namespace Ui { class CSwiftData; }
|
||||||
namespace BlackCore { class CWebDataServices; }
|
namespace BlackCore
|
||||||
|
{
|
||||||
|
class CWebDataServices;
|
||||||
|
namespace Db
|
||||||
|
{
|
||||||
|
class CBackgroundDataUpdater;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* swift data entry control (aka mapping tool)
|
* swift data entry control (aka mapping tool)
|
||||||
@@ -68,12 +76,15 @@ private:
|
|||||||
void initDynamicMenus();
|
void initDynamicMenus();
|
||||||
|
|
||||||
void performGracefulShutdown();
|
void performGracefulShutdown();
|
||||||
|
void consolidationSettingChanged();
|
||||||
|
|
||||||
void displayConsole();
|
void displayConsole();
|
||||||
void displayLog();
|
void displayLog();
|
||||||
|
|
||||||
BlackGui::CManagedStatusBar m_statusBar;
|
BlackGui::CManagedStatusBar m_statusBar;
|
||||||
QScopedPointer<Ui::CSwiftData> ui;
|
QScopedPointer<Ui::CSwiftData> ui;
|
||||||
|
QScopedPointer<BlackCore::Db::CBackgroundDataUpdater, QScopedPointerDeleteLater> m_updater;
|
||||||
|
BlackMisc::CSettingReadOnly<BlackGui::Settings::TBackgroundConsolidation> m_consolidationSettings { this, &CSwiftData::consolidationSettingChanged }; //!< consolidation time
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
Reference in New Issue
Block a user