mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 15:25:35 +08:00
Ref T246, data can also be loaded from resource files
This commit is contained in:
@@ -15,6 +15,9 @@
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackmisc/network/networkutils.h"
|
||||
|
||||
#include <QPointer>
|
||||
#include <QMessageBox>
|
||||
|
||||
using namespace BlackGui;
|
||||
using namespace BlackCore;
|
||||
using namespace BlackMisc;
|
||||
@@ -60,11 +63,17 @@ namespace BlackGui
|
||||
|
||||
connect(ui->pb_LoadAllFromDB, &QPushButton::pressed, this, &CDbLoadOverviewComponent::loadAllFromDb);
|
||||
connect(ui->pb_LoadAllFromShared, &QPushButton::pressed, this, &CDbLoadOverviewComponent::loadAllFromShared);
|
||||
connect(ui->pb_LoadAllFromResources, &QPushButton::pressed, this, &CDbLoadOverviewComponent::loadAllFromResourceFiles);
|
||||
|
||||
if (sGui->hasWebDataServices())
|
||||
{
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbLoadOverviewComponent::dataLoaded);
|
||||
QTimer::singleShot(10 * 1000, this, &CDbLoadOverviewComponent::loadInfoObjects);
|
||||
QPointer<CDbLoadOverviewComponent> myself(this);
|
||||
QTimer::singleShot(10 * 1000, this, [ = ]
|
||||
{
|
||||
if (!myself) { return; }
|
||||
this->loadInfoObjects();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,12 +119,13 @@ namespace BlackGui
|
||||
QFrame::resizeEvent(event);
|
||||
}
|
||||
|
||||
void CDbLoadOverviewComponent::showVisibleLoadAllButtons(bool shared, bool db)
|
||||
void CDbLoadOverviewComponent::showVisibleLoadAllButtons(bool shared, bool db, bool disk)
|
||||
{
|
||||
const bool widget = shared || db;
|
||||
ui->wi_LoadAllButtons->setVisible(widget);
|
||||
ui->pb_LoadAllFromDB->setVisible(db);
|
||||
ui->pb_LoadAllFromShared->setVisible(shared);
|
||||
ui->pb_LoadAllFromResources->setVisible(disk);
|
||||
}
|
||||
|
||||
void CDbLoadOverviewComponent::loadAllFromDb()
|
||||
@@ -128,6 +138,15 @@ namespace BlackGui
|
||||
this->triggerLoadingFromSharedFiles(CEntityFlags::AllDbEntitiesNoInfoObjects);
|
||||
}
|
||||
|
||||
void CDbLoadOverviewComponent::loadAllFromResourceFiles()
|
||||
{
|
||||
if (m_loadInProgress) { return; }
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getWebDataServices()) { return; }
|
||||
const QMessageBox::StandardButton reply = QMessageBox::warning(this, "Load DB data", "You should only load DB from disk resources if loading from network does not work. Really load?", QMessageBox::Yes | QMessageBox::No);
|
||||
if (reply != QMessageBox::Yes) { return; }
|
||||
sGui->getWebDataServices()->initDbCachesFromLocalResourceFiles(true);
|
||||
}
|
||||
|
||||
void CDbLoadOverviewComponent::setGuiValues()
|
||||
{
|
||||
if (!sGui) { return; }
|
||||
|
||||
Reference in New Issue
Block a user