WsParser_VS/StoryPresent/main.cpp

75 lines
2.1 KiB
C++

#include "storypresent.h"
#include "dag_layout.h"
#include "xast_parse.h"
#include "dag_present.h"
#include "view_present.h"
#include <argsparser.h>
#include <QDebug>
#include <QMessageBox>
#include <QTextEdit>
#include <QtWidgets/QApplication>
using namespace args_parse;
using namespace std;
int main(int argc, char* argv[]) {
QApplication a(argc, argv);
ArgsParser cmdrec;
auto help_mode = std::make_shared<MatchMode>(0x000au, u8"打印帮助文档");
cmdrec << help_mode;
(*help_mode) << std::make_shared<IndexParam>(u8"StoryPresent", u8"程序名") << make_shared<FloatOption>(u8"help", u8"打印帮助文档");
auto test_mode = std::make_shared<MatchMode>(0x000bu, u8"开发过程内部测试");
cmdrec << test_mode;
(*test_mode) << std::make_shared<IndexParam>(u8"StoryPresent", u8"程序名") << make_shared<FloatOption>(u8"test", u8"打印帮助文档");
auto rst = cmdrec.parse(argc, argv);
QTextEdit msg;
msg.setReadOnly(true);
if (!rst) {
msg.setWindowTitle(u8"参数输入错误");
msg.setPlainText(cmdrec.helperDoc());
msg.show();
}
else {
switch (rst->modeCode()) {
case 0x000au:
msg.setWindowTitle(u8"帮助信息");
msg.setPlainText(cmdrec.helperDoc());
msg.show();
break;
case 0x000bu:
{
auto arrows = QList<graph_data::Arrow>() <<
graph_data::Arrow(u8"a中文测试", u8"b中文测试") <<
graph_data::Arrow(u8"c中文测试", u8"b中文测试") <<
graph_data::Arrow(u8"c中文测试", u8"d中文测试") <<
graph_data::Arrow(u8"b中文测试", u8"e中文测试") <<
graph_data::Arrow(u8"d中文测试", u8"e中文测试") <<
graph_data::Arrow(u8"c中文测试", u8"e中文测试");
auto view = new dags::DAGActiveView;
view->updateWithEdges(arrows);
view->show();
//dags::DAGGraph tools;
//tools.rebuildFromEdges(arrows);
//tools.graphLayout();
//for (auto n : tools.nodeWithLayout()) {
// msg.setWindowTitle("layout-message");
// msg.append(QString("node:%3,layer:%1,sort:%2").arg(n->layerNumber()).arg(n->sortNumber()).arg(n->layerNode()->bindPoint().name()));
// msg.show();
//}
}break;
default:
break;
}
}
return a.exec();
}