添加了调用透视图
This commit is contained in:
parent
c683fe138b
commit
29a4b4dad4
|
@ -53,6 +53,8 @@ void DeduceFramework::init_framework()
|
|||
{
|
||||
auto mgr_e = std::make_shared<RtEntityManager>();
|
||||
mgr_e->append(this->shared_from_this());
|
||||
auto info_pulls = std::make_shared<ComponentsInfoPull>();
|
||||
mgr_e->append(info_pulls);
|
||||
|
||||
this->_entity_map_over_0xffff[mgr_e->entityID()] = mgr_e;
|
||||
}
|
||||
|
@ -160,6 +162,8 @@ void DeduceFramework::execute(std::shared_ptr<Immediate> map,
|
|||
auto ins = std::make_shared<TypesQueryResult>();
|
||||
ins->reset(in->targetEntity(), in->sourceEntity());
|
||||
ins->_component_types = this->_factory_ins->allComponentTypes();
|
||||
|
||||
ins->_entity_templets[NAME(RtEntityManager)] = RtEntityManager::const_id;
|
||||
for (auto ekey : this->_templets_within_0x2ff_0xffff.keys())
|
||||
ins->_entity_templets[ekey] = this->_templets_within_0x2ff_0xffff[ekey]->entityID();
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ void ComponentsInfoPull::execute(std::shared_ptr<Immediate> map,
|
|||
void ComponentsInfoPull::execute(std::shared_ptr<Immediate> map,
|
||||
std::shared_ptr<const ProcedureSignatureQuery> in, QList<std::shared_ptr<ProcedureSignatureQueryResult>>& out)
|
||||
{
|
||||
auto ent_ins = std::dynamic_pointer_cast<RtWsEntity>(this->_bind_entity.lock());
|
||||
auto ent_ins = std::dynamic_pointer_cast<ComponentSet>(this->_bind_entity.lock());
|
||||
auto comps = ent_ins->components();
|
||||
|
||||
auto result = std::make_shared<ProcedureSignatureQueryResult>();
|
||||
|
|
|
@ -134,6 +134,7 @@ QString RtEntityManager::name() const
|
|||
}
|
||||
|
||||
void RtEntityManager::append(std::shared_ptr<WsComponent> ins) {
|
||||
ins->bindEntity(this->shared_from_this());
|
||||
_comps_list[ins->name()] = ins;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,11 +4,21 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||
VisualStudioVersion = 17.13.35825.156
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimsWorld", "SimsWorld\SimsWorld.vcxproj", "{46E3FBA5-6775-4638-AE2E-935675D3B9CE}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{20CFC220-4F5B-4D39-97FA-74C70768F1A7} = {20CFC220-4F5B-4D39-97FA-74C70768F1A7}
|
||||
{C4A07990-233A-46F5-A3A0-48544CABA594} = {C4A07990-233A-46F5-A3A0-48544CABA594}
|
||||
{DF15B899-B9AE-4EBE-8FCC-436C9DB6CEF0} = {DF15B899-B9AE-4EBE-8FCC-436C9DB6CEF0}
|
||||
{E1104048-F35B-40B7-995C-0320E689BF09} = {E1104048-F35B-40B7-995C-0320E689BF09}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimsBasic", "SimsBasic\SimsBasic.vcxproj", "{DF15B899-B9AE-4EBE-8FCC-436C9DB6CEF0}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C4A07990-233A-46F5-A3A0-48544CABA594} = {C4A07990-233A-46F5-A3A0-48544CABA594}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ComponentBasic", "ComponentBasic\ComponentBasic.vcxproj", "{20CFC220-4F5B-4D39-97FA-74C70768F1A7}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C4A07990-233A-46F5-A3A0-48544CABA594} = {C4A07990-233A-46F5-A3A0-48544CABA594}
|
||||
{DF15B899-B9AE-4EBE-8FCC-436C9DB6CEF0} = {DF15B899-B9AE-4EBE-8FCC-436C9DB6CEF0}
|
||||
{E1104048-F35B-40B7-995C-0320E689BF09} = {E1104048-F35B-40B7-995C-0320E689BF09}
|
||||
EndProjectSection
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
#include "PerspectiveView.h"
|
||||
#include <QSplitter>
|
||||
#include <QVBoxLayout>
|
||||
#include <QDebug>
|
||||
#include <QGroupBox>
|
||||
#include <internal_impl.h>
|
||||
|
||||
void PerspectiveView::deduce_start()
|
||||
{
|
||||
auto request = std::make_shared<DeduceRequest>();
|
||||
request->reset(-1, RtEntityManager::const_id);
|
||||
emit this->backend_deduce_request(request);
|
||||
}
|
||||
|
||||
void PerspectiveView::reply_accept(const QList<std::shared_ptr<WsMessage>>& msg_set)
|
||||
{
|
||||
for (auto msg : msg_set)
|
||||
{
|
||||
if (msg->topicString() == TypesQueryResult().topicString()) {
|
||||
_templet_model->clear();
|
||||
|
||||
auto ins_conv = std::dynamic_pointer_cast<TypesQueryResult>(msg);
|
||||
for (auto sign : ins_conv->_entity_templets.keys()) {
|
||||
auto cell = new QStandardItem(sign);
|
||||
cell->setData(ins_conv->_entity_templets[sign]);
|
||||
cell->setEditable(false);
|
||||
_templet_model->appendRow(cell);
|
||||
}
|
||||
}
|
||||
if (msg->topicString() == ProcedureSignatureQueryResult().topicString()) {
|
||||
this->_procedure_model->removeRows(0, this->_procedure_model->rowCount());
|
||||
|
||||
auto ins_conv = std::dynamic_pointer_cast<ProcedureSignatureQueryResult>(msg);
|
||||
for (auto fun_pair : ins_conv->_signature_list) {
|
||||
QList<QStandardItem*> row;
|
||||
row << new QStandardItem(fun_pair.first);
|
||||
row << new QStandardItem(fun_pair.second);
|
||||
for(auto info : row) info->setEditable(false);
|
||||
|
||||
this->_procedure_model->appendRow(row);
|
||||
}
|
||||
this->_procedure_view->resizeColumnsToContents();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PerspectiveView::complete_accept(std::shared_ptr<RespondDefault> ins) {}
|
||||
|
||||
void PerspectiveView::show_procedures_start(const QModelIndex& target)
|
||||
{
|
||||
if (!target.isValid())
|
||||
return;
|
||||
|
||||
auto templet_id = this->_templet_model->itemFromIndex(target)->data().toULongLong();
|
||||
auto ins = std::make_shared<ProcedureSignatureQuery>();
|
||||
ins->reset(-1, templet_id);
|
||||
_bind_framework->accept(QList<std::shared_ptr<WsMessage>>{ins});
|
||||
}
|
||||
|
||||
PerspectiveView::PerspectiveView(std::shared_ptr<DeduceFramework> ins, QWidget* p /*= nullptr*/)
|
||||
:QDialog(p),
|
||||
_bind_framework(ins),
|
||||
_bind_timer(new QTimer(this)),
|
||||
_templet_types(new QListView(this)),
|
||||
_templet_model(new QStandardItemModel(this)),
|
||||
_procedure_view(new QTableView(this)),
|
||||
_procedure_model(new QStandardItemModel(this))
|
||||
{
|
||||
connect(this, &PerspectiveView::backend_deduce_request, _bind_framework.get(), &DeduceFramework::deduceBegin);
|
||||
connect(_bind_framework.get(), &DeduceFramework::reply, this, &PerspectiveView::reply_accept);
|
||||
connect(_bind_framework.get(), &DeduceFramework::complete, this, &PerspectiveView::complete_accept);
|
||||
connect(_templet_types, &QListView::clicked, this, &PerspectiveView::show_procedures_start);
|
||||
|
||||
this->setWindowTitle(u8"调用透视视图");
|
||||
this->setMinimumSize(800, 600);
|
||||
|
||||
auto layout = new QVBoxLayout(this);
|
||||
auto splitter = new QSplitter(this);
|
||||
layout->addWidget(splitter);
|
||||
|
||||
splitter->addWidget(_templet_types);
|
||||
auto groupbox = new QGroupBox(u8"调用过程签名", this);
|
||||
auto glayout = new QVBoxLayout(groupbox);
|
||||
glayout->addWidget(_procedure_view);
|
||||
_procedure_view->setModel(_procedure_model);
|
||||
splitter->addWidget(groupbox);
|
||||
_templet_types->setModel(_templet_model);
|
||||
|
||||
splitter->setStretchFactor(1, 1);
|
||||
|
||||
auto templet_pull = std::make_shared<TypesQuery>();
|
||||
templet_pull->reset(-1, RtEntityManager::const_id);
|
||||
_bind_framework->accept(QList<std::shared_ptr<WsMessage>>() << templet_pull);
|
||||
connect(_bind_timer, &QTimer::timeout, this, &PerspectiveView::deduce_start);
|
||||
|
||||
_bind_timer->start(100);
|
||||
_procedure_model->setHorizontalHeaderLabels(QStringList()<<u8"输入消息"<<u8"输出消息");
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
#pragma once
|
||||
#include <EntityDocks.h>
|
||||
#include <QDialog>
|
||||
#include <QTimer>
|
||||
#include <QListView>
|
||||
#include <QStandardItemModel>
|
||||
#include <QTableView>
|
||||
|
||||
|
||||
class PerspectiveView : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
std::shared_ptr<DeduceFramework> _bind_framework;
|
||||
QTimer *const _bind_timer;
|
||||
|
||||
QListView *const _templet_types;
|
||||
QStandardItemModel *const _templet_model;
|
||||
QTableView *const _procedure_view;
|
||||
QStandardItemModel *const _procedure_model;
|
||||
|
||||
void deduce_start();
|
||||
void reply_accept(const QList<std::shared_ptr<WsMessage>>& set);
|
||||
void complete_accept(std::shared_ptr<RespondDefault> ins);
|
||||
|
||||
void show_procedures_start(const QModelIndex &target);
|
||||
|
||||
public:
|
||||
PerspectiveView(std::shared_ptr<DeduceFramework> ins, QWidget* p = nullptr);
|
||||
|
||||
signals:
|
||||
void backend_deduce_request(std::shared_ptr<const DeduceRequest> ins);
|
||||
};
|
||||
|
|
@ -99,6 +99,7 @@
|
|||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="PerspectiveView.cpp" />
|
||||
<ClCompile Include="TempletAssemble.cpp" />
|
||||
<QtRcc Include="sims_world.qrc" />
|
||||
<QtUic Include="sims_world.ui" />
|
||||
|
@ -111,6 +112,9 @@
|
|||
<ItemGroup>
|
||||
<QtMoc Include="TempletAssemble.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="PerspectiveView.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
|
||||
<Import Project="$(QtMsBuild)\qt.targets" />
|
||||
|
|
|
@ -49,10 +49,16 @@
|
|||
<ClCompile Include="TempletAssemble.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PerspectiveView.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="TempletAssemble.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="PerspectiveView.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -6,8 +6,9 @@
|
|||
#include <QLabel>
|
||||
#include <QGroupBox>
|
||||
|
||||
TempletAssemble::TempletAssemble()
|
||||
:QWidget(nullptr),
|
||||
TempletAssemble::TempletAssemble(std::shared_ptr<DeduceFramework> fmk, QWidget *parent)
|
||||
:QDialog(parent),
|
||||
_bind_framework(fmk),
|
||||
_templet_present(new QListView(this)),
|
||||
_templet_model(new QStandardItemModel(this)),
|
||||
_t_add(new QPushButton(u8"添加模板",this)),
|
||||
|
@ -20,6 +21,9 @@ TempletAssemble::TempletAssemble()
|
|||
_component_model(new QStandardItemModel(this)),
|
||||
_apply(new QPushButton(u8"应用", this))
|
||||
{
|
||||
setWindowTitle(u8"ÀàÐÍÄ£°åÅäÖÃ");
|
||||
this->setMinimumSize(800, 600);
|
||||
|
||||
auto layout = new QVBoxLayout(this);
|
||||
auto split = new QSplitter(this);
|
||||
layout->addWidget(split);
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
#pragma once
|
||||
#include <QWidget>
|
||||
#include <QDialog>
|
||||
#include <QListView>
|
||||
#include <QStandardItemModel>
|
||||
#include <QComboBox>
|
||||
#include <QPushButton>
|
||||
#include <EntityDocks.h>
|
||||
|
||||
class TempletAssemble : public QWidget
|
||||
class TempletAssemble : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
std::shared_ptr<DeduceFramework> _bind_framework;
|
||||
|
||||
QListView *const _templet_present;
|
||||
QStandardItemModel *const _templet_model;
|
||||
QPushButton *const _t_add, *const _t_remove;
|
||||
|
@ -21,7 +24,7 @@ private:
|
|||
QPushButton *const _apply;
|
||||
|
||||
public:
|
||||
TempletAssemble();
|
||||
TempletAssemble(std::shared_ptr<DeduceFramework> fmk, QWidget *p = nullptr);
|
||||
virtual ~TempletAssemble() = default;
|
||||
|
||||
|
||||
|
|
|
@ -5,11 +5,7 @@
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
//SimsWorld w;
|
||||
//w.show();
|
||||
|
||||
TempletAssemble tass;
|
||||
tass.show();
|
||||
|
||||
SimsWorld w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
|
|
|
@ -1,13 +1,29 @@
|
|||
#include "sims_world.h"
|
||||
#include "TempletAssemble.h"
|
||||
#include "PerspectiveView.h"
|
||||
|
||||
SimsWorld::SimsWorld(QWidget *parent)
|
||||
: QMainWindow(parent),
|
||||
_backend_ins(std::make_shared<DeduceFramework>())
|
||||
SimsWorld::SimsWorld(QWidget* parent)
|
||||
: QMainWindow(parent),
|
||||
_backend_ins(std::make_shared<DeduceFramework>())
|
||||
{
|
||||
ui.setupUi(this);
|
||||
ui.setupUi(this);
|
||||
|
||||
_backend_ins->init_framework();
|
||||
auto file = this->menuBar()->addMenu(u8"文件");
|
||||
auto setting = this->menuBar()->addMenu(u8"基础设置");
|
||||
auto assemble = setting->addAction(u8"类型构建");
|
||||
connect(assemble, &QAction::triggered, [=]() {
|
||||
TempletAssemble dia(_backend_ins, this);
|
||||
dia.exec();
|
||||
});
|
||||
auto signature = setting->addAction(u8"调用透视");
|
||||
connect(signature, &QAction::triggered, [=]() {
|
||||
PerspectiveView dia(_backend_ins, this);
|
||||
dia.exec();
|
||||
});
|
||||
|
||||
_backend_ins->init_framework();
|
||||
}
|
||||
|
||||
SimsWorld::~SimsWorld()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue