mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-15 03:45:41 +08:00
refs #507, adjustements in swift data (mapping tool)
* output of download template * setup will be read automatically
This commit is contained in:
committed by
Mathew Sutcliffe
parent
348d4e2f60
commit
b24cd2e9c7
@@ -15,6 +15,7 @@
|
||||
#include "blackgui/components/enableforruntime.h"
|
||||
#include "blackgui/stylesheetutility.h"
|
||||
#include "blackcore/webdataservices.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
#include "blackmisc/icon.h"
|
||||
#include "blackmisc/loghandler.h"
|
||||
#include "blackmisc/project.h"
|
||||
@@ -23,6 +24,7 @@
|
||||
#include <QCloseEvent>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackCore;
|
||||
using namespace BlackGui;
|
||||
using namespace BlackGui::Components;
|
||||
@@ -31,7 +33,7 @@ CSwiftData::CSwiftData(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
CIdentifiable(this),
|
||||
ui(new Ui::CSwiftData),
|
||||
m_webDataReader(new CWebDataServices(CWebReaderFlags::AllSwiftDbReaders))
|
||||
m_webDataReader(new CWebDataServices(CWebReaderFlags::AllSwiftDbReaders, 500))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->init();
|
||||
@@ -103,7 +105,7 @@ void CSwiftData::initReaders()
|
||||
Q_ASSERT_X(this->m_webDataReader, Q_FUNC_INFO, "Missing reader");
|
||||
this->ui->comp_MainInfoArea->setProvider(this->m_webDataReader);
|
||||
this->ui->comp_InfoBar->setProvider(this->m_webDataReader);
|
||||
this->m_webDataReader->readAllInBackground(1000); // kick of readers a little delayed
|
||||
// web data will be read automatically when setup is syncronized
|
||||
}
|
||||
|
||||
void CSwiftData::initMenu()
|
||||
@@ -113,6 +115,7 @@ void CSwiftData::initMenu()
|
||||
this->ui->menu_WindowMinimize->setIcon(this->style()->standardIcon(QStyle::SP_TitleBarMinButton));
|
||||
connect(this->ui->menu_FileExit, &QAction::triggered, this, &CSwiftData::ps_onMenuClicked);
|
||||
connect(this->ui->menu_FileReloadStyleSheets, &QAction::triggered, this, &CSwiftData::ps_onMenuClicked);
|
||||
connect(this->ui->menu_FileResetSettings, &QAction::triggered, this, &CSwiftData::ps_onMenuClicked);
|
||||
|
||||
connect(this->ui->menu_SettingsDirectory, &QAction::triggered, this, &CSwiftData::ps_onMenuClicked);
|
||||
connect(this->ui->menu_SettingsFiles, &QAction::triggered, this, &CSwiftData::ps_onMenuClicked);
|
||||
@@ -132,7 +135,8 @@ void CSwiftData::initMenu()
|
||||
connect(this->ui->menu_InternalsEnvVars, &QAction::triggered, this, &CSwiftData::ps_onMenuClicked);
|
||||
connect(this->ui->menu_InternalsMetatypes, &QAction::triggered, this, &CSwiftData::ps_onMenuClicked);
|
||||
connect(this->ui->menu_InternalsSetup, &QAction::triggered, this, &CSwiftData::ps_onMenuClicked);
|
||||
connect(this->ui->menu_InternalsJsonBootstrapTemplate, &QAction::triggered, this, &CSwiftData::ps_onMenuClicked);
|
||||
connect(this->ui->menu_JsonBootstrapTemplate, &QAction::triggered, this, &CSwiftData::ps_onMenuClicked);
|
||||
connect(this->ui->menu_JsonDownloadTemplate, &QAction::triggered, this, &CSwiftData::ps_onMenuClicked);
|
||||
}
|
||||
|
||||
void CSwiftData::performGracefulShutdown()
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
#include "blackcore/context_runtime.h"
|
||||
#include "blackcore/data/globalsetup.h"
|
||||
#include "blackcore/data/download.h"
|
||||
#include "blackcore/setupreader.h"
|
||||
#include "blackgui/systemtraywindow.h"
|
||||
#include "blackgui/managedstatusbar.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
@@ -53,6 +55,9 @@ private slots:
|
||||
//! Menu clicked
|
||||
void ps_onMenuClicked();
|
||||
|
||||
//! Setup has been changed
|
||||
void ps_setupChanged();
|
||||
|
||||
private:
|
||||
void init();
|
||||
void initLogDisplay();
|
||||
@@ -68,7 +73,8 @@ private:
|
||||
QScopedPointer<Ui::CSwiftData> ui;
|
||||
BlackGui::CManagedStatusBar m_statusBar;
|
||||
BlackCore::CWebDataServices *m_webDataReader = nullptr;
|
||||
BlackCore::CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< setup cache
|
||||
BlackCore::CData<BlackCore::Data::GlobalSetup> m_setup {this, &CSwiftData::ps_setupChanged}; //!< setup cache
|
||||
BlackCore::CData<BlackCore::Data::Download> m_download { this }; // download data
|
||||
};
|
||||
|
||||
#endif // guard
|
||||
|
||||
@@ -128,7 +128,14 @@
|
||||
<property name="title">
|
||||
<string>Internals</string>
|
||||
</property>
|
||||
<addaction name="menu_InternalsJsonBootstrapTemplate"/>
|
||||
<widget class="QMenu" name="menuTemplates">
|
||||
<property name="title">
|
||||
<string>Templates</string>
|
||||
</property>
|
||||
<addaction name="menu_JsonBootstrapTemplate"/>
|
||||
<addaction name="menu_JsonDownloadTemplate"/>
|
||||
</widget>
|
||||
<addaction name="menuTemplates"/>
|
||||
<addaction name="menu_InternalsMetatypes"/>
|
||||
<addaction name="menu_InternalsEnvVars"/>
|
||||
<addaction name="menu_InternalsSetup"/>
|
||||
@@ -211,7 +218,7 @@
|
||||
<string>Debug metatypes (to console)</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="menu_InternalsJsonBootstrapTemplate">
|
||||
<action name="menu_JsonBootstrapTemplate">
|
||||
<property name="text">
|
||||
<string>JSON bootstrap template</string>
|
||||
</property>
|
||||
@@ -276,6 +283,11 @@
|
||||
<string>Reset</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="menu_JsonDownloadTemplate">
|
||||
<property name="text">
|
||||
<string>JSON download template</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
|
||||
@@ -29,9 +29,6 @@ using namespace BlackCore;
|
||||
using namespace BlackGui::Components;
|
||||
using namespace BlackMisc;
|
||||
|
||||
/*
|
||||
* Menu clicked
|
||||
*/
|
||||
void CSwiftData::ps_onMenuClicked()
|
||||
{
|
||||
QObject *sender = QObject::sender();
|
||||
@@ -103,12 +100,18 @@ void CSwiftData::ps_onMenuClicked()
|
||||
CDbMappingComponent *mappingComponent = this->ui->comp_MainInfoArea->getMappingComponent();
|
||||
mappingComponent->resizeForMapping();
|
||||
}
|
||||
else if (sender == this->ui->menu_InternalsJsonBootstrapTemplate)
|
||||
else if (sender == this->ui->menu_JsonBootstrapTemplate)
|
||||
{
|
||||
QString json(m_setup.get().toJsonString());
|
||||
this->ui->comp_MainInfoArea->getLogComponent()->appendPlainTextToConsole(json);
|
||||
this->displayConsole();
|
||||
}
|
||||
else if (sender == this->ui->menu_JsonDownloadTemplate)
|
||||
{
|
||||
QString json(m_download.get().toJsonString());
|
||||
this->ui->comp_MainInfoArea->getLogComponent()->appendPlainTextToConsole(json);
|
||||
this->displayConsole();
|
||||
}
|
||||
else if (sender == this->ui->menu_InternalsMetatypes)
|
||||
{
|
||||
QString metadata(getAllUserMetatypesTypes());
|
||||
@@ -135,6 +138,11 @@ void CSwiftData::ps_onMenuClicked()
|
||||
}
|
||||
}
|
||||
|
||||
void CSwiftData::ps_setupChanged()
|
||||
{
|
||||
CLogMessage(this).debug() << "Setup changed";
|
||||
}
|
||||
|
||||
void CSwiftData::initDynamicMenus()
|
||||
{
|
||||
Q_ASSERT(this->ui->menu_InfoAreas);
|
||||
|
||||
Reference in New Issue
Block a user