From b8c1101693345bb49b2a1541237c112f6a24d7eb Mon Sep 17 00:00:00 2001 From: shi_jq Date: Thu, 13 Mar 2025 10:45:13 +0800 Subject: [PATCH] =?UTF-8?q?[ref]=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/dbms/db_base_api/CDbKingbaseApi.cpp | 5 +- platform/src/dbms/db_base_api/CDbMySQLApi.cpp | 322 +- .../src/dbms/db_base_api/CDbOpenGaussApi.cpp | 5 +- .../src/dbms/db_his_data_srv/CDumpUtils.cpp | 28 +- .../src/dbms/db_his_data_srv/DbHisCfg.cpp | 1 + platform/src/dbms/db_his_data_srv/DbHisCfg.h | 12 +- .../dbms/db_his_data_srv/db_his_data_srv.pro | 2 +- .../db_his_mng_api/CChunkedJsonHandler.cpp | 11 +- .../dbms/db_his_mng_api/CChunkedJsonHandler.h | 4 +- .../src/dbms/db_his_mng_api/CHisMngApi.cpp | 16 + .../src/dbms/db_his_mng_api/CHisMngApiImp.cpp | 456 +- .../src/dbms/db_his_mng_api/CHisMngApiImp.h | 35 +- platform/src/dbms/db_his_mng_api/en.ts | 315 +- .../test/db_his_query_api_test/main.cpp | 47 +- platform/src/dbms/db_manager/CHisUtil.cpp | 2 +- .../src/dbms/db_manager/CLogMngWidget.cpp | 4 +- .../src/dbms/db_manager/CStationReuseForm.cpp | 30 +- platform/src/dbms/db_manager/conndig.cpp | 11 +- platform/src/dbms/db_manager/conndig.h | 4 +- platform/src/dbms/db_manager/conndig.ui | 370 +- platform/src/dbms/db_manager/db_compare.cpp | 63 +- platform/src/dbms/db_manager/db_manager.pro | 218 +- .../src/dbms/db_manager/db_manager_common.h | 4 - platform/src/dbms/db_manager/db_set.cpp | 21 +- platform/src/dbms/db_manager/db_set.h | 5 +- platform/src/dbms/db_manager/db_set.ui | 194 +- platform/src/dbms/db_manager/en.ts | 2374 ---- .../his_widgets/import_his_backup_dialog.cpp | 39 +- .../his_widgets/import_his_backup_dialog.h | 6 +- .../his_widgets/import_his_backup_dialog.ui | 26 +- .../his_widgets/new_his_backup_dialog.cpp | 26 +- .../his_widgets/new_his_backup_dialog.h | 5 +- .../his_widgets/new_his_dump_dialog.cpp | 26 +- .../his_widgets/new_his_dump_dialog.h | 4 +- platform/src/dbms/db_manager/main.cpp | 9 +- platform/src/dbms/db_manager/pj_manager.cpp | 382 +- platform/src/dbms/db_manager/pj_manager.h | 12 +- platform/src/dbms/db_manager/pj_manager.ui | 4868 ++++----- .../pj_manager_his/pj_manager_his.cpp | 79 +- .../pj_manager_his_data_srv.cpp | 123 +- .../src/dbms/db_manager/res/db_manager.ico | Bin 4286 -> 3198 bytes .../tst_project_data_veri.cpp | 4 +- .../dbms/db_manager_api/db_manager_api.cpp | 90 +- .../db_manager_api/db_manager_api_common.h | 6 +- platform/src/dbms/db_manager_api/db_opt.cpp | 94 +- .../dbms/db_manager_api/db_opt_kingbase.cpp | 30 +- .../src/dbms/db_manager_api/db_opt_mysql.cpp | 2 +- .../dbms/db_manager_api/db_opt_opengauss.cpp | 26 +- platform/src/dbms/db_manager_api/en.ts | 1787 +++- .../project_data_veri_manual/MainWindow.cpp | 2 +- platform/src/dbms/db_save/COStreamFile.cpp | 6 +- .../dbms/db_studio/CColumnModeDelegate.cpp | 6 +- .../src/dbms/db_studio/CColumnModeModel.cpp | 13 +- platform/src/dbms/db_studio/CDbStudio.cpp | 189 +- platform/src/dbms/db_studio/CDbStudio.h | 11 +- platform/src/dbms/db_studio/CDbStudio.ui | 18 +- platform/src/dbms/db_studio/CFileSelect.cpp | 15 +- platform/src/dbms/db_studio/CFileSelect.h | 9 +- platform/src/dbms/db_studio/CSubsystem.cpp | 10 +- platform/src/dbms/db_studio/CSubsystem.h | 4 +- .../src/dbms/db_studio/CTableModeDelegate.cpp | 9 +- .../src/dbms/db_studio/CTableModeModel.cpp | 15 +- platform/src/dbms/db_studio/StructDefine.h | 15 +- platform/src/dbms/db_studio/db_studio.pro | 5 +- platform/src/dbms/db_studio/main.cpp | 31 + .../src/dbms/db_sysinfo_api/CDbSysInfo.cpp | 51 +- platform/src/dbms/dbms.pro | 2 + platform/src/dbms/rdb_api/CBptree.cpp | 5 +- platform/src/dbms/rdb_api/CRdbCache.cpp | 373 - platform/src/dbms/rdb_api/CRdbCache.h | 35 - .../dbms/rdb_api/CRdbLoadTableAttribute.cpp | 11 +- .../src/dbms/rdb_api/CRdbLocalManager.cpp | 1 - .../src/dbms/rdb_api/CRdbMngInterface.cpp | 49 +- platform/src/dbms/rdb_api/rdb_api.pro | 138 +- .../src/dbms/rdb_server/CRdbRedundant.cpp | 4 +- platform/src/dbms/rdb_server/CRdbRedundant.h | 6 +- .../src/dbms/rdb_server/CRdbUpdateThread.cpp | 935 +- platform/src/dbms/rdb_studio/main.cpp | 39 +- platform/src/dbms/rdb_studio/mainwindow.cpp | 14 +- platform/src/dbms/rdb_studio/mainwindow.h | 3 +- platform/src/dbms/rdb_studio/mainwindow.ui | 10 +- platform/src/dbms/rdb_studio/rdb_studio.pro | 7 +- platform/src/dbms/rdb_studio/res.qrc | 1 + platform/src/dbms/tsdb_api/CTsdbConn.cpp | 7 + platform/src/dbms/tsdb_api/TsdbApi.cpp | 8 +- .../dbms/tsdb_api/test/tsdb_api_test/main.cpp | 46 +- platform/src/dbms/tsdb_save/CNodeMng.cpp | 16 +- .../dbms/tsdb_save_api/CTsdbSaveApiImp.cpp | 4 +- .../src/example/tsdbDataSim/MainWindow.cpp | 357 + platform/src/example/tsdbDataSim/MainWindow.h | 86 + .../src/example/tsdbDataSim/MainWindow.ui | 2035 ++++ platform/src/example/tsdbDataSim/RandUtil.h | 114 + .../src/example/tsdbDataSim/dataWorker.cpp | 683 ++ platform/src/example/tsdbDataSim/dataWorker.h | 95 + platform/src/example/tsdbDataSim/download.ico | Bin 0 -> 4286 bytes platform/src/example/tsdbDataSim/download.png | Bin 0 -> 8282 bytes platform/src/example/tsdbDataSim/main.cpp | 18 + .../src/example/tsdbDataSim/tsdbDataSim.pro | 56 + .../MainWindow.cpp | 254 + .../tsdbDataSimForCloudPlatform/MainWindow.h | 71 + .../tsdbDataSimForCloudPlatform/MainWindow.ui | 682 ++ .../tsdbDataSimForCloudPlatform/RandUtil.h | 95 + .../dataWorker.cpp | 277 + .../tsdbDataSimForCloudPlatform/dataWorker.h | 55 + .../tsdbDataSimForCloudPlatform/download.ico | Bin 0 -> 4286 bytes .../tsdbDataSimForCloudPlatform/download.png | Bin 0 -> 8282 bytes .../tsdbDataSimForCloudPlatform/main.cpp | 16 + .../tsdbDataSim.pro | 55 + .../gui/GraphDataAcess/CGraphDataAcess.cpp | 54 +- .../src/gui/GraphDataAcess/CGraphDataAcess.h | 10 +- .../src/gui/GraphDataAcess/GraphDataAcess.pro | 2 +- platform/src/gui/GraphPub/CBase.cpp | 20 +- .../src/gui/GraphPub/CCanvasGenerator.cpp | 59 +- platform/src/gui/GraphPub/CCanvasItem.cpp | 586 +- platform/src/gui/GraphPub/CCanvasItem.h | 71 +- platform/src/gui/GraphPub/CCanvasPub.cpp | 162 + platform/src/gui/GraphPub/CCanvasPub.h | 11 +- platform/src/gui/GraphPub/CStream.cpp | 9 +- .../BasicShape/CAnimationManage.cpp | 26 + .../gui/GraphShape/BasicShape/CDataShape.cpp | 17 +- .../GraphShape/BasicShape/CDrawObjFactory.cpp | 8 + .../gui/GraphShape/BasicShape/CGroupShape.cpp | 2 +- .../gui/GraphShape/BasicShape/CIconShape.cpp | 54 +- .../gui/GraphShape/BasicShape/CLineShape.cpp | 28 + .../gui/GraphShape/BasicShape/CPathShape.cpp | 34 + .../gui/GraphShape/BasicShape/CPokeShape.cpp | 27 + .../GraphShape/BasicShape/CPolygonShape.cpp | 34 + .../gui/GraphShape/BasicShape/CRectShape.cpp | 28 + .../src/gui/GraphShape/BasicShape/CShape.cpp | 53 +- .../gui/GraphShape/BasicShape/CTextShape.cpp | 47 +- .../GraphShape/BasicShape/CWidgetShape.cpp | 8 +- .../gui/GraphShape/ChartShape/CBarChart.cpp | 109 +- .../src/gui/GraphShape/ChartShape/CBarChart.h | 2 + .../gui/GraphShape/ChartShape/CChartShape.cpp | 34 +- .../gui/GraphShape/ChartShape/CChartShape.h | 8 +- .../gui/GraphShape/ChartShape/CLineChart.cpp | 2 +- .../gui/GraphShape/ChartShape/CPieChart.cpp | 2 +- .../GraphShape/ChartShape/CRTLineChart.cpp | 115 +- .../gui/GraphShape/ChartShape/CRTLineChart.h | 6 +- .../GraphShape/DynamicShape/CDyLineShape.cpp | 18 +- .../gui/GraphShape/DynamicShape/CFlowLine.cpp | 2 +- .../gui/GraphShape/DynamicShape/CLinkLine.cpp | 172 +- platform/src/gui/GraphShape/GraphShape.pro | 4 + .../src/gui/GraphShape/IconInfo/CIconInfo.cpp | 8 +- .../gui/GraphShape/include/CAnimationManage.h | 2 + .../src/gui/GraphShape/include/CDyLineShape.h | 1 - .../src/gui/GraphShape/include/CIconShape.h | 4 + .../src/gui/GraphShape/include/CLineShape.h | 3 +- .../src/gui/GraphShape/include/CLinkLine.h | 9 + .../src/gui/GraphShape/include/CPathShape.h | 2 + .../src/gui/GraphShape/include/CPokeShape.h | 3 + .../gui/GraphShape/include/CPolygonShape.h | 2 + .../src/gui/GraphShape/include/CQWidgetWrap.h | 18 +- .../src/gui/GraphShape/include/CRectShape.h | 7 +- .../src/gui/GraphShape/include/CTextShape.h | 10 +- platform/src/gui/GraphTool/GraphTool.pro | 7 +- .../gui/GraphTool/QssEditor/CAddBtnForm.cpp | 2 +- .../gui/GraphTool/QssEditor/CQssEditor.cpp | 5 +- .../src/gui/GraphTool/QssEditor/CQssEditor.h | 4 +- .../src/gui/GraphTool/QssEditor/CQssEditor.ui | 8 +- .../gui/GraphTool/QssEditor/CSearchDialog.cpp | 5 +- .../gui/GraphTool/QssEditor/CSearchDialog.h | 4 +- .../src/gui/GraphTool/QssEditor/QssEditor.pro | 2 + .../QssEditor/qtgradient/qtgradientdialog.cpp | 12 +- .../QssEditor/qtgradient/qtgradientdialog.h | 4 +- .../QssEditor/qtgradient/qtgradientdialog.ui | 4 +- .../qtgradient/qtgradientviewdialogn.cpp | 10 +- .../qtgradient/qtgradientviewdialogn.h | 4 +- .../src/gui/GraphTool/Retriever/CListView.cpp | 2 +- .../gui/GraphTool/Retriever/CRetriever.cpp | 180 +- .../src/gui/GraphTool/Retriever/CRetriever.ui | 2600 +++-- .../src/gui/GraphTool/Retriever/Retriever.pro | 2 +- .../gui/GraphTool/ScriptForm/ScriptForm.cpp | 7 +- .../gui/GraphTool/ScriptForm/ScriptForm.pro | 2 + .../gui/GraphTool/WebPublish/CWebPublish.cpp | 25 +- .../gui/GraphTool/WebPublish/CWebPublish.h | 5 +- .../gui/GraphTool/WebPublish/WebPublish.pro | 2 +- .../src/gui/PropertyEditor/PropertyEditor.pro | 1 + .../gradient/CGradientDialog.cpp | 8 +- .../PropertyEditor/gradient/CGradientDialog.h | 4 +- .../PropertyEditor/gradient/GradientDialog.ui | 17 +- .../src/gui/PropertyEditor/pen/CPenDialog.cpp | 8 +- .../src/gui/PropertyEditor/pen/CPenDialog.h | 4 +- .../src/gui/PropertyEditor/pen/CPenDialog.ui | 5 +- .../gui/PropertyEditor/qteditorfactory.cpp | 8 +- platform/src/gui/gui.pro | 3 + platform/src/gui/hmi/CDesignerScene.cpp | 194 +- platform/src/gui/hmi/CDesignerScene.h | 1 + platform/src/gui/hmi/CDesignerView.cpp | 130 +- platform/src/gui/hmi/CDesignerView.h | 5 + platform/src/gui/hmi/CDesignerWnd.cpp | 744 +- platform/src/gui/hmi/CDesignerWnd.h | 36 +- platform/src/gui/hmi/CDynamicValue.cpp | 56 +- platform/src/gui/hmi/CDynamicValue.h | 1 + platform/src/gui/hmi/CExplorerScene.cpp | 69 +- platform/src/gui/hmi/CExplorerView.cpp | 1 + platform/src/gui/hmi/CExplorerWnd.cpp | 42 +- platform/src/gui/hmi/CExplorerWnd.h | 2 +- platform/src/gui/hmi/CExtern.h | 2 + platform/src/gui/hmi/CGraphApp.cpp | 163 +- platform/src/gui/hmi/CGraphApp.h | 7 +- platform/src/gui/hmi/CGraphDoc.cpp | 2 +- platform/src/gui/hmi/CGraphHead.cpp | 413 +- platform/src/gui/hmi/CGraphHead.h | 17 +- platform/src/gui/hmi/CGraphScene.cpp | 208 +- platform/src/gui/hmi/CGraphScene.h | 20 + platform/src/gui/hmi/CGraphView.cpp | 27 + platform/src/gui/hmi/CGraphView.h | 2 + platform/src/gui/hmi/CGraphWnd.cpp | 14 +- platform/src/gui/hmi/CGraphWnd.h | 3 +- platform/src/gui/hmi/CMenuString.h | 2 + platform/src/gui/hmi/CUndoCommand.cpp | 91 +- platform/src/gui/hmi/CUndoCommand.h | 6 +- platform/src/gui/hmi/case/CSimulate.cpp | 2 +- .../CAnimationConfigDialog.cpp | 10 +- .../CAnimationConfigDialog.h | 4 +- .../dialog/ShapeConfigDialog/CFindReplace.cpp | 8 +- .../dialog/ShapeConfigDialog/CFindReplace.h | 3 +- .../dialog/ShapeConfigDialog/CInputDialog.cpp | 14 +- .../dialog/ShapeConfigDialog/CInputDialog.h | 6 +- .../ShapeConfigDialog/CShapeConfigDialog.cpp | 9 +- .../ShapeConfigDialog/CShapeConfigDialog.h | 4 +- .../ShapeConfigDialog/CStrategyConfigModel.h | 9 + .../ShapeConfigDialog/CTextReplacer.cpp | 4 +- .../dialog/ShapeConfigDialog/CTextReplacer.h | 4 +- .../ShapeConfigDialog/CTextShapeEditor.cpp | 6 +- .../ShapeConfigDialog/CTextShapeEditor.h | 6 +- .../dialog/ShapeConfigDialog/replaceDialog.ui | 6 +- .../CGlobalConfigDialog.cpp | 5 +- .../globalConfigDialog/CGlobalConfigDialog.h | 4 +- .../hmi/dialog/hmiConfigDialog/CHmiConfig.cpp | 40 +- .../hmi/dialog/hmiConfigDialog/CHmiConfig.h | 4 +- .../gui/hmi/dialog/layerDialog/CLayerDlg.cpp | 5 +- .../gui/hmi/dialog/layerDialog/CLayerDlg.h | 4 +- .../CTagSourceCfgDialog.cpp | 10 +- .../CTagSourceCfgDialog.h | 4 +- .../CTagSourceCfgDialog.ui | 8 +- platform/src/gui/hmi/hmi.ico | Bin 4286 -> 4030 bytes platform/src/gui/hmi/hmi.pro | 116 +- platform/src/gui/include/CBase.h | 5 +- platform/src/gui/include/CDrawObjDefine.h | 2 + platform/src/gui/include/CPubStruct.h | 3 +- platform/src/gui/include/CShape.h | 7 +- .../acs_device_api/AcsDeviceApiCommon.h | 4 +- .../acs_device_api/CAcsDeviceApi.h | 4 +- .../app_fbd/fbd_common/FbdAlarmCltApi.h | 4 +- .../app_fbd/fbd_common/FbdDiagDataApi.h | 105 +- .../app_fbd/fbd_common/FbdDiagDataStruct.h | 39 + .../include/dbms/db_his_mng_api/CHisMngApi.h | 4 + .../dbms/db_manager_api/db_manager_api.h | 2 +- platform/src/include/dbms/rdb_api/RdbMemMan.h | 2 - .../src/include/dbms/tsdb_api/CTsdbConn.h | 36 +- .../include/gui/GraphShape/CPluginWidget.h | 4 +- .../gui/GraphTool/Retriever/CRetriever.h | 22 +- .../gui/GraphTool/ScriptForm/ScriptForm.h | 4 +- .../public/pub_sysinfo_api/SysInfoBase.h | 2 +- .../public/pub_utility_api/FileStyle.h | 9 +- .../include/public/pub_utility_api/FileUtil.h | 13 +- .../service/alarm_server_api/AlarmCommonDef.h | 5 +- .../service/data_process_api/DataProcessApi.h | 9 + .../interlock_api/InterLockInterface.h | 4 +- .../operate_server_api/JsonMessageStruct.h | 1 + .../operate_server_api/JsonOptCommand.cpp | 1670 +-- .../operate_server_api/JsonOptCommand.h | 116 +- .../include/service/perm_mng_api/PermMngApi.h | 8 + .../service/perm_mng_api/PermMngDefine.h | 1 + .../sys/sys_dog_auth_api/DogAuthInterface.h | 3 - .../src/include/sys/sys_login_api/CLoginDlg.h | 4 +- .../sys/sys_proc_mng_api/ProcMngInterface.h | 2 +- .../src/include/tools/ScriptForm/ScriptForm.h | 11 +- .../tools/fbd_designer/fbd_block/CBlock.h | 27 + .../fbd_designer/fbd_editor/CFBDMainWindow.h | 36 +- .../fbd_designer/fbd_retriever/CRetriever.h | 6 +- .../tools/model_common/CPluginWidget.h | 4 +- .../src/include/tools/model_common/common.h | 1 + .../model_table/CustomWidget/kbdtreeview.h | 3 - .../include/tools/model_table/kbddbdesign.h | 2 - .../tools/model_table/kbdexportimportlogic.h | 2 +- .../include/tools/model_table/kbdinputdlg.h | 3 +- .../src/include/tools/model_table/kbdpage.h | 2 - .../tools/model_table/kbdpropertydlg.h | 3 +- .../include/tools/model_table/kbdreplacedlg.h | 3 +- .../src/include/tools/model_table/kbdtable.h | 1 - .../tools/model_table/kbdtabledefine.h | 3 + .../src/include/tools/model_table/valuedlg.h | 4 +- .../src/public/pub_widget/PubWidgetInit.cpp | 64 +- platform/src/public/pub_widget/pub_widget.pro | 106 +- .../src/tools/Other/generateTablexml/main.cpp | 4 +- platform/src/tools/ScriptForm/FindWidget.cpp | 105 - platform/src/tools/ScriptForm/FindWidget.h | 36 - platform/src/tools/ScriptForm/FindWidget.ui | 401 - platform/src/tools/ScriptForm/Highlighter.cpp | 154 - platform/src/tools/ScriptForm/Highlighter.h | 93 - .../src/tools/ScriptForm/ScriptEditor.cpp | 496 - platform/src/tools/ScriptForm/ScriptEditor.h | 145 - platform/src/tools/ScriptForm/ScriptForm.cpp | 340 - platform/src/tools/ScriptForm/ScriptForm.pro | 31 - platform/src/tools/ScriptForm/ScriptForm.qrc | 14 - .../src/tools/ScriptForm/ScriptRes/complete | 1453 --- .../ScriptForm/ScriptRes/icon/analysis.png | Bin 802 -> 0 bytes .../tools/ScriptForm/ScriptRes/icon/copy.png | Bin 360 -> 0 bytes .../tools/ScriptForm/ScriptRes/icon/cut.png | Bin 897 -> 0 bytes .../tools/ScriptForm/ScriptRes/icon/find.png | Bin 694 -> 0 bytes .../tools/ScriptForm/ScriptRes/icon/paste.png | Bin 453 -> 0 bytes .../tools/ScriptForm/ScriptRes/icon/redo.png | Bin 457 -> 0 bytes .../tools/ScriptForm/ScriptRes/icon/undo.png | Bin 437 -> 0 bytes .../ScriptForm/ScriptRes/icon/zoomIn.png | Bin 617 -> 0 bytes .../ScriptForm/ScriptRes/icon/zoomOut.png | Bin 646 -> 0 bytes .../tools/fbd_designer/fbd_block/CBlock.cpp | 132 +- .../src/tools/fbd_designer/fbd_designer.pro | 4 +- .../fbd_designer/fbd_designer.ico | Bin 4286 -> 4742 bytes .../fbd_designer/fbd_designer.pro | 2 + .../tools/fbd_designer/fbd_designer/main.cpp | 65 +- .../fbd_designer/fbd_diagram/CDiagram.cpp | 7 +- .../fbd_diagram/CPluginManager.cpp | 5 +- .../fbd_designer/fbd_diagram/fbd_diagram.pro | 1 + .../tools/fbd_designer/fbd_editor/CAbout.cpp | 11 +- .../tools/fbd_designer/fbd_editor/CAbout.h | 4 +- .../tools/fbd_designer/fbd_editor/CAbout.ui | 21 +- .../fbd_editor/CFBDMainWindow.cpp | 487 +- .../fbd_designer/fbd_editor/CFBDMainWindow.ui | 35 +- .../tools/fbd_designer/fbd_editor/CGroup.cpp | 33 +- .../tools/fbd_designer/fbd_editor/CGroup.h | 4 +- .../fbd_designer/fbd_editor/CGroupEdit.cpp | 19 +- .../fbd_designer/fbd_editor/CGroupEdit.h | 4 +- .../fbd_designer/fbd_editor/CSetGroupDlg.cpp | 47 +- .../fbd_designer/fbd_editor/CSetGroupDlg.h | 5 +- .../fbd_designer/fbd_editor/fbd_editor.ico | Bin 4286 -> 4742 bytes .../fbd_designer/fbd_editor/fbd_editor.pro | 154 +- .../fbd_designer/fbd_editor/fbd_editor.qrc | 1 + .../fbd_designer/fbd_editor/icons/Help.png | Bin 561 -> 748 bytes .../fbd_designer/fbd_editor/icons/Open.png | Bin 431 -> 437 bytes .../fbd_editor/icons/button_cancel.png | Bin 242 -> 282 bytes .../fbd_editor/icons/continue.png | Bin 389 -> 373 bytes .../fbd_designer/fbd_editor/icons/copy.png | Bin 287 -> 219 bytes .../fbd_editor/icons/database_delete.png | Bin 709 -> 825 bytes .../fbd_designer/fbd_editor/icons/diagram.png | Bin 561 -> 655 bytes .../fbd_editor/icons/diagram_blue.png | Bin 1004 -> 945 bytes .../fbd_editor/icons/diagram_green.png | Bin 1004 -> 964 bytes .../fbd_editor/icons/document-new.png | Bin 359 -> 323 bytes .../fbd_editor/icons/edit-cut.png | Bin 646 -> 643 bytes .../fbd_editor/icons/filecheck.png | Bin 614 -> 803 bytes .../fbd_designer/fbd_editor/icons/group.png | Bin 478 -> 434 bytes .../fbd_editor/icons/list-delete.png | Bin 709 -> 832 bytes .../fbd_designer/fbd_editor/icons/paste.png | Bin 340 -> 250 bytes .../fbd_designer/fbd_editor/icons/redo.png | Bin 462 -> 490 bytes .../fbd_designer/fbd_editor/icons/save.png | Bin 377 -> 325 bytes .../fbd_editor/icons/save_all.png | Bin 360 -> 270 bytes .../fbd_designer/fbd_editor/icons/search.png | Bin 534 -> 685 bytes .../fbd_editor/icons/settings1.png | Bin 459 -> 399 bytes .../fbd_editor/icons/shape_align_bottom.png | Bin 247 -> 207 bytes .../fbd_editor/icons/shape_align_left.png | Bin 265 -> 211 bytes .../fbd_editor/icons/shape_align_right.png | Bin 274 -> 220 bytes .../fbd_editor/icons/shape_align_top.png | Bin 246 -> 213 bytes .../fbd_designer/fbd_editor/icons/start.png | Bin 383 -> 544 bytes .../fbd_editor/icons/text-xml.png | Bin 505 -> 575 bytes .../fbd_designer/fbd_editor/icons/undo.png | Bin 466 -> 462 bytes .../fbd_editor/icons/zoom100percent.png | Bin 565 -> 706 bytes .../fbd_designer/fbd_editor/icons/zoomin.png | Bin 500 -> 716 bytes .../fbd_editor/icons/zoomobjects.png | Bin 506 -> 635 bytes .../fbd_designer/fbd_editor/icons/zoomout.png | Bin 482 -> 651 bytes .../actionAOplugin/icon/actionAO.png | Bin 652 -> 627 bytes .../actionDOplugin/icon/actionDO.png | Bin 693 -> 702 bytes .../fbd_plugins/add2fplugin/icon/add2f.png | Bin 293 -> 298 bytes .../fbd_plugins/add2plugin/icon/add.png | Bin 293 -> 298 bytes .../fbd_plugins/and2plugin/icon/and2.png | Bin 606 -> 677 bytes .../antishakeplugin/antishakeplugin.cpp | 7 + .../antishakeplugin/antishakeplugin.h | 4 + .../antishakeplugin/icon/antishake.png | Bin 387 -> 305 bytes .../bitsplitplugin/icon/bitsplit.png | Bin 501 -> 585 bytes .../fbd_plugins/btoiplugin/icon/btoi.png | Bin 546 -> 608 bytes .../fbd_plugins/cmpeplugin/icon/et.png | Bin 309 -> 282 bytes .../fbd_plugins/cmpgeplugin/icon/gtet.png | Bin 524 -> 567 bytes .../fbd_plugins/cmpgfplugin/icon/gtf.png | Bin 467 -> 520 bytes .../fbd_plugins/cmpgplugin/icon/gt.png | Bin 467 -> 520 bytes .../fbd_plugins/cmpleplugin/icon/ltet.png | Bin 558 -> 549 bytes .../fbd_plugins/cmplfplugin/icon/ltf.png | Bin 466 -> 496 bytes .../fbd_plugins/cmplplugin/icon/lt.png | Bin 466 -> 496 bytes .../fbd_plugins/constfplugin/icon/constf.png | Bin 480 -> 556 bytes .../fbd_plugins/constplugin/icon/const.png | Bin 480 -> 556 bytes .../fbd_plugins/constsplugin/icon/consts.png | Bin 480 -> 556 bytes .../fbd_plugins/divfplugin/icon/divf.png | Bin 515 -> 680 bytes .../fbd_plugins/divplugin/icon/div.png | Bin 515 -> 680 bytes .../fbd_designer/fbd_plugins/fbd_plugins.pro | 10 +- .../fbd_plugins/ftoiplugin/icon/ftoi.png | Bin 470 -> 500 bytes .../fbd_plugins/icons/default.png | Bin 246 -> 260 bytes .../fbd_plugins/icons/template.png | Bin 453 -> 437 bytes .../fbd_plugins/inputfplugin/icon/inputf.png | Bin 295 -> 279 bytes .../fbd_plugins/inputplugin/icon/input.png | Bin 295 -> 279 bytes .../fbd_plugins/inputplugin/inputplugin.cpp | 27 + .../fbd_plugins/inputplugin/inputplugin.h | 4 + .../inputswitchplugin/icon/inputswitch.png | Bin 467 -> 399 bytes .../fbd_plugins/itobplugin/icon/itob.png | Bin 523 -> 587 bytes .../fbd_plugins/itofplugin/icon/itof.png | Bin 504 -> 526 bytes .../fbd_plugins/luaplugin/icon/lua.png | Bin 456 -> 497 bytes .../fbd_plugins/luaplugin/luaplugin.cpp | 2 +- .../fbd_plugins/luaplugin/luaplugin.pro | 1 + .../fbd_plugins/mulfplugin/icon/mulf.png | Bin 432 -> 424 bytes .../fbd_plugins/mulplugin/icon/mul.png | Bin 432 -> 424 bytes .../fbd_plugins/notplugin/icon/not.png | Bin 360 -> 404 bytes .../fbd_plugins/or2plugin/icon/or2.png | Bin 506 -> 492 bytes .../outputfplugin/icon/outputf.png | Bin 488 -> 615 bytes .../outputfplugin/outputfplugin.cpp | 32 + .../fbd_plugins/outputfplugin/outputfplugin.h | 10 + .../fbd_plugins/outputplugin/icon/output.png | Bin 488 -> 615 bytes .../fbd_plugins/outputplugin/outputplugin.cpp | 28 + .../fbd_plugins/outputplugin/outputplugin.h | 8 + .../fbd_plugins/subfplugin/icon/subf.png | Bin 273 -> 292 bytes .../fbd_plugins/subplugin/icon/sub.png | Bin 273 -> 292 bytes .../fbd_property/CPropertyModel.cpp | 2 +- .../fbd_property/CPropertyTreeView.cpp | 65 + .../fbd_property/CPropertyTreeView.h | 4 +- .../fbd_property/CVariantDelegate.cpp | 15 + .../fbd_property/CVariantDelegate.h | 6 +- .../fbd_designer/fbd_renderer/CBlockItem.cpp | 291 +- .../fbd_designer/fbd_renderer/CBlockItem.h | 21 +- .../fbd_designer/fbd_renderer/CCellWidget.cpp | 6 +- .../fbd_designer/fbd_renderer/CRenderer.cpp | 60 +- .../fbd_designer/fbd_renderer/CRenderer.h | 16 + .../fbd_renderer/CTemplateWidget.cpp | 8 +- .../fbd_designer/fbd_retriever/CRetriever.cpp | 30 +- .../fbd_designer/fbd_retriever/CRetriever.ui | 22 +- .../fbd_retriever/fbd_retriever.pro | 3 +- platform/src/tools/model_common/common.cpp | 41 +- .../src/tools/model_common/model_common.pro | 5 +- .../src/tools/model_common/model_common_EN.ts | 50 +- .../model_plugin/AlarmWidget/AlarmWidget.pro | 1 + .../AlarmWidget/alarmdefinepluginwidget.h | 2 +- .../model_plugin/AlarmWidget/alarmwidget.cpp | 65 +- .../DevModelWidget/DevModelWidget.pro | 5 + .../DevModelWidget/devicemodelpluginwidget.h | 2 +- .../model_plugin/DevModelWidget/devwidget.cpp | 803 +- .../model_plugin/DevModelWidget/devwidget.h | 23 +- .../DevModelWidget/kbdaddtempgroupdlg.cpp | 6 +- .../DevModelWidget/kbdaddtempgroupdlg.h | 4 +- .../DevModelWidget/kbdbatchmodifydevgroup.cpp | 15 +- .../DevModelWidget/kbdbatchmodifydevgroup.h | 5 +- .../DevModelWidget/kbdcreatedevbyfes.cpp | 18 +- .../DevModelWidget/kbddevandfeswidget.cpp | 34 +- .../DevModelWidget/kbddevgrouplistdlg.cpp | 8 +- .../DevModelWidget/kbddevgrouplistdlg.h | 4 +- .../DevModelWidget/kbddevinfo.cpp | 2 +- .../model_plugin/DevModelWidget/kbddevinfo.h | 4 +- .../DevModelWidget/kbdfesdevdlg.cpp | 8 +- .../DevModelWidget/kbdfesdevdlg.h | 4 +- .../DevModelWidget/kbdfesdevtempdlg.cpp | 4 +- .../DevModelWidget/kbdfesdevtempdlg.h | 4 +- .../DevModelWidget/kbdgeneratefesdlg.cpp | 7 +- .../DevModelWidget/kbdgeneratefesdlg.h | 4 +- .../DevModelWidget/kbdimportdevgroupdlg.cpp | 12 +- .../DevModelWidget/kbdimportdevgroupdlg.h | 4 +- .../DevModelWidget/kbdpointtypedlg.cpp | 6 +- .../DevModelWidget/kbdpointtypedlg.h | 5 +- .../DevModelWidget/kbdrelationfesdlg.cpp | 12 +- .../DevModelWidget/kbdrelationfesdlg.h | 4 +- .../DevModelWidget/kbdtempgroupinstdlg.cpp | 12 +- .../DevModelWidget/kbdtempgroupinstdlg.h | 5 +- .../DevModelWidget/parsingdevfile.cpp | 2 +- .../model_plugin/FESWidget/FESWidget.pro | 3 +- .../FESWidget/fescfgpluginwidget.h | 2 +- .../model_plugin/FESWidget/feswidget.cpp | 85 +- .../tools/model_plugin/FESWidget/feswidget.h | 3 + .../FESWidget/kbdForwardrtudlg.cpp | 29 +- .../model_plugin/FESWidget/kbdForwardrtudlg.h | 4 +- .../FESWidget/kbdbatchfesdevdlg.cpp | 6 +- .../FESWidget/kbdbatchfesdevdlg.h | 4 +- .../model_plugin/FESWidget/kbdchanwidget.cpp | 11 +- .../FESWidget/kbddevimportdlg.cpp | 67 +- .../model_plugin/FESWidget/kbddevimportdlg.h | 6 +- .../FESWidget/kbdfesdevwidget.cpp | 8 +- .../FESWidget/kbdfespointwidget.cpp | 476 +- .../FESWidget/kbdfespointwidget.h | 17 +- .../FESWidget/kbdfesprotocolwidget.cpp | 55 +- .../FESWidget/kbdforwardbackwidget.cpp | 351 +- .../FESWidget/kbdforwardbackwidget.h | 12 + .../FESWidget/kbdforwardwizard.cpp | 4 +- .../model_plugin/FESWidget/kbdimportdlg.cpp | 11 +- .../model_plugin/FESWidget/kbdimportdlg.h | 5 +- .../model_plugin/FESWidget/kbdpagewidget.cpp | 4 +- .../model_plugin/FESWidget/kbdpsc3000dlg.cpp | 40 +- .../FESWidget/kbdrtulistwidget.cpp | 12 +- .../FESWidget/kbdselectdevdlg.cpp | 14 +- .../model_plugin/FESWidget/kbdselectdevdlg.h | 4 +- .../FESWidget/kbdupdatepsc3000dlg.cpp | 344 +- .../FESWidget/kbdupdatepsc3000dlg.h | 15 +- .../SystemConfigWizard/SystemConfigWizard.pro | 1 + .../systemconfigpluginwidget.h | 2 +- .../SystemConfigWizard/systemconfigwizard.cpp | 16 +- .../model_plugin/TempPlugin/TempPlugin.pro | 2 +- .../TempPlugin/editrelationdlg.cpp | 18 +- .../model_plugin/TempPlugin/editrelationdlg.h | 7 +- .../model_plugin/TempPlugin/festempwidget.cpp | 4221 ++++---- .../model_plugin/TempPlugin/festempwidget.h | 8 +- .../TempPlugin/kbdbatchinstancedlg.cpp | 8 +- .../TempPlugin/kbdbatchinstancedlg.h | 4 +- .../TempPlugin/kbdcustominstplugindlg.cpp | 150 +- .../TempPlugin/kbdcustominstplugindlg.h | 11 +- .../model_plugin/TempPlugin/kbddevlistdlg.cpp | 2 +- .../model_plugin/TempPlugin/kbddevlistdlg.h | 4 +- .../TempPlugin/kbdfesdevlistdlg.cpp | 2 +- .../TempPlugin/kbdfesdevlistdlg.h | 4 +- .../model_plugin/TempPlugin/kbdfestempdlg.cpp | 2 +- .../model_plugin/TempPlugin/kbdfestempdlg.h | 4 +- .../TempPlugin/kbdfestemppointmodifydlg.cpp | 12 +- .../TempPlugin/kbdfestemppointmodifydlg.h | 4 +- .../TempPlugin/kbdgeneratetempwizard.cpp | 4 +- .../TempPlugin/kbdinstplugindlg.cpp | 11 +- .../TempPlugin/kbdinstplugindlg.h | 4 +- .../TempPlugin/kbdpointfromtextdlg.cpp | 6 +- .../TempPlugin/kbdpointfromtextdlg.h | 4 +- .../TempPlugin/tempmanagepluginwidget.cpp | 15 +- .../TempPlugin/tempmanagepluginwidget.h | 2 +- .../TempPlugin/temppluginwidget.cpp | 232 +- .../TempPlugin/temppluginwidget.h | 14 +- .../model_plugin/TempPlugin/tempwidget.cpp | 110 +- .../model_plugin/TempPlugin/tempwidget.h | 7 +- .../UserWidget/usermanagepluginwidget.h | 2 +- .../model_plugin/UserWidget/userwidget.cpp | 41 +- .../model_plugin/UserWidget/userwidget.h | 9 +- .../src/tools/model_plugin/model_plugin.pro | 2 + platform/src/tools/model_studio/icons.qrc | 25 +- .../src/tools/model_studio/icons/alarm.png | Bin 761 -> 0 bytes .../src/tools/model_studio/icons/common.png | Bin 606 -> 0 bytes platform/src/tools/model_studio/icons/dev.png | Bin 680 -> 0 bytes .../src/tools/model_studio/icons/exit.png | Bin 774 -> 0 bytes platform/src/tools/model_studio/icons/fes.png | Bin 964 -> 0 bytes .../src/tools/model_studio/icons/formula.png | Bin 860 -> 0 bytes .../src/tools/model_studio/icons/linkage.png | Bin 660 -> 0 bytes .../src/tools/model_studio/icons/sample.png | Bin 954 -> 0 bytes platform/src/tools/model_studio/icons/seq.png | Bin 749 -> 0 bytes .../src/tools/model_studio/icons/studio.ico | Bin 4286 -> 4286 bytes .../src/tools/model_studio/icons/user.png | Bin 938 -> 0 bytes .../tools/model_studio/kbdbackpointpatch.cpp | 230 +- .../tools/model_studio/kbdbackpointpatch.h | 14 +- .../tools/model_studio/kbdbackpointpatch.ui | 76 +- .../src/tools/model_studio/kbdconfigcheck.cpp | 463 +- .../src/tools/model_studio/kbdconfigcheck.h | 19 +- .../src/tools/model_studio/kbdfespointdlg.cpp | 2 +- .../src/tools/model_studio/kbdfespointdlg.h | 5 +- .../tools/model_studio/kbdfespointpatch.cpp | 60 +- .../src/tools/model_studio/kbdfespointpatch.h | 7 +- .../tools/model_studio/kbdfespointpatch.ui | 107 +- .../model_studio/loginDialog/logindlg.cpp | 16 +- .../tools/model_studio/loginDialog/logindlg.h | 4 +- platform/src/tools/model_studio/main.cpp | 48 +- .../src/tools/model_studio/mainwindow.cpp | 213 +- platform/src/tools/model_studio/mainwindow.h | 21 +- platform/src/tools/model_studio/mainwindow.ui | 16 +- .../src/tools/model_studio/model_studio.pro | 10 +- .../src/tools/model_studio/model_studio_EN.ts | 9500 ----------------- platform/src/tools/model_studio/studio.ico | Bin 4286 -> 4286 bytes .../icons/systemConfig.ico | Bin 4286 -> 4286 bytes .../model_system_config/kbdchainwidget.cpp | 13 +- .../model_system_config/kbdnodewidget.cpp | 79 +- .../tools/model_system_config/kbdnodewidget.h | 2 - .../model_system_config/kbdrttablewidget.cpp | 18 +- .../tools/model_system_config/logindlg.cpp | 24 +- .../src/tools/model_system_config/logindlg.h | 5 +- .../src/tools/model_system_config/main.cpp | 43 +- .../tools/model_system_config/mainwindow.cpp | 50 +- .../tools/model_system_config/mainwindow.h | 3 +- .../tools/model_system_config/mainwindow.ui | 26 - .../model_system_config.pro | 1 + .../model_system_config_EN.ts | 416 +- .../model_system_config/sysconfigwidget.cpp | 204 +- .../model_system_config/sysconfigwidget.h | 5 +- .../model_system_config/systemConfig.ico | Bin 4286 -> 4286 bytes .../model_table/CustomWidget/kbddommodel.cpp | 2 +- .../CustomWidget/kbdpassworddlg.cpp | 8 +- .../CustomWidget/kbdselectdevpointdlg.cpp | 4 +- .../CustomWidget/kbdselectpointdlg.cpp | 5 +- .../model_table/CustomWidget/kbdtreeview.cpp | 137 - .../tools/model_table/icons/arrowBottom.png | Bin 1040 -> 0 bytes .../src/tools/model_table/icons/arrowLeft.png | Bin 1094 -> 0 bytes .../tools/model_table/icons/arrowRight.png | Bin 1039 -> 0 bytes .../src/tools/model_table/icons/arrowTop.png | Bin 1081 -> 0 bytes .../src/tools/model_table/kbdbatchdlg.cpp | 10 +- platform/src/tools/model_table/kbdbatchdlg.h | 6 +- .../src/tools/model_table/kbddbdesign.cpp | 40 +- .../src/tools/model_table/kbdinputdlg.cpp | 8 +- .../tools/model_table/kbdmodelexcelfun.cpp | 23 +- .../src/tools/model_table/kbdmodelwrap.cpp | 27 +- .../src/tools/model_table/kbdmsgcontrl.cpp | 4 +- platform/src/tools/model_table/kbdpage.cpp | 12 +- .../src/tools/model_table/kbdpropertydlg.cpp | 10 +- .../src/tools/model_table/kbdreplacedlg.cpp | 6 +- .../src/tools/model_table/kbdsplitter.cpp | 40 +- platform/src/tools/model_table/kbdtable.cpp | 168 +- .../src/tools/model_table/kbdtabledatamgr.cpp | 6 +- .../src/tools/model_table/kbdtablemodel.cpp | 4 + platform/src/tools/model_table/kbdwidget.cpp | 10 +- .../src/tools/model_table/model_table.pro | 1 + .../src/tools/model_table/model_table_EN.ts | 1836 +++- .../qttreepropertybrowser.cpp | 8 +- .../src/tools/model_table/tableresource.qrc | 4 - platform/src/tools/model_table/valuedlg.cpp | 2 +- platform/src/tools/model_table/worker.cpp | 16 +- .../src/tools/model_user/kbdacscollectdlg.cpp | 10 +- .../src/tools/model_user/kbdacscollectdlg.h | 6 +- .../src/tools/model_user/kbdacsdevcfg.cpp | 19 +- .../model_user/kbdloadacsinfotodevdlg.cpp | 21 +- .../tools/model_user/kbdloadacsinfotodevdlg.h | 18 +- platform/src/tools/model_user/kbdroleview.cpp | 22 +- .../tools/model_user/kbduserfuncwidget.cpp | 8 +- .../src/tools/model_user/kbdusergroupview.cpp | 21 +- platform/src/tools/model_user/kbduserview.cpp | 71 +- platform/src/tools/model_user/kbduserview.h | 5 + .../src/tools/model_user/kbduserwidget.cpp | 30 +- .../src/tools/model_user/kbduserxmlwidget.cpp | 19 +- platform/src/tools/model_user/model_user.pro | 9 +- .../src/tools/model_user/model_user_EN.ts | 893 -- .../model_waiting_dlg/model_waiting_dlg_EN.ts | 28 - platform/src/tools/tools.pro | 8 +- 613 files changed, 26004 insertions(+), 31078 deletions(-) delete mode 100644 platform/src/dbms/db_manager/en.ts delete mode 100644 platform/src/dbms/rdb_api/CRdbCache.cpp delete mode 100644 platform/src/dbms/rdb_api/CRdbCache.h create mode 100644 platform/src/example/tsdbDataSim/MainWindow.cpp create mode 100644 platform/src/example/tsdbDataSim/MainWindow.h create mode 100644 platform/src/example/tsdbDataSim/MainWindow.ui create mode 100644 platform/src/example/tsdbDataSim/RandUtil.h create mode 100644 platform/src/example/tsdbDataSim/dataWorker.cpp create mode 100644 platform/src/example/tsdbDataSim/dataWorker.h create mode 100644 platform/src/example/tsdbDataSim/download.ico create mode 100644 platform/src/example/tsdbDataSim/download.png create mode 100644 platform/src/example/tsdbDataSim/main.cpp create mode 100644 platform/src/example/tsdbDataSim/tsdbDataSim.pro create mode 100644 platform/src/example/tsdbDataSimForCloudPlatform/MainWindow.cpp create mode 100644 platform/src/example/tsdbDataSimForCloudPlatform/MainWindow.h create mode 100644 platform/src/example/tsdbDataSimForCloudPlatform/MainWindow.ui create mode 100644 platform/src/example/tsdbDataSimForCloudPlatform/RandUtil.h create mode 100644 platform/src/example/tsdbDataSimForCloudPlatform/dataWorker.cpp create mode 100644 platform/src/example/tsdbDataSimForCloudPlatform/dataWorker.h create mode 100644 platform/src/example/tsdbDataSimForCloudPlatform/download.ico create mode 100644 platform/src/example/tsdbDataSimForCloudPlatform/download.png create mode 100644 platform/src/example/tsdbDataSimForCloudPlatform/main.cpp create mode 100644 platform/src/example/tsdbDataSimForCloudPlatform/tsdbDataSim.pro delete mode 100644 platform/src/tools/ScriptForm/FindWidget.cpp delete mode 100644 platform/src/tools/ScriptForm/FindWidget.h delete mode 100644 platform/src/tools/ScriptForm/FindWidget.ui delete mode 100644 platform/src/tools/ScriptForm/Highlighter.cpp delete mode 100644 platform/src/tools/ScriptForm/Highlighter.h delete mode 100644 platform/src/tools/ScriptForm/ScriptEditor.cpp delete mode 100644 platform/src/tools/ScriptForm/ScriptEditor.h delete mode 100644 platform/src/tools/ScriptForm/ScriptForm.cpp delete mode 100644 platform/src/tools/ScriptForm/ScriptForm.pro delete mode 100644 platform/src/tools/ScriptForm/ScriptForm.qrc delete mode 100644 platform/src/tools/ScriptForm/ScriptRes/complete delete mode 100644 platform/src/tools/ScriptForm/ScriptRes/icon/analysis.png delete mode 100644 platform/src/tools/ScriptForm/ScriptRes/icon/copy.png delete mode 100644 platform/src/tools/ScriptForm/ScriptRes/icon/cut.png delete mode 100644 platform/src/tools/ScriptForm/ScriptRes/icon/find.png delete mode 100644 platform/src/tools/ScriptForm/ScriptRes/icon/paste.png delete mode 100644 platform/src/tools/ScriptForm/ScriptRes/icon/redo.png delete mode 100644 platform/src/tools/ScriptForm/ScriptRes/icon/undo.png delete mode 100644 platform/src/tools/ScriptForm/ScriptRes/icon/zoomIn.png delete mode 100644 platform/src/tools/ScriptForm/ScriptRes/icon/zoomOut.png delete mode 100644 platform/src/tools/model_studio/icons/alarm.png delete mode 100644 platform/src/tools/model_studio/icons/common.png delete mode 100644 platform/src/tools/model_studio/icons/dev.png delete mode 100644 platform/src/tools/model_studio/icons/exit.png delete mode 100644 platform/src/tools/model_studio/icons/fes.png delete mode 100644 platform/src/tools/model_studio/icons/formula.png delete mode 100644 platform/src/tools/model_studio/icons/linkage.png delete mode 100644 platform/src/tools/model_studio/icons/sample.png delete mode 100644 platform/src/tools/model_studio/icons/seq.png delete mode 100644 platform/src/tools/model_studio/icons/user.png delete mode 100644 platform/src/tools/model_studio/model_studio_EN.ts delete mode 100644 platform/src/tools/model_table/icons/arrowBottom.png delete mode 100644 platform/src/tools/model_table/icons/arrowLeft.png delete mode 100644 platform/src/tools/model_table/icons/arrowRight.png delete mode 100644 platform/src/tools/model_table/icons/arrowTop.png delete mode 100644 platform/src/tools/model_user/model_user_EN.ts delete mode 100644 platform/src/tools/model_waiting_dlg/model_waiting_dlg_EN.ts diff --git a/platform/src/dbms/db_base_api/CDbKingbaseApi.cpp b/platform/src/dbms/db_base_api/CDbKingbaseApi.cpp index f45866f2..66bb7c44 100644 --- a/platform/src/dbms/db_base_api/CDbKingbaseApi.cpp +++ b/platform/src/dbms/db_base_api/CDbKingbaseApi.cpp @@ -20,7 +20,10 @@ bool CDbKingbaseApi::doAfterOpen() * SET search_path TO ISCS6000_FSNH;--设置,会话级 * ALTER database ISCS6000_FSNH SET search_path TO ISCS6000_FSNH,“$USER”, public;--设置,永久 */ - QString sSql = "SET search_path TO iscs6000;"; + /* 为以后搜索方便,保留此注释 + * QString sSql = QString("SET search_path TO %1;").arg(EMS_DEFAULT_DATABASE) ; + */ + QString sSql = QString("SET search_path TO %1;").arg(m_objDbPara.getDatabaseName()) ; if ( !execute(sSql) ) return false; diff --git a/platform/src/dbms/db_base_api/CDbMySQLApi.cpp b/platform/src/dbms/db_base_api/CDbMySQLApi.cpp index 36af310d..c8790b1d 100644 --- a/platform/src/dbms/db_base_api/CDbMySQLApi.cpp +++ b/platform/src/dbms/db_base_api/CDbMySQLApi.cpp @@ -1,161 +1,161 @@ -#include "CDbMySQLApi.h" - -using namespace iot_dbms; - -CDbMySQLApi::CDbMySQLApi() - : CDbBaseApi_impl() -{ -} - -CDbMySQLApi::CDbMySQLApi( const CDbPara& objDbPara ) - : CDbBaseApi_impl( objDbPara ) -{ -} - -CDbMySQLApi::~CDbMySQLApi() -{ -} - -QString CDbMySQLApi::getDriverStr() const -{ - return QString( "QMYSQL" ); -} - -void CDbMySQLApi::setConnectOptions() -{ - // model_studio 调用存储过程的时候会导致超过60s无返回,故不设置超时参数,todo 应该让它优化 - QString sAppName = QCoreApplication::applicationName().toLower(); - if ( sAppName=="model_studio" || sAppName=="db_manager" ) - return; - - //< 经实验,setConnectOptions()必须一次性设置(不可分多行),再次执行setConnectOptions()会覆盖掉之前的 - //< 在此参数下,60%网络丢包率环境,测试9474次打开数据库: - //< 526次大于61秒,其中70~79秒47次,80~89秒4次,90秒1次,112秒1次 - //< 因此,极端情况下可能触发死锁检测(默认3分钟)自杀,todo 可以考虑增加死锁检测默认值到5分钟 - m_pDb->setConnectOptions("MYSQL_OPT_CONNECT_TIMEOUT=10;MYSQL_OPT_READ_TIMEOUT=60;MYSQL_OPT_WRITE_TIMEOUT=60"); -} - -bool CDbMySQLApi::doAfterOpen() -{ - QString sSql = "use " + m_objDbPara.getDatabaseName(); - if ( !execute(sSql) ) - { - return false; - } - - if ( !execute("set names 'utf8'") ) - { - return false; - } - - //< 历史原因,有些表的长度超长,在MySQL5时代可以的,但现在不行,报错如下: - //< SQL EXECUTE ERROR, REASON:Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. - //< 执行此设置以作兼容,在MySQL5上是默认OFF的 - execute("SET SESSION innodb_strict_mode = 'OFF'"); - - return true; -} - -bool CDbMySQLApi::needReconnect() -{ - if ( 2006 == m_nErrorNum ) - { - // 2006错误:MySQL server has gone away,与服务器连接中断 - return true; - } - if ( 2013 == m_nErrorNum ) - { - // 2013错误:Lost connection to MySQL server during query - return true; - } - return false; -} - -bool CDbMySQLApi::drop( const QString& sTableName ) -{ - if ( !isOpen() ) - return false; - - m_sLastSql = QString( "drop table if exists %1;" ) - .arg( addQuoteMarks(sTableName) ); - - QSqlQuery objQuery( m_sLastSql, *m_pDb ); - m_sErrorStr = objQuery.lastError().text(); - m_nErrorNum = objQuery.lastError().number(); - return objQuery.isActive(); -} - -QString CDbMySQLApi::addQuoteMarks( const QString& sStr ) const -{ - QString strDest( sStr.trimmed() ); - if ( !strDest.startsWith("`") ) - strDest = QString("`%1").arg(strDest); - if ( !strDest.endsWith("`") ) - strDest = QString("%1`").arg(strDest); - return strDest; -} - -QString CDbMySQLApi::convertQuoteMarks( const QString& sStr ) const -{ - QString sTmp = sStr; - sTmp = sTmp.replace("\\","\\\\"); /* \ -> \\ */ - sTmp = sTmp.replace("'","\\'"); /* ' -> \' */ - //sTmp = sTmp.replace("\"","\\\""); - return sTmp; -} - -QString CDbMySQLApi::convertToSqlString( const QDateTime& dt ) const -{ - QString strDateTime = dt.toString( "yyyy-MM-dd hh:mm:ss" ); - strDateTime = QString( "\'%1\'" ).arg( strDateTime ); - return strDateTime; -} - -QString CDbMySQLApi::getHostName() -{ - QString sHostName = ""; - if ( m_pDb != NULL && m_pDb->isOpen() ) - { - QSqlQuery objQuery = m_pDb->exec("select @@global.hostname"); - m_sErrorStr = objQuery.lastError().text(); - m_nErrorNum = objQuery.lastError().number(); - if ( objQuery.next()) - sHostName = objQuery.value( 0 ).toString(); - } - return sHostName; -} - -bool CDbMySQLApi::lockTable( const QString& sTabelName ) -{ - if ( m_pDb != NULL && m_pDb->isOpen() && sTabelName.size()>0 ) - { - QSqlQuery objQuery = m_pDb->exec("LOCK TABLES "+sTabelName+" WRITE"); - m_sErrorStr = objQuery.lastError().text(); - m_nErrorNum = objQuery.lastError().number(); - return objQuery.isActive(); - } - return false; -} - -bool CDbMySQLApi::unlockTable() -{ - if ( m_pDb != NULL && m_pDb->isOpen() ) - { - QSqlQuery objQuery = m_pDb->exec("UNLOCK TABLES"); - m_sErrorStr = objQuery.lastError().text(); - m_nErrorNum = objQuery.lastError().number(); - return objQuery.isActive(); - } - return false; -} - - - - - - - - - - - +#include "CDbMySQLApi.h" + +using namespace iot_dbms; + +CDbMySQLApi::CDbMySQLApi() + : CDbBaseApi_impl() +{ +} + +CDbMySQLApi::CDbMySQLApi( const CDbPara& objDbPara ) + : CDbBaseApi_impl( objDbPara ) +{ +} + +CDbMySQLApi::~CDbMySQLApi() +{ +} + +QString CDbMySQLApi::getDriverStr() const +{ + return QString( "QMYSQL" ); +} + +void CDbMySQLApi::setConnectOptions() +{ + // model_studio 调用存储过程的时候会导致超过60s无返回,故不设置超时参数,todo 应该让它优化 + QString sAppName = QCoreApplication::applicationName().toLower(); + if ( sAppName=="model_studio" || sAppName=="db_manager" ) + return; + + //< 经实验,setConnectOptions()必须一次性设置(不可分多行),再次执行setConnectOptions()会覆盖掉之前的 + //< 在此参数下,60%网络丢包率环境,测试9474次打开数据库: + //< 526次大于61秒,其中70~79秒47次,80~89秒4次,90秒1次,112秒1次 + //< 因此,极端情况下可能触发死锁检测(默认3分钟)自杀,todo 可以考虑增加死锁检测默认值到5分钟 + m_pDb->setConnectOptions("MYSQL_OPT_CONNECT_TIMEOUT=10;MYSQL_OPT_READ_TIMEOUT=60;MYSQL_OPT_WRITE_TIMEOUT=60;MYSQL_OPT_RECONNECT=1"); +} + +bool CDbMySQLApi::doAfterOpen() +{ + QString sSql = "use " + m_objDbPara.getDatabaseName(); + if ( !execute(sSql) ) + { + return false; + } + + if ( !execute("set names 'utf8'") ) + { + return false; + } + + //< 历史原因,有些表的长度超长,在MySQL5时代可以的,但现在不行,报错如下: + //< SQL EXECUTE ERROR, REASON:Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. + //< 执行此设置以作兼容,在MySQL5上是默认OFF的 + execute("SET SESSION innodb_strict_mode = 'OFF'"); + + return true; +} + +bool CDbMySQLApi::needReconnect() +{ + if ( 2006 == m_nErrorNum ) + { + // 2006错误:MySQL server has gone away,与服务器连接中断 + return true; + } + if ( 2013 == m_nErrorNum ) + { + // 2013错误:Lost connection to MySQL server during query + return true; + } + return false; +} + +bool CDbMySQLApi::drop( const QString& sTableName ) +{ + if ( !isOpen() ) + return false; + + m_sLastSql = QString( "drop table if exists %1;" ) + .arg( addQuoteMarks(sTableName) ); + + QSqlQuery objQuery( m_sLastSql, *m_pDb ); + m_sErrorStr = objQuery.lastError().text(); + m_nErrorNum = objQuery.lastError().number(); + return objQuery.isActive(); +} + +QString CDbMySQLApi::addQuoteMarks( const QString& sStr ) const +{ + QString strDest( sStr.trimmed() ); + if ( !strDest.startsWith("`") ) + strDest = QString("`%1").arg(strDest); + if ( !strDest.endsWith("`") ) + strDest = QString("%1`").arg(strDest); + return strDest; +} + +QString CDbMySQLApi::convertQuoteMarks( const QString& sStr ) const +{ + QString sTmp = sStr; + sTmp = sTmp.replace("\\","\\\\"); /* \ -> \\ */ + sTmp = sTmp.replace("'","\\'"); /* ' -> \' */ + //sTmp = sTmp.replace("\"","\\\""); + return sTmp; +} + +QString CDbMySQLApi::convertToSqlString( const QDateTime& dt ) const +{ + QString strDateTime = dt.toString( "yyyy-MM-dd hh:mm:ss" ); + strDateTime = QString( "\'%1\'" ).arg( strDateTime ); + return strDateTime; +} + +QString CDbMySQLApi::getHostName() +{ + QString sHostName = ""; + if ( m_pDb != NULL && m_pDb->isOpen() ) + { + QSqlQuery objQuery = m_pDb->exec("select @@global.hostname"); + m_sErrorStr = objQuery.lastError().text(); + m_nErrorNum = objQuery.lastError().number(); + if ( objQuery.next()) + sHostName = objQuery.value( 0 ).toString(); + } + return sHostName; +} + +bool CDbMySQLApi::lockTable( const QString& sTabelName ) +{ + if ( m_pDb != NULL && m_pDb->isOpen() && sTabelName.size()>0 ) + { + QSqlQuery objQuery = m_pDb->exec("LOCK TABLES "+sTabelName+" WRITE"); + m_sErrorStr = objQuery.lastError().text(); + m_nErrorNum = objQuery.lastError().number(); + return objQuery.isActive(); + } + return false; +} + +bool CDbMySQLApi::unlockTable() +{ + if ( m_pDb != NULL && m_pDb->isOpen() ) + { + QSqlQuery objQuery = m_pDb->exec("UNLOCK TABLES"); + m_sErrorStr = objQuery.lastError().text(); + m_nErrorNum = objQuery.lastError().number(); + return objQuery.isActive(); + } + return false; +} + + + + + + + + + + + diff --git a/platform/src/dbms/db_base_api/CDbOpenGaussApi.cpp b/platform/src/dbms/db_base_api/CDbOpenGaussApi.cpp index f97fa742..1e1802a5 100644 --- a/platform/src/dbms/db_base_api/CDbOpenGaussApi.cpp +++ b/platform/src/dbms/db_base_api/CDbOpenGaussApi.cpp @@ -21,7 +21,10 @@ bool CDbOpenGaussApi::doAfterOpen() * SET search_path TO ISCS6000_FSNH;--设置,会话级 * ALTER database ISCS6000_FSNH SET search_path TO ISCS6000_FSNH,“$USER”, public;--设置,永久 */ - QString sSql = "SET search_path TO iscs6000;"; + /*为以后搜索方便,保留此注释 + * QString sSql = QString("SET search_path TO %1;").arg(EMS_DEFAULT_DATABASE) ; + */ + QString sSql = QString("SET search_path TO %1;").arg(m_objDbPara.getDatabaseName()) ; if ( !execute(sSql) ) return false; diff --git a/platform/src/dbms/db_his_data_srv/CDumpUtils.cpp b/platform/src/dbms/db_his_data_srv/CDumpUtils.cpp index 1ee59058..7dbe8170 100644 --- a/platform/src/dbms/db_his_data_srv/CDumpUtils.cpp +++ b/platform/src/dbms/db_his_data_srv/CDumpUtils.cpp @@ -19,8 +19,6 @@ #define CONNECTION_NAME PROCESS_NAME -#define DATABASE_NAME "iscs6000" -#define TSDB_DB_NAME "iscs6000" #define DB_FILE_NAME "db_export.sql" #define TSDB_FILE_NAME "tsdb_export.sql.gz" @@ -79,7 +77,11 @@ bool CDumpUtils::getDbConn(const CDbHisCfg &dbCfg,iot_dbms::CDbBaseApi &objDb) objPara.setPort(3306); objPara.setDbType(iot_dbms::EDbType::DB_MYSQL); } - objPara.setDatabaseName(DATABASE_NAME); + + /* 为以后搜索方便,保留此注释 + * objPara.setDatabaseName(EMS_DEFAULT_DATABASE); + */ + objPara.setDatabaseName(dbCfg.strDbName); objDb.setDbPara(objPara); bool ok = objDb.open(); @@ -90,6 +92,11 @@ bool CDumpUtils::getDbConn(const CDbHisCfg &dbCfg,iot_dbms::CDbBaseApi &objDb) //获取首链接连接 { iot_public::CSysInfoInterfacePtr ptrSysInfo; + if(!iot_public::createSysInfoInstance(ptrSysInfo)) + { + LOGERROR( "createSysInfoInstance 返回失败" ); + return false; + } iot_public::SDatabaseInfo stFirstConnectInfo; //数据库连接信息 std::vector vecLocalDbInfo; std::vector vecRemoteDbInfo; @@ -180,8 +187,11 @@ bool CDumpUtils::doBackup(const CDbHisCfg &dbCfg) qint64 expired_days_timestamp = expired_days.toMSecsSinceEpoch(); //==================================================================== + /* 为以后搜索方便,保留此注释 + * hismng.exportHisPartV2(objDb.getDatabase(),"127.0.0.1",EMS_DEFAULT_DATABASE,0,expired_days_timestamp,dbFilePath,tsdbFilePath); + */ iot_dbms::CHisMngApi hismng; - hismng.exportHisPartV2(objDb.getDatabase(),"127.0.0.1",TSDB_DB_NAME,0,expired_days_timestamp,dbFilePath,tsdbFilePath); + hismng.exportHisPartV2(objDb.getDatabase(),"127.0.0.1",objDb.getDbPara().getDatabaseName(),0,expired_days_timestamp,dbFilePath,tsdbFilePath); //< 生成配置 LOGINFO("start to generate config"); @@ -211,7 +221,10 @@ bool CDumpUtils::doBackup(const CDbHisCfg &dbCfg) //< 数据库 - entry.setAttribute("databaseName", DATABASE_NAME); + /* 为以后搜索方便,保留此注释 + * entry.setAttribute("databaseName", EMS_DEFAULT_DATABASE); + */ + entry.setAttribute("databaseName", objDb.getDbPara().getDatabaseName()); //< 备份名称 entry.setAttribute("configName", QDateTime::currentDateTime().toString(QObject::tr("yyyy年M月d日h时m分s秒"))); @@ -252,7 +265,10 @@ bool CDumpUtils::doClean(const CDbHisCfg &dbCfg, bool isAll) //==================================================================== iot_dbms::CHisMngApi hismng; - hismng.delHis(objDb.getDatabase(),"127.0.0.1",TSDB_DB_NAME,expired_days_timestamp); + /* 为以后搜索方便,保留此注释 + * hismng.delHis(objDb.getDatabase(),"127.0.0.1",EMS_DEFAULT_DATABASE,expired_days_timestamp); + */ + hismng.delHisV2(objDb.getDatabase(),"127.0.0.1",objDb.getDbPara().getDatabaseName(),expired_days_timestamp); QString logPath = QCoreApplication::applicationDirPath() + "/../../log/"; // 清理日志 diff --git a/platform/src/dbms/db_his_data_srv/DbHisCfg.cpp b/platform/src/dbms/db_his_data_srv/DbHisCfg.cpp index f34034c1..5cfe5389 100644 --- a/platform/src/dbms/db_his_data_srv/DbHisCfg.cpp +++ b/platform/src/dbms/db_his_data_srv/DbHisCfg.cpp @@ -52,6 +52,7 @@ bool CDbHisCfg::loadFromFile() strUsername = node.attribute("username"); strPasswd = node.attribute("passwd"); strDbType = node.attribute("dbType"); + strDbName = node.attribute("dbName"); } } diff --git a/platform/src/dbms/db_his_data_srv/DbHisCfg.h b/platform/src/dbms/db_his_data_srv/DbHisCfg.h index f4e868e9..4151f88a 100644 --- a/platform/src/dbms/db_his_data_srv/DbHisCfg.h +++ b/platform/src/dbms/db_his_data_srv/DbHisCfg.h @@ -13,9 +13,15 @@ public: int nTrigWeekDay = 7; // 在星期几触发 int nTrigHour = 1; // 触发小时数 24小时制 int nTrigMin = 0; // 触发分钟数 - QString strUsername = "root"; - QString strPasswd = "kbdct@0755"; - QString strDbType = "QMYSQL"; + /* 为方便检索,暂时保留此注释,同时为避免出错,取消默认参数 + * QString strUsername = "root"; + * QString strPasswd = EMS_DEFAULT_PASSWD; + * QString strDbType = "QMYSQL"; + */ + QString strUsername = ""; + QString strPasswd = ""; + QString strDbType = ""; + QString strDbName = ""; int nTrigType = 1; int nTrigAction = 1; int nTrigVolume = 90; diff --git a/platform/src/dbms/db_his_data_srv/db_his_data_srv.pro b/platform/src/dbms/db_his_data_srv/db_his_data_srv.pro index dfd390cb..5e10da70 100644 --- a/platform/src/dbms/db_his_data_srv/db_his_data_srv.pro +++ b/platform/src/dbms/db_his_data_srv/db_his_data_srv.pro @@ -31,7 +31,7 @@ win32-msvc:contains(QMAKE_HOST.arch, x86_64){ LIBS += -lboost_system -lboost_filesystem \ -llog4cplus -lpub_logger_api \ - -lpub_utility_api -ldb_his_mng_api -ldb_base_api + -lpub_utility_api -ldb_his_mng_api -ldb_base_api -lpub_sysinfo_api HEADERS += \ CDumpUtils.h \ diff --git a/platform/src/dbms/db_his_mng_api/CChunkedJsonHandler.cpp b/platform/src/dbms/db_his_mng_api/CChunkedJsonHandler.cpp index 5b171705..c5fbeab4 100644 --- a/platform/src/dbms/db_his_mng_api/CChunkedJsonHandler.cpp +++ b/platform/src/dbms/db_his_mng_api/CChunkedJsonHandler.cpp @@ -2,7 +2,7 @@ -CChunkedJsonHandler::CChunkedJsonHandler(QString strFilePath): +CChunkedJsonHandler::CChunkedJsonHandler(const QString &strDbName,const QString &strFilePath): state_(kExpectObjectStart), nIndex(0), m_gGzipOs(strFilePath) @@ -13,7 +13,7 @@ CChunkedJsonHandler::CChunkedJsonHandler(QString strFilePath): return ; } - genDMLHeader(m_gGzipOs); + genDMLHeader(strDbName,m_gGzipOs); } @@ -259,11 +259,12 @@ bool CChunkedJsonHandler::RawNumber(const Ch *str, SizeType length, bool copy){ } } -void CChunkedJsonHandler::genDMLHeader(CChunkedJsonHandler::CGZipOStream &os) +void CChunkedJsonHandler::genDMLHeader(const QString &strDbName,CChunkedJsonHandler::CGZipOStream &os) { + /* 为以后搜索方便,保留此注释 EMS_DEFAULT_DATABASE */ os << "# DDL\n" - << "CREATE DATABASE iscs6000 WITH NAME autogen\n"; - os << "# DML\n" << "# CONTEXT-DATABASE:iscs6000\n" + << "CREATE DATABASE " << strDbName.toStdString().c_str() << " WITH NAME autogen\n"; + os << "# DML\n" << "# CONTEXT-DATABASE:" << strDbName.toStdString().c_str() <<"\n" << "# CONTEXT-RETENTION-POLICY:autogen\n" << "# writing tsm data\n"; } diff --git a/platform/src/dbms/db_his_mng_api/CChunkedJsonHandler.h b/platform/src/dbms/db_his_mng_api/CChunkedJsonHandler.h index fe8a3b2d..dcbe551e 100644 --- a/platform/src/dbms/db_his_mng_api/CChunkedJsonHandler.h +++ b/platform/src/dbms/db_his_mng_api/CChunkedJsonHandler.h @@ -73,7 +73,7 @@ struct CChunkedJsonHandler : public rapidjson::BaseReaderHandlerdelHisAllV2(*conn,ip,databaseName)) + emit delHisAllFinished(true); + else + emit delHisAllFinished(false); +} + +void iot_dbms::CHisMngApi::delHisV2(QSqlDatabase *conn, const QString &ip, const QString &databaseName, qint64 endTimeStamp) +{ + if(m_pImp->delHisV2(*conn,ip,databaseName,endTimeStamp)) + emit delHisFinished(true); + else + emit delHisFinished(false); +} + void iot_dbms::CHisMngApi::needTerminate() { m_pImp->needTerminate(); diff --git a/platform/src/dbms/db_his_mng_api/CHisMngApiImp.cpp b/platform/src/dbms/db_his_mng_api/CHisMngApiImp.cpp index 07be2148..fa5baf22 100644 --- a/platform/src/dbms/db_his_mng_api/CHisMngApiImp.cpp +++ b/platform/src/dbms/db_his_mng_api/CHisMngApiImp.cpp @@ -111,7 +111,8 @@ bool iot_dbms::CHisMngApiImp::getColumnMySQL(QSqlDatabase &conn, const QString & bool iot_dbms::CHisMngApiImp::getColumnPostgres(QSqlDatabase &conn, const QString &sTableName, QList &listColumn) { - QString sSql = "SELECT * from " + /* 为以后搜索方便,保留此注释 EMS_DEFAULT_DATABASE */ + QString sSql = QString("SELECT * from " "(SELECT " " DISTINCT ON (pg_attribute.attname) pg_attribute.attname, " "format_type(pg_attribute.atttypid, pg_attribute.atttypmod), " @@ -119,11 +120,11 @@ bool iot_dbms::CHisMngApiImp::getColumnPostgres(QSqlDatabase &conn, const QStrin "attnotnull,attnum " "FROM pg_index, pg_class, pg_attribute, pg_namespace " "WHERE pg_attribute.attnum > 0 AND " - "pg_class.oid = '" + sTableName + "'::regclass " - "AND nspname = 'iscs6000' " + "pg_class.oid = '%1'::regclass " + "AND nspname = '%2' " "AND pg_class.relnamespace = pg_namespace.oid " "AND pg_attribute.attrelid = pg_class.oid " - "AND pg_attribute.attisdropped = false) as ts order by attnum;"; + "AND pg_attribute.attisdropped = false) as ts order by attnum;").arg(sTableName).arg(conn.databaseName()); QSqlQuery query( conn ); if ( query.exec( sSql ) == false ){ logError(query.lastError().text()); @@ -280,8 +281,20 @@ bool iot_dbms::CHisMngApiImp::exportTables(QSqlDatabase &conn, qint64 startTimeS bool iot_dbms::CHisMngApiImp::exportTsdbBin(const QString &ip, const QString &dbName, const QString &dirPath, qint64 startTime, qint64 endTime) { - QString program = "influxd";//备份工具 + + QStringList arguments; + QString program;//备份工具 + +#ifdef OS_WINDOWS + program = "influxd"; +#endif + +#ifdef OS_LINUX + program = "pkexec"; + arguments << "influxd"; +#endif + arguments << "backup" << "-host" << ip+":8088" << "-portable" << "-database" << dbName; if(startTime != 0){ arguments << "-start" << QDateTime::fromMSecsSinceEpoch(startTime).toTimeSpec(Qt::OffsetFromUTC).toString(Qt::ISODate); @@ -290,38 +303,47 @@ bool iot_dbms::CHisMngApiImp::exportTsdbBin(const QString &ip, const QString &db arguments << "-end" << QDateTime::fromMSecsSinceEpoch(endTime).toTimeSpec(Qt::OffsetFromUTC).toString(Qt::ISODate); } - arguments << dirPath; + arguments << QDir::toNativeSeparators(dirPath); + LOGINFO("arguments is [%s]",arguments.join(" ").toStdString().c_str()); m_pExportProc->start(program,arguments); if(!m_pExportProc->waitForFinished(-1)) { //< todo 导出错误 - logStatus("log here #1023"); + QString errorLog = m_pExportProc->errorString(); + QString stdOut = m_pExportProc->readAllStandardOutput(); + QString stdErr = m_pExportProc->readAllStandardError(); + logError("Export failed: " + errorLog + "\nOutput: " + stdOut + "\nError: " + stdErr); return false; } return true; } -bool iot_dbms::CHisMngApiImp::exportTsdbByInspect(const QString &dbName, const QString &dstFilePath, qint64 startTime, qint64 endTime) +bool iot_dbms::CHisMngApiImp::exportTsdbByInspect(const STsdbConnParam &connParam, const QString &dstFilePath, qint64 startTime, qint64 endTime) { - - if(!isTsdbDbExist(dbName,"127.0.0.1")) + if(!isTsdbDbExist(connParam)) return false; m_pExportProc->terminate(); m_pExportProc->kill(); - QString program = "influx_inspect"; - + QString program; QStringList arguments; - arguments << "export" << "-compress" << "-database" << dbName ; + #ifdef OS_WINDOWS + program = "influx_inspect"; QString influxdb_home = qgetenv("INFLUXDB_HOME"); + arguments << "export" << "-compress" << "-database" << connParam.strDbName.c_str() ; arguments << QString() + "-datadir=" + influxdb_home + "influxdb_data\\data"; arguments << QString() + "-waldir=" + influxdb_home + "influxdb_data\\wal"; #endif + + #ifdef OS_LINUX + program = "pkexec"; + arguments << "influx_inspect"; + arguments << "export" << "-compress" << "-database" << connParam.strDbName.c_str() ; arguments << "-datadir=/var/lib/influxdb/data"; arguments << "-waldir=/var/lib/influxdb/wal"; #endif @@ -334,11 +356,13 @@ bool iot_dbms::CHisMngApiImp::exportTsdbByInspect(const QString &dbName, const Q while(!m_pExportProc->waitForFinished(1)) { + QProcess::ProcessError error = m_pExportProc->error(); QCoreApplication::processEvents(QEventLoop::AllEvents,100); - if(is_stop) + if(is_stop || (error != QProcess::UnknownError && error != QProcess::Timedout)) { is_stop = false; logStatus(tr("停止转储")); + logError("Export failed: " + m_pExportProc->errorString()); m_pExportProc->terminate(); m_pExportProc->kill(); return false; @@ -362,7 +386,7 @@ void iot_dbms::CHisMngApiImp::slotBackupProgressHandler() } else if(result.contains("backup failed: EOF")) { - logError(tr("备份历史数据失败,检查iscs6000是否正确配置")); + logError(tr("备份历史数据失败,检查数据库是否正确配置")); m_pExportProc->kill(); } else if(result.contains("Download shard 0 failed")) @@ -393,9 +417,9 @@ void iot_dbms::CHisMngApiImp::slotBackupFinishedHandler(int exitCode, QProcess:: // logStatus(tr("导出完成")); } -bool iot_dbms::CHisMngApiImp::isTsdbDbExist(const QString &database, const QString &ip) +bool iot_dbms::CHisMngApiImp::isTsdbDbExist(const STsdbConnParam &connParam) { - iot_dbms::CTsdbConn db_conn(ip.toStdString().c_str()); + iot_dbms::CTsdbConn db_conn(connParam); if(!db_conn.pingServer()) { logError(tr("数据库测试连接失败")); @@ -407,7 +431,7 @@ bool iot_dbms::CHisMngApiImp::isTsdbDbExist(const QString &database, const QStri if(db_conn.doQuery(sql, &result, 1000)) { - if (result.find(database.toStdString()) != std::string::npos) { + if (result.find(connParam.strDbName) != std::string::npos) { return true; } logError(tr("时序库不存在")); @@ -431,6 +455,83 @@ bool iot_dbms::CHisMngApiImp::isLocalhost(const QString &addr) return false; } +bool iot_dbms::CHisMngApiImp::hasDataByPeriod(const STsdbConnParam& connParam,const QString& measurement, qint64 startTime, qint64 endTime,QString& queryErr) +{ + QProcess process; + QString delProgram = "influx"; + QString sql=QString("SELECT COUNT(*) FROM %1 WHERE time >= %2ms AND time <= %3ms LIMIT 1").arg(measurement).arg(startTime).arg(endTime); + QStringList arguments; + arguments << "-username" << QString::fromStdString(connParam.strUserName) + << "-password" << QString::fromStdString(connParam.strUserPassword) + << "-host" + << QString::fromStdString(connParam.strIP) + << "-execute" + << sql + << QString("-database=")+ QString::fromStdString(connParam.strDbName); + process.start(delProgram, arguments); + if (!process.waitForFinished(-1)) { + QByteArray errorOutput = process.readAllStandardError(); + queryErr=QString::fromUtf8(errorOutput); + LOGERROR("exec-influxdb-cleanData-ERR: %s %s err(%s)",delProgram.toStdString().c_str(),arguments.join(" ").toStdString().c_str(),queryErr.toStdString().c_str()); + return false; + } + QByteArray standardOutput = process.readAllStandardOutput(); + QByteArray errorOutput = process.readAllStandardError(); + if(!errorOutput.isEmpty()) + { + queryErr=QString::fromUtf8(errorOutput); + LOGERROR("exec-influxdb-cleanData-ERR: %s %s err(%s)",delProgram.toStdString().c_str(),arguments.join(" ").toStdString().c_str(),queryErr.toStdString().c_str()); + return false; + } + LOGTRACE("exec-influxdb-cleanData-ifHasData-ok: %s %s",delProgram.toStdString().c_str(),arguments.join(" ").toStdString().c_str()); + if(!standardOutput.isEmpty()) + { + return true; + } + else + { + return false; + } +} + +void iot_dbms::CHisMngApiImp::deleteDataByPeriod(const STsdbConnParam& connParam,const QString& measurement, qint64 startTime, qint64 endTime,QString& queryErr) +{ + QProcess process; + QString delProgram = "influx"; + QString sql=QString("delete from %1 WHERE time >= %2ms AND time <= %3ms ").arg(measurement).arg(startTime).arg(endTime); + QStringList arguments; + arguments << "-username" << QString::fromStdString(connParam.strUserName) + << "-password" << QString::fromStdString(connParam.strUserPassword) + << "-host" + << QString::fromStdString(connParam.strIP) + << "-execute" + << sql + << QString("-database=")+ QString::fromStdString(connParam.strDbName); + process.start(delProgram, arguments); + if (!process.waitForFinished(-1)) { + QByteArray errorOutput = process.readAllStandardError(); + queryErr=QString::fromUtf8(errorOutput); + LOGERROR("exec-influxdb-cleanData-ERR: %s %s err(%s)",delProgram.toStdString().c_str(),arguments.join(" ").toStdString().c_str(),queryErr.toStdString().c_str()); + return ; + } + QByteArray standardOutput = process.readAllStandardOutput(); + QByteArray errorOutput = process.readAllStandardError(); + if(!errorOutput.isEmpty()) + { + queryErr=QString::fromUtf8(errorOutput); + LOGERROR("exec-influxdb-deleteData-ERR: %s %s err(%s)",delProgram.toStdString().c_str(),arguments.join(" ").toStdString().c_str(),queryErr.toStdString().c_str()); + return ; + } + LOGTRACE("exec-influxdb-deleteData-ok: %s %s",delProgram.toStdString().c_str(),arguments.join(" ").toStdString().c_str()); + if(!standardOutput.isEmpty()) + { + //正常不应该有标准输出 + queryErr=QString::fromUtf8(standardOutput); + LOGERROR("exec-influxdb-deleteData-out: %s %s out(%s)",delProgram.toStdString().c_str(),arguments.join(" ").toStdString().c_str(),queryErr.toStdString().c_str()); + return ; + } +} + std::string iot_dbms::CHisMngApiImp::genUrlHisEvent(const QString &ip, const QString &databaseName, qint64 startTime, qint64 endTime) { QString strStartTime = QString::number(startTime); @@ -548,6 +649,10 @@ std::string iot_dbms::CHisMngApiImp::genUrlHis(const QString &ip, const QString bool iot_dbms::CHisMngApiImp::optimizeTable(QSqlDatabase &conn, const QString &tableName) { + if(!isMySqL(conn)) + { + return true; + } QString sql = "optimize table "+ tableName; return executeSql(conn,sql); } @@ -819,7 +924,7 @@ bool iot_dbms::CHisMngApiImp::exportHisEventTsdb(const QString &ip, rapidjson::Reader reader; { - CChunkedJsonHandler handler(dstFilePath); + CChunkedJsonHandler handler(databaseName,dstFilePath); while(1) { if(reader.Parse(stream,handler)) @@ -864,7 +969,7 @@ bool iot_dbms::CHisMngApiImp::exportTsdbByQuery(const QString &ip, const QString rapidjson::Reader reader; { - CChunkedJsonHandler handler(dstFilePath); + CChunkedJsonHandler handler(dbName,dstFilePath); while(1) { if(reader.Parse(stream,handler)) @@ -896,7 +1001,7 @@ bool iot_dbms::CHisMngApiImp::exportHisData(const QString &ip, const QString &da rapidjson::Reader reader; { - CChunkedJsonHandler handler(dstFilePath); + CChunkedJsonHandler handler(databaseName,dstFilePath); while(1) { if(reader.Parse(stream,handler)) @@ -956,8 +1061,13 @@ bool iot_dbms::CHisMngApiImp::exportHisDump(QSqlDatabase &conn, const QString &d logStatus("正在导出时序库内容"); + STsdbConnParam connParam; //ip和port不指定则默认本机默认端口8086 + connParam.strUserName = tsdbName.toStdString(); + connParam.strUserPassword = conn.password().toStdString(); //todo:此处有风险,如果QSqlDatabase直接调用的open(user,password)接口,则此函数获取不到密码 + connParam.strDbName = tsdbName.toStdString(); + //< 历史事件时序库 - if(!exportTsdbByInspect(tsdbName,tsdbFilePath,1,endTimeStamp)) + if(!exportTsdbByInspect(connParam,tsdbFilePath,1,endTimeStamp)) { logError(tr("无法导出时序库内容")); return false; @@ -1033,12 +1143,16 @@ bool iot_dbms::CHisMngApiImp::exportHisPartV2(QSqlDatabase conn, const QString & } logStatus(tr("关系库历史事件导出完成")); - logStatus(tr("开始导出时序库历史")); if( isLocalhost(ip) ) { // 本地接口导出 - if(!exportTsdbByInspect(tsdbDbName,tsdbFilePath,starttime,endtime)) + STsdbConnParam connParam; //ip和port不指定则默认本机默认端口8086 + connParam.strUserName = conn.databaseName().toStdString(); + connParam.strUserPassword = conn.password().toStdString(); //todo:此处有风险,如果QSqlDatabase直接调用的open(user,password)接口,则此函数获取不到密码 + connParam.strDbName = conn.databaseName().toStdString(); + + if(!exportTsdbByInspect(connParam,tsdbFilePath,starttime,endtime)) { logError(tr("导出时序库历史错误")); return false; @@ -1081,7 +1195,7 @@ bool iot_dbms::CHisMngApiImp::importHisPart(QSqlDatabase &conn, //< 导入时序库历史事件 logStatus(tr("开始导入时序库历史事件")); - if(!importTsdbSQL(ip,tsdbDbName,tsdbEventFilePath,true)) + if(!importTsdbSQL(ip,tsdbDbName,conn.password(),tsdbDbName,tsdbEventFilePath,true)) { logError(tr("导出时序库历史事件错误")); return false; @@ -1094,7 +1208,7 @@ bool iot_dbms::CHisMngApiImp::importHisPart(QSqlDatabase &conn, { //< 导入时序库采样数据 logStatus(tr("开始导入时序库采样数据")); - if(!importTsdbSQL(ip,tsdbDbName,tsdbDataFilePath,true)) + if(!importTsdbSQL(ip,tsdbDbName,conn.password(),tsdbDbName,tsdbDataFilePath,true)) { logError(tr("导入时序库采样数据错误")); return false; @@ -1117,7 +1231,7 @@ bool iot_dbms::CHisMngApiImp::importHisPartV2(QSqlDatabase conn, const QString & //< 导入时序库采样数据 logStatus(tr("开始导入时序库采样数据")); - if(!importTsdbSQL(ip,tsdbDbName,tsdbFilePath,false)) + if(!importTsdbSQL(ip,tsdbDbName,conn.password(),tsdbDbName,tsdbFilePath,false)) { logError(tr("导入时序库数据错误")); return false; @@ -1126,19 +1240,44 @@ bool iot_dbms::CHisMngApiImp::importHisPartV2(QSqlDatabase conn, const QString & return true; } -bool iot_dbms::CHisMngApiImp::delHisTsdb(const QString &ip, const QString &databaseName, qint64 endTimeStamp) +bool iot_dbms::CHisMngApiImp::delHisTsdb(const QString &ip,const QString &userName, const QString &password, const QString &databaseName, qint64 endTimeStamp) { - QString delProgram("influx"); + STsdbConnParam connParam; + connParam.strIP = ip.toStdString(); + connParam.strUserName = userName.toStdString(); + connParam.strUserPassword = password.toStdString(); + connParam.strDbName = databaseName.toStdString(); + + int result = 0; + if(isTsdbDbExist(connParam)) + { + QString delProgram("influx"); + + // example influx -execute "DELETE WHERE time < '2016-01-01'" -database="xxx" + QStringList arguments; + QString sql = "DELETE WHERE time < " + QString::number(endTimeStamp) +"ms"; + + /* 为以后搜索方便,保留此注释 + * arguments << "-username" << EMS_DEFAULT_DATABASE + * << "-password" << EMS_DEFAULT_PASSWD + * << "-host" + * << ip + * << "-execute" + * << sql + * << QString("-database=")+ databaseName; + */ + arguments << "-username" << userName + << "-password" << password + << "-host" + << ip + << "-execute" + << sql + << QString("-database=")+ databaseName; + + result = QProcess::execute(delProgram,arguments); + LOGINFO("执行清理时序数据: %s %s",delProgram.toStdString().c_str(),arguments.join(" ").toStdString().c_str()); + } - // example influx -execute "DELETE WHERE time < '2016-01-01'" -database="iscs6000" - QStringList arguments; - QString sql = "DELETE WHERE time < " + QString::number(endTimeStamp) +"ms"; - arguments << "-host" - << ip - << "-execute" - << sql - << QString("-database=")+ databaseName; - int result = QProcess::execute(delProgram,arguments); if( 0 == result) { //< to-do @@ -1163,6 +1302,110 @@ bool iot_dbms::CHisMngApiImp::delHisTsdb(const QString &ip, const QString &datab return true; } +bool iot_dbms::CHisMngApiImp::delHisTsdbV2(const QString &ip, const QString &userName, const QString &password, const QString &databaseName, qint64 endTimeStamp) +{ + STsdbConnParam connParam; + connParam.strIP = ip.toStdString(); + connParam.strUserName = userName.toStdString(); + connParam.strUserPassword = password.toStdString(); + connParam.strDbName = databaseName.toStdString(); + QDateTime endDateTime = QDateTime::fromMSecsSinceEpoch(endTimeStamp); + bool handlResult=true; + QString queryErr=""; + QStringList tableNames; + tableNames<<"acc_sample_result"; + tableNames<<"ai_sample_result"; + tableNames<<"di_sample_result"; + tableNames<<"his_event_point"; + for(int i = 0; i < tableNames.size(); ++i) + { + QString currentTable=tableNames[i]; + QDateTime startDeleteTime; + bool hasDeleteStartTime=false; + //按月跨度找到第一个月有数据的时间(即使找到1970也才655次循环) + for(int i=0;i<700;++i) + { + QDateTime endTime=endDateTime.addMonths(-i); + QDateTime startTime=endDateTime.addMonths(-i-1); + if(!hasDataByPeriod(connParam,currentTable,startTime.toMSecsSinceEpoch(),endTime.toMSecsSinceEpoch(),queryErr)&&(queryErr.isEmpty())) + { + startDeleteTime=endTime; + hasDeleteStartTime=true; + LOGINFO("delHisTsdbV2 %s get startDeleteTime: %s ",currentTable.toStdString().c_str(),startDeleteTime.toString(Qt::ISODate).toStdString().c_str()); + break; + } + if(!queryErr.isEmpty()) + { + LOGERROR("deleteDataByPeriod-queryStart-err %s start(%s) end(%s) ",currentTable.toStdString().c_str(),startTime.toString(Qt::ISODate).toStdString().c_str(),endTime.toString(Qt::ISODate).toStdString().c_str()); + return false; + } + + } + + //按天跨度删除数据 + if(hasDeleteStartTime) + { + int daysDifference = qAbs(endDateTime.daysTo(startDeleteTime)); + for(int i=0;i tables = getHisEventTables(); @@ -1171,14 +1414,21 @@ bool iot_dbms::CHisMngApiImp::delHisEventDb(QSqlDatabase &conn, qint64 endTimeSt { if(!trashMysqlTableByPartition(conn,tables[i].c_str(),endTimeStamp)) { - return false; + logError(tr("通过分区删除") + tables[i].c_str() + tr("旧数据失败") ); } if(!trashTableByTimestamp(conn,tables[i].c_str(),endTimeStamp)) { + logError(tr("通过时间删除") + tables[i].c_str() + tr("旧数据失败") ); + } + + if(!optimizeTable(conn,tables[i].c_str())) //极端情况下优化表空间 + { + logError(tr("优化") + tables[i].c_str() + tr("表空间失败") ); logError(tr("删除") + tables[i].c_str() + tr("旧数据失败") ); return false; } + logStatus(tr("删除") + tables[i].c_str() + tr("旧数据成功")); } return true; @@ -1192,7 +1442,8 @@ bool iot_dbms::CHisMngApiImp::delHis(QSqlDatabase &conn, const QString &ip, cons return false; } - if(!delHisTsdb(ip,databaseName,endTimeStamp)) + //时序库暂用了数据库同样的用户名密码 + if(!delHisTsdb(ip,conn.databaseName(),conn.password(),databaseName,endTimeStamp)) { logError(tr("清空时序库失败")); return false; @@ -1201,6 +1452,23 @@ bool iot_dbms::CHisMngApiImp::delHis(QSqlDatabase &conn, const QString &ip, cons return true; } +bool iot_dbms::CHisMngApiImp::delHisV2(QSqlDatabase &conn, const QString &ip, const QString &databaseName, qint64 endTimeStamp) +{ + if(!delHisEventDb(conn,endTimeStamp)) + { + logError(tr("清空关系库历史事件失败")); + return false; + } + + //时序库暂用了数据库同样的用户名密码 + if(!delHisTsdbV2(ip,conn.databaseName(),conn.password(),databaseName,endTimeStamp)) + { + logError(tr("清空时序库失败")); + return false; + } + logStatus(tr("清空时序库成功")); + return true; +} bool iot_dbms::CHisMngApiImp::delHisAll(QSqlDatabase &conn, const QString &ip, const QString &databaseName) { @@ -1210,7 +1478,26 @@ bool iot_dbms::CHisMngApiImp::delHisAll(QSqlDatabase &conn, const QString &ip, c return false; } - if(!delHisTsdb(ip,databaseName,QDateTime::currentMSecsSinceEpoch())) + //时序库暂用了数据库同样的用户名密码 + if(!delHisTsdb(ip,conn.databaseName(),conn.password(),databaseName,QDateTime::currentMSecsSinceEpoch())) + { + logError(tr("清空时序库失败")); + return false; + } + logStatus(tr("清空时序库成功")); + return true; +} + +bool iot_dbms::CHisMngApiImp::delHisAllV2(QSqlDatabase &conn, const QString &ip, const QString &databaseName) +{ + if(!delHisDbAll(conn)) + { + logError(tr("清空关系库历史事件失败")); + return false; + } + + //时序库暂用了数据库同样的用户名密码 + if(!delHisTsdbV2(ip,conn.databaseName(),conn.password(),databaseName,QDateTime::currentMSecsSinceEpoch())) { logError(tr("清空时序库失败")); return false; @@ -1235,18 +1522,18 @@ bool iot_dbms::CHisMngApiImp::delHisDbAll(QSqlDatabase &conn) return true; } -bool iot_dbms::CHisMngApiImp::importTsdbBin(const QString &ip, const QString &databaseName, const QString &srcDirPath) +bool iot_dbms::CHisMngApiImp::importTsdbBin(const STsdbConnParam &connParam, const QString &srcDirPath) { - if( ip.isEmpty() || databaseName.isEmpty() || srcDirPath.isEmpty()) + if(connParam.strIP.empty() || connParam.strDbName.empty() || srcDirPath.isEmpty()) return false; // 检查路径权限 读权限 - QFileInfo fi(srcDirPath); - if (fi.permission(QFile::ReadUser) == false) - { - logError(tr("无法对目录") + srcDirPath + tr("进行读操作,请检查操作用户权限,备份失败")); - return false; - } +// QFileInfo fi(srcDirPath); +// if (fi.permission(QFile::ReadUser) == false) +// { +// logError(tr("无法对目录") + srcDirPath + tr("进行读操作,请检查操作用户权限,备份失败")); +// return false; +// } if(iot_dbms::initTsdbApi() == false) { @@ -1256,7 +1543,7 @@ bool iot_dbms::CHisMngApiImp::importTsdbBin(const QString &ip, const QString &da // 连接influxdb,delete and create database { - iot_dbms::CTsdbConn db_conn(ip.toStdString().c_str()); + iot_dbms::CTsdbConn db_conn(connParam); if(db_conn.pingServer() == false) { logError(tr("数据库连接失败")); @@ -1264,9 +1551,9 @@ bool iot_dbms::CHisMngApiImp::importTsdbBin(const QString &ip, const QString &da } // 1. 删除数据库 - if(db_conn.deleteDatabase(databaseName.toStdString().c_str()) == false) + if(db_conn.deleteDatabase(connParam.strDbName.c_str()) == false) { - logError(tr("无法删除influxDB数据库:")+ databaseName); + logError(tr("无法删除influxDB数据库:")+ QString(connParam.strDbName.c_str())); return false; } } @@ -1281,48 +1568,75 @@ bool iot_dbms::CHisMngApiImp::importTsdbBin(const QString &ip, const QString &da // 2.导入备份 QString program = "influxd"; QStringList arguments; - arguments << "restore" << "-host" << ip+":8088" << "-portable" << "-db" << databaseName << srcDirPath; +#ifdef OS_LINUX + program = "pkexec"; //提升权限 + arguments << "influxd"; +#endif + + arguments << "restore" << "-host" << (connParam.strIP + ":8088").c_str() << "-portable" << "-db" << connParam.strDbName.c_str() << srcDirPath; + LOGINFO("arguments is [%s]",arguments.join(" ").toStdString().c_str()); //开始导入备份进程 m_pImportProc->start(program,arguments); if(!m_pImportProc->waitForFinished(-1)) { - //todo 解决错误 + QString errorLog = m_pImportProc->errorString(); + logError("import failed! errorlog: " + errorLog ); return false; } return true; } -bool iot_dbms::CHisMngApiImp::importTsdbSQL(const QString &ip, const QString &databaseName, const QString &srcFilePath, bool isPrecisionMs) +bool iot_dbms::CHisMngApiImp::importTsdbSQL(const QString &ip,const QString &userName, const QString &password, const QString &databaseName, const QString &srcFilePath, bool isPrecisionMs) { - if( ip.isEmpty() || databaseName.isEmpty() || srcFilePath.isEmpty()) + if( ip.isEmpty() || userName.isEmpty() || password.isEmpty() || databaseName.isEmpty() || srcFilePath.isEmpty()) return false; // 检查路径权限 读权限 - QFileInfo fi(srcFilePath); - if (fi.permission(QFile::ReadUser) == false) - { - logError(tr("无法对目录") + srcFilePath + tr("进行读操作,请检查操作用户权限,备份失败")); - return false; - } - - QString program = "influx"; +// QFileInfo fi(srcFilePath); +// if (fi.permission(QFile::ReadUser) == false) +// { +// logError(tr("无法对目录") + srcFilePath + tr("进行读操作,请检查操作用户权限,备份失败")); +// return false; +// } + QString program; QStringList arguments; + +#ifdef OS_WINDOWS + program = "influx"; +#endif + +#ifdef OS_LINUX + program = "pkexec"; //提升权限 + arguments << "influx"; +#endif + //< 导出实例influx -import -host 192.168.77.200 -compressed -path=export.txt.gz -precision=ms QString tmpPath = QString("-path=") + srcFilePath; - arguments << "-import" << "-host" << ip << "-compressed"; + + /* 为以后搜索方便,保留此注释 + * arguments << "-username" << EMS_DEFAULT_DATABASE + * << "-password" << EMS_DEFAULT_PASSWD + * << "-import" << "-host" << ip << "-compressed"; + */ + arguments << "-username" << userName + << "-password" << password + << "-import" << "-host" << ip << "-compressed"; + if(isPrecisionMs) arguments << "-precision=ms"; arguments << tmpPath; + LOGINFO("arguments is [%s]",arguments.join(" ").toStdString().c_str()); //开始导入备份进程 m_pImportProc->start(program,arguments); if(!m_pImportProc->waitForFinished(-1)) { - //todo 解决错误 + QString errorLog = m_pImportProc->errorString(); + logError("import failed! errorlog: " + errorLog ); return false; } return true; @@ -1420,7 +1734,13 @@ bool iot_dbms::CHisMngApiImp::importHis(QSqlDatabase &conn, const QString &srcFi } logStatus(tr("导入历史记录备份成功")); - if(!importTsdbBin(ip,databaseName,srcDirPath)) + STsdbConnParam connParam; //ip和port不指定则默认本机默认端口8086 + connParam.strIP = ip.toStdString(); + connParam.strUserName = databaseName.toStdString(); + connParam.strUserPassword = conn.password().toStdString(); //todo:此处有风险,如果QSqlDatabase直接调用的open(user,password)接口,则此函数获取不到密码 + connParam.strDbName = databaseName.toStdString(); + + if(!importTsdbBin(connParam,srcDirPath)) { logError(tr("导入采样数据备份失败")); return false; @@ -1444,7 +1764,7 @@ bool iot_dbms::CHisMngApiImp::importHisDump(QSqlDatabase &conn, logStatus(tr("导入历史事件备份成功")); logStatus(tr("开始导入采样数据备份")); - if(!importTsdbSQL(ip,databaseName,tsdbFilePath,false)) + if(!importTsdbSQL(ip,databaseName,conn.password(),databaseName,tsdbFilePath,false)) { logError(tr("导入采样数据备份失败")); return false; diff --git a/platform/src/dbms/db_his_mng_api/CHisMngApiImp.h b/platform/src/dbms/db_his_mng_api/CHisMngApiImp.h index 8425f80d..fceb29c8 100644 --- a/platform/src/dbms/db_his_mng_api/CHisMngApiImp.h +++ b/platform/src/dbms/db_his_mng_api/CHisMngApiImp.h @@ -5,6 +5,7 @@ #include #include #include +#include "tsdb_api/CTsdbConn.h" namespace iot_dbms { @@ -125,8 +126,10 @@ public: * @param endTimeStamp * @return */ - bool delHisTsdb(const QString &ip,const QString &databaseName,qint64 endTimeStamp); + bool delHisTsdb(const QString &ip,const QString &userName, const QString &password,const QString &databaseName,qint64 endTimeStamp); + + bool delHisTsdbV2(const QString &ip,const QString &userName, const QString &password,const QString &databaseName,qint64 endTimeStamp); /** * @brief delHisEventDb 删除关系库的历史数据,根据时间戳删除 * @param conn @@ -144,7 +147,15 @@ public: * @return */ bool delHis(QSqlDatabase& conn,const QString &ip,const QString &databaseName,qint64 endTimeStamp); - + /** + * @brief delHis 删除历史数据,包括关系库和时序库。根据时间戳删除(大批量数据按天删除) + * @param conn + * @param ip + * @param databaseName + * @param endTimeStamp + * @return + */ + bool delHisV2(QSqlDatabase& conn,const QString &ip,const QString &databaseName,qint64 endTimeStamp); /** * @brief delHisAll 删除全部的历史数据,包括关系库和时序库 * @param conn @@ -154,6 +165,15 @@ public: */ bool delHisAll(QSqlDatabase& conn,const QString &ip,const QString &databaseName); + /** + * @brief delHisAll 删除全部的历史数据,包括关系库和时序库(大批量数据按天删除) + * @param conn + * @param ip + * @param databaseName + * @return + */ + bool delHisAllV2(QSqlDatabase& conn,const QString &ip,const QString &databaseName); + /** * @brief delHisDbAll 删除全部的关系数据库的数据 * @param conn @@ -164,10 +184,10 @@ public: //< import 部分 //< import tsdb bin influxd restore - bool importTsdbBin(const QString &ip, const QString &databaseName,const QString & srcDirPath); + bool importTsdbBin(const STsdbConnParam &connParam,const QString & srcDirPath); //< import tsdb sql influx -import -compressed - bool importTsdbSQL(const QString &ip, const QString &databaseName,const QString & srcFilePath,bool isPrecisionMs); + bool importTsdbSQL(const QString &ip,const QString &userName, const QString &password, const QString &databaseName,const QString & srcFilePath,bool isPrecisionMs); //< import db sql 执行sql文件 bool importDbSQL(QSqlDatabase &conn, const QString &srcFilePath); @@ -228,7 +248,7 @@ private: bool exportTables(QSqlDatabase &conn, qint64 startTimeStamp, qint64 endTimeStamp, const std::string &tableName, QTextStream &textStream); bool exportTsdbBin(const QString &ip, const QString & dbName,const QString &dirPath,qint64 startTime = 0,qint64 endTime = 0); - bool exportTsdbByInspect(const QString & dbName, const QString & dstFilePath, qint64 startTime,qint64 endTime); + bool exportTsdbByInspect(const STsdbConnParam &connParam, const QString & dstFilePath, qint64 startTime,qint64 endTime); std::string genUrlHisEvent(const QString &ip, const QString &databaseName,qint64 startTime,qint64 endTime); std::string genUrlHisData(const QString &ip,const QString &databaseName,qint64 startTime,qint64 endTime,const std::vector &vecTables); std::string genUrlHis(const QString &ip,const QString &databaseName,qint64 startTime,qint64 endTime); @@ -251,12 +271,13 @@ private slots: void slotBackupFinishedHandler(int exitCode, QProcess::ExitStatus exitStatus); private: - bool isTsdbDbExist(const QString & database, const QString &ip); + bool isTsdbDbExist(const STsdbConnParam &connParam); bool isLocalhost(const QString& addr); bool is_stop = false; - + bool hasDataByPeriod(const STsdbConnParam& connParam,const QString& measurement,qint64 startTime,const qint64 endTime,QString& queryErr); + void deleteDataByPeriod(const STsdbConnParam& connParam,const QString& measurement,qint64 startTime,qint64 endTime,QString& queryErr); }; } //< namespace iot_dbms; diff --git a/platform/src/dbms/db_his_mng_api/en.ts b/platform/src/dbms/db_his_mng_api/en.ts index 0a1e152b..715d34e4 100644 --- a/platform/src/dbms/db_his_mng_api/en.ts +++ b/platform/src/dbms/db_his_mng_api/en.ts @@ -4,37 +4,39 @@ QObject - + 数据库连接未打开 Database connection not open - + + 获取表 Get the table - + + 列信息失败 Column information failed - + 无法查询表 - The table could not be querien + The table could not be queried - + 开始备份表: Start backing up the table: - + 无法备份该表: The table could not be backed up: - + 完成备份表: Complete the backup table: @@ -42,7 +44,7 @@ iot_dbms::CHisMngApi - + 开始转储 Start dump @@ -50,347 +52,430 @@ iot_dbms::CHisMngApiImp - 的列数量 - Number of columns + Number of columns - + 错误,未处理的数据类型: Error, unprocessed data type: - + 该服务器备份服务未开启,请配置 + 该服务器备份服务未开启,请配置 The server backup service is not turned on, please configure - - 备份历史数据失败,检查iscs6000是否正确配置 - Failed to back up historical data to check that iscs6000 is configured correctly + + 备份历史数据失败,检查数据库是否正确配置 + 备份历史数据失败,检查iscs6000是否正确配置 + Failed to back up historical data, please check if rqeh6000 is configured correctly - + 备份历史数据失败,检查网络是否正常连接以及备份服务8088端口是否开启 - Backup history data failed to check if the network is properly connected and if port 8088 of the backup service is on + 备份历史数据失败,请检查网络是否正常连接以及备份服务8088端口是否开启 + Backup history data failed, please check if the network is properly connected and if port 8088 of the backup service is on - - + + 数据库不能连接 The database cannot be connected - - + + Table - - + + 删除分区 Delete a partition - - - + + + 失败 Failed - + 成功 Success - + 路径不可写 Path is not writeable - - - + 备份历史事件出错 Backup history event error - - + + + 无法连接influxDB Unable to connect to influxDB - + 无法导出历史事件关系库 The Historical Event Relationship Library cannot be exported - + 无法导出时序库内容 Time Database was unable to be exported - + + 开始导出关系库历史事件 Start exporting history events of relation database - + + 导出关系库历史事件错误 cannot export history events of relation database - + + 关系库历史事件导出完成 history events of relation history export completed - + 开始导出时序库历史事件 Start exporting time-series library history events - - + + 导出时序库历史事件错误 Export history events of Time-series database failed - + 时序库历史事件导出完成 Export history events of Time-series database completed - + 开始导出时序库采样数据 start export sample points of time-series database - + 导出时序库采样数据错误 Export sample points of time-series database failed - + 时序库采样数据导出完成 Export sample points of time-series database done - + + 开始导入关系库历史事件 Start import history events of relation database - + + 导入关系库历史事件错误 Import history events of relation database failed - + + 关系库历史事件导入完成 Import history events of relation database done - + 开始导入时序库历史事件 Start import history events of time-series database - + 时序库历史事件导入完成 Import history events of time-series done - + + 开始导入时序库采样数据 Import sample points of time-series database - + 导入时序库采样数据错误 Import sample poins of time-series database failed - + 时序库采样数据导入完成 Import sample points of time-series database done - - + + 删除 delete - + + + 旧数据失败 old data failed - + + 的行数量 + Number of rows + + + + + 停止转储 + Stop dump + + + + 数据库测试连接失败 + Database test connection failed + + + + 时序库不存在 + Time-series database does not exist + + + + 查询数据库错误 + query db error + + + + 开始导出时序库历史 + Start exporting time-series database history + + + + + 导出时序库历史错误 + Error exporting time-series database history + + + + + 时序库历史导出完成 + Time-series database history export completed + + + + 导入时序库数据错误 + Error importing time-series database data + + + + 时序库数据导入完成 + Time-series database data import completed + + + + 通过分区删除 + Delete by partition + + + + 通过时间删除 + Delete by time + + + + 优化 + Optimize + + + + 表空间失败 + Tablespace failed + + + 旧数据成功 - old data successfully + Old data successfully - - + + 清空关系库历史事件失败 - clear history events of relation database failed + Failed to clear history events of relational database - - + + 清空时序库失败 - clear time-series database failed + Failed to clear time-series database - - - 清空时序库成功 - clear time-series database done - - - - 开始清空(truncate)表 - start truncate table - - - - - 清空表 - truncate table - - - + + 清空时序库成功 + Successfully cleared time-series database + + + + 开始清空(truncate)表 + Start truncating table + + + + + 清空表 + Truncate table + + + + 完成 - done + Completed - - + + 无法对目录 - Cannot cope with table + Cannot operate on the directory - - + + 进行读操作,请检查操作用户权限,备份失败 - To read, please check the operation user permissions, the backup failed + Please check the operation user permissions to perform read operations, backup failed - + 无法初始化influx数据库连接条件,请检查软件依赖是否安装正确 Unable to initialize the influx database connection condition, check that the software dependency is installed correctly - + 数据库连接失败 Database connection failed - + 无法删除influxDB数据库: The influxDB database could not be deleted: - + 无法销毁influx数据库连接资源 Could not destroy the influx database connection resource - + 开始导入数据文件 Start importing data files - + 打开导入文件失败 Failed to open import file - + 导入历史事件失败 Failed to import history events - + 导入已完成: Importing done: - + 删除旧历史记录失败 Failed to delete old history - + 删除旧历史记录成功 Removing old history successfully - + 导入历史记录备份失败 Import history backup failed - + 导入历史记录备份成功 Import history backup successful - - + + 导入采样数据备份失败 Importing sampledata backup failed - - + + 导入采样数据备份成功 Import edited data backup successfully - + 开始导入历史事件 Start importing history events - + 导入历史事件备份失败 failed to import history events backup - + 导入历史事件备份成功 Import history events backup successfully - + 开始导入采样数据备份 Start importing sample data backups - + 开始清理表 Start cleaning up the table - - + + 清理表 Clean up the table - + 导出历史失败 Export history failed - + 删除历史失败 Failed to delete history diff --git a/platform/src/dbms/db_his_query_api/test/db_his_query_api_test/main.cpp b/platform/src/dbms/db_his_query_api/test/db_his_query_api_test/main.cpp index a49cd662..cb774bb3 100644 --- a/platform/src/dbms/db_his_query_api/test/db_his_query_api_test/main.cpp +++ b/platform/src/dbms/db_his_query_api/test/db_his_query_api_test/main.cpp @@ -512,16 +512,6 @@ static void testEventQuery() static int doTest() { - if (!iot_dbms::initTsdbApi()) - { - LOGERROR("initTsdbApi() failed !"); - return 1; - } - - g_pTsdbConn = new iot_dbms::CTsdbConn("127.0.0.1", 8086, g_pszDbName, "", ""); - - g_pvecTagName = new std::vector; - if (!g_pTsdbConn->pingServer(1000)) { LOGERROR("pingServer() return false !"); @@ -563,20 +553,35 @@ int main(/*int argc, char *argv[]*/) LOGINFO("sizeof(iot_dbms::VarMeasPiontVal) == %lu", sizeof(iot_dbms::VarMeasPiontVal)); LOGINFO("sizeof(iot_dbms::SHisSamplePointVar) == %lu", sizeof(iot_dbms::SVarHisSamplePoint)); - - nRc = doTest(); - - delete g_pTsdbConn; - g_pTsdbConn = NULL; - - delete g_pvecTagName; - g_pvecTagName = NULL; - - if (!iot_dbms::releaseTsdbApi()) + if (!iot_dbms::initTsdbApi()) { - LOGERROR("releaseTsdbApi() failed !"); + LOGERROR("initTsdbApi() failed !"); nRc = 1; } + else + { + g_pvecTagName = new std::vector; + +// g_pTsdbConn = new iot_dbms::CTsdbConn( "127.0.0.1", 8086, g_pszDbName, +// EMS_DEFAULT_DATABASE, EMS_DEFAULT_PASSWD ); + + auto spTsdbConn = iot_dbms::getOneUseableConn( true ); + g_pTsdbConn = spTsdbConn.get(); + + nRc = doTest(); + +// delete g_pTsdbConn; + g_pTsdbConn = NULL; + + delete g_pvecTagName; + g_pvecTagName = NULL; + + if (!iot_dbms::releaseTsdbApi()) + { + LOGERROR("releaseTsdbApi() failed !"); + nRc = 1; + } + } //< 停止日志系统 iot_public::StopLogSystem(); diff --git a/platform/src/dbms/db_manager/CHisUtil.cpp b/platform/src/dbms/db_manager/CHisUtil.cpp index 829216dc..1746a308 100644 --- a/platform/src/dbms/db_manager/CHisUtil.cpp +++ b/platform/src/dbms/db_manager/CHisUtil.cpp @@ -69,6 +69,6 @@ bool CHisUtil::isDataExported(const QDomElement &elem) QString CHisUtil::getBackupType(const QDomElement &eleDbSet) { if(isDump(eleDbSet)) - return "转储"; + return QObject::tr("转储"); return eleDbSet.attribute( "isAll" ) == "1"?QObject::tr("全量备份"):QObject::tr("增量备份"); } diff --git a/platform/src/dbms/db_manager/CLogMngWidget.cpp b/platform/src/dbms/db_manager/CLogMngWidget.cpp index 9549a459..da53717f 100644 --- a/platform/src/dbms/db_manager/CLogMngWidget.cpp +++ b/platform/src/dbms/db_manager/CLogMngWidget.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" #include #include #include @@ -131,7 +131,7 @@ void CLogMngWidget::exportLog() { if(ui->app->layout()->count() == 0 ) { - QMessageBox::warning(this,tr("提醒"),tr("请先选择导出类型")); + N_MessageBox::warning(this,tr("提醒"),tr("请先选择导出类型")); return; } diff --git a/platform/src/dbms/db_manager/CStationReuseForm.cpp b/platform/src/dbms/db_manager/CStationReuseForm.cpp index 1ccd2506..eb8dd22c 100644 --- a/platform/src/dbms/db_manager/CStationReuseForm.cpp +++ b/platform/src/dbms/db_manager/CStationReuseForm.cpp @@ -1,6 +1,6 @@ #include "CStationReuseForm.h" #include "ui_CStationReuseForm.h" -#include +#include "pub_widget/MessageBox.h" #include "db_manager_api/db_manager_api.h" #include "conndig.h" #include "common/Common.h" @@ -75,7 +75,7 @@ void CStationReuseForm::onSetIpPort(QString ip, QString db, db_opt* pDbOpt) m_pSrcDbOpt = pDbOpt ; ui->comboBoxdataServiceSrv->clear(); ui->comboBoxdataServiceSrv->addItem(m_pSrcDbOpt->getHostName()); - ui->comboBoxdataServiceSrv->addItem(("选择厂站复用源数据源 ")); + ui->comboBoxdataServiceSrv->addItem((tr("选择厂站复用源数据源 "))); ui->comboBoxdataBaseSrv->addItems(listDatabase); ui->comboBoxdataBaseSrv->setCurrentText(strCurDatabase); } @@ -84,7 +84,7 @@ void CStationReuseForm::onSetIpPort(QString ip, QString db, db_opt* pDbOpt) m_pDstDbOpt = pDbOpt ; ui->comboBoxdataServiceDst->clear(); ui->comboBoxdataServiceDst->addItem(m_pDstDbOpt->getHostName()); - ui->comboBoxdataServiceDst->addItem(("选择厂站复用目标数据源 ")); + ui->comboBoxdataServiceDst->addItem((tr("选择厂站复用目标数据源 "))); ui->comboBoxdataBaseDst->addItems(listDatabase); ui->comboBoxdataBaseDst->setCurrentText(strCurDatabase); @@ -167,11 +167,11 @@ void CStationReuseForm::slotComboBoxDataBaseDstChanged(const QString &sText) void CStationReuseForm::soltPushButtonReuseClicked() { - QMessageBox::StandardButton resultButton = QMessageBox::information(this, + int resultButton = N_MessageBox::information(this, tr("提示"), tr("请确保源数据库和目标数据库的所有表结构一致,否则会出错!"), - QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); + N_MessageBox::Yes | N_MessageBox::No, N_MessageBox::Yes); - if(resultButton == QMessageBox::No){ return; } + if(resultButton == N_MessageBox::No){ return; } QString sDataServiceSrc = ui->comboBoxdataServiceSrv->currentText(); QString sDataBaseSrc = ui->comboBoxdataBaseSrv->currentText(); @@ -180,50 +180,50 @@ void CStationReuseForm::soltPushButtonReuseClicked() if ( sDataServiceSrc == "" ) { - QMessageBox::warning( this, tr("警告"), tr("未选择源数据服务 ") ); + N_MessageBox::warning( this, tr("警告"), tr("未选择源数据服务 ") ); return; } if ( sDataBaseSrc == "" ) { - QMessageBox::warning( this, tr("警告"), tr("未选择源数据库 ") ); + N_MessageBox::warning( this, tr("警告"), tr("未选择源数据库 ") ); return; } if ( sDataServiceDst == "" ) { - QMessageBox::warning( this, tr("警告"), tr("未选择目标数据服务 ") ); + N_MessageBox::warning( this, tr("警告"), tr("未选择目标数据服务 ") ); return; } if ( sDataBaseDst == "" ) { - QMessageBox::warning( this, tr("警告"), tr("未选择目标数据库 ") ); + N_MessageBox::warning( this, tr("警告"), tr("未选择目标数据库 ") ); return; } if ( m_pSrcDbOpt == NULL ) { - QMessageBox::warning( this, tr("警告"), tr("源数据服务未连接 ") ); + N_MessageBox::warning( this, tr("警告"), tr("源数据服务未连接 ") ); return; } if ( m_pDstDbOpt == NULL ) { - QMessageBox::warning( this, tr("警告"), tr("目标数据服务未连接 ") ); + N_MessageBox::warning( this, tr("警告"), tr("目标数据服务未连接 ") ); return; } if ( sDataServiceSrc == sDataServiceDst && sDataBaseSrc == sDataBaseDst ) { - QMessageBox::warning( this, tr("警告"), tr("源和目标不能相同") ); + N_MessageBox::warning( this, tr("警告"), tr("源和目标不能相同") ); return; } QString sSubStationSrc = ui->comboBoxStationSrv->currentText(); if ( sSubStationSrc == "" ) { - QMessageBox::warning( this, tr("警告"), tr("未选择源车站 ") ); + N_MessageBox::warning( this, tr("警告"), tr("未选择源车站 ") ); return; } QString sSubStationDst = ui->comboBoxStationDst->currentText(); if ( sSubStationDst == "" ) { - QMessageBox::warning( this, tr("警告"), tr("未选择目标车站") ); + N_MessageBox::warning( this, tr("警告"), tr("未选择目标车站") ); return; } diff --git a/platform/src/dbms/db_manager/conndig.cpp b/platform/src/dbms/db_manager/conndig.cpp index eff692b9..0e922653 100644 --- a/platform/src/dbms/db_manager/conndig.cpp +++ b/platform/src/dbms/db_manager/conndig.cpp @@ -19,7 +19,7 @@ enum dbType }; ConnDig::ConnDig(QWidget *parent) : - QDialog(parent), + CustomUiDialog(parent), ui(new Ui::ConnDig) { ui->setupUi(this); @@ -29,6 +29,7 @@ ConnDig::ConnDig(QWidget *parent) : connect(ui->pushButton_cancel, SIGNAL(clicked(bool)), this, SLOT(onCancel())); connect(ui->comboBox_type, SIGNAL(currentTextChanged(QString)), this, SLOT(onDbTypeChanged(QString))); + setAutoLayout(true); } ConnDig::~ConnDig() @@ -62,12 +63,12 @@ void ConnDig::initUi() ui->lineEdit_user->setText(settings.value("login/user","root").toString()); - ui->lineEdit_pwd->setText(settings.value("login/psw",CN_PASSWD).toString()); + ui->lineEdit_pwd->setText(settings.value("login/psw",EMS_DEFAULT_PASSWD).toString()); ui->lineEdit_ip->setText(settings.value("login/ip","127.0.0.1").toString()); ui->lineEdit_port->setText(settings.value("login/port","3306").toString()); ui->comboBox_type->setCurrentIndex(settings.value("login/type","0").toInt()); - ui->lineEdit_name->setText(settings.value("login/dbname","iscs6000").toString()); + ui->lineEdit_name->setText(settings.value("login/dbname",EMS_DEFAULT_DATABASE).toString()); QRegExp regExp("^[1-9]*[1-9][0-9]*$"); @@ -87,12 +88,12 @@ void ConnDig::onAccept() { if(!connectDb()) return; - QDialog::accept(); + CustomUiDialog::accept(); } void ConnDig::onCancel() { - QDialog::reject(); + CustomUiDialog::reject(); } void ConnDig::onDbTypeChanged(const QString &dbType) diff --git a/platform/src/dbms/db_manager/conndig.h b/platform/src/dbms/db_manager/conndig.h index aeb7d343..81706bac 100644 --- a/platform/src/dbms/db_manager/conndig.h +++ b/platform/src/dbms/db_manager/conndig.h @@ -1,14 +1,14 @@ #ifndef CONNDIG_H #define CONNDIG_H -#include +#include "pub_widget/CustomDialog.h" namespace Ui { class ConnDig; } class db_opt; -class ConnDig : public QDialog +class ConnDig : public CustomUiDialog { Q_OBJECT diff --git a/platform/src/dbms/db_manager/conndig.ui b/platform/src/dbms/db_manager/conndig.ui index a979a06f..380272a1 100644 --- a/platform/src/dbms/db_manager/conndig.ui +++ b/platform/src/dbms/db_manager/conndig.ui @@ -6,206 +6,195 @@ 0 0 - 350 - 338 + 235 + 262 Dialog - + - - - - - - - - 80 - 0 - - - - - 80 - 16777215 - - - - 用户 - - - - - - - - - - 50 - - - - - - - + + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + 用户 + + - - - - - - - 80 - 0 - - - - - 80 - 16777215 - - - - 密码 - - - - - - - 50 - - - QLineEdit::Password - - - - + + + + + + + 50 + + + + + - - - - - - - 80 - 0 - - - - - 80 - 16777215 - - - - IP地址 - - - - - - - + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + 密码 + + - - - - - - - 80 - 0 - - - - - 80 - 16777215 - - - - 端口 - - - - - - - + + + + 50 + + + QLineEdit::Password + + - - - - - - - 80 - 0 - - - - - 80 - 16777215 - - - - 数据库类型 - - - - - - - - 240 - 40 - - - - - 240 - 40 - - - - - + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + IP地址 + + - - - - - - - 80 - 0 - - - - - 80 - 16777215 - - - - 数据库名称 - - - - - - - + + + + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + 端口 + + + + + + + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + 数据库类型 + + + + + + + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + 数据库名称 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -244,6 +233,19 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + diff --git a/platform/src/dbms/db_manager/db_compare.cpp b/platform/src/dbms/db_manager/db_compare.cpp index 0148214c..38d4c0e1 100644 --- a/platform/src/dbms/db_manager/db_compare.cpp +++ b/platform/src/dbms/db_manager/db_compare.cpp @@ -2,10 +2,9 @@ #include "db_manager_api/db_opt.h" #include #include -#include #include "db_manager_api/kbdwaitprgdlg.h" #include -#include +#include "pub_widget/MessageBox.h" #include "db_manager_common.h" #include "db_sysinfo_api/CDbSysInfo.h" @@ -111,7 +110,7 @@ void db_compare::dataReuse(db_opt* pSrcDbOpt, QString sDataBaseOrg, db_opt* pDst if( m_sDstStaTagName.isEmpty() || m_sDstStaDesc.isEmpty() ) { - emit mergeRes("目标车站信息为空,请检查数据库", 1); + emit mergeRes(tr("目标车站信息为空,请检查数据库"), 1); emit signalEnable(); return; } @@ -171,7 +170,7 @@ void db_compare::reuseFunc() // 目标中找不到的表直接忽略 else if(false == CDbSysInfo::getTableModeByTableName(curTableName.toStdString(),stTableModelInfo) ) { - emit mergeRes("数据库表[" + curTableName + "]复用忽略.", 0); + emit mergeRes(tr("数据库表[%1]复用忽略.").arg(curTableName), 0); continue; } else if( tableMergeMap[curTableName] == "skip" ) { @@ -208,8 +207,8 @@ void db_compare::reuseFunc() QString sSelectError = ""; if ( m_pSrcDbOpt->executeSql( sSqlSelect, objSqlQuery, sSelectError ) == false ) { - emit mergeRes("从源数据库查询记录查询失败:" + sSelectError, 1); - emit mergeRes("表 :" + curTableName + ", 复用失败!", 1); + emit mergeRes(tr("从源数据库查询记录查询失败:%1").arg(sSelectError), 1); + emit mergeRes(tr("表 :%1, 复用失败!").arg(curTableName), 1); continue; } if(objSqlQuery.size() <=0 ){ @@ -235,11 +234,11 @@ void db_compare::reuseFunc() objSqlQuery.clear(); if(bReuseRet) { - emit mergeRes("表:" + curTableName + ", 复用成功!", 0); + emit mergeRes(tr("表:%1, 复用成功!").arg(curTableName), 0); } else { - emit mergeRes("表:" + curTableName + ", 复用失败!", 1); + emit mergeRes(tr("表:%1, 复用失败!").arg(curTableName), 1); continue; } } @@ -258,7 +257,7 @@ bool db_compare::checkTable( QString& sTableName ) //判断表是否存在 if(!ifExistTable(m_pDstDbOpt, m_sDatabaseDst, sTableName ) ) { - emit mergeRes("目标数据库中不存在表:" + sTableName, 1); + emit mergeRes(tr("目标数据库中不存在表:%1").arg(sTableName), 1); return false; } //判断源表与目标表字段是否一致 @@ -266,7 +265,7 @@ bool db_compare::checkTable( QString& sTableName ) int columnNum_dst = getColumnNum(m_pDstDbOpt, m_sDatabaseDst, sTableName); if(columnNum_org != columnNum_dst) { - emit mergeRes("源数据库与目标数据库的表:" + sTableName + "字段结构不一致!", 1); + emit mergeRes(tr("源数据库与目标数据库的表:%1字段结构不一致!").arg(sTableName), 1); return false; } //判断源表与目标表主键是否一致 @@ -276,7 +275,7 @@ bool db_compare::checkTable( QString& sTableName ) int key_num_dst = keys_dst.size(); if(key_num_org != key_num_dst) { - emit mergeRes("源数据库与目标数据库的表:" + sTableName + "主键数量不一致!", 1); + emit mergeRes(tr("源数据库与目标数据库的表:%1主键数量不一致!").arg(sTableName), 1); return false; } else @@ -292,7 +291,7 @@ bool db_compare::checkTable( QString& sTableName ) } if(keysColums) { - emit mergeRes("源数据库与目标数据库的表:" + sTableName + "主键字段不一致!", 1); + emit mergeRes(tr("源数据库与目标数据库的表:%1主键字段不一致!").arg(sTableName), 1); return false; } } @@ -306,7 +305,7 @@ bool db_compare::hasColumn(db_opt *pDb_opt, QString &sDatabaseName, QString &sTa QString error; if ( pDb_opt->executeSql( sql, result, error ) == false ) { - emit mergeRes("判断表是否存在字段失败" + error, 1); + emit mergeRes(tr("判断表是否存在字段失败 %1").arg(error), 1); qDebug() << "判断表是否存在字段失败: sql == " << sql; return false; } @@ -356,7 +355,7 @@ int db_compare::mergeTable(db_opt* pSrcDbOpt, QString dataBaseOrg, db_opt* pDstD QString sSelectError = ""; if ( pSrcDbOpt->executeSql( sSqlSelect, objSqlQuery, sSelectError ) == false ) { - emit mergeRes("判断表是否没有主键查询失败:" + sSelectError, 1); + emit mergeRes(tr("判断表是否没有主键查询失败:%1").arg(sSelectError), 1); return -1; } int size_Org = objSqlQuery.size(); @@ -382,7 +381,7 @@ int db_compare::mergeTable(db_opt* pSrcDbOpt, QString dataBaseOrg, db_opt* pDstD if ( pSrcDbOpt->executeSql( sSqlSelect, objSqlQuery, sSelectError ) == false ) { qDebug() << "src db select error ============================ sql == " << sSqlSelect; - emit mergeRes("查找源数据库失败" + sSelectError, 1); + emit mergeRes(tr("查找源数据库失败%1").arg(sSelectError), 1); return -1; } m_max61850Id = 0; @@ -439,7 +438,7 @@ void db_compare::clearAllDataByTableName(db_opt *pDstDbOpt, QString dataBaseDst, if( pDstDbOpt->executeSql(sqlDel, error ) == false ) { emit mergeRes(tr("删除表:%1数据失败").arg(tableName) + error, 1); - emit mergeRes("SQL语句为:" + sqlDel, 1); + emit mergeRes(tr("SQL语句为:%1").arg(sqlDel), 1); qDebug() << sqlDel; // emit mergeRes(sSql_Insert, 0); } @@ -538,7 +537,7 @@ bool db_compare::insertRecord(db_opt* pDb_option, QString dataBase, QString tabl if( pDb_option->executeSql(sSql_allColumnName, query_allColumnName, sError_allColumnName) == false ) { - emit mergeRes( "获取表的所有字段名失败:" + sError_allColumnName, 1 ); + emit mergeRes( tr("获取表的所有字段名失败:%1").arg(sError_allColumnName), 1 ); return false; } while(query_allColumnName.next()) @@ -593,8 +592,8 @@ bool db_compare::insertRecord(db_opt* pDb_option, QString dataBase, QString tabl QString sError_Insert = ""; if( pDb_option->executeSql(sSql_Insert, query_Insert, sError_Insert ) == false ) { - emit mergeRes("插入记录语句执行失败:" + sError_Insert, 1); - emit mergeRes("SQL语句为:" + sSql_Insert, 1); + emit mergeRes(tr("插入记录语句执行失败:%1").arg(sError_Insert), 1); + emit mergeRes(tr("SQL语句为:%1").arg(sSql_Insert), 1); qDebug() << sSql_Insert; // emit mergeRes(sSql_Insert, 0); return false; @@ -771,7 +770,7 @@ bool db_compare::ifExistColumn(db_opt* pDb_opt, QString sDataBase, QString table QString sError; if( pDb_opt->executeSql(sSql, query, sError) == false ) { - emit mergeRes("判断" + columnName + "字段是否存在:" + sError, 1); + emit mergeRes(tr("判断%1字段是否存在:%2").arg(columnName).arg(sError), 1); return ret; } while(query.next()) @@ -864,7 +863,7 @@ bool db_compare::ifKeysConflict(db_opt* pDb_opt, QString sDataBase, QString sTab QString sError_u = ""; if( pDb_opt->executeSql(sSql_u, query_u, sError_u) == false ) { - emit mergeRes("判断UNIQUE记录冲突查询失败:" + sError_u, 1); + emit mergeRes(tr("判断UNIQUE记录冲突查询失败:%1").arg(sError_u), 1); return false; } if(query_u.size() > 0) @@ -896,7 +895,7 @@ bool db_compare::ifKeysConflict(db_opt* pDb_opt, QString sDataBase, QString sTab QString sError_k = ""; if( pDb_opt->executeSql(sSql_k, query_k, sError_k) == false ) { - emit mergeRes("判断主键冲突查询失败:" + sError_k, 1); + emit mergeRes(tr("判断主键冲突查询失败:%1").arg(sError_k), 1); } if(query_k.size() > 0) { @@ -932,7 +931,7 @@ void db_compare::deleteConflictRecord(db_opt* pDb_opt, QString sDataBase, QStrin QString sError_u = ""; if( pDb_opt->executeSql(sSql_u, query_u, sError_u) == false ) { - emit mergeRes("删除UNIQUE冲突记录失败:" + sError_u, 1); + emit mergeRes(tr("删除UNIQUE冲突记录失败:%1").arg(sError_u), 1); } query_u.clear(); } @@ -955,7 +954,7 @@ void db_compare::deleteConflictRecord(db_opt* pDb_opt, QString sDataBase, QStrin QString sError_k = ""; if( pDb_opt->executeSql(sSql_k, query_k, sError_k) == false ) { - emit mergeRes("删除主键冲突记录失败:" + sError_k, 1); + emit mergeRes(tr("删除主键冲突记录失败:%1").arg(sError_k), 1); } query_k.clear(); } @@ -968,7 +967,7 @@ int db_compare::getColumnNum(db_opt* pDb_opt, QString sDataBase, QString sTableN QString sError; if( pDb_opt->executeSql(sSql, query, sError) == false ) { - emit mergeRes("查询字段数量失败:" + sError, 1); + emit mergeRes(tr("查询字段数量失败:%1").arg(sError), 1); } while(query.next()) { @@ -988,7 +987,7 @@ QStringList db_compare::getMainKeys(db_opt* pDb_opt, QString sDataBase, QString QString sError = ""; if( pDb_opt->executeSql(sSql, query, sError) == false ) { - emit mergeRes("获取主键查询失败:" + sError, 1); + emit mergeRes(tr("获取主键查询失败:%1").arg(sError), 1); } while(query.next()) @@ -1012,7 +1011,7 @@ QStringList db_compare::getUniques(db_opt* pDb_opt, QString sDataBaseName, QStri QString sError = ""; if( pDb_opt->executeSql(sSql, query, sError) == false ) { - emit mergeRes("查询UNIQUE字段失败:" + sError, 1); + emit mergeRes(tr("查询UNIQUE字段失败:%1").arg(sError), 1); } while(query.next()) @@ -1033,7 +1032,7 @@ bool db_compare::ifExistTable(db_opt* pDb_opt, QString sDataBase, QString sTable QString sError = ""; if( pDb_opt->executeSql(sSql, query, sError) == false ) { - emit mergeRes("获取主键查询失败:" + sError, 1); + emit mergeRes(tr("获取主键查询失败:%1").arg(sError), 1); } while(query.next()) { @@ -1053,7 +1052,7 @@ bool db_compare::ifSubSystemSame( db_opt* pDb_opt, QString& sDatabaseName, QStri QString sError = ""; if( pDb_opt->executeSql(sSql, query, sError) == false ) { - emit mergeRes("查询专业是否匹配出错," + sError, 1); + emit mergeRes(tr("查询专业是否匹配出错,%1").arg(sError), 1); return false; } while(query.next()) @@ -1071,7 +1070,7 @@ bool db_compare::ifSubSystemSame( db_opt* pDb_opt, QString& sDatabaseName, QStri QString sError = ""; if( pDb_opt->executeSql(sSql, query, sError) == false ) { - emit mergeRes("查询专业是否匹配出错," + sError, 1); + emit mergeRes(tr("查询专业是否匹配出错,%1").arg(sError), 1); return false; } while(query.next()) @@ -1089,7 +1088,7 @@ bool db_compare::ifDistinguishStation( db_opt* pDb_opt, QString& sDatabaseName, QString sError = ""; if( pDb_opt->executeSql(sSql, query, sError) == false ) { - emit mergeRes("查询专业是否匹配出错," + sError, 1); + emit mergeRes(tr("查询专业是否匹配出错,%1").arg(sError), 1); return false; } while(query.next()) @@ -1107,7 +1106,7 @@ bool db_compare::ifDistinguishSubSystem( db_opt* pDb_opt, QString& sDatabaseName QString sError = ""; if( pDb_opt->executeSql(sSql, query, sError) == false ) { - emit mergeRes("查询专业是否匹配出错," + sError, 1); + emit mergeRes(tr("查询专业是否匹配出错,%1").arg(sError), 1); return false; } while(query.next()) diff --git a/platform/src/dbms/db_manager/db_manager.pro b/platform/src/dbms/db_manager/db_manager.pro index ad33caa7..7d1084c2 100644 --- a/platform/src/dbms/db_manager/db_manager.pro +++ b/platform/src/dbms/db_manager/db_manager.pro @@ -1,107 +1,111 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2018-06-28T13:47:06 -# -#------------------------------------------------- - -QT += core gui sql xml network - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - -TARGET = db_manager -TEMPLATE = app - -#CONFIG += c++11 - -# The following define makes your compiler emit warnings if you use -# any feature of Qt which has been marked as deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - - -SOURCES += \ - main.cpp \ - db_set.cpp \ - db_compare.cpp \ - mytreewidget.cpp \ - pj_manager.cpp \ - conndig.cpp \ - his_widgets/new_his_backup_dialog.cpp \ - his_widgets/import_his_backup_dialog.cpp \ - his_widgets/new_his_dump_dialog.cpp \ - pj_manager_his/pj_manager_his.cpp \ - pj_manager_his/pj_manager_his_data_srv.cpp \ - CHisUtil.cpp \ - CLogMngWidget.cpp \ - CExportZipWorker.cpp\ - SingleApplication.cpp \ - SingleApplication_p.cpp \ - CStationReuseForm.cpp - -HEADERS += \ - db_manager_common.h \ - db_set.h \ - db_compare.h \ - mytreewidget.h \ - pj_manager.h \ - conndig.h \ - his_widgets/new_his_backup_dialog.h \ - his_widgets/import_his_backup_dialog.h \ - his_widgets/new_his_dump_dialog.h \ - CHisUtil.h \ - CLogMngWidget.h \ - CExportZipWorker.h \ - SingleApplication.h \ - SingleApplication_p.h \ - CStationReuseForm.h - -FORMS += \ - db_set.ui \ - pj_manager.ui \ - conndig.ui \ - his_widgets/new_his_backup_dialog.ui \ - his_widgets/import_his_backup_dialog.ui \ - his_widgets/new_his_dump_dialog.ui \ - logMngWidget.ui \ - CStationReuseForm.ui - - -LIBS += -lboost_thread \ - -lboost_chrono \ - -lboost_system - - -LIBS += -lpub_logger_api -llog4cplus -lz -lcurl -lpub_sysinfo_api -ltsdb_api -ldb_base_api -ldb_manager_api -ldb_his_mng_api -lpub_utility_api -ldb_sysinfo_api - -DEFINES += QAPPLICATION_CLASS=QApplication - -win32{ - LIBS += -ladvapi32 - QMAKE_CXXFLAGS += /wd"4003" - QMAKE_CXXFLAGS_WARN_ON -= -w34189 - RC_ICONS = res/db_manager.ico - -CONFIG(debug, debug|release) { - LIBS += -lquazipd -} -CONFIG(release, debug|release) { - LIBS += -lquazip -} - -} -else{ - LIBS += -lquazip -} - -TRANSLATIONS = $$PWD/en.ts -RESOURCES += res.qrc - -#-0----------------------------------------------------------------- -COMMON_PRI=$$PWD/../../common.pri -exists($$COMMON_PRI) { - include($$COMMON_PRI) -}else { - error("FATAL error: can not find common.pri") -} - +#------------------------------------------------- +# +# Project created by QtCreator 2018-06-28T13:47:06 +# +#------------------------------------------------- + +QT += core gui sql xml network + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = db_manager +TEMPLATE = app + +#CONFIG += c++11 + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which has been marked as deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + + +SOURCES += \ + main.cpp \ + db_set.cpp \ + db_compare.cpp \ + mytreewidget.cpp \ + pj_manager.cpp \ + conndig.cpp \ + his_widgets/new_his_backup_dialog.cpp \ + his_widgets/import_his_backup_dialog.cpp \ + his_widgets/new_his_dump_dialog.cpp \ + pj_manager_his/pj_manager_his.cpp \ + pj_manager_his/pj_manager_his_data_srv.cpp \ + CHisUtil.cpp \ + CLogMngWidget.cpp \ + CExportZipWorker.cpp\ + SingleApplication.cpp \ + SingleApplication_p.cpp \ + CStationReuseForm.cpp \ + CCreateInfluxDBUserDlg.cpp + +HEADERS += \ + db_manager_common.h \ + db_set.h \ + db_compare.h \ + mytreewidget.h \ + pj_manager.h \ + conndig.h \ + his_widgets/new_his_backup_dialog.h \ + his_widgets/import_his_backup_dialog.h \ + his_widgets/new_his_dump_dialog.h \ + CHisUtil.h \ + CLogMngWidget.h \ + CExportZipWorker.h \ + SingleApplication.h \ + SingleApplication_p.h \ + CStationReuseForm.h \ + CCreateInfluxDBUserDlg.h + +FORMS += \ + db_set.ui \ + pj_manager.ui \ + conndig.ui \ + his_widgets/new_his_backup_dialog.ui \ + his_widgets/import_his_backup_dialog.ui \ + his_widgets/new_his_dump_dialog.ui \ + logMngWidget.ui \ + CStationReuseForm.ui \ + CCreateInfluxDBUserDlg.ui + + +LIBS += -lboost_thread \ + -lboost_chrono \ + -lboost_system + + +LIBS += -lpub_logger_api -llog4cplus -lz -lcurl -lpub_sysinfo_api -ltsdb_api -ldb_base_api -ldb_manager_api -ldb_his_mng_api -lpub_utility_api -ldb_sysinfo_api +LIBS += -lpub_widget + +DEFINES += QAPPLICATION_CLASS=QApplication + +win32{ + LIBS += -ladvapi32 + QMAKE_CXXFLAGS += /wd"4003" + QMAKE_CXXFLAGS_WARN_ON -= -w34189 + RC_ICONS = res/db_manager.ico + +CONFIG(debug, debug|release) { + LIBS += -lquazipd +} +CONFIG(release, debug|release) { + LIBS += -lquazip +} + +} +else{ + LIBS += -lquazip +} + +TRANSLATIONS = $$PWD/en.ts +RESOURCES += res.qrc + +#-0----------------------------------------------------------------- +COMMON_PRI=$$PWD/../../common.pri +exists($$COMMON_PRI) { + include($$COMMON_PRI) +}else { + error("FATAL error: can not find common.pri") +} + diff --git a/platform/src/dbms/db_manager/db_manager_common.h b/platform/src/dbms/db_manager/db_manager_common.h index 47aaaa19..0f182f26 100644 --- a/platform/src/dbms/db_manager/db_manager_common.h +++ b/platform/src/dbms/db_manager/db_manager_common.h @@ -16,14 +16,10 @@ -#define TSDB_DB_NAME "iscs6000" #define DB_FILE_NAME "db_export.sql" #define TSDB_FILE_NAME "tsdb_export.sql.gz" #define TSDB_FILE_EVENT_NAME "tsdb_export_event.sql.gz" #define TSDB_FILE_DATA_NAME "tsdb_export_data.sql.gz" #define TSDB_BIN_DIR "tsdb_bin_export" -#define CN_PASSWD "kbdct@0755" - - #endif // DB_MANAGER_COMMON_H diff --git a/platform/src/dbms/db_manager/db_set.cpp b/platform/src/dbms/db_manager/db_set.cpp index 7f9bd348..0d02f62b 100644 --- a/platform/src/dbms/db_manager/db_set.cpp +++ b/platform/src/dbms/db_manager/db_set.cpp @@ -1,6 +1,6 @@ #include "db_set.h" #include "ui_db_set.h" -#include +#include "pub_widget/MessageBox.h" #include #include #include @@ -9,11 +9,13 @@ using namespace iot_dbms; db_set::db_set( QWidget* parent ) - : QDialog( parent ) + : CustomUiDialog( parent ) , ui( new Ui::db_set ) { ui->setupUi( this ); - ui->le_passwd->setText(CN_PASSWD); + ui->le_passwd->setText(EMS_DEFAULT_PASSWD); + + setAutoLayout(true); } db_set::~db_set() @@ -135,14 +137,11 @@ void db_set::accept() { if( ui->le_name->text() == "" || ui->le_ip->text() == "" || ui->le_port->text() == "") { - QMessageBox msg(this); - msg.setText(tr("不准选择空路径")); - msg.setWindowTitle(tr("提示")); - msg.exec(); + N_MessageBox::information(this,tr("提示"),tr("不准选择空路径")); return; } else - return QDialog::accept(); + return CustomUiDialog::accept(); } @@ -174,7 +173,7 @@ void db_set::on_rb_kingbase_clicked() void db_set::on_pushButton_clicked() { if( ui->le_user->text() == "" || ui->le_ip->text() == "" || ui->le_port->text() == "" || ui->le_passwd->text() == ""){ - QMessageBox::warning(this,tr("警告"),tr("请把信息填写完整")); + N_MessageBox::warning(this,tr("警告"),tr("请把信息填写完整")); return; } @@ -208,11 +207,11 @@ void db_set::on_pushButton_clicked() if(ok) { - QMessageBox::information(this,tr("测试结果"),tr("连接成功")); + N_MessageBox::information(this,tr("测试结果"),tr("连接成功")); } else { - QMessageBox::warning(this,tr("测试结果"),QString(tr("连接失败:")) + objDb.getLastErrorString()); + N_MessageBox::warning(this,tr("测试结果"),QString(tr("连接失败:")) + objDb.getLastErrorString()); } } } diff --git a/platform/src/dbms/db_manager/db_set.h b/platform/src/dbms/db_manager/db_set.h index 463a5116..d90f0fa7 100644 --- a/platform/src/dbms/db_manager/db_set.h +++ b/platform/src/dbms/db_manager/db_set.h @@ -1,16 +1,15 @@ #ifndef DBSET_H #define DBSET_H -#include #include "db_base_api/CDbPara.h" - +#include "pub_widget/CustomDialog.h" namespace Ui { class db_set; } -class db_set : public QDialog +class db_set : public CustomUiDialog { Q_OBJECT diff --git a/platform/src/dbms/db_manager/db_set.ui b/platform/src/dbms/db_manager/db_set.ui index dc4fe772..9daa7c50 100644 --- a/platform/src/dbms/db_manager/db_set.ui +++ b/platform/src/dbms/db_manager/db_set.ui @@ -6,73 +6,15 @@ 0 0 - 359 - 290 + 283 + 354 Dialog - - - - - - - 数据库类型: - - - - - - - - - MySQL - - - true - - - buttonGroup - - - - - - - openGauss - - - buttonGroup - - - - - - - Oracle - - - buttonGroup - - - - - - - KingBase - - - buttonGroup - - - - - - - - + + @@ -140,7 +82,7 @@ - kbdct@0755 + ems@byd23 QLineEdit::Password @@ -149,36 +91,110 @@ - - - - - 0 - 0 - - - - - 微软雅黑 - 10 - 50 - false - - - - 测试连接是否正常 - - + + + + + + 数据库类型: + + + + + + + + + MySQL + + + true + + + buttonGroup + + + + + + + openGauss + + + buttonGroup + + + + + + + Oracle + + + buttonGroup + + + + + + + KingBase + + + buttonGroup + + + + + + - - + + - Qt::Horizontal + Qt::Vertical - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + 20 + 40 + - + + + + + + + + 测试连接 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + diff --git a/platform/src/dbms/db_manager/en.ts b/platform/src/dbms/db_manager/en.ts deleted file mode 100644 index 7612ab00..00000000 --- a/platform/src/dbms/db_manager/en.ts +++ /dev/null @@ -1,2374 +0,0 @@ - - - - - CExportZipWorker - - - 创建日志导出文件失败,请检查以下文件是否被占用或被其他文件打开: - cannot export log file, please check if other is using log folder - - - - 读取日志路径失败 - cannot read log folder - - - - 读取日志文件失败 - cannot read log file - - - - 创建文件失败 - cannot create log file - - - - 导出日志成功,路径: - exported file: - - - - CLogMngWidget - - - Form - - - - - 全部 - all - - - - 刷新 - refresh - - - - 导出日志 - export - - - - - log文件夹不存在 - log folder does not exist - - - - 请出建模信息 - please export system model info first - - - - 提醒 - notification - - - - 请先选择导出类型 - please choose export type - - - - 保存文件名 - filename - - - - zip (*.zip) - - - - - ConnDig - - - Dialog - - - - - 用户 - username - - - - 密码 - password - - - - IP地址 - ip address - - - - 端口 - port - - - - 数据库类型 - db type - - - - 数据库名称 - db name - - - - 连接 - Connect - - - - 取消 - Cancel - - - - 连接数据库 - Connect Database - - - - MySQL - MySQL - - - - Oracle - Oracle - - - - 未知的数据库服务类型! - unknown database type! - - - - 连接数据库服务%1成功! - succeed to connect database service%1! - - - - 数据库服务%1不存在%2数据库! - Database %2 did not exist in database service %1! - - - - 连接数据库服务%1失败! - fail to connect database service %1! - - - - QObject - - - 全部备份 - All of Backup - - - - 部分备份 - partial backup - - - - - - - - 打开服务管理器失败,请确认是否具有权限!建议以管理员权限打开 - cannot open Service Manager, pleasure ensure that you have sufficient permission - - - - 未设置服务自启动,请先设置服务自启动 - the service is not automatic startup, please make service startup - - - - - 未设置服务自启动,无需取消! - the service is not automatic startup, there is no need to cancel it! - - - - - 停止服务超时! - timeout to stop serivce! - - - - - 获取服务状态失败! - cannot get the state of the service! - - - - 文件不存在! - cannot find file! - - - - 注册服务失败,请确认是否具有权限!建议以管理员权限打开 - cannot register service,pleasure ensure that you have enough permissions - - - - 已添加并设置服务自启动 - the service is automatic startup at boot - - - - 已设置服务自启动,若需重新设置,请先取消! - the service is automatic startup at boot, if you want to reset it, please be first to cancel startup at boot! - - - - 注销成功! - unregister service! - - - - 注销服务失败! - fail to unregister service! - - - - db_compare - - - 合并出错,%1 - cannot merge %1 - - - - 配置出错,跳过,%1 - some error in config, continue $1 - - - - 删除表:%1数据失败 - failt to delete the data of table: %1 - - - - db_exportType - - - Dialog - - - - - 删除表语句 - delete statement - - - - 创建表语句 - create statement - - - - 插入数据语句 - insert statement - - - - 创建触发器、存储过程、函数语句 - create trigger, procedure, function statement - - - - 确定 - ok - - - - 取消 - cancel - - - - 导出类型选择 - choose export type - - - - db_restore - - - Dialog - - - - - 删除表语句 - delete statement - - - - 创建表语句 - create statement - - - - 插入数据语句 - insert statement - - - - 创建触发器、存储过程、函数语句 - create trigger, procedure, function statement - - - - 确定 - ok - - - - 取消 - cancel - - - - db_set - - - Dialog - - - - - 数据库类型: - database type - - - - MySql - - - - - Oracle - - - - - 显 示 名 称: - display name - - - - localhost - - - - - IP 地 址: - ip address - - - - 127.0.0.1 - - - - - 端 口 号: - port - - - - 3306 - - - - - 用 户 名: - username - - - - root - - - - - 密 码: - password - - - - kbdct - - - - - 测试连接是否正常 - test connection - - - - 不准选择空路径 - No empty paths allowed - - - - 提示 - NOTIF - - - - 警告 - warning - - - - 请把信息填写完整 - Please fill in the information - - - - - 测试结果 - Test results - - - - 连接成功 - Connection successful - - - - 连接失败: - Connection failed: - - - - import_his_backup_dialog - - - Dialog - - - - - 常规 - common - - - - 导入服务器: - dest server - - - - hostname - - - - - 导入数据库: - dest databaseName - - - - databaseName - - - - - 备份文件信息 - info - - - - 备份名称: - name - - - - - - - - - - - TextLabel - - - - - 备份类型: - type - - - - 备份日期: - date - - - - 来源数据库: - source - - - - 来源地址: - source address - - - - 转储截止日期: - dump enddate - - - - 部分备份信息: - partial backup info - - - - 注释: - comment - - - - 信息日志 - log - - - - 导入备份 : - import - - - - 时间 : - time - - - - 0 s - - - - - - 开始 - start - - - - 取消 - cancel - - - - 导入备份 - import backup - - - - - yyyy年M月d日h时m分s秒 - yyyy,M,d,h,m,s - - - - 提醒 - Alert - - - - 是否恢复备份?(如果是恢复全量备份则会覆盖原始数据!) - whether to restore the backup?(if you import the full backup, the data will be override) - - - - 关闭 - close - - - - 还原备份全部历史事件和采样数据完成 - succeed to import all history event and history data - - - - 还原备份全部历史事件和采样数据错误 - fail to import all history event and history data - - - - 还原备份转储完成 - fail to import backup - - - - - 导入SQL中可能有部分重复和错误,具体请参见日志 - there are some errors in import SQL, please dig into logs - - - - 还原备份转储错误 - fail to restore backup - - - - 导入部分转储完成 - completing import partial dump - - - - 导入部分转储错误 - fail to import partial backup - - - - new_his_backup_dialog - - - 新增备份 - new backup - - - - 常规 - common - - - - 服务器: - server - - - - 数据库: - databasename - - - - databaseName - - - - - hostname - - - - - 注释: - comment - - - - 增量备份 - addtional backup - - - - 恢复时不会覆盖原始数据,速度慢 - The original data will not be overwritten, it is slow - - - - - 历史事件 - historical events - - - - 历史采样数据 - sample points - - - - 全量备份 - full backup - - - - 恢复时会覆盖原始数据,速度快 - The original data will be overwritten, it is fast - - - - 增量备份高级选项 - advanced - - - - - 时间 - time - - - - - 开始时间 - start time - - - - - 结束时间 - end time - - - - 设定与采样数据时间同步 - sync with sample point - - - - - 按设定的时间区间备份,若时间总选项为否,则备份全部时间的数据 - if the time is unchecked, backup all time - - - - 历史数据 - hisdata - - - - 类型 - type - - - 数字量变位 - digital change - - - 模拟量越限 - analog over - - - soe事件序列 - soe - - - 人工操作 - opearate - - - - 按选中的类型备份,若类型总选项为否,则选择全部类型 - if the time is unchecked, backup all types - - - 采样数据 - sample point - - - - 设定与历史事件时间同步 - Set to synchronize with historical event time - - - - 数字量 - di - - - - 模拟量 - ai - - - - 累积量 - acc - - - - 混合量 - mix - - - - 信息日志 - log - - - - 备份信息 : - info: - - - - TextLabel - - - - - 时间 : - time: - - - - 0 s - - - - - - 开始 - start - - - - 取消 - close - - - - 保存配置文件失败 - fail to save config file - - - - yyyy年M月d日h时m分s秒 - yyyy, M, d, h, m, s - - - - 全部备份 - All Backup - - - - 部分备份 - partial backup - - - - ,历史事件 - ,his event - - - - - ( - ( - - - - - 从 - from - - - - - 到 - to - - - - - 全部时间 - all time - - - - , - , - - - 模拟量变位 - ai - - - 数字量变位 - di - - - 系统信息 - sys_info - - - soe事件序列 - soe - - - 人工操作 - opearate - - - - 全部类型 - all types - - - - - ) - ) - - - - ,采样数据 - sample points - - - - 模拟量 - ai - - - - 数字量 - di - - - - 累积量 - acc - - - - 混合量 - mix - - - - - - - 提醒 - alert - - - - - 结束时间请先设置小于当前时间 - please set end time after start time - - - - - 开始时间请先设置小于结束时间 - please set start time before end time - - - - 备份全部历史事件和采样数据完成 - complte - - - - 备份全部历史事件和采样数据错误 - fail - - - - 备份完成 - backup compelte - - - - 备份失败 - fail to backup - - - - 关闭 - close - - - - new_his_dump_dialog - - - Dialog - - - - - 常规 - common - - - - 转储服务器: - server - - - - hostname - - - - - 转储数据库: - database - - - - databaseName - - - - - 转储截止日期 : - enddate - - - - 时间 : - time: - - - - 0 s - - - - - TextLabel - - - - - - yyyy年M月d日h时m分s秒 - yyyy,M,d,h,m,s - - - - 手动转储 - manual dump - - - - - 开始 - start - - - - 取消 - cancel - - - - 关闭 - close - - - - 保存配置文件失败 - fail to save config file - - - - pj_manager - - - MainWindow - - - - - - 工程管理 - Project - - - - 连接 - Connect - - - - 备份恢复 - backup/restore - - - - 系统升级 - upgrade - - - - 历史数据 - hisdata - - - - 操作方式 - Operation method - - - - - - 数据库 - database - - - - 简单模式 - easy mode - - - - 完整模式 - full mode - - - - 选择数据库:只备份/恢复数据库 - database mode: only backup/restore database - - - - 选择简单模式:包括数据库,还有data目录和报表 - 选择简单模式:包括数据库,还有data目录下的所有文件 - easy mode: database, data dir and report files - - - - 选择完整模式:包括数据库,还有data,common,platform目录和报表 - 选择完整模式:包括数据库,还有data,common,platform目录下的所有文件 - full mode: database,and directory:data,common,platform and report files - - - - 备份记录 - backup history - - - - - - 备份日期 - backup date - - - - - 备份目录 - backup directory - - - - - 备份 - backup - - - - 恢复 - restore - - - - 完整升级 - System - - - - - 开始 - start - - - - - 结束 - end - - - - 导入文件(包括工程数据组态图形趋势) - import file(include project data, configuration,image,trends) - - - - 日志管理 - log management - - - - 导入数据库脚本 - import database scripts - - - - - 删除触发器、存储过程、函数 - delete trigger,procedure,functions - - - - - 升级数据库表结构 - upgrade the structures of database - - - - - 导入基础数据 - import basic data - - - - - 创建触发器、存储过程、函数 - create trigger,procedure,function - - - - 数据库升级 - Database - - - - 升级 - upgrade - - - - - 新增备份 - new backup - - - - - - 删除备份 - delete backup - - - - - 导入备份 - import backup - - - - 名 - name - - - - - 备份类型 - backup type - - - - - 备份大小 - backup size - - - - 转储 - dump - - - - 定时: - every - - - - 星期 - weekday - - - - 日 - sunday - - - - 一 - monday - - - - 二 - tuesday - - - - 三 - Wednesday - - - - 四 - Thursday - - - - 五 - Friday - - - - 六 - Saturday - - - - hh:mm - - - - - 自动转储 - automatic dump - - - - 天前的数据 - day before - - - - 应用配置 - apply - - - - 自动转储服务管理 - automatic dump service management - - - - 启动服务 - start service - - - - 关闭服务 - close service - - - - 设置服务自启动 - enable auto start - - - - 关闭服务自启动 - disable auto start - - - - 开启状态: - isOpened - - - - - - 关闭 - close - - - - 是否自启动: - isAutoStart - - - - 否 - no - - - - 手动转储 - manual dump - - - - 提示:自动转储和手动转储的数据可在备份标签页(前页)查看 - results can be viewed in the previous page - - - - 请连接本地数据库 - please connect local database - - - - 清理 - clean - - - - 全部删除 - delete all - - - - 将删除该数据库内的所有历史数据(事件,采样数据,趋势) - delete all historical event and sample points - - - - 部分删除 - partial clean - - - - 将删除选择日期之前的历史数据(事件,采样数据,趋势) - delete historical event and sample points before - - - - yyyy/M/d APh:mm:ss - - - - - 开始清理 - start - - - - 表空间相关 - about tablespace - - - - 当前历史事件表占用磁盘总大小: - tables size about hisevents - - - - GB - - - - - 查询 - get - - - - 清理表空间 - clean tablespace - - - - - 数据库管理 - Database - - - - 数据库表 - tables - - - - 数据合并 - database merge - - - - 步骤1:选择源数据库 - step 1:choose source database - - - - - 数据服务 - data services - - - - 步骤2:选择目标数据库 - step2: choose target database - - - - 步骤3:选择源位置 - step3: choose src location - - - - 步骤5:配置和执行 - step 5" config and execute - - - 步骤3:选择位置 - step 3: choose location - - - - - 位置 - location - - - - 步骤4:选择专业 - step4: choose applicaiton - - - - 专业 - applicaiton - - - 步骤5:执行 - step5: execute - - - - 执行 - execute - - - - 步骤5:选择目标位置 - step 5: choose destination location - - - - - - - - - - - - - - - - - - - - - - - - - - - 提示 - notification - - - - - - 错误 - error - - - - 文件 - file - - - - 帮助 - help - - - - 工程管理工具 - Project Management - - - - msgtab - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 警告 - warning - - - - - 正在执行操作,请勿重新连接! - Operation in progress, do not reconnect! - - - - 新建备份 - new backup - - - - 输入备份名: - import the name of backup - - - - 恢复提醒 - notification - - - - 请确认连接的数据库所配置的所有系统已经离线,本工具只支持离线恢复,是否继续 - please check if the system is offline, continue - - - - - - 备份失败! - Backup failed! - - - - - - 备份完成! - The backup is complete! - - - - - - - 请在备份记录中选择一项备份的工程! - Please select a backup project in the backup record! - - - - - - 恢复失败! - Recovery failed! - - - - - - 恢复成功! - Restored successfully! - - - - 升级提醒 - notification - - - 升级操作将会对当前工程数据和数据库进线覆盖,请确认是否继续? - the upgrade operation will overwrite current data and database, continue? - - - - - 升级失败! - Upgrade failed! - - - - - 升级成功! - ugrade successed! - - - - - iscs6000_table_struct.xml不存在 - iscs6000_table_struct.xml does not exist - - - - iscs6000_func.sql不存在! - iscs6000_func.sql does not exist! - - - - 请添加一个数据服务配置 - Please add a data service configuration - - - - 文件内容不是xml格式 - File content is not in xml format - - - - 打开配置文件 - Open configuration file - - - - 失败 - fail - - - - 连接数据服务 - connect database service - - - - 断开数据服务 - disconnect database service - - - - 修改数据服务配置 - modify config - - - - 删除数据服务配置 - delete config - - - - 导入基础数据 - import basic data - - - - 更新数据库结构 - update database structure - - - - 执行SQL脚本 - execute sql script - - - - 删除数据库 - delete database - - - - 数据库脚本管理 - Database script management - - - - 创建触发器 - Create trigger - - - - 删除触发器 - delete trigger - - - - 更新触发器 - update trigger - - - - - 未知的节点类型 - Unknown node type - - - - 增加数据服务配置 - add database service config - - - - 连接数据库服务%1成功 - Connecting to Database Service %1 Successfully - - - - 连接数据库服务%1失败 - fail to connect database service %1 - - - - 未知的数据库服务类型 - Unknown database service type - - - - 断开数据库服务成功 - disconnect database service succeed - - - - 增加数据配置 - add database config - - - - 修改配置需要断开数据库连接,是否断开? - Modifying the configuration requires disconnecting the database. Is it disconnected? - - - - 修改数据配置 - Modify data configuration - - - - 请先断开数据服务 - Please disconnect the data service first - - - - 导入基础数据将会清空原来表中的数据,是否导入? - Importing the basic data will clear the data in the original table. Is it imported? - - - - 选择一个或多个文件 - Select one or more files - - - - 无法打开基础数据路径! - cannot open basic data path - - - - - - - - 获取数据库操作对象失败 - Failed to get database operation object - - - - 升级数据库将会修改表结构,确认升级? - Upgrading the database will modify the table structure, confirm the upgrade? - - - - - - - 数据库选择错误 - Database selection error - - - - 确认删除数据库? - Are you sure you want to delete the database? - - - - 数据库删除成功! - Database deleted successfully! - - - - 数据库删除失败! - Database deletion failed! - - - - Open File - - - - - Sql (*.sql) - - - - - 未选择源车站 - please choose source location first - - - - 未选择源专业 - please choose source domain - - - - 未选择目标车站 - please choose destination location - - - - 已有同名数据库,创建失败 - Existing database with the same name, creation failed - - - - 数据库名不能为汉字 - Database name cannot be non-latin characters - - - - 数据库名不能以数字开头 - Database name cannot start with a number - - - - 数据库名不能包含中划线 - Database name cannot contain an underscore - - - - 数据库创建失败 - Database creation failed - - - - - 新建数据库 - new database - - - - - - 名称 - name - - - - 数据库类型 - db type - - - - IP地址 - ip address - - - - 端口号 - port - - - - 用户名 - username - - - - 密码 - password - - - - 表名 - table name - - - - 行数 - line number - - - - 表备注 - table comment - - - - 表空间 - table space - - - - 表属性 - table property - - - - iscs6000_table_struct.xml读取失败 - iscs6000_table_struct.xml read failed - - - - 配置文件节点为空! - Profile node is empty! - - - - 参数表 - Parameters Table - - - - 历史表 - History table - - - - 升级操作将会对当前工程数据和数据库进行覆盖,请确认是否继续? - this opearation will overwrite current data dir and database, continue? - - - - 临时表 - Temporary table - - - - - 非临时表 - Non-temporary tables - - - - 请确保源数据库和目标数据库的所有表结构一致,否则会出错! - Make sure that all the table structures of the source and target databases are consistent, otherwise an error will occur! - - - - 未选择源数据服务 - No source data service selected - - - - 未选择源数据库 - The source database was not selected - - - - 未选择目标数据服务 - Target data service not selected - - - - 未选择目标数据库 - Target database not selected - - - - 源数据服务未连接 - The source data service is not connected - - - - 目标数据服务未连接 - Target data service is not connected - - - - 源和目标不能相同 - The source and target cannot be the same - - - 未选择车站 - No station selected - - - 未选择专业 - No major selected - - - - 专业ID不正确,ID值: - Professional ID is incorrect, ID value: - - - - 请先连接数据服务 - Please connect to the data service first - - - - 数据库名: - databaseName: - - - - - - - - - - - - - - - - - - - - - 提醒 - alert - - - - - 请先连接数据库 - please connect to database first - - - - - yyyy年M月d日h时m分s秒 - yyyy,M,d,h,m,s - - - - 请选择备份 - please choose backup - - - - 请确认是否删除备份 - please ensure that whether to delete backup - - - - 对象信息 - object info - - - - - 值 - value - - - - 备份名称 - backup name - - - - 路径 - path - - - - 来源数据库 - source database - - - - 来源主机地址 - source address - - - - 备注 - comment - - - - 转储截止日期 - enddate of dump - - - - 部分备份信息 - partial backup info - - - - 显示对象信息 - display object info - - - - - 重命名 - rename - - - - - 修改备注 - modify comment - - - - 显示备份所在文件夹 - show containing folder - - - - 刷新 - refresh - - - - 是否删除备份 - Whether to delete backups - - - - 请先选择备份对象 - please choose backup object - - - - 重命名备份: - renanme backup - - - - 修改备份备注: - modify backup comment - - - - 表空间优化已完成 - optimize tablespace done - - - - 表空间优化失败 - fail to optimize tablespace - - - - 清理全部历史数据已完成 - clean all historical event and sample points done - - - - 清理全部历史数据失败 - fail to clean all historical data - - - - 清理历史数据已完成 - clean historical data done - - - - 清理历史数据失败 - fail to clean historical data - - - - 请确认是否删除? - please whether to delete - - - - 服务已开启 - serivce is open - - - - 服务已启动 - service is started - - - - 服务已关闭 - service is closed - - - - 关闭服务成功 - closing service completed - - - - 设置可执行权限失败! - fail to set execute permission - - - - 文件不存在! - file is not found - - - - 服务配置文件不可写,请确认是否具有权限!请以root用户打开db_manager程序, - service config cannot be writen, please ensure that you have enough permission - - - - 写入服务配置文件失败! - fail to write to service config file - - - - 调用系统重新加载配置失败! - fail to call systemd - - - - 设置服务开机自启动失败! - fail to call systemctl - - - - 服务已注册并设置自启动 - service registerd! - - - - 服务已关闭自启动 - service has closed automatic start - - - - - 开 - start - - - - - 关 - close - - - - - 开启 - open - - - diff --git a/platform/src/dbms/db_manager/his_widgets/import_his_backup_dialog.cpp b/platform/src/dbms/db_manager/his_widgets/import_his_backup_dialog.cpp index 09327514..8d0c1a12 100644 --- a/platform/src/dbms/db_manager/his_widgets/import_his_backup_dialog.cpp +++ b/platform/src/dbms/db_manager/his_widgets/import_his_backup_dialog.cpp @@ -1,6 +1,7 @@ #include "import_his_backup_dialog.h" #include "ui_import_his_backup_dialog.h" #include "public/pub_utility_api/FileUtil.h" +#include "public/pub_utility_api/TimeUtil.h" #include "db_manager_common.h" #include "CHisUtil.h" @@ -9,18 +10,21 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" import_his_backup_dialog::import_his_backup_dialog(QWidget *parent) : - QDialog(parent), + CustomUiDialog(parent), ui(new Ui::import_his_backup_dialog) { ui->setupUi(this); initUi(); initHisMng(); + setCloseBtnVisible(false); + m_lLastImportTsdbPrintInfo = 0L; + setAutoLayout(true); } import_his_backup_dialog::~import_his_backup_dialog() @@ -61,6 +65,20 @@ void import_his_backup_dialog::addMsg(const QString &msg) isDbErr = true; return; } + + qint64 lCurTime = iot_public::getMonotonicMsec(); + if(msg.contains("(PPS)")) //针对influxdb特例化处理,否则消息框消息太多,临时解决为:1分钟输出1条过程信息 + { + if(lCurTime - m_lLastImportTsdbPrintInfo < 60 * 1000) + { + return; + } + else + { + m_lLastImportTsdbPrintInfo = lCurTime; + } + } + ui->listWidget->addItem(msg); } @@ -72,8 +90,6 @@ void import_his_backup_dialog::initUi() this->setWindowTitle(tr("导入备份")); // ui->tabWidget->setCurrentIndex(0); - ui->listWidget->setStyleSheet("QListWidget::item{height:20px;color:#0a0a0a}"); - this->setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint); //< 取消关闭按钮 ui->label_dumpdate_tag->setHidden(true); ui->label_dumpdate->setHidden(true); @@ -221,25 +237,29 @@ QString import_his_backup_dialog::getTsdbDataFilePath() void import_his_backup_dialog::startImport() { + m_lLastImportTsdbPrintInfo = 0L; + /* 为以后搜索方便,保留此注释 + * 本函数多处EMS_DEFAULT_DATABASE + */ if(isDump) { - emit importHisDump(m_pConn,getDbFilePath(),m_pConn->hostName(),TSDB_DB_NAME,getTsdbFilePath()); + emit importHisDump(m_pConn,getDbFilePath(),m_pConn->hostName(),m_pConn->databaseName(),getTsdbFilePath()); return; } if(isAll) { - emit importHis(m_pConn,getDbFilePath(),m_pConn->hostName(),TSDB_DB_NAME,getTsdbBinDir()); + emit importHis(m_pConn,getDbFilePath(),m_pConn->hostName(),m_pConn->databaseName(),getTsdbBinDir()); return; } if(isPart) { if(partVersion == 1) { - emit importPart(m_pConn,m_pConn->hostName(),TSDB_DB_NAME,isEventExported,isDataExported,getDbFilePath(),getTsdbEventFilePath(),getTsdbDataFilePath()); + emit importPart(m_pConn,m_pConn->hostName(),m_pConn->databaseName(),isEventExported,isDataExported,getDbFilePath(),getTsdbEventFilePath(),getTsdbDataFilePath()); } else{ - emit importPartV2(m_pConn,m_pConn->hostName(),TSDB_DB_NAME,getDbFilePath(),getTsdbFilePath()); + emit importPartV2(m_pConn,m_pConn->hostName(),m_pConn->databaseName(),getDbFilePath(),getTsdbFilePath()); } } @@ -256,7 +276,8 @@ void import_his_backup_dialog::on_buttonBox_clicked(QAbstractButton *button) { if(button->text() == tr("开始")) { - if(QMessageBox::question(this,tr("提醒"),tr("是否恢复备份?(如果是恢复全量备份则会覆盖原始数据!)")) != QMessageBox::Yes) + if(N_MessageBox::question(this,tr("提醒"),tr("是否恢复备份?(如果是恢复全量备份则会覆盖原始数据!)")) + != N_MessageBox::Ok) { return; } diff --git a/platform/src/dbms/db_manager/his_widgets/import_his_backup_dialog.h b/platform/src/dbms/db_manager/his_widgets/import_his_backup_dialog.h index d46e991a..28389f23 100644 --- a/platform/src/dbms/db_manager/his_widgets/import_his_backup_dialog.h +++ b/platform/src/dbms/db_manager/his_widgets/import_his_backup_dialog.h @@ -3,18 +3,18 @@ #include -#include #include #include #include #include #include +#include "pub_widget/CustomDialog.h" namespace Ui { class import_his_backup_dialog; } -class import_his_backup_dialog : public QDialog +class import_his_backup_dialog : public CustomUiDialog { Q_OBJECT @@ -70,7 +70,7 @@ private: int partVersion; bool isEventExported = false; bool isDataExported = false; - + qint64 m_lLastImportTsdbPrintInfo; //最后一次打印tsdb导入信息的日志时间,1分钟打印一次,防止qlistwidget行数太多 void initUi(); void initHisMng(); diff --git a/platform/src/dbms/db_manager/his_widgets/import_his_backup_dialog.ui b/platform/src/dbms/db_manager/his_widgets/import_his_backup_dialog.ui index d6edc0e8..837ec6ed 100644 --- a/platform/src/dbms/db_manager/his_widgets/import_his_backup_dialog.ui +++ b/platform/src/dbms/db_manager/his_widgets/import_his_backup_dialog.ui @@ -14,19 +14,6 @@ Dialog - - - - button-layout: 2 - - - Qt::Horizontal - - - QDialogButtonBox::Apply|QDialogButtonBox::Cancel - - - @@ -280,6 +267,19 @@ + + + + button-layout: 2 + + + Qt::Horizontal + + + QDialogButtonBox::Apply|QDialogButtonBox::Cancel + + + diff --git a/platform/src/dbms/db_manager/his_widgets/new_his_backup_dialog.cpp b/platform/src/dbms/db_manager/his_widgets/new_his_backup_dialog.cpp index 328cb152..b1883a4c 100644 --- a/platform/src/dbms/db_manager/his_widgets/new_his_backup_dialog.cpp +++ b/platform/src/dbms/db_manager/his_widgets/new_his_backup_dialog.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include "pub_widget/MessageBox.h" #include #include #include @@ -15,7 +15,7 @@ Q_DECLARE_METATYPE(std::vector) new_his_backup_dialog::new_his_backup_dialog(QWidget *parent) : - QDialog(parent), + CustomUiDialog(parent), ui(new Ui::new_his_backup_dialog) { ui->setupUi(this); @@ -28,6 +28,9 @@ new_his_backup_dialog::new_his_backup_dialog(QWidget *parent) : qRegisterMetaType< std::vector >(); qRegisterMetaType< std::vector >(); + setCloseBtnVisible(false); + + setAutoLayout(true); } new_his_backup_dialog::~new_his_backup_dialog() @@ -73,8 +76,6 @@ void new_his_backup_dialog::init() ui->tabWidget->setCurrentIndex(0); - this->setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint); //< 取消关闭按钮 - ui->dateTimeEdit_start->setDateTime(QDateTime::currentDateTime().addYears(-1)); ui->dateTimeEdit_end->setDateTime(QDateTime::currentDateTime()); @@ -116,7 +117,6 @@ void new_his_backup_dialog::initConnect() void new_his_backup_dialog::initStyleSheet() { - ui->listWidget->setStyleSheet("QListWidget::item{height:20px;color:#0a0a0a}"); } void new_his_backup_dialog::initHisMng() @@ -262,13 +262,13 @@ void new_his_backup_dialog::checkTimeValid() if(ui->dateTimeEdit_end->dateTime() > QDateTime::currentDateTime()) { ui->dateTimeEdit_end->setDateTime(QDateTime::currentDateTime()); - QMessageBox::information(this,tr("提醒"),tr("结束时间请先设置小于当前时间")); + N_MessageBox::information(this,tr("提醒"),tr("结束时间请先设置小于当前时间")); return; } if(ui->dateTimeEdit_start->dateTime() > ui->dateTimeEdit_end->dateTime()) { ui->dateTimeEdit_start->setDateTime(ui->dateTimeEdit_end->dateTime().addDays(-1)); - QMessageBox::information(this,tr("提醒"),tr("开始时间请先设置小于结束时间")); + N_MessageBox::information(this,tr("提醒"),tr("开始时间请先设置小于结束时间")); } } @@ -296,7 +296,10 @@ void new_his_backup_dialog::startBackupAll() endtime = ui->dateTimeEdit_end->dateTime().toMSecsSinceEpoch(); } - emit exportHis(m_pConn,m_dbFilePath,TSDB_DB_NAME,m_tsdbBinDir,starttime,endtime ); + /* 为以后搜索方便,保留此注释 + * emit exportHis(m_pConn,m_dbFilePath,EMS_DEFAULT_DATABASE,m_tsdbBinDir,starttime,endtime ); + */ + emit exportHis(m_pConn,m_dbFilePath,m_pConn->databaseName(),m_tsdbBinDir,starttime,endtime ); } void new_his_backup_dialog::startBackupPart() @@ -310,11 +313,12 @@ void new_his_backup_dialog::startBackupPart() endtime = ui->dateTimeEdit_end->dateTime().toMSecsSinceEpoch(); } - emit exportPart(m_pConn,m_pConn->hostName(),TSDB_DB_NAME, - + /* 为以后搜索方便,保留此注释 + * emit exportPart(m_pConn,m_pConn->hostName(),EMS_DEFAULT_DATABASE, + */ + emit exportPart(m_pConn,m_pConn->hostName(),m_pConn->databaseName(), starttime, endtime, - m_dbFilePath, m_tsdbFilePath ); diff --git a/platform/src/dbms/db_manager/his_widgets/new_his_backup_dialog.h b/platform/src/dbms/db_manager/his_widgets/new_his_backup_dialog.h index 06d5cbc6..e3d23083 100644 --- a/platform/src/dbms/db_manager/his_widgets/new_his_backup_dialog.h +++ b/platform/src/dbms/db_manager/his_widgets/new_his_backup_dialog.h @@ -3,18 +3,17 @@ #include -#include #include #include #include #include - +#include "pub_widget/CustomDialog.h" namespace Ui { class new_his_backup_dialog; } -class new_his_backup_dialog : public QDialog +class new_his_backup_dialog : public CustomUiDialog { Q_OBJECT diff --git a/platform/src/dbms/db_manager/his_widgets/new_his_dump_dialog.cpp b/platform/src/dbms/db_manager/his_widgets/new_his_dump_dialog.cpp index 55fba3d6..dda1cf14 100644 --- a/platform/src/dbms/db_manager/his_widgets/new_his_dump_dialog.cpp +++ b/platform/src/dbms/db_manager/his_widgets/new_his_dump_dialog.cpp @@ -13,11 +13,8 @@ #include #include "CHisUtil.h" - - - new_his_dump_dialog::new_his_dump_dialog(QWidget *parent) : - QDialog(parent), + CustomUiDialog(parent), ui(new Ui::new_his_dump_dialog) { ui->setupUi(this); @@ -25,6 +22,10 @@ new_his_dump_dialog::new_his_dump_dialog(QWidget *parent) : initUi(); initHisMng(); init(); + + setCloseBtnVisible(false); + + setAutoLayout(true); } new_his_dump_dialog::~new_his_dump_dialog() @@ -60,12 +61,12 @@ void new_his_dump_dialog::handleDumpHisFinished(bool result) { if(result) { - addMsg("转储完成"); + addMsg(tr("转储完成")); genConfig(); } else { - addMsg("转储失败"); + addMsg(tr("转储失败")); } finish(); } @@ -80,10 +81,6 @@ void new_his_dump_dialog::setDumpDateTime(qint64 timestamp) void new_his_dump_dialog::initUi() { ui->listWidget->setUniformItemSizes(true); - - this->setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint); //< 取消关闭按钮 - ui->listWidget->setStyleSheet("QListWidget::item{height:20px;color:#0a0a0a}"); - this->setWindowTitle(tr("手动转储")); ui->buttonBox->button(QDialogButtonBox::Apply)->setText(tr("开始")); @@ -130,9 +127,10 @@ void new_his_dump_dialog::updateTime() void new_his_dump_dialog::startDump() { - emit dumpHis(m_pConn,m_dbFilePath, - TSDB_DB_NAME,m_tsdbFilePath, - m_dumpTimestamp); + /* 为以后搜索方便,保留此注释 + * emit dumpHis(m_pConn,m_dbFilePath,EMS_DEFAULT_DATABASE,m_tsdbFilePath,m_dumpTimestamp); + */ + emit dumpHis(m_pConn,m_dbFilePath,m_pConn->databaseName(),m_tsdbFilePath,m_dumpTimestamp); } void new_his_dump_dialog::finish() @@ -218,7 +216,7 @@ void new_his_dump_dialog::on_buttonBox_clicked(QAbstractButton *button) connect(&timer,&QTimer::timeout,this,&new_his_dump_dialog::updateTime); timer.setInterval(100); timer.start(); - button->setText("取消"); + button->setText(tr("取消")); ui->buttonBox->button(QDialogButtonBox::Cancel)->setEnabled(false); ui->buttonBox->button(QDialogButtonBox::Cancel)->setDown(true); diff --git a/platform/src/dbms/db_manager/his_widgets/new_his_dump_dialog.h b/platform/src/dbms/db_manager/his_widgets/new_his_dump_dialog.h index 36cd4c33..266d84d8 100644 --- a/platform/src/dbms/db_manager/his_widgets/new_his_dump_dialog.h +++ b/platform/src/dbms/db_manager/his_widgets/new_his_dump_dialog.h @@ -1,17 +1,17 @@ #ifndef NEW_HIS_DUMP_DIALOG_H #define NEW_HIS_DUMP_DIALOG_H -#include #include #include #include #include +#include "pub_widget/CustomDialog.h" namespace Ui { class new_his_dump_dialog; } -class new_his_dump_dialog : public QDialog +class new_his_dump_dialog : public CustomUiDialog { Q_OBJECT diff --git a/platform/src/dbms/db_manager/main.cpp b/platform/src/dbms/db_manager/main.cpp index 89dd983f..e33f71d6 100644 --- a/platform/src/dbms/db_manager/main.cpp +++ b/platform/src/dbms/db_manager/main.cpp @@ -10,6 +10,7 @@ #include "pub_utility_api/I18N.h" #include "pub_utility_api/FileUtil.h" #include "pub_utility_api/SingleProcInstance.h" +#include "pub_widget/PubWidgetInit.h" using namespace iot_public; class SingleApplication; @@ -42,6 +43,8 @@ void initI8n() pTrans->load( strQmFile.c_str()); QApplication::installTranslator( pTrans ); } + + iot_public::installTranslator(strLanguage); } @@ -53,8 +56,8 @@ int main( int argc, char *argv[] ) SingleApplication a( argc, argv ); - QCoreApplication::setOrganizationName( "KbdSoft.ZHJK" ); - QCoreApplication::setOrganizationDomain( "KbdTech.com" ); + QCoreApplication::setOrganizationName( "IOT" ); + QCoreApplication::setOrganizationDomain( "iot.com" ); QCoreApplication::setApplicationName( "db_manager" ); iot_public::StartLogSystem( "PUBLIC", "db_manager" ); @@ -66,7 +69,7 @@ int main( int argc, char *argv[] ) QObject::connect( &a, &SingleApplication::instanceStarted, [&w]() { - LOGINFO( "重新打开应用程序,开始工作!" ); + LOGINFO( QObject::tr("重新打开应用程序,开始工作!").toStdString().c_str() ); w.show(); w.showNormal(); w.activateWindow(); diff --git a/platform/src/dbms/db_manager/pj_manager.cpp b/platform/src/dbms/db_manager/pj_manager.cpp index c29554dd..a5081c1c 100644 --- a/platform/src/dbms/db_manager/pj_manager.cpp +++ b/platform/src/dbms/db_manager/pj_manager.cpp @@ -1,11 +1,11 @@ #include -#include +#include "pub_widget/MessageBox.h" #include #include #include #include #include - +#include #include "pub_utility_api/I18N.h" #include "public/pub_utility_api/FileUtil.h" @@ -23,12 +23,17 @@ #include "db_set.h" #include"db_manager_common.h" #include "../db_manager_api/db_manager_api_common.h" - +#include "pub_utility_api/FileStyle.h" +#include "CCreateInfluxDBUserDlg.h" using namespace iot_public; #define INDEX_NONDB_LOG 0 #define INDEX_LOG_STACK_PROJECT 3 +const int CN_MainTabIndex_Project = 0; +const int CN_MainTabIndex_DB = 1; +const int CN_MainTabIndex_Log = 2; + quint32 getDefaultImportExportType() { @@ -55,7 +60,7 @@ enum EN_ITEM_DATA_INDEX_TYPE }; pj_manager::pj_manager(QWidget *parent) : - QMainWindow(parent), + CustomUiMainWindow(parent), ui(new Ui::pj_manager), m_his_backup_dockWidiget(NULL) { @@ -80,6 +85,8 @@ pj_manager::pj_manager(QWidget *parent) : appendTableInfoFromXml(sPlatFilePath, m_tableInfoMap ); appendTableInfoFromXml(sProdFilePath, m_tableInfoMap ); + + setTitleWidget(ui->mainmenu); } pj_manager::~pj_manager() @@ -102,30 +109,49 @@ void pj_manager::initPath() void pj_manager::loadQss() { - QString qss; - QFile qssFile(":/res/pj_manager.qss"); - qssFile.open(QFile::ReadOnly); - if (qssFile.isOpen()) + QString qss = QString(); + std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss","zh","light"); + + QFile qssfile1(QString::fromStdString(strFullPath)); + qssfile1.open(QFile::ReadOnly); + if (qssfile1.isOpen()) { - qss = QLatin1String(qssFile.readAll()); - qApp->setStyleSheet(qss); - qssFile.close(); + qss += QLatin1String(qssfile1.readAll()); + qssfile1.close(); + } + + else + { + qDebug() << "public.qss 无法打开!"; + } + + strFullPath = iot_public::CFileStyle::getPathOfStyleFile("db_manager.qss","zh","light"); + QFile qssfile2(QString::fromStdString(strFullPath)); + qssfile2.open(QFile::ReadOnly); + if (qssfile2.isOpen()) + { + qss += QLatin1String(qssfile2.readAll()); + qssfile2.close(); } else { - qDebug() << "pj_manager.qss 无法打开!"; + qDebug() << "db_manager.qss 无法打开!"; + } + + if (!qss.isEmpty()) + { + qApp->setStyleSheet(qss); } } void pj_manager::initUi() { - setWindowTitle(tr("工程管理工具")); + setWindowTitle(tr("工程管理")); #ifdef OS_LINUX setWindowIcon( QIcon( ":res/db_manager.png" ) ); #endif - ui->statusbar->hide(); - ui->menubar->hide(); +// ui->statusbar->hide(); setDisabled(); ui->listWidget_error->setUniformItemSizes(true); @@ -147,7 +173,7 @@ void pj_manager::initUi() initBackupTableWidget(); initLabels(); - ui->tabWidget_main->setCurrentIndex(0); + ui->stackedWidget_main->setCurrentIndex(CN_MainTabIndex_Project); ui->stackedWidget_project->setCurrentIndex(0); ui->stackedWidget_database->setCurrentIndex(0); ui->tab_his->setCurrentIndex(0); @@ -159,10 +185,11 @@ void pj_manager::initUi() ui->tabWidget_info->setTabIcon( 0, QIcon( ":res/msg_info.png" ) ); ui->tabWidget_info->setTabIcon( 1, QIcon( ":res/msg_error.png" ) ); - QListWidgetItem *itemSelected1 = ui->listWidget->item(0); - QListWidgetItem *itemSelected2 = ui->listWidget_db->item(0); - itemSelected1->setSelected(true); - itemSelected2->setSelected(true); + + ui->listWidget->setCurrentRow(0); + ui->listWidget_db->setCurrentRow(0); + ui->listWidget_db->item(1)->setHidden(true); //厂站复用 + ui->listWidget_db->item(2)->setHidden(true); //厂站合并 loadQss(); @@ -174,10 +201,29 @@ void pj_manager::initUi() //< 更改英文ui适配 if(isEn()) + { initEnUi(); + } initLogMngWidget(); + QPushButton* btn; + btn = new QPushButton(); + btn->setObjectName("btn_project"); + btn->setText(tr("工程管理")); + ui->memuForm->addToolBtn(btn); + + btn = new QPushButton(); + btn->setObjectName("btn_dbManager"); + btn->setText(tr("数据库管理")); + ui->memuForm->addToolBtn(btn); + + btn = new QPushButton(); + btn->setObjectName("btn_logManager"); + btn->setText(tr("日志管理")); + ui->memuForm->addToolBtn(btn); + + connect(ui->memuForm, SIGNAL(buttonClicked(int)),ui->stackedWidget_main, SLOT(setCurrentIndex(int))); } @@ -298,6 +344,8 @@ void pj_manager::onCreateTriggerDone() void pj_manager::initConnect() { + connect(ui->stackedWidget_main,SIGNAL(currentChanged(int)),this,SLOT(slotMainTableWidgetCurrentChanged(int))); + connect(m_pDma, SIGNAL(sig_showMsg(QString, int)), this, SLOT(onShowMsg(QString,int))); connect(m_pDma, SIGNAL(signalPercent(int)), this, SLOT(onSetPercent(int))); @@ -340,6 +388,7 @@ void pj_manager::initConnect() connect(this, SIGNAL(sigCreateTriggerDone()), this, SLOT(onCreateTriggerDone() ) ); connect(this, SIGNAL(sigDeploy()), this, SLOT(slotDeploy() ) ); connect(ui->listWidget_db,SIGNAL(clicked(QModelIndex)),this,SLOT(onListWidgetDbChanged(QModelIndex))); + connect(ui->listWidget_logMng,SIGNAL(clicked(QModelIndex)),this,SLOT(onListWidgetLogMngChanged(QModelIndex))); connect(ui->treeWidget, SIGNAL( customContextMenuRequested(const QPoint&)), this, SLOT( slotTreeWidgetContextMenuRequest(const QPoint&) ) ); connect(ui->treeWidget, SIGNAL( itemClicked(QTreeWidgetItem*, int)), this, SLOT( slotItemClicked(QTreeWidgetItem*, int)) ); connect(this, SIGNAL( sigSetDbProgressBar(int) ), ui->progressBar_db, SLOT( setValue(int) ) ); @@ -406,6 +455,11 @@ void pj_manager::onListWidgetDbChanged(QModelIndex index) } } +void pj_manager::onListWidgetLogMngChanged(QModelIndex) +{ + +} + void pj_manager::onShowBackup() { ui->stackedWidget_project->setCurrentIndex(0); @@ -482,7 +536,6 @@ void pj_manager::setDisabled(bool value) ui->page_backup->setDisabled(value); ui->page_update->setDisabled(value); ui->page_hisdata->setDisabled(value); - ui->menubar->setDisabled(value); ui->listWidget->setDisabled(value); if(value) pjUi = false; @@ -492,14 +545,14 @@ void pj_manager::setDisabled(bool value) void pj_manager::onConnDb() { - if(ui->tabWidget_main->currentIndex() == 0) + if(ui->stackedWidget_main->currentIndex() == CN_MainTabIndex_Project) { if(ui->stackedWidget_project->currentIndex() == 0) { int value = ui->progressBar_backup->text().split("%")[0].toInt(); if( value > 0 && value < 100 ) { - QMessageBox::warning(this, tr("警告"), tr("正在执行操作,请勿重新连接!") ); + N_MessageBox::warning(this, tr("警告"), tr("正在执行操作,请勿重新连接!") ); return; } } @@ -508,7 +561,7 @@ void pj_manager::onConnDb() int value = ui->progressBar_update->text().split("%")[0].toInt(); if( value > 0 && value < 100 ) { - QMessageBox::warning(this, tr("警告"), tr("正在执行操作,请勿重新连接!") ); + N_MessageBox::warning(this, tr("警告"), tr("正在执行操作,请勿重新连接!") ); return; } } @@ -606,7 +659,7 @@ void pj_manager::onBackup() Qt::WindowMaximizeButtonHint ); if(!ok) return; - if(ui->tabWidget_main->currentIndex() == 0 && ui->stackedWidget_project->currentIndex() == 0) + if(ui->stackedWidget_main->currentIndex() == CN_MainTabIndex_Project && ui->stackedWidget_project->currentIndex() == 0) { if(ui->radioButton_db->isChecked()) { @@ -625,10 +678,11 @@ void pj_manager::onBackup() void pj_manager::onRestore() { - if(QMessageBox::question(this,tr("恢复提醒"),tr("请确认连接的数据库所配置的所有系统已经离线,本工具只支持离线恢复,是否继续")) != QMessageBox::Yes) + if(N_MessageBox::question(this,tr("恢复提醒"),tr("请确认连接的数据库所配置的所有系统已经离线,本工具只支持离线恢复,是否继续")) + != N_MessageBox::Ok) return; - if(ui->tabWidget_main->currentIndex() == 0 && ui->stackedWidget_project->currentIndex() == 0) + if(ui->stackedWidget_main->currentIndex() == CN_MainTabIndex_Project && ui->stackedWidget_project->currentIndex() == 0) { if(ui->radioButton_db->isChecked()) { @@ -640,8 +694,9 @@ void pj_manager::onRestore() } else if(ui->radioButton_comp->isChecked()) { - QMessageBox::StandardButton resultButton = QMessageBox::information(this, "提示", "请先关闭所有系统运行程序,\n包含net_keep_alived和db_his_data_srv.\n拷贝完成后,会关闭当前软件!\n是否继续", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); - if(resultButton == QMessageBox::No) + int resultButton = N_MessageBox::information(this, tr("提示"), tr("请先关闭所有系统运行程序,\n包含net_keep_alived和db_his_data_srv.\n拷贝完成后,会关闭当前软件!\n是否继续"), + N_MessageBox::Yes | N_MessageBox::No, N_MessageBox::Yes); + if(resultButton == N_MessageBox::No) { return; } @@ -656,8 +711,8 @@ void pj_manager::backupDb() quint32 nExportType = getDefaultImportExportType(); if(!m_pDma->backupDb(m_pDbOpt, m_sDatabaseName, nExportType,m_currentBackupName)) { - QMessageBox::StandardButton resultButton = QMessageBox::information(this, tr("提示"), tr("备份失败!"), QMessageBox::Yes); - if(resultButton == QMessageBox::Yes) + int resultButton = N_MessageBox::information(this, tr("提示"), tr("备份失败!"), N_MessageBox::Yes); + if(resultButton == N_MessageBox::Yes) { emit sigSetBackupProgressBar(0); @@ -667,8 +722,8 @@ void pj_manager::backupDb() } else { - QMessageBox::StandardButton resultButton = QMessageBox::information(this, tr("提示"), tr("备份完成!"), QMessageBox::Yes); - if(resultButton == QMessageBox::Yes) + int resultButton = N_MessageBox::information(this, tr("提示"), tr("备份完成!"), N_MessageBox::Yes); + if(resultButton == N_MessageBox::Yes) { emit sigSetBackupProgressBar(0); genBakCfg(); @@ -679,7 +734,7 @@ void pj_manager::backupDb() void pj_manager::onSetPercent(int nPercent) { - int index1 = ui->tabWidget_main->currentIndex(); + int index1 = ui->stackedWidget_main->currentIndex(); if(index1 == 0) { int index2 = ui->stackedWidget_project->currentIndex(); @@ -788,11 +843,7 @@ void pj_manager::initUpdateTableWidget() void pj_manager::initLogMngWidget() { - QGridLayout* layout = new QGridLayout; - m_logMngWidget = new CLogMngWidget; - ui->page_logmng->setLayout(layout); - ui->page_logmng->layout()->addWidget(m_logMngWidget); - connect(m_logMngWidget,&CLogMngWidget::showMsg,this,&pj_manager::onShowMsg); + connect(ui->logMngWidget,&CLogMngWidget::showMsg,this,&pj_manager::onShowMsg); } void pj_manager::onRadioButtonChanged() @@ -806,8 +857,8 @@ void pj_manager::backupSimp() if(!m_pDma->backupSimp(m_pDbOpt, m_sDatabaseName, nExportType,m_currentBackupName ) ) { - QMessageBox::StandardButton resultButton = QMessageBox::information(this, tr("提示"), tr("备份失败!"), QMessageBox::Yes); - if(resultButton == QMessageBox::Yes) + int resultButton = N_MessageBox::information(this, tr("提示"), tr("备份失败!"), N_MessageBox::Yes); + if(resultButton == N_MessageBox::Yes) { emit sigSetBackupProgressBar(0); @@ -817,8 +868,8 @@ void pj_manager::backupSimp() } else { - QMessageBox::StandardButton resultButton = QMessageBox::information(this, tr("提示"), tr("备份完成!"), QMessageBox::Yes); - if(resultButton == QMessageBox::Yes) + int resultButton = N_MessageBox::information(this, tr("提示"), tr("备份完成!"), N_MessageBox::Yes); + if(resultButton == N_MessageBox::Yes) { emit sigSetBackupProgressBar(0); genBakCfg(); @@ -832,8 +883,8 @@ void pj_manager::backupComp() quint32 nExportType = getDefaultImportExportType(); if(!m_pDma->backupComp(m_pDbOpt, m_sDatabaseName, nExportType,m_currentBackupName) ) { - QMessageBox::StandardButton resultButton = QMessageBox::information(this, tr("提示"), tr("备份失败!"), QMessageBox::Yes); - if(resultButton == QMessageBox::Yes) + int resultButton = N_MessageBox::information(this, tr("提示"), tr("备份失败!"), N_MessageBox::Yes); + if(resultButton == N_MessageBox::Yes) { emit sigSetBackupProgressBar(0); @@ -843,8 +894,8 @@ void pj_manager::backupComp() } else { - QMessageBox::StandardButton resultButton = QMessageBox::information(this, tr("提示"), tr("备份完成!"), QMessageBox::Yes); - if(resultButton == QMessageBox::Yes) + int resultButton = N_MessageBox::information(this, tr("提示"), tr("备份完成!"), N_MessageBox::Yes); + if(resultButton == N_MessageBox::Yes) { emit sigSetBackupProgressBar(0); genBakCfg(); @@ -859,7 +910,7 @@ void pj_manager::restoreDb() QList ptableItem = ui->tableWidget_backup->selectedItems(); if( ptableItem.count() <= 0 ) { - QMessageBox::warning( this, tr("警告"), tr("请在备份记录中选择一项备份的工程!") ); + N_MessageBox::warning( this, tr("警告"), tr("请在备份记录中选择一项备份的工程!") ); return; } @@ -872,8 +923,8 @@ void pj_manager::restoreDb() } if( !m_pDma->restoreDb( m_pDbOpt ,m_sDatabaseName, sBackupContent, nImportType ) ) { - QMessageBox::StandardButton resultButton = QMessageBox::information(this, tr("提示"), tr("恢复失败!"), QMessageBox::Yes); - if(resultButton == QMessageBox::Yes) + int resultButton = N_MessageBox::information(this, tr("提示"), tr("恢复失败!"), N_MessageBox::Yes); + if(resultButton == N_MessageBox::Yes) { emit sigSetBackupProgressBar(0); @@ -883,8 +934,8 @@ void pj_manager::restoreDb() } else { - QMessageBox::StandardButton resultButton = QMessageBox::information(this, tr("提示"), tr("恢复成功!"), QMessageBox::Yes); - if(resultButton == QMessageBox::Yes) + int resultButton = N_MessageBox::information(this, tr("提示"), tr("恢复成功!"), N_MessageBox::Yes); + if(resultButton == N_MessageBox::Yes) { emit sigSetBackupProgressBar(0); @@ -898,7 +949,7 @@ void pj_manager::restoreSimp() QList ptableItem = ui->tableWidget_backup->selectedItems(); if( ptableItem.count() <= 0 ) { - QMessageBox::warning( this, tr("警告"), tr("请在备份记录中选择一项备份的工程!") ); + N_MessageBox::warning( this, tr("警告"), tr("请在备份记录中选择一项备份的工程!") ); return; } @@ -911,8 +962,8 @@ void pj_manager::restoreSimp() } if( !m_pDma->restoreSimp( m_pDbOpt ,m_sDatabaseName, sBackupContent, nImportType ) ) { - QMessageBox::StandardButton resultButton = QMessageBox::information(this, tr("提示"), tr("恢复失败!"), QMessageBox::Yes); - if(resultButton == QMessageBox::Yes) + int resultButton = N_MessageBox::information(this, tr("提示"), tr("恢复失败!"), N_MessageBox::Yes); + if(resultButton == N_MessageBox::Yes) { emit sigSetBackupProgressBar(0); @@ -922,8 +973,8 @@ void pj_manager::restoreSimp() } else { - QMessageBox::StandardButton resultButton = QMessageBox::information(this, tr("提示"), tr("恢复成功!"), QMessageBox::Yes); - if(resultButton == QMessageBox::Yes) + int resultButton = N_MessageBox::information(this, tr("提示"), tr("恢复成功!"), N_MessageBox::Yes); + if(resultButton == N_MessageBox::Yes) { emit sigSetBackupProgressBar(0); @@ -937,7 +988,7 @@ void pj_manager::restoreComp() QList ptableItem = ui->tableWidget_backup->selectedItems(); if( ptableItem.count() <= 0 ) { - QMessageBox::warning( this, tr("警告"), tr("请在备份记录中选择一项备份的工程!") ); + N_MessageBox::warning( this, tr("警告"), tr("请在备份记录中选择一项备份的工程!") ); return; } @@ -950,8 +1001,8 @@ void pj_manager::restoreComp() } if( !m_pDma->restoreComp( m_pDbOpt ,m_sDatabaseName, sBackupContent, nImportType ) ) { - QMessageBox::StandardButton resultButton = QMessageBox::information(this, tr("提示"), tr("恢复失败!"), QMessageBox::Yes); - if(resultButton == QMessageBox::Yes) + int resultButton = N_MessageBox::information(this, tr("提示"), tr("恢复失败!"), N_MessageBox::Yes); + if(resultButton == N_MessageBox::Yes) { emit sigSetBackupProgressBar(0); @@ -961,8 +1012,8 @@ void pj_manager::restoreComp() } else { - QMessageBox::StandardButton resultButton = QMessageBox::information(this, tr("提示"), tr("恢复成功!"), QMessageBox::Yes); - if(resultButton == QMessageBox::Yes) + int resultButton = N_MessageBox::information(this, tr("提示"), tr("恢复成功!"), N_MessageBox::Yes); + if(resultButton == N_MessageBox::Yes) { emit sigSetBackupProgressBar(0); @@ -976,7 +1027,7 @@ void pj_manager::onUpdateExe() int index = ui->tabWidget_update->currentIndex(); if( index == 0 ) { - if(QMessageBox::question(this,tr("升级提醒"),tr("升级操作将会对当前工程数据和数据库进行覆盖,请确认是否继续?")) != QMessageBox::Yes) + if(N_MessageBox::question(this,tr("升级提醒"),tr("升级操作将会对当前工程数据和数据库进行覆盖,请确认是否继续?"), N_MessageBox::Yes) != N_MessageBox::Yes) return; updateProject(); } @@ -990,7 +1041,7 @@ void pj_manager::updateProject() QList ptableItem = ui->tableWidget_update->selectedItems(); if( ptableItem.count() <= 0 ) { - QMessageBox::warning( this, tr("警告"), tr("请在备份记录中选择一项备份的工程!") ); + N_MessageBox::warning( this, tr("警告"), tr("请在备份记录中选择一项备份的工程!") ); return; } @@ -998,8 +1049,8 @@ void pj_manager::updateProject() QString sBackupContent = "/" + ptItem->text(); if(!m_pDma->updateProject(m_pDbOpt, m_sDatabaseName, sBackupContent)) { - QMessageBox::StandardButton resultButton = QMessageBox::information(this, tr("提示"), tr("升级失败!"), QMessageBox::Yes); - if(resultButton == QMessageBox::Yes) + int resultButton = N_MessageBox::information(this, tr("提示"), tr("升级失败!"), N_MessageBox::Yes); + if(resultButton == N_MessageBox::Yes) { emit sigSetUpdateProgressBar(0); initLabels(); @@ -1009,8 +1060,8 @@ void pj_manager::updateProject() } else { - QMessageBox::StandardButton resultButton = QMessageBox::information(this, tr("提示"), tr("升级成功!"), QMessageBox::Yes); - if(resultButton == QMessageBox::Yes) + int resultButton = N_MessageBox::information(this, tr("提示"), tr("升级成功!"), N_MessageBox::Yes); + if(resultButton == N_MessageBox::Yes) { emit sigSetUpdateProgressBar(0); initLabels(); @@ -1023,8 +1074,8 @@ void pj_manager::updateDatabase() { if(!m_pDma->updateDatabase(m_pDbOpt, m_sDatabaseName)) { - QMessageBox::StandardButton resultButton = QMessageBox::information(this, tr("提示"), tr("升级失败!"), QMessageBox::Yes); - if(resultButton == QMessageBox::Yes) + int resultButton = N_MessageBox::information(this, tr("提示"), tr("升级失败!"), N_MessageBox::Yes); + if(resultButton == N_MessageBox::Yes) { emit sigSetUpdateProgressBar(0); initLabels(); @@ -1033,8 +1084,8 @@ void pj_manager::updateDatabase() } else { - QMessageBox::StandardButton resultButton = QMessageBox::information(this, tr("提示"), tr("升级成功!"), QMessageBox::Yes); - if(resultButton == QMessageBox::Yes) + int resultButton = N_MessageBox::information(this, tr("提示"), tr("升级成功!"), N_MessageBox::Yes); + if(resultButton == N_MessageBox::Yes) { emit sigSetUpdateProgressBar(0); initLabels(); @@ -1151,6 +1202,7 @@ void pj_manager::slotTreeWidgetContextMenuRequest( const QPoint& ) menu.addAction( tr("删除数据服务配置"), this, SLOT( slotDeleteDatabaseServiceSet() ) ); menu.addSeparator(); menu.addAction( tr("新建数据库"), this, SLOT(onCreateDatabase() ) ); + menu.addAction( tr("新建influxDB用户") ,this , SLOT( slotCreateInflucDBUser())); } else if ( nItemType == EN_ITEM_DATABASE ) { @@ -1294,8 +1346,8 @@ void pj_manager::slotDisConnectDatabaseService() void pj_manager::slotAddDatabaseServiceSet() { db_set* pDbSet = new db_set( this ); - pDbSet->setTitle( tr("增加数据配置") ); - if ( pDbSet && pDbSet->exec() == QDialog::Accepted ) + pDbSet->setTitle( tr("增加数据库配置") ); + if ( pDbSet && pDbSet->exec() == CustomUiDialog::Accepted ) { QTreeWidgetItem* pItem = new QTreeWidgetItem; pItem->setText( 0, pDbSet->getName() ); @@ -1323,8 +1375,8 @@ void pj_manager::slotModifyDatabaseServiceSet() if ( pItem->childCount() > 0 ) { - QMessageBox::StandardButton button = QMessageBox::information( this, tr("提示"), tr("修改配置需要断开数据库连接,是否断开?"), QMessageBox::Yes, QMessageBox::No ); - if ( button == QMessageBox::StandardButton::Yes ) + int button = N_MessageBox::information( this, tr("提示"), tr("修改配置需要断开数据库连接,是否断开?"), N_MessageBox::Yes, N_MessageBox::No ); + if ( button == N_MessageBox::Yes ) slotDisConnectDatabaseService(); else return; @@ -1339,7 +1391,7 @@ void pj_manager::slotModifyDatabaseServiceSet() pDbSet->setUser( pItem->data( 0, Qt::UserRole + EN_ITEM_DATA_INDEX_USER ).toString() ); pDbSet->setPasswd( pItem->data( 0, Qt::UserRole + EN_ITEM_DATA_INDEX_PASSWD ).toString() ); - if ( pDbSet->exec() == QDialog::Accepted ) + if ( pDbSet->exec() == CustomUiDialog::Accepted ) { pItem->setText( 0, pDbSet->getName() ); pItem->setData( 0, Qt::UserRole + EN_ITEM_DATA_INDEX_DBTYPE, pDbSet->getDbType() ); @@ -1359,7 +1411,7 @@ void pj_manager::slotDeleteDatabaseServiceSet() db_opt* pDbOpt = getDbOpt( ui->treeWidget->currentItem() ); if ( pDbOpt != NULL ) { - QMessageBox::information( this, tr("提示"), tr("请先断开数据服务") ); + N_MessageBox::information( this, tr("提示"), tr("请先断开数据服务") ); return; } @@ -1389,8 +1441,8 @@ void pj_manager::slotImportBaseData() if(strLanguage.empty()) return; - QMessageBox::StandardButton resultButton = QMessageBox::information(this, tr("提示"), tr("导入基础数据将会清空原来表中的数据,是否导入?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); - if(resultButton == QMessageBox::No) + int resultButton = N_MessageBox::information(this, tr("提示"), tr("导入基础数据将会清空原来表中的数据,是否导入?"), N_MessageBox::Yes | N_MessageBox::No, N_MessageBox::Yes); + if(resultButton == N_MessageBox::No) { return; } @@ -1408,7 +1460,7 @@ void pj_manager::slotImportBaseData() } else { - QMessageBox::warning( this, tr("警告"), tr("无法打开基础数据路径!") ); + N_MessageBox::warning( this, tr("警告"), tr("无法打开基础数据路径!") ); } if( sListFile.count() == 0 ) @@ -1432,8 +1484,8 @@ void pj_manager::slotImportBaseData() void pj_manager::slotUpdateDatabase() { - QMessageBox::StandardButton button = QMessageBox::information( this, tr("提示"), tr("升级数据库将会修改表结构,确认升级?"), QMessageBox::Yes, QMessageBox::No ); - if ( button != QMessageBox::StandardButton::Yes ) + int button = N_MessageBox::information( this, tr("提示"), tr("升级数据库将会修改表结构,确认升级?"), N_MessageBox::Yes, N_MessageBox::No ); + if ( button != N_MessageBox::Yes ) return; QTreeWidgetItem* pItem = ui->treeWidget->currentItem(); @@ -1441,7 +1493,7 @@ void pj_manager::slotUpdateDatabase() return; if ( pItem->data( 0, Qt::UserRole + EN_ITEM_DATA_INDEX_ITEMTYPE ).toInt() != EN_ITEM_DATABASE ) { - QMessageBox::warning( this, tr("警告"), tr("数据库选择错误") ); + N_MessageBox::warning( this, tr("警告"), tr("数据库选择错误") ); return; } QString sDatabaseName = pItem->text( 0 ); @@ -1484,7 +1536,7 @@ bool pj_manager::slotCreateTrigger() return false; if ( pItem->data( 0, Qt::UserRole + EN_ITEM_DATA_INDEX_ITEMTYPE ).toInt() != EN_ITEM_DATABASE ) { - QMessageBox::warning( this, tr("警告"), tr("数据库选择错误") ); + N_MessageBox::warning( this, tr("警告"), tr("数据库选择错误") ); return false; } QString sDatabaseName = pItem->text( 0 ); @@ -1507,7 +1559,7 @@ bool pj_manager::slotDeleteTrigger() if ( pItem->data( 0, Qt::UserRole + EN_ITEM_DATA_INDEX_ITEMTYPE ).toInt() != EN_ITEM_DATABASE ) { - QMessageBox::warning( this, tr("警告"), tr("数据库选择错误") ); + N_MessageBox::warning( this, tr("警告"), tr("数据库选择错误") ); return false; } @@ -1527,12 +1579,12 @@ bool pj_manager::slotDeleteTrigger() void pj_manager::slotDeleteDatabase() { - QMessageBox::StandardButton button = QMessageBox::information( this, tr("提示"), tr("确认删除数据库?"), QMessageBox::Yes, QMessageBox::No ); - if ( button != QMessageBox::StandardButton::Yes ) + int button = N_MessageBox::information( this, tr("提示"), tr("确认删除数据库?"), N_MessageBox::Yes, N_MessageBox::No ); + if ( button != N_MessageBox::Yes ) return; - button = QMessageBox::information( this, tr("提示"), tr("请再次确认删除数据库?"), QMessageBox::Yes, QMessageBox::No ); - if ( button != QMessageBox::StandardButton::Yes ) + button = N_MessageBox::information( this, tr("提示"), tr("请再次确认删除数据库?"), N_MessageBox::Yes, N_MessageBox::No ); + if ( button != N_MessageBox::Yes ) return; QTreeWidgetItem* pItemService = ui->treeWidget->currentItem()->parent(); @@ -1591,7 +1643,7 @@ void pj_manager::slotExecuteSqlScript() if ( pItem->data( 0, Qt::UserRole + EN_ITEM_DATA_INDEX_ITEMTYPE ).toInt() != EN_ITEM_DATABASE ) { - QMessageBox::warning( this, tr("警告"), tr("数据库选择错误") ); + N_MessageBox::warning( this, tr("警告"), tr("数据库选择错误") ); return; } @@ -1628,7 +1680,7 @@ void pj_manager::slotDeploy() case iot_dbms::EDbType::DB_MYSQL: info.db_type = "mysql"; break; case iot_dbms::EDbType::DB_OPENGAUSS: - info.db_type = "openguass"; + info.db_type = "opengauss"; m_pDbOpt->closeDatabase(); break; case iot_dbms::EDbType::DB_KINGBASE: @@ -1636,8 +1688,8 @@ void pj_manager::slotDeploy() m_pDbOpt->closeDatabase(); break; default: - LOGERROR("不支持的数据库类型!"); - onShowMsg("初始化完整工程失败:不支持的数据库类型!",1); + LOGERROR(tr("不支持的数据库类型!").toStdString().c_str()); + onShowMsg(tr("初始化完整工程失败:不支持的数据库类型!"), 1); return; } @@ -1646,7 +1698,7 @@ void pj_manager::slotDeploy() onShowMsg(tr("开始初始化完整工程")); if(!m_pDma->initCompleteProject()) { - onShowMsg("初始化完整工程失败!",1); + onShowMsg(tr("初始化完整工程失败!"),1); } switch (m_pDbOpt->getDbType()) { @@ -1660,8 +1712,8 @@ void pj_manager::slotDeploy() m_pDbOpt->openDatabase(info.address,info.port,info.username,info.password,info.db_name); break; default: - LOGERROR("不支持的数据库类型!"); - onShowMsg("初始化完整工程失败:不支持的数据库类型!",1); + LOGERROR(tr("不支持的数据库类型!").toStdString().c_str()); + onShowMsg(tr("初始化完整工程失败:不支持的数据库类型!"),1); return; } } @@ -1878,6 +1930,13 @@ void pj_manager::appendTableInfoFromXml( const QString& sFilePath,QMapcomboBox_db_dst->currentText(); if ( sDataServiceOrg == "" ) { - QMessageBox::warning( this, tr("警告"), tr("未选择源数据服务") ); + N_MessageBox::warning( this, tr("警告"), tr("未选择源数据服务") ); return; } if ( sDataBaseOrg == "" ) { - QMessageBox::warning( this, tr("警告"), tr("未选择源数据库") ); + N_MessageBox::warning( this, tr("警告"), tr("未选择源数据库") ); return; } if ( sDataServiceDst == "" ) { - QMessageBox::warning( this, tr("警告"), tr("未选择目标数据服务") ); + N_MessageBox::warning( this, tr("警告"), tr("未选择目标数据服务") ); return; } if ( sDataBaseDst == "" ) { - QMessageBox::warning( this, tr("警告"), tr("未选择目标数据库") ); + N_MessageBox::warning( this, tr("警告"), tr("未选择目标数据库") ); return; } db_opt* pDbOpt_org = (db_opt*)ui->comboBox_sv_src->currentData( Qt::UserRole ).toULongLong(); if ( pDbOpt_org == NULL ) { - QMessageBox::warning( this, tr("警告"), tr("源数据服务未连接") ); + N_MessageBox::warning( this, tr("警告"), tr("源数据服务未连接") ); return; } db_opt* pDbOpt_dst = (db_opt*)ui->comboBox_sv_dst->currentData( Qt::UserRole ).toULongLong(); if ( pDbOpt_dst == NULL ) { - QMessageBox::warning( this, tr("警告"), tr("目标数据服务未连接") ); + N_MessageBox::warning( this, tr("警告"), tr("目标数据服务未连接") ); return; } if ( sDataServiceOrg == sDataServiceDst && sDataBaseOrg == sDataBaseDst ) { - QMessageBox::warning( this, tr("警告"), tr("源和目标不能相同") ); + N_MessageBox::warning( this, tr("警告"), tr("源和目标不能相同") ); return; } QString sSubStationSrc = ui->comboBox_station->currentText(); if ( sSubStationSrc == "" ) { - QMessageBox::warning( this, tr("警告"), tr("未选择源车站") ); + N_MessageBox::warning( this, tr("警告"), tr("未选择源车站") ); return; } int nSubStationIdSrc = ui->comboBox_station->currentData().toInt(); QString sSubSystemSrc = ui->comboBox_subsystem->currentText(); if ( sSubSystemSrc == "" ) { - QMessageBox::warning( this, tr("警告"), tr("未选择源专业") ); + N_MessageBox::warning( this, tr("警告"), tr("未选择源专业") ); return; } int nSubSystemIdSrc = ui->comboBox_subsystem->currentData().toInt(); if ( nSubSystemIdSrc <= 0 ) { - QMessageBox::warning( this, tr("警告"), tr("专业ID不正确,ID值:") + QString::number( nSubSystemIdSrc ) ); + N_MessageBox::warning( this, tr("警告"), tr("专业ID不正确,ID值:") + QString::number( nSubSystemIdSrc ) ); return; } QString sSubStationDst = ui->comboBox_station_2->currentText(); if ( sSubStationDst == "" ) { - QMessageBox::warning( this, tr("警告"), tr("未选择目标车站") ); + N_MessageBox::warning( this, tr("警告"), tr("未选择目标车站") ); return; } int nSubStationIdDst = ui->comboBox_station_2->currentData().toInt(); @@ -2244,12 +2303,79 @@ void pj_manager::slotShowBackupFolder(int row, int /*column*/) showInFolder(getBackupDir() + QDir::separator() + ui->tableWidget_backup->item(row,2)->text()); } +void pj_manager::slotMainTableWidgetCurrentChanged(int index) +{ + if(index == CN_MainTabIndex_Log) + { + ui->stackedWidget_logMng->setCurrentIndex(0); + ui->listWidget_logMng->setFocus(); + ui->listWidget_logMng->setCurrentRow(0); + } +} + +void pj_manager::slotCreateInflucDBUser() +{ + // 用户名及密码 + CCreateInfluxDBUserDlg dlg(this); + dlg.setIP(QString("127.0.0.1")); + dlg.setAdminUser(QString(EMS_DEFAULT_DATABASE)); + dlg.setUserInfo(QString("rqeh6001")); + dlg.setPassWord(QString(EMS_DEFAULT_PASSWD)); + if( dlg.exec() == QDialog::Accepted) + { + QString localhost = dlg.getIP(); + QString adminUser = dlg.getAdminUser(); + QString password = dlg.getPassWordInfo(); + QString userinfo = dlg.getUserInfo(); + if (!createInfluxDBUser(adminUser,password,localhost ,userinfo)) + { + N_MessageBox::warning( this, tr("警告"), tr("用户创建失败") ); + }else + { + N_MessageBox::information(this , tr("提示") , tr("用户创建成功")); + } + } + +} + +bool pj_manager::createInfluxDBUser(const QString &adminUser, const QString &password, const QString &host, const QString &username) +{ + bool ret = false; + QString program = "influx"; + // 构造命令参数 + QStringList arguments; + arguments << "-username" << adminUser + << "-password" << password + << "-host" << host + << "-execute" + << QString("create user %1 with password '%2' with all privileges").arg(username, EMS_DEFAULT_PASSWD); + + QProcess process; + process.start(program, arguments); + if (!process.waitForFinished(-1)) { + LOGERROR( "Failed to execute command: %s" , process.errorString().toStdString().c_str() ); + return ret; + } + + // 检查命令输出 + QString output = process.readAllStandardOutput(); + QString errorOutput = process.readAllStandardError(); + if (!errorOutput.isEmpty()) { + LOGERROR( "Error occurred while creating user: %s", errorOutput.toStdString().c_str()); + } else { + LOGERROR("User created successfully: %s", output.toStdString().c_str()); + ret = true; + } + + return ret; +} + bool pj_manager::databaseCheck() { db_opt* pDbOpt = getDbOpt( ui->treeWidget->currentItem() ); if ( pDbOpt == NULL ) { - QMessageBox::information( this, tr("提示"), tr("请先连接数据服务") ); + N_MessageBox::information( this, tr("提示"), tr("请先连接数据服务") ); return false; } @@ -2264,7 +2390,7 @@ bool pj_manager::databaseCheck() bool ok; sDatabaseName = QInputDialog::getText( this, tr( "新建数据库" ), tr( "数据库名:" ), QLineEdit::Normal, - "iscs6000", &ok, Qt::MSWindowsFixedSizeDialogHint | Qt::WindowTitleHint | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint ); + EMS_DEFAULT_DATABASE, &ok, Qt::MSWindowsFixedSizeDialogHint | Qt::WindowTitleHint | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint ); if ( !ok || sDatabaseName.isEmpty() ) return false; @@ -2275,7 +2401,7 @@ bool pj_manager::databaseCheck() { if ( listDatabase.at( i ).toLower() == sDatabaseName.toLower() ) { - QMessageBox::critical( this, tr("错误"), tr("已有同名数据库,创建失败") ); + N_MessageBox::critical( this, tr("错误"), tr("已有同名数据库,创建失败") ); return false; } } @@ -2286,7 +2412,7 @@ bool pj_manager::databaseCheck() ushort uni = cha.unicode(); if( uni >= 0x4E00 && uni <= 0x9FA5 ) { - QMessageBox::warning( this, tr("警告"), tr("数据库名不能为汉字") ); + N_MessageBox::warning( this, tr("警告"), tr("数据库名不能为汉字") ); return false; } } @@ -2295,13 +2421,13 @@ bool pj_manager::databaseCheck() sDatabaseName.startsWith("5") || sDatabaseName.startsWith("6") || sDatabaseName.startsWith("7") || sDatabaseName.startsWith("8") || \ sDatabaseName.startsWith("9") || sDatabaseName.startsWith("0") ) { - QMessageBox::warning( this, tr("警告"), tr("数据库名不能以数字开头") ); + N_MessageBox::warning( this, tr("警告"), tr("数据库名不能以数字开头") ); return false; } if( sDatabaseName.contains("-") ) { - QMessageBox::warning( this, tr("警告"), tr("数据库名不能包含中划线") ); + N_MessageBox::warning( this, tr("警告"), tr("数据库名不能包含中划线") ); return false; } return true; @@ -2328,23 +2454,26 @@ bool pj_manager::createDatabase() else { onShowMsg( sError, 1 ); - QMessageBox::critical( this, tr("错误"), tr("数据库创建失败") ); + N_MessageBox::critical( this, tr("错误"), tr("数据库创建失败") ); return false; } if(pDbOpt->getDbType() == iot_dbms::DB_KINGBASE ) { - sSql = "CREATE SCHEMA iscs6000;" ; + /* 为以后搜索方便,保留此注释。mysql的database实际应该对应schema + * sSql = QString("CREATE SCHEMA %1;").arg(EMS_DEFAULT_DATABASE) ; + */ + sSql = QString("CREATE SCHEMA %1;").arg(sDatabaseName) ; if(!pDbOpt->switchDatabase(sDatabaseName)) { - QMessageBox::critical( this, tr("错误"), tr("无法切换到数据库") ); + N_MessageBox::critical( this, tr("错误"), tr("无法切换到数据库") ); return false; } if( !pDbOpt->executeSql( sSql, sError ) ) { onShowMsg( sError, 1 ); - QMessageBox::critical( this, tr("错误"), tr("模式创建失败") ); + N_MessageBox::critical( this, tr("错误"), tr("模式创建失败") ); return false; } } @@ -2361,9 +2490,9 @@ void pj_manager::initHisMng() connect(m_pHisMng,& iot_dbms::CHisMngApi::error,this,&pj_manager::addErrMsg); connect(this,&pj_manager::optimizeDbSpace,m_pHisMng,& iot_dbms::CHisMngApi::optimizeDbSpace); connect(m_pHisMng,& iot_dbms::CHisMngApi::optimizeDbSpaceFinished,this,&pj_manager::handleOptimizeDbSpaceFinished); - connect(this,&pj_manager::delHisAll,m_pHisMng,& iot_dbms::CHisMngApi::delHisAll); + connect(this,&pj_manager::delHisAll,m_pHisMng,& iot_dbms::CHisMngApi::delHisAllV2); connect(m_pHisMng,& iot_dbms::CHisMngApi::delHisAllFinished,this,&pj_manager::handleDelHisAllFinished); - connect(this,&pj_manager::delHis,m_pHisMng,& iot_dbms::CHisMngApi::delHis); + connect(this,&pj_manager::delHis,m_pHisMng,& iot_dbms::CHisMngApi::delHisV2); connect(m_pHisMng,& iot_dbms::CHisMngApi::delHisFinished,this,&pj_manager::handleDelHisFinished); hisWorkThread.start(); @@ -2493,7 +2622,7 @@ void pj_manager::onCreateDatabase() void pj_manager::onMsgDlg(const QString &msg) { - QMessageBox::information( this, tr("提醒"), msg ); + N_MessageBox::information( this, tr("提醒"), msg ); } void pj_manager::on_listWidget_nondb_clicked(const QModelIndex &index) @@ -2517,7 +2646,10 @@ void pj_manager::on_comboBox_product_currentTextChanged(const QString &arg1) void pj_manager::on_btn_deploy_clicked() { - if(QMessageBox::question(this,tr("部署提醒"),tr("请确认连接的数据库所配置的所有系统已经离线,\n所部署的数据库将无法恢复,请注意备份,\n是否继续?")) != QMessageBox::Yes) + if(N_MessageBox::question(this,tr("部署提醒"),tr("请确认连接的数据库所配\n" + "置的所有系统已经离线,所\n" + "部署的数据库将无法恢复,\n" + "请注意备份,是否继续?")) != N_MessageBox::Ok) return; emit sigDeploy(); } diff --git a/platform/src/dbms/db_manager/pj_manager.h b/platform/src/dbms/db_manager/pj_manager.h index a7b056c5..0574f20d 100644 --- a/platform/src/dbms/db_manager/pj_manager.h +++ b/platform/src/dbms/db_manager/pj_manager.h @@ -14,6 +14,8 @@ #include #include "db_manager_common.h" #endif +#include "pub_widget/CustomMainWindow.h" + namespace Ui { class pj_manager; @@ -29,7 +31,7 @@ struct sTableInfos using namespace iot_dbms; class CLogMngWidget; -class pj_manager : public QMainWindow +class pj_manager : public CustomUiMainWindow { Q_OBJECT @@ -65,6 +67,7 @@ signals: private slots: void onListWidgetChanged(QModelIndex); void onListWidgetDbChanged(QModelIndex); + void onListWidgetLogMngChanged(QModelIndex); void onShowBackup(); void onShowUpdate(); void onShowDeploy(); @@ -119,7 +122,10 @@ private slots: void slotPushButtonMergeClicked(); void slotShowBackupFolder(int row,int column); + void slotMainTableWidgetCurrentChanged(int index); + void slotCreateInflucDBUser(); //创建influxdb 数据库用户 + bool createInfluxDBUser(const QString &adminUser, const QString &password, const QString &host, const QString &username); //创建influxdb 数据库用户 //< 历史数据相关====================================================================================================================================================== void on_tab_his_currentChanged(int index); //历史stackwidget标签页切换 @@ -145,6 +151,7 @@ private slots: //< 转储相关 void isLocalHostPageChange();// 判断是否本地地址来决定加载转储页面 + bool isCfgExist(); void on_btn_export_cfg_clicked(); // 导出转储配置按钮 void on_btn_start_srv_clicked(); // 开始转储服务 void on_btn_close_srv_clicked(); // 关闭转储服务 @@ -277,12 +284,9 @@ private: QSet m_setHisTabls; QDockWidget* m_his_backup_dockWidiget; // 历史对象信息查看ui - CLogMngWidget* m_logMngWidget; // 日志管理ui - bool pjUi = false; //工程管理界面是否可用 bool dbUi = true; //数据管理界面是否可用 - }; #endif // PJ_MANAGER_H diff --git a/platform/src/dbms/db_manager/pj_manager.ui b/platform/src/dbms/db_manager/pj_manager.ui index 671bd739..b9698eb4 100644 --- a/platform/src/dbms/db_manager/pj_manager.ui +++ b/platform/src/dbms/db_manager/pj_manager.ui @@ -6,7 +6,7 @@ 0 0 - 893 + 995 614 @@ -14,7 +14,7 @@ MainWindow - + 0 @@ -27,1699 +27,382 @@ 0 - - - - 0 - - - - 工程管理 - - - - - - - - - 80 - 30 - - - - - 80 - 30 - - - - 连接 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 122 - 0 - - - - - 122 - 16777215 - - - - - 备份恢复 + + 0 + + + + + + + + + + + + 9 + + + 9 + + + 9 + + + 9 + + + 6 + + + + + + 0 + 0 + + + + + 16777215 + 200 + + + + QTabWidget::South + + + 0 + + + + 提示 + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + - - - true - + + + 0 + 100 + - - AlignCenter + + QListView::Static - - - - 系统升级 + + + + + + + 错误 + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QListView::Static - - - true - - - - AlignCenter - - - - - 历史数据 - - - - true - - - - AlignCenter - - - - - 典型工程 - - - - Microsoft YaHei UI - true - - - - AlignCenter - - - - - - - - - 122 - 0 - - - - - 122 - 16777215 - - - - - 日志管理 - - - - true - - - - AlignCenter - - - - - - - - - - - 1 - 1 - - - - 2 - - - - - - - 操作方式 - - - - - - - - 0 - 100 - - - - - 16777215 - 100 - - - - - - - - 2 + + + + + + + + + + 1 + + + + + + + + + + 80 + 30 + - - 4 + + + 80 + 30 + - - 4 + + 连接 - - 4 + + + + + + Qt::Horizontal - - 4 + + + 40 + 20 + + + + + + + + + + + + + 122 + 0 + + + + + 122 + 16777215 + - - - - - - 150 - 0 - - - - - 150 - 16777215 - - - - - 微软雅黑 - - - - 数据库 - - - true - - - - - - - - 150 - 0 - - - - - 150 - 16777215 - - - - - 微软雅黑 - - - - 简单模式 - - - - - - - - 150 - 0 - - - - - 150 - 16777215 - - - - - 微软雅黑 - - - - 完整模式 - - - - + + 备份恢复 + + + + 75 + true + + + + AlignCenter + - - - Qt::Horizontal + + 系统升级 + + + + 75 + true + + + + AlignCenter + + + + + 历史数据 + + + + 75 + true + + + + AlignCenter + + + + + 典型工程 + + + + Microsoft YaHei UI + 75 + true + + + + AlignCenter + + + + + + + + + + + 1 + 1 + + + + 1 + + + 2 + + + + + + + 操作方式 - + + + + + - 40 - 20 + 0 + 100 - - - - - - - - 选择数据库:只备份/恢复数据库 - - - - - - - 选择简单模式:包括数据库,还有data目录和报表 - - - - - - - 选择完整模式:包括数据库,data,可执行文件和报表 - - - - - - - - - - - - 备份记录 - - - - - - - - 备份日期 - - - - - 备份数据库 - - - - - 备份目录 - - - - - - - - 6 - - - - - 0 - - - false - - - - - - - - 80 - 30 - - - - - 80 - 30 - - - - 备份 - - - - - - - - 80 - 30 - - - - - 80 - 30 - - - - 恢复 - - - - - - - - - - - - - - - - - 0 + + + 16777215 + 100 + + + + + + + + 2 - - - 完整升级 - - - - - - - - - - - - - - 0 - 0 - - - - - 50 - 20 - - - - - Microsoft YaHei - - - - 开始 - - - Qt::AlignCenter - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 0 - 0 - - - - 2 - - - Qt::Vertical - - - - - - - - - - 0 - 0 - - - - - 0 - 15 - - - - - 16777215 - 15 - - - - 导入文件(包括工程数据组态图形趋势) - - - - - - - - 0 - 0 - - - - - 0 - 15 - - - - - 16777215 - 15 - - - - 导入数据库脚本 - - - - - - - - 0 - 0 - - - - - 0 - 15 - - - - - 16777215 - 15 - - - - 删除触发器、存储过程、函数 - - - - - - - - 0 - 15 - - - - - 16777215 - 15 - - - - 升级数据库表结构 - - - - - - - - 0 - 15 - - - - - 16777215 - 15 - - - - 导入基础数据 - - - - - - - - 0 - 15 - - - - - 16777215 - 15 - - - - 创建触发器、存储过程、函数 - - - - - - - - - - - - 0 - 0 - - - - - 50 - 20 - - - - - Microsoft YaHei - - - - 结束 - - - Qt::AlignCenter - - - - - - - - - - 备份日期 - - - - - 备份目录 - - - - - - - - - - - 数据库升级 - - - - - - - - - 50 - 20 - - - - - Microsoft YaHei - - - - 开始 - - - Qt::AlignCenter - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 0 - 0 - - - - 2 - - - Qt::Vertical - - - - - - - - - - 0 - 15 - - - - - 16777215 - 15 - - - - 删除触发器、存储过程、函数 - - - - - - - - 0 - 15 - - - - - 16777215 - 15 - - - - 升级数据库表结构 - - - - - - - - 0 - 15 - - - - - 16777215 - 15 - - - - 导入基础数据 - - - - - - - - 0 - 15 - - - - - 16777215 - 15 - - - - 创建触发器、存储过程、函数 - - - - - - - - - - - - - - 50 - 20 - - - - - Microsoft YaHei - - - - 结束 - - - Qt::AlignCenter - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - - - - 0 + + 4 - - false + + 4 - - - - - - - 80 - 30 - + + 4 - - - 80 - 30 - + + 4 - - 升级 - - - - - - - - - - - - - 3 - - - 3 - - - 3 - - - 3 - - - - - 1 - - - true - - - - 备份 - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 新增备份 - - - - - - - 删除备份 - - - - - - - 导入备份 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 4 - 0 - - - - - 名称 - - - - - 备份类型 - - - - - 备份大小 - - - - - - - - - - - 自动清理 - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - + - - - 服务配置管理 - - - - 3 - - - 3 - - - 3 - - - - - - - 磁盘触发 - - - - 3 - - - 3 - - - 3 - - - - - - - 容量大于 - - - - - - - 90 - - - - - - - % - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 磁盘占用 - - - - - - - 0 - - - - - - - % - - - - - - - 查询 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - 服务启动后总会检查磁盘容量 -大于上述容量设定值后仅执行清理过程 - - - Qt::PlainText - - - true - - - - - - - - - - 时间触发 - - - true - - - - 3 - - - 3 - - - 3 - - - - - - - - 0 - 0 - - - - 星期 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - QDateTimeEdit::HourSection - - - hh:mm - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 触发 - - - - - - - - 备份和清理 - - - - - 仅清理 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - - - 处理 - - - - - - - - 0 - 0 - - - - 0 - - - 10000 - - - 730 - - - - - - - 天前的数据 - - - - - - - Qt::Horizontal - - - - 136 - 20 - - - - - - - - - - - - 应用配置 - - - - - - - Qt::Horizontal - - - - 136 - 20 - - - - - - - - - - - - - - 0 - 1 - - - - - - - 自动转储服务管理 - - - - - - - - 启动服务 - - - - - - - 关闭服务 - - - - - - - min-width: 120px; - - - - 设置服务自启动 - - - - - - - min-width: 120px; - - - - 关闭服务自启动 - - - - - - - - - Qt::Horizontal - - - - 136 - 20 - - - - - - - - - - 开启状态: - - - - - - - 关闭 - - - - - - - 是否自启动: - - - - - - - - - - - - - - - - Qt::Horizontal - - - - 251 - 20 - - - - - - - - - - - Qt::Vertical - - + + - 20 - 125 + 150 + 0 - - - - - - - - - - font: 20pt "微软雅黑"; + + + 150 + 16777215 + + + + + 微软雅黑 + - 请连接本地数据库 + 数据库 + + + true - - - - Qt::Vertical - - + + + - 20 - 40 + 150 + 0 - + + + 150 + 16777215 + + + + + 微软雅黑 + + + + 简单模式 + + + + + + + + 150 + 0 + + + + + 150 + 16777215 + + + + + 微软雅黑 + + + + 完整模式 + + - - - - - - - - 手动清理 - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 0 - 70 - - - - 全部删除 - - - true - - - - - - - 0 - 0 - - - - 将删除该数据库内的所有历史数据(事件,采样数据,趋势) - - - Qt::RichText - - - - - - - - - - - 0 - 1 - - - - 部分删除 - - - true - - - false - - - - - - - - - - 将删除选择日期之前的历史数据(事件,采样数据,趋势) - - - - - - - yyyy/M/d hh:mm:ss - - - true - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - 开始清理 - - - + Qt::Horizontal @@ -1731,597 +414,77 @@ + + + + + + 选择数据库:只备份/恢复数据库 + + + + + + + 选择简单模式:包括数据库,还有data目录和报表 + + + + + + + 选择完整模式:包括数据库,data,可执行文件和报表 + + + + + - - - - - Qt::Vertical - - - - 20 - 221 - - - - - - - - 表空间相关 - - - - - - - - - - 当前历史事件表占用磁盘总大小: - - - - - - - GB - - - - - - - - - 查询 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 清理表空间 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - + + + + + + 备份记录 + + + + + + - + 备份日期 - - - - - - - - - - - - - - - - - 产品 - - - - - - - - - - 项目 - - - - - - - - - - 开始部署 - - - - - - - - - Qt::Horizontal - - - - 459 - 20 - - - - - - - - Qt::Vertical - - - - 20 - 260 - - - - - - - - - - - - - 数据库管理 - - - - - - - - - 122 - 0 - - - - - 122 - 16777215 - - - - - 数据库表 - - - - Microsoft YaHei UI - true - - - - AlignCenter - - - - - 厂站复用 - - - - Microsoft YaHei UI - true - - - - AlignCenter - - - - - 厂站合并 - - - - Microsoft YaHei UI - true - - - - AlignCenter - - - - - - - - - 200 - 0 - - - - - 180 - 16777215 - - - - - 数据服务列表 - - - - - - - - 2 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - 0 - - - false - - - - - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 3 - - - - - 步骤1:选择源数据库 - - - - 0 - - - 0 - - - 0 - - - 0 - + + + + 备份数据库 + + + + + 备份目录 + + + + + + - 3 + 6 - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - 数据服务 - - - - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - 数据库 - - - - - - - - - - - - - - - 步骤2:选择目标数据库 - - - - 0 - - - 0 - - - 0 - - - 0 - - - 3 - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - 数据服务 - - - - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - 数据库 - - - - - - - - - - - - - - - - 0 - 0 - - - - 步骤3:选择源位置 - - - - 0 - - - 0 - - - 0 - - - 0 - - - 3 - - - - - - 60 - 0 - + + + + 0 - - - 60 - 16777215 - - - - 位置 + + false - - - - - - - - - - 步骤4:选择专业 - - - - 0 - - - 0 - - - 0 - - - 0 - - - 3 - - - - - - 50 - 0 - - - - - 50 - 16777215 - - - - 专业 - - - - - - - - - - - - - 0 - - - false - - - - - - - 步骤5:配置和执行 - - - - 0 - - - 0 - - - 0 - - - 0 - - - 3 - - - + + 80 @@ -2331,55 +494,1638 @@ 80 - 31 + 30 - 执行 + 备份 - - - - Qt::Horizontal - - + + + - 40 - 20 + 80 + 30 - + + + 80 + 30 + + + + 恢复 + + - - - - Qt::Horizontal + + + + + + + + + + + + + + 0 + + + + 完整升级 + + + + + + + + + + + + + + 0 + 0 + + + + + 50 + 20 + + + + + Microsoft YaHei + + + + 开始 + + + Qt::AlignCenter + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 0 + 0 + + + + 2 + + + Qt::Vertical + + + + + + + + + + 0 + 0 + + + + + 0 + 15 + + + + + 16777215 + 15 + + + + 导入文件(包括工程数据组态图形趋势) + + + + + + + + 0 + 0 + + + + + 0 + 15 + + + + + 16777215 + 15 + + + + 导入数据库脚本 + + + + + + + + 0 + 0 + + + + + 0 + 15 + + + + + 16777215 + 15 + + + + 删除触发器、存储过程、函数 + + + + + + + + 0 + 15 + + + + + 16777215 + 15 + + + + 升级数据库表结构 + + + + + + + + 0 + 15 + + + + + 16777215 + 15 + + + + 导入基础数据 + + + + + + + + 0 + 15 + + + + + 16777215 + 15 + + + + 创建触发器、存储过程、函数 + + + + + + + + + + + + 0 + 0 + + + + + 50 + 20 + + + + + Microsoft YaHei + + + + 结束 + + + Qt::AlignCenter + + + + + + + + + + 备份日期 + + + + + 备份目录 + + + + + + + + + + + 数据库升级 + + + + + + + + + 50 + 20 + + + + + Microsoft YaHei + + + + 开始 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 0 + 0 + + + + 2 + + + Qt::Vertical + + + + + + + + + + 0 + 15 + + + + + 16777215 + 15 + + + + 删除触发器、存储过程、函数 + + + + + + + + 0 + 15 + + + + + 16777215 + 15 + + + + 升级数据库表结构 + + + + + + + + 0 + 15 + + + + + 16777215 + 15 + + + + 导入基础数据 + + + + + + + + 0 + 15 + + + + + 16777215 + 15 + + + + 创建触发器、存储过程、函数 + + + + + + + + + + + + + + 50 + 20 + + + + + Microsoft YaHei + + + + 结束 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + + + 0 + + + false + + + + + + + + 80 + 30 + + + + + 80 + 30 + + + + 升级 + + + + + + + + + + + + + 3 + + + 3 + + + 3 + + + 3 + + + + + 1 + + + true + + + + 备份 + + + + 0 - - - 40 - 20 - + + 0 - + + 0 + + + 0 + + + + + + + 新增备份 + + + + + + + 删除备份 + + + + + + + 导入备份 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 4 + 0 + + + + + 名称 + + + + + 备份类型 + + + + + 备份大小 + + + + + + + + + + + 自动清理 + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 1 + + + + + + + 服务配置管理 + + + + 3 + + + 3 + + + 3 + + + + + + + 磁盘触发 + + + + 3 + + + 3 + + + 3 + + + + + + + 容量大于 + + + + + + + 90 + + + + + + + % + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 磁盘占用 + + + + + + + 0 + + + + + + + % + + + + + + + 查询 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 服务启动后总会检查磁盘容量 +大于上述容量设定值后仅执行清理过程 + + + Qt::PlainText + + + true + + + + + + + + + + 时间触发 + + + true + + + + 3 + + + 3 + + + 3 + + + + + + + + 0 + 0 + + + + 星期 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + QDateTimeEdit::HourSection + + + hh:mm + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 触发 + + + + + + + + 备份和清理 + + + + + 仅清理 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + + 处理 + + + + + + + + 0 + 0 + + + + 0 + + + 10000 + + + 730 + + + + + + + 天前的数据 + + + + + + + Qt::Horizontal + + + + 136 + 20 + + + + + + + + + + + + 应用配置 + + + + + + + Qt::Horizontal + + + + 136 + 20 + + + + + + + + + + + + + + 0 + 1 + + + + + + + 自动转储服务管理 + + + + + + + + 启动服务 + + + + + + + 关闭服务 + + + + + + + min-width: 120px; + + + + 设置服务自启动 + + + + + + + min-width: 120px; + + + + 关闭服务自启动 + + + + + + + + + Qt::Horizontal + + + + 136 + 20 + + + + + + + + + + 开启状态: + + + + + + + 关闭 + + + + + + + 是否自启动: + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 251 + 20 + + + + + + + + + + + Qt::Vertical + + + + 20 + 125 + + + + + + + + + + + + font: 20pt "微软雅黑"; + + + 请连接本地数据库 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + 手动清理 + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 0 + 70 + + + + 全部删除 + + + true + + + + + + + 0 + 0 + + + + 将删除该数据库内的所有历史数据(事件,采样数据,趋势) + + + Qt::RichText + + + + + + + + + + + 0 + 1 + + + + 部分删除 + + + true + + + false + + + + + + + + + + 将删除选择日期之前的历史数据(事件,采样数据,趋势) + + + + + + + yyyy/M/d hh:mm:ss + + + true + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + 开始清理 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 221 + + + + + + + + 表空间相关 + + + + + + + + + + 当前历史事件表占用磁盘总大小: + + + + + + + GB + + + + + + + + + 查询 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 清理表空间 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 产品 + + + + + + + + + + 项目 + + + + + + + + + + 开始部署 + + + + + + + + + Qt::Horizontal + + + + 459 + 20 + + + + + + + + Qt::Vertical + + + + 20 + 260 + + + + + + + + + + + + + + + + + + + 122 + 0 + + + + + 122 + 16777215 + + + + + 数据库表 + + + + Microsoft YaHei UI + 75 + true + + + + AlignCenter + + + + + 厂站复用 + + + + Microsoft YaHei UI + 75 + true + + + + AlignCenter + + + + + 厂站合并 + + + + Microsoft YaHei UI + 75 + true + + + + AlignCenter + + + + + + + + + 200 + 0 + + + + + 180 + 16777215 + + + + + 数据服务列表 + + + + + + + + 2 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + 0 + + + false + + - - - - - - 0 - 0 - - - - 步骤5:选择目标位置 - - + + + + + + + + + 0 @@ -2395,158 +2141,444 @@ 3 - - - - - 60 - 0 - + + + + 步骤1:选择源数据库 - - - 60 - 16777215 - + + + 0 + + + 0 + + + 0 + + + 0 + + + 3 + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + 数据服务 + + + + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + 数据库 + + + + + + + + + + + + + + + 步骤2:选择目标数据库 - - 位置 + + + 0 + + + 0 + + + 0 + + + 0 + + + 3 + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + 数据服务 + + + + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + 数据库 + + + + + + + + + + + + + + + + 0 + 0 + + + + 步骤3:选择源位置 + + + + 0 + + + 0 + + + 0 + + + 0 + + + 3 + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + 位置 + + + + + + + + + + + + + 步骤4:选择专业 + + + + 0 + + + 0 + + + 0 + + + 0 + + + 3 + + + + + + 50 + 0 + + + + + 50 + 16777215 + + + + 专业 + + + + + + + + + + + + + 0 + + + false - - - - - 0 - 0 - + + + + 步骤5:配置和执行 + + + 0 + + + 0 + + + 0 + + + 0 + + + 3 + + + + + + 80 + 30 + + + + + 80 + 31 + + + + 执行 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 0 + 0 + + + + 步骤5:选择目标位置 + + + + 0 + + + 0 + + + 0 + + + 0 + + + 3 + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + 位置 + + + + + + + + 0 + 0 + + + + + - - + + + + + + + + + + + + + 122 + 0 + + + + + 122 + 16777215 + + + + + 日志管理 + + + + 75 + true + + + + AlignCenter + + - - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 200 - - - - QTabWidget::South - - - 0 - - - - 提示 - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - QListView::Static - + + + + + 0 + + + + + + - - - - - - 错误 - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QListView::Static - - - - - + + + - - - - 0 - 0 - 893 - 21 - - - - - 文件 - - - - - 帮助 - - - - - @@ -2571,6 +2603,24 @@
CStationReuseForm.h
1 + + CLogMngWidget + QWidget +
CLogMngWidget.h
+ 1 +
+ + MenuFrame + QWidget +
pub_widget/MenuFrame.h
+ 1 +
+ + WorkFrame + QWidget +
pub_widget/WorkFrame.h
+ 1 +
diff --git a/platform/src/dbms/db_manager/pj_manager_his/pj_manager_his.cpp b/platform/src/dbms/db_manager/pj_manager_his/pj_manager_his.cpp index 250fe22a..3ef28552 100644 --- a/platform/src/dbms/db_manager/pj_manager_his/pj_manager_his.cpp +++ b/platform/src/dbms/db_manager/pj_manager_his/pj_manager_his.cpp @@ -5,7 +5,7 @@ **/ #include -#include +#include "pub_widget/MessageBox.h" #include #include #include @@ -15,6 +15,7 @@ #include #include #include +#include #ifdef OS_WINDOWS #include @@ -39,7 +40,7 @@ void pj_manager::on_btn_his_new_bakup_clicked() { if(m_pDbOpt == NULL) { - QMessageBox::information(this,tr("提醒"),tr("请先连接数据库")); + N_MessageBox::information(this,tr("提醒"),tr("请先连接数据库")); return; } new_his_backup_dialog new_bk_dialog(this); @@ -110,10 +111,10 @@ void pj_manager::on_btn_his_del_backup_clicked() { if(ui->treeWidget_hst_data->selectedItems().size() == 0) { - QMessageBox::information(this,tr("提醒"),tr("请选择备份")); + N_MessageBox::information(this,tr("提醒"),tr("请选择备份")); return; } - if(QMessageBox::question(this,tr("提醒"),tr("请确认是否删除备份") + ui->treeWidget_hst_data->selectedItems()[0]->text(0)) != QMessageBox::Yes) + if(N_MessageBox::question(this,tr("提醒"),tr("请确认是否删除备份") + ui->treeWidget_hst_data->selectedItems()[0]->text(0)) != N_MessageBox::Ok) { return; } @@ -244,7 +245,7 @@ void pj_manager::delHisBackup() if(ui->treeWidget_hst_data->selectedItems().size() > 0) { //< 确认 - if(QMessageBox::question(this,tr("删除备份"),tr("是否删除备份")+ui->treeWidget_hst_data->selectedItems()[0]->text(0)) != QMessageBox::Yes) + if(N_MessageBox::question(this,tr("删除备份"),tr("是否删除备份")+ui->treeWidget_hst_data->selectedItems()[0]->text(0)) != N_MessageBox::Ok) { return; } @@ -269,12 +270,12 @@ void pj_manager::importHisBackup() { if(ui->treeWidget_hst_data->selectedItems().size() == 0) { - QMessageBox::information(this,tr("提醒"),tr("请先选择备份对象")); + N_MessageBox::information(this,tr("提醒"),tr("请先选择备份对象")); return; } if(m_pDbOpt == NULL) { - QMessageBox::information(this,tr("提醒"),tr("请先连接数据库")); + N_MessageBox::information(this,tr("提醒"),tr("请先连接数据库")); return; } @@ -345,13 +346,13 @@ bool pj_manager::isLocalhost(const QString& addr) QString pj_manager::getHisDumpSrvWeekday(const QString& weekday) { - if(weekday == "日") return "7"; - if(weekday == "一") return "1"; - if(weekday == "二") return "2"; - if(weekday == "三") return "3"; - if(weekday == "四") return "4"; - if(weekday == "五") return "5"; - if(weekday == "六") return "6"; + if(weekday == tr("日")) return "7"; + if(weekday == tr("一")) return "1"; + if(weekday == tr("二")) return "2"; + if(weekday == tr("三")) return "3"; + if(weekday == tr("四")) return "4"; + if(weekday == tr("五")) return "5"; + if(weekday == tr("六")) return "6"; return "0"; } @@ -366,8 +367,8 @@ QString pj_manager::getHisDumpSrvType(bool ischecked) QString pj_manager::getHisDumpSrvAction(const QString& type) { - if(type == "备份和清理") return "1"; - if(type == "仅清理") return "2"; + if(type == tr("备份和清理")) return "1"; + if(type == tr("仅清理")) return "2"; return "0"; } @@ -375,25 +376,25 @@ QString pj_manager::getHisDumpSrvWeekday(int weekday) { switch (weekday) { case 1: - return "一"; + return tr("一"); break; case 2: - return "二"; + return tr("二"); break; case 3: - return "三"; + return tr("三"); break; case 4: - return "四"; + return tr("四"); break; case 5: - return "五"; + return tr("五"); break; case 6: - return "六"; + return tr("六"); break; case 7: - return "日"; + return tr("日"); break; default: return "0"; @@ -407,10 +408,10 @@ QString pj_manager::getHisDumpSrvAction(int action) { switch (action) { case 1: - return "备份和清理"; + return tr("备份和清理"); break; case 2: - return "仅清理"; + return tr("仅清理"); break; default: return "0"; @@ -532,7 +533,7 @@ void pj_manager::on_btn_export_cfg_clicked() QFile file( sName ); if ( file.open( QIODevice::WriteOnly ) == false ) { - onShowMsg( "打开配置文件" + sName + "失败", 1 ); + onShowMsg( tr("打开配置文件%1失败").arg(sName), 1 ); return; } QDomDocument dom; @@ -552,13 +553,14 @@ void pj_manager::on_btn_export_cfg_clicked() eleDbSet.setAttribute( "username", sCurrentUser ); eleDbSet.setAttribute( "passwd", sCurrentPasswd ); eleDbSet.setAttribute( "dbType", m_pDbOpt->getDbType() == EDbType::DB_MYSQL?"QMYSQL":"QPSQL" ); + eleDbSet.setAttribute( "dbName", m_pDbOpt->getDatabaseName() ); eleDbManagerCfg.appendChild( eleDbSet ); file.write( dom.toByteArray() ); file.close(); - QMessageBox::information(this,"提醒","配置已导出,请手动重启服务,使新配置生效"); + N_MessageBox::information(this, tr("提醒"),tr("配置已导出,请手动重启服务,使新配置生效")); } @@ -588,22 +590,22 @@ void pj_manager::addErrMsg(const QString &msg) void pj_manager::handleOptimizeDbSpaceFinished(bool result) { ui->btn_optimize_his_table->setDisabled(false); - if(result) QMessageBox::information(this,tr("提醒"),tr("表空间优化已完成")); - else QMessageBox::information(this,tr("提醒"),tr("表空间优化失败")); + if(result) N_MessageBox::information(this,tr("提醒"),tr("表空间优化已完成")); + else N_MessageBox::information(this,tr("提醒"),tr("表空间优化失败")); } void pj_manager::handleDelHisAllFinished(bool result) { ui->btn_start_trash->setDisabled(false); - if(result) QMessageBox::information(this,tr("提醒"),tr("清理全部历史数据已完成")); - else QMessageBox::information(this,tr("提醒"),tr("清理全部历史数据失败")); + if(result) N_MessageBox::information(this,tr("提醒"),tr("清理全部历史数据已完成")); + else N_MessageBox::information(this,tr("提醒"),tr("清理全部历史数据失败")); } void pj_manager::handleDelHisFinished(bool result) { ui->btn_start_trash->setDisabled(false); - if(result) QMessageBox::information(this,tr("提醒"),tr("清理历史数据已完成")); - else QMessageBox::information(this,tr("提醒"),tr("清理历史数据失败")); + if(result) N_MessageBox::information(this,tr("提醒"),tr("清理历史数据已完成")); + else N_MessageBox::information(this,tr("提醒"),tr("清理历史数据失败")); } void pj_manager::on_btn_look_table_space_size_clicked() @@ -624,7 +626,10 @@ void pj_manager::on_groupBox_exportPart_toggled(bool arg1) void pj_manager::on_btn_start_trash_clicked() { - if(QMessageBox::question(this,tr("提醒"),tr("请确认是否删除?")) != QMessageBox::Yes) + /* 为以后搜索方便,保留此注释 + * 本函数多次EMS_DEFAULT_DATABASE + */ + if(N_MessageBox::question(this,tr("提醒"),tr("请确认是否删除?")) != N_MessageBox::Ok) { return; } @@ -634,10 +639,10 @@ void pj_manager::on_btn_start_trash_clicked() { return; } - emit delHisAll(m_pDbOpt->getDatabaseConn(),m_pDbOpt->getHostName(),TSDB_DB_NAME); + emit delHisAll(m_pDbOpt->getDatabaseConn(),m_pDbOpt->getHostName(),m_pDbOpt->getDatabaseName()); } else - emit delHis(m_pDbOpt->getDatabaseConn(),m_pDbOpt->getHostName(),TSDB_DB_NAME,ui->dateTimeEdit_trash_end->dateTime().toMSecsSinceEpoch()); + emit delHis(m_pDbOpt->getDatabaseConn(),m_pDbOpt->getHostName(),m_pDbOpt->getDatabaseName(),ui->dateTimeEdit_trash_end->dateTime().toMSecsSinceEpoch()); ui->btn_start_trash->setDisabled(true); } @@ -653,7 +658,7 @@ bool pj_manager::truncateHisTbls() { QApplication::processEvents(); onShowMsg( sError, 1 ); - QMessageBox::critical( this, tr("错误"), tr("表") + sTableName + tr("删除失败:") + sError); + N_MessageBox::critical( this, tr("错误"), tr("表") + sTableName + tr("删除失败:") + sError); return false; } onShowMsg( tr("清空表: ") + sTableName ); diff --git a/platform/src/dbms/db_manager/pj_manager_his/pj_manager_his_data_srv.cpp b/platform/src/dbms/db_manager/pj_manager_his/pj_manager_his_data_srv.cpp index e4d98604..f972fb72 100644 --- a/platform/src/dbms/db_manager/pj_manager_his/pj_manager_his_data_srv.cpp +++ b/platform/src/dbms/db_manager/pj_manager_his/pj_manager_his_data_srv.cpp @@ -15,27 +15,40 @@ #include #endif +#include "pub_widget/MessageBox.h" #include "pj_manager.h" #include "ui_pj_manager.h" #include"db_manager_common.h" #include "public/pub_utility_api/FileUtil.h" +#include "setup/CommonDef.h" +bool pj_manager::isCfgExist() +{ + if( QFile::exists( getHisDumpSrvConfigPath() ) ) + { + return true; + } + return false; +} void pj_manager::on_btn_start_srv_clicked() { + if(! isCfgExist() ) + { + N_MessageBox::warning(this,tr("提醒"),tr("配置文件不存在,请导出")); + return; + } #ifdef OS_LINUX -if(QProcess::execute("pkexec systemctl start iscs6000_db_his_data_srv.service")== QProcess::NormalExit) - QMessageBox::information(this,tr("提醒"),tr("服务已开启")); +if(QProcess::execute(QString("pkexec systemctl start %1.service").arg(g_pszDBHisDataServiceName))== QProcess::NormalExit) + N_MessageBox::information(this,tr("提醒"),tr("服务已开启")); else - QMessageBox::warning(this,tr("提醒"),tr("服务开启失败")); + N_MessageBox::warning(this,tr("提醒"),tr("服务开启失败")); refreshHisSrvState(); #endif #ifdef OS_WINDOWS -const TCHAR *pszServiceName = _T("db_his_data_srv"); - //< 打开服务控制管理器 SC_HANDLE hSCM = ::OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); if (hSCM == NULL) @@ -44,7 +57,7 @@ if (hSCM == NULL) } else { - SC_HANDLE hService = ::OpenService(hSCM, pszServiceName, SERVICE_QUERY_STATUS | SERVICE_STOP | DELETE); + SC_HANDLE hService = ::OpenService(hSCM, g_pTCharDBHisDataServiceName, SERVICE_QUERY_STATUS | SERVICE_STOP | DELETE); if (NULL == hService) { @@ -53,8 +66,8 @@ else } else { - QProcess::execute("net start db_his_data_srv"); - QMessageBox::information(this,tr("提醒"),tr("服务已启动")); + QProcess::execute(QString("net start %1").arg(g_pszDBHisDataServiceName) ); + N_MessageBox::information(this,tr("提醒"),tr("服务已启动")); } ::CloseServiceHandle(hService); @@ -67,21 +80,26 @@ refreshHisSrvState(); void pj_manager::on_btn_close_srv_clicked() { + + if(! isCfgExist() ) + { + N_MessageBox::warning(this,tr("提醒"),tr("配置文件不存在,请导出")); + return; + } + #ifdef OS_LINUX -if(QProcess::execute("pkexec systemctl stop iscs6000_db_his_data_srv.service") == QProcess::NormalExit) +if(QProcess::execute(QString("pkexec systemctl stop %1.service").arg(g_pszDBHisDataServiceName)) == QProcess::NormalExit) { - QMessageBox::information(this,tr("提醒"),tr("服务已关闭")); + N_MessageBox::information(this,tr("提醒"),tr("服务已关闭")); } else { - QMessageBox::warning(this,tr("提醒"),tr("服务关闭失败")); + N_MessageBox::warning(this,tr("提醒"),tr("服务关闭失败")); } refreshHisSrvState(); #endif #ifdef OS_WINDOWS -const TCHAR *pszServiceName = _T("db_his_data_srv"); - //< 打开服务控制管理器 SC_HANDLE hSCM = ::OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); if (hSCM == NULL) @@ -90,8 +108,8 @@ if (hSCM == NULL) } else { - SC_HANDLE hService = ::OpenService(hSCM, pszServiceName, SERVICE_QUERY_STATUS | SERVICE_STOP | DELETE); - //SC_HANDLE hService = ::OpenService(hSCM, _T("iscs6000_launcher_17b5ab7"), SERVICE_QUERY_STATUS | SERVICE_STOP | DELETE); + SC_HANDLE hService = ::OpenService(hSCM, g_pTCharDBHisDataServiceName, SERVICE_QUERY_STATUS | SERVICE_STOP | DELETE); + //SC_HANDLE hService = ::OpenService(hSCM, _T("xxxx_launcher_17b5ab7"), SERVICE_QUERY_STATUS | SERVICE_STOP | DELETE); if (NULL == hService) { @@ -106,9 +124,9 @@ else { //< todo 当使用SERVICE_USER_XXX_PROCESS类型的服务注册时,停止服务存在困难 //< 此情况下服务的真实名称是注册名加上用户会话的ID,而ID是变化的,且微软没有开发获取的方法 - //< 比如真实的服务名是“iscs6000_launcher_17b5ab7”且正在运行,如果查询“iscs6000_launcher”的状态,是停止的 - //< 也无法通过停止“iscs6000_launcher”服务来停止“iscs6000_launcher_17b5ab7” - //< 删除“iscs6000_launcher”服务后,“iscs6000_launcher_17b5ab7”还可见,必须注销重新登录才会消失 + //< 比如真实的服务名是“xxxx_launcher_17b5ab7”且正在运行,如果查询“xxxx_launcher”的状态,是停止的 + //< 也无法通过停止“xxxx_launcher”服务来停止“xxxx_launcher_17b5ab7” + //< 删除“xxxx_launcher”服务后,“xxxx_launcher_17b5ab7”还可见,必须注销重新登录才会消失 if(SERVICE_STOPPED != objStatus.dwCurrentState && TRUE == ControlService(hService, SERVICE_CONTROL_STOP, &objStatus)) @@ -131,7 +149,7 @@ else if (SERVICE_STOPPED == objStatus.dwCurrentState) { - QMessageBox::information(this,tr("提醒"),tr("关闭服务成功")); + N_MessageBox::information(this,tr("提醒"),tr("关闭服务成功")); } else { @@ -156,6 +174,13 @@ refreshHisSrvState(); void pj_manager::on_btn_enable_srv_clicked() { + + if(! isCfgExist() ) + { + N_MessageBox::warning(this,tr("提醒"),tr("配置文件不存在,请导出")); + return; + } + #ifdef OS_LINUX const QString strExec = QCoreApplication::applicationDirPath() + "/db_his_data_srv"; @@ -180,16 +205,15 @@ else return; } -const char *pszSystemdCfgFile = "/tmp/iscs6000_db_his_data_srv.service"; //< 生成或修改systemd服务配置文件 { - QSettings objIniSetting(pszSystemdCfgFile, QSettings::IniFormat); + QSettings objIniSetting(g_pszDBHisDataServiceTempFile, QSettings::IniFormat); objIniSetting.setIniCodec( QTextCodec::codecForLocale() ); if (!objIniSetting.isWritable()) { onShowMsg(tr("服务配置文件不可写,请确认是否具有权限!请以root用户打开db_manager程序, ") - + pszSystemdCfgFile,1); + + g_pszDBHisDataServiceTempFile,1); return; } @@ -198,7 +222,7 @@ const char *pszSystemdCfgFile = "/tmp/iscs6000_db_his_data_srv.service"; objIniSetting.clear(); objIniSetting.beginGroup("Unit"); - objIniSetting.setValue("Description", "iscs6000_db_his_data_srv"); + objIniSetting.setValue("Description", g_pszDBHisDataServiceName); objIniSetting.setValue("After", "network.target"); objIniSetting.endGroup(); @@ -219,15 +243,14 @@ const char *pszSystemdCfgFile = "/tmp/iscs6000_db_his_data_srv.service"; if (QSettings::NoError != objIniSetting.status()) { onShowMsg(tr("写入服务配置文件失败!") - + pszSystemdCfgFile,1); + + g_pszDBHisDataServiceTempFile,1); return ; } } -//const char *pszSystemdCfgFile = "/usr/lib/systemd/system/iscs6000_db_his_data_srv.service"; - //< 设置服务开机自启动 -if (0 != system("pkexec bash -c 'cp -f /tmp/iscs6000_db_his_data_srv.service /usr/lib/systemd/system/ && systemctl daemon-reload && systemctl enable iscs6000_db_his_data_srv'")) +QString strRegAutoStartShell = QString("pkexec bash -c 'cp -f %1 %2 && systemctl daemon-reload && systemctl enable %3'").arg(g_pszDBHisDataServiceTempFile).arg(g_pszDBHisDataServiceFile).arg(g_pszDBHisDataServiceName); +if (0 != system(strRegAutoStartShell.toStdString().c_str())) { onShowMsg(tr("设置服务开机自启动失败!"),1); return; @@ -236,11 +259,10 @@ if (0 != system("pkexec bash -c 'cp -f /tmp/iscs6000_db_his_data_srv.service /u //< 刷新服务状态 refreshHisSrvState(); -QMessageBox::information(this,tr("提醒"),tr("服务已注册并设置自启动")); +N_MessageBox::information(this,tr("提醒"),tr("服务已注册并设置自启动")); #endif #ifdef OS_WINDOWS -const TCHAR *pszServiceName = _T("db_his_data_srv"); bool bRet = false; const QString strExec = QDir::toNativeSeparators (QCoreApplication::applicationDirPath() + "/db_his_data_srv.exe"); @@ -260,7 +282,7 @@ if (NULL == hSCM) else { //< 判断服务是否已存在 - SC_HANDLE hService = ::OpenService(hSCM, pszServiceName, SERVICE_QUERY_CONFIG); + SC_HANDLE hService = ::OpenService(hSCM, g_pTCharDBHisDataServiceName, SERVICE_QUERY_CONFIG); if (NULL == hService) { //< 创建服务 @@ -273,7 +295,7 @@ else //< 2、多用户登录时会启动多个实例,而实际上由于端口占用等原因,是起不来的; //< 3、本程序停止服务时存在困难,见下面unregSysService()中的注释。 hService = ::CreateService( - hSCM, pszServiceName, pszServiceName, + hSCM, g_pTCharDBHisDataServiceName, g_pTCharDBHisDataServiceName, SERVICE_ALL_ACCESS, 0x00000010/*SERVICE_WIN32_OWN_PROCESS*/, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, strExec.toStdWString().c_str(), NULL, NULL, NULL, NULL, NULL); @@ -285,7 +307,7 @@ else else { SERVICE_DESCRIPTION stSrvDesc; - TCHAR szDesc[] = _T("宏茂技术监控系统自动清除过期数据服务"); + TCHAR szDesc[] = _T("自动清除过期数据服务"); stSrvDesc.lpDescription = szDesc; if (::ChangeServiceConfig2(hService, SERVICE_CONFIG_DESCRIPTION, &stSrvDesc)) { @@ -312,18 +334,24 @@ refreshHisSrvState(); void pj_manager::on_btn_disable_srv_clicked() { + + if(! isCfgExist() ) + { + N_MessageBox::warning(this,tr("提醒"),tr("配置文件不存在,请导出")); + return; + } + + #ifdef OS_LINUX - if(QProcess::execute("pkexec systemctl disable iscs6000_db_his_data_srv.service") == QProcess::NormalExit) - QMessageBox::information(this,tr("提醒"),tr("服务已关闭自启动")); + if(QProcess::execute(QString("pkexec systemctl disable %1.service").arg(g_pszDBHisDataServiceName)) == QProcess::NormalExit) + N_MessageBox::information(this,tr("提醒"),tr("服务已关闭自启动")); else - QMessageBox::warning(this,tr("提醒"),tr("服务关闭自启动失败")); + N_MessageBox::warning(this,tr("提醒"),tr("服务关闭自启动失败")); refreshHisSrvState(); #endif #ifdef OS_WINDOWS -const TCHAR *pszServiceName = _T("db_his_data_srv"); - //< 打开服务控制管理器 SC_HANDLE hSCM = ::OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); if (hSCM == NULL) @@ -332,8 +360,8 @@ if (hSCM == NULL) } else { - SC_HANDLE hService = ::OpenService(hSCM, pszServiceName, SERVICE_QUERY_STATUS | SERVICE_STOP | DELETE); - //SC_HANDLE hService = ::OpenService(hSCM, _T("iscs6000_launcher_17b5ab7"), SERVICE_QUERY_STATUS | SERVICE_STOP | DELETE); + SC_HANDLE hService = ::OpenService(hSCM, g_pTCharDBHisDataServiceName, SERVICE_QUERY_STATUS | SERVICE_STOP | DELETE); + //SC_HANDLE hService = ::OpenService(hSCM, _T("xxxx_launcher_17b5ab7"), SERVICE_QUERY_STATUS | SERVICE_STOP | DELETE); if (NULL == hService) { @@ -348,9 +376,9 @@ else { //< todo 当使用SERVICE_USER_XXX_PROCESS类型的服务注册时,停止服务存在困难 //< 此情况下服务的真实名称是注册名加上用户会话的ID,而ID是变化的,且微软没有开发获取的方法 - //< 比如真实的服务名是“iscs6000_launcher_17b5ab7”且正在运行,如果查询“iscs6000_launcher”的状态,是停止的 - //< 也无法通过停止“iscs6000_launcher”服务来停止“iscs6000_launcher_17b5ab7” - //< 删除“iscs6000_launcher”服务后,“iscs6000_launcher_17b5ab7”还可见,必须注销重新登录才会消失 + //< 比如真实的服务名是“xxxx_launcher_17b5ab7”且正在运行,如果查询“xxxx_launcher”的状态,是停止的 + //< 也无法通过停止“xxxx_launcher”服务来停止“xxxx_launcher_17b5ab7” + //< 删除“xxxx_launcher”服务后,“xxxx_launcher_17b5ab7”还可见,必须注销重新登录才会消失 if(SERVICE_STOPPED != objStatus.dwCurrentState && TRUE == ControlService(hService, SERVICE_CONTROL_STOP, &objStatus)) @@ -407,7 +435,7 @@ void pj_manager::refreshHisSrvState() { #ifdef OS_LINUX - if (0 == QProcess::execute("systemctl is-enabled iscs6000_db_his_data_srv.service")) + if (0 == QProcess::execute(QString("systemctl is-enabled %1.service").arg(g_pszDBHisDataServiceName))) { ui->label_srv_is_enabled->setText(tr("开")); ui->label_srv_is_enabled->setStyleSheet("color: #037550"); @@ -420,7 +448,7 @@ void pj_manager::refreshHisSrvState() } - if (0 == QProcess::execute("systemctl is-active iscs6000_db_his_data_srv.service")) + if (0 == QProcess::execute(QString("systemctl is-active %1.service").arg(g_pszDBHisDataServiceName))) { ui->label_srv_is_active->setText(tr("开启")); ui->label_srv_is_active->setStyleSheet("color: #037550"); @@ -436,19 +464,18 @@ void pj_manager::refreshHisSrvState() #ifdef OS_WINDOWS - const TCHAR *pszServiceName = _T("db_his_data_srv"); SC_HANDLE hSCM = ::OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); if (NULL == hSCM) { onShowMsg(QObject::tr("打开服务管理器失败,请确认是否具有权限!建议以管理员权限打开"),1); } - if (4 == GetServiceStatus(pszServiceName)) + if (4 == GetServiceStatus(g_pTCharDBHisDataServiceName)) { ui->label_srv_is_active->setText(tr("开启")); ui->label_srv_is_active->setStyleSheet("color: #037550"); } - else if(1 == GetServiceStatus(pszServiceName)) + else if(1 == GetServiceStatus(g_pTCharDBHisDataServiceName)) { ui->label_srv_is_active->setText(tr("关闭")); ui->label_srv_is_active->setStyleSheet("color: #D74C41"); @@ -456,7 +483,7 @@ void pj_manager::refreshHisSrvState() } - SC_HANDLE hService = ::OpenService(hSCM, pszServiceName, SERVICE_QUERY_CONFIG); + SC_HANDLE hService = ::OpenService(hSCM, g_pTCharDBHisDataServiceName, SERVICE_QUERY_CONFIG); if(NULL == hService) { ui->label_srv_is_enabled->setText(tr("关")); diff --git a/platform/src/dbms/db_manager/res/db_manager.ico b/platform/src/dbms/db_manager/res/db_manager.ico index 060fa3ef5e221a96a8b1acebbfb72222c8716a74..52eb2b6fa52980548382bf279d6e4b26eb2f1f95 100644 GIT binary patch literal 3198 zcmeHKJx?1!5PcRDkw76*B2qYll#x=pNIKk6ASER&5(P*pDJW84ap$B+ks?J3N`3-A zz?NLlL~`M;A_bNxC@2z%f`Y=lXWtyFJI5dE51O1cp1qmfc{4jRyEc&FC;JNgevSQQ zU=_d{QkL|dB)OhEbW34z;!)DXJ$nEbHT9~W*v{={O57a)I!`fLVPS0 zu-FK&H}zTya7&xj$Zo~zSDdn&T7XN^De2Ed*tAnE^ctqw>y1Mfs~KSTR{<|1YaJs; zEcq4h!SSIrRX!!V?;7qO{)dSUhQR3X;3VF{P^&Lf*8*ALdp zf#UMPYkk3nVHl^alIyo{O=nzn>dqNuY-?Sf^jYt&USsvcDE8estl{0H9mV0!;kcBV zQ^e=QoQM1muF)Ib0iVpC>Rq`@gJ(>NeZ2l+ zk9cD_{iT`~xv|miN#huAC1d=)d5ZI?bB=q{iu{ew!>HbFquiN3UgsU3)sOm{=Yw#j z5y!;-m|u^~C#=(v^Aq7*%w^vKoDs*czBh_EN>PY!PVAMGzTcXJOm`~l>4{;v_k;CN zx8B08KiaF`Jd>W8&WF?Iz-2j nArExgz)>04DI?SViv^On-n(+?HIM%l{`IV_aMC(yqtm_z!Bm6* literal 4286 zcmciFU2D@&7zglEcCi~_y%Mi9mtOY9t?D+!6!XL*z|GW}bhXCzP_+`sX3OakR#`qQ8L zC7>M4{A;X?2S7QP{`?;B-IF<#8qcqIKpFYSE0ElKXX#QAbPl!M7g7UR@{uz=xo@=W zt=^D8dF;NNr~z5HGp!1th1bS|ia z??ftd9iv>d-dnq&fYL;n=Gsl_C(5SP>5j=L6JIyq-cmqmqFn3a6!jBj)9Q4`WR!`o zo9`xTKu2&m+x|N11NBhn9BMd6)ZzMyGttueaJvX~pdJ+G_c!M&Ks`v#p^oZNi~H2T zd=FZmrd*&tLhLtr`n}*n2o%HHuIY^&vYhW%vy)$+uC>;u$%2ne=Nvlo-NRg0;6mrU zU_UaPv#D3*^KI8=G>|19ImyQ*7aj-RZ(B=qjrNy29#BR;@+yY6v(|9AKQHZXvjNZv z@;jY7&-)v566gfUcz=Gq|D&RTPCz}`+w|X@cQCK(5O(J`ud5Jrw|mX|w0(Z}_;|fK z#+z8zKri{sAYHRe1ma diff --git a/platform/src/dbms/db_manager_api/auto/project_data_veri/tst_project_data_veri.cpp b/platform/src/dbms/db_manager_api/auto/project_data_veri/tst_project_data_veri.cpp index be794614..890fbe43 100644 --- a/platform/src/dbms/db_manager_api/auto/project_data_veri/tst_project_data_veri.cpp +++ b/platform/src/dbms/db_manager_api/auto/project_data_veri/tst_project_data_veri.cpp @@ -12,11 +12,11 @@ #define LANG_CONFIG_NAME "language.xml" -#define TEST_DB_NAME "iscs6000testdbganyuhang" +#define TEST_DB_NAME "iscs6000testdb" #define TEST_DB_IP "127.0.0.1" #define TEST_DB_PORT 3306 #define TEST_DB_USERNAME "root" -#define TEST_DB_PASSWORD "kbdct@0755" +#define TEST_DB_PASSWORD EMS_DEFAULT_PASSWD class project_data_veri : public QObject diff --git a/platform/src/dbms/db_manager_api/db_manager_api.cpp b/platform/src/dbms/db_manager_api/db_manager_api.cpp index ab63d7a6..2f296d6e 100644 --- a/platform/src/dbms/db_manager_api/db_manager_api.cpp +++ b/platform/src/dbms/db_manager_api/db_manager_api.cpp @@ -142,7 +142,7 @@ bool db_manager_api::createDatabase(SDbConnInfo db_conn, EInitProjectErr &err, Q db_conn.username, db_conn.password ) == false ) { err = DATABASE_ERR; - errTxt = tr("打开数据库:") + db_conn.address + tr("失败!"); + errTxt = tr("打开数据库:") + QString("%1:%2 %3@%4").arg(db_conn.address).arg(db_conn.port).arg(db_conn.username).arg(db_conn.password) + tr("失败!"); return false; } sig_showMsg( tr("打开数据库成功...") ); @@ -450,6 +450,7 @@ void db_manager_api::backupSimpExe() QSet setIgnorePattern; setIgnorePattern.insert("syncthing_home"); + setIgnorePattern.insert("cache"); if( !m_pFileOpt->copyFiles(m_sAllSrc, m_sAllDst,setIgnorePattern) ) { sig_showMsg(tr("拷贝文件失败!"), 1); @@ -509,6 +510,7 @@ void db_manager_api::backupCompExe() QSet setIgnorePattern; setIgnorePattern.insert("syncthing_home"); + setIgnorePattern.insert("cache"); if( !m_pFileOpt->copyFiles(m_sAllSrc, m_sAllDst,setIgnorePattern) ) { sig_showMsg(tr("拷贝文件失败!"), 1); @@ -881,16 +883,24 @@ bool db_manager_api::createTrigger(db_opt* pDbOpt, QString& sDatabaseName) return m_ret; } -bool db_manager_api::updateDatabase(db_opt* pDbOpt, QString& sDatabaseName) +bool db_manager_api::updateDatabase(db_opt* pDbOpt, QString& sDatabaseName,bool isNoWaitDlg) { m_pDbOpt = pDbOpt; m_sDatabaseName = sDatabaseName; m_ret = true; - ThreadFun fun = boost::bind(&db_manager_api::updateDatabaseExe, this); - KbdWaitPrgDlg m_WaitPrgDialog(fun); - if (m_WaitPrgDialog.exec()) + if(!isNoWaitDlg) { + ThreadFun fun = boost::bind(&db_manager_api::updateDatabaseExe, this); + KbdWaitPrgDlg m_WaitPrgDialog(fun); + if (m_WaitPrgDialog.exec()) + { + } } + else + { + updateDatabaseExe(); + } + return m_ret; } @@ -965,6 +975,54 @@ bool db_manager_api::initCompleteProjectExe() //**************获取国际化路径,同时初始化基础数据路径************************ initProjectI18NPath(); + //************************拷贝common和data目录************************************ + QString strDataDstPath = CFileUtil::getSimplePath(CFileUtil::getCurModuleDir() + "../../data" ).c_str(); + QString strDataSrcPath = CFileUtil::getSimplePath(CFileUtil::getCurModuleDir() + "../../products/").c_str(); + strDataSrcPath += QDir::separator()+m_productName + QDir::separator() + m_projectName + QDir::separator()+ "data"; + QStringList srcList; + QStringList dstList; + + QDir dbDir; + if (dbDir.exists(strDataSrcPath)) + { + dstList.append(strDataDstPath); + srcList.append(strDataSrcPath); + } + + QString strComDstPath = CFileUtil::getSimplePath(CFileUtil::getCurModuleDir() + "../../platform/common" ).c_str(); + QString strCommSrcPath2 = CFileUtil::getSimplePath(CFileUtil::getCurModuleDir() + "../../products/").c_str(); + strCommSrcPath2 += QDir::separator() + m_productName + QDir::separator() + m_projectName + QDir::separator() + "common"; + QString strCommSrcPath1 = CFileUtil::getSimplePath(CFileUtil::getCurModuleDir() + "../../products/").c_str(); + strCommSrcPath1 += QDir::separator() + m_productName + QDir::separator() + "common"; + if (dbDir.exists(strCommSrcPath1)) + { + dstList.append(strComDstPath); + srcList.append(strCommSrcPath1); + } + + if (dbDir.exists(strCommSrcPath2)) + { + dstList.append(strComDstPath); + srcList.append(strCommSrcPath2); + } + + QString strProductDstPath = CFileUtil::getSimplePath(CFileUtil::getCurModuleDir() + "../../product" ).c_str(); + QString strProductSrcPath = CFileUtil::getSimplePath(CFileUtil::getCurModuleDir() + "../../products/").c_str(); + strProductSrcPath += QDir::separator()+m_productName + QDir::separator() + m_projectName + QDir::separator()+ "product"; + if (dbDir.exists(strProductSrcPath)) + { + dstList.append(strProductDstPath); + srcList.append(strProductSrcPath); + } + + m_pFileOpt->deleteDir(strDataDstPath); + if (!m_pFileOpt->copyFiles(srcList, dstList)) + { + sig_showMsg(tr("拷贝文件失败!"), 1); + return false; + } + sig_showMsg(tr("复制文件成功...")); + //***************************创建数据库,存在删除*************************** sig_showMsg( tr("开始创建数据库...") ); if(!createDatabase(m_dbConnInfo, err, errTxt)) //创建数据库 @@ -985,16 +1043,6 @@ bool db_manager_api::initCompleteProjectExe() sig_showMsg( tr("数据库表结构升级成功...") ); - //**************************恢复旧的数据库数据,不恢复脚本和触发器******************** - sig_showMsg( tr("开始创建数据库表结构...") ); - QString strProjectPath = QStringLiteral("products") + QDir::separator() + m_productName + QDir::separator() + m_projectName+"/database" ; //增加数据库路径 - if(!restoreDatabase(strProjectPath,err, errTxt)) - { - sig_showMsg( errTxt,1); //显示错误信息 - return false; - } - sig_showMsg( tr("开始创建数据库表结构...") ); - //**********************导入Excel格式基础数据****************************** sig_showMsg( tr("开始导入基础数据...") ); m_ret = true; @@ -1006,6 +1054,16 @@ bool db_manager_api::initCompleteProjectExe() } sig_showMsg(tr( "导入基础数据完成...") ); + //**************************恢复旧的数据库数据,不恢复脚本和触发器******************** + sig_showMsg( tr("开始创建数据库表结构...") ); + QString strProjectPath = QStringLiteral("products") + QDir::separator() + m_productName + QDir::separator() + m_projectName+"/database" ; //增加数据库路径 + if(!restoreDatabase(strProjectPath,err, errTxt)) + { + sig_showMsg( errTxt,1); //显示错误信息 + return false; + } + sig_showMsg( tr("开始创建数据库表结构...") ); + //************************部署+导入触发器等******************************** sig_showMsg( tr("开始部署...") ); if(!deployToLocal(err, errTxt,0)) @@ -1027,6 +1085,8 @@ bool db_manager_api::initCompleteProjectExe() sig_showMsg( tr("初始化完整工程完成...") ); + m_pDbOpt->closeDatabase(); + sig_showMsg( tr("断开数据库链接...") ); return true; } diff --git a/platform/src/dbms/db_manager_api/db_manager_api_common.h b/platform/src/dbms/db_manager_api/db_manager_api_common.h index 26823e47..d5c0dc98 100644 --- a/platform/src/dbms/db_manager_api/db_manager_api_common.h +++ b/platform/src/dbms/db_manager_api/db_manager_api_common.h @@ -1,4 +1,4 @@ -#ifndef DB_MANAGER_API_COMMON_H +#ifndef DB_MANAGER_API_COMMON_H #define DB_MANAGER_API_COMMON_H #include "pub_utility_api/UtilityCommon.h" @@ -25,13 +25,9 @@ #define FUNC_DEFINE_FILE_KINGBASE "iscs6000_func_Kingbase.sql" -#define KINGBASE_DEFAULT_SCHEMA "iscs6000" - #define DB_MANAGER_CFG_NAME "db_manager_cfg.xml" #define CFG_MD_BACKUP "backup" #define CFG_MD_BACKUP_KEY_REPORTFILE "reportFilePath" -#define CN_PASSWD "kbdct@0755" - #endif // DB_MANAGER_API_COMMON_H diff --git a/platform/src/dbms/db_manager_api/db_opt.cpp b/platform/src/dbms/db_manager_api/db_opt.cpp index efa4ec58..aa836c63 100644 --- a/platform/src/dbms/db_manager_api/db_opt.cpp +++ b/platform/src/dbms/db_manager_api/db_opt.cpp @@ -364,44 +364,44 @@ bool db_opt::createDbNode( QString sDatabaseName ) qDebug() << "查询数据库节点出错"; return false; } - QString username; - QString port; + QString username = m_sUser; + QString port = QString("%1").arg(m_nPort); QString dbType; switch (getDbType()) { case EDbType::DB_MYSQL: - username = "root"; - port = "3306"; +// username = "root"; +// port = "3306"; dbType = "2"; break; case EDbType::DB_OPENGAUSS: - username = "iscs"; - port = "5432"; +// username = "iscs"; +// port = "5432"; dbType = "3"; break; case EDbType::DB_KINGBASE: - username = "system"; - port = "54321"; +// username = "system"; +// port = "54321"; dbType = "4"; break; default: LOGERROR("不支持的数据库类型!"); - break; + return false; } - + /* 为以后搜索方便,保留此注释 EMS_DEFAULT_PASSWD*/ QString sSql; if( querySel.next() ) { sSql = "update sys_model_dbconfig_node set DB_TYPE = '" + dbType + "', DB_SERVICE_NAME = '" + sDatabaseName + "'," \ - "USER_NAME = '" + username + "', USER_PASSWORD = '"+ CN_PASSWD + "', NIC_CUR_ID = '1', DB_NAME = '0', DB_HOST_PRIOR = '1', IS_DB_SWITCH = '1', IS_DIRECT_ACCESS = '1', DB_PORT = '"+ port +"'" \ + "USER_NAME = '" + username + "', USER_PASSWORD = '"+ m_objDb.getDbPara().getPassword() + "', NIC_CUR_ID = '1', DB_NAME = '0', DB_HOST_PRIOR = '1', IS_DB_SWITCH = '1', IS_DIRECT_ACCESS = '1', DB_PORT = '"+ port +"'" \ "where NODE_NAME = '" + QHostInfo::localHostName() + "';"; } else { sSql = "insert into sys_model_dbconfig_node (NODE_NAME,DB_TYPE,DB_SERVICE_NAME,USER_NAME,USER_PASSWORD,NIC_CUR_ID,DB_NAME,DB_HOST_PRIOR,IS_DB_SWITCH,IS_DIRECT_ACCESS,DB_PORT)" \ - "values ('" + QHostInfo::localHostName() + "','" + dbType + "','" + sDatabaseName + "','" + username + "','"+ CN_PASSWD + "','1','0','1','1','1','" + port + "');"; + "values ('" + QHostInfo::localHostName() + "','" + dbType + "','" + sDatabaseName + "','" + username + "','"+ m_objDb.getDbPara().getPassword() + "','1','0','1','1','1','" + port + "');"; } QSqlQuery query( *m_objDb.getDatabase() ); if ( query.exec( sSql ) == false ) @@ -790,7 +790,7 @@ bool db_opt::importDatabase( QString sDatabaseName, QString sFileName, quint32 n //************************导入Excel数据****************************************** - signalSendMsg( "开始导入Excel数据文件...!" ); + signalSendMsg( tr("开始导入Excel数据文件...!") ); if( nImportType & EN_IMPORT_DATA ) { QString sExcelPath = sFileName; @@ -1085,7 +1085,7 @@ bool db_opt::executeXmlFileUpdate( QString sDatabaseName) return false; } - signalSendMsg( "数据库表结构更新完成!"); + signalSendMsg(tr("数据库表结构更新完成!")); return true; } @@ -1236,7 +1236,7 @@ void db_opt::filterTable( QStringList& listTable ) if ( !QFile::exists( dir.filePath( sFilePath ) ) ) { sFilePath = ""; - signalSendMsg("数据库定义配置文件不存在", 1); + signalSendMsg(tr("数据库定义配置文件不存在"), 1); return; } } @@ -1274,6 +1274,13 @@ void db_opt::filterTable( QStringList& listTable ) if("Table" == eleTable.tagName()) { QString sTableName = eleTable.attribute("name"); + QString sUseType = eleTable.attribute("use_type"); + if(sUseType.isEmpty()) + { + eleTable = eleTable.nextSiblingElement(); + continue; //< 为空表示禁用 + } + QDomElement table_db = eleTable.firstChildElement(); while (!table_db.isNull()) { @@ -1350,6 +1357,13 @@ void db_opt::filterTable(QMap &tableOptMap) if("Table" == eleTable.tagName()) { QString sTableName = eleTable.attribute("name"); + QString sUseType = eleTable.attribute("use_type"); + if(sUseType.isEmpty()) + { + eleTable = eleTable.nextSiblingElement(); + continue; //< 为空表示禁用 + } + QDomElement table_db = eleTable.firstChildElement(); while (!table_db.isNull()) { @@ -1406,6 +1420,13 @@ bool db_opt::appendTableNeedBak(const QString& cfgFilePath, QStringList & listTa if("Table" == eleTable.tagName()) { QString sTableName = eleTable.attribute("name"); + QString sUseType = eleTable.attribute("use_type"); + if(sUseType.isEmpty()) + { + eleTable = eleTable.nextSiblingElement(); + continue; //< 为空表示禁用 + } + QDomElement table_db = eleTable.firstChildElement(); while (!table_db.isNull()) { @@ -1534,7 +1555,7 @@ bool db_opt::deleteIndex( QString& sTableName, QSqlQuery& query ) { if( !getTableIndex( sTableName, query) ) { - signalSendMsg( "deleteIndex函数获取表索引失败", 1 ); + signalSendMsg(tr("deleteIndex函数获取表索引失败"), 1 ); return false; } if( query.size() <= 0 ) @@ -1610,7 +1631,10 @@ bool db_opt::createDb(QString &dbName,QString &sError) if(getDbType() == EDbType::DB_KINGBASE) { - sSql = "CREATE SCHEMA iscs6000;"; + /* 为以后搜索方便,保留此注释。mysql的database实际应该对应schema + * sSql = QString("CREATE SCHEMA %1;").arg(EMS_DEFAULT_DATABASE); + */ + sSql = QString("CREATE SCHEMA %1;").arg(dbName); if(!switchDatabase(dbName)) { sError = tr("无法切换到数据库") ; @@ -1622,7 +1646,22 @@ bool db_opt::createDb(QString &dbName,QString &sError) } } - + if(getDbType() == EDbType::DB_OPENGAUSS) + { + /* 为以后搜索方便,保留此注释。mysql的database实际应该对应schema + * sSql = QString("CREATE SCHEMA %1;").arg(EMS_DEFAULT_DATABASE); + */ + sSql = QString("CREATE SCHEMA %1;").arg(dbName); + if(!switchDatabase(dbName)) + { + sError = tr("无法切换到数据库") ; + return false; + } + if ( !executeSql( sSql, sError ) ) + { + return false; + } + } return true; } @@ -1651,7 +1690,7 @@ void db_opt::slotDeleteTrigger( QString sDatabaseName, QString sFileName ) //先删除所有触发器,防止造成重复触发器错误 //deleteAllTrigger_impl( sDatabaseName ); - signalSendMsg( "开始执行SQL文件..." ); + signalSendMsg( tr("开始执行SQL文件...") ); QFile file( sFileName ); if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) ) { @@ -1808,7 +1847,7 @@ void db_opt::slotRecoverAllFunction( QString sDatabaseName ) bool db_opt::deleteAllTrigger_impl( QString sDatabaseName, bool getCreateTrigger ) { - signalSendMsg( "开始删除触发器..." ); + signalSendMsg( tr("开始删除触发器...") ); m_listOldTriggerName.clear(); m_listCreateTriggerString.clear(); @@ -1908,7 +1947,7 @@ bool db_opt::deleteAllProcedure_impl( QString sDatabaseName ) bool db_opt::deleteAllFunction_impl( QString sDatabaseName ) { - signalSendMsg( "开始删除函数..." ); + signalSendMsg( tr("开始删除函数...") ); m_listOldFunctionName.clear(); m_listCreateFunctionString.clear(); @@ -1991,7 +2030,7 @@ bool db_opt::recoverAllTrigger_impl( QString sDatabaseName ) bool db_opt::recoverAllProcedure_impl( QString sDatabaseName ) { - signalSendMsg( "开始恢复存储过程..." ); + signalSendMsg( tr("开始恢复存储过程...") ); // 将缺少的存储过程重新导入 QString sError = ""; @@ -2136,7 +2175,7 @@ bool db_opt::deleteVoidedTable(const QStringList &tableNameDb) return false; } sDeleteTableString = ""; - signalSendMsg("表:" + tableNameDb[i] + "删除成功!", 0); + signalSendMsg(tr("表:%1删除成功!").arg(tableNameDb[i]), 0); } return true; } @@ -2186,14 +2225,14 @@ bool db_opt::handleEleTable(const QDomElement &eleTable, const QString &sDatabas signalSendMsg(tr("重新获取表")+ sTableName +tr("的所有字段失败!"), 1); return false; } if( !updatePriKey( sDatabaseName, sTableName, xmlTableKeys ) ){ - signalSendMsg( "更新表的主键失败", 1 ); return false; + signalSendMsg( tr("更新表的主键失败"), 1 ); return false; } idxColumn += nColAdded; //调整idxColumn if( !deleteVoidedColumn( idxColumn,listXmlColumns, listColumn, sTableName) ){ - signalSendMsg( "删除多余的字段失败", 1 ); return false; + signalSendMsg( tr("删除多余的字段失败"), 1 ); return false; } if( !updateTableIndex( sTableName, normalIndex, uniqueIndex, fulltextIndex ) ){ - signalSendMsg( "更新表的索引失败", 1 ); return false; + signalSendMsg( tr("更新表的索引失败"), 1 ); return false; } return true; } @@ -2357,7 +2396,8 @@ bool db_opt::handleDbStruct(const QDomElement &databaseStruct,const QString& sDa while ( !eleTable.isNull() ) { QString sTableName = eleTable.attribute("name").toLower(); - if ( eleTable.attribute("use_type","") == "rdb" ) {// 筛选掉纯内存库表 + QString sUseType = eleTable.attribute("use_type",""); + if ( sUseType == "rdb" || sUseType.isEmpty() ) {// 筛选掉纯内存库表或者禁用的表 eleTable = eleTable.nextSiblingElement(); continue; } diff --git a/platform/src/dbms/db_manager_api/db_opt_kingbase.cpp b/platform/src/dbms/db_manager_api/db_opt_kingbase.cpp index ee96293f..f29b9451 100644 --- a/platform/src/dbms/db_manager_api/db_opt_kingbase.cpp +++ b/platform/src/dbms/db_manager_api/db_opt_kingbase.cpp @@ -2,9 +2,14 @@ #include "pub_logger_api/logger.h" #include "db_manager_api_common.h" +/* 为以后搜索方便,保留此注释 + * 将KINGBASE_DEFAULT_SCHEMA和EMS_DEFAULT_DATABASE 替换为数据库名,也就是在pgsql数据库中数据库和模式同名 + */ +//#define KINGBASE_DEFAULT_SCHEMA EMS_DEFAULT_DATABASE + using namespace iot_dbms; -const QString g_sDefaultSchema= QStringLiteral(KINGBASE_DEFAULT_SCHEMA); +//const QString g_sDefaultSchema= QStringLiteral(KINGBASE_DEFAULT_SCHEMA); db_opt_kingbase::db_opt_kingbase() { @@ -68,7 +73,7 @@ bool db_opt_kingbase::getTableName( QString sDatabaseName, QList& listTa } - QString sSql = "SELECT t.table_name, pg_catalog.obj_description(pgc.oid, 'pg_class') FROM information_schema.tables t INNER JOIN pg_catalog.pg_class pgc ON t.table_name = pgc.relname WHERE t.table_type='BASE TABLE' AND t.table_schema='" + g_sDefaultSchema + "';"; + QString sSql = "SELECT t.table_name, pg_catalog.obj_description(pgc.oid, 'pg_class') FROM information_schema.tables t INNER JOIN pg_catalog.pg_class pgc ON t.table_name = pgc.relname WHERE t.table_type='BASE TABLE' AND t.table_schema='" + m_objDb.getDbPara().getDatabaseName() + "';"; QSqlQuery query( *m_objDb.getDatabase() ); if ( query.exec( sSql ) == false ) return false; @@ -97,7 +102,7 @@ bool db_opt_kingbase::getTableName( QString sDatabaseName, QStringList& listTabl return false; } - QString sSql = "SELECT table_name FROM information_schema.tables WHERE table_schema = '"+ g_sDefaultSchema + "' AND table_type = 'BASE TABLE'"; + QString sSql = "SELECT table_name FROM information_schema.tables WHERE table_schema = '"+ m_objDb.getDbPara().getDatabaseName() + "' AND table_type = 'BASE TABLE'"; QSqlQuery query( *m_objDb.getDatabase() ); if ( query.exec( sSql ) == false ) return false; @@ -253,7 +258,7 @@ bool db_opt_kingbase::getCreateTableString( QString sDatabaseName, QString sTabl return false; } { - sSql = "SELECT * FROM show_create_table('" + g_sDefaultSchema + "', '" + sTableName + "');"; + sSql = "SELECT * FROM show_create_table('" + m_objDb.getDbPara().getDatabaseName() + "', '" + sTableName + "');"; QSqlQuery query( *m_objDb.getDatabase() ); if ( query.exec( sSql ) == false ) return false; @@ -387,7 +392,7 @@ bool db_opt_kingbase::getColumn( QString sDatabaseName, QString sTableName, QLis "FROM pg_index, pg_class, pg_attribute, pg_namespace " "WHERE pg_attribute.attnum > 0 AND " "pg_class.oid = '" + sTableName + "'::regclass " - "AND nspname = '" + g_sDefaultSchema + "' " + "AND nspname = '" + m_objDb.getDbPara().getDatabaseName() + "' " "AND pg_class.relnamespace = pg_namespace.oid " "AND pg_attribute.attrelid = pg_class.oid " "AND pg_attribute.attisdropped = false) as ts order by attnum;"; @@ -591,7 +596,7 @@ QStringList db_opt_kingbase::getMainKeys(QString sDataBase, QString sTableName) " WHERE pg_attribute.attnum > 0 AND " " pg_class.oid = '" + sTableName + "'::regclass AND " " indrelid = pg_class.oid " - " AND nspname = '" + g_sDefaultSchema + "' " + " AND nspname = '" + m_objDb.getDbPara().getDatabaseName() + "' " " AND pg_class.relnamespace = pg_namespace.oid " " AND pg_attribute.attrelid = pg_class.oid " " AND pg_attribute.attnum = any(pg_index.indkey)" @@ -633,7 +638,7 @@ bool db_opt_kingbase::getTriggerName(QString sDatabaseName, QString sTableName, listTriggerName.clear(); QString sSql = "select TRIGGER_NAME,EVENT_OBJECT_TABLE from information_schema.TRIGGERS \ - where event_object_catalog='" + g_sDefaultSchema + "' "; + where event_object_catalog='" + m_objDb.getDbPara().getDatabaseName() + "' "; if ( sTableName != "" ) sSql += "and EVENT_OBJECT_TABLE='" + sTableName + "' "; QSqlQuery query( *m_objDb.getDatabase() ); @@ -666,7 +671,7 @@ bool db_opt_kingbase::getCreateTriggerString( QString sDatabaseName, QString sTa } QString sSql = "select TRIGGER_NAME,ACTION_TIMING,EVENT_MANIPULATION,EVENT_OBJECT_TABLE,ACTION_ORIENTATION,ACTION_STATEMENT from information_schema.TRIGGERS \ - where event_object_catalog='" + g_sDefaultSchema + "' and TRIGGER_NAME = '" + sTriggerName + "' "; + where event_object_catalog='" + m_objDb.getDbPara().getDatabaseName() + "' and TRIGGER_NAME = '" + sTriggerName + "' "; if ( sTableName != "" ) sSql += " and EVENT_OBJECT_TABLE='" + sTableName + "' "; QSqlQuery query( *m_objDb.getDatabase() ); @@ -731,7 +736,7 @@ bool db_opt_kingbase::getFunctionName( QString sDatabaseName, QStringList& listF } listFunctionName.clear(); - QString sSql = "SELECT p.oid::regprocedure FROM pg_catalog.pg_namespace n JOIN pg_catalog.pg_proc p ON pronamespace = n.oid WHERE nspname = '" + g_sDefaultSchema +"';"; + QString sSql = "SELECT p.oid::regprocedure FROM pg_catalog.pg_namespace n JOIN pg_catalog.pg_proc p ON pronamespace = n.oid WHERE nspname = '" + m_objDb.getDbPara().getDatabaseName() +"';"; QSqlQuery query( *m_objDb.getDatabase() ); if ( query.exec( sSql ) == false ) return false; @@ -855,7 +860,8 @@ bool db_opt_kingbase::checkTrigger(const QString &sDatabaseName) while ( !eleTable.isNull() ) { QString sTableName = eleTable.attribute("name").toLower(); - if ( eleTable.attribute("use_type","") == "rdb" ) {// 筛选掉纯内存库表 + QString sUseType = eleTable.attribute("use_type",""); + if ( sUseType == "rdb" || sUseType.isEmpty()) {// 筛选掉纯内存库表 eleTable = eleTable.nextSiblingElement(); continue; } @@ -958,7 +964,7 @@ bool db_opt_kingbase::dropPrimaryKey(const QString &sDatabaseName, const QString QString sSql = "select concat('alter table " + sTableName + "drop constraint ', constraint_name) as my_query " + "from information_schema.table_constraints " + - "where table_schema = '" + g_sDefaultSchema + "' and table_name = '" + sTableName + + "where table_schema = '" + m_objDb.getDbPara().getDatabaseName() + "' and table_name = '" + sTableName + "' and constraint_type = 'PRIMARY KEY';"; { QSqlQuery query( *m_objDb.getDatabase() ); @@ -989,7 +995,7 @@ bool db_opt_kingbase::getTableIndex(QString &sTableName, QSqlQuery &query) QString sError; query.clear(); - QString sSql = "select indexname from pg_indexes where tablename not like 'pg%' and schemaname = '" + g_sDefaultSchema + "' and indexname not like '%_pkey' and tablename = '" + sTableName + "' ;"; + QString sSql = "select indexname from pg_indexes where tablename not like 'pg%' and schemaname = '" + m_objDb.getDbPara().getDatabaseName() + "' and indexname not like '%_pkey' and tablename = '" + sTableName + "' ;"; if ( executeSql( sSql, query, sError ) == false ) { qDebug() << "获取表索引出错"; diff --git a/platform/src/dbms/db_manager_api/db_opt_mysql.cpp b/platform/src/dbms/db_manager_api/db_opt_mysql.cpp index 89cb7856..c854ceec 100644 --- a/platform/src/dbms/db_manager_api/db_opt_mysql.cpp +++ b/platform/src/dbms/db_manager_api/db_opt_mysql.cpp @@ -984,7 +984,7 @@ bool db_opt_mysql::importSqlFileHelper(QString sFileName, quint32 nImportType, i } restoreDatabaseParameter(); file.close(); - signalSendMsg( "导入SQL文件完成...!" ); + signalSendMsg( tr("导入SQL文件完成...!") ); return true; } diff --git a/platform/src/dbms/db_manager_api/db_opt_opengauss.cpp b/platform/src/dbms/db_manager_api/db_opt_opengauss.cpp index bfa7cb94..922d7116 100644 --- a/platform/src/dbms/db_manager_api/db_opt_opengauss.cpp +++ b/platform/src/dbms/db_manager_api/db_opt_opengauss.cpp @@ -66,7 +66,7 @@ bool db_opt_opengauss::getTableName( QString sDatabaseName, QList& listT } - QString sSql = "SELECT t.table_name, pg_catalog.obj_description(pgc.oid, 'pg_class') FROM information_schema.tables t INNER JOIN pg_catalog.pg_class pgc ON t.table_name = pgc.relname WHERE t.table_type='BASE TABLE' AND t.table_schema='public';"; + QString sSql = "SELECT t.table_name, pg_catalog.obj_description(pgc.oid, 'pg_class') FROM information_schema.tables t INNER JOIN pg_catalog.pg_class pgc ON t.table_name = pgc.relname WHERE t.table_type='BASE TABLE' AND t.table_schema='" + m_objDb.getDbPara().getDatabaseName() + "';"; QSqlQuery query( *m_objDb.getDatabase() ); if ( query.exec( sSql ) == false ) return false; @@ -95,7 +95,7 @@ bool db_opt_opengauss::getTableName( QString sDatabaseName, QStringList& listTab return false; } - QString sSql = "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'"; + QString sSql = "SELECT t.table_name, pg_catalog.obj_description(pgc.oid, 'pg_class') FROM information_schema.tables t INNER JOIN pg_catalog.pg_class pgc ON t.table_name = pgc.relname WHERE t.table_type='BASE TABLE' AND t.table_schema='" + m_objDb.getDbPara().getDatabaseName() + "';"; QSqlQuery query( *m_objDb.getDatabase() ); if ( query.exec( sSql ) == false ) return false; @@ -122,7 +122,7 @@ bool db_opt_opengauss::getCreateTableString( QString sDatabaseName, QString sTab } QString sSql = - "CREATE OR REPLACE FUNCTION public.show_create_table(\n" + "CREATE OR REPLACE FUNCTION show_create_table(\n" " in_schema_name varchar,\n" " in_table_name varchar\n" ")\n" @@ -243,8 +243,8 @@ bool db_opt_opengauss::getCreateTableString( QString sDatabaseName, QString sTab " -- return the ddl\n" " RETURN v_table_ddl;\n" " END;\n" - "$$;\n" - "SELECT * FROM public.show_create_table('public', '" + sTableName + "');"; + "$$;\n"; + //"SELECT * FROM public.show_create_table('public', '" + sTableName + "');"; QSqlQuery query( *m_objDb.getDatabase() ); if ( query.exec( sSql ) == false ) @@ -376,7 +376,7 @@ bool db_opt_opengauss::getColumn( QString sDatabaseName, QString sTableName, QLi "FROM pg_index, pg_class, pg_attribute, pg_namespace " "WHERE pg_attribute.attnum > 0 AND " "pg_class.oid = '" + sTableName + "'::regclass " - "AND nspname = 'public' " + "AND nspname = '" + m_objDb.getDbPara().getDatabaseName() + "' " "AND pg_class.relnamespace = pg_namespace.oid " "AND pg_attribute.attrelid = pg_class.oid " "AND pg_attribute.attisdropped = false) order by attnum;"; @@ -569,7 +569,7 @@ QStringList db_opt_opengauss::getMainKeys(QString sDataBase, QString sTableName) " WHERE pg_attribute.attnum > 0 AND " " pg_class.oid = '" + sTableName + "'::regclass AND " " indrelid = pg_class.oid " - " AND nspname = 'public' " + " AND nspname = '" + m_objDb.getDbPara().getDatabaseName() + "' " " AND pg_class.relnamespace = pg_namespace.oid " " AND pg_attribute.attrelid = pg_class.oid " " AND pg_attribute.attnum = any(pg_index.indkey)" @@ -706,7 +706,7 @@ bool db_opt_opengauss::getFunctionName( QString sDatabaseName, QStringList& list } listFunctionName.clear(); - QString sSql = "SELECT proname FROM pg_catalog.pg_namespace n JOIN pg_catalog.pg_proc p ON pronamespace = n.oid WHERE nspname = 'public';"; + QString sSql = "SELECT p.oid::regprocedure FROM pg_catalog.pg_namespace n JOIN pg_catalog.pg_proc p ON pronamespace = n.oid WHERE nspname = '" + m_objDb.getDbPara().getDatabaseName() +"';"; QSqlQuery query( *m_objDb.getDatabase() ); if ( query.exec( sSql ) == false ) return false; @@ -863,10 +863,10 @@ bool db_opt_opengauss::dropPrimaryKey(const QString &sDatabaseName, const QStrin } - QString sSql = "select concat('alter table public." + sTableName + + QString sSql = "select concat('alter table " + sTableName + "drop constraint ', constraint_name) as my_query " + "from information_schema.table_constraints " + - "where table_schema = 'public' and table_name = '" + sTableName + + "where table_schema = '" + m_objDb.getDbPara().getDatabaseName() + "' and table_name = '" + sTableName + "' and constraint_type = 'PRIMARY KEY';"; { QSqlQuery query( *m_objDb.getDatabase() ); @@ -897,7 +897,7 @@ bool db_opt_opengauss::getTableIndex(QString &sTableName, QSqlQuery &query) QString sError; query.clear(); - QString sSql = "select indexname from pg_indexes where tablename not like 'pg%' and schemaname = 'public' and indexname not like '%_pkey' and tablename = '" + sTableName + "' ;"; + QString sSql = "select indexname from pg_indexes where tablename not like 'pg%' and schemaname = '" + m_objDb.getDbPara().getDatabaseName() + "' and indexname not like '%_pkey' and tablename = '" + sTableName + "' ;"; if ( executeSql( sSql, query, sError ) == false ) { qDebug() << "获取表索引出错"; @@ -913,7 +913,7 @@ bool db_opt_opengauss::deleteTableIndex(QString &sTableName, QSqlQuery &query) QString sError; Q_UNUSED(sTableName) - QString sSql = "drop index " + query.value("indexname").toString(); + QString sSql = "drop index " +m_objDb.getDbPara().getDatabaseName()+"."+ query.value("indexname").toString(); if ( executeSql( sSql, sError ) == false ) { qDebug() << "删除表索引出错"; @@ -950,7 +950,7 @@ bool db_opt_opengauss::createUniqueIndex(QString &sTableName, QList { QString sError; - QString sSql = "CREATE UNIQUE INDEX IN_" + sTableName.toUpper() + " ON " + sTableName + " ("; + QString sSql = "CREATE UNIQUE INDEX Un_" + sTableName.toUpper() + " ON " + sTableName + " ("; for(int i = 0; i < uniqueIndex.count(); i++) { sSql += uniqueIndex[i][0] + " "+ uniqueIndex[i][1] + ","; diff --git a/platform/src/dbms/db_manager_api/en.ts b/platform/src/dbms/db_manager_api/en.ts index 55ffe920..0f62e7b8 100644 --- a/platform/src/dbms/db_manager_api/en.ts +++ b/platform/src/dbms/db_manager_api/en.ts @@ -4,370 +4,872 @@ db_manager_api - - - + + + 导出数据库文件失败! Failed to export database file! - - - - - - + + + + + + 拷贝文件失败! Copying files failed! - - - - iscs6000_table_struct.xml不存在! - iscs6000_table_struct.xml doesn't exist! + rqeh6000_table_struct.xml不存在! + rqeh6000_table_struct.xml doesn't exist! - - iscs6000_his_event_tables.sql不存在 - iscs6000_his_event_tables.sql does not exist + rqeh6000_his_event_tables.sql不存在 + rqeh6000_his_event_tables.sql does not exist - - - - - - + + + + + 拷贝文件成功! Copying files succeeded! - 导入数据库脚本失败! - Failed to import database script! + Failed to import database script! - 部署失败! - Deployment failed! + Deployment failed! - 正在创建数据库表结构... - Creating database table structure ... + Creating database table structure ... - 数据库表结构创建出错! - Database table structure creation error! + Database table structure creation error! - 数据库表结构创建完成! - The database table structure is created! + The database table structure is created! - 正在导入基础数据... - Importing basic data ... + Importing basic data ... - 导入基础数据完成! - Importing basic data is complete! + Importing basic data is complete! - 正在导入基础工程数据... - Importing basic engineering data ... + Importing basic engineering data ... - 导入基础工程数据完成! - Import of basic engineering data is complete! + Import of basic engineering data is complete! - 正在自动化本地单机部署... - Automating local stand-alone deployment ... + Automating local stand-alone deployment ... - 自动化本地单机部署完成! - Automated local stand-alone deployment is complete! + Automated local stand-alone deployment is complete! - 正在创建触发器、存储过程、函数... - Creating triggers, stored procedures, functions ... + Creating triggers, stored procedures, functions ... - 创建触发器、存储过程、函数成功! - Create trigger, stored procedure, function succeeded! + Create trigger, stored procedure, function succeeded! - - - - + + + + 导入数据库文件失败! Failed to import database file! - - - - + + + + 数据库文件database.sql不存在! Database file database.sql does not exist! - + 执行创建任务命令失败!,命令: Failed to execute the create task command!, command: - - iscs6000_func.sql不存在! - iscs6000_func.sql does not exist! + rqeh6000_func.sql不存在! + rqeh6000_func.sql does not exist! + + + + 开始创建数据库操作句柄... + Starting to create a database operation handle... + + + + 未知的数据库类型... + Unknown database type... + + + + 开始打开数据库... + Starting to open the database... + + + + 打开数据库: + Opening the database: + + + + + 失败! + Failed! + + + + 打开数据库成功... + Successfully opened the database... + + + + 删除数据库: + Deleting the database: + + + + 失败!请检查是否有其他程序正在连接此数据库 + Failed! Please check if there are other programs currently connected to this database + + + + 创建数据库: + Creating the database: + + + + 失败: + Failed: + + + + + 创建数据库成功... + Successfully created the database... + + + + + + + 路径: + Path: + + + + + + + 不存在! + Does not exist! + + + + + 不存在 + Does not exist + + + + 开始创建参数表... + Starting to create the parameter table... + + + + 执行数据库定义配置文件失败! + Failed to execute the database definition configuration file! + + + + 创建参数表完成... + Parameter table creation completed... + + + + 开始创建历史表... + Starting to create the history table... + + + + + 执行函数定义文件失败 + Failed to execute the function definition file + + + + 创建历史表成功... + History table created successfully... + + + + + 开始导入基础数据... + Starting to import basic data... + + + + + + 导入 + Import + + + + 下的基础数据失败! + Failed to import basic data! + + + + 下基础数据导入完成... + Basic data import completed... + + + + + 下的Exl数据失败! + Failed to import Excel data! + + + + 解压 + Unzip + + + + 解压数据压缩包成功... + Successfully unzipped the data package... + + + + 未知格式的文件 + File of unknown format + + + + 开始删除触发器... + Starting to delete the trigger... + + + + 删除触发器失败! + Failed to delete the trigger! + + + + 触发器删除成功... + Trigger deleted successfully... + + + + 导入excel文件成功... + Successfully imported Excel file... + + + + + 删除文件夹 + Deleting folder + + + + 失败 + Failed + + + + 成功 + Successful + + + + 开始拷贝文件! + Starting to copy the file! + + + + 删除触发器/存储过程/函数失败! + Failed to delete the trigger/stored procedure/function! + + + + 更新数据库表结构失败! + Failed to update the database table structure! + + + + 创建触发器失败! + Failed to create the trigger! + + + + 更新触发器和存储过程失败! + Failed to update the trigger and stored procedures! + + + + 删除文件失败! + Failed to delete the file! + + + + 开始导入完整工程... + Starting to import the complete project... + + + + 复制文件成功... + Successfully copied the file... + + + + 开始创建数据库... + Starting to create the database... + + + + 开始升级数据库表结构... + Starting to upgrade the database table structure... + + + + 数据库表结构升级成功... + The database table structure was successfully upgraded... + + + + 导入基础数据完成... + Import of basic data completed... + + + + + 开始创建数据库表结构... + Starting to create the database table structure... + + + + 开始部署... + Starting deployment... + + + + 部署成功... + Deployment successful... + + + + 开始创建触发器等... + Starting to create triggers, etc... + + + + 创建触发器等成功... + Successfully created triggers, etc... + + + + 初始化完整工程完成... + Initialization of the complete project is complete... + + + + 断开数据库链接... + Disconnect the database link... + + + + 本地化部署-切换数据库失败! + Localization deployment - failed to switch databases! + + + + 本地化部署-创建域信息失败! + Localization deployment - failed to create domain information! + + + + 本地化部署-创建位置信息失败! + Localization deployment - failed to create location information! + + + + 本地化部署-创建应用部署信息失败! + Localization deployment - failed to create application deployment information! + + + + 本地化部署-创建机器节点失败! + Localization deployment - failed to create machine node! + + + + 本地化部署-应用部署失败! + Localization deployment - application deployment failed! + + + + 本地化部署-创建数据库节点失败! + Localization deployment - failed to create database node! + + + + 本地化部署-部署数据库失败! + Localization deployment - database deployment failed! db_opt - + 创建域成功... Creating a domain successfully... - + 创建车站成功... Successful station creation... - + 创建节点成功... Creating node successfully... - 创建部署信息成功... - Creating deployment information successfully... + Creating deployment information successfully... - + 创建数据库节点成功... Creating a database node successfully... - + 创建数据库域成功... Creating a database domain successfully... - - + 导出文件: Export files: - - - + + 打开导出文件失败 Failed to open export file - - 导出数据库完成! - Export database done! + + 更新部署信息成功... + Successfully updated deployment information... - + + 不能创建文件: + Cannot create file: + + + + sql执行失败: + + SQL execution failed: + + + + + +错误原因: + +Error reason: + + + + 导出数据库完成! + Database export completed! + + + + 切换数据库失败! + Failed to switch databases! + + + + 数据库操作接口打开数据库失败! The database operation interface failed to open the database! - - 开始导入数据库文件... - Start importing database files... - - - - - - 打开导入文件失败 - Failed to open import file - - - + 请选择恢复工程数据导入选项!!!! - Please select the recovery engineering data import option! + Please select the recovery project data import option!!!! - + + 删除触发器失败! - The removal of the trigger failed! + Failed to delete the trigger! - + + 开始升级表结构... + Starting to upgrade the table structure... + + + + 升级表结构失败! + Failed to upgrade the table structure! + + + + 开始升级触发器... + Starting to upgrade the triggers... + + + + 升级触发器失败! + Failed to upgrade the triggers! + + + 开始清空数据库表数据! Start emptying the database table data! - + 清空表数据失败! Emptying table data failed! - + 数据库表数据清空完成! Database table data emptying is complete! - - - - - 分隔符解析错误 - Separator resolution error + + 导入database.sql文件失败 + Failed to import the database.sql file - - 导入表: - Import tables: + + 开始导入Excel数据文件...! + - - 数据失败! - Data failed! + + 无法获取表: + Unable to obtain the table: - - 导入Excel数据文件 - Import Excel data files + + 的列数据 + 's column data - - 完成...! - Complete...! + + 文件: + File: - - 恢复触发器失败! - Recovery trigger failed! + + 无法打开 + Unable to open - - 开始导入触发器、存储过程、函数...! - Start importing triggers, stored procedures, functions...! + + 的数据...无法打开! + 's data... Unable to open! - - 导入触发器、存储过程、函数出错,出错语句: - Import triggers, stored procedures, function errors, error statements: - - - - 导入触发器、存储过程、函数完成...! - Import triggers, stored procedures, function completion...! - - - - 正在导入表: - Importing tables: - - - - 的数据... - Data... - - - - - - - - - - - - - + + + + + + + + 表: Table: - + + 的数据...导入失败! - Data... Import failed! + The data of the user... failed to import! - + 的数据...导入完成! - Data... Import is complete! + The data of the user... has been successfully imported! - - - 开始导入数据文件... - Start importing data files... + + + + + + + 无法切换数据库 + Unable to switch databases - - 出错SQL语句: - Error SQL statement: + + Excel文件 + Excel File - - -出错原因: - -Error SQL statement: + + 打开不成功!原因: + Failed to open! Reason: - - 导入数据文件完成...! - Import ing data file is done...! + + 有问题! + There is a problem! - - + + 读取数据库结构定义文件失败! + Failed to read the database structure definition file! + + + + 处理数据库结构定义文件失败! + Failed to process the database structure definition file! + + + + 数据库表结构更新完成! + + + + + 函数定义文件不存在! + The function definition file does not exist! + + + + 数据库定义配置文件不存在 + + + + + db_manager_opt.xml不存在! + db_manager_opt.xml does not exist! + + + + + DOM setContent平台失败! + DOM setContent failed on the platform! + + + + + DOM setContent产品失败! + DOM setContent for product failed! + + + + 升级表结构文件不存在: + Upgrade table structure file does not exist: + + + + 配置文件节点为空: + Configuration file node is empty: + + + + deleteIndex函数获取表索引失败 + + + + + 无法切换到数据库 + Unable to switch to the database + + + + 开始执行SQL文件... + + + + + 分隔符解析错误 + Separator parsing error + + + + 开始删除触发器... + Starting to delete the trigger... + + + + 开始删除函数... + + + + + 开始恢复存储过程... + + + + + 表:%1删除成功! + + + + + 解析索引错误,列: + Index parsing error, column: + + + + 无法处理列 + Unable to process the column + + + + 更新表的主键失败 + + + + + 删除多余的字段失败 + + + + + 更新表的索引失败 + + + + + 字段: + Field: + + + + 无法删除 + Unable to delete + + + + 的主键! + the primary key! + + + + 无法获得数据库 + Unable to obtain the database + + + + 的所有表名! + names of all tables! + + + + 无法创建表 + Unable to create the table + + + + 无法处理表 + Unable to process the table + + + + 删除多余表失败 + Failed to delete the redundant table + + + + 导入表: + Importing table: + + + + 数据失败! + Data import failed! + + + + 恢复触发器失败! + Failed to restore the trigger! + + + + 开始导入触发器、存储过程、函数...! + Starting to import triggers, stored procedures, functions...! + + + + 导入触发器、存储过程、函数出错,出错语句: + Error importing triggers, stored procedures, functions, error statement: + + + + 导入触发器、存储过程、函数完成...! + Finished importing triggers, stored procedures, functions...! + + + 升级表结构文件不存在! - Upgrade table structure file does not exist + Upgrade table structure file does not exist! - - DOM setContent失败! - DOM setContent failed! - - - - + + + 配置文件节点为空! - DOM setContent failed! + Configuration file node is empty! - - - + + + 获取表 Get the table - + 的建表语句失败! - The table-building statement failed! + Table creation statement failed! - + 创建表失败,原因: Creating a table failed for: - + 创建语句: @@ -376,330 +878,859 @@ Create a statement: - - + + 创建成功! Successful creation! - - + + 平台升级表结构文件不存在! + Platform upgrade table structure file does not exist! + + + + 无法删除表: + Unable to delete table: + + + + 的所有字段失败! All fields failed! - 的所有字段失败! + All fields failed! - - ,字段: - Field: - - - + ,未知的索引类型: , unknown index type: - - - - - - - + + 的字段: - Fields of: + Fields: - - 类型修改失败! - Type modification failed! - - - - 类型修改成功! - Type modification failed! - - - - 修改失败! - The modification failed! - - - - 添加失败! - Failed to add! - - - + 重新获取表 - Reacquiring the table + Reacquire the table - - 删除成功! - The deletion was successful! - - - - 删除主键失败!,原因: - Failed to delete the primary key!, for reasons: - - - + 创建主键失败!,原因: - Failed to create the primary key!, for reasons: + Failed to create the primary key!, reason: - + 表 - table + Table - + 更新主键成功! - update the primary key done! + Successfully updated the primary key! - - - - 开始导入文件... - Start importing files... + + + + 无法读取配置文件: + Unable to read the configuration file: - - - - 文件名解析失败: - File name resolution failed: - - - - - - - - - 导入文件 - import file - - - - - - 有错误,详细信息见日志 - Errors, details see log - - - - 错误语句: - Error statement: - - - - - - 完成... - Done.. - - - - - 导入所有文件完成... - Import all files to complete.. - - - + 清空表 - Emptying the table + Clear the table - + 失败,原因: - Failure, cause: + Failed, reason: - + 位置修改成功! - Location modification was successful! + Position modification successful! - + 的添加字段语句失败! - The addition field statement of failed! + Failed to add field statement! - + updateTableIndex函数内删除索引失败 - Failed to delete index within updateTableIndex function + Failed to delete index in updateTableIndex function - + deleteIndex函数删除表索引失败 DeleteIndex function failed to delete table index - + deleteIndex函数删除索引失败 DeleteIndex function failed to delete index - + 打开SQL文件失败 Failed to open SQL file - + 脚本运行出错! - The script is running wrong! + The script has an error! - + 文件执行完成... - File execution complete... + File execution completed... - - 导出表名: - Export table name: - - - - ; 用时: - ;Time: - - - - 文件: - File - - - - 所有表导出完成! - All table exports are complete! - - - + 删除触发器完成...失败 - Remove trigger complete... Failed + Deleting trigger complete... Failed - + 删除触发器完成...成功 - Remove trigger complete... Success + Deleting trigger complete... Success - + 开始删除存储过程... - Start removing stored procedures... + Start deleting stored procedures... - + 删除存储过程完成...失败 - Remove stored procedure complete... Failed + Deleting stored procedure complete... Failed - + 删除存储过程完成...成功 - Remove stored procedure complete... Success + Deleting stored procedure complete... Success - + 删除函数完成...失败 - Delete function complete... Failed + Deleting function complete... Failed - + 删除函数完成...成功 - Delete function complete... Success + Deleting function complete... Success - + 开始恢复触发器... - Start recovery trigger... + Start restoring triggers... - + 恢复触发器完成...失败 - Recovery trigger completes... Failed + Restoring trigger complete... Failed - + 恢复触发器完成...成功 - Recovery trigger completes... Success + Restoring trigger complete... Success - + 恢复存储过程完成...失败 - Recovery stored procedure completes... Failed + Restoring stored procedure complete... Failed - + 恢复存储过程完成...成功 - Recovery stored procedure completes... Success + Restoring stored procedure complete... Success - + 开始恢复函数... - Start recovery function... + Start restoring functions... - + 恢复函数完成...失败 - Recovery function completes... Failed + Restoring function complete... Failed - + 恢复函数完成...成功 - Recovery function completes... Success + Restoring function complete... Success + + + + db_opt_kingbase + + + 未知的数据类型: + Unknown data type: + + + + 获取主键查询失败: + 获取主键查询失败: + + + + + + 无法切换数据库 + Unable to switch the database + + + + 读取数据库结构定义文件失败! + Failed to read the database structure definition file! + + + + + 开始导入数据文件... + Start importing data files... + + + + + 打开导入文件失败 + Failed to open import file + + + + + + + + + + Sql文件 + SQL File + + + + + + + + + + 行 + Line + + + + + + + + + + 出错SQL语句: + Error SQL statement: + + + + + + + + + + +出错原因: + +Error SQL statement: + + + 出错原因: + Error SQL statement: + + + + + 导入数据文件完成...! + Import ing data file is done...! + + + + + + 表: + Table: + + + + + + 的字段: + Fields of: + + + + 类型修改失败! + Type modification failed! + + + + 类型修改成功! + Type modification failed! + + + + 无法添加列 + Unable to add a column + + + + 删除成功! + The deletion was successful! db_opt_mysql - + 未知的数据类型: Unknown data type: - - - - 错误,未处理的数据类型: - Error, unprocessed data type: + + sql执行失败: + + SQL execution failed: + - + + +错误原因: + + + + + + + + + 表: + Table: + + + + + + + + 的字段: + Fields of: + + + + 删除成功! + The deletion was successful! + + + + 无法添加列 + Unable to add a column + + + + 类型修改失败! + Type modification failed! + + + + 类型修改成功! + Type modification was successful! + + + + 修改失败! + Modification failed! + + + + 添加失败! + Addition failed! + + + + 开始导入数据库文件... + Starting to import database files... + + + + + 打开导入文件失败 + Failed to open the import file + + + + + 分隔符解析错误 + Delimiter parsing error + + + + 导入SQL文件完成...! + + + + + 删除主键失败!,原因: + Failed to delete the primary key!, for reasons: + + + + 无法切换数据库 + Unable to switch databases + + + + 开始导入数据文件... + Starting to import data files... + + + + 出错SQL语句: + Error SQL statement: + + + + 导入数据文件完成...! + Import ing data file is done...! + + + 错误,未处理的数据类型: + Error, unprocessed data type: + + + + 获取主键查询失败: + Failed to retrieve the primary key: + + + 文件名解析失败: + File name resolution failed: + + + 打开导入文件失败: + Failed to open import file: + + + 未找到对应的表: + The table for the corresponding was not found: + + + + db_opt_opengauss + + + 未知的数据类型: + Unknown data type: + + + 获取主键查询失败: 获取主键查询失败: - - 文件名解析失败: - File name resolution failed: + + + 无法切换数据库 + Unable to switch databases - - 打开导入文件失败: - Failed to open import file: + + + 开始导入数据文件... + Start importing data files... - - 未找到对应的表: - The table for the corresponding was not found: + + + 打开导入文件失败 + Failed to open import file + + + + + + + + + + Sql文件 + SQL File + + + + + + + + + + 行 + Line + + + + + + + + + + 出错SQL语句: + Error SQL statement: + + + + + + + + + + +出错原因: + +Error SQL statement: + + + + + 导入数据文件完成...! + Import ing data file is done...! + + + + + + 表: + Table: + + + + + + 的字段: + Fields of: + + + + 类型修改失败! + Type modification failed! + + + + 类型修改成功! + Type modification failed! + + + + 无法添加列 + Unable to add a column + + + + 删除成功! + The deletion was successful! file_opt - + 拷贝文件: - Copy files: + Copying file: - + 失败! Failed! + + iot_dbms::db_manager_api + + 开始创建数据库操作句柄... + Starting to create a database operation handle... + + + 未知的数据库类型... + Unknown database type... + + + 开始打开数据库... + Starting to open the database... + + + 打开数据库: + Opening the database: + + + 失败! + Failed! + + + 打开数据库成功... + Successfully opened the database... + + + 删除数据库: + Deleting the database: + + + 失败!请检查是否有其他程序正在连接此数据库 + Failed! Please check if there are other programs currently connected to this database + + + 创建数据库: + Creating the database: + + + 失败: + Failed: + + + 创建数据库成功... + Successfully created the database... + + + 路径: + Path: + + + 不存在! + Does not exist! + + + 不存在 + Does not exist + + + 开始创建参数表... + Starting to create the parameter table... + + + 执行数据库定义配置文件失败! + Failed to execute the database definition configuration file! + + + 创建参数表完成... + Parameter table creation completed... + + + 开始创建历史表... + Starting to create the history table... + + + 执行函数定义文件失败 + Failed to execute the function definition file + + + 创建历史表成功... + History table created successfully... + + + 开始导入基础数据... + Starting to import basic data... + + + 导入 + Import + + + 下的基础数据失败! + Failed to import basic data! + + + 下基础数据导入完成... + Basic data import completed... + + + 下的Exl数据失败! + Failed to import Excel data! + + + 解压 + Unzip + + + 解压数据压缩包成功... + Successfully unzipped the data package... + + + 未知格式的文件 + File of unknown format + + + 开始删除触发器... + Starting to delete the trigger... + + + 删除触发器失败! + Failed to delete the trigger! + + + 触发器删除成功... + Trigger deleted successfully... + + + 导入excel文件成功... + Successfully imported Excel file... + + + 导出数据库文件失败! + Failed to export database file! + + + 拷贝文件失败! + Copying files failed! + + + 拷贝文件成功! + Copying files succeeded! + + + 导入数据库文件失败! + Failed to import database file! + + + 数据库文件database.sql不存在! + Database file database.sql does not exist! + + + 删除文件夹 + Deleting folder + + + 失败 + Failed + + + 成功 + Successful + + + 开始拷贝文件! + Starting to copy the file! + + + 执行创建任务命令失败!,命令: + Failed to execute the create task command!, command: + + + 删除触发器/存储过程/函数失败! + Failed to delete the trigger/stored procedure/function! + + + 更新数据库表结构失败! + Failed to update the database table structure! + + + 创建触发器失败! + Failed to create the trigger! + + + 更新触发器和存储过程失败! + Failed to update the trigger and stored procedures! + + + 删除文件失败! + Failed to delete the file! + + + 开始导入完整工程... + Starting to import the complete project... + + + 复制文件成功... + Successfully copied the file... + + + 开始创建数据库... + Starting to create the database... + + + 开始升级数据库表结构... + Starting to upgrade the database table structure... + + + 数据库表结构升级成功... + The database table structure was successfully upgraded... + + + 导入基础数据完成... + Import of basic data completed... + + + 开始创建数据库表结构... + Starting to create the database table structure... + + + 开始部署... + Starting deployment... + + + 部署成功... + Deployment successful... + + + 开始创建触发器等... + Starting to create triggers, etc... + + + 创建触发器等成功... + Successfully created triggers, etc... + + + 初始化完整工程完成... + Initialization of the complete project is complete... + + + 断开数据库链接... + Disconnect the database link... + + + 本地化部署-切换数据库失败! + Localization deployment - failed to switch databases! + + + 本地化部署-创建域信息失败! + Localization deployment - failed to create domain information! + + + 本地化部署-创建位置信息失败! + Localization deployment - failed to create location information! + + + 本地化部署-创建应用部署信息失败! + Localization deployment - failed to create application deployment information! + + + 本地化部署-创建机器节点失败! + Localization deployment - failed to create machine node! + + + 本地化部署-应用部署失败! + Localization deployment - application deployment failed! + + + 本地化部署-创建数据库节点失败! + Localization deployment - failed to create database node! + + + 本地化部署-部署数据库失败! + Localization deployment - database deployment failed! + + diff --git a/platform/src/dbms/db_manager_api/manual/project_data_veri_manual/MainWindow.cpp b/platform/src/dbms/db_manager_api/manual/project_data_veri_manual/MainWindow.cpp index 8a45a8ec..45d53d69 100644 --- a/platform/src/dbms/db_manager_api/manual/project_data_veri_manual/MainWindow.cpp +++ b/platform/src/dbms/db_manager_api/manual/project_data_veri_manual/MainWindow.cpp @@ -15,7 +15,7 @@ #define TEST_DB_IP "127.0.0.1" #define TEST_DB_PORT 3306 #define TEST_DB_USERNAME "root" -#define TEST_DB_PASSWORD "kbdct@0755" +#define TEST_DB_PASSWORD EMS_DEFAULT_PASSWD MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), diff --git a/platform/src/dbms/db_save/COStreamFile.cpp b/platform/src/dbms/db_save/COStreamFile.cpp index c37f854a..e5801e5a 100644 --- a/platform/src/dbms/db_save/COStreamFile.cpp +++ b/platform/src/dbms/db_save/COStreamFile.cpp @@ -101,8 +101,8 @@ void COStreamFile::writeMsg( const std::string &strData ) } uint64 ullSize = cn_check_mask | strData.size(); m_pStream->WriteLittleEndian64( ullSize ); - LOGDEBUG( "write little endian64 %llu", ( unsigned long long ) strData.size()); - m_pStream->WriteRaw(( const void * ) strData.data(), strData.size()); + LOGDEBUG( "write little endian64 %d", strData.size()); + m_pStream->WriteRaw(( const void * ) strData.data(), static_cast(strData.size())); } -} //< namespace iot_dbms \ No newline at end of file +} //< namespace iot_dbms diff --git a/platform/src/dbms/db_studio/CColumnModeDelegate.cpp b/platform/src/dbms/db_studio/CColumnModeDelegate.cpp index df54c349..be8c17ff 100644 --- a/platform/src/dbms/db_studio/CColumnModeDelegate.cpp +++ b/platform/src/dbms/db_studio/CColumnModeDelegate.cpp @@ -21,7 +21,7 @@ QWidget* CColumnModeDelegate::createEditor( QWidget *parent, const QStyleOptionV pComboBox->addItem("rdb"); return pComboBox; } - else if ( nCol == 5 || nCol == 9 || nCol == 10 || nCol == 13 || nCol ==19 || nCol == 20 || nCol == 21 ) + else if ( nCol == 5 || nCol == 9 || nCol == 10 || nCol == 13 || nCol ==19 || nCol == 20 ) { QComboBox *pComboBox = new QComboBox(parent); pComboBox->addItem("yes"); @@ -95,7 +95,7 @@ void CColumnModeDelegate::setEditorData( QWidget *editor, const QModelIndex &ind pSpinBox->setValue( nValue ); } else if ( nCol == 4 || nCol == 5 || nCol == 9 || nCol == 10 || nCol == 13 || nCol == 19 || - nCol == 20 || nCol == 21 || nCol == 6 || nCol == 11 || nCol == 12 || nCol == 15 || nCol == 16 ) + nCol == 20 || nCol == 6 || nCol == 11 || nCol == 12 || nCol == 15 || nCol == 16 ) { QString text = index.model()->data(index).toString(); QComboBox* pComboBox = static_cast(editor); @@ -113,7 +113,7 @@ void CColumnModeDelegate::setModelData( QWidget *editor, QAbstractItemModel *mod model->setData(index, pSpinBox->value()); } else if ( nCol == 4 || nCol == 5 || nCol == 9 || nCol == 10 || nCol == 13 || nCol == 19 || - nCol == 20 || nCol == 21 || nCol == 6 || nCol == 11 || nCol == 12 || nCol == 15 || nCol == 16 ) + nCol == 20 || nCol == 6 || nCol == 11 || nCol == 12 || nCol == 15 || nCol == 16 ) { QComboBox* pComboBox = static_cast(editor); QString data = pComboBox->currentText(); diff --git a/platform/src/dbms/db_studio/CColumnModeModel.cpp b/platform/src/dbms/db_studio/CColumnModeModel.cpp index bc6b2eaf..71497fc1 100644 --- a/platform/src/dbms/db_studio/CColumnModeModel.cpp +++ b/platform/src/dbms/db_studio/CColumnModeModel.cpp @@ -27,8 +27,7 @@ CColumnModeModel::CColumnModeModel() << "数据长度(rdb)" << "默认值(rdb)" << "是否同步到备内存库" - << "是否更新到内存库" - << "内存库持久化"; + << "是否更新到内存库"; } CColumnModeModel::~CColumnModeModel() @@ -143,9 +142,6 @@ QVariant CColumnModeModel::data( const QModelIndex &index, int role ) const case 20: oVal = m_pListColumn->at(index.row())->sIsUpdateToRdb; break; - case 21: - oVal = m_pListColumn->at(index.row())->sCache; - break; } return oVal; } @@ -314,13 +310,6 @@ bool CColumnModeModel::setData( const QModelIndex& index, const QVariant &value, emit signalDataChanged(); } break; - case 21: - if ( m_pListColumn->at(index.row())->sCache != value.toString() ) - { - m_pListColumn->at(index.row())->sCache = value.toString(); - emit signalDataChanged(); - } - break; } return true; } diff --git a/platform/src/dbms/db_studio/CDbStudio.cpp b/platform/src/dbms/db_studio/CDbStudio.cpp index 0c485605..9673e719 100644 --- a/platform/src/dbms/db_studio/CDbStudio.cpp +++ b/platform/src/dbms/db_studio/CDbStudio.cpp @@ -4,18 +4,21 @@ #include "pub_sysinfo_api/SysInfoApi.h" #include "CFileSelect.h" #include +#include "pub_widget/MessageBox.h" + CDbStudio::CDbStudio(QWidget *parent) : - QMainWindow(parent), + CustomUiMainWindow(parent), ui(new Ui::CDbStudio) { ui->setupUi(this); + setAutoLayout(true); + + ui->menuBar->hide(); + ui->mainToolBar->hide(); + ui->statusBar->hide(); - if ( false == loadConfig() ) - { - exit(0); - return; - } initUi(); + initMainMenu(); } CDbStudio::~CDbStudio() @@ -23,30 +26,74 @@ CDbStudio::~CDbStudio() delete ui; } -bool CDbStudio::loadConfig() +void CDbStudio::slotMainMenuClicked(int nIndex) +{ + if ( false == loadConfig(nIndex) ) + { + N_MessageBox::warning(this,tr("警告"),tr("加载配置文件失败")); + return; + } + + refreshTableModeTableView(); + refreshColumnModeListWidget(); +} + +void CDbStudio::initMainMenu() +{ + QPushButton* platBtn = new QPushButton(); + platBtn->setObjectName("btn_platform"); + platBtn->setText(tr("平台配置")); + ui->mainMenu->addToolBtn(platBtn); + + QPushButton* prodBtn = new QPushButton(); + prodBtn->setObjectName("btn_product"); + prodBtn->setText(tr("产品配置")); + ui->mainMenu->addToolBtn(prodBtn); + + connect(ui->mainMenu, &MenuFrame::buttonClicked,this, &CDbStudio::slotMainMenuClicked); + + slotMainMenuClicked(CN_MainMenu_Platform); + platBtn->setChecked(true); +} + +void CDbStudio::clearTableInfo() +{ + foreach (STable* pTable, m_listTable) { + delete pTable; + } + + m_listTable.clear(); + m_listTable_db.clear(); //< m_listTable_db都在m_listTable + m_listTable_rdb.clear(); //< m_listTable_rdb都在m_listTable + m_listSubsystem.clear(); +} + +bool CDbStudio::loadConfig(int nMenuIndex) { m_bSaved = true; m_sComment = ""; + clearTableInfo(); // 先选择编辑的文件 - CFileSelect objFileSelect; - objFileSelect.exec(); + CFileSelect objFileSelect(nMenuIndex,this); +// objFileSelect.exec(); m_sFilePath = objFileSelect.getFilePath(); if ( m_sFilePath == "" ) return false; // 设置窗口名称 - setWindowTitle( "表结构修改工具" + objFileSelect.getDesc() ); + m_strCurTitle = tr("表结构管理工具") + objFileSelect.getDesc(); + setWindowTitle( m_strCurTitle ); QFile oFile( m_sFilePath ); if ( !oFile.exists() ) { - QMessageBox::critical( 0, "错误", QString("配置文件【%1】不存在").arg(m_sFilePath) ); + N_MessageBox::critical( 0, "错误", QString("配置文件【%1】不存在").arg(m_sFilePath) ); return false; } if ( !oFile.open(QIODevice::ReadOnly) ) { - QMessageBox::critical( 0, "错误", QString("配置文件【%1】打开失败").arg(m_sFilePath) ); + N_MessageBox::critical( 0, "错误", QString("配置文件【%1】打开失败").arg(m_sFilePath) ); return false; } @@ -54,7 +101,7 @@ bool CDbStudio::loadConfig() if ( !oDoc.setContent(&oFile) ) { oFile.close(); - QMessageBox::critical( 0, "错误", QString("配置文件【%1】解析内容错误").arg(m_sFilePath) ); + N_MessageBox::critical( 0, "错误", QString("配置文件【%1】解析内容错误").arg(m_sFilePath) ); return false; } @@ -93,7 +140,6 @@ bool CDbStudio::loadConfig() pTable->nSubsystemFlag = eleTableRdb.attribute( "subsystem_flag", "0" ).toULongLong(); pTable->sSelectByLocation = eleTableRdb.attribute( "select_by_location", "" ); pTable->sSelectBySubsystem = eleTableRdb.attribute( "select_by_subsystem", "" ); - pTable->sCache = eleTableRdb.attribute( "cache", "" ); } QDomElement eleColumn = eleTable.firstChildElement("Column"); @@ -132,7 +178,6 @@ bool CDbStudio::loadConfig() pColumn->sDefaultValue_rdb = eleColumnRdb.attribute( "default_value", "" ); pColumn->sIsSynToSlave = eleColumnRdb.attribute( "is_syn_to_slave", "" ); pColumn->sIsUpdateToRdb = eleColumnRdb.attribute( "is_update_to_rdb", "" ); - pColumn->sCache = eleColumnRdb.attribute( "cache", "" ); } pTable->listColumn.append( pColumn ); @@ -148,13 +193,13 @@ bool CDbStudio::loadConfig() std::vector vecSubsystemInfo; if ( iot_public::createSysInfoInstance( pSysInfo ) == false ) { - QMessageBox::warning( 0, "警告", tr("createSysInfoInstance失败,导致无法修改表所属的专业,其他功能可用") ); + N_MessageBox::warning( 0, "警告", tr("createSysInfoInstance失败,导致无法修改表所属的专业,其他功能可用") ); } else { if ( 0 != pSysInfo->getAllSubsystemInfo( vecSubsystemInfo )) { - QMessageBox::critical( 0, "错误", tr("获取专业信息失败") ); + N_MessageBox::critical( 0, "错误", tr("获取专业信息失败") ); return false; } } @@ -194,10 +239,6 @@ bool CDbStudio::loadConfig() void CDbStudio::initUi() { - ui->menuBar->hide(); - ui->mainToolBar->hide(); - ui->statusBar->hide(); - initTableModeUi(); initColumnModeUi(); } @@ -224,7 +265,7 @@ void CDbStudio::initTableModeUi() ui->tableView_tableMode->setItemDelegateForColumn( 8, new CTableModeDelegate(&m_listSubsystem) ); ui->tableView_tableMode->setItemDelegateForColumn( 9, new CTableModeDelegate(&m_listSubsystem) ); ui->tableView_tableMode->setItemDelegateForColumn( 10, new CTableModeDelegate(&m_listSubsystem) ); - ui->tableView_tableMode->setItemDelegateForColumn( 11, new CTableModeDelegate(&m_listSubsystem) ); + connect( m_pTableModeModel, SIGNAL(signalTableNameChanged()), this, SLOT(slotTableNameChanged()) ); connect( m_pTableModeModel, SIGNAL(signalDataChanged()), this, SLOT(slotDataChanged()) ); @@ -234,7 +275,7 @@ void CDbStudio::initTableModeUi() connect( ui->pushButton_delTable, SIGNAL(clicked(bool)), this, SLOT(slotDelTable(bool)) ); connect( ui->pushButton_saveTable, SIGNAL(clicked(bool)), this, SLOT(slotSave(bool)) ); - refreshTableModeTableView(); +// refreshTableModeTableView(); } void CDbStudio::initColumnModeUi() @@ -268,7 +309,6 @@ void CDbStudio::initColumnModeUi() ui->tableView_columnMode->setItemDelegateForColumn( 17, new CColumnModeDelegate ); ui->tableView_columnMode->setItemDelegateForColumn( 19, new CColumnModeDelegate ); ui->tableView_columnMode->setItemDelegateForColumn( 20, new CColumnModeDelegate ); - ui->tableView_columnMode->setItemDelegateForColumn( 21, new CColumnModeDelegate ); connect( m_pColumnModeModel, SIGNAL(signalDataChanged()), this, SLOT(slotDataChanged()) ); connect( ui->listWidget_columnMode, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(slotColumnModeListWidgetItemClicked(QListWidgetItem*)) ); @@ -280,15 +320,15 @@ void CDbStudio::initColumnModeUi() connect( ui->pushButton_moveUp, SIGNAL(clicked(bool)), this, SLOT(slotColumnMoveUp(bool)) ); connect( ui->pushButton_moveDown, SIGNAL(clicked(bool)), this, SLOT(slotColumnMoveDown(bool)) ); - refreshColumnModeListWidget(); +// refreshColumnModeListWidget(); } void CDbStudio::closeEvent(QCloseEvent *pEvent) { if ( m_bSaved == false ) { - int nRet = QMessageBox::information( 0, "提示", "当前修改未保存,是否保存?", QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel ); - if ( nRet == QMessageBox::Yes ) + int nRet = N_MessageBox::information( 0, "提示", "当前修改未保存,是否保存?", N_MessageBox::Yes, N_MessageBox::No, N_MessageBox::Cancel ); + if ( nRet == N_MessageBox::Yes ) { bool bRet = slotSave( true ); if ( bRet == false ) @@ -297,7 +337,7 @@ void CDbStudio::closeEvent(QCloseEvent *pEvent) return; } } - else if ( nRet == QMessageBox::Cancel ) + else if ( nRet == N_MessageBox::Cancel ) { pEvent->ignore(); return; @@ -349,7 +389,6 @@ void CDbStudio::refreshTableModeTableView() ui->tableView_tableMode->setColumnHidden( 8, false ); ui->tableView_tableMode->setColumnHidden( 9, false ); ui->tableView_tableMode->setColumnHidden( 10, false ); - ui->tableView_tableMode->setColumnHidden( 11, false ); m_pTableModeModel->setTablePtr( &m_listTable ); } @@ -361,7 +400,6 @@ void CDbStudio::refreshTableModeTableView() ui->tableView_tableMode->setColumnHidden( 8, true ); ui->tableView_tableMode->setColumnHidden( 9, true ); ui->tableView_tableMode->setColumnHidden( 10, true ); - ui->tableView_tableMode->setColumnHidden( 11, false ); m_pTableModeModel->setTablePtr( &m_listTable_db ); @@ -374,7 +412,6 @@ void CDbStudio::refreshTableModeTableView() ui->tableView_tableMode->setColumnHidden( 8, false ); ui->tableView_tableMode->setColumnHidden( 9, false ); ui->tableView_tableMode->setColumnHidden( 10, false ); - ui->tableView_tableMode->setColumnHidden( 11, true ); m_pTableModeModel->setTablePtr( &m_listTable_rdb ); @@ -497,18 +534,27 @@ void CDbStudio::refreshColumnModeListWidget() void CDbStudio::configChanged() { - setWindowTitle( "表结构修改工具(未保存)" ); - ui->tableView_tableMode->setStyleSheet( "background-color: wheat;" ); - ui->tableView_columnMode->setStyleSheet( "background-color: wheat;" ); + setWindowTitle( m_strCurTitle + "(未保存)" ); +// ui->tableView_tableMode->setStyleSheet( "background-color: wheat;" ); +// ui->tableView_columnMode->setStyleSheet( "background-color: wheat;" ); m_bSaved = false; + ui->tableView_tableMode->setProperty("changed",true); + ui->tableView_columnMode->setProperty("changed",true); + this->style()->polish(ui->tableView_tableMode); + this->style()->polish(ui->tableView_columnMode); } void CDbStudio::configSaved() { - setWindowTitle( "表结构修改工具" ); + setWindowTitle( m_strCurTitle ); ui->tableView_tableMode->setStyleSheet( "" ); ui->tableView_columnMode->setStyleSheet( "" ); m_bSaved = true; + + ui->tableView_tableMode->setProperty("changed",false); + ui->tableView_columnMode->setProperty("changed",false); + this->style()->polish(ui->tableView_tableMode); + this->style()->polish(ui->tableView_columnMode); } void CDbStudio::slotShowTableStateChanged( int ) @@ -537,13 +583,13 @@ void CDbStudio::slotDelTable( bool ) int nRow = ui->tableView_tableMode->currentIndex().row(); if ( nRow < 0 || nRow >= m_listTable.count() ) { - QMessageBox::critical( 0, "错误", "请先选择要删除的表" ); + N_MessageBox::critical( 0, "错误", "请先选择要删除的表" ); return; } STable* pTable = m_listTable.at( nRow ); - QMessageBox::StandardButton ret = QMessageBox::question( 0, "警告", "确定删除表 【"+pTable->sName+"】?"); - if ( ret == QMessageBox::StandardButton::Yes ) + int ret = N_MessageBox::question( 0, "警告", "确定删除表 【"+pTable->sName+"】?"); + if ( ret == N_MessageBox::Ok ) { m_pTableModeModel->clearTablePtr(); m_listTable.removeAt( nRow ); @@ -551,7 +597,7 @@ void CDbStudio::slotDelTable( bool ) pTable = NULL; refreshTableModeTableView(); - QMessageBox::information(0,"提示","删除成功"); + N_MessageBox::information(0,"提示","删除成功"); } refreshColumnModeListWidget(); @@ -590,7 +636,7 @@ void CDbStudio::slotAddColumn( bool ) QListWidgetItem* pItem = ui->listWidget_columnMode->currentItem(); if ( pItem == NULL ) { - QMessageBox::warning( 0, "警告", "请先选择一张表" ); + N_MessageBox::warning( 0, "警告", "请先选择一张表" ); return; } @@ -617,7 +663,7 @@ void CDbStudio::slotDelColumn( bool ) QListWidgetItem* pItem = ui->listWidget_columnMode->currentItem(); if ( pItem == NULL ) { - QMessageBox::warning( 0, "警告", "请先选择一张表" ); + N_MessageBox::warning( 0, "警告", "请先选择一张表" ); return; } @@ -628,13 +674,13 @@ void CDbStudio::slotDelColumn( bool ) int nRow = ui->tableView_columnMode->currentIndex().row(); if ( nRow < 0 || nRow >= m_listTable.at(nIndex)->listColumn.count() ) { - QMessageBox::critical( 0, "错误", "请先选择要删除的列" ); + N_MessageBox::critical( 0, "错误", "请先选择要删除的列" ); return; } SColumn* pColumn = m_listTable.at(nIndex)->listColumn.at( nRow ); - QMessageBox::StandardButton ret = QMessageBox::question( 0, "警告", "确定删除列 【"+pColumn->sName+"】?"); - if ( ret == QMessageBox::StandardButton::Yes ) + int ret = N_MessageBox::question( 0, "警告", "确定删除列 【"+pColumn->sName+"】?"); + if ( ret == N_MessageBox::Ok ) { m_pColumnModeModel->clearTablePtr(); m_listTable.at(nIndex)->listColumn.removeAt( nRow ); @@ -642,7 +688,7 @@ void CDbStudio::slotDelColumn( bool ) pColumn = NULL; m_pColumnModeModel->setTablePtr( &m_listTable.at(nIndex)->listColumn ); - QMessageBox::information(0,"提示","删除成功"); + N_MessageBox::information(0,"提示","删除成功"); } configChanged(); } @@ -652,7 +698,7 @@ void CDbStudio::slotColumnMoveUp( bool ) QListWidgetItem* pItem = ui->listWidget_columnMode->currentItem(); if ( pItem == NULL ) { - QMessageBox::warning( 0, "警告", "请先选择一张表" ); + N_MessageBox::warning( 0, "警告", "请先选择一张表" ); return; } int nIndex = pItem->data( Qt::UserRole ).toInt(); @@ -662,7 +708,7 @@ void CDbStudio::slotColumnMoveUp( bool ) int nCurrentRow = ui->tableView_columnMode->currentIndex().row(); if ( nCurrentRow < 0 ) { - QMessageBox::warning( 0, "警告", "请先选择要上移的列" ); + N_MessageBox::warning( 0, "警告", "请先选择要上移的列" ); return; } else if ( nCurrentRow == 0 ) @@ -683,7 +729,7 @@ void CDbStudio::slotColumnMoveDown( bool ) QListWidgetItem* pItem = ui->listWidget_columnMode->currentItem(); if ( pItem == NULL ) { - QMessageBox::warning( 0, "警告", "请先选择一张表" ); + N_MessageBox::warning( 0, "警告", "请先选择一张表" ); return; } int nIndex = pItem->data( Qt::UserRole ).toInt(); @@ -693,7 +739,7 @@ void CDbStudio::slotColumnMoveDown( bool ) int nCurrentRow = ui->tableView_columnMode->currentIndex().row(); if ( nCurrentRow < 0 ) { - QMessageBox::warning( 0, "警告", "请先选择要上移的列" ); + N_MessageBox::warning( 0, "警告", "请先选择要上移的列" ); return; } else if ( nCurrentRow >= m_pColumnModeModel->rowCount()-1 ) @@ -722,12 +768,12 @@ bool CDbStudio::slotSave( bool ) STable* pTable = m_listTable.at(nTableIndex); if ( pTable->sName == "" ) { - QMessageBox::critical( 0, "错误", QString("存在空名字的表") ); + N_MessageBox::critical( 0, "错误", QString("存在空名字的表") ); return false; } else if ( listTableName.contains(pTable->sName.toLower()) ) { - QMessageBox::critical( 0, "错误", QString("存在同名字的表【%1】").arg(pTable->sName) ); + N_MessageBox::critical( 0, "错误", QString("存在同名字的表【%1】").arg(pTable->sName) ); return false; } listTableName.append( pTable->sName.toLower() ); @@ -738,12 +784,12 @@ bool CDbStudio::slotSave( bool ) SColumn* pColumn = pTable->listColumn.at(nColumnIndex); if ( pColumn->sName == "" ) { - QMessageBox::critical( 0, "错误", QString("表【%1】存在空名字的列").arg(pTable->sName) ); + N_MessageBox::critical( 0, "错误", QString("表【%1】存在空名字的列").arg(pTable->sName) ); return false; } else if ( listColumnName.contains(pColumn->sName.toLower()) ) { - QMessageBox::critical( 0, "错误", QString("表【%1】存在同名字的列【%2】").arg(pTable->sName).arg(pColumn->sName) ); + N_MessageBox::critical( 0, "错误", QString("表【%1】存在同名字的列【%2】").arg(pTable->sName).arg(pColumn->sName) ); return false; } listColumnName.append( pColumn->sName.toLower() ); @@ -771,12 +817,12 @@ bool CDbStudio::slotSave( bool ) QFile oFile( m_sFilePath ); if ( !oFile.exists() ) { - QMessageBox::critical( 0, "错误", QString("配置文件【%1】不存在,保存失败").arg(m_sFilePath) ); + N_MessageBox::critical( 0, "错误", QString("配置文件【%1】不存在,保存失败").arg(m_sFilePath) ); return false; } if ( !oFile.open(QIODevice::WriteOnly | QIODevice::Text) ) { - QMessageBox::critical( 0, "错误", QString("配置文件【%1】打开失败,保存失败").arg(m_sFilePath) ); + N_MessageBox::critical( 0, "错误", QString("配置文件【%1】打开失败,保存失败").arg(m_sFilePath) ); return false; } QXmlStreamWriter writer(&oFile); @@ -812,7 +858,6 @@ bool CDbStudio::slotSave( bool ) writer.writeAttribute( "subsystem_flag" , QString::number(pTable->nSubsystemFlag) ); writer.writeAttribute( "select_by_location" , pTable->sSelectByLocation ); writer.writeAttribute( "select_by_subsystem" , pTable->sSelectBySubsystem ); - writer.writeAttribute( "cache" , pTable->sCache ); writer.writeEndElement(); } @@ -905,7 +950,6 @@ bool CDbStudio::slotSave( bool ) writer.writeAttribute( "default_value" , pColumn->sDefaultValue_rdb ); writer.writeAttribute( "is_syn_to_slave" , pColumn->sIsSynToSlave ); writer.writeAttribute( "is_update_to_rdb" , pColumn->sIsUpdateToRdb ); - writer.writeAttribute( "cache" , pColumn->sCache ); writer.writeEndElement(); } @@ -916,7 +960,7 @@ bool CDbStudio::slotSave( bool ) writer.writeEndElement(); writer.writeEndDocument(); oFile.close(); - QMessageBox::information(0,"提示",QString("保存配置文件【%1】成功").arg(m_sFilePath)); + N_MessageBox::information(0,"提示",QString("保存配置文件【%1】成功").arg(m_sFilePath)); configSaved(); return true; @@ -931,32 +975,3 @@ void CDbStudio::slotDataChanged() { configChanged(); } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/platform/src/dbms/db_studio/CDbStudio.h b/platform/src/dbms/db_studio/CDbStudio.h index e6cf2746..c3f9a368 100644 --- a/platform/src/dbms/db_studio/CDbStudio.h +++ b/platform/src/dbms/db_studio/CDbStudio.h @@ -22,12 +22,13 @@ #include "CColumnModeModel.h" #include "CColumnModeDelegate.h" #include "StructDefine.h" +#include "pub_widget/CustomMainWindow.h" namespace Ui { class CDbStudio; } -class CDbStudio : public QMainWindow +class CDbStudio : public CustomUiMainWindow { Q_OBJECT @@ -37,7 +38,7 @@ public: public: void initUi(); - bool loadConfig(); + bool loadConfig(int nMenuIndex); void initTableModeUi(); void initColumnModeUi(); @@ -65,6 +66,11 @@ public slots: void slotTableNameChanged(); void slotDataChanged(); + void slotMainMenuClicked(int nIndex); + +private: + void initMainMenu(); + void clearTableInfo(); private: Ui::CDbStudio *ui; QString m_sComment; // 配置文件的注释 @@ -76,6 +82,7 @@ private: QList m_listSubsystem; // 专业信息 bool m_bSaved; // 是否保存过 QString m_sFilePath; // 当前编辑的文件,带路径 + QString m_strCurTitle; //< 当前标题 }; #endif // CDBSTUDIO_H diff --git a/platform/src/dbms/db_studio/CDbStudio.ui b/platform/src/dbms/db_studio/CDbStudio.ui index 1a719b5c..39751ff1 100644 --- a/platform/src/dbms/db_studio/CDbStudio.ui +++ b/platform/src/dbms/db_studio/CDbStudio.ui @@ -14,7 +14,13 @@ CDbStudio
- + + + 0 + + + + @@ -174,7 +180,7 @@ 0 0 1030 - 25 + 23 @@ -189,6 +195,14 @@ + + + MenuFrame + QWidget +
pub_widget/MenuFrame.h
+ 1 +
+
tabWidget tableView_tableMode diff --git a/platform/src/dbms/db_studio/CFileSelect.cpp b/platform/src/dbms/db_studio/CFileSelect.cpp index 5b30fe0a..c7bea5d7 100644 --- a/platform/src/dbms/db_studio/CFileSelect.cpp +++ b/platform/src/dbms/db_studio/CFileSelect.cpp @@ -3,13 +3,23 @@ #include "ui_CFileSelect.h" #include "StructDefine.h" -CFileSelect::CFileSelect(QWidget *parent) : - QDialog(parent), +CFileSelect::CFileSelect(int nMenuIndex,QWidget *parent) : + CustomUiDialog(parent), ui(new Ui::CFileSelect) { ui->setupUi(this); init(); + switch (nMenuIndex) { + case CN_MainMenu_Platform: + slotPlatformClicked(); + break; + case CN_MainMenu_Product: + slotProductClicked(); + break; + default: + break; + } } CFileSelect::~CFileSelect() @@ -19,6 +29,7 @@ CFileSelect::~CFileSelect() void CFileSelect::init() { + CustomUiDialog::setAutoLayout(true); this->setWindowTitle( tr("文件选择") ); m_sFilePath = ""; m_sDesc = ""; diff --git a/platform/src/dbms/db_studio/CFileSelect.h b/platform/src/dbms/db_studio/CFileSelect.h index 45feb628..ae1515e0 100644 --- a/platform/src/dbms/db_studio/CFileSelect.h +++ b/platform/src/dbms/db_studio/CFileSelect.h @@ -1,18 +1,21 @@ #ifndef CFILESELECT_H #define CFILESELECT_H -#include +#include "pub_widget/CustomDialog.h" + +const int CN_MainMenu_Platform = 0; +const int CN_MainMenu_Product = 1; namespace Ui { class CFileSelect; } -class CFileSelect : public QDialog +class CFileSelect : public CustomUiDialog { Q_OBJECT public: - explicit CFileSelect(QWidget *parent = 0); + explicit CFileSelect(int nMenuIndex,QWidget *parent = 0); ~CFileSelect(); public: diff --git a/platform/src/dbms/db_studio/CSubsystem.cpp b/platform/src/dbms/db_studio/CSubsystem.cpp index 456242a8..36ce0e37 100644 --- a/platform/src/dbms/db_studio/CSubsystem.cpp +++ b/platform/src/dbms/db_studio/CSubsystem.cpp @@ -2,10 +2,12 @@ #include CSubsystem::CSubsystem( QWidget* pParent, QList* pListSubsystem ) - :QDialog(pParent) + :CustomDialog(pParent) { this->setParent( pParent ); - this->setWindowTitle( "专业选择" ); + this->setWindowTitle( tr("专业选择") ); + this->setMinimumWidth(200); + m_bAccepted = false; m_pListSubsystem = pListSubsystem; @@ -64,13 +66,13 @@ bool CSubsystem::isAccepted() void CSubsystem::slotOk() { m_bAccepted = true; - QDialog::accept(); + CustomDialog::accept(); } void CSubsystem::slotCancel() { m_bAccepted = false; - QDialog::reject(); + CustomDialog::reject(); } diff --git a/platform/src/dbms/db_studio/CSubsystem.h b/platform/src/dbms/db_studio/CSubsystem.h index 2f333307..505e5327 100644 --- a/platform/src/dbms/db_studio/CSubsystem.h +++ b/platform/src/dbms/db_studio/CSubsystem.h @@ -1,14 +1,14 @@ #ifndef CSUBSYSTEM_H #define CSUBSYSTEM_H -#include #include #include #include #include #include "StructDefine.h" +#include "pub_widget/CustomDialog.h" -class CSubsystem : public QDialog +class CSubsystem : public CustomDialog { Q_OBJECT diff --git a/platform/src/dbms/db_studio/CTableModeDelegate.cpp b/platform/src/dbms/db_studio/CTableModeDelegate.cpp index 42a36aef..fed37e05 100644 --- a/platform/src/dbms/db_studio/CTableModeDelegate.cpp +++ b/platform/src/dbms/db_studio/CTableModeDelegate.cpp @@ -16,6 +16,7 @@ QWidget* CTableModeDelegate::createEditor( QWidget *parent, const QStyleOptionVi if ( nCol == 4 ) { QComboBox *pComboBox = new QComboBox(parent); + pComboBox->addItem(""); pComboBox->addItem("db+rdb"); pComboBox->addItem("db"); pComboBox->addItem("rdb"); @@ -24,6 +25,7 @@ QWidget* CTableModeDelegate::createEditor( QWidget *parent, const QStyleOptionVi else if ( nCol == 5) { QComboBox *pComboBox = new QComboBox(parent); + pComboBox->addItem(""); pComboBox->addItem("param"); pComboBox->addItem("his"); pComboBox->addItem("temp"); @@ -40,9 +42,10 @@ QWidget* CTableModeDelegate::createEditor( QWidget *parent, const QStyleOptionVi CSubsystem* pSubsystem = new CSubsystem( parent, m_pListSubsystem ); return pSubsystem; } - else if ( nCol == 6 || nCol == 9 || nCol == 10 || nCol == 11 ) + else if ( nCol == 6 || nCol == 9 || nCol == 10 ) { QComboBox *pComboBox = new QComboBox(parent); + pComboBox->addItem(""); pComboBox->addItem("yes"); pComboBox->addItem("no"); return pComboBox; @@ -65,7 +68,7 @@ void CTableModeDelegate::setEditorData( QWidget *editor, const QModelIndex &inde CSubsystem* pSubsystem = static_cast(editor); pSubsystem->setSubsystemId( nValue ); } - else if ( nCol == 4 || nCol == 5 || nCol == 6 || nCol == 9 || nCol == 10 || nCol == 11 ) + else if ( nCol == 4 || nCol == 5 || nCol == 6 || nCol == 9 || nCol == 10 ) { QString text = index.model()->data(index).toString(); QComboBox* pComboBox = static_cast(editor); @@ -88,7 +91,7 @@ void CTableModeDelegate::setModelData( QWidget *editor, QAbstractItemModel *mode if ( pSubsystem->isAccepted() ) model->setData(index, pSubsystem->getSubsystemId()); } - else if ( nCol == 4 || nCol == 5 || nCol == 6 || nCol == 9 || nCol == 10 || nCol == 11 ) + else if ( nCol == 4 || nCol == 5 || nCol == 6 || nCol == 9 || nCol == 10 ) { QComboBox* pComboBox = static_cast(editor); QString text = pComboBox->currentText(); diff --git a/platform/src/dbms/db_studio/CTableModeModel.cpp b/platform/src/dbms/db_studio/CTableModeModel.cpp index c2c8da39..e140bff1 100644 --- a/platform/src/dbms/db_studio/CTableModeModel.cpp +++ b/platform/src/dbms/db_studio/CTableModeModel.cpp @@ -16,9 +16,8 @@ CTableModeModel::CTableModeModel() << "最大行数" << "专业标志" - << "是否区分车站" - << "是否区分专业" - << "内存库持久化"; + << "是否区分位置" + << "是否区分专业"; } CTableModeModel::~CTableModeModel() @@ -103,9 +102,6 @@ QVariant CTableModeModel::data( const QModelIndex &index, int role ) const case 10: oVal = m_pListTable->at(index.row())->sSelectBySubsystem; break; - case 11: - oVal = m_pListTable->at(index.row())->sCache; - break; } return oVal; } @@ -203,13 +199,6 @@ bool CTableModeModel::setData( const QModelIndex &index, const QVariant &value, emit signalDataChanged(); } break; - case 11: - if ( m_pListTable->at(index.row())->sCache != value.toString() ) - { - m_pListTable->at(index.row())->sCache = value.toString(); - emit signalDataChanged(); - } - break; } return true; } diff --git a/platform/src/dbms/db_studio/StructDefine.h b/platform/src/dbms/db_studio/StructDefine.h index 406b42fe..c4550747 100644 --- a/platform/src/dbms/db_studio/StructDefine.h +++ b/platform/src/dbms/db_studio/StructDefine.h @@ -35,7 +35,6 @@ struct SColumn QString sDefaultValue_rdb; // 默认值 QString sIsSynToSlave; // 是否需要同步到备内存库 yes\no(是,否) QString sIsUpdateToRdb; // 关系库的变化是否更新到内存库 yes\no(是,否) - QString sCache; // 是否持久化 yes\no SColumn() { @@ -65,7 +64,6 @@ struct SColumn sDefaultValue_rdb = ""; sIsSynToSlave = ""; sIsUpdateToRdb = ""; - sCache = ""; } }; @@ -88,7 +86,6 @@ struct STable quint64 nSubsystemFlag; // 专业标志 QString sSelectByLocation; // 是否区分车站 yes\no QString sSelectBySubsystem; // 是否区分专业 yes\no - QString sCache; // 是否持久化 yes\no // 列 QList listColumn; // 所有列集合 @@ -110,7 +107,17 @@ struct STable nSubsystemFlag = 0; sSelectByLocation = ""; sSelectBySubsystem = ""; - sCache = ""; + } + + ~STable() + { + foreach (SColumn *pCol, listColumn) { + delete pCol; + } + listColumn.clear(); + + listColumn_db.clear(); //< listColumn_db都在listColumn中 + listColumn_rdb.clear(); //< listColumn_rdb都在listColumn中 } }; diff --git a/platform/src/dbms/db_studio/db_studio.pro b/platform/src/dbms/db_studio/db_studio.pro index e5cc8cac..4d0fb0eb 100644 --- a/platform/src/dbms/db_studio/db_studio.pro +++ b/platform/src/dbms/db_studio/db_studio.pro @@ -21,7 +21,7 @@ DEFINES += QT_DEPRECATED_WARNINGS # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - +RC_ICONS = icons/db_studio.ico SOURCES += \ main.cpp \ @@ -47,8 +47,7 @@ FORMS += \ CDbStudio.ui \ CFileSelect.ui -LIBS += \ - -lpub_sysinfo_api \ +LIBS += -lpub_sysinfo_api -lpub_widget -lpub_utility_api !include( ../../common.pri ){ error(the file common.pri is not exist!!) diff --git a/platform/src/dbms/db_studio/main.cpp b/platform/src/dbms/db_studio/main.cpp index bd771ef8..6339867b 100644 --- a/platform/src/dbms/db_studio/main.cpp +++ b/platform/src/dbms/db_studio/main.cpp @@ -2,12 +2,43 @@ #include #include "common/QtAppGlobalSet.h" #include "CDbStudio.h" +#include "pub_utility_api/FileStyle.h" +#include "pub_widget/PubWidgetInit.h" int main(int argc, char *argv[]) { iot_common::doQtAppGlobalSet(); QApplication a(argc, argv); + QString qss = QString(); + std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss","zh","light"); + + QFile qssfile1(QString::fromStdString(strFullPath)); + qssfile1.open(QFile::ReadOnly); + if (qssfile1.isOpen()) + { + qss += QLatin1String(qssfile1.readAll()); + qssfile1.close(); + } + + strFullPath = iot_public::CFileStyle::getPathOfStyleFile("db_studio.qss","zh","light"); + QFile qssfile2(QString::fromStdString(strFullPath)); + qssfile2.open(QFile::ReadOnly); + if (qssfile2.isOpen()) + { + qss += QLatin1String(qssfile2.readAll()); + qssfile2.close(); + } + + if (!qss.isEmpty()) + { + qApp->setStyleSheet(qss); + } + + iot_public::installTranslator("zh"); + +// qApp->setFont(QFont("Microsoft YaHei",10)); + CDbStudio w; w.show(); diff --git a/platform/src/dbms/db_sysinfo_api/CDbSysInfo.cpp b/platform/src/dbms/db_sysinfo_api/CDbSysInfo.cpp index c13a6206..54de897b 100644 --- a/platform/src/dbms/db_sysinfo_api/CDbSysInfo.cpp +++ b/platform/src/dbms/db_sysinfo_api/CDbSysInfo.cpp @@ -10,7 +10,20 @@ #include "boost/lexical_cast.hpp" #include "boost/format.hpp" #include "boost/asio/ip/host_name.hpp" +#include "boost/algorithm/string/predicate.hpp" + +//< 屏蔽xml_parser编译告警 +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-copy" +#endif + #include "boost/property_tree/xml_parser.hpp" + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif + #include "pub_utility_api/FileUtil.h" #include #include @@ -114,7 +127,7 @@ int CDbSysInfo::getAppIdByTableName( const std::string& strAppName, const std::s for (BOOST_AUTO(itTable, table.begin()); itTable!=table.end(); itTable++) { std::string sUseType = itTable->second.get(".use_type"); - if ("Table" != itTable->first || sUseType == "db") + if ("Table" != itTable->first || !boost::contains(sUseType,"rdb")) continue; BOOST_AUTO(rdb, itTable->second.get_child("Rdb")); if ( rdb.size() <= 0 ) @@ -150,7 +163,7 @@ int CDbSysInfo::getAppIdByTableName( const std::string& strAppName, const std::s for (BOOST_AUTO(itTable, table.begin()); itTable!=table.end(); itTable++) { std::string sUseType = itTable->second.get(".use_type"); - if ("Table" != itTable->first || sUseType == "db") + if ("Table" != itTable->first || !boost::contains(sUseType,"rdb") ) continue; BOOST_AUTO(rdb, itTable->second.get_child("Rdb")); if ( rdb.size() <= 0 ) @@ -278,9 +291,8 @@ bool CDbSysInfo::getAllRdbTableNameBySubsystemId( const int nSubsystemId, std::v BOOST_AUTO(table, pt.get_child("DatabaseStruct")); for (BOOST_AUTO(itTable, table.begin()); itTable!=table.end(); itTable++) { - if ("Table" != itTable->first ) - continue; - if ( itTable->second.get(".use_type") == "db" ) + std::string strUseType = itTable->second.get(".use_type"); + if ("Table" != itTable->first || !boost::contains(strUseType,"rdb") ) continue; BOOST_AUTO(rdb, itTable->second.get_child("")); for (BOOST_AUTO(itRdb, rdb.begin()); itRdb!=rdb.end(); itRdb++) @@ -306,9 +318,8 @@ bool CDbSysInfo::getAllRdbTableNameBySubsystemId( const int nSubsystemId, std::v BOOST_AUTO(table, pt.get_child("DatabaseStruct")); for (BOOST_AUTO(itTable, table.begin()); itTable!=table.end(); itTable++) { - if ("Table" != itTable->first ) - continue; - if ( itTable->second.get(".use_type") == "db" ) + std::string strUseType = itTable->second.get(".use_type"); + if ("Table" != itTable->first || !boost::contains(strUseType,"rdb") ) continue; BOOST_AUTO(rdb, itTable->second.get_child("")); for (BOOST_AUTO(itRdb, rdb.begin()); itRdb!=rdb.end(); itRdb++) @@ -352,9 +363,8 @@ bool CDbSysInfo::getAllRdbColumnNameByTableName( const std::string sTableName, s BOOST_AUTO(table, pt.get_child("DatabaseStruct")); for (BOOST_AUTO(itTable, table.begin()); itTable!=table.end(); itTable++) { - if ("Table" != itTable->first ) - continue; - if ( itTable->second.get(".use_type") == "db" ) + std::string strUseType = itTable->second.get(".use_type"); + if ("Table" != itTable->first || !boost::contains(strUseType,"rdb") ) continue; std::vector tmpVecColumn; BOOST_AUTO(column, itTable->second.get_child("")); @@ -389,9 +399,8 @@ bool CDbSysInfo::getAllRdbColumnNameByTableName( const std::string sTableName, s BOOST_AUTO(table, pt.get_child("DatabaseStruct")); for (BOOST_AUTO(itTable, table.begin()); itTable!=table.end(); itTable++) { - if ("Table" != itTable->first ) - continue; - if ( itTable->second.get(".use_type") == "db" ) + std::string strUseType = itTable->second.get(".use_type"); + if ("Table" != itTable->first || !boost::contains(strUseType,"rdb") ) continue; std::vector tmpVecColumn; BOOST_AUTO(column, itTable->second.get_child("")); @@ -451,7 +460,7 @@ bool CDbSysInfo::getTableModeByTableName( const std::string& strTableName ,STab for (BOOST_AUTO(itTable, table.begin()); itTable!=table.end(); itTable++) { std::string sUseType = itTable->second.get(".use_type"); - if ("Table" != itTable->first || sUseType == "rdb") continue; //过滤非关系库表 + if ("Table" != itTable->first || sUseType == "rdb" || sUseType.empty()) continue; //过滤非关系库表 STableModeInfo stTableInfo; stTableInfo.strName = itTable->second.get(".name"); @@ -501,7 +510,7 @@ bool CDbSysInfo::getTableModeByTableName( const std::string& strTableName ,STab for (BOOST_AUTO(itTable, table.begin()); itTable!=table.end(); itTable++) { std::string sUseType = itTable->second.get(".use_type"); - if ("Table" != itTable->first || sUseType == "rdb") continue; //过滤非关系库表 + if ("Table" != itTable->first || sUseType == "rdb" || sUseType.empty()) continue; //过滤非关系库表 STableModeInfo stTableInfo; stTableInfo.strName = itTable->second.get(".name"); @@ -571,9 +580,8 @@ bool CDbSysInfo::getSubsystemFlagByTableName( const std::string sTableName, uint BOOST_AUTO(table, pt.get_child("DatabaseStruct")); for (BOOST_AUTO(itTable, table.begin()); itTable!=table.end(); itTable++) { - if ("Table" != itTable->first ) - continue; - if ( itTable->second.get(".use_type") == "db" ) + std::string strUseType = itTable->second.get(".use_type"); + if ("Table" != itTable->first || !boost::contains(strUseType,"rdb") ) continue; BOOST_AUTO(rdb, itTable->second.get_child("")); for (BOOST_AUTO(itRdb, rdb.begin()); itRdb!=rdb.end(); itRdb++) @@ -599,9 +607,8 @@ bool CDbSysInfo::getSubsystemFlagByTableName( const std::string sTableName, uint BOOST_AUTO(table, pt.get_child("DatabaseStruct")); for (BOOST_AUTO(itTable, table.begin()); itTable!=table.end(); itTable++) { - if ("Table" != itTable->first ) - continue; - if ( itTable->second.get(".use_type") == "db" ) + std::string strUseType = itTable->second.get(".use_type"); + if ("Table" != itTable->first || !boost::contains(strUseType,"rdb") ) continue; BOOST_AUTO(rdb, itTable->second.get_child("")); for (BOOST_AUTO(itRdb, rdb.begin()); itRdb!=rdb.end(); itRdb++) diff --git a/platform/src/dbms/dbms.pro b/platform/src/dbms/dbms.pro index 5ecd0ce8..98531db7 100644 --- a/platform/src/dbms/dbms.pro +++ b/platform/src/dbms/dbms.pro @@ -15,6 +15,8 @@ SUBDIRS += \ tsdb_save_api \ tsdb_api\ tsdb_save \ + tsdb_local_save \ + tsdb_etl \ db_his_query_api\ db_his_mng_api \ db_manager_api \ diff --git a/platform/src/dbms/rdb_api/CBptree.cpp b/platform/src/dbms/rdb_api/CBptree.cpp index e57ff361..24050103 100644 --- a/platform/src/dbms/rdb_api/CBptree.cpp +++ b/platform/src/dbms/rdb_api/CBptree.cpp @@ -1,6 +1,7 @@ #include "CBptree.h" #include "RdbFunc.h" #include "pub_logger_api/logger.h" +#include "boost/concept_check.hpp" using namespace iot_dbms; @@ -39,7 +40,9 @@ int CBptree::find( const char* const pKey ) int CBptree::remove( const char* const pKey ) { - char* p = (char*)pKey; + boost::ignore_unused_variable_warning(pKey); + + //char* p = (char*)pKey; return -1; } diff --git a/platform/src/dbms/rdb_api/CRdbCache.cpp b/platform/src/dbms/rdb_api/CRdbCache.cpp deleted file mode 100644 index e3df192f..00000000 --- a/platform/src/dbms/rdb_api/CRdbCache.cpp +++ /dev/null @@ -1,373 +0,0 @@ -#include "CRdbCache.h" -#include "pub_utility_api/FileUtil.h" -#include "pub_logger_api/logger.h" -#include "pub_sysinfo_api/SysInfoApi.h" -#include "CRdbDictionary.h" -#include "CRdbLocalTable.h" -#include "RdbServerMessage.pb.h" -#include "rdb_api/FuncForNet.h" -#include "rdb_api/CRdbAccessEx.h" -#include "db_sysinfo_api/CDbSysInfo.h" - -#define CN_RDBCACHE "RdbCache" // 缓存文件内容中预留的字符串 -#define CN_MAXROWOFONEFILE 100000 // 单个缓存文件容纳的最多行数 -#define CN_VERSIONFILE "rdb_cache_version.md5" // 内存库缓存版本 - -using namespace iot_public; -using namespace iot_dbms; -using namespace iot_idl; - -CRdbCache::CRdbCache( QString sAppName ) -{ - m_sAppName = sAppName; -} - -CRdbCache::~CRdbCache() -{ - -} - -bool CRdbCache::save() -{ - // 创建/清空缓存目录 - QString sPath = QString("%1/../../data/cache/rdb_server/%2").arg(CFileUtil::getCurModuleDir().c_str()).arg(m_sAppName); - QDir objDir(sPath); - sPath = objDir.absolutePath(); - if ( !objDir.exists() )// 不存在就创建 - { - LOGINFO("缓存目录不存在,现在创建【%s】",sPath.toStdString().c_str()); - if ( !objDir.mkpath(sPath) ) - { - LOGERROR("创建缓存目录失败【%s】",sPath.toStdString().c_str()); - return false; - } - } - else// 存在就清空 - { - // 清空会导致后续打开文件失败,暂时屏蔽 - //objDir.removeRecursively(); - - // 遍历删除文件 - QFileInfoList listFile = objDir.entryInfoList(); - for ( int i=0; inStartColumnNo); - - // 获取指针异常 - if ( pRdbTable == NULL || pRdbColumn == NULL ) - { - LOGERROR("获取指针异常"); - continue; - } - - // 未设置表持久化 - if ( pRdbTable->nCache != 1 ) - continue; - - // 表没有主键 - if ( pRdbTable->nKeyFlag != 1 ) - { - LOGERROR("表没有主键,不执行持久化【%s】",pRdbTable->strName); - continue; - } - - // 查询当前表所有非主键且配置了持久化的列 - std::vector vecColumn; - for ( int i=0; inColumnCount; i++ ) - { - if ( !pRdbColumn[i].bIsKey && pRdbColumn[i].bCache ) - { - vecColumn.push_back( &pRdbColumn[i] ); - } - } - - // 没有配置持久化的列 - if ( vecColumn.size() <= 0 ) - continue; - - // 打开内存表 - CRdbLocalTable objTable(nAppId); - int nRet = objTable.OpenTable(pRdbTable->strName); - if ( nRet != 0 ) - { - LOGERROR("打开内存表失败【%s】",pRdbTable->strName); - continue; - } - - // 读取内存表数据 - int nFileIndex = 0; // 缓存文件序号 - RdbReplace objReplace; - objReplace.set_strsessionid(CN_RDBCACHE); - objReplace.set_strtablename(pRdbTable->strName); - objTable.LockTable(); - for ( int nRowIndex=0; nRowIndexstrName); - break; - } - - // 拷贝主键 - RdbSynUpdate* pUpdate = objReplace.add_msgupdate(); - pUpdate->set_strkeys( data, pRdbTable->nKeyRecLen ); - - // 拷贝列值 - size_t i = 0; - CVarType objValue; - while ( i < vecColumn.size() ) - { - RdbUpdateValue* pUpdVal = pUpdate->add_msgupdatevalue(); - pUpdVal->set_strcolumnname( vecColumn[i]->strName ); - SVariable* pVal = pUpdVal->mutable_msgvalue(); - objTable.GetColumnValue( nRowIndex, objTable.GetColumnNo(vecColumn[i]->strName), objValue ); - Vartype2SVarivale( objValue, *pVal ); - i++; - } - - // 适时写入文件,防止文件过大 - if ( (nRowIndex==objTable.getRecordCount()-1) || (nRowIndex!=0&&nRowIndex%CN_MAXROWOFONEFILE==0) ) - { - // 打开缓存文件 - QString sFilePath = sPath+"/"+pRdbTable->strName+"."+QString::number(nFileIndex); - QFile objFile(sFilePath); - if ( !objFile.open(QIODevice::WriteOnly) ) - { - LOGERROR("打开缓存文件失败【%s】", sFilePath.toStdString().c_str()); - break; - } - // 写入文件 - QDataStream objStream(&objFile); - std::string sData = objReplace.SerializeAsString(); - objStream.writeRawData( sData.c_str(), sData.size() ); - objFile.close(); - // 清理RdbReplace中的数据 - objReplace.clear_msgupdate(); - // 文件序号加1 - nFileIndex++; - } - } - objTable.UnlockTable(); - } - - // 写版本文件 - QString sCacheVersion = getCacheVersion(); - if ( sCacheVersion == "" ) - { - LOGERROR("获取配置版本失败"); - return false; - } - QFile objFile(sPath+"/"+CN_VERSIONFILE); - if ( !objFile.open(QIODevice::WriteOnly|QIODevice::Text) ) - { - LOGERROR("打开文件失败【%s】",CN_VERSIONFILE); - return false; - } - objFile.write(sCacheVersion.toUtf8()); - objFile.close(); - - // 返回成功 - return true; -} - -bool CRdbCache::load() -{ - // 检查缓存文件夹 - QString sPath = QString("%1/../../data/cache/rdb_server/%2").arg(CFileUtil::getCurModuleDir().c_str()).arg(m_sAppName); - QDir objDir(sPath); - sPath = objDir.absolutePath(); - if ( !objDir.exists() ) - { - LOGDEBUG("缓存目录不存在,不加载缓存【%s】",sPath.toStdString().c_str()); - return false; - } - - // 检查缓存版本 - QFile objFile(sPath+"/"+CN_VERSIONFILE); - if ( !objFile.open(QIODevice::ReadOnly|QIODevice::Text) ) - { - LOGDEBUG("打开文件失败【%s】",CN_VERSIONFILE); - return false; - } - QString sCacheVersion_file(objFile.readAll()); - objFile.close(); - QString sCacheVersion_current = getCacheVersion(); - if ( sCacheVersion_current != sCacheVersion_file ) - { - LOGERROR("缓存版本不正确,不加载缓存"); - return false; - } - - // 获取应用id - int nAppId = CDbSysInfo::getAppIdByAppName( m_sAppName.toStdString() ); - if ( nAppId < 0 ) - { - LOGERROR("获取应用Id失败"); - return false; - } - - // 读缓存文件 - CRdbDictionary objDict( nAppId ); - for ( int nTableIndex=0; nTableIndexnCache != 1 )// 不持久化 - continue; - if ( pRdbTable->nKeyFlag == 0 )// 没有主键 - continue; - - int nFileIndex = 0; // 缓存文件序号 - while (true) - { - // 打开缓存文件 - QString sFilePath = sPath+"/"+pRdbTable->strName+"."+QString::number(nFileIndex); - nFileIndex++; - QFile objFile(sFilePath); - if ( !objFile.exists() || !objFile.open(QIODevice::ReadOnly) ) - break; - - // 读取文件内容、反序列化 - QByteArray bytData = objFile.readAll(); - RdbReplace objReplace; - objFile.close(); - if ( !objReplace.ParseFromArray(bytData.data(),bytData.size()) ) - { - LOGERROR("反序列化失败【%s】",sFilePath.toStdString().c_str()); - continue; - } - - // 判断预留字符串 - if ( objReplace.strsessionid() != CN_RDBCACHE ) - { - LOGERROR("文件内容错误【%s】",sFilePath.toStdString().c_str()); - continue; - } - - // 打开内存表 - CRdbAccessEx objAccessEx; - if ( !objAccessEx.open(nAppId,objReplace.strtablename().c_str()) ) - { - LOGERROR( "打开内存库表失败【%s】", objReplace.strtablename().c_str() ); - continue; - } - - // 更新数据 - objAccessEx.lock(); - int nRecord = objReplace.msgupdate_size(); - for ( int nIndex=0; nIndex vecUpdColumn; - int nUpdValue = objSynUpdate.msgupdatevalue_size(); - for ( int i=0; i -#include -#include -#include -#include -#include -#include -#include - -// 内存库缓存类,用于持久化 -class CRdbCache -{ -public: - CRdbCache( QString sAppName ); - ~CRdbCache(); - -public: - // 保存缓存,由sys_ctl调用 - bool save(); - - // 加载缓存,由rdb_server调用 - bool load(); - -private: - // 获取缓存版本 - QString getCacheVersion();// 将平台和产品的表结构配置文件加起来算md5,作为缓存的版本 - -private: - QString m_sAppName;// 应用名称 -}; - -#endif // CRDBCACHE_H diff --git a/platform/src/dbms/rdb_api/CRdbLoadTableAttribute.cpp b/platform/src/dbms/rdb_api/CRdbLoadTableAttribute.cpp index ac5f574d..6e66d1d7 100644 --- a/platform/src/dbms/rdb_api/CRdbLoadTableAttribute.cpp +++ b/platform/src/dbms/rdb_api/CRdbLoadTableAttribute.cpp @@ -148,7 +148,6 @@ int CRdbLoadTableAttribute::CreateTableByConfig( QString sFile ) strncpy( stTableMode.strParaTable, stTableMode.strName, sizeof( stTableMode.strParaTable ) ); stTableMode.nSelectByLocation = eleTableRdb.attribute("select_by_location","no")=="yes"?1:0; stTableMode.nSelectBySubsystem = eleTableRdb.attribute("select_by_subsystem","no")=="yes"?1:0; - stTableMode.nCache = eleTableRdb.attribute("cache","no")=="yes"?1:0; stTableMode.nLastLoadTime = 0; // 表需要申请的行数大于设置的最大行数时,最大行数修改为实际行数的120% @@ -259,7 +258,6 @@ int CRdbLoadTableAttribute::CreateTableByConfig( QString sFile ) pColumn->bIsKey = eleColumn.attribute("is_key","no")=="yes"?true:false; pColumn->bNeedSyn = eleColumnRdb.attribute("is_syn_to_slave","no")=="yes"?true:false; pColumn->bNotUpdateRtdb = eleColumnRdb.attribute("is_update_to_rdb","no")=="yes"?false:true; - pColumn->bCache = eleColumnRdb.attribute("cache","no")=="yes"?true:false; if ( pColumn->bIsKey && nTableKeyNum < RDB_KEYCOLUMN_NUMS ) { strncpy( stTableMode.strArrayKeyColumnName[nTableKeyNum], pColumn->strName, RDB_COLUMN_NAME_LEN ); @@ -290,13 +288,6 @@ int CRdbLoadTableAttribute::CreateTableByConfig( QString sFile ) LOGERROR( "创建表 [%s] 失败,失败原因:%d", stTableMode.strName, nRet ); return -1; } - - -// QString sXml = ""; -// QTextStream objStr(&sXml); -// eleTable.save(objStr,4); -// LOGERROR("%s",sXml.toStdString().c_str()); - } oFile.close(); @@ -320,6 +311,8 @@ int CRdbLoadTableAttribute::CreateTableByConfig( QString sFile ) + + diff --git a/platform/src/dbms/rdb_api/CRdbLocalManager.cpp b/platform/src/dbms/rdb_api/CRdbLocalManager.cpp index 1ddcdd1f..c787d1b0 100644 --- a/platform/src/dbms/rdb_api/CRdbLocalManager.cpp +++ b/platform/src/dbms/rdb_api/CRdbLocalManager.cpp @@ -53,7 +53,6 @@ int CRdbLocalManager::AddTable( SRdbTableAttribute* pRdbTableAttr, int columnnum pDestRtdbColumnAttr[i].bNeedSyn = pSrcRtdbColumnAttr[i].bNeedSyn; pDestRtdbColumnAttr[i].bIsKey = pSrcRtdbColumnAttr[i].bIsKey; pDestRtdbColumnAttr[i].bNotUpdateRtdb = pSrcRtdbColumnAttr[i].bNotUpdateRtdb; - pDestRtdbColumnAttr[i].bCache = pSrcRtdbColumnAttr[i].bCache; // pDestRtdbColumnAttr[i].eventflag=pSrcRtdbColumnAttr[i].eventflag; rcol.addColumn( pDestRtdbColumnAttr[i].nDataType, pDestRtdbColumnAttr[i].nDataLen, pDestRtdbColumnAttr[i].nBitNums, &pDestRtdbColumnAttr[i].nOffset, &pDestRtdbColumnAttr[i].nPosition ); diff --git a/platform/src/dbms/rdb_api/CRdbMngInterface.cpp b/platform/src/dbms/rdb_api/CRdbMngInterface.cpp index 3bc23628..82b21943 100644 --- a/platform/src/dbms/rdb_api/CRdbMngInterface.cpp +++ b/platform/src/dbms/rdb_api/CRdbMngInterface.cpp @@ -15,17 +15,16 @@ #include "CRdbConfigMan.h" #include "CRdbDataSegMan.h" #include "pub_logger_api/logger.h" -#include "CRdbCache.h" using namespace iot_public; using namespace iot_dbms; using namespace std; -bool iot_dbms::CRdbMngIntereface::loadAppDb( const std::string& strAppName ) +bool iot_dbms::CRdbMngIntereface::loadAppDb( const std::string& strAppname ) { // 创建管理段共享内存 CRdbServerMemMan cServerMemman; - int nRet = cServerMemman.init(strAppName); + int nRet = cServerMemman.init( strAppname ); if ( 0 == nRet ) { LOGINFO( "共享内存已存在" ); @@ -49,7 +48,7 @@ bool iot_dbms::CRdbMngIntereface::loadAppDb( const std::string& strAppName ) return false; } SAppInfo stAppInfo; - nRet = ptrSysInfo->getAppInfoByName( strAppName, stAppInfo ); + nRet = ptrSysInfo->getAppInfoByName( strAppname, stAppInfo ); if ( iotFailed == nRet ) { LOGERROR( "getAppInfoByName error" ); @@ -91,41 +90,11 @@ bool iot_dbms::CRdbMngIntereface::loadAppDb( const std::string& strAppName ) rdbtable->m_stSynParam.bNeedSyn = bTemp; } } - - // 加载缓存 - LOGINFO("开始加载缓存"); - CRdbCache objCache(strAppName.c_str()); - if ( !objCache.load() ) - { - LOGERROR("加载缓存失败"); - // 加载缓存失败时内存库仍可用,所以此处不返回失败 - } - else - { - LOGINFO("加载缓存成功"); - } - return true; } int iot_dbms::CRdbMngIntereface::deleteAppDbShm( const std::string& strAppName ) { - if ( isLoadAppDb(strAppName) ) - { - // 保存缓存 - LOGINFO("开始保存缓存"); - CRdbCache objCache(strAppName.c_str()); - if ( !objCache.save() ) - { - LOGERROR("保存缓存失败"); - // 保存缓存失败时仍需执行后续逻辑,所以此处不返回失败 - } - else - { - LOGINFO("保存缓存成功"); - } - } - CRdbDataSegMan objDataMan( CDbSysInfo::getAppIdByAppName( strAppName ) ); objDataMan.deleteShm(); CRdbServerMemMan objMemMan; @@ -146,15 +115,3 @@ bool iot_dbms::CRdbMngIntereface::isLoadAppDb( const std::string& strAppName ) return objMemMan.isCreatedDb( nAppId ); } } - - - - - - - - - - - - diff --git a/platform/src/dbms/rdb_api/rdb_api.pro b/platform/src/dbms/rdb_api/rdb_api.pro index f50d3c30..fac6cd74 100644 --- a/platform/src/dbms/rdb_api/rdb_api.pro +++ b/platform/src/dbms/rdb_api/rdb_api.pro @@ -15,85 +15,79 @@ DEFINES += USING_CUR_SYN #DEFINES += USE_HASHTABLE SOURCES += \ - CBaseTable.cpp \ - CBptree.cpp \ - CPremalloc.cpp \ - CRdbAccessImpl.cpp \ - CRdbColumnInfo.cpp \ - CRdbDataSegMan.cpp \ - CRdbDictionary.cpp \ - CRdbLocalManager.cpp \ - CRdbLocalTable.cpp \ - CRdbQuickSortSrch.cpp \ - CRdbServerMemMan.cpp \ - CRdbTime.cpp \ - CShareMem.cpp \ - QuickSortSrch.cpp \ - RdbFunc.cpp \ - CVarType.cpp \ - CRdbMngInterface.cpp \ - CRdbConfigMan.cpp \ - CRdbAccess.cpp \ - CRdbQueryResultImpl.cpp \ - RdbMemMan.cpp \ - CRdbLoadTableAttribute.cpp \ - CRdbLoadTableData.cpp \ - CHashTable.cpp \ - CRdbKey.cpp \ - CRdbCache.cpp + CBaseTable.cpp \ + CBptree.cpp \ + CPremalloc.cpp \ + CRdbAccessImpl.cpp \ + CRdbColumnInfo.cpp \ + CRdbDataSegMan.cpp \ + CRdbDictionary.cpp \ + CRdbLocalManager.cpp \ + CRdbLocalTable.cpp \ + CRdbQuickSortSrch.cpp \ + CRdbServerMemMan.cpp \ + CRdbTime.cpp \ + CShareMem.cpp \ + QuickSortSrch.cpp \ + RdbFunc.cpp \ + CVarType.cpp \ + CRdbMngInterface.cpp \ + CRdbConfigMan.cpp \ + CRdbAccess.cpp \ + CRdbQueryResultImpl.cpp \ + RdbMemMan.cpp \ + CRdbLoadTableAttribute.cpp \ + CRdbLoadTableData.cpp \ + CHashTable.cpp \ + CRdbKey.cpp HEADERS += \ - ../../include/dbms/rdb_api/CRdbAccess.h \ - ../../include/dbms/rdb_api/CRdbMngInterface.h \ - ../../include/dbms/rdb_api/RdbDefine.h \ - ../../include/dbms/rdb_api/RdbExport.h \ - ../../include/dbms/rdb_api/RdbMemMan.h \ - ../../include/dbms/rdb_api/CVarType.h \ - ../../include/dbms/rdb_api/CRdbAccessEx.h \ - ../../include/dbms/rdb_api/RdbTableMng.h \ - ../../include/dbms/rdb_api/FuncForNet.h \ - CPreMalloc.h \ - CRdbAccessImpl.h \ - CRdbDataSegMan.h \ - CRdbLocalManager.h \ - CRdbQuickSortSrch.h \ - CShareMem.h \ - MallocSpace.h \ - QuickSortSrch.h \ - RdbFunc.h \ - CRdbQueryResultImpl.h \ - CBaseTable.h \ - CRdbLocalTable.h \ - CRdbServerMemMan.h \ - CBptree.h \ - CHashTable.h \ - CRdbDictionary.h \ - CRdbTime.h \ - CRdbColumnInfo.h \ - CRdbLoadTableAttribute.h \ - CRdbLoadTableData.h \ - CRdbKey_impl.h \ - CRdbKey.h \ - CRdbCache.h \ + CPreMalloc.h \ + CRdbAccessImpl.h \ + CRdbDataSegMan.h \ + CRdbLocalManager.h \ + CRdbQuickSortSrch.h \ + CShareMem.h \ + MallocSpace.h \ + QuickSortSrch.h \ + RdbFunc.h \ + CRdbQueryResultImpl.h \ + CBaseTable.h \ + CRdbLocalTable.h \ + CRdbServerMemMan.h \ + CBptree.h \ + CHashTable.h \ + CRdbDictionary.h \ + CRdbTime.h \ + CRdbColumnInfo.h \ + CRdbLoadTableAttribute.h \ + CRdbLoadTableData.h \ + CRdbKey_impl.h \ + CRdbKey.h \ + ../../include/dbms/rdb_api/CRdbAccess.h \ + ../../include/dbms/rdb_api/CRdbMngInterface.h \ + ../../include/dbms/rdb_api/RdbDefine.h \ + ../../include/dbms/rdb_api/RdbExport.h \ + ../../include/dbms/rdb_api/RdbMemMan.h \ + ../../include/dbms/rdb_api/CVarType.h \ + ../../include/dbms/rdb_api/CRdbAccessEx.h \ + ../../include/dbms/rdb_api/RdbTableMng.h \ + ../../include/dbms/rdb_api/FuncForNet.h \ -LIBS += \ - -ldb_base_api \ - -ldb_api_ex \ - -lpub_logger_api \ - -lpub_sysinfo_api \ - -llog4cplus \ - -lboost_system \ - -lboost_thread \ - -ldb_sysinfo_api \ - -lpub_utility_api \ - -lprotobuf \ +LIBS += -ldb_base_api \ + -ldb_api_ex \ + -lpub_logger_api \ + -lpub_sysinfo_api \ + -llog4cplus \ + -lboost_system \ + -lboost_thread \ + -ldb_sysinfo_api \ + -lpub_utility_api win32{ - LIBS += -lAdvAPI32 + LIBS += -lAdvAPI32 } -include($$PWD/../../idl_files/idl_files.pri) - COMMON_PRI=$$PWD/../../common.pri exists($$COMMON_PRI) { include($$COMMON_PRI) diff --git a/platform/src/dbms/rdb_server/CRdbRedundant.cpp b/platform/src/dbms/rdb_server/CRdbRedundant.cpp index c88d9534..04a7a3a8 100644 --- a/platform/src/dbms/rdb_server/CRdbRedundant.cpp +++ b/platform/src/dbms/rdb_server/CRdbRedundant.cpp @@ -11,8 +11,8 @@ int CRdbRedundant::redundantSwitch(bool bMaster, bool bSlave) bool CRdbRedundant::initSwitch(int nAppId) { - iot_dbms::CRdbConfigMan objConfigMan(nAppId); - m_pShmRdbConfig = (iot_dbms::SRdbConfig*)objConfigMan.getConfigAddr(); + iot_dbms::CRdbConfigMan objConfigMan(nAppId); + m_pShmRdbConfig = (iot_dbms::SRdbConfig*)objConfigMan.getConfigAddr(); if (NULL == m_pShmRdbConfig) { return false; diff --git a/platform/src/dbms/rdb_server/CRdbRedundant.h b/platform/src/dbms/rdb_server/CRdbRedundant.h index 20450602..27ea7e1c 100644 --- a/platform/src/dbms/rdb_server/CRdbRedundant.h +++ b/platform/src/dbms/rdb_server/CRdbRedundant.h @@ -17,11 +17,11 @@ public: bool bSlave() const; void setBSlave(bool bSlave); - void bindProcMng(iot_sys::CProcMngInterfacePtr ptrProcMng); + void bindProcMng(iot_sys::CProcMngInterfacePtr ptrProcMng); bool setStatus(bool bMaster = true); private: - iot_dbms::SRdbConfig *m_pShmRdbConfig; - iot_sys::CProcMngInterfacePtr m_ptrProcMng; + iot_dbms::SRdbConfig *m_pShmRdbConfig; + iot_sys::CProcMngInterfacePtr m_ptrProcMng; }; #endif // CRDBREDUNDANT_H diff --git a/platform/src/dbms/rdb_server/CRdbUpdateThread.cpp b/platform/src/dbms/rdb_server/CRdbUpdateThread.cpp index 320f0ff3..940af722 100644 --- a/platform/src/dbms/rdb_server/CRdbUpdateThread.cpp +++ b/platform/src/dbms/rdb_server/CRdbUpdateThread.cpp @@ -1,467 +1,468 @@ -#include "CRdbUpdateThread.h" - -#include "../rdb_api/CRdbConfigMan.h" -#include "../rdb_api/CRdbDictionary.h" -#include "../rdb_api/CRdbServerMemMan.h" -#include "../rdb_api/QVariant2Vartype.inc" -#include "pub_logger_api/logger.h" -#include "pub_sysinfo_api/SysInfoApi.h" -#include "db_sysinfo_api/CDbSysInfo.h" -#include "rdb_api/CRdbAccessEx.h" - -using namespace iot_public; -using namespace iot_dbms; - -CRdbUpdateThread::CRdbUpdateThread( const iot_public::SRunAppInfo stAppInfo ) - : CTimerThreadBase( "rdb_server CRdbUpdateThread 关系数据库向内存库更新线程", 1000, 1000*60*5 ), - m_objDb(DB_CONN_MODEL_READ) -{ - m_ptrSysInfo = nullptr; - m_ullCurId = 0; - m_stAppInfo = ( stAppInfo ); - m_ulAppShmIdAddr = NULL; - m_sNodeName = ""; -} - -CRdbUpdateThread::~CRdbUpdateThread() -{ - quit(); - release(); -} - -void CRdbUpdateThread::execute() -{ - checkCurrentDatabaseChange(); - updateRtdb(); -} - -int CRdbUpdateThread::initialize() -{ - m_vecSynNote.clear(); - if ( false == initAppShmId() ) - { - LOGERROR( "模型实时库同步初始化失败, initAppShmId fail." ); - return false; - } - m_ullCurId = getMinId(); - /* - if(false == CDbSysInfo::initialize()) - { - LOGERROR("模型实时库同步初始化失败,createSysInfoInstance fail."); - return false ; - } - if(iot_public::createSysInfoInstance(m_ptrSysInfo) == false) - { - LOGERROR("模型实时库同步初始化失败,createSysInfoInstance fail."); - return false ; - } - if(NULL == m_ptrSysInfo) - { - LOGERROR("模型实时库同步初始化失败,sysInfoPtr == null."); - return false ; - }*/ - - return true; -} - -void CRdbUpdateThread::release() -{ - m_vecSynNote.clear(); - //m_ptrSysInfo.reset(); - //CDbSysInfo::release(); -} - -int CRdbUpdateThread::getDomainIdByLocaiton( int nLocationId ) -{ - SLocationInfo stLocationInfo; - - //m_ptrSysInfo->getLocationInfoById(nLocationId, stLocationInfo) ; - CDbSysInfo::m_ptrSysInfo->getLocationInfoById( nLocationId, stLocationInfo ); - - return stLocationInfo.nDomainId; -} - -int CRdbUpdateThread::initAppShmId() -{ - CRdbServerMemMan objMemMan; - if ( !objMemMan.isCreatedDb( m_stAppInfo.nAppId ) ) - { - LOGERROR( "app rdb_server not start." ); - return false; - } - CRdbConfigMan objRtdbConfigMan( m_stAppInfo.nAppId ); - uint64* pShmCurId = &objRtdbConfigMan.getConfigAddr()->ullDb2RtdbSynId; - //m_mapAppId2Info[m_stAppInfo.nAppId] = pShmCurId; - m_ulAppShmIdAddr = pShmCurId; - - return true; -} - -void CRdbUpdateThread::updateCurId() -{ - /* - for(std::map::iterator iter = m_mapAppId2Info.begin(); iter != m_mapAppId2Info.end(); ++iter){ - uint64 *pShmId = iter->second; - *pShmId = m_ullCurId; - }*/ - if ( m_ulAppShmIdAddr ) - { - *m_ulAppShmIdAddr = m_ullCurId; - } -} - -uint64 CRdbUpdateThread::getMinId() -{ - uint64 ullRet = 0; - /* - for(std::map::iterator iter = m_mapAppId2Info.begin(); iter != m_mapAppId2Info.end(); ++iter){ - uint64 *pShmId = iter->second; - ullRet = *(pShmId) refSynNote.ullActId ? m_ullCurId : refSynNote.ullActId; - bool bSelectByLocation = false; - //bool bSelectBySubsystem = false; - - //判断当前应用是否和 RDB同步记录 在同一个应用 - //=========================================================================================================== - std::set setAppId; - if ( !CDbSysInfo::getAppIdBySubsystemFlag( refSynNote.unSubsystemFlag, setAppId ) ) - { - continue; - } - //如果是删除记录,直接处理.说明:记录已删除,无法获知属于哪个车站,也无法或者属于哪个应用,只能尝试对每个车站的每个应用进行删除,删除失败无副作用. - if ( setAppId.size() == 0 ) - { - continue; //此表没有再任何一个应用中加载. - } - //没有找到 APP - if ( setAppId.find( m_stAppInfo.nAppId ) == setAppId.end() ) - { - continue; - } - - // 组装所有条件 - //=========================================================================================================== - std::vector vecCondition; - for ( size_t i = 0; i < refSynNote.vecKeyColumnName.size() && i < refSynNote.vecKeyOldValue.size(); ++i ) - { - CONDINFO objCondition; - objCondition.conditionval = refSynNote.vecKeyOldValue[i].c_str(); - objCondition.logicalop = ATTRCOND_AND; - if ( refSynNote.vecKeyColumnName[i].length() > sizeof( objCondition.name ) - 1 ) - { - LOGERROR( "%s:%s 字段名超长", refSynNote.strTableName.c_str(), refSynNote.vecKeyColumnName[i].c_str() ); - continue; - } - strncpy( objCondition.name, refSynNote.vecKeyColumnName[i].c_str(), sizeof( objCondition.name ) ); - objCondition.relationop = ATTRCOND_EQU; - vecCondition.push_back( objCondition ); - } - - //DELETE一条同步记录处理 - //=========================================================================================================== - if ( EModelSynOptTypeDelete == refSynNote.nOptType ) - { //DELETE - if ( !objRtdb.open( m_stAppInfo.nAppId, refSynNote.strTableName.c_str() ) ) - { - LOGERROR( "同步模型至实时库时,打开表失败,appid:%d, tablename:%s", m_stAppInfo.nAppId, refSynNote.strTableName.c_str() ); - continue; - } - objRtdb.lock(); - objRtdb.remove( vecCondition ); - objRtdb.unLock(); - continue; - } - - //获取应用表目录地址 是否区分站点id和应用id - //=========================================================================================================== - CRdbDictionary objDict( m_stAppInfo.nAppId ); - SRdbTableAttribute* pTable = objDict.SearchTable( refSynNote.strTableName.c_str() ); - if ( 0 == pTable ) - { - LOGERROR( "应用%d没有加载表%s", m_stAppInfo.nAppId, refSynNote.strTableName.c_str() ); - continue; - } - bSelectByLocation = pTable->nSelectByLocation; //区分车站 - //bSelectBySubsystem = pTable->nSelectBySubsystem; //区分专业 - - //不属于此站点,return,属于则,查出对应记录,然后确定需要更新此表的应用 - //=========================================================================================================== - QSqlQuery objQuery; - if ( !openDb() ) - { - LOGERROR( "打开数据库失败,openDb()!" ); - return; - } - QList listCondition; - for ( size_t nCondIndex = 0; - nCondIndex < refSynNote.vecKeyColumnName.size() && nCondIndex < refSynNote.vecKeyNewValue.size(); - ++nCondIndex ) - { - CDbCondition objCondition; - objCondition.m_eCompare = CDbCondition::COMPARE_EQ; - objCondition.m_eLogic = CDbCondition::LOGIC_AND; - objCondition.m_sColName = refSynNote.vecKeyColumnName[nCondIndex].c_str(); - objCondition.m_value = refSynNote.vecKeyNewValue[nCondIndex].c_str(); - listCondition << objCondition; - } - if ( !m_objDb.select( refSynNote.strTableName.c_str(), listCondition, objQuery ) - || !objQuery.next() ) - { - LOGERROR( "根据key查找记录失败,act_id:%llu", (unsigned long long)refSynNote.ullActId ); - continue; - } - //区分车站判断 - //=========================================================================================================== - if ( bSelectByLocation ) - { - bool bConvertRet; - int nLocationId = objQuery.value( STR_LOCATION_ID ).toInt( &bConvertRet ); - if ( !bConvertRet ) - { - LOGERROR( "同步的记录区分站点,但是获取站点号失败." ); - continue; - } - if ( getDomainIdByLocaiton( nLocationId ) != m_stAppInfo.nDomainId ) - { - continue; - } - } - //区分专业判断 - /* - //=========================================================================================================== - int nSelectedAppId = m_stAppInfo.nAppId ; - if(bSelectBySubsystem){ - bool bConvertRet; - int nSubsystemId = objQuery.value(STR_SUB_SYSTEM).toInt(&bConvertRet); - if(!bConvertRet){ - LOGERROR("同步记录区分专业,但是获取专业ID失败."); - continue; - } - nSelectedAppId = CDbSysInfo::getAppIdBySubsystemId(nSubsystemId); - if(m_stAppInfo.nAppId != nSelectedAppId ){ - LOGINFO("修改的记录不需要记录到实时库.id:%d", refSynNote.ullActId); - continue; - } - }*/ - - //从所属任意应用查出表结构 - //=============================================================================================== - SRdbColumnAttribute* pShmColumn = objDict.GetColumnStruct( pTable->nStartColumnNo ); - std::vector vecColumnValue; - - for ( int pColumnIndex = 0; pColumnIndex < pTable->nColumnCount; ++pColumnIndex ) - { - if ( ( pShmColumn + pColumnIndex )->bNotUpdateRtdb ) - { - continue; - } - RSQL_UPD_COLUMN objUpdColumn; - strncpy( objUpdColumn.updcolname, ( pShmColumn + pColumnIndex )->strName, sizeof( objUpdColumn.updcolname ) ); - QVariantToVartypeValue( objQuery.value( objUpdColumn.updcolname ), - ( pShmColumn + pColumnIndex )->nDataType, objUpdColumn.updvalue ); - vecColumnValue.push_back( objUpdColumn ); - } - - //对对应应用进行同步 - //=============================================================================================== - if ( !objRtdb.open( m_stAppInfo.nAppId, refSynNote.strTableName.c_str() ) ) - { - LOGERROR( "同步模型至实时库时,打开表失败,appid:%d, tablename:%s", m_stAppInfo.nAppId, refSynNote.strTableName.c_str() ); - continue; - } - if ( EModelSynOptTypeInsert == refSynNote.nOptType ) - { - objRtdb.lock(); - objRtdb.insert( vecColumnValue ); - objRtdb.unLock(); - } - else - { - objRtdb.lock(); - objRtdb.update( vecColumnValue, vecCondition ); - objRtdb.unLock(); - } - //m_objRtdb.close(); - } - - updateCurId(); //更新同步到的id到共享内存 - - m_vecSynNote.clear(); - - return; -} - -bool CRdbUpdateThread::openDb() -{ - if ( !m_objDb.isOpen() ) - { - if ( !m_objDb.open() ) - { - LOGERROR( "获取可读数据库连接失败." ); - return false; - } - } - return true; -} - -bool CRdbUpdateThread::getCurNote() -{ - m_vecSynNote.clear(); - if ( !openDb() ) - { - return false; - } - - CDbCondition objCondtion0; - objCondtion0.m_sColName = "act_id"; - objCondtion0.m_value = (qulonglong)m_ullCurId; - objCondtion0.m_eCompare = CDbCondition::COMPARE_GT; - objCondtion0.m_eLogic = CDbCondition::LOGIC_AND; - CDbCondition objCondtion1; - objCondtion1.m_sColName = "act_id"; - objCondtion1.m_value = (qulonglong)m_ullCurId+1000; - objCondtion1.m_eCompare = CDbCondition::COMPARE_LT; - QList listCondition; - listCondition << objCondtion0 << objCondtion1; - - CDbOrder objOrderBy(objCondtion0.m_sColName); - QList listOrderBy; - listOrderBy << objOrderBy; - - QSqlQuery objQuery; - if ( !m_objDb.select( "sys_trigger_info", listCondition, listOrderBy, objQuery ) ) - { - LOGERROR( "select return non zero. %s", objQuery.lastError().databaseText().toUtf8().data() ); - return false; - } - while ( objQuery.next() ) - { - SSynNoteForModel objModelNote; - bool bConvertRet; - objModelNote.ullActId = objQuery.value( "act_id" ).toULongLong( &bConvertRet ); - if ( false == bConvertRet ) - { - LOGERROR( "convert ret:false" ); - continue; - } - int nOptType = objQuery.value( "op_type" ).toInt( &bConvertRet ); - if ( false == bConvertRet || ( nOptType < 0 || nOptType > 2 ) ) - { - LOGERROR( "convert ret:%s, op_type:%d", bConvertRet ? "true" : "false", objModelNote.nOptType ); - continue; - } - objModelNote.nOptType = EModelSynOptType( nOptType ); - - objModelNote.strTableName = objQuery.value( "table_name" ).toString().toUtf8().data(); - QStringList listColumnName = objQuery.value( "key_column_name" ).toString().split( "," ); - for ( int i = 0; i < listColumnName.size(); ++i ) - { - objModelNote.vecKeyColumnName.push_back( listColumnName[i].toUtf8().data() ); - } - QStringList listKeyOldValue = objQuery.value( "key_old_value" ).toString().split( "," ); - for ( int i = 0; i < listKeyOldValue.size(); ++i ) - { - objModelNote.vecKeyOldValue.push_back( listKeyOldValue[i].toUtf8().data() ); - } - QStringList listKeyNewValue = objQuery.value( "key_new_value" ).toString().split( "," ); - for ( int i = 0; i < listKeyNewValue.size(); ++i ) - { - objModelNote.vecKeyNewValue.push_back( listKeyNewValue[i].toUtf8().data() ); - } - - // 由于数据库中不再有表模式和列模式这两张表,故此处从xml文件中获取subsystem_flag - //objModelNote.unSubsystemFlag = objQuery.value( "subsystem_flag" ).toInt( &bConvertRet ); - if ( false == CDbSysInfo::getSubsystemFlagByTableName(objModelNote.strTableName,objModelNote.unSubsystemFlag) ) - { - //LOGERROR( "获取内存表【%s】的subsystemFlag失败", objModelNote.strTableName.c_str() ); - continue; - } - - if ( EModelSynOptTypeInsert == objModelNote.nOptType && objModelNote.vecKeyNewValue.size() == 0 ) - { - continue; - } - if ( EModelSynOptTypeDelete == objModelNote.nOptType && objModelNote.vecKeyOldValue.size() == 0 ) - { - continue; - } - if ( EModelSynOptTypeUpdate == objModelNote.nOptType - && ( objModelNote.vecKeyNewValue != objModelNote.vecKeyOldValue || objModelNote.vecKeyNewValue.size() == 0 ) ) - { - continue; - } - if ( 0 == objModelNote.unSubsystemFlag || objModelNote.strTableName.length() == 0 ) - { - continue; - } - m_vecSynNote.push_back( objModelNote ); - } - return true; -} +#include "CRdbUpdateThread.h" + +#include "../rdb_api/CRdbConfigMan.h" +#include "../rdb_api/CRdbDictionary.h" +#include "../rdb_api/CRdbServerMemMan.h" +#include "../rdb_api/QVariant2Vartype.inc" +#include "pub_logger_api/logger.h" +#include "pub_sysinfo_api/SysInfoApi.h" +#include "db_sysinfo_api/CDbSysInfo.h" +#include "rdb_api/CRdbAccessEx.h" + +using namespace iot_public; +using namespace iot_dbms; + +CRdbUpdateThread::CRdbUpdateThread( const iot_public::SRunAppInfo stAppInfo ) + : CTimerThreadBase( "rdb_server CRdbUpdateThread 关系数据库向内存库更新线程", 1000, 1000*60*5 ), + m_objDb(DB_CONN_MODEL_READ) +{ + m_ptrSysInfo = nullptr; + m_ullCurId = 0; + m_stAppInfo = ( stAppInfo ); + m_ulAppShmIdAddr = NULL; + m_sNodeName = ""; +} + +CRdbUpdateThread::~CRdbUpdateThread() +{ + quit(); + release(); +} + +void CRdbUpdateThread::execute() +{ + checkCurrentDatabaseChange(); + updateRtdb(); +} + +int CRdbUpdateThread::initialize() +{ + m_vecSynNote.clear(); + if ( false == initAppShmId() ) + { + LOGERROR( "模型实时库同步初始化失败, initAppShmId fail." ); + return false; + } + m_ullCurId = getMinId(); + /* + if(false == CDbSysInfo::initialize()) + { + LOGERROR("模型实时库同步初始化失败,createSysInfoInstance fail."); + return false ; + } + if(iot_public::createSysInfoInstance(m_ptrSysInfo) == false) + { + LOGERROR("模型实时库同步初始化失败,createSysInfoInstance fail."); + return false ; + } + if(NULL == m_ptrSysInfo) + { + LOGERROR("模型实时库同步初始化失败,sysInfoPtr == null."); + return false ; + }*/ + + return true; +} + +void CRdbUpdateThread::release() +{ + m_vecSynNote.clear(); + //m_ptrSysInfo.reset(); + //CDbSysInfo::release(); +} + +int CRdbUpdateThread::getDomainIdByLocaiton( int nLocationId ) +{ + SLocationInfo stLocationInfo; + + //m_ptrSysInfo->getLocationInfoById(nLocationId, stLocationInfo) ; + CDbSysInfo::m_ptrSysInfo->getLocationInfoById( nLocationId, stLocationInfo ); + + return stLocationInfo.nDomainId; +} + +int CRdbUpdateThread::initAppShmId() +{ + CRdbServerMemMan objMemMan; + if ( !objMemMan.isCreatedDb( m_stAppInfo.nAppId ) ) + { + LOGERROR( "app rdb_server not start." ); + return false; + } + CRdbConfigMan objRtdbConfigMan( m_stAppInfo.nAppId ); + uint64* pShmCurId = &objRtdbConfigMan.getConfigAddr()->ullDb2RtdbSynId; + //m_mapAppId2Info[m_stAppInfo.nAppId] = pShmCurId; + m_ulAppShmIdAddr = pShmCurId; + + return true; +} + +void CRdbUpdateThread::updateCurId() +{ + /* + for(std::map::iterator iter = m_mapAppId2Info.begin(); iter != m_mapAppId2Info.end(); ++iter){ + uint64 *pShmId = iter->second; + *pShmId = m_ullCurId; + }*/ + if ( m_ulAppShmIdAddr ) + { + *m_ulAppShmIdAddr = m_ullCurId; + } +} + +uint64 CRdbUpdateThread::getMinId() +{ + uint64 ullRet = 0; + /* + for(std::map::iterator iter = m_mapAppId2Info.begin(); iter != m_mapAppId2Info.end(); ++iter){ + uint64 *pShmId = iter->second; + ullRet = *(pShmId) refSynNote.ullActId ? m_ullCurId : refSynNote.ullActId; + bool bSelectByLocation = false; + bool bSelectBySubsystem = false; + + //判断当前应用是否和 RDB同步记录 在同一个应用 + //=========================================================================================================== + std::set setAppId; + if ( !CDbSysInfo::getAppIdBySubsystemFlag( refSynNote.unSubsystemFlag, setAppId ) ) + { + continue; + } + //如果是删除记录,直接处理.说明:记录已删除,无法获知属于哪个车站,也无法或者属于哪个应用,只能尝试对每个车站的每个应用进行删除,删除失败无副作用. + if ( setAppId.size() == 0 ) + { + continue; //此表没有再任何一个应用中加载. + } + //没有找到 APP + if ( setAppId.find( m_stAppInfo.nAppId ) == setAppId.end() ) + { + continue; + } + + // 组装所有条件 + //=========================================================================================================== + std::vector vecCondition; + for ( size_t i = 0; i < refSynNote.vecKeyColumnName.size() && i < refSynNote.vecKeyOldValue.size(); ++i ) + { + CONDINFO objCondition; + objCondition.conditionval = refSynNote.vecKeyOldValue[i].c_str(); + objCondition.logicalop = ATTRCOND_AND; + if ( refSynNote.vecKeyColumnName[i].length() > sizeof( objCondition.name ) - 1 ) + { + LOGERROR( "%s:%s 字段名超长", refSynNote.strTableName.c_str(), refSynNote.vecKeyColumnName[i].c_str() ); + continue; + } + strncpy( objCondition.name, refSynNote.vecKeyColumnName[i].c_str(), sizeof( objCondition.name ) ); + objCondition.relationop = ATTRCOND_EQU; + vecCondition.push_back( objCondition ); + } + + //DELETE一条同步记录处理 + //=========================================================================================================== + if ( EModelSynOptTypeDelete == refSynNote.nOptType ) + { //DELETE + if ( !objRtdb.open( m_stAppInfo.nAppId, refSynNote.strTableName.c_str() ) ) + { + LOGERROR( "同步模型至实时库时,打开表失败,appid:%d, tablename:%s", m_stAppInfo.nAppId, refSynNote.strTableName.c_str() ); + continue; + } + objRtdb.lock(); + objRtdb.remove( vecCondition ); + objRtdb.unLock(); + continue; + } + + //获取应用表目录地址 是否区分站点id和应用id + //=========================================================================================================== + CRdbDictionary objDict( m_stAppInfo.nAppId ); + SRdbTableAttribute* pTable = objDict.SearchTable( refSynNote.strTableName.c_str() ); + if ( 0 == pTable ) + { + LOGERROR( "应用%d没有加载表%s", m_stAppInfo.nAppId, refSynNote.strTableName.c_str() ); + continue; + } + bSelectByLocation = pTable->nSelectByLocation; //区分车站 + bSelectBySubsystem = pTable->nSelectBySubsystem; //区分专业 + + //不属于此站点,return,属于则,查出对应记录,然后确定需要更新此表的应用 + //=========================================================================================================== + QSqlQuery objQuery; + if ( !openDb() ) + { + LOGERROR( "打开数据库失败,openDb()!" ); + return; + } + QList listCondition; + for ( size_t nCondIndex = 0; + nCondIndex < refSynNote.vecKeyColumnName.size() && nCondIndex < refSynNote.vecKeyNewValue.size(); + ++nCondIndex ) + { + CDbCondition objCondition; + objCondition.m_eCompare = CDbCondition::COMPARE_EQ; + objCondition.m_eLogic = CDbCondition::LOGIC_AND; + objCondition.m_sColName = refSynNote.vecKeyColumnName[nCondIndex].c_str(); + objCondition.m_value = refSynNote.vecKeyNewValue[nCondIndex].c_str(); + listCondition << objCondition; + } + if ( !m_objDb.select( refSynNote.strTableName.c_str(), listCondition, objQuery ) + || !objQuery.next() ) + { + LOGERROR( "根据key查找记录失败,act_id:%llu", (unsigned long long)refSynNote.ullActId ); + continue; + } + //区分车站判断 + //=========================================================================================================== + if ( bSelectByLocation ) + { + bool bConvertRet; + int nLocationId = objQuery.value( STR_LOCATION_ID ).toInt( &bConvertRet ); + if ( !bConvertRet ) + { + LOGERROR( "同步的记录区分站点,但是获取站点号失败." ); + continue; + } + if ( getDomainIdByLocaiton( nLocationId ) != m_stAppInfo.nDomainId ) + { + continue; + } + } + //区分专业判断 + //=========================================================================================================== + int nSelectedAppId = m_stAppInfo.nAppId ; + if(bSelectBySubsystem){ + bool bConvertRet; + int nSubsystemId = objQuery.value(STR_SUB_SYSTEM).toInt(&bConvertRet); + if(!bConvertRet){ + LOGERROR("同步记录区分专业,但是获取专业ID失败."); + continue; + } + nSelectedAppId = CDbSysInfo::getAppIdBySubsystemId(nSubsystemId); + if(m_stAppInfo.nAppId != nSelectedAppId ){ + LOGINFO("修改的记录不需要记录到实时库.id:%llu", (unsigned long long)refSynNote.ullActId); + continue; + } + } + + //从所属任意应用查出表结构 + //=============================================================================================== + SRdbColumnAttribute* pShmColumn = objDict.GetColumnStruct( pTable->nStartColumnNo ); + std::vector vecColumnValue; + + for ( int pColumnIndex = 0; pColumnIndex < pTable->nColumnCount; ++pColumnIndex ) + { + if ( ( pShmColumn + pColumnIndex )->bNotUpdateRtdb ) + { + continue; + } + RSQL_UPD_COLUMN objUpdColumn; + strncpy( objUpdColumn.updcolname, ( pShmColumn + pColumnIndex )->strName, sizeof( objUpdColumn.updcolname ) ); + QVariantToVartypeValue( objQuery.value( objUpdColumn.updcolname ), + ( pShmColumn + pColumnIndex )->nDataType, objUpdColumn.updvalue ); + vecColumnValue.push_back( objUpdColumn ); + } + + //对对应应用进行同步 + //=============================================================================================== + if ( !objRtdb.open( m_stAppInfo.nAppId, refSynNote.strTableName.c_str() ) ) + { + LOGERROR( "同步模型至实时库时,打开表失败,appid:%d, tablename:%s", m_stAppInfo.nAppId, refSynNote.strTableName.c_str() ); + continue; + } + if ( EModelSynOptTypeInsert == refSynNote.nOptType ) + { + objRtdb.lock(); + objRtdb.insert( vecColumnValue ); + objRtdb.unLock(); + } + else + { + objRtdb.lock(); + objRtdb.update( vecColumnValue, vecCondition ); + objRtdb.unLock(); + } + //m_objRtdb.close(); + } + + updateCurId(); //更新同步到的id到共享内存 + + m_vecSynNote.clear(); + + return; +} + +bool CRdbUpdateThread::openDb() +{ + if ( !m_objDb.isOpen() ) + { + if ( !m_objDb.open() ) + { + LOGERROR( "获取可读数据库连接失败." ); + return false; + } + } + return true; +} + +bool CRdbUpdateThread::getCurNote() +{ + m_vecSynNote.clear(); + if ( !openDb() ) + { + return false; + } + + CDbCondition objCondtion0; + objCondtion0.m_sColName = "act_id"; + objCondtion0.m_value = (qulonglong)m_ullCurId; + objCondtion0.m_eCompare = CDbCondition::COMPARE_GT; + objCondtion0.m_eLogic = CDbCondition::LOGIC_AND; + CDbCondition objCondtion1; + objCondtion1.m_sColName = "act_id"; + objCondtion1.m_value = (qulonglong)m_ullCurId+1000; + objCondtion1.m_eCompare = CDbCondition::COMPARE_LT; + QList listCondition; + listCondition << objCondtion0 << objCondtion1; + + CDbOrder objOrderBy(objCondtion0.m_sColName); + QList listOrderBy; + listOrderBy << objOrderBy; + + QSqlQuery objQuery; + if ( !m_objDb.select( "sys_trigger_info", listCondition, listOrderBy, objQuery ) ) + { + LOGERROR( "select return non zero. %s", objQuery.lastError().databaseText().toUtf8().data() ); + m_objDb.close(); + LOGINFO("close db connect,wait next time to connect"); + return false; + } + while ( objQuery.next() ) + { + SSynNoteForModel objModelNote; + bool bConvertRet; + objModelNote.ullActId = objQuery.value( "act_id" ).toULongLong( &bConvertRet ); + if ( false == bConvertRet ) + { + LOGERROR( "convert ret:false" ); + continue; + } + int nOptType = objQuery.value( "op_type" ).toInt( &bConvertRet ); + if ( false == bConvertRet || ( nOptType < 0 || nOptType > 2 ) ) + { + LOGERROR( "convert ret:%s, op_type:%d", bConvertRet ? "true" : "false", objModelNote.nOptType ); + continue; + } + objModelNote.nOptType = EModelSynOptType( nOptType ); + + objModelNote.strTableName = objQuery.value( "table_name" ).toString().toUtf8().data(); + QStringList listColumnName = objQuery.value( "key_column_name" ).toString().split( "," ); + for ( int i = 0; i < listColumnName.size(); ++i ) + { + objModelNote.vecKeyColumnName.push_back( listColumnName[i].toUtf8().data() ); + } + QStringList listKeyOldValue = objQuery.value( "key_old_value" ).toString().split( "," ); + for ( int i = 0; i < listKeyOldValue.size(); ++i ) + { + objModelNote.vecKeyOldValue.push_back( listKeyOldValue[i].toUtf8().data() ); + } + QStringList listKeyNewValue = objQuery.value( "key_new_value" ).toString().split( "," ); + for ( int i = 0; i < listKeyNewValue.size(); ++i ) + { + objModelNote.vecKeyNewValue.push_back( listKeyNewValue[i].toUtf8().data() ); + } + + // 由于数据库中不再有表模式和列模式这两张表,故此处从xml文件中获取subsystem_flag + //objModelNote.unSubsystemFlag = objQuery.value( "subsystem_flag" ).toInt( &bConvertRet ); + if ( false == CDbSysInfo::getSubsystemFlagByTableName(objModelNote.strTableName,objModelNote.unSubsystemFlag) ) + { + //LOGERROR( "获取内存表【%s】的subsystemFlag失败", objModelNote.strTableName.c_str() ); + continue; + } + + if ( EModelSynOptTypeInsert == objModelNote.nOptType && objModelNote.vecKeyNewValue.size() == 0 ) + { + continue; + } + if ( EModelSynOptTypeDelete == objModelNote.nOptType && objModelNote.vecKeyOldValue.size() == 0 ) + { + continue; + } + if ( EModelSynOptTypeUpdate == objModelNote.nOptType + && ( objModelNote.vecKeyNewValue != objModelNote.vecKeyOldValue || objModelNote.vecKeyNewValue.size() == 0 ) ) + { + continue; + } + if ( 0 == objModelNote.unSubsystemFlag || objModelNote.strTableName.length() == 0 ) + { + continue; + } + m_vecSynNote.push_back( objModelNote ); + } + return true; +} diff --git a/platform/src/dbms/rdb_studio/main.cpp b/platform/src/dbms/rdb_studio/main.cpp index aef9bc8a..c2808741 100644 --- a/platform/src/dbms/rdb_studio/main.cpp +++ b/platform/src/dbms/rdb_studio/main.cpp @@ -2,9 +2,9 @@ #include #include "common/QtAppGlobalSet.h" #include "pub_logger_api/logger.h" -#include "net/net_msg_bus_api/MsgBusApi.h" -#include "net/net_msg_bus_api/CMbCommunicator.h" #include "mainwindow.h" +#include "pub_utility_api/FileStyle.h" +#include "pub_widget/PubWidgetInit.h" int main( int argc, char* argv[] ) { @@ -12,10 +12,37 @@ int main( int argc, char* argv[] ) iot_public::StartLogSystem( "default", "rdb_studio" ); QApplication a( argc, argv ); - iot_net::initMsgBus( "sfda", "sdfafds" ); - iot_net::CMbCommunicator* pCom = new iot_net::CMbCommunicator(); - delete pCom; - iot_net::releaseMsgBus(); + + QString qss = QString(); + std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss","zh","light"); + + QFile qssfile1(QString::fromStdString(strFullPath)); + qssfile1.open(QFile::ReadOnly); + if (qssfile1.isOpen()) + { + qss += QLatin1String(qssfile1.readAll()); + qssfile1.close(); + } + + strFullPath = iot_public::CFileStyle::getPathOfStyleFile("rdb_studio.qss","zh","light"); + QFile qssfile2(QString::fromStdString(strFullPath)); + qssfile2.open(QFile::ReadOnly); + if (qssfile2.isOpen()) + { + qss += QLatin1String(qssfile2.readAll()); + qssfile2.close(); + } + + if (!qss.isEmpty()) + { + qApp->setStyleSheet(qss); + } + iot_public::installTranslator("zh"); + +// qApp->setFont(QFont("Microsoft YaHei",10)); + + a.setWindowIcon(QIcon(":/icons/rdb_studio.ico")); + MainWindow w; w.show(); int nRet = a.exec(); diff --git a/platform/src/dbms/rdb_studio/mainwindow.cpp b/platform/src/dbms/rdb_studio/mainwindow.cpp index 4cc1929c..7cbb3d61 100644 --- a/platform/src/dbms/rdb_studio/mainwindow.cpp +++ b/platform/src/dbms/rdb_studio/mainwindow.cpp @@ -5,9 +5,10 @@ #include "tablemodel.h" #include "CMemDictionaryM.h" #include "CMemTableM.h" +#include "pub_widget/MessageBox.h" MainWindow::MainWindow( QWidget* parent ) - : QMainWindow( parent ) + : CustomUiMainWindow( parent ) , ui( new Ui::MainWindow ) { ui->setupUi( this ); @@ -31,7 +32,8 @@ void MainWindow::initVariable() void MainWindow::initUi() { - this->setWindowTitle( "内存库工具" ); + this->setWindowTitle( tr("内存库工具") ); + CustomUiMainWindow::setAutoLayout(true); //隐藏无关组件 ui->mainToolBar->hide(); @@ -257,7 +259,7 @@ void MainWindow::slotListWidgetTableClicked( QListWidgetItem* pItem ) } else { - QMessageBox::warning( this, tr( "Error" ), tr( "打开表失败!" ) ); + N_MessageBox::warning( this, tr( "Error" ), tr( "打开表失败!" ) ); } } @@ -273,12 +275,12 @@ void MainWindow::slotPushButtonAddFilterClicked() { if ( ui->comboBox_column->currentText() == "" ) { - QMessageBox::warning( 0, "提示", "列名不能为空" ); + N_MessageBox::warning( 0, "提示", "列名不能为空" ); return; } if ( ui->lineEdit_in->text() == "" ) { - QMessageBox::warning( 0, "提示", "筛选内容不能为空" ); + N_MessageBox::warning( 0, "提示", "筛选内容不能为空" ); return; } @@ -300,7 +302,7 @@ void MainWindow::slotPushButtonDeleteFilterClicked() { if ( ui->tableWidget_filter->selectedItems().count() <= 0 ) { - QMessageBox::warning( 0, "提示", "请先选择一行" ); + N_MessageBox::warning( 0, "提示", "请先选择一行" ); return; } diff --git a/platform/src/dbms/rdb_studio/mainwindow.h b/platform/src/dbms/rdb_studio/mainwindow.h index 6b1fdb9c..d169d591 100644 --- a/platform/src/dbms/rdb_studio/mainwindow.h +++ b/platform/src/dbms/rdb_studio/mainwindow.h @@ -6,6 +6,7 @@ #include #include "CMemTableM.h" #include "rdb_api/RdbTableMng.h" +#include "pub_widget/CustomMainWindow.h" namespace Ui { @@ -21,7 +22,7 @@ using namespace std; using namespace iot_dbms; using namespace iot_public; -class MainWindow : public QMainWindow +class MainWindow : public CustomUiMainWindow { Q_OBJECT diff --git a/platform/src/dbms/rdb_studio/mainwindow.ui b/platform/src/dbms/rdb_studio/mainwindow.ui index 670e04b5..21afc1bb 100644 --- a/platform/src/dbms/rdb_studio/mainwindow.ui +++ b/platform/src/dbms/rdb_studio/mainwindow.ui @@ -19,16 +19,16 @@ 2 - 2 + 9 - 2 + 9 - 2 + 9 - 2 + 9 @@ -451,7 +451,7 @@ 0 0 911 - 25 + 23 diff --git a/platform/src/dbms/rdb_studio/rdb_studio.pro b/platform/src/dbms/rdb_studio/rdb_studio.pro index 2668d04e..92340a29 100644 --- a/platform/src/dbms/rdb_studio/rdb_studio.pro +++ b/platform/src/dbms/rdb_studio/rdb_studio.pro @@ -22,6 +22,7 @@ DEFINES += QT_DEPRECATED_WARNINGS # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 +RC_ICONS = icons/rdb_studio.ico SOURCES += \ main.cpp \ @@ -42,9 +43,11 @@ FORMS += \ LIBS += \ -lrdb_api \ -lpub_logger_api \ - -lnet_msg_bus_api \ -llog4cplus \ - -lboost_system + -lboost_system \ + -lpub_widget \ + -lpub_utility_api + COMMON_PRI=$$PWD/../../common.pri exists($$COMMON_PRI) { diff --git a/platform/src/dbms/rdb_studio/res.qrc b/platform/src/dbms/rdb_studio/res.qrc index 3b12dc75..792c4b37 100644 --- a/platform/src/dbms/rdb_studio/res.qrc +++ b/platform/src/dbms/rdb_studio/res.qrc @@ -7,5 +7,6 @@ icons/rightArrow.png icons/save.png icons/undo.png + icons/rdb_studio.ico diff --git a/platform/src/dbms/tsdb_api/CTsdbConn.cpp b/platform/src/dbms/tsdb_api/CTsdbConn.cpp index 2e89ec53..f83261a5 100644 --- a/platform/src/dbms/tsdb_api/CTsdbConn.cpp +++ b/platform/src/dbms/tsdb_api/CTsdbConn.cpp @@ -20,6 +20,13 @@ CTsdbConn::CTsdbConn(const char *pchHost, int nPort, const char *pchDb, m_pImp = new CTsdbConnImp(pchHost, nPort, pchDb, pchUser, pchPwd); } +CTsdbConn::CTsdbConn(const STsdbConnParam &stConnParam) +{ + m_pImp = new CTsdbConnImp(stConnParam.strIP.c_str(),stConnParam.nPort, + stConnParam.strDbName.c_str(),stConnParam.strUserName.c_str(), + stConnParam.strUserPassword.c_str()); +} + CTsdbConn::~CTsdbConn() { delete m_pImp; diff --git a/platform/src/dbms/tsdb_api/TsdbApi.cpp b/platform/src/dbms/tsdb_api/TsdbApi.cpp index 4fb2af7b..2169acda 100644 --- a/platform/src/dbms/tsdb_api/TsdbApi.cpp +++ b/platform/src/dbms/tsdb_api/TsdbApi.cpp @@ -133,7 +133,13 @@ CTsdbConnPtr getOneUseableConn(bool bLocalDomain) if (pchIp) { //< todo 端口、数据库名、用户名、密码都使用默认值 - ptrConn.reset(new CTsdbConn(pchIp)); + /* 为以后搜索方便,保留此注释 EMS_DEFAULT_DATABASE + * 暂时使用了首链接的数据库名和密码,用户名与数据库名相同 + */ + ptrConn.reset(new CTsdbConn(pchIp,INFLUXDB_DEFAULT_PORT, + stFirstDbInfo.strServiceName.c_str(), + stFirstDbInfo.strServiceName.c_str(), + stFirstDbInfo.strUserPassword.c_str())); //< 超时时间使用默认值 if (ptrConn->pingServer()) diff --git a/platform/src/dbms/tsdb_api/test/tsdb_api_test/main.cpp b/platform/src/dbms/tsdb_api/test/tsdb_api_test/main.cpp index a1c67533..e8624bbe 100644 --- a/platform/src/dbms/tsdb_api/test/tsdb_api_test/main.cpp +++ b/platform/src/dbms/tsdb_api/test/tsdb_api_test/main.cpp @@ -66,17 +66,20 @@ void tsdb_api_test() LOGINFO("\n******** Complete ********\n"); { + std::string strResult; + LOGINFO("\n\n******** Test getOneUseableConn() ********"); iot_dbms::CTsdbConnPtr ptrConn = iot_dbms::getOneUseableConn(true); if (!ptrConn) { - LOGINFO("getOneUseableConn() return NULL !") + LOGINFO("getOneUseableConn() return NULL !"); } LOGINFO("\n******** Complete ********\n"); //< 不使用getOneUseableConn()返回的正式库测试 - ptrConn.reset(new iot_dbms::CTsdbConn("127.0.0.1", -1, "ykn_test", "", "")); + ptrConn.reset(new iot_dbms::CTsdbConn("127.0.0.1", -1, "ykn_test", + EMS_DEFAULT_DATABASE, EMS_DEFAULT_PASSWD)); LOGINFO("\n\n******** Test pingServer() ********"); if (!ptrConn->pingServer(1000)) @@ -86,6 +89,31 @@ void tsdb_api_test() } LOGINFO("\n******** Complete ********\n"); + LOGINFO( "\n\n******** Test drop user ********" ); + if ( !ptrConn->doQuery( "drop user iscs6000", &strResult )) + { + //< 当开启了用户认证,又没有admin级别用户的话,只允许执行新建admin级别用户的操作 + ptrConn->doQuery( QString("create user %1 with password '%2' with all privileges").arg(EMS_DEFAULT_DATABASE).arg(EMS_DEFAULT_PASSWD), &strResult ); + } + else + { + LOGINFO( "drop user sucess, result: %s", strResult.c_str()); + } + LOGINFO( "\n******** Complete ********\n" ); + + LOGINFO( "\n\n******** Test create user ********" ); + //< 重复建立同名、同密码用户会成功,如果同名但密码不同则会失败 + if ( !ptrConn->doQuery(QString("create user %1 with password '%2' with all privileges").arg(EMS_DEFAULT_DATABASE).arg(EMS_DEFAULT_PASSWD), &strResult )) + { + LOGERROR( "create user return false !" ); + return; + } + else + { + LOGINFO( "create user sucess, result: %s", strResult.c_str()); + } + LOGINFO( "\n******** Complete ********\n" ); + LOGINFO("\n\n******** Test createDatabase() ********"); if (!ptrConn->createDatabase("ykn_test", 1000)) { @@ -104,8 +132,6 @@ void tsdb_api_test() LOGINFO("\n\n******** Test doQuery() ********"); { - std::string strResult; - if (!ptrConn->doQuery("select * from ai_sample_result", &strResult, 1000)) { LOGERROR("doQuery() return false !"); @@ -127,7 +153,6 @@ void tsdb_api_test() LOGERROR("doQuery() return false !"); } LOGINFO("strResult == \n%s", strResult.c_str()); - } LOGINFO("\n******** Complete ********\n"); @@ -138,6 +163,17 @@ void tsdb_api_test() } LOGINFO("\n******** Complete ********\n"); +// LOGINFO( "\n\n******** Test drop user ********" ); +// if ( !ptrConn->doQuery( "drop user iscs6000", &strResult )) +// { +// LOGERROR( "drop user return false !" ); +// return; +// } +// else +// { +// LOGINFO( "drop user sucess, result: %s", strResult.c_str()); +// } +// LOGINFO( "\n******** Complete ********\n" ); } LOGINFO("\n\n******** Test releaseTsdbApi() ********"); diff --git a/platform/src/dbms/tsdb_save/CNodeMng.cpp b/platform/src/dbms/tsdb_save/CNodeMng.cpp index 0d5f7076..d2ea032f 100644 --- a/platform/src/dbms/tsdb_save/CNodeMng.cpp +++ b/platform/src/dbms/tsdb_save/CNodeMng.cpp @@ -130,10 +130,14 @@ bool CNodeMng::init() } //< todo 端口号、数据库名、用户名、密码 暂时写死 + /* 为以后搜索方便,保留此注释 + * 取消默认EMS_DEFAULT_DATABASE,时序库使用系统建模中关系库的首链接的数据库配置 + * 时序库用户名用的数据库名称 + */ CNodeThreadPtr ptrNodeThread(new CNodeThread(stDbNodeInfo.strName, strIpA, strIpB, - 8086, "iscs6000", - "", "")); + 8086, stFirstDbInfo.strServiceName, + stFirstDbInfo.strServiceName, stFirstDbInfo.strUserPassword)); m_vecLocalThreads.push_back(ptrNodeThread); @@ -169,10 +173,14 @@ bool CNodeMng::init() } //< todo 端口号、数据库名、用户名、密码 暂时写死 + /* 为以后搜索方便,保留此注释 + * 取消默认EMS_DEFAULT_DATABASE,时序库使用系统建模中关系库的首链接的数据库配置 + * 时序库用户名用的数据库名称 + */ CNodeThreadPtr ptrNodeThread(new CNodeThread(stDbNodeInfo.strName, strIpA, strIpB, - 8086, "iscs6000", - "", "")); + 8086, stFirstDbInfo.strServiceName, + stFirstDbInfo.strServiceName, stFirstDbInfo.strUserPassword)); m_vecRemoteThreads.push_back(ptrNodeThread); diff --git a/platform/src/dbms/tsdb_save_api/CTsdbSaveApiImp.cpp b/platform/src/dbms/tsdb_save_api/CTsdbSaveApiImp.cpp index 4afcb725..6ecf935d 100644 --- a/platform/src/dbms/tsdb_save_api/CTsdbSaveApiImp.cpp +++ b/platform/src/dbms/tsdb_save_api/CTsdbSaveApiImp.cpp @@ -198,7 +198,9 @@ void CTsdbSaveApiImp::execute() objMbMsg.setPara2(m_nDomainID); //< 域ID //< 注意: 发送后消息内容被清空 - const bool bRc = m_objComm.sendMsgToDomain(objMbMsg, -1); //< 发本域 + //const bool bRc = m_objComm.sendMsgToDomain(objMbMsg, -1); //< 发本域 + //为了提高大数据量下的处理能力,每个应用部署一个tsdb_save服务 + const bool bRc = m_objComm.sendMsgToHost(objMbMsg); //< 发本机 if (bRc) { diff --git a/platform/src/example/tsdbDataSim/MainWindow.cpp b/platform/src/example/tsdbDataSim/MainWindow.cpp new file mode 100644 index 00000000..0f6bb6c5 --- /dev/null +++ b/platform/src/example/tsdbDataSim/MainWindow.cpp @@ -0,0 +1,357 @@ +#include "MainWindow.h" +#include "ui_MainWindow.h" +#include +#include +#include +#include +#include "dataWorker.h" +#include "db_his_query_api/DbHisQueryApi.h" + +#include +using namespace iot_dbms; +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow) +{ + ui->setupUi(this); + + dataWorker *worker = new dataWorker; + worker->moveToThread(&workerThread); + connect(&workerThread, &QThread::finished, worker, &QObject::deleteLater); + + connect(this, &MainWindow::operate, worker, &dataWorker::doWork); + connect(worker, &dataWorker::resultReady, this, &MainWindow::handleResults); + + connect(this, &MainWindow::startTest, worker, &dataWorker::doTest); + connect(worker, &dataWorker::testResultReady, this, &MainWindow::handleTestResults); + + connect(this, &MainWindow::insertEvent, worker, &dataWorker::doInsertEvent); + connect(worker, &dataWorker::InsertEventResultReady, this, &MainWindow::handleEventInsertResults); + + + connect(this, &MainWindow::deleteWork, worker, &dataWorker::doDel); + connect(worker, &dataWorker::deleteResultReady, this, &MainWindow::handleDeleteResults); + + connect(worker, &dataWorker::onErrMsg, this, &MainWindow::onErrMsg); + connect(worker, &dataWorker::onStatus, this, &MainWindow::onStatus); + connect(worker, &dataWorker::onTestStatus, this, &MainWindow::onTestStatus); + connect(worker, &dataWorker::onAddTestRow, this, &MainWindow::onAddTestRow); + + + + + workerThread.start(); + ui->label_status->setHidden(true); + + auto date = ui->calendarWidget_startDate->selectedDate(); + date.setDate(date.addYears(-3).year(),date.month(),date.day()); + ui->calendarWidget_startDate->setSelectedDate(date); + + date = ui->calendarWidget_test->selectedDate(); + date.setDate(date.addYears(-2).year(),date.month(),date.day()); + ui->calendarWidget_test->setSelectedDate(date); + +// QThreadPool::globalInstance()->setMaxThreadCount(10); + +} + +MainWindow::~MainWindow() +{ + workerThread.quit(); + workerThread.wait(); + + delete ui; +} + + + + + +QString MainWindow::getPointType() +{ + if( ui->comboBox_type->currentText() == tr("模拟量")){ + return QString("ai_sample_result"); + }else if( ui->comboBox_type->currentText() == tr("累积量")){ + return QString("acc_sample_result"); + }else if( ui->comboBox_type->currentText() == tr("混合量")){ + return QString("mix_sample_result"); + }else if( ui->comboBox_type->currentText() == tr("数字量")){ + return QString("di_sample_result"); + }else + return ""; +} + +int MainWindow::getDeviatType() +{ + if (ui->comboBox_deviatType->currentText() == tr("左边")){ + return -1; + }else if (ui->comboBox_deviatType->currentText() == tr("两边")){ + return 0; + }else { + return 1; + } +} + + +void MainWindow::on_pushButton_insert_clicked() +{ + if(QMessageBox::question(this,"提醒","是否插入") != QMessageBox::Yes) + { + return; + } + + QString address = ui->lineEdit_addr->text(); + QStringList listPoint = ui->plainTextEdit_point->toPlainText().simplified().split(','); + listPoint.removeAll(""); + for(int i = 0; i < listPoint.size(); i++) + { + listPoint[i] = listPoint[i].trimmed(); + } + QString pointType = getPointType(); + quint64 interval = ui->spinBox_interval->value() * 1000; //ms + int deviatProb = ui->spinBox_deviatProb->value(); + double normalBase = ui->doubleSpinBox_base->value(); + double normalLength = ui->doubleSpinBox_length->value(); + quint64 starttime = QDateTime(ui->calendarWidget_startDate->selectedDate(),ui->timeEdit_start->time()).toMSecsSinceEpoch(); + quint64 endtime = QDateTime(ui->calendarWidget_endDate->selectedDate(),ui->timeEdit_end->time()).toMSecsSinceEpoch(); // 结束日期加一天 + int deviatType = getDeviatType(); + + bool isDeleteInterval = ui->checkBox_delete->isChecked(); + bool isDeleteAll = ui->checkBox_delAll->isChecked(); + bool isMT = ui->checkBox_mt->isChecked(); + emit operate(listPoint,address,pointType,interval,deviatProb,normalBase,normalLength,starttime,endtime,deviatType,isDeleteInterval,isDeleteAll,isMT); + ui->pushButton_insert->setEnabled(false); + ui->pushButton_delete->setEnabled(false); + ui->label_status->setHidden(false); +} + +void MainWindow::onErrMsg(const QString &msg) +{ + QMessageBox::critical(this,"提醒",msg); +} + +void MainWindow::onStatus(const QString &msg) +{ + ui->label_status->setText(msg); +} + +void MainWindow::onTestStatus(const QString &msg) +{ + ui->plainTextEdit_test_result->appendPlainText(msg); +} + +void MainWindow::onAddTestRow(const QStringList &newRow) +{ + ui->tableWidget->insertRow(ui->tableWidget->rowCount()); + QString newLine; + for(int i = 0; i < newRow.size(); i++) + { + ui->tableWidget->setItem(ui->tableWidget->rowCount()-1, i, new QTableWidgetItem(newRow.at(i))); + newLine += newRow.at(i) + ","; + } + newLine.chop(1); + ui->plainTextEdit_test_result->appendPlainText(newLine); + ui->tableWidget->resizeColumnsToContents(); +} + +void MainWindow::on_comboBox_type_currentTextChanged(const QString &arg1) +{ + if("数字量" == arg1) + { + ui->groupBox->setHidden(true); + } + else + { + ui->groupBox->setHidden(false); + } +} + +void MainWindow::handleResults(const QString &msg, bool result) { + ui->label_status->setHidden(true); + + if(result) + { + QMessageBox::information(this,"提醒","插入成功"); + } + else + { + onErrMsg(QString("插入失败:") + msg); + } + ui->pushButton_insert->setEnabled(true); + ui->pushButton_delete->setEnabled(true); + +} + +void MainWindow::handleTestResults(const QString &msg, bool result) +{ + if(result) + { + QMessageBox::information(this,"提醒","测试结束"); + } + else + { + onErrMsg(QString("测试失败:") + msg); + } + ui->pushButton_start_test->setEnabled(true); +} + +void MainWindow::handleDeleteResults(const QString &msg, bool result) +{ + ui->label_status->setHidden(true); + + if(result) + { + QMessageBox::information(this,"提醒","删除成功"); + } + else + { + onErrMsg(QString("删除失败:") + msg); + } + ui->pushButton_insert->setEnabled(true); + ui->pushButton_delete->setEnabled(true); +} + +void MainWindow::handleEventInsertResults(const QString &msg, bool result) +{ + if(result) + { + QMessageBox::information(this,"提醒","生成数据库文件已放至同目录outEvent.sql"); + } + else + { + onErrMsg(QString("插入失败:") + msg); + } +} + +void MainWindow::on_pushButton_delete_clicked() +{ + if(QMessageBox::question(this,"提醒","是否删除") != QMessageBox::Yes) + { + return; + } + + QString address = ui->lineEdit_addr->text(); + QStringList listPoint = ui->plainTextEdit_point->toPlainText().simplified().split(','); + listPoint.removeAll(""); + for(int i = 0; i < listPoint.size(); i++) + { + listPoint[i] = listPoint[i].trimmed(); + } + QString pointType = getPointType(); + + quint64 starttime = QDateTime(ui->calendarWidget_startDate->selectedDate(),ui->timeEdit_start->time()).toMSecsSinceEpoch(); + quint64 endtime = QDateTime(ui->calendarWidget_endDate->selectedDate(),ui->timeEdit_end->time()).toMSecsSinceEpoch(); // 结束日期加一天 + bool isDeleteAll = ui->checkBox_delAll->isChecked(); + + emit deleteWork(address,pointType,listPoint,starttime,endtime,isDeleteAll); + + ui->pushButton_insert->setEnabled(false); + ui->pushButton_delete->setEnabled(false); + ui->label_status->setHidden(false); + +} + +void MainWindow::on_pushButton_insert_event_clicked() +{ + if(QMessageBox::question(this,"提醒","是否插入历史数据") != QMessageBox::Yes) + { + return; + } + + QStringList listPoint = ui->plainTextEdit_point_event->toPlainText().simplified().split(','); + listPoint.removeAll(""); + for(int i = 0; i < listPoint.size(); i++) + { + listPoint[i] = listPoint[i].trimmed(); + } + + quint64 starttime = QDateTime(ui->calendarWidget_startDate_event->selectedDate(),ui->timeEdit_start_event->time()).toMSecsSinceEpoch(); + quint64 endtime = QDateTime(ui->calendarWidget_endDate_event->selectedDate(),ui->timeEdit_end_event->time()).toMSecsSinceEpoch(); // 结束日期加一天 + + emit insertEvent( + QStringList() + << QString::number( ui->spinBox_alm_type->value() ) // 0 + << QString::number( ui->spinBox_alm_status->value() ) // 1 + << QString::number( ui->spinBox_alm_style->value() ) // 2 + << QString::number( ui->spinBox_location_id->value() ) // 3 + << QString::number( ui->spinBox_priority->value() ) // 4 + << QString::number( ui->spinBox_sub_system->value() ) // 5 + << QString::number( ui->spinBox_dev_type->value() ) //6 + << QString::number( ui->spinBox_region_id->value() ) // 7 + << QString::number( ui->spinBox_interval_event->value() ) // 8 + + , + listPoint,ui->lineEdit_content->text(),starttime,endtime); +} + +void MainWindow::on_pushButton_delete_event_clicked() +{ + onErrMsg(tr("该功能未实现")); +} + + + +void MainWindow::on_checkBox_delAll_clicked(bool checked) +{ + if(checked) + { + ui->checkBox_delete->setChecked(false); + } +} + +void MainWindow::on_checkBox_delete_clicked(bool checked) +{ + if(checked) + { + ui->checkBox_delAll->setChecked(false); + } +} + +void MainWindow::on_pushButton_start_test_clicked() +{ + if(QMessageBox::question(this,"提醒","是否查询") != QMessageBox::Yes) + { + + return; + } + ui->plainTextEdit_test_result->clear(); + QString headerLine; + headerLine += QString("结果") + ","; + headerLine += QString("规模") + ","; + headerLine += QString("周期") + ","; + headerLine += QString("开始日期") + ","; + headerLine += QString("结果日期") + ","; + headerLine += QString("间隔(s)") + ","; + headerLine += QString("结果数量") + ","; + headerLine += QString("方法") + ","; + headerLine += QString("用时(ms)"); + ui->plainTextEdit_test_result->appendPlainText(headerLine); + + + while(ui->tableWidget->rowCount() > 0) + { + ui->tableWidget->removeRow(0); + } + + // 一些参数预先设定 + int timeout = ui->spinBox_timeout->value(); + int base = ui->spinBox_base->value(); + int facor = ui->spinBox_factor->value(); + + QString address = ui->lineEdit_addr_test->text(); + qint64 starttime = QDateTime(ui->calendarWidget_test->selectedDate(),QTime(0,0)).toMSecsSinceEpoch(); + + QStringList listPoint = ui->plainTextEdit_point_test->toPlainText().simplified().split(','); + listPoint.removeAll(""); + for(int i = 0; i < listPoint.size(); i++) + { + listPoint[i] = listPoint[i].trimmed(); + } + + // todo 这里时间间隔和计算方法以后再做,这里固定填充了 + + emit startTest(timeout,base,facor,listPoint,starttime,address); + + ui->pushButton_start_test->setEnabled(false); + +} diff --git a/platform/src/example/tsdbDataSim/MainWindow.h b/platform/src/example/tsdbDataSim/MainWindow.h new file mode 100644 index 00000000..eec1ff0d --- /dev/null +++ b/platform/src/example/tsdbDataSim/MainWindow.h @@ -0,0 +1,86 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include +#include + +namespace Ui +{ + class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = 0); + ~MainWindow(); + + +private slots: + + QString getPointType(); + int getDeviatType(); + void on_pushButton_insert_clicked(); + + void on_comboBox_type_currentTextChanged(const QString &arg1); + + void on_pushButton_delete_clicked(); + + void on_pushButton_insert_event_clicked(); + + void on_pushButton_delete_event_clicked(); + + + void on_checkBox_delAll_clicked(bool checked); + + void on_checkBox_delete_clicked(bool checked); + + void on_pushButton_start_test_clicked(); + +public slots: + void handleResults(const QString &msg,bool result =true); + void handleTestResults(const QString &msg,bool result =true); + void handleDeleteResults(const QString &msg,bool result =true); + void handleEventInsertResults(const QString &msg,bool result =true); + + + void onErrMsg(const QString &msg); + void onStatus(const QString &msg); + void onTestStatus(const QString &msg); + void onAddTestRow(const QStringList &newRow); + + +signals: + void operate( + QStringList listpoint, + QString address, + QString pointType, + quint64 interval, + int deviatProb, + double normalBase, + double normalLength, + quint64 starttime, + quint64 endtime, + int deviatType, + bool isDeleteInterval, + bool isDeleteAll, + bool isMT); + void startTest( + int,int,int,QStringList,qint64,QString); + + void deleteWork(QString address,QString pointType,QStringList listPoint,quint64 starttime,quint64 endtime,bool isDeleteAll); + + void insertEvent(QStringList listFixedArgs, + QStringList listPoints, + QString content,quint64 starttime,quint64 endtime + ); + +private: + Ui::MainWindow *ui; + QThread workerThread; +}; + + +#endif // MAINWINDOW_H diff --git a/platform/src/example/tsdbDataSim/MainWindow.ui b/platform/src/example/tsdbDataSim/MainWindow.ui new file mode 100644 index 00000000..d9951d25 --- /dev/null +++ b/platform/src/example/tsdbDataSim/MainWindow.ui @@ -0,0 +1,2035 @@ + + + MainWindow + + + + 0 + 0 + 823 + 702 + + + + 时序库数据仿真小工具 + + + + + + + + + + + + + + 1 + + + + 历史数据 + + + + + + + + 通用参数 + + + + + + + + 数据库地址: + + + + + + + 192.168.2.195 + + + + + + + + + + + 测点类型: + + + + + + + + 模拟量 + + + + + 累积量 + + + + + 数字量 + + + + + 混合量 + + + + + + + + + + + + 测点标签(,分隔): + + + + + + + zJT3FvCsnU00Hoy, +R0vPO0M900004ag, +h0fx2Ly887lQtsR, +7hn20GNtBtDQMvC, +Edu0ys0vqGAK9Hn, +0EXr0urSw5cq000, +yn0u00OWWCro0Qe, +f0QPi0lI00k5hT7, +xTK080KDk7sE0Kg, +Vi5lHdn0KLo9S0R, +I0aAzoOO50d0qzd, +L6YjGO0IPeK0H00, +inJmCZpxZWR0aRz, +fnv0Z05LlEHqk0O, +AkyMnJlL5C0m0pg, +e0O0rCnrBT40dfR, +Q0eOTmhY00GYoPW, +o0OLEU9AmWY0Tzb, +sqdasVp0Gf3cPXL, +n0MBaM0z3E7XxiM, +U0I0T0oIEX9zAG2, +MCvgqEnyfUP07J0, +0OGSw00j00sXwl0, +uYpXv0L5Eba6x00, +DuGWm7q05D09qik, +XY5BIsABVbb07Uz, +Ge3v0tZkO0eRTh1, +i14NZ0LUCC1YkRo, +bZKUgi0gecPBShj, +b00lt0CxOYSFsx8, +AEIpYK10qx34e0t, +00RUqHdUwCK0Qkq, +VmNxvhsddVV004T, +f08000D0QJpN6B0, +QyRlvHyTyo00q0v, +WN0svB0USDLLyoW, +0UV0ai0tl0VwIyL, +sVDqGva0CGe115N, +xK0lN00M04V0000, +o0BpjCk34A70900, +40kQ8oI0Ik0n0j0, +0Dp6vf01WjXP000, +d5k8060n6QC0Q01, +ZFh00ro0o4F10c0, +Xb5y0t0RK00KKNq, +j1jogcBjaYfgaos, +ufyevkis208vpLh, +f070qAAml60RY8A, +0DORIurNG0xuHl9, +TWCP00za3NZXXxc, +cB0R05sfmO9bWA6, +l0zL0obPT0k0ErG, +Z07LE3FAL90Td00, +nD00BPwN0t0YnEa, +N0ZMfj8l0Y60GF0, +T20kbjxMRnkxXTJ, +Ufc0lWp0swFCljE, +J3b0C0z7zeXa0VD, +YaDTXd2LZ0YQIke, +g0R00L0v0A0y0WB, +72010x0XUpbzPI1, +Hjwv44xY0sX0206, +aE00hI50Wncz0KP, +8jc0599LRnd0q3C, +Z02Se0wt0O000A0, +40ISv0eVKom01h0, +AX2H00Ai500q410, +iyJKT06Uy00uPBy, +OSn0JbcStSd2AI6, +M3QT0of070o1Xte, +ozu0DYn0RfvMrAg, +lwKM5p0GC0hhvcK, +59oxjgO8xWh3A9b, +3hOcL09V0s50GaE, +ROiEW000xK4rFWS, +eiU06nvRvKRqWd0, +WPjPoj9Vo8R5Dk9, +aSDCBqi0tyMeBD8, +qVN8x50Ree4X0A7, +K0ZgDMCTpigeW6l, +mn81010jL600x00, +n2c0g10NM00h0Qz, +yFbimNIe0HVbWFk, +elEvAw0ZDCV0VDk, +zFY0K0n4E00krN0, +G0CveLTU0f90g0K, +dn0RKVIGnsI4PD0, +JD0TlzjtUJ1KoY8, +lbnD0SjsR0O3JhW, +iGufd0oSu2J0Zpd, +00U5VQJQ02tlGd0, +aWeGoOK0n4X6Syo, +4vfHc20030r0kNc, +0jyJ9W0V9n0GP0Y, +06tlpo0oXmCGp0T, +hiU0qLN05Hbptif, +W3z000RTTxmKa50, +lbEl0L0NdD0fBej, +TKYxYo0iI0rF4TQ, +HCj2CDF5eWbhvPO, +0M0Ge1C5HjO3z4j, +L0WSVlGFnAuuI0a, +75cKa4w2PF9w2vl, +2qD0lrS307yUNr0, +0oGe00407162sUk, +1wh0pb50H7Jq4EC, +hAL000fsxCsWdw5, +0HhBOJ0W15v0iGl, +00KfH0300kPAla2, +EVqO00n0lddbaa0, +I0yCTS6yv0Ufke0, +24sxz0gdv0SX000, +Q0zW0FDs1X070Ym, +o30k5f0kN00DpMl, +V0UtdrZ0Tnj47ps, +yfT03QZ77drj0H5, +roU009n8q040tuz, +08r0000pRdRe000, +HDNP0GmSX001h9a, +hoUgxDqD3x0iReL, +bIKR5O0B00BLBP5, +hOHBNpC8IaLnKh0, +00w8iVEVR09lTTM, +0phAov1Fafg0uiP, +lv0CdQVPuHhPzwY, +ji00prZXWuBv000, +F0a9f710iv0cOod, +CuDc7BlkB0ubT0k, +u23W0maYZj0YUAD, +a78h0800000oqp8, +tZxINxzbMj8YdkF, +vqIDLGi0000G3CO, +LDfG0Uogd0YR0AW, +WrjWotWty0Bp0Rg, +0HlxaCLlZEC61Q0, +CWI6cZ0j7bdaPVZ, +p000UPB10iINThy, +wZ0O0NAp01kCb1B, +Ynix00uZS0Dx0w3, +0IZ7H3sv0l59I2u, +qR56gK3b0K7kyp3, +40y4B0fhiqpn082, +vLB0FAO0KhQmMVA, +H00TGIG06BGmC10, +VWDCN4Gfl8uws00, +ffQnEXoKE1f0ZEO, +Jb0hx0u00K0NzfC, +2TXqlSwfQ07MRrV, +0D0c8WXq0Roc7AX, +aRQ2Y6g050f0Lpp, +0gW0Wb7a0Kb0I0s, +RU0A5UaEuFiO0jV, +yFTAz4A0tf0CrDc, +04Ejf00UUg4gts0, +icX0dG0cr0007uz, +00HF0sfRt2yiOes, +tl41yE0gNX0FObG, +00O0i7FdHaTyusn, +00Gzym0DKz0pm3d, +ZC02pyLEiITa7m1, +mEa6X5f40Ao0Wwu, +F00ht0JbPJ3C0eS, +puZwECwPqBV0NRq, +0KKDxB6uX0L0Ajg, +VBz000Fk0PB7IZd, +TxU0yJ0QsbQSI3T, +200lSbfkGwGF14q, +wugkEbks6M0iRiW, +vJWr0ZsA0k00gY0, +dPi0kfE0F0300R0, +R04r0NCxf3zpLPX, +tuFyh0Nj0obBx0w, +dSY30LV0S83okzi, +m0m9PT50460YvG0, +M00000Mg0nUQBd0, +hqSx0N0Z0h0OJ0n, +w833tXYdbh0dWRA, +L0007y50FqJe02B, +809cJ1iw00VahwW, +9qengrJ3z0MLFmN, +0T0kM0s0B0RhlA0, +O0i90KAz0kIqQJ0, +00HFM3tVVYgUxUh, +1K55Q900KK2z022, +hqwfJzvUI5Freze, +0YpEs0lY30POmBm, +0NS5Xnv0GO6R42Y, +l0JF04Jzf99p0qu, +Zi04SbD1cdz0HqM, +gOswyq0030a0kr0, +x6dIMYCU0rbt05I, +jMqvFLf9v05CfS0, +z0C0RV0UnKm06Ie, +0pa0G97SFGT0o0d, +8qBG5Xk5AiS9hC5, +Z2go5k0p1ZLq5ej, +4PbhPqa0z0YQM5a, +ta00W0IrfZALt0G, +0OmBcFBCIf0Eq1r, +700e0Scdoc0nqYa, +T4DsttVL0z0MrY0, +G0Tp0CXK0A40Ko0, +gqTDj6vdQNxEB0B, +fN0WEyLnUC1XpsZ, +7V09b04m0G0fkf0, +MK8TeyvifcdwKrz, +ewAp0ReYMDHHF0r, +io8wIfdTpAfT0dQ, +0i0i60w0j30LPXZ, +8a0PAKDPrVb0MS4, +0dQ8HRsjQ0xDnJM, +e2r5002J60bLgCS, +00HyoJzBV0NrwCa, +cg4ll0a0vJSUX8j, +00ul1w4zV0jUrSl, +wt5Y0MccZjzXyGJ, +n7x0fkIvQwK0kG3, +XNmUwfqLtotUW49, +Vug0P8X0Wt0Pe0c, +0000x0sil42e0DU, +o0Y0hvdnhMM4ZqT, +J0BtWL1PDajYi0c, +O0a0U05VIWUrH0g, +ou0lNwN4HeYV3NK, +00yXLoPdaZ0PC0e, +PtUL0q06I2ua0HA, +0IDU1PMpVn00EN0, +000ygQzZ1bA601o, +PaXmE0PT0Rg000E, +PpE8Liou90DfuEY, +r00Z4PSb03IiTVM, +JcP8Q000MQx5szt, +q0v09D0NbbA4Ka0, +DD01GUUnVs0JZpQ, +AoYq00g9F0maWkj, +01F0m9ixP0hThax, +XLrNr7TayzJLqPl, +400yofVjWL2t53f, +CS0wnKEIDTJOn0p, +T6RqgQbyFMFT30V, +0WM90zVnt05nS07, +04NcNfxZF9y30PF, +RY0zF0a0qMh116J, +03rb6pe0egg0l00, +sjSjAHcDsCSi6tZ, +tQA3PXKdgP0L0dB, +090h0x6BihII8WY, +GEbN0hTZO10A0e0, +0000gULEB5b80Zl, +00v00AsaWl0m06p, +N00ucifyKA0jMZU, +LBnv100sZvpCf40, +A0CB0qlCPot1NSi, +4g0IX0YxXLva3e0, +0J91wFRM0F10Pq8, +GYOyY2zAK49lOqT, +00oDw9G00M0LoA0, +wemPcY0O6e0H0Ya, +8mszApU503f0i9F, +BTHlR0iwn8P8t0w, +FqbiMciBR7Rp001, +0O0gpH00Sp29S9c, +hD0nu0ceg6Lbj0E, +UXpURvF300Z0000, +M71Rgvz0bnoS0gw, +eW00EJVs9Q0iDhA, +uCw6D000PkJ5wyN, +B3atJ0FdXI40lrd, +U4Gfqf0M0EVzC8J, +5j1mykFXyN0dslf, +0013JJ3H60s05O0, +5jdW0FJLT0Xa207, +05dM0IcX9eys0pe, +H0LOsO5w6t10BPr, +0x30f3Qd00Meq00, +pyKzMz5lNmzEm0j, +o6mYa000qnnmkgE, +0TgAZfP0p74s0sW, +pugU550rua7mBhS, +0A5TXHfyNyO5C00, +HHHX0M0pgddcUH0, +Q4w0oyVvz7Kz2q0, +hp0Bjz01DuusdI4, +0NVEZ0OJ8b0c5KG, +aR6kbQc00tIF0KQ, +010Kr800QPX00B0, +3KM86XqkcJjXA8D, +7kF0pC2hOgZFL0p, +aVktlp0Os0xCBMt, +7F04d4rKJ9cmXEH, +6Wa00IodzUbNq5S, +sRZS00J50V223j0, +hHAW5JsEhLV0M0O, +J0g07P7mHV0DkY0, +8000bNUxJYu6vES, +i0hNpIMChgSZ3KD, +00900M0LtaVfrX4, +0G7xFJz7wbKtW0K, +dnqGzDAUq3Nu0m0, +0RY0it0YS0yMjQa, +ApPP0040uC0h8W0, +WVmPUaG9PcimMTO, +R0ht0z0R00NQmOL, +fSzbGEd39U0t200, +0BX30Y010q0HCk0, +wSIpH0YSKASAFhe, +00S5NZolc6rLg96, +AaVe3mRw00st105, +e0XC0xhyZJjiE0e, +B0q0hKK00QT03eT, +fRzn1X0XC2dsr0X, +lJ6AeQFnv6QZ20E, +MQZCD0ZO0TznBZj, +F80qu0zu0aw0LM0, +6BN02cqE0Q0APRB, +0OiQS3pfQ7VAL10, +00zLSIjS00qEV5t, +Y3db10bQr00C1e0, +0gw08Efb2cY00La, +sJno00PexUbipyU, +n6tvH7rZ6w6X0c0, +3zh0jAb3Bb0DuZI, +0sh1V0qEvqOM09l, +QL0P0XHUC0xEd00, +DB6Gr0080llDi0F, +LGWGmY0j7BOiail, +N000S0kIc0ncBc3, +nVcCvgAY3dnTPNZ, +X8MmFybpDHLl9xa, +Z30Gw0909030l01, +lLYY7GlrlAB0PVw, +00J8J0w0mM4z0c7, +D3aV5z00QT07Rk0, +cjUMfhWQ42jJt00, +rmO0XqTeXmyEa0i, +bP1aN00E06jYv0O, +7Pn0anq604SmACT, +bTJQdUm60PK40g0, +c0vMiY0Fk0Anen0, +j1vGSgqdsOqyQLD, +cy2qao9wR0HkD40, +8003IGMeBkYay2M, +eDRiiG90pWAG0Xy, +P0k8bhVN015eo0H, +7z7mW0ha0Q0k1io, +eIG0K0TV9dXoLZ0, +h1000N0is407Lg1, +0pJvl0qzW0Y2Ql0, +VLHvRmu0d8dL00o, +XcBE3DC7oFIG7FU, +0l6aar0C20Ci2UC, +WW6ezLBuwmL0b77, +000qkPExulhjy9J, +5qrD0wpQ6gZ3000, +0jRKWRQN0MLS3TN, +0wTbiVsfcmCK100, +sv8kmO060vivGEV, +30OZ0imf0SFzLoo, +n0G0v6FUE0xN11i, +2N0zcvBDoJZoh00, +kaXzkhUrlDLQ0nL, +xd0RJj703FzcI90, +0NHqY5KAdbUJDBp, +u0Vhj8KY0qy0zU0, +XOY00nmT9uNtQwF, +0jJTTpV0Il0000n, +EV009T0u0RhLAx9, +MzFG05jur3Up000, +00mN0N05Pbsq3f7, +Zikl4XNT0z19mff, +0j00diV2r00Ds0U, +MS308j4qJS00K0c, +0AhUKyH0YOdDao0, +5p60z0kLbPL00eo, +0ZSV0fPNnTxkZjC, +Eg0Vz2Ow0x0kYPl, +fXwQz3nM04lZu0L, +aUCAUoD9xoW0BL6, +SAT03277pw0AO00, +zoH9d0jczViw0Xr, +Gt0A10CaSqyzI8T, +O8vnAxCdsR2000I, +0yZRrHdVu5ugO0K, +JzAUuUePb0YE000, +0x0M0cIByl03v0x, +EK000W0Cpf0BslL, +DPdy1AiJprryAPH, +kt009A50K50p6p0, +h0VZJw50dbIq4LZ, +j0ZMHWcs0Pzzcil, +5UPV0o00LG9VE0U, +f0e0vPf0z00010N, +Lz000AuIlD00K42, +L80zHLd00EHG0v2, +NSm0G04Hsa0000f, +qvdmzqU3U0oL0yv, +PoY0Vz0Px0p80M0, +op0ibc3cdt0k8aM, +0j0cEXuFVvUV0bk, +DYEMaWLnF3k80ut, +4c4aU3Ea5ZUjc0o, +KgJjA5Bnqg0V0o0, +kk0dBfeSYsv4eE0, +VQDiAcpDNErI0xB, +0Rzh00hOlQ9i0jE, +00Ws1s2m55s0e20, +A0A6fg5OxoIeCD0, +pTHRxhC4ufwq70d, +dEpoUe1QJQC0575, +zV00P0BSYl8TmEb, +0ClUR0rUXL0000W, +ad0t101hNrSFi5D, +SYU1Yq1Gtb9GiF0, +0Q0x0c00P0gff90, +0CyZWa0EsgglL5n, +0XPc00dLu0A0fT0, +bqS9n7aLf0i02NO, +q0n0zx0wPa0EZkQ, +SIT0k0n8zqmDfa0, +g0300m0r100MaY0, +SG900k4NqikU608, +9i08m9avESjptbQ, +rT000dc37k5NsED, +b50tTR00iz0L0W0, +xKDGCV0c9Vqy2zi, +YV8004s0FUrS0fY, +i0YDX0btc8PdVoC, +0EvVZDD00leIsAw, +YU0vvQvvF7dJ6Ae, +06oMK2JJ0uSz0LN, +q0pcgxfg0e8100K, +ssIK08D0hF0DDNi, +mFf00sG954J803D, +yVy0E00HwY0CByI, +W0dG1nck0rsnqPm, +0kG0Nt5n00klSyp, +PqsTm2gjKP3nv0Z, +t5lVUr0Rmf00u0j, +maek0tTXUw9Wt20, +N0nLbE0tWL008N5, +H7Tmh6asy900I0P, +0b004LqBsn2ubeM, +q0yyN000007Qt01, +50Pz0XSJHMJ0k00, +CCfE0dGnbRXHWtq, +0Ko0P031j70nshN, +K00X00LQsGNr0dY, +TCWTQbAlVJU0Qa0, +0B22t0gnhFQlUL0, +G00ez000EDf0rsb, +m0nv0TaUtyTSaQW, +xG900d5vApMV046, +0PfNjNQD7ZaWIGB, +0CZNvY000F000BH, +sZySyg0huMnSK0Q, +80GKd0k7kcy5Z0Y, +yWttb12gnDy0UqY, +91By0z0fWkW8ljA, +OzM0000ezPI0KGF, +L0DVO9oj3BMmS50, +eoWsC00tew2Fo0s, +S0s08IG0DX2dQII, +0pQX0wxfaUC0WzI, +awDV800hngK70mv, +Yr50nhIEL9gT5v4, +j3H0hX0X0IMB90n, +8srb5IR0QEZs0N0, +030F0aLdTWb0oI0, +as0g5zmaTEG1X0L, +a0On0hJxC6Mi92R, +C0ch0fDO0W7bDjZ, +M00kyJSsK0hyBI6, +ND20ngrV0H8qt0r, +v0yIIY0CoQO3il0, +Upp3gYNrCHd0o2v, +Du0zcgI0Nlfbnb0, +7aN0Pda0cxb00H6, +nYd90GFMGQk5KXr, +Hd07qOC000IAY0y, +d42Z000ScKz2Enr, +Dp8RXMDzZW8Oq6j, +akNsq0bH01FbSfx, +0c50R80PArr00X0, +3gX8pSTqhBs0dGu, +GiQdBy0oR3h0xe0, +KGMTCjoo09NXYRd, +b00AbDlvvP4wMUP, +v0sAA04UVFbFW0w, +Q0oMx0SwZHPj0v0, +00Dc02m2P0750Iv, +00H0f94xRdf0vr7, +1z000jT6Y30Q0u0, +00mv42ePoYvp3l6, +yH0wH9F0aQl507H, +GD8l0EwXdatAmTU, +h0Jnn9RYVn0qNJJ, +UsnrJ90sR1XK00y, +00CgT0q00SJbr00, +yxZC000Tj80k07I, +Z900000028fyk0z, + + + + + + + + + + + 间隔秒 + + + + + + + + + + 1688000 + + + 300 + + + + + + + + + + + 偏离概率(千分比) + + + + + + + 1000 + + + + + + + + + + + + 模拟量/累积量/混合量模拟相关参数 + + + + + + 正常区间起始值 + + + + + + + 50000000000000000.000000000000000 + + + + + + + 正常区间长度 + + + + + + + 7777777777777777311744.000000000000000 + + + 10000.000000000000000 + + + + + + + 偏离方向 + + + + + + + + 右边 + + + + + 两边 + + + + + 左边 + + + + + + + + + + + + + + + 开始时间 + + + + + + + + + + + + + + + 结束时间 + + + + + + + + + + + + + + + + + + + + + + + 是否删除所有数据 + + + + + + + 是否删除区间数据 + + + + + + + 是否多线程 + + + true + + + + + + + 插入 + + + + + + + 删除 + + + + + + + + + + 历史数据测试 + + + + + + + + + 1 + 0 + + + + 测试基本参数 + + + + + + + + 超时时间(秒) + + + + + + + 35 + + + + + + + + + + + 测试基数 + + + + + + + 10000000 + + + 10 + + + + + + + + + + + 增长基数 + + + + + + + 5 + + + + + + + + + + + + 测点标签(,分隔): + + + + + + + 1 + 0 + + + + zJT3FvCsnU00Hoy, +R0vPO0M900004ag, +h0fx2Ly887lQtsR, +7hn20GNtBtDQMvC, +Edu0ys0vqGAK9Hn, +0EXr0urSw5cq000, +yn0u00OWWCro0Qe, +f0QPi0lI00k5hT7, +xTK080KDk7sE0Kg, +Vi5lHdn0KLo9S0R, +I0aAzoOO50d0qzd, +L6YjGO0IPeK0H00, +inJmCZpxZWR0aRz, +fnv0Z05LlEHqk0O, +AkyMnJlL5C0m0pg, +e0O0rCnrBT40dfR, +Q0eOTmhY00GYoPW, +o0OLEU9AmWY0Tzb, +sqdasVp0Gf3cPXL, +n0MBaM0z3E7XxiM, +U0I0T0oIEX9zAG2, +MCvgqEnyfUP07J0, +0OGSw00j00sXwl0, +uYpXv0L5Eba6x00, +DuGWm7q05D09qik, +XY5BIsABVbb07Uz, +Ge3v0tZkO0eRTh1, +i14NZ0LUCC1YkRo, +bZKUgi0gecPBShj, +b00lt0CxOYSFsx8, +AEIpYK10qx34e0t, +00RUqHdUwCK0Qkq, +VmNxvhsddVV004T, +f08000D0QJpN6B0, +QyRlvHyTyo00q0v, +WN0svB0USDLLyoW, +0UV0ai0tl0VwIyL, +sVDqGva0CGe115N, +xK0lN00M04V0000, +o0BpjCk34A70900, +40kQ8oI0Ik0n0j0, +0Dp6vf01WjXP000, +d5k8060n6QC0Q01, +ZFh00ro0o4F10c0, +Xb5y0t0RK00KKNq, +j1jogcBjaYfgaos, +ufyevkis208vpLh, +f070qAAml60RY8A, +0DORIurNG0xuHl9, +TWCP00za3NZXXxc, +cB0R05sfmO9bWA6, +l0zL0obPT0k0ErG, +Z07LE3FAL90Td00, +nD00BPwN0t0YnEa, +N0ZMfj8l0Y60GF0, +T20kbjxMRnkxXTJ, +Ufc0lWp0swFCljE, +J3b0C0z7zeXa0VD, +YaDTXd2LZ0YQIke, +g0R00L0v0A0y0WB, +72010x0XUpbzPI1, +Hjwv44xY0sX0206, +aE00hI50Wncz0KP, +8jc0599LRnd0q3C, +Z02Se0wt0O000A0, +40ISv0eVKom01h0, +AX2H00Ai500q410, +iyJKT06Uy00uPBy, +OSn0JbcStSd2AI6, +M3QT0of070o1Xte, +ozu0DYn0RfvMrAg, +lwKM5p0GC0hhvcK, +59oxjgO8xWh3A9b, +3hOcL09V0s50GaE, +ROiEW000xK4rFWS, +eiU06nvRvKRqWd0, +WPjPoj9Vo8R5Dk9, +aSDCBqi0tyMeBD8, +qVN8x50Ree4X0A7, +K0ZgDMCTpigeW6l, +mn81010jL600x00, +n2c0g10NM00h0Qz, +yFbimNIe0HVbWFk, +elEvAw0ZDCV0VDk, +zFY0K0n4E00krN0, +G0CveLTU0f90g0K, +dn0RKVIGnsI4PD0, +JD0TlzjtUJ1KoY8, +lbnD0SjsR0O3JhW, +iGufd0oSu2J0Zpd, +00U5VQJQ02tlGd0, +aWeGoOK0n4X6Syo, +4vfHc20030r0kNc, +0jyJ9W0V9n0GP0Y, +06tlpo0oXmCGp0T, +hiU0qLN05Hbptif, +W3z000RTTxmKa50, +lbEl0L0NdD0fBej, +TKYxYo0iI0rF4TQ, +HCj2CDF5eWbhvPO, +0M0Ge1C5HjO3z4j, +L0WSVlGFnAuuI0a, +75cKa4w2PF9w2vl, +2qD0lrS307yUNr0, +0oGe00407162sUk, +1wh0pb50H7Jq4EC, +hAL000fsxCsWdw5, +0HhBOJ0W15v0iGl, +00KfH0300kPAla2, +EVqO00n0lddbaa0, +I0yCTS6yv0Ufke0, +24sxz0gdv0SX000, +Q0zW0FDs1X070Ym, +o30k5f0kN00DpMl, +V0UtdrZ0Tnj47ps, +yfT03QZ77drj0H5, +roU009n8q040tuz, +08r0000pRdRe000, +HDNP0GmSX001h9a, +hoUgxDqD3x0iReL, +bIKR5O0B00BLBP5, +hOHBNpC8IaLnKh0, +00w8iVEVR09lTTM, +0phAov1Fafg0uiP, +lv0CdQVPuHhPzwY, +ji00prZXWuBv000, +F0a9f710iv0cOod, +CuDc7BlkB0ubT0k, +u23W0maYZj0YUAD, +a78h0800000oqp8, +tZxINxzbMj8YdkF, +vqIDLGi0000G3CO, +LDfG0Uogd0YR0AW, +WrjWotWty0Bp0Rg, +0HlxaCLlZEC61Q0, +CWI6cZ0j7bdaPVZ, +p000UPB10iINThy, +wZ0O0NAp01kCb1B, +Ynix00uZS0Dx0w3, +0IZ7H3sv0l59I2u, +qR56gK3b0K7kyp3, +40y4B0fhiqpn082, +vLB0FAO0KhQmMVA, +H00TGIG06BGmC10, +VWDCN4Gfl8uws00, +ffQnEXoKE1f0ZEO, +Jb0hx0u00K0NzfC, +2TXqlSwfQ07MRrV, +0D0c8WXq0Roc7AX, +aRQ2Y6g050f0Lpp, +0gW0Wb7a0Kb0I0s, +RU0A5UaEuFiO0jV, +yFTAz4A0tf0CrDc, +04Ejf00UUg4gts0, +icX0dG0cr0007uz, +00HF0sfRt2yiOes, +tl41yE0gNX0FObG, +00O0i7FdHaTyusn, +00Gzym0DKz0pm3d, +ZC02pyLEiITa7m1, +mEa6X5f40Ao0Wwu, +F00ht0JbPJ3C0eS, +puZwECwPqBV0NRq, +0KKDxB6uX0L0Ajg, +VBz000Fk0PB7IZd, +TxU0yJ0QsbQSI3T, +200lSbfkGwGF14q, +wugkEbks6M0iRiW, +vJWr0ZsA0k00gY0, +dPi0kfE0F0300R0, +R04r0NCxf3zpLPX, +tuFyh0Nj0obBx0w, +dSY30LV0S83okzi, +m0m9PT50460YvG0, +M00000Mg0nUQBd0, +hqSx0N0Z0h0OJ0n, +w833tXYdbh0dWRA, +L0007y50FqJe02B, +809cJ1iw00VahwW, +9qengrJ3z0MLFmN, +0T0kM0s0B0RhlA0, +O0i90KAz0kIqQJ0, +00HFM3tVVYgUxUh, +1K55Q900KK2z022, +hqwfJzvUI5Freze, +0YpEs0lY30POmBm, +0NS5Xnv0GO6R42Y, +l0JF04Jzf99p0qu, +Zi04SbD1cdz0HqM, +gOswyq0030a0kr0, +x6dIMYCU0rbt05I, +jMqvFLf9v05CfS0, +z0C0RV0UnKm06Ie, +0pa0G97SFGT0o0d, +8qBG5Xk5AiS9hC5, +Z2go5k0p1ZLq5ej, +4PbhPqa0z0YQM5a, +ta00W0IrfZALt0G, +0OmBcFBCIf0Eq1r, +700e0Scdoc0nqYa, +T4DsttVL0z0MrY0, +G0Tp0CXK0A40Ko0, +gqTDj6vdQNxEB0B, +fN0WEyLnUC1XpsZ, +7V09b04m0G0fkf0, +MK8TeyvifcdwKrz, +ewAp0ReYMDHHF0r, +io8wIfdTpAfT0dQ, +0i0i60w0j30LPXZ, +8a0PAKDPrVb0MS4, +0dQ8HRsjQ0xDnJM, +e2r5002J60bLgCS, +00HyoJzBV0NrwCa, +cg4ll0a0vJSUX8j, +00ul1w4zV0jUrSl, +wt5Y0MccZjzXyGJ, +n7x0fkIvQwK0kG3, +XNmUwfqLtotUW49, +Vug0P8X0Wt0Pe0c, +0000x0sil42e0DU, +o0Y0hvdnhMM4ZqT, +J0BtWL1PDajYi0c, +O0a0U05VIWUrH0g, +ou0lNwN4HeYV3NK, +00yXLoPdaZ0PC0e, +PtUL0q06I2ua0HA, +0IDU1PMpVn00EN0, +000ygQzZ1bA601o, +PaXmE0PT0Rg000E, +PpE8Liou90DfuEY, +r00Z4PSb03IiTVM, +JcP8Q000MQx5szt, +q0v09D0NbbA4Ka0, +DD01GUUnVs0JZpQ, +AoYq00g9F0maWkj, +01F0m9ixP0hThax, +XLrNr7TayzJLqPl, +400yofVjWL2t53f, +CS0wnKEIDTJOn0p, +T6RqgQbyFMFT30V, +0WM90zVnt05nS07, +04NcNfxZF9y30PF, +RY0zF0a0qMh116J, +03rb6pe0egg0l00, +sjSjAHcDsCSi6tZ, +tQA3PXKdgP0L0dB, +090h0x6BihII8WY, +GEbN0hTZO10A0e0, +0000gULEB5b80Zl, +00v00AsaWl0m06p, +N00ucifyKA0jMZU, +LBnv100sZvpCf40, +A0CB0qlCPot1NSi, +4g0IX0YxXLva3e0, +0J91wFRM0F10Pq8, +GYOyY2zAK49lOqT, +00oDw9G00M0LoA0, +wemPcY0O6e0H0Ya, +8mszApU503f0i9F, +BTHlR0iwn8P8t0w, +FqbiMciBR7Rp001, +0O0gpH00Sp29S9c, +hD0nu0ceg6Lbj0E, +UXpURvF300Z0000, +M71Rgvz0bnoS0gw, +eW00EJVs9Q0iDhA, +uCw6D000PkJ5wyN, +B3atJ0FdXI40lrd, +U4Gfqf0M0EVzC8J, +5j1mykFXyN0dslf, +0013JJ3H60s05O0, +5jdW0FJLT0Xa207, +05dM0IcX9eys0pe, +H0LOsO5w6t10BPr, +0x30f3Qd00Meq00, +pyKzMz5lNmzEm0j, +o6mYa000qnnmkgE, +0TgAZfP0p74s0sW, +pugU550rua7mBhS, +0A5TXHfyNyO5C00, +HHHX0M0pgddcUH0, +Q4w0oyVvz7Kz2q0, +hp0Bjz01DuusdI4, +0NVEZ0OJ8b0c5KG, +aR6kbQc00tIF0KQ, +010Kr800QPX00B0, +3KM86XqkcJjXA8D, +7kF0pC2hOgZFL0p, +aVktlp0Os0xCBMt, +7F04d4rKJ9cmXEH, +6Wa00IodzUbNq5S, +sRZS00J50V223j0, +hHAW5JsEhLV0M0O, +J0g07P7mHV0DkY0, +8000bNUxJYu6vES, +i0hNpIMChgSZ3KD, +00900M0LtaVfrX4, +0G7xFJz7wbKtW0K, +dnqGzDAUq3Nu0m0, +0RY0it0YS0yMjQa, +ApPP0040uC0h8W0, +WVmPUaG9PcimMTO, +R0ht0z0R00NQmOL, +fSzbGEd39U0t200, +0BX30Y010q0HCk0, +wSIpH0YSKASAFhe, +00S5NZolc6rLg96, +AaVe3mRw00st105, +e0XC0xhyZJjiE0e, +B0q0hKK00QT03eT, +fRzn1X0XC2dsr0X, +lJ6AeQFnv6QZ20E, +MQZCD0ZO0TznBZj, +F80qu0zu0aw0LM0, +6BN02cqE0Q0APRB, +0OiQS3pfQ7VAL10, +00zLSIjS00qEV5t, +Y3db10bQr00C1e0, +0gw08Efb2cY00La, +sJno00PexUbipyU, +n6tvH7rZ6w6X0c0, +3zh0jAb3Bb0DuZI, +0sh1V0qEvqOM09l, +QL0P0XHUC0xEd00, +DB6Gr0080llDi0F, +LGWGmY0j7BOiail, +N000S0kIc0ncBc3, +nVcCvgAY3dnTPNZ, +X8MmFybpDHLl9xa, +Z30Gw0909030l01, +lLYY7GlrlAB0PVw, +00J8J0w0mM4z0c7, +D3aV5z00QT07Rk0, +cjUMfhWQ42jJt00, +rmO0XqTeXmyEa0i, +bP1aN00E06jYv0O, +7Pn0anq604SmACT, +bTJQdUm60PK40g0, +c0vMiY0Fk0Anen0, +j1vGSgqdsOqyQLD, +cy2qao9wR0HkD40, +8003IGMeBkYay2M, +eDRiiG90pWAG0Xy, +P0k8bhVN015eo0H, +7z7mW0ha0Q0k1io, +eIG0K0TV9dXoLZ0, +h1000N0is407Lg1, +0pJvl0qzW0Y2Ql0, +VLHvRmu0d8dL00o, +XcBE3DC7oFIG7FU, +0l6aar0C20Ci2UC, +WW6ezLBuwmL0b77, +000qkPExulhjy9J, +5qrD0wpQ6gZ3000, +0jRKWRQN0MLS3TN, +0wTbiVsfcmCK100, +sv8kmO060vivGEV, +30OZ0imf0SFzLoo, +n0G0v6FUE0xN11i, +2N0zcvBDoJZoh00, +kaXzkhUrlDLQ0nL, +xd0RJj703FzcI90, +0NHqY5KAdbUJDBp, +u0Vhj8KY0qy0zU0, +XOY00nmT9uNtQwF, +0jJTTpV0Il0000n, +EV009T0u0RhLAx9, +MzFG05jur3Up000, +00mN0N05Pbsq3f7, +Zikl4XNT0z19mff, +0j00diV2r00Ds0U, +MS308j4qJS00K0c, +0AhUKyH0YOdDao0, +5p60z0kLbPL00eo, +0ZSV0fPNnTxkZjC, +Eg0Vz2Ow0x0kYPl, +fXwQz3nM04lZu0L, +aUCAUoD9xoW0BL6, +SAT03277pw0AO00, +zoH9d0jczViw0Xr, +Gt0A10CaSqyzI8T, +O8vnAxCdsR2000I, +0yZRrHdVu5ugO0K, +JzAUuUePb0YE000, +0x0M0cIByl03v0x, +EK000W0Cpf0BslL, +DPdy1AiJprryAPH, +kt009A50K50p6p0, +h0VZJw50dbIq4LZ, +j0ZMHWcs0Pzzcil, +5UPV0o00LG9VE0U, +f0e0vPf0z00010N, +Lz000AuIlD00K42, +L80zHLd00EHG0v2, +NSm0G04Hsa0000f, +qvdmzqU3U0oL0yv, +PoY0Vz0Px0p80M0, +op0ibc3cdt0k8aM, +0j0cEXuFVvUV0bk, +DYEMaWLnF3k80ut, +4c4aU3Ea5ZUjc0o, +KgJjA5Bnqg0V0o0, +kk0dBfeSYsv4eE0, +VQDiAcpDNErI0xB, +0Rzh00hOlQ9i0jE, +00Ws1s2m55s0e20, +A0A6fg5OxoIeCD0, +pTHRxhC4ufwq70d, +dEpoUe1QJQC0575, +zV00P0BSYl8TmEb, +0ClUR0rUXL0000W, +ad0t101hNrSFi5D, +SYU1Yq1Gtb9GiF0, +0Q0x0c00P0gff90, +0CyZWa0EsgglL5n, +0XPc00dLu0A0fT0, +bqS9n7aLf0i02NO, +q0n0zx0wPa0EZkQ, +SIT0k0n8zqmDfa0, +g0300m0r100MaY0, +SG900k4NqikU608, +9i08m9avESjptbQ, +rT000dc37k5NsED, +b50tTR00iz0L0W0, +xKDGCV0c9Vqy2zi, +YV8004s0FUrS0fY, +i0YDX0btc8PdVoC, +0EvVZDD00leIsAw, +YU0vvQvvF7dJ6Ae, +06oMK2JJ0uSz0LN, +q0pcgxfg0e8100K, +ssIK08D0hF0DDNi, +mFf00sG954J803D, +yVy0E00HwY0CByI, +W0dG1nck0rsnqPm, +0kG0Nt5n00klSyp, +PqsTm2gjKP3nv0Z, +t5lVUr0Rmf00u0j, +maek0tTXUw9Wt20, +N0nLbE0tWL008N5, +H7Tmh6asy900I0P, +0b004LqBsn2ubeM, +q0yyN000007Qt01, +50Pz0XSJHMJ0k00, +CCfE0dGnbRXHWtq, +0Ko0P031j70nshN, +K00X00LQsGNr0dY, +TCWTQbAlVJU0Qa0, +0B22t0gnhFQlUL0, +G00ez000EDf0rsb, +m0nv0TaUtyTSaQW, +xG900d5vApMV046, +0PfNjNQD7ZaWIGB, +0CZNvY000F000BH, +sZySyg0huMnSK0Q, +80GKd0k7kcy5Z0Y, +yWttb12gnDy0UqY, +91By0z0fWkW8ljA, +OzM0000ezPI0KGF, +L0DVO9oj3BMmS50, +eoWsC00tew2Fo0s, +S0s08IG0DX2dQII, +0pQX0wxfaUC0WzI, +awDV800hngK70mv, +Yr50nhIEL9gT5v4, +j3H0hX0X0IMB90n, +8srb5IR0QEZs0N0, +030F0aLdTWb0oI0, +as0g5zmaTEG1X0L, +a0On0hJxC6Mi92R, +C0ch0fDO0W7bDjZ, +M00kyJSsK0hyBI6, +ND20ngrV0H8qt0r, +v0yIIY0CoQO3il0, +Upp3gYNrCHd0o2v, +Du0zcgI0Nlfbnb0, +7aN0Pda0cxb00H6, +nYd90GFMGQk5KXr, +Hd07qOC000IAY0y, +d42Z000ScKz2Enr, +Dp8RXMDzZW8Oq6j, +akNsq0bH01FbSfx, +0c50R80PArr00X0, +3gX8pSTqhBs0dGu, +GiQdBy0oR3h0xe0, +KGMTCjoo09NXYRd, +b00AbDlvvP4wMUP, +v0sAA04UVFbFW0w, +Q0oMx0SwZHPj0v0, +00Dc02m2P0750Iv, +00H0f94xRdf0vr7, +1z000jT6Y30Q0u0, +00mv42ePoYvp3l6, +yH0wH9F0aQl507H, +GD8l0EwXdatAmTU, +h0Jnn9RYVn0qNJJ, +UsnrJ90sR1XK00y, +00CgT0q00SJbr00, +yxZC000Tj80k07I, +Z900000028fyk0z, + + + + + + + + + + 开始日期 + + + + + + + 1 + 0 + + + + + + + + + + + + + + + 测试间隔(暂未实现) + + + + + + 日(小时) + + + true + + + + + + + 周(天) + + + true + + + + + + + 月(天) + + + true + + + + + + + 年(月) + + + true + + + + + + + + + + 计算方案(暂未实现) + + + + + + 差值 + + + true + + + + + + + 最大值 + + + true + + + + + + + 平均值 + + + true + + + + + + + 最小值 + + + true + + + + + + + 瞬时值 + + + true + + + + + + + + + + 测试地址 + + + + + + 127.0.0.1 + + + + + + + + + + 测试结果 + + + + + + + 3 + 4 + + + + + 结果 + + + + + 规模 + + + + + 周期 + + + + + 开始日期 + + + + + 结束日期 + + + + + 间隔(s) + + + + + 结果数量 + + + + + 方法 + + + + + 用时(ms) + + + + + + + + + 0 + 1 + + + + + + + + + + + + + 开始测试 + + + + + + + 结束测试 + + + + + + + + + + + + 历史事件 + + + + + + + 0 + 0 + + + + 测点标签(,分隔): + + + + + + + + 0 + 0 + + + + 固定参数 + + + + + + + + + 0 + 0 + + + + ALM_STATUS(报警状态) + + + + + + + + 0 + 0 + + + + 11 + + + + + + + + + + + + 0 + 0 + + + + SUB_SYSTEM(专业ID) + + + true + + + + + + + 4 + + + + + + + + + + + + 0 + 0 + + + + LOCATION_ID(位置ID) + + + + + + + 1 + + + + + + + + + + + + 0 + 0 + + + + REGION_ID(责任组ID) + + + true + + + true + + + + + + + 1 + + + + + + + + + + + + 0 + 0 + + + + ALM_STYLE(告警方式) + + + + + + + + + + + + + + + 0 + 0 + + + + DEV_TYPE(设备类型ID) + + + true + + + + + + + 7 + + + + + + + + + + + + 0 + 0 + + + + PRIORITY(报警优先级) + + + true + + + + + + + + 0 + 0 + + + + 2 + + + + + + + + + + + + 0 + 0 + + + + ALM_TYPE(报警类型) + + + true + + + + + + + + 0 + 0 + + + + 1 + + + + + + + + + + + + occ.dev3_ht100.yx34 + + + + + + + + + 间隔秒 + + + + + + + + + + 1688000 + + + 300 + + + + + + + + + + + 报警内容(tag_name) + + + + + + + [tag_name] 中断 + + + + + + + + + + 0 + 0 + + + + 开始时间 + + + + + + + + + + + + + + + + 0 + 0 + + + + 结束时间 + + + + + + + + + + + + + + + + + + + 插入 + + + + + + + 删除 + + + + + + + + + + + + + + diff --git a/platform/src/example/tsdbDataSim/RandUtil.h b/platform/src/example/tsdbDataSim/RandUtil.h new file mode 100644 index 00000000..b76ba09c --- /dev/null +++ b/platform/src/example/tsdbDataSim/RandUtil.h @@ -0,0 +1,114 @@ +#pragma once + + +#include +#include + +#include "boost/uuid/random_generator.hpp" +#include "boost/regex.hpp" + +#include + +// 随机生成一个大于 0 小于 10000 的浮点数 +inline double generateRandomNumber() { + std::random_device rnd; + std::mt19937 gen(rnd()); + std::uniform_real_distribution<> dist(0, 10000); + return dist(gen); +} + +inline quint64 quaRand(){ return qrand() * qrand() * qrand();} + +inline bool boolGen(int trueProb = 500){ + if(trueProb == 0) + { + return false; + } + else if (trueProb == 1000) + { + return true; + } + int result = qrand() % 1000; + if( result < trueProb) + { + return true; + } + else + return false; +} +inline double doubleGen(double base,double length) +{ + quint64 lengthx100k = length * 100000; + + return base + (quaRand() % lengthx100k ) /100000.0; +} + +#define DeviateMax 1000000 + +inline double doubleGenController(double base,double length,int deviatProb,int deviatType) +{ + if( boolGen(deviatProb)){ + // 偏离代码 + if(deviatType == 0) + { + if(boolGen()) + return doubleGen(0,base); + else + return doubleGen(base + length,DeviateMax - (base + length)); + + }else if(deviatType == -1) + { + return doubleGen(0,base); + }else if(deviatType == 1) + { + return doubleGen(base + length,DeviateMax); + } + else + { + return 0; + } + + }else{ + return doubleGen(base,length); + } +} + +void generateUuidBase64(std::string &strOut) +{ + boost::uuids::detail::random_provider randomGen; + boost::uint8_t baUuid[18]; + boost::uint8_t baBase64[24]; + + //< 填充随机数 + randomGen.get_random_bytes(&baUuid, 16); + + //< 最后填充 0 + baUuid[16] = 0; + baUuid[17] = 0; + + //< 编码为 base64 + { + static const char *szBase64Array = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + + boost::uint8_t *pData = baUuid; + int nDestIndex = 0; + for (int i = 0; i < 18; i = i + 3) + { + boost::uint32_t nData = ((boost::uint32_t) *pData << 16) + + ((boost::uint32_t) *(pData + 1) << 8) + (*(pData + 2)); + baBase64[nDestIndex] = szBase64Array[nData >> 18]; + baBase64[nDestIndex + 1] = szBase64Array[nData >> 12 & (boost::uint32_t) 0x3f]; + baBase64[nDestIndex + 2] = szBase64Array[nData >> 6 & (boost::uint32_t) 0x3f]; + baBase64[nDestIndex + 3] = szBase64Array[nData & (boost::uint32_t) 0x3f]; + pData = pData + 3; + nDestIndex = nDestIndex + 4; + } + baBase64[22] = 0; + baBase64[23] = 0; + } + + //< 输出 + strOut.assign((const char *) baBase64, 22); + strOut.shrink_to_fit(); +} + diff --git a/platform/src/example/tsdbDataSim/dataWorker.cpp b/platform/src/example/tsdbDataSim/dataWorker.cpp new file mode 100644 index 00000000..b6f5b2aa --- /dev/null +++ b/platform/src/example/tsdbDataSim/dataWorker.cpp @@ -0,0 +1,683 @@ +#include "dataWorker.h" +#include "RandUtil.h" +#include +#include +#include +#include +#include +#include +#include +#include "db_his_query_api/DbHisQueryApi.h" + +enum EnTimeInterval +{ + TI_NULL = 0, //< 无,不使用, + TI_DAY, //< 间隔为小时,停止时间为24小时后 + TI_WEEK, //< 间隔为天,停止时间为7天后 + TI_MONTH, //< 间隔为天,停止时间为30天后 + TI_YEAR, //< 间隔为30天,停止时间为12个30天后 +}; + +void getTimeInteval(EnTimeInterval emTI,const qint64& starttime,qint64& inteval,qint64 & endtime) +{ + switch (emTI) { + case TI_DAY: + inteval = 3600l * 1000l; + endtime = starttime + (inteval * 24l); + break; + case TI_WEEK: + inteval = 24l * 3600l * 1000l; + endtime = starttime + (inteval * 7l); + break; + case TI_MONTH: + inteval = 24l * 3600l * 1000l; + endtime = starttime + (inteval * 30l); + break; + case TI_YEAR: + inteval = 30ll * 24ll * 3600000ll; + endtime = starttime + (inteval * 12ll); + break; + default: + break; + } +} +//< 通过 EnComputeMethod 获取查询的字符串 +static QString getStrFromCM(iot_dbms::EnComputeMethod enCM) +{ + switch (enCM) + { + case iot_dbms::CM_MAX: + return "最大值"; + case iot_dbms::CM_MIN: + return "最小值"; + case iot_dbms::CM_LAST: + return "瞬时值"; + case iot_dbms::CM_MEAN: + return "平均值"; + case iot_dbms::CM_NULL: + return "差值"; // TODO 这里用来临时用来占位差值 + + } + return "无方法"; +} + +//< 通过 EnComputeMethod 获取查询的字符串 +static QString getStrFromTI(EnTimeInterval enTI) +{ + switch (enTI) + { + case TI_DAY: + return "日"; + case TI_WEEK: + return "周"; + case TI_MONTH: + return "月"; + case TI_YEAR: + return "年"; + } + return "无时间"; +} + +const int RETRY_TIME = 10; +void dataWorker::doTest(int timeout, int base, int factor, QStringList listpoint, qint64 starttime, QString address) +{ + + QList listCM; + listCM << iot_dbms::CM_NULL << iot_dbms::CM_MAX << iot_dbms::CM_MIN << iot_dbms::CM_LAST << iot_dbms::CM_MEAN; + + QList listTI; + listTI << TI_DAY << TI_WEEK<< TI_MONTH<< TI_YEAR; +// listTI << TI_YEAR; + + + + iot_dbms::CTsdbConn conn(address.toStdString().c_str()); + if(!conn.pingServer()) + { + emit testResultReady(tr("无法连接数据库"),false); + } + + qint64 timeoutMs = timeout * 1000l; + + + + // a lot of loop + // loop 1 listpoint size + for(size_t pointSize = base; pointSize < listpoint.size(); pointSize += factor){ + QList ::const_iterator itTI; + // loop 2 time interval + for (itTI = listTI.constBegin(); itTI != listTI.constEnd(); ++itTI) { + qint64 inteval = 0,endtime = 0; + getTimeInteval(*itTI,starttime,inteval,endtime); + // loop 3 computeMethod + QList ::const_iterator itCM; + // loop 2 time interval + for (itCM = listCM.constBegin(); itCM != listCM.constEnd(); ++itCM) { + // add listpoint + std::vector vecMpKey; + std::vector *> *vecResult = new std::vector *>(); + + // 构造随机测点集合 + QStringList testPoints; + { + std::vector nums; + for (int i = 0; i < listpoint.size(); i++) { + nums.push_back(i); + } + + std::random_device rd; + std::mt19937 g(rd()); + std::shuffle(nums.begin(), nums.end(), g); + + std::vector random_nums(nums.begin(), nums.begin() + pointSize); + + for (int i : random_nums) { + testPoints << listpoint.at(i); + } + } + + std::vector vecTimeBegin,vecTimeEnd; + for(int i = 0; i < pointSize; i++) + { + for(boost::int64_t queryTime = starttime;queryTime < endtime;queryTime += inteval ) + { + iot_dbms::SMeasPointKey key; + std::string tmp = testPoints[i].toStdString(); + char * tag = (char*)malloc(tmp.size() + 1); + memset(tag, 0, tmp.size() + 1); + memcpy(tag, tmp.c_str(), tmp.size()); + key.m_pszTagName = tag; + key.m_enType = iot_dbms::MPT_AI; + vecMpKey.push_back(key); + + vecResult->push_back(new std::vector()); + vecTimeBegin.push_back(queryTime); + vecTimeEnd.push_back(queryTime + inteval); + } + + if( *itCM == iot_dbms::CM_NULL) // TODO NULL 临时占位差值计算 后面替换 + { + iot_dbms::SMeasPointKey key; + std::string tmp = listpoint[i].toStdString(); + char * tag = (char*)malloc(tmp.size() + 1); + memset(tag, 0, tmp.size() + 1); + memcpy(tag, tmp.c_str(), tmp.size()); + key.m_pszTagName = tag; + key.m_enType = iot_dbms::MPT_AI; + vecMpKey.push_back(key); + + vecResult->push_back(new std::vector()); + vecTimeBegin.push_back(endtime); + vecTimeEnd.push_back(endtime + inteval); + } + } + + // 开始查询 + QElapsedTimer timer; + timer.start(); + + auto actualCM = *itCM; + if( *itCM == iot_dbms::CM_NULL) // TODO NULL 临时占位差值计算 后面替换 + { + actualCM = iot_dbms::CM_LAST; + } + + if(!iot_dbms::getHisValue(conn, timeoutMs, vecMpKey, &vecTimeBegin, &vecTimeEnd, NULL, NULL, actualCM, 0, iot_dbms::FM_NULL_METHOD, *vecResult)) + { + QString testResult; + testResult = QString("超时--%1点,%2[起%5,止%6,间隔:%7s,结果共:%8],%3,共%4ms") + .arg(QString::number(pointSize)) + .arg(getStrFromTI(*itTI)) + .arg(getStrFromCM(*itCM)) + .arg(QString::number(timer.elapsed() )) + .arg(QDateTime::fromMSecsSinceEpoch(starttime).toString("yyyyMMdd")) + .arg(QDateTime::fromMSecsSinceEpoch(endtime).toString("yyyyMMdd")) + .arg(inteval /1000) + .arg(QString::number(vecResult->size())) + ; + QStringList listResult; + listResult << "超时"; + + listResult << QString::number(pointSize); + listResult << getStrFromTI(*itTI); + listResult << QDateTime::fromMSecsSinceEpoch(starttime).toString("yyyyMMdd"); + listResult << QDateTime::fromMSecsSinceEpoch(endtime).toString("yyyyMMdd"); + listResult << QString::number(inteval /1000); + listResult << QString::number(vecResult->size()); + listResult << getStrFromCM(*itCM); + listResult << QString::number(timer.elapsed()) ; + + emit onAddTestRow(listResult); + +// emit onTestStatus(testResult); + emit testResultReady(tr("测试完毕")); + + return; + } + + if( *itCM == iot_dbms::CM_NULL) + { + for(int i = 1; i < vecResult->at(0)->size() ; i ++) + { + auto result = boost::get(vecResult->at(0)->at(i).m_varValue) - boost::get(vecResult->at(0)->at(i - 1).m_varValue); + } + } + + QString testResult; + testResult = QString("完成:%1点,%2[起%5,止%6,间隔:%7s,结果共:%8],%3,共%4ms") + .arg(QString::number(pointSize)) + .arg(getStrFromTI(*itTI)) + .arg(getStrFromCM(*itCM)) + .arg(QString::number(timer.elapsed())) + .arg(QDateTime::fromMSecsSinceEpoch(starttime).toString("yyyyMMdd")) + .arg(QDateTime::fromMSecsSinceEpoch(endtime).toString("yyyyMMdd")) + .arg(inteval /1000) + .arg(QString::number(vecResult->size())) + ; + QStringList listResult; + + + listResult << "完成"; + + listResult << QString::number(pointSize); + listResult << getStrFromTI(*itTI); + listResult << QDateTime::fromMSecsSinceEpoch(starttime).toString("yyyyMMdd"); + listResult << QDateTime::fromMSecsSinceEpoch(endtime).toString("yyyyMMdd"); + listResult << QString::number(inteval /1000); + listResult << QString::number(vecResult->size()); + listResult << getStrFromCM(*itCM); + listResult << QString::number(timer.elapsed()) ; + + + emit onAddTestRow(listResult); + +// emit onTestStatus(testResult); + + foreach(iot_dbms::SMeasPointKey key, vecMpKey) + { + free((char*)key.m_pszTagName); + } + + std::vector *>::iterator res = vecResult->begin(); + while(vecResult->end() != res) + { + delete (*res); + ++res; + } + vecResult->clear(); + delete vecResult; + } + + } + + } + + + // + + emit testResultReady("success"); + + +} + +void dataWorker::doWork(QStringList listPoint, QString address, QString pointType, quint64 interval, int deviatProb, double normalBase, double normalLength, quint64 starttime, quint64 endtime, int deviatType, bool isDeleteInterval, bool isDeleteAll, bool isMT) +{ + // 删除 + if(isDeleteAll || isDeleteInterval) + { + if(!deletePoint(address,pointType,listPoint,starttime,endtime,isDeleteAll)) + { + emit resultReady(tr("删除测点失败"),false); + + return; + }else{ + } + } + // 插入 + + // 生成QString + bool result = false; + if(isMT) + { + result = getGenSqlAndInsertMT(listPoint,pointType,address,interval,deviatProb,normalBase,normalLength,starttime,endtime,deviatType); + } + else + { + result = getGenSqlAndInsertST(listPoint,pointType,address,interval,deviatProb,normalBase,normalLength,starttime,endtime,deviatType); + } + + if(!result) + { + emit resultReady("插入失败",false); + return; + } + else{ + emit resultReady("插入成功",true); + } +} + +void dataWorker::doDel(QString address, QString pointType, QStringList listPoint, quint64 starttime, quint64 endtime, bool isDeleteAll) +{ + if(!deletePoint(address,pointType,listPoint,starttime,endtime,isDeleteAll)) + { + emit deleteResultReady(tr("删除测点失败"),false); + + return; + } + emit deleteResultReady(tr("删除测点成功"),true); + +} + +void dataWorker::doInsertEvent(QStringList listFixedArgs, QStringList listPoints, QString content, quint64 starttime, quint64 endtime) +{ + + + QFile file("outEvent.sql"); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) + return; + + QTextStream out(&file); + //out << "The magic number is: " << 49 << "\n"; + + quint64 interval = listFixedArgs.at(8).toInt() * 1000; + + QString sqltext; + // 第一层测点循环 + for(int pointIdx = 0; pointIdx < listPoints.size(); pointIdx += 1){ + emit onStatus( QString("正在插入点%1(%2/%3)").arg( listPoints.at(pointIdx) ).arg(pointIdx + 1).arg(listPoints.size()) ); + + + QString tag_name = listPoints.at(pointIdx); + QString key_id_tag = "digital." + tag_name + ".value"; + QString contentToFilled = content; + contentToFilled = contentToFilled.replace("[tag_name]",tag_name); + QString dev_group_tag = tag_name.split('.')[0] % QChar('.') % tag_name.split('.')[1].split('_')[0]; + + QString arg0 = listFixedArgs[0]; + QString arg1 = listFixedArgs[1]; + QString arg2 = listFixedArgs[2]; + QString arg3 = listFixedArgs[3]; + QString arg4 = listFixedArgs[4]; + QString arg5 = listFixedArgs[5]; + QString arg6 = listFixedArgs[6]; + QString arg7 = listFixedArgs[7]; + + // 第二层时间循环 + for(quint64 timestamp = starttime; timestamp < endtime; timestamp += interval ) + { + std::string uuid; + generateUuidBase64(uuid); + //insert into HIS_EVENT (UUID_BASE64,ALM_TYPE,ALM_STATUS + //,ALM_STYLE,TIME_STAMP,LOCATION_ID,CONTENT,PRIORITY, + //SUB_SYSTEM,DEV_TYPE,REGION_ID,DEV_GROUP_TAG,KEY_ID_TAG, + //CONFIRM_TIME,CONFIRM_USER_ID,CONFIRM_NODE_NAME, + //WAVE_FILE,IA_UUID) values ('B0P7XbDw7mACiqFAnT36YU' + //,3,201,0,1663027300645,1,'dev3 yx34 中断',2,4,7,1,'occ.dev3', + //'digital.occ.dev3_ht100.yx34.value',0,0,'','','B0Pp6cIUMGw+bZBtbMy5JU'); + out << "insert into HIS_EVENT (UUID_BASE64,ALM_TYPE,ALM_STATUS" + ",ALM_STYLE,TIME_STAMP,LOCATION_ID,CONTENT,PRIORITY" + ",SUB_SYSTEM,DEV_TYPE,REGION_ID,DEV_GROUP_TAG" + ",KEY_ID_TAG,CONFIRM_TIME,CONFIRM_USER_ID" + ",CONFIRM_NODE_NAME,WAVE_FILE,IA_UUID) values (" + % QChar('\'') % uuid.c_str() % QString("',") + % arg0 % "," + % arg1 % "," + % arg2 % "," + % QString::number( timestamp ) % "," + % arg3 % "," + % QChar('\'') % contentToFilled % QString("',") + % arg4 % "," + % arg5 % "," + % arg6 % "," + % arg7 % "," + % QChar('\'') % dev_group_tag % QString("',") + % QChar('\'') % key_id_tag % QString("',") + % QStringLiteral("0,0,'','','');\n"); + + + } + + } + //out << "The magic number is: " << 49 << "\n"; + + // 两层循环,一层测点循环 一层时间循环 + + //qDebug() << uuid.c_str() << listFixedArgs << listPoints << content << starttime << endtime << interval; + emit InsertEventResultReady("nice",true); + +} + +bool dataWorker::insertHisDataWithRetry(iot_dbms::CTsdbConn &conn, const QString &insertSqlTxt) +{ + int retryTime = RETRY_TIME; + while(retryTime > 0 ) + { + if(retryTime <= RETRY_TIME -1) + { + QThread::msleep(500); + } + if(!conn.doInsert(insertSqlTxt.toStdString().c_str())){ + retryTime -= 1; + continue; + } + break; + } + if(retryTime <= 0) + { + return false; + } + return true; +} + +bool dataWorker::getGenSqlAndInsertMT(QStringList listpoint, QString pointType, QString address, quint64 interval, int deviatProb, double normalBase, double normalLength, quint64 starttime, quint64 endtime, int deviatType) +{ + QElapsedTimer timer; + timer.start(); + QList taskList; + m_strTimestamp.clear(); + int totalCalc = ((endtime - starttime) / interval ) + 1; + m_strTimestamp.reserve(totalCalc); + for(quint64 timestamp = starttime; timestamp < endtime; timestamp += interval) + { + m_strTimestamp.append(QString::number(timestamp)); + } + + for(int pointIdx = 0; pointIdx < listpoint.size(); pointIdx += 1){ + + STaskUnit task; + task.pointtag = listpoint.at(pointIdx); + task.pointtype = pointType; + task.address = address; + task.deviatProb = deviatProb; + task.normalBase = normalBase; + task.normalLength = normalLength; + task.deviatType = deviatType; + + taskList << task; + } + m_ft = QtConcurrent::mapped(taskList + ,std::bind(&dataWorker::getGenSqlAndInsertSingleTask,this,std::placeholders::_1)); + + while(true) + { + if( m_ft.isFinished()) + { + break; + } + int progress = m_ft.progressValue(); + if(progress > 0) + { + emit onStatus( QString("已完成插入测点(%1/%2),平均耗时:%3 s") + .arg( progress) + .arg( listpoint.size() ) + .arg( (timer.elapsed() / 1000.0) / progress ) + ); + } + else + { + emit onStatus( QString("已完成插入测点(%1/%2)") + .arg( progress) + .arg( listpoint.size() ) + ); + } + + QThread::msleep(500); + } + if( m_ft.resultCount() != taskList.size()) + { + return false; + } + return true; +} + +bool dataWorker::getGenSqlAndInsertST(QStringList listpoint, QString pointType, QString address, quint64 interval, int deviatProb, double normalBase, double normalLength, quint64 starttime, quint64 endtime, int deviatType) +{ + QElapsedTimer timer; + timer.start(); + bool isDi = false; + if( pointType == "di_sample_result" ) + { + isDi = true; + } + + iot_dbms::CTsdbConn conn(address.toStdString().c_str()); + if(!conn.pingServer()) + { + emit onErrMsg(tr("无法连接数据库")); + qDebug() << "无法连接数据库"; + return false; + } + + QString insertSqlTxt; + insertSqlTxt.reserve( 100000000 ); + + // 第一层测点循环 + for(int pointIdx = 0; pointIdx < listpoint.size(); pointIdx += 1){ + QString pointHeader = pointType % QStringLiteral(",tag_name=") % listpoint.at(pointIdx) % QStringLiteral(" status=2i,value="); + // 第二层时间循环 + long long totalCalc = ((endtime - starttime) / interval ) + 1; + int sqlCnt = 0; + long totalCnt = 0; + for(quint64 timestamp = starttime; timestamp < endtime; timestamp += interval) + { + if(isDi){ + insertSqlTxt.append( pointHeader % + (boolGen(deviatProb) ? QStringLiteral("1i ") : QStringLiteral("0i ") ) + % QString::number(timestamp) % "\n" ); + }else{ + insertSqlTxt += pointHeader; + insertSqlTxt += QString::number( doubleGenController(normalBase,normalLength,deviatProb,deviatType) ); + insertSqlTxt += QStringLiteral(" "); + insertSqlTxt += QString::number(timestamp); + insertSqlTxt += QStringLiteral("\n"); + } + totalCnt += 1; + if( ++sqlCnt >= 10000 || insertSqlTxt.size() >= 950000 ) + { + sqlCnt = 0; + if(!insertHisDataWithRetry(conn,insertSqlTxt)) + { + return false; + } + insertSqlTxt.clear(); + } +// qDebug() << insertSqlTxt.size(); + } + if(pointIdx > 0) + { + emit onStatus( QString("已完成插入测点(%1/%2),平均耗时:%3 s") + .arg( pointIdx) + .arg( listpoint.size() ) + .arg( (timer.elapsed() / 1000.0) / pointIdx ) + ); + } + else + { + emit onStatus( QString("已完成插入测点(%1/%2),耗时:%3 s") + .arg( pointIdx) + .arg( listpoint.size() ) + .arg( (timer.elapsed() / 1000.0) ) + ); + } + } + // 剩余sql语句插入 + if(!insertHisDataWithRetry(conn,insertSqlTxt)) + { + return false; + } + + return true; +} + +bool dataWorker::getGenSqlAndInsertSingleTask(dataWorker::STaskUnit task) +{ + QString insertSqlTxt; + insertSqlTxt.reserve( 400000 ); + + bool isDi = false; + if( task.pointtype == "di_sample_result" ) + { + isDi = true; + } + + iot_dbms::CTsdbConn conn(task.address.toStdString().c_str()); + + + QString pointHeader = task.pointtype % QStringLiteral(",tag_name=") % task.pointtag % QStringLiteral(" status=2i,value="); + // 第二层时间循环 + int sqlCnt = 0,totalCnt = 0; + + QVector::const_iterator it; + for (it = m_strTimestamp.constBegin(); it != m_strTimestamp.constEnd(); ++it) { + if(isDi){ + insertSqlTxt += pointHeader; + insertSqlTxt += (boolGen(task.deviatProb) ? QStringLiteral("1i ") : QStringLiteral("0i ") ); + insertSqlTxt += *it; + insertSqlTxt += "\n"; + }else{ + insertSqlTxt += pointHeader; + insertSqlTxt += QString::number( doubleGenController(task.normalBase,task.normalLength,task.deviatProb,task.deviatType) ); + insertSqlTxt += QStringLiteral(" "); + insertSqlTxt += *it; + insertSqlTxt += QStringLiteral("\n"); + } + totalCnt++; + // sql语句大于10000句时 + if( ++sqlCnt >= 5000 || m_strTimestamp.size() == totalCnt) + { + sqlCnt = 0; + if(!insertHisDataWithRetry(conn,insertSqlTxt)) + { + m_ft.cancel(); + return false; + } + insertSqlTxt.clear(); + } + } + return true; +} + + + +bool dataWorker::deletePoint(QString address, QString pointType, QStringList listPoint, quint64 starttime, quint64 endtime, bool isDeleteAll) +{ + using namespace iot_dbms; + + CTsdbConn conn(address.toStdString().c_str()); + + if(!conn.pingServer()) + { + emit onErrMsg(tr("无法连接数据库")); + return false; + } + + // 获得删除语句 + qDebug()<< "start delete"; + { + // 第一层测点循环 + for(int pointIdx = 0; pointIdx < listPoint.size(); pointIdx += 1){ + emit onStatus( QString("正在删除点%1(%2/%3)").arg(listPoint.at(pointIdx)).arg(pointIdx + 1).arg(listPoint.size()) ); + + QString singlePoint; + singlePoint += "delete from " + pointType; + singlePoint += " where tag_name='" + listPoint.at(pointIdx); + if( !isDeleteAll ) { + singlePoint += "' and time >= " + QString::number(starttime); + singlePoint += "ms and time < " + QString::number(endtime) + "ms;"; + }else{ + singlePoint += "';"; + } + qDebug() << singlePoint; + //emit onStatus( QString("正在执行删除语句到数据库") ); + int retryTime = RETRY_TIME; + while(retryTime > 0 ) + { + if(retryTime <= RETRY_TIME - 1) + { + QThread::msleep(500); + } + std::string result; + if(!conn.doQuery(singlePoint.toStdString().c_str(),&result)){ + retryTime -= 1; + continue; + } + + if( result.find("error") != std::string::npos){ // 找到eror则错误 + retryTime -= 1; + continue; + } + break; + } + if(retryTime <= 0) + { + onErrMsg( QString("无法删除测点%1").arg(listPoint.at(pointIdx)) ); + return false; + } + + + } + + } + return true; +} + diff --git a/platform/src/example/tsdbDataSim/dataWorker.h b/platform/src/example/tsdbDataSim/dataWorker.h new file mode 100644 index 00000000..287fbea3 --- /dev/null +++ b/platform/src/example/tsdbDataSim/dataWorker.h @@ -0,0 +1,95 @@ +#ifndef DATAWORKER_H +#define DATAWORKER_H + +#include +#include + +#include + +class dataWorker : public QObject +{ + Q_OBJECT + + typedef struct taskUnit + { + QString pointtag; + QString pointtype; + QString address; + int deviatProb; + double normalBase; + double normalLength; + int deviatType; + } STaskUnit; +public slots: + + void doTest( + int timeout, + int base, + int factor, + QStringList listpoint, + qint64 starttime, + QString address); + void doWork( + QStringList listPoint, + QString address, + QString pointType, + quint64 interval, + int deviatProb, + double normalBase, + double normalLength, + quint64 starttime, + quint64 endtime, + int deviatType, + bool isDeleteInterval, + bool isDeleteAll, + bool isMT); + void doDel(QString address,QString pointType,QStringList listPoint,quint64 starttime,quint64 endtime,bool isDeleteAll); + void doInsertEvent(QStringList listFixedArgs, + QStringList listPoints, + QString content, + quint64 starttime,quint64 endtime); + bool insertHisDataWithRetry(iot_dbms::CTsdbConn& conn, const QString &insertSqlTxt); + +signals: + void resultReady(const QString &msg,bool result =true); + void testResultReady(const QString &msg,bool result =true); + void deleteResultReady(const QString &msg,bool result =true); + void InsertEventResultReady(const QString &msg,bool result =true); + + + void onErrMsg(const QString &msg); + void onStatus(const QString &msg); + void onTestStatus(const QString &msg); + void onAddTestRow(const QStringList &newRow); + +private: + bool getGenSqlAndInsertMT(QStringList listpoint, + QString pointType, + QString address, + quint64 interval, + int deviatProb, + double normalBase, + double normalLength, + quint64 starttime, + quint64 endtime, + int deviatType); + bool getGenSqlAndInsertST(QStringList listpoint, + QString pointType, + QString address, + quint64 interval, + int deviatProb, + double normalBase, + double normalLength, + quint64 starttime, + quint64 endtime, + int deviatType); + bool getGenSqlAndInsertSingleTask(STaskUnit task); + bool deletePoint(QString address,QString pointType,QStringList listPoint,quint64 starttime,quint64 endtime,bool isDeleteAll); + + QFuture m_ft; + QVector m_strTimestamp; + + +}; + +#endif // DATAWORKER_H diff --git a/platform/src/example/tsdbDataSim/download.ico b/platform/src/example/tsdbDataSim/download.ico new file mode 100644 index 0000000000000000000000000000000000000000..4e2193609d5b28c2230d9b4cc0089681022decc9 GIT binary patch literal 4286 zcmcgw=~q=%6o35(edkP-J|F144=l@<4${iW=Zls7qF2jx8l?C8m~= zCYm5FhZHh3CBeinLkB+MVN*B9S4w4@4nr3uU>t~^X=Z`*T<29T!xUvZ9G}M z&C>CWG0cGmwErc?zuy4C0w&gA_4TLCiOcA(f-4j;Xz3m+2+v4s)TUUHa zxtT|)wCFljKYU0HH8s-ljWNuD2DIQ;yh;|<1PowpUb0;5VD&Xq;Cs##!8~S%{u-|0 z4|g3;2eyAr_sh$vy{(OGwf6RQdcd^c0k3flzyMa@AQ$mjEbH&h_R`Z~oqkOBS?qi& zE54yYHrCb4@AA^pE^7fMbo%A!F}huHlUiF^ga^Ek0a=i#>;Nou#ERf|+8Fboo9Os1 zrKNmMP4)F6r~Fo__$qEvAbt43aEfNXSCrk>)^$BUpTamM;s2Q zf=vAy@ZB9g)|!^Go}N8@D*R_zCyV<8S+BBFkjqfI#r{TXX=$c)aSO@o9edHw2fFog zphZ)InWji+o;`UYG9g>ppgVln1omp|)LX?Q;#to(&3Oow6kZeAw@XS`=TTjB11)&s zCI?E~fDkevTlv|Dk8#9HS#hz*#pBZH9I>0iR__3|WnNCM(49PRQ0%Ve)El;%G++=F z{CZB42iYnnjric(zx^wX79VwwYbZWwhUlW?;td-g-jOD>+gGh&+dsDt=AjE>N#*;>x$_hF1YOLMaf0RvdTRQT98$X#fa_wLcA#HEz+O&T@S)@nRwv$H9b^F90utjX-# zT^ly>n5*~$W5{Vu4Gr{9V|9kq0bbqFz{i%oN1& ztoG9(_ABg*Je3eUgO2Y%K$R60l5dJG=hNcAVBv)gCUP#vp7LaRV3ZUVQs%Bb6wiE9 z2Mv~eh}eLwJ>IgTHPNxu#yJ$Z8ubEoEXLc9EUx1upCfOr4389i=mT9L-!jgVHhi2w zrw(S&sf)}n=-|wSi=|4~u#~NhK^YjthfDiF4K7n5#i`N^;a%!p`(c{WW z!9)#>W`C<7ka>Ef$tBdfc^vN=ZwQ*OFUptvxAf78$GZ3#-0fq z?auzKphm9wsGX?a8a|I<4tjuA@fqK+rMa&Yoj-n3!_PaDBk?fJd8p(ItRL&u%fZ+@ zwps0?YSC5UEBnJHb=8k4YJyK!{n?I6-b6khpkB}58k!IsLRT+blsH>9GnA$bbf(PR z-x1c5zAcqjMMlXP1?%tNw-?{S$Eep9&ULWAia*2z+O|)UME8!hJBr*W_Up#@C9Lxa zx_-HUV$G98KVYIOJ#nrqbR?C7IHlS25gEwni98|npw}31&g#Cjkrfoj<(XH2M-KVNc1q~ zpPuqB@=5mIeG-=nTYSoKxc7^#A|HF<#j{f%TKmxgiFN%Vy34;xuCe~0b}gF~MmRGn zAFKU<8hGjS84-%)l!pIb-_mr_;F4`e4;^SPv;M{ zX5;xQH#1AtfV|_|8C%mhxBqeef`XR!o{d{Lj_tL*j+%n={gb99sna;q**bq=4OqAF z{CV}ai)`O;+3WuOoM^||b=nzME#k!f9|`#{g3pSZ6P6NqP{&{D{K>k(_R0nww(C59 z-{?4hH*rmc%nK(^vCIYqtG%J;&1-*B74LQ6qLnc(Y!1C4Q^^MwI_iJN{lmrP{R4Lj zbw1HRyZHdktK2_c`TmvF!~KirUiSWlbCSA;%KbBx@1MNSm2He~>?Pz$>}kYSIG-6} zxNf848)KLQ4QP%0>bKlK8B5(i)g2gih~={o^0BRsnuWTF+KrBHjM?Iod8PxFx_=x0 JAMk(w{ulSMsNw(s literal 0 HcmV?d00001 diff --git a/platform/src/example/tsdbDataSim/download.png b/platform/src/example/tsdbDataSim/download.png new file mode 100644 index 0000000000000000000000000000000000000000..22e651aeba98d511ca2bcc4224a7d3ea895b618c GIT binary patch literal 8282 zcmV-gAf?}lP)O8NQv-{0aQ9YtMQb^!o5As|XAAWHxH|0p3!|NZ|UAWA19N+={v92-X}B}()2 z^#uSz+S=tB8AciuJ^%nU`27DB6GQs^`W_iT002E16hrp)_xJnveteI@z|1{2UewXq zZ*GTZXM?Jzw3m~mLP2E>06QNWOd}aa001)P=IJRYN{EJ;$;Qi3Olz>Nx;#8wKt5!b znWPgDJ!oTtet4A>4na*vW&i*!001agR(4=sb*rqmQBY@|pR$63oN{o6$;H%+ika8b z-Z3y)($?5BGEqT4TNVvRYiWF-n61OV#mLIeu(P@V02??qW3e4eWdHyl97#k$RCt`- zoqKL17xN^D2Oxo9+1-2g`eQzw zmP5V}l3d4RnE$$DeE*Z|?C&qOL?o2VVc*IB?&9=^ri3MI8m+1h*xz4(UTqo8Fd;Ww z>mc*r5TLJzT#(Rs75IOmlc8aBbF7w5XGJ{*bsF9k^aXf?{$Hkd zGmXu44P!Xbt~NbYZ%HnpS=}5XPFH9#aALOIYBwW^5K6F%BRus)U@A%saVs>-Y6ULkkibeQK(6=FB)?r;jb=WL< zgv?j{Q-p$At-dTC#s-NjAjbG%@lvg-Lisbd)xUa|J1I3ERhN(*{6vKL4WZs;PPT;K z)T3|3%PQaR^m;W)x~i%e!PMOow1bpz|(^B(Cw>5G$>;L3a2(MqDrbFQ%p~_a!RfG<=B@{*YRdPt@ zfP)P)8x)Gk2;qQOE~{31^YF!khxw1456s!yyn$LgT#c|cc)`W zr>BYfCQi^LB%|Ye*Af#BM&8G7=X5bdm_cJizYG5?btf5mJh(#1XqxipWO-itB-^2s z&XWGmR7h8F;nx?m|@f zB!sZtR(n3Lp9$p*o)FGtWm)F;`UedmuY=b+i8((%Pn8f|Pr7>rI-i746nR-L@7E0& zLi9(vaoQWsr$Vl4GYurE5^k<&cXPrtLp^t(qkJo)AYmdw!#V8M_v55fdornw?_sB7 z6ZNYD)oZuBdaSPV$#)3Q{D72^zmX8B3TW;C|MWYAL(;&i zkI70yy26d?*5H^``DX}a@HM_=DauzM|D%LuVKQ!T|I{mlFOh4EC%akhA0Xs~mC129 z!j$KXJt4=LtK?Ss;|Te(D)tBq>;{^sxvXgz-Rq<(M(mo_?ulwS8RU_K>ioS)XaszP z@7-2s)^49oT1FB^+kA?hSex&2^`9VgZfeA5on5}ZR2^Lw1YXyld!z>u5_7n?pN&?% zu^D;TY3;`OI|*IGA8V~}uLgaT+<5WKJHUI&m7*ZuQZ81zSBe0DqJZM_qGd3Qr>kQ` zTIJaU=EsDD=*j>*VqXl$HSL)WitORc3@&e}2$%W7)-cS2fm8VQL|#QS9{~`l*Kmmm z+2XT-@1adQcL_Gu-2+1H`z-|^*B?|oLMTvGSL^GCtVEcLPK{^(b4-iSUEK?#cLvi( zOHgZOff#l{0AP*d371x(xc5;Pq42y@?R0HyZ;_bykwC3%&=aE9!|QYWKpU@cR zq_w{OcMz)WEdF*aLB=a^=$D0JY(FItBF51YdrG#grb>vkGhQbEniDzdTwWi=&Eyfr zS$hgZKv08fo&q60V;uAs~&~4ON@xK2K4C`h6GfhBA-%opGWhQuRQ zSOBM;aBIe3AQA?v7(!8WzG7|IV`T55YSo_5!CPz^jc(*n;TJHyz+K|2L(+%i2tl2} znjrd9F)`s_ft_?3ja!yJECNdin^-4x^hiRu&``&C!qF5C-U$f{Sp9%$oWD-#uRbQIqbcxY(j7LLQ7uMCU;-&(m1C{NnVaFkvk> zpeNKPB-`srX$<&;gnF*V5DBHBBWIElYJEFQXsiqLgl9dH`TPVvDm@Wlh6i1S{0yCLJZukuDAIen`22O~ z71*mOb)XC{FQaUB_CnE;5Q-E&qjB%v^;ggms$t)1_L)8u$cgcQjKw5`v9Hk8drsb4 zg(S(Z-QheriwL{56t>E;~d zrXdb98#!f`f3iUpgG4B5H`LM0&GC0Y7mvmB`S$>!J)+F(gsOO?&6RP3Rc^H4_)aAJ zzD$ryz|9>hs~aC$RdU(yl(rCFp2Wom!UiwD(-HzFSw#AHF4MG>7jFFLHHQ`@p&VbCd#ke`wtA zD)Eyc%0KOq?d3sv3OqDCp}ew>i%pjdF=~Z_Oj|F9gdG|}K_5n`0DdXiE5A(yOUOGP zWVI=p@HG3XMD$WotUUkNcT;l?;t9)g&rPPIlN08{@qO7CLLROjV*(4J#J>1ajmYES zuZ%rmFIMk@(}X}dif+Xm`64HMM2VGD*g3xP-%7U*w$uFT05LPs4Tk87-$2-YJRm;M8WwnO$#uCq*#u*4jiYjA|aAfaRqXL%J_j5gVsWfU%`OdZ(HQLATQv+vuKR& z2@A+utteCC3Kp*I2DlI}AD^+vqx6M*&J6bD5;G(dBE>-V={F@5qu$qr%^$t9;7s6_ zD_{W-9C6gTHL^_bUBahiE}ZbBfzI7rse)axA%BP>F71e{O|HS1tF_}sy;tDKbs9W$ zEbld(AR+t!WaIE)*ab|MY=nWW1hOMf?ptHbz;5Oo(xgEYNO+mcMh~L)?QAgco?KDO zy$An}Vyr|WAy9n>pOoy2h%pa!IHbVI!g?|rhL*D~Vlu+Ad=mK1;5N(vIxj+7bL;HZQD0 z-Sk^Nf-n$tRBE=vz5tR`P*#*)&n>h2;Vs(+^n}9fmZa7+8jbARt73)1pLpI1**L~^ zG9gwR0rLpZf(#Rju#R5T7K=_)FP_SB|x3Lr3xa(X^wQ!ZCGOu@n zkHxIB1VXg#4)l_5(*!{!Ug8ojTh&z;KB@-CES=0|;70QXFF0SSqxs^QRe@Xk;NUz_ zSuaB$lxLQR@~>uid_jQbvbVSy=zt~Ke?rM)+!u0P451x3`0}_?21vP6 zuNLE1ZTlIc%#a6E^vmUFO2*pSH3I^!#}aM;wR?*fQPc;8C{yep7hG@bP3a**Ip;sr zu#P5#Gl&2*ZQHR5P7ZwlC%a&1d$_Yti)>{Xwx?ygt&sw|rkjx%NjM4;=42wF>Ypr_ zrIj#u8Y^h};x9s9Sy%Ja4^-XA3yXluM2?eebDUeB)h&(OH4lWpv;&AMl}H$Le|@5; znV(P(0dgGEb+&}SD>W+FwOX$?yU9C1_sT0$5L(N?wTBLo@GS7r=8mbWxHf1rACv zi6z9#i$~9nO=_0nd~ia$M0 z;DTawG~q=mt2S*!B9w9|RP#rLOZ{qo0>Yt_#yey$Nd{hN77iy&ERe8INf??BnXz;H ze7K+9c&A6Ozx1pWzH{^r{n!6NJ>ws(A0jy*6#Dp=DD~4A$5(f@zaWRdzt!C{Y8{{HIY|gb zmRHZL&f`bcc0atHuq70gQP3Eg+WrJQuls!wC?b$V7+m0$>`OXAw}!o9U9K;TH{=^G zxrQYazT**U%E+IN`gX6Sw8sQowFN%&3$mRiXlrA*QCwILvgTf0U9kX&AAJ=o9eDz^7* z_Xz-s(_Y=ZZ6;hlp|Nld_LK3(S^xH78P|=hEf}uZEM>d7LXvT9PdKRhr$e&e0^@sP zq>hTI(87AI(J8yQyT-0p?Avv8%+p>5+Y4mJIe1dyT|A1x8G!723i}VCeBiv?E}`H! zi!otMZNECyyPP=7{b}QlLx19yFlZ5u@*f6$!03UjG0|D@8EN_U@QI|^8u#KAPgR{K zWONRBbqI+e#^BNc)7 zy#(%Irh^QeL1@a9qpE&E&rGBrKM;$7nmH9(blf&pTYu^54P8YJc{;CdC#P$hjb;OdM|RwSP1)llR$@*HM__~`@rtpX1_ zDxM}36NN+?3YAJ_69vU0Pf!1mTqck!nKO&H`2bLKK?sMhqXLP!V3|uvGJ5wJ8SJ-# z3!UffSQ(5Xj);ju5{_$QjAyS=Xc;M2hf#5@C8JNQY6P^&YSnJ9aUpxfzgFSL#+h%u zk)?o5MX^d~6^mY#7EG#-jB9fV!?B6n%GnaK`Pn!s&Rx3glhrLSZDsAJr=EZ#ELfpY z97!|#KAf%3bkr+wgrWv+{jV@KHW3$J+8k|EeU`mk*-}K%nbhMW%#Yx^TjG0+CoBvI zDU?#y9DglX`KcC45EWTv`WSQo$HkZ8V}$2<0qPHhzp&4FC-#v10#Q_K+jY>42{U?V zX>uSOXAW~W-|M;nfFKAO6gV;nvK1aSVq=5}ao*#L+5POB5e>M?ljnHYq4JMzz^y?F z@YW&_H#aaITQ4u`^)r0h&(F`3RSVak*f{T_WA*JDD`L5Y3V~lYno)#6QzEnQpl02G z|Nbyd1Byx5I4eF@pOkMwt_rx3>`0GVGPA4zr*#D2DgGEjpj}1P6lgTIyV;Z?8WW#y zab(U6D$h*B%b@r()eCJlN90-`LR?CEyu|0s9GCZG#zk%LyyJzs+OH8or_}kdB%#TB zIwp55ivXhug>BVCsTDz(JXtLu@wsb9sF!ZPy-;k(xX|9Wsq$cjuwWKg=AF zLu%i|?>bT5*K6ypBNa!@X*K9`D*Zy2Lz*}b7y-r-3hmw8976~vjbZc1j3CN9;Dou{ z&Dns$vLfui?(rm2hX(*S!|ajokS>=ySw6lL{aNkWz1UszX%t(b&ABHBL`OD;G9N!l zO$F(Z&Tv%OSND9H#afv~{r;$AWZIevN$O&Z*Hnau6N926{4u=eJOB=1)n6 z)I{}ZXlo2ft1}v#D7>JvJRn@s*h32tF=r-whx9duXzN6M)H5`r49ixWrvu}N`J9Q5 zBt@BhdX;2T#}U%ki9$kA>kF<%*8-J`lP?QC--$h=-0ZgktQCDeH+`)yBvkd<77Cpc z7p~_0foCJy&FL$=-oB%Kjmhe@#n;?J)r2X7UZLjXcSC=3sNLHl5LO12)gfWcy|}uG zP`DWi_o0av;rX+r@6_e@B$Yvh_RwrXiE2#px`{EhFOl@9Q($?%9*9|Tk`NXL1HBhV zn7H<3O#M;@*=49Bq~T}iw@pZ2k`Pwlqs;$bH*&3fO#RZR8nj5d)dF>0PQ4R&0sjvq zA}khxmJg>D`5t)E8nj5rb%asH!&cnlaxcZdg1*L!LBc>9I5O!&ObOeqB(Eckgj@?6 z5?%*=Zc&8RTYxZe%p-DblD1bsa$GHFay@S-cL_pYi=ljrT0QYQ6vaH*2zXpQ?}(c0 zZfO$w=4qk4E@?uaK<%}rl9{gX1H;iZ*(2)eqa7C#G*OuaAAa*OpJ)RRS0V_HtE(Te zH$p-}Jyd&^%U-5O_=&v{i2GY0!UW%;6Uvz9?3u{prX(N|2EDnPHwr2}T-q95V2h#um<GK^T_=jXZ@tyNLU){aDj&4TvXX%o*** z7RVT>697}$ca5}nUTG-{mG}{#L}y1lC%$Lsaw#G zeTNO^k!DT9iW&sO6Q;NiDS0nhW9|Te_8cd+7H#T>`wme=V2o1-D))tIu}WAtrn{Fc zc|YLmj^akT5-%a*=R+i|nD7Qv6QyuA#;?`V-Vd0(r!zC0DwP;Q{5xcfm`x&4INu*` zAQVQ@-P1X0U+xlPtVEq`Sb~IAlDD%H9RN@%3_9lxJYmZFa&I6>d#f|t$D#m8Wgp=0 zoc9La*!klNnGl`_CgB}&cYx{ct-c`?^*$l|xsmNIbeTw~z7s43%rZ|VWCshPIltD| z=^P3P33+{v?{9E4H^-~`6lVoRL5ZYySc=G22i7CeUW-9zDnJnQtC)SL?3J+J+pGeV!Fm?u+Ll&%HbJePgoK_rH?>$Fzw~3-TP;TSv)9P% z1sAb*HPtjlQ3kp*m@FQn{Gq3{n`FgMjw9sN`8$`uc!a*@t zRA!TO2s342GX7@?8{`p1$JPk>ayS$6BA z(m$mtuY=b+iHX|J;}}8LlkQ%D&Xac@3JFqTWw}fyEX!y0`Mhmqk`Pv_ydo~T=S<4) zkU8%zM1_yo9}7d6vD))_{cPtF2@vvfALXq{-ARVNKox2MTsZ$ZS)Qjk;*`#plRp(r z%OoKzW+rZMSa+9=d`O7wFgb6vSsPI}B>ci^-_hKWY07SOOkvHnu zIo&G`<0AxD*9=O+a!5S}oJ%X*^Wyj)hT_UeOVV4)Jp{8+UuwOmeILkg8`V>SiRo18RMLxdGp?Rp#U zluFD+bVewKa9fi{cSf!5k0$I0iTW!%_@vbQ(QSb&OX}cGn6B!&Qdpt0 zBPWtH#0_IgPd0<~VR)92MB1>*eo-B&7u7+u|s4Q2Hq0|}iCq59a| z>7QSz;|OrK;sv!@eOWw=4N5v={IGbbR@JDmiul{=TWtsShDUWnIQR((?LKe`2eVyN zNLEZ*=*LfpL{k)5Ry(V)NvH&kgv*-aRY#R&MbUWQYUGI93ZiGCJ3-r`xrCr^Lqcij z8J_i(jfNTS{Jce*E)Xp&3#R#cUH{U~t%i4R*VoszjliGY?uM&e`-@($=drf(5;CSYr;5`R8V9-5>iuo1bhBu`B-Q!Dg7U{k+#elPhCPKnzL0n5 zW~|b(PtbV0ntH1;ypp)gj+5hQ0j&ye$FtzfA9D8k_4H z#&DutZ3uM~?3Y0wdKGxbWD1U>D`;siI{m1W!h*CX`*GQFDtpy-ZM$as$oxT&Iu zP#OyR<0>iK?Ozo3VE+NZ^*?6ZA#Jhsa;4K_{zW;^mGy-?h-WqvlIXp~{}7?zZG5sJ zWPXS#RM!5V5`7y2lG!dRUXxpt|A&PacH3ZX2^ns<){}>q|8EM=*TdaHYDdU4jaF3$ z?C&o?ueJ`HSbM_FmZJkyZR$4`K_AS9J{9$l5V_*B!%psZmd-G1`&Dp1q5DDp-V);Z Y|7*o}7*0;ig#Z8m07*qoM6N<$f^{YCp8x;= literal 0 HcmV?d00001 diff --git a/platform/src/example/tsdbDataSim/main.cpp b/platform/src/example/tsdbDataSim/main.cpp new file mode 100644 index 00000000..8894093b --- /dev/null +++ b/platform/src/example/tsdbDataSim/main.cpp @@ -0,0 +1,18 @@ +#include "MainWindow.h" +#include +#include "tsdb_api/TsdbApi.h" +#include "pub_logger_api/logger.h" + +int main(int argc, char *argv[]) +{ + using namespace iot_dbms; + initTsdbApi(); + iot_public::StartLogSystem("TEST","tsdbDataSim"); + QApplication a(argc, argv); + MainWindow w; + w.show(); + + int result = a.exec(); + releaseTsdbApi(); + return result; +} diff --git a/platform/src/example/tsdbDataSim/tsdbDataSim.pro b/platform/src/example/tsdbDataSim/tsdbDataSim.pro new file mode 100644 index 00000000..6da7eb7b --- /dev/null +++ b/platform/src/example/tsdbDataSim/tsdbDataSim.pro @@ -0,0 +1,56 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2021-04-07T16:28:26 +# +#------------------------------------------------- + +QT += core gui concurrent + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = tsdbDataSim +TEMPLATE = app + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which has been marked as deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + + +SOURCES += \ + main.cpp \ + MainWindow.cpp \ + dataWorker.cpp + +HEADERS += \ + MainWindow.h \ + RandUtil.h \ + dataWorker.h + +FORMS += \ + MainWindow.ui + + +LIBS += -ltsdb_api -ldb_base_api -ldb_his_query_api -lboost_system -llog4cplus \ + -lpub_logger_api + +win32:RC_ICONS += download.ico + +win32{ + LIBS += -lbcrypt +} + + +#------------------------------------------------------------------- +COMMON_PRI=$$PWD/../../common.pri +exists($$COMMON_PRI) { + include($$COMMON_PRI) +}else { + error("FATAL error: can not find common.pri") +} diff --git a/platform/src/example/tsdbDataSimForCloudPlatform/MainWindow.cpp b/platform/src/example/tsdbDataSimForCloudPlatform/MainWindow.cpp new file mode 100644 index 00000000..83d09914 --- /dev/null +++ b/platform/src/example/tsdbDataSimForCloudPlatform/MainWindow.cpp @@ -0,0 +1,254 @@ +#include "MainWindow.h" +#include "ui_MainWindow.h" +#include +#include +#include +#include +#include "dataWorker.h" +using namespace iot_dbms; +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow) +{ + ui->setupUi(this); + + dataWorker *worker = new dataWorker; + worker->moveToThread(&workerThread); + connect(&workerThread, &QThread::finished, worker, &QObject::deleteLater); + + connect(this, &MainWindow::operate, worker, &dataWorker::doWork); + connect(worker, &dataWorker::resultReady, this, &MainWindow::handleResults); + + connect(this, &MainWindow::insertEvent, worker, &dataWorker::doInsertEvent); + connect(worker, &dataWorker::InsertEventResultReady, this, &MainWindow::handleEventInsertResults); + + + connect(this, &MainWindow::deleteWork, worker, &dataWorker::doDel); + connect(worker, &dataWorker::deleteResultReady, this, &MainWindow::handleDeleteResults); + + connect(worker, &dataWorker::onErrMsg, this, &MainWindow::onErrMsg); + connect(worker, &dataWorker::onStatus, this, &MainWindow::onStatus); + + + workerThread.start(); + ui->label_status->setHidden(true); + +} + +MainWindow::~MainWindow() +{ + workerThread.quit(); + workerThread.wait(); + + delete ui; +} + + + + + +QString MainWindow::getPointType() +{ + if( ui->comboBox_type->currentText() == tr("模拟量")){ + return QString("ANALOG"); + }else if( ui->comboBox_type->currentText() == tr("累积量")){ + return QString("ACCRUE"); + }else + return ""; +} + +int MainWindow::getDeviatType() +{ + if (ui->comboBox_deviatType->currentText() == tr("左边")){ + return -1; + }else if (ui->comboBox_deviatType->currentText() == tr("两边")){ + return 0; + }else { + return 1; + } +} + + +void MainWindow::on_pushButton_insert_clicked() +{ + if(QMessageBox::question(this,"提醒","是否插入") != QMessageBox::Yes) + { + return; + } + + QString address = ui->lineEdit_addr->text(); + QStringList listPoint = ui->plainTextEdit_point->toPlainText().simplified().split(','); + listPoint.removeAll(""); + for(int i = 0; i < listPoint.size(); i++) + { + listPoint[i] = listPoint[i].trimmed(); + } + QString pointType = getPointType(); + quint64 interval = ui->spinBox_interval->value() * 1000; //ms + int deviatProb = ui->spinBox_deviatProb->value(); + double normalBase = ui->doubleSpinBox_base->value(); + double normalLength = ui->doubleSpinBox_length->value(); + quint64 starttime = QDateTime(ui->calendarWidget_startDate->selectedDate(),ui->timeEdit_start->time()).toMSecsSinceEpoch(); + quint64 endtime = QDateTime(ui->calendarWidget_endDate->selectedDate(),ui->timeEdit_end->time()).toMSecsSinceEpoch(); // 结束日期加一天 + int deviatType = getDeviatType(); + + bool isDeleteInterval = ui->checkBox_delete->isChecked(); + bool isDeleteAll = ui->checkBox_delAll->isChecked(); + + emit operate(listPoint,address,pointType,interval,deviatProb,normalBase,normalLength,starttime,endtime,deviatType,isDeleteInterval,isDeleteAll); + ui->pushButton_insert->setEnabled(false); + ui->pushButton_delete->setEnabled(false); + ui->label_status->setHidden(false); +} + +void MainWindow::onErrMsg(const QString &msg) +{ + QMessageBox::critical(this,"提醒",msg); +} + +void MainWindow::onStatus(const QString &msg) +{ + ui->label_status->setText(msg); +} + +void MainWindow::on_comboBox_type_currentTextChanged(const QString &arg1) +{ + if("数字量" == arg1) + { + ui->groupBox->setHidden(true); + } + else + { + ui->groupBox->setHidden(false); + } +} + +void MainWindow::handleResults(const QString &msg, bool result) { + ui->label_status->setHidden(true); + + if(result) + { + QMessageBox::information(this,"提醒","插入成功"); + } + else + { + onErrMsg(QString("插入失败:") + msg); + } + ui->pushButton_insert->setEnabled(true); + ui->pushButton_delete->setEnabled(true); + +} + +void MainWindow::handleDeleteResults(const QString &msg, bool result) +{ + ui->label_status->setHidden(true); + + if(result) + { + QMessageBox::information(this,"提醒","删除成功"); + } + else + { + onErrMsg(QString("删除失败:") + msg); + } + ui->pushButton_insert->setEnabled(true); + ui->pushButton_delete->setEnabled(true); +} + +void MainWindow::handleEventInsertResults(const QString &msg, bool result) +{ + if(result) + { + QMessageBox::information(this,"提醒","生成数据库文件已放至同目录outEvent.sql"); + } + else + { + onErrMsg(QString("插入失败:") + msg); + } +} + +void MainWindow::on_pushButton_delete_clicked() +{ + if(QMessageBox::question(this,"提醒","是否删除") != QMessageBox::Yes) + { + return; + } + + QString address = ui->lineEdit_addr->text(); + QStringList listPoint = ui->plainTextEdit_point->toPlainText().simplified().split(','); + listPoint.removeAll(""); + for(int i = 0; i < listPoint.size(); i++) + { + listPoint[i] = listPoint[i].trimmed(); + } + QString pointType = getPointType(); + + quint64 starttime = QDateTime(ui->calendarWidget_startDate->selectedDate(),ui->timeEdit_start->time()).toMSecsSinceEpoch(); + quint64 endtime = QDateTime(ui->calendarWidget_endDate->selectedDate(),ui->timeEdit_end->time()).toMSecsSinceEpoch(); // 结束日期加一天 + bool isDeleteAll = ui->checkBox_delAll->isChecked(); + + emit deleteWork(address,pointType,listPoint,starttime,endtime,isDeleteAll); + + ui->pushButton_insert->setEnabled(false); + ui->pushButton_delete->setEnabled(false); + ui->label_status->setHidden(false); + +} + +void MainWindow::on_pushButton_insert_event_clicked() +{ + if(QMessageBox::question(this,"提醒","是否插入历史数据") != QMessageBox::Yes) + { + return; + } + + QStringList listPoint = ui->plainTextEdit_point_event->toPlainText().simplified().split(','); + listPoint.removeAll(""); + for(int i = 0; i < listPoint.size(); i++) + { + listPoint[i] = listPoint[i].trimmed(); + } + + quint64 starttime = QDateTime(ui->calendarWidget_startDate->selectedDate(),ui->timeEdit_start->time()).toMSecsSinceEpoch(); + quint64 endtime = QDateTime(ui->calendarWidget_endDate->selectedDate(),ui->timeEdit_end->time()).toMSecsSinceEpoch(); // 结束日期加一天 + + emit insertEvent( + QStringList() + << QString::number( ui->spinBox_alm_type->value() ) // 0 + << QString::number( ui->spinBox_alm_status->value() ) // 1 + << QString::number( ui->spinBox_alm_style->value() ) // 2 + << QString::number( ui->spinBox_location_id->value() ) // 3 + << QString::number( ui->spinBox_priority->value() ) // 4 + << QString::number( ui->spinBox_sub_system->value() ) // 5 + << QString::number( ui->spinBox_dev_type->value() ) //6 + << QString::number( ui->spinBox_region_id->value() ) // 7 + << QString::number( ui->spinBox_interval_event->value() ) // 8 + + , + listPoint,ui->lineEdit_content->text(),starttime,endtime); + +// QString address = ui->lineEdit_addr->text(); +// QStringList listPoint = ui->plainTextEdit_point->toPlainText().simplified().split(','); +// listPoint.removeAll(""); +// for(int i = 0; i < listPoint.size(); i++) +// { +// listPoint[i] = listPoint[i].trimmed(); +// } +// QString pointType = getPointType(); + +// quint64 starttime = QDateTime(ui->calendarWidget_startDate->selectedDate(),ui->timeEdit_start->time()).toMSecsSinceEpoch(); +// quint64 endtime = QDateTime(ui->calendarWidget_endDate->selectedDate(),ui->timeEdit_end->time()).toMSecsSinceEpoch(); // 结束日期加一天 +// bool isDeleteAll = ui->checkBox_delAll->isChecked(); + +// emit deleteWork(address,pointType,listPoint,starttime,endtime,isDeleteAll); + +// ui->pushButton_insert->setEnabled(false); +// ui->pushButton_delete->setEnabled(false); +// ui->label_status->setHidden(false); + +} + +void MainWindow::on_pushButton_delete_event_clicked() +{ + onErrMsg(tr("该功能未实现")); +} diff --git a/platform/src/example/tsdbDataSimForCloudPlatform/MainWindow.h b/platform/src/example/tsdbDataSimForCloudPlatform/MainWindow.h new file mode 100644 index 00000000..22ae9c85 --- /dev/null +++ b/platform/src/example/tsdbDataSimForCloudPlatform/MainWindow.h @@ -0,0 +1,71 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include +#include + +namespace Ui +{ + class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = 0); + ~MainWindow(); + + +private slots: + + QString getPointType(); + int getDeviatType(); + void on_pushButton_insert_clicked(); + + void on_comboBox_type_currentTextChanged(const QString &arg1); + + void on_pushButton_delete_clicked(); + + void on_pushButton_insert_event_clicked(); + + void on_pushButton_delete_event_clicked(); + +public slots: + void handleResults(const QString &msg,bool result =true); + void handleDeleteResults(const QString &msg,bool result =true); + void handleEventInsertResults(const QString &msg,bool result =true); + + + void onErrMsg(const QString &msg); + void onStatus(const QString &msg); + +signals: + void operate( + QStringList listpoint, + QString address, + QString pointType, + quint64 interval, + int deviatProb, + double normalBase, + double normalLength, + quint64 starttime, + quint64 endtime, + int deviatType, + bool isDeleteInterval, + bool isDeleteAll); + + void deleteWork(QString address,QString pointType,QStringList listPoint,quint64 starttime,quint64 endtime,bool isDeleteAll); + + void insertEvent(QStringList listFixedArgs, + QStringList listPoints, + QString content,quint64 starttime,quint64 endtime + ); + +private: + Ui::MainWindow *ui; + QThread workerThread; +}; + +#endif // MAINWINDOW_H diff --git a/platform/src/example/tsdbDataSimForCloudPlatform/MainWindow.ui b/platform/src/example/tsdbDataSimForCloudPlatform/MainWindow.ui new file mode 100644 index 00000000..5b9581b1 --- /dev/null +++ b/platform/src/example/tsdbDataSimForCloudPlatform/MainWindow.ui @@ -0,0 +1,682 @@ + + + MainWindow + + + + 0 + 0 + 736 + 595 + + + + 时序库数据仿真小工具 + + + + + + + 0 + + + + 历史数据 + + + + + + + + 通用参数 + + + + + + + + 数据库地址: + + + + + + + 127.0.0.1 + + + + + + + + + + + 测点类型: + + + + + + + + 模拟量 + + + + + 累积量 + + + + + + + + + + + + 测点标签(,分隔): + + + + + + + ggggggg + + + + + + + + + + + 间隔秒 + + + + + + + + + + 1688000 + + + 300 + + + + + + + + + + + 偏离概率 + + + + + + + 100 + + + + + + + + + + + + 模拟量/累积量/混合量模拟相关参数 + + + + + + 正常区间起始值 + + + + + + + 50000000000000000.000000000000000 + + + + + + + 正常区间长度 + + + + + + + 7777777777777777311744.000000000000000 + + + 19.000000000000000 + + + + + + + 偏离方向 + + + + + + + + 右边 + + + + + 两边 + + + + + 左边 + + + + + + + + + + + + + + + 开始时间 + + + + + + + + + + + + + + + 结束时间 + + + + + + + + + + + + + + + + + + + + + + + 是否删除所有数据 + + + delGroup + + + + + + + 是否删除区间数据 + + + delGroup + + + + + + + 插入 + + + + + + + 删除 + + + + + + + + + + 历史事件 + + + + + + + 0 + 0 + + + + 测点标签(,分隔): + + + + + + + + 0 + 0 + + + + 固定参数 + + + + + + + + + 0 + 0 + + + + ALM_STATUS(报警状态) + + + + + + + + 0 + 0 + + + + 11 + + + + + + + + + + + + 0 + 0 + + + + SUB_SYSTEM(专业ID) + + + true + + + + + + + 4 + + + + + + + + + + + + 0 + 0 + + + + LOCATION_ID(位置ID) + + + + + + + 1 + + + + + + + + + + + + 0 + 0 + + + + REGION_ID(责任组ID) + + + true + + + true + + + + + + + 1 + + + + + + + + + + + + 0 + 0 + + + + ALM_STYLE(告警方式) + + + + + + + + + + + + + + + 0 + 0 + + + + DEV_TYPE(设备类型ID) + + + true + + + + + + + 7 + + + + + + + + + + + + 0 + 0 + + + + PRIORITY(报警优先级) + + + true + + + + + + + + 0 + 0 + + + + 2 + + + + + + + + + + + + 0 + 0 + + + + ALM_TYPE(报警类型) + + + true + + + + + + + + 0 + 0 + + + + 1 + + + + + + + + + + + + occ.dev3_ht100.yx34 + + + + + + + + + 间隔秒 + + + + + + + + + + 1688000 + + + 300 + + + + + + + + + + + 报警内容(tag_name) + + + + + + + [tag_name] 中断 + + + + + + + + + + 0 + 0 + + + + 开始时间 + + + + + + + + + + + + + + + + 0 + 0 + + + + 结束时间 + + + + + + + + + + + + + + + + + + + 插入 + + + + + + + 删除 + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/platform/src/example/tsdbDataSimForCloudPlatform/RandUtil.h b/platform/src/example/tsdbDataSimForCloudPlatform/RandUtil.h new file mode 100644 index 00000000..910f91ee --- /dev/null +++ b/platform/src/example/tsdbDataSimForCloudPlatform/RandUtil.h @@ -0,0 +1,95 @@ +#pragma once + + +#include +#include + +#include "boost/uuid/random_generator.hpp" +#include "boost/regex.hpp" + +quint64 quaRand(){ return qrand() * qrand() * qrand();} +bool boolGen(int trueProb = 50){ + int result = qrand() % 100; + if( result < trueProb) + { + return true; + } + else + return false; +} +double doubleGen(double base,double length) +{ + quint64 lengthx100k = length * 100000; + + return base + (quaRand() % lengthx100k ) /100000.0; +} + +#define DeviateMax 1000000 + +double doubleGenController(double base,double length,int deviatProb,int deviatType) +{ + if( boolGen(deviatProb)){ + // 偏离代码 + if(deviatType == 0) + { + if(boolGen()) + return doubleGen(0,base); + else + return doubleGen(base + length,DeviateMax - (base + length)); + + }else if(deviatType == -1) + { + return doubleGen(0,base); + }else if(deviatType == 1) + { + return doubleGen(base + length,DeviateMax); + } + else + { + return 0; + } + + }else{ + return doubleGen(base,length); + } +} + +void generateUuidBase64(std::string &strOut) +{ + boost::uuids::detail::random_provider randomGen; + boost::uint8_t baUuid[18]; + boost::uint8_t baBase64[24]; + + //< 填充随机数 + randomGen.get_random_bytes(&baUuid, 16); + + //< 最后填充 0 + baUuid[16] = 0; + baUuid[17] = 0; + + //< 编码为 base64 + { + static const char *szBase64Array = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + + boost::uint8_t *pData = baUuid; + int nDestIndex = 0; + for (int i = 0; i < 18; i = i + 3) + { + boost::uint32_t nData = ((boost::uint32_t) *pData << 16) + + ((boost::uint32_t) *(pData + 1) << 8) + (*(pData + 2)); + baBase64[nDestIndex] = szBase64Array[nData >> 18]; + baBase64[nDestIndex + 1] = szBase64Array[nData >> 12 & (boost::uint32_t) 0x3f]; + baBase64[nDestIndex + 2] = szBase64Array[nData >> 6 & (boost::uint32_t) 0x3f]; + baBase64[nDestIndex + 3] = szBase64Array[nData & (boost::uint32_t) 0x3f]; + pData = pData + 3; + nDestIndex = nDestIndex + 4; + } + baBase64[22] = 0; + baBase64[23] = 0; + } + + //< 输出 + strOut.assign((const char *) baBase64, 22); + strOut.shrink_to_fit(); +} + diff --git a/platform/src/example/tsdbDataSimForCloudPlatform/dataWorker.cpp b/platform/src/example/tsdbDataSimForCloudPlatform/dataWorker.cpp new file mode 100644 index 00000000..76a60eaf --- /dev/null +++ b/platform/src/example/tsdbDataSimForCloudPlatform/dataWorker.cpp @@ -0,0 +1,277 @@ +#include "dataWorker.h" +#include "RandUtil.h" +#include +#include +#include +#include +#include + +const int RETRY_TIME = 20; +void dataWorker::doWork(QStringList listPoint, QString address, QString pointType, quint64 interval, int deviatProb, double normalBase, double normalLength, quint64 starttime, quint64 endtime, int deviatType, bool isDeleteInterval, bool isDeleteAll) +{ + // 删除 + if(isDeleteAll || isDeleteInterval) + { + if(!deletePoint(address,pointType,listPoint,starttime,endtime,isDeleteAll)) + { + emit resultReady(tr("删除测点失败"),false); + + return; + }else{ + } + } + // 插入 + + // 生成QString + if(!getGenSqlAndInsert(listPoint,pointType,address,interval,deviatProb,normalBase,normalLength,starttime,endtime,deviatType)) + { + emit resultReady("插入失败",false); + return; + } + else{ + emit resultReady("插入成功",true); + } +} + +void dataWorker::doDel(QString address, QString pointType, QStringList listPoint, quint64 starttime, quint64 endtime, bool isDeleteAll) +{ + if(!deletePoint(address,pointType,listPoint,starttime,endtime,isDeleteAll)) + { + emit deleteResultReady(tr("删除测点失败"),false); + + return; + } + emit deleteResultReady(tr("删除测点成功"),true); + +} + +void dataWorker::doInsertEvent(QStringList listFixedArgs, QStringList listPoints, QString content, quint64 starttime, quint64 endtime) +{ + + + QFile file("outEvent.sql"); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) + return; + + QTextStream out(&file); + //out << "The magic number is: " << 49 << "\n"; + + quint64 interval = listFixedArgs.at(8).toInt() * 1000; + + QString sqltext; + // 第一层测点循环 + for(int pointIdx = 0; pointIdx < listPoints.size(); pointIdx += 1){ + emit onStatus( QString("正在插入点%1(%2/%3)").arg( listPoints.at(pointIdx) ).arg(pointIdx + 1).arg(listPoints.size()) ); + + + QString tag_name = listPoints.at(pointIdx); + QString key_id_tag = "digital." + tag_name + ".value"; + QString contentToFilled = content; + contentToFilled = contentToFilled.replace("[tag_name]",tag_name); + QString dev_group_tag = tag_name.split('.')[0] % QChar('\.') % tag_name.split('.')[1].split('_')[0]; + + // 第二层时间循环 + for(quint64 timestamp = starttime; timestamp < endtime; timestamp += interval ) + { + std::string uuid; + generateUuidBase64(uuid); + //insert into HIS_EVENT (UUID_BASE64,ALM_TYPE,ALM_STATUS + //,ALM_STYLE,TIME_STAMP,LOCATION_ID,CONTENT,PRIORITY, + //SUB_SYSTEM,DEV_TYPE,REGION_ID,DEV_GROUP_TAG,KEY_ID_TAG, + //CONFIRM_TIME,CONFIRM_USER_ID,CONFIRM_NODE_NAME, + //WAVE_FILE,IA_UUID) values ('B0P7XbDw7mACiqFAnT36YU' + //,3,201,0,1663027300645,1,'dev3 yx34 中断',2,4,7,1,'occ.dev3', + //'digital.occ.dev3_ht100.yx34.value',0,0,'','','B0Pp6cIUMGw+bZBtbMy5JU'); + sqltext += "insert into HIS_EVENT (UUID_BASE64,ALM_TYPE,ALM_STATUS" + ",ALM_STYLE,TIME_STAMP,LOCATION_ID,CONTENT,PRIORITY" + ",SUB_SYSTEM,DEV_TYPE,REGION_ID,DEV_GROUP_TAG" + ",KEY_ID_TAG,CONFIRM_TIME,CONFIRM_USER_ID" + ",CONFIRM_NODE_NAME,WAVE_FILE,IA_UUID) values (" + % QChar('\'') % uuid.c_str() % QString("',") + % listFixedArgs[0] % "," + % listFixedArgs[1] % "," + % listFixedArgs[2] % "," + % QString::number( timestamp ) % "," + % listFixedArgs[3] % "," + % QChar('\'') % contentToFilled % QString("',") + % listFixedArgs[4] % "," + % listFixedArgs[5] % "," + % listFixedArgs[6] % "," + % listFixedArgs[7] % "," + % QChar('\'') % dev_group_tag % QString("',") + % QChar('\'') % key_id_tag % QString("',") + % QStringLiteral("0,0,'','','');\n"); + + if(sqltext.size() > 1000000) + { + out << sqltext; + sqltext.clear(); + } + } + out << sqltext; + } + //out << "The magic number is: " << 49 << "\n"; + + // 两层循环,一层测点循环 一层时间循环 + + //qDebug() << uuid.c_str() << listFixedArgs << listPoints << content << starttime << endtime << interval; + emit InsertEventResultReady("nice",true); + +} + +bool dataWorker::getGenSqlAndInsert(QStringList listpoint, QString pointType, QString address, quint64 interval, int deviatProb, double normalBase, double normalLength, quint64 starttime, quint64 endtime, int deviatType) +{ + + QElapsedTimer timer; + timer.start(); + bool isDi = false; + if( pointType == "di_sample_result" ) + { + isDi = true; + } +// CTsdbConn(const char *pchHost = "localhost", int nPort = 8086, +// const char *pchDb = EMS_DEFAULT_DATABASE, +// const char *pchUser = EMS_DEFAULT_DATABASE, const char *pchPwd = EMS_DEFAULT_PASSWD); + iot_dbms::CTsdbConn conn(address.toStdString().c_str(),8086,"cloud_platform",EMS_DEFAULT_DATABASE,EMS_DEFAULT_PASSWD); + if(!conn.pingServer()) + { + emit onErrMsg(tr("无法连接数据库")); + qDebug() << "无法连接数据库"; + return false; + } + + double baseNum = normalBase; + + // 第一层测点循环 + for(int pointIdx = 0; pointIdx < listpoint.size(); pointIdx += 1){ + emit onStatus( QString("正在插入点%1(%2/%3)").arg( listpoint.at(pointIdx) ).arg(pointIdx + 1).arg(listpoint.size()) ); + + QString insertSqlTxt; + // 第二层时间循环 + for(quint64 timestamp = starttime; timestamp < endtime; timestamp += interval) + { + + QString singlePoint = pointType % ",tag_name=" % listpoint.at(pointIdx) % " status=1i,score=1.0,value="; + if(isDi){ + singlePoint += boolGen(deviatProb) ? QStringLiteral("1i") : QStringLiteral("0i"); + }else if(pointType == "ACCRUE") + { + baseNum += 1.0; + singlePoint+=QString::number(baseNum); + } + else{ + + singlePoint += QString::number( doubleGenController(normalBase,normalLength,deviatProb,deviatType)); + } + + singlePoint += " " % QString::number(timestamp) % "\n"; + + insertSqlTxt += singlePoint; + int sqlSize = insertSqlTxt.size(); + if(insertSqlTxt.size() >= 50) + { + emit onStatus( QString("正在插入点%1(%2/%3/%4%%)-正在执行插入语句到数据库") + .arg( listpoint.at(pointIdx) ) + .arg(pointIdx + 1) + .arg(listpoint.size()) + .arg( (timestamp - starttime) * 100 / (double)(endtime - starttime) ) ); + + int retryTime = RETRY_TIME; + while(retryTime > 0 ) + { + if(retryTime <= RETRY_TIME -1) + { + QThread::msleep(500); + } + if(!conn.doInsert(insertSqlTxt.toStdString().c_str())){ + emit onStatus( QString("正在插入点%1(%2/%3/%4%%)-插入失败,重试中(%5/%6)") + .arg( listpoint.at(pointIdx) ) + .arg(pointIdx + 1) + .arg(listpoint.size()) + .arg( (timestamp - starttime) * 100 / (double)(endtime - starttime) ) + .arg( RETRY_TIME - retryTime + 2 ) + .arg( RETRY_TIME ) + ); + retryTime -= 1; + continue; + } + break; + } + if(retryTime <= 0) + { + onErrMsg( QString("无法插入测点%1").arg(listpoint.at(pointIdx)) ); + return false; + } + + insertSqlTxt.clear(); + } + } + } + qDebug() << "timer: "<< timer.elapsed() << "ms"; + return true; +} + + + +bool dataWorker::deletePoint(QString address, QString pointType, QStringList listPoint, quint64 starttime, quint64 endtime, bool isDeleteAll) +{ + using namespace iot_dbms; + + CTsdbConn conn(address.toStdString().c_str()); + + if(!conn.pingServer()) + { + emit onErrMsg(tr("无法连接数据库")); + return false; + } + + // 获得删除语句 + qDebug()<< "start delete"; + { + // 第一层测点循环 + for(int pointIdx = 0; pointIdx < listPoint.size(); pointIdx += 1){ + emit onStatus( QString("正在删除点%1(%2/%3)").arg(listPoint.at(pointIdx)).arg(pointIdx + 1).arg(listPoint.size()) ); + + QString singlePoint; + singlePoint += "delete from " + pointType; + singlePoint += " where tag_name='" + listPoint.at(pointIdx); + if( !isDeleteAll ) { + singlePoint += "' and time >= " + QString::number(starttime); + singlePoint += "ms and time < " + QString::number(endtime) + "ms;"; + }else{ + singlePoint += "';"; + } + qDebug() << singlePoint; + //emit onStatus( QString("正在执行删除语句到数据库") ); + int retryTime = RETRY_TIME; + while(retryTime > 0 ) + { + if(retryTime <= RETRY_TIME - 1) + { + QThread::msleep(500); + } + std::string result; + if(!conn.doQuery(singlePoint.toStdString().c_str(),&result)){ + retryTime -= 1; + continue; + } + + if( result.find("error") != std::string::npos){ // 找到eror则错误 + retryTime -= 1; + continue; + } + break; + } + if(retryTime <= 0) + { + onErrMsg( QString("无法删除测点%1").arg(listPoint.at(pointIdx)) ); + return false; + } + + + } + + } + return true; +} + diff --git a/platform/src/example/tsdbDataSimForCloudPlatform/dataWorker.h b/platform/src/example/tsdbDataSimForCloudPlatform/dataWorker.h new file mode 100644 index 00000000..eed26f1a --- /dev/null +++ b/platform/src/example/tsdbDataSimForCloudPlatform/dataWorker.h @@ -0,0 +1,55 @@ +#ifndef DATAWORKER_H +#define DATAWORKER_H + +#include + +class dataWorker : public QObject +{ + Q_OBJECT + +public slots: + void doWork( + QStringList listPoint, + QString address, + QString pointType, + quint64 interval, + int deviatProb, + double normalBase, + double normalLength, + quint64 starttime, + quint64 endtime, + int deviatType, + bool isDeleteInterval, + bool isDeleteAll); + void doDel(QString address,QString pointType,QStringList listPoint,quint64 starttime,quint64 endtime,bool isDeleteAll); + void doInsertEvent(QStringList listFixedArgs, + QStringList listPoints, + QString content, + quint64 starttime,quint64 endtime); + +signals: + void resultReady(const QString &msg,bool result =true); + void deleteResultReady(const QString &msg,bool result =true); + void InsertEventResultReady(const QString &msg,bool result =true); + + void onErrMsg(const QString &msg); + void onStatus(const QString &msg); + +private: + bool getGenSqlAndInsert(QStringList listpoint, + QString pointType, + QString address, + quint64 interval, + int deviatProb, + double normalBase, + double normalLength, + quint64 starttime, + quint64 endtime, + int deviatType); + bool insertPoint(const QString &sql,QString address); + bool deletePoint(QString address,QString pointType,QStringList listPoint,quint64 starttime,quint64 endtime,bool isDeleteAll); + + +}; + +#endif // DATAWORKER_H diff --git a/platform/src/example/tsdbDataSimForCloudPlatform/download.ico b/platform/src/example/tsdbDataSimForCloudPlatform/download.ico new file mode 100644 index 0000000000000000000000000000000000000000..4e2193609d5b28c2230d9b4cc0089681022decc9 GIT binary patch literal 4286 zcmcgw=~q=%6o35(edkP-J|F144=l@<4${iW=Zls7qF2jx8l?C8m~= zCYm5FhZHh3CBeinLkB+MVN*B9S4w4@4nr3uU>t~^X=Z`*T<29T!xUvZ9G}M z&C>CWG0cGmwErc?zuy4C0w&gA_4TLCiOcA(f-4j;Xz3m+2+v4s)TUUHa zxtT|)wCFljKYU0HH8s-ljWNuD2DIQ;yh;|<1PowpUb0;5VD&Xq;Cs##!8~S%{u-|0 z4|g3;2eyAr_sh$vy{(OGwf6RQdcd^c0k3flzyMa@AQ$mjEbH&h_R`Z~oqkOBS?qi& zE54yYHrCb4@AA^pE^7fMbo%A!F}huHlUiF^ga^Ek0a=i#>;Nou#ERf|+8Fboo9Os1 zrKNmMP4)F6r~Fo__$qEvAbt43aEfNXSCrk>)^$BUpTamM;s2Q zf=vAy@ZB9g)|!^Go}N8@D*R_zCyV<8S+BBFkjqfI#r{TXX=$c)aSO@o9edHw2fFog zphZ)InWji+o;`UYG9g>ppgVln1omp|)LX?Q;#to(&3Oow6kZeAw@XS`=TTjB11)&s zCI?E~fDkevTlv|Dk8#9HS#hz*#pBZH9I>0iR__3|WnNCM(49PRQ0%Ve)El;%G++=F z{CZB42iYnnjric(zx^wX79VwwYbZWwhUlW?;td-g-jOD>+gGh&+dsDt=AjE>N#*;>x$_hF1YOLMaf0RvdTRQT98$X#fa_wLcA#HEz+O&T@S)@nRwv$H9b^F90utjX-# zT^ly>n5*~$W5{Vu4Gr{9V|9kq0bbqFz{i%oN1& ztoG9(_ABg*Je3eUgO2Y%K$R60l5dJG=hNcAVBv)gCUP#vp7LaRV3ZUVQs%Bb6wiE9 z2Mv~eh}eLwJ>IgTHPNxu#yJ$Z8ubEoEXLc9EUx1upCfOr4389i=mT9L-!jgVHhi2w zrw(S&sf)}n=-|wSi=|4~u#~NhK^YjthfDiF4K7n5#i`N^;a%!p`(c{WW z!9)#>W`C<7ka>Ef$tBdfc^vN=ZwQ*OFUptvxAf78$GZ3#-0fq z?auzKphm9wsGX?a8a|I<4tjuA@fqK+rMa&Yoj-n3!_PaDBk?fJd8p(ItRL&u%fZ+@ zwps0?YSC5UEBnJHb=8k4YJyK!{n?I6-b6khpkB}58k!IsLRT+blsH>9GnA$bbf(PR z-x1c5zAcqjMMlXP1?%tNw-?{S$Eep9&ULWAia*2z+O|)UME8!hJBr*W_Up#@C9Lxa zx_-HUV$G98KVYIOJ#nrqbR?C7IHlS25gEwni98|npw}31&g#Cjkrfoj<(XH2M-KVNc1q~ zpPuqB@=5mIeG-=nTYSoKxc7^#A|HF<#j{f%TKmxgiFN%Vy34;xuCe~0b}gF~MmRGn zAFKU<8hGjS84-%)l!pIb-_mr_;F4`e4;^SPv;M{ zX5;xQH#1AtfV|_|8C%mhxBqeef`XR!o{d{Lj_tL*j+%n={gb99sna;q**bq=4OqAF z{CV}ai)`O;+3WuOoM^||b=nzME#k!f9|`#{g3pSZ6P6NqP{&{D{K>k(_R0nww(C59 z-{?4hH*rmc%nK(^vCIYqtG%J;&1-*B74LQ6qLnc(Y!1C4Q^^MwI_iJN{lmrP{R4Lj zbw1HRyZHdktK2_c`TmvF!~KirUiSWlbCSA;%KbBx@1MNSm2He~>?Pz$>}kYSIG-6} zxNf848)KLQ4QP%0>bKlK8B5(i)g2gih~={o^0BRsnuWTF+KrBHjM?Iod8PxFx_=x0 JAMk(w{ulSMsNw(s literal 0 HcmV?d00001 diff --git a/platform/src/example/tsdbDataSimForCloudPlatform/download.png b/platform/src/example/tsdbDataSimForCloudPlatform/download.png new file mode 100644 index 0000000000000000000000000000000000000000..22e651aeba98d511ca2bcc4224a7d3ea895b618c GIT binary patch literal 8282 zcmV-gAf?}lP)O8NQv-{0aQ9YtMQb^!o5As|XAAWHxH|0p3!|NZ|UAWA19N+={v92-X}B}()2 z^#uSz+S=tB8AciuJ^%nU`27DB6GQs^`W_iT002E16hrp)_xJnveteI@z|1{2UewXq zZ*GTZXM?Jzw3m~mLP2E>06QNWOd}aa001)P=IJRYN{EJ;$;Qi3Olz>Nx;#8wKt5!b znWPgDJ!oTtet4A>4na*vW&i*!001agR(4=sb*rqmQBY@|pR$63oN{o6$;H%+ika8b z-Z3y)($?5BGEqT4TNVvRYiWF-n61OV#mLIeu(P@V02??qW3e4eWdHyl97#k$RCt`- zoqKL17xN^D2Oxo9+1-2g`eQzw zmP5V}l3d4RnE$$DeE*Z|?C&qOL?o2VVc*IB?&9=^ri3MI8m+1h*xz4(UTqo8Fd;Ww z>mc*r5TLJzT#(Rs75IOmlc8aBbF7w5XGJ{*bsF9k^aXf?{$Hkd zGmXu44P!Xbt~NbYZ%HnpS=}5XPFH9#aALOIYBwW^5K6F%BRus)U@A%saVs>-Y6ULkkibeQK(6=FB)?r;jb=WL< zgv?j{Q-p$At-dTC#s-NjAjbG%@lvg-Lisbd)xUa|J1I3ERhN(*{6vKL4WZs;PPT;K z)T3|3%PQaR^m;W)x~i%e!PMOow1bpz|(^B(Cw>5G$>;L3a2(MqDrbFQ%p~_a!RfG<=B@{*YRdPt@ zfP)P)8x)Gk2;qQOE~{31^YF!khxw1456s!yyn$LgT#c|cc)`W zr>BYfCQi^LB%|Ye*Af#BM&8G7=X5bdm_cJizYG5?btf5mJh(#1XqxipWO-itB-^2s z&XWGmR7h8F;nx?m|@f zB!sZtR(n3Lp9$p*o)FGtWm)F;`UedmuY=b+i8((%Pn8f|Pr7>rI-i746nR-L@7E0& zLi9(vaoQWsr$Vl4GYurE5^k<&cXPrtLp^t(qkJo)AYmdw!#V8M_v55fdornw?_sB7 z6ZNYD)oZuBdaSPV$#)3Q{D72^zmX8B3TW;C|MWYAL(;&i zkI70yy26d?*5H^``DX}a@HM_=DauzM|D%LuVKQ!T|I{mlFOh4EC%akhA0Xs~mC129 z!j$KXJt4=LtK?Ss;|Te(D)tBq>;{^sxvXgz-Rq<(M(mo_?ulwS8RU_K>ioS)XaszP z@7-2s)^49oT1FB^+kA?hSex&2^`9VgZfeA5on5}ZR2^Lw1YXyld!z>u5_7n?pN&?% zu^D;TY3;`OI|*IGA8V~}uLgaT+<5WKJHUI&m7*ZuQZ81zSBe0DqJZM_qGd3Qr>kQ` zTIJaU=EsDD=*j>*VqXl$HSL)WitORc3@&e}2$%W7)-cS2fm8VQL|#QS9{~`l*Kmmm z+2XT-@1adQcL_Gu-2+1H`z-|^*B?|oLMTvGSL^GCtVEcLPK{^(b4-iSUEK?#cLvi( zOHgZOff#l{0AP*d371x(xc5;Pq42y@?R0HyZ;_bykwC3%&=aE9!|QYWKpU@cR zq_w{OcMz)WEdF*aLB=a^=$D0JY(FItBF51YdrG#grb>vkGhQbEniDzdTwWi=&Eyfr zS$hgZKv08fo&q60V;uAs~&~4ON@xK2K4C`h6GfhBA-%opGWhQuRQ zSOBM;aBIe3AQA?v7(!8WzG7|IV`T55YSo_5!CPz^jc(*n;TJHyz+K|2L(+%i2tl2} znjrd9F)`s_ft_?3ja!yJECNdin^-4x^hiRu&``&C!qF5C-U$f{Sp9%$oWD-#uRbQIqbcxY(j7LLQ7uMCU;-&(m1C{NnVaFkvk> zpeNKPB-`srX$<&;gnF*V5DBHBBWIElYJEFQXsiqLgl9dH`TPVvDm@Wlh6i1S{0yCLJZukuDAIen`22O~ z71*mOb)XC{FQaUB_CnE;5Q-E&qjB%v^;ggms$t)1_L)8u$cgcQjKw5`v9Hk8drsb4 zg(S(Z-QheriwL{56t>E;~d zrXdb98#!f`f3iUpgG4B5H`LM0&GC0Y7mvmB`S$>!J)+F(gsOO?&6RP3Rc^H4_)aAJ zzD$ryz|9>hs~aC$RdU(yl(rCFp2Wom!UiwD(-HzFSw#AHF4MG>7jFFLHHQ`@p&VbCd#ke`wtA zD)Eyc%0KOq?d3sv3OqDCp}ew>i%pjdF=~Z_Oj|F9gdG|}K_5n`0DdXiE5A(yOUOGP zWVI=p@HG3XMD$WotUUkNcT;l?;t9)g&rPPIlN08{@qO7CLLROjV*(4J#J>1ajmYES zuZ%rmFIMk@(}X}dif+Xm`64HMM2VGD*g3xP-%7U*w$uFT05LPs4Tk87-$2-YJRm;M8WwnO$#uCq*#u*4jiYjA|aAfaRqXL%J_j5gVsWfU%`OdZ(HQLATQv+vuKR& z2@A+utteCC3Kp*I2DlI}AD^+vqx6M*&J6bD5;G(dBE>-V={F@5qu$qr%^$t9;7s6_ zD_{W-9C6gTHL^_bUBahiE}ZbBfzI7rse)axA%BP>F71e{O|HS1tF_}sy;tDKbs9W$ zEbld(AR+t!WaIE)*ab|MY=nWW1hOMf?ptHbz;5Oo(xgEYNO+mcMh~L)?QAgco?KDO zy$An}Vyr|WAy9n>pOoy2h%pa!IHbVI!g?|rhL*D~Vlu+Ad=mK1;5N(vIxj+7bL;HZQD0 z-Sk^Nf-n$tRBE=vz5tR`P*#*)&n>h2;Vs(+^n}9fmZa7+8jbARt73)1pLpI1**L~^ zG9gwR0rLpZf(#Rju#R5T7K=_)FP_SB|x3Lr3xa(X^wQ!ZCGOu@n zkHxIB1VXg#4)l_5(*!{!Ug8ojTh&z;KB@-CES=0|;70QXFF0SSqxs^QRe@Xk;NUz_ zSuaB$lxLQR@~>uid_jQbvbVSy=zt~Ke?rM)+!u0P451x3`0}_?21vP6 zuNLE1ZTlIc%#a6E^vmUFO2*pSH3I^!#}aM;wR?*fQPc;8C{yep7hG@bP3a**Ip;sr zu#P5#Gl&2*ZQHR5P7ZwlC%a&1d$_Yti)>{Xwx?ygt&sw|rkjx%NjM4;=42wF>Ypr_ zrIj#u8Y^h};x9s9Sy%Ja4^-XA3yXluM2?eebDUeB)h&(OH4lWpv;&AMl}H$Le|@5; znV(P(0dgGEb+&}SD>W+FwOX$?yU9C1_sT0$5L(N?wTBLo@GS7r=8mbWxHf1rACv zi6z9#i$~9nO=_0nd~ia$M0 z;DTawG~q=mt2S*!B9w9|RP#rLOZ{qo0>Yt_#yey$Nd{hN77iy&ERe8INf??BnXz;H ze7K+9c&A6Ozx1pWzH{^r{n!6NJ>ws(A0jy*6#Dp=DD~4A$5(f@zaWRdzt!C{Y8{{HIY|gb zmRHZL&f`bcc0atHuq70gQP3Eg+WrJQuls!wC?b$V7+m0$>`OXAw}!o9U9K;TH{=^G zxrQYazT**U%E+IN`gX6Sw8sQowFN%&3$mRiXlrA*QCwILvgTf0U9kX&AAJ=o9eDz^7* z_Xz-s(_Y=ZZ6;hlp|Nld_LK3(S^xH78P|=hEf}uZEM>d7LXvT9PdKRhr$e&e0^@sP zq>hTI(87AI(J8yQyT-0p?Avv8%+p>5+Y4mJIe1dyT|A1x8G!723i}VCeBiv?E}`H! zi!otMZNECyyPP=7{b}QlLx19yFlZ5u@*f6$!03UjG0|D@8EN_U@QI|^8u#KAPgR{K zWONRBbqI+e#^BNc)7 zy#(%Irh^QeL1@a9qpE&E&rGBrKM;$7nmH9(blf&pTYu^54P8YJc{;CdC#P$hjb;OdM|RwSP1)llR$@*HM__~`@rtpX1_ zDxM}36NN+?3YAJ_69vU0Pf!1mTqck!nKO&H`2bLKK?sMhqXLP!V3|uvGJ5wJ8SJ-# z3!UffSQ(5Xj);ju5{_$QjAyS=Xc;M2hf#5@C8JNQY6P^&YSnJ9aUpxfzgFSL#+h%u zk)?o5MX^d~6^mY#7EG#-jB9fV!?B6n%GnaK`Pn!s&Rx3glhrLSZDsAJr=EZ#ELfpY z97!|#KAf%3bkr+wgrWv+{jV@KHW3$J+8k|EeU`mk*-}K%nbhMW%#Yx^TjG0+CoBvI zDU?#y9DglX`KcC45EWTv`WSQo$HkZ8V}$2<0qPHhzp&4FC-#v10#Q_K+jY>42{U?V zX>uSOXAW~W-|M;nfFKAO6gV;nvK1aSVq=5}ao*#L+5POB5e>M?ljnHYq4JMzz^y?F z@YW&_H#aaITQ4u`^)r0h&(F`3RSVak*f{T_WA*JDD`L5Y3V~lYno)#6QzEnQpl02G z|Nbyd1Byx5I4eF@pOkMwt_rx3>`0GVGPA4zr*#D2DgGEjpj}1P6lgTIyV;Z?8WW#y zab(U6D$h*B%b@r()eCJlN90-`LR?CEyu|0s9GCZG#zk%LyyJzs+OH8or_}kdB%#TB zIwp55ivXhug>BVCsTDz(JXtLu@wsb9sF!ZPy-;k(xX|9Wsq$cjuwWKg=AF zLu%i|?>bT5*K6ypBNa!@X*K9`D*Zy2Lz*}b7y-r-3hmw8976~vjbZc1j3CN9;Dou{ z&Dns$vLfui?(rm2hX(*S!|ajokS>=ySw6lL{aNkWz1UszX%t(b&ABHBL`OD;G9N!l zO$F(Z&Tv%OSND9H#afv~{r;$AWZIevN$O&Z*Hnau6N926{4u=eJOB=1)n6 z)I{}ZXlo2ft1}v#D7>JvJRn@s*h32tF=r-whx9duXzN6M)H5`r49ixWrvu}N`J9Q5 zBt@BhdX;2T#}U%ki9$kA>kF<%*8-J`lP?QC--$h=-0ZgktQCDeH+`)yBvkd<77Cpc z7p~_0foCJy&FL$=-oB%Kjmhe@#n;?J)r2X7UZLjXcSC=3sNLHl5LO12)gfWcy|}uG zP`DWi_o0av;rX+r@6_e@B$Yvh_RwrXiE2#px`{EhFOl@9Q($?%9*9|Tk`NXL1HBhV zn7H<3O#M;@*=49Bq~T}iw@pZ2k`Pwlqs;$bH*&3fO#RZR8nj5d)dF>0PQ4R&0sjvq zA}khxmJg>D`5t)E8nj5rb%asH!&cnlaxcZdg1*L!LBc>9I5O!&ObOeqB(Eckgj@?6 z5?%*=Zc&8RTYxZe%p-DblD1bsa$GHFay@S-cL_pYi=ljrT0QYQ6vaH*2zXpQ?}(c0 zZfO$w=4qk4E@?uaK<%}rl9{gX1H;iZ*(2)eqa7C#G*OuaAAa*OpJ)RRS0V_HtE(Te zH$p-}Jyd&^%U-5O_=&v{i2GY0!UW%;6Uvz9?3u{prX(N|2EDnPHwr2}T-q95V2h#um<GK^T_=jXZ@tyNLU){aDj&4TvXX%o*** z7RVT>697}$ca5}nUTG-{mG}{#L}y1lC%$Lsaw#G zeTNO^k!DT9iW&sO6Q;NiDS0nhW9|Te_8cd+7H#T>`wme=V2o1-D))tIu}WAtrn{Fc zc|YLmj^akT5-%a*=R+i|nD7Qv6QyuA#;?`V-Vd0(r!zC0DwP;Q{5xcfm`x&4INu*` zAQVQ@-P1X0U+xlPtVEq`Sb~IAlDD%H9RN@%3_9lxJYmZFa&I6>d#f|t$D#m8Wgp=0 zoc9La*!klNnGl`_CgB}&cYx{ct-c`?^*$l|xsmNIbeTw~z7s43%rZ|VWCshPIltD| z=^P3P33+{v?{9E4H^-~`6lVoRL5ZYySc=G22i7CeUW-9zDnJnQtC)SL?3J+J+pGeV!Fm?u+Ll&%HbJePgoK_rH?>$Fzw~3-TP;TSv)9P% z1sAb*HPtjlQ3kp*m@FQn{Gq3{n`FgMjw9sN`8$`uc!a*@t zRA!TO2s342GX7@?8{`p1$JPk>ayS$6BA z(m$mtuY=b+iHX|J;}}8LlkQ%D&Xac@3JFqTWw}fyEX!y0`Mhmqk`Pv_ydo~T=S<4) zkU8%zM1_yo9}7d6vD))_{cPtF2@vvfALXq{-ARVNKox2MTsZ$ZS)Qjk;*`#plRp(r z%OoKzW+rZMSa+9=d`O7wFgb6vSsPI}B>ci^-_hKWY07SOOkvHnu zIo&G`<0AxD*9=O+a!5S}oJ%X*^Wyj)hT_UeOVV4)Jp{8+UuwOmeILkg8`V>SiRo18RMLxdGp?Rp#U zluFD+bVewKa9fi{cSf!5k0$I0iTW!%_@vbQ(QSb&OX}cGn6B!&Qdpt0 zBPWtH#0_IgPd0<~VR)92MB1>*eo-B&7u7+u|s4Q2Hq0|}iCq59a| z>7QSz;|OrK;sv!@eOWw=4N5v={IGbbR@JDmiul{=TWtsShDUWnIQR((?LKe`2eVyN zNLEZ*=*LfpL{k)5Ry(V)NvH&kgv*-aRY#R&MbUWQYUGI93ZiGCJ3-r`xrCr^Lqcij z8J_i(jfNTS{Jce*E)Xp&3#R#cUH{U~t%i4R*VoszjliGY?uM&e`-@($=drf(5;CSYr;5`R8V9-5>iuo1bhBu`B-Q!Dg7U{k+#elPhCPKnzL0n5 zW~|b(PtbV0ntH1;ypp)gj+5hQ0j&ye$FtzfA9D8k_4H z#&DutZ3uM~?3Y0wdKGxbWD1U>D`;siI{m1W!h*CX`*GQFDtpy-ZM$as$oxT&Iu zP#OyR<0>iK?Ozo3VE+NZ^*?6ZA#Jhsa;4K_{zW;^mGy-?h-WqvlIXp~{}7?zZG5sJ zWPXS#RM!5V5`7y2lG!dRUXxpt|A&PacH3ZX2^ns<){}>q|8EM=*TdaHYDdU4jaF3$ z?C&o?ueJ`HSbM_FmZJkyZR$4`K_AS9J{9$l5V_*B!%psZmd-G1`&Dp1q5DDp-V);Z Y|7*o}7*0;ig#Z8m07*qoM6N<$f^{YCp8x;= literal 0 HcmV?d00001 diff --git a/platform/src/example/tsdbDataSimForCloudPlatform/main.cpp b/platform/src/example/tsdbDataSimForCloudPlatform/main.cpp new file mode 100644 index 00000000..e98f4b99 --- /dev/null +++ b/platform/src/example/tsdbDataSimForCloudPlatform/main.cpp @@ -0,0 +1,16 @@ +#include "MainWindow.h" +#include +#include "tsdb_api/TsdbApi.h" + +int main(int argc, char *argv[]) +{ + using namespace iot_dbms; + initTsdbApi(); + QApplication a(argc, argv); + MainWindow w; + w.show(); + + int result = a.exec(); + releaseTsdbApi(); + return result; +} diff --git a/platform/src/example/tsdbDataSimForCloudPlatform/tsdbDataSim.pro b/platform/src/example/tsdbDataSimForCloudPlatform/tsdbDataSim.pro new file mode 100644 index 00000000..3a865e21 --- /dev/null +++ b/platform/src/example/tsdbDataSimForCloudPlatform/tsdbDataSim.pro @@ -0,0 +1,55 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2021-04-07T16:28:26 +# +#------------------------------------------------- + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = tsdbDataSim +TEMPLATE = app + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which has been marked as deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + + +SOURCES += \ + main.cpp \ + MainWindow.cpp \ + dataWorker.cpp + +HEADERS += \ + MainWindow.h \ + RandUtil.h \ + dataWorker.h + +FORMS += \ + MainWindow.ui + + +LIBS += -ltsdb_api -ldb_api_ex + +win32:RC_ICONS += download.ico + +win32{ + LIBS += -lbcrypt +} + + +#------------------------------------------------------------------- +COMMON_PRI=$$PWD/../../common.pri +exists($$COMMON_PRI) { + include($$COMMON_PRI) +}else { + error("FATAL error: can not find common.pri") +} diff --git a/platform/src/gui/GraphDataAcess/CGraphDataAcess.cpp b/platform/src/gui/GraphDataAcess/CGraphDataAcess.cpp index 8f6d06f9..952005dd 100644 --- a/platform/src/gui/GraphDataAcess/CGraphDataAcess.cpp +++ b/platform/src/gui/GraphDataAcess/CGraphDataAcess.cpp @@ -26,11 +26,17 @@ CGraphDataAcess::CGraphDataAcess(QObject *parent) : QObject(parent) m_permMng = NULL; m_lockCal = NULL; m_pAlmApi = NULL; + m_ptrRedundancyInfo = NULL; init(); } CGraphDataAcess::~CGraphDataAcess() { + if(m_ptrRedundancyInfo != NULL) + { + m_ptrRedundancyInfo.reset(); + } + if(m_dbMng != NULL) { delete m_dbMng; @@ -116,6 +122,12 @@ int CGraphDataAcess::init() return false; } + m_ptrRedundancyInfo = iot_sys::getRedundantInfoInstance(); + if(m_ptrRedundancyInfo == NULL) + { + return false; + } + m_permMng = getPermMngInstance("base"); if(m_permMng == NULL) { @@ -123,8 +135,6 @@ int CGraphDataAcess::init() } m_permMng->PermDllInit(); - m_ptrDogAuth = iot_sys::getDogAuthInstance(); - SNodeInfo stNodeInfo; m_sysInfo->getLocalNodeInfo(stNodeInfo); int appNo = getAppIdByName("public"); @@ -972,6 +982,26 @@ int CGraphDataAcess::getUserIdByUserName(const QString &userName) return userId; } +int CGraphDataAcess::getAllowDurationByUserId(const int &userId) +{ + int allowDuration = -1; + int retCode = -1; + + if(m_permMng == NULL) + { + LOGERROR("getAllowDurationByUserId m_pPermMng NULL"); + return -1; + } + + retCode = m_permMng->GetAllowDurationByUserId(userId, allowDuration); + if(retCode < 0) + { + LOGERROR("getAllowDurationByUserId error! retcode = %d,user_id = %d", retCode, userId); + return retCode; + } + return allowDuration; +} + QString CGraphDataAcess::sysLogin(const QString &userName, const QString &passWord, int groupId, int expireTime) { @@ -1019,7 +1049,7 @@ QString CGraphDataAcess::sysLogin(const QString &userName, const QString &passWo break; case PERM_PASSWORD_ERROR: { - errorStr = tr("用户口令错误"); + errorStr = tr("密码错误"); } break; case PERM_USER_EXPIRED: @@ -1622,8 +1652,12 @@ QVariantList CGraphDataAcess::checkCtrlInterlock(const QString &strKeyIdTag, con bool CGraphDataAcess::health() { - iot_sys::CRedundantInfoInterfacePtr ptrRedundancyInfo = iot_sys::getRedundantInfoInstance(); - if(ptrRedundancyInfo == NULL) +// iot_sys::CRedundantInfoInterfacePtr ptrRedundancyInfo = iot_sys::getRedundantInfoInstance(); +// if(ptrRedundancyInfo == NULL) +// { +// return false; +// } + if(m_ptrRedundancyInfo == NULL) { return false; } @@ -1634,7 +1668,7 @@ bool CGraphDataAcess::health() // int appNo = getAppIdByName("base"); iot_sys::SNodeRedundantInfo stMasterNodeInfo; - if(iotSuccess != ptrRedundancyInfo->getMasterNodeInfo(stNodeInfo.nDomainId, CN_AppId_BASE, stMasterNodeInfo)) + if(iotSuccess != m_ptrRedundancyInfo->getMasterNodeInfo(stNodeInfo.nDomainId, CN_AppId_BASE, stMasterNodeInfo)) { return false; } @@ -1801,12 +1835,4 @@ int CGraphDataAcess::getScriptByStrategy(const QString &name, QString &script) return -1; } -int CGraphDataAcess::checkDogStatus() -{ - if(m_ptrDogAuth == NULL) - { - return AUTH_STATUS_FAILD ; - } - return m_ptrDogAuth->checkAuthStatus(); -} diff --git a/platform/src/gui/GraphDataAcess/CGraphDataAcess.h b/platform/src/gui/GraphDataAcess/CGraphDataAcess.h index a14c6845..15ec60c1 100644 --- a/platform/src/gui/GraphDataAcess/CGraphDataAcess.h +++ b/platform/src/gui/GraphDataAcess/CGraphDataAcess.h @@ -11,7 +11,7 @@ #include "../../include/application/sim_interlock_api/SimInterLockInterface.h" #include "rdb_net_api/CRdbNetApi.h" #include "alarm_server_api/CAlmApiForApp.h" -#include "sys_dog_auth_api/DogAuthInterface.h" +#include "sys_node_mng_api/RedundantInfoInterface.h" using namespace iot_app; using namespace iot_dbms; @@ -84,6 +84,7 @@ public slots: QList getCurUserInfo(); QList getUserGroupByUserName(const QString &userName, const QString &logTag = ""); int getUserIdByUserName(const QString &userName); + int getAllowDurationByUserId(const int &userId); QString sysLogin(const QString &userName, const QString &passWord, int groupId, int expireTime); int sysLogOut(); @@ -107,12 +108,11 @@ public slots: bool getColumnDispInfo(const QString &tableName, const QString &columnName, columnInfoStru &columnInfo); bool getMenuStringByValue(const QString &menuName, const int &menuValue, std::string &menuString); - int getDigValueNum(const QString &keyIdTag); + int getDigValueNum(const QString &keyIdTag); QVariantList checkCtrlInterlock(const QString &keyIdTag, const int nCtrlValue); bool health(); bool health(int domainId, int appId); - int checkDogStatus() ; //读取文件 QString readFileData(const QString &relativePath); @@ -120,7 +120,7 @@ public slots: private: void getValueList(CRdbQueryResult &rdbResult, QVariantList &result); void getValueList(RdbRet *objReply, QVariantList &result); - int parseCondition(const QString &str, iot_dbms::CONDINFO &stCondInfo); + int parseCondition(const QString &str, iot_dbms::CONDINFO &stCondInfo); private: QMap m_colMap; QMap m_stnDmMap; @@ -136,7 +136,7 @@ private: CSysInfoInterfacePtr m_sysInfo; CSimInterLockInterfacePtr m_lockCal; CAlmApiForApp *m_pAlmApi; - iot_sys::CDogAuthInterfacePtr m_ptrDogAuth; + iot_sys::CRedundantInfoInterfacePtr m_ptrRedundancyInfo; }; #endif // CGRAPHDATAACESS_H diff --git a/platform/src/gui/GraphDataAcess/GraphDataAcess.pro b/platform/src/gui/GraphDataAcess/GraphDataAcess.pro index 1880365f..822748ce 100644 --- a/platform/src/gui/GraphDataAcess/GraphDataAcess.pro +++ b/platform/src/gui/GraphDataAcess/GraphDataAcess.pro @@ -6,7 +6,7 @@ QT += core gui xml sql LIBS += -llog4cplus -lboost_system -lprotobuf LIBS += -lGraphPub -ldb_base_api -ldb_api_ex -lrdb_api -lrdb_net_api -lalarm_server_api -lnet_msg_bus_api -lpub_logger_api -lperm_mng_api -lsim_interlock_api -ldb_sysinfo_api -LIBS += -lsys_node_mng_api -lpub_sysinfo_api -lsys_dog_auth_api +LIBS += -lsys_node_mng_api -lpub_sysinfo_api DEFINES += GRAPHDATAACESS_LIBRARY DEFINES += QT_DEPRECATED_WARNINGS diff --git a/platform/src/gui/GraphPub/CBase.cpp b/platform/src/gui/GraphPub/CBase.cpp index 2807d66d..1803fed2 100644 --- a/platform/src/gui/GraphPub/CBase.cpp +++ b/platform/src/gui/GraphPub/CBase.cpp @@ -37,18 +37,18 @@ void CBase::setSysHome(const QString &sys) const std::string strLanguage = std::move(iot_public::getCurLanguage()); m_pathTypeNameMap[PATH_TYPE_ICONSET] = - getSysHome() + spt + DIR_PLAT_OR_PROD + spt + "common" + spt + "resource" + spt + + getSysHome() + spt + "resource" + spt + QString::fromStdString(strLanguage) + spt + "gui" + spt + "icon" + spt + "hmi" + spt; m_pathTypeNameMap[PATH_TYPE_TRANS] = - getSysHome() + spt + DIR_PLAT_OR_PROD + spt + "common" + spt + "resource" + spt + + getSysHome() + spt + "resource" + spt + QString::fromStdString(strLanguage) + spt + "gui" + spt + "translate" + spt + QString("hmi_%1.qm").arg(QString::fromStdString(strLanguage)); m_pathTypeNameMap[PATH_TYPE_ICONTRANS] = - getSysHome() + spt + CN_DIR_PRODUCT + spt + "common" + spt + "resource" + spt + + getSysHome() + spt + "resource" + spt + QString::fromStdString(strLanguage) + spt + "gui" + spt + "translate" + spt + QString("icon_%1.ts").arg(QString::fromStdString(strLanguage)); m_pathTypeNameMap[PATH_TYPE_PLUGINTRANS] = - getSysHome() + spt + CN_DIR_PRODUCT + spt + "common" + spt + "resource" + spt + + getSysHome() + spt + "resource" + spt + QString::fromStdString(strLanguage) + spt + "gui" + spt + "translate" + spt + QString("plugin_%1.qm").arg(QString::fromStdString(strLanguage)); @@ -68,6 +68,7 @@ void CBase::setProjectHome(const QString &project) m_pathTypeNameMap[PATH_TYPE_ICON] = getProjectHome() + spt + "data" + spt + "icon" + spt; m_pathTypeNameMap[PATH_TYPE_BACKPIXMAP] = getProjectHome() + spt + "data" + spt + "back_pixmap" + spt; m_pathTypeNameMap[PATH_TYPE_SCRIPT] = getProjectHome() + spt + "data" + spt + "script" + spt; + m_pathTypeNameMap[PATH_TYPE_ELF] = getProjectHome() + spt + "data" + spt + "elf" + spt; } QString CBase::truncTag(const QString &tagName, const QString &format) @@ -119,6 +120,10 @@ QString CBase::truncTag(const QString &tagName, const QString &format) { ret = tagName.section('.', 3, count - 1); } + else if (format == "dev") + { + ret = tagName.section('.', 4, 4); + } return ret; } @@ -654,7 +659,7 @@ int CBase::getColorValue(QString rgb255) int CBase::getCoreNameByPathName(const QString graphPathName, QString &graphCoreName) { - QRegExp exp("(pic\\\\|pic/|icon\\\\|icon/)(.*)(glx|ilx)"); + QRegExp exp("(pic\\\\|pic/|icon\\\\|icon/|elf\\\\|elf/)(.*)(glx|ilx|elx)"); int idx1 = exp.indexIn(graphPathName); if(idx1 > 0) { @@ -681,7 +686,7 @@ int CBase::getCoreNameByPathName(const QString graphPathName, QString &graphCore int CBase::getNameByPathName(const QString graphPathName, QString &graphName) { - QRegExp exp("(pic\\\\|pic/|icon\\\\|icon/)(.*)(glx|ilx)"); + QRegExp exp("(pic\\\\|pic/|icon\\\\|icon/|elf\\\\|elf/)(.*)(glx|ilx|elx)"); int idx1 = exp.indexIn(graphPathName); if(idx1 > 0) { @@ -765,11 +770,12 @@ int CBase::getOffColor() return m_offColor; } -void CBase::setScreenInfo(const int num, const QStringList &s, const bool &b) +void CBase::setScreenInfo(const int num, const QStringList &s, const bool &b, const QStringList &no) { m_screenInfo.push_back(num); m_screenInfo.push_back(s); m_screenInfo.push_back(b); + m_screenInfo.push_back(no); } QVariantList CBase::getScreenInfo() diff --git a/platform/src/gui/GraphPub/CCanvasGenerator.cpp b/platform/src/gui/GraphPub/CCanvasGenerator.cpp index c07e5a1c..fedc22cc 100644 --- a/platform/src/gui/GraphPub/CCanvasGenerator.cpp +++ b/platform/src/gui/GraphPub/CCanvasGenerator.cpp @@ -27,7 +27,7 @@ int CCanvasGenerator::publishGraph() publishColorCfgInfo(); - beginIndex(); //发布首页 + beginIndex(); QString strTemp; for(QString &file : allFiles) { @@ -349,17 +349,6 @@ int CCanvasGenerator::appendIndexDiv(CXMLStream &xmls, QDomElement &p, const ifr QDomElement divItem = xmls.AppendChild("div", &p); xmls.PutValue("id", frame.m_class); xmls.PutValue("class", QString("position %1").arg(frame.m_class)); - - //首页增加导航 - if(frame.m_class =="" && frame.m_src =="index.glx") - { - xmls.AppendChild("div", &divItem); - xmls.PutValue("id", QString("breadcrumb")); - xmls.PutValue("class", QString("position")); - xmls.PutValue("style", QString("left:108px;top:4px;width:auto;height:30px;color: rgba(0, 180, 255, 125);line-height: 30px;")); - } - - m_indexStream.AppendText("", &divItem); QString background; @@ -407,7 +396,7 @@ int CCanvasGenerator::appendIndexDiv(CXMLStream &xmls, QDomElement &p, const ifr void CCanvasGenerator::beginIndex(const QString &fileName) { - QDomElement rootItem ; + QDomElement rootItem, headItem; CGStream outfs; outfs.SetMode(CGStream::xmlfile); m_indexStream = outfs.m_XMLStream; @@ -416,19 +405,10 @@ void CCanvasGenerator::beginIndex(const QString &fileName) { strStyleName = "light"; } - QString destPath = CBaseInstance()->getSysHome() + QDir::separator() + QString("web") + QDir::separator() + QString("nginx") + QDir::separator() + QString("html") + QDir::separator() + QString::fromStdString(strStyleName) + QDir::separator() - + QString("page") ; - - QDir target(destPath); - if(!target.exists()) //路径不存在创建路径 "page" - { - QDir().mkdir(target.absolutePath()); - } - - QString destFileNamePath = destPath + QDir::separator() + fileName.section('.', 0, 0) + ".html"; - int ret = m_indexStream.OPEN(destFileNamePath.toLocal8Bit().data(), std::ios::out, 1); + + QString("page") + QDir::separator() + fileName.section('.', 0, 0) + ".html"; + int ret = m_indexStream.OPEN(destPath.toLocal8Bit().data(), std::ios::out, 1); if (ret < 0) { return; @@ -457,7 +437,6 @@ void CCanvasGenerator::beginIndex(const QString &fileName) m_indexStream.AppendChild("style", &m_indexHeadItem); // m_navModelItem = m_indexStream.AppendChild("script", &m_indexHeadItem); // m_indexStream.AppendText(".position{position:absolute;}", &styleItem); - m_indexBodyItem = m_indexStream.AppendChild("body", &rootItem); QString baseStyle = ".position{position:absolute;}button{background:transparent;border:none;color:#eee;outline:none;cursor:pointer;}" @@ -470,7 +449,6 @@ void CCanvasGenerator::beginIndex(const QString &fileName) void CCanvasGenerator::endIndex(const QString &fileName) { Q_UNUSED(fileName) - QDomElement iframeItem = m_indexStream.AppendChild("iframe", &m_indexBodyItem); m_indexStream.PutValue("id", QString("dialog")); m_indexStream.PutValue("class", QString("dn")); @@ -846,6 +824,7 @@ int CCanvasGenerator::publishCanvas(CXMLStream &xmls, QString &fileName) QString plane_name; QString style; QMap > planeMap; + QMap elfMap; QList GroupItemList; xmlBodyItem = xmls.GetChild("body"); xmls.GetValue("style", style); @@ -895,7 +874,7 @@ int CCanvasGenerator::publishCanvas(CXMLStream &xmls, QString &fileName) item->readItem(xmls); planeMap[item->m_plane].push_back(item); } - else if(objType == OBJTYPE_LINE || objType == OBJTYPE_BUS) + else if(objType == OBJTYPE_LINE || objType == OBJTYPE_BUS || objType == OBJTYPE_DYLINKLINE) { item = new CLineItem(objType); item->readItem(xmls); @@ -1008,6 +987,15 @@ int CCanvasGenerator::publishCanvas(CXMLStream &xmls, QString &fileName) planeMap[item->m_plane].append(item->m_subItems); GroupItemList.append(item); } + else if(objType == OBJTYPE_ELF) + { + CElfItem *item = new CElfItem; + item->setPolicyScriptMap(m_policyScriptMap); + item->readItem(xmls); + planeMap[item->m_plane].append(item->m_subItems); + elfMap[item->m_objId] = item; + GroupItemList.append(item); + } else {} @@ -1123,11 +1111,24 @@ int CCanvasGenerator::publishCanvas(CXMLStream &xmls, QString &fileName) } //< 连接线prevs,nexts属性 QMap >::iterator linkIter; + CLinkItem *link; + QMap ::iterator elfIter; for (linkIter = linkMap.begin(); linkIter != linkMap.end(); linkIter++) { QList itemList = linkIter.value(); for(int i = 0; i < itemList.count(); i++) { + link = dynamic_cast(itemList[i]); + elfIter = elfMap.find(link->m_startId); + if(elfIter != elfMap.end()) + { + link->m_startId = dynamic_cast(elfIter.value())->getInstId(link->m_startSubId); + } + elfIter = elfMap.find(link->m_endId); + if(elfIter != elfMap.end()) + { + link->m_endId = dynamic_cast(elfIter.value())->getInstId(link->m_endSubId); + } QJsonObject levelObject; itemList[i]->write(levelObject, linkIter.key()); levelArray.append(levelObject); @@ -1288,6 +1289,7 @@ int CCanvasGenerator::publishIcon(QString &iconName) levelArray.append(levelObject); } } + json["pageConfig"] = iconCfgJson; json["signs"] = levelArray; @@ -1333,8 +1335,7 @@ QStringList CCanvasGenerator::includePrePkg() const QStringList CCanvasGenerator::includePkg() const { QStringList pkgList; - // pkgList << "../../js/jquery-1.11.1.min.js"; - pkgList << "../../js/jquery-3.7.0.min.js"; + pkgList << "../../js/jquery-1.11.1.min.js"; pkgList << "../../js/common.js"; pkgList << "../../js/day.min.js"; pkgList << "../../js/index.js"; diff --git a/platform/src/gui/GraphPub/CCanvasItem.cpp b/platform/src/gui/GraphPub/CCanvasItem.cpp index 732d9628..315f1731 100644 --- a/platform/src/gui/GraphPub/CCanvasItem.cpp +++ b/platform/src/gui/GraphPub/CCanvasItem.cpp @@ -216,6 +216,53 @@ void CCanvasItem::write(CXMLStream &stream, QDomElement p) Q_UNUSED(p) } +void CCanvasItem::copy(CCanvasItem *src) +{ + m_objType = src->m_objType; + m_objType = src->m_objType; + m_objId = src->m_objId; + m_typeStr = src->m_typeStr; + m_nameString = src->m_nameString; + m_script = src->m_script; + m_dyStrategy = src->m_dyStrategy; + m_fillStyleSheet = src->m_fillStyleSheet; + m_visible = src->m_visible; + m_zaxis = src->m_zaxis; + m_lineColor = src->m_lineColor; + m_fillColor = src->m_fillColor; + m_angle = src->m_angle; + m_opacity = src->m_opacity; + m_lineWidth = src->m_lineWidth; + m_lineStyle = src->m_lineStyle; + m_fillMode = src->m_fillMode; + m_levelStart = src->m_levelStart; + m_levelEnd = src->m_levelEnd; + m_plane = src->m_plane; + m_show = src->m_show; + m_startX = src->m_startX; + m_startY = src->m_startY; + m_width = src->m_width; + m_height = src->m_height; + m_boundRect = src->m_boundRect; + m_originPoint = src->m_originPoint; + m_transform = src->m_transform; + m_policyScriptMap = src->m_policyScriptMap; + m_dyTagVec = src->m_dyTagVec; + m_dyTagVec.resize(src->m_dyTagVec.size()); +} + +CCanvasItem *CCanvasItem::clone() +{ + return NULL; +} + +void CCanvasItem::zoom(QPoint base, float wFactor, float hFactor) +{ + Q_UNUSED(base) + Q_UNUSED(wFactor) + Q_UNUSED(hFactor) +} + CRectItem::CRectItem() { m_roundFactor = 0.0; @@ -379,6 +426,31 @@ void CRectItem::write(CXMLStream &stream, QDomElement p) writeStyle(stream); } +void CRectItem::copy(CCanvasItem* src) +{ + CCanvasItem::copy(src); + m_roundFactor = ((CRectItem*)src)->m_roundFactor; + m_hFillDirection = ((CRectItem*)src)->m_hFillDirection; + m_vFillDirection = ((CRectItem*)src)->m_vFillDirection; + m_hFillPercent = ((CRectItem*)src)->m_hFillPercent; + m_vFillPercent = ((CRectItem*)src)->m_vFillPercent; +} + +CCanvasItem *CRectItem::clone() +{ + CRectItem * item = new CRectItem; + item->copy(this); + return item; +} + +void CRectItem::zoom(QPoint base, float wFactor, float hFactor) +{ + m_startX = base.x() + (m_startX - base.x()) * wFactor; + m_startY = base.y() + (m_startY - base.y()) * hFactor; + m_width *= wFactor; + m_height *= hFactor; +} + void CRectItem::write(QJsonObject &json, int plane) { json["layer"] = plane; @@ -462,6 +534,31 @@ int CEllipseItem::writeStyle(QJsonObject &json) return 1; } +void CEllipseItem::copy(CCanvasItem *src) +{ + CCanvasItem::copy(src); + m_roundFactor = ((CEllipseItem*)src)->m_roundFactor; + m_hFillDirection = ((CEllipseItem*)src)->m_hFillDirection; + m_vFillDirection = ((CEllipseItem*)src)->m_vFillDirection; + m_hFillPercent = ((CEllipseItem*)src)->m_hFillPercent; + m_vFillPercent = ((CEllipseItem*)src)->m_vFillPercent; +} + +CCanvasItem *CEllipseItem::clone() +{ + CEllipseItem * item = new CEllipseItem; + item->copy(this); + return item; +} + +void CEllipseItem::zoom(QPoint base, float wFactor, float hFactor) +{ + m_startX = base.x() + (m_startX - base.x()) * wFactor; + m_startY = base.y() + (m_startY - base.y()) * hFactor; + m_width *= wFactor; + m_height *= hFactor; +} + void CEllipseItem::write(QJsonObject &json, int plane) { json["layer"] = plane; @@ -594,6 +691,35 @@ int CLineItem::writeStyle(QJsonObject &json) return 1; } +void CLineItem::copy(CCanvasItem *src) +{ + CCanvasItem::copy(src); + m_startX = ((CLineItem*)src)->m_startX; + m_startY = ((CLineItem*)src)->m_startY; + m_endX = ((CLineItem*)src)->m_endX; + m_endY = ((CLineItem*)src)->m_endY; + m_startArrow = ((CLineItem*)src)->m_startArrow; + m_endArrow = ((CLineItem*)src)->m_endArrow; + m_subType = ((CLineItem*)src)->m_subType; + m_topLeft = ((CLineItem*)src)->m_topLeft; + m_pos = ((CLineItem*)src)->m_pos; +} + +CCanvasItem *CLineItem::clone() +{ + CLineItem * item = new CLineItem; + item->copy(this); + return item; +} + +void CLineItem::zoom(QPoint base, float wFactor, float hFactor) +{ + m_pos.setX(base.x() + (m_pos.x() - base.x()) * wFactor); + m_pos.setY(base.y() + (m_pos.y() - base.y()) * hFactor); + m_endX = (m_endX - m_startX) * wFactor; + m_endY = (m_endY - m_startY) * hFactor; +} + void CLineItem::write(QJsonObject &json, int plane) { json["layer"] = plane; @@ -626,6 +752,10 @@ void CLineItem::write(QJsonObject &json, int plane) json["floatType"] = "carrier"; m_dyTagVec[0] = ""; } + else if(m_subType == OBJTYPE_DYLINKLINE) + { + json["floatType"] = "carrier"; + } writeComm(json); writeStyle(json); @@ -649,6 +779,11 @@ void CJxItem::write(QJsonObject &json, int plane) json["floatType"] = "jx"; } +void CJxItem::zoom(QPoint base, float wFactor, float hFactor) +{ + CLineItem::zoom(base, wFactor, hFactor); +} + CPolygonItem::CPolygonItem() { @@ -735,6 +870,33 @@ int CPolygonItem::writeStyle(QJsonObject &json) return 1; } +void CPolygonItem::copy(CCanvasItem *src) +{ + CCanvasItem::copy(src); + m_points = ((CPolygonItem*)src)->m_points; + m_topLeft = ((CPolygonItem*)src)->m_topLeft; +} + +CCanvasItem *CPolygonItem::clone() +{ + CPolygonItem * item = new CPolygonItem; + item->copy(this); + return item; +} + +void CPolygonItem::zoom(QPoint base, float wFactor, float hFactor) +{ + m_startX = base.x() + (m_startX - base.x()) * wFactor; + m_startY = base.y() + (m_startY - base.y()) * hFactor; + + for(int n=0; nm_points; + m_topLeft = ((CPathItem*)src)->m_topLeft; + m_startArrow = ((CPathItem*)src)->m_startArrow; + m_endArrow = ((CPathItem*)src)->m_endArrow; +} + +CCanvasItem *CPathItem::clone() +{ + CPathItem * item = new CPathItem; + item->copy(this); + return item; +} + +void CPathItem::zoom(QPoint base, float wFactor, float hFactor) +{ + m_startX = base.x() + (m_startX - base.x()) * wFactor; + m_startY = base.y() + (m_startY - base.y()) * hFactor; + + for(int n=0; nm_flowColor; + m_flowType = ((CFlowItem*)src)->m_flowType; +} + +CCanvasItem *CFlowItem::clone() +{ + CFlowItem * item = new CFlowItem; + item->copy(this); + return item; +} + +void CFlowItem::zoom(QPoint base, float wFactor, float hFactor) +{ + CPathItem::zoom(base, wFactor, hFactor); +} + CLinkItem::CLinkItem() : CPathItem() { @@ -999,17 +1214,29 @@ void CLinkItem::readItem(CXMLStream &xmls) QString linkToInfo; xmls.GetValue("from", linkFromInfo); QStringList linkList = linkFromInfo.split(","); - if(linkList.count()) + int count = linkList.count(); + if(count == 2) { m_startId = linkList[0].toInt(); } + else if(count == 4) + { + m_startId = linkList[1].toInt(); + m_startSubId = linkList[2].toInt(); + } xmls.GetValue("to", linkToInfo); linkList = linkToInfo.split(","); - if(linkList.count()) + count = linkList.count(); + if(count == 2 || count == 3) { m_endId = linkList[0].toInt(); } + else if(count == 4 || count == 5) + { + m_endId = linkList[1].toInt(); + m_endSubId = linkList[2].toInt(); + } } void CLinkItem::write(QJsonObject &json, int plane) @@ -1021,6 +1248,27 @@ void CLinkItem::write(QJsonObject &json, int plane) json["nexts"] = QString("%1_%2").arg(idTypeMap[m_endId]).arg(m_endId); } +void CLinkItem::copy(CCanvasItem *src) +{ + CPathItem::copy(src); + m_startId = ((CLinkItem*)src)->m_startId; + m_endId = ((CLinkItem*)src)->m_endId; + m_startSubId = ((CLinkItem*)src)->m_startSubId; + m_endSubId = ((CLinkItem*)src)->m_endSubId; +} + +CCanvasItem *CLinkItem::clone() +{ + CLinkItem * item = new CLinkItem; + item->copy(this); + return item; +} + +void CLinkItem::zoom(QPoint base, float wFactor, float hFactor) +{ + CPathItem::zoom(base, wFactor, hFactor); +} + CPixmapItem::CPixmapItem() { @@ -1082,6 +1330,27 @@ void CPixmapItem::write(CXMLStream &stream, QDomElement p) writeStyle(stream); } +void CPixmapItem::copy(CCanvasItem *src) +{ + CCanvasItem::copy(src); + m_pixmap = ((CPixmapItem*)src)->m_pixmap; +} + +CCanvasItem *CPixmapItem::clone() +{ + CPixmapItem * item = new CPixmapItem; + item->copy(this); + return item; +} + +void CPixmapItem::zoom(QPoint base, float wFactor, float hFactor) +{ + m_startX = base.x() + (m_startX - base.x()) * wFactor; + m_startY = base.y() + (m_startY - base.y()) * hFactor; + m_width *= wFactor; + m_height *= hFactor; +} + CGridItem::CGridItem() @@ -1154,6 +1423,30 @@ void CGridItem::write(CXMLStream &stream, QDomElement p) Q_UNUSED(p) } +void CGridItem::copy(CCanvasItem *src) +{ + CCanvasItem::copy(src); + m_row = ((CGridItem*)src)->m_row; + m_column = ((CGridItem*)src)->m_column; + m_rowWW = ((CGridItem*)src)->m_rowWW; + m_columnHH = ((CGridItem*)src)->m_columnHH; +} + +CCanvasItem *CGridItem::clone() +{ + CGridItem * item = new CGridItem; + item->copy(this); + return item; +} + +void CGridItem::zoom(QPoint base, float wFactor, float hFactor) +{ + m_startX = base.x() + (m_startX - base.x()) * wFactor; + m_startY = base.y() + (m_startY - base.y()) * hFactor; + m_width *= wFactor; + m_height *= hFactor; +} + CStringItem::CStringItem() { m_string = ""; @@ -1347,6 +1640,33 @@ void CStringItem::write(CXMLStream &stream, QDomElement p) writeStyle(stream); } +void CStringItem::copy(CCanvasItem *src) +{ + CCanvasItem::copy(src); + m_string = ((CStringItem*)src)->m_string; + m_fontFamily = ((CStringItem*)src)->m_fontFamily; + m_font = ((CStringItem*)src)->m_font; + m_fontSize = ((CStringItem*)src)->m_fontSize; + m_dotLen = ((CStringItem*)src)->m_dotLen; + m_align = ((CStringItem*)src)->m_align; + m_subType = ((CStringItem*)src)->m_subType; +} + +CCanvasItem *CStringItem::clone() +{ + CStringItem * item = new CStringItem; + item->copy(this); + return item; +} + +void CStringItem::zoom(QPoint base, float wFactor, float hFactor) +{ + m_startX = base.x() + (m_startX - base.x()) * wFactor; + m_startY = base.y() + (m_startY - base.y()) * hFactor; + m_width *= wFactor; + m_height *= hFactor; + m_fontSize = m_fontSize * ( wFactor + hFactor ) / 2.; +} CTimeItem::CTimeItem() { @@ -1394,6 +1714,31 @@ int CTimeItem::writeStyle(QJsonObject &json) return 1; } +void CTimeItem::copy(CCanvasItem *src) +{ + CCanvasItem::copy(src); + m_format = ((CTimeItem*)src)->m_format; + m_fontFamily = ((CTimeItem*)src)->m_fontFamily; + m_font = ((CTimeItem*)src)->m_font; + m_fontSize = ((CTimeItem*)src)->m_fontSize; +} + +CCanvasItem *CTimeItem::clone() +{ + CTimeItem * item = new CTimeItem; + item->copy(this); + return item; +} + +void CTimeItem::zoom(QPoint base, float wFactor, float hFactor) +{ + m_startX = base.x() + (m_startX - base.x()) * wFactor; + m_startY = base.y() + (m_startY - base.y()) * hFactor; + m_width *= wFactor; + m_height *= hFactor; + m_fontSize = m_fontSize * ( wFactor + hFactor ) / 2.; +} + void CTimeItem::write(QJsonObject &json, int plane) { json["layer"] = plane; @@ -1485,6 +1830,27 @@ void CPokeItem::write(QJsonObject &json, int plane) writeStyle(json); } +void CPokeItem::copy(CCanvasItem *src) +{ + CStringItem::copy(src); + m_pokeType = ((CPokeItem*)src)->m_pokeType; + m_planes = ((CPokeItem*)src)->m_planes; + m_text = ((CPokeItem*)src)->m_text; + m_url = ((CPokeItem*)src)->m_url; +} + +CCanvasItem *CPokeItem::clone() +{ + CPokeItem * item = new CPokeItem; + item->copy(this); + return item; +} + +void CPokeItem::zoom(QPoint base, float wFactor, float hFactor) +{ + CStringItem::zoom(base, wFactor, hFactor); +} + CIconItem::CIconItem() { @@ -1557,6 +1923,28 @@ int CIconItem::writeStyle(QJsonObject &json) return 1; } +void CIconItem::copy(CCanvasItem *src) +{ + CCanvasItem::copy(src); + m_iconName = ((CIconItem*)src)->m_iconName; + m_wFactor = ((CIconItem*)src)->m_wFactor; + m_hFactor = ((CIconItem*)src)->m_hFactor; + m_baseWidth = ((CIconItem*)src)->m_baseWidth; + m_baseHeight = ((CIconItem*)src)->m_baseHeight; +} + +CCanvasItem *CIconItem::clone() +{ + CIconItem * item = new CIconItem; + item->copy(this); + return item; +} + +void CIconItem::zoom(QPoint base, float wFactor, float hFactor) +{ + m_startX = base.x() + (m_startX - base.x()) * wFactor; + m_startY = base.y() + (m_startY - base.y()) * hFactor; +} CGroupItem::CGroupItem() : CCanvasItem() { @@ -1611,9 +1999,9 @@ void CGroupItem::readItem(CXMLStream &stream) item = new CPathItem; item->readItem(stream); } - else if(objType == OBJTYPE_LINE) + else if(objType == OBJTYPE_LINE || objType == OBJTYPE_BUS || objType == OBJTYPE_DYLINKLINE) { - item = new CLineItem; + item = new CLineItem(objType); item->readItem(stream); } else if(objType == OBJTYPE_CIRCLE || objType == OBJTYPE_ELLIPSE) @@ -2758,3 +3146,193 @@ void CFlipCurveItem::write(QJsonObject &json, int plane) json["range"] = m_range; json["interval"] = m_range/(m_xmarkNum-1); } + +CElfItem::CElfItem() : CCanvasItem() +{ + m_wFactor = 1.0; + m_hFactor = 1.0; +} + +void CElfItem::getCanvasBoundRect() +{ +} + +void CElfItem::readItem(CXMLStream &stream) +{ + readComm(stream); + + QRectF rect; + stream.GetValue("rect", rect); + stream.GetValue("WFactor", m_wFactor); + stream.GetValue("HFactor", m_hFactor); + stream.GetValue("icon_name", m_iconName); + int replace_nums = 0; + stream.GetValue("replace_nums", replace_nums); + QString replace; + for(int n=0; nreadElficon(m_iconName, m_policyScriptMap)) + { + QList linkItem; + QList items = CPubInstance()->getSubItem(m_iconName); + for(int n = 0; n < items.size(); n++) + { + CCanvasItem * item = items[n]->clone(); + switch (item->m_objType) + { + case OBJTYPE_RECT: + case OBJTYPE_CIRCLE: + case OBJTYPE_ELLIPSE: + case OBJTYPE_PIXMAP: + case OBJTYPE_GRID: + case OBJTYPE_TIME: + case OBJTYPE_POLYGON: + case OBJTYPE_DYPOLYGON: + case OBJTYPE_POLYLINE: + case OBJTYPE_FLOWDASH: + { + item->m_startX += rect.x(); + item->m_startY += rect.y(); + break; + } + case OBJTYPE_ICON + 20: + { + CIconItem * icon = dynamic_cast(item); + icon->m_wFactor = m_wFactor; + icon->m_hFactor = m_hFactor; + icon->m_startX += rect.x(); + icon->m_startY += rect.y(); + break; + } + case OBJTYPE_STRING: + case OBJTYPE_DBDATA: + case OBJTYPE_POKE: + { + CStringItem * text = dynamic_cast(item); + text->m_startX += rect.x(); + text->m_startY += rect.y(); + QMap::iterator iter = m_txtReplaceMap.find(text->m_objId); + if(iter != m_txtReplaceMap.end()) + { + text->m_string = iter.value(); + if(dynamic_cast(item)) + { + dynamic_cast(item)->m_text = iter.value(); + } + } + break; + } + case OBJTYPE_RELATIVE: + { + item->m_startX += rect.x(); + item->m_startY += rect.y(); + linkItem.push_back(item); + break; + } + case OBJTYPE_LINE: + case OBJTYPE_BUS: + case OBJTYPE_FLOWDOT: + case OBJTYPE_DYLINKLINE: + { + CLineItem * line = dynamic_cast(item); + line->m_pos += rect.topLeft().toPoint(); + break; + } + default: + break; + } + item->zoom(rect.topLeft().toPoint(), m_wFactor, m_hFactor); + + m_tempInstMap[item->m_objId] = CPubInstance()->getElfObjId(); + item->m_objId = CPubInstance()->getElfObjId(); + CPubInstance()->increaseElfObjId(); + replaceDynamic(item); + + m_subItems.push_back(item); + } + + for(int n = 0; n < linkItem.size(); n++) + { + CLinkItem * link = dynamic_cast(linkItem[n]); + link->m_startId = getInstId(link->m_startId); + link->m_endId = getInstId(link->m_endId); + } + } +} + +void CElfItem::write(QJsonObject &json, int plane) +{ + CCanvasItem *tmp = NULL; + for(int i = 0; i < m_subItems.count(); i++) + { + tmp = m_subItems[i]; + if(tmp) + { + tmp->write(json, plane); + } + } +} + +int CElfItem::writeStyle(QJsonObject &json) +{ + Q_UNUSED(json) + return 1; +} + +long CElfItem::getInstId(const long &tempId) +{ + QMap::iterator iter = m_tempInstMap.find(tempId); + if(iter == m_tempInstMap.end()) + { + return tempId; + } + return iter.value(); +} + +long CElfItem::getTempId(const long &instId) +{ + QMap::iterator iter = m_tempInstMap.begin(); + for(; iter != m_tempInstMap.end(); ++iter) + { + if(iter.value() == instId) + { + return iter.key(); + } + } + return instId; +} + +void CElfItem::replaceDynamic(CCanvasItem *obj) +{ + QString cTag,pTag; + int group = m_dyTagVec.size(); + for(int n=0; n < group; ++n) + { + pTag = m_dyTagVec[n]; //< "PSCADA.station1.G02" + cTag = obj->m_dyTagVec.value(n); //< "station1.PSCADA.digital.station1.G01_dlq.Pos.value" + if(!cTag.isEmpty()) + { + QStringList cList = cTag.split("."); + QStringList pList = pTag.split("."); + if(cList.size() != 7 || pList.size() != 3) + { + continue; + } + cList[0] = pList[1]; + cList[1] = pList[0]; + cList[3] = pList[1]; + cList[4] = QString(cList[4]).replace(QString(cList[4]).section("_", 0, 0), pList[2]); + obj->m_dyTagVec[n] = cList.join("."); + } + } +} diff --git a/platform/src/gui/GraphPub/CCanvasItem.h b/platform/src/gui/GraphPub/CCanvasItem.h index c40c9649..ac0d48ae 100644 --- a/platform/src/gui/GraphPub/CCanvasItem.h +++ b/platform/src/gui/GraphPub/CCanvasItem.h @@ -77,6 +77,9 @@ public: virtual void write(QJsonObject &json, int plane) = 0; virtual int writeStyle(CXMLStream &stream); virtual void write(CXMLStream &stream, QDomElement p); + virtual void copy(CCanvasItem* src); + virtual CCanvasItem * clone(); + virtual void zoom(QPoint base, float wFactor, float hFactor); public: unsigned char m_objType; int m_objId; @@ -128,6 +131,9 @@ public: virtual int writeStyle(QJsonObject &json); int writeStyle(CXMLStream &stream); void write(CXMLStream &stream, QDomElement p); + virtual void copy(CCanvasItem* src); + virtual CCanvasItem * clone(); + virtual void zoom(QPoint base, float wFactor, float hFactor); public: qreal m_roundFactor; int m_hFillPercent; @@ -145,6 +151,9 @@ public: virtual void readItem(CXMLStream &stream); void write(QJsonObject &json, int plane); virtual int writeStyle(QJsonObject &json); + virtual void copy(CCanvasItem* src); + virtual CCanvasItem * clone(); + virtual void zoom(QPoint base, float wFactor, float hFactor); public: int m_roundFactor; int m_hFillPercent; @@ -163,6 +172,9 @@ public: virtual void readItem(CXMLStream &stream); void write(QJsonObject &json, int plane); virtual int writeStyle(QJsonObject &json); + virtual void copy(CCanvasItem* src); + virtual CCanvasItem * clone(); + virtual void zoom(QPoint base, float wFactor, float hFactor); public: int m_startX; int m_startY; @@ -182,6 +194,7 @@ public: ~CJxItem(); virtual void readItem(CXMLStream &stream); void write(QJsonObject &json, int plane); + virtual void zoom(QPoint base, float wFactor, float hFactor); }; class CPolygonItem : public CCanvasItem @@ -193,6 +206,9 @@ public: virtual void readItem(CXMLStream &stream); void write(QJsonObject &json, int plane); virtual int writeStyle(QJsonObject &json); + virtual void copy(CCanvasItem* src); + virtual CCanvasItem * clone(); + virtual void zoom(QPoint base, float wFactor, float hFactor); public: QList m_points; QPoint m_topLeft; @@ -204,6 +220,7 @@ public: CDyPolygonItem(); ~CDyPolygonItem(); void write(QJsonObject &json, int plane); + virtual void zoom(QPoint base, float wFactor, float hFactor); }; class CPathItem : public CCanvasItem @@ -215,6 +232,9 @@ public: virtual void readItem(CXMLStream &stream); void write(QJsonObject &json, int plane); virtual int writeStyle(QJsonObject &json); + virtual void copy(CCanvasItem* src); + virtual CCanvasItem * clone(); + virtual void zoom(QPoint base, float wFactor, float hFactor); public: QList m_points; QPoint m_topLeft; @@ -230,6 +250,9 @@ public: ~CFlowItem(); virtual void readItem(CXMLStream &stream); void write(QJsonObject &json, int plane); + virtual void copy(CCanvasItem* src); + virtual CCanvasItem * clone(); + virtual void zoom(QPoint base, float wFactor, float hFactor); public: long m_flowColor; int m_flowType; @@ -242,9 +265,14 @@ public: ~CLinkItem(); virtual void readItem(CXMLStream &stream); void write(QJsonObject &json, int plane); + virtual void copy(CCanvasItem* src); + virtual CCanvasItem * clone(); + virtual void zoom(QPoint base, float wFactor, float hFactor); public: int m_startId; int m_endId; + int m_startSubId; + int m_endSubId; }; class CPixmapItem : public CCanvasItem @@ -258,6 +286,9 @@ public: virtual int writeStyle(QJsonObject &json); virtual int writeStyle(CXMLStream &stream); virtual void write(CXMLStream &stream, QDomElement p); + virtual void copy(CCanvasItem* src); + virtual CCanvasItem * clone(); + virtual void zoom(QPoint base, float wFactor, float hFactor); public: QString m_pixmap; }; @@ -273,6 +304,9 @@ public: virtual int writeStyle(QJsonObject &json); virtual int writeStyle(CXMLStream &stream); virtual void write(CXMLStream &stream, QDomElement p); + virtual void copy(CCanvasItem* src); + virtual CCanvasItem * clone(); + virtual void zoom(QPoint base, float wFactor, float hFactor); public: int m_row; int m_column; @@ -292,6 +326,9 @@ public: virtual int writeStyle(QJsonObject &json); int writeStyle(CXMLStream &stream); void write(CXMLStream &stream, QDomElement p); + virtual void copy(CCanvasItem* src); + virtual CCanvasItem * clone(); + virtual void zoom(QPoint base, float wFactor, float hFactor); public: QString m_string; QString m_fontFamily; @@ -311,7 +348,9 @@ public: virtual void readItem(CXMLStream &stream); void write(QJsonObject &json, int plane); virtual int writeStyle(QJsonObject &json); - + virtual void copy(CCanvasItem* src); + virtual CCanvasItem * clone(); + virtual void zoom(QPoint base, float wFactor, float hFactor); public: QString m_format; QString m_fontFamily; @@ -327,6 +366,9 @@ public: ~CPokeItem(); virtual void readItem(CXMLStream &stream); virtual void write(QJsonObject &json, int plane); + virtual void copy(CCanvasItem* src); + virtual CCanvasItem * clone(); + virtual void zoom(QPoint base, float wFactor, float hFactor); public: short m_pokeType; QString m_planes; @@ -345,6 +387,9 @@ public: virtual void readItem(CXMLStream &stream); void write(QJsonObject &json, int plane); virtual int writeStyle(QJsonObject &json); + virtual void copy(CCanvasItem* src); + virtual CCanvasItem * clone(); + virtual void zoom(QPoint base, float wFactor, float hFactor); public: QString m_iconName; float m_wFactor; @@ -366,6 +411,30 @@ public: QList m_subItems; }; +class CElfItem : public CCanvasItem +{ +public: + CElfItem(); + ~CElfItem(); + void getCanvasBoundRect(); + virtual void readItem(CXMLStream &stream); + void write(QJsonObject &json, int plane); + virtual int writeStyle(QJsonObject &json); + long getInstId(const long &tempId); + long getTempId(const long &instId); + +private: + void replaceDynamic(CCanvasItem *obj); + +public: + QList m_subItems; + QString m_iconName; + float m_wFactor; + float m_hFactor; + QMap m_tempInstMap; //< 模板obj_id - 实例obj_id + QMap m_txtReplaceMap; //< 模板obj_id - 文本 +}; + class CLabelItem : public CCanvasItem { public: diff --git a/platform/src/gui/GraphPub/CCanvasPub.cpp b/platform/src/gui/GraphPub/CCanvasPub.cpp index 0fe3456a..151efec3 100644 --- a/platform/src/gui/GraphPub/CCanvasPub.cpp +++ b/platform/src/gui/GraphPub/CCanvasPub.cpp @@ -1,4 +1,7 @@ #include "CCanvasPub.h" +#include "CCanvasItem.h" +#include "../include/CBase.h" +#include "../include/CStream.h" CCanvasPub *CPubInstance() { @@ -8,7 +11,17 @@ CCanvasPub *CPubInstance() CCanvasPub::CCanvasPub() { + m_elfObjId = 10000; +} +CCanvasPub::~CCanvasPub() +{ + QMap>::iterator it = m_elfMap.begin(); + for(; it != m_elfMap.end(); it++) + { + qDeleteAll(it.value()); + } + m_elfMap.clear(); } void CCanvasPub::addIdType(const int &k, const QString &v) @@ -25,3 +38,152 @@ QMap CCanvasPub::getIdType() const { return m_idTypeMap; } + +long CCanvasPub::getElfObjId() +{ + return m_elfObjId; +} + +void CCanvasPub::increaseElfObjId() +{ + m_elfObjId++; +} + +int CCanvasPub::readElficon(const QString &icon_name, QMap &policyScriptMap) +{ + if(m_elfMap.find(icon_name) != m_elfMap.end()) + { + return 1; + } + int ret = 0; + QString path = CBaseInstance()->getSysHome() + QDir::separator() + QString("data") + QDir::separator() + + QString("elf") + QDir::separator() + icon_name + ".elx"; + + QDomElement xmlRootItem, xmlHeadItem, xmlBodyItem, xmlCurItem; + CGStream iofs; + iofs.SetMode(CGStream::xmlfile); + CXMLStream &xmls = iofs.m_XMLStream; + ret = xmls.OPEN(path.toLocal8Bit().data(), std::ios::in, 1); + if(ret < 0) + { + qDebug() << path << " cannot open"; + return ret; + } + + int objType, count; + int graphType, width, height, levelNum, planeNum; + xmlRootItem = xmls.GetChild("graph"); + xmlHeadItem = xmls.GetChild("head"); + xmls.GetValue("icon_type", graphType); + xmls.GetValue("icon_h", height); + xmls.GetValue("icon_w", width); + xmls.GetValue("state_num", levelNum); + xmls.GetValue("plane_num", planeNum); + xmls.GetValue("obj_count", count); + + xmlBodyItem = xmls.GetChild("body"); + xmlCurItem = xmls.GetChild("item", &xmlBodyItem); + + CCanvasItem *item = NULL; + for(int j = 0; j < count; j++) + { + xmls.GetValue("obj_type", objType); + if(objType == OBJTYPE_RECT) + { + item = new CRectItem; + item->readItem(xmls); + } + else if(objType == OBJTYPE_POLYGON) + { + item = new CPolygonItem; + item->readItem(xmls); + } + else if(objType == OBJTYPE_DYPOLYGON) + { + item = new CDyPolygonItem; + item->readItem(xmls); + } + else if(objType == OBJTYPE_POLYLINE) + { + item = new CPathItem; + item->readItem(xmls); + } + else if(objType == OBJTYPE_TIME) + { + item = new CTimeItem(); + item->readItem(xmls); + } + else if(objType == OBJTYPE_GRID) + { + item = new CGridItem; + item->readItem(xmls); + } + else if(objType == OBJTYPE_LINE || objType == OBJTYPE_BUS || objType == OBJTYPE_DYLINKLINE) + { + item = new CLineItem(objType); + item->readItem(xmls); + } + else if(objType == OBJTYPE_CIRCLE || objType == OBJTYPE_ELLIPSE) + { + item = new CEllipseItem; + item->readItem(xmls); + } + else if(objType == OBJTYPE_STRING || objType == OBJTYPE_DBDATA) + { + item = new CStringItem(objType); + item->setPolicyScriptMap(policyScriptMap); + item->readItem(xmls); + } + else if(objType == OBJTYPE_POKE) + { + item = new CPokeItem; + item->readItem(xmls); + } + else if(objType == OBJTYPE_PIXMAP) + { + item = new CPixmapItem; + item->readItem(xmls); + } + else if(objType == OBJTYPE_ICON + 20) + { + item = new CIconItem; + item->setPolicyScriptMap(policyScriptMap); + item->readItem(xmls); + } + else if(objType == OBJTYPE_RELATIVE) + { + item = new CLinkItem; + item->readItem(xmls); + } + else if(objType == OBJTYPE_FLOWDOT) + { + item = new CJxItem; + item->readItem(xmls); + } + else if(objType == OBJTYPE_FLOWDASH) + { + item = new CFlowItem; + item->readItem(xmls); + } + else + {} + + m_elfMap[icon_name].push_back(item); + item = NULL; + xmls.m_CurElem = xmlCurItem; + xmlCurItem = xmls.GetNextSibling(); + } + + xmls.CLOSE(); + return 1; +} + +QList CCanvasPub::getSubItem(const QString &icon_name) +{ + QMap>::const_iterator iter = m_elfMap.find(icon_name); + if(iter != m_elfMap.end()) + { + return iter.value(); + } + return QList(); +} diff --git a/platform/src/gui/GraphPub/CCanvasPub.h b/platform/src/gui/GraphPub/CCanvasPub.h index 6f3bc7ac..2df5c297 100644 --- a/platform/src/gui/GraphPub/CCanvasPub.h +++ b/platform/src/gui/GraphPub/CCanvasPub.h @@ -3,17 +3,26 @@ #include +class CCanvasItem; class CCanvasPub { public: CCanvasPub(); + ~CCanvasPub(); void addIdType(const int &k, const QString &v); void setIdType(QMap &map); QMap getIdType() const; + long getElfObjId(); + void increaseElfObjId(); + + int readElficon(const QString &icon_name, QMap &policyScriptMap); + QList getSubItem(const QString &icon_name); + private: QMap m_idTypeMap; - + QMap> m_elfMap; + long m_elfObjId; }; CCanvasPub *CPubInstance(); diff --git a/platform/src/gui/GraphPub/CStream.cpp b/platform/src/gui/GraphPub/CStream.cpp index a2975f58..9330350d 100644 --- a/platform/src/gui/GraphPub/CStream.cpp +++ b/platform/src/gui/GraphPub/CStream.cpp @@ -636,7 +636,7 @@ CGStream &CGStream::operator<<(long double q) CGStream &CGStream::operator<<(const char *p) { - unsigned int len = strlen(p) + 1; + unsigned int len = static_cast(strlen(p) + 1); *this << len; if (len > MAX_STRING_RW_LEN) @@ -650,7 +650,7 @@ CGStream &CGStream::operator<<(const char *p) CGStream &CGStream::operator<<(const string &p) { - unsigned int len = p.length(); + unsigned int len = static_cast(p.length()); *this << len; if (len > MAX_STRING_RW_LEN) @@ -822,7 +822,7 @@ void CGStream::FlushBuffer(char *&buffer) bool CGStream::GetPointer(const std :: vector &filebuffer) { char *temp = NULL; - m_nDataStreamLen = filebuffer.size(); + m_nDataStreamLen = static_cast(filebuffer.size()); try { temp = new char[m_nDataStreamLen]; @@ -1087,8 +1087,7 @@ bool CGStream::UpdateBuffer(long double p) bool CGStream::UpdateBuffer(char *p) { - int len; - len = strlen(p); + int len = static_cast(strlen(p)); return SwapData(p, len); } diff --git a/platform/src/gui/GraphShape/BasicShape/CAnimationManage.cpp b/platform/src/gui/GraphShape/BasicShape/CAnimationManage.cpp index edca42ef..0da908f3 100644 --- a/platform/src/gui/GraphShape/BasicShape/CAnimationManage.cpp +++ b/platform/src/gui/GraphShape/BasicShape/CAnimationManage.cpp @@ -71,6 +71,32 @@ void CAnimationManage::updateValue(const QList &values) } } +void CAnimationManage::resetTag(const QString& oldTagName,const QString& tagName) +{ + if (Q_NULLPTR != m_animationScale) + { + if (m_animationScale->tagName().compare(oldTagName)==0) + { + m_animationScale->setTagName(tagName); + } + } + if (Q_NULLPTR != m_animationPosition) + { + if (m_animationPosition->tagName().compare(oldTagName) == 0) + { + m_animationPosition->setTagName(tagName); + } + } + if (Q_NULLPTR != m_animationRotation) + { + if (m_animationRotation->tagName().compare(oldTagName) == 0) + { + m_animationRotation->setTagName(tagName); + } + } + +} + CAnimationScale * CAnimationManage::scaleAnimation() { return m_animationScale; diff --git a/platform/src/gui/GraphShape/BasicShape/CDataShape.cpp b/platform/src/gui/GraphShape/BasicShape/CDataShape.cpp index 111192d6..9b9fbe31 100644 --- a/platform/src/gui/GraphShape/BasicShape/CDataShape.cpp +++ b/platform/src/gui/GraphShape/BasicShape/CDataShape.cpp @@ -23,6 +23,7 @@ void CDataShape::initCommColor() setString(""); setFillStyleSheet("brushIndex:1;Color[0,170,0];back_pixmap:;Gradient"); m_font = QFont("宋体", 10); + m_nInitPointSize = 10; QString info = "2,16711680,3,1,43520,0"; QStringList strlist = info.split(','); if(strlist.size() == 6) @@ -57,7 +58,16 @@ int CDataShape::copy(CShape *src, char flag) return -1; } CDataShape *tmp = (CDataShape *)src; - + m_font = tmp->m_font; + m_option = tmp->m_option; + m_showDataType = tmp->m_showDataType; + m_showDotLen = tmp->m_showDotLen; + m_nInitPointSize = tmp->m_nInitPointSize; + m_fontDirection = tmp->m_fontDirection; + m_shandowStyle = tmp->m_shandowStyle; + m_borderColor = tmp->m_borderColor; + m_borderDepth = tmp->m_borderDepth; + setString(tmp->getString()); copyComm(src); return 0; } @@ -227,6 +237,11 @@ void CDataShape::setPropertyValue(const QString &name, QVariant value) void CDataShape::getPropertyList(std::list< std::pair > &propertyList) { + if(parentObj() && parentObj()->getObjType() == OBJTYPE_ELF) + { + propertyList.push_back(std::pair(QObject::tr("文本内容"), QVariant(m_string))); + return; + } QColor fontcolor(getLineColor()); QString fillstyle = getFillStyleSheet(); QBrush brush = CBaseInstance()->setBrush(fillstyle); diff --git a/platform/src/gui/GraphShape/BasicShape/CDrawObjFactory.cpp b/platform/src/gui/GraphShape/BasicShape/CDrawObjFactory.cpp index c3953300..9901add4 100644 --- a/platform/src/gui/GraphShape/BasicShape/CDrawObjFactory.cpp +++ b/platform/src/gui/GraphShape/BasicShape/CDrawObjFactory.cpp @@ -22,6 +22,8 @@ #include "CDyPolygon.h" #include "CElfShape.h" #include "CTimeShape.h" +#include "CNewElfShape.h" +#include "CDyLinkLine.h" #include "./ChartShape/CChartShape.h" #include "CDrawObjFactory.h" @@ -119,6 +121,9 @@ int CDrawObjFactory::createDrawObj(char type, CShape **ppobj, QString typeN) case OBJTYPE_RELATIVE: *ppobj = new CLinkLine(); break; + case OBJTYPE_DYLINKLINE: + *ppobj = new CDyLinkLine(type); + break; case OBJTYPE_PIEGRAPH: *ppobj = new CChartShape(type); break; @@ -131,6 +136,9 @@ int CDrawObjFactory::createDrawObj(char type, CShape **ppobj, QString typeN) case OBJTYPE_RTLINEGRAPH: *ppobj = new CChartShape(type); break; + case OBJTYPE_ELF: + *ppobj = new CNewElfShape(type); + break; default: if (type == OBJTYPE_ICON + 20) { diff --git a/platform/src/gui/GraphShape/BasicShape/CGroupShape.cpp b/platform/src/gui/GraphShape/BasicShape/CGroupShape.cpp index 33752bda..3912958d 100644 --- a/platform/src/gui/GraphShape/BasicShape/CGroupShape.cpp +++ b/platform/src/gui/GraphShape/BasicShape/CGroupShape.cpp @@ -392,7 +392,7 @@ void CGroupShape::shift(const QPointF &op) void CGroupShape::reverse(CShape *src) { - if(!src || src->getObjType() != OBJTYPE_MERGE) return; + if(!src) return; QPointF offset = src->m_prePos - m_prePos; qDebug() << "CGroupShape reverse:" << src->pos() << pos() << offset; diff --git a/platform/src/gui/GraphShape/BasicShape/CIconShape.cpp b/platform/src/gui/GraphShape/BasicShape/CIconShape.cpp index a1d8560e..f6a96f3f 100644 --- a/platform/src/gui/GraphShape/BasicShape/CIconShape.cpp +++ b/platform/src/gui/GraphShape/BasicShape/CIconShape.cpp @@ -10,6 +10,8 @@ CIconShape::CIconShape(char type, QGraphicsItem *parent): CRectShape(type, paren m_iconType = 0; m_pIconInfo = NULL; m_zoomMaxLevel = 7; + m_hInitFactor = 1.0; + m_wInitFactor = 1.0; m_startX = 0.0; m_startY = 0.0; m_width = 0; @@ -51,6 +53,8 @@ int CIconShape::getIconStateNum() bool CIconShape::setShowStyle(int group, int value, bool animate) { + Q_UNUSED(animate); + if (group >= 0 && group < 2) { m_showStyle[group] = value; @@ -176,7 +180,7 @@ void CIconShape::setWFactor(float value) { if(value < 0.1) { - value = 0.1; + value = 0.1f; } m_wTempFactor = getWFactor(); QTransform trans = transform(); @@ -188,7 +192,7 @@ void CIconShape::setHFactor(float value) { if(value < 0.1) { - value = 0.1; + value = 0.1f; } m_hTempFactor = getHFactor(); QTransform trans = transform(); @@ -324,7 +328,7 @@ void CIconShape::draw(QPainter *p, CDySetColor *dycolor) if(objDrawCount == 0) { int envType = getScene()->getEnvTypeFlag(); - if(envType == AppMode::DesignerMode) + if(envType == AppMode::DesignerMode || envType == AppMode::ElfMode) { QPen pen(Qt::gray); pen.setStyle(Qt::DotLine); @@ -370,6 +374,8 @@ void CIconShape::copyComm(CShape *src) m_pIconInfo = Q_NULLPTR; setIconInfo(m_iconType, m_name); + m_wInitFactor = ((CIconShape*)src)->m_wInitFactor; + m_hInitFactor = ((CIconShape*)src)->m_hInitFactor; } void CIconShape::reverse(CShape *src) @@ -407,16 +413,14 @@ int CIconShape::read(CGStream &bifs, char flag) //m_startX = pos.x(); //m_startY = pos.y(); - float wFactor = 1.; - float hFactor = 1.; - xmls.GetValue("WFactor", wFactor); - xmls.GetValue("HFactor", hFactor); + xmls.GetValue("WFactor", m_wInitFactor); + xmls.GetValue("HFactor", m_hInitFactor); setIconInfo(30, m_name); - CShapeAdaptor::get().adaptorIcon(pos, wFactor, hFactor, this); + CShapeAdaptor::get().adaptorIcon(pos, m_wInitFactor, m_hInitFactor, this); setPos(pos.x(), pos.y()); - setWFactor(wFactor); - setHFactor(hFactor); + setWFactor(m_wInitFactor); + setHFactor(m_hInitFactor); } else { @@ -648,6 +652,34 @@ void CIconShape::updateGeometry(qreal x, qreal y, qreal dx, qreal dy) setHFactor(dy / m_height); } +void CIconShape::zoomWidth(float factor) +{ + CShape * parent = parentObj(); + if(parent) + { + float scale = factor / m_wFactor; + m_wFactor = factor; + setWFactor(factor * m_wInitFactor); + + QPointF tmp = (pos() - parent->pos()) * scale; + setPos(parent->pos().x() + tmp.x(), pos().y()); + } +} + +void CIconShape::zoomHeight(float factor) +{ + CShape * parent = parentObj(); + if(parent) + { + float scale = factor / m_hFactor; + m_hFactor = factor; + setHFactor(factor * m_hInitFactor); + + QPointF tmp = (pos() - parent->pos()) * scale; + setPos(pos().x(), parent->pos().y() + tmp.y()); + } +} + QPoint CIconShape::getRotateCenter() { return QPoint(m_startX, m_startY); @@ -808,7 +840,7 @@ void CIconShape::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWid draw(painter, getDySetColor()); - if(getScene() && getScene()->getEnvTypeFlag() == AppMode::DesignerMode) + if(getScene() && (getScene()->getEnvTypeFlag() == AppMode::DesignerMode || getScene()->getEnvTypeFlag() == AppMode::ElfMode)) { drawPin(painter); } diff --git a/platform/src/gui/GraphShape/BasicShape/CLineShape.cpp b/platform/src/gui/GraphShape/BasicShape/CLineShape.cpp index 7d43ba91..5f7dc804 100644 --- a/platform/src/gui/GraphShape/BasicShape/CLineShape.cpp +++ b/platform/src/gui/GraphShape/BasicShape/CLineShape.cpp @@ -383,6 +383,34 @@ void CLineShape::updateGeometry(qreal x, qreal y, qreal dx, qreal dy) } +void CLineShape::zoomWidth(float factor) +{ + CShape * parent = parentObj(); + if(parent) + { + float scale = factor / m_wFactor; + m_wFactor = factor; + setStartX(getStartX() * scale); + setEndX(getEndX() * scale); + QPointF tmp = (pos() - parent->pos()) * scale; + setPos(parent->pos().x() + tmp.x(), pos().y()); + } +} + +void CLineShape::zoomHeight(float factor) +{ + CShape * parent = parentObj(); + if(parent) + { + float scale = factor / m_hFactor; + m_hFactor = factor; + setStartY(getStartY() * scale); + setEndY(getEndY() * scale); + QPointF tmp = (pos() - parent->pos()) * scale; + setPos(pos().x(), parent->pos().y() + tmp.y()); + } +} + void CLineShape::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) { painter->setRenderHint(QPainter::Antialiasing, true); diff --git a/platform/src/gui/GraphShape/BasicShape/CPathShape.cpp b/platform/src/gui/GraphShape/BasicShape/CPathShape.cpp index 9c81f52b..473d72d1 100644 --- a/platform/src/gui/GraphShape/BasicShape/CPathShape.cpp +++ b/platform/src/gui/GraphShape/BasicShape/CPathShape.cpp @@ -779,6 +779,40 @@ int CPathShape::write(CGStream &stream, char flag) return 1; } +void CPathShape::zoomWidth(float factor) +{ + CShape * parent = parentObj(); + if(parent) + { + float scale = factor / m_wFactor; + m_wFactor = factor; + for(int n = 0; n < m_points.size(); ++n) + { + QPointF &p = m_points[n]; + p.setX(p.x() * scale); + } + QPointF tmp = (pos() - parent->pos()) * scale; + setPos(parent->pos().x() + tmp.x(), pos().y()); + } +} + +void CPathShape::zoomHeight(float factor) +{ + CShape * parent = parentObj(); + if(parent) + { + float scale = factor / m_hFactor; + m_hFactor = factor; + for(int n = 0; n < m_points.size(); ++n) + { + QPointF &p = m_points[n]; + p.setY(p.y() * scale); + } + QPointF tmp = (pos() - parent->pos()) * scale; + setPos(pos().x(), parent->pos().y() + tmp.y()); + } +} + int CPathShape::read(CGStream &stream, char flag) { Q_UNUSED(flag) diff --git a/platform/src/gui/GraphShape/BasicShape/CPokeShape.cpp b/platform/src/gui/GraphShape/BasicShape/CPokeShape.cpp index 228ebdc0..5fff421f 100644 --- a/platform/src/gui/GraphShape/BasicShape/CPokeShape.cpp +++ b/platform/src/gui/GraphShape/BasicShape/CPokeShape.cpp @@ -129,6 +129,28 @@ int CPokeShape::write(CGStream &stream, char flag) return count; } +CShape *CPokeShape::clone(char flag) +{ + CPokeShape *pObj = new CPokeShape(m_objType, NULL); + pObj->copy((CShape *)this, flag); + return pObj; +} + +int CPokeShape::copy(CShape *src, char flag) +{ + Q_UNUSED(flag) + if (src == NULL) + { + return -1; + } + CTextShape::copy(src, flag); + m_style = ((CPokeShape *)src)->m_style; + m_planes = ((CPokeShape *)src)->m_planes; + m_fileName = ((CPokeShape *)src)->m_fileName; + + return 1; +} + void CPokeShape::setPropertyValue(const QString &name, QVariant value) { CTextShape::setPropertyValue(name, value); @@ -174,6 +196,11 @@ void CPokeShape::setPropertyValue(const QString &name, QVariant value) void CPokeShape::getPropertyList(std::list< std::pair > &propertyList) { + if(parentObj() && parentObj()->getObjType() == OBJTYPE_ELF) + { + propertyList.push_back(std::pair(QObject::tr("文本内容"), QVariant(m_string))); + return; + } QColor fontcolor(getLineColor()); QString fillstyle = getFillStyleSheet(); QBrush brush = CBaseInstance()->setBrush(fillstyle); diff --git a/platform/src/gui/GraphShape/BasicShape/CPolygonShape.cpp b/platform/src/gui/GraphShape/BasicShape/CPolygonShape.cpp index d17e458f..f7757307 100644 --- a/platform/src/gui/GraphShape/BasicShape/CPolygonShape.cpp +++ b/platform/src/gui/GraphShape/BasicShape/CPolygonShape.cpp @@ -668,3 +668,37 @@ int CPolygonShape::read(CGStream &stream, char flag) return 1; } + +void CPolygonShape::zoomWidth(float factor) +{ + CShape * parent = parentObj(); + if(parent) + { + float scale = factor / m_wFactor; + m_wFactor = factor; + for(int n = 0; n < m_points.size(); ++n) + { + QPointF &p = m_points[n]; + p.setX(p.x() * scale); + } + QPointF tmp = (pos() - parent->pos()) * scale; + setPos(parent->pos().x() + tmp.x(), pos().y()); + } +} + +void CPolygonShape::zoomHeight(float factor) +{ + CShape * parent = parentObj(); + if(parent) + { + float scale = factor / m_hFactor; + m_hFactor = factor; + for(int n = 0; n < m_points.size(); ++n) + { + QPointF &p = m_points[n]; + p.setY(p.y() * scale); + } + QPointF tmp = (pos() - parent->pos()) * scale; + setPos(pos().x(), parent->pos().y() + tmp.y()); + } +} diff --git a/platform/src/gui/GraphShape/BasicShape/CRectShape.cpp b/platform/src/gui/GraphShape/BasicShape/CRectShape.cpp index 9e074d0d..2fc65ed5 100644 --- a/platform/src/gui/GraphShape/BasicShape/CRectShape.cpp +++ b/platform/src/gui/GraphShape/BasicShape/CRectShape.cpp @@ -831,3 +831,31 @@ QRect CRectShape::getVisualBox() rt.translate(pt); return rt; } + +void CRectShape::zoomWidth(float factor) +{ + CShape * parent = parentObj(); + if(parent) + { + float scale = factor / m_wFactor; + m_wFactor = factor; + setWidth( getWidth() * scale ); + + QPointF tmp = (pos() - parent->pos()) * scale; + setPos(parent->pos().x() + tmp.x(), pos().y()); + } +} + +void CRectShape::zoomHeight(float factor) +{ + CShape * parent = parentObj(); + if(parent) + { + float scale = factor / m_hFactor; + m_hFactor = factor; + setHeight( getHeight() * scale ); + + QPointF tmp = (pos() - parent->pos()) * scale; + setPos(pos().x(), parent->pos().y() + tmp.y()); + } +} diff --git a/platform/src/gui/GraphShape/BasicShape/CShape.cpp b/platform/src/gui/GraphShape/BasicShape/CShape.cpp index e7e3bd5c..e02c1cd7 100644 --- a/platform/src/gui/GraphShape/BasicShape/CShape.cpp +++ b/platform/src/gui/GraphShape/BasicShape/CShape.cpp @@ -39,6 +39,8 @@ CShape::CShape(QGraphicsItem *parent) m_parent = NULL; m_animationManage = Q_NULLPTR; m_isRotateCenter = false; + m_wFactor = 1.0; + m_hFactor = 1.0; getDySetColor()->initial(getLineStyle(), getFillMode(), getLineColor(), getFillColor(), getLineWidth(), getRotateAngle()); @@ -81,7 +83,7 @@ QString CShape::getDyStrategy() const bool CShape::getDynamicPtrInfo(int &group, int &num) { - group = m_dynamicVec.size(); + group = static_cast(m_dynamicVec.size()); num = 1; return true; } @@ -752,7 +754,7 @@ int CShape::writeComm(CGStream &stream) stream << m_script.toStdString(); stream << m_dyStrategy.toStdString(); stream << m_visible; - short dyNum = m_dynamicVec.size(); + short dyNum = static_cast(m_dynamicVec.size()); stream << dyNum; stream << leveld.toStdString(); @@ -821,7 +823,7 @@ int CShape::writeComm(CXMLStream &xmls) xmls.PutValue("show_only", m_visible); //动态属性部分 - int dyNum = m_dynamicVec.size(); + int dyNum = static_cast(m_dynamicVec.size()); xmls.PutValue("dy_nums", dyNum); char pname[40]; QString tag; @@ -872,7 +874,7 @@ int CShape::readComm(CGStream &stream) } try { - char lineStyle; + char lineStyle = Qt::SolidLine; char fillMode = 0; int lineColor = 0; int fillColor = 0; @@ -1023,7 +1025,7 @@ int CShape::readAnimation(CGStream &stream) int CShape::readComm(CXMLStream &xmls) { - char lineStyle; + char lineStyle = Qt::SolidLine; char fillMode = 0; QString fillStyle; int lineColor = 0; @@ -1307,7 +1309,7 @@ void CShape::setDynamic(std::vector &keyInfos, bool isTag, bool update) { Q_UNUSED(update) int i = 0; - int size = keyInfos.size(); + int size = static_cast(keyInfos.size()); if (size > 0) { @@ -1323,7 +1325,12 @@ void CShape::setDynamic(std::vector &keyInfos, bool isTag, bool update) { if (isTag) { + QString oldStr = m_dynamicVec[i].getTagName(); m_dynamicVec[i].setTagName(keyInfos[i]); + if (Q_NULLPTR != m_animationManage) + { + m_animationManage->resetTag(oldStr,keyInfos[i]); + } } else { @@ -1335,7 +1342,7 @@ QStringList CShape::getDynamic(bool isTag) { QStringList ret; QString str; - int size = m_dynamicVec.size(); + int size = static_cast(m_dynamicVec.size()); for (int i = 0; i < size; i++) { if (isTag) @@ -1420,6 +1427,16 @@ void CShape::updateGeometry(qreal x, qreal y, qreal dx, qreal dy) Q_UNUSED(dy) } +void CShape::zoomWidth(float factor) +{ + Q_UNUSED(factor) +} + +void CShape::zoomHeight(float factor) +{ + Q_UNUSED(factor) +} + void CShape::updateAnimationValue(QList &values) { if (Q_NULLPTR != m_animationManage) @@ -1438,8 +1455,24 @@ QVariant CShape::itemChange(GraphicsItemChange change, const QVariant &value) break; case ItemPositionChange: { - QPoint pt = value.toPointF().toPoint(); - return pt; + QPointF pt = value.toPointF(); + if(getScene() && getScene()->getEnvTypeFlag() == AppMode::ElfMode) + { + QRect vRect = getVisualBox(); + QRectF rect = getScene()->sceneRect(); + pt.setX(qMin(rect.right(), qMax(pt.x(), rect.left()))); + pt.setY(qMin(rect.bottom(), qMax(pt.y(), rect.top()))); + if(vRect.left() + vRect.width() > rect.right()){ + rect.setWidth(rect.width() + getVisualBox().width()); + } + if(vRect.top() + vRect.height() > rect.bottom()){ + rect.setHeight(rect.height() + getVisualBox().height()); + } + getScene()->getCurGraphHead()->setGraphRect(rect.toRect()); + getScene()->setSceneRect(rect); + return pt; + } + return pt.toPoint(); } default: break; @@ -1478,7 +1511,7 @@ void CShape::hoverEnterEvent(QGraphicsSceneHoverEvent *e) { m_hoverFlag = 1; QString tipMsg; - if(getScene() && getScene()->getEnvTypeFlag() == AppMode::DesignerMode) + if(getScene() && (getScene()->getEnvTypeFlag() == AppMode::DesignerMode || getScene()->getEnvTypeFlag() == AppMode::ElfMode)) { if(!IsDynamicLinked()) { diff --git a/platform/src/gui/GraphShape/BasicShape/CTextShape.cpp b/platform/src/gui/GraphShape/BasicShape/CTextShape.cpp index 45d8365b..f842d889 100644 --- a/platform/src/gui/GraphShape/BasicShape/CTextShape.cpp +++ b/platform/src/gui/GraphShape/BasicShape/CTextShape.cpp @@ -1,11 +1,13 @@ #include "CTextShape.h" #include "CShapeAdaptor.h" +#include "CNewElfShape.h" #include CTextShape::CTextShape(char type, QGraphicsItem *parent): CRectShape(type, parent) { m_charWidth = 0; m_font = QFont("宋体", 20); + m_nInitPointSize = 20; m_string = "****"; m_fontDirection = HorDir; m_fillColor = 617188; @@ -24,6 +26,11 @@ CTextShape::CTextShape(char type, QGraphicsItem *parent): CRectShape(type, paren setAcceptHoverEvents(true); } +CTextShape::~CTextShape() +{ + +} + int CTextShape::copy(CShape *src, char flag) { Q_UNUSED(flag) @@ -37,8 +44,11 @@ int CTextShape::copy(CShape *src, char flag) m_option = tmp->m_option; m_font = tmp->m_font; + m_nInitPointSize = tmp->m_nInitPointSize; m_fontDirection = tmp->m_fontDirection; m_shandowStyle = tmp->m_shandowStyle; + m_borderColor = tmp->m_borderColor; + m_borderDepth = tmp->m_borderDepth; setString(tmp->getString()); return 0; @@ -57,11 +67,15 @@ void CTextShape::setFontDirection(int value) updateVerDirFontWidth(); } -void CTextShape::setString(const QString &text) +void CTextShape::setString(const QString &text, bool isDesign) { m_string = text; updateVerDirFontWidth(); update(); + if(isDesign) + { + updateToParent(); + } } void CTextShape::replace(const QString &before, const QString &after, Qt::CaseSensitivity cs) @@ -69,6 +83,7 @@ void CTextShape::replace(const QString &before, const QString &after, Qt::CaseSe m_string.replace(before, after, cs); updateVerDirFontWidth(); update(); + updateToParent(); } char CTextShape::getFontDirection() const @@ -284,7 +299,7 @@ void CTextShape::setPropertyValue(const QString &name, QVariant value) if (name == "Text" || name == QObject::tr("文本内容")) { QString str = value.toString(); - setString(str); + setString(str, true); } else if (name == QObject::tr("字体颜色")) { @@ -365,6 +380,7 @@ void CTextShape::setPropertyValue(const QString &name, QVariant value) else if (name == QObject::tr("字体")) { m_font = value.value(); + m_nInitPointSize = m_font.pointSize(); } else if (name == QObject::tr("轴Z坐标")) { @@ -405,6 +421,11 @@ void CTextShape::setPropertyValue(const QString &name, QVariant value) void CTextShape::getPropertyList(std::list< std::pair > &propertyList) { + if(parentObj() && parentObj()->getObjType() == OBJTYPE_ELF) + { + propertyList.push_back(std::pair(QObject::tr("文本内容"), QVariant(m_string))); + return; + } QColor fontcolor(getLineColor()); QString fillstyle = getFillStyleSheet(); QBrush brush = CBaseInstance()->setBrush(fillstyle); @@ -515,6 +536,7 @@ int CTextShape::read(CGStream &stream, char flag) m_font.fromString(font); CShapeAdaptor::get().adaptorText(rect, m_font, this); + m_nInitPointSize = m_font.pointSize(); setPos(rect.x(), rect.y()); setWidth(rect.width()); setHeight(rect.height()); @@ -545,6 +567,7 @@ int CTextShape::read(CGStream &stream, char flag) tmp = ""; stream >> tmp; m_font.fromString(QString::fromStdString(tmp)); + m_nInitPointSize = m_font.pointSize(); setPos(posx, posy); setFontDirection(m_fontDirection); @@ -558,6 +581,26 @@ int CTextShape::read(CGStream &stream, char flag) return 1; } +void CTextShape::updateToParent() +{ + if(parentObj() && parentObj()->getObjType() == OBJTYPE_ELF) + { + dynamic_cast(parentObj())->addReplaceTxt(getObjId(), m_string); + } +} + +void CTextShape::zoomWidth(float factor) +{ + CRectShape::zoomWidth(factor); + m_font.setPointSize(m_nInitPointSize * ( m_wFactor + m_hFactor ) / 2.); +} + +void CTextShape::zoomHeight(float factor) +{ + CRectShape::zoomHeight(factor); + m_font.setPointSize(m_nInitPointSize * ( m_wFactor + m_hFactor ) / 2.); +} + void CTextShape::hoverMoveEvent(QGraphicsSceneHoverEvent *e) { CRectShape::hoverMoveEvent(e); diff --git a/platform/src/gui/GraphShape/BasicShape/CWidgetShape.cpp b/platform/src/gui/GraphShape/BasicShape/CWidgetShape.cpp index 674f8c2a..3055aa70 100644 --- a/platform/src/gui/GraphShape/BasicShape/CWidgetShape.cpp +++ b/platform/src/gui/GraphShape/BasicShape/CWidgetShape.cpp @@ -1,6 +1,7 @@ #include "CWidgetShape.h" #include "CShapeAdaptor.h" #include "../hmi/CGraphScene.h" +#include "pub_logger_api/logger.h" CWidgetShape::CWidgetShape(char type, QString typeN, QGraphicsItem *parentItem, QWidget *parent): CRectShape(type, parentItem) { @@ -142,7 +143,7 @@ QWidget *CWidgetShape::createCustomWidget(const QString &name) } char envType = getScene()->getEnvTypeFlag(); bool editMode = false; - if (envType == AppMode::DesignerMode) + if (envType == AppMode::DesignerMode || envType == AppMode::ElfMode) { editMode = true; } @@ -151,6 +152,7 @@ QWidget *CWidgetShape::createCustomWidget(const QString &name) fileName = name; fileName += ".dll"; #else + if (name.contains(QRegExp("^lib"))) { fileName = name; @@ -181,6 +183,8 @@ QWidget *CWidgetShape::createCustomWidget(const QString &name) } else { + QString lastErro = loader.errorString(); + LOGERROR("插件加载错误,插件名:%s,错误信息:%s",fileName.toStdString().c_str(),lastErro.toStdString().c_str()); } } @@ -188,7 +192,7 @@ QWidget *CWidgetShape::createCustomWidget(const QString &name) { customWidget = new CPushButton("未找到插件", m_pParent); } - if (envType == AppMode::DesignerMode) + if (envType == AppMode::DesignerMode || envType == AppMode::ElfMode) { customWidget->setEnabled(false); } diff --git a/platform/src/gui/GraphShape/ChartShape/CBarChart.cpp b/platform/src/gui/GraphShape/ChartShape/CBarChart.cpp index f3026fb2..ada8017a 100644 --- a/platform/src/gui/GraphShape/ChartShape/CBarChart.cpp +++ b/platform/src/gui/GraphShape/ChartShape/CBarChart.cpp @@ -63,7 +63,7 @@ void CBarChart::mousePressEvent(QGraphicsSceneMouseEvent *event) void CBarChart::slot_barSetPressed(int nIndex, QBarSet *barSet) { Q_UNUSED(nIndex) - if(AppMode::DesignerMode == property("EnvTypeFlag").toInt()) + if(AppMode::DesignerMode == property("EnvTypeFlag").toInt() || AppMode::ElfMode == property("EnvTypeFlag").toInt()) { foreach (QBarSet * set, m_series->barSets()) { @@ -473,4 +473,111 @@ void CBarChart::updateValues(const QList values) } } +void CBarChart::updateValues(const QList &values, const QList &status) +{ + int maxValue = 0; + int minValue = 0; + if (m_series->count() > 0 && m_series->barSets()[0]->count() > 0 && values.count() > 0) + { + int nIndex = 0; + for (int nBarIndex(0); nBarIndex < m_series->barSets()[0]->count(); nBarIndex++) + { + for (int nBarSetsIndex(0); nBarSetsIndex < m_series->count() && nIndex < values.count(); nBarSetsIndex++) + { + if (!checkStatusValid(status[nIndex])) + { + m_series->barSets()[nBarSetsIndex]->replace(nBarIndex, 0); + continue; + } + + if (values.at(nIndex) > axisYMax()) + { + if (axisYMax() > 0) + { + setAxisYMax(values.at(nIndex) * 1.2); + } + else + { + setAxisYMax(values.at(nIndex) * 0.8); + } + } + if (values.at(nIndex) < axisYMin()) + { + if (axisYMin() > 0) + { + setAxisYMin(values.at(nIndex) * 0.8); + } + else + { + setAxisYMin(values.at(nIndex) * 1.2); + } + } + + float value = values[nIndex++]; + if (nIndex == 0) + { + maxValue = value; + minValue = value; + } + if (value > maxValue) + { + maxValue = value; + } + if (value < minValue) + { + minValue = value; + } + + m_series->barSets()[nBarSetsIndex]->replace(nBarIndex, value); + + } + } + + if (maxValue == minValue) + { + return; + } + + if (maxValue > 0) + { + if (maxValue * 1.2 < axisYMax()) + { + setAxisYMax(maxValue * 1.2); + } + } + else + { + if (maxValue * 0.8 < axisYMax()) + { + setAxisYMax(maxValue * 0.8); + } + } + + + if (minValue > 0) + { + if (minValue * 0.8 > axisYMin()) + { + setAxisYMin(minValue * 0.8); + } + } + else + { + if (minValue * 1.2 > axisYMin()) + { + setAxisYMin(minValue * 1.2); + } + } + } +} + +bool CBarChart::checkStatusValid(int status) +{ + if ((status & 4) == 4) + { + return false; + } + return true; +} + diff --git a/platform/src/gui/GraphShape/ChartShape/CBarChart.h b/platform/src/gui/GraphShape/ChartShape/CBarChart.h index 7a1984ab..fe6a9cba 100644 --- a/platform/src/gui/GraphShape/ChartShape/CBarChart.h +++ b/platform/src/gui/GraphShape/ChartShape/CBarChart.h @@ -101,6 +101,8 @@ public: void updateIndexValue(const int &nIndex, const float &value); void updateIndexValue(const int &barSetsIndex, const int &barIndex, const float &value); void updateValues(const QList values); + void updateValues(const QList &values, const QList &status); + bool checkStatusValid(int status); protected: void initialize(); diff --git a/platform/src/gui/GraphShape/ChartShape/CChartShape.cpp b/platform/src/gui/GraphShape/ChartShape/CChartShape.cpp index 9d16fce9..52be9f5b 100644 --- a/platform/src/gui/GraphShape/ChartShape/CChartShape.cpp +++ b/platform/src/gui/GraphShape/ChartShape/CChartShape.cpp @@ -405,7 +405,7 @@ void CChartShape::setAllDatas(const QList &values, const QList &stat CBarChart * chart = (CBarChart*)m_pChart; if(chart) { - chart->updateValues(values); + chart->updateValues(values, status); } } else if(OBJTYPE_LINEGRAPH == m_objType) @@ -2375,9 +2375,20 @@ int CChartShape::write(CGStream &stream, char flag) return 1; } +void CChartShape::repleaceTag(const std::vector& keyInfo) +{ + QList::iterator iter = m_listTagInfo.begin(); + for (int index = 0; iter!=m_listTagInfo.end() && index < keyInfo.size(); ++iter,++index) + { + TagSrcInfo& srcInfo = *iter; + srcInfo.tag_name = keyInfo.at(index); + } +} + void CChartShape::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) { - if(AppMode::DesignerMode == getScene()->getEnvTypeFlag()) + unsigned char envType = getScene()->getEnvTypeFlag(); + if(AppMode::DesignerMode == envType || AppMode::ElfMode == envType) { updateChartGeometry(); painter->setRenderHint(QPainter::Antialiasing, true); @@ -2393,12 +2404,13 @@ QVariant CChartShape::itemChange(GraphicsItemChange change, const QVariant &valu { if(scene()) { - m_pChart->setProperty("EnvTypeFlag", getScene()->getEnvTypeFlag()); - if(AppMode::DesignerMode == getScene()->getEnvTypeFlag()) + unsigned char envType = getScene()->getEnvTypeFlag(); + m_pChart->setProperty("EnvTypeFlag", envType); + if(AppMode::DesignerMode == envType || AppMode::ElfMode == envType) { connect(scene(), SIGNAL(selectionChanged()), this,SLOT(onSceneSelectionChanged())); } - if(AppMode::ExplorerMode == getScene()->getEnvTypeFlag()) + if(AppMode::ExplorerMode == envType) { if(CPieChart::PieType == m_pChart->type()) @@ -2659,3 +2671,15 @@ void CChartShape::updateChartValues(const ListTagValue values) m_pDataQueryThread = Q_NULLPTR; LOGINFO("inflush finished"); } + +void CChartShape::replaceDataSetTagInfo(QString oldKey, QString newKey) +{ + if(m_objType == OBJTYPE_RTLINEGRAPH) + { + for(int nIndex=0; nIndex < m_listTagInfo.size(); ++nIndex) + { + m_listTagInfo[nIndex].tag_name.replace(oldKey,newKey); + } + emit queryChartData(m_listTagInfo); + } +} diff --git a/platform/src/gui/GraphShape/ChartShape/CChartShape.h b/platform/src/gui/GraphShape/ChartShape/CChartShape.h index 760ce206..64aeaa82 100644 --- a/platform/src/gui/GraphShape/ChartShape/CChartShape.h +++ b/platform/src/gui/GraphShape/ChartShape/CChartShape.h @@ -38,10 +38,13 @@ public: void updateDynamicByTags(); void updateDynamicByInst(); + //caodingfa:新增替换实时曲线图中数据源中的测点中变量 + void replaceDataSetTagInfo(QString oldKey, QString newKey); float indexData(const int &index); void setIndexData(const int &index, const float &value); void setAllDatas(const QList &values, const QList &status); + void setObjVisible(bool visible); @@ -55,6 +58,7 @@ public: int read(CGStream &stream, char flag); int write(CGStream &stream, char flag); + void repleaceTag(const std::vector& keyInfo); signals: void queryChartData(const QList &listTag); @@ -62,6 +66,8 @@ protected: void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *); QVariant itemChange(GraphicsItemChange change, const QVariant &value); +public slots: + void initDataSrcInfo(); private: QString getSrcTagDesc(const int &nIndex); @@ -70,8 +76,6 @@ private: private slots: void updateFocus(); void onSceneSelectionChanged(); - - void initDataSrcInfo(); void updateChartValues(const ListTagValue values); private: EnConnectMode m_connectMode; diff --git a/platform/src/gui/GraphShape/ChartShape/CLineChart.cpp b/platform/src/gui/GraphShape/ChartShape/CLineChart.cpp index 077c7b23..b3a1e451 100644 --- a/platform/src/gui/GraphShape/ChartShape/CLineChart.cpp +++ b/platform/src/gui/GraphShape/ChartShape/CLineChart.cpp @@ -308,7 +308,7 @@ void CLineChart::generateRandomValue() void CLineChart::seriesPressed() { - if(AppMode::DesignerMode == property("EnvTypeFlag").toInt()) + if(AppMode::DesignerMode == property("EnvTypeFlag").toInt() || AppMode::ElfMode == property("EnvTypeFlag").toInt()) { clearSelectionSeries(); CLineSeries * lineSeries = dynamic_cast(sender()); diff --git a/platform/src/gui/GraphShape/ChartShape/CPieChart.cpp b/platform/src/gui/GraphShape/ChartShape/CPieChart.cpp index 0a6d0914..fc17e31a 100644 --- a/platform/src/gui/GraphShape/ChartShape/CPieChart.cpp +++ b/platform/src/gui/GraphShape/ChartShape/CPieChart.cpp @@ -267,7 +267,7 @@ void CPieChart::setSliceTipsFont(const QFont &font) void CPieChart::slot_seriesPressed(QPieSlice *slice) { - if(AppMode::DesignerMode == property("EnvTypeFlag").toInt()) + if(AppMode::DesignerMode == property("EnvTypeFlag").toInt() || AppMode::ElfMode == property("EnvTypeFlag").toInt()) { if(dynamic_cast(slice)) { diff --git a/platform/src/gui/GraphShape/ChartShape/CRTLineChart.cpp b/platform/src/gui/GraphShape/ChartShape/CRTLineChart.cpp index 314ddb58..e7d54c1d 100644 --- a/platform/src/gui/GraphShape/ChartShape/CRTLineChart.cpp +++ b/platform/src/gui/GraphShape/ChartShape/CRTLineChart.cpp @@ -29,7 +29,13 @@ CRTLineChart::CRTLineChart(QGraphicsItem *parent, Qt::WindowFlags wFlags) CRTLineChart::~CRTLineChart() { - + //不确定是否会自动清理,保险起见手动清理一下 + QList listSeries = series(); + foreach (QAbstractSeries * series, listSeries) + { + QLineSeries * lineSeries = dynamic_cast(series); + lineSeries->clear(); + } } int CRTLineChart::type() const @@ -83,6 +89,7 @@ void CRTLineChart::setLineCount(const int &nCount) series->setProperty("LINE_TYPE", "LINE"); series->setPenWidth(seriesWidth()); connect(series, &CLineSeries::pressed, this, &CRTLineChart::seriesPressed); + connect(series, &QLineSeries::clicked, this, &CRTLineChart::showPoint); addSeries(series); series->attachAxis(m_axisX); series->attachAxis(m_axisY); @@ -543,8 +550,16 @@ void CRTLineChart::generateRandomValue() lineSeries->clear(); for(int nMarkIndex(0); nMarkIndex < m_axisXMarkCount; nMarkIndex++) { - lineSeries->append(m_axisX->max().toMSecsSinceEpoch() - (nMarkIndex * m_axisX->min().secsTo(m_axisX->max()) / (m_axisXMarkCount - 1) * 1000), - (qrand() % (m_axisYMax - m_axisYMin) + m_axisYMin)); + if (m_axisXMarkCount == 1) + { + lineSeries->append(0, + (qrand() % (m_axisYMax - m_axisYMin) + m_axisYMin)); + } + else + { + lineSeries->append(m_axisX->max().toMSecsSinceEpoch() - (nMarkIndex * m_axisX->min().secsTo(m_axisX->max()) / (m_axisXMarkCount - 1) * 1000), + (qrand() % (m_axisYMax - m_axisYMin) + m_axisYMin)); + } } } } @@ -552,7 +567,7 @@ void CRTLineChart::generateRandomValue() void CRTLineChart::seriesPressed() { - if(AppMode::DesignerMode == property("EnvTypeFlag").toInt()) + if(AppMode::DesignerMode == property("EnvTypeFlag").toInt() || AppMode::ElfMode == property("EnvTypeFlag").toInt()) { clearSelectionSeries(); CLineSeries * lineSeries = dynamic_cast(sender()); @@ -564,6 +579,24 @@ void CRTLineChart::seriesPressed() } } +void CRTLineChart::showPoint(const QPointF &point) +{ + if (true) { + QLineSeries *series = qobject_cast(sender()); + if(series) + { + QDateTime dateTime = QDateTime::fromMSecsSinceEpoch(point.x()); + QString formattedTime = dateTime.toString("yyyy-MM-dd hh:mm:ss"); + QString info = QString("name:%1 \ntime:%2 \nval:%3").arg(series->name()).arg(formattedTime).arg(point.y()); + QToolTip::showText(QCursor::pos(), info,nullptr,QRect(),8000); + } + + } else { + + QToolTip::hideText(); + } +} + CLineSeries *CRTLineChart::currentSeries() { foreach (QAbstractSeries * series, series()) @@ -601,10 +634,6 @@ void CRTLineChart::start() QObject::connect(m_pTimer, &QTimer::timeout, this, &CRTLineChart::handleTimeElapsed); int msec = m_refreshInterval * 1000; - if(!m_bRollEnable) - { - msec = m_refreshInterval * 20000; - } m_pTimer->setInterval(msec); } @@ -629,6 +658,23 @@ void CRTLineChart::clearValues() } } +void CRTLineChart::clearValuesExcludeLastValue() +{ + QList listSeries = series(); + foreach (QAbstractSeries * series, listSeries) + { + QLineSeries * lineSeries = dynamic_cast(series); + if(lineSeries) + { + int nCount = lineSeries->count(); + if(nCount > 1) + { + lineSeries->removePoints(0,nCount - 1); + } + } + } +} + void CRTLineChart::resetGuidesSeries() { QList colorList; @@ -801,6 +847,11 @@ void CRTLineChart::updateValues(const QList &values, const QList &st QLineSeries * lineSeries = dynamic_cast(listSeries.at(nSeriesIndex)); if(lineSeries) { + if (!checkStatusValid(status[nSeriesIndex])) + { + continue; + } + if(lineSeries->property("STATIC_LINE").toBool()) { continue; @@ -820,6 +871,15 @@ void CRTLineChart::updateValues(const QList &values, const QList &st m_isUpdated = false; } +bool CRTLineChart::checkStatusValid(int status) +{ + if ((status & 4) == 4) + { + return false; + } + return true; +} + void CRTLineChart::handleTimeElapsed() { if(m_bRollEnable) @@ -828,7 +888,8 @@ void CRTLineChart::handleTimeElapsed() foreach (QAbstractSeries * series, listSeries) { QLineSeries * lineSeries = dynamic_cast(series); - if(lineSeries->count() && !lineSeries->property("STATIC_LINE").toBool()) + int pntCount = lineSeries->count(); + if(pntCount && !lineSeries->property("STATIC_LINE").toBool()) { //< replace last index // lineSeries->replace(lineSeries->count() - 1, @@ -839,9 +900,24 @@ void CRTLineChart::handleTimeElapsed() { lineSeries->append(QDateTime::currentDateTime().toMSecsSinceEpoch(), lineSeries->pointsVector().last().y()); } - if(lineSeries->at(0).x() < m_axisX->min().toMSecsSinceEpoch()) + + int removeIndex = 0; //为了提升性能,每100个作为一组删除 + int stepSize = 100; + while(removeIndex + stepSize < pntCount) { - lineSeries->remove(0); + if(lineSeries->at(removeIndex + stepSize).x() < m_axisX->min().toMSecsSinceEpoch()) + { + removeIndex += stepSize; + } + else + { + break; + } + } + + if(removeIndex > 0) + { + lineSeries->removePoints(0,removeIndex); } } } @@ -851,10 +927,10 @@ void CRTLineChart::handleTimeElapsed() else { QDate date = QDate::currentDate(); - if(m_initDate < date) + if(m_initDate != date) { LOGINFO("next day"); - clearValues(); + clearValuesExcludeLastValue(); //保留最后一个测点,防止数据不变化时,第2天无法绘制曲线 m_initDate = date; if(WORK_MODE_DAY == m_workMode) { @@ -862,6 +938,19 @@ void CRTLineChart::handleTimeElapsed() m_axisX->setMax(QDateTime(QDate::currentDate().addDays(1))); } } + + QList listSeries = series(); + foreach (QAbstractSeries * series, listSeries) + { + QLineSeries * lineSeries = dynamic_cast(series); + if(lineSeries->count() && !lineSeries->property("STATIC_LINE").toBool()) + { + if(!m_isUpdated) + { + lineSeries->append(QDateTime::currentDateTime().toMSecsSinceEpoch(), lineSeries->pointsVector().last().y()); + } + } + } } setGuides(); } diff --git a/platform/src/gui/GraphShape/ChartShape/CRTLineChart.h b/platform/src/gui/GraphShape/ChartShape/CRTLineChart.h index 5dcc734f..49847a87 100644 --- a/platform/src/gui/GraphShape/ChartShape/CRTLineChart.h +++ b/platform/src/gui/GraphShape/ChartShape/CRTLineChart.h @@ -116,6 +116,9 @@ public: void start(); void clearValues(); + //清除数据并保留最后一个值 + void clearValuesExcludeLastValue(); + void resetGuidesSeries(); void updateIndexValue(const int &nIndex, const float &value); void updateIndexValue(const int &nIndex, const QDateTime &dateTime, const float &value); @@ -123,13 +126,13 @@ public: void updateValues(const QList &values); void updateValues(const QList &values, const QList &status); + bool checkStatusValid(int status); signals: void lineChartSelect(); protected: void initialize(); void mousePressEvent(QGraphicsSceneMouseEvent *event); - void clearSelectionSeries(); void generateRandomValue(); void handleTimeElapsed(); @@ -137,6 +140,7 @@ protected: protected slots: void seriesPressed(); + void showPoint(const QPointF &point); private: int m_axisYMin; diff --git a/platform/src/gui/GraphShape/DynamicShape/CDyLineShape.cpp b/platform/src/gui/GraphShape/DynamicShape/CDyLineShape.cpp index fd09438e..a34d102e 100644 --- a/platform/src/gui/GraphShape/DynamicShape/CDyLineShape.cpp +++ b/platform/src/gui/GraphShape/DynamicShape/CDyLineShape.cpp @@ -18,22 +18,6 @@ CDyLineShape::CDyLineShape(char type, QGraphicsItem *parent) : CLineShape(parent m_nodeNoVec << 0; } -int CDyLineShape::copy(CShape *src, char flag) -{ - Q_UNUSED(flag) - if (src == NULL) - { - return -1; - } - - copyComm(src); - - m_endX = ((CDyLineShape*)src)->m_endX; - m_endY = ((CDyLineShape*)src)->m_endY; - - return 0; -} - CShape *CDyLineShape::clone(char flag) { CDyLineShape *pObj = new CDyLineShape(m_objType, NULL); @@ -156,7 +140,7 @@ void CDyLineShape::hoverMoveEvent(QGraphicsSceneHoverEvent *e) CLineShape::hoverMoveEvent(e); QPointF hoverPoint = e->pos(); - qDebug() << "m_selPin:" << m_selPin; + //qDebug() << "m_selPin:" << m_selPin; // if (m_selPin > -1) // { diff --git a/platform/src/gui/GraphShape/DynamicShape/CFlowLine.cpp b/platform/src/gui/GraphShape/DynamicShape/CFlowLine.cpp index d30afe47..52e61449 100644 --- a/platform/src/gui/GraphShape/DynamicShape/CFlowLine.cpp +++ b/platform/src/gui/GraphShape/DynamicShape/CFlowLine.cpp @@ -76,7 +76,7 @@ void CFlowLine::draw(QPainter *p, CDySetColor *dycolor) if (dycolor->m_flowDirection == 0) { unsigned char envFlag = getScene()->getEnvTypeFlag(); - if(envFlag == AppMode::DesignerMode) + if(envFlag == AppMode::DesignerMode || envFlag == AppMode::ElfMode) { flowState = dycolor->getFlowingState() % 4; for (int i = 0; i < m_points.size() - 1; i++) diff --git a/platform/src/gui/GraphShape/DynamicShape/CLinkLine.cpp b/platform/src/gui/GraphShape/DynamicShape/CLinkLine.cpp index d7360fa4..c052fdfa 100644 --- a/platform/src/gui/GraphShape/DynamicShape/CLinkLine.cpp +++ b/platform/src/gui/GraphShape/DynamicShape/CLinkLine.cpp @@ -1,5 +1,6 @@ #include #include "CLinkLine.h" +#include "CNewElfShape.h" #include "../include/CShape.h" #include "../hmi/CGraphScene.h" @@ -41,6 +42,18 @@ int CLinkLine::copy(CShape *src, char flag) return 1; } +CShape *CLinkLine::clone(char flag) +{ + CLinkLine *pObj = new CLinkLine(); + pObj->copy((CShape *)this, flag); + pObj->m_leftDevId = this->m_leftDevId; + pObj->m_rightDevId = this->m_rightDevId; + pObj->m_leftDevPin = this->m_leftDevPin; + pObj->m_rightDevPin = this->m_rightDevPin; + pObj->m_percentList = this->m_percentList; + return (CShape *)pObj; +} + void CLinkLine::reverse(CShape *src) { if(src == NULL) @@ -173,22 +186,51 @@ int CLinkLine::write(CGStream &stream, char flag) QString endLinkInfo; QString pinPercentInfo; QString pinSegInfo; + QString objName; if(m_leftDev) { - startLinkInfo = QString("%1,%2").arg(m_leftDev->getObjId()).arg(m_leftDevPin); + if(m_leftDev->parentObj() && m_leftDev->parentObj()->getObjType() == OBJTYPE_ELF) + { + m_leftDev->parentObj()->getObjName(objName); + startLinkInfo = QString("%1,%2,%3,%4").arg(objName).arg(m_leftDev->parentObj()->getObjId()) + .arg(dynamic_cast(m_leftDev->parentObj())->getTempObjId(m_leftDev->getObjId())).arg(m_leftDevPin); + } + else + { + startLinkInfo = QString("%1,%2").arg(m_leftDev->getObjId()).arg(m_leftDevPin); + } } if(m_rightDev) { - if(m_rightDev->getObjType() == OBJTYPE_RELATIVE) + if(m_rightDev->parentObj() && m_rightDev->parentObj()->getObjType() == OBJTYPE_ELF) { - qreal percent = dynamic_cast(m_rightDev)->getPercent(m_rightDevPin); - endLinkInfo = QString("%1,%2,%3").arg(m_rightDev->getObjId()).arg(m_rightDevPin).arg(percent); - qDebug() << "endLinkInfo:" << endLinkInfo; + m_rightDev->parentObj()->getObjName(objName); + if(m_rightDev->getObjType() == OBJTYPE_RELATIVE) + { + qreal percent = dynamic_cast(m_rightDev)->getPercent(m_rightDevPin); + endLinkInfo = QString("%1,%2,%3,%4,%5").arg(objName).arg(m_rightDev->parentObj()->getObjId()) + .arg(dynamic_cast(m_rightDev->parentObj())->getTempObjId(m_rightDev->getObjId())).arg(m_rightDevPin).arg(percent); + qDebug() << "endLinkInfo:" << endLinkInfo; + } + else + { + endLinkInfo = QString("%1,%2,%3,%4").arg(objName).arg(m_rightDev->parentObj()->getObjId()) + .arg(dynamic_cast(m_rightDev->parentObj())->getTempObjId(m_rightDev->getObjId())).arg(m_rightDevPin); + } } else { - endLinkInfo = QString("%1,%2").arg(m_rightDev->getObjId()).arg(m_rightDevPin); + if(m_rightDev->getObjType() == OBJTYPE_RELATIVE) + { + qreal percent = dynamic_cast(m_rightDev)->getPercent(m_rightDevPin); + endLinkInfo = QString("%1,%2,%3").arg(m_rightDev->getObjId()).arg(m_rightDevPin).arg(percent); + qDebug() << "endLinkInfo:" << endLinkInfo; + } + else + { + endLinkInfo = QString("%1,%2").arg(m_rightDev->getObjId()).arg(m_rightDevPin); + } } } @@ -237,6 +279,12 @@ int CLinkLine::read(CGStream &stream, char flag) m_leftDevId = linkList[0].toInt(); m_leftDevPin = linkList[1].toDouble(); } + else if(linkList.count() == 4) + { + m_leftDevId = linkList[1].toInt(); + m_leftSubDevId = linkList[2].toInt(); + m_leftDevPin = linkList[3].toDouble(); + } QString linkToInfo; xmls.GetValue("to", linkToInfo); @@ -255,6 +303,21 @@ int CLinkLine::read(CGStream &stream, char flag) m_preRightDevPin = m_rightDevPin; //qDebug() << "read m_perecnt:" << m_perecnt; } + else if(linkList.count() == 4) + { + m_rightDevId = linkList[1].toInt(); + m_rightSubDevId = linkList[2].toInt(); + m_rightDevPin = linkList[3].toDouble(); + m_preRightDevPin = m_rightDevPin; + } + else if(linkList.count() == 5) + { + m_rightDevId = linkList[1].toInt(); + m_rightSubDevId = linkList[2].toInt(); + m_rightDevPin = linkList[3].toDouble(); + m_perecnt = linkList[4].toDouble(); + m_preRightDevPin = m_rightDevPin; + } else {} @@ -307,6 +370,12 @@ int CLinkLine::read(CGStream &stream, char flag) m_leftDevId = linkList[0].toInt(); m_leftDevPin = linkList[1].toDouble(); } + else if(linkList.count() == 4) + { + m_leftDevId = linkList[1].toInt(); + m_leftSubDevId = linkList[2].toInt(); + m_leftDevPin = linkList[3].toDouble(); + } linkList = linkToInfo.split(","); if(linkList.count() == 2) @@ -322,6 +391,21 @@ int CLinkLine::read(CGStream &stream, char flag) m_perecnt = linkList[2].toDouble(); m_preRightDevPin = m_rightDevPin; } + else if(linkList.count() == 4) + { + m_rightDevId = linkList[1].toInt(); + m_rightSubDevId = linkList[2].toInt(); + m_rightDevPin = linkList[3].toDouble(); + m_preRightDevPin = m_rightDevPin; + } + else if(linkList.count() == 5) + { + m_rightDevId = linkList[1].toInt(); + m_rightSubDevId = linkList[2].toInt(); + m_rightDevPin = linkList[3].toDouble(); + m_perecnt = linkList[4].toDouble(); + m_preRightDevPin = m_rightDevPin; + } else {} @@ -419,6 +503,16 @@ long CLinkLine::getEndDevId() return m_rightDevId; } +void CLinkLine::setStartDevId(long id) +{ + m_leftDevId = id; +} + +void CLinkLine::setEndDevId(long id) +{ + m_rightDevId = id; +} + qreal CLinkLine::getPreEndDevPin() { return m_preRightDevPin; @@ -434,6 +528,16 @@ void CLinkLine::setPreEndDevPin(const qreal &pin) m_preRightDevPin = pin; } +long CLinkLine::getStartSubDevId() +{ + return m_leftSubDevId; +} + +long CLinkLine::getEndSubDevId() +{ + return m_rightSubDevId; +} + bool CLinkLine::IsPscadaLinkObj() { return true; @@ -511,21 +615,6 @@ void CLinkLine::adjustEndSeg() } } - else if(len == 2) - { - prepareGeometryChange(); - - qreal width = qAbs(m_points[1].x() - m_points[0].x()); - qreal height = qAbs(m_points[1].y() - m_points[0].y()); - if(width > 10*height) - { - m_points[1].setY(m_points[0].y()); - } - else if(height > 10*width) - { - m_points[1].setX(m_points[0].x()); - } - } } void CLinkLine::adjust(const bool &modify) @@ -554,7 +643,6 @@ void CLinkLine::adjust(const bool &modify) m_points[1].setY(newPinPoint.y()); } } - opl = mapFromScene(m_leftDev->getScenePin(m_leftDevPin)) - m_points[0]; m_points.first() = mapFromScene(m_leftDev->getScenePin(m_leftDevPin)); @@ -780,16 +868,10 @@ void CLinkLine::setPercent(const QPointF &pinPoint) } else { - if( (pinPoint.x() >= m_points[index].x() && pinPoint.x() <= m_points[index + 1].x()) || - (pinPoint.x() >= m_points[index + 1].x() && pinPoint.x() <= m_points[index].x()) ) - { + if(pinPoint.x() >= m_points[index].x() && pinPoint.x() <= m_points[index + 1].x()) m_perecnt = qAbs((pinPoint.x() - m_points[index].x()) / (m_points[index + 1].x() - m_points[index].x())); - } else - { - //m_perecnt = qAbs((pinPoint.y() - m_points[index].y()) / (m_points[index + 1].y() - m_points[index].y())); - m_perecnt = 1; - } + m_perecnt = qAbs((pinPoint.y() - m_points[index].y()) / (m_points[index + 1].y() - m_points[index].y())); } qDebug() << "pinPoint :" << pinPoint; @@ -921,6 +1003,36 @@ void CLinkLine::updateBus(QPointF offset, int hvDirect) adjust(); } +void CLinkLine::zoomWidth(float factor) +{ + CShape * parent = parentObj(); + if(parent) + { + float scale = factor / m_wFactor; + m_wFactor = factor; + for(int n = 0; n < m_points.size(); ++n) + { + QPointF &p = m_points[n]; + p.setX(p.x() * scale); + } + } +} + +void CLinkLine::zoomHeight(float factor) +{ + CShape * parent = parentObj(); + if(parent) + { + float scale = factor / m_hFactor; + m_hFactor = factor; + for(int n = 0; n < m_points.size(); ++n) + { + QPointF &p = m_points[n]; + p.setY(p.y() * scale); + } + } +} + void CLinkLine::reversePinNo() { if(m_leftDev && m_rightDev && m_hasDirection) diff --git a/platform/src/gui/GraphShape/GraphShape.pro b/platform/src/gui/GraphShape/GraphShape.pro index 0f09db0d..a58083af 100644 --- a/platform/src/gui/GraphShape/GraphShape.pro +++ b/platform/src/gui/GraphShape/GraphShape.pro @@ -33,9 +33,11 @@ HEADERS += include/CEllipseShape.h \ include/CLinkLine.h \ include/CRadialShape.h \ include/CDyPolygon.h \ + include/CDyLinkLine.h \ include/CArcShape.h \ include/CFlowLine.h \ include/CElfShape.h \ + include/CNewElfShape.h \ include/CGridShape.h \ include/CTimeShape.h \ include/CTextPrinter.h \ @@ -77,6 +79,7 @@ SOURCES += BasicShape/CDrawObjFactory.cpp \ BasicShape/CGridShape.cpp \ BasicShape/CTimeShape.cpp \ BasicShape/CElfShape.cpp \ + BasicShape/CNewElfShape.cpp \ BasicShape/CAnimationManage.cpp \ BasicShape/CShapeAdaptor.cpp \ DynamicShape/CDynamic.cpp \ @@ -86,6 +89,7 @@ SOURCES += BasicShape/CDrawObjFactory.cpp \ DynamicShape/CFlowLine.cpp \ DynamicShape/CRadialShape.cpp \ DynamicShape/CDyPolygon.cpp \ + DynamicShape/CDyLinkLine.cpp \ ScriptWrap/CQScriptWrap.cpp \ ScriptWrap/CQWidgetWrap.cpp \ IconInfo/CIconInfo.cpp \ diff --git a/platform/src/gui/GraphShape/IconInfo/CIconInfo.cpp b/platform/src/gui/GraphShape/IconInfo/CIconInfo.cpp index 451db3dc..8790e442 100644 --- a/platform/src/gui/GraphShape/IconInfo/CIconInfo.cpp +++ b/platform/src/gui/GraphShape/IconInfo/CIconInfo.cpp @@ -5,6 +5,8 @@ #include "../../include/CShape.h" #include "../include/CDrawObjFactory.h" +#define HMI_DEFAULT_AUTHOR "hmi" + CIconTypeInfo::CIconTypeInfo() : m_iconType(-1) { @@ -103,6 +105,10 @@ int CIconInfo::readIcon(const QString &name, int mode) QDomElement rootItem, headItem, bodyItem, objItem; //mode = CGStream::binfile; int index = name.indexOf(".ilx"); + if(index < 0) + { + index = name.indexOf(".elx"); + } if (index > 0) { mode = CGStream::xmlfile; @@ -214,7 +220,7 @@ int CIconInfo::writeIcon(const QString &name, int mode) { rootItem = xmls.AppendChild("graph"); QString version = "1.0"; - QString author = "kbd"; + QString author = HMI_DEFAULT_AUTHOR; xmls.PutValue("version", version); xmls.PutValue("author", author); xmls.AppendChild("head", &rootItem); diff --git a/platform/src/gui/GraphShape/include/CAnimationManage.h b/platform/src/gui/GraphShape/include/CAnimationManage.h index a77e4081..4c4f4449 100644 --- a/platform/src/gui/GraphShape/include/CAnimationManage.h +++ b/platform/src/gui/GraphShape/include/CAnimationManage.h @@ -21,6 +21,8 @@ public: void updateValue(const QList &values); + void resetTag(const QString& oldTagName,const QString& tagName); + //缩放 CAnimationScale * scaleAnimation(); void setScaleAnimation(CAnimationScale *animation); diff --git a/platform/src/gui/GraphShape/include/CDyLineShape.h b/platform/src/gui/GraphShape/include/CDyLineShape.h index 7bbfd0c5..d0921fc5 100644 --- a/platform/src/gui/GraphShape/include/CDyLineShape.h +++ b/platform/src/gui/GraphShape/include/CDyLineShape.h @@ -11,7 +11,6 @@ public: CDyLineShape(char type, QGraphicsItem *parent = NULL); CShape *clone(char flag = RW_PART_ALL); - int copy(CShape *src, char flag = RW_PART_ALL); bool IsPscadaLinkObj(); bool needFlowing(); diff --git a/platform/src/gui/GraphShape/include/CIconShape.h b/platform/src/gui/GraphShape/include/CIconShape.h index 895f3cf7..cf1d6dd9 100644 --- a/platform/src/gui/GraphShape/include/CIconShape.h +++ b/platform/src/gui/GraphShape/include/CIconShape.h @@ -90,6 +90,8 @@ public: void setPinSelected(int pin); void setPinHovered(int pin); void updateGeometry(qreal x, qreal y, qreal dx, qreal dy); + void zoomWidth(float factor); + void zoomHeight(float factor); protected: void draw(QPainter *pDC); @@ -116,6 +118,8 @@ private: char m_zoomMaxLevel; CIconInfo *m_pIconInfo; QList m_objlist; + float m_wInitFactor; + float m_hInitFactor; }; #endif //CICONSHAPE_H diff --git a/platform/src/gui/GraphShape/include/CLineShape.h b/platform/src/gui/GraphShape/include/CLineShape.h index 8f8bf8bb..ac08c7a2 100644 --- a/platform/src/gui/GraphShape/include/CLineShape.h +++ b/platform/src/gui/GraphShape/include/CLineShape.h @@ -26,7 +26,8 @@ public: virtual QRect getVisualBox(); void updateGeometry(qreal x, qreal y, qreal dx, qreal dy); - + void zoomWidth(float factor); + void zoomHeight(float factor); protected: void draw(QPainter *p); diff --git a/platform/src/gui/GraphShape/include/CLinkLine.h b/platform/src/gui/GraphShape/include/CLinkLine.h index d8fc1359..1cdae746 100644 --- a/platform/src/gui/GraphShape/include/CLinkLine.h +++ b/platform/src/gui/GraphShape/include/CLinkLine.h @@ -31,6 +31,7 @@ public: CLinkLine(); int copy(CShape *src, char flag = RW_PART_ALL); + CShape *clone(char flag = RW_PART_ALL); void reverse(CShape *src); void initLink(CShape *leftDev, CShape *rightDev, qreal leftPin, qreal rightPin); void clearLinkShip(); @@ -60,9 +61,13 @@ public: CShape *getEndDev(); long getStartDevId(); long getEndDevId(); + void setStartDevId(long id); + void setEndDevId(long id); qreal getPreEndDevPin(); void setEndDevPin(const qreal &pin); void setPreEndDevPin(const qreal &pin); + long getStartSubDevId(); + long getEndSubDevId(); bool IsPscadaLinkObj(); bool needFlowing(); @@ -82,6 +87,8 @@ public: qreal getPercent(int pin); void genAutoPath(); void updateBus(QPointF offset, int hvDirect); + void zoomWidth(float factor); + void zoomHeight(float factor); CShape *m_leftDev; CShape *m_rightDev; @@ -111,6 +118,8 @@ private: long m_leftDevId; long m_rightDevId; + long m_leftSubDevId; + long m_rightSubDevId; bool m_showPinNo; bool m_hasDirection; diff --git a/platform/src/gui/GraphShape/include/CPathShape.h b/platform/src/gui/GraphShape/include/CPathShape.h index 0ec04052..abed6dfe 100644 --- a/platform/src/gui/GraphShape/include/CPathShape.h +++ b/platform/src/gui/GraphShape/include/CPathShape.h @@ -48,6 +48,8 @@ public: void getPropertyList(std::list< std::pair > &propertyList); int read(CGStream &stream, char flag); int write(CGStream &stream, char flag); + void zoomWidth(float factor); + void zoomHeight(float factor); protected: QPainterPath createArrow(QPointF p1, QPointF p2, qreal width = 10) const; diff --git a/platform/src/gui/GraphShape/include/CPokeShape.h b/platform/src/gui/GraphShape/include/CPokeShape.h index 463f15f2..1d50bef1 100644 --- a/platform/src/gui/GraphShape/include/CPokeShape.h +++ b/platform/src/gui/GraphShape/include/CPokeShape.h @@ -20,6 +20,9 @@ public: name = QObject::tr("热键"); } + CShape *clone(char flag = RW_PART_ALL); + virtual int copy(CShape *src, char flag = RW_PART_ALL); + void setPropertyValue(const QString &name, QVariant value); void getPropertyList(std::list< std::pair > &propertyList); diff --git a/platform/src/gui/GraphShape/include/CPolygonShape.h b/platform/src/gui/GraphShape/include/CPolygonShape.h index fcbfde22..7dc2429c 100644 --- a/platform/src/gui/GraphShape/include/CPolygonShape.h +++ b/platform/src/gui/GraphShape/include/CPolygonShape.h @@ -42,6 +42,8 @@ public: void getPropertyList(std::list< std::pair > &propertyList); int write(CGStream &stream, char flag); int read(CGStream &stream, char flag); + void zoomWidth(float factor); + void zoomHeight(float factor); protected: QVariant itemChange(GraphicsItemChange change, const QVariant &value); diff --git a/platform/src/gui/GraphShape/include/CQWidgetWrap.h b/platform/src/gui/GraphShape/include/CQWidgetWrap.h index ef5f49a0..cb9a0b34 100644 --- a/platform/src/gui/GraphShape/include/CQWidgetWrap.h +++ b/platform/src/gui/GraphShape/include/CQWidgetWrap.h @@ -4,7 +4,7 @@ #include #include #include "CTextPrinter.h" -#include "model_excel/xlsx/xlsxdocument.h" +#include "pub_excel/xlsx/xlsxdocument.h" class CGComboBox : public QComboBox { @@ -63,6 +63,11 @@ public slots: return currentText(); } + void setItemSelected(int index) + { + QComboBox::setCurrentIndex(index); + } + signals: void currentItemChanged(int index, QString text, QString data); private slots: @@ -154,7 +159,14 @@ public slots: row = currentRow(); } takeItem(row); + setCurrentRow(0); } + + void setItemSelected(int row) + { + QListWidget::setCurrentRow(row); + } + //row=-1时修改当前条目,否则修改指定行 void updateItem(int row, const QString &text, const QString &data) { @@ -438,7 +450,7 @@ signals: \param [QString] text - 显示内容 \param [QString] data - 实际值 */ - void itemClicked(int index, QString text, QString data); + void itemClick(int index, QString text, QString data); /*! \brief 双击信号 ItemDoubleClicked
\param [int] index - 索引 @@ -457,7 +469,7 @@ signals: private slots: void onItemClicked(QTreeWidgetItem *item, int column) { - emit itemClicked(indexOfTopLevelItem(item), item->text(column), item->data(column, Qt::ToolTipRole).toString()); + emit itemClick(indexOfTopLevelItem(item), item->text(column), item->data(column, Qt::ToolTipRole).toString()); } void onDBItemClicked(QTreeWidgetItem *item, int column) { diff --git a/platform/src/gui/GraphShape/include/CRectShape.h b/platform/src/gui/GraphShape/include/CRectShape.h index 001e2a22..f1a33626 100644 --- a/platform/src/gui/GraphShape/include/CRectShape.h +++ b/platform/src/gui/GraphShape/include/CRectShape.h @@ -9,7 +9,7 @@ class DLL_CLASS CRectShape : public CShape public: enum shadowType{SHADOW_NONE, SHADOW_OUT, SHADOW_IN}; CRectShape(char type, QGraphicsItem *parent = NULL); - ~CRectShape(); + virtual ~CRectShape(); protected: void drawHandles(QPainter *p); @@ -121,7 +121,7 @@ public: int write(CGStream &bofs, char flag); CShape *clone(char flag); - int copy(CShape *src, char flag); + virtual int copy(CShape *src, char flag); void copyComm(CShape *src); void setRotateAngle(short ang); @@ -130,6 +130,9 @@ public: virtual QRect getVisualBox(); + void zoomWidth(float factor); + void zoomHeight(float factor); + protected: virtual void subDraw(QPainter *pDC, QRectF &rect , int lineCol, char lineStyle, int fillCol, char fillMode, int lineWid); diff --git a/platform/src/gui/GraphShape/include/CTextShape.h b/platform/src/gui/GraphShape/include/CTextShape.h index aab3c482..d4a56b08 100644 --- a/platform/src/gui/GraphShape/include/CTextShape.h +++ b/platform/src/gui/GraphShape/include/CTextShape.h @@ -13,17 +13,18 @@ public: enum {AlignTop = 0, AlignBottom, AlignVCenter}; enum ShandowStyle{Normal, Raised, Sunken, Plain}; CTextShape(char type, QGraphicsItem *parent = NULL); + virtual ~CTextShape(); inline QString getString() const { return m_string; } - void setString(const QString &text); + void setString(const QString &text, bool isDesign = false); void replace(const QString &before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive); CShape *clone(char flag = RW_PART_ALL); - int copy(CShape *src, char flag = RW_PART_ALL); + virtual int copy(CShape *src, char flag = RW_PART_ALL); virtual void setFontDirection(int value); char getFontDirection() const; @@ -34,6 +35,10 @@ public: int write(CGStream &stream, char flag); int read(CGStream &stream, char flag); + void updateToParent(); + void zoomWidth(float factor); + void zoomHeight(float factor); + protected: void draw(QPainter *pDC); void drawShadow(QPainter *pDC); @@ -63,6 +68,7 @@ protected: uchar m_shandowStyle; int m_borderColor; qreal m_borderDepth; + int m_nInitPointSize; }; diff --git a/platform/src/gui/GraphTool/GraphTool.pro b/platform/src/gui/GraphTool/GraphTool.pro index 4c894381..0db71030 100644 --- a/platform/src/gui/GraphTool/GraphTool.pro +++ b/platform/src/gui/GraphTool/GraphTool.pro @@ -1,3 +1,4 @@ -TEMPLATE=subdirs -CONFIG += ordered -SUBDIRS+= ScriptForm Retriever QssEditor WebPublish +TEMPLATE=subdirs +CONFIG += ordered +SUBDIRS+= ScriptForm Retriever QssEditor WebPublish ToolBoxTree AutoCreateElement + diff --git a/platform/src/gui/GraphTool/QssEditor/CAddBtnForm.cpp b/platform/src/gui/GraphTool/QssEditor/CAddBtnForm.cpp index e9ea261b..fe82c703 100644 --- a/platform/src/gui/GraphTool/QssEditor/CAddBtnForm.cpp +++ b/platform/src/gui/GraphTool/QssEditor/CAddBtnForm.cpp @@ -554,7 +554,7 @@ bool CAddBtnForm::getFilePath(QString& str) bool CAddBtnForm::getGradColor(QString &str) { bool ok; - const QGradient grad = QtGradientViewDialogN::getGradient(&ok, m_manager, this, tr("选择渐变")); + const QGradient grad = QtGradientViewDialogN::getGradient(&ok, m_manager, this, tr("渐变配置")); if(ok) { str.append(QString(":%1;").arg(QtGradientUtils::styleSheetCode(grad))); diff --git a/platform/src/gui/GraphTool/QssEditor/CQssEditor.cpp b/platform/src/gui/GraphTool/QssEditor/CQssEditor.cpp index e1b953de..5418bc9a 100644 --- a/platform/src/gui/GraphTool/QssEditor/CQssEditor.cpp +++ b/platform/src/gui/GraphTool/QssEditor/CQssEditor.cpp @@ -6,9 +6,10 @@ #include CQssEditor::CQssEditor(QWidget *parent, int type, const QString& style) : - QDialog(parent), + CustomUiDialog(parent), ui(new Ui::QssEditor) { + setWindowTitle(tr("样式编辑器")); ui->setupUi(this); initialize(); @@ -24,6 +25,8 @@ CQssEditor::CQssEditor(QWidget *parent, int type, const QString& style) : { setObjNames(name, style); } + + CustomUiDialog::setAutoLayout(true); } CQssEditor::~CQssEditor() diff --git a/platform/src/gui/GraphTool/QssEditor/CQssEditor.h b/platform/src/gui/GraphTool/QssEditor/CQssEditor.h index b6d3d876..9c11bf86 100644 --- a/platform/src/gui/GraphTool/QssEditor/CQssEditor.h +++ b/platform/src/gui/GraphTool/QssEditor/CQssEditor.h @@ -1,7 +1,6 @@ #ifndef QSSEDITOR_H #define QSSEDITOR_H -#include #include #include "CQssTextEdit.h" #include "CHighLighter.h" @@ -11,12 +10,13 @@ #include "CSearchDialog.h" #include "../gui/include/CDrawObjDefine.h" #include "Export.h" +#include "pub_widget/CustomDialog.h" namespace Ui { class QssEditor; } -class DLL_CLASS CQssEditor : public QDialog +class DLL_CLASS CQssEditor : public CustomUiDialog { Q_OBJECT diff --git a/platform/src/gui/GraphTool/QssEditor/CQssEditor.ui b/platform/src/gui/GraphTool/QssEditor/CQssEditor.ui index 37c93f2c..26bb27a5 100644 --- a/platform/src/gui/GraphTool/QssEditor/CQssEditor.ui +++ b/platform/src/gui/GraphTool/QssEditor/CQssEditor.ui @@ -15,16 +15,16 @@ - 0 + 5 - 0 + 5 - 0 + 5 - 0 + 5 2 diff --git a/platform/src/gui/GraphTool/QssEditor/CSearchDialog.cpp b/platform/src/gui/GraphTool/QssEditor/CSearchDialog.cpp index 8f44a1d1..c908199d 100644 --- a/platform/src/gui/GraphTool/QssEditor/CSearchDialog.cpp +++ b/platform/src/gui/GraphTool/QssEditor/CSearchDialog.cpp @@ -2,15 +2,18 @@ #include "ui_CSearchDialog.h" CSearchDialog::CSearchDialog(QWidget *parent) : - QDialog(parent), + CustomUiDialog(parent), ui(new Ui::SearchDialog) { + setWindowTitle(tr("查找和替换")); ui->setupUi(this); setWindowFlags(windowFlags()&~Qt::WindowContextHelpButtonHint); this->setWindowIcon(QIcon(":/icos/find.png")); connect(ui->m_nextBtn, SIGNAL(clicked()), this, SLOT(findNext())); connect(ui->m_allReplaceBtn, SIGNAL(clicked()), this, SLOT(allReplace())); + + CustomUiDialog::setAutoLayout(true); } CSearchDialog::~CSearchDialog() diff --git a/platform/src/gui/GraphTool/QssEditor/CSearchDialog.h b/platform/src/gui/GraphTool/QssEditor/CSearchDialog.h index 64f8b11d..1040b601 100644 --- a/platform/src/gui/GraphTool/QssEditor/CSearchDialog.h +++ b/platform/src/gui/GraphTool/QssEditor/CSearchDialog.h @@ -2,13 +2,13 @@ #define SEARCHDIALOG_H #include "CQssTextEdit.h" -#include +#include "pub_widget/CustomDialog.h" namespace Ui { class SearchDialog; } -class CSearchDialog : public QDialog +class CSearchDialog : public CustomUiDialog { Q_OBJECT diff --git a/platform/src/gui/GraphTool/QssEditor/QssEditor.pro b/platform/src/gui/GraphTool/QssEditor/QssEditor.pro index 5d948229..5f89aaf8 100644 --- a/platform/src/gui/GraphTool/QssEditor/QssEditor.pro +++ b/platform/src/gui/GraphTool/QssEditor/QssEditor.pro @@ -61,6 +61,8 @@ RESOURCES += \ DEFINES += DLL_OUT +LIBS += -lpub_widget + COMMON_PRI=$$PWD/../../../common.pri exists($$COMMON_PRI) { include($$COMMON_PRI) diff --git a/platform/src/gui/GraphTool/QssEditor/qtgradient/qtgradientdialog.cpp b/platform/src/gui/GraphTool/QssEditor/qtgradient/qtgradientdialog.cpp index 574e4366..2adb4504 100644 --- a/platform/src/gui/GraphTool/QssEditor/qtgradient/qtgradientdialog.cpp +++ b/platform/src/gui/GraphTool/QssEditor/qtgradient/qtgradientdialog.cpp @@ -195,8 +195,10 @@ void QtGradientDialogPrivate::slotAboutToShowDetails(bool details, int extension */ QtGradientDialog::QtGradientDialog(QWidget *parent) - : QDialog(parent), d_ptr(new QtGradientDialogPrivate()) + : CustomUiDialog(parent), d_ptr(new QtGradientDialogPrivate()) { + setWindowTitle(tr("编辑渐变")); + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); d_ptr->q_ptr = this; d_ptr->m_ui.setupUi(this); @@ -210,6 +212,10 @@ QtGradientDialog::QtGradientDialog(QWidget *parent) button->setAutoDefault(false); connect(d_ptr->m_ui.gradientEditor, SIGNAL(aboutToShowDetails(bool,int)), this, SLOT(slotAboutToShowDetails(bool,int))); + + setDetailsVisible(true); + + setAutoLayout(true); } /*! @@ -334,9 +340,9 @@ QGradient QtGradientDialog::getGradient(bool *ok, const QGradient &initial, QWid dlg.setGradient(initial); const int res = dlg.exec(); if (ok) { - *ok = (res == QDialog::Accepted) ? true : false; + *ok = (res == CustomUiDialog::Accepted) ? true : false; } - if (res == QDialog::Accepted) + if (res == CustomUiDialog::Accepted) return dlg.gradient(); return initial; } diff --git a/platform/src/gui/GraphTool/QssEditor/qtgradient/qtgradientdialog.h b/platform/src/gui/GraphTool/QssEditor/qtgradient/qtgradientdialog.h index 1c7182cd..f44a50cf 100644 --- a/platform/src/gui/GraphTool/QssEditor/qtgradient/qtgradientdialog.h +++ b/platform/src/gui/GraphTool/QssEditor/qtgradient/qtgradientdialog.h @@ -40,11 +40,11 @@ #ifndef QTGRADIENTDIALOG_H #define QTGRADIENTDIALOG_H -#include +#include "pub_widget/CustomDialog.h" QT_BEGIN_NAMESPACE -class QtGradientDialog : public QDialog +class QtGradientDialog : public CustomUiDialog { Q_OBJECT Q_PROPERTY(QGradient gradient READ gradient WRITE setGradient) diff --git a/platform/src/gui/GraphTool/QssEditor/qtgradient/qtgradientdialog.ui b/platform/src/gui/GraphTool/QssEditor/qtgradient/qtgradientdialog.ui index 6548af13..09489d96 100644 --- a/platform/src/gui/GraphTool/QssEditor/qtgradient/qtgradientdialog.ui +++ b/platform/src/gui/GraphTool/QssEditor/qtgradient/qtgradientdialog.ui @@ -44,8 +44,8 @@ 0 0 - 178 - 81 + 477 + 256 diff --git a/platform/src/gui/GraphTool/QssEditor/qtgradient/qtgradientviewdialogn.cpp b/platform/src/gui/GraphTool/QssEditor/qtgradient/qtgradientviewdialogn.cpp index 031a1d17..b11e0e5f 100644 --- a/platform/src/gui/GraphTool/QssEditor/qtgradient/qtgradientviewdialogn.cpp +++ b/platform/src/gui/GraphTool/QssEditor/qtgradient/qtgradientviewdialogn.cpp @@ -43,9 +43,11 @@ #include QtGradientViewDialogN::QtGradientViewDialogN(QWidget *parent) : - QDialog(parent), + CustomUiDialog(parent), ui(new Ui::QtGradientViewDialogN) { + setWindowTitle("渐变配置"); + ui->setupUi(this); setWindowFlags(windowFlags()&~Qt::WindowContextHelpButtonHint); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); @@ -55,6 +57,8 @@ QtGradientViewDialogN::QtGradientViewDialogN(QWidget *parent) : this, SLOT(slotGradientSelected(QString))); connect(ui->gradientView, SIGNAL(gradientActivated(QString)), this, SLOT(slotGradientActivated(QString))); + + setAutoLayout(true); } QtGradientViewDialogN::~QtGradientViewDialogN() @@ -74,10 +78,10 @@ QGradient QtGradientViewDialogN::getGradient(bool *ok, QtGradientManager *manage dlg.setWindowTitle(caption); QGradient grad = QLinearGradient(); const int res = dlg.exec(); - if (res == QDialog::Accepted) + if (res == CustomUiDialog::Accepted) grad = dlg.ui->gradientView->gradientManager()->gradients().value(dlg.ui->gradientView->currentGradient()); if (ok) - *ok = res == QDialog::Accepted; + *ok = res == CustomUiDialog::Accepted; return grad; } diff --git a/platform/src/gui/GraphTool/QssEditor/qtgradient/qtgradientviewdialogn.h b/platform/src/gui/GraphTool/QssEditor/qtgradient/qtgradientviewdialogn.h index f51a7f5c..a491d1b3 100644 --- a/platform/src/gui/GraphTool/QssEditor/qtgradient/qtgradientviewdialogn.h +++ b/platform/src/gui/GraphTool/QssEditor/qtgradient/qtgradientviewdialogn.h @@ -42,14 +42,14 @@ #include #include -#include +#include "pub_widget/CustomDialog.h" namespace Ui { class QtGradientViewDialogN; } class QtGradientManager; -class QtGradientViewDialogN : public QDialog +class QtGradientViewDialogN : public CustomUiDialog { Q_OBJECT diff --git a/platform/src/gui/GraphTool/Retriever/CListView.cpp b/platform/src/gui/GraphTool/Retriever/CListView.cpp index a59911fc..d094ebd3 100644 --- a/platform/src/gui/GraphTool/Retriever/CListView.cpp +++ b/platform/src/gui/GraphTool/Retriever/CListView.cpp @@ -85,7 +85,7 @@ QString CListView::getTagName() { return m_viewInfo + QString(".value"); } - else if(E_Table_Retriever == m_type) + else if(E_Table_Retriever == m_type || E_DevGroup_Retriever == m_type) { if(m_viewInfo.isEmpty()) { diff --git a/platform/src/gui/GraphTool/Retriever/CRetriever.cpp b/platform/src/gui/GraphTool/Retriever/CRetriever.cpp index 93198b13..54f8e44e 100644 --- a/platform/src/gui/GraphTool/Retriever/CRetriever.cpp +++ b/platform/src/gui/GraphTool/Retriever/CRetriever.cpp @@ -10,7 +10,7 @@ #include "pub_utility_api/FileUtil.h" CRetriever::CRetriever(QWidget *parent, Qt::WindowFlags f) : - QDialog(parent, f), + CustomUiDialog(parent), ui(new Ui::CRetriever), m_pReadDb(Q_NULLPTR), m_device_tableModel(Q_NULLPTR), @@ -20,8 +20,11 @@ CRetriever::CRetriever(QWidget *parent, Qt::WindowFlags f) : m_tableTagNameModel(Q_NULLPTR), m_tableProperty_valueModel(Q_NULLPTR), m_statInsModel(Q_NULLPTR), - m_statParaModel(Q_NULLPTR) + m_statParaModel(Q_NULLPTR), + m_devGroupModel(Q_NULLPTR) { + setWindowTitle(tr("检索器")); + ui->setupUi(this); initialize(); @@ -30,6 +33,8 @@ CRetriever::CRetriever(QWidget *parent, Qt::WindowFlags f) : setWindowFlag(Qt::WindowStaysOnTopHint); setAttribute(Qt::WA_DeleteOnClose); } + + CustomUiDialog::setAutoLayout(true); } CRetriever::~CRetriever() @@ -62,11 +67,13 @@ void CRetriever::initialize() ui->Profession->addItem(strSubSystemDesc, strSubSystemName); ui->Profession_Table->addItem(strSubSystemDesc, strSubSystemName); ui->Profession_Statistics->addItem(strSubSystemDesc, strSubSystemName); + ui->Profession_DevGroup->addItem(strSubSystemDesc, strSubSystemName); } } ui->Profession->setCurrentIndex(-1); ui->Profession_Table->setCurrentIndex(-1); ui->Profession_Statistics->setCurrentIndex(-1); + ui->Profession_DevGroup->setCurrentIndex(-1); //查询所有位置名称 m_pReadDb->execute("select tag_name, description from sys_model_location_info", query); @@ -79,6 +86,7 @@ void CRetriever::initialize() ui->Location->addItem(strLocationDesc, strLocationName); ui->Location_Table->addItem(strLocationDesc, strLocationName); ui->Location_Statistics->addItem(strLocationDesc, strLocationName); + ui->Location_DevGroup->addItem(strLocationDesc, strLocationName); } } //ui->Location_Table->addItem("#", ""); @@ -98,6 +106,7 @@ void CRetriever::initialize() pRadioButtonGrp->addButton(ui->DeviceRadio, 0); pRadioButtonGrp->addButton(ui->TableRadio, 1); pRadioButtonGrp->addButton(ui->StatRadio, 2); + pRadioButtonGrp->addButton(ui->DevGroupRadio, 3); connect(pRadioButtonGrp, static_cast(&QButtonGroup::buttonClicked), this, &CRetriever::slot_retrieverTypeChanged); connect(ui->Location, SIGNAL(currentIndexChanged(QString)), this, SLOT(slot_currentLocationChanged(QString))); @@ -115,11 +124,14 @@ void CRetriever::initialize() connect(ui->Location_Statistics, SIGNAL(currentIndexChanged(int)), this, SLOT(slot_updateCurrentStatisticsTempl())); connect(ui->statisticsTmplComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slot_updateCurrentStatisticsTempl())); connect(ui->StatInsView, SIGNAL(clicked(QModelIndex)), this, SLOT(slot_currentStatisticsTemplChanged(QModelIndex))); + connect(ui->Profession_DevGroup, SIGNAL(currentIndexChanged(int)), this, SLOT(slot_updateCurrentDevGroupTempl())); + connect(ui->Location_DevGroup, SIGNAL(currentIndexChanged(int)), this, SLOT(slot_updateCurrentDevGroupTempl())); readDevTypeXml(); ui->Profession->setCurrentIndex(0); ui->Profession_Table->setCurrentIndex(0); ui->Profession_Statistics->setCurrentIndex(0); ui->Profession_Table->setCurrentIndex(0); + ui->Profession_DevGroup->setCurrentIndex(0); ui->stackedWidgetL->setCurrentIndex(0); ui->stackedWidgetR->setCurrentIndex(0); } @@ -149,6 +161,8 @@ void CRetriever::initPanel() ui->Property_ValueTypeComboBox->setView(new QListView(this)); ui->Profession_Statistics->setView(new QListView(this)); ui->Location_Statistics->setView(new QListView(this)); + ui->Profession_DevGroup->setView(new QListView(this)); + ui->Location_DevGroup->setView(new QListView(this)); QCompleter *completer = new QCompleter(ui->DeviceGroupComboBox->model()); completer->setFilterMode(Qt::MatchContains); @@ -162,6 +176,7 @@ void CRetriever::initPanel() ui->TagNameView->setRetrieverType(E_Device_Retriever); ui->TableProperty_ValueView->setRetrieverType(E_Table_Retriever); ui->StatInsView->setRetrieverType(E_Statistics_Retriever); + ui->devGroupView->setRetrieverType(E_DevGroup_Retriever); m_device_tableModel = new QStandardItemModel(this); ui->Device_TableView->setModel(m_device_tableModel); m_tagNameModel = new QStandardItemModel(this); @@ -179,6 +194,8 @@ void CRetriever::initPanel() m_statParaModel = new QStandardItemModel(this); ui->statParaView->setModel(m_statParaModel); ui->statParaView->setSelectionMode(QAbstractItemView::NoSelection); + m_devGroupModel = new QStandardItemModel(this); + ui->devGroupView->setModel(m_devGroupModel); ui->TagTypeComboBox->addItem(tr("数字量"), "digital"); ui->TagTypeComboBox->addItem(tr("模拟量"), "analog"); @@ -200,7 +217,7 @@ void CRetriever::initPanel() pDeviceLayout->addWidget(pDeviceFilter); ui->DeviceFilter->setLayout(pDeviceLayout); connect(pDeviceFilter, SIGNAL(clicked()), this, SLOT(slot_deviceFilter())); - connect(ui->DeviceFilter, SIGNAL(editingFinished()), this, SLOT(slot_deviceFilter())); + connect(ui->DeviceFilter, SIGNAL(textEdited(QString)), this, SLOT(slot_deviceFilter())); ui->TableFilter->setTextMargins(0, 0, 21, 0); QPushButton * pTableFilter = new QPushButton(this); @@ -212,7 +229,19 @@ void CRetriever::initPanel() pTableLayout->addWidget(pTableFilter); ui->TableFilter->setLayout(pTableLayout); connect(pTableFilter, SIGNAL(clicked()), this, SLOT(slot_tableFilter())); - connect(ui->TableFilter, SIGNAL(editingFinished()), this, SLOT(slot_tableFilter())); + connect(ui->TableFilter, SIGNAL(textEdited(QString)), this, SLOT(slot_tableFilter())); + + ui->devGroupFilter->setTextMargins(0, 0, 21, 0); + QPushButton * pDevGroupFilter = new QPushButton(this); + pDevGroupFilter->setMaximumSize(21, 22); + pDevGroupFilter->setCursor(QCursor(Qt::ArrowCursor)); + QHBoxLayout * pDevGroupLayout = new QHBoxLayout(); + pDevGroupLayout->setContentsMargins(1, 1, 1, 1); + pDevGroupLayout->addStretch(); + pDevGroupLayout->addWidget(pDevGroupFilter); + ui->devGroupFilter->setLayout(pDevGroupLayout); + connect(pDevGroupFilter, SIGNAL(clicked()), this, SLOT(slot_devGroupFilter())); + connect(ui->devGroupFilter, SIGNAL(textEdited(QString)), this, SLOT(slot_devGroupFilter())); ui->TagNameFilter->setTextMargins(0, 0, 21, 0); QPushButton * pTagNameFilter = new QPushButton(this); @@ -224,21 +253,28 @@ void CRetriever::initPanel() pTagNameLayout->addWidget(pTagNameFilter); ui->TagNameFilter->setLayout(pTagNameLayout); connect(pTagNameFilter, &QPushButton::clicked, this, &CRetriever::slot_tagNameFilter); - connect(ui->TagNameFilter, &QLineEdit::editingFinished, this, &CRetriever::slot_tagNameFilter); + connect(ui->TagNameFilter, &QLineEdit::textEdited, this, &CRetriever::slot_tagNameFilter); connect(ui->TagNameView, &CListView::itemTagTriggered, this, &CRetriever::slotItemTagTriggered); connect(ui->TableProperty_ValueView, &CListView::itemTagTriggered, this, &CRetriever::slotItemTagTriggered); connect(ui->StatInsView, &CListView::itemStatInstTriggered, this, &CRetriever::itemStatInstTriggered); + connect(ui->devGroupView, &CListView::itemTagTriggered, this, &CRetriever::slotItemTagTriggered); - QString searchButtonStyle = QString("QPushButton{ background:#F0F0F0; \ - border:1px solid transparent; \ - border-left-color: darkgray;\ - padding-left: -1px; padding-top: -1px; \ - image:url(:/resource/search.png);} \ - QPushButton:hover{background:#E0E0E0;} \ - QPushButton:pressed{background:#E0E0E0;padding:0px; }"); + QString searchButtonStyle = QString("QPushButton{ border: none; \ + background:#F0F0F0; \ + transition: all 0.2s ease-in-out;\ + background-image:url(:/resource/search.png);\ + background-repeat:no-repeat;\ + background-position:center;}\ + QPushButton:hover { background-color: #E0E0E0;\ + border-radius: 5px;\ + transform: scale(1.1);}\ + QPushButton:pressed {background-color: #D0D0D0;\ + transform: scale(0.95);\ + box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.3);}"); pDeviceFilter->setStyleSheet(searchButtonStyle); pTableFilter->setStyleSheet(searchButtonStyle); pTagNameFilter->setStyleSheet(searchButtonStyle); + pDevGroupFilter->setStyleSheet(searchButtonStyle); setStyleSheet("QListView{height:36px;}"); } @@ -416,6 +452,7 @@ void CRetriever::setStatVisible(const bool &visible) ui->StatRadio->setVisible(visible); ui->DeviceRadio->setVisible(!visible); ui->TableRadio->setVisible(!visible); + ui->DevGroupRadio->setVisible(false); if(visible) { ui->StatRadio->setChecked(true); @@ -436,6 +473,27 @@ void CRetriever::setMultVisible(const bool &visible) ui->m_multiCheck->setVisible(visible); } +void CRetriever::setGroupVisible(const bool &visible) +{ + ui->DevGroupRadio->setVisible(visible); + ui->DeviceRadio->setVisible(!visible); + ui->TableRadio->setVisible(!visible); + ui->StatRadio->setVisible(false); + if(visible) + { + ui->DevGroupRadio->setChecked(true); + slot_retrieverTypeChanged(3); + } + else + { + if(ui->DevGroupRadio->isChecked()) + { + ui->DeviceRadio->setChecked(true); + slot_retrieverTypeChanged(0); + } + } +} + void CRetriever::slotItemTagTriggered(const QString &strTagName, const QString &strTagDesc) { emit itemTagTriggered(strTagName, strTagDesc, ui->m_multiCheck->isChecked()); @@ -444,7 +502,7 @@ void CRetriever::slotItemTagTriggered(const QString &strTagName, const QString & void CRetriever::closeEvent(QCloseEvent *e) { emit closed(); - QDialog::closeEvent(e); + CustomUiDialog::closeEvent(e); } void CRetriever::queryCurrentProfessionID(E_RETRIEVER_TYPE type, int &id) @@ -466,6 +524,10 @@ void CRetriever::queryCurrentProfessionID(E_RETRIEVER_TYPE type, int &id) { professionDescription = ui->Profession_Statistics->currentText(); } + else if (type == E_DevGroup_Retriever) + { + professionDescription = ui->Profession_DevGroup->currentText(); + } if(!professionDescription.isEmpty()) { @@ -501,6 +563,10 @@ void CRetriever::queryCurrentProfessionTagName(E_RETRIEVER_TYPE type,QString &ta { professionDescription = ui->Profession_Statistics->currentText(); } + else if (type == E_DevGroup_Retriever) + { + professionDescription = ui->Profession_DevGroup->currentText(); + } if(!professionDescription.isEmpty()) { @@ -535,10 +601,15 @@ void CRetriever::queryCurrentLocationID(E_RETRIEVER_TYPE type, int &id) { locationDescription = ui->Location_Statistics->currentText(); } + else if (type == E_DevGroup_Retriever) + { + locationDescription = ui->Location_DevGroup->currentText(); + } if(!locationDescription.isEmpty()) { - m_pReadDb->execute(QString("select location_id from sys_model_location_info where description = '%1'").arg(locationDescription), query); + QString tmp = locationDescription.replace("'", "''"); + m_pReadDb->execute(QString("select location_id from sys_model_location_info where description ='%1'").arg(tmp), query); if(query.isActive()) { while(query.next()) @@ -574,6 +645,10 @@ void CRetriever::queryCurrentLocationTagName(E_RETRIEVER_TYPE type, QString &tag { locationDescription = ui->Location_Statistics->currentText(); } + else if (type == E_DevGroup_Retriever) + { + locationDescription = ui->Location_DevGroup->currentText(); + } if(!locationDescription.isEmpty()) { @@ -1040,23 +1115,30 @@ void CRetriever::slot_retrieverTypeChanged(int nIndex) { ui->stackedWidgetL->setCurrentIndex(nIndex); ui->stackedWidgetR->setCurrentIndex(nIndex); + if(nIndex == E_DevGroup_Retriever) + { + ui->stackedWidgetR->setVisible(false); + } + else + { + ui->stackedWidgetR->setVisible(true); + } } void CRetriever::slot_deviceFilter() { - slot_currentDevGroupChanged(QString()); - if(ui->DeviceFilter->text().isEmpty()) + QString filterName = ui->DeviceFilter->text(); + int nRowCount = m_device_tableModel->rowCount(); + for (int nIndex = 0; nIndex < nRowCount; nIndex++) { - return; - } - - for(int nIndex = 0; nIndex < m_device_tableModel->rowCount(); nIndex++) - { - if(!m_device_tableModel->item(nIndex)->text().contains(ui->DeviceFilter->text())) + if (filterName.isEmpty() || m_device_tableModel->item(nIndex)->text().contains(filterName,Qt::CaseInsensitive)) { - m_device_tableModel->removeRow(nIndex); - nIndex--; + ui->Device_TableView->setRowHidden(nIndex,false); + } + else + { + ui->Device_TableView->setRowHidden(nIndex,true); } } } @@ -1127,6 +1209,23 @@ void CRetriever::slot_tagNameFilter() } } +void CRetriever::slot_devGroupFilter() +{ + QString filterName = ui->devGroupFilter->text(); + int nRowCount = m_devGroupModel->rowCount(); + for (int nIndex = 0; nIndex < nRowCount; nIndex++) + { + if (filterName.isEmpty() || m_devGroupModel->item(nIndex)->text().contains(filterName,Qt::CaseInsensitive)) + { + ui->devGroupView->setRowHidden(nIndex,false); + } + else + { + ui->devGroupView->setRowHidden(nIndex,true); + } + } +} + void CRetriever::slot_currentProfessionChanged(const QString &text) { Q_UNUSED(text); @@ -1331,3 +1430,36 @@ void CRetriever::slot_currentStatisticsTemplChanged(const QModelIndex &index) ui->StatInsView->setInstTagList(listInstTag); } +void CRetriever::slot_updateCurrentDevGroupTempl() +{ + m_devGroupModel->clear(); + + int nProfessionID = -1; + int nLocationID = -1; + queryCurrentProfessionID(E_DevGroup_Retriever,nProfessionID); + queryCurrentLocationID(E_DevGroup_Retriever,nLocationID); + if(nProfessionID == -1 || nLocationID == -1) + { + return; + } + + if(m_pReadDb->isOpen()) + { + QSqlQuery query; + //查询该专业、车站下所有设备组 + m_pReadDb->execute(QString("select description, tag_name from dev_group where sub_system = %1 and location_id = %2 order by dev_group_no asc").arg(nProfessionID).arg(nLocationID), query); + if(query.isActive()) + { + while(query.next()) + { + QStandardItem *item = new QStandardItem(); + item->setText(query.value(0).toString()); + item->setData(query.value(1).toString()); + m_devGroupModel->appendRow(item); + } + } + ui->devGroupView->setCurrentIndex(m_devGroupModel->index(0,0)); + ui->devGroupView->setViewInfo(ui->Profession_DevGroup->currentData().toString()); + } +} + diff --git a/platform/src/gui/GraphTool/Retriever/CRetriever.ui b/platform/src/gui/GraphTool/Retriever/CRetriever.ui index c8d3babb..3a0d91d2 100644 --- a/platform/src/gui/GraphTool/Retriever/CRetriever.ui +++ b/platform/src/gui/GraphTool/Retriever/CRetriever.ui @@ -13,491 +13,118 @@ 检索器 - + - 3 + 7 - 3 + 7 - 3 + 7 - 3 + 7 - 2 + 0 - - - - Qt::Vertical - - - - - - 2 + + + Qt::Horizontal - - 2 - - - - - 0 + + + + 2 - - - + + 2 + + + + 0 - - 0 - - - 0 - - - 0 - - - 0 - - - 3 - - - - - - 0 - 60 - + + + + 0 - - QFrame::StyledPanel + + 0 - - QFrame::Sunken + + 0 - - - 6 - - - 3 - - - 6 - - - 3 - - - 4 - - - - - 专业: - - - - - - - - 0 - 25 - - - - QComboBox QAbstractItemView::item{min-height: 23px;} - - - QComboBox::AdjustToMinimumContentsLength - - - 12 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 位置: - - - - - - - - 0 - 25 - - - - QComboBox QAbstractItemView::item{min-height: 23px;} - - - QComboBox::AdjustToMinimumContentsLength - - - 12 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 0 - 50 - + + 0 - - QFrame::StyledPanel + + 0 - - QFrame::Sunken + + 3 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - + + + + + 0 + 60 + + + + QFrame::StyledPanel + + + QFrame::Sunken + + - 3 + 6 - 6 - - 3 - + 6 - - 2 + + 3 - + 4 - + - 设备组: - - - - - - - - 160 - 16777215 - - - - - - - - - - 0 - - - + 专业: - - - - - - - - QFrame::Raised - - - QAbstractItemView::NoEditTriggers - - - - - - - QFrame::Sunken - - - 1 - - - Qt::Horizontal - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 3 - - - - - - 0 - 60 - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - - 6 - - - 3 - - - 6 - - - 3 - - - 4 - - - - - 专业: - - - - - - - - 0 - 25 - - - - QComboBox QAbstractItemView::item{min-height: 23px;} - - - QComboBox::AdjustToMinimumContentsLength - - - 12 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 位置: - - - - - - - - 0 - 25 - - - - QComboBox QAbstractItemView::item{min-height: 23px;} - - - QComboBox::AdjustToMinimumContentsLength - - - 12 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 0 - 25 - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QFrame::Sunken - - - 1 - - - Qt::Horizontal - - - - - - - 3 - - - 6 - - - 3 - - - 6 - - - - - + + + + 0 + 25 + - - + + QComboBox QAbstractItemView::item{min-height: 23px;} - - 0 + + QComboBox::AdjustToMinimumContentsLength - - + + 12 - - + + Qt::Horizontal @@ -510,786 +137,1405 @@ - + - 表名: + 位置: - - - - - - QFrame::Raised - - - QAbstractItemView::NoEditTriggers - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 3 - - - - - - 0 - 60 - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - - 6 - - - 3 - - - 6 - - - 3 - - - 4 - - - - - 专业: - - - - - - - - 0 - 25 - - - - QComboBox QAbstractItemView::item{min-height: 23px;} - - - QComboBox::AdjustToMinimumContentsLength - - - 12 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 位置: - - - - - - - - 0 - 25 - - - - QComboBox QAbstractItemView::item{min-height: 23px;} - - - QComboBox::AdjustToMinimumContentsLength - - - 12 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 0 - 25 - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 3 - - - 6 - - - 3 - - - 6 - - - - - 统计量模板: + + + + + 0 + 25 + + + + QComboBox QAbstractItemView::item{min-height: 23px;} + + + QComboBox::AdjustToMinimumContentsLength + + + 12 - - - - - + + Qt::Horizontal - 194 + 40 20 - - - - - QFrame::Raised + + + + + + + 0 + 50 + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + 0 - - QAbstractItemView::NoEditTriggers + + 0 + + + 0 + + + 0 + + + 0 + + + + + 3 + + + 6 + + + 3 + + + 6 + + + 2 + + + 4 + + + + + 设备组: + + + + + + + + 160 + 16777215 + + + + + + + + + + 0 + + + + + + + + + + + + + + + QFrame::Raised + + + QAbstractItemView::NoEditTriggers + + + + + + + QFrame::Sunken + + + 1 + + + Qt::Horizontal + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 3 + + + + + + 0 + 60 + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + 6 + + + 3 + + + 6 + + + 3 + + + 4 + + + + + 专业: + + + + + + + + 0 + 25 + + + + QComboBox QAbstractItemView::item{min-height: 23px;} + + + QComboBox::AdjustToMinimumContentsLength + + + 12 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 位置: + + + + + + + + 0 + 25 + + + + QComboBox QAbstractItemView::item{min-height: 23px;} + + + QComboBox::AdjustToMinimumContentsLength + + + 12 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 0 + 25 + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QFrame::Sunken + + + 1 + + + Qt::Horizontal + + + + + + + 3 + + + 6 + + + 3 + + + 6 + + + + + + + + + + + 0 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 表名: + + + + + + + + + QFrame::Raised + + + QAbstractItemView::NoEditTriggers + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 3 + + + + + + 0 + 60 + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + 6 + + + 3 + + + 6 + + + 3 + + + 4 + + + + + 专业: + + + + + + + + 0 + 25 + + + + QComboBox QAbstractItemView::item{min-height: 23px;} + + + QComboBox::AdjustToMinimumContentsLength + + + 12 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 位置: + + + + + + + + 0 + 25 + + + + QComboBox QAbstractItemView::item{min-height: 23px;} + + + QComboBox::AdjustToMinimumContentsLength + + + 12 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 0 + 25 + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 3 + + + 6 + + + 3 + + + 6 + + + + + 统计量模板: + + + + + + + + + + Qt::Horizontal + + + + 194 + 20 + + + + + + + + + + QFrame::Raised + + + QAbstractItemView::NoEditTriggers + + + + + + + QFrame::Sunken + + + 1 + + + Qt::Horizontal + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 3 + + + + + + 0 + 60 + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + 6 + + + 3 + + + 6 + + + 3 + + + 4 + + + + + 专业: + + + + + + + + 0 + 25 + + + + QComboBox QAbstractItemView::item{min-height: 23px;} + + + QComboBox::AdjustToMinimumContentsLength + + + 12 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 位置: + + + + + + + + 0 + 25 + + + + QComboBox QAbstractItemView::item{min-height: 23px;} + + + QComboBox::AdjustToMinimumContentsLength + + + 12 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 0 + 25 + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QFrame::Sunken + + + 1 + + + Qt::Horizontal + + + + + + + 3 + + + 6 + + + 3 + + + 6 + + + + + + + + + + + 0 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 设备组: + + + + + + + + + QFrame::Raised + + + QAbstractItemView::NoEditTriggers + + + + + + + + + + + + + + + 0 + 48 + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + 8 + + + 0 + + + 3 + + + 0 + + + 6 + + + + + + + Qt::Horizontal + + + + 138 + 17 + + + + + + + + 统计量 - - - - QFrame::Sunken + + + + 设备检索 - - 1 + + true - - Qt::Horizontal + + + + + + 多点关联 + + + + + + + 检索方式: + + + + + + + 表检索 + + + + + + + 设备组检索 - - - -
-
- - - - - - 0 - 48 - - - - QFrame::StyledPanel - - - QFrame::Sunken - - + + + + + + + + Qt::Horizontal + + + + + + + + 0 + + + - 8 + 0 0 - 3 + 0 0 - - 6 + + 0 + + + 3 - - - - - 表检索 - - - - - - - Qt::Horizontal - - - - 138 - 17 - - - - - - - - 检索方式: - - - - - - - 设备检索 - - - true - - - - - - - 统计量 - - - - - - - 多点关联 - - - - + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 3 + + + 6 + + + 3 + + + 6 + + + + + 点类型: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + QComboBox QAbstractItemView::item{min-height: 23px;} + + + + + + + + + QFrame::Raised + + + QAbstractItemView::NoEditTriggers + + + + + + + Qt::Horizontal + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 3 + + + 6 + + + 3 + + + 6 + + + 6 + + + + + QComboBox QAbstractItemView::item{min-height: 23px;} + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 值: + + + + + + + + + Qt::Horizontal + + + + + + + QFrame::Raised + + + QAbstractItemView::NoEditTriggers + + + + + - - - - - Qt::Horizontal - + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 3 + + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 3 + + + 6 + + + 3 + + + 6 + + + + + 点名: + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Horizontal + + + + + + + QFrame::Raised + + + QAbstractItemView::NoEditTriggers + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 3 + + + 6 + + + 3 + + + 6 + + + 6 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 列名: + + + + + + + + + Qt::Horizontal + + + + + + + QFrame::Raised + + + QAbstractItemView::NoEditTriggers + + + + + + + - - - - - - - 2 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 3 - - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - - 0 + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 3 + + + + + QAbstractItemView::NoEditTriggers - - 0 - - - 0 - - - 0 - - - 0 - - - - - 3 - - - 6 - - - 3 - - - 6 - - - - - 点类型: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - QComboBox QAbstractItemView::item{min-height: 23px;} - - - - - - - - - QFrame::Raised - - - QAbstractItemView::NoEditTriggers - - - - - - - Qt::Horizontal - - - - - - - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 3 - - - 6 - - - 3 - - - 6 - - - 6 - - - - - QComboBox QAbstractItemView::item{min-height: 23px;} - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 值: - - - - - - - - - Qt::Horizontal - - - - - - - QFrame::Raised - - - QAbstractItemView::NoEditTriggers - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 3 - - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 3 - - - 6 - - - 3 - - - 6 - - - - - 点名: - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Horizontal - - - - - - - QFrame::Raised - - - QAbstractItemView::NoEditTriggers - - - - - - - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 3 - - - 6 - - - 3 - - - 6 - - - 6 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 列名: - - - - - - - - - Qt::Horizontal - - - - - - - QFrame::Raised - - - QAbstractItemView::NoEditTriggers - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 3 - - - - - QAbstractItemView::NoEditTriggers - - - true - - - false - - - - + + true + + + false + + + + + diff --git a/platform/src/gui/GraphTool/Retriever/Retriever.pro b/platform/src/gui/GraphTool/Retriever/Retriever.pro index b1392002..f1ddab90 100644 --- a/platform/src/gui/GraphTool/Retriever/Retriever.pro +++ b/platform/src/gui/GraphTool/Retriever/Retriever.pro @@ -17,7 +17,7 @@ RESOURCES += $$PWD/resource.qrc DEFINES += DLL_OUT -LIBS += -llog4cplus -ldb_base_api -ldb_api_ex -lpub_logger_api -lpub_utility_api -ldb_sysinfo_api +LIBS += -llog4cplus -ldb_base_api -ldb_api_ex -lpub_logger_api -lpub_utility_api -ldb_sysinfo_api -lpub_widget COMMON_PRI=$$PWD/../../../common.pri diff --git a/platform/src/gui/GraphTool/ScriptForm/ScriptForm.cpp b/platform/src/gui/GraphTool/ScriptForm/ScriptForm.cpp index 08f3d6e5..b639fba7 100644 --- a/platform/src/gui/GraphTool/ScriptForm/ScriptForm.cpp +++ b/platform/src/gui/GraphTool/ScriptForm/ScriptForm.cpp @@ -18,11 +18,14 @@ #include "FindWidget.h" ScriptForm::ScriptForm(QWidget *parent) : - QDialog(parent, Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), +// QDialog(parent, Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), + CustomDialog(parent), scriptEditor(Q_NULLPTR), funcNameWidget(Q_NULLPTR), findWidget(Q_NULLPTR) { + setWindowTitle(tr("脚本编辑器")); + initialize(); installEventFilter(this); resize(QApplication::desktop()->size() / 2); @@ -257,5 +260,5 @@ bool ScriptForm::eventFilter(QObject *object, QEvent *event) } } } - return QWidget::eventFilter(object, event); + return CustomDialog::eventFilter(object, event); } diff --git a/platform/src/gui/GraphTool/ScriptForm/ScriptForm.pro b/platform/src/gui/GraphTool/ScriptForm/ScriptForm.pro index 62f98b09..fd82bdea 100644 --- a/platform/src/gui/GraphTool/ScriptForm/ScriptForm.pro +++ b/platform/src/gui/GraphTool/ScriptForm/ScriptForm.pro @@ -28,6 +28,8 @@ win32 DEFINES += DLL_OUT } +LIBS += -lpub_widget + COMMON_PRI=$$PWD/../../../common.pri exists($$COMMON_PRI) { include($$COMMON_PRI) diff --git a/platform/src/gui/GraphTool/WebPublish/CWebPublish.cpp b/platform/src/gui/GraphTool/WebPublish/CWebPublish.cpp index 7f6ec20b..efc75f30 100644 --- a/platform/src/gui/GraphTool/WebPublish/CWebPublish.cpp +++ b/platform/src/gui/GraphTool/WebPublish/CWebPublish.cpp @@ -15,9 +15,11 @@ #include CWebPublish::CWebPublish(QWidget *parent) : - QDialog(parent), + CustomUiDialog(parent), ui(new Ui::MainWindow) { + setWindowTitle(tr("web发布")); + ui->setupUi(this); initConfigTable(); @@ -27,6 +29,8 @@ CWebPublish::CWebPublish(QWidget *parent) : { LOGINFO("CWebPublish --创建系统信息访问库实例失败!"); } + + CustomUiDialog::setAutoLayout(true); } CWebPublish::~CWebPublish() @@ -178,10 +182,17 @@ void CWebPublish::initConfigDatas() void CWebPublish::publish() { int ret = 1; + if(ui->m_picCheck->checkState() == Qt::Checked) + { + CCanvasInterface *ptr = createCanvas(); + ret = ptr->publishIcon(); + ret = ptr->publishGraph(); + destroyCanvas(ptr); + } std::string strStyleName = iot_public::CFileStyle::getCurStyle("light"); int backRet = 1; - if(ui->m_imageCheck->checkState() == Qt::Checked) //拷贝BITMAP文件 + if(ui->m_imageCheck->checkState() == Qt::Checked) { QString hmiFile = CBaseInstance()->getSysHome() + QDir::separator() + QString("data") + QDir::separator() + QString("back_pixmap"); @@ -191,16 +202,8 @@ void CWebPublish::publish() backRet = copyFiles(hmiFile, webFile); } - if(ui->m_picCheck->checkState() == Qt::Checked) //发布页面:切换位置,不然第一个会web发布失败 - { - CCanvasInterface *ptr = createCanvas(); - ret = ptr->publishIcon(); - ret = ptr->publishGraph(); - destroyCanvas(ptr); - } - int themeRet = 1; - if(ui->m_themeCheck->checkState() == Qt::Checked) //发布样式 + if(ui->m_themeCheck->checkState() == Qt::Checked) { themeRet = pubCssTheme(QString::fromStdString(strStyleName)); } diff --git a/platform/src/gui/GraphTool/WebPublish/CWebPublish.h b/platform/src/gui/GraphTool/WebPublish/CWebPublish.h index 02c85881..3eef932d 100644 --- a/platform/src/gui/GraphTool/WebPublish/CWebPublish.h +++ b/platform/src/gui/GraphTool/WebPublish/CWebPublish.h @@ -3,14 +3,15 @@ #include #include "CWebPublishExport.h" -#include "../../../include/public/pub_sysinfo_api/SysInfoApi.h" +#include "pub_sysinfo_api/SysInfoApi.h" +#include "pub_widget/CustomDialog.h" namespace Ui { class MainWindow; } using namespace iot_public; -class WEBPUBLISH CWebPublish : public QDialog +class WEBPUBLISH CWebPublish : public CustomUiDialog { Q_OBJECT diff --git a/platform/src/gui/GraphTool/WebPublish/WebPublish.pro b/platform/src/gui/GraphTool/WebPublish/WebPublish.pro index 4524ee74..dc1928ed 100644 --- a/platform/src/gui/GraphTool/WebPublish/WebPublish.pro +++ b/platform/src/gui/GraphTool/WebPublish/WebPublish.pro @@ -48,7 +48,7 @@ RESOURCES += \ #} LIBS += -llog4cplus -lpub_logger_api -lpub_sysinfo_api -lpub_utility_api -lboost_system -lboost_chrono -lboost_thread -LIBS += -lGraphPub +LIBS += -lGraphPub -lpub_widget COMMON_PRI=$$PWD/../../../common.pri exists($$COMMON_PRI) { diff --git a/platform/src/gui/PropertyEditor/PropertyEditor.pro b/platform/src/gui/PropertyEditor/PropertyEditor.pro index 97a5db79..4f9496f5 100644 --- a/platform/src/gui/PropertyEditor/PropertyEditor.pro +++ b/platform/src/gui/PropertyEditor/PropertyEditor.pro @@ -36,6 +36,7 @@ HEADERS += $$PWD/qtpropertybrowser.h \ RESOURCES += $$PWD/qtpropertybrowser.qrc +LIBS += -lpub_widget COMMON_PRI=$$PWD/../../common.pri exists($$COMMON_PRI) { diff --git a/platform/src/gui/PropertyEditor/gradient/CGradientDialog.cpp b/platform/src/gui/PropertyEditor/gradient/CGradientDialog.cpp index 2a57e072..11afdaf5 100644 --- a/platform/src/gui/PropertyEditor/gradient/CGradientDialog.cpp +++ b/platform/src/gui/PropertyEditor/gradient/CGradientDialog.cpp @@ -8,16 +8,20 @@ #include CGradientDialog::CGradientDialog(QBrush brush, QWidget *parent) : - QDialog(parent), + CustomUiDialog(parent), ui(new Ui::GradientDialog), m_color(brush.color()), m_gradientStartColor(brush.color()), m_gradientEndColor(Qt::white) { + setWindowTitle(tr("填充配置")); + ui->setupUi(this); initialize(); connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(brushEditFinish())); initBrush(brush); + + CustomUiDialog::setAutoLayout(true); } CGradientDialog::~CGradientDialog() @@ -59,7 +63,7 @@ bool CGradientDialog::eventFilter(QObject *watched, QEvent *event) } } } - return false; + return CustomUiDialog::eventFilter(watched,event); } void CGradientDialog::initBrush(const QBrush &brush) diff --git a/platform/src/gui/PropertyEditor/gradient/CGradientDialog.h b/platform/src/gui/PropertyEditor/gradient/CGradientDialog.h index e7ba69f6..2aa9362c 100644 --- a/platform/src/gui/PropertyEditor/gradient/CGradientDialog.h +++ b/platform/src/gui/PropertyEditor/gradient/CGradientDialog.h @@ -1,9 +1,9 @@ #ifndef CGRADIENTDIALOG_H #define CGRADIENTDIALOG_H -#include #include #include +#include "pub_widget/CustomDialog.h" namespace Ui { class GradientDialog; @@ -33,7 +33,7 @@ private: QBrush m_brush; }; -class CGradientDialog : public QDialog +class CGradientDialog : public CustomUiDialog { Q_OBJECT public: diff --git a/platform/src/gui/PropertyEditor/gradient/GradientDialog.ui b/platform/src/gui/PropertyEditor/gradient/GradientDialog.ui index 149ce831..f0b51820 100644 --- a/platform/src/gui/PropertyEditor/gradient/GradientDialog.ui +++ b/platform/src/gui/PropertyEditor/gradient/GradientDialog.ui @@ -20,10 +20,25 @@ Dialog + + 9 + + + 9 + + + 9 + + + 9 + + + 6 + - QFrame::StyledPanel + QFrame::NoFrame QFrame::Sunken diff --git a/platform/src/gui/PropertyEditor/pen/CPenDialog.cpp b/platform/src/gui/PropertyEditor/pen/CPenDialog.cpp index 6cd263b6..dd75eb9b 100644 --- a/platform/src/gui/PropertyEditor/pen/CPenDialog.cpp +++ b/platform/src/gui/PropertyEditor/pen/CPenDialog.cpp @@ -4,12 +4,16 @@ #include CPenDialog::CPenDialog(const QPen &pen, QWidget *parent) : - QDialog(parent), + CustomUiDialog(parent), ui(new Ui::CPenDialog) { + setWindowTitle(tr("画笔配置")); + ui->setupUi(this); initialize(); setPen(pen); + + setAutoLayout(true); } CPenDialog::~CPenDialog() @@ -106,7 +110,7 @@ bool CPenDialog::eventFilter(QObject *watched, QEvent *event) } } } - return false; + return CustomUiDialog::eventFilter(watched,event); } void CPenDialog::onCurrentLineWidthChanged(int width) diff --git a/platform/src/gui/PropertyEditor/pen/CPenDialog.h b/platform/src/gui/PropertyEditor/pen/CPenDialog.h index 83933104..bcfbae91 100644 --- a/platform/src/gui/PropertyEditor/pen/CPenDialog.h +++ b/platform/src/gui/PropertyEditor/pen/CPenDialog.h @@ -1,11 +1,11 @@ #ifndef CPENDIALOG_H #define CPENDIALOG_H -#include #include #include #include #include +#include "pub_widget/CustomDialog.h" namespace Ui { class CPenDialog; @@ -46,7 +46,7 @@ private: }; -class CPenDialog : public QDialog +class CPenDialog : public CustomUiDialog { Q_OBJECT diff --git a/platform/src/gui/PropertyEditor/pen/CPenDialog.ui b/platform/src/gui/PropertyEditor/pen/CPenDialog.ui index 6a02412b..dd5f46ab 100644 --- a/platform/src/gui/PropertyEditor/pen/CPenDialog.ui +++ b/platform/src/gui/PropertyEditor/pen/CPenDialog.ui @@ -30,11 +30,14 @@ - QFrame::Box + QFrame::NoFrame QFrame::Raised + + 1 + diff --git a/platform/src/gui/PropertyEditor/qteditorfactory.cpp b/platform/src/gui/PropertyEditor/qteditorfactory.cpp index 23cc10cf..0dd34141 100644 --- a/platform/src/gui/PropertyEditor/qteditorfactory.cpp +++ b/platform/src/gui/PropertyEditor/qteditorfactory.cpp @@ -2878,8 +2878,8 @@ void QtBrushEditWidget::paintEvent(QPaintEvent *ev) void QtBrushEditWidget::buttonClicked() { - CGradientDialog dlg(m_brush); - if(QDialog::Accepted == dlg.exec()) + CGradientDialog dlg(m_brush,this); + if(CustomUiDialog::Accepted == dlg.exec()) { m_brush = dlg.getBrush(); emit valueChanged(m_brush); @@ -3031,8 +3031,8 @@ void QtPenEditWidget::paintEvent(QPaintEvent *ev) void QtPenEditWidget::buttonClicked() { - CPenDialog dlg(m_pen); - if(QDialog::Accepted == dlg.exec()) + CPenDialog dlg(m_pen,this); + if(CustomUiDialog::Accepted == dlg.exec()) { m_pen = dlg.pen(); emit valueChanged(m_pen); diff --git a/platform/src/gui/gui.pro b/platform/src/gui/gui.pro index 07a89a0c..2576d632 100644 --- a/platform/src/gui/gui.pro +++ b/platform/src/gui/gui.pro @@ -8,3 +8,6 @@ SUBDIRS += PropertyEditor \ GraphDataAcess \ hmi +TRANSLATIONS += \ + platform_en.ts\ + platform_fr.ts diff --git a/platform/src/gui/hmi/CDesignerScene.cpp b/platform/src/gui/hmi/CDesignerScene.cpp index e3c28905..278c1df5 100644 --- a/platform/src/gui/hmi/CDesignerScene.cpp +++ b/platform/src/gui/hmi/CDesignerScene.cpp @@ -13,6 +13,9 @@ #include "../GraphShape/include/CQScriptWrap.h" #include "../GraphShape/include/CPathShape.h" #include "../GraphShape/include/CPolygonShape.h" +#include "../GraphShape/include/CNewElfShape.h" +#include "../GraphShape/include/CDataShape.h" +#include "../../include/public/pub_logger_api/logger.h" #include CDesignerScene::CDesignerScene(): CGraphScene() @@ -149,7 +152,7 @@ char CDesignerScene::IsShowObject(CShape *pobj) return NOT_SHOW; } int plane = pobj->getPlane(); - if (getEnvTypeFlag() == AppMode::DesignerMode) + if (getEnvTypeFlag() == AppMode::DesignerMode || getEnvTypeFlag() == AppMode::ElfMode) { //先判断图层显示配置信息 if (!IsShowingPlane(plane)) @@ -383,7 +386,7 @@ void CDesignerScene::pasteFromClipboard(CGStream &bifs, QPoint &point, bool with } idlist.push_back(tmpobj->getObjId()); - if (getEnvTypeFlag() == AppMode::DesignerMode) + if (getEnvTypeFlag() == AppMode::DesignerMode || getEnvTypeFlag() == AppMode::ElfMode) { if(OBJTYPE_RELATIVE != tmpobj->getObjType()) { @@ -421,7 +424,7 @@ void CDesignerScene::pasteFromClipboard(CGStream &bifs, QPoint &point, bool with QPointF pos = tmpobj->pos(); tmpobj->setPos(point.x() - topLeft.x() + tmpobj->pos().x(), point.y() - topLeft.y() + tmpobj->pos().y()); - if(tmpobj->getObjType() == OBJTYPE_MERGE) + if(dynamic_cast(tmpobj)) { QPointF offset = tmpobj->pos() - pos; CGroupShape *tmp = dynamic_cast(tmpobj); @@ -434,6 +437,10 @@ void CDesignerScene::pasteFromClipboard(CGStream &bifs, QPoint &point, bool with (*it)->setPos((*it)->pos() + offset); (*it)->m_prePos = (*it)->pos(); } + else + { + (*it)->setPos(0,0); + } (*it)->setPlane(getCurPlane()); } @@ -799,6 +806,7 @@ void CDesignerScene::setAlign(int style) QList listShape; foreach(CShape *obj, items) { + if(!obj || obj->getObjType() == OBJTYPE_RELATIVE) continue; listShape.append(obj); } if(listShape.count() < 2) @@ -857,6 +865,7 @@ void CDesignerScene::setAlign(int style) QList listShape; foreach(CShape *obj, items) { + if(!obj || obj->getObjType() == OBJTYPE_RELATIVE) continue; listShape.append(obj); } if(listShape.count() < 2) @@ -929,6 +938,10 @@ void CDesignerScene::mirrorHorizontal() { QMessageBox::warning(NULL, QObject::tr("提示"), QObject::tr("组合图元不可镜像!")); } + else if(obj->getObjType() == OBJTYPE_ELF) + { + QMessageBox::warning(NULL, QObject::tr("提示"), QObject::tr("精灵图元不可镜像!")); + } else if(obj->IsWidgetObj()) { QMessageBox::warning(NULL, QObject::tr("提示"), QObject::tr("控件图元不可镜像!")); @@ -969,6 +982,10 @@ void CDesignerScene::mirrorVertical() { QMessageBox::warning(NULL, tr("提示"), tr("组合图元不可镜像!")); } + else if(obj->getObjType() == OBJTYPE_ELF) + { + QMessageBox::warning(NULL, tr("提示"), tr("精灵图元不可镜像!")); + } else if(obj->IsWidgetObj()) { QMessageBox::warning(NULL, tr("提示"), tr("控件图元不可镜像!")); @@ -1132,13 +1149,14 @@ void CDesignerScene::traverse() for(iter = m_topoObjMap.begin(); iter != m_topoObjMap.end(); iter++) { pobj = iter.value(); - qDebug() << pobj->getObjId(); + qDebug() <<"id:"<< pobj->getObjId()<< " type:"<getObjType(); if(pobj->getObjType() == OBJTYPE_FLOWDOT) { powVec.push_back(pobj); } } + m_linkIndexMap.clear();// lww 20220917 增加清空,否则删除关联关系失败 foreach(CShape *pow, powVec) { qDebug() << "pow " << pow->getObjId(); @@ -1432,7 +1450,7 @@ void CDesignerScene::mousePressEvent(QGraphicsSceneMouseEvent *e) QPointF endPoint = e->scenePos(); QList points = m_lkLine->getPoints(); int len = points.count(); - if(len > 2) + if(len >= 2) { points[len - 2] = endPoint; if(points[len - 2].x() == points[len - 1].x()) @@ -1447,19 +1465,6 @@ void CDesignerScene::mousePressEvent(QGraphicsSceneMouseEvent *e) { } } - else if(len == 2) - { - qreal width = qAbs(endPoint.x() - points[0].x()); - qreal height = qAbs(endPoint.y() - points[0].y()); - if(width > 10*height) - { - endPoint.setY(points[0].y()); - } - else if(height > 10*width) - { - endPoint.setX(points[0].x()); - } - } CLinkLine *tmp = dynamic_cast(m_endDev); tmp->setPercent(endPoint); @@ -1606,6 +1611,10 @@ void CDesignerScene::mouseMoveEvent(QGraphicsSceneMouseEvent *e) } else { + if(hoverItem->parentObj()) + { + continue; + } m_endDev = hoverItem; break; } @@ -1891,7 +1900,7 @@ void CDesignerScene::keyPressEvent(QList &list, int offset, int key) { view->beginMoveCommand(obj, QPoint(offset, 0)); obj->setPos(pos.x() - offset, pos.y()); - if(obj->getObjType() == OBJTYPE_MERGE) + if(dynamic_cast(obj)) { CGroupShape *tmp = dynamic_cast(obj); tmp->shift(QPointF(-offset, 0.)); @@ -1910,7 +1919,7 @@ void CDesignerScene::keyPressEvent(QList &list, int offset, int key) { view->beginMoveCommand(obj, QPoint(-offset, 0)); obj->setPos(pos.x() + offset, pos.y()); - if(obj->getObjType() == OBJTYPE_MERGE) + if(dynamic_cast(obj)) { CGroupShape *tmp = dynamic_cast(obj); tmp->shift(QPointF(offset, 0.)); @@ -1922,7 +1931,7 @@ void CDesignerScene::keyPressEvent(QList &list, int offset, int key) { view->beginMoveCommand(obj, QPoint(0, offset)); obj->setPos(pos.x(), pos.y() - offset); - if(obj->getObjType() == OBJTYPE_MERGE) + if(dynamic_cast(obj)) { CGroupShape *tmp = dynamic_cast(obj); tmp->shift(QPointF(0., -offset)); @@ -1934,7 +1943,7 @@ void CDesignerScene::keyPressEvent(QList &list, int offset, int key) { view->beginMoveCommand(obj, QPoint(0, -offset)); obj->setPos(pos.x(), pos.y() + offset); - if(obj->getObjType() == OBJTYPE_MERGE) + if(dynamic_cast(obj)) { CGroupShape *tmp = dynamic_cast(obj); tmp->shift(QPointF(0., offset)); @@ -2002,7 +2011,7 @@ void CDesignerScene::mouseMoveEvent(QList &list, const QPointF &op) obj->setPos(modPoint); qDebug() << "op:" << op; - if(obj->getObjType() == OBJTYPE_MERGE) + if(dynamic_cast(obj)) { QPointF offset = modPoint - obj->m_prePos; // CGroupShape *tmp = dynamic_cast(obj); @@ -2203,6 +2212,145 @@ CUndoCommand *CDesignerScene::buildUndoCommand(QGraphicsItem *item) return cmd; } +void CDesignerScene::createBatchObject(CShape *templateObject, QPoint &point ,const QList > &listInfo, const int count, const int rowOrCol , int space) +{ + if(NULL == templateObject || count == 0) + { + return; + } + int size = count; + CShape *tmpobj = NULL; + QList idlist; + QList newlist; + + char mark = COPY_WITHOUT_DY_INFO; + char flag = RW_PART_SHAPE | RW_PART_LINK; + + QPointF startPos(point); + while( size > 0) + { + tmpobj = templateObject->clone(flag); + tmpobj->setScene(this); + tmpobj->setParentWidget((QWidget *)views().front()->viewport(), getEnvTypeFlag()); + newlist.push_back(tmpobj); + idlist.push_back(tmpobj->getObjId()); + size--; + } + + + QList>::const_iterator it = listInfo.begin(); + if (newlist.size() > 0) + { + clearSelection(); + QPointF currentPos = startPos; + QList::iterator tmpit = newlist.begin(); + for (; tmpit != newlist.end(); tmpit++) + { + tmpobj = (*tmpit); + if (getEnvTypeFlag() == AppMode::IconMode) + { + tmpobj->setStartLevel(getCurLevel()); + } + else + { + tmpobj->setStartLevel(0); + tmpobj->setEndLevel(0); + if(OBJTYPE_RELATIVE != tmpobj->getObjType()) + { + QPointF pos = tmpobj->pos(); + tmpobj->setPos(currentPos); + if(dynamic_cast(tmpobj)) + { + QPointF offset = tmpobj->pos() - pos; + CGroupShape *tmp = dynamic_cast(tmpobj); + QList *tmpObjList = tmp->getMergeListPtr(); + QList::iterator it = tmpObjList->begin(); + for(; it != tmpObjList->end(); it++) + { + if((*it)->getObjType() != OBJTYPE_RELATIVE) + { + (*it)->setPos((*it)->pos() + offset); + (*it)->m_prePos = (*it)->pos(); + } + else + { + (*it)->setPos(0,0); + } + (*it)->setPlane(getCurPlane()); + } + + if (rowOrCol) { + currentPos.setX(currentPos.x() + tmpobj->boundingRect().width() + space); + } else { + currentPos.setY(currentPos.y() + tmpobj->boundingRect().height() + space); + } + }else + { + int heightTmp = 0; + int widthTmp = 0; + try{ + widthTmp = tmpobj->boundingRect().width(); + heightTmp = tmpobj->boundingRect().height(); + + }catch(...) + { + LOGERROR("捕获到异常:可能是该对象并未实现boundingRect 方法 !objType:%d" , tmpobj->getObjType()); + widthTmp = 50; + heightTmp = 50; + } + + if (rowOrCol) { + currentPos.setX(currentPos.x() + widthTmp + space); + } else { + currentPos.setY(currentPos.y() + widthTmp + space); + } + } + + tmpobj->m_prePos = tmpobj->pos(); + } + } + + tmpobj->setPlane(getCurPlane()); + if(!tmpobj->IsChartObj() && it != listInfo.end()) + { + QString desc = it->first; + QString tagInfo = it->second; + QStringList listTagName; + listTagName.append(tagInfo); + std::vector dyVec = listTagName.toVector().toStdVector(); + + tmpobj->setDynamic(dyVec, true); + if(tmpobj->getObjType() == OBJTYPE_DBDATA) + { + CDataShape *tmp = dynamic_cast(tmpobj); + if(tmp->getShowDataType() == CDataShape::CardType) + { + tmp->setString(desc); + } + } + it++; + } + } + + excludeSlink(newlist, idlist); + + CDesignerView *view = dynamic_cast(views().front()); + view->m_pGraphWnd->m_pUndoStack->push(new CAddCommand(this, newlist, idlist)); + + foreach(CShape *item, newlist) + { + item->setSelected(true); + } + } + + //删除模板对象 + if( templateObject ) + { + delete templateObject; + } + templateObject = NULL; +} + void CDesignerScene::onOrthogonal(QPointF &point, const QPointF &basePoint, qreal ang) { bool orthogonal = isOrthMode(); diff --git a/platform/src/gui/hmi/CDesignerScene.h b/platform/src/gui/hmi/CDesignerScene.h index 3c4315cd..fe457378 100644 --- a/platform/src/gui/hmi/CDesignerScene.h +++ b/platform/src/gui/hmi/CDesignerScene.h @@ -54,6 +54,7 @@ public: void keyPressEvent(QList &list, int offset, int key); void mouseMoveEvent(QList &list, const QPointF &op); CUndoCommand *buildUndoCommand(QGraphicsItem *item); + void createBatchObject(CShape *templateObject ,QPoint &point ,const QList> &listInfo, const int count , const int rowOrCol , int space = 10); //批量生成对象 private: void onOrthogonal(QPointF &point, const QPointF &basePoint, qreal ang); void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e); diff --git a/platform/src/gui/hmi/CDesignerView.cpp b/platform/src/gui/hmi/CDesignerView.cpp index b409d290..feabc650 100644 --- a/platform/src/gui/hmi/CDesignerView.cpp +++ b/platform/src/gui/hmi/CDesignerView.cpp @@ -23,6 +23,8 @@ CDesignerView::CDesignerView(CGraphScene *scene, QWidget *parent, const char *na m_orthogonal = true; m_gridSpace = 20; m_gridLineColor = 0; + m_firstType = 0; + m_firstName = ""; m_pScene->setDataAccess(((CGraphApp *)qApp)->getDataAccess()); @@ -186,10 +188,10 @@ void CDesignerView::contextMenuEvent(QContextMenuEvent *event) contextMenu.addAction(tr("动画配置"), m_pGraphWnd, SLOT(openAnimationConfigDlg())); if (OBJTYPE_MERGE == obj->getObjType()) { - contextMenu.addSeparator(); - QAction *pSaveAsElfIcon = new QAction(tr("添加到精灵图元"), this); - contextMenu.addAction(pSaveAsElfIcon); - connect(pSaveAsElfIcon, &QAction::triggered, m_pGraphWnd, &CDesignerWnd::iconElfSave); +// contextMenu.addSeparator(); +// QAction *pSaveAsElfIcon = new QAction(tr("添加到精灵图元"), this); +// contextMenu.addAction(pSaveAsElfIcon); +// connect(pSaveAsElfIcon, &QAction::triggered, m_pGraphWnd, &CDesignerWnd::iconElfSave); } else if(OBJTYPE_STRING == obj->getObjType() || OBJTYPE_POKE == obj->getObjType() || OBJTYPE_DBDATA == obj->getObjType()) { @@ -208,17 +210,56 @@ void CDesignerView::contextMenuEvent(QContextMenuEvent *event) else {} } + contextMenu.addSeparator(); + QAction *pSaveAsElfIcon = new QAction(tr("添加到精灵图元"), this); + contextMenu.addAction(pSaveAsElfIcon); + connect(pSaveAsElfIcon, &QAction::triggered, m_pGraphWnd, &CDesignerWnd::elfSave); contextMenu.exec(event->globalPos()); } else { contextMenu.addAction(m_pGraphWnd->m_pEditPasteFromClipboardAction); - contextMenu.addAction(tr("检索器"), m_pGraphWnd, SLOT(openSearchDlg())); + contextMenu.addAction(m_pGraphWnd->m_pRetrieverAction); + contextMenu.addAction(m_pGraphWnd->m_pAutoCreateAction); contextMenu.exec(event->globalPos()); } } +void CDesignerView::dragEnterEvent(QDragEnterEvent *event) +{ + if (event->mimeData()->hasText()) + { + event->acceptProposedAction(); + event->setDropAction(Qt::CopyAction); + } + else + { + event->setAccepted(true); + } +} + +void CDesignerView::dropEvent(QDropEvent *event) +{ + if (event->mimeData()->hasText()) + { + QMouseEvent mouseEvent(QEvent::MouseButtonPress, event->pos(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); + QApplication::sendEvent(this, &mouseEvent); + QMouseEvent mousePress(QEvent::MouseButtonRelease, event->pos(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); + QApplication::sendEvent(this, &mousePress); + } + event->accept(); +} + +void CDesignerView::dragMoveEvent(QDragMoveEvent *event) +{ + if (event->mimeData()->hasText()) + { + QMouseEvent mouseEvent(QEvent::MouseMove, event->pos(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); + QApplication::sendEvent(this, &mouseEvent); + } +} + void CDesignerView::mousePressEvent(QMouseEvent *e) { CGraphView::mousePressEvent(e); @@ -249,6 +290,8 @@ void CDesignerView::mousePressEvent(QMouseEvent *e) objName = ((CIconShape*)pobj)->getIconName(); objName = m_pGraphWnd->s_iconTransMap[objName]; } + m_firstType = pobj->getObjType(); + m_firstName = objName; msg = QString("%1 %2").arg(pobj->getObjId()).arg(objName); break; @@ -259,16 +302,21 @@ void CDesignerView::mousePressEvent(QMouseEvent *e) { msg = tr("视图"); pobj = NULL; + m_firstType = 0; + m_firstName = ""; } int modifier = e->modifiers() & Qt::ControlModifier; if(modifier != Qt::ControlModifier && curList.count() == 0) { m_pScene->clearSelection(); + m_firstType = 0; + m_firstName = ""; } m_pGraphWnd->statusBar()->showMessage(msg); m_pGraphWnd->updateCommProperty(pobj); + m_pGraphWnd->updateRetrieverView(pobj); } } @@ -348,6 +396,43 @@ void CDesignerView::mouseReleaseEvent(QMouseEvent *e) void CDesignerView::mouseMoveEvent(QMouseEvent *e) { CGraphView::mouseMoveEvent(e); + if((e->modifiers() & Qt::ControlModifier) != Qt::ControlModifier) + { + return; + } + if((e->buttons() & Qt::LeftButton) != Qt::LeftButton) + { + return; + } + QList selectedItems = m_pScene->selectedItems(); + if(selectedItems.count() <= 0) + { + return; + } + QString tmpName; + CShape *shape = NULL; + + QPainterPath path = m_pScene->selectionArea(); + QList itemList = m_pScene->items(path); + itemList.append(selectedItems); + foreach (QGraphicsItem *item, itemList) { + shape = dynamic_cast(item); + if(shape == NULL || shape->parentItem()) + { + continue; + } + if(shape->getObjType() != m_firstType) + { + shape->setSelected(false); + continue; + } + shape->getObjName(tmpName); + if(tmpName != m_firstName) + { + shape->setSelected(false); + continue; + } + } } void CDesignerView::keyPressEvent(QKeyEvent *event) @@ -473,7 +558,7 @@ void CDesignerView::keyPressEvent(QKeyEvent *event) // else // {} - m_pGraphWnd->onShapeStateChanged(); +// m_pGraphWnd->onShapeStateChanged(); // else if (Qt::Key_Delete == event->key()) // { // foreach(QGraphicsItem *item, items) @@ -499,10 +584,13 @@ bool CDesignerView::eventFilter(QObject *watched, QEvent *e) { return true; } + break; } case QEvent::MouseButtonRelease: + { mouseReleaseEvent((QMouseEvent *)e); break; + } case QEvent::MouseMove: { if (watched != this) @@ -513,6 +601,15 @@ bool CDesignerView::eventFilter(QObject *watched, QEvent *e) mouseMoveEvent(&ee); //return true; } + break; + } + case QEvent::MouseButtonPress: + { + if (watched == this) + { + mousePressEvent((QMouseEvent *)e); + } + break; } default: break; @@ -535,16 +632,19 @@ void CDesignerView::getPropertyList(std::list< std::pair > &p void CDesignerView::setPropertyValue(const QString &name, QVariant value) { + QSettings settings(QLatin1String("IOT_HMI"), QLatin1String("Designer")); CGraphView::setPropertyValue(name, value); if (name == tr("显示网格")) { m_pGraphWnd->m_pGridAction->setChecked(value.toBool()); setGridLine(value.toBool(), true); + settings.setValue("isGrid", value.toBool()); return; } else if (name == tr("网格间距")) { setGridSpace(value.toInt(), true); + settings.setValue("gridSpace", value.toInt()); return; } else if (name == tr("网格颜色")) @@ -553,6 +653,7 @@ void CDesignerView::setPropertyValue(const QString &name, QVariant value) int tempcolor = color.rgb(); tempcolor = tempcolor & 0x00ffffff; setGridLineColor(tempcolor); + settings.setValue("gridColor", tempcolor); } } @@ -606,22 +707,7 @@ void CDesignerView::drawGridLine(QPainter *pDC, QRect &rect) pDC->save(); pDC->setBrush(Qt::NoBrush); - if (wndType == AppMode::IconMode) - { - pen.setColor(m_gridLineColor); - pen.setWidth(0); - pDC->setPen(pen); - step = getGridSpace(); - for (i = rect1.left() / step; i <= rect1.right() / step; i++) - { - for (j = rect1.top() / step; j <= rect1.bottom() / step; j++) - { - pDC->drawPoint(i * step , j * step); - } - } - } - - if(wndType == AppMode::DesignerMode) + if (wndType == AppMode::IconMode || wndType == AppMode::DesignerMode || wndType == AppMode::ElfMode) { pen.setColor(m_gridLineColor); pen.setWidth(0); diff --git a/platform/src/gui/hmi/CDesignerView.h b/platform/src/gui/hmi/CDesignerView.h index 94461e43..5098256a 100644 --- a/platform/src/gui/hmi/CDesignerView.h +++ b/platform/src/gui/hmi/CDesignerView.h @@ -83,6 +83,9 @@ protected: void mouseMoveEvent(QMouseEvent *); void keyPressEvent(QKeyEvent *event); void contextMenuEvent(QContextMenuEvent *e); + void dragEnterEvent(QDragEnterEvent *event); + void dropEvent(QDropEvent *event); + void dragMoveEvent(QDragMoveEvent *event); private: bool m_hasGrid; @@ -90,6 +93,8 @@ private: bool m_orthogonal; int m_gridSpace; int m_gridLineColor; + unsigned char m_firstType; + QString m_firstName; }; #endif // CDESIGNERVIEW_H diff --git a/platform/src/gui/hmi/CDesignerWnd.cpp b/platform/src/gui/hmi/CDesignerWnd.cpp index 1ee9db94..5aa4eabe 100644 --- a/platform/src/gui/hmi/CDesignerWnd.cpp +++ b/platform/src/gui/hmi/CDesignerWnd.cpp @@ -1,10 +1,10 @@ #include #include #include +#include "pub_utility_api/FileUtil.h" #include "CDesignerWnd.h" #include "CDesignerScene.h" #include "CDesignerView.h" -#include "CDrawObjDatabase.h" #include "CExtern.h" #include "CUndoCommand.h" #include "CScaleBar.h" @@ -15,6 +15,8 @@ #include "../GraphShape/include/CGroupShape.h" #include "../GraphShape/include/CWidgetShape.h" #include "../GraphShape/ChartShape/CChartShape.h" +#include "../GraphShape/include/CNewElfShape.h" +#include "../GraphShape/include/CLinkLine.h" #include "../include/propertyeditor.h" #include "../GraphShape/include/CDrawObjFactory.h" #include "../GraphDataAcess/CGraphDataAcess.h" @@ -22,6 +24,7 @@ #include "GraphTool/Retriever/CRetriever.h" #include "../GraphTool/QssEditor/CQssEditor.h" #include "../GraphTool/WebPublish/CWebPublish.h" +#include "../GraphTool/AutoCreateElement/CAutoCreate.h" #include "./dialog/ShapeConfigDialog/CFindReplace.h" #include "./dialog/ShapeConfigDialog/CTextReplacer.h" #include "./dialog/ShapeConfigDialog/CTextShapeEditor.h" @@ -33,7 +36,11 @@ #include "./dialog/hmiConfigDialog/CHmiConfig.h" #include "./dialog/globalConfigDialog/CGlobalConfigDialog.h" #include "./dialog/dataBindCheck/CBindCheckWidget.h" -#include "pub_utility_api/FileUtil.h" +//#include "./dialog/toolBoxTree/CBoxTreeWidget.h" +//#include "./dialog/toolBoxTree/CBoxListView.h" +#include "./dialog/graphTree/CGraphFileTree.h" +#include "../GraphTool/ToolBoxTree/CBoxTreeWidget.h" +#include "../GraphTool/ToolBoxTree/CBoxListView.h" QMapCDesignerWnd::s_iconTransMap; QMapCDesignerWnd::s_toolOpenMap; @@ -48,6 +55,8 @@ CDesignerWnd::CDesignerWnd(int id, char type, CGraphDoc *doc, } m_pToolBox = NULL; + m_pFileWidget = NULL; + m_pElfBox = NULL; m_pGraphEnv = new CDesignerScene; m_pGraphEnv->setEnvTypeFlag(type); @@ -56,12 +65,16 @@ CDesignerWnd::CDesignerWnd(int id, char type, CGraphDoc *doc, m_pGraphView->setFrameStyle(QFrame::WinPanel | QFrame::Sunken); m_pGraphView->centerOn(0, 0); + m_pos.setX(-1); + m_pos.setY(-1); + setCentralWidget(m_pGraphView); setAttribute(Qt::WA_DeleteOnClose); //InitScript(); m_pRetriever = NULL; + m_pAutoCreate = NULL; m_pActionGroupTools = NULL; m_currentTool = -1; m_pShowStateGroup = NULL; @@ -74,7 +87,9 @@ CDesignerWnd::CDesignerWnd(int id, char type, CGraphDoc *doc, setupToolbars(); setupMenubar(); setupToolOpen(); + setupFileWidget(); setupToolbox(); + setupElfbox(); setupGraphLayers(); setupPropertyEditor(); setDockNestingEnabled(true); @@ -89,7 +104,7 @@ CDesignerWnd::CDesignerWnd(int id, char type, CGraphDoc *doc, connect(m_ScaleBar, SIGNAL(valueChanged(int)), m_pGraphView, SLOT(updateMatrix(int))); connect(m_pGraphView, SIGNAL(matrixChg(float, int, int)), this, SLOT(setScaleValue(float, int,int))); - connect(m_pToolBox, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(onItemDbClicked(QTreeWidgetItem *, int))); +// connect(m_pToolBox, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(onItemDbClicked(QTreeWidgetItem *, int))); } CDesignerWnd::~CDesignerWnd() @@ -101,12 +116,24 @@ CDesignerWnd::~CDesignerWnd() delete m_pGraphView; } m_pGraphView = NULL; + if (m_pToolBox != NULL) { delete m_pToolBox; } - m_pToolBox = NULL; + + if (m_pFileWidget != NULL) + { + delete m_pFileWidget; + } + m_pFileWidget = NULL; + + if (m_pElfBox != NULL) + { + delete m_pElfBox; + } + m_pElfBox = NULL; } CDesignerView *CDesignerWnd::getGraphView() const @@ -146,6 +173,13 @@ void CDesignerWnd::toolSelected(QTreeWidgetItem *treeitem, int column) { return; } + else if (getWndType() == AppMode::ElfMode) + { + if(!isElfSupport(curTool)) + { + return; + } + } m_currentTool = curTool; m_pGraphEnv->createObj(m_currentTool, itemName, typeN, strategy, mark); @@ -191,45 +225,57 @@ bool CDesignerWnd::needSave(const QString &action) void CDesignerWnd::fileNew() { - int ret = 0; if(!needSave(tr("新建"))) { return; } - QMessageBox mb(tr("提醒"), tr("请选择新建类型?"), - QMessageBox::Warning, QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, - QMessageBox::Cancel | QMessageBox::Escape, 0); + QMessageBox mb(QMessageBox::Warning, tr("提醒"), tr("请选择新建类型?")); + QPushButton * bt1 = mb.addButton(QMessageBox::Yes); + mb.addButton(QMessageBox::No); + mb.addButton(QMessageBox::Abort); + QPushButton * bt2 = mb.addButton(QMessageBox::Cancel); + mb.setDefaultButton(bt1); + mb.setEscapeButton(bt2); mb.setButtonText(QMessageBox::Yes, tr("新建图形")); mb.setButtonText(QMessageBox::No, tr("新建图元")); + mb.setButtonText(QMessageBox::Abort, tr("精灵图元")); mb.setButtonText(QMessageBox::Cancel, tr("取消")); int retmb = mb.exec(); - switch (retmb) - { - case QMessageBox::Yes: - ret = 1; - break; - case QMessageBox::No: - ret = 2; - break; - case QMessageBox::Cancel: + if(retmb == QMessageBox::Cancel){ return; } m_graphPathName = ""; m_pGraphEnv->reset(); - if (ret == 1) + switch (retmb) + { + case QMessageBox::Yes: { m_pGraphEnv->setEnvRect(QRect(0, 0, 1680, 1050)); InitGUI(AppMode::DesignerMode); + break; } - else + case QMessageBox::No: { m_pGraphEnv->getCurGraphHead()->setGraphType(ICON_TYPE); m_pGraphEnv->getCurGraphHead()->changePlaneNum(1); m_pGraphEnv->getCurGraphHead()->setIconStateNum(4); m_pGraphEnv->setEnvRect(QRect(0, 0, 100, 100)); InitGUI(AppMode::IconMode); + break; + } + case QMessageBox::Abort: + { + m_pGraphEnv->getCurGraphHead()->setGraphType(ELF_TYPE); + m_pGraphEnv->getCurGraphHead()->changePlaneNum(1); + m_pGraphEnv->getCurGraphHead()->setIconStateNum(1); + m_pGraphEnv->setEnvRect(QRect(0, 0, 300, 300)); + InitGUI(AppMode::ElfMode); + break; + } + default: + return; } setCaption(""); @@ -261,10 +307,9 @@ void CDesignerWnd::fileOpen() return; } - QString path; - CBaseInstance()->getPathName(CBase::PATH_TYPE_PIC, path); + QString path = getWndBasePath(); QString fileName = QFileDialog::getOpenFileName(this, tr("打开文件"), - path, tr("pic (*.glx *.ilx)")); + path, tr("pic (*.glx *.ilx *.elx)")); if (fileName.isEmpty()) { return; @@ -275,6 +320,17 @@ void CDesignerWnd::fileOpen() m_pEditRedoAction->setDisabled(false); } +void CDesignerWnd::fileOpenByTree(const QString &fileName) +{ + if(!needSave(tr("打开"))) + { + return; + } + fileOpen(fileName); + m_pEditUndoAction->setDisabled(false); + m_pEditRedoAction->setDisabled(false); +} + int CDesignerWnd::fileOpen(const QString &fileName) { if (fileName.isEmpty()) @@ -320,6 +376,10 @@ int CDesignerWnd::fileOpen(const QString &fileName) { InitGUI(AppMode::DesignerMode); } + else if (m_pGraphEnv->getCurGraphHead()->getGraphType() == ELF_TYPE) + { + InitGUI(AppMode::ElfMode); + } int backColor = m_pGraphEnv->getCurGraphHead()->getBackColor(); QString backPixName = m_pGraphEnv->getCurGraphHead()->getBackPixmapName(); if (backPixName.isEmpty() || backPixName == "0") @@ -353,18 +413,25 @@ int CDesignerWnd::fileSave(int saveType) { QString path, ftype, posglx, fileName; - if (getWndType() == AppMode::DesignerMode) + char wndType = getWndType(); + if (wndType == AppMode::DesignerMode) { CBaseInstance()->getPathName(CBase::PATH_TYPE_PIC, path); posglx = ".glx"; ftype = QString("pic(*%1)").arg(posglx); } - else + else if(wndType == AppMode::IconMode) { CBaseInstance()->getPathName(CBase::PATH_TYPE_ICON, path); posglx = ".ilx"; ftype = QString("ico(*%1)").arg(posglx); } + else if(wndType == AppMode::ElfMode) + { + CBaseInstance()->getPathName(CBase::PATH_TYPE_ELF, path); + posglx = ".elx"; + ftype = QString("elf(*%1)").arg(posglx); + } if (saveType == 0) { @@ -503,6 +570,113 @@ void CDesignerWnd::iconElfSave() return; } +void CDesignerWnd::elfSave() +{ + if (!m_pGraphEnv || m_pGraphEnv->selectedItems().count() < 1) + { + return; + } + QString strFilePath; + QString strPostfix = ".elx"; + QString strFileType = QString("elf(*%1)").arg(strPostfix); + CBaseInstance()->getPathName(CBase::PATH_TYPE_ELF, strFilePath); + + QString strIconFileName; + strIconFileName = QFileDialog::getSaveFileName(this, tr("保存文件"), strFilePath, strFileType); + if(strIconFileName.isEmpty()) + { + return; + } + + QString coreName; + QRegExp exp("[\\d|\\w|\u4e00-\u9fa5]+"); + CBaseInstance()->getCoreNameByPathName(strIconFileName, coreName); + if(((coreName[0].isDigit()) || !exp.exactMatch(coreName)) && (strPostfix == ".ilx")) + { + QMessageBox::warning(this, tr("提示"), tr("非法的命名")); + return; + } + + if (strIconFileName.indexOf(strPostfix) < 0) + { + strIconFileName += strPostfix; + } + if (strIconFileName.length() <= 4) + { + return; + } + + if (!strIconFileName.isEmpty()) + { + QList items = m_pGraphEnv->selectedItems(); + QList itemList; + QList linkList; + QMap idNewMap; + QMap linkMap; + CShape *tmp; + int objId = 1; + foreach (QGraphicsItem *item, items) { + CShape *shape = dynamic_cast(item); + if(!shape) + { + continue; + } + if(!isElfSupport(shape->getObjType())) + { + continue; + } + tmp = shape->clone(); + if(tmp) + { + idNewMap[shape->getObjId()] = tmp; + if(shape->getObjType() == OBJTYPE_RELATIVE) + { + CLinkLine * link = dynamic_cast(shape); + if((link->getStartDev() && link->getStartDev()->getObjType() == OBJTYPE_RELATIVE) || + (link->getEndDev() && link->getEndDev()->getObjType() == OBJTYPE_RELATIVE)) + { + linkList.push_back(shape); + } + else + { + linkList.push_front(shape); + } + linkMap[shape] = dynamic_cast(tmp); + } + else + { + tmp->setObjId(objId++); + itemList.push_back(tmp); + } + } + } + for(int n=0; n < linkList.size(); n++){ + CLinkLine * link = dynamic_cast(linkList[n]); + QMap::iterator it1 = idNewMap.find(link->getStartDevId()); + if(it1 == idNewMap.end()) + { + delete linkMap[link]; + continue; + } + QMap::iterator it2 = idNewMap.find(link->getEndDevId()); + if(it2 == idNewMap.end()) + { + delete linkMap[link]; + continue; + } + linkMap[link]->initLink(it1.value(), it2.value(), link->getStartDevPin(), link->getEndDevPin()); + linkMap[link]->setPos(0,0); + linkMap[link]->setObjId(objId++); + itemList.push_back(linkMap[link]); + } + if(itemList.size()) + { + m_pGraphEnv->elfSave(strIconFileName, itemList); + } + qDeleteAll(itemList); + } +} + void CDesignerWnd::fileNewGDWin() { if(!needSave()) @@ -516,9 +690,9 @@ void CDesignerWnd::fileNewGDWin() void CDesignerWnd::fileNewTIDWin() { QString fileName = "", pathName = ""; - if(m_pToolBox->currentItem()) + fileName = m_pToolBox->currentName(); + if(!fileName.isEmpty()) { - fileName = m_pToolBox->currentItem()->data(0, Qt::UserRole + 3).toString(); fileName += ".ilx"; CBaseInstance()->getIconPathNameByIconName(fileName, pathName); } @@ -577,6 +751,20 @@ void CDesignerWnd::openTextReplaceDlg() CTextShape *pTextObj = dynamic_cast(obj); textList.append(pTextObj); } + else if(OBJTYPE_ELF == obj->getObjType() || OBJTYPE_MERGE == obj->getObjType()) + { + CGroupShape *elfObj = dynamic_cast(obj); + QList * childList = elfObj->getMergeListPtr(); + QList::iterator it = childList->begin(); + for(; it != childList->end(); it++) + { + if(OBJTYPE_STRING == (*it)->getObjType() || OBJTYPE_POKE == (*it)->getObjType() || OBJTYPE_DBDATA == (*it)->getObjType()) + { + CTextShape *pTextObj = dynamic_cast(*it); + textList.append(pTextObj); + } + } + } } m_textReplacer->setListTextShpe(textList); @@ -591,7 +779,7 @@ void CDesignerWnd::openReplaceDlg() foreach (QGraphicsItem * item, items) { CShape *pObj = dynamic_cast(item); - if(pObj && OBJTYPE_STRING != pObj->getObjType()) + if(pObj && (OBJTYPE_STRING != pObj->getObjType() && OBJTYPE_ELF != pObj->getObjType())) { isReplaceText = false; break; @@ -612,6 +800,21 @@ void CDesignerWnd::openReplaceDlg() if(pTextObj) { listTextShape.append(pTextObj); + continue; + } + CGroupShape * pGroupObj = dynamic_cast(item); + if(pGroupObj) + { + QList * childList = pGroupObj->getMergeListPtr(); + QList::iterator it = childList->begin(); + for(; it != childList->end(); it++) + { + pTextObj = dynamic_cast(*it); + if(pTextObj) + { + listTextShape.append(pTextObj); + } + } } } @@ -662,7 +865,7 @@ void CDesignerWnd::updateReplaceInfo(CShape *obj) void CDesignerWnd::openScriptForm() { - ScriptForm form; + ScriptForm form(this); form.setContentText(m_pGraphEnv->getCurGraphHead()->getScript()); form.exec(); bool c = form.textChanged(); @@ -692,6 +895,30 @@ void CDesignerWnd::showToolbox(bool show) } } + +void CDesignerWnd::showFileWidget(bool show) +{ + if (show) + { + m_pFileDockWnd->show(); + } + else + { + m_pFileDockWnd->hide(); + } +} + +void CDesignerWnd::showElfbox(bool show) +{ + if (show) + { + m_pElfDockWnd->show(); + } + else + { + m_pElfDockWnd->hide(); + } +} void CDesignerWnd::slotItemClicked(QTreeWidgetItem *item, int column) { Q_UNUSED(column) @@ -713,6 +940,44 @@ void CDesignerWnd::slotItemClicked(QTreeWidgetItem *item, int column) } } +void CDesignerWnd::slotListItemClicked(const DrawObjDatabaseRecord *record) +{ + if (qApp->mouseButtons() == Qt::LeftButton) + { + updateCommProperty(); + + int curTool = record->toolType; + QString typeN = record->typeSub; + QString mark = record->mark; + QString strategy = record->strategy; + QString itemName = record->name; + + if (getWndType() == AppMode::IconMode && curTool > OBJTYPE_PIN) + { + return; + } + else if (getWndType() == AppMode::ElfMode) + { + if(!isElfSupport(curTool)) + { + return; + } + } + + m_currentTool = curTool; + m_pGraphEnv->createObj(m_currentTool, itemName, typeN, strategy, mark); + qDebug("currentTool is %d ,item=%s!", m_currentTool, itemName.toLocal8Bit().data()); + } + else if (qApp->mouseButtons() == Qt::RightButton) + { + if(sender()->objectName() == "elflist") + { + return; + } + showTreeMenu(record->toolType); + } +} + void CDesignerWnd::loadIconTrans() { if(!s_iconTransMap.isEmpty()) @@ -1007,7 +1272,7 @@ void CDesignerWnd::group() //QMessageBox::warning(this, tr("错误"), tr("图表和控件图元不允许组合")); } - if(obj->getObjType() == OBJTYPE_MERGE) + if(obj->getObjType() == OBJTYPE_MERGE || obj->getObjType() == OBJTYPE_ELF) { continue; //QMessageBox::warning(this, tr("错误"), tr("不允许嵌套组合")); @@ -1655,6 +1920,11 @@ void CDesignerWnd::setupActions() m_pRetrieverAction->setShortcut(tr("F2")); connect(m_pRetrieverAction, SIGNAL(triggered()), this, SLOT(openSearchDlg())); + CBaseInstance()->getFilePathName(CBase::PATH_TYPE_ICONSET, "batchCreate.png", iconbuf); + m_pAutoCreateAction = new QAction(QPixmap(iconbuf), tr("批量生成图元"), this); + connect(m_pAutoCreateAction, SIGNAL(triggered()), this, SLOT(openAutoCreateDlg())); + + m_pClearTagAction = new QAction(QPixmap(iconbuf), tr("清空联库"), this); connect(m_pClearTagAction, SIGNAL(triggered()), this, SLOT(clearTagNames())); @@ -1670,6 +1940,16 @@ void CDesignerWnd::setupActions() m_pWinOpenToolboxAction->setChecked(true); connect(m_pWinOpenToolboxAction, SIGNAL(toggled(bool)), this, SLOT(showToolbox(bool))); + m_pWinOpenFileWidgetAction = new QAction(QPixmap(iconbuf), tr(g_wnd_file_widget), this); + m_pWinOpenFileWidgetAction->setCheckable(true); + m_pWinOpenFileWidgetAction->setChecked(true); + connect(m_pWinOpenFileWidgetAction, SIGNAL(toggled(bool)), this, SLOT(showFileWidget(bool))); + + m_pWinOpenElfboxAction = new QAction(QPixmap(iconbuf), tr(g_wnd_elfbox), this); + m_pWinOpenElfboxAction->setCheckable(true); + m_pWinOpenElfboxAction->setChecked(true); + connect(m_pWinOpenElfboxAction, SIGNAL(toggled(bool)), this, SLOT(showElfbox(bool))); + //CBaseInstance()->getFilePathName(PATH_TYPE_ICONSET, "grh_open_grh_prop.png", iconbuf); m_pWinPropertyEditorAction = new QAction(QPixmap(iconbuf), tr(g_property_editor), this); m_pWinPropertyEditorAction->setCheckable(true); @@ -1875,6 +2155,7 @@ void CDesignerWnd::setupToolbars() m_pEditToolBar->addAction(m_pLevelDownAction); m_pEditToolBar->addAction(m_pEditForwardAction); m_pEditToolBar->addAction(m_pEditBackAction); + m_pEditToolBar->addAction(m_pAutoCreateAction); m_pAlignToolBar = addToolBar(tr(g_align_tool)); m_pAlignToolBar->addAction(m_pAlignLeftAction); @@ -1923,22 +2204,26 @@ void CDesignerWnd::setupToolbars() void CDesignerWnd::onStatusBarBtnClicked(QAction *action) { + QSettings settings(QLatin1String("IOT_HMI"), QLatin1String("Designer")); QString txt = action->text(); if (txt == "栅格") { bool flag = m_pGraphView->hasGridLine(); m_pGraphView->setGridLine(!flag); onShapeStateChanged(); + settings.setValue("isGrid", !flag); } else if (txt == "捕捉") { bool flag = m_pGraphView->isCatchMode(); m_pGraphView->setCatchMode(!flag); + settings.setValue("isCatch", !flag); } else if (txt == "正交") { bool flag = m_pGraphView->isOrthMode(); m_pGraphView->setOrthMode(!flag); + settings.setValue("isOrth", !flag); } } @@ -1956,7 +2241,9 @@ void CDesignerWnd::setupMenubar() m_pWndMenu->addAction(m_pWinNewGDWinAction); m_pWndMenu->addSeparator(); m_pWndMenu->addAction(m_pWinLayerAction); + m_pWndMenu->addAction(m_pWinOpenFileWidgetAction); m_pWndMenu->addAction(m_pWinOpenToolboxAction); + m_pWndMenu->addAction(m_pWinOpenElfboxAction); m_pWndMenu->addAction(m_pWinPropertyEditorAction); m_pWndMenu->addAction(m_pWinDataBindEditorAction); m_pWndMenu->addAction(m_pWinBindCheckEditorAction); @@ -2073,6 +2360,64 @@ void CDesignerWnd::setupGraphLayers() connect(m_pRemoveGraphLayoutBtn, SIGNAL(clicked()), this, SLOT(onRemovePlane())); } +void CDesignerWnd::setupFileWidget() +{ + m_pFileDockWnd = new QDockWidget(tr(g_wnd_file_widget), this); + m_pFileDockWnd->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); + addDockWidget(Qt::LeftDockWidgetArea, m_pFileDockWnd); + m_pFileWidget = new CGraphFileTree(m_pFileDockWnd); + m_pFileDockWnd->setWidget(m_pFileWidget); + m_pFileDockWnd->setMinimumWidth(270); + m_pFileDockWnd->setMinimumHeight(95); +// resizeDocks({ m_pFileDockWnd }, { 270 }, Qt::Horizontal); //在qt5中不能立即生效 +// resizeDocks({ m_pFileDockWnd }, { 95 }, Qt::Vertical); + + connect(m_pFileDockWnd, &QDockWidget::visibilityChanged, this, &CDesignerWnd::updateFileWidgetAction); + connect(m_pFileWidget, SIGNAL(sigFileClicked(QString)), this, SLOT(fileOpenByTree(QString))); +} + +void CDesignerWnd::setupElfbox() +{ + m_pElfDockWnd = new QDockWidget(tr(g_wnd_elfbox), this); + m_pElfDockWnd->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); + addDockWidget(Qt::LeftDockWidgetArea, m_pElfDockWnd); + m_pElfBox = new CBoxTreeWidget(m_pElfDockWnd); + m_pElfBox->setHeaderLabels(QStringList()<<""); + m_pElfDockWnd->setWidget(m_pElfBox); + + connect(m_pElfBox, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(toolSelected(QTreeWidgetItem *, int))); + connect(m_pElfDockWnd, &QDockWidget::visibilityChanged, this, &CDesignerWnd::updateElfBoxAction); + + QTreeWidgetItem *tb2 = new QTreeWidgetItem(m_pElfBox); + tb2->setText(0, tr("精灵图元")); + tb2->setData(0, Qt::UserRole + 3, "精灵图元"); + CBoxListView * listView = m_pElfBox->addListView(tb2, false); //新键的精灵图元无法选择图片,只能用默认的图片所以直接用文字展示 + listView->setObjectName("elflist"); + connect(listView, &CBoxListView::itemPressed, this, &CDesignerWnd::slotListItemClicked); + + QString elfPath; + CBaseInstance()->getPathName(CBase::PATH_TYPE_ELF, elfPath); + QDir dir(elfPath); + QFileInfoList fileList = dir.entryInfoList(QDir::Files | QDir::NoSymLinks); + foreach (QFileInfo file, fileList) { + DrawObjDatabaseRecord * record = new DrawObjDatabaseRecord(); + record->name = file.baseName(); + record->toolType = OBJTYPE_ELF; + record->icon = new QIcon(record->iconSet); + listView->addWidget(record); + DrawObjDatabase::append(record); + } + m_pElfBox->adjustSubListSize(tb2); + //如果 listWidget 的内容为空,隐藏右箭头 + if (listView->model()->rowCount() == 0) { + tb2->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicator); + } else { + tb2->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator); + } + tabifyDockWidget(m_pToolsDockWnd, m_pElfDockWnd); + m_pToolsDockWnd->raise(); +} + void CDesignerWnd::updateProperty(const QString &name, const QVariant &value, bool sub) { Q_UNUSED(sub) @@ -2183,7 +2528,7 @@ void CDesignerWnd::graphLayersItemSelectionChanged() QList itemList = m_pGraphLayersTree->selectedItems(); if(!itemList.isEmpty()) { - if(AppMode::DesignerMode == getWndType()) + if(AppMode::DesignerMode == getWndType() || AppMode::ElfMode == getWndType()) { if(itemList.size() == 1 && m_pGraphLayersTree->isTopLevelItem(itemList.first())) { @@ -2239,7 +2584,7 @@ void CDesignerWnd::graphEnvItemSelectionChanged() QModelIndex parent; QTreeWidgetItem * pTopLevelItem = NULL; QList listSelectionItem = m_pGraphEnv->selectedItems(); - if(AppMode::DesignerMode == getWndType()) + if(AppMode::DesignerMode == getWndType() || AppMode::ElfMode == getWndType()) { parent = m_pGraphLayersTree->model()->index(m_pGraphEnv->getCurPlane(), 0); pTopLevelItem = m_pGraphLayersTree->topLevelItem(m_pGraphEnv->getCurPlane()); @@ -2347,7 +2692,7 @@ void CDesignerWnd::planeChange(int plane) void CDesignerWnd::initGraphLayers() { m_pGraphLayersTree->clear(); - if (getWndType() == AppMode::DesignerMode) + if (getWndType() == AppMode::DesignerMode || getWndType() == AppMode::ElfMode) { m_pGraphLayerDockWnd->setWindowTitle(tr("图层")); int plane_nums = m_pGraphEnv->getCurGraphHead()->getPlaneNum(); @@ -2426,28 +2771,29 @@ void CDesignerWnd::initGraphLayers() } } -void CDesignerWnd::addLayout() +void CDesignerWnd::addLayout(int plane) { if(AppMode::DesignerMode == getWndType()) { - QString name; int nums = m_pGraphEnv->getCurGraphHead()->getPlaneNum(); - if(m_pGraphEnv->getAllShowingPlane().count() < nums + 1) { QMessageBox::warning(this, tr("警告"), tr("图层数量已达到最大值,不允许继续添加图层!")); return; } - m_pGraphEnv->getCurGraphHead()->changePlaneNum(nums + 1); - name = QString(tr("图层%1").arg(nums)); - m_pGraphEnv->getCurGraphHead()->setPlaneName(nums, name); - QTreeWidgetItem * item = new QTreeWidgetItem(m_pGraphLayersTree, QStringList() << name); + + m_pGraphEnv->getCurGraphHead()->addPlane(plane); + QString name = QString(tr("图层%1").arg(plane)); + m_pGraphEnv->getCurGraphHead()->setPlaneName(plane, name); + QTreeWidgetItem * item = new QTreeWidgetItem(QStringList() << name); item->setCheckState(0, Qt::Checked); item->setFlags(item->flags() | Qt::ItemIsEditable); - m_pGraphLayersTree->addTopLevelItem(item); + m_pGraphLayersTree->insertTopLevelItem(plane, item); + m_pGraphEnv->moveShowPlaneRight(plane); QVector showingVec = m_pGraphEnv->getAllShowingPlane(); - showingVec[nums] = true; + showingVec[plane] = true; m_pGraphEnv->setAllShowingPlane(showingVec, true); + m_pGraphEnv->setCurPlane(plane); m_pGraphLayersTree->clearSelection(); item->setSelected(true); } @@ -2459,18 +2805,19 @@ void CDesignerWnd::addLayout() return; } - m_pGraphEnv->getCurGraphHead()->setIconStateNum(nums + 1); - QString name = QString(tr("状态%1").arg(nums + 1)); - m_pGraphEnv->getCurGraphHead()->setIconStateName(nums, name); - QTreeWidgetItem * item = new QTreeWidgetItem(m_pGraphLayersTree, QStringList() << name); + m_pGraphEnv->getCurGraphHead()->insertIconState(plane); + QString name = QString(tr("状态%1").arg(plane+1)); + m_pGraphEnv->getCurGraphHead()->insertIconStateName(plane, name); + m_pGraphEnv->setCurLevel(plane); + QTreeWidgetItem * item = new QTreeWidgetItem(QStringList() << name); item->setFlags(item->flags() | Qt::ItemIsEditable); - m_pGraphLayersTree->addTopLevelItem(item); + m_pGraphLayersTree->insertTopLevelItem(plane, item); m_pGraphLayersTree->clearSelection(); item->setSelected(true); } } -void CDesignerWnd::removeLayout() +void CDesignerWnd::removeLayout(int plane) { if(AppMode::DesignerMode == getWndType()) { @@ -2479,10 +2826,11 @@ void CDesignerWnd::removeLayout() { return; } - m_pGraphEnv->getCurGraphHead()->changePlaneNum(--nums); - m_pGraphLayersTree->takeTopLevelItem(m_pGraphLayersTree->topLevelItemCount() - 1); + m_pGraphEnv->getCurGraphHead()->delPlane(plane); + m_pGraphEnv->moveShowPlaneLeft(plane); + m_pGraphLayersTree->takeTopLevelItem(plane); m_pGraphLayersTree->clearSelection(); - m_pGraphLayersTree->topLevelItem(nums - 1)->setSelected(true); + m_pGraphLayersTree->topLevelItem(m_pGraphEnv->getCurPlane())->setSelected(true); } else if(AppMode::IconMode == getWndType()) { @@ -2491,10 +2839,10 @@ void CDesignerWnd::removeLayout() { return; } - m_pGraphEnv->getCurGraphHead()->removeLastIconState(--nums); - m_pGraphLayersTree->takeTopLevelItem(m_pGraphLayersTree->topLevelItemCount() - 1); + m_pGraphEnv->getCurGraphHead()->removeIconState(plane); + m_pGraphLayersTree->takeTopLevelItem(plane); m_pGraphLayersTree->clearSelection(); - m_pGraphLayersTree->topLevelItem(nums - 1)->setSelected(true); + m_pGraphLayersTree->topLevelItem(m_pGraphEnv->getCurLevel())->setSelected(true); } } @@ -2504,20 +2852,45 @@ void CDesignerWnd::InitGUI(int type) setWndType(type); m_pGraphView->resetMatrix(); + QSettings settings(QLatin1String("IOT_HMI"), QLatin1String("Designer")); m_pGraphView->setGridSpace(10); - m_pGraphView->setGridLineColor(0); - m_pGridAction->setChecked(false); - m_pCatchAction->setChecked(false); + m_pGridAction->setChecked(true); + m_pCatchAction->setChecked(true); m_pOrthAction->setChecked(true); - m_pGraphView->setGridLine(false); - m_pGraphView->setCatchMode(false); - m_pGraphView->setOrthMode(true); + QVariant p = settings.value("isGrid"); + if(p.isValid()) + { + m_pGridAction->setChecked(p.toBool()); + m_pGraphView->setGridLine(p.toBool()); + } + p = settings.value("isCatch"); + if(p.isValid()) + { + m_pCatchAction->setChecked(p.toBool()); + m_pGraphView->setCatchMode(p.toBool()); + } + p = settings.value("isOrth"); + if(p.isValid()) + { + m_pOrthAction->setChecked(p.toBool()); + m_pGraphView->setOrthMode(p.toBool()); + } + p = settings.value("gridSpace"); + if(p.isValid()) + { + m_pGraphView->setGridSpace(p.toInt()); + } + p = settings.value("gridColor"); + if(p.isValid()) + { + m_pGraphView->setGridLineColor(p.toInt()); + } m_pGraphEnv->setEnvTypeFlag(type); QRect rc = m_pGraphEnv->getCurGraphHead()->getGraphRect(); m_pGraphEnv->setEnvRect(rc); int scale_value = 1; - if (type == 1) + if (type == ICON_TYPE) { QVector showing_vec; showing_vec.fill(true, MAX_PLANE); @@ -2528,6 +2901,7 @@ void CDesignerWnd::InitGUI(int type) m_ScaleBar->setValue(10); initGraphLayers(); onShapeStateChanged(); + m_pFileWidget->reload(getWndBasePath()); } void CDesignerWnd::setCaption(const QString &title) @@ -2549,20 +2923,8 @@ void CDesignerWnd::setupToolbox() m_pToolsDockWnd = new QDockWidget(tr(g_wnd_toolbox), this); m_pToolsDockWnd->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); addDockWidget(Qt::LeftDockWidgetArea, m_pToolsDockWnd); - m_pToolBox = new QTreeWidget(m_pToolsDockWnd); + m_pToolBox = new CBoxTreeWidget(m_pToolsDockWnd); m_pToolBox->setHeaderLabels(labels); - m_pToolBox->setStyleSheet("QTreeView::item{height:26px;}"); - - QFont font = qApp->font(); - font.setPointSize(font.pointSize() + 1); - m_pToolBox->setFont(font); - - QPalette palette = m_pToolBox->palette(); - palette.setColor(QPalette::Shadow, Qt::blue); - m_pToolBox->setIconSize(QSize(30, 30)); - m_pToolBox->setPalette(palette); - m_pToolBox->setAutoFillBackground(true); - m_pToolBox->header()->setVisible(false); m_pToolsDockWnd->setWidget(m_pToolBox); connect(m_pToolBox, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(toolSelected(QTreeWidgetItem *, int))); @@ -2582,6 +2944,9 @@ void CDesignerWnd::setupToolbox() tb2->setText(0, s_iconTransMap[grp]); tb2->setData(0, Qt::UserRole + 3, grp); + CBoxListView * listView = m_pToolBox->addListView(tb2, true); + connect(listView, &CBoxListView::itemPressed, this, &CDesignerWnd::slotListItemClicked); + for (int i = 0; i < DrawObjDatabase::count(); ++i) { if (DrawObjDatabase::group(i) != grp) @@ -2589,18 +2954,15 @@ void CDesignerWnd::setupToolbox() continue; } - QTreeWidgetItem *b = new QTreeWidgetItem(); - QString atext = DrawObjDatabase::className(i); - - b->setText(0, s_iconTransMap[atext]); - b->setData(0, Qt::WhatsThisRole, DrawObjDatabase::curToolType(i)); - b->setData(0, Qt::UserRole, DrawObjDatabase::curToolTypeN(i)); - b->setData(0, Qt::UserRole + 1, DrawObjDatabase::mark(i)); - b->setData(0, Qt::UserRole + 2, DrawObjDatabase::strategy(i)); - b->setData(0, Qt::UserRole + 3, atext); - b->setIcon(0, DrawObjDatabase::iconSet(i)); - tb2->insertChild(0, b); + DrawObjDatabaseRecord * record = DrawObjDatabase::at(i); + if(record) + { + record->name = s_iconTransMap[record->name]; + DrawObjDatabase::iconSet(i); + listView->addWidget(record); + } } + m_pToolBox->adjustSubListSize(tb2); } } @@ -2659,6 +3021,12 @@ void CDesignerWnd::addIcon(QTreeWidgetItem *item, QString fileName) return; } + if(m_pToolBox->isExist(fileCoreName)) + { + QMessageBox::warning(this, tr("警告"), tr("当前图元名称已存在,不允许重复添加!")); + return; + } + QDomElement headItem; headItem = xmls.GetChild("head"); int type = 0, common = 0; @@ -2691,38 +3059,6 @@ void CDesignerWnd::addIcon(QTreeWidgetItem *item, QString fileName) iconInfo->remove(); } - if(pItem->parent()) - { - for(int nIndex(0); nIndex < pItem->parent()->childCount(); nIndex++) - { -// if(fileCoreName == pItem->parent()->child(nIndex)->text(0)) - if(fileCoreName == pItem->parent()->child(nIndex)->data(0, Qt::UserRole + 3).toString()) - { - QMessageBox::warning(this, tr("警告"), tr("当前图元名称已存在,不允许重复添加!")); - delete newItem; - return; - } - } - pItem->parent()->addChild(newItem); - } - else - { - if(pItem->text(0) == tr("精灵图元")) - { - for(int nIndex(0); nIndex < pItem->childCount(); nIndex++) - { - if(fileCoreName == pItem->child(nIndex)->text(0)) - { - delete newItem; - return; - } - } - } - - pItem->addChild(newItem); - } - - QString sysPath, treeItemIcon = "default.png"; CBaseInstance()->getPathName(CBase::PATH_TYPE_SYS, sysPath); QString toolName = sysPath + "toolbox.xml"; @@ -2736,17 +3072,52 @@ void CDesignerWnd::addIcon(QTreeWidgetItem *item, QString fileName) xmls1.PutValue("icon", treeItemIcon); xmls1.PutValue("common", common); xmls1.CLOSE(); + + CBoxListView * listView; + if(pItem->parent() == NULL) + { + if(pItem->childCount() == 0) + { + listView = m_pToolBox->addListView(pItem, true); + connect(listView, &CBoxListView::itemPressed, this, &CDesignerWnd::slotListItemClicked); + listView->setFont(m_pToolBox->font()); + } + else + { + listView = m_pToolBox->getListView(pItem->child(0)); + } + } + else + { + listView = m_pToolBox->getListView(pItem); + } + + if(listView) + { + DrawObjDatabaseRecord * record = new DrawObjDatabaseRecord(); + record->name = fileCoreName; + record->toolType = type; + record->icon = new QIcon(record->iconSet); + listView->addWidget(record); + DrawObjDatabase::append(record); + } } void CDesignerWnd::delIcon() { QString fileName, groupName, itemName; QTreeWidgetItem *pItem = m_pToolBox->currentItem(); - itemName = pItem->data(0, Qt::UserRole + 3).toString(); if (pItem->parent() == NULL) { return; } + CBoxListView * listView = m_pToolBox->getListView(pItem); + if (listView == NULL) + { + return; + } + DrawObjDatabaseRecord * record = listView->selectedRecord(); + itemName = record->name; groupName = pItem->parent()->data(0, Qt::UserRole + 3).toString(); QString sysPath; CBaseInstance()->getPathName(CBase::PATH_TYPE_SYS, sysPath); @@ -2761,7 +3132,7 @@ void CDesignerWnd::delIcon() groupItem.removeChild(objItem); xmls.CLOSE(); - pItem->parent()->removeChild(pItem); + listView->removeSelectedWidget(); } void CDesignerWnd::addIconGrp() @@ -2884,6 +3255,7 @@ void CDesignerWnd::openSearchDlg() // }); } m_pRetriever->setStatVisible(false); + m_pRetriever->setGroupVisible(false); QList itemList = m_pGraphEnv->selectedItems(); if(!itemList.isEmpty()) { @@ -2905,11 +3277,26 @@ void CDesignerWnd::openSearchDlg() m_pRetriever->setStatVisible(CONNECT_MODE_INST == chart->getConnectMode()); } } + else if(OBJTYPE_ELF == pObj->getObjType()) + { + m_pRetriever->setGroupVisible(true); + } } m_pRetriever->show(); m_pDataBindDockWnd->raise(); } +void CDesignerWnd::openAutoCreateDlg() +{ + if( NULL == m_pAutoCreate) + { + m_pAutoCreate = new CAutoCreate(this); + connect(m_pAutoCreate , &CAutoCreate::signal_createBatchObj , this , &CDesignerWnd::createBatchObject); + } + m_pos = QCursor::pos(); + m_pAutoCreate->show(); +} + void CDesignerWnd::setScaleValue(float scale, int dx, int dy) { Q_UNUSED(dx) @@ -2966,6 +3353,7 @@ void CDesignerWnd::onShapeStateChanged() void CDesignerWnd::onAddPlane() { + int plane = 0; if(AppMode::DesignerMode == getWndType()) { int nums = m_pGraphEnv->getCurGraphHead()->getPlaneNum(); @@ -2974,6 +3362,7 @@ void CDesignerWnd::onAddPlane() QMessageBox::warning(this, tr("警告"), tr("图层数量已达到最大值,不允许继续添加图层!")); return; } + plane = m_pGraphEnv->getCurPlane() + 1; } else if(AppMode::IconMode == getWndType()) { @@ -2983,13 +3372,20 @@ void CDesignerWnd::onAddPlane() QMessageBox::warning(this, tr("警告"), tr("图元状态数量已达到最大值,不允许继续添加图元状态!")); return; } + plane = m_pGraphEnv->getCurLevel() + 1; + } + else if(AppMode::ElfMode == getWndType()) + { + QMessageBox::warning(this, tr("警告"), tr("精灵图元编辑模式下不允许添加图层!")); + return; } - m_pUndoStack->push(new CAddPlaneCommand(this)); + m_pUndoStack->push(new CAddPlaneCommand(plane, this)); } void CDesignerWnd::onRemovePlane() { + int plane = 0; if(AppMode::DesignerMode == getWndType()) { int nums = m_pGraphEnv->getCurGraphHead()->getPlaneNum(); @@ -2998,6 +3394,7 @@ void CDesignerWnd::onRemovePlane() QMessageBox::warning(this, tr("警告"), tr("图层数量至少为1,不允许继续删除图层!")); return; } + plane = m_pGraphEnv->getCurPlane(); } else if(AppMode::IconMode == getWndType()) { @@ -3007,8 +3404,14 @@ void CDesignerWnd::onRemovePlane() QMessageBox::warning(this, tr("警告"), tr("图元状态数量至少为1,不允许继续删除图元状态!")); return; } + plane = m_pGraphEnv->getCurLevel(); } - m_pUndoStack->push(new CRemovePlaneCommand(this)); + else if(AppMode::ElfMode == getWndType()) + { + QMessageBox::warning(this, tr("警告"), tr("精灵图元编辑模式下不允许删除图层!")); + return; + } + m_pUndoStack->push(new CRemovePlaneCommand(plane, this)); } void CDesignerWnd::onItemChanged(QTreeWidgetItem *item, int column) @@ -3017,13 +3420,13 @@ void CDesignerWnd::onItemChanged(QTreeWidgetItem *item, int column) { if(m_pGraphLayersTree->isTopLevelItem(item)) { - if (AppMode::DesignerMode == getWndType()) + if (AppMode::DesignerMode == getWndType() || AppMode::ElfMode == getWndType()) { int currentPlaneIndex = m_pGraphLayersTree->indexOfTopLevelItem(item); QVector showingPlane = m_pGraphEnv->getAllShowingPlane(); if (showingPlane.size() > currentPlaneIndex) { - if(showingPlane[currentPlaneIndex] != item->checkState(column)) + if(showingPlane[currentPlaneIndex] != (item->checkState(column) != Qt::CheckState::Unchecked)) { showingPlane[currentPlaneIndex] = item->checkState(column); m_pGraphEnv->setAllShowingPlane(showingPlane, true); @@ -3055,6 +3458,10 @@ void CDesignerWnd::insertGraphLayersTreeItem(CShape *obj) { layout = obj->getStartLevel(); } + else if(AppMode::ElfMode == getWndType()) + { + layout = obj->getPlane(); + } QTreeWidgetItem * item = m_pGraphLayersTree->topLevelItem(layout); if(item) { @@ -3110,6 +3517,10 @@ void CDesignerWnd::removeGraphLayersTreeItem(CShape *obj) { layout = obj->getStartLevel(); } + else if(AppMode::ElfMode == getWndType()) + { + layout = obj->getPlane(); + } QTreeWidgetItem * item = m_pGraphLayersTree->topLevelItem(layout); if(item) { @@ -3130,6 +3541,20 @@ void CDesignerWnd::updateToolBoxAction(const bool checked) m_pWinOpenToolboxAction->blockSignals(false); } +void CDesignerWnd::updateFileWidgetAction(const bool checked) +{ + m_pWinOpenFileWidgetAction->blockSignals(true); + m_pWinOpenFileWidgetAction->setChecked(checked); + m_pWinOpenFileWidgetAction->blockSignals(false); +} + +void CDesignerWnd::updateElfBoxAction(const bool checked) +{ + m_pWinOpenElfboxAction->blockSignals(true); + m_pWinOpenElfboxAction->setChecked(checked); + m_pWinOpenElfboxAction->blockSignals(false); +} + void CDesignerWnd::updatePropertyEditorAction(const bool checked) { m_pWinPropertyEditorAction->blockSignals(true); @@ -3331,3 +3756,78 @@ void CDesignerWnd::updateShapeDataBind(const QStringList &tagNames) } } } + +QString CDesignerWnd::getWndBasePath() +{ + QString path; + char wndType = getWndType(); + if(wndType == AppMode::IconMode) + { + CBaseInstance()->getPathName(CBase::PATH_TYPE_ICON, path); + } + else if(wndType == AppMode::ElfMode) + { + CBaseInstance()->getPathName(CBase::PATH_TYPE_ELF, path); + } + else + { + CBaseInstance()->getPathName(CBase::PATH_TYPE_PIC, path); + } + return path; +} + +bool CDesignerWnd::isElfSupport(int objType) +{ + if(objType >= OBJTYPE_PIEGRAPH && objType < OBJTYPE_ICON) + { + return false; + } + if(objType == OBJTYPE_CIRCLE_ARC || objType == OBJTYPE_ELLIPSE_ARC || objType == OBJTYPE_PIN || + objType == OBJTYPE_MERGE || objType == OBJTYPE_BEZIER || objType == OBJTYPE_ELF) + { + return false; + } + return true; +} + +void CDesignerWnd::updateRetrieverView(CShape *obj) +{ + if(!obj || !m_pRetriever) + { + return; + } + if(obj->getObjType() == OBJTYPE_ELF) + { + m_pRetriever->setGroupVisible(true); + } + else + { + m_pRetriever->setGroupVisible(false); + } +} + +void CDesignerWnd::createBatchObject(CShape *obj , QList> listInfo, int count , int rowOrCol , int space) +{ + QPoint pos = m_pos; + pos = getGraphView()->mapFromGlobal(pos); + QPointF viewpos = getGraphView()->mapToScene(pos); + m_pGraphView->onGrid(viewpos); + + if (getWndType() == AppMode::IconMode) + { + viewpos = QPointF(0, 0); + } + + if (getGraphView()->IsCursorBeyond(viewpos)) + { + QPoint cgpos(-1, -1); + m_pGraphEnv->createBatchObject(obj , cgpos, listInfo , count , rowOrCol , space); + + } + else + { + QPoint cgpos(int(viewpos.x()), int(viewpos.y())); + m_pGraphEnv->createBatchObject(obj , cgpos, listInfo , count , rowOrCol , space); + + } +} diff --git a/platform/src/gui/hmi/CDesignerWnd.h b/platform/src/gui/hmi/CDesignerWnd.h index 0cbf9d61..32a9de79 100644 --- a/platform/src/gui/hmi/CDesignerWnd.h +++ b/platform/src/gui/hmi/CDesignerWnd.h @@ -10,6 +10,7 @@ #include "CGraphWnd.h" #include "CDesignerScene.h" +#include "../GraphTool/ToolBoxTree/CDrawObjDatabase.h" class CDesignerView; class CDesignerScene; @@ -21,9 +22,11 @@ class CFindReplace; class CTextReplacer; class CDataBindWidget; class CRetriever; +class CAutoCreate; class QssEditor; class CBindCheckWidget; - +class CBoxTreeWidget; +class CGraphFileTree; class CDesignerWnd : public CGraphWnd { Q_OBJECT @@ -54,11 +57,13 @@ public slots: void onItemDbClicked(QTreeWidgetItem *item, int column); void fileNew(); void fileOpen(); + void fileOpenByTree(const QString &fileName); int fileOpen(const QString &fileName); int fileSave(int saveType = 0); int fileSaveAs(); void iconElfSave(); + void elfSave(); void fileNewGDWin(); void fileNewTIDWin(); @@ -67,6 +72,8 @@ public slots: void fileNewGEIdxWin(); void openScriptForm(); void showToolbox(bool show); + void showFileWidget(bool show); + void showElfbox(bool show); void showPropertyEditor(bool show); void showDataBindEditor(bool show); void showBindCheckEditor(bool show); @@ -94,11 +101,13 @@ public slots: void openPropDlg(CShape *obj = NULL); void openAnimationConfigDlg(); void openSearchDlg(); + void openAutoCreateDlg(); void mirrorHorizontal(); void mirrorVertical(); void makeEqualLarge(); void makeEqualSmall(); + int uploadTopoLink(); bool valid(const QMap > &linkIndexMap); void hmiConfig(); @@ -123,6 +132,7 @@ public slots: void graphEnvItemSelectionChanged(); void slotItemClicked(QTreeWidgetItem *item, int column); + void slotListItemClicked(const DrawObjDatabaseRecord *record); void addIcon(QTreeWidgetItem *item = Q_NULLPTR, QString fileName = QString()); void delIcon(); void addIconGrp(); @@ -133,8 +143,8 @@ public slots: void initGraphLayers(); - void addLayout(); - void removeLayout(); + void addLayout(int plane); + void removeLayout(int plane); void onAddPlane(); void onRemovePlane(); @@ -143,6 +153,8 @@ public slots: void removeGraphLayersTreeItem(CShape *obj); void updateToolBoxAction(const bool checked); + void updateFileWidgetAction(const bool checked); + void updateElfBoxAction(const bool checked); void updatePropertyEditorAction(const bool checked); void updateDataBindEditorAction(const bool checked); void updateBindCheckEditorAction(const bool checked); @@ -157,7 +169,11 @@ public slots: void clearTagNames(); void updateShapeDataBind(const QStringList &tagNames); + QString getWndBasePath(); + bool isElfSupport(int objType); + void updateRetrieverView(CShape *obj); + void createBatchObject(CShape *obj , QList> listInfo, int count , int rowOrCol , int space); protected: void closeEvent(QCloseEvent *e); bool needSave(const QString &action = ""); @@ -165,6 +181,7 @@ protected: public: int m_currentTool; bool m_ftModify; + QPoint m_pos; static QMap s_iconTransMap; static QMap s_toolOpenMap; @@ -185,10 +202,14 @@ public: QAction *m_pRetrieverAction; QAction *m_pClearTagAction; + QAction *m_pAutoCreateAction; + QAction *m_pWinToNormalAction; QAction *m_pWinLayerAction; QAction *m_pWinOpenToolboxAction; + QAction *m_pWinOpenFileWidgetAction; + QAction *m_pWinOpenElfboxAction; QAction *m_pWinPropertyEditorAction; QAction *m_pWinDataBindEditorAction; QAction *m_pWinBindCheckEditorAction; @@ -262,6 +283,8 @@ public: QDockWidget *m_pBindCheckDockWnd; QDockWidget *m_pGraphLayerDockWnd; QDockWidget *m_pToolsDockWnd; + QDockWidget *m_pFileDockWnd; + QDockWidget *m_pElfDockWnd; PropertyEditor *m_pPropertyBox; CDataBindWidget *m_pDataBindWidget; @@ -272,8 +295,11 @@ public: CRetriever *m_pRetriever; QLabel *m_positionFrame; CScaleBar *m_ScaleBar; + CAutoCreate *m_pAutoCreate; - QTreeWidget *m_pToolBox; + CBoxTreeWidget *m_pToolBox; + CGraphFileTree *m_pFileWidget; + CBoxTreeWidget *m_pElfBox; CGraphLayoutTreeWidget *m_pGraphLayersTree; QToolBar *m_statusToolBar; CFindReplace *m_replaceDlg; @@ -291,6 +317,8 @@ private: void setupToolbox(); void setupPropertyEditor(); void setupGraphLayers(); + void setupFileWidget(); + void setupElfbox(); }; #endif // CDESIGNERWND_H diff --git a/platform/src/gui/hmi/CDynamicValue.cpp b/platform/src/gui/hmi/CDynamicValue.cpp index d6742821..abd15ba0 100644 --- a/platform/src/gui/hmi/CDynamicValue.cpp +++ b/platform/src/gui/hmi/CDynamicValue.cpp @@ -259,6 +259,40 @@ int CDynamicValue::flowDotChanged(const AppKeyStru &key, const QVariant &dvalue) return ret; } +int CDynamicValue::getDataStatus(VALUE_TYPE vtype, int group, int num) +{ + int status(-1); + VALUE_STATUS valueStatus; + + if (m_keyValueVec.size() <= 0) + { + return status; + } + + QVector::iterator it = m_keyValueVec.begin(); + switch (vtype) + { + case VALUE_VT: + { + for (; it != m_keyValueVec.end(); it++) + { + if (((*it).vtype == vtype) && (group == it->group) && (num == it->num)) + { + valueStatus = (*it); + status = valueStatus.status; + break; + } + } + break; + } + default: //QCOLOR_VT,SCRIPT_VT,STATUS_VT + { + break; + } + } + return status; +} + int CDynamicValue::setDataValue(AppKeyStru &key, const QVariant &dvalue, int status, int qcolor) { Q_UNUSED(qcolor) @@ -367,8 +401,8 @@ bool CDynamicValue::refreshShowingStyle(bool force) return false; } - setDbDataValue(); //< 只更新多态文本文本值,策略在下面计算 runScript(); + setDbDataValue(); //< 只更新多态文本文本值,策略在下面计算 if (!m_valueChanged) { return false; @@ -437,13 +471,27 @@ int CDynamicValue::setDbDataValue() QString text; QVariant dvalue = getDataValue(VALUE_VT, 0, 0); - getDataDispString(dvalue, text); - if (text.isEmpty()) + int valueStatus=getDataStatus(VALUE_VT, 0, 0); + if(valueStatus==4) { - text = " "; + text ="-"; + } + else + { + getDataDispString(dvalue, text); + if (text.isEmpty()) + { + text = " "; + } } tmp->setValue(text); + + float logicVal = getDataValue(LOGIC_VT, 0, 0).toDouble(); + if(logicVal == -1) + { + tmp->setString("NaN"); + } } return 0; } diff --git a/platform/src/gui/hmi/CDynamicValue.h b/platform/src/gui/hmi/CDynamicValue.h index 262cde6e..8d6dd067 100644 --- a/platform/src/gui/hmi/CDynamicValue.h +++ b/platform/src/gui/hmi/CDynamicValue.h @@ -111,6 +111,7 @@ public: int setObjDataValue(); QVariant getDataValue(VALUE_TYPE vtype, int group = -1, int num = -1); int flowDotChanged(const AppKeyStru &key, const QVariant &dvalue); + int getDataStatus(VALUE_TYPE vtype, int group = -1, int num = -1); private: int setObjStatusStyle(); diff --git a/platform/src/gui/hmi/CExplorerScene.cpp b/platform/src/gui/hmi/CExplorerScene.cpp index 76ce6556..db5085fd 100644 --- a/platform/src/gui/hmi/CExplorerScene.cpp +++ b/platform/src/gui/hmi/CExplorerScene.cpp @@ -6,7 +6,8 @@ #include "../GraphShape/include/CLinkLine.h" #include "../GraphShape/include/CIconShape.h" #include "../GraphShape/include/CBusShape.h" - +#include "../GraphShape/include/CNewElfShape.h" +#include "../GraphShape/include/CDyLinkLine.h" using namespace iot_service; @@ -87,6 +88,30 @@ int CExplorerScene::fileOpen(const QString &pathName, int fileType, int ioType) } } }//lj + else if(pobj->getObjType() == OBJTYPE_ELF) + { + CNewElfShape *tmp = dynamic_cast(pobj); + QList *sublist = tmp->getMergeListPtr(); + if(sublist) + { + QList::iterator it = sublist->begin(); + for(; it != sublist->end(); it++) + { + (*it)->setAcceptedMouseButtons(Qt::MouseButton::NoButton); + (*it)->setPos((*it)->pos() + tmp->pos()); + if(!(*it)->getInitVisible()) + { + (*it)->setVisible(false); + } + (*it)->setNameString(QString("obj_%1").arg((*it)->getObjId())); + objTag = (*it)->getNameString(); + if(!objTag.isEmpty()) + { + m_pObjTagMap[objTag] = *it; + } + } + } + } else { addItem(pobj); @@ -129,6 +154,22 @@ int CExplorerScene::fileOpen(const QString &pathName, int fileType, int ioType) startDev = m_topoObjMap[link->getStartDevId()]; endDev = m_topoObjMap[link->getEndDevId()]; } + if(startDev && startDev->getObjType() == OBJTYPE_ELF) + { + long leftSubId = dynamic_cast(startDev)->getInstObjId(link->getStartSubDevId()); + if(leftSubId > 0) + { + startDev = m_topoObjMap[leftSubId]; + } + } + if(endDev && endDev->getObjType() == OBJTYPE_ELF) + { + long rightSubId = dynamic_cast(endDev)->getInstObjId(link->getEndSubDevId()); + if(rightSubId > 0) + { + endDev = m_topoObjMap[rightSubId]; + } + } link->initLink(startDev, endDev, link->getStartDevPin(), link->getEndDevPin()); @@ -182,7 +223,7 @@ void CExplorerScene::createDynamicSet() int CExplorerScene::createDynamicSet(CShape *pobj) { int objType = pobj->getObjType(); - if(pobj->getObjType() == OBJTYPE_MERGE) + if(dynamic_cast(pobj)) { CGroupShape *tmpObj = (CGroupShape *)pobj; QList *tmpObjList = tmpObj->getMergeListPtr(); @@ -210,22 +251,21 @@ void CExplorerScene::subscribe(bool again) createDynamicSet(); } - QString keyTag; - QString tableName; - QString columnName; - CDynamicValue *pdvalue = NULL; QVector::iterator iter = m_DValueVect.begin(); m_DValueMultiMap.clear(); for(; iter != m_DValueVect.end(); iter++) { - pdvalue = *iter; + CDynamicValue *pdvalue = *iter; pdvalue->initDValueInfo(); QSet keyTagSet = pdvalue->getKeyTagSet(); QVector keyVec = pdvalue->getKeyIdVect(); for(int i = 0; i < keyVec.size(); i++) { - m_DValueMultiMap.insert(keyVec[i], pdvalue); + QString keyTag; + QString tableName; + QString columnName; + if(keyTagSet.contains(keyVec[i].tag_name)) { keyTag = CBaseInstance()->truncTag(keyVec[i].tag_name, "key"); @@ -233,6 +273,13 @@ void CExplorerScene::subscribe(bool again) columnName = CBaseInstance()->truncTag(keyVec[i].tag_name, "col"); } + if(tableName.isEmpty()) //使用模板时在联库信息中配置非测点信息,所以过滤掉 + { + continue; + } + + m_DValueMultiMap.insert(keyVec[i], pdvalue); + if(keyVec[i].tag_name.indexOf(".qcolor") != -1) { pdvalue->setDataValue(keyVec[i], 0); @@ -333,6 +380,12 @@ int CExplorerScene::setDevQColor(CShape *obj, const int &qcolor) shape->setIslandState(qcolor); return 1; } + else if(obj->getObjType() == OBJTYPE_DYLINKLINE) + { + CDyLinkLine *shape = dynamic_cast(obj); + shape->setIslandState(qcolor); + return 1; + } CDynamicValue *pdvalue = NULL; QVector::iterator iter = m_DValueVect.begin(); for(; iter != m_DValueVect.end(); iter++) diff --git a/platform/src/gui/hmi/CExplorerView.cpp b/platform/src/gui/hmi/CExplorerView.cpp index 6fbd6d71..339642ca 100644 --- a/platform/src/gui/hmi/CExplorerView.cpp +++ b/platform/src/gui/hmi/CExplorerView.cpp @@ -531,6 +531,7 @@ int CExplorerView::fileOpen(const QString &fileName, const QString &replaceKey, else { setBackgroundBrush(QBrush(backColor)); + m_prePixName = ""; } } else diff --git a/platform/src/gui/hmi/CExplorerWnd.cpp b/platform/src/gui/hmi/CExplorerWnd.cpp index c2a473a9..15be8f22 100644 --- a/platform/src/gui/hmi/CExplorerWnd.cpp +++ b/platform/src/gui/hmi/CExplorerWnd.cpp @@ -10,6 +10,7 @@ #include "./dialog/screenShot/CScreenShot.h" #include "sys_dog_auth_api/DogAuthInterface.h" #include "public/pub_utility_api/FileUtil.h" +#include "pub_utility_api/FileStyle.h" CExplorerWnd::CExplorerWnd(int id, int type, CGraphDoc *doc, QWidget *parent, Qt::WindowFlags flag) @@ -39,10 +40,25 @@ int CExplorerWnd::Init() setupActions(); setupMenubar(); - + initStyleSheet(); return 0; } - +void CExplorerWnd::initStyleSheet() +{ + QString qss; + std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("explorerWnd.qss") ; + QFile qssfile2(QString::fromStdString(strFullPath)); + qssfile2.open(QFile::ReadOnly); + if (qssfile2.isOpen()) + { + qss = QLatin1String(qssfile2.readAll()); + qssfile2.close(); + } + if(!qss.isEmpty()) + { + setStyleSheet(qss); + } +} CExplorerWnd::~CExplorerWnd() { QVector views = getGraphViews(); @@ -255,13 +271,13 @@ void CExplorerWnd::showCheckDogInfo() { iot_sys::CDogAuthInterfacePtr ptrDogAuth = iot_sys::getDogAuthInstance(); int nRet = ptrDogAuth->checkAuthStatus(); - if(nRet == AUTH_STATUS_OK) + if(nRet > 0) { - QMessageBox::information(NULL, tr("提示"), tr("加密狗检测正常!")); + QMessageBox::information(NULL, tr("提示"), tr("加密狗运行异常!")); } else { - QMessageBox::information(NULL, tr("提示"), tr("加密狗运行异常!")); + QMessageBox::information(NULL, tr("提示"), tr("加密狗检测正常!")); } return; } @@ -386,12 +402,22 @@ QString CExplorerWnd::getIndexPic() QString pic; int index = getScreenIndex(); QVariantList info = CBaseInstance()->getScreenInfo(); - if(info.count() == 3) + if(info.count() == 4) { QStringList pics = info[1].toStringList(); - if(pics.count() > index) + QStringList nos = info[3].toStringList(); + if(pics.length() != nos.length()) { - pic = pics[index]; + return pic; + } + + for(int n = 0; n < nos.size(); n++) + { + if(QString(nos[n]).toInt() == index) + { + pic = pics[n]; + break; + } } } diff --git a/platform/src/gui/hmi/CExplorerWnd.h b/platform/src/gui/hmi/CExplorerWnd.h index 3314c7ad..dbdbd65c 100644 --- a/platform/src/gui/hmi/CExplorerWnd.h +++ b/platform/src/gui/hmi/CExplorerWnd.h @@ -121,7 +121,7 @@ private: void setupMenubar(); void enableMenubar(bool enable); bool isAbsolutePath(const QString &path); - + void initStyleSheet(); }; #endif // CEXPLORERWND_H diff --git a/platform/src/gui/hmi/CExtern.h b/platform/src/gui/hmi/CExtern.h index 31fd08c7..a6211312 100644 --- a/platform/src/gui/hmi/CExtern.h +++ b/platform/src/gui/hmi/CExtern.h @@ -20,6 +20,8 @@ extern const char *g_wnd_new_ex; extern const char *g_wnd_new_run; extern const char *g_wnd_script; extern const char *g_wnd_toolbox; +extern const char *g_wnd_file_widget; +extern const char *g_wnd_elfbox; extern const char *g_property_editor; extern const char *g_data_bind_editor; extern const char *g_bind_check_editor; diff --git a/platform/src/gui/hmi/CGraphApp.cpp b/platform/src/gui/hmi/CGraphApp.cpp index 0bdf1bfa..644ad0f4 100644 --- a/platform/src/gui/hmi/CGraphApp.cpp +++ b/platform/src/gui/hmi/CGraphApp.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "CGraphApp.h" #include "CDesignerWnd.h" #include "CDesignerView.h" @@ -14,6 +15,10 @@ #include "../GraphShape/IconInfo/CIconInfoControl.h" #include "MessageChannel.h" #include "DataProcMessage.pb.h" +#include "pub_utility_api/I18N.h" +#include "pub_utility_api/FileUtil.h" +#include "pub_utility_api/FileStyle.h" +#include "pub_widget/PubWidgetInit.h" using namespace iot_idl; @@ -56,6 +61,7 @@ LONG WINAPI handledException(struct _EXCEPTION_POINTERS *pExceptionPointers) CGraphApp::CGraphApp(int &argc, char **argv) : QApplication(argc, argv) { + loadDesignerStyle(); //< 仅加载到内存中 #ifdef OS_WINDOWS SetUnhandledExceptionFilter(handledException); #endif @@ -87,9 +93,14 @@ CGraphApp::CGraphApp(int &argc, char **argv) : QApplication(argc, argv) m_forceRequery = false; m_noBorder = true; checkArg(argc, argv); - loadTranslator(); + //loadTranslator(); + initI8n(); loadCfgInfo(); - loadAllIconInfo(); + QString path; + CBaseInstance()->getPathName(CBase::PATH_TYPE_ICON, path); + loadAllIconInfo(path, "*.ilx"); + CBaseInstance()->getPathName(CBase::PATH_TYPE_ELF, path); + loadAllIconInfo(path, "*.elx"); } CGraphApp::~CGraphApp() @@ -130,7 +141,6 @@ CGraphApp::~CGraphApp() iot_public::StopLogSystem(); } - bool CGraphApp::isRunning() { return m_bRunning; @@ -163,6 +173,28 @@ void CGraphApp::newLocalServer() } } +void CGraphApp::loadDesignerStyle() +{ + std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss","zh","light"); + + QFile qssfile1(QString::fromStdString(strFullPath)); + qssfile1.open(QFile::ReadOnly); + if (qssfile1.isOpen()) + { + m_strDesignerQss += QLatin1String(qssfile1.readAll()); + qssfile1.close(); + } + + strFullPath = iot_public::CFileStyle::getPathOfStyleFile("hmi_designer.qss","zh","light"); + QFile qssfile2(QString::fromStdString(strFullPath)); + qssfile2.open(QFile::ReadOnly); + if (qssfile2.isOpen()) + { + m_strDesignerQss += QLatin1String(qssfile2.readAll()); + qssfile2.close(); + } +} + void CGraphApp::runApp(QString name) { m_curEWndIndex = 0; @@ -173,7 +205,6 @@ void CGraphApp::runApp(QString name) if (!(iot_net::initMsgBus("HMI", "HMI"))) { - LOGERROR("initMsgBus fail return;"); return; } @@ -212,6 +243,68 @@ void CGraphApp::loadTranslator() pluginTranslator->load(pluginTransFile); installTranslator(pluginTranslator); } +void CGraphApp::initI8n() +{ + const std::string strLanguage = std::move( iot_public::getCurLanguage()); + + std::string strFilePath = std::move( iot_public::CFileUtil::getPathOfResFile( "gui/translate/platform_"+strLanguage+".qm" )); + if ( !strFilePath.empty()) + { + auto *pTrans = new QTranslator; + pTrans->load( strFilePath.c_str()); + QApplication::installTranslator( pTrans ); + } + + strFilePath = std::move( iot_public::CFileUtil::getPathOfResFile( "gui/translate/product_"+strLanguage+".qm")); + if ( !strFilePath.empty()) + { + auto *pTrans = new QTranslator; + pTrans->load( strFilePath.c_str()); + QApplication::installTranslator( pTrans ); + } + + if(strLanguage=="en") + { + strFilePath = std::move( iot_public::CFileUtil::getPathOfResFile( "model_studio/translate/model_user_EN.qm" )); + if ( !strFilePath.empty()) + { + auto *pTrans = new QTranslator; + pTrans->load( strFilePath.c_str()); + QApplication::installTranslator( pTrans ); + } + QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates)); //设置应用程序的本地化 qt控件显示语言 + }else if( strLanguage == "fr") + { + //法语翻译待添加 + strFilePath = std::move( iot_public::CFileUtil::getPathOfResFile( "model_studio/translate/model_user_FR.qm" )); + if ( !strFilePath.empty()) + { + auto *pTrans = new QTranslator; + pTrans->load( strFilePath.c_str()); + QApplication::installTranslator( pTrans ); + } + QLocale::setDefault(QLocale(QLocale::French, QLocale::France)); //设置应用程序的本地化 + } + + strFilePath = std::move( iot_public::CFileUtil::getPathOfResFile( "fbd_editor/translate/platform_"+strLanguage+".qm")); + if ( !strFilePath.empty()) + { + auto *pTrans = new QTranslator; + pTrans->load( strFilePath.c_str()); + QApplication::installTranslator( pTrans ); + } + strFilePath = std::move( iot_public::CFileUtil::getPathOfResFile( "fbd_editor/translate/product_"+strLanguage+"qm")); + if ( !strFilePath.empty()) + { + auto *pTrans = new QTranslator; + pTrans->load( strFilePath.c_str()); + QApplication::installTranslator( pTrans ); + } + + iot_public::installTranslator(strLanguage); + + //LOGINFO("lang%s-- qmpath:%s", strLanguage.c_str(), strFilePath.c_str()); +} void CGraphApp::loadCfgInfo() { @@ -228,6 +321,7 @@ void CGraphApp::loadCfgInfo() QJsonObject json = loadDoc.object(); QJsonObject cfgJson = json["config"].toObject(); QJsonObject screenJson = cfgJson["screen"].toObject(); + QJsonObject screenNoJson = cfgJson["screenNo"].toObject(); QStringList idxs; QJsonObject::iterator iter = screenJson.begin(); @@ -236,6 +330,13 @@ void CGraphApp::loadCfgInfo() idxs << iter.value().toString(); ++iter; } + QStringList noList; + iter = screenNoJson.begin(); + while(iter != screenNoJson.end()) + { + noList << iter.value().toString(); + ++iter; + } QDesktopWidget *dw = QApplication::desktop(); QRect geo = dw->screenGeometry(); @@ -245,7 +346,7 @@ void CGraphApp::loadCfgInfo() CBaseInstance()->setScreenGeometry(geo); CBaseInstance()->getPathNameByName(cfgJson["layout"].toString(), m_graphDispInfo.pathName); CBaseInstance()->setColorCfgFlag(cfgJson["ccfg"].toBool()); - CBaseInstance()->setScreenInfo(cfgJson["screen-num"].toInt(), idxs, cfgJson["layout-single"].toBool()); + CBaseInstance()->setScreenInfo(cfgJson["screen-num"].toInt(), idxs, cfgJson["layout-single"].toBool(), noList); } void CGraphApp::checkArg(int &argc, char **argv) @@ -301,6 +402,10 @@ void CGraphApp::checkDispArg(int &argc, const QStringList &argv, GraphDispInfo & { graphInfo.type = AppMode::IconMode; } + else if(wndStr == "elf") + { + graphInfo.type = AppMode::ElfMode; + } else { graphInfo.type = AppMode::DesignerMode; @@ -357,6 +462,7 @@ int CGraphApp::newDesignerWnd(GraphDispInfo &graphInfo) } m_activeDesignerWnd = new CDesignerWnd(m_curDWndIndex, AppMode::DesignerMode, m_graphDoc, graphInfo); + m_activeDesignerWnd->setStyleSheet(m_strDesignerQss); m_designerWndMap[m_curDWndIndex] = m_activeDesignerWnd; m_curDWndIndex++; @@ -371,6 +477,7 @@ int CGraphApp::newDesignerWnd() GraphDispInfo graphInfo; m_activeDesignerWnd = new CDesignerWnd(m_curDWndIndex, AppMode::DesignerMode, m_graphDoc, graphInfo); + m_activeDesignerWnd->setStyleSheet(m_strDesignerQss); m_designerWndMap[m_curDWndIndex] = m_activeDesignerWnd; m_curDWndIndex++; @@ -420,14 +527,18 @@ void CGraphApp::deleteExplorerWnd(int id) QVariant CGraphApp::setScreenLayout(const QVariantList &info, int screenWidth) { + Q_UNUSED(screenWidth); + QList result; int viewNum = 0; QStringList viewList; - if(info.count() == 3) + QStringList noList; + if(info.count() == 4) { viewNum = (info[0].toInt() > 0) ? info[0].toInt() : 1; viewList = info[1].toStringList(); + noList = info[3].toStringList(); if(info[2].toBool()) { @@ -438,26 +549,38 @@ QVariant CGraphApp::setScreenLayout(const QVariantList &info, int screenWidth) QDesktopWidget *dw = QApplication::desktop(); int numScrs = dw->numScreens(); - viewNum = (viewNum > numScrs) ? numScrs : viewNum; - + viewNum = (viewNum > 0) ? viewNum : 1; + int screenNo; + QList createdNo; for(int n = 0; n < viewNum; n++) { - QRect rect = dw->screenGeometry(n); - int rx = rect.topLeft().x(); - int ry = rect.topLeft().y(); - int width = rect.width(); - int height = rect.height(); + screenNo = n < noList.size() ? QString(noList[n]).toInt() : n; + if(screenNo >= numScrs) + { + continue; + } + if(createdNo.indexOf(screenNo) != -1) + { + continue; + } + createdNo.append(screenNo); - QRect dest(rx, ry, width, height); + QRect rect = dw->screenGeometry(screenNo); if (!rect.isValid()) { return -1; } + int rx = rect.topLeft().x(); + int ry = rect.topLeft().y(); + int width = rect.width(); + int height = rect.height(); + QRect dest(rx, ry, width, height); + long wndId = -1; int id = setWndGeometry(m_graphDispInfo, dest, wndId); - rx += screenWidth; +// rx += screenWidth; if (id > 0) { result.push_back(id); @@ -654,19 +777,15 @@ void CGraphApp::newExplorerWnd(GraphDispInfo &graphInfo) m_activeExplorerWnd->raise(); } -bool CGraphApp::loadAllIconInfo() +bool CGraphApp::loadAllIconInfo(const QString &path, const QString &filter) { QString IconFileName; QString IconName; QString iconPathName; - QString path; - - CBaseInstance()->getPathName(CBase::PATH_TYPE_ICON, path); CIconInfo *icon; int pos; QDir dir(path); - QString filter = "*.ilx"; dir.setNameFilters(QStringList(filter)); QStringList fileList = dir.entryList(); @@ -884,7 +1003,7 @@ void CGraphApp::checkDogStatus() } int nRet = m_ptrDogAuth->checkAuthStatus(); - if(nRet == AUTH_STATUS_FAILD) //加密狗异常退出系统 + if(nRet > 0) { m_nDogCount += 1; if(m_nDogCount >= DOG_TIMEOUT) @@ -935,7 +1054,7 @@ void CGraphApp::timerEvent(QTimerEvent *e) if (m_communicator->recvMsg(msg, 0)) { msgType = msg.getMsgType(); - qDebug("-----receive msg, type %d", msgType); + //qDebug("-----receive msg, type %d", msgType); switch (msgType) { diff --git a/platform/src/gui/hmi/CGraphApp.h b/platform/src/gui/hmi/CGraphApp.h index 6bffe691..0bcde309 100644 --- a/platform/src/gui/hmi/CGraphApp.h +++ b/platform/src/gui/hmi/CGraphApp.h @@ -10,7 +10,7 @@ #include "../../include/application/sim_interlock_api/SimInterLockInterface.h" #include "sys_dog_auth_api/DogAuthInterface.h" -const int DOG_TIMEOUT = 120; //< 加密狗异常超时时间min +const int DOG_TIMEOUT = 7*24*60; //< 加密狗异常超时时间min class CDesignerWnd; class CExplorerWnd; @@ -63,6 +63,7 @@ public: bool isRunning(); void loadTranslator(); void loadCfgInfo(); + void initI8n(); CGraphDataAcess *getDataAccess() { @@ -89,7 +90,7 @@ public: { return m_registerName; } - bool loadAllIconInfo(); + bool loadAllIconInfo(const QString &path, const QString &filter); public: int processChangeData(); @@ -118,6 +119,7 @@ public slots: private: void initLocalConnection(); void newLocalServer(); + void loadDesignerStyle(); protected: virtual void timerEvent(QTimerEvent *e); @@ -156,6 +158,7 @@ private: bool m_bRunning; QString m_serverName; QLocalServer *m_localServer; + QString m_strDesignerQss; }; #endif // CGRAPHAPP_H diff --git a/platform/src/gui/hmi/CGraphDoc.cpp b/platform/src/gui/hmi/CGraphDoc.cpp index bb125667..8cdbc18b 100644 --- a/platform/src/gui/hmi/CGraphDoc.cpp +++ b/platform/src/gui/hmi/CGraphDoc.cpp @@ -48,7 +48,7 @@ int CGraphDoc::addToChgDataMap(const iot_net::CMbMessage &msg, long long &ntimes { AppKeyStru appKey; ChgDataStru chgData; - chgDataPkg.ParseFromArray(msg.getDataPtr(), msg.getDataSize()); + chgDataPkg.ParseFromArray(msg.getDataPtr(), static_cast(msg.getDataSize())); ::iot_idl::SRealTimePkgHead head = chgDataPkg.sthead(); ntimestamp = head.ntimestamp(); diff --git a/platform/src/gui/hmi/CGraphHead.cpp b/platform/src/gui/hmi/CGraphHead.cpp index d5612d8c..cae18042 100644 --- a/platform/src/gui/hmi/CGraphHead.cpp +++ b/platform/src/gui/hmi/CGraphHead.cpp @@ -11,7 +11,9 @@ #include "../GraphShape/IconInfo/CIconInfoControl.h" #include "../GraphShape/include/CDrawObjFactory.h" #include "../GraphShape/include/CWidgetShape.h" +#include "../GraphShape/include/CGroupShape.h" +#define HMI_DEFAULT_AUTHOR "hmi" CGraphHead::CGraphHead() { @@ -493,7 +495,7 @@ int CGraphHead::fileOpen(const QString &fileName, int type, int io) QString flag = fileName.right(4); io = BIN_IO; type = 0; - if (flag == ".glx" || flag == ".ilx") + if (flag == ".glx" || flag == ".ilx" || flag == ".elx") { io = XML_IO; } @@ -502,11 +504,19 @@ int CGraphHead::fileOpen(const QString &fileName, int type, int io) { type = 100; } + else if (flag == ".elx") + { + type = 125; + } if (type == 100) { iconLoad(fileName, 0); } + else if (type == 125) + { + elfLoad(fileName); + } else { if (io == BIN_IO) @@ -545,6 +555,11 @@ int CGraphHead::fileSave(const QString &fileName, int type, int io) io = XML_IO; type = 100; } + else if (flag == ".elx") + { + io = XML_IO; + type = 125; + } else if (flag == ".irb") { io = BIN_IO; @@ -565,6 +580,13 @@ int CGraphHead::fileSave(const QString &fileName, int type, int io) return 0; } } + else if (type == 125) + { + if (elfSave(fileName) < 0) + { + return 0; + } + } else { if (io == BIN_IO) @@ -617,7 +639,7 @@ int CGraphHead::saveFileXML(const QString &fileName) } rootItem = xmls.AppendChild("graph"); QString version = "1.0"; - QString author = "kbd"; + QString author = HMI_DEFAULT_AUTHOR; xmls.PutValue("version", version); xmls.PutValue("author", author); xmls.AppendChild("head", &rootItem); @@ -848,55 +870,122 @@ void CGraphHead::setPlaneType(int no, char type) m_layerInfo.m_LayerType[no] = type; } -int CGraphHead::addPlane(CPlaneHead *plane) +void CGraphHead::moveLayerRight(int start) { - if (plane == NULL) + for(int n = MAX_PLANE - 1; n > start; n--) { - plane = new CPlaneHead(); + qSwap(m_layerInfo.m_LayerID[n], m_layerInfo.m_LayerID[n-1]); + qSwap(m_layerInfo.m_LayerType[n], m_layerInfo.m_LayerType[n-1]); + qSwap(m_layerInfo.m_LayerName[n], m_layerInfo.m_LayerName[n-1]); } +} - m_planeList.push_back(plane); +void CGraphHead::moveLayerLeft(int start) +{ + for(int n = start; n < MAX_PLANE - 1; n++) + { + qSwap(m_layerInfo.m_LayerID[n], m_layerInfo.m_LayerID[n+1]); + qSwap(m_layerInfo.m_LayerType[n], m_layerInfo.m_LayerType[n+1]); + qSwap(m_layerInfo.m_LayerName[n], m_layerInfo.m_LayerName[n+1]); + } + m_layerInfo.m_LayerID[MAX_PLANE - 1] = 0; + m_layerInfo.m_LayerType[MAX_PLANE - 1] = 0; + m_layerInfo.m_LayerName[MAX_PLANE - 1] = ""; +} + +int CGraphHead::addPlane(int no) +{ + CPlaneHead *pPlane = new CPlaneHead; + m_planeList.insert(no, pPlane); setPlaneNum(m_planeList.size()); + + QList *objlist; + for (int nPlane = no + 1; nPlane < m_planeList.size(); nPlane++) + { + objlist = m_planeList[nPlane]->getObjList(); + foreach (CShape *obj, *objlist) { + if(!obj) + { + continue; + } + CGroupShape * g = dynamic_cast(obj); + if(g) + { + QList *glist = g->getMergeListPtr(); + foreach (CShape *gobj, *glist) { + if(gobj){ + gobj->setPlane(nPlane); + } + } + } + obj->setPlane(nPlane); + } + } + moveLayerRight(no); + return 0; } int CGraphHead::delPlane(int no) { int maxplaneid = m_planeList.size() - 1; - if (maxplaneid == 0) + if (maxplaneid <= 0) + { + return -1; + } + if (no < 0 || no > maxplaneid) { return -1; } - QList *objlist = NULL; - no = maxplaneid; - if (no >= 0 && no < m_planeList.size()) - { - objlist = m_planeList[no]->getObjList(); - } - - int curPlane = m_pGraphEnv->getCurPlane(); - m_pGraphEnv->setCurPlane(0); - CDesignerScene * scene = dynamic_cast(m_pGraphEnv); - if(scene) + if(!scene) + { + return -1; + } + QList *objlist = m_planeList[no]->getObjList(); + QList listItem; + listItem.clear(); + foreach (CShape * item, *objlist) + { + listItem.append(item); + } + if(!listItem.isEmpty()) { - QList listItem; - listItem.clear(); - foreach (CShape * item, *objlist) - { - listItem.append(item); - } scene->deleteItems(listItem); } - if (curPlane == maxplaneid) + for (int nPlane = no; nPlane < maxplaneid; nPlane++) { - curPlane = 0; + objlist = m_planeList[nPlane + 1]->getObjList(); + foreach (CShape *obj, *objlist) { + if(!obj) + { + continue; + } + CGroupShape * g = dynamic_cast(obj); + if(g) + { + QList *glist = g->getMergeListPtr(); + foreach (CShape *gobj, *glist) { + if(gobj){ + gobj->setPlane(nPlane); + } + } + } + obj->setPlane(nPlane); + } } + moveLayerLeft(no); - m_pGraphEnv->setCurPlane(curPlane); - m_planeList.pop_back(); + delete m_planeList[no]; + m_planeList.removeAt(no); + setPlaneNum(m_planeList.size()); + if (no == maxplaneid) + { + no = maxplaneid - 1; + } + scene->setCurPlane(no); return 0; } @@ -904,25 +993,20 @@ int CGraphHead::delPlane(int no) void CGraphHead::changePlaneNum(int num) { int i, oldnum; - CPlaneHead *pPlane; oldnum = getPlaneNum(); //m_planeList.Count(); - setPlaneNum(num); - int planeid = m_planeList.size() - 1; if(num > oldnum) { for(i = oldnum; i < num; i++) { - pPlane = new CPlaneHead; - m_planeList.push_back(pPlane); - setPlaneID(planeid + 1, planeid + 1); + addPlane(i); } } else if(oldnum > num) { for(i = oldnum - 1; i >= num; i--) { - delPlane(oldnum - 1); + delPlane(i); } } } @@ -1093,7 +1177,7 @@ int CGraphHead::iconSave(const QString &name) } rootItem = xmls.AppendChild("graph"); QString version = "1.0"; - QString author = "kbd"; + QString author = HMI_DEFAULT_AUTHOR; xmls.PutValue("version", version); xmls.PutValue("author", author); xmls.AppendChild("head", &rootItem); @@ -1150,6 +1234,130 @@ int CGraphHead::iconSave(const QString &name) return 0; } +int CGraphHead::elfLoad(const QString &name) +{ + int i = 0, ret = 0; + QList *tmplist = NULL; + CShape *tmpobj = NULL; + int obj_type, count; + int width, height; + + QDomElement rootItem, headItem, bodyItem, curItem; + + CGStream iofs; + iofs.SetMode(CGStream::xmlfile); + + CXMLStream &xmls = iofs.m_XMLStream; + ret = xmls.OPEN(name.toLocal8Bit().data(), std::ios::in, 1); + if (ret < 0) + { + return ret; + } + + int icon_type = -1; + rootItem = xmls.GetChild("graph"); + headItem = xmls.GetChild("head"); + xmls.GetValue("graph_type", m_graphType); + xmls.GetValue("icon_type", icon_type); + xmls.GetValue("icon_h", height); + xmls.GetValue("icon_w", width); + xmls.GetValue("state_num", m_levelNum); + xmls.GetValue("plane_num", m_planeNum); + xmls.GetValue("obj_count", count); + + setPlaneNum(m_planeNum); + removeList(); + m_graphRect.setWidth(width); + m_graphRect.setHeight(height); + + CDrawObjFactory *fac; + ret = getDrawObjFactory(&fac); + CPlaneHead *pPlane = new CPlaneHead; + if(count > 0) + { + bodyItem = xmls.GetChild("body"); + curItem = xmls.GetChild("item", &bodyItem); + tmplist = pPlane->getObjList(); + for(i = 0; i < count; ++i) + { + xmls.GetValue("obj_type", obj_type); + ret = fac->createDrawObj(obj_type, &tmpobj); + if (ret < 0) + { + continue; + } + tmpobj->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false); + tmpobj->setScene(m_pGraphEnv); + tmpobj->setParentWidget(((QWidget *)m_pGraphEnv->views().front()->viewport()), m_pGraphEnv->getEnvTypeFlag()); + tmpobj->read(iofs); + tmplist->push_back(tmpobj); + tmpobj->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); + xmls.m_CurElem = curItem; + curItem = xmls.GetNextSibling(); + } + } + m_planeList.push_back(pPlane); + m_graphRect.setWidth(width); + m_graphRect.setHeight(height); + fac->release(); + xmls.CLOSE(); + return 0; +} + +int CGraphHead::elfSave(const QString &name) +{ + int ret; + QDomElement rootItem, bodyItem, objItem; + + CGStream iofs; + iofs.SetMode(CGStream::xmlfile); + + CXMLStream &xmls = iofs.m_XMLStream; + ret = xmls.OPEN(name.toLocal8Bit().data(), std::ios::out, 1); + if (ret < 0) + { + return ret; + } + rootItem = xmls.AppendChild("graph"); + QString version = "1.0"; + QString author = HMI_DEFAULT_AUTHOR; + xmls.PutValue("version", version); + xmls.PutValue("author", author); + xmls.AppendChild("head", &rootItem); + xmls.PutValue("graph_type", m_graphType); + xmls.PutValue("icon_type", OBJTYPE_ELF); + + xmls.PutValue("icon_w", m_graphRect.width()); + xmls.PutValue("icon_h", m_graphRect.height()); + + xmls.PutValue("state_num", m_levelNum); + xmls.PutValue("plane_num", getPlaneNum()); + + int objcount = 0; + QList *tmplist1 = NULL; + CPlaneHead * plane = m_planeList.value(0); + if(plane) + { + tmplist1 = plane->getObjList(); + objcount = tmplist1->size(); + } + xmls.PutValue("obj_count", objcount); + bodyItem = xmls.AppendChild("body", &rootItem); + if(plane) + { + CShape *pobj = NULL; + QList::iterator it1 = tmplist1->begin(); + for (; it1 != tmplist1->end(); it1++) + { + pobj = (*it1); + objItem = xmls.AppendChild("item", &bodyItem); + pobj->write(iofs); + } + } + xmls.CLOSE(); + return 0; +} + int CGraphHead::iconElfSave(const QString &name, CShape *item) { int ret; @@ -1165,7 +1373,7 @@ int CGraphHead::iconElfSave(const QString &name, CShape *item) return ret; } QString version = "1.0"; - QString author = "kbd"; + QString author = HMI_DEFAULT_AUTHOR; rootItem = xmls.AppendChild("graph"); xmls.PutValue("version", version); xmls.PutValue("author", author); @@ -1184,12 +1392,75 @@ int CGraphHead::iconElfSave(const QString &name, CShape *item) return 0; } -void CGraphHead::removeLastIconState(int state) +int CGraphHead::elfSave(const QString &name, QList items) { - if(state < 1) + int ret; + QDomElement rootItem, bodyItem, objItem; + + CGStream iofs; + iofs.SetMode(CGStream::xmlfile); + + CXMLStream &xmls = iofs.m_XMLStream; + ret = xmls.OPEN(name.toLocal8Bit().data(), std::ios::out, 1); + if (ret < 0) { - return; + return ret; } + QString version = "1.0"; + QString author = HMI_DEFAULT_AUTHOR; + rootItem = xmls.AppendChild("graph"); + xmls.PutValue("version", version); + xmls.PutValue("author", author); + xmls.AppendChild("head", &rootItem); + xmls.PutValue("graph_type", ELF_TYPE); + xmls.PutValue("icon_type", OBJTYPE_ELF); + xmls.PutValue("state_num", 1); + xmls.PutValue("plane_num", 1); + xmls.PutValue("obj_count", items.size()); + + QRect rect = m_pGraphEnv->adjustRect(&items); + + xmls.PutValue("icon_w", rect.width()); + xmls.PutValue("icon_h", rect.height()); + + bodyItem = xmls.AppendChild("body", &rootItem); + foreach (CShape *item, items) { + objItem = xmls.AppendChild("item", &bodyItem); + item->write(iofs); + } + xmls.CLOSE(); + return 0; +} + +void CGraphHead::insertIconState(int state) +{ + CDesignerScene * scene = dynamic_cast(m_pGraphEnv); + if(scene) + { + QList::iterator iter = m_planeList.begin(); + while(iter != m_planeList.end()) + { + QList *tmplist = (*iter)->getObjList(); + QList::iterator item = tmplist->begin(); + int level; + while(item != tmplist->end()) + { + level = (int)((*item)->getStartLevel()); + if(state <= level) + { + (*item)->setStartLevel(level + 1); + } + item++; + } + iter++; + } + + setIconStateNum(getLevelNum() + 1); + } +} + +void CGraphHead::removeIconState(int state) +{ CDesignerScene * scene = dynamic_cast(m_pGraphEnv); if(scene) { @@ -1199,21 +1470,37 @@ void CGraphHead::removeLastIconState(int state) QList *tmplist = (*iter)->getObjList(); QList::iterator item = tmplist->begin(); QList listItem; + int level; while(item != tmplist->end()) { - if(state == (int)((*item)->getStartLevel())) + level = (int)((*item)->getStartLevel()); + if(state == level) { - listItem.append(*item); - item = tmplist->erase(item); - continue; + listItem.append(*item); + item = tmplist->erase(item); + continue; + } + else if(state < level) + { + (*item)->setStartLevel(level - 1); } item++; } - scene->deleteItems(listItem); + if(!listItem.isEmpty()) + { + scene->deleteItems(listItem); + } iter++; } - setIconStateNum(state); + int maxLevelId = getLevelNum() - 1; + setIconStateNum(getLevelNum() - 1); + removeIconStateName(state); + if(state == maxLevelId) + { + state = getLevelNum() - 1; + } + m_pGraphEnv->setCurLevel(state); } } @@ -1274,6 +1561,40 @@ void CGraphHead::setIconStateName(int state, const QString &name) } } +void CGraphHead::insertIconStateName(int state, const QString &name) +{ + CIconTypeInfo * icon = IconInfoControlInstance()->getIconTypeInfoPtr(getGraphType()); + if (icon == NULL) + { + return; + } + QVector *names = icon->getStateNamePtr(); + int size = names->size(); + if(state < size) + { + names->insert(state, name); + } + else + { + names->append(name); + } +} + +void CGraphHead::removeIconStateName(int state) +{ + CIconTypeInfo * icon = IconInfoControlInstance()->getIconTypeInfoPtr(getGraphType()); + if (icon == NULL) + { + return; + } + QVector *names = icon->getStateNamePtr(); + int size = names->size(); + if (state < size) + { + names->removeAt(state); + } +} + void CGraphHead::setIconStateNum(int states) { setLevelNum(states); diff --git a/platform/src/gui/hmi/CGraphHead.h b/platform/src/gui/hmi/CGraphHead.h index 6e5a466b..1390a1c6 100644 --- a/platform/src/gui/hmi/CGraphHead.h +++ b/platform/src/gui/hmi/CGraphHead.h @@ -8,6 +8,7 @@ class CGraphScene; const int GRAPH_TYPE = 0; const int ICON_TYPE = 1; +const int ELF_TYPE = 2; const int BIN_IO = 0; const int XML_IO = 1; @@ -95,6 +96,9 @@ public: char getPlaneType(int no) const; void setPlaneType(int no, char type); + void moveLayerRight(int start); + void moveLayerLeft(int start); + void setInitShowPlane(QVector &showvec) { m_InitShowingPlane = showvec; @@ -104,7 +108,7 @@ public: return m_InitShowingPlane; } - int addPlane(CPlaneHead *plane); + int addPlane(int no); int delPlane(int no); void changePlaneNum(int num); @@ -143,12 +147,19 @@ public: int iconLoad(const QString &name, int type); int iconSave(const QString &name); - int iconElfSave(const QString &name, CShape *item); + int elfLoad(const QString &name); + int elfSave(const QString &name); - void removeLastIconState(int state); + int iconElfSave(const QString &name, CShape *item); + int elfSave(const QString &name, QList items); + + void insertIconState(int state); + void removeIconState(int state); int getIconStateName(int state, QString &name); void setIconStateName(int state, const QString &name); + void insertIconStateName(int state, const QString &name); + void removeIconStateName(int state); int getIconStateNum() const; void setIconStateNum(int states); int getIconPlaneName(int plane, QString &name); diff --git a/platform/src/gui/hmi/CGraphScene.cpp b/platform/src/gui/hmi/CGraphScene.cpp index cd5daf48..c0896863 100644 --- a/platform/src/gui/hmi/CGraphScene.cpp +++ b/platform/src/gui/hmi/CGraphScene.cpp @@ -17,6 +17,7 @@ #include "../GraphShape/include/CArcShape.h" #include "../GraphShape/include/CElfShape.h" #include "../GraphShape/include/CWidgetShape.h" +#include "../GraphShape/include/CNewElfShape.h" QScriptValue toQScriptValue(QScriptEngine *eng, const QVariant &qvar) { @@ -45,6 +46,7 @@ CGraphScene::CGraphScene() : QGraphicsScene() m_isModified = false; m_isMousePressed = false; m_staticObjID = 1; + m_elfObjID = 10000; m_pScriptEngine = new QScriptEngine; m_bDebug = false; m_viewFlag = 0; @@ -88,6 +90,7 @@ void CGraphScene::reset() m_showingPlane[0] = true; m_pCurrentObj = NULL; m_staticObjID = 1; + m_elfObjID = 10000; if (m_pScriptEngine) { @@ -285,7 +288,7 @@ void CGraphScene::restoreObj(CShape *obj) objList->push_back(obj); - if (obj->getObjType() == OBJTYPE_MERGE) + if (dynamic_cast(obj)) { CShape *sub = NULL; CGroupShape *tmp = dynamic_cast(obj); @@ -303,6 +306,14 @@ void CGraphScene::restoreObj(CShape *obj) } } } + if(obj->getObjType() == OBJTYPE_ELF) + { + QMap::iterator it = m_topoObjMap.find(obj->getObjId()); + if (it == m_topoObjMap.end()) + { + m_topoObjMap[obj->getObjId()] = obj; + } + } } else if ((obj->IsPscadaLinkObj() || obj->getPinNum() > 0)) { @@ -347,7 +358,7 @@ void CGraphScene::appendObj(CShape *obj, bool append) } else { - if (obj->getObjType() == OBJTYPE_MERGE) + if (dynamic_cast(obj)) { CShape *sub = NULL; CGroupShape *tmp = dynamic_cast(obj); @@ -365,6 +376,11 @@ void CGraphScene::appendObj(CShape *obj, bool append) } } } + QMap::iterator it = m_topoObjMap.find(obj->getObjId()); + if (it == m_topoObjMap.end()) + { + m_topoObjMap[obj->getObjId()] = obj; + } } else if (/*getCurGraphHead()->getTopoFlag() == 1 &&*/ (obj->IsPscadaLinkObj() || obj->getPinNum() > 0)) { @@ -457,7 +473,7 @@ void CGraphScene::removeLinkShip(CShape *obj, QList *objList) if(!obj) return; QList edgeList; - if(obj->getObjType() == OBJTYPE_MERGE) + if(dynamic_cast(obj)) { CGroupShape *tmp = dynamic_cast(obj); QList *sublist = tmp->getMergeListPtr(); @@ -646,6 +662,23 @@ bool CGraphScene::IsShowingPlane(short plane_no) return ret; } +void CGraphScene::moveShowPlaneRight(int start) +{ + for(int n = MAX_PLANE - 1; n > start; n--) + { + qSwap(m_showingPlane[n], m_showingPlane[n-1]); + } +} + +void CGraphScene::moveShowPlaneLeft(int start) +{ + for(int n = start; n < MAX_PLANE - 1; n++) + { + qSwap(m_showingPlane[n], m_showingPlane[n+1]); + } + m_showingPlane[MAX_PLANE - 1] = true; +} + char CGraphScene::IsShowObject(CShape *pobj) { if (pobj == NULL) @@ -709,6 +742,7 @@ CShape* CGraphScene::shapeTwin(CShape *obj) twin->setParentWidget((QWidget *)views().front()->viewport(), getEnvTypeFlag()); twin->pasteFromClipboard(bofs, &retlist, RW_PART_SHAPE | RW_PART_LINK); twin = retlist.first(); + fac->release(); return twin; } @@ -757,9 +791,14 @@ CShape *CGraphScene::createObj(unsigned char objType, QString name, QString type if(!objlist->isEmpty()) { delete m_pCurrentObj; + m_pCurrentObj = NULL; QVector subIdx; CShape *tmp = objlist->first(); + if(tmp->getObjType() != OBJTYPE_MERGE) + { + return NULL; + } foreach (CShape *obj, dynamic_cast(tmp)->m_mergeList) { subIdx.push_back(obj->getObjId()); @@ -792,6 +831,12 @@ CShape *CGraphScene::createObj(unsigned char objType, QString name, QString type // (dynamic_cast(m_pCurrentObj))->setWidth(iconInfo->m_iconWidth); // (dynamic_cast(m_pCurrentObj))->setHeight(iconInfo->m_iconHeight); } + else if (objType == OBJTYPE_ELF && !name.isEmpty() && name != "精灵图元") + { + m_pCurrentObj->setScene(this); + CNewElfShape * tmp = dynamic_cast(m_pCurrentObj); + tmp->setIconInfo(name, false); + } if (!m_pCurrentObj) { @@ -924,7 +969,8 @@ void CGraphScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) } int objType = m_pCurrentObj->getObjType(); - if (objType == OBJTYPE_ICON + 20 || objType == OBJTYPE_MERGE) + if (objType == OBJTYPE_ICON + 20 || objType == OBJTYPE_MERGE + || (objType == OBJTYPE_ELF && dynamic_cast(m_pCurrentObj)->getPokeFile() != "")) { QList idlist; QList newlist; @@ -933,7 +979,7 @@ void CGraphScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) m_pCurrentObj->setPos(modPoint); m_pCurrentObj->m_prePos = m_pCurrentObj->pos(); - if(objType == OBJTYPE_MERGE) + if(dynamic_cast(m_pCurrentObj)) { CGroupShape *g = dynamic_cast(m_pCurrentObj); QList *tmpObjList = g->getMergeListPtr(); @@ -1197,6 +1243,30 @@ int CGraphScene::fileOpen(const QString &pathName, int fileType, int ioType) } } }//lj + else if(pobj->getObjType() == OBJTYPE_ELF) + { + CNewElfShape *tmp = dynamic_cast(pobj); + QList *sublist = tmp->getMergeListPtr(); + if(sublist) + { + QList::iterator it = sublist->begin(); + for(; it != sublist->end(); it++) + { + if((*it)->getObjType() == OBJTYPE_RELATIVE) + { + CLinkLine *link = dynamic_cast(*it); + for(int n = 0 ; n < link->m_points.size(); ++n) + { + link->m_points[n] += tmp->pos(); + } + } + else + { + (*it)->setPos((*it)->pos() + tmp->pos()); + } + } + } + } addItem(pobj); updateItemsTempState(pobj); @@ -1224,7 +1294,22 @@ int CGraphScene::fileOpen(const QString &pathName, int fileType, int ioType) startDev = m_topoObjMap[link->getStartDevId()]; endDev = m_topoObjMap[link->getEndDevId()]; } - + if(startDev && startDev->getObjType() == OBJTYPE_ELF) + { + long leftSubId = dynamic_cast(startDev)->getInstObjId(link->getStartSubDevId()); + if(leftSubId > 0) + { + startDev = m_topoObjMap[leftSubId]; + } + } + if(endDev && endDev->getObjType() == OBJTYPE_ELF) + { + long rightSubId = dynamic_cast(endDev)->getInstObjId(link->getEndSubDevId()); + if(rightSubId > 0) + { + endDev = m_topoObjMap[rightSubId]; + } + } link->initLink(startDev, endDev, link->getStartDevPin(), link->getEndDevPin()); link->setFlag(QGraphicsItem::ItemIsMovable, false); } @@ -1237,6 +1322,7 @@ int CGraphScene::fileOpen(const QString &pathName, int fileType, int ioType) int CGraphScene::fileSave(const QString &pathName, unsigned char saveFlag, int fileType, int ioType) { Q_UNUSED(saveFlag) + adjustRect(); m_pGraphHead->fileSave(pathName, fileType, ioType); return 0; } @@ -1247,6 +1333,12 @@ int CGraphScene::iconElfSave(const QString &pathName, CShape *item) return 0; } +int CGraphScene::elfSave(const QString &pathName, QList items) +{ + m_pGraphHead->elfSave(pathName, items); + return 0; +} + QList CGraphScene::selectedObjs() { QList objList; @@ -1426,7 +1518,7 @@ int CGraphScene::advanced(long msec, const QRect &source) for (; it1 != objList->end(); it1++) { pobj = (*it1); - if(pobj->getObjType() == OBJTYPE_MERGE) + if(dynamic_cast(pobj)) { CGroupShape *tmpObj = (CGroupShape *)pobj; QList *tmpObjList = tmpObj->getMergeListPtr(); @@ -1655,6 +1747,30 @@ void CGraphScene::constructLink(QList &list, QList &idlist, QVect { startDev = list[idxs]; endDev = list[idxe]; + if(startDev->getObjType() == OBJTYPE_ELF) + { + long leftSubId = dynamic_cast(startDev)->getInstObjId(link->getStartSubDevId()); + if(leftSubId > 0) + { + startDev = m_topoObjMap[leftSubId]; + } + else + { + startDev = NULL; + } + } + if(endDev->getObjType() == OBJTYPE_ELF) + { + long rightSubId = dynamic_cast(endDev)->getInstObjId(link->getEndSubDevId()); + if(rightSubId > 0) + { + endDev = m_topoObjMap[rightSubId]; + } + else + { + endDev = NULL; + } + } } } @@ -1669,7 +1785,7 @@ void CGraphScene::constructLink(QList &list, QList &idlist, QVect unLinks.push_back(link); } } - else if(obj->getObjType() == OBJTYPE_MERGE) + else if(dynamic_cast(obj)) { gpIdx++; gpIdxSubMap[i] = gp[gpIdx]; @@ -1692,7 +1808,7 @@ void CGraphScene::constructLink(QList &list, QList &idlist, QVect CShape *obj = list[i]; if(!obj) continue; - if(obj->getObjType() == OBJTYPE_MERGE) + if(dynamic_cast(obj)) { CGroupShape *tmp = dynamic_cast(obj); QVector subIds = gpIdxSubMap[i]; @@ -1786,3 +1902,77 @@ void CGraphScene::constructLink(CGroupShape *obj, QVector &subIdx) } } } + +void CGraphScene::adjustRect() +{ + if(getEnvTypeFlag() == AppMode::ElfMode) + { + QRect rect = adjustRect(NULL); + if(!rect.isEmpty()) + { + setEnvRect(rect); + } + } +} + +QRect CGraphScene::adjustRect(QList *items) +{ + QRect rect = getCurGraphHead()->getGraphRect(); + QPointF topLeft(rect.width(), rect.height()); + QPointF bottomRight(0.0, 0.0); + + QList *itemList = items; + if(!itemList) + { + CPlaneHead * plane = getCurGraphHead()->getPlaneList()->value(0); + if(plane) + { + itemList = plane->getObjList(); + } + } + if(!itemList) + { + return QRect(); + } + + CShape *pobj = NULL; + QPointF ltmp,rtmp; + QList::iterator it = itemList->begin(); + for (; it != itemList->end(); it++) + { + pobj = (*it); + rtmp = pobj->getVisualBox().bottomRight(); + if(rtmp.x() > bottomRight.x()) + { + bottomRight.setX(rtmp.x()); + } + if(rtmp.y() > bottomRight.y()) + { + bottomRight.setY(rtmp.y()); + } + ltmp = pobj->getVisualBox().topLeft(); + if(ltmp.x() < topLeft.x()) + { + topLeft.setX(ltmp.x()); + } + if(ltmp.y() < topLeft.y()) + { + topLeft.setY(ltmp.y()); + } + } + QPointF offset = topLeft; + if(offset.x() > 0 || offset.y() > 0) + { + it = itemList->begin(); + for (; it != itemList->end(); it++) + { + pobj = (*it); + if(pobj->getObjType() == OBJTYPE_RELATIVE) + { + continue; + } + pobj->setPos(pobj->pos()-offset); + } + } + return QRect(QPoint(0,0), (bottomRight - offset).toPoint()); +} diff --git a/platform/src/gui/hmi/CGraphScene.h b/platform/src/gui/hmi/CGraphScene.h index 4f4827ed..2af6dcc4 100644 --- a/platform/src/gui/hmi/CGraphScene.h +++ b/platform/src/gui/hmi/CGraphScene.h @@ -29,6 +29,7 @@ public: int fileSave(const QString &pathName, unsigned char saveFlag, int fileType = 0, int ioType = 0); int iconElfSave(const QString &pathName, CShape *item); + int elfSave(const QString &pathName, QList items); QList selectedObjs(); public: void reset(); @@ -66,6 +67,8 @@ public: return m_showingPlane; } bool IsShowingPlane(short plane_no); + void moveShowPlaneRight(int start); + void moveShowPlaneLeft(int start); CGraphHead *getCurGraphHead() { @@ -81,6 +84,19 @@ public: void increaseObjID(); void decreaseObjID(); + long getElfObjID() const + { + return m_elfObjID; + } + void increaseElfObjID() + { + m_elfObjID++; + } + void decreaseElfObjID() + { + m_elfObjID--; + } + void restoreObj(CShape *obj); void restoreLinkShip(CShape *obj, QList links); @@ -122,6 +138,9 @@ public: void constructLink(QList &list, QList &idlist, QVector > &gp); void constructLink(CGroupShape *obj, QVector &subIdx); + void adjustRect(); + QRect adjustRect(QList *items); + protected: void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *mouseEvent); void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent); @@ -151,6 +170,7 @@ public: bool m_isModified; bool m_isMousePressed; long m_staticObjID; + long m_elfObjID; QSet m_visitEdgeSet; CGraphHead *m_pGraphHead; diff --git a/platform/src/gui/hmi/CGraphView.cpp b/platform/src/gui/hmi/CGraphView.cpp index d2433475..c78c105d 100644 --- a/platform/src/gui/hmi/CGraphView.cpp +++ b/platform/src/gui/hmi/CGraphView.cpp @@ -617,6 +617,15 @@ void CGraphView::setObjKeyInfo(QString objName, QString keyInfo, bool isTag) keyInfos.push_back(strList[i]); } pobj->setDynamic(keyInfos, isTag); + bool isChartObj = pobj->IsChartObj(); + if(isChartObj) + { + CChartShape* pCharObj = (CChartShape*)pobj; + pCharObj->repleaceTag(keyInfos); + pCharObj->initDataSrcInfo(); + + } + } } @@ -698,3 +707,21 @@ bool CGraphView::eventFilter(QObject *obj, QEvent *event) return QGraphicsView::eventFilter(obj, event); } + +void CGraphView::replaceDataSetTagInfo(QString objName,QString oldKey, QString newKey) +{ + if (!env()) + { + return; + } + CShape *pObj = env()->getqsFocusObj(objName); + if (pObj == NULL) + { + return; + } + + if (pObj->getObjType() == OBJTYPE_RTLINEGRAPH) + { + ((CChartShape *)pObj)->replaceDataSetTagInfo(oldKey,newKey); + } +} diff --git a/platform/src/gui/hmi/CGraphView.h b/platform/src/gui/hmi/CGraphView.h index c78a258c..d3d3f0be 100644 --- a/platform/src/gui/hmi/CGraphView.h +++ b/platform/src/gui/hmi/CGraphView.h @@ -58,6 +58,8 @@ public slots: void setFocusObjTwinkle(bool enable, int freq = -1, int onColor = -1, int offColor = -1); void setPropertyValue(QString objName, QString property, QVariant value); void setObjValue(QString objName, QVariant value); + //caodingfa:新增替换实时曲线图中数据源中的测点中变量 + void replaceDataSetTagInfo(QString objName,QString oldKey, QString newKey); QStringList getObjValue(QString objName); QString execute(const QString &script); diff --git a/platform/src/gui/hmi/CGraphWnd.cpp b/platform/src/gui/hmi/CGraphWnd.cpp index 2cfd2182..650d6062 100644 --- a/platform/src/gui/hmi/CGraphWnd.cpp +++ b/platform/src/gui/hmi/CGraphWnd.cpp @@ -4,8 +4,14 @@ CGraphWnd::CGraphWnd(int id, char type, CGraphDoc *doc, QWidget *parent, Qt::WindowFlags flag) - : QMainWindow(parent, flag), m_wndID(id), m_wndType(type), m_graphDoc(doc) + : CustomUiMainWindow(parent), m_wndID(id), m_wndType(type), m_graphDoc(doc) { + if(type == AppMode::DesignerMode) + { + setContentsMargins(6,0,6,2); + } + + CustomUiMainWindow::setAutoLayout(true); m_pMenubar = nullptr; m_pFileMenu = nullptr; m_pHelpMenu = nullptr; @@ -33,7 +39,11 @@ CGraphDoc *CGraphWnd::getGraphDoc() void CGraphWnd::loadAllIcon() { - ((CGraphApp *)qApp)->loadAllIconInfo(); + QString path; + CBaseInstance()->getPathName(CBase::PATH_TYPE_ICON, path); + ((CGraphApp *)qApp)->loadAllIconInfo(path, "*.ilx"); + CBaseInstance()->getPathName(CBase::PATH_TYPE_ELF, path); + ((CGraphApp *)qApp)->loadAllIconInfo(path, "*.elx"); return; } diff --git a/platform/src/gui/hmi/CGraphWnd.h b/platform/src/gui/hmi/CGraphWnd.h index ccd61202..f042b851 100644 --- a/platform/src/gui/hmi/CGraphWnd.h +++ b/platform/src/gui/hmi/CGraphWnd.h @@ -5,8 +5,9 @@ #include #include #include "CGraphApp.h" +#include "pub_widget/CustomMainWindow.h" -class CGraphWnd : public QMainWindow +class CGraphWnd : public CustomUiMainWindow { Q_OBJECT public: diff --git a/platform/src/gui/hmi/CMenuString.h b/platform/src/gui/hmi/CMenuString.h index 5ff3d71d..068f512f 100644 --- a/platform/src/gui/hmi/CMenuString.h +++ b/platform/src/gui/hmi/CMenuString.h @@ -24,6 +24,8 @@ const char *g_wnd_script = QT_TR_NOOP("脚本编辑器"); const char *g_wnd_new_gi = QT_TR_NOOP("新建图元窗口"); const char *g_wnd_toolbox = QT_TR_NOOP("工具箱"); +const char *g_wnd_file_widget = QT_TR_NOOP("页面"); +const char *g_wnd_elfbox = QT_TR_NOOP("精灵图元"); const char *g_property_editor = QT_TR_NOOP("属性编辑器"); const char *g_data_bind_editor = QT_TR_NOOP("联库信息"); const char *g_bind_check_editor = QT_TR_NOOP("模型检查"); diff --git a/platform/src/gui/hmi/CUndoCommand.cpp b/platform/src/gui/hmi/CUndoCommand.cpp index ca6b1474..7020b373 100644 --- a/platform/src/gui/hmi/CUndoCommand.cpp +++ b/platform/src/gui/hmi/CUndoCommand.cpp @@ -9,6 +9,7 @@ #include "../GraphShape/include/CGroupShape.h" #include "../GraphShape/include/CIconShape.h" #include "../GraphShape/include/CLinkLine.h" +#include "../GraphShape/include/CNewElfShape.h" int g_nActionIndex = 0; @@ -54,27 +55,27 @@ CUndoCommand::CUndoCommand(CShape *item, CShape *pre, QUndoCommand *parent) m_pPreviousItem->m_prePos = pre->pos(); //qDebug() << "m_pPreviousItem:" << m_pPreviousItem->m_prePos << m_pPreviousItem->pos(); - if(m_pCurrentItem->getObjType() == OBJTYPE_MERGE) + if(dynamic_cast(m_pCurrentItem)) { - CGroupShape *tmp = dynamic_cast(m_pCurrentItem); - QList *subList = tmp->getMergeListPtr(); - QList::iterator it = subList->begin(); - for(; it != subList->end(); it++) - { - (*it)->m_prePos = (*it)->pos(); - } - - it = subList->begin(); - for(; it != subList->end(); it++) - { - CShape *s = *it; - if(s->getObjType() == OBJTYPE_RELATIVE) + QList *subList = dynamic_cast(m_pCurrentItem)->getMergeListPtr(); + if(subList){ + QList::iterator it = subList->begin(); + for(; it != subList->end(); it++) { - CLinkLine *link = dynamic_cast(s); - link->adjust(true); + (*it)->m_prePos = (*it)->pos(); + } + it = subList->begin(); + for(; it != subList->end(); it++) + { + CShape *s = *it; + if(s->getObjType() == OBJTYPE_RELATIVE) + { + CLinkLine *link = dynamic_cast(s); + link->adjust(true); + } } } - }//lj + } } m_pNextItem->setObjId(item->m_objId); @@ -141,6 +142,10 @@ void CUndoCommand::undo() // m_pCurrentItem->setPos(m_pPreviousItem->pos()); // m_pCurrentItem->m_prePos = m_pPreviousItem->pos(); } + else if(m_pCurrentItem->getObjType() == OBJTYPE_ELF) + { + dynamic_cast(m_pCurrentItem)->reverse(m_pPreviousItem); + } else { m_pCurrentItem->copy(m_pPreviousItem); @@ -200,6 +205,10 @@ void CUndoCommand::redo() // }//lj // m_pCurrentItem->m_prePos = m_pNextItem->pos(); } + else if(m_pCurrentItem->getObjType() == OBJTYPE_ELF) + { + dynamic_cast(m_pCurrentItem)->reverse(m_pNextItem); + } else { m_pCurrentItem->copy(m_pNextItem); @@ -278,6 +287,22 @@ void CAddCommand::buildChildId(CShape *groupItem) qDebug() << "m_gpVec:" << m_gpVec; } + else if(groupItem->getObjType() == OBJTYPE_ELF) + { + QVector idlist; + CNewElfShape *pGroupObj = dynamic_cast(groupItem); + QList *pListObj = pGroupObj->getMergeListPtr(); + foreach (CShape *obj, *pListObj) + { + idlist.push_back(obj->getObjId()); + +// obj->setObjId(m_pScene->getElfObjID()); + obj->setNameString(QString("obj_%1").arg(obj->getObjId())); +// m_pScene->increaseElfObjID(); + } + + m_gpVec.push_back(idlist); + } } void CAddCommand::undo() @@ -296,7 +321,7 @@ void CAddCommand::undo() QList tempItem; foreach(CShape *item, m_listItem) { - if (item->getObjType() == OBJTYPE_MERGE) + if (dynamic_cast(item)) { CGroupShape *pObj = dynamic_cast(item); QList *sublist = pObj->getMergeListPtr(); @@ -349,7 +374,7 @@ void CAddCommand::redo() m_pScene->addItem(item); item->setPos(item->pos()); - if(item->getObjType() == OBJTYPE_MERGE) + if(dynamic_cast(item)) { CGroupShape *tmp = dynamic_cast(item); QList *sublist = tmp->getMergeListPtr(); @@ -437,10 +462,9 @@ void CRemoveCommand::undo() { foreach (CShape * item, m_listItem) { - if (item->getObjType() == OBJTYPE_MERGE) + if(dynamic_cast(item)) { - CGroupShape *pObj = dynamic_cast(item); - QList *sublist = pObj->getMergeListPtr(); + QList *sublist = dynamic_cast(item)->getMergeListPtr(); if (sublist) { QList::iterator it; @@ -473,10 +497,9 @@ void CRemoveCommand::redo() dynamic_cast(m_pScene)->clearCurrentLinkLine(); } - if (item->getObjType() == OBJTYPE_MERGE) + if(dynamic_cast(item)) { - CGroupShape *pObj = dynamic_cast(item); - QList *sublist = pObj->getMergeListPtr(); + QList *sublist = dynamic_cast(item)->getMergeListPtr(); if (sublist) { QList::iterator it; @@ -718,9 +741,10 @@ void CUnGroupCommand::redo() g_nActionIndex++; } -CAddPlaneCommand::CAddPlaneCommand(CDesignerWnd *wnd, QUndoCommand *parent) +CAddPlaneCommand::CAddPlaneCommand(int plane, CDesignerWnd *wnd, QUndoCommand *parent) : QUndoCommand(parent), - m_pWnd(wnd) + m_pWnd(wnd), + m_nPlane(plane) { } @@ -732,19 +756,20 @@ CAddPlaneCommand::~CAddPlaneCommand() void CAddPlaneCommand::undo() { - m_pWnd->removeLayout(); + m_pWnd->removeLayout(m_nPlane); g_nActionIndex--; } void CAddPlaneCommand::redo() { - m_pWnd->addLayout(); + m_pWnd->addLayout(m_nPlane); g_nActionIndex++; } -CRemovePlaneCommand::CRemovePlaneCommand(CDesignerWnd *wnd, QUndoCommand *parent) +CRemovePlaneCommand::CRemovePlaneCommand(int plane, CDesignerWnd *wnd, QUndoCommand *parent) : QUndoCommand(parent), - m_pWnd(wnd) + m_pWnd(wnd), + m_nPlane(plane) { } @@ -756,13 +781,13 @@ CRemovePlaneCommand::~CRemovePlaneCommand() void CRemovePlaneCommand::undo() { - m_pWnd->addLayout(); + m_pWnd->addLayout(m_nPlane); g_nActionIndex--; } void CRemovePlaneCommand::redo() { - m_pWnd->removeLayout(); + m_pWnd->removeLayout(m_nPlane); g_nActionIndex++; } diff --git a/platform/src/gui/hmi/CUndoCommand.h b/platform/src/gui/hmi/CUndoCommand.h index 258ed626..794cd0b3 100644 --- a/platform/src/gui/hmi/CUndoCommand.h +++ b/platform/src/gui/hmi/CUndoCommand.h @@ -103,7 +103,7 @@ class CAddPlaneCommand : public QUndoCommand { public: enum { Id = 1005 }; - explicit CAddPlaneCommand(CDesignerWnd * wnd, QUndoCommand *parent = 0); + explicit CAddPlaneCommand(int plane, CDesignerWnd * wnd, QUndoCommand *parent = 0); ~CAddPlaneCommand(); void undo() override; @@ -111,13 +111,14 @@ public: int id() const override { return Id; } private: CDesignerWnd * m_pWnd; + int m_nPlane; }; class CRemovePlaneCommand : public QUndoCommand { public: enum { Id = 1006 }; - explicit CRemovePlaneCommand(CDesignerWnd * wnd, QUndoCommand *parent = 0); + explicit CRemovePlaneCommand(int plane, CDesignerWnd * wnd, QUndoCommand *parent = 0); ~CRemovePlaneCommand(); void undo() override; @@ -125,6 +126,7 @@ public: int id() const override { return Id; } private: CDesignerWnd * m_pWnd; + int m_nPlane; }; //class CAddLinkLineCommand : public QUndoCommand diff --git a/platform/src/gui/hmi/case/CSimulate.cpp b/platform/src/gui/hmi/case/CSimulate.cpp index c6ee0f37..968b9af4 100644 --- a/platform/src/gui/hmi/case/CSimulate.cpp +++ b/platform/src/gui/hmi/case/CSimulate.cpp @@ -142,7 +142,7 @@ void CSimulate::bfs(CShape *obj, int island) QString tagName = tagList[0]; QString objName; - if(m_topoObjMap[index]->getObjType() == OBJTYPE_BUS) + if(m_topoObjMap[index]->getObjType() == OBJTYPE_BUS || m_topoObjMap[index]->getObjType() == OBJTYPE_DYLINKLINE) { if(preIndex != -1) { diff --git a/platform/src/gui/hmi/dialog/AnimationConfigDialog/CAnimationConfigDialog.cpp b/platform/src/gui/hmi/dialog/AnimationConfigDialog/CAnimationConfigDialog.cpp index a95dec7d..05b3e3d0 100644 --- a/platform/src/gui/hmi/dialog/AnimationConfigDialog/CAnimationConfigDialog.cpp +++ b/platform/src/gui/hmi/dialog/AnimationConfigDialog/CAnimationConfigDialog.cpp @@ -57,12 +57,16 @@ int CSpinBoxGroup::valueCompare(_T min, _T max) } CAnimationConfigDialog::CAnimationConfigDialog(CShape *shape, QWidget *parent) : - QDialog(parent), + CustomUiDialog(parent), ui(new Ui::CAnimationConfigDialog), m_pShape(shape) { + setWindowTitle(tr("动画配置")); + ui->setupUi(this); initialize(); + + CustomUiDialog::setAutoLayout(true); } CAnimationConfigDialog::~CAnimationConfigDialog() @@ -211,7 +215,7 @@ void CAnimationConfigDialog::reject() delete m_pAnimationManage; } m_pAnimationManage = Q_NULLPTR; - return QDialog::reject(); + return CustomUiDialog::reject(); } void CAnimationConfigDialog::accept() @@ -227,7 +231,7 @@ void CAnimationConfigDialog::accept() savePositionConfig(); saveScaleConfig(); m_pShape->setAnimationManage(m_pAnimationManage); - return QDialog::accept(); + return CustomUiDialog::accept(); } void CAnimationConfigDialog::saveRotateConfig() diff --git a/platform/src/gui/hmi/dialog/AnimationConfigDialog/CAnimationConfigDialog.h b/platform/src/gui/hmi/dialog/AnimationConfigDialog/CAnimationConfigDialog.h index 4b86b091..040bf124 100644 --- a/platform/src/gui/hmi/dialog/AnimationConfigDialog/CAnimationConfigDialog.h +++ b/platform/src/gui/hmi/dialog/AnimationConfigDialog/CAnimationConfigDialog.h @@ -1,10 +1,10 @@ #ifndef CANIMATIONCONFIGDIALOG_H #define CANIMATIONCONFIGDIALOG_H -#include #include #include "../include/CShape.h" +#include "pub_widget/CustomDialog.h" namespace Ui { class CAnimationConfigDialog; @@ -28,7 +28,7 @@ private: QString m_strSpinType; }; -class CAnimationConfigDialog : public QDialog +class CAnimationConfigDialog : public CustomUiDialog { Q_OBJECT diff --git a/platform/src/gui/hmi/dialog/ShapeConfigDialog/CFindReplace.cpp b/platform/src/gui/hmi/dialog/ShapeConfigDialog/CFindReplace.cpp index 16f4afc7..84552af4 100644 --- a/platform/src/gui/hmi/dialog/ShapeConfigDialog/CFindReplace.cpp +++ b/platform/src/gui/hmi/dialog/ShapeConfigDialog/CFindReplace.cpp @@ -3,14 +3,18 @@ #include "../GraphShape/include/CGroupShape.h" CFindReplace::CFindReplace(QWidget *parent) - : QDialog(parent) + : CustomUiDialog(parent) { + setWindowTitle(tr("联库替换")); + ui.setupUi(this); setupSignal(); if(parent) { m_pWnd = dynamic_cast(parent); } + + CustomUiDialog::setAutoLayout(true); } CFindReplace::~CFindReplace() @@ -86,7 +90,7 @@ void CFindReplace::onEnableRepBtn(const QString &text) void CFindReplace::onCloseBtn() { - done(QDialog::Accepted); + done(CustomUiDialog::Accepted); } void CFindReplace::onReplaceBtn() diff --git a/platform/src/gui/hmi/dialog/ShapeConfigDialog/CFindReplace.h b/platform/src/gui/hmi/dialog/ShapeConfigDialog/CFindReplace.h index 3621a6b6..df94601f 100644 --- a/platform/src/gui/hmi/dialog/ShapeConfigDialog/CFindReplace.h +++ b/platform/src/gui/hmi/dialog/ShapeConfigDialog/CFindReplace.h @@ -2,11 +2,12 @@ #define CFINDREPLACE_H #include "ui_replaceDialog.h" +#include "pub_widget/CustomDialog.h" class CShape; class CDesignerWnd; -class CFindReplace : public QDialog +class CFindReplace : public CustomUiDialog { Q_OBJECT public: diff --git a/platform/src/gui/hmi/dialog/ShapeConfigDialog/CInputDialog.cpp b/platform/src/gui/hmi/dialog/ShapeConfigDialog/CInputDialog.cpp index 6ba1a8c5..05ca770c 100644 --- a/platform/src/gui/hmi/dialog/ShapeConfigDialog/CInputDialog.cpp +++ b/platform/src/gui/hmi/dialog/ShapeConfigDialog/CInputDialog.cpp @@ -5,16 +5,16 @@ #include CInputDialog::CInputDialog(QWidget *parent) - : QDialog(parent), + : CustomDialog(parent), m_nInputId(0) { - QVBoxLayout * layout = new QVBoxLayout(this); + m_pMainLayout = new QVBoxLayout(this); QDialogButtonBox * buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - layout->addWidget(buttonBox); - layout->setMargin(3); - layout->setSpacing(3); - setLayout(layout); + m_pMainLayout->addWidget(buttonBox); + m_pMainLayout->setMargin(3); + m_pMainLayout->setSpacing(3); + setLayout(m_pMainLayout); connect(buttonBox, &QDialogButtonBox::accepted, [=]{accept();}); connect(buttonBox, &QDialogButtonBox::rejected, [=]{reject();}); } @@ -26,7 +26,7 @@ CInputDialog::~CInputDialog() int CInputDialog::addOneInput(const QString &text, const QString &value) { - QVBoxLayout *gLayout = dynamic_cast(this->layout()); + QVBoxLayout *gLayout = dynamic_cast(m_pMainLayout); if(gLayout) { QVBoxLayout * layout = new QVBoxLayout; diff --git a/platform/src/gui/hmi/dialog/ShapeConfigDialog/CInputDialog.h b/platform/src/gui/hmi/dialog/ShapeConfigDialog/CInputDialog.h index 8d023aaf..aa51cdd2 100644 --- a/platform/src/gui/hmi/dialog/ShapeConfigDialog/CInputDialog.h +++ b/platform/src/gui/hmi/dialog/ShapeConfigDialog/CInputDialog.h @@ -2,11 +2,11 @@ #define CINPUTDIALOG_H #include -#include #include +#include "pub_widget/CustomDialog.h" class QLineEdit; -class CInputDialog : public QDialog +class CInputDialog : public CustomDialog { Q_OBJECT public: @@ -20,7 +20,7 @@ public: private: int m_nInputId; QMap m_inputMap; - + QVBoxLayout *m_pMainLayout; }; #endif // CINPUTDIALOG_H diff --git a/platform/src/gui/hmi/dialog/ShapeConfigDialog/CShapeConfigDialog.cpp b/platform/src/gui/hmi/dialog/ShapeConfigDialog/CShapeConfigDialog.cpp index 270cdf71..8aa068ca 100644 --- a/platform/src/gui/hmi/dialog/ShapeConfigDialog/CShapeConfigDialog.cpp +++ b/platform/src/gui/hmi/dialog/ShapeConfigDialog/CShapeConfigDialog.cpp @@ -25,7 +25,7 @@ #include "../../../include/CXMLStream.h" CShapeConfigDialog::CShapeConfigDialog(CShape *shape, QWidget *parent) - : QDialog(parent), + : CustomDialog(parent), m_shape(shape), m_dataBindWidget(nullptr), m_scriptWidget(nullptr), @@ -34,6 +34,8 @@ CShapeConfigDialog::CShapeConfigDialog(CShape *shape, QWidget *parent) m_tableWidget(nullptr), m_strategyConfigModel(nullptr) { + setWindowTitle(tr("着色策略配置")); + QRect rt = QApplication::desktop()->availableGeometry(); resize(rt.width() / 2, rt.height() / 2); setAcceptDrops(true); @@ -58,7 +60,6 @@ void CShapeConfigDialog::initialize() } // m_tabWidget->addTab(m_scriptWidget, tr("函数绑定")); m_tabWidget->addTab(m_strategyConfigWidget, tr("策略配置")); - setWindowTitle(tr("属性配置")); QGridLayout * pLayout = new QGridLayout(); pLayout->setMargin(0); pLayout->addWidget(m_tabWidget); @@ -399,11 +400,11 @@ bool CShapeConfigDialog::getInputStrategyName(QString &strategyName, QString &st QRegExp descExp("[\\d|\\w|\u4e00-\u9fa5]+"); while(ok) { - CInputDialog dialog; + CInputDialog dialog(this); int nameId = dialog.addOneInput(tr("策略名称:"), name); int descId = dialog.addOneInput(tr("策略描述:"), desc); dialog.setWindowFlag(Qt::WindowStaysOnTopHint, true); - if(dialog.exec() == QDialog::Accepted) + if(dialog.exec() == CustomDialog::Accepted) { name = dialog.getInputText(nameId); desc = dialog.getInputText(descId); diff --git a/platform/src/gui/hmi/dialog/ShapeConfigDialog/CShapeConfigDialog.h b/platform/src/gui/hmi/dialog/ShapeConfigDialog/CShapeConfigDialog.h index 5d8dfa2d..446d66d3 100644 --- a/platform/src/gui/hmi/dialog/ShapeConfigDialog/CShapeConfigDialog.h +++ b/platform/src/gui/hmi/dialog/ShapeConfigDialog/CShapeConfigDialog.h @@ -1,8 +1,8 @@ #ifndef CSHAPECONFIGDIALOG_H #define CSHAPECONFIGDIALOG_H -#include #include "CStrategyConfigModel.h" +#include "pub_widget/CustomDialog.h" class CShape; class QTabWidget; @@ -14,7 +14,7 @@ class CRetriever; class QTableWidget; class QSplitter; -class CShapeConfigDialog : public QDialog +class CShapeConfigDialog : public CustomDialog { Q_OBJECT diff --git a/platform/src/gui/hmi/dialog/ShapeConfigDialog/CStrategyConfigModel.h b/platform/src/gui/hmi/dialog/ShapeConfigDialog/CStrategyConfigModel.h index 92a25608..f93db61e 100644 --- a/platform/src/gui/hmi/dialog/ShapeConfigDialog/CStrategyConfigModel.h +++ b/platform/src/gui/hmi/dialog/ShapeConfigDialog/CStrategyConfigModel.h @@ -24,6 +24,15 @@ struct COLOR_CONFIG_VALID int fill_on_color_valid; /* 闪烁填充亮色 */ int freq_down_color_valid; /* 闪烁线色暗色 */ int fill_down_color_valid; /* 闪烁填充暗色 */ + + COLOR_CONFIG_VALID(){ + line_color_valid = 0; + fill_color_valid = 0; + freq_on_color_valid = 0; + fill_on_color_valid = 0; + freq_down_color_valid = 0; + fill_down_color_valid = 0; + } } ; #define ListColorConfig QList diff --git a/platform/src/gui/hmi/dialog/ShapeConfigDialog/CTextReplacer.cpp b/platform/src/gui/hmi/dialog/ShapeConfigDialog/CTextReplacer.cpp index 136f8dc0..12692182 100644 --- a/platform/src/gui/hmi/dialog/ShapeConfigDialog/CTextReplacer.cpp +++ b/platform/src/gui/hmi/dialog/ShapeConfigDialog/CTextReplacer.cpp @@ -3,12 +3,14 @@ #include "../GraphShape/include/CTextShape.h" CTextReplacer::CTextReplacer(QWidget *parent) : - QDialog(parent), + CustomUiDialog(parent), ui(new Ui::CTextReplacer) { ui->setupUi(this); setWindowTitle(tr("文本替换")); connect(ui->replace, &QPushButton::clicked, this, &CTextReplacer::replace); + + CustomUiDialog::setAutoLayout(true); } CTextReplacer::~CTextReplacer() diff --git a/platform/src/gui/hmi/dialog/ShapeConfigDialog/CTextReplacer.h b/platform/src/gui/hmi/dialog/ShapeConfigDialog/CTextReplacer.h index 9ff60cd5..af3cc5d4 100644 --- a/platform/src/gui/hmi/dialog/ShapeConfigDialog/CTextReplacer.h +++ b/platform/src/gui/hmi/dialog/ShapeConfigDialog/CTextReplacer.h @@ -1,7 +1,7 @@ #ifndef CTEXTREPLACER_H #define CTEXTREPLACER_H -#include +#include "pub_widget/CustomDialog.h" namespace Ui { class CTextReplacer; @@ -9,7 +9,7 @@ class CTextReplacer; class CTextShape; -class CTextReplacer : public QDialog +class CTextReplacer : public CustomUiDialog { Q_OBJECT diff --git a/platform/src/gui/hmi/dialog/ShapeConfigDialog/CTextShapeEditor.cpp b/platform/src/gui/hmi/dialog/ShapeConfigDialog/CTextShapeEditor.cpp index 887dfa38..e664ebdf 100644 --- a/platform/src/gui/hmi/dialog/ShapeConfigDialog/CTextShapeEditor.cpp +++ b/platform/src/gui/hmi/dialog/ShapeConfigDialog/CTextShapeEditor.cpp @@ -6,13 +6,15 @@ #include CTextShapeEditor::CTextShapeEditor(CTextShape *shape, QWidget *parent) - : QDialog(parent), + : CustomUiDialog(parent), m_pShape(shape) { initialize(); QString strShapeName; m_pShape->getObjName(strShapeName); setWindowTitle(QObject::tr("文字编辑") + " - " + strShapeName); + + setAutoLayout(true); } CTextShapeEditor::~CTextShapeEditor() @@ -32,7 +34,7 @@ void CTextShapeEditor::initialize() QPushButton * pCancleBtn = new QPushButton(QObject::tr("取消"), this); connect(pCancleBtn, &QPushButton::clicked, [=](){ reject(); }); connect(pSaveBtn, &QPushButton::clicked, [=](){ - m_pShape->setString(pTextEditor->toPlainText()); + m_pShape->setString(pTextEditor->toPlainText(), true); accept(); }); pHLayout->addWidget(pSaveBtn); diff --git a/platform/src/gui/hmi/dialog/ShapeConfigDialog/CTextShapeEditor.h b/platform/src/gui/hmi/dialog/ShapeConfigDialog/CTextShapeEditor.h index 9b6bab7f..da15df4c 100644 --- a/platform/src/gui/hmi/dialog/ShapeConfigDialog/CTextShapeEditor.h +++ b/platform/src/gui/hmi/dialog/ShapeConfigDialog/CTextShapeEditor.h @@ -1,13 +1,13 @@ #ifndef CTEXTSHAPEEDITOR_H #define CTEXTSHAPEEDITOR_H -#include +#include "pub_widget/CustomDialog.h" class QTextEdit; class CTextShape; class CDesignerWnd; -class CTextShapeEditor : public QDialog +class CTextShapeEditor : public CustomUiDialog { public: CTextShapeEditor(CTextShape *shape, QWidget *parent = 0); @@ -20,4 +20,4 @@ private: CTextShape * m_pShape; }; -#endif // CTEXTSHAPEEDITOR_H \ No newline at end of file +#endif // CTEXTSHAPEEDITOR_H diff --git a/platform/src/gui/hmi/dialog/ShapeConfigDialog/replaceDialog.ui b/platform/src/gui/hmi/dialog/ShapeConfigDialog/replaceDialog.ui index 0267e38b..8922b5f4 100644 --- a/platform/src/gui/hmi/dialog/ShapeConfigDialog/replaceDialog.ui +++ b/platform/src/gui/hmi/dialog/ShapeConfigDialog/replaceDialog.ui @@ -21,12 +21,12 @@ - 290 - 130 + 16777215 + 16777215 - 连库替换 + 联库替换 false diff --git a/platform/src/gui/hmi/dialog/globalConfigDialog/CGlobalConfigDialog.cpp b/platform/src/gui/hmi/dialog/globalConfigDialog/CGlobalConfigDialog.cpp index 317bf4df..96768c82 100644 --- a/platform/src/gui/hmi/dialog/globalConfigDialog/CGlobalConfigDialog.cpp +++ b/platform/src/gui/hmi/dialog/globalConfigDialog/CGlobalConfigDialog.cpp @@ -6,13 +6,16 @@ #include CGlobalConfigDialog::CGlobalConfigDialog(QWidget *parent) : - QDialog(parent), + CustomUiDialog(parent), ui(new Ui::CGlobalConfigDialog) { + setWindowTitle(tr("全局变量配置")); ui->setupUi(this); initView(); initScriptCfg(); + + CustomUiDialog::setAutoLayout(true); } CGlobalConfigDialog::~CGlobalConfigDialog() diff --git a/platform/src/gui/hmi/dialog/globalConfigDialog/CGlobalConfigDialog.h b/platform/src/gui/hmi/dialog/globalConfigDialog/CGlobalConfigDialog.h index 5ee7a205..816ebd77 100644 --- a/platform/src/gui/hmi/dialog/globalConfigDialog/CGlobalConfigDialog.h +++ b/platform/src/gui/hmi/dialog/globalConfigDialog/CGlobalConfigDialog.h @@ -1,14 +1,14 @@ #ifndef CGLOBALCONFIGDIALOG_H #define CGLOBALCONFIGDIALOG_H -#include +#include "pub_widget/CustomDialog.h" namespace Ui { class CGlobalConfigDialog; } class QTableWidgetItem; -class CGlobalConfigDialog : public QDialog +class CGlobalConfigDialog : public CustomUiDialog { Q_OBJECT public: diff --git a/platform/src/gui/hmi/dialog/hmiConfigDialog/CHmiConfig.cpp b/platform/src/gui/hmi/dialog/hmiConfigDialog/CHmiConfig.cpp index f3d0ffc4..10c82533 100644 --- a/platform/src/gui/hmi/dialog/hmiConfigDialog/CHmiConfig.cpp +++ b/platform/src/gui/hmi/dialog/hmiConfigDialog/CHmiConfig.cpp @@ -1,6 +1,7 @@ #include "CHmiConfig.h" #include "ui_CConfigDialog.h" #include "CFileDelegate.h" +#include "CComboxDelegate.h" #include "../include/CBase.h" #include #include @@ -8,13 +9,16 @@ #include CHmiConfig::CHmiConfig(QWidget *parent) : - QDialog(parent), + CustomUiDialog(parent), ui(new Ui::CConfigDialog) { + setWindowTitle(tr("页面配置")); ui->setupUi(this); initView(); initData(); + + CustomUiDialog::setAutoLayout(true); } CHmiConfig::~CHmiConfig() @@ -47,11 +51,12 @@ void CHmiConfig::initView() ui->m_homePage->setPath(picPath); ui->m_backImg->setPath(pixPath); - ui->m_screenTable->setColumnCount(1); - ui->m_screenTable->horizontalHeader()->setVisible(false); + ui->m_screenTable->setColumnCount(2); + ui->m_screenTable->setHorizontalHeaderLabels(QStringList() << tr("屏幕首页面") << tr("屏幕号")); ui->m_screenTable->horizontalHeader()->setStretchLastSection(true); - CFileDelegate *delegate = new CFileDelegate(this, picPath); - ui->m_screenTable->setItemDelegate(delegate); + ui->m_screenTable->setColumnWidth(0, 300); + ui->m_screenTable->setItemDelegateForColumn(0, new CFileDelegate(this, picPath)); + ui->m_screenTable->setItemDelegateForColumn(1, new CComboxDelegate(this)); } void CHmiConfig::initData() @@ -77,6 +82,7 @@ void CHmiConfig::initScreenCfg() QJsonObject readJsonObject = readJsonResponse.object(); QJsonObject obj = readJsonObject["config"].toObject(); QJsonObject screenObj = obj["screen"].toObject(); + QJsonObject screenNoObj = obj["screenNo"].toObject(); ui->m_width->setText(QString::number(obj["w"].toInt())); ui->m_height->setText(QString::number(obj["h"].toInt())); @@ -95,20 +101,39 @@ void CHmiConfig::initScreenCfg() ui->m_screenTable->setItem(nRow++, 0, item); ++iter; } + nRow = 0; + iter = screenNoObj.begin(); + while(iter != screenNoObj.end() && nRow < nScreen) + { + QTableWidgetItem *item = new QTableWidgetItem(iter.value().toString()); + ui->m_screenTable->setItem(nRow++, 1, item); + ++iter; + } } void CHmiConfig::saveScreenCfg() { QJsonObject writeJson; QJsonObject screenObj; + QJsonObject screenNoObj; for(int nIndex=0; nIndexm_screenTable->rowCount(); ++nIndex) { if(!ui->m_screenTable->item(nIndex, 0)) { screenObj.insert(QString("s%1").arg(nIndex+1), ""); - continue; } - screenObj.insert(QString("s%1").arg(nIndex+1), ui->m_screenTable->item(nIndex, 0)->text()); + else + { + screenObj.insert(QString("s%1").arg(nIndex+1), ui->m_screenTable->item(nIndex, 0)->text()); + } + if(!ui->m_screenTable->item(nIndex, 1)) + { + screenNoObj.insert(QString("n%1").arg(nIndex+1), "0"); + } + else + { + screenNoObj.insert(QString("n%1").arg(nIndex+1), ui->m_screenTable->item(nIndex, 1)->text()); + } } QJsonObject obj; obj.insert("w", ui->m_width->text().toInt()); @@ -121,6 +146,7 @@ void CHmiConfig::saveScreenCfg() obj.insert("layout-single", ui->m_isSingleSreen->isChecked()); obj.insert("screen-num", ui->m_screenNum->value()); obj.insert("screen", screenObj); + obj.insert("screenNo", screenNoObj); writeJson.insert("config", obj); QJsonDocument document; diff --git a/platform/src/gui/hmi/dialog/hmiConfigDialog/CHmiConfig.h b/platform/src/gui/hmi/dialog/hmiConfigDialog/CHmiConfig.h index 0406fc4d..864e4ad0 100644 --- a/platform/src/gui/hmi/dialog/hmiConfigDialog/CHmiConfig.h +++ b/platform/src/gui/hmi/dialog/hmiConfigDialog/CHmiConfig.h @@ -1,13 +1,13 @@ #ifndef CCONFIGDIALOG_H #define CCONFIGDIALOG_H -#include +#include "pub_widget/CustomDialog.h" namespace Ui { class CConfigDialog; } -class CHmiConfig : public QDialog +class CHmiConfig : public CustomUiDialog { Q_OBJECT diff --git a/platform/src/gui/hmi/dialog/layerDialog/CLayerDlg.cpp b/platform/src/gui/hmi/dialog/layerDialog/CLayerDlg.cpp index 96469614..f875af8a 100644 --- a/platform/src/gui/hmi/dialog/layerDialog/CLayerDlg.cpp +++ b/platform/src/gui/hmi/dialog/layerDialog/CLayerDlg.cpp @@ -3,7 +3,7 @@ #include CLayerDlg::CLayerDlg(QWidget *parent, const QVector &initPlane, const QMap &planeName) : - QDialog(parent), + CustomDialog(parent), m_planeMap(planeName) { initView(); @@ -51,7 +51,7 @@ void CLayerDlg::slotStateChg(bool text) void CLayerDlg::closeEvent(QCloseEvent *event) { emit layerStr(getLayerStr()); - QDialog::closeEvent(event); + CustomDialog::closeEvent(event); } void CLayerDlg::initView() @@ -74,6 +74,7 @@ void CLayerDlg::initView() setLayout(layout); setWindowTitle(tr("图层工具")); + setMinimumSize(300,150); } QString CLayerDlg::getLayerStr() diff --git a/platform/src/gui/hmi/dialog/layerDialog/CLayerDlg.h b/platform/src/gui/hmi/dialog/layerDialog/CLayerDlg.h index 6160c264..b787478d 100644 --- a/platform/src/gui/hmi/dialog/layerDialog/CLayerDlg.h +++ b/platform/src/gui/hmi/dialog/layerDialog/CLayerDlg.h @@ -1,10 +1,10 @@ #ifndef CLAYERDLG_H #define CLAYERDLG_H -#include #include +#include "pub_widget/CustomDialog.h" -class CLayerDlg : public QDialog +class CLayerDlg : public CustomDialog { Q_OBJECT diff --git a/platform/src/gui/hmi/dialog/statisticsSrcCfgDialog/CTagSourceCfgDialog.cpp b/platform/src/gui/hmi/dialog/statisticsSrcCfgDialog/CTagSourceCfgDialog.cpp index 32175445..e79170eb 100644 --- a/platform/src/gui/hmi/dialog/statisticsSrcCfgDialog/CTagSourceCfgDialog.cpp +++ b/platform/src/gui/hmi/dialog/statisticsSrcCfgDialog/CTagSourceCfgDialog.cpp @@ -6,13 +6,17 @@ #include "../GraphShape/ChartShape/CChartShape.h" CTagSourceCfgDialog::CTagSourceCfgDialog(CChartShape *shape, QWidget *parent) : - QDialog(parent), + CustomUiDialog(parent), ui(new Ui::CTagSourceCfgDialog), m_shape(shape), m_model(Q_NULLPTR) { + setWindowTitle(tr("数据源配置")); + ui->setupUi(this); initialize(); + + CustomUiDialog::setAutoLayout(true); } CTagSourceCfgDialog::~CTagSourceCfgDialog() @@ -37,10 +41,10 @@ void CTagSourceCfgDialog::initialize() void CTagSourceCfgDialog::accept() { m_shape->setChartDynamicTagInfo(m_model->getTagInfo()); - QDialog::accept(); + CustomUiDialog::accept(); } void CTagSourceCfgDialog::reject() { - QDialog::reject(); + CustomUiDialog::reject(); } diff --git a/platform/src/gui/hmi/dialog/statisticsSrcCfgDialog/CTagSourceCfgDialog.h b/platform/src/gui/hmi/dialog/statisticsSrcCfgDialog/CTagSourceCfgDialog.h index fe0b87dd..c664869e 100644 --- a/platform/src/gui/hmi/dialog/statisticsSrcCfgDialog/CTagSourceCfgDialog.h +++ b/platform/src/gui/hmi/dialog/statisticsSrcCfgDialog/CTagSourceCfgDialog.h @@ -1,7 +1,7 @@ #ifndef CTAGSOURCECFGDIALOG_H #define CTAGSOURCECFGDIALOG_H -#include +#include "pub_widget/CustomDialog.h" namespace Ui { class CTagSourceCfgDialog; @@ -11,7 +11,7 @@ class CChartShape; class CTagSourceCfgModel; class QItemEditorFactory; -class CTagSourceCfgDialog : public QDialog +class CTagSourceCfgDialog : public CustomUiDialog { Q_OBJECT diff --git a/platform/src/gui/hmi/dialog/statisticsSrcCfgDialog/CTagSourceCfgDialog.ui b/platform/src/gui/hmi/dialog/statisticsSrcCfgDialog/CTagSourceCfgDialog.ui index 5247c6fe..04b50d79 100644 --- a/platform/src/gui/hmi/dialog/statisticsSrcCfgDialog/CTagSourceCfgDialog.ui +++ b/platform/src/gui/hmi/dialog/statisticsSrcCfgDialog/CTagSourceCfgDialog.ui @@ -15,16 +15,16 @@ - 3 + 5 - 3 + 5 - 3 + 5 - 3 + 5 3 diff --git a/platform/src/gui/hmi/hmi.ico b/platform/src/gui/hmi/hmi.ico index 8fd3da43fdfd7c8a8cf99bdd2ee565556201f674..203b2e17c53b1a55509c11731c7b2fefb6ff42c7 100644 GIT binary patch literal 4030 zcmeHJEo@U!6h0_OASuZRkU+LNmLMh&69`BU2;{^BVq#(ffj~?k`qJBU8H?s*ltfbV=> z@SB%cIg#rkvIv=nJcMwc9}mywE(fAF9Dm+1lD%$49yprG zqz2p1i3J%XijsP}EH^S4PEiJqO2nGGPK-&Xtz#wY)8gXXkrRkfI@yvXD}GrDxF=t;Vw?Nbuy)c$>sth4 z8@SIRd&&1`#O+q6C`&Hq;&8#s=9D$Axz;Ea7yXEL5q`5jxx}e;z~#HpZ@8R^!{s^h z(yz!e=IOo4_~noEo%~F~)!0GrSote9`lKK9aOXRph6`>n))k#UB@NBj@x1qZB^w_+ zxedKcHA%&_7)tiZv-h4{Jg z8-De|adEEuZjg&%4Q7SQSdq`yQOw~w=%01FcEIJG+@;O9I?)dJ^o^WOdTy|4;hvw0 zt7Mb^>ClUw@_qi%lSSB=$Rm9spN;)tE+gw*tk>*b5-zy0XZY~l>SC<&-3GrK<~ z-x0gveD-)>b!?~sIsRo!a?sxi+u=L~_ssae2E7Jkn>p6GHMxq~vTMd}&KzOnyCv+K zo+simzJMo+{K0%3e!q>gG0k2Y?lksX&-}-o<5I51B|Cxzi%HXfbJk4z3~c@SN+aG0o`HcC;>U7!Ept&FcRR=H zDlGnMep0S}cgY70Nm31C$ct6ykE@$D-ne(z1+_Tw9>_UXp0#egW|sTL{be82Qo(fr zT;R2xo9ewc9vmrxOi)E$Q)2C;enoyB%|}OF(2Tgv$HxRTBhq|woHQfSdghR3L|Ua2 zq#2Rc^OK|*k@kyIq*L%wTY%~mXU6rH_UdWUlmgV{_`T&0yia>JsZQE2&yc3%aCWqC z#!Y!{Tz}bmb(S;*iRPj$>8!#wsJ1Yyo& zEWVIi4DAbx_8smrYD9^nXtKpf^-`TL9F_*Kk=fJbXXYgLSm5Zb^7|i2L^r&#> zO4(Ps?=F$fAi&wdGhsLxvvCiMPwFe(_m@d$RE}m3-h29<(p$emx()K2jXpUDQudSH zhXUy~sG)}o{uI5W_wg!eMx+gr(45 Lk4MCek)gRiDcPSj diff --git a/platform/src/gui/hmi/hmi.pro b/platform/src/gui/hmi/hmi.pro index 7b072e2a..65740aed 100644 --- a/platform/src/gui/hmi/hmi.pro +++ b/platform/src/gui/hmi/hmi.pro @@ -26,6 +26,7 @@ DEFINES += ISOLATION_AWARE_ENABLED=1 INCLUDEPATH += ../../include/dbms INCLUDEPATH += ../plugin/ScriptForm INCLUDEPATH += ../GraphTool/WebPublish +INCLUDEPATH += ../GraphTool/AutoCreateElement SOURCES += \ main.cpp \ @@ -43,33 +44,34 @@ SOURCES += \ CGraphHead.cpp \ CDynamicValue.cpp \ CGraphDoc.cpp \ - CDrawObjDatabase.cpp \ CUndoCommand.cpp \ CScaleBar.cpp \ CGraphLayoutTreeWidget.cpp \ - case/CSimulate.cpp \ - dialog/screenShot/CScreenShot.cpp \ - dialog/naviDialog/CNaviDialog.cpp \ - dialog/ShapeConfigDialog/CFindReplace.cpp \ - dialog/dataBind/CDataBindWidget.cpp \ - dialog/dataBind/CDataBindModel.cpp \ - dialog/dataBind/CDataBindView.cpp \ - dialog/AnimationConfigDialog/CAnimationConfigDialog.cpp \ - dialog/ShapeConfigDialog/CTextShapeEditor.cpp \ - dialog/ShapeConfigDialog/CTextReplacer.cpp \ - CShieldEvent.cpp \ - dialog/statisticsSrcCfgDialog/CTagSourceCfgDialog.cpp \ - dialog/statisticsSrcCfgDialog/CTagSourceCfgModel.cpp \ - dialog/layerDialog/CLayerDlg.cpp \ - dialog/hmiConfigDialog/CHmiConfig.cpp \ - dialog/hmiConfigDialog/CLineEditWithBt.cpp \ - dialog/hmiConfigDialog/CFileDelegate.cpp \ - dialog/hmiConfigDialog/CColorWidget.cpp \ - dialog/dataBindCheck/CBindCheckModel.cpp \ - dialog/dataBindCheck/CBindCheckWidget.cpp \ - dialog/dataBindCheck/CBindCheck.cpp \ - dialog/globalConfigDialog/CGlobalConfigDialog.cpp \ - dialog/globalConfigDialog/CTableDelegate.cpp + CShieldEvent.cpp \ + case/CSimulate.cpp \ + dialog/screenShot/CScreenShot.cpp \ + dialog/naviDialog/CNaviDialog.cpp \ + dialog/ShapeConfigDialog/CFindReplace.cpp \ + dialog/dataBind/CDataBindWidget.cpp \ + dialog/dataBind/CDataBindModel.cpp \ + dialog/dataBind/CDataBindView.cpp \ + dialog/AnimationConfigDialog/CAnimationConfigDialog.cpp \ + dialog/ShapeConfigDialog/CTextShapeEditor.cpp \ + dialog/ShapeConfigDialog/CTextReplacer.cpp \ + dialog/statisticsSrcCfgDialog/CTagSourceCfgDialog.cpp \ + dialog/statisticsSrcCfgDialog/CTagSourceCfgModel.cpp \ + dialog/layerDialog/CLayerDlg.cpp \ + dialog/hmiConfigDialog/CHmiConfig.cpp \ + dialog/hmiConfigDialog/CLineEditWithBt.cpp \ + dialog/hmiConfigDialog/CFileDelegate.cpp \ + dialog/hmiConfigDialog/CColorWidget.cpp \ + dialog/dataBindCheck/CBindCheckModel.cpp \ + dialog/dataBindCheck/CBindCheckWidget.cpp \ + dialog/dataBindCheck/CBindCheck.cpp \ + dialog/globalConfigDialog/CGlobalConfigDialog.cpp \ + dialog/globalConfigDialog/CTableDelegate.cpp \ + dialog/graphTree/CGraphFileTree.cpp \ + dialog/hmiConfigDialog/CComboxDelegate.cpp HEADERS += \ CGraphApp.h \ @@ -88,47 +90,49 @@ HEADERS += \ CDynamicValue.h \ CGraphDoc.h \ CExtern.h \ - CDrawObjDatabase.h \ CUndoCommand.h \ CScaleBar.h \ CGraphLayoutTreeWidget.h \ + CShieldEvent.h \ ../include/CPubStruct.h \ - case/CSimulate.h \ - dialog/screenShot/CScreenShot.h \ - dialog/naviDialog/CNaviDialog.h \ - dialog/ShapeConfigDialog/CFindReplace.h \ - dialog/dataBind/CDataBindWidget.h \ - dialog/dataBind/CDataBindModel.h \ - dialog/dataBind/CDataBindView.h \ - dialog/AnimationConfigDialog/CAnimationConfigDialog.h \ - dialog/ShapeConfigDialog/CTextShapeEditor.h \ - dialog/ShapeConfigDialog/CTextReplacer.h \ - CShieldEvent.h \ - dialog/statisticsSrcCfgDialog/CTagSourceCfgDialog.h \ - dialog/statisticsSrcCfgDialog/CTagSourceCfgModel.h \ - dialog/layerDialog/CLayerDlg.h \ - dialog/hmiConfigDialog/CHmiConfig.h \ - dialog/hmiConfigDialog/CLineEditWithBt.h \ - dialog/hmiConfigDialog/CFileDelegate.h \ - dialog/hmiConfigDialog/CColorWidget.h \ - dialog/dataBindCheck/CBindCheckModel.h \ - dialog/dataBindCheck/CBindCheckWidget.h \ - dialog/dataBindCheck/CBindCheck.h \ - dialog/dataBindCheck/CBindStruct.h \ - dialog/globalConfigDialog/CGlobalConfigDialog.h \ - dialog/globalConfigDialog/CTableDelegate.h + case/CSimulate.h \ + dialog/screenShot/CScreenShot.h \ + dialog/naviDialog/CNaviDialog.h \ + dialog/ShapeConfigDialog/CFindReplace.h \ + dialog/dataBind/CDataBindWidget.h \ + dialog/dataBind/CDataBindModel.h \ + dialog/dataBind/CDataBindView.h \ + dialog/AnimationConfigDialog/CAnimationConfigDialog.h \ + dialog/ShapeConfigDialog/CTextShapeEditor.h \ + dialog/ShapeConfigDialog/CTextReplacer.h \ + dialog/statisticsSrcCfgDialog/CTagSourceCfgDialog.h \ + dialog/statisticsSrcCfgDialog/CTagSourceCfgModel.h \ + dialog/layerDialog/CLayerDlg.h \ + dialog/hmiConfigDialog/CHmiConfig.h \ + dialog/hmiConfigDialog/CLineEditWithBt.h \ + dialog/hmiConfigDialog/CFileDelegate.h \ + dialog/hmiConfigDialog/CColorWidget.h \ + dialog/dataBindCheck/CBindCheckModel.h \ + dialog/dataBindCheck/CBindCheckWidget.h \ + dialog/dataBindCheck/CBindCheck.h \ + dialog/dataBindCheck/CBindStruct.h \ + dialog/globalConfigDialog/CGlobalConfigDialog.h \ + dialog/globalConfigDialog/CTableDelegate.h \ + dialog/graphTree/CGraphFileTree.h \ + dialog/hmiConfigDialog/CComboxDelegate.h FORMS += \ - dialog/ShapeConfigDialog/replaceDialog.ui \ - dialog/ShapeConfigDialog/CTextReplacer.ui \ - dialog/AnimationConfigDialog/CAnimationConfigDialog.ui \ - dialog/statisticsSrcCfgDialog/CTagSourceCfgDialog.ui \ - dialog/hmiConfigDialog/CConfigDialog.ui \ - dialog/globalConfigDialog/CGlobalConfigDialog.ui + dialog/ShapeConfigDialog/replaceDialog.ui \ + dialog/ShapeConfigDialog/CTextReplacer.ui \ + dialog/AnimationConfigDialog/CAnimationConfigDialog.ui \ + dialog/statisticsSrcCfgDialog/CTagSourceCfgDialog.ui \ + dialog/hmiConfigDialog/CConfigDialog.ui \ + dialog/globalConfigDialog/CGlobalConfigDialog.ui +LIBS += -lpub_widget LIBS += -lGraphPub -lGraphDataAcess -lGraphShape LIBS += -llog4cplus -lpub_logger_api -lpub_utility_api -ldb_base_api -ldb_api_ex -lnet_msg_bus_api -lprotobuf -lpub_sysinfo_api -lperm_mng_api -ldp_chg_data_api -lsys_dog_auth_api -LIBS += -lPropertyEditor -lRetriever -lScriptForm -lQssEditor -lWebPublish +LIBS += -lPropertyEditor -lRetriever -lScriptForm -lQssEditor -lWebPublish -lToolBoxTree -lAutoCreateElement win32{ LIBS += -luser32 -lshell32 diff --git a/platform/src/gui/include/CBase.h b/platform/src/gui/include/CBase.h index 292cb881..dda99c75 100644 --- a/platform/src/gui/include/CBase.h +++ b/platform/src/gui/include/CBase.h @@ -21,7 +21,8 @@ public: PATH_TYPE_DLL, PATH_TYPE_SCRIPT, PATH_TYPE_ICONTRANS, - PATH_TYPE_PLUGINTRANS + PATH_TYPE_PLUGINTRANS, + PATH_TYPE_ELF }; CBase(); ~CBase(); @@ -97,7 +98,7 @@ public: void setOffColor(const int &c); int getOffColor(); - void setScreenInfo(const int num, const QStringList &s, const bool &b); + void setScreenInfo(const int num, const QStringList &s, const bool &b, const QStringList &no); QVariantList getScreenInfo(); bool hasClickedOn(const QPointF &pressPoint, const QPointF &point, const qreal &handlerWidth) const; diff --git a/platform/src/gui/include/CDrawObjDefine.h b/platform/src/gui/include/CDrawObjDefine.h index 8b28666a..228b3e14 100644 --- a/platform/src/gui/include/CDrawObjDefine.h +++ b/platform/src/gui/include/CDrawObjDefine.h @@ -19,6 +19,7 @@ const ubyte OBJTYPE_POKE = 17; //标志调用 const ubyte OBJTYPE_PIN = 18; //PIN端子 const ubyte OBJTYPE_MERGE = 20; //组合设备 const ubyte OBJTYPE_BEZIER = 24; //贝塞尔曲线 +const ubyte OBJTYPE_ELF = 28; //精灵图元 const ubyte OBJTYPE_BUS = 30; //母线 const ubyte OBJTYPE_FLOWLINE = 31; //线路 @@ -27,6 +28,7 @@ const ubyte OBJTYPE_DBDATA = 33; //动态数据 const ubyte OBJTYPE_RELATIVE = 34; //连接关系 const ubyte OBJTYPE_FEEDLINE = 35; //馈线 const ubyte OBJTYPE_FLOWDOT = 36; //线端 +const ubyte OBJTYPE_DYLINKLINE = 37; //自由连接线 const ubyte OBJTYPE_FLOWDASH = 40; //潮流线 const ubyte OBJTYPE_ALARM = 41; //告警提示 const ubyte OBJTYPE_DYPOLYGON = 42; //带电区域 diff --git a/platform/src/gui/include/CPubStruct.h b/platform/src/gui/include/CPubStruct.h index 57832b4a..03e4630e 100644 --- a/platform/src/gui/include/CPubStruct.h +++ b/platform/src/gui/include/CPubStruct.h @@ -5,7 +5,8 @@ enum AppMode { IconMode = 1, DesignerMode, - ExplorerMode + ExplorerMode, + ElfMode }; struct COLOR_CONFIG_PUBLIC diff --git a/platform/src/gui/include/CShape.h b/platform/src/gui/include/CShape.h index c42ec006..86290cad 100644 --- a/platform/src/gui/include/CShape.h +++ b/platform/src/gui/include/CShape.h @@ -43,7 +43,7 @@ public: } CShape(QGraphicsItem *parent); - ~CShape(); + virtual ~CShape(); public: virtual int advanced(long msec); @@ -184,6 +184,8 @@ public: virtual qreal getHeight() const; virtual QRect getVisualBox(); virtual void updateGeometry(qreal x, qreal y, qreal dx, qreal dy); + virtual void zoomWidth(float factor); + virtual void zoomHeight(float factor); void updateAnimationValue(QList &values); @@ -237,6 +239,9 @@ public: QPointF m_rotateOrigin; bool m_isRotateCenter; + float m_wFactor; + float m_hFactor; + private: // CAnimationSet * m_animationSet; CAnimationManage * m_animationManage; diff --git a/platform/src/include/application/app_bio_identify/acs_device_api/AcsDeviceApiCommon.h b/platform/src/include/application/app_bio_identify/acs_device_api/AcsDeviceApiCommon.h index 92c04284..96bab314 100644 --- a/platform/src/include/application/app_bio_identify/acs_device_api/AcsDeviceApiCommon.h +++ b/platform/src/include/application/app_bio_identify/acs_device_api/AcsDeviceApiCommon.h @@ -17,7 +17,7 @@ /** * @brief 高级应用相关命名空间 */ -namespace iot_application +namespace iot_app { class CFingerprintInfo @@ -80,4 +80,4 @@ public: std::list m_listFingerprint; //< 指纹信息,内含下发结果 }; -} //< namespace iot_application +} //< namespace iot_app diff --git a/platform/src/include/application/app_bio_identify/acs_device_api/CAcsDeviceApi.h b/platform/src/include/application/app_bio_identify/acs_device_api/CAcsDeviceApi.h index 3383e221..a82521f5 100644 --- a/platform/src/include/application/app_bio_identify/acs_device_api/CAcsDeviceApi.h +++ b/platform/src/include/application/app_bio_identify/acs_device_api/CAcsDeviceApi.h @@ -13,7 +13,7 @@ #include "AcsDeviceApiExport.h" #include "AcsDeviceApiCommon.h" -namespace iot_application +namespace iot_app { class CAcsDeviceApiImpl; //< 实现类 @@ -158,4 +158,4 @@ private: CAcsDeviceApiImpl *m_pImpl; }; -} //< namespace iot_application +} //< namespace iot_app diff --git a/platform/src/include/application/app_fbd/fbd_common/FbdAlarmCltApi.h b/platform/src/include/application/app_fbd/fbd_common/FbdAlarmCltApi.h index f532172a..afe4f7f4 100644 --- a/platform/src/include/application/app_fbd/fbd_common/FbdAlarmCltApi.h +++ b/platform/src/include/application/app_fbd/fbd_common/FbdAlarmCltApi.h @@ -51,11 +51,13 @@ public: * @param stPosition: 传入起始告警,允许与 stLastAlm 为同一个对象的引用 * vecOutput: 输出获取的告警,从 传入的stAlmInput(不包含) 之后的告警 * stLastAlm: 输出最后一条告警,若当前没有告警,则本对象 isValid 为false + * bIncludeBeforeStartup :是否包含本进程启动前产生的告警,true为包括 * @return 成功返回iotSuccess,失败返回错误码 **********************************************************************************/ virtual int getAlarmAfter( const SFbdAlarmInfo &stPosition, std::vector &vecOutput, - SFbdAlarmInfo &stLastAlm ) const = 0; + SFbdAlarmInfo &stLastAlm, + const bool bIncludeBeforeStartup = false ) const = 0; /******************************************************************************//** * @brief 通过UUID在当前活动告警中获取告警信息 diff --git a/platform/src/include/application/app_fbd/fbd_common/FbdDiagDataApi.h b/platform/src/include/application/app_fbd/fbd_common/FbdDiagDataApi.h index fecc7f1a..b6bb3e4a 100644 --- a/platform/src/include/application/app_fbd/fbd_common/FbdDiagDataApi.h +++ b/platform/src/include/application/app_fbd/fbd_common/FbdDiagDataApi.h @@ -23,6 +23,9 @@ namespace iot_app namespace app_fbd { +const int iotFBDErr_GlobalVarAlreadyExist = 100; //变量已经存在 +const int iotFBDErr_GlobalVarTypeMismatch = 101; //变量类型不匹配 + //< 功能块图(Diagram)数据接口,内部有锁,线程安全 class CFbdDiagDataApi { @@ -30,7 +33,7 @@ public: virtual ~CFbdDiagDataApi() = default; - /******************************************************************************//** + /******************************************************************************** * @brief 获取指定模块的属性 * @param stPropertyKey: 属性的唯一标识 * strPropertyValue: 输出参数,属性值 @@ -39,7 +42,7 @@ public: virtual int getModProperty( const SFbdModPropKey &stPropertyKey, std::string &strPropertyValue ) const = 0; - /******************************************************************************//** + /******************************************************************************** * @brief 获取指定模块的属性 * @param stModuleKey: 模块名唯一标识 * strPropertyName: 属性名 @@ -54,7 +57,7 @@ public: } - /******************************************************************************//** + /******************************************************************************** * @brief 获取FBD模块输入端对应的值的key * @param stInputKey: 输入端口的唯一标识 * stValueKey: 输出参数,值的key,可通过此key来获取值 @@ -63,7 +66,7 @@ public: virtual int getValKeyByModInput( const SFbdModInputKey &stInputKey, SFbdValueKey &stValueKey ) const = 0; - /******************************************************************************//** + /******************************************************************************** * @brief 获取FBD模块输入端对应的值的key * @param stModuleKey: 模块名唯一标识 * nInputIndex: 输入端序号,从1开始 @@ -78,7 +81,7 @@ public: } - /******************************************************************************//** + /******************************************************************************** * @brief 获取FBD模块输入端对应的值的key * @param stOutputKey: 输出端口的唯一标识 * stValueKey: 输出参数,值的key,可通过此key来获取值 @@ -87,7 +90,7 @@ public: virtual int getValKeyByModOutput( const SFbdModOutputKey &stOutputKey, SFbdValueKey &stValueKey ) const = 0; - /******************************************************************************//** + /******************************************************************************** * @brief 获取FBD模块输入端对应的值的key * @param stModuleKey: 模块名唯一标识 * nOutputIndex: 输出端序号,从1开始 @@ -102,7 +105,7 @@ public: } - /******************************************************************************//** + /******************************************************************************** * @brief 获取数字类型量(布尔、整型、浮点)值 * @param stValueKey: 值的key * stValAndSta: 输出,值 @@ -111,7 +114,7 @@ public: virtual int getNumericValByKey( const SFbdValueKey &stValueKey, SFbdNumericValue &stValAndSta ) const = 0; - /******************************************************************************//** + /******************************************************************************** * @brief 设置数字类型量(布尔、整型、浮点)值 * @param stValueKey: 值的key * stValAndSta: 设置的值 @@ -120,7 +123,7 @@ public: virtual int setNumericValByKey( const SFbdValueKey &stValueKey, const SFbdNumericValue &stValAndSta ) = 0; - /******************************************************************************//** + /******************************************************************************** * @brief 获取文本类型量值 * @param stValueKey: 值的key * stValAndSta: 输出,值 @@ -129,7 +132,7 @@ public: virtual int getStringValByKey( const SFbdValueKey &stValueKey, SFbdStringValue &stValAndSta ) const = 0; - /******************************************************************************//** + /******************************************************************************** * @brief 设置文本类型量值 * @param stValueKey: 值的key * stValAndSta: 设置的值 @@ -138,7 +141,7 @@ public: virtual int setStringValByKey( const SFbdValueKey &stValueKey, const SFbdStringValue &stValAndSta ) = 0; - /******************************************************************************//** + /******************************************************************************** * @brief 获取告警类型量(包括事件)值 * @param stValueKey: 值的key * stValAndSta: 输出,值 @@ -147,7 +150,7 @@ public: virtual int getAlarmValByKey( const SFbdValueKey &stValueKey, SFbdAlarmValue &stValAndSta ) const = 0; - /******************************************************************************//** + /******************************************************************************** * @brief 设置告警类型量(包括事件)值 * @param stValueKey: 值的key * stValAndSta: 设置的值 @@ -156,20 +159,86 @@ public: virtual int setAlarmValByKey( const SFbdValueKey &stValueKey, const SFbdAlarmValue &stValAndSta ) = 0; + /******************************************************************************** + * @brief 获取数字类型量(布尔、整型、浮点)值,用于全局变量 + * @param strVarName 变量名 + * stValAndSta: 设置的值 + * @return 成功返回iotSuccess,失败返回错误码 + **********************************************************************************/ + virtual int getGlobalNumericValByKey( const std::string &strVarName, + SFbdNumericValue &stValAndSta ) const = 0; + + /******************************************************************************** + * @brief 设置数字类型量(布尔、整型、浮点)值,用于全局变量 + * @param strVarName 变量名 + * stValAndSta: 设置的值 + * @return 成功返回iotSuccess,失败返回错误码 + **********************************************************************************/ + virtual int setGlobalNumericValByKey( const std::string &strVarName, + const SFbdNumericValue &stValAndSta ) = 0; + + /******************************************************************************** + * @brief 注册数字类型量全局变量(布尔、整型、浮点) + * @param strVarName 变量名 + * @return 存在返回iotSuccess,失败返回错误码 + **********************************************************************************/ + virtual int regGlobalNumericValByKey( const std::string &strVarName, + const SFbdNumericValue &stValAndSta ) = 0; + + /******************************************************************************** + * @brief 取消注册数字类型量全局变量(布尔、整型、浮点) + * @param strVarName 变量名 + * @return 存在返回iotSuccess,失败返回错误码 + **********************************************************************************/ + virtual int unregGlobalNumericVar(const std::string &strVarName) = 0; + + /******************************************************************************** + * @brief 获取字符串类型值,用于全局变量 + * @param strVarName 变量名 + * stValAndSta: 设置的值 + * @return 成功返回iotSuccess,失败返回错误码 + **********************************************************************************/ + virtual int getGlobalStringValByKey( const std::string &strVarName, + SFbdStringValue &stValAndSta ) const = 0; + + /******************************************************************************** + * @brief 设置字符串类型值,用于全局变量 + * @param strVarName 变量名 + * stValAndSta: 设置的值 + * @return 成功返回iotSuccess,失败返回错误码 + **********************************************************************************/ + virtual int setGlobalStringValByKey( const std::string &strVarName, + const SFbdStringValue &stValAndSta ) = 0; + + /******************************************************************************** + * @brief 字符串类型变量是否存在,用于全局变量 + * @param strVarName 变量名 + * @return 成功返回iotSuccess,失败返回错误码 + **********************************************************************************/ + virtual int regGlobalStringValByKey( const std::string &strVarName, + const SFbdStringValue &stValAndSta ) = 0; + + /******************************************************************************** + * @brief 取消字符串类型全局变量 + * @param strVarName 变量名 + * @return 成功返回iotSuccess,失败返回错误码 + **********************************************************************************/ + virtual int unregGlobalStringVar(const std::string &strVarName) = 0; + private: - /******************************************************************************//** + /******************************************************************************** * @brief 以下私有函数仅供FBD服务使用 **********************************************************************************/ friend class CFbdUtil; - /******************************************************************************//** + /******************************************************************************** * @brief 获取本应用所有的FBD组列表 * @param vecGrpInfo: 输出,FBD组列表 * @return 成功返回iotSuccess,失败返回错误码 **********************************************************************************/ virtual int getAllGroupInfo( std::vector &vecGrpInfo ) const = 0; - /******************************************************************************//** + /******************************************************************************** * @brief 获取指定FBD组的模块信息列表 * @param nFbdGrpId: FBD组ID * vecModuleInfo: 输出,组中所有的模块 @@ -178,14 +247,14 @@ private: virtual int getModuleInfoByGroup( const int nFbdGrpId, std::vector &vecModuleInfo ) const = 0; - /******************************************************************************//** + /******************************************************************************** * @brief 从本类管理的内存中,删除指定FBD组的所有数据 * @param nFbdGrpId: 要删除的FBD组ID * @return 成功返回iotSuccess,失败返回错误码 **********************************************************************************/ virtual int deleteAllDataByGroup( const int nFbdGrpId ) = 0; - /******************************************************************************//** + /******************************************************************************** * @brief 将指定FBD组的所有数据,插入到本类管理的内存中 * @param stGrpInfo: FBD组信息 * stGrpData: 要插入的FBD组数据 @@ -193,7 +262,7 @@ private: **********************************************************************************/ virtual int insertAllDataByGroup( const SFbdGroupInfo &stGrpInfo, const SFbdGroupData &stGrpData ) = 0; - /******************************************************************************//** + /******************************************************************************** * @brief 传入调试请求消息,获取调试响应消息 * @param objReq:请求消息,输入参数 * objRep: 响应消息,输出参数 diff --git a/platform/src/include/application/app_fbd/fbd_common/FbdDiagDataStruct.h b/platform/src/include/application/app_fbd/fbd_common/FbdDiagDataStruct.h index 18724b67..fa2a1816 100644 --- a/platform/src/include/application/app_fbd/fbd_common/FbdDiagDataStruct.h +++ b/platform/src/include/application/app_fbd/fbd_common/FbdDiagDataStruct.h @@ -82,6 +82,28 @@ struct SFbdNumericValue { return !( *this == rhs ); } + + inline bool getBool() const + { + return (static_cast(m_dValue) != 0); + } + + inline bool isValid() const + { + return (m_nStatus == CN_FBD_STATUS_Valid); + } + + inline void setValidValue(const double &dVal) + { + m_nStatus = CN_FBD_STATUS_Valid; + m_dValue = dVal; + } + + inline void setInvalidValue(const double &dVal) + { + m_nStatus = CN_FBD_STATUS_Invalid; + m_dValue = dVal; + } }; @@ -113,6 +135,23 @@ struct SFbdStringValue { return !( *this == rhs ); } + + inline bool isValid() const + { + return (m_nStatus == CN_FBD_STATUS_Valid); + } + + inline void setValidValue(const std::string &strVal) + { + m_nStatus = CN_FBD_STATUS_Valid; + m_strValue = strVal; + } + + inline void setInvalidValue(const std::string &strVal) + { + m_nStatus = CN_FBD_STATUS_Invalid; + m_strValue = strVal; + } }; diff --git a/platform/src/include/dbms/db_his_mng_api/CHisMngApi.h b/platform/src/include/dbms/db_his_mng_api/CHisMngApi.h index 0cefe32a..e08fae6a 100644 --- a/platform/src/include/dbms/db_his_mng_api/CHisMngApi.h +++ b/platform/src/include/dbms/db_his_mng_api/CHisMngApi.h @@ -136,6 +136,10 @@ public slots: void delHisAll(QSqlDatabase *conn, const QString &ip, const QString &databaseName); void delHis(QSqlDatabase *conn,const QString &ip,const QString &databaseName,qint64 endTimeStamp); + //< 删除部分(大批量数据删除) + void delHisAllV2(QSqlDatabase *conn, const QString &ip, const QString &databaseName); + void delHisV2(QSqlDatabase *conn,const QString &ip,const QString &databaseName,qint64 endTimeStamp); + void needTerminate(); diff --git a/platform/src/include/dbms/db_manager_api/db_manager_api.h b/platform/src/include/dbms/db_manager_api/db_manager_api.h index 40c257d2..67528758 100644 --- a/platform/src/include/dbms/db_manager_api/db_manager_api.h +++ b/platform/src/include/dbms/db_manager_api/db_manager_api.h @@ -51,7 +51,7 @@ public: bool restoreComp(db_opt* pDbOpt, QString& sDatabaseName, QString& sBackupContent, quint32 nImportType); //升级接口-升级数据库 - bool updateDatabase(db_opt* pDbOpt, QString& sDatabaseName); + bool updateDatabase(db_opt* pDbOpt, QString& sDatabaseName,bool isNoWaitDlg = false); //升级接口-升级工程 bool updateProject(db_opt* pDbOpt, QString& sDatabaseName, QString& sBackupContent); diff --git a/platform/src/include/dbms/rdb_api/RdbMemMan.h b/platform/src/include/dbms/rdb_api/RdbMemMan.h index 03eb4e59..7d03541f 100644 --- a/platform/src/include/dbms/rdb_api/RdbMemMan.h +++ b/platform/src/include/dbms/rdb_api/RdbMemMan.h @@ -121,7 +121,6 @@ struct SRdbTableAttribute char strDataTable[RDB_TABLE_NAME_LEN]; // 数据表 uint8 nSelectByLocation; // 是否需要按车站查询 uint8 nSelectBySubsystem; // 是否需要按专业查询 - uint8 nCache; // 是否持久化 1持久化 0不持久化 int nStartColumnNo; // 当前表的列在所有列中的开始号 int nColumnCount; // 表列数 int nLastLoadTime; // 上次加载时间 @@ -165,7 +164,6 @@ struct SRdbColumnAttribute bool bIsKey; // 是否主键 bool bNeedSyn; // 主数据库的变化是否同步到备数据库 bool bNotUpdateRtdb; // 数据库的变化是否同步到内存库,不支持实时建模 - bool bCache; // 是否持久化 int nOffset; uint8 nPosition; public: diff --git a/platform/src/include/dbms/tsdb_api/CTsdbConn.h b/platform/src/include/dbms/tsdb_api/CTsdbConn.h index 3fff90e1..335a2fb1 100644 --- a/platform/src/include/dbms/tsdb_api/CTsdbConn.h +++ b/platform/src/include/dbms/tsdb_api/CTsdbConn.h @@ -14,11 +14,31 @@ #include "TsdbApiExport.h" +#define INFLUXDB_DEFAULT_PORT 8086 + namespace iot_dbms { //< CTsdbConn的实现类 class CTsdbConnImp; +//< 时序库连接参数 +typedef struct _STsdbConnParam +{ + int nPort; + std::string strIP; + std::string strUserName; + std::string strUserPassword; + std::string strDbName; + _STsdbConnParam() + { + nPort = INFLUXDB_DEFAULT_PORT; + strIP = "localhost"; + strUserName = ""; + strUserPassword = ""; + strDbName = ""; + } +}STsdbConnParam,*PSTsdbConnParam; + /******************************************************************************//** * @brief 时序库连接类,时序库访问的主体 **********************************************************************************/ @@ -33,16 +53,24 @@ public: * nPort: 输入,端口号,传入负数(如-1)则使用默认端口8086 * pchDb: 输入,数据库名,比如"iscs6000" * pchUser: 输入,数据库用户名,比如"root" - * pchPwd: 输入,用户密码,比如"kbdct@0755" + * pchPwd: 输入,用户密码,比如"ems@byd23" * * 注意:参数不应传入空指针NULL * * @return 无 * @retval 无 **********************************************************************************/ - CTsdbConn(const char *pchHost = "localhost", int nPort = 8086, - const char *pchDb = "iscs6000", - const char *pchUser = "", const char *pchPwd = ""); +// CTsdbConn(const char *pchHost = "localhost", int nPort = 8086, +// const char *pchDb = EMS_DEFAULT_DATABASE, +// const char *pchUser = EMS_DEFAULT_DATABASE, const char *pchPwd = EMS_DEFAULT_PASSWD); + + explicit CTsdbConn(const char *pchHost, int nPort, + const char *pchDb, + const char *pchUser, const char *pchPwd); + + explicit CTsdbConn(const STsdbConnParam &stConnParam); + + CTsdbConn() = delete; virtual ~CTsdbConn(); diff --git a/platform/src/include/gui/GraphShape/CPluginWidget.h b/platform/src/include/gui/GraphShape/CPluginWidget.h index acd6f6c5..aaa04240 100644 --- a/platform/src/include/gui/GraphShape/CPluginWidget.h +++ b/platform/src/include/gui/GraphShape/CPluginWidget.h @@ -23,8 +23,8 @@ public: }; -Q_DECLARE_INTERFACE(CPluginWidgetInterface, - "kbd.PluginWidgetInterface/1.0") +#define HMI_WidgetPlugin_IID "HMI.PluginWidgetInterface/1.0" +Q_DECLARE_INTERFACE(CPluginWidgetInterface,HMI_WidgetPlugin_IID) #endif //IPLUGINWIDGET_H diff --git a/platform/src/include/gui/GraphTool/Retriever/CRetriever.h b/platform/src/include/gui/GraphTool/Retriever/CRetriever.h index 4b895e85..511cee0d 100644 --- a/platform/src/include/gui/GraphTool/Retriever/CRetriever.h +++ b/platform/src/include/gui/GraphTool/Retriever/CRetriever.h @@ -1,15 +1,16 @@ #ifndef CRETRIEVER_H #define CRETRIEVER_H -#include #include "db_api_ex/CDbApi.h" #include "Export.h" +#include "pub_widget/CustomDialog.h" enum E_RETRIEVER_TYPE { E_Device_Retriever = 0, //< 设备检索 E_Table_Retriever = 1, //< 表检索 - E_Statistics_Retriever = 2 //< 统计量 + E_Statistics_Retriever = 2, //< 统计量 + E_DevGroup_Retriever = 3 //< 设备组检索 }; namespace Ui { @@ -21,7 +22,7 @@ using namespace iot_dbms; class QStandardItem; class QStandardItemModel; -class DLL_CLASS CRetriever : public QDialog +class DLL_CLASS CRetriever : public CustomUiDialog { Q_OBJECT @@ -43,6 +44,8 @@ public: void setMultVisible(const bool &visible); + void setGroupVisible(const bool &visible); + private slots: void slotItemTagTriggered(const QString &strTagName, const QString &strTagDesc); @@ -223,7 +226,12 @@ private slots: /** * @brief slot_tagNameFilter 点名过滤 */ - void slot_tagNameFilter(); + void slot_tagNameFilter(); + + /** + * @brief slot_devGroupFilter 设备组过滤 + */ + void slot_devGroupFilter(); /** * @brief slot_currentProfessionChanged 专业变化 @@ -308,6 +316,11 @@ private slots: */ void slot_currentStatisticsTemplChanged(const QModelIndex &index); + /** + * @brief slot_updateCurrentDevGroupTempl 更新设备组检索设备组列表 + */ + void slot_updateCurrentDevGroupTempl(); + private: Ui::CRetriever *ui; CDbApi * m_pReadDb; @@ -319,6 +332,7 @@ private: QStandardItemModel * m_tableProperty_valueModel; QStandardItemModel * m_statInsModel; QStandardItemModel * m_statParaModel; + QStandardItemModel * m_devGroupModel; QMap m_devTypeMap; //< 设备类型/点类型 }; diff --git a/platform/src/include/gui/GraphTool/ScriptForm/ScriptForm.h b/platform/src/include/gui/GraphTool/ScriptForm/ScriptForm.h index ee9a5bbc..acc2ae25 100644 --- a/platform/src/include/gui/GraphTool/ScriptForm/ScriptForm.h +++ b/platform/src/include/gui/GraphTool/ScriptForm/ScriptForm.h @@ -2,7 +2,7 @@ #define SCRIPTFORM_H #include "Export.h" -#include +#include "pub_widget/CustomDialog.h" class QAction; class QToolBar; @@ -12,7 +12,7 @@ class ScriptEditor; class QListWidget; class FindWidget; -class DLL_CLASS ScriptForm : public QDialog +class DLL_CLASS ScriptForm : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/include/public/pub_sysinfo_api/SysInfoBase.h b/platform/src/include/public/pub_sysinfo_api/SysInfoBase.h index 886ac327..e9c40eb3 100644 --- a/platform/src/include/public/pub_sysinfo_api/SysInfoBase.h +++ b/platform/src/include/public/pub_sysinfo_api/SysInfoBase.h @@ -181,7 +181,7 @@ namespace iot_public std::string strUserName; //!< 数据库用户名 std::string strUserPassword; //!< 密码 int nNicCurId; //!< 活动网卡ID - std::string strDBName; //!< 数据库标识 + std::string strDBName; //!< 数据库标识 0:主数据库/1:备数据库 int nDBHostPrior; //!< 域内优先级 bool bEnableSwitch; //!< 是否允许切换 bool bEnableDirectAccess; //!< 是否允许直连 diff --git a/platform/src/include/public/pub_utility_api/FileStyle.h b/platform/src/include/public/pub_utility_api/FileStyle.h index 78a3b26d..c87e3546 100644 --- a/platform/src/include/public/pub_utility_api/FileStyle.h +++ b/platform/src/include/public/pub_utility_api/FileStyle.h @@ -25,15 +25,14 @@ public: /** @brief 获取样式文件绝对路径 @param strFileName 样式文件名 - @param strPlatOrProd 输入,属于平台还是产品,传入 CN_DIR_PLATFORM 或 CN_DIR_PRODUCT - 宏定义 DIR_PLAT_OR_PROD 自动适配,写在头文件中,指调用者属于平台还是产品,而非本动态库 - @param strDefaultStyle 输入,默认风格,失败时尝试该风格 + @param strDefaultLang 输入,语言配置,默认为空,为空则使用配置文件指定,如果不为空,则由输入参数指定具体的语言 + @param strDefaultStyle 输入,默认风格,默认不指定,不指定则使用配置文件指定,如果不为空,则由输入参数指定风格 @return 如果文件 strPlatOrProd/common/style/getCurStyle()/strFileName 存在,则返回该绝对路径 否则返回空,调用者可只需判断是否为空,而无需判断文件是否存在 */ static std::string getPathOfStyleFile( const std::string &strFileName, - const std::string &strPlatOrProd = DIR_PLAT_OR_PROD, - const std::string &strDefaultStyle = "light" ); + const std::string &strDefaultLang = "", + const std::string &strDefaultStyle = "" ); }; } //namespace iot_public diff --git a/platform/src/include/public/pub_utility_api/FileUtil.h b/platform/src/include/public/pub_utility_api/FileUtil.h index d64cfe86..60f29ea0 100644 --- a/platform/src/include/public/pub_utility_api/FileUtil.h +++ b/platform/src/include/public/pub_utility_api/FileUtil.h @@ -90,17 +90,14 @@ public: /** @brief 获取资源文件绝对路径 - @param strFileName 输入,资源文件名。允许传入目录名、相对路径,只判是否存在,不要求一定是文件 - @param strPlatOrProd 输入,属于平台还是产品,传入 CN_DIR_PLATFORM 或 CN_DIR_PRODUCT - 宏定义 DIR_PLAT_OR_PROD 自动适配,写在头文件中,指调用者属于平台还是产品,而非本动态库 - @param strDefaultLang 输入,默认语言,当前语言路径下未找到文件时,使用默认语言路径查找 - @return 如果文件 strPlatOrProd/common/resource/getCurLanguage()/strFileName (即当前语言目录下)存在,则返回该绝对路径 - 如果文件 strPlatOrProd/common/resource/strDefaultLang/strFileName (即默认语言目录)存在,则返回该绝对路径 + @param strFileName 输入,资源文件名。允许传入目录名、相对路径,只判是否存在,不要求一定是文件 + @param strDefaultLang 输入,指定的语言,默认输入为空(为空取的是中文),如果输入不为空则指定输入的语言(zh,en) + @return 如果文件 /resource/getCurLanguage()/strFileName (即当前语言目录下)存在,则返回该绝对路径 + 如果文件 /resource/strDefaultLang/strFileName (即默认语言目录)存在,则返回该绝对路径 否则返回空,调用者可只需判断是否为空,而无需判断文件是否存在 */ static std::string getPathOfResFile( const std::string &strFileName, - const std::string &strPlatOrProd = DIR_PLAT_OR_PROD, - const std::string &strDefaultLang = "zh" ); + const std::string &strDefaultLang = "" ); }; diff --git a/platform/src/include/service/alarm_server_api/AlarmCommonDef.h b/platform/src/include/service/alarm_server_api/AlarmCommonDef.h index 64f594c0..ee87b879 100644 --- a/platform/src/include/service/alarm_server_api/AlarmCommonDef.h +++ b/platform/src/include/service/alarm_server_api/AlarmCommonDef.h @@ -93,7 +93,10 @@ enum enAlarmKeyword ALM_KEY_CHANNEL_STATUS = 60, // 通道状态 ALM_KEY_RTU_NAME = 61, // RTU名 ALM_KEY_RTU_STATUS = 62, // RTU状态 - ALM_KEY_CUSTOM_CONTENT = 100 // 自定义内容 + ALM_KEY_CUSTOM_CONTENT = 100, // 自定义内容 + //================================================================== + // 以下为内部特殊用途,无需在数据库中定义,不要用于告警格式配置 + ALM_KEY_SPECIAL_INIT = 200 // 表示该告警为初始化告警,用于告警源向告警服务同步状态(动作、复归),避免测点状态与告警状态不一致的问题 }; diff --git a/platform/src/include/service/data_process_api/DataProcessApi.h b/platform/src/include/service/data_process_api/DataProcessApi.h index a1776601..d22d8631 100644 --- a/platform/src/include/service/data_process_api/DataProcessApi.h +++ b/platform/src/include/service/data_process_api/DataProcessApi.h @@ -240,6 +240,15 @@ public: @retval */ virtual int getDigAlarmPara(const SDigAlarmInfo &stDigAlmInfo,SDigAlarmPara &stDigAlmPara)= 0 ; + + /** + @brief 查询指定的数字量文本值是否存在 + @param strStateText 数字量文本 + @param nValue 对应数字量文本的actual_value + @return bool + @retval true代表存在,false代表不存在 + */ + virtual bool isExistStateText(const std::string &strStateText,const int &nValue)= 0 ; }; typedef boost::shared_ptr CDataProcessApiPtr; diff --git a/platform/src/include/service/interlock_api/InterLockInterface.h b/platform/src/include/service/interlock_api/InterLockInterface.h index 33b7403f..57153921 100644 --- a/platform/src/include/service/interlock_api/InterLockInterface.h +++ b/platform/src/include/service/interlock_api/InterLockInterface.h @@ -27,12 +27,12 @@ namespace iot_service public: /** @brief 初始化 - @return 成功返回iotSuccess,失败返回相应错误码 + @return 成功返回kbdSucces,失败返回相应错误码 */ virtual int initialize() =0 ; /** @brief 判断联锁关系 - @return 成功返回iotSuccess,失败返回相应错误码 + @return 成功返回kbdSucces,失败返回相应错误码 */ virtual int CheckCtrlInterlock(const char *strCtrlPointName, const double dTargValue,std::string &strResult, bool &bSuccess) =0; }; diff --git a/platform/src/include/service/operate_server_api/JsonMessageStruct.h b/platform/src/include/service/operate_server_api/JsonMessageStruct.h index a0d1ad1b..7ff51819 100644 --- a/platform/src/include/service/operate_server_api/JsonMessageStruct.h +++ b/platform/src/include/service/operate_server_api/JsonMessageStruct.h @@ -52,6 +52,7 @@ #define MT_OPT_INTERN_HANDOVER 32 //!< operate_server内部控制权限移交 hmi->operate_server #define MT_OPT_INTERN_HANDOVER_UP 33 //!< 内部权限状态反馈(operate_server->hmi) #define MT_OPT_EXTERN_HANDOVER_UP 34 //!< 外部权限状态反馈(data_process->hmi) +#define MT_OPT_AUTO_CTRL_WITHOUT_RESP 35 //!< app->operate_server(主要用于功率控制场景,定时发送指令不等待反馈) //@} /** diff --git a/platform/src/include/service/operate_server_api/JsonOptCommand.cpp b/platform/src/include/service/operate_server_api/JsonOptCommand.cpp index 1f3f78d7..0279efb9 100644 --- a/platform/src/include/service/operate_server_api/JsonOptCommand.cpp +++ b/platform/src/include/service/operate_server_api/JsonOptCommand.cpp @@ -5,13 +5,12 @@ */ #include "JsonOptCommand.h" -//#include -#include "sstream" -#include -#include -//#include -#include -#include +//#define RAPIDJSON_HAS_STDSTRING 1 //< 必须放在rapidjson头文件之前,用来支持std::string +#include "rapidjson/document.h" +#include "rapidjson/writer.h" +#include "rapidjson/stringbuffer.h" +#include "pub_utility_api/RapidJsonHelper.h" + #include "pub_logger_api/logger.h" using namespace std; @@ -21,138 +20,210 @@ using namespace iot_public; #define OPT_DOWN_KEYWORD "OPT_DOWN_KEYWORD" #define OPT_DOWN_CUSTALM "OPT_DOWN_CUSTALM" -//Class COptReqHead +//控制请求结构头 hmi->operate_server //======================================================================================== -/** -@brief 生成操作命令JSON 头结构 -@param in SOptReqHead& stHead - out pt_root BOOST ptree 结构 -@return 成功:true 失败 false -@retval -*/ -COptReqHead::COptReqHead() +class COptReqHead { +public: + /** + @brief 生成操作命令JSON 头结构 + @param in SOptReqHead& stHead + writer json流 + @return 成功:true 失败 false + @retval + */ + static inline void generate(rapidjson::Writer &writer,const SOptReqHead& stHead) + { + //< 开始写入头部信息 + writer.Key("strSrcTag"); + writer.String(stHead.strSrcTag.c_str()); + writer.Key("nSrcDomainID"); + writer.Int(stHead.nSrcDomainID); + writer.Key("nDstDomainID"); + writer.Int(stHead.nDstDomainID); + writer.Key("nAppID"); + writer.Int(stHead.nAppID); + writer.Key("strHostName"); + writer.String(stHead.strHostName.c_str()); + writer.Key("strInstName"); + writer.String(stHead.strInstName.c_str()); + writer.Key("strCommName"); + writer.String(stHead.strCommName.c_str()); + writer.Key("nUserID"); + writer.Int(stHead.nUserID); + writer.Key("nUserGroupID"); + writer.Int(stHead.nUserGroupID); + writer.Key("nOptTime"); + writer.Int64(stHead.nOptTime); + //< 结束头部信息 + } + /** + @brief 解码操作消息JSON 头信息到结构体 SOptReqHead stHead + @param out SOptReqHead& stHead + in doc json对象 + @return 成功:true 失败 false + @retval + */ + static inline void parse (const rapidjson::Value &doc, SOptReqHead& stHead) + { + stHead.strSrcTag = RapidJsonHelper::getString(doc,"strSrcTag","hmi"); + stHead.nSrcDomainID = RapidJsonHelper::getInt(doc,"nSrcDomainID"); + stHead.nDstDomainID = RapidJsonHelper::getInt(doc,"nDstDomainID"); + stHead.nAppID = RapidJsonHelper::getInt(doc,"nAppID"); + stHead.strHostName = RapidJsonHelper::getString(doc,"strHostName",""); + stHead.strInstName = RapidJsonHelper::getString(doc,"strInstName",""); + stHead.strCommName = RapidJsonHelper::getString(doc,"strCommName",""); + stHead.nUserID = RapidJsonHelper::getInt(doc,"nUserID",-1); + stHead.nUserGroupID = RapidJsonHelper::getInt(doc,"nUserGroupID",-1); + stHead.nOptTime = RapidJsonHelper::getInt64(doc,"nOptTime"); + } -} - -bool COptReqHead::generate(const SOptReqHead& stHead,boost::property_tree::ptree &pt_root) -{ - //try{ - pt_root.put("strSrcTag", stHead.strSrcTag ); - pt_root.put("nSrcDomainID",stHead.nSrcDomainID ); - pt_root.put("nDstDomainID",stHead.nDstDomainID ); - pt_root.put("nAppID" ,stHead.nAppID ); - pt_root.put("strHostName" ,stHead.strHostName ); - pt_root.put("strInstName" ,stHead.strInstName ); - pt_root.put("strCommName" ,stHead.strCommName ); - pt_root.put("nUserID" ,stHead.nUserID ); - pt_root.put("nUserGroupID",stHead.nUserGroupID ); - pt_root.put("nOptTime" ,stHead.nOptTime ); - //} - //catch(boost::property_tree::ptree_error &pt_root) - //{ - // pt_root.what(); - // return false; - //} - return true; -} - -/** -@brief 解码操作消息JSON 头信息到结构体 SOptReqHead stHead -@param out SOptReqHead& stHead - in parser BOOST ptree 结构 -@return 成功:true 失败 false -@retval -*/ -bool COptReqHead::parse(const boost::property_tree::ptree parser, SOptReqHead& stHead) -{ - //try{ - stHead.strSrcTag = parser.get("strSrcTag","hmi"); - stHead.nSrcDomainID = parser.get("nSrcDomainID"); - stHead.nDstDomainID = parser.get("nDstDomainID"); - stHead.nAppID = parser.get("nAppID"); - stHead.strHostName = parser.get("strHostName",""); - stHead.strInstName = parser.get("strInstName",""); - stHead.strCommName = parser.get("strCommName",""); - stHead.nUserID = parser.get("nUserID",-1); - stHead.nUserGroupID = parser.get("nUserGroupID",-1); - stHead.nOptTime = parser.get("nOptTime"); - //} - //catch(boost::property_tree::ptree_error &parser) - //{ - // parser.what(); - // return false; - //} - return true; -} + COptReqHead() = delete; +}; -COptReplyHead::COptReplyHead() -{ - -} -//Class COptReplyHead +//控制请求回复结构头 operate_server->hmi //======================================================================================== +class COptReplyHead +{ +public: + /** + @brief 编码操作请求回复命令到结构体SOptReplyHead + @param in SOptReplyHead& stHead + out pt_root BOOST ptree 结构 + @return 成功:true 失败 false + @retval + */ + static inline void generate(rapidjson::Writer &writer,const SOptReplyHead& stHead) + { + writer.Key("strSrcTag"); + writer.String(stHead.strSrcTag.c_str()); + writer.Key("nDomainID"); + writer.Int(stHead.nDomainID); + writer.Key("nDstDomainID"); + writer.Int(stHead.nDstDomainID); + writer.Key("nAppID"); + writer.Int(stHead.nAppID); + writer.Key("strHostName"); + writer.String(stHead.strHostName.c_str()); + writer.Key("strInstName"); + writer.String(stHead.strInstName.c_str()); + writer.Key("strKeyIdTag"); + writer.String(stHead.strKeyIdTag.c_str()); + writer.Key("nIsSuccess"); + writer.Int(stHead.nIsSuccess); + writer.Key("strResultStr"); + writer.String(stHead.strResultStr.c_str()); + writer.Key("nOptTime"); + writer.Int64(stHead.nOptTime); + } -/** -@brief 编码操作请求回复命令到结构体SOptReplyHead -@param in SOptReplyHead& stHead - out pt_root BOOST ptree 结构 -@return 成功:true 失败 false -@retval -*/ -bool COptReplyHead::generate(const SOptReplyHead& stHead,boost::property_tree::ptree &pt_root ) -{ - //try{ - pt_root.put("strSrcTag" ,stHead.strSrcTag ); - pt_root.put("nDomainID" ,stHead.nDomainID ); - pt_root.put("nDstDomainID" ,stHead.nDstDomainID ); - pt_root.put("nAppID" ,stHead.nAppID ); - pt_root.put("strHostName" ,stHead.strHostName ); - pt_root.put("strInstName" ,stHead.strInstName ); - pt_root.put("strKeyIdTag" ,stHead.strKeyIdTag ); - pt_root.put("nIsSuccess" ,stHead.nIsSuccess ); - pt_root.put("strResultStr" ,stHead.strResultStr ); - pt_root.put("nOptTime" ,stHead.nOptTime ); - //} - //catch(boost::property_tree::ptree_error &pt_root) - //{ - // pt_root.what(); - // return false; - //} - return true; -} -/** -@brief 解码操作回复消息JSON 头信息到结构体 SOptReplyHead stHead -@param out SOptReplyHead& stHead - in parser BOOST ptree 结构 -@return 成功:true 失败 false -@retval -*/ -bool COptReplyHead::parse (const boost::property_tree::ptree parser, SOptReplyHead& stHead) -{ - //try{ - stHead.strSrcTag = parser.get("strSrcTag"); - stHead.nDomainID = parser.get("nDomainID"); - stHead.nDstDomainID = parser.get("nDstDomainID"); - stHead.nAppID = parser.get("nAppID"); - stHead.strHostName = parser.get("strHostName"); - stHead.strInstName = parser.get("strInstName"); - stHead.strKeyIdTag = parser.get("strKeyIdTag"); - stHead.nIsSuccess = parser.get("nIsSuccess"); - stHead.strResultStr = parser.get("strResultStr"); - stHead.nOptTime = parser.get("nOptTime"); - //} - //catch(boost::property_tree::ptree_error &parser) - //{ - // parser.what(); - // return false; - //} - return true; -} + /** + @brief 解码操作回复消息JSON 头信息到结构体 SOptReplyHead stHead + @param out SOptReplyHead& stHead + in parser BOOST ptree 结构 + @return 成功:true 失败 false + @retval + */ + static inline void parse (const rapidjson::Value &doc, SOptReplyHead& stHead) + { + stHead.strSrcTag = RapidJsonHelper::getString(doc,"strSrcTag"); + stHead.nDomainID = RapidJsonHelper::getInt(doc,"nDomainID"); + stHead.nDstDomainID = RapidJsonHelper::getInt(doc,"nDstDomainID"); + stHead.nAppID = RapidJsonHelper::getInt(doc,"nAppID"); + stHead.strHostName = RapidJsonHelper::getString(doc,"strHostName"); + stHead.strInstName = RapidJsonHelper::getString(doc,"strInstName"); + stHead.strKeyIdTag = RapidJsonHelper::getString(doc,"strKeyIdTag"); + stHead.nIsSuccess = RapidJsonHelper::getInt(doc,"nIsSuccess"); + stHead.strResultStr = RapidJsonHelper::getString(doc,"strResultStr"); + stHead.nOptTime = RapidJsonHelper::getInt64(doc,"nOptTime"); + } + + COptReplyHead() = delete; +}; //控制请求消息JSON类 OPERATE_SERVER->HMI //===================================================================== +void innerWriteOptCtrlRequest(rapidjson::Writer &writer,const SOptCtrlRequest& stCtrlRequest) +{ + writer.StartObject(); //起始 + //< 开始写入头部信息 + COptReqHead::generate(writer,stCtrlRequest.stHead); + + //< 开始写入测点数组 + writer.Key(OPT_DOWN_INFO); + writer.StartArray(); + for (size_t i = 0; i < stCtrlRequest.vecOptCtrlQueue.size(); i++) + { + const SOptCtrlReqQueue &stCtrlInfo = stCtrlRequest.vecOptCtrlQueue.at(i); + writer.StartObject(); + + writer.Key("strKeyIdTag"); + writer.String(stCtrlInfo.strKeyIdTag.c_str()); + writer.Key("nCtrlType"); + writer.Int(stCtrlInfo.nCtrlType); + writer.Key("fTargetValue"); + writer.Double(stCtrlInfo.dTargetValue); + writer.Key("nCtrlActType"); + writer.Int(stCtrlInfo.nCtrlActType); + writer.Key("strCtrlActName"); + writer.String(stCtrlInfo.strCtrlActName.c_str()); + writer.Key("strOffsetNo"); + writer.String(stCtrlInfo.strOffsetNo.c_str()); + writer.Key("bIsDeviceOccupy"); + writer.Bool(stCtrlInfo.bIsDeviceOccupy); + writer.Key("bIsCtrlRequest"); + writer.Bool(stCtrlInfo.bIsCtrlRequest); + writer.Key("bIsGenAlarm"); + writer.Bool(stCtrlInfo.bIsGenAlarm); + writer.Key("bCheckInterLock"); + writer.Bool(stCtrlInfo.bCheckInterLock); + + writer.EndObject(); + } + writer.EndArray(); //< 结束写入测点数组 + writer.EndObject(); //结束 +} + +void innerParseOptCtrlRequest(const rapidjson::Value &doc, SOptCtrlRequest &stReq) +{ + COptReqHead::parse(doc,stReq.stHead); //< 解析消息头 + + stReq.vecOptCtrlQueue.clear(); + + const rapidjson::Value::ConstMemberIterator &iterInfo = doc.FindMember(OPT_DOWN_INFO); + if(iterInfo == doc.MemberEnd()) + { + return; + } + + const rapidjson::Value& arrInfo = iterInfo->value; + if(!arrInfo.IsArray()) + { + return; + } + + int nInfoSize = arrInfo.Size(); + stReq.vecOptCtrlQueue.reserve(nInfoSize); + for(int nIdx = 0; nIdx < nInfoSize; nIdx++) + { + const rapidjson::Value& arrValue = arrInfo[nIdx]; + + SOptCtrlReqQueue stCtrlInfo ; + stCtrlInfo.strKeyIdTag = RapidJsonHelper::getString(arrValue,"strKeyIdTag"); + stCtrlInfo.nCtrlType = RapidJsonHelper::getInt(arrValue,"nCtrlType",1); + stCtrlInfo.dTargetValue = RapidJsonHelper::getDouble(arrValue,"fTargetValue"); + stCtrlInfo.nCtrlActType = RapidJsonHelper::getInt(arrValue,"nCtrlActType"); + stCtrlInfo.strCtrlActName = RapidJsonHelper::getString(arrValue,"strCtrlActName",""); + stCtrlInfo.strOffsetNo = RapidJsonHelper::getString(arrValue,"strOffsetNo","null"); + stCtrlInfo.bIsCtrlRequest = RapidJsonHelper::getBool(arrValue,"bIsCtrlRequest",false); + stCtrlInfo.bIsDeviceOccupy= RapidJsonHelper::getBool(arrValue,"bIsDeviceOccupy",true); + stCtrlInfo.bIsGenAlarm = RapidJsonHelper::getBool(arrValue,"bIsGenAlarm",true); + stCtrlInfo.bCheckInterLock= RapidJsonHelper::getBool(arrValue,"bCheckInterLock",true); + + stReq.vecOptCtrlQueue.push_back(stCtrlInfo); + } +} /** @brief 解码控制请求消息并输出JSON字符串 @@ -162,42 +233,31 @@ bool COptReplyHead::parse (const boost::property_tree::ptree parser, SOptReplyHe */ string COptCtrlRequest::generate(const SOptCtrlRequest& stCtrlRequest) { - try - { - boost::property_tree::ptree pt_root; - boost::property_tree::ptree children; - boost::property_tree::ptree child; + //生成调整为使用rapidjson生成,格式为紧凑格式 + rapidjson::StringBuffer s; + rapidjson::Writer writer(s); - m_objHead.generate(stCtrlRequest.stHead,pt_root); - for(size_t i = 0; i < stCtrlRequest.vecOptCtrlQueue.size(); i++) - { - SOptCtrlReqQueue stCtrlInfo = stCtrlRequest.vecOptCtrlQueue.at(i); - child.put("strKeyIdTag", stCtrlInfo.strKeyIdTag); - child.put("nCtrlType", stCtrlInfo.nCtrlType); - child.put("fTargetValue", stCtrlInfo.dTargetValue); - child.put("nCtrlActType", stCtrlInfo.nCtrlActType); - child.put("strCtrlActName", stCtrlInfo.strCtrlActName); - child.put("strOffsetNo", stCtrlInfo.strOffsetNo); - child.put("bIsDeviceOccupy",stCtrlInfo.bIsDeviceOccupy); - child.put("bIsGenAlarm", stCtrlInfo.bIsGenAlarm); - child.put("bCheckInterLock",stCtrlInfo.bCheckInterLock); - children.push_back(std::make_pair("", child)); - } - pt_root.add_child(OPT_DOWN_INFO, children); - - std::stringstream ss; - boost::property_tree::write_json(ss, pt_root); - std::string s = ss.str(); - return s; - } - catch(boost::property_tree::ptree_error &pt_error) - { - LOGERROR("COptCtrlRequest::generate ,error=%s!", pt_error.what()); - return "" ; - } - return "" ; + innerWriteOptCtrlRequest(writer,stCtrlRequest); + return s.GetString(); } + +string COptCtrlRequest::generate(const std::vector &vecCtrlReq) +{ + //生成调整为使用rapidjson生成,格式为紧凑格式 + rapidjson::StringBuffer s; + rapidjson::Writer writer(s); + + writer.StartArray(); //< 起始 + for(size_t reqIdx = 0; reqIdx < vecCtrlReq.size(); reqIdx++) + { + innerWriteOptCtrlRequest(writer,vecCtrlReq[reqIdx]); + } + writer.EndArray(); //< 结束 + + return s.GetString(); +} + /** @brief 解码控制请求消息(JSON字符串)到结构体 @param in std::string& s: 需要解码JSON 字符串 @@ -207,42 +267,74 @@ string COptCtrlRequest::generate(const SOptCtrlRequest& stCtrlRequest) */ bool COptCtrlRequest::parse(const std::string& s, SOptCtrlRequest& stCtrlRequest) { - try{ - std::istringstream iss; - iss.str(s.c_str()); - boost::property_tree::ptree parser; - boost::property_tree::json_parser::read_json(iss, parser); - - m_objHead.parse(parser,stCtrlRequest.stHead); - stCtrlRequest.vecOptCtrlQueue.clear(); - boost::property_tree::ptree sms_array = parser.get_child(OPT_DOWN_INFO); - BOOST_FOREACH(boost::property_tree::ptree::value_type &v, sms_array) - { - boost::property_tree::ptree p = v.second; - SOptCtrlReqQueue stCtrlInfo ; - stCtrlInfo.strKeyIdTag = p.get("strKeyIdTag"); - stCtrlInfo.nCtrlType = p.get("nCtrlType",1); - stCtrlInfo.dTargetValue = p.get("fTargetValue"); - stCtrlInfo.nCtrlActType = p.get("nCtrlActType"); - stCtrlInfo.strCtrlActName = p.get("strCtrlActName",""); - stCtrlInfo.strOffsetNo = p.get("strOffsetNo","null"); - stCtrlInfo.bIsCtrlRequest = p.get("bIsCtrlRequest",false); - stCtrlInfo.bIsDeviceOccupy= p.get("bIsDeviceOccupy",true); - stCtrlInfo.bIsGenAlarm = p.get("bIsGenAlarm",true); - stCtrlInfo.bCheckInterLock= p.get("bCheckInterLock",true); - - stCtrlRequest.vecOptCtrlQueue.push_back(stCtrlInfo); - } - return true; - } - catch(boost::property_tree::ptree_error &pt_error) + rapidjson::Document doc; + if( doc.Parse(s.c_str()).HasParseError() ) { - LOGERROR("COptCtrlRequest::parse ,error=%s!", pt_error.what()); + LOGERROR("COptCtrlRequest::parse ,error=%d", doc.GetParseError()); return false; } + + if(!doc.IsObject()) + { + LOGERROR("COptCtrlRequest::parse json is not object"); + return false; + } + + try + { + innerParseOptCtrlRequest(doc,stCtrlRequest); + } + catch(const std::exception& ex) + { + LOGERROR("COptCtrlRequest::parse ,error=%s!", ex.what()); + return false; + } + return true; } +bool COptCtrlRequest::parse(const string &s, std::vector &vecCtrlReq) +{ + rapidjson::Document doc; + if( doc.Parse(s.c_str()).HasParseError() ) + { + LOGERROR("COptCtrlRequest::parse ,error=%d", doc.GetParseError()); + return false; + } + + try + { + if(doc.IsObject()) + { + SOptCtrlRequest stReq; + innerParseOptCtrlRequest(doc,stReq); + vecCtrlReq.push_back(stReq); + } + else if(doc.IsArray()) + { + int nArrSize = doc.Size(); + vecCtrlReq.reserve(nArrSize); + for(int i = 0;i < nArrSize; i++) + { + SOptCtrlRequest stReq; + innerParseOptCtrlRequest(doc[i],stReq); + vecCtrlReq.push_back(stReq); + } + } + else + { + LOGERROR("COptCtrlRequest::parse ,invalid json\n%s\n", s.c_str()); + return false; + } + } + catch(const std::exception& ex) + { + LOGERROR("COptCtrlRequest::parse ,error=%s!", ex.what()); + return false; + } + + return true; +} /** @brief 解码控制请求消息并输出JSON字符串 @@ -250,81 +342,89 @@ bool COptCtrlRequest::parse(const std::string& s, SOptCtrlRequest& stCtrlRequest @return string 编码好的 JSON 字符串 @retval */ -string COptCustCtrlRequest::generate(const SOptCustCtrlRequest& stCustCtrlRequest) +std::string COptCustCtrlRequest::generate(const SOptCustCtrlRequest& stCustCtrlRequest) { - try + rapidjson::StringBuffer s; + rapidjson::Writer writer(s); + + writer.StartObject(); //起始 + + //< 消息头 + COptReqHead::generate(writer,stCustCtrlRequest.stHead); + writer.Key("strKeyIdTag"); + writer.String(stCustCtrlRequest.strKeyIdTag.c_str()); + writer.Key("strRtuTag"); + writer.String(stCustCtrlRequest.strRtuTag.c_str()); + + //< 控制参数 + writer.Key(OPT_DOWN_INFO); + writer.StartArray(); + for(size_t i = 0; i < stCustCtrlRequest.vecOptCustCtrlQueue.size(); i++) { - boost::property_tree::ptree pt_root; - boost::property_tree::ptree children; - boost::property_tree::ptree child; + const SOptCustCtrlQueue &stCtrlInfo = stCustCtrlRequest.vecOptCustCtrlQueue.at(i); + writer.StartObject(); - m_objHead.generate(stCustCtrlRequest.stHead,pt_root); + writer.Key("K"); + writer.String(stCtrlInfo.strKeyName.c_str()); + writer.Key("V"); + writer.String(stCtrlInfo.strKeyValue.c_str()); - pt_root.put("strKeyIdTag", stCustCtrlRequest.strKeyIdTag); - pt_root.put("strRtuTag", stCustCtrlRequest.strRtuTag); - - // 控制参数 - //===================================================================================================== - for(size_t i = 0; i < stCustCtrlRequest.vecOptCustCtrlQueue.size(); i++) - { - SOptCustCtrlQueue stCtrlInfo = stCustCtrlRequest.vecOptCustCtrlQueue.at(i); - child.put("K", stCtrlInfo.strKeyName); - child.put("V", stCtrlInfo.strKeyValue); - children.push_back(std::make_pair("", child)); - } - pt_root.add_child(OPT_DOWN_INFO, children); - - // 报警参数 - //===================================================================================================== - child.clear(); - children.clear(); - for(size_t i = 0; i < stCustCtrlRequest.vecOptAlarmQueue.size(); i++) - { - SOptAlarmInfo stAlarmInfo = stCustCtrlRequest.vecOptAlarmQueue.at(i); - - child.put("nAlarmType", stAlarmInfo.nAlarmType); //报警类型 - child.put("nAlarmStatus", stAlarmInfo.nAlarmStatus); //报警状态 - child.put("lAlarmTime", stAlarmInfo.lAlarmTime); //时标(RFC1305、POSIX时标标准) - child.put("nLocationId", stAlarmInfo.nLocationId); //位置ID - child.put("nAlarmStyle", stAlarmInfo.nAlarmStyle); //见enAlmStyle注释 - - // 报警参数-选填项目 - //================================================================================================ - child.put("nDeviceType", stAlarmInfo.nDeviceType); //设备类型ID - child.put("nRegionId", stAlarmInfo.nRegionId); //责任区ID - child.put("strKeyIdTag", stAlarmInfo.strKeyIdTag); //替换式报警必须填充,否则作为流水帐报警处理 - child.put("strGraphName", stAlarmInfo.strGraphName);//报警关联画面名称 - child.put("strAlarmSrc", stAlarmInfo.strAlarmSrc); //PA/PIS/ATS:表示消息来来源 - - children.push_back(std::make_pair("", child)); - - // 报警参数-关键字 - //================================================================================================ - boost::property_tree::ptree keyWord; - boost::property_tree::ptree keyWordItems; - for(size_t index = 0; index < stAlarmInfo.vecAlmKeyword.size(); index++) - { - SAlarmKeyWord stKeyWord = stAlarmInfo.vecAlmKeyword[index]; - keyWord.put("nKeyId", stKeyWord.nKeyId); - keyWord.put("strKeyValue",stKeyWord.strKeyValue); - keyWordItems.push_back(std::make_pair("", keyWord)); - } - children.put_child(OPT_DOWN_KEYWORD, keyWordItems); - - } - pt_root.add_child(OPT_DOWN_CUSTALM, children); - - std::stringstream ss; - boost::property_tree::write_json(ss, pt_root); - std::string s = ss.str(); - return s; + writer.EndObject(); } - catch(boost::property_tree::ptree_error &pt_error) + writer.EndArray(); //< 结束写入控制参数 + + // 报警参数 + writer.Key(OPT_DOWN_CUSTALM); + writer.StartArray(); //< 开始报警参数数组 + for(size_t i = 0; i < stCustCtrlRequest.vecOptAlarmQueue.size(); i++) { - LOGERROR("COptCustCtrlRequest::generate ,error=%s!", pt_error.what()); - return "" ; + const SOptAlarmInfo &stAlarmInfo = stCustCtrlRequest.vecOptAlarmQueue.at(i); + writer.StartObject(); //< 开始单个报警 + + writer.Key("nAlarmType"); + writer.Int(stAlarmInfo.nAlarmType); //报警类型 + writer.Key("nAlarmStatus"); + writer.Int(stAlarmInfo.nAlarmStatus); //报警状态 + writer.Key("lAlarmTime"); + writer.Int64(stAlarmInfo.lAlarmTime); //时标(RFC1305、POSIX时标标准) + writer.Key("nLocationId"); + writer.Int(stAlarmInfo.nLocationId); //位置ID + writer.Key("nAlarmStyle"); + writer.Int(stAlarmInfo.nAlarmStyle); //见enAlmStyle注释 + + // 报警参数-选填项目 + writer.Key("nDeviceType"); + writer.Int(stAlarmInfo.nDeviceType); //设备类型ID + writer.Key("nRegionId"); + writer.Int(stAlarmInfo.nRegionId); //责任区ID + writer.Key("strKeyIdTag"); + writer.String(stAlarmInfo.strKeyIdTag.c_str()); //替换式报警必须填充,否则作为流水帐报警处理 + writer.Key("strGraphName"); + writer.String(stAlarmInfo.strGraphName.c_str());//报警关联画面名称 + writer.Key("strAlarmSrc"); + writer.String(stAlarmInfo.strAlarmSrc.c_str()); //PA/PIS/ATS:表示消息来来源 + + // 报警参数-关键字 + writer.Key(OPT_DOWN_KEYWORD); + writer.StartArray(); //< 开始报警关键字数组 + for(size_t index = 0; index < stAlarmInfo.vecAlmKeyword.size(); index++) + { + const SAlarmKeyWord &stKeyWord = stAlarmInfo.vecAlmKeyword[index]; + writer.StartObject(); + writer.Key("nKeyId"); + writer.Int(stKeyWord.nKeyId); + writer.Key("strKeyValue"); + writer.String(stKeyWord.strKeyValue.c_str()); + writer.EndObject(); + } + writer.EndArray(); //< 结束报警关键字数组 + writer.EndObject(); //< 开始单个报警 } - return "" ; + writer.EndArray(); //< 结束写入报警参数数组 + + writer.EndObject(); //起始 + + return s.GetString(); } /** @@ -336,78 +436,98 @@ string COptCustCtrlRequest::generate(const SOptCustCtrlRequest& stCustCtrlReques */ bool COptCustCtrlRequest::parse(const std::string& s, SOptCustCtrlRequest& stCustCtrlRequest) { - try{ - std::istringstream iss; - iss.str(s.c_str()); - boost::property_tree::ptree parser; - boost::property_tree::json_parser::read_json(iss, parser); + rapidjson::Document doc; + if( doc.Parse(s.c_str()).HasParseError() ) + { + LOGERROR("COptCustCtrlRequest::parse ,error=%d", doc.GetParseError()); + return false; + } - m_objHead.parse(parser,stCustCtrlRequest.stHead); + if(!doc.IsObject()) + { + LOGERROR("COptCustCtrlRequest::parse json is not object"); + return false; + } - stCustCtrlRequest.strKeyIdTag = parser.get("strKeyIdTag"); - stCustCtrlRequest.strRtuTag = parser.get("strRtuTag",""); + try + { + //< 解析消息头 + COptReqHead::parse(doc,stCustCtrlRequest.stHead); + stCustCtrlRequest.strKeyIdTag = RapidJsonHelper::getString(doc,"strKeyIdTag"); + stCustCtrlRequest.strRtuTag = RapidJsonHelper::getString(doc,"strRtuTag",""); + //< 控制参数 stCustCtrlRequest.vecOptCustCtrlQueue.clear(); - boost::property_tree::ptree sms_array = parser.get_child(OPT_DOWN_INFO); - BOOST_FOREACH(boost::property_tree::ptree::value_type &v, sms_array) + const rapidjson::Value::ConstMemberIterator &iterCtrl = doc.FindMember(OPT_DOWN_INFO); + if(iterCtrl != doc.MemberEnd() && iterCtrl->value.IsArray()) { - boost::property_tree::ptree p = v.second; - SOptCustCtrlQueue stCtrlInfo ; - stCtrlInfo.strKeyName = p.get("K"); - stCtrlInfo.strKeyValue = p.get("V"); - stCustCtrlRequest.vecOptCustCtrlQueue.push_back(stCtrlInfo); - } - // 报警参数 - //================================================================================================ - boost::optional child_null_test = parser.get_child_optional(OPT_DOWN_CUSTALM); - if (child_null_test) - { - boost::property_tree::ptree alarm_array = parser.get_child(OPT_DOWN_CUSTALM); - BOOST_FOREACH(boost::property_tree::ptree::value_type &v, alarm_array) + const rapidjson::Value& arrCtrlInfo = iterCtrl->value; + + int nInfoSize = arrCtrlInfo.Size(); + stCustCtrlRequest.vecOptCustCtrlQueue.reserve(nInfoSize); + for(int nIdx = 0; nIdx < nInfoSize; nIdx++) { - boost::property_tree::ptree pAlarm = v.second; + const rapidjson::Value& ctrlInfo = arrCtrlInfo[nIdx]; + SOptCustCtrlQueue stCtrlInfo ; + stCtrlInfo.strKeyName = RapidJsonHelper::getString(ctrlInfo,"K"); + stCtrlInfo.strKeyValue = RapidJsonHelper::getString(ctrlInfo,"V"); + stCustCtrlRequest.vecOptCustCtrlQueue.push_back(stCtrlInfo); + } + } + + //< 报警参数 + stCustCtrlRequest.vecOptAlarmQueue.clear(); + const rapidjson::Value::ConstMemberIterator &iterAlm = doc.FindMember(OPT_DOWN_CUSTALM); + if(iterAlm != doc.MemberEnd() && iterAlm->value.IsArray()) + { + const rapidjson::Value& arrAlmInfo = iterAlm->value; + int nAlmSize = arrAlmInfo.Size(); + stCustCtrlRequest.vecOptAlarmQueue.reserve(nAlmSize); + for(int nAlmIdx = 0; nAlmIdx < nAlmSize; nAlmIdx++) + { + const rapidjson::Value& almInfo = arrAlmInfo[nAlmIdx]; SOptAlarmInfo stAlarmInfo; - // 报警参数-必填项目 - //=========================================================================================== - stAlarmInfo.nAlarmType = pAlarm.get("nAlarmType", 0); //报警类型 - stAlarmInfo.nAlarmStatus = pAlarm.get("nAlarmStatus"); //报警状态 - stAlarmInfo.nLocationId = pAlarm.get("nLocationId", 0); //位置ID - stAlarmInfo.nAlarmStyle = pAlarm.get("nAlarmStyle", 0); //见enAlmStyle注释 - stAlarmInfo.lAlarmTime = pAlarm.get("lAlarmTime", 0); //时标(RFC1305、POSIX时标标准) - + stAlarmInfo.nAlarmType = RapidJsonHelper::getInt(almInfo,"nAlarmType", 0); //报警类型 + stAlarmInfo.nAlarmStatus = RapidJsonHelper::getInt(almInfo,"nAlarmStatus"); //报警状态 + stAlarmInfo.nLocationId = RapidJsonHelper::getInt(almInfo,"nLocationId", 0); //位置ID + stAlarmInfo.nAlarmStyle = RapidJsonHelper::getInt(almInfo,"nAlarmStyle", 0); //见enAlmStyle注释 + stAlarmInfo.lAlarmTime = RapidJsonHelper::getInt64(almInfo,"lAlarmTime", 0); //时标(RFC1305、POSIX时标标准) // 报警参数-选填项目 - //=========================================================================================== - stAlarmInfo.nDeviceType = pAlarm.get("nDeviceType", 0); //设备类型ID - stAlarmInfo.nRegionId = pAlarm.get("nRegionId", 0); //责任区ID - stAlarmInfo.strKeyIdTag = pAlarm.get("strKeyIdTag", "");//替换式报警必须填充 - stAlarmInfo.strGraphName = pAlarm.get("strGraphName", "");//报警关联画面名称 - stAlarmInfo.strAlarmSrc = pAlarm.get("strAlarmSrc", "hmi"); //PA/PIS/ATS:表示消息来来源 + stAlarmInfo.nDeviceType = RapidJsonHelper::getInt(almInfo,"nDeviceType", 0); //设备类型ID + stAlarmInfo.nRegionId = RapidJsonHelper::getInt(almInfo,"nRegionId", 0); //责任区ID + stAlarmInfo.strKeyIdTag = RapidJsonHelper::getString(almInfo,"strKeyIdTag", "");//替换式报警必须填充 + stAlarmInfo.strGraphName = RapidJsonHelper::getString(almInfo,"strGraphName", "");//报警关联画面名称 + stAlarmInfo.strAlarmSrc = RapidJsonHelper::getString(almInfo,"strAlarmSrc", "hmi"); //PA/PIS/ATS:表示消息来来源 // 报警参数-关键字 - //=========================================================================================== stAlarmInfo.vecAlmKeyword.clear(); - boost::property_tree::ptree keyword_array = pAlarm.get_child(OPT_DOWN_KEYWORD); - BOOST_FOREACH(boost::property_tree::ptree::value_type &keyword, keyword_array) + const rapidjson::Value::ConstMemberIterator &iterAlmKey = almInfo.FindMember(OPT_DOWN_KEYWORD); + if(iterAlmKey != doc.MemberEnd() && iterAlmKey->value.IsArray()) { - boost::property_tree::ptree pKeyword = keyword.second; - SAlarmKeyWord stKeyWord; - stKeyWord.nKeyId = pKeyword.get("nKeyId"); - stKeyWord.strKeyValue = pKeyword.get("strKeyValue", ""); - stAlarmInfo.vecAlmKeyword.push_back(stKeyWord); + const rapidjson::Value& arrAlmKeyInfo = iterAlmKey->value; + int nAlmKeySize = arrAlmKeyInfo.Size(); + stAlarmInfo.vecAlmKeyword.reserve(nAlmKeySize); + for(int nKeyIdx = 0; nKeyIdx < nAlmKeySize; nKeyIdx++) + { + const rapidjson::Value& almKeyInfo = arrAlmKeyInfo[nKeyIdx]; + SAlarmKeyWord stKeyWord; + stKeyWord.nKeyId = RapidJsonHelper::getInt(almKeyInfo,"nKeyId"); + stKeyWord.strKeyValue = RapidJsonHelper::getString(almKeyInfo,"strKeyValue", ""); + stAlarmInfo.vecAlmKeyword.push_back(stKeyWord); + } } stCustCtrlRequest.vecOptAlarmQueue.push_back(stAlarmInfo); } } - - return true; } - catch(boost::property_tree::ptree_error &pt_error) + catch(const std::exception& ex) { - LOGERROR("COptCustCtrlRequest::parse ,error=%s!", pt_error.what()); + LOGERROR("COptCustCtrlRequest::parse ,error=%s!", ex.what()); return false; } + return true; } @@ -417,35 +537,28 @@ bool COptCustCtrlRequest::parse(const std::string& s, SOptCustCtrlRequest& stCus @return 编码好的 JSON 字符串 @retval */ -string COptCustCtrlReply::generate(const SOptCustCtrlReply& stCustCtrlReply) +std::string COptCustCtrlReply::generate(const SOptCustCtrlReply& stCustCtrlReply) { - try - { - boost::property_tree::ptree pt_root; - boost::property_tree::ptree children; - boost::property_tree::ptree child; + rapidjson::StringBuffer s; + rapidjson::Writer writer(s); - m_objHead.generate(stCustCtrlReply.stHead,pt_root); - for(size_t i = 0; i < stCustCtrlReply.vecOptCustCtrlQueue.size(); i++) - { - SOptCustCtrlQueue stCtrlInfo = stCustCtrlReply.vecOptCustCtrlQueue.at(i); - child.put("K", stCtrlInfo.strKeyName); - child.put("V", stCtrlInfo.strKeyValue); - children.push_back(std::make_pair("", child)); - } - pt_root.add_child(OPT_DOWN_INFO, children); - - std::stringstream ss; - boost::property_tree::write_json(ss, pt_root); - std::string s = ss.str(); - return s; - } - catch(boost::property_tree::ptree_error &pt_error) + writer.StartObject(); //< 起始 + COptReplyHead::generate(writer,stCustCtrlReply.stHead); + writer.Key(OPT_DOWN_INFO); + writer.StartArray(); + for(size_t i = 0; i < stCustCtrlReply.vecOptCustCtrlQueue.size(); i++) { - LOGERROR("COptCustCtrlReply::generate ,error=%s!", pt_error.what()); - return "" ; + const SOptCustCtrlQueue &stCtrlInfo = stCustCtrlReply.vecOptCustCtrlQueue.at(i); + writer.StartObject(); + writer.Key("K"); + writer.String(stCtrlInfo.strKeyName.c_str()); + writer.Key("V"); + writer.String(stCtrlInfo.strKeyValue.c_str()); + writer.EndObject(); } - return "" ; + writer.EndArray(); + writer.EndObject(); //< 结束 + return s.GetString(); } /** @@ -457,30 +570,47 @@ string COptCustCtrlReply::generate(const SOptCustCtrlReply& stCustCtrlReply) */ bool COptCustCtrlReply::parse(const std::string& s, SOptCustCtrlReply& stCustCtrlReply) { - try{ - std::istringstream iss; - iss.str(s.c_str()); - boost::property_tree::ptree parser; - boost::property_tree::json_parser::read_json(iss, parser); - - m_objHead.parse(parser,stCustCtrlReply.stHead); - stCustCtrlReply.vecOptCustCtrlQueue.clear(); - boost::property_tree::ptree sms_array = parser.get_child(OPT_DOWN_INFO); - BOOST_FOREACH(boost::property_tree::ptree::value_type &v, sms_array) - { - boost::property_tree::ptree p = v.second; - SOptCustCtrlQueue stCtrlInfo ; - stCtrlInfo.strKeyName = p.get("K"); - stCtrlInfo.strKeyValue = p.get("V"); - stCustCtrlReply.vecOptCustCtrlQueue.push_back(stCtrlInfo); - } - return true; - } - catch(boost::property_tree::ptree_error &pt_error) + rapidjson::Document doc; + if( doc.Parse(s.c_str()).HasParseError() ) { - LOGERROR("COptCustCtrlReply::parse ,error=%s!", pt_error.what()); + LOGERROR("COptCustCtrlReply::parse ,error=%d", doc.GetParseError()); return false; } + + if(!doc.IsObject()) + { + LOGERROR("COptCustCtrlReply::parse json is not object"); + return false; + } + + try + { + COptReplyHead::parse(doc,stCustCtrlReply.stHead); + stCustCtrlReply.vecOptCustCtrlQueue.clear(); + const rapidjson::Value::ConstMemberIterator &iterCtrl = doc.FindMember(OPT_DOWN_INFO); + if(iterCtrl != doc.MemberEnd() && iterCtrl->value.IsArray()) + { + const rapidjson::Value& arrCtrlInfo = iterCtrl->value; + + int nInfoSize = arrCtrlInfo.Size(); + stCustCtrlReply.vecOptCustCtrlQueue.reserve(nInfoSize); + for(int nIdx = 0; nIdx < nInfoSize; nIdx++) + { + const rapidjson::Value& ctrlInfo = arrCtrlInfo[nIdx]; + SOptCustCtrlQueue stCtrlInfo ; + stCtrlInfo.strKeyName = RapidJsonHelper::getString(ctrlInfo,"K"); + stCtrlInfo.strKeyValue = RapidJsonHelper::getString(ctrlInfo,"V"); + stCustCtrlReply.vecOptCustCtrlQueue.push_back(stCtrlInfo); + } + } + + } + catch(const std::exception& ex) + { + LOGERROR("COptCustCtrlReply::parse ,error=%s!", ex.what()); + return false; + } + return true; } @@ -495,37 +625,35 @@ bool COptCustCtrlReply::parse(const std::string& s, SOptCustCtrlReply& stCustCtr */ string COptCtrlReply::generate(const SOptCtrlReply& stOptCtrlReply) { - try - { - boost::property_tree::ptree pt_root; - boost::property_tree::ptree children; - boost::property_tree::ptree child; + rapidjson::StringBuffer s; + rapidjson::Writer writer(s); - m_objHead.generate(stOptCtrlReply.stHead,pt_root); - for(size_t i = 0; i < stOptCtrlReply.vecReplyQueue.size(); i++) - { - SOptReplyQueue stCtrlInfo = stOptCtrlReply.vecReplyQueue.at(i); - child.put("strCtrlActName", stCtrlInfo.strCtrlActName); - child.put("nCtrlActType", stCtrlInfo.nCtrlActType); - child.put("fTargetValue", stCtrlInfo.dTargetValue); - child.put("bCtrlAllow", stCtrlInfo.bCtrlAllow); - child.put("strOffsetNo", stCtrlInfo.strOffsetNo); - children.push_back(std::make_pair("", child)); - } - pt_root.add_child(OPT_DOWN_INFO, children); - - std::stringstream ss; - boost::property_tree::write_json(ss, pt_root); - std::string s = ss.str(); - return s; - } - catch(boost::property_tree::ptree_error &pt_error) + writer.StartObject(); //< 起始 + COptReplyHead::generate(writer,stOptCtrlReply.stHead); + writer.Key(OPT_DOWN_INFO); + writer.StartArray(); + for(size_t i = 0; i < stOptCtrlReply.vecReplyQueue.size(); i++) { - LOGERROR("COptCtrlReply::generate ,error=%s!", pt_error.what()); - return "" ; + const SOptReplyQueue &stCtrlInfo = stOptCtrlReply.vecReplyQueue.at(i); + writer.StartObject(); + writer.Key("strCtrlActName"); + writer.String(stCtrlInfo.strCtrlActName.c_str()); + writer.Key("nCtrlActType"); + writer.Int(stCtrlInfo.nCtrlActType); + writer.Key("fTargetValue"); + writer.Double(stCtrlInfo.dTargetValue); + writer.Key("bCtrlAllow"); + writer.Bool(stCtrlInfo.bCtrlAllow); + writer.Key("strOffsetNo"); + writer.String(stCtrlInfo.strOffsetNo.c_str()); + writer.EndObject(); } - return "" ; + writer.EndArray(); + + writer.EndObject(); //< 结束 + return s.GetString(); } + /** @brief 解码控制回复请求消息(JSON字符串)到结构体 @param in std::string& s: 需要解码JSON 字符串 @@ -535,33 +663,50 @@ string COptCtrlReply::generate(const SOptCtrlReply& stOptCtrlReply) */ bool COptCtrlReply::parse(const std::string& s, SOptCtrlReply& stOptCtrlReply) { - try{ - std::istringstream iss; - iss.str(s.c_str()); - boost::property_tree::ptree parser; - boost::property_tree::json_parser::read_json(iss, parser); - - m_objHead.parse(parser,stOptCtrlReply.stHead); - stOptCtrlReply.vecReplyQueue.clear(); - boost::property_tree::ptree sms_array = parser.get_child(OPT_DOWN_INFO); - BOOST_FOREACH(boost::property_tree::ptree::value_type &v, sms_array) - { - boost::property_tree::ptree p = v.second; - SOptReplyQueue stCtrlInfo ; - stCtrlInfo.strCtrlActName = p.get("strCtrlActName"); - stCtrlInfo.nCtrlActType = p.get("nCtrlActType"); - stCtrlInfo.dTargetValue = p.get("fTargetValue"); - stCtrlInfo.bCtrlAllow = p.get("bCtrlAllow"); - stCtrlInfo.strOffsetNo = p.get("strOffsetNo"); - stOptCtrlReply.vecReplyQueue.push_back(stCtrlInfo); - } - return true; - } - catch(boost::property_tree::ptree_error &pt_error) + rapidjson::Document doc; + if( doc.Parse(s.c_str()).HasParseError() ) { - LOGERROR("COptCtrlReply::parse ,error=%s!", pt_error.what()); + LOGERROR("COptCtrlReply::parse ,error=%d", doc.GetParseError()); return false; } + + if(!doc.IsObject()) + { + LOGERROR("COptCtrlReply::parse json is not object"); + return false; + } + + try + { + COptReplyHead::parse(doc,stOptCtrlReply.stHead); + stOptCtrlReply.vecReplyQueue.clear(); + const rapidjson::Value::ConstMemberIterator &iterCtrl = doc.FindMember(OPT_DOWN_INFO); + if(iterCtrl != doc.MemberEnd() && iterCtrl->value.IsArray()) + { + const rapidjson::Value& arrCtrlInfo = iterCtrl->value; + + int nInfoSize = arrCtrlInfo.Size(); + stOptCtrlReply.vecReplyQueue.reserve(nInfoSize); + for(int nIdx = 0; nIdx < nInfoSize; nIdx++) + { + const rapidjson::Value& ctrlInfo = arrCtrlInfo[nIdx]; + SOptReplyQueue stCtrlInfo ; + stCtrlInfo.strCtrlActName = RapidJsonHelper::getString(ctrlInfo,"strCtrlActName"); + stCtrlInfo.nCtrlActType = RapidJsonHelper::getInt(ctrlInfo,"nCtrlActType"); + stCtrlInfo.dTargetValue = RapidJsonHelper::getDouble(ctrlInfo,"fTargetValue"); + stCtrlInfo.bCtrlAllow = RapidJsonHelper::getBool(ctrlInfo,"bCtrlAllow"); + stCtrlInfo.strOffsetNo = RapidJsonHelper::getString(ctrlInfo,"strOffsetNo"); + stOptCtrlReply.vecReplyQueue.push_back(stCtrlInfo); + } + } + + } + catch(const std::exception& ex) + { + LOGERROR("COptCtrlReply::parse ,error=%s!", ex.what()); + return false; + } + return true; } @@ -576,38 +721,38 @@ bool COptCtrlReply::parse(const std::string& s, SOptCtrlReply& stOptCtrlReply) */ string COptTagSet::generate(const SOptTagSet& stOptTagSet) { - try - { - boost::property_tree::ptree pt_root; - boost::property_tree::ptree children; - boost::property_tree::ptree child; + rapidjson::StringBuffer s; + rapidjson::Writer writer(s); - m_objHead.generate(stOptTagSet.stHead,pt_root); - for(size_t i = 0; i < stOptTagSet.vecTagQueue.size(); i++) - { - SOptTagQueue stCtrlInfo = stOptTagSet.vecTagQueue.at(i); - child.put("strKeyIdTag", stCtrlInfo.strKeyIdTag); - child.put("nIsSet", stCtrlInfo.nIsSet); - child.put("fSetValue", stCtrlInfo.fSetValue); - child.put("strStateText", stCtrlInfo.strStateText); - child.put("bIsPointQuery", stCtrlInfo.bIsPointQuery); - child.put("nLocationId", stCtrlInfo.nLocationId); - child.put("nSubSystem", stCtrlInfo.nSubSystem); - children.push_back(std::make_pair("", child)); - } - pt_root.add_child(OPT_DOWN_INFO, children); + writer.StartObject(); //< 起始 + COptReqHead::generate(writer,stOptTagSet.stHead); - std::stringstream ss; - boost::property_tree::write_json(ss, pt_root); - std::string s = ss.str(); - return s; - } - catch(boost::property_tree::ptree_error &pt_error) + writer.Key(OPT_DOWN_INFO); + writer.StartArray(); + for(size_t i = 0; i < stOptTagSet.vecTagQueue.size(); i++) { - LOGERROR("COptTagSet::generate ,error=%s!", pt_error.what()); - return "" ; + const SOptTagQueue &stCtrlInfo = stOptTagSet.vecTagQueue.at(i); + writer.StartObject(); + writer.Key("strKeyIdTag"); + writer.String(stCtrlInfo.strKeyIdTag.c_str()); + writer.Key("nIsSet"); + writer.Int(stCtrlInfo.nIsSet); + writer.Key("fSetValue"); + writer.Double(stCtrlInfo.fSetValue); + writer.Key("strStateText"); + writer.String(stCtrlInfo.strStateText.c_str()); + writer.Key("bIsPointQuery"); + writer.Bool(stCtrlInfo.bIsPointQuery); + writer.Key("nLocationId"); + writer.Int(stCtrlInfo.nLocationId); + writer.Key("nSubSystem"); + writer.Int(stCtrlInfo.nSubSystem); + writer.EndObject(); } - return "" ; + writer.EndArray(); + + writer.EndObject(); //< 结束 + return s.GetString(); } /** @@ -619,121 +764,152 @@ string COptTagSet::generate(const SOptTagSet& stOptTagSet) */ bool COptTagSet::parse(const std::string& s, SOptTagSet& stOptTagSet) { - try + rapidjson::Document doc; + if( doc.Parse(s.c_str()).HasParseError() ) { - std::istringstream iss; - iss.str(s.c_str()); - boost::property_tree::ptree parser; - boost::property_tree::json_parser::read_json(iss, parser); - - m_objHead.parse(parser,stOptTagSet.stHead); - stOptTagSet.vecTagQueue.clear(); - boost::property_tree::ptree sms_array = parser.get_child(OPT_DOWN_INFO); - BOOST_FOREACH(boost::property_tree::ptree::value_type &v, sms_array) - { - boost::property_tree::ptree p = v.second; - SOptTagQueue stCtrlInfo ; - stCtrlInfo.strKeyIdTag = p.get("strKeyIdTag"); - stCtrlInfo.nIsSet = p.get("nIsSet"); - stCtrlInfo.fSetValue = p.get("fSetValue",0.0); - stCtrlInfo.strStateText = p.get("strStateText",""); - stCtrlInfo.bIsPointQuery = p.get("bIsPointQuery",false); - stCtrlInfo.nLocationId = p.get("nLocationId"); - stCtrlInfo.nSubSystem = p.get("nSubSystem"); - stOptTagSet.vecTagQueue.push_back(stCtrlInfo); - } - return true; - } - catch(boost::property_tree::ptree_error &pt_error) - { - LOGERROR("COptTagSet::parse ,error=%s!", pt_error.what()); + LOGERROR("COptTagSet::parse ,error=%d", doc.GetParseError()); return false; } + + if(!doc.IsObject()) + { + LOGERROR("COptTagSet::parse json is not object"); + return false; + } + + try + { + COptReqHead::parse(doc,stOptTagSet.stHead); + stOptTagSet.vecTagQueue.clear(); + const rapidjson::Value::ConstMemberIterator &iterCtrl = doc.FindMember(OPT_DOWN_INFO); + if(iterCtrl != doc.MemberEnd() && iterCtrl->value.IsArray()) + { + const rapidjson::Value& arrCtrlInfo = iterCtrl->value; + + int nInfoSize = arrCtrlInfo.Size(); + stOptTagSet.vecTagQueue.reserve(nInfoSize); + for(int nIdx = 0; nIdx < nInfoSize; nIdx++) + { + const rapidjson::Value& ctrlInfo = arrCtrlInfo[nIdx]; + SOptTagQueue stCtrlInfo ; + stCtrlInfo.strKeyIdTag = RapidJsonHelper::getString(ctrlInfo,"strKeyIdTag"); + stCtrlInfo.nIsSet = RapidJsonHelper::getInt(ctrlInfo,"nIsSet"); + stCtrlInfo.fSetValue = RapidJsonHelper::getDouble(ctrlInfo,"fSetValue",0.0); + stCtrlInfo.strStateText = RapidJsonHelper::getString(ctrlInfo,"strStateText",""); + stCtrlInfo.bIsPointQuery = RapidJsonHelper::getBool(ctrlInfo,"bIsPointQuery",false); + stCtrlInfo.nLocationId = RapidJsonHelper::getInt(ctrlInfo,"nLocationId"); + stCtrlInfo.nSubSystem = RapidJsonHelper::getInt(ctrlInfo,"nSubSystem"); + stOptTagSet.vecTagQueue.push_back(stCtrlInfo); + } + } + + } + catch(const std::exception& ex) + { + LOGERROR("COptTagSet::parse ,error=%s!", ex.what()); + return false; + } + return true; } //屏蔽设置 HMI->operate_server 无反馈 //======================================================================================== - std::string COptShieldSet::generate(const SOptShieldSet& stOptShieldSet) { - try - { - boost::property_tree::ptree pt_root; - boost::property_tree::ptree children; - boost::property_tree::ptree child; + rapidjson::StringBuffer s; + rapidjson::Writer writer(s); - m_objHead.generate(stOptShieldSet.stHead,pt_root); - for(size_t i = 0; i < stOptShieldSet.vecTagQueue.size(); i++) - { - SOptShieldQueue stCtrlInfo = stOptShieldSet.vecTagQueue.at(i); - child.put("nShieldId", stCtrlInfo.nShieldId); - child.put("nIsSet", stCtrlInfo.nIsSet); - child.put("nShieldMode", stCtrlInfo.nShieldMode); - child.put("nLocationId", stCtrlInfo.nLocationId); - child.put("nSubSystem", stCtrlInfo.nSubSystem); - child.put("nRegionId", stCtrlInfo.nRegionId); - child.put("nVolLevel", stCtrlInfo.nVolLevel); - child.put("strDeviceTag", stCtrlInfo.strDeviceTag); - child.put("strDeviceGrp", stCtrlInfo.strDeviceGrp); - child.put("strStateText", stCtrlInfo.strStateText); - children.push_back(std::make_pair("", child)); - } - pt_root.add_child(OPT_DOWN_INFO, children); + writer.StartObject(); //< 起始 + COptReqHead::generate(writer,stOptShieldSet.stHead); - std::stringstream ss; - boost::property_tree::write_json(ss, pt_root); - std::string s = ss.str(); - return s; - } - catch(boost::property_tree::ptree_error &pt_error) + writer.Key(OPT_DOWN_INFO); + writer.StartArray(); + for(size_t i = 0; i < stOptShieldSet.vecTagQueue.size(); i++) { - LOGERROR("COptShieldSet::generate ,error=%s!", pt_error.what()); - return "" ; + const SOptShieldQueue &stCtrlInfo = stOptShieldSet.vecTagQueue.at(i); + writer.StartObject(); + writer.Key("nShieldId"); + writer.Int(stCtrlInfo.nShieldId); + writer.Key("nIsSet"); + writer.Int(stCtrlInfo.nIsSet); + writer.Key("nShieldMode"); + writer.Int(stCtrlInfo.nShieldMode); + writer.Key("nLocationId"); + writer.Int(stCtrlInfo.nLocationId); + writer.Key("nSubSystem"); + writer.Int(stCtrlInfo.nSubSystem); + writer.Key("nRegionId"); + writer.Int(stCtrlInfo.nRegionId); + writer.Key("nVolLevel"); + writer.Int(stCtrlInfo.nVolLevel); + writer.Key("strDeviceTag"); + writer.String(stCtrlInfo.strDeviceTag.c_str()); + writer.Key("strDeviceGrp"); + writer.String(stCtrlInfo.strDeviceGrp.c_str()); + writer.Key("strStateText"); + writer.String(stCtrlInfo.strStateText.c_str()); + writer.EndObject(); } - return "" ; + writer.EndArray(); + + writer.EndObject(); //< 结束 + return s.GetString(); } bool COptShieldSet::parse(const std::string& s, SOptShieldSet& stOptShieldSet) { - try + rapidjson::Document doc; + if( doc.Parse(s.c_str()).HasParseError() ) { - std::istringstream iss; - iss.str(s.c_str()); - boost::property_tree::ptree parser; - boost::property_tree::json_parser::read_json(iss, parser); - - m_objHead.parse(parser,stOptShieldSet.stHead); - stOptShieldSet.vecTagQueue.clear(); - boost::property_tree::ptree sms_array = parser.get_child(OPT_DOWN_INFO); - BOOST_FOREACH(boost::property_tree::ptree::value_type &v, sms_array) - { - boost::property_tree::ptree p = v.second; - SOptShieldQueue stCtrlInfo ; - stCtrlInfo.nShieldId = p.get("nShieldId"); - stCtrlInfo.nIsSet = p.get("nIsSet"); - stCtrlInfo.nShieldMode = p.get("nShieldMode"); - stCtrlInfo.nLocationId = p.get("nLocationId"); - stCtrlInfo.nSubSystem = p.get("nSubSystem"); - stCtrlInfo.nRegionId = p.get("nRegionId",-1); - stCtrlInfo.nVolLevel = p.get("nVolLevel",-1); - stCtrlInfo.strDeviceTag = p.get("strDeviceTag",""); - stCtrlInfo.strDeviceGrp = p.get("strDeviceGrp",""); - stCtrlInfo.strStateText = p.get("strStateText",""); - stOptShieldSet.vecTagQueue.push_back(stCtrlInfo); - } - return true; - } - catch(boost::property_tree::ptree_error &pt_error) - { - LOGERROR("COptShieldSet::parse ,error=%s!", pt_error.what()); + LOGERROR("COptShieldSet::parse ,error=%d", doc.GetParseError()); return false; } + + if(!doc.IsObject()) + { + LOGERROR("COptShieldSet::parse json is not object"); + return false; + } + + try + { + COptReqHead::parse(doc,stOptShieldSet.stHead); + stOptShieldSet.vecTagQueue.clear(); + const rapidjson::Value::ConstMemberIterator &iterCtrl = doc.FindMember(OPT_DOWN_INFO); + if(iterCtrl != doc.MemberEnd() && iterCtrl->value.IsArray()) + { + const rapidjson::Value& arrCtrlInfo = iterCtrl->value; + + int nInfoSize = arrCtrlInfo.Size(); + stOptShieldSet.vecTagQueue.reserve(nInfoSize); + for(int nIdx = 0; nIdx < nInfoSize; nIdx++) + { + const rapidjson::Value& ctrlInfo = arrCtrlInfo[nIdx]; + SOptShieldQueue stCtrlInfo ; + stCtrlInfo.nShieldId = RapidJsonHelper::getInt(ctrlInfo,"nShieldId"); + stCtrlInfo.nIsSet = RapidJsonHelper::getInt(ctrlInfo,"nIsSet"); + stCtrlInfo.nShieldMode = RapidJsonHelper::getInt(ctrlInfo,"nShieldMode"); + stCtrlInfo.nLocationId = RapidJsonHelper::getInt(ctrlInfo,"nLocationId"); + stCtrlInfo.nSubSystem = RapidJsonHelper::getInt(ctrlInfo,"nSubSystem"); + stCtrlInfo.nRegionId = RapidJsonHelper::getInt(ctrlInfo,"nRegionId",-1); + stCtrlInfo.nVolLevel = RapidJsonHelper::getInt(ctrlInfo,"nVolLevel",-1); + stCtrlInfo.strDeviceTag = RapidJsonHelper::getString(ctrlInfo,"strDeviceTag",""); + stCtrlInfo.strDeviceGrp = RapidJsonHelper::getString(ctrlInfo,"strDeviceGrp",""); + stCtrlInfo.strStateText = RapidJsonHelper::getString(ctrlInfo,"strStateText",""); + stOptShieldSet.vecTagQueue.push_back(stCtrlInfo); + } + } + } + catch(const std::exception& ex) + { + LOGERROR("COptShieldSet::parse ,error=%s!", ex.what()); + return false; + } + return true; } - - //挂牌设置 HMI->operate_server 无回复 //======================================================================================== /** @@ -744,40 +920,42 @@ bool COptShieldSet::parse(const std::string& s, SOptShieldSet& stOptShieldSet) */ string CTokenSet::generate(const STokenSet& stTokenSet) { - try - { - boost::property_tree::ptree pt_root; - boost::property_tree::ptree children; - boost::property_tree::ptree child; + rapidjson::StringBuffer s; + rapidjson::Writer writer(s); - m_objHead.generate(stTokenSet.stHead,pt_root); - for(size_t i = 0; i < stTokenSet.vecTokenQueue.size(); i++) - { - STokenQueue stCtrlInfo = stTokenSet.vecTokenQueue.at(i); - child.put("strKeyIdTag", stCtrlInfo.strKeyIdTag); - child.put("nTokenId", stCtrlInfo.nTokenId); - child.put("nTokenPosX", stCtrlInfo.nTokenPosX); - child.put("nTokenPosY", stCtrlInfo.nTokenPosY); - child.put("nIsDisplay", stCtrlInfo.nIsDisplay); - child.put("strNote", stCtrlInfo.strNote); - child.put("nLocationId", stCtrlInfo.nLocationId); - child.put("nSubSystem", stCtrlInfo.nSubSystem); - children.push_back(std::make_pair("", child)); - } - pt_root.add_child(OPT_DOWN_INFO, children); + writer.StartObject(); //< 起始 + COptReqHead::generate(writer,stTokenSet.stHead); - std::stringstream ss; - boost::property_tree::write_json(ss, pt_root); - std::string s = ss.str(); - return s; - } - catch(boost::property_tree::ptree_error &pt_error) + writer.Key(OPT_DOWN_INFO); + writer.StartArray(); + for(size_t i = 0; i < stTokenSet.vecTokenQueue.size(); i++) { - LOGERROR("CTokenSet::generate ,error=%s!", pt_error.what()); - return "" ; + const STokenQueue &stCtrlInfo = stTokenSet.vecTokenQueue.at(i); + writer.StartObject(); + writer.Key("strKeyIdTag"); + writer.String(stCtrlInfo.strKeyIdTag.c_str()); + writer.Key("nTokenId"); + writer.Int(stCtrlInfo.nTokenId); + writer.Key("nTokenPosX"); + writer.Int(stCtrlInfo.nTokenPosX); + writer.Key("nTokenPosY"); + writer.Int(stCtrlInfo.nTokenPosY); + writer.Key("nIsDisplay"); + writer.Int(stCtrlInfo.nIsDisplay); + writer.Key("strNote"); + writer.String(stCtrlInfo.strNote.c_str()); + writer.Key("nLocationId"); + writer.Int(stCtrlInfo.nLocationId); + writer.Key("nSubSystem"); + writer.Int(stCtrlInfo.nSubSystem); + writer.EndObject(); } - return "" ; + writer.EndArray(); + + writer.EndObject(); //< 结束 + return s.GetString(); } + /** @brief 解码挂牌命令消息(JSON字符串)到结构体 @param in std::string& s: 需要解码JSON 字符串 @@ -787,37 +965,52 @@ string CTokenSet::generate(const STokenSet& stTokenSet) */ bool CTokenSet::parse(const std::string& s, STokenSet& stTokenSet) { - try + rapidjson::Document doc; + if( doc.Parse(s.c_str()).HasParseError() ) { - std::istringstream iss; - iss.str(s.c_str()); - boost::property_tree::ptree parser; - boost::property_tree::json_parser::read_json(iss, parser); - - m_objHead.parse(parser,stTokenSet.stHead); - stTokenSet.vecTokenQueue.clear(); - boost::property_tree::ptree sms_array = parser.get_child(OPT_DOWN_INFO); - BOOST_FOREACH(boost::property_tree::ptree::value_type &v, sms_array) - { - boost::property_tree::ptree p = v.second; - STokenQueue stCtrlInfo ; - stCtrlInfo.strKeyIdTag = p.get("strKeyIdTag"); - stCtrlInfo.nTokenId = p.get("nTokenId"); - stCtrlInfo.nTokenPosX = p.get("nTokenPosX",0); - stCtrlInfo.nTokenPosY = p.get("nTokenPosY",0); - stCtrlInfo.nIsDisplay = p.get("nIsDisplay",0); - stCtrlInfo.strNote = p.get("strNote",""); - stCtrlInfo.nLocationId = p.get("nLocationId"); - stCtrlInfo.nSubSystem = p.get("nSubSystem"); - stTokenSet.vecTokenQueue.push_back(stCtrlInfo); - } - return true; - } - catch(boost::property_tree::ptree_error &pt_error) - { - LOGERROR("CTokenSet::parse ,error=%s!", pt_error.what()); + LOGERROR("CTokenSet::parse ,error=%d", doc.GetParseError()); return false; } + + if(!doc.IsObject()) + { + LOGERROR("CTokenSet::parse json is not object"); + return false; + } + + try + { + COptReqHead::parse(doc,stTokenSet.stHead); + stTokenSet.vecTokenQueue.clear(); + const rapidjson::Value::ConstMemberIterator &iterCtrl = doc.FindMember(OPT_DOWN_INFO); + if(iterCtrl != doc.MemberEnd() && iterCtrl->value.IsArray()) + { + const rapidjson::Value& arrCtrlInfo = iterCtrl->value; + + int nInfoSize = arrCtrlInfo.Size(); + stTokenSet.vecTokenQueue.reserve(nInfoSize); + for(int nIdx = 0; nIdx < nInfoSize; nIdx++) + { + const rapidjson::Value& ctrlInfo = arrCtrlInfo[nIdx]; + STokenQueue stCtrlInfo ; + stCtrlInfo.strKeyIdTag = RapidJsonHelper::getString(ctrlInfo,"strKeyIdTag"); + stCtrlInfo.nTokenId = RapidJsonHelper::getInt(ctrlInfo,"nTokenId"); + stCtrlInfo.nTokenPosX = RapidJsonHelper::getInt(ctrlInfo,"nTokenPosX",0); + stCtrlInfo.nTokenPosY = RapidJsonHelper::getInt(ctrlInfo,"nTokenPosY",0); + stCtrlInfo.nIsDisplay = RapidJsonHelper::getInt(ctrlInfo,"nIsDisplay",0); + stCtrlInfo.strNote = RapidJsonHelper::getString(ctrlInfo,"strNote",""); + stCtrlInfo.nLocationId = RapidJsonHelper::getInt(ctrlInfo,"nLocationId"); + stCtrlInfo.nSubSystem = RapidJsonHelper::getInt(ctrlInfo,"nSubSystem"); + stTokenSet.vecTokenQueue.push_back(stCtrlInfo); + } + } + } + catch(const std::exception& ex) + { + LOGERROR("CTokenSet::parse ,error=%s!", ex.what()); + return false; + } + return true; } @@ -831,34 +1024,30 @@ bool CTokenSet::parse(const std::string& s, STokenSet& stTokenSet) */ string CAiLimitSet::generate(const SAiLimitSet& stAiLimitSet) { - try - { - boost::property_tree::ptree pt_root; - boost::property_tree::ptree children; - boost::property_tree::ptree child; + rapidjson::StringBuffer s; + rapidjson::Writer writer(s); - m_objHead.generate(stAiLimitSet.stHead,pt_root); - for(size_t i = 0; i < stAiLimitSet.vecAiLimitQueue.size(); i++) - { - SAiLimitQueue stCtrlInfo = stAiLimitSet.vecAiLimitQueue.at(i); - child.put("strKeyIdTag", stCtrlInfo.strKeyIdTag); - child.put("fValue", stCtrlInfo.fValue); - children.push_back(std::make_pair("", child)); - } - pt_root.add_child(OPT_DOWN_INFO, children); + writer.StartObject(); //< 起始 + COptReqHead::generate(writer,stAiLimitSet.stHead); - std::stringstream ss; - boost::property_tree::write_json(ss, pt_root); - std::string s = ss.str(); - return s; - } - catch(boost::property_tree::ptree_error &pt_error) + writer.Key(OPT_DOWN_INFO); + writer.StartArray(); + for(size_t i = 0; i < stAiLimitSet.vecAiLimitQueue.size(); i++) { - LOGERROR("CAiLimitSet::generate ,error=%s!", pt_error.what()); - return ""; + const SAiLimitQueue &stCtrlInfo = stAiLimitSet.vecAiLimitQueue.at(i); + writer.StartObject(); + writer.Key("strKeyIdTag"); + writer.String(stCtrlInfo.strKeyIdTag.c_str()); + writer.Key("fValue"); + writer.Double(stCtrlInfo.fValue); + writer.EndObject(); } - return ""; + writer.EndArray(); + + writer.EndObject(); //< 结束 + return s.GetString(); } + /** @brief 解码遥测限值设置命令消息(JSON字符串)到结构体 @param in std::string& s: 需要解码JSON 字符串 @@ -868,31 +1057,47 @@ string CAiLimitSet::generate(const SAiLimitSet& stAiLimitSet) */ bool CAiLimitSet::parse(const std::string& s, SAiLimitSet& stAiLimitSet) { - try + rapidjson::Document doc; + if( doc.Parse(s.c_str()).HasParseError() ) { - std::istringstream iss; - iss.str(s.c_str()); - boost::property_tree::ptree parser; - boost::property_tree::json_parser::read_json(iss, parser); - - m_objHead.parse(parser,stAiLimitSet.stHead); - stAiLimitSet.vecAiLimitQueue.clear(); - boost::property_tree::ptree sms_array = parser.get_child(OPT_DOWN_INFO); - BOOST_FOREACH(boost::property_tree::ptree::value_type &v, sms_array) - { - boost::property_tree::ptree p = v.second; - SAiLimitQueue stCtrlInfo ; - stCtrlInfo.strKeyIdTag = p.get("strKeyIdTag"); - stCtrlInfo.fValue = p.get("fValue"); - stAiLimitSet.vecAiLimitQueue.push_back(stCtrlInfo); - } - return true; - } - catch(boost::property_tree::ptree_error &pt_error) - { - LOGERROR("CAiLimitSet::parse ,error=%s!", pt_error.what()); + LOGERROR("CAiLimitSet::parse ,error=%d", doc.GetParseError()); return false; } + + if(!doc.IsObject()) + { + LOGERROR("CAiLimitSet::parse json is not object"); + return false; + } + + try + { + COptReqHead::parse(doc,stAiLimitSet.stHead); + stAiLimitSet.vecAiLimitQueue.clear(); + const rapidjson::Value::ConstMemberIterator &iterCtrl = doc.FindMember(OPT_DOWN_INFO); + if(iterCtrl != doc.MemberEnd() && iterCtrl->value.IsArray()) + { + const rapidjson::Value& arrCtrlInfo = iterCtrl->value; + + int nInfoSize = arrCtrlInfo.Size(); + stAiLimitSet.vecAiLimitQueue.reserve(nInfoSize); + for(int nIdx = 0; nIdx < nInfoSize; nIdx++) + { + const rapidjson::Value& ctrlInfo = arrCtrlInfo[nIdx]; + + SAiLimitQueue stCtrlInfo ; + stCtrlInfo.strKeyIdTag = RapidJsonHelper::getString(ctrlInfo,"strKeyIdTag"); + stCtrlInfo.fValue = RapidJsonHelper::getFloat(ctrlInfo,"fValue"); + stAiLimitSet.vecAiLimitQueue.push_back(stCtrlInfo); + } + } + } + catch(const std::exception& ex) + { + LOGERROR("CAiLimitSet::parse ,error=%s!", ex.what()); + return false; + } + return true; } @@ -906,34 +1111,30 @@ bool CAiLimitSet::parse(const std::string& s, SAiLimitSet& stAiLimitSet) */ string CHandoverRequest::generate(const SHandoverRequest& stHandoverRequest) { - try - { - boost::property_tree::ptree pt_root; - boost::property_tree::ptree children; - boost::property_tree::ptree child; + rapidjson::StringBuffer s; + rapidjson::Writer writer(s); - m_objHead.generate(stHandoverRequest.stHead,pt_root); - for(size_t i = 0; i < stHandoverRequest.vecHandoverQueue.size(); i++) - { - SHandoverQueue stCtrlInfo = stHandoverRequest.vecHandoverQueue.at(i); - child.put("strKeyIdTag", stCtrlInfo.strKeyIdTag); - child.put("nOptType", stCtrlInfo.nOptType); - children.push_back(std::make_pair("", child)); - } - pt_root.add_child(OPT_DOWN_INFO, children); + writer.StartObject(); //< 起始 + COptReqHead::generate(writer,stHandoverRequest.stHead); - std::stringstream ss; - boost::property_tree::write_json(ss, pt_root); - std::string s = ss.str(); - return s; - } - catch(boost::property_tree::ptree_error &pt_error) + writer.Key(OPT_DOWN_INFO); + writer.StartArray(); + for(size_t i = 0; i < stHandoverRequest.vecHandoverQueue.size(); i++) { - LOGERROR("CHandoverRequest::generate ,error=%s!", pt_error.what()); - return ""; + const SHandoverQueue &stCtrlInfo = stHandoverRequest.vecHandoverQueue.at(i); + writer.StartObject(); + writer.Key("strKeyIdTag"); + writer.String(stCtrlInfo.strKeyIdTag.c_str()); + writer.Key("nOptType"); + writer.Int(stCtrlInfo.nOptType); + writer.EndObject(); } - return ""; + writer.EndArray(); + + writer.EndObject(); //< 结束 + return s.GetString(); } + /** @brief 解码权限转移请求消息(JSON字符串)到结构体 @param in std::string& s: 需要解码JSON 字符串 @@ -943,35 +1144,49 @@ string CHandoverRequest::generate(const SHandoverRequest& stHandoverRequest) */ bool CHandoverRequest::parse(const std::string& s, SHandoverRequest& stHandoverRequest) { - try + rapidjson::Document doc; + if( doc.Parse(s.c_str()).HasParseError() ) { - std::istringstream iss; - iss.str(s.c_str()); - boost::property_tree::ptree parser; - boost::property_tree::json_parser::read_json(iss, parser); - - m_objHead.parse(parser,stHandoverRequest.stHead); - stHandoverRequest.vecHandoverQueue.clear(); - boost::property_tree::ptree sms_array = parser.get_child(OPT_DOWN_INFO); - BOOST_FOREACH(boost::property_tree::ptree::value_type &v, sms_array) - { - boost::property_tree::ptree p = v.second; - SHandoverQueue stCtrlInfo ; - stCtrlInfo.strKeyIdTag = p.get("strKeyIdTag"); - stCtrlInfo.nOptType = p.get("nOptType"); - stHandoverRequest.vecHandoverQueue.push_back(stCtrlInfo); - } - return true; - } - catch(boost::property_tree::ptree_error &pt_error) - { - LOGERROR("CHandoverRequest::parse ,error=%s!", pt_error.what()); + LOGERROR("CHandoverRequest::parse ,error=%d", doc.GetParseError()); return false; } + + if(!doc.IsObject()) + { + LOGERROR("CHandoverRequest::parse json is not object"); + return false; + } + + try + { + COptReqHead::parse(doc,stHandoverRequest.stHead); + stHandoverRequest.vecHandoverQueue.clear(); + const rapidjson::Value::ConstMemberIterator &iterCtrl = doc.FindMember(OPT_DOWN_INFO); + if(iterCtrl != doc.MemberEnd() && iterCtrl->value.IsArray()) + { + const rapidjson::Value& arrCtrlInfo = iterCtrl->value; + + int nInfoSize = arrCtrlInfo.Size(); + stHandoverRequest.vecHandoverQueue.reserve(nInfoSize); + for(int nIdx = 0; nIdx < nInfoSize; nIdx++) + { + const rapidjson::Value& ctrlInfo = arrCtrlInfo[nIdx]; + SHandoverQueue stCtrlInfo ; + stCtrlInfo.strKeyIdTag = RapidJsonHelper::getString(ctrlInfo,"strKeyIdTag"); + stCtrlInfo.nOptType = RapidJsonHelper::getInt(ctrlInfo,"nOptType"); + stHandoverRequest.vecHandoverQueue.push_back(stCtrlInfo); + } + } + } + catch(const std::exception& ex) + { + LOGERROR("CHandoverRequest::parse ,error=%s!", ex.what()); + return false; + } + return true; } - //权限转移回复 operate_server->hmi //======================================================================================== /** @@ -982,34 +1197,28 @@ bool CHandoverRequest::parse(const std::string& s, SHandoverRequest& stHandoverR */ string CHandoverReply::generate(const SHandoverReply& stHandoverReply) { - try + rapidjson::StringBuffer s; + rapidjson::Writer writer(s); + + writer.StartObject(); //< 起始 + COptReplyHead::generate(writer,stHandoverReply.stHead); + writer.Key("bHandoverReply"); + writer.Bool(stHandoverReply.bHandoverReply); + + writer.Key(OPT_DOWN_INFO); + writer.StartArray(); + for(size_t i = 0; i < stHandoverReply.vecLocation.size(); i++) { - boost::property_tree::ptree pt_root; - boost::property_tree::ptree children; - boost::property_tree::ptree child; - - m_objHead.generate(stHandoverReply.stHead,pt_root); - pt_root.put("bHandoverReply" ,stHandoverReply.bHandoverReply); - - for(size_t i = 0; i < stHandoverReply.vecLocation.size(); i++) - { - int nLocation = stHandoverReply.vecLocation.at(i); - child.put("nLocation", nLocation); - children.push_back(std::make_pair("", child)); - } - pt_root.add_child(OPT_DOWN_INFO, children); - - std::stringstream ss; - boost::property_tree::write_json(ss, pt_root); - std::string s = ss.str(); - return s; + int nLocation = stHandoverReply.vecLocation.at(i); + writer.StartObject(); + writer.Key("nLocation"); + writer.Int(nLocation); + writer.EndObject(); } - catch(boost::property_tree::ptree_error &pt_error) - { - LOGERROR("CHandoverReply::generate ,error=%s!", pt_error.what()); - return ""; - } - return "" ; + writer.EndArray(); + + writer.EndObject(); //< 结束 + return s.GetString(); } /** @@ -1021,32 +1230,45 @@ string CHandoverReply::generate(const SHandoverReply& stHandoverReply) */ bool CHandoverReply::parse(const std::string& s, SHandoverReply& stHandoverReply) { - try + rapidjson::Document doc; + if( doc.Parse(s.c_str()).HasParseError() ) { - std::istringstream iss; - iss.str(s.c_str()); - boost::property_tree::ptree parser; - boost::property_tree::json_parser::read_json(iss, parser); - - m_objHead.parse(parser,stHandoverReply.stHead); - stHandoverReply.bHandoverReply = parser.get("bHandoverReply"); - - stHandoverReply.vecLocation.clear(); - boost::property_tree::ptree sms_array = parser.get_child(OPT_DOWN_INFO); - BOOST_FOREACH(boost::property_tree::ptree::value_type &v, sms_array) - { - boost::property_tree::ptree p = v.second; - int nLocation = p.get("nLocation");; - stHandoverReply.vecLocation.push_back(nLocation); - } - return true; - } - catch(boost::property_tree::ptree_error &pt_error) - { - LOGERROR("CHandoverReply::parse ,error=%s!", pt_error.what()); + LOGERROR("CHandoverReply::parse ,error=%d", doc.GetParseError()); return false; } + + if(!doc.IsObject()) + { + LOGERROR("CHandoverReply::parse json is not object"); + return false; + } + + try + { + COptReplyHead::parse(doc,stHandoverReply.stHead); + stHandoverReply.bHandoverReply = RapidJsonHelper::getBool(doc,"bHandoverReply"); + + stHandoverReply.vecLocation.clear(); + const rapidjson::Value::ConstMemberIterator &iterCtrl = doc.FindMember(OPT_DOWN_INFO); + if(iterCtrl != doc.MemberEnd() && iterCtrl->value.IsArray()) + { + const rapidjson::Value& arrCtrlInfo = iterCtrl->value; + + int nInfoSize = arrCtrlInfo.Size(); + stHandoverReply.vecLocation.reserve(nInfoSize); + for(int nIdx = 0; nIdx < nInfoSize; nIdx++) + { + const rapidjson::Value& ctrlInfo = arrCtrlInfo[nIdx]; + int nLocation = RapidJsonHelper::getInt(ctrlInfo,"nLocation");; + stHandoverReply.vecLocation.push_back(nLocation); + } + } + } + catch(const std::exception& ex) + { + LOGERROR("CHandoverReply::parse ,error=%s!", ex.what()); + return false; + } + return true; } - - diff --git a/platform/src/include/service/operate_server_api/JsonOptCommand.h b/platform/src/include/service/operate_server_api/JsonOptCommand.h index 0b6530b8..3cea4d6f 100644 --- a/platform/src/include/service/operate_server_api/JsonOptCommand.h +++ b/platform/src/include/service/operate_server_api/JsonOptCommand.h @@ -4,93 +4,65 @@ @author 周正龙 */ #pragma once - -#include -#include -#include #include "JsonMessageStruct.h" -#include -#include -#include -#include -#include - -//控制请求结构头 hmi->operate_server -//======================================================================================== -class COptReqHead -{ -public: - COptReqHead(); -public: - bool generate(const SOptReqHead& stHead,boost::property_tree::ptree &pt_root ); - bool parse (const boost::property_tree::ptree parser, SOptReqHead& stHead); -}; - -//控制请求回复结构头 operate_server->hmi -//======================================================================================== -class COptReplyHead -{ -public: - COptReplyHead(); -public: - bool generate(const SOptReplyHead& stHead,boost::property_tree::ptree &pt_root ); - bool parse (const boost::property_tree::ptree parser, SOptReplyHead& stHead); -}; - //包含[控制请求,设备占用,选择,执行,选择取消,直控](DO/MO/AO) operate_server->HMI/linkage_server/sequence_server //======================================================================================== class COptCtrlRequest { -private: - COptReqHead m_objHead; public: - std::string generate(const SOptCtrlRequest& stCtrlRequest); - bool parse(const std::string& s, SOptCtrlRequest& stCtrlRequest); + static std::string generate(const SOptCtrlRequest& stCtrlRequest); + static bool parse(const std::string& s, SOptCtrlRequest& stCtrlRequest); + COptCtrlRequest() = delete; + +//private: + //< 控制服务中还未添加支持,故不开放 + static std::string generate(const std::vector &vecCtrlReq); + static bool parse(const std::string &s,std::vector &vecCtrlReq); }; //控制请求,选择,执行,取消返回(DO/MO/AO) HMI/linkage_server/sequence_server->operate_server //======================================================================================== class COptCtrlReply { -private: - COptReplyHead m_objHead; public: - std::string generate(const SOptCtrlReply& stOptCtrlReply); - bool parse(const std::string& s, SOptCtrlReply& stOptCtrlReply); + static std::string generate(const SOptCtrlReply& stOptCtrlReply); + static bool parse(const std::string& s, SOptCtrlReply& stOptCtrlReply); + + COptCtrlReply() = delete; }; //自定义控制命令 operate_server->HMI //======================================================================================== class COptCustCtrlRequest { -private: - COptReqHead m_objHead; public: - std::string generate(const SOptCustCtrlRequest& stOptCustCtrlRequest); - bool parse(const std::string& s, SOptCustCtrlRequest& stOptCustCtrlRequest); + static std::string generate(const SOptCustCtrlRequest& stOptCustCtrlRequest); + static bool parse(const std::string& s, SOptCustCtrlRequest& stOptCustCtrlRequest); + + COptCustCtrlRequest() = delete; }; //自定义命令返回 //======================================================================================== class COptCustCtrlReply { -private: - COptReplyHead m_objHead; public: - std::string generate(const SOptCustCtrlReply& stOptCustCtrlReply); - bool parse(const std::string& s, SOptCustCtrlReply& stOptCustCtrlReply); + static std::string generate(const SOptCustCtrlReply& stOptCustCtrlReply); + static bool parse(const std::string& s, SOptCustCtrlReply& stOptCustCtrlReply); + + COptCustCtrlReply() = delete; }; //点标签设置 HMI->operate_server 无反馈 //======================================================================================== class COptTagSet { -private: - COptReqHead m_objHead; public: - std::string generate(const SOptTagSet& stOptTagSet); - bool parse(const std::string& s, SOptTagSet& stOptTagSet); + static std::string generate(const SOptTagSet& stOptTagSet); + static bool parse(const std::string& s, SOptTagSet& stOptTagSet); + + COptTagSet() = delete; }; @@ -98,55 +70,55 @@ public: //======================================================================================== class COptShieldSet { -private: - COptReqHead m_objHead; public: - std::string generate(const SOptShieldSet& stOptShieldSet); - bool parse(const std::string& s, SOptShieldSet& stOptShieldSet); + static std::string generate(const SOptShieldSet& stOptShieldSet); + static bool parse(const std::string& s, SOptShieldSet& stOptShieldSet); + + COptShieldSet() = delete; }; //挂牌设置 HMI->operate_server 无回复 //======================================================================================== class CTokenSet { -private: - COptReqHead m_objHead; public: - std::string generate(const STokenSet& stTokenSet); - bool parse(const std::string& s, STokenSet& stTokenSet); + static std::string generate(const STokenSet& stTokenSet); + static bool parse(const std::string& s, STokenSet& stTokenSet); + + CTokenSet() = delete; }; //限制设置 HMI->operate_server 无回复 //======================================================================================== class CAiLimitSet { -private: - COptReqHead m_objHead; public: - std::string generate(const SAiLimitSet& stAiLimitSet); - bool parse(const std::string& s, SAiLimitSet& stAiLimitSet); + static std::string generate(const SAiLimitSet& stAiLimitSet); + static bool parse(const std::string& s, SAiLimitSet& stAiLimitSet); + + CAiLimitSet() = delete; }; //权限转移请求 hmi->operate_server //======================================================================================== class CHandoverRequest { -private: - COptReqHead m_objHead; public: - std::string generate(const SHandoverRequest& stHandoverRequest); - bool parse(const std::string& s, SHandoverRequest& stHandoverRequest); + static std::string generate(const SHandoverRequest& stHandoverRequest); + static bool parse(const std::string& s, SHandoverRequest& stHandoverRequest); + + CHandoverRequest() = delete; }; //权限转移回复 operate_server->hmi //======================================================================================== class CHandoverReply { -private: - COptReplyHead m_objHead; public: - std::string generate(const SHandoverReply& stHandoverReply); - bool parse(const std::string& s, SHandoverReply& stHandoverReply); + static std::string generate(const SHandoverReply& stHandoverReply); + static bool parse(const std::string& s, SHandoverReply& stHandoverReply); + + CHandoverReply() = delete; }; diff --git a/platform/src/include/service/perm_mng_api/PermMngApi.h b/platform/src/include/service/perm_mng_api/PermMngApi.h index 0e75d046..301d46a9 100644 --- a/platform/src/include/service/perm_mng_api/PermMngApi.h +++ b/platform/src/include/service/perm_mng_api/PermMngApi.h @@ -294,6 +294,14 @@ public: */ virtual int getAllUsergID(std::vector &vecUsergID) = 0; + /** + @brief 由用户ID号得到允许持续时间 + @param [in/out] int & nPermId 用户名对应的用户ID号 + @param [in/out] int & nAllowDuration 用户名对应的允许持续时间 + @return =0 成功;PERM_NO_NAME 用户ID不存在; <0 出错 + \sa GetAllowDurationByUserId(const int &nPermId,int64 &nAllowDuration) + */ + virtual int GetAllowDurationByUserId(const int &nPermId,int &nAllowDuration)= 0; }; typedef boost::shared_ptr CPermMngApiPtr; diff --git a/platform/src/include/service/perm_mng_api/PermMngDefine.h b/platform/src/include/service/perm_mng_api/PermMngDefine.h index dbb70ff7..8ebd6a0e 100644 --- a/platform/src/include/service/perm_mng_api/PermMngDefine.h +++ b/platform/src/include/service/perm_mng_api/PermMngDefine.h @@ -377,6 +377,7 @@ struct SUserDef ////用户信息 char moblie_phone[32] = {0}; char email[64] = {0}; char address[128] = {0}; + int allow_duration = 0; }; struct SUsergDef ////用户组信息 diff --git a/platform/src/include/sys/sys_dog_auth_api/DogAuthInterface.h b/platform/src/include/sys/sys_dog_auth_api/DogAuthInterface.h index fa42bf3b..d97d252f 100644 --- a/platform/src/include/sys/sys_dog_auth_api/DogAuthInterface.h +++ b/platform/src/include/sys/sys_dog_auth_api/DogAuthInterface.h @@ -9,9 +9,6 @@ #include "boost/make_shared.hpp" #include "Export.h" -#define AUTH_STATUS_OK 1 //授权状态-成功 -#define AUTH_STATUS_EXPIRED 0 //授权状态-过期 -#define AUTH_STATUS_FAILD -1 //授权状态-失败 #ifdef SYS_DOG_AUTH_EXPORTS #define SYS_DOG_AUTH_API G_DECL_EXPORT diff --git a/platform/src/include/sys/sys_login_api/CLoginDlg.h b/platform/src/include/sys/sys_login_api/CLoginDlg.h index c10f0ff3..86169c67 100644 --- a/platform/src/include/sys/sys_login_api/CLoginDlg.h +++ b/platform/src/include/sys/sys_login_api/CLoginDlg.h @@ -1,10 +1,10 @@ #ifndef CLOGINDLG_H #define CLOGINDLG_H -#include #include "db_api_ex/CDbApi.h" #include "LoginExport.h" #include "Common.h" +#include "pub_widget/CustomDialog.h" namespace Ui { class CLoginDlg; @@ -48,7 +48,7 @@ struct ST_USER_INFO } }; -class LOGIN_API CLoginDlg : public QDialog +class LOGIN_API CLoginDlg : public CustomUiDialog { Q_OBJECT diff --git a/platform/src/include/sys/sys_proc_mng_api/ProcMngInterface.h b/platform/src/include/sys/sys_proc_mng_api/ProcMngInterface.h index 9428ff44..df1efa03 100644 --- a/platform/src/include/sys/sys_proc_mng_api/ProcMngInterface.h +++ b/platform/src/include/sys/sys_proc_mng_api/ProcMngInterface.h @@ -16,7 +16,7 @@ #define SYS_PROC_MNG_API G_DECL_IMPORT #endif -#define DOG_TIMEOUT 7200 //秒钟(2小时) +#define DOG_TIMEOUT 604800 //秒钟(7*24小时) namespace iot_sys { diff --git a/platform/src/include/tools/ScriptForm/ScriptForm.h b/platform/src/include/tools/ScriptForm/ScriptForm.h index c9012123..43f254a3 100644 --- a/platform/src/include/tools/ScriptForm/ScriptForm.h +++ b/platform/src/include/tools/ScriptForm/ScriptForm.h @@ -3,15 +3,19 @@ #include "ScriptForm_global.h" #include -#include +#include "pub_widget/CustomDialog.h" class QAction; class QToolBar; class QLabel; class QPushButton; -class ScriptEditor; class QListWidget; + +namespace ScriptForm_lua +{ + class FindWidget; +class ScriptEditor; class SCRIPTFORM_EXPORT ScriptFormWidget : public QWidget { @@ -66,7 +70,7 @@ private: }; -class SCRIPTFORM_EXPORT ScriptForm : public QDialog +class SCRIPTFORM_EXPORT ScriptForm : public CustomDialog { Q_OBJECT public: @@ -80,4 +84,5 @@ private: ScriptFormWidget* m_pScript; }; +} #endif // SCRIPTFORM_H diff --git a/platform/src/include/tools/fbd_designer/fbd_block/CBlock.h b/platform/src/include/tools/fbd_designer/fbd_block/CBlock.h index 94701ebe..29e6248c 100644 --- a/platform/src/include/tools/fbd_designer/fbd_block/CBlock.h +++ b/platform/src/include/tools/fbd_designer/fbd_block/CBlock.h @@ -32,6 +32,33 @@ public: virtual void customWindow( QString ) {}// 自定义属性编辑框 virtual QIcon getIcon(); // 插件的图标 + //< 获取图元输入端口文本的位置坐标,nInputTextWidth是文字边框的宽度 + virtual QPointF getInputTextPos(const int nInputIndex,const int nInputTextWidth); + virtual QPointF getOutputTextPos(const int nOutputIndex,const int nOutputTextWidth); + + //< 获取图元图标的位置 + virtual QPointF getIconPos(const QSize &pixmapSize); + virtual bool isCustomItemPos(); + /******************************************************************************** + * @brief 获取输入端口总高度 + * @param nInputSize:输入端口数量 + * nPortHeight:单个端口高度 + * @return + ********************************************************************************/ + virtual int getInputHeight(const int nIndex,const int nPortSize,const int nPortHeight); + virtual int getOutputHeight(const int nIndex, const int nPortSize, const int nPortHeight); + // 第一个输入(输出、文字)与顶的距离 + virtual int getFirstHeight(); + virtual void setDefaultIconSize(); + + //< 初始化后执行的操作,可以图元自定义一些特殊操作 + virtual void afterInitialize(); + //< 输出值显示分隔符 + virtual QString getOutputRealValueSep(); + + //< 用于画图元外边框的折线 + virtual QPolygonF getPolygon(const int nWidth,const int nHeight); + public: QString getCustomShowName(); void setCustomShowName( QString sShowName ); diff --git a/platform/src/include/tools/fbd_designer/fbd_editor/CFBDMainWindow.h b/platform/src/include/tools/fbd_designer/fbd_editor/CFBDMainWindow.h index 8d7e0e9a..40396f93 100644 --- a/platform/src/include/tools/fbd_designer/fbd_editor/CFBDMainWindow.h +++ b/platform/src/include/tools/fbd_designer/fbd_editor/CFBDMainWindow.h @@ -23,6 +23,8 @@ #include #include #include "CFBDMainWindow_global.h" +#include "pub_widget/CustomMainWindow.h" + class CDiagram; class CGraphicsScene; @@ -33,10 +35,16 @@ namespace Ui { class CFBDMainWindow; } -class EDITOR_EXPORT CFBDMainWindow : public QMainWindow +class EDITOR_EXPORT CFBDMainWindow : public CustomUiMainWindow { Q_OBJECT - + Q_PROPERTY(QColor itemSelectBorderColor READ itemSelectBorderColor WRITE setItemSelectBorderColor) + Q_PROPERTY(QColor itemNormalBorderColor READ itemNormalBorderColor WRITE setItemNormalBorderColor) + Q_PROPERTY(QColor itemDefaultBackgroundColor READ itemDefaultBackgroundColor WRITE setItemDefaultBackgroundColor) + Q_PROPERTY(QColor itemErrorBackgroundColor READ itemErrorBackgroundColor WRITE setItemErrorBackgroundColor) + Q_PROPERTY(QColor itemTextBackgroundColor READ itemTextBackgroundColor WRITE setItemTextBackgroundColor) + Q_PROPERTY(QColor errorStateTextColor READ errorStateTextColor WRITE setErrorStateTextColor) + Q_PROPERTY(QColor normalStateTextColor READ normalStateTextColor WRITE setNormalStateTextColor) public: explicit CFBDMainWindow( QWidget* parent=0 ); ~CFBDMainWindow(); @@ -60,6 +68,7 @@ private: void deleteDiagram( QString sName ); void closeEvent( QCloseEvent* pEvent ); int setGroupInfo(); + void setMulGroupEnable(QMap mapDiagram); //设置多个图使能 bool updateGroupInfo( int nGroupId ); void updateSceneRect(); @@ -90,10 +99,25 @@ private: CGraphicsView* getCurrentView(); CGraphicsScene* getCurrentScene(); + QColor itemSelectBorderColor(); + QColor itemNormalBorderColor(); + QColor itemDefaultBackgroundColor(); + QColor itemErrorBackgroundColor(); + QColor itemTextBackgroundColor(); + QColor errorStateTextColor(); + QColor normalStateTextColor(); + void setItemSelectBorderColor( QColor color ); + void setItemNormalBorderColor( QColor color ); + void setItemDefaultBackgroundColor( QColor color ); + void setItemErrorBackgroundColor( QColor color ); + void setItemTextBackgroundColor( QColor color ); + void setErrorStateTextColor(QColor color ); + void setNormalStateTextColor(QColor color ); private slots: void slotShowGroupDetail( bool ); void slotTreeWidgetItemDoubleClicked( QTreeWidgetItem *pItem, int nColumn ); void slotTreeWidgetContextMenuRequest( const QPoint& objPoint ); + void slotTreeWidgetItemChange(QTreeWidgetItem *pItem, int nColumn ); void slotDeleteDiagram(); void slotExportDiagramAsXml(); void slotBusinessTypeOfBlockChanged( QString sCurrentText ); @@ -104,7 +128,8 @@ private slots: void slotSceneChanged(); void slotErrorDisplay( QString sMsg ); void slotSceneRectChanged(const QRectF &rect); - void showEditMsg( QString sMsg, int nLevel ); //编译过程中的操作提示 + void showEditMsg( QString sMsg, int nLevel ); //编译过程中的操作提示 + void slotOneClickEnable(); //一键使能 void itemsSelected(QList); void tabClosed(int); @@ -139,6 +164,8 @@ private slots: void on_actionSaveAsTemplate_triggered(); void on_addWidgetLineEdit_returnPressed(); + void on_actionReplace_triggered(); + private: Ui::CFBDMainWindow *ui; CPluginManager* m_pPluginManager; // 加载图元 @@ -158,6 +185,9 @@ private: int m_nCurrentBusinessTypeId; // 当前业务类型ID QList m_listDiagramName; // 数据库中所有图的名称,包括未打开的图 bool m_bEditPermission; // 编辑权限 + QColor m_errorStateTextColor; // 状态栏错误的字体颜色 + QColor m_normalStateTextColor; // 状态栏正常的字体颜色 }; + #endif // FBDMAINWINDOW_H diff --git a/platform/src/include/tools/fbd_designer/fbd_retriever/CRetriever.h b/platform/src/include/tools/fbd_designer/fbd_retriever/CRetriever.h index c3d7dc90..924c562d 100644 --- a/platform/src/include/tools/fbd_designer/fbd_retriever/CRetriever.h +++ b/platform/src/include/tools/fbd_designer/fbd_retriever/CRetriever.h @@ -4,6 +4,7 @@ #include #include "db_api_ex/CDbApi.h" #include "CRetriever_global.h" +#include "pub_widget/CustomDialog.h" namespace Ui { class CFBDRetriever; @@ -14,12 +15,13 @@ using namespace iot_dbms; class QStandardItem; class QStandardItemModel; -class RETRIEVER_EXPORT CFBDRetriever : public QDialog +class RETRIEVER_EXPORT CFBDRetriever : public CustomUiDialog { Q_OBJECT public: - explicit CFBDRetriever(QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags()); + //explicit CFBDRetriever(QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags()); + explicit CFBDRetriever(QWidget *parent = Q_NULLPTR); ~CFBDRetriever(); void setValidLocation(QStringList &locations); diff --git a/platform/src/include/tools/model_common/CPluginWidget.h b/platform/src/include/tools/model_common/CPluginWidget.h index acd6f6c5..aaa04240 100644 --- a/platform/src/include/tools/model_common/CPluginWidget.h +++ b/platform/src/include/tools/model_common/CPluginWidget.h @@ -23,8 +23,8 @@ public: }; -Q_DECLARE_INTERFACE(CPluginWidgetInterface, - "kbd.PluginWidgetInterface/1.0") +#define HMI_WidgetPlugin_IID "HMI.PluginWidgetInterface/1.0" +Q_DECLARE_INTERFACE(CPluginWidgetInterface,HMI_WidgetPlugin_IID) #endif //IPLUGINWIDGET_H diff --git a/platform/src/include/tools/model_common/common.h b/platform/src/include/tools/model_common/common.h index f2a20c4a..dfbc3a49 100644 --- a/platform/src/include/tools/model_common/common.h +++ b/platform/src/include/tools/model_common/common.h @@ -46,6 +46,7 @@ public: static QString getOSDirName(); static QString getModelConfigPath(); static QString getSoftwareVersion(); + static QString getLanguage(); static bool isInTablePath(const QString &xmlFileName); static bool isSysRun(); static void reloadKeepalived(); diff --git a/platform/src/include/tools/model_table/CustomWidget/kbdtreeview.h b/platform/src/include/tools/model_table/CustomWidget/kbdtreeview.h index 6d6d1c73..6d2e5338 100644 --- a/platform/src/include/tools/model_table/CustomWidget/kbdtreeview.h +++ b/platform/src/include/tools/model_table/CustomWidget/kbdtreeview.h @@ -34,8 +34,6 @@ protected: void showEvent(QShowEvent *event); bool searchChildItemText(QStandardItemModel *itemModel,const QModelIndex &index,const QString &text,bool bFind); - bool endCardsearchChildItemText(QStandardItemModel *itemModel,const QModelIndex &index,const QString &text,bool bFind); - bool startCardsearchChildItemText(QStandardItemModel *itemModel,const QModelIndex &index,const QString &text,bool bFind); void setChildReverseSelect(QStandardItem* itemParent); private: KbdTable *m_clickActionTable; @@ -45,7 +43,6 @@ private slots: void onClickItem(const QModelIndex &index); public slots: void onSearchItemText(const QString &text); - void onCardSearchItemText(QString text); void onSelectAll(); void onReverseSelect(); }; diff --git a/platform/src/include/tools/model_table/kbddbdesign.h b/platform/src/include/tools/model_table/kbddbdesign.h index a9a92401..c268473a 100644 --- a/platform/src/include/tools/model_table/kbddbdesign.h +++ b/platform/src/include/tools/model_table/kbddbdesign.h @@ -99,8 +99,6 @@ public: bool getSqlInfoToCombobox(const QString &sql,const QString &descField,const QString &dataField,QComboBox *cb); - bool getSqlInfoToCombobox(const QString &sql, const QString &nameField,const QString &descField, const QString &dataField, QComboBox *cb); - bool getSqlSingleResult(const QString &sql, const QStringList &filedList, QStringList &resultList); bool isExist(const QString &sql,bool &exist); diff --git a/platform/src/include/tools/model_table/kbdexportimportlogic.h b/platform/src/include/tools/model_table/kbdexportimportlogic.h index df6b9e85..e379cb84 100644 --- a/platform/src/include/tools/model_table/kbdexportimportlogic.h +++ b/platform/src/include/tools/model_table/kbdexportimportlogic.h @@ -12,7 +12,7 @@ #include /** - * @brief The KbdExportImportLogic class 宏茂技术模板导出,导入逻辑 + * @brief The KbdExportImportLogic class 远信储能模板导出,导入逻辑 * @note 随着设计更改,本类大部分功能已无用,只有部分函数有用 */ class TABLEMODULESHARED_EXPORT KbdExportImportLogic : public QObject diff --git a/platform/src/include/tools/model_table/kbdinputdlg.h b/platform/src/include/tools/model_table/kbdinputdlg.h index 2efbca28..b994d0a7 100644 --- a/platform/src/include/tools/model_table/kbdinputdlg.h +++ b/platform/src/include/tools/model_table/kbdinputdlg.h @@ -3,10 +3,11 @@ #include #include "tablemodule_global.h" +#include "pub_widget/CustomDialog.h" class QLineEdit; class QSpinBox; -class TABLEMODULESHARED_EXPORT KbdInputDlg : public QDialog +class TABLEMODULESHARED_EXPORT KbdInputDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/include/tools/model_table/kbdpage.h b/platform/src/include/tools/model_table/kbdpage.h index 3c710e30..babc16ab 100644 --- a/platform/src/include/tools/model_table/kbdpage.h +++ b/platform/src/include/tools/model_table/kbdpage.h @@ -32,8 +32,6 @@ public: void refreshCurrentPage(); void refreshToTailPage(); void initState();//回到初始状态 -signals: - void currentPageChange(); private: void initLayout(); void initData(); diff --git a/platform/src/include/tools/model_table/kbdpropertydlg.h b/platform/src/include/tools/model_table/kbdpropertydlg.h index 254530b7..b7607859 100644 --- a/platform/src/include/tools/model_table/kbdpropertydlg.h +++ b/platform/src/include/tools/model_table/kbdpropertydlg.h @@ -7,10 +7,11 @@ #include #include "tablemodule_global.h" +#include "pub_widget/CustomDialog.h" class KbdPropertyPanel; -class TABLEMODULESHARED_EXPORT KbdPropertyDlg : public QDialog +class TABLEMODULESHARED_EXPORT KbdPropertyDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/include/tools/model_table/kbdreplacedlg.h b/platform/src/include/tools/model_table/kbdreplacedlg.h index fe3237bf..5b3721c6 100644 --- a/platform/src/include/tools/model_table/kbdreplacedlg.h +++ b/platform/src/include/tools/model_table/kbdreplacedlg.h @@ -3,9 +3,10 @@ #include #include "tablemodule_global.h" +#include "pub_widget/CustomDialog.h" class QLineEdit; -class TABLEMODULESHARED_EXPORT KbdReplaceDlg : public QDialog +class TABLEMODULESHARED_EXPORT KbdReplaceDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/include/tools/model_table/kbdtable.h b/platform/src/include/tools/model_table/kbdtable.h index 7b9d16d9..3fd0cc2f 100644 --- a/platform/src/include/tools/model_table/kbdtable.h +++ b/platform/src/include/tools/model_table/kbdtable.h @@ -42,7 +42,6 @@ public: void addMenuAction(const QString &text, const QObject *receiver, const char* member); void searchItemText(const QStringList &listColDes,const QString &text); - void searchItemListText(const QStringList &listColDes,const QStringList &text); signals: /** * @brief beforeMenuExecute 在菜单执行之前,发出该信号,请使用直连链接该信号 diff --git a/platform/src/include/tools/model_table/kbdtabledefine.h b/platform/src/include/tools/model_table/kbdtabledefine.h index 49ec54a2..301d351a 100644 --- a/platform/src/include/tools/model_table/kbdtabledefine.h +++ b/platform/src/include/tools/model_table/kbdtabledefine.h @@ -80,6 +80,9 @@ struct SqlComboboxLimit QString value; QString Desc; QString chanNo; + int valueIndex{-1}; //< 为了提高获取sql结果时的性能 + int descIndex{-1}; + int chanNoIndex{-1}; bool operator ==(const SqlComboboxLimit &right) const { diff --git a/platform/src/include/tools/model_table/valuedlg.h b/platform/src/include/tools/model_table/valuedlg.h index 48043f66..2185586d 100644 --- a/platform/src/include/tools/model_table/valuedlg.h +++ b/platform/src/include/tools/model_table/valuedlg.h @@ -8,11 +8,11 @@ #include #include "tablemodule_global.h" #include - +#include "pub_widget/CustomDialog.h" /** * @brief The ValueDlg class 继承该类后,需在KbdTableDataMgr::init()使用KBD_REGISTER_CLASS宏去注册 */ -class TABLEMODULESHARED_EXPORT ValueDlg : public QDialog +class TABLEMODULESHARED_EXPORT ValueDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/public/pub_widget/PubWidgetInit.cpp b/platform/src/public/pub_widget/PubWidgetInit.cpp index 6e622bcc..bb11ca20 100644 --- a/platform/src/public/pub_widget/PubWidgetInit.cpp +++ b/platform/src/public/pub_widget/PubWidgetInit.cpp @@ -1,32 +1,32 @@ -#include "pub_widget/PubWidgetInit.h" -#include "pub_utility_api/I18N.h" -#include "pub_utility_api/FileUtil.h" -#include -#include -#include - -namespace iot_public -{ - bool installTranslator(const std::string& pLanguage) - { - bool res = false; - const std::string strLanguage = pLanguage; - std::string strOmFile = iot_public::CFileUtil::getPathOfResFile( "pub_widget/translate/pub_widget_" + strLanguage + ".qm" ); - if( !strOmFile.empty() ) - { - res = true; - auto *pTrans = new QTranslator; - res = pTrans->load( strOmFile.c_str()); - res = QApplication::installTranslator( pTrans ); - } - return res; - - } - - - bool installTranslatorFromConfig() - { - const std::string strLanguage = std::move( iot_public::getCurLanguage()); - return installTranslator(strLanguage); - } -} +#include "pub_widget/PubWidgetInit.h" +#include "pub_utility_api/I18N.h" +#include "pub_utility_api/FileUtil.h" +#include +#include +#include + +namespace iot_public +{ + bool installTranslator(const std::string& pLanguage) + { + bool res = false; + const std::string strLanguage = pLanguage; + std::string strOmFile = iot_public::CFileUtil::getPathOfResFile( "pub_widget/translate/pub_widget_" + strLanguage + ".qm" ); + if( !strOmFile.empty() ) + { + res = true; + auto *pTrans = new QTranslator; + res = pTrans->load( strOmFile.c_str()); + res = QApplication::installTranslator( pTrans ); + } + return res; + + } + + + bool installTranslatorFromConfig() + { + const std::string strLanguage = std::move( iot_public::getCurLanguage()); + return installTranslator(strLanguage); + } +} diff --git a/platform/src/public/pub_widget/pub_widget.pro b/platform/src/public/pub_widget/pub_widget.pro index 56bd982e..4ba2ea7d 100644 --- a/platform/src/public/pub_widget/pub_widget.pro +++ b/platform/src/public/pub_widget/pub_widget.pro @@ -1,53 +1,53 @@ -QT += core gui -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - -TEMPLATE = lib -TARGET = pub_widget - -DEFINES += PUB_WIDGET_LIBRARY - -win32{ - QMAKE_CXXFLAGS -= -Zc:strictStrings -} - -# Input -HEADERS += \ - ../../include/public/pub_widget/widget_global.h \ - ../../include/public/pub_widget/Widgets.h \ - ../../include/public/pub_widget/NcFramelessHelper.h \ - ../../include/public/pub_widget/MainTitle.h \ - ../../include/public/pub_widget/WorkFrame.h \ - ../../include/public/pub_widget/MenuFrame.h \ - ../../include/public/pub_widget/MessageBox.h \ - ../../include/public/pub_widget/AlertMessageBox.h \ - ../../include/public/pub_widget/FramelessWindow.hpp \ - ../../include/public/pub_widget/CustomDialogTitle.h \ - ../../include/public/pub_widget/CustomDialog.h \ - ../../include/public/pub_widget/CustomMainWindow.h \ - ../../include/public/pub_widget/PubWidgetInit.h - -SOURCES += \ - ../../public/pub_widget/MainTitle.cpp \ - ../../public/pub_widget/Widgets.cpp \ - ../../public/pub_widget/NcFramelessHelper.cpp \ - ../../public/pub_widget/MenuFrame.cpp \ - ../../public/pub_widget/WorkFrame.cpp \ - ../../public/pub_widget/MessageBox.cpp \ - ../../public/pub_widget/AlertMessageBox.cpp \ - ../../public/pub_widget/CustomDialog.cpp \ - ../../public/pub_widget/CustomDialogTitle.cpp \ - ../../public/pub_widget/CustomMainWindow.cpp \ - ../../public/pub_widget/PubWidgetInit.cpp - -LIBS += -lpub_utility_api - -TRANSLATIONS += pub_widget_en.ts \ - pub_widget_fr.ts - -#------------------------------------------------------------------- -COMMON_PRI=$$PWD/../../common.pri -exists($$COMMON_PRI) { - include($$COMMON_PRI) -}else { - error("FATAL error: can not find common.pri") -} +QT += core gui +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TEMPLATE = lib +TARGET = pub_widget + +DEFINES += PUB_WIDGET_LIBRARY + +win32{ + QMAKE_CXXFLAGS -= -Zc:strictStrings +} + +# Input +HEADERS += \ + ../../include/public/pub_widget/widget_global.h \ + ../../include/public/pub_widget/Widgets.h \ + ../../include/public/pub_widget/NcFramelessHelper.h \ + ../../include/public/pub_widget/MainTitle.h \ + ../../include/public/pub_widget/WorkFrame.h \ + ../../include/public/pub_widget/MenuFrame.h \ + ../../include/public/pub_widget/MessageBox.h \ + ../../include/public/pub_widget/AlertMessageBox.h \ + ../../include/public/pub_widget/FramelessWindow.hpp \ + ../../include/public/pub_widget/CustomDialogTitle.h \ + ../../include/public/pub_widget/CustomDialog.h \ + ../../include/public/pub_widget/CustomMainWindow.h \ + ../../include/public/pub_widget/PubWidgetInit.h + +SOURCES += \ + ../../public/pub_widget/MainTitle.cpp \ + ../../public/pub_widget/Widgets.cpp \ + ../../public/pub_widget/NcFramelessHelper.cpp \ + ../../public/pub_widget/MenuFrame.cpp \ + ../../public/pub_widget/WorkFrame.cpp \ + ../../public/pub_widget/MessageBox.cpp \ + ../../public/pub_widget/AlertMessageBox.cpp \ + ../../public/pub_widget/CustomDialog.cpp \ + ../../public/pub_widget/CustomDialogTitle.cpp \ + ../../public/pub_widget/CustomMainWindow.cpp \ + ../../public/pub_widget/PubWidgetInit.cpp + +LIBS += -lpub_utility_api + +TRANSLATIONS += pub_widget_en.ts \ + pub_widget_fr.ts + +#------------------------------------------------------------------- +COMMON_PRI=$$PWD/../../common.pri +exists($$COMMON_PRI) { + include($$COMMON_PRI) +}else { + error("FATAL error: can not find common.pri") +} diff --git a/platform/src/tools/Other/generateTablexml/main.cpp b/platform/src/tools/Other/generateTablexml/main.cpp index 493e60a4..db9b7996 100644 --- a/platform/src/tools/Other/generateTablexml/main.cpp +++ b/platform/src/tools/Other/generateTablexml/main.cpp @@ -6,8 +6,8 @@ int main(int argc, char *argv[]) { QApplication a(argc, argv); - QCoreApplication::setOrganizationName("Soft"); - QCoreApplication::setOrganizationDomain("KbdSoft.com"); + QCoreApplication::setOrganizationName("IOT"); + QCoreApplication::setOrganizationDomain("iot.com"); QCoreApplication::setApplicationName("GenerateTableXml"); MainWindow w; diff --git a/platform/src/tools/ScriptForm/FindWidget.cpp b/platform/src/tools/ScriptForm/FindWidget.cpp deleted file mode 100644 index b395c727..00000000 --- a/platform/src/tools/ScriptForm/FindWidget.cpp +++ /dev/null @@ -1,105 +0,0 @@ -#include "FindWidget.h" -#include "ui_FindWidget.h" -#include - -FindWidget::FindWidget(QWidget *parent) : - QWidget(parent), - ui(new Ui::FindWidget) -{ - ui->setupUi(this); - ui->findText->setFocus(); -} - -FindWidget::~FindWidget() -{ - delete ui; -} - -void FindWidget::setFocus() -{ - ui->findText->setFocus(); -} - -void FindWidget::setFindText(const QString &text) -{ - ui->findText->setText(text); -} - -void FindWidget::onFindNext() -{ - if(ui->findNext->text().isEmpty()) - { - return; - } - - QTextDocument::FindFlags flags; - if(ui->caseSensitive->isChecked()) - { - flags |= QTextDocument::FindCaseSensitively; - } - if(ui->wholeWords->isChecked()) - { - flags |= QTextDocument::FindWholeWords; - } - - emit sigFind(ui->findText->text(), flags); -} - -void FindWidget::onFindPrev() -{ - if(ui->findText->text().isEmpty()) - { - return; - } - - QTextDocument::FindFlags flags; - if(ui->caseSensitive->isChecked()) - { - flags |= QTextDocument::FindCaseSensitively; - } - if(ui->wholeWords->isChecked()) - { - flags |= QTextDocument::FindWholeWords; - } - - emit sigFind(ui->findText->text(), flags | QTextDocument::FindBackward); -} - -void FindWidget::onReplace() -{ - if(ui->findText->text().isEmpty()) - { - return; - } - QTextDocument::FindFlags flags; - if(ui->caseSensitive->isChecked()) - { - flags |= QTextDocument::FindCaseSensitively; - } - if(ui->wholeWords->isChecked()) - { - flags |= QTextDocument::FindWholeWords; - } - - emit sigReplace(ui->findText->text(), ui->replaceText->text(), flags); -} - -void FindWidget::onReplaceAll() -{ - if(ui->findText->text().isEmpty()) - { - return; - } - - QTextDocument::FindFlags flags; - if(ui->caseSensitive->isChecked()) - { - flags |= QTextDocument::FindCaseSensitively; - } - if(ui->wholeWords->isChecked()) - { - flags |= QTextDocument::FindWholeWords; - } - - emit sigReplaceAll(ui->findText->text(), ui->replaceText->text(), flags); -} diff --git a/platform/src/tools/ScriptForm/FindWidget.h b/platform/src/tools/ScriptForm/FindWidget.h deleted file mode 100644 index 8cb69694..00000000 --- a/platform/src/tools/ScriptForm/FindWidget.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef FINDWIDGET_H -#define FINDWIDGET_H - -#include - -namespace Ui { -class FindWidget; -} - -class FindWidget : public QWidget -{ - Q_OBJECT - -public: - explicit FindWidget(QWidget *parent = 0); - ~FindWidget(); - - void setFocus(); - void setFindText(const QString &text); - -signals: - void sigFind(QString, int); - void sigReplace(QString, QString, int); - void sigReplaceAll(QString, QString, int); - -private slots: - void onFindNext(); - void onFindPrev(); - void onReplace(); - void onReplaceAll(); - -private: - Ui::FindWidget *ui; -}; - -#endif // FINDWIDGET_H diff --git a/platform/src/tools/ScriptForm/FindWidget.ui b/platform/src/tools/ScriptForm/FindWidget.ui deleted file mode 100644 index 3f65194f..00000000 --- a/platform/src/tools/ScriptForm/FindWidget.ui +++ /dev/null @@ -1,401 +0,0 @@ - - - FindWidget - - - Qt::NonModal - - - - 0 - 0 - 719 - 54 - - - - - 0 - 40 - - - - - 16777215 - 58 - - - - Qt::StrongFocus - - - Form - - - QFrame { - background: #C0C0C0; -} - - - - - 2 - - - 0 - - - 2 - - - 0 - - - 0 - - - - - - 16777215 - 54 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - 6 - - - 0 - - - - - 3 - - - 2 - - - - - 6 - - - - - - 56 - 0 - - - - - 56 - 16777215 - - - - Find : - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - findText - - - - - - - - 0 - 23 - - - - - 16777215 - 23 - - - - - - - - 2 - - - 1 - - - 2 - - - 1 - - - 0 - - - - - Qt::NoFocus - - - Find Next - - - - - - - Qt::NoFocus - - - Find Prev - - - - - - - - - - - 0 - - - - - - 56 - 0 - - - - - 56 - 16777215 - - - - Replace : - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - replaceText - - - - - - - - 0 - 23 - - - - - 16777215 - 23 - - - - - - - - 2 - - - 1 - - - 2 - - - 1 - - - 0 - - - - - Qt::NoFocus - - - Replace - - - - - - - Qt::NoFocus - - - Replace All - - - - - - - - - - - - - QFrame::Box - - - QFrame::Sunken - - - - 6 - - - 0 - - - 0 - - - 0 - - - 2 - - - 0 - - - - - Case Sensitive - - - - - - - Whole Words - - - - - - - - - - - - - findText - replaceText - wholeWords - caseSensitive - - - - - findNext - clicked() - FindWidget - onFindNext() - - - 453 - 19 - - - 452 - -12 - - - - - findPrev - clicked() - FindWidget - onFindPrev() - - - 523 - 17 - - - 523 - -16 - - - - - replaceAll - clicked() - FindWidget - onReplaceAll() - - - 546 - 50 - - - 546 - 133 - - - - - replace - clicked() - FindWidget - onReplace() - - - 483 - 55 - - - 483 - 126 - - - - - - onFindNext() - onFindPrev() - onReplace() - onReplaceAll() - - diff --git a/platform/src/tools/ScriptForm/Highlighter.cpp b/platform/src/tools/ScriptForm/Highlighter.cpp deleted file mode 100644 index 525d0e6e..00000000 --- a/platform/src/tools/ScriptForm/Highlighter.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "Highlighter.h" - -//! [0] -Highlighter::Highlighter(QTextDocument *parent) - : QSyntaxHighlighter(parent) -{ - HighlightingRule rule; - - keywordFormat.setForeground(Qt::darkBlue); - keywordFormat.setFontWeight(QFont::Bold); - QStringList keywordPatterns; - keywordPatterns << "\\bfunction\\b" << "\\bchar\\b" << "\\bclass\\b" << "\\bconst\\b" - << "\\bdouble\\b" << "\\benum\\b" << "\\bexplicit\\b" - << "\\bfriend\\b" << "\\binline\\b" << "\\bint\\b" - << "\\blong\\b" << "\\bnamespace\\b" << "\\boperator\\b" - << "\\bprivate\\b" << "\\bprotected\\b" << "\\bpublic\\b" - << "\\bshort\\b" << "\\bsignals\\b" << "\\bsigned\\b" - << "\\bslots\\b" << "\\bstatic\\b" << "\\bstruct\\b" - << "\\btemplate\\b" << "\\btypedef\\b" << "\\btypename\\b" - << "\\bunion\\b" << "\\bunsigned\\b" << "\\bvirtual\\b" - << "\\bvoid\\b" << "\\bvolatile\\b" << "\\bbool\\b"; - foreach (const QString &pattern, keywordPatterns) { - rule.pattern = QRegularExpression(pattern); - rule.format = keywordFormat; - highlightingRules.append(rule); -//! [0] //! [1] - } -//! [1] - -//! [2] - classFormat.setFontWeight(QFont::Bold); - classFormat.setForeground(Qt::darkMagenta); - rule.pattern = QRegularExpression("\\bQ[A-Za-z]+\\b"); - rule.format = classFormat; - highlightingRules.append(rule); -//! [2] - -//! [3] - singleLineCommentFormat.setForeground(Qt::red); - rule.pattern = QRegularExpression("//[^\n]*"); - rule.format = singleLineCommentFormat; - highlightingRules.append(rule); - - multiLineCommentFormat.setForeground(Qt::red); -//! [3] - -//! [4] - quotationFormat.setForeground(Qt::darkGreen); - rule.pattern = QRegularExpression("\".*\""); - rule.format = quotationFormat; - highlightingRules.append(rule); -//! [4] - -//! [5] - functionFormat.setFontItalic(true); - functionFormat.setForeground(Qt::blue); - rule.pattern = QRegularExpression("\\b[A-Za-z0-9_]+(?=\\()"); - rule.format = functionFormat; - highlightingRules.append(rule); -//! [5] - -//! [6] - commentStartExpression = QRegularExpression("/\\*"); - commentEndExpression = QRegularExpression("\\*/"); -} -//! [6] - -//! [7] -void Highlighter::highlightBlock(const QString &text) -{ - foreach (const HighlightingRule &rule, highlightingRules) { - QRegularExpressionMatchIterator matchIterator = rule.pattern.globalMatch(text); - while (matchIterator.hasNext()) { - QRegularExpressionMatch match = matchIterator.next(); - setFormat(match.capturedStart(), match.capturedLength(), rule.format); - } - } -//! [7] //! [8] - setCurrentBlockState(0); -//! [8] - -//! [9] - int startIndex = 0; - if (previousBlockState() != 1) - startIndex = text.indexOf(commentStartExpression); - -//! [9] //! [10] - while (startIndex >= 0) { -//! [10] //! [11] - QRegularExpressionMatch match = commentEndExpression.match(text, startIndex); - int endIndex = match.capturedStart(); - int commentLength = 0; - if (endIndex == -1) { - setCurrentBlockState(1); - commentLength = text.length() - startIndex; - } else { - commentLength = endIndex - startIndex - + match.capturedLength(); - } - setFormat(startIndex, commentLength, multiLineCommentFormat); - startIndex = text.indexOf(commentStartExpression, startIndex + commentLength); - } -} -//! [11] diff --git a/platform/src/tools/ScriptForm/Highlighter.h b/platform/src/tools/ScriptForm/Highlighter.h deleted file mode 100644 index 25fe9eb6..00000000 --- a/platform/src/tools/ScriptForm/Highlighter.h +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef HIGHLIGHTER_H -#define HIGHLIGHTER_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE -class QTextDocument; -QT_END_NAMESPACE - -//! [0] -class Highlighter : public QSyntaxHighlighter -{ - Q_OBJECT - -public: - Highlighter(QTextDocument *parent = 0); - -protected: - void highlightBlock(const QString &text) override; - -private: - struct HighlightingRule - { - QRegularExpression pattern; - QTextCharFormat format; - }; - QVector highlightingRules; - - QRegularExpression commentStartExpression; - QRegularExpression commentEndExpression; - - QTextCharFormat keywordFormat; - QTextCharFormat classFormat; - QTextCharFormat singleLineCommentFormat; - QTextCharFormat multiLineCommentFormat; - QTextCharFormat quotationFormat; - QTextCharFormat functionFormat; -}; -//! [0] - -#endif // HIGHLIGHTER_H diff --git a/platform/src/tools/ScriptForm/ScriptEditor.cpp b/platform/src/tools/ScriptForm/ScriptEditor.cpp deleted file mode 100644 index 74a47ea8..00000000 --- a/platform/src/tools/ScriptForm/ScriptEditor.cpp +++ /dev/null @@ -1,496 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include "ScriptEditor.h" -#include "Highlighter.h" - -ScriptEditor::ScriptEditor(QWidget *parent) - : QPlainTextEdit(parent), completer(nullptr), highlighter(nullptr) -{ - lineNumberArea = new LineNumberArea(this); - - connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int))); - connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int))); - connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); - - updateLineNumberAreaWidth(0); - highlightCurrentLine(); - - completer = new QCompleter(this); - completer->setModel(modelFromFile("://ScriptRes/complete")); - completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel); - completer->setCaseSensitivity(Qt::CaseInsensitive); - completer->setWrapAround(true); - setCompleter(completer); - highlighter = new Highlighter(document()); - - QPalette palette = this->palette(); - palette.setColor(QPalette::Inactive, QPalette::Highlight, palette.color(QPalette::Highlight)); - palette.setColor(QPalette::Inactive, QPalette::HighlightedText, palette.color(QPalette::HighlightedText)); - setPalette(palette); -} - -ScriptEditor::~ScriptEditor() -{ - if(nullptr != highlighter) - { - delete highlighter; - highlighter = nullptr; - } -} - -int ScriptEditor::lineNumberAreaWidth() -{ - int digits = 1; - int max = qMax(1, blockCount()); - while (max >= 10) { - max /= 10; - ++digits; - } - - int space = 10 + fontMetrics().width(QLatin1Char('9')) * digits; - - return space; -} - -void ScriptEditor::setCompleter(QCompleter *c) -{ - if (completer) - QObject::disconnect(c, 0, this, 0); - - completer = c; - - if (!completer) - return; - - completer->setWidget(this); - completer->setCompletionMode(QCompleter::PopupCompletion); - completer->setCaseSensitivity(Qt::CaseInsensitive); - QObject::connect(completer, SIGNAL(activated(QString)), - this, SLOT(insertCompletion(QString))); -} - -QCompleter *ScriptEditor::getCompleter() const -{ - return completer; -} - -QString ScriptEditor::getCurrentSelectText() const -{ - return textCursor().selectedText(); -} - -QStringList ScriptEditor::getAllFunctions() const -{ - QStringList strFunctions; - QString regExp = QString("(^function)\\s+\\w+"); - QTextCursor c = document()->find(QRegExp(regExp), QTextCursor()); - while (!c.isNull()) - { - if(!c.block().text().isEmpty()) - { - QString funcDef = c.block().text().remove("function "); - strFunctions.append(funcDef); - } - c = document()->find(QRegExp(regExp), c); - } - return strFunctions; -} - -QAbstractItemModel *ScriptEditor::modelFromFile(const QString& fileName) -{ - QFile file(fileName); - if (!file.open(QFile::ReadOnly)) - return new QStringListModel(completer); - -#ifndef QT_NO_CURSOR - QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); -#endif - QStringList words; - - while (!file.atEnd()) { - QByteArray line = file.readLine(); - if (!line.isEmpty()) - words << line.trimmed(); - } - -#ifndef QT_NO_CURSOR - QApplication::restoreOverrideCursor(); -#endif - return new QStringListModel(words, completer); -} - -QString ScriptEditor::text() const -{ - return document()->toPlainText(); -} - -void ScriptEditor::setText(const QString &text) -{ - document()->setPlainText(text); -} - -void ScriptEditor::refresh(const QString &strFindText) -{ - QTextCursor c = document()->find(strFindText, QTextCursor()); - if (!c.isNull()) - { - c.clearSelection(); - setTextCursor(c); - } - setFocus(); -} - -void ScriptEditor::onFind(const QString &strFindText, int flag) -{ - QTextCursor c = document()->find(strFindText, textCursor(), (QTextDocument::FindFlags)flag); - if (!c.isNull()) - { - setTextCursor(c); - } - setFocus(); -} - -void ScriptEditor::onReplace(const QString &strFindText, const QString &strReplaceText, int flag) -{ - QTextCursor cursor = textCursor(); - if (cursor.hasSelection() && cursor.selectedText() == strFindText) - { - cursor.beginEditBlock(); - cursor.insertText(strReplaceText); - cursor.endEditBlock(); - setTextCursor(cursor); - } - else - { - cursor = document()->find(strFindText, textCursor(), (QTextDocument::FindFlags)flag); - if (!cursor.isNull()) - { - cursor.beginEditBlock(); - cursor.insertText(strReplaceText); - cursor.endEditBlock(); - setTextCursor(cursor); - } - } -} - -void ScriptEditor::onReplaceAll(const QString &strFindText, const QString &strReplaceText, int flag) -{ - QTextCursor c = textCursor(); - QTextCursor cursor = c; - - cursor.setPosition(0, QTextCursor::MoveAnchor); - setTextCursor(cursor); - - while (!cursor.isNull()) - { - cursor = document()->find(strFindText, textCursor(), (QTextDocument::FindFlags)flag); - cursor.beginEditBlock(); - cursor.insertText(strReplaceText); - cursor.endEditBlock(); - setTextCursor(cursor); - } - setTextCursor(c); -} - -void ScriptEditor::updateLineNumberAreaWidth(int newBlockCount) -{ - Q_UNUSED(newBlockCount) - setViewportMargins(lineNumberAreaWidth(), 0, 0, 0); -} - -void ScriptEditor::updateLineNumberArea(const QRect &rect, int dy) -{ - if (dy) - lineNumberArea->scroll(0, dy); - else - lineNumberArea->update(0, rect.y(), lineNumberArea->width(), rect.height()); - - if (rect.contains(viewport()->rect())) - updateLineNumberAreaWidth(0); -} - -void ScriptEditor::zoom(int &delta) -{ - int nDelta = font().pointSize(); - if(delta > 0 && nDelta >= 9) - { - zoomOut(delta); - } - else if(delta < 0 && nDelta <= 89) - { - zoomIn(-delta); - } - -} - -void ScriptEditor::insertCompletion(const QString &completion) -{ - if (completer->widget() != this) - return; - QTextCursor tc = textCursor(); - int extra = completion.length() - completer->completionPrefix().length(); - tc.movePosition(QTextCursor::Left); - tc.movePosition(QTextCursor::EndOfWord); - tc.insertText(completion.right(extra)); - setTextCursor(tc); -} - -void ScriptEditor::resizeEvent(QResizeEvent *e) -{ - QPlainTextEdit::resizeEvent(e); - QRect cr = contentsRect(); - lineNumberArea->setGeometry(QRect(cr.left(), cr.top(), lineNumberAreaWidth(), cr.height())); -} - -void ScriptEditor::wheelEvent(QWheelEvent *e) -{ - if(e->modifiers() == Qt::ControlModifier) - { - int nDelta = e->delta() / 120; - zoom(nDelta); - } - QPlainTextEdit::wheelEvent(e); -} - -void ScriptEditor::focusInEvent(QFocusEvent *e) -{ - if (completer) - completer->setWidget(this); - QPlainTextEdit::focusInEvent(e); -} - -void ScriptEditor::keyPressEvent(QKeyEvent *e) -{ - if (completer && completer->popup()->isVisible()) - { - if(e->modifiers() & Qt::ControlModifier) - { - e->ignore(); - return; - } - // The following keys are forwarded by the completer to the widget - switch (e->key()) { - case Qt::Key_Enter: - case Qt::Key_Return: - case Qt::Key_Escape: - case Qt::Key_Tab: - case Qt::Key_Backtab: - e->ignore(); - return; // let the completer do default behavior - default: - break; - } - } - - switch (e->key()) - { - case Qt::Key_Tab: - { - QTextCursor cursor = textCursor(); - cursor.beginEditBlock(); - if(e->modifiers() & Qt::ShiftModifier) - { - - } - else - { - cursor.insertText(" "); - } - cursor.endEditBlock(); - setTextCursor(cursor); - e->accept(); - return; - } - case Qt::Key_BraceRight: - { - QTextCursor cursor = textCursor(); - cursor.movePosition(QTextCursor::StartOfLine); - cursor.select(QTextCursor::LineUnderCursor); - - QString tcText = cursor.selectedText(); - - cursor.beginEditBlock(); - if(tcText.count(" ") == tcText.length()) - { - cursor.removeSelectedText(); - int place = tcText.length(); - while(--place > 3) - { - cursor.insertText(" "); - } - } - cursor.endEditBlock(); - cursor.clearSelection(); - setTextCursor(cursor); - QPlainTextEdit::keyPressEvent(e); - return; - } - case Qt::Key_Return: - { - QTextCursor tc = textCursor(); - tc.movePosition(QTextCursor::PreviousCharacter); - tc.select(QTextCursor::WordUnderCursor); - QString prefix = tc.selectedText().right(1); - tc.movePosition(QTextCursor::NextCharacter); - - tc.select(QTextCursor::LineUnderCursor); - QString tcText = tc.selectedText(); - int place = 0; - while(!tcText.isEmpty() && tcText.at(0) == " ") - { - place++; - tcText.remove(0, 1); - } - - QPlainTextEdit::keyPressEvent(e); - QTextCursor cursor = textCursor(); - cursor.beginEditBlock(); - if(prefix == "{") - { - while(place-- > 0) - { - cursor.insertText(" "); - } - cursor.insertText(" "); - } - else /*if(prefix == ";")*/ - { - while(place-- > 0) - { - cursor.insertText(" "); - } - } - cursor.endEditBlock(); - setTextCursor(cursor); - e->accept(); - return; - } - } - bool isShortcut = ((e->modifiers() & Qt::ControlModifier) && e->key() == Qt::Key_E); // CTRL+E - if (!completer || !isShortcut) // do not process the shortcut when we have a completer - QPlainTextEdit::keyPressEvent(e); - - const bool ctrlOrShift = e->modifiers() & (Qt::ControlModifier | Qt::ShiftModifier); - if (!completer || (ctrlOrShift && e->text().isEmpty())) - return; - - static QString eow("~!@#$%^&*()_+{}|:\"<>?,./;'[]\\-="); // end of word - bool hasModifier = (e->modifiers() != Qt::NoModifier) && !ctrlOrShift; - - QTextCursor tc = textCursor(); - tc.select(QTextCursor::WordUnderCursor); - - QString completionPrefix = tc.selectedText(); - - if ((hasModifier || e->text().isEmpty()|| completionPrefix.length() < 3 - || eow.contains(e->text().right(1)))) { - completer->popup()->hide(); - return; - } - - if (completionPrefix != completer->completionPrefix()) { - completer->setCompletionPrefix(completionPrefix); - completer->popup()->setCurrentIndex(completer->completionModel()->index(0, 0)); - } - QRect cr = cursorRect(); - cr.setWidth(completer->popup()->sizeHintForColumn(0) - + completer->popup()->verticalScrollBar()->sizeHint().width()); - completer->complete(cr); // popup it up! -} - -void ScriptEditor::highlightCurrentLine() -{ - QList extraSelections; - - if (!isReadOnly()) { - QTextEdit::ExtraSelection selection; - - QColor lineColor = QColor(Qt::lightGray).lighter(108); - - selection.format.setBackground(lineColor); - selection.format.setProperty(QTextFormat::FullWidthSelection, true); - selection.cursor = textCursor(); - selection.cursor.clearSelection(); - extraSelections.append(selection); - } - - setExtraSelections(extraSelections); -} - - -void ScriptEditor::lineNumberAreaPaintEvent(QPaintEvent *event) -{ - QPainter painter(lineNumberArea); - painter.fillRect(event->rect(), Qt::lightGray); - - QTextBlock block = firstVisibleBlock(); - int blockNumber = block.blockNumber(); - int top = (int) blockBoundingGeometry(block).translated(contentOffset()).top(); - int bottom = top + (int) blockBoundingRect(block).height(); - - while (block.isValid() && top <= event->rect().bottom()) { - if (block.isVisible() && bottom >= event->rect().top()) { - QString number = QString::number(blockNumber + 1); - painter.setPen(Qt::black); - painter.drawText(0, top, lineNumberArea->width(), fontMetrics().height(), - Qt::AlignCenter, number); - } - - block = block.next(); - top = bottom; - bottom = top + (int) blockBoundingRect(block).height(); - ++blockNumber; - } -} - diff --git a/platform/src/tools/ScriptForm/ScriptEditor.h b/platform/src/tools/ScriptForm/ScriptEditor.h deleted file mode 100644 index 720cd2ab..00000000 --- a/platform/src/tools/ScriptForm/ScriptEditor.h +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SCRIPTEDITOR_H -#define SCRIPTEDITOR_H - -#include -#include - -QT_BEGIN_NAMESPACE -class QPaintEvent; -class QResizeEvent; -class QSize; -class QWidget; -QT_END_NAMESPACE - -class QCompleter; -class QAbstractItemModel; -class Highlighter; -class LineNumberArea; - -//![scripteditordefinition] - -class ScriptEditor : public QPlainTextEdit -{ - Q_OBJECT - -public: - ScriptEditor(QWidget *parent = 0); - ~ScriptEditor(); - - void lineNumberAreaPaintEvent(QPaintEvent *event); - int lineNumberAreaWidth(); - - void setCompleter(QCompleter *c); - QCompleter * getCompleter() const; - - QString getCurrentSelectText() const; - - QStringList getAllFunctions() const; - - QAbstractItemModel *modelFromFile(const QString &fileName); - - QString text() const; - void setText(const QString &text); - -public slots: - void refresh(const QString &strFindText); - void onFind(const QString &strFindText, int flag); - void onReplace(const QString &strFindText, const QString &strReplaceText, int flag); - void onReplaceAll(const QString &strFindText, const QString &strReplaceText, int flag); - -protected: - virtual void resizeEvent(QResizeEvent *event) override; - virtual void wheelEvent(QWheelEvent *e) override; - virtual void focusInEvent(QFocusEvent *e); - virtual void keyPressEvent(QKeyEvent *e); - -private slots: - void updateLineNumberAreaWidth(int newBlockCount); - void highlightCurrentLine(); - void updateLineNumberArea(const QRect &, int); - void zoom(int &delta); - void insertCompletion(const QString &completion); - -private: - QWidget *lineNumberArea; - QCompleter * completer; - Highlighter * highlighter; -}; - -//![scripteditordefinition] - -//![extraarea] - -class LineNumberArea : public QWidget -{ -public: - LineNumberArea(ScriptEditor *editor) : QWidget(editor) { - scriptEditor = editor; - } - - QSize sizeHint() const override { - return QSize(scriptEditor->lineNumberAreaWidth(), 0); - } - -protected: - void paintEvent(QPaintEvent *event) override { - scriptEditor->lineNumberAreaPaintEvent(event); - } - -private: - ScriptEditor * scriptEditor; -}; - -//![extraarea] - -#endif diff --git a/platform/src/tools/ScriptForm/ScriptForm.cpp b/platform/src/tools/ScriptForm/ScriptForm.cpp deleted file mode 100644 index 24ca03ec..00000000 --- a/platform/src/tools/ScriptForm/ScriptForm.cpp +++ /dev/null @@ -1,340 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../../include/tools/ScriptForm/ScriptForm.h" -#include "ScriptEditor.h" -#include "FindWidget.h" - -ScriptFormWidget::ScriptFormWidget(QWidget *parent) : - QWidget(parent), - scriptEditor(Q_NULLPTR), - funcNameWidget(Q_NULLPTR), - findWidget(Q_NULLPTR) -{ - initialize(); - installEventFilter(this); -} - -ScriptFormWidget::~ScriptFormWidget() -{ - delete scriptEditor; - scriptEditor = nullptr; - -} - -QString ScriptFormWidget::contentText() const -{ - return scriptEditor->text(); -} - -void ScriptFormWidget::setContentText(const QString &value) -{ - if(nullptr != scriptEditor) - { - scriptEditor->setText(value); - } -} - -void ScriptFormWidget::initialize() -{ - QVBoxLayout * layout = new QVBoxLayout(this); - - scriptEditor = new ScriptEditor(this); - initToolBar(); - connect(scriptEditor, SIGNAL(undoAvailable(bool)), this, SLOT(setUndoEnable(bool))); - connect(scriptEditor, SIGNAL(redoAvailable(bool)), this, SLOT(setRedoEnable(bool))); - layout->addWidget(toolBar); - - QSplitter * split = new QSplitter(this); - funcNameWidget = new QListWidget(this); - funcNameWidget->setMaximumWidth(350); - funcNameWidget->clear(); - connect(funcNameWidget, &QListWidget::clicked, this, &ScriptFormWidget::refresh); - split->addWidget(scriptEditor); - split->addWidget(funcNameWidget); - split->setStretchFactor(0, 4); - split->setStretchFactor(1, 1); - split->setContentsMargins(2, 0, 2, 0); - layout->addWidget(split); - - findWidget = new FindWidget(this); - findWidget->setVisible(false); - connect(findWidget, &FindWidget::sigFind, scriptEditor, &ScriptEditor::onFind); - connect(findWidget, &FindWidget::sigReplace, scriptEditor, &ScriptEditor::onReplace); - connect(findWidget, &FindWidget::sigReplaceAll, scriptEditor, &ScriptEditor::onReplaceAll); - layout->addWidget(findWidget); - QHBoxLayout * pBottomLayout = new QHBoxLayout(); - toolTipLabel = new QLabel(tr(""), this); - toolTipLabel->setFixedHeight(23); - connect(scriptEditor, SIGNAL(cursorPositionChanged()), this, SLOT(updateToolTipInfo())); - pBottomLayout->setMargin(2); - pBottomLayout->addWidget(toolTipLabel); - - layout->addLayout(pBottomLayout); - layout->setMargin(0); - layout->setSpacing(0); - layout->setStretch(0, 0); - layout->setStretch(1, 1); - layout->setStretch(2, 0); - layout->setStretch(3, 0); - setLayout(layout); -} - -void ScriptFormWidget::initToolBar() -{ - actionCopy_C = new QAction(QIcon("://ScriptRes/icon/copy.png"), tr("Copy"), this); - actionCut_T = new QAction(QIcon("://ScriptRes/icon/cut.png"), tr("Cut"), this); - actionPaste_P = new QAction(QIcon("://ScriptRes/icon/paste.png"), tr("Paste"), this); - actionUndo_U = new QAction(QIcon("://ScriptRes/icon/undo.png"), tr("Undo"), this); - actionRedo_R = new QAction(QIcon("://ScriptRes/icon/redo.png"), tr("Redo"), this); - actionZoomIn = new QAction(QIcon("://ScriptRes/icon/zoomIn.png"), tr("ZoomIn"), this); - actionZoomOut = new QAction(QIcon("://ScriptRes/icon/zoomOut.png"), tr("ZoomOut"), this); - actionFind_F = new QAction(QIcon("://ScriptRes/icon/find.png"), tr("Find && Replace"), this); - actionFind_F->setShortcut(QKeySequence::Find); - actionFind_F->setCheckable(true); - actionAnalysis = new QAction(QIcon("://ScriptRes/icon/analysis.png"), tr("Script Syntax Check"), this); - actionAnalysis->setShortcut(QKeySequence(tr("F7"))); - connect(actionCopy_C, SIGNAL(triggered()), scriptEditor, SLOT(copy())); - connect(actionCut_T, SIGNAL(triggered()), scriptEditor, SLOT(cut())); - connect(actionPaste_P, SIGNAL(triggered()), scriptEditor, SLOT(paste())); - connect(actionRedo_R, SIGNAL(triggered()), scriptEditor, SLOT(redo())); - connect(actionUndo_U, SIGNAL(triggered()), scriptEditor, SLOT(undo())); - connect(actionZoomOut, SIGNAL(triggered()), scriptEditor, SLOT(zoomIn())); - connect(actionZoomIn, SIGNAL(triggered()), scriptEditor, SLOT(zoomOut())); - connect(actionFind_F, SIGNAL(toggled(bool)), this, SLOT(onFindReplaceText(bool))); - connect(actionAnalysis, SIGNAL(triggered()), this, SLOT(onScriptSyntaxCheck())); - actionUndo_U->setEnabled(false); - actionRedo_R->setEnabled(false); - toolBar = new QToolBar(this); - toolBar->addAction(actionCopy_C); - toolBar->addAction(actionCut_T); - toolBar->addAction(actionPaste_P); - toolBar->addSeparator(); - toolBar->addAction(actionUndo_U); - toolBar->addAction(actionRedo_R); - toolBar->addSeparator(); - toolBar->addAction(actionZoomIn); - toolBar->addAction(actionZoomOut); - toolBar->addSeparator(); - toolBar->addAction(actionFind_F); - toolBar->addSeparator(); - toolBar->addAction(actionAnalysis); -} - -void ScriptFormWidget::setUndoEnable(bool enable) -{ - actionUndo_U->setEnabled(enable); -} - -void ScriptFormWidget::setRedoEnable(bool enable) -{ - actionRedo_R->setEnabled(enable); -} - -void ScriptFormWidget::onFindReplaceText(bool toggled) -{ - findWidget->setVisible(toggled); - if(toggled) - { - if(!scriptEditor->getCurrentSelectText().isEmpty()) - { - findWidget->setFindText(scriptEditor->getCurrentSelectText()); - } - findWidget->setFocus(); - } -} - -void ScriptFormWidget::onScriptSyntaxCheck() -{ - // 文件存在则删除 - QString sLuaFileName = "tmpLuaFile.lua"; - QFile file(sLuaFileName); - if ( file.exists() ) - file.remove(); - - // 打开文件 - bool bRet = file.open( QFile::WriteOnly | QFile::Text ); - if ( bRet == false ) - { - QMessageBox::critical( 0, "Error", "Open temp file [tmpLuaFile.lua] fail" ); - return; - } - - // 脚本内容写入文件并关闭 - file.write( scriptEditor->text().toStdString().c_str() ); - file.close(); - - // 启动luac - QProcess proc; - proc.setReadChannel( QProcess::StandardOutput ); - QStringList arguments; - arguments << sLuaFileName; - proc.start("luac", arguments); - - // 等待进程启动 - if ( !proc.waitForStarted() ) - { - QMessageBox::critical( 0, "Error", "Start luac fail" ); - return; - } - - // 等待进程结束 - proc.waitForFinished(); - - // 读取执行结果 - QByteArray byte = proc.readAllStandardError().data(); - if ( byte.count() > 0 ) - QMessageBox::critical( 0, "Error", byte ); - else - QMessageBox::information( 0, "Info", "Success" ); - - // 删除临时脚本文件 - file.remove(); - - // 删除luac输出的文件 - QFile out("luac.out"); - if ( out.exists() ) - out.remove(); - -// QString strScriptContent = scriptEditor->text(); -// QScriptEngine scriptEngine; -// QScriptValue result = scriptEngine.evaluate(strScriptContent); -// if (result.isError()) -// { -// QMessageBox::critical(this, tr("Syntax Error"), QString("Line : %1\nColumn : %2\n%3 ") -// .arg(result.property("lineNumber").toInt32()) -// .arg(result.property("columnNumber").toInt32()) -// .arg(result.toString())); -// } -// else -// { -// QMessageBox::information(this, tr("Syntax Valid"), tr("The program is correct.")); -// } - -// QMessageBox::information( 0, "提示", "LUA此功能暂未开放" ); -// return; - -// QString strScriptContent = scriptEditor->text(); -// QScriptSyntaxCheckResult result = QScriptEngine::checkSyntax(strScriptContent); -// if(QScriptSyntaxCheckResult::Error == result.state()) -// { -// QMessageBox::warning(this, tr("Warning"), -// QString("Line : %1\nColumn : %2\nError : %3 ") -// .arg(result.errorLineNumber()) -// .arg(result.errorColumnNumber()) -// .arg(result.errorMessage())); -// } -// else if(QScriptSyntaxCheckResult::Intermediate == result.state()) -// { -// QMessageBox::warning(this, tr("Warning"), tr("The program is incomplete.")); -// } -// else if(QScriptSyntaxCheckResult::Valid == result.state()) -// { -// QMessageBox::information(this, tr("Information"), tr("The program is correct.")); -// } -} - -void ScriptFormWidget::updateToolTipInfo() -{ - int row = scriptEditor->textCursor().blockNumber() + 1; - int column = scriptEditor->textCursor().columnNumber() + 1; - toolTipLabel->setText(tr(" Line: %1, Column: %2").arg(row).arg(column)); - updateFuncNames(); -} - -void ScriptFormWidget::onEditFinished() -{ - QString content = scriptEditor->text(); - emit contentTextChange(content); - close(); -} - -void ScriptFormWidget::updateFuncNames() -{ - if(0 != funcNameWidget->count()) - { - funcNameWidget->clear(); - } - QStringList listFuncNames = scriptEditor->getAllFunctions(); - if(!listFuncNames.isEmpty()) - { - funcNameWidget->addItems(listFuncNames); - } -} - -void ScriptFormWidget::refresh() -{ - QListWidgetItem * item = funcNameWidget->currentItem(); - if(item) - { - scriptEditor->refresh(QString("function ") + item->text()); - } -} - -bool ScriptFormWidget::eventFilter(QObject *object, QEvent *event) -{ - if (object == this) - { - if (QEvent::DeactivateControl == event->type()) - { - onEditFinished(); - return true; - } - else if (QEvent::KeyPress == event->type()) - { - if(Qt::Key_Escape == ((QKeyEvent*)event)->key()) - { - if(actionFind_F->isChecked()) - { - actionFind_F->toggle(); - } - return true; - } - } - } - return QWidget::eventFilter(object, event); -} - -ScriptForm::ScriptForm(QWidget *parent) : - QDialog(parent, Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint) -{ - m_pScript = new ScriptFormWidget(this); - QHBoxLayout* hLayout = new QHBoxLayout; - hLayout->addWidget(m_pScript); - hLayout->setMargin(0); - setLayout(hLayout); - resize(QApplication::desktop()->size() / 2); -} - -ScriptForm::~ScriptForm() -{ - delete m_pScript; - m_pScript = nullptr; -} - -QString ScriptForm::contentText() const -{ - return m_pScript->contentText(); -} - -void ScriptForm::setContentText(const QString &value) -{ - if(nullptr != m_pScript) - { - m_pScript->setContentText(value); - } -} diff --git a/platform/src/tools/ScriptForm/ScriptForm.pro b/platform/src/tools/ScriptForm/ScriptForm.pro deleted file mode 100644 index b73433f6..00000000 --- a/platform/src/tools/ScriptForm/ScriptForm.pro +++ /dev/null @@ -1,31 +0,0 @@ -QT += widgets printsupport script - -TARGET = ScriptForm_lua -TEMPLATE = lib -DEFINES += SCRIPTFORM_LIBRARY - -HEADERS += \ - $$PWD/../../include/tools/ScriptForm/ScriptForm_global.h \ - $$PWD/Highlighter.h \ - $$PWD/ScriptEditor.h \ - $$PWD/../../include/tools/ScriptForm/ScriptForm.h \ - $$PWD/FindWidget.h - -SOURCES += \ - $$PWD/Highlighter.cpp \ - $$PWD/ScriptEditor.cpp \ - $$PWD/ScriptForm.cpp \ - $$PWD/FindWidget.cpp - -RESOURCES += \ - $$PWD/ScriptForm.qrc - -FORMS += \ - $$PWD/FindWidget.ui - -COMMON_PRI=$$PWD/../../common.pri -exists($$COMMON_PRI) { - include($$COMMON_PRI) -}else { - error("FATAL error: can not find common.pri") -} diff --git a/platform/src/tools/ScriptForm/ScriptForm.qrc b/platform/src/tools/ScriptForm/ScriptForm.qrc deleted file mode 100644 index 1fd90a93..00000000 --- a/platform/src/tools/ScriptForm/ScriptForm.qrc +++ /dev/null @@ -1,14 +0,0 @@ - - - ScriptRes/icon/analysis.png - ScriptRes/icon/copy.png - ScriptRes/icon/cut.png - ScriptRes/icon/find.png - ScriptRes/icon/paste.png - ScriptRes/icon/redo.png - ScriptRes/icon/undo.png - ScriptRes/icon/zoomIn.png - ScriptRes/icon/zoomOut.png - ScriptRes/complete - - diff --git a/platform/src/tools/ScriptForm/ScriptRes/complete b/platform/src/tools/ScriptForm/ScriptRes/complete deleted file mode 100644 index 60a77386..00000000 --- a/platform/src/tools/ScriptForm/ScriptRes/complete +++ /dev/null @@ -1,1453 +0,0 @@ -able -about -above -absence -absolutely -abstract -access -according -accumulated -achieve -achieving -activity -acts -actual -actually -add -added -adding -addition -additionally -additions -addresses -adjust -adjustments -advanced -advice -after -afterwards -again -agenda -aim -algorithm -all -allocated -allow -allowed -allowing -allows -along -alpha -already -also -alternative -alternatively -although -American -an -and -announced -annoy -another -answer -answers -any -anything -anyway -apart -API -appear -appears -appendices -appendix -appends -application -applications -apply -approach -approaches -appropriate -Arabic -arbitrary -are -areas -ARGB -argument -arguments -around -arrangements -arrive -arrived -Arthur -article -articles -as -asked -aspects -assume -at -attachment -attempt -attempting -attend -attendees -attributes -authors -availability -available -avoid -away -back -background -backgrounds -bandwidth -bandwidths -Barcelona -base -based -basic -basically -basics -be -because -been -before -behave -behavior -behind -being -below -benefits -Berkeley -between -bit -bits -bitwise -black -blended -blending -blends -block -blue -BMP -body -bold -booking -bool -Boston -both -bottom -box -boxes -braces -break -breaks -broad -browsers -buffer -buffers -build -builds -built -bundled -burdens -busy -but -by -bypass -bypassing -bytes -calendar -call -called -calling -calls -Cambridge -can -canonical -canonicalised -cap -capabilities -capacity -caption -card -care -case -cast -catch -causing -centre -certain -challenges -chance -change -changes -changing -channel -channels -chapter -char -chart -charts -check -checks -Chicago -chosen -chunk -circle -citation -city -claim -class -classes -clause -clauses -clear -clearing -client -clients -close -closed -code -colon -color -colorize -colorizer -colors -colour -column -columns -combine -combined -combines -combining -comes -command -commands -comment -common -communicate -community -compiled -complement -complete -completely -completeness -completes -completion -complex -compliant -component -components -compositing -composition -compression -computation -computer -concepts -conclusion -concurrent -configurable -congested -congestion -connect -connected -connection -connections -cons -consider -consisting -consists -construct -constructed -constructing -constructor -constructs -consume -contact -contain -containing -contains -contents -contents -continue -continued -contributors -control -controlled -controller -controller -controlling -controls -controls -conventions -cook -cooperation -copy -copyright -core -cores -corollary -correct -correctly -corresponding -could -couple -coworkers -CPU -create -creates -creating -crucial -cultures -current -currently -custom -customized -cut -data -database -datasets -datum -day -days -deal -dealing -decide -decouple -decoupled -deeply -def -default -define -defines -definition -definitions -delegate -delete -demo -demonstrate -demonstrations -deployed -describe -describes -design -desktop -desktops -destination -destinations -destructor -details -detect -determine -determines -developer -developers -development -developments -device -devices -diagram -dialogs -dictionary -did -difference -differences -different -differs -digital -direct -direct -directions -directly -directory -discuss -display -displaying -displays -distribute -distribution -disturbing -divide -do -documentation -documents -does -done -down -downLimit -download -downloaded -downloading -draw -drawing -drawn -drop -Duff -during -DVD -dynamic -dynamically -dynamics -each -earlier -easily -editing -editors -education -effect -effectively -effects -either -ellipse -ellipses -elliptical -else -email -embedded -emit -emits -empty -enable -enables -encapsulates -enclose -end -endnote -endnotes -engineer -engineering -English -enjoys -enough -ensure -ensures -entails -enter -entire -entitled -entries -entry -environment -erases -error -errors -especially -established -etc. -Europe -even -evenly -event -events -eventually -every -everyone -example -examples -except -exception -excessive -exclusive -existing -exists -expand -expected -expense -export -exposes -extend -extended -extending -extensible -extension -external -extra -extract -faces -facilities -factory -fade -failure -fairness -falls -false -family -fashion -fast -faster -features -February -feedback -feel -fetch -fetching -few -fields -figure -figures -file -file name -files -filled -filler -final -finally -find -fine -finish -finished -first -flow -fly -focus -followed -following -font -foot -footnote -footnotes -for -form -format -formats -forms -formula -formulas -forum -found -framework -France -from -front -full -fully -function -functionality -functions -future -gain -games -gap -general -generic -Germany -get -gill -give -given -gives -giving -global -go -goes -got -gradient -graph -graphical -graphics -gray -great -greatly -green -grey -group -growing -gui -GUI -hack -had -half -Hamburg -hand -handing -handle -handler -handlers -handles -handling -happens -hardware -harmonica -has -have -having -he -head -header -headers -hear -height -help -helper -here -high -highlight -highly -hints -his -hold -holder -holding -hole -home -horizontal -host -hosting -hours -Houston -how -however -huge -hyphen -ID -idea -ideally -if -Illinois -illustrate -illustrated -illustrates -image -images -impact -implement -implementation -implementations -implemented -implementing -implements -import -important -improvements -in -include -included -includes -including -inclusion -incoming -inconvenient -indent -index -indicate -inexpensively -influence -info -information -ingenious -inherits -initial -initially -inner -input -inspired -install -installs -instance -instead -instructs -integer -integers -integration -intended -intensive -interest -interests -interface -interfaces -interfere -internal -interval -into -intriguing -intro -introduce -introduced -invalid -invented -inverse -invocation -involved -Irish -irregular -is -ISO -ISPs -issue -issues -it -items -iterate -its -itself -job -join -JPEG -jungle -just -Karaoke -keep -keeping -key -kind -king -known -label -labels -landscape -language -large -last -later -latest -lawn -layout -lead -leader -leaders -lean -leaves -leaving -left -lemma -length -less -let -level -levels -libraries -library -lies -like -likely -limit -limiting -limits -line -linear -lines -linewidth -link -linked -linking -Linux -list -lists -little -lives -load -loading -loads -located -location -locations -logo -long -longer -look -looked -looking -looks -lookup -lookups -loop -lout -low -macro -made -magazine -magic -main -major -make -makes -making -manage -managed -managing -mandatory -manipulate -manipulation -manner -many -map -maps -March -margin -mask -masking -Massachusetts -match -mathematical -maximum -may -means -meet -member -members -memory -merged -method -might -milliseconds -minimize -minimum -minor -mix -MNG -mode -model -models -modes -modified -module -moments -monitored -monthly -more -most -mostly -move -much -multitude -Munich -must -name -named -names -necessary -need -needed -needs -network -new -news -newsletter -next -nicely -no -none -normally -Norway -not -note -notes -nothing -notifies -notify -now -null -number -numbered -numbering -numbers -Nydalen -object -objects -obtain -obtaining -odd -of -off -office -offset -offsets -often -old -on -once -one -ones -online -only -onto -opacity -opaque -open -opens -operates -operating -operation -operations -operator -opportunity -opposed -optimize -option -optionally -options -or -OR -order -ordinary -original -originally -Oslo -other -otherwise -our -out -outer -outgoing -output -outside -over -overcoming -overrides -overview -own -owner -owners -pace -Pacific -package -packages -packets -page -pages -paint -painted -painting -paragraph -paragraphs -parameters -parent -Paris -parse -part -partial -partially -particular -partners -parts -party -passed -passing -patches -path -pattern -patterns -pause -PDF -peek -pending -perform -performed -performs -permission -permutations -personal -pick -pie -pipe -pixel -pixels -place -places -planning -platforms -play -players -playing -please -pleasing -plugin -plugins -plus -PNG -pointer -pop -popular -populates -porter -Porter -portrait -possibility -possible -potential -potentially -power -powers -preceded -presence -present -prevent -prevents -previous -previously -primarily -primary -primitives -printed -printing -prior -probably -problem -process -processes -processing -produce -produced -produces -products -programming -programs -project -projects -proof -proper -properly -properties -property -proposed -proposition -pros -protocols -proud -provide -provided -provides -provision -proxy -public -published -punch -punches -pursuing -put -Qt -Qtopia -quality -quarter -quarterly -queried -queries -query -question -questions -radial -ragged -range -rate -rates -rather -ratio -raw -read -reader -reading -reads -ready -real -realistic -really -received -recent -recognized -recommended -recompile -rectangle -rectangular -red -redistribute -reducing -reference -references -reflect -regardless -regional -register -registered -registration -reimplement -reimplementation -reimplemented -release -released -releases -reliable -rely -remains -remember -removed -removes -repeatedly -replace -report -represent -represented -represents -reproduced -requested -require -required -requires -resetting -resides -resolve -respective -respectively -response -rest -restart -result -resulting -resume -return -returning -returns -reuse -revealing -rich -riches -right -roadshow -role -Roman -router -routers -rule -run -runner -runners -running -runs -sake -sales -salespeople -same -sample -San Jose -save -saved -saves -say -scalable -scale -scanline -scene -scenes -schedule -school -script -seam -seamless -search -searches -searching -second -seconds -section -sections -security -see -seen -selection -seminar -seminars -sending -separated -separates -series -service -services -set -setting -setup -seven -seventh -several -shade -shadow -shape -shares -shaves -shine -shorter -should -show -shown -shows -side -signal -signals -signature -significantly -similar -similarily -similarly -simple -simplest -simplified -simplifying -simply -simulate -simultaneous -since -single -size -sizes -slightly -slope -slot -slowing -small -smaller -so -socket -sockets -software -solutions -solved -some -soon -sort -sorting -source -sources -south -space -special -specialized -specific -specifically -specification -specifications -specified -specify -speed -spend -split -SQL -standard -standards -start -starts -starve -state -states -static -steady -stealing -step -still -stop -stopwatch -store -stored -stores -straightforward -stream -string -strings -structure -structured -strut -style -styles -styling -subclass -subclassing -subdirectory -subsection -subsections -succeeds -success -successful -successfully -such -suggestion -suggestions -suitable -support -supported -supports -suppose -supposes -sure -switch -switches -symbol -symbols -synonyms -system -systems -table -tables -tags -take -takes -tap -target -targets -TCP -team -technique -technology -template -templates -Texas -text -than -that -the -their -them -then -theorem -there -these -they -thickness -thin -third -this -those -three -throttling -through -tightly -time -timer -times -tiny -tips -title -titles -to -together -too -top -torrent -total -tour -trademarks -traffic -training -transaction -transfer -transferred -transferring -transfers -translucency -translucent -transparency -transparent -travel -traveled -true -try -turn -twice -two -type -typed -typical -typically -unable -under -underlying -understanding -undoes -unique -united -unlike -unpack -unsigned -until -untouched -up -update -updated -updates -upload -uploading -uploads -us -use -used -useful -user -users -uses -using -usual -usually -valid -value -values -variable -variation -variety -various -vector -venturing -verifying -versa -version -versions -vertical -very -via -vice -virtual -visual -void -VP -waiting -Wales -want -wants -was -way -ways -we -web -website -well -were -what -when -whenever -where -whether -which -while -whistle -white -who -whole -why -widget -widgets -width -widths -will -window -windows -wish -with -without -word -words -work -working -works -would -wrap -wrapper -write -writes -writing -writings -written -X -X11 -XOR -year -years -yes -you -your -zero diff --git a/platform/src/tools/ScriptForm/ScriptRes/icon/analysis.png b/platform/src/tools/ScriptForm/ScriptRes/icon/analysis.png deleted file mode 100644 index 8839d3bdf9f65f6f8f6bfdbe8f4f7aed08137c7f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 802 zcmV+-1Ks?IP)2#pAPNOI~R7%~l7Jy*m z^Jc1}C~EOTw)7HFnAhqWiS6C)k26q@N6U-wA1OR)oQiBTrRI4 zA0L0`LkFJc^?>KJJC1X2YFfcrmIVM%uh&aWp|yVEc9JCBG)+$#UaQp_JjNQVX$5oY zik}Rxl-r}xNB}?>hB}9|0AR6LtY3;XiUnsQxGeJYj>9n2oN68m!%*++?0f@&>2x}% zqE`vbPyh!2U_yE2+%~u2t$4Fm=Y~00E|=Fyl5{z}28f8L@g68pSTQ?MO4;S#*f8_? zJOzN8n;QaNu6z@eHCWRMc3pRzL)Kt6jOTeltJOMfx7%#IJJWE*U=7x^f-f#E2Eelu zec$f`Ys1_rrP{l@yT5WHt&7DbQQ!Cb>}I9Z=6X;(B%&x9^D)R(r|4vxk<98Rgh=8z z4l03($nA7Gf4Og~*EVSWf?vzd=2xGS);eo8o8P&wl)B}#+rsz#z6k{YDP^e#wsH|L zqby@vx%x;c8|Laa!L4A9D2iG_i2i#nd&T`O!YhG48bvr4A7IP(>Nt*5z77c?ewbrh gU9m0xzrQg504j{jR@@TGHUIzs07*qoM6N<$f*gTx{{R30 diff --git a/platform/src/tools/ScriptForm/ScriptRes/icon/copy.png b/platform/src/tools/ScriptForm/ScriptRes/icon/copy.png deleted file mode 100644 index ea5957fec249ade4f324899e69f95668c44a5a45..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 360 zcmV-u0hj)XP)B00038Nklg=yyDl_ekL5 zjzm?3B@`_}T@w6s9bo37ZQE@~(xz$fuQiWzn#U&9$=_9F5e4E8k~GoM^@|F2}O z;1#@rXOpvXA!5qRMc?-}j^q1*MT7ugnp%Edt6$~)wq6P?xk;BqgH^9iRg|10000!F=*RZ7{~uF1Wyq} zfk@i&psh!G1v)$92-QCEuh^`t<$ueeeIiCz7TqeuT~a5bC1@Tb7ktmUZuS`l^bT zmX==M_g(Vn#AR7ly0x`c{qA4@n4h12`pv5lh2LsEp{22h^IDTT=b_oCoA%~pve@7oyisSf6Hugcl zuIqkM6y+EIIOlH(A&bCpI}t(_Ip=QyKv9%q*L6S5l5>8RAOL7KniIeJR1xKe^0t*j1^4N8J zb$#Ww{I{<0_V)Jv`T6;;*?Wqj9G{(?{XRE0_fPiz_4V~Hnx_3BS}$yQdHMbR{{HsN zVAC|$2qA|6kk9AeU0q$#@uatzqA14;3ky*Y1UtZRv^E-zqw%k)!J#b zT05DKZF-)!H>&co-|ts|q56x(;+v^pUDsDSoz6?)UtC;7;+ip5h~xN~s4NV_(=ZHA zMJM7oewGzr_T5gW^Kx8hQ@0Z#9ccDsKb92|U@2`p@5W24;dcK;H7KA->3b={vQ z#WKd)K@j{Td`Xgavx8;arncJm{c5}2rmCunGqyA(yaWKMs(x;_+jJTfc#MCUj~4tt XaEo?&@S`XO00000NkvXXu0mjfkOHtp diff --git a/platform/src/tools/ScriptForm/ScriptRes/icon/find.png b/platform/src/tools/ScriptForm/ScriptRes/icon/find.png deleted file mode 100644 index 85d74a1c30d3b057ec1ae2fce94b877bceb358c1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 694 zcmV;n0!jUeP)82xe{SP2;n z1RTij+1O?~yYnZ^HsVz4Rw+04OD=7yGnHa<=~HaBv)gTLa+|_b2`-3*h2)BjFizBU z10e_ZAmA`B@A=Kl_cH11_j|YmzFfrhlEz=#kO(10zu&jBEHk1gx?<-r#%oa&mvJ0V zeBXa*YusttV_ny;HBECio6Yw&Vv3?Xg<)t1LGXIA@n|$6tJUgvF~%6L^E{s?Nit`7 zk|Ys95D2>xs;b^jr_&Ozl`(JH>-B!Pt~+TGqLhxe+wIS`=10c5u3t-%^rsjjgl^jI zooSlGIF6r-agrq8>X!ZJRBM{%oMH+9;QRgyLg=PSi$|$q_KoY7mk?sGoJ z*S&nHVua8b;Qb&~nOc@*r)m1gek{wfd7kUK6O8ei)#Op?<1EVz0DwHtD-VU|c@Cwt zD+ogOzQCezI6qf)1f*_D8a@%%d zH4050r2rv>7-^b50@McxrF6`-Qzhr406EI)ySuw(@iX|@$OI^-pQ0#Fv)Rn3;vJpp zFbwVDIgaCJ(=>;tnDSa58V5n}s;cTOYfdSxj6D{V(lKia05BK~x^?`sTm)FO-eVT0 zUVR3GL6@z*%DmCIfN7dTgwXgimpy*JdGl7rr-C}w-QNjzyUU)N9YY6JwbbfClE+HqSRsQ5mb;sf z8c5T$NL5w533!fzAcz3K+7!ID;Y3k6M7Gtcwqss0$_w>XaPSA!{~ z`J9F`O*3cNuA|hg#+t3KnYy~JjKeTINs{Cb*rQ(oOOkXD1VJCL`v5QqUj!BeK_6LT z004h;a8VR~6P#%ui?IltBuUh_#&h=gBCx8ePmEHJUI1D#x09kMUxW}#)3n2q$&HDb zaU92Y0C4OpX>&MOn}X}Qj$~Q>XuqqfVxG5~f*r>>0l?{ej1Xb~03d|0VHo<<;22}( vjbv7HHNUv`ss3eIGHtt^)#(2T^H=%?x!!!t1s%$_00000NkvXXu0mjfT{*m1 diff --git a/platform/src/tools/ScriptForm/ScriptRes/icon/redo.png b/platform/src/tools/ScriptForm/ScriptRes/icon/redo.png deleted file mode 100644 index 01107cccc7aedffe04ab2850615b380c0a04ca26..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 457 zcmV;)0XF`LP)Lv5^M|pnyAmAnum|&^2^- z73#kLTWevh1v3{h_V+oUyxFc)XNZVML^@_J0rWv909if}fl>-eDToM&s0i6-1E<2X zf>Yqx!Le|TX&}7WuH^CiJvHf!F^98rt^)9NxHAN{)?(;f1WKTW-gRcT{a>S zX|0d`C*V1#E1w_m^7Ii48Q-C`rn;_qXfx?tV~4hFITb1*LFfd`%+)!E7^u&S;2pyh zPw709x+E&bWfZbMIV8^Z+TXr(uUT-@H0xOCSg|3>GMxbQ%v_2{7n>KeU=evGqNK#y zhbG$Rwl)xB%u#7A4tCC!{wyM&v1`o5U;w@Esm2(;##BpyXQ$J6Drv2KiR}RF76Z@0 zLvqfo0lcMvPiA#p*F21QZbfY%OX#-h_%HMWz|ufRio9Ka00000NkvXXu0mjfg*LrL diff --git a/platform/src/tools/ScriptForm/ScriptRes/icon/undo.png b/platform/src/tools/ScriptForm/ScriptRes/icon/undo.png deleted file mode 100644 index f618e2de80ec67afb5002f1b038c05cd6f5ad3ad..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 437 zcmV;m0ZRUfP)ecU zNjJ&Ec?$f%Xs!fXAa#^xgJgs2ONsD*r-eG7gk%H0pM7w5n5v3Bbl8RZ@?erx(=_V6 z&$ceBV3L)H+yJ2KI^=>cf>S5}SZiU7VNq~N=q$K2bQ1g@Pyk?>KuDfMA7^IFB~0wP@RRWMc%*0Uz3! za{DB>1U!WBuBz8KHk&|v-*)`%1?aQ|4dcs(O#lr`}ryPr|dvu1Y=a>R~Ef(o$(G;%aLxLJ0LzJubGn f*7Vwc5+(EvF*Fo-?^xf400000NkvXXu0mjf+I_fb diff --git a/platform/src/tools/ScriptForm/ScriptRes/icon/zoomIn.png b/platform/src/tools/ScriptForm/ScriptRes/icon/zoomIn.png deleted file mode 100644 index 74b820768d0fa2fbb19653e6b1a1ef7fd946372a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 617 zcmV-v0+#)WP)G>D&l{y~V7+aU5C6Ovu9i zRfHe^hxDF)6r*ihxQEQUQ11!0bczshX4^J4O*1Qsf^@%8N=wr;H$sRN=loq4Y^Zu1 zh9PxbmzQPvq+>=1+17Q9S(X)7gQF;#=Xw5Ht|_Hu+qSQV!{N1CXIa+VFpPQkB!VD# zPLkxPP7BHryA9C$^-lJ~s5OG>n)tg*TCX*lM zj{Rh+UDxH;Kmh-B7??qsU#x<>iCs;akhkv9hI zdyRs#EGvQ_c<#b=j-4?UccB0Pj^jL>tG~%ZpsRE3y2;bWah!+l?uXz?uoNOrZQG77 zdF=K3-G^&|ua#=TZ<^KeMM4PK0>I@*eGC16e_{Rr&3Qr;%#GKx00000NkvXXu0mjf DMztCP diff --git a/platform/src/tools/ScriptForm/ScriptRes/icon/zoomOut.png b/platform/src/tools/ScriptForm/ScriptRes/icon/zoomOut.png deleted file mode 100644 index 996bcf4225eb91b08a33fe35cc8bcdc974477855..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 646 zcmV;10(t$3P)W*yj(%sOuW;A@eTOdx9;UMTj`IZ5ykq8t?ae(ww7|W~OOw%CcNYDR;VHV<^U9 z7*f}DWtL@6I%b5B?eTcTBuVyHgM|>&G);f2F{L!C>-z0EUqrqsE@+J?h2|5rd*A-qmTQtmv@d+hQW1S4Xg63O@ddEZXcG<`|a^rdS~O1blWe+~eU zW!V!V1{cA$ZO;Hc66sP*hZM*0f>N3_JqN*6RgD1v>bf4xNF6B;=MqB5zIaY1le3awjIE+5LY)`;xxM;x2iSb3cDi1#jcdVYJ64%!S=RJgLnY;* zJO{z1X>I@j48!u@z%%)isBRf%;ewLbiR~@8^6Zk|fzP#-7!=m_listInPort.count() ) + return ""; return m_listInPort[nIndex].name(); } QString CBlock::getOutPortName( int nIndex ) { + if ( nIndex<0 || nIndex>=m_listOutPort.count() ) + return ""; return m_listOutPort[nIndex].name(); } @@ -216,13 +318,14 @@ QString CBlock::getInPortShowName( int nIndex ) { if ( nIndex<0 || nIndex>=m_listInPort.count() ) return ""; - QString sName = m_listInPort[nIndex].name(); return getInPortShowName( sName ); } void CBlock::setInPortShowName( int nIndex, QString sShowName ) { + if ( nIndex<0 || nIndex>=m_listInPort.count() ) + return; QString sName = m_listInPort[nIndex].name(); setInPortShowName( sName, sShowName ); } @@ -246,13 +349,14 @@ QString CBlock::getOutPortShowName( int nIndex ) { if ( nIndex<0 || nIndex>=m_listOutPort.count() ) return ""; - QString sName = m_listOutPort[nIndex].name(); return getOutPortShowName( sName ); } void CBlock::setOutPortShowName( int nIndex, QString sShowName ) { + if ( nIndex<0 || nIndex>=m_listOutPort.count() ) + return; QString sName = m_listOutPort[nIndex].name(); setOutPortShowName( sName, sShowName ); } @@ -298,21 +402,29 @@ int CBlock::getOutPortSize() EPortDataType CBlock::getInPortDataType( int nIndex ) { + if ( nIndex<0 || nIndex>=m_listInPort.count() ) + return E_PORTDATA_INT; return m_listInPort[nIndex].dataType(); } void CBlock::setInPortDataType( int nIndex, EPortDataType eType ) { + if ( nIndex<0 || nIndex>=m_listInPort.count() ) + return; m_listInPort[nIndex].setDataType( eType ); } EPortDataType CBlock::getOutPortDataType( int nIndex ) { + if ( nIndex<0 || nIndex>=m_listOutPort.count() ) + return E_PORTDATA_INT; return m_listOutPort[nIndex].dataType(); } void CBlock::setOutPortDataType( int nIndex, EPortDataType eType ) { + if ( nIndex<0 || nIndex>=m_listOutPort.count() ) + return; m_listOutPort[nIndex].setDataType( eType ); } @@ -405,31 +517,43 @@ void CBlock::setDiagram( QObject* pDiagram ) void CBlock::setInPortValue( int nIndex, QString sValue ) { + if ( nIndex<0 || nIndex>=m_listInPort.count() ) + return; m_listInPort[nIndex].setValue( sValue ); } QString CBlock::getInPortValue(int nIndex) { + if ( nIndex<0 || nIndex>=m_listInPort.count() ) + return ""; return m_listInPort[nIndex].value(); } void CBlock::setOutPortValue( int nIndex, QString sValue ) { + if ( nIndex<0 || nIndex>=m_listOutPort.count() ) + return; m_listOutPort[nIndex].setValue( sValue ); } QString CBlock::getOutPortValue(int nIndex) { + if ( nIndex<0 || nIndex>=m_listOutPort.count() ) + return ""; return m_listOutPort[nIndex].value(); } int CBlock::getOutPortStatus(int nIndex) { + if ( nIndex<0 || nIndex>=m_listOutPort.count() ) + return 0; return m_listOutPort[nIndex].status(); } void CBlock::setOutPortStatus( int nIndex, EDataStatusType eStatus ) { + if ( nIndex<0 || nIndex>=m_listOutPort.count() ) + return; m_listOutPort[nIndex].setStatus( eStatus ); } diff --git a/platform/src/tools/fbd_designer/fbd_designer.pro b/platform/src/tools/fbd_designer/fbd_designer.pro index 74b8a9fc..3025e331 100644 --- a/platform/src/tools/fbd_designer/fbd_designer.pro +++ b/platform/src/tools/fbd_designer/fbd_designer.pro @@ -14,5 +14,5 @@ SUBDIRS += \ fbd_designer \ TRANSLATIONS += \ - fbd_editor_en.ts \ - fbd_editor_zh.ts + platform_en.ts \ + platform_fr.ts diff --git a/platform/src/tools/fbd_designer/fbd_designer/fbd_designer.ico b/platform/src/tools/fbd_designer/fbd_designer/fbd_designer.ico index 594c9bca5084b5f1246e04891a83da7b4b6c4746..b785b08c6280e6aff81ceac767964f3d4fd8cd6c 100644 GIT binary patch literal 4742 zcmcInO-NKx6h5Y)P+(+~prl}e;G%_rLP3Fx0v9b>v}obNMT-^&Eeu@v@QoU@2$7I5 zaM7Z`sD+Cb5+g|nsYuO?qfO>tR3@U3HG)64@4GWsUel=Wjn6yWIq#iw?svX>?(Y-H z!ms>{;J;MvoDexBA{D6Rs25SGXSoVn!O=w3iVXgOmgI%nq%Itgo=`wSAzN1PtWe{q zv9K+D&^1m4q$mS;Pfe0s8WHn*k^_0{TETY%_TGtrlz0l1;>@_fsYf1~Cy)!g=g{T7 zC56zB@5NzPn=QX4Y-w#$c@J`;zapIiHd5GWg6mv7s9v&m`BV)8_Fx#{Llp z`5SPyMT`Z;c5*S#@C(v+?!|SrJld^3KdCa~(m@~et;vby>DiVhVno`ch3#UGE7kH? zx0-)>L&pHmVcMN#+>+z;o$M@D+glroWqm1X{72}^e0$>IoNH*SF#<9|3}Txy)m5V7 zMBAmn$thyVG0o{=q1xJrYxnqKNc%!RL|@LYOgXVFF_;fx{P{MbV=&faXOZH1U|#6s zEXeCC`cL;(s~>Ng)Kpig=7jm#NI%#*GUbH%(n1VyYa|B8V=>sQWAUAHjP}$5o~5w= zv$i6(JmuWfd33o4q~(paoZrO4Uh*u(XZ(XD#i@MEyN=%`wP;fxX_ZRqsY5??4pXqq z*t(L$AQmyBtx^>U$W4q*E#JMA@O?Rlyao@#C8g~U`daOUgYgAUKl-(hg6Aq9F5Aq6 zTjhd@=SBi|#U*yeJTZ3H+;A~I;1fG+PT_Wsd9vm8VROQHciQB@jZB`88IQ|;{lU5k zx#8jTN$ypL#);>iGoIULv#;;hXU}$9;$J+Do8kP?k_yD*-O<;4abB1hnMj-ixA)?N zJ&b!s4`c(*p<9?I-AUbU{Ro=9JQF^q4aYt$FI)Ok?-y*t^BuhYJBz?K>UFId4(TNF z)dWo5uM_>pUcvsd>Rf^!Y}`NUcl0<5j6ZTXFlx!kbl3;cMcSnrF~-RadC+%N@aZ#g zcO-O-qt~u2OXTdwc Ya_vZh_hxo_xt*KPtKOua68tK*szO{6 zLRydT)N13^~stPMliG zHFr5ZJLm4obvcHgIy0xA`TTHhYx^&*lS2cscJkCe553&!yR#gtfS)=(pUrptom&`D z`wJt~g{W}e!bsZ1JezSpw9tzKeiOAS`v2JZXK7Lyli_d{yWzkEz!37%_e?l*5zO=Q!l}HOE(l z-paUYt&9`n_d+>5X?>1Ej$dMW+N3&Mo1~H`+<)}`P911KB@p|cKj%ju?nXeKlLQ_aI6m)O@PCBR z^Yp46f4nCF8DuZFAHCyG_az`h`S-6+$>a4YGL(LQJ9{7j8OpzZV_LR1rpZwL{hKqg zy*WdM((gandKd#T#G=G?^0}S?^2o|~gp)6iVnAJp`~3`^#$yG@(8SKzT=o6_?OD~? zo+X3C&e**F_wUSQot-%{XzYy5vwpvS`ub!DXh0rZ`!C-uXT1md_H+p3fD9b})7`u6 z(cPt1ZD~MP(m`Dr6uKe?bS-_;s(t^_S^U`x{IW0PLR_TIBK4$IBVu%g=-2A$&Ut&3 F{s2?XeTx79 diff --git a/platform/src/tools/fbd_designer/fbd_designer/fbd_designer.pro b/platform/src/tools/fbd_designer/fbd_designer/fbd_designer.pro index 655d8968..57c700b3 100644 --- a/platform/src/tools/fbd_designer/fbd_designer/fbd_designer.pro +++ b/platform/src/tools/fbd_designer/fbd_designer/fbd_designer.pro @@ -28,6 +28,8 @@ LIBS += \ -lnet_msg_bus_api \ -lfbd_editor \ -lsys_login_api \ + -lpub_utility_api \ + -lpub_widget RESOURCES += \ fbd_designer.qrc diff --git a/platform/src/tools/fbd_designer/fbd_designer/main.cpp b/platform/src/tools/fbd_designer/fbd_designer/main.cpp index b9981563..3d35cd49 100644 --- a/platform/src/tools/fbd_designer/fbd_designer/main.cpp +++ b/platform/src/tools/fbd_designer/fbd_designer/main.cpp @@ -1,10 +1,14 @@ - +#include #include #include "common/QtAppGlobalSet.h" #include "pub_logger_api/logger.h" #include "net_msg_bus_api/MsgBusApi.h" #include "sys_login_api/CLoginDlg.h" #include "CFBDMainWindow.h" +#include "pub_utility_api/FileUtil.h" +#include "pub_utility_api/I18N.h" +#include "pub_utility_api/FileStyle.h" +#include "pub_widget/PubWidgetInit.h" using namespace iot_public; using namespace iot_net; @@ -15,6 +19,60 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); + // 加载语言翻译文件 + const std::string strLanguage = std::move( iot_public::getCurLanguage()); + std::string strQmFile = + std::move( iot_public::CFileUtil::getPathOfResFile( "fbd_editor/translate/product_" + strLanguage + ".qm" )); + if ( !strQmFile.empty()) + { + auto *pTrans = new QTranslator; + pTrans->load( strQmFile.c_str()); + QApplication::installTranslator( pTrans ); + } + + strQmFile = + std::move( iot_public::CFileUtil::getPathOfResFile( "fbd_editor/translate/platform_" + strLanguage + ".qm" )); + if ( !strQmFile.empty()) + { + auto *pTrans = new QTranslator; + pTrans->load( strQmFile.c_str()); + QApplication::installTranslator( pTrans ); + } + iot_public::installTranslator(strLanguage); + + + { + QString qss = QString(); + std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss", + "zh", + "light"); + + QFile qssfile1(QString::fromStdString(strFullPath)); + qssfile1.open(QFile::ReadOnly); + if (qssfile1.isOpen()) + { + qss += QLatin1String(qssfile1.readAll()); + qssfile1.close(); + } + + strFullPath = iot_public::CFileStyle::getPathOfStyleFile("fbd_designer.qss", + "zh", + "light"); + + QFile qssfile2(QString::fromStdString(strFullPath)); + qssfile2.open(QFile::ReadOnly); + if (qssfile2.isOpen()) + { + qss += QLatin1String(qssfile2.readAll()); + qssfile2.close(); + } + + if (!qss.isEmpty()) + { + qApp->setStyleSheet(qss); + } + } + // 初始化日志库 StartLogSystem( "BASE", "fbd_designer" ); @@ -33,10 +91,13 @@ int main(int argc, char *argv[]) // 主界面 CFBDMainWindow w; + w.setWindowTitle(QObject::tr("逻辑编程工具")); + w.setAutoLayout(true); + w.slotSetEditPermission( !nRet ); w.setWindowIcon( QIcon(":fbd_designer.ico") ); w.slotInit(); - w.show(); + w.showMaximized(); nRet = a.exec(); } diff --git a/platform/src/tools/fbd_designer/fbd_diagram/CDiagram.cpp b/platform/src/tools/fbd_designer/fbd_diagram/CDiagram.cpp index 44550418..30c95768 100644 --- a/platform/src/tools/fbd_designer/fbd_diagram/CDiagram.cpp +++ b/platform/src/tools/fbd_designer/fbd_diagram/CDiagram.cpp @@ -13,6 +13,7 @@ #include "pub_logger_api/logger.h" #include "MessageChannel.h" #include "FBD.pb.h" +#include "pub_widget/MessageBox.h" #ifdef WIN32 #include @@ -236,7 +237,7 @@ void CDiagram::addConnection(CConnection *conn, bool bSendSignal) { if (bSendSignal) { - QMessageBox::critical(NULL, tr("错误"), tr("一个输入不能连入多个输出!")); + N_MessageBox::critical(NULL, tr("错误"), tr("一个输入不能连入多个输出!")); } } } @@ -367,7 +368,7 @@ void CDiagram::fromXML( const QByteArray& byXml, const bool bTemplate ) bool statusOK = xmlContent.setContent(byXml, true, &sErrorStr, &nErrorLine, &nErrorColumn); if ( !statusOK ) { - QMessageBox::critical(0, "DOM Parser", QString("Could not read or find the contents document. Error at line %1, column %2:\n%3") + N_MessageBox::critical(0, "DOM Parser", QString("Could not read or find the contents document. Error at line %1, column %2:\n%3") .arg(nErrorLine).arg(nErrorColumn).arg(sErrorStr) ); return; } @@ -381,7 +382,7 @@ void CDiagram::fromXML( const QByteArray& byXml, const bool bTemplate ) CBlock *pBlock = CPluginManager::getInstance()->createBlockByKey(sBlockName); if ( pBlock == NULL ) { - QMessageBox::critical(NULL, tr("错误"), tr("读文件模块错误,模块不存在,请重新安装程序!") + sBlockName); + N_MessageBox::critical(NULL, tr("错误"), tr("读文件模块错误,模块不存在,请重新安装程序!") + sBlockName); break; } diff --git a/platform/src/tools/fbd_designer/fbd_diagram/CPluginManager.cpp b/platform/src/tools/fbd_designer/fbd_diagram/CPluginManager.cpp index f44863b7..e8c6b9ae 100644 --- a/platform/src/tools/fbd_designer/fbd_diagram/CPluginManager.cpp +++ b/platform/src/tools/fbd_designer/fbd_diagram/CPluginManager.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "pub_widget/MessageBox.h" using namespace std; @@ -37,7 +38,7 @@ void CPluginManager::loadPlugins(QString pluginDirectory) foreach (QString fileName, pluginsDir.entryList(QDir::Files)) { #if defined(Q_OS_WIN) - if (fileName.right(10) != "plugin.dll") + if (fileName.right(10).toLower() != "plugin.dll") continue; #else if ( fileName.right(3) != ".so" ) @@ -53,7 +54,7 @@ void CPluginManager::loadPlugins(QString pluginDirectory) qDebug()<<"Found plugin class: "<name()<< " - " << fileName; if ( m_mapInterface.contains(echoInterface->name()) ) { - QMessageBox::critical( 0, tr("错误"), tr("存在同名插件:")+echoInterface->name() ); + N_MessageBox::critical( 0, tr("错误"), tr("存在同名插件:")+echoInterface->name() ); return; } m_mapInterface.insert(echoInterface->name(), plugin); diff --git a/platform/src/tools/fbd_designer/fbd_diagram/fbd_diagram.pro b/platform/src/tools/fbd_designer/fbd_diagram/fbd_diagram.pro index a3ecaef4..23c6d1b5 100644 --- a/platform/src/tools/fbd_designer/fbd_diagram/fbd_diagram.pro +++ b/platform/src/tools/fbd_designer/fbd_diagram/fbd_diagram.pro @@ -36,6 +36,7 @@ LIBS += \ -llog4cplus \ -lnet_msg_bus_api \ -lprotobuf \ + -lpub_widget win32-msvc* { diff --git a/platform/src/tools/fbd_designer/fbd_editor/CAbout.cpp b/platform/src/tools/fbd_designer/fbd_editor/CAbout.cpp index 01aab159..8038a4fd 100644 --- a/platform/src/tools/fbd_designer/fbd_editor/CAbout.cpp +++ b/platform/src/tools/fbd_designer/fbd_editor/CAbout.cpp @@ -4,13 +4,18 @@ #include CAbout::CAbout(QWidget *parent) : - QDialog(parent), + CustomUiDialog(parent), ui(new Ui::CAbout) { ui->setupUi(this); + + setWindowTitle(tr("关于")); + //QPixmap pmap = QPixmap (":/icons/nari_logo.png"); //ui->labelPic->setPixmap(pmap); - setFixedSize(width(), height()); + ui->labelPic->setFixedHeight(2); + ui->pushButton->hide(); +// setFixedSize(width(), height()); QString version = "V 1.0"; QFile file(":/version.txt"); if (file.exists()) @@ -22,6 +27,8 @@ CAbout::CAbout(QWidget *parent) : version = QString(file.readLine()).trimmed(); } } + + CustomUiDialog::setAutoLayout(true); } CAbout::~CAbout() diff --git a/platform/src/tools/fbd_designer/fbd_editor/CAbout.h b/platform/src/tools/fbd_designer/fbd_editor/CAbout.h index 74460489..65dd1b0b 100644 --- a/platform/src/tools/fbd_designer/fbd_editor/CAbout.h +++ b/platform/src/tools/fbd_designer/fbd_editor/CAbout.h @@ -1,14 +1,14 @@ #ifndef ABOUT_H #define ABOUT_H -#include +#include namespace Ui { class CAbout; } -class CAbout : public QDialog +class CAbout : public CustomUiDialog { Q_OBJECT diff --git a/platform/src/tools/fbd_designer/fbd_editor/CAbout.ui b/platform/src/tools/fbd_designer/fbd_editor/CAbout.ui index a3d4ef44..b5864db7 100644 --- a/platform/src/tools/fbd_designer/fbd_editor/CAbout.ui +++ b/platform/src/tools/fbd_designer/fbd_editor/CAbout.ui @@ -6,8 +6,8 @@ 0 0 - 600 - 99 + 291 + 92 @@ -26,7 +26,7 @@ 关于 - + :/icons/fbd-system.png:/icons/fbd-system.png @@ -35,6 +35,9 @@ + + true + @@ -43,7 +46,7 @@ - 广州市宏茂技术有限公司 逻辑编程工具 版本 V1.0 + 逻辑编程工具 版本 V1.0 Qt::AlignCenter @@ -70,6 +73,12 @@ 关闭 + + + 16 + 18 + + @@ -89,8 +98,6 @@ - - - + diff --git a/platform/src/tools/fbd_designer/fbd_editor/CFBDMainWindow.cpp b/platform/src/tools/fbd_designer/fbd_editor/CFBDMainWindow.cpp index 994d6788..3bf1b2e9 100644 --- a/platform/src/tools/fbd_designer/fbd_editor/CFBDMainWindow.cpp +++ b/platform/src/tools/fbd_designer/fbd_editor/CFBDMainWindow.cpp @@ -8,15 +8,18 @@ #include "ui_CFBDMainWindow.h" #include "CRenderer.h" #include "CGraphicsScene.h" -#include "CPluginManager.h" -#include "CProperty.h" #include "CAbout.h" #include "CSetGroupDlg.h" #include "fbd_designer/fbd_retriever/CRetriever.h" #include "CGraphicsView.h" #include "CPortItem.h" #include "CGroup.h" +#include "CPluginManager.h" #include "CObjectSerializer.h" +#include "pub_widget/MessageBox.h" +#include "pub_widget/PubWidgetInit.h" +#include "CReplaceDialog.h" + #ifndef WIN32 #include #endif @@ -30,15 +33,18 @@ using namespace iot_public; #define C_DIAGRAM_MAXLEN 800*1024 // fbd_diagram表的内容字段最大长度 CFBDMainWindow::CFBDMainWindow(QWidget *parent) : - QMainWindow(parent), + CustomUiMainWindow(parent), ui(new Ui::CFBDMainWindow), m_pPluginManager(NULL), m_pSettings(NULL), m_pActionUndo(NULL), m_pActionRedo(NULL), - m_pLabelStatus(NULL) + m_pLabelStatus(NULL), + m_errorStateTextColor(250,0,0), + m_normalStateTextColor(0,0,255) { ui->setupUi(this); + setContentsMargins(6,0,5,2); // 加载翻译文件 initLanguage(); @@ -52,23 +58,26 @@ CFBDMainWindow::CFBDMainWindow(QWidget *parent) : // 加载qss样式 if ( false == initQss() ) { - QMessageBox::critical(0,tr("错误"),tr("加载样式文件失败")); + N_MessageBox::critical(this,tr("错误"),tr("加载样式文件失败")); return; } // 初始化所有图元 if ( false == initPlugins() ) { - QMessageBox::critical(0,tr("错误"),tr("初始化所有图元失败")); + N_MessageBox::critical(this,tr("错误"),tr("初始化所有图元失败")); return; } // 读取配置文件 if ( false == readSettings() ) { - QMessageBox::critical(0,tr("错误"),tr("读取配置文件失败")); + N_MessageBox::critical(this,tr("错误"),tr("读取配置文件失败")); return; } + + slotBusinessTypeOfBlockChanged(tr("ALL")); + slotBusinessTypeOfDiagramChanged(tr("ALL")); } CFBDMainWindow::~CFBDMainWindow() @@ -93,13 +102,15 @@ void CFBDMainWindow::initLanguage() // 加载语言翻译文件 const std::string strLanguage = std::move( iot_public::getCurLanguage()); const std::string strQmFile = - std::move( iot_public::CFileUtil::getPathOfResFile( "fbd_editor/translate/fbd_editor_" + strLanguage + ".qm" )); + std::move( iot_public::CFileUtil::getPathOfResFile( "fbd_editor/translate/platform_" + strLanguage + ".qm" )); if ( !strQmFile.empty()) { auto *pTrans = new QTranslator; pTrans->load( strQmFile.c_str()); QApplication::installTranslator( pTrans ); } + + iot_public::installTranslator(strLanguage); } void CFBDMainWindow::initVariables() @@ -118,8 +129,8 @@ void CFBDMainWindow::initVariables() // 业务类型 m_mapAllBusinessType["1"] = tr("ALL"); - m_mapAllBusinessType["2"] = tr("ISCS"); - m_mapAllBusinessType["3"] = tr("EMS"); + m_mapAllBusinessType["2"] = tr("监控"); + m_mapAllBusinessType["3"] = tr("其他"); m_pSettings = NULL; m_bEditPermission = false; @@ -127,12 +138,12 @@ void CFBDMainWindow::initVariables() void CFBDMainWindow::initUi() { + this->hideWindowTitle(); ui->tabWidget->tabBar()->setObjectName("CenterTabWidget"); - ui->centralWidget->setStyleSheet( "background-color: #E6ECF2;" );//中间窗口tab标签页右侧空白部分的颜色 // 合并图和图元的dockwidget - this->tabifyDockWidget( ui->dockWidgetDiagram, ui->dockWidgetTemplate ); - this->tabifyDockWidget( ui->dockWidgetDiagram, ui->dockWidgetBlock ); + this->tabifyDockWidget( ui->dockWidgetTemplate, ui->dockWidgetBlock ); + this->tabifyDockWidget( ui->dockWidgetBlock, ui->dockWidgetDiagram ); // 隐藏图的树的标题头 ui->treeWidget->header()->hide(); @@ -190,26 +201,14 @@ void CFBDMainWindow::initUi() connect( ui->comboBox_businessType_diagram, SIGNAL(currentIndexChanged(QString)), this, SLOT(slotBusinessTypeOfDiagramChanged(QString)) ); // ui->widgetTemplate->setContextMenuPolicy( Qt::CustomContextMenu ); // connect( ui->widgetTemplate, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(slotDeleteTemplate(const QPoint&)) ); + + connect(ui->treeWidget , &QTreeWidget::itemChanged , this , &CFBDMainWindow::slotTreeWidgetItemChange); + } bool CFBDMainWindow::initQss() { - std::string strFileName = "fbd_designer.qss"; - std::string strFilePath = CFileStyle::getPathOfStyleFile(strFileName); - if ( strFilePath.size() <= 0 ) - { - LOGERROR("未获取到 %s 文件的路径",strFileName.c_str()); - return false; - } - QString sFilePath( strFilePath.c_str() ); - QFile objFile( sFilePath ); - if ( !objFile.exists() || !objFile.open(QFile::ReadOnly|QFile::Text) ) - { - LOGERROR("打开 %s 文件失败",strFileName.c_str()); - return false; - } - this->setStyleSheet( objFile.readAll() ); - objFile.close(); + return true; } @@ -320,7 +319,7 @@ bool CFBDMainWindow::initBlockMenu( QString sBusinessTypeName ) if ( listBlockGroupId.contains(eleGroup.attribute("id")) ) { QWidget* pGroupWidget = new QWidget(ui->toolBox); - pGroupWidget->setStyleSheet( "background-color: #FFFFFF" ); + pGroupWidget->setObjectName("groupWidget"); QString sBlockGroupName = ""; if ( m_mapAllBlockGroup.contains(eleGroup.attribute("id")) ) sBlockGroupName = m_mapAllBlockGroup[eleGroup.attribute("id")]; @@ -389,7 +388,7 @@ bool CFBDMainWindow::initDiagramTree( QString sBusinessTypeName ) CDbApi objDbApi(DB_CONN_MODEL_READ); if ( !objDbApi.open() ) { - QMessageBox::critical(0,tr("错误"),tr("打开数据库失败")); + N_MessageBox::critical(this,tr("错误"),tr("打开数据库失败")); return false; } @@ -406,6 +405,8 @@ bool CFBDMainWindow::initDiagramTree( QString sBusinessTypeName ) QTreeWidgetItem* pTopItem = new QTreeWidgetItem(listName); pTopItem->setIcon( 0, QIcon(":/icons/group.png") ); pTopItem->setData(0,Qt::UserRole,objQuery.value("ID").toInt()); + pTopItem->setFlags(pTopItem->flags() | Qt::ItemIsUserCheckable); + pTopItem->setCheckState(0 , Qt::Unchecked); ui->treeWidget->addTopLevelItem( pTopItem ); // 加载图 @@ -429,6 +430,8 @@ bool CFBDMainWindow::initDiagramTree( QString sBusinessTypeName ) pItem->setToolTip(0,tr("未生效")); pItem->setIcon( 0, QIcon(":/icons/diagram_blue.png") ); } + pItem->setFlags(pItem->flags() | Qt::ItemIsUserCheckable); + pItem->setCheckState(0 , Qt::Unchecked); pTopItem->addChild( pItem ); m_listDiagramName.append( sName ); } @@ -447,26 +450,13 @@ bool CFBDMainWindow::initDiagramTree( QString sBusinessTypeName ) bool CFBDMainWindow::initTemplate() { - // 清空模板 - QVBoxLayout* pLayout = dynamic_cast(ui->widgetTemplate->layout()); - if ( pLayout != NULL ) - { - QLayoutItem* pChild = NULL; - while ( (pChild=pLayout->takeAt(0)) != NULL ) - { - pLayout->removeItem( pChild ); - delete pChild->widget(); - } - delete pLayout; - } - pLayout = new QVBoxLayout(ui->widgetTemplate); - ui->widgetTemplate->setLayout( pLayout ); + ui->widgetTemplate->clear(); // 打开数据库 CDbApi objDbApi(DB_CONN_MODEL_READ); if ( !objDbApi.open() ) { - QMessageBox::critical(0,tr("错误"),tr("打开数据库失败")); + N_MessageBox::critical(this,tr("错误"),tr("打开数据库失败")); return false; } @@ -503,12 +493,12 @@ bool CFBDMainWindow::initTemplate() for ( int i=0; icreateTemplateWidget(listName.at(i),qUncompress(tmpXml)); + QTreeWidgetItem * item = new QTreeWidgetItem(); + QWidget* pWidet = CRenderer::getInstance()->createTemplateWidget(listName.at(i), qUncompress(tmpXml)); + ui->widgetTemplate->addTopLevelItem(item); + ui->widgetTemplate->setItemWidget(item,0, pWidet); connect( pWidet, SIGNAL(signalDeleteTemplate(QString)), this, SLOT(slotDeleteTemplate(QString)) ); - pLayout->addWidget( pWidet ); } - ((QVBoxLayout*)pLayout)->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding)); - return true; } @@ -531,21 +521,21 @@ void CFBDMainWindow::slotInit( QString sBussinessTypeName, QString sDefaultDiagr // 初始化图元、图元组菜单 if ( false == initBlockMenu(m_sCurrentBusinessTypeName) ) { - QMessageBox::critical(0,tr("错误"),tr("初始化图元菜单失败")); + N_MessageBox::critical(this,tr("错误"),tr("初始化图元菜单失败")); return; } // 初始化图、图组菜单 if ( false == initDiagramTree(m_sCurrentBusinessTypeName) ) { - QMessageBox::critical(0,tr("错误"),tr("初始化图列表失败")); + N_MessageBox::critical(this,tr("错误"),tr("初始化图列表失败")); return; } // 初始化模板列表 if ( false == initTemplate() ) { - QMessageBox::critical(0,tr("错误"),tr("初始化模板列表失败")); + N_MessageBox::critical(this,tr("错误"),tr("初始化模板列表失败")); return; } @@ -562,7 +552,7 @@ void CFBDMainWindow::slotInit( QString sBussinessTypeName, QString sDefaultDiagr QByteArray byXml; if ( !readDiagramFromDatabase(sDefaultDiagramName,byXml,nGroupId,nEnable) ) { - QMessageBox::critical(0, tr("错误"), tr("从数据库中读取图【%1】失败").arg(sDefaultDiagramName)); + N_MessageBox::critical(this, tr("错误"), tr("从数据库中读取图【%1】失败").arg(sDefaultDiagramName)); return; } @@ -593,7 +583,7 @@ bool CFBDMainWindow::readDiagramFromDatabase( QString sName, QByteArray& byXml, CDbApi objDbApi(DB_CONN_MODEL_WRITE); if ( !objDbApi.open() ) { - QMessageBox::critical(0,tr("错误"),tr("打开数据库失败")); + N_MessageBox::critical(this,tr("错误"),tr("打开数据库失败")); return false; } @@ -637,15 +627,15 @@ void CFBDMainWindow::deleteDiagram( QString sName ) if ( false == checkEditPermission() ) return; - QMessageBox::StandardButton eRet = QMessageBox::question(0,tr("删除确认"),tr("确定删除图 %1 吗?").arg(sName)); - if ( eRet != QMessageBox::Yes ) + int eRet = N_MessageBox::question(this,tr("删除确认"),tr("确定删除图 %1 吗?").arg(sName)); + if ( eRet != N_MessageBox::Ok ) return; // 打开数据库 CDbApi objDbApi(DB_CONN_MODEL_WRITE); if ( !objDbApi.open() ) { - QMessageBox::critical(0,tr("错误"),tr("打开数据库失败")); + N_MessageBox::critical(this,tr("错误"),tr("打开数据库失败")); return; } @@ -653,14 +643,14 @@ void CFBDMainWindow::deleteDiagram( QString sName ) QString sSql = QString("DELETE FROM fbd_diagram WHERE NAME='%1'").arg(sName); if ( !objDbApi.execute(sSql) ) { - QMessageBox::critical(0,tr("错误"),tr("删除图失败")); + N_MessageBox::critical(this,tr("错误"),tr("删除图失败")); return; } // 更新组信息 if ( false == updateGroupInfo(ui->treeWidget->currentItem()->parent()->data(0,Qt::UserRole).toInt()) ) { - QMessageBox::critical(0,tr("错误"),tr("更新组信息失败")); + N_MessageBox::critical(this,tr("错误"),tr("更新组信息失败")); } // 重新初始化图列表 @@ -673,7 +663,7 @@ void CFBDMainWindow::deleteDiagram( QString sName ) bool CFBDMainWindow::checkEditPermission() { if ( !m_bEditPermission ) - QMessageBox::critical(this,tr("错误"),tr("当前用户无编辑权限")); + N_MessageBox::critical(this,tr("错误"),tr("当前用户无编辑权限")); return m_bEditPermission; } @@ -701,7 +691,7 @@ void CFBDMainWindow::setActionsEnabled() ui->actionRefreshUI->setEnabled(on && bemp); ui->actionCopyFBD->setEnabled(on && bemp); ui->actionCutFBD->setEnabled(on && bemp); - + ui->actionReplace->setEnabled(on && bemp); if (m_pActionUndo) ui->mainToolBar->removeAction(m_pActionUndo); if (m_pActionRedo) @@ -789,7 +779,7 @@ void CFBDMainWindow::on_actionOpenXml_triggered() QString sDir = QCoreApplication::applicationDirPath()+"/../../data/fbd_designer/"; if ( false == objDir.mkpath(sDir) ) { - QMessageBox::critical(0,tr("错误"),QString(tr("创建路径【%1】失败")).arg(sDir)); + N_MessageBox::critical(this,tr("错误"),QString(tr("创建路径【%1】失败")).arg(sDir)); sDir = ""; } @@ -802,14 +792,14 @@ void CFBDMainWindow::on_actionOpenXml_triggered() if ( m_listDiagramName.contains(sName) ) { - QMessageBox::critical(0,tr("错误"),tr("数据库中已包含此图,请修改名称后再打开")); + N_MessageBox::critical(this,tr("错误"),tr("数据库中已包含此图,请修改名称后再打开")); return; } QByteArray byXml; if ( !readDiagramFromFile(sPathName,byXml) ) { - QMessageBox::critical(0,tr("错误"),tr("打开文件失败")); + N_MessageBox::critical(this,tr("错误"),tr("打开文件失败")); return; } createTab( sName, byXml ); @@ -859,7 +849,7 @@ void CFBDMainWindow::on_actionSave_triggered() // 图检查有错误且生效状态为1时不能保存 if ( !bRet && pDiagram->getEnable() ) { - QMessageBox::critical(0,tr("错误"),tr("图检查有错误且生效状态为【是】时不能保存")); + N_MessageBox::critical(this,tr("错误"),tr("图检查有错误且生效状态为【是】时不能保存")); return; } @@ -874,7 +864,7 @@ void CFBDMainWindow::on_actionSave_triggered() CDbApi objDbApi(DB_CONN_MODEL_WRITE); if ( !objDbApi.open() ) { - QMessageBox::critical(0,tr("错误"),tr("打开数据库失败")); + N_MessageBox::critical(this,tr("错误"),tr("打开数据库失败")); return; } @@ -882,7 +872,7 @@ void CFBDMainWindow::on_actionSave_triggered() QString sSql = QString("DELETE FROM fbd_diagram WHERE NAME='%1';").arg(sName); if ( !objDbApi.execute(sSql) ) { - QMessageBox::critical(0,tr("错误"),tr("保存图失败")); + N_MessageBox::critical(this,tr("错误"),tr("保存图失败")); return; } @@ -910,7 +900,7 @@ void CFBDMainWindow::on_actionSave_triggered() .arg(nEnable); if ( !objDbApi.execute(sSql) ) { - QMessageBox::critical(0,tr("错误"),tr("保存图失败")); + N_MessageBox::critical(this,tr("错误"),tr("保存图失败")); return; } nPartNumber++; @@ -919,7 +909,7 @@ void CFBDMainWindow::on_actionSave_triggered() // 更新组信息 if ( false == updateGroupInfo(nGroupId) ) { - QMessageBox::critical(0,tr("错误"),tr("更新组信息失败")); + N_MessageBox::critical(this,tr("错误"),tr("更新组信息失败")); } // 重置图的变化状态为未变化 @@ -946,7 +936,7 @@ void CFBDMainWindow::on_actionExit_triggered() void CFBDMainWindow::on_actionAbout_triggered() { - CAbout *about = new CAbout(); + CAbout *about = new CAbout(this); about->show(); } @@ -959,14 +949,14 @@ void CFBDMainWindow::on_actionRun_triggered() if ( pDiagram->isDiagramChanged() ) { ui->actionRun->setChecked( false ); - QMessageBox::warning( 0, tr("警告"), tr("当前图未保存") ); + N_MessageBox::warning(this, tr("警告"), tr("当前图未保存") ); return; } if ( pDiagram->getEnable() == false ) { ui->actionRun->setChecked( false ); - QMessageBox::warning( 0, tr("警告"), tr("当前图未使能") ); + N_MessageBox::warning(this, tr("警告"), tr("当前图未使能") ); return; } @@ -980,7 +970,7 @@ void CFBDMainWindow::on_actionRun_triggered() setToolBtnStatus( false ); ui->dockWidgetDiagram->setEnabled( false ); ui->dockWidgetBlock->setEnabled( false ); - centralWidget()->setEnabled( false ); + centralWidget()->setEnabled( true ); ui->dockWidgetProperty->setEnabled( false ); ui->dockWidgetCheck->setEnabled( false ); pScene->setRefreshBlock( true ); @@ -1012,7 +1002,7 @@ void CFBDMainWindow::on_actionSaveAsTemplate_triggered() return; if ( sName == "" ) { - QMessageBox::critical(0,tr("错误"),tr("名称不能为空")); + N_MessageBox::critical(this,tr("错误"),tr("名称不能为空")); return; } @@ -1049,7 +1039,7 @@ void CFBDMainWindow::on_actionSaveAsTemplate_triggered() CDbApi objDbApi(DB_CONN_MODEL_WRITE); if ( !objDbApi.open() ) { - QMessageBox::critical(0,tr("错误"),tr("打开数据库失败")); + N_MessageBox::critical(this,tr("错误"),tr("打开数据库失败")); return; } @@ -1060,14 +1050,14 @@ void CFBDMainWindow::on_actionSaveAsTemplate_triggered() { if ( objQuery.next() ) { - QMessageBox::critical(0,tr("错误"),tr("模板名称重复")); + N_MessageBox::critical(this,tr("错误"),tr("模板名称重复")); return; } objQuery.clear(); } else { - QMessageBox::critical(0,tr("错误"),tr("查询数据库失败")); + N_MessageBox::critical(this,tr("错误"),tr("查询数据库失败")); return; } @@ -1075,7 +1065,7 @@ void CFBDMainWindow::on_actionSaveAsTemplate_triggered() sSql = QString("DELETE FROM fbd_template WHERE NAME='%1';").arg(sName); if ( !objDbApi.execute(sSql) ) { - QMessageBox::critical(0,tr("错误"),tr("保存模板失败")); + N_MessageBox::critical(this,tr("错误"),tr("保存模板失败")); return; } @@ -1101,7 +1091,7 @@ void CFBDMainWindow::on_actionSaveAsTemplate_triggered() .arg(QString(tmpContent)); if ( !objDbApi.execute(sSql) ) { - QMessageBox::critical(0,tr("错误"),tr("保存模板失败")); + N_MessageBox::critical(this,tr("错误"),tr("保存模板失败")); return; } nPartNumber++; @@ -1110,7 +1100,7 @@ void CFBDMainWindow::on_actionSaveAsTemplate_triggered() // 重新加载模板 initTemplate(); - QMessageBox::information(0,tr("信息"),tr("保存模板成功")); + N_MessageBox::information(this,tr("信息"),tr("保存模板成功")); } void CFBDMainWindow::on_addWidgetLineEdit_returnPressed() @@ -1149,9 +1139,9 @@ bool CFBDMainWindow::closeTab( int nIndex ) if ( pDiagram->isDiagramChanged() && !pDiagram->isDiagramEmpty()) { - QMessageBox::StandardButton eRet = QMessageBox::question(NULL, tr("确认"), - tr("图形的修改未保存,是否关闭?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); - if ( eRet != QMessageBox::Yes ) + int eRet = N_MessageBox::question(this, tr("确认"), + tr("图形的修改未保存,是否关闭?"), N_MessageBox::Yes | N_MessageBox::No, N_MessageBox::Yes); + if ( eRet != N_MessageBox::Yes ) return false; } @@ -1204,6 +1194,7 @@ void CFBDMainWindow::createTab( QString sName, const QByteArray& byXml, const in connect(pScene, SIGNAL(sceneChanged()), this, SLOT(slotDiagramChanged())); connect(ui->propertyEditor, SIGNAL(propertyChanged()), this, SLOT(slotDiagramChanged())); connect(pScene,SIGNAL(sceneRectChanged(QRectF)), this, SLOT(slotSceneRectChanged(QRectF))); + connect(pScene, SIGNAL(signalReplaceValue(QList)), this, SLOT(itemsSelected(QList))); if ( !sName.startsWith(UNTITLED_NAME) ) { @@ -1215,7 +1206,7 @@ void CFBDMainWindow::createTab( QString sName, const QByteArray& byXml, const in } catch (QString error ) { - QMessageBox::critical(0, "DOM Parser", error); + N_MessageBox::critical(this, "DOM Parser", error); } } pScene->setSceneRect(pScene->itemsBoundingRect()); @@ -1227,15 +1218,17 @@ void CFBDMainWindow::viewContextMenu(QPoint tt1) { Q_UNUSED(tt1) - QMenu *pMenu = new QMenu(); + QMenu *pMenu = new QMenu(this); pMenu->addSeparator(); pMenu->addAction(ui->actionSearcher); pMenu->addSeparator(); pMenu->addAction(ui->actionCopyFBD); pMenu->addAction(ui->actionPasteFBD); pMenu->addAction(ui->actionCutFBD); + pMenu->addAction(ui->actionReplace); //pMenu->addSeparator(); //pMenu->addAction(ui->actionRefreshUI); + //pMenu->addAction(new QAction("替换")); // 保存为模板功能 CGraphicsScene* pScene = getCurrentScene(); @@ -1250,11 +1243,13 @@ void CFBDMainWindow::viewContextMenu(QPoint tt1) { ui->actionCopyFBD->setDisabled(false); ui->actionCutFBD->setDisabled(false); + ui->actionReplace->setDisabled(false); } else { ui->actionCopyFBD->setDisabled(true); ui->actionCutFBD->setDisabled(true); + ui->actionReplace->setDisabled(true); } if (m_listCopy.length() > 0) { @@ -1320,7 +1315,7 @@ void CFBDMainWindow::copy() listProperty.push_back(QString(pBlockItem->getBlock()->getUuid().toString())); listUuid.push_back(QString(pBlockItem->getBlock()->getUuid().toString())); const QMetaObject *metaObject = pBlockItem->getBlock()->metaObject(); - for ( int i=metaObject->propertyOffset(); ipropertyCount(); ++i ) + for ( int i=0; ipropertyCount(); ++i ) //不跳过父类属性sshowname { QMetaProperty prop = metaObject->property(i); QString sValue; @@ -1568,9 +1563,9 @@ bool CFBDMainWindow::readSettings() m_pSettings = new QSettings(sSettingHome, QSettings::IniFormat, 0); } m_pSettings->beginGroup("CFBDMainWindow"); - resize(m_pSettings->value("size", QSize(1200, 800)).toSize()); - move(m_pSettings->value("pos", QPoint(200, 200)).toPoint()); - ui->propertyEditor->setColumnWidth( 0, m_pSettings->value("width-property-col0",100).toInt() ); +// resize(m_pSettings->value("size", QSize(1200, 800)).toSize()); +// move(m_pSettings->value("pos", QPoint(200, 200)).toPoint()); + ui->propertyEditor->setColumnWidth( 0, m_pSettings->value("width-property-col0",200).toInt() ); QList listDock; QList listSize; listDock << ui->dockWidgetProperty; @@ -1633,7 +1628,7 @@ void CFBDMainWindow::slotTreeWidgetItemDoubleClicked( QTreeWidgetItem *pItem, in QByteArray byXml; if ( !readDiagramFromDatabase(sName,byXml,nGroupId,nEnable) ) { - QMessageBox::critical(0, tr("错误"), tr("从数据库中读取图失败")); + N_MessageBox::critical(this, tr("错误"), tr("从数据库中读取图失败")); return; } @@ -1650,12 +1645,44 @@ void CFBDMainWindow::slotTreeWidgetContextMenuRequest( const QPoint& ) if ( ui->treeWidget->indexOfTopLevelItem(pItem) >= 0 ) return; - QMenu menu; + QMenu menu(this); menu.addAction( tr("导出为xml文件"), this, SLOT(slotExportDiagramAsXml()) ); menu.addAction( tr("删除此图"), this, SLOT(slotDeleteDiagram()) ); + menu.addAction( tr("一键使能"), this , SLOT(slotOneClickEnable())); menu.exec( QCursor::pos() ); } +void CFBDMainWindow::slotTreeWidgetItemChange(QTreeWidgetItem *item, int column) +{ + if (column == 0) + { + if (item->parent() == nullptr) { + Qt::CheckState rootState = item->checkState(0); + for (int i = 0; i < item->childCount(); ++i) { + QTreeWidgetItem *childItem = item->child(i); + childItem->setCheckState(0, rootState); + } + } else { + QTreeWidgetItem *parentItem = item->parent(); + bool allChecked = true; + bool allUnchecked = true; + for (int i = 0; i < parentItem->childCount(); ++i) { + QTreeWidgetItem *childItem = parentItem->child(i); + if (childItem->checkState(0) == Qt::Unchecked) { + allChecked = false; + }else { + allUnchecked = false; + } + } + if (allChecked) { + parentItem->setCheckState(0, Qt::Checked); + } else if (allUnchecked) { + parentItem->setCheckState(0, Qt::Unchecked); + } + } + } +} + void CFBDMainWindow::slotDeleteDiagram() { QTreeWidgetItem* pItem = ui->treeWidget->currentItem(); @@ -1676,7 +1703,7 @@ void CFBDMainWindow::slotExportDiagramAsXml() QString sDir = QCoreApplication::applicationDirPath()+"/../../data/fbd_designer/"; if ( false == objDir.mkpath(sDir) ) { - QMessageBox::critical(0,tr("错误"),QString(tr("创建路径【%1】失败")).arg(sDir)); + N_MessageBox::critical(this,tr("错误"),QString(tr("创建路径【%1】失败")).arg(sDir)); sDir = ""; } QString sPath = QFileDialog::getExistingDirectory(this, tr("选择导出路径"), sDir, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); @@ -1687,13 +1714,13 @@ void CFBDMainWindow::slotExportDiagramAsXml() QFile objFile(sPathName); if ( objFile.exists() ) { - QMessageBox::StandardButton eRet = QMessageBox::question(NULL, tr("询问"), tr("文件已存在,是否覆盖?")); - if ( eRet != QMessageBox::Yes ) + int eRet = N_MessageBox::question(this, tr("询问"), tr("文件已存在,是否覆盖?")); + if ( eRet != N_MessageBox::Ok ) return; } if ( !objFile.open(QIODevice::WriteOnly|QIODevice::Text) ) { - QMessageBox::critical(NULL, tr("错误"), tr("文件打开失败")); + N_MessageBox::critical(this, tr("错误"), tr("文件打开失败")); return; } @@ -1702,13 +1729,13 @@ void CFBDMainWindow::slotExportDiagramAsXml() QByteArray byXml; if ( false == readDiagramFromDatabase(sName,byXml,nGroupId,nEnable) ) { - QMessageBox::critical(NULL, tr("错误"), tr("从数据库读取文件内容失败")); + N_MessageBox::critical(this, tr("错误"), tr("从数据库读取文件内容失败")); return; } objFile.write(byXml); objFile.close(); - QMessageBox::information(NULL, tr("信息"), tr("导出成功")); + N_MessageBox::information(this, tr("信息"), tr("导出成功")); } CDiagram* CFBDMainWindow::getCurrentDiagram() @@ -1727,6 +1754,76 @@ CGraphicsScene* CFBDMainWindow::getCurrentScene() return NULL; } +QColor CFBDMainWindow::itemSelectBorderColor() +{ + return CRenderer::getInstance()->itemSelectBorderColor(); +} + +QColor CFBDMainWindow::itemNormalBorderColor() +{ + return CRenderer::getInstance()->itemNormalBorderColor(); +} + +QColor CFBDMainWindow::itemDefaultBackgroundColor() +{ + return CRenderer::getInstance()->itemDefaultBackgroundColor(); +} + +QColor CFBDMainWindow::itemErrorBackgroundColor() +{ + return CRenderer::getInstance()->itemErrorBackgroundColor(); +} + +QColor CFBDMainWindow::itemTextBackgroundColor() +{ + return CRenderer::getInstance()->itemTextBackgroundColor(); +} + +QColor CFBDMainWindow::errorStateTextColor() +{ + return m_errorStateTextColor; +} + +QColor CFBDMainWindow::normalStateTextColor() +{ + return m_normalStateTextColor; +} + +void CFBDMainWindow::setItemSelectBorderColor(QColor color) +{ + CRenderer::getInstance()->setItemSelectBorderColor(color); +} + +void CFBDMainWindow::setItemNormalBorderColor(QColor color) +{ + CRenderer::getInstance()->setItemNormalBorderColor(color); +} + +void CFBDMainWindow::setItemDefaultBackgroundColor(QColor color) +{ + CRenderer::getInstance()->setItemDefaultBackgroundColor(color); +} + +void CFBDMainWindow::setItemErrorBackgroundColor(QColor color) +{ + CRenderer::getInstance()->setItemErrorBackgroundColor(color); +} + +void CFBDMainWindow::setItemTextBackgroundColor(QColor color) +{ + CRenderer::getInstance()->setItemTextBackgroundColor(color); +} + +void CFBDMainWindow::setErrorStateTextColor(QColor color) +{ + m_errorStateTextColor = color; +} + +void CFBDMainWindow::setNormalStateTextColor(QColor color) +{ + m_normalStateTextColor = color; +} + void CFBDMainWindow::on_actionZoom_in_triggered() { CGraphicsView* pView = getCurrentView(); @@ -1800,6 +1897,82 @@ int CFBDMainWindow::setGroupInfo() return -1; } +void CFBDMainWindow::setMulGroupEnable(QMap mapDiagram) +{ + if( mapDiagram.isEmpty() || !checkEditPermission()) return; + + showEditMsg("", 10); + + ui->logEdit->clear(); + ui->dockWidgetCheck->setVisible(true); + + QStringList errorName , updataErr; + errorName.clear(); + updataErr.clear(); + CSetGroupDialog objSetGroupDialog(this); + if( QDialog::Accepted == objSetGroupDialog.exec()) + { + CDbApi objDbApi(DB_CONN_MODEL_WRITE); + if ( !objDbApi.open() ) + { + N_MessageBox::critical(this,tr("错误"),tr("打开数据库失败")); + return; + } + QString sSql = ""; + //检查结果 + QMap::iterator itor = mapDiagram.begin(); + for( ; itor != mapDiagram.end(); itor ++) + { + CDiagram *tmp = itor.value(); + tmp->setEnable(objSetGroupDialog.getEnable()); + + QSet setBlock; + bool bRet = tmp->checkConnection( setBlock ); + if( !bRet && tmp->getEnable() ) + { + errorName<getName(); + continue; + }else + { + sSql += QString("UPDATE fbd_diagram SET ENABLE = %1 WHERE NAME = '%2';") + .arg(tmp->getEnable()) + .arg(tmp->getName()); + + if( !objDbApi.execute(sSql) || !updateGroupInfo(tmp->getGroupId())) + { + updataErr<getName(); + continue; + } + } + } + + // 重新加载图列表 + initDiagramTree(); + + showEditMsg(tr("使能完成"), 10); + + QString errorLog = ""; + if (!errorName.isEmpty()) + { + QString joinedNames = errorName.join(","); + errorLog += tr("%1 图检查有错误不能使能!").arg(joinedNames); + } + + if (!updataErr.isEmpty()) + { + if (!errorLog.isEmpty()) + errorLog += "\n"; // 只在非空时添加换行符 + + QString joinedErrors = updataErr.join(","); + errorLog += tr("%1 使能失败!").arg(joinedErrors); + } + + if (!errorLog.isEmpty()) { + N_MessageBox::critical(this, tr("错误"), errorLog); + } + } +} + void CFBDMainWindow::on_actionSetGroup_triggered() { setGroupInfo(); @@ -1808,7 +1981,7 @@ void CFBDMainWindow::on_actionSetGroup_triggered() void CFBDMainWindow::on_actionSearcher_triggered() { showEditMsg(tr("打开检索器..."), 10); - CFBDRetriever* pRetriever = new CFBDRetriever(); + CFBDRetriever* pRetriever = new CFBDRetriever(this); pRetriever->show(); } @@ -1820,7 +1993,7 @@ void CFBDMainWindow::on_actionCheckConnection_triggered( ) CDiagram *pDiagram = getCurrentDiagram(); if ( pDiagram == NULL ) { - QMessageBox::critical(NULL, tr("错误"), tr("找不到当前fbd文档!")); + N_MessageBox::critical(this, tr("错误"), tr("找不到当前fbd文档!")); return; } @@ -1895,8 +2068,8 @@ void CFBDMainWindow::slotDeleteTemplate( QString sTemplateName ) if ( false == checkEditPermission() ) return; - QMessageBox::StandardButton eRet = QMessageBox::question(0,tr("删除确认"),tr("确定删除模板 %1 吗?").arg(sTemplateName)); - if ( eRet != QMessageBox::Yes ) + int eRet = N_MessageBox::question(this,tr("删除确认"),tr("确定删除模板 %1 吗?").arg(sTemplateName)); + if ( eRet != N_MessageBox::Ok ) return; qDebug()<<"delete template "<setStyleSheet( sStyle ); m_pLabelStatus->setText( QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss ") + sMsg ); } +void CFBDMainWindow::slotOneClickEnable() +{ + //获取当前的勾选的节点 + QMap checkedDiagram; + checkedDiagram.clear(); + for (int i = 0; i < ui->treeWidget->topLevelItemCount(); ++i) { + QTreeWidgetItem *item = ui->treeWidget->topLevelItem(i); + for (int j = 0; j < item->childCount(); ++j) { + QTreeWidgetItem *childItem = item->child(j); + if (childItem->checkState(0) == Qt::Checked) { + QString diagramName = childItem->text(0); + int nGroupId; + int nEnable; + QByteArray byXml; + if ( !readDiagramFromDatabase(diagramName,byXml,nGroupId,nEnable) ) + { + N_MessageBox::critical(this, tr("错误"), tr("从数据库中读取图失败")); + continue; + } + CDiagram *tmp = new CDiagram(); + tmp->setName( diagramName ); + tmp->setGroupId( nGroupId ); + tmp->setEnable( nEnable ); + tmp->fromXML( byXml ); + checkedDiagram.insert( diagramName, tmp ); + } + } + } + + if(checkedDiagram.isEmpty() && ui->treeWidget->currentItem()) + { + QString diagramName = ui->treeWidget->currentItem()->text(0); + int nGroupId; + int nEnable; + QByteArray byXml; + if ( !readDiagramFromDatabase(diagramName,byXml,nGroupId,nEnable) ) + { + N_MessageBox::critical(this, tr("错误"), tr("从数据库中读取图失败")); + return; + } + CDiagram *tmp = new CDiagram(); + tmp->setName( diagramName ); + tmp->setGroupId( nGroupId ); + tmp->setEnable( nEnable ); + tmp->fromXML( byXml ); + checkedDiagram.insert( diagramName, tmp ); + } + + //调用设置使能的对话框 + setMulGroupEnable(checkedDiagram); +} + + void CFBDMainWindow::setToolBtnStatus(bool bEnable) { CDiagram *pDiagram = getCurrentDiagram(); @@ -1957,6 +2194,7 @@ void CFBDMainWindow::setToolBtnStatus(bool bEnable) ui->actionSearcher->setEnabled(bEnable && bemp); ui->actionClose->setEnabled(bEnable && bemp); ui->actionRun->setEnabled(bemp); + ui->actionReplace->setEnabled(bemp); if ( !bEnable ) { @@ -2200,3 +2438,36 @@ void CFBDMainWindow::on_actionRefreshUI_triggered() updateSceneRect(); } + +void CFBDMainWindow::on_actionReplace_triggered() +{ + //获取当前输入串 + QString tagValue = ""; + bool flag = false; + if ( getCurrentScene()->selectedItems().size() > 0 ) + { + foreach ( QGraphicsItem* pItem, getCurrentScene()->selectedItems() ) + { + CBlockItem *pBlockItem = qgraphicsitem_cast(pItem); + if ( pBlockItem == NULL ) + continue; + const QMetaObject *metaObject = pBlockItem->getBlock()->metaObject(); + for ( int i=metaObject->propertyOffset(); ipropertyCount(); ++i ) + { + QMetaProperty prop = metaObject->property(i); + QString name = prop.name(); + if (prop.isUser() && ( "InputKeyId" == name || "OutputKeyId" == name )) + { + tagValue = pBlockItem->getBlock()->property(metaObject->property(i).name()).toString(); + flag = true; + break; + } + } + if( flag ) + break; + } + } + CReplaceDialog *dialog = new CReplaceDialog(tagValue,this); + connect(dialog , &CReplaceDialog::siganlsReplace , ui->propertyEditor , &CPropertyTreeView::slotReplaceTagValue); + dialog->exec(); +} diff --git a/platform/src/tools/fbd_designer/fbd_editor/CFBDMainWindow.ui b/platform/src/tools/fbd_designer/fbd_editor/CFBDMainWindow.ui index aefe0a0d..5589da15 100644 --- a/platform/src/tools/fbd_designer/fbd_editor/CFBDMainWindow.ui +++ b/platform/src/tools/fbd_designer/fbd_editor/CFBDMainWindow.ui @@ -40,7 +40,7 @@ true - 0 + 1 @@ -63,7 +63,7 @@ 0 0 995 - 25 + 23 @@ -86,6 +86,7 @@ + @@ -210,7 +211,7 @@ 0 0 274 - 223 + 206 @@ -426,7 +427,7 @@ 0 0 274 - 320 + 216 @@ -559,7 +560,16 @@ - + + + false + + + + 1 + + + @@ -877,6 +887,21 @@ 保存为模板 + + + + :/icons/replace.png:/icons/replace.png + + + 替换 + + + 替换标签值 + + + Ctrl+F + + diff --git a/platform/src/tools/fbd_designer/fbd_editor/CGroup.cpp b/platform/src/tools/fbd_designer/fbd_editor/CGroup.cpp index 3fadb41e..0745c171 100644 --- a/platform/src/tools/fbd_designer/fbd_editor/CGroup.cpp +++ b/platform/src/tools/fbd_designer/fbd_editor/CGroup.cpp @@ -3,12 +3,13 @@ #include "CGroupEdit.h" #include "db_api_ex/CDbApi.h" #include "pub_logger_api/logger.h" +#include "pub_widget/MessageBox.h" using namespace iot_public; using namespace iot_dbms; CGroup::CGroup(QMap objMap, QWidget *parent) : - QDialog(parent), + CustomUiDialog(parent), ui(new Ui::CGroup), m_mapAllBusinessType(objMap) { @@ -36,25 +37,27 @@ CGroup::CGroup(QMap objMap, QWidget *parent) : CSysInfoInterfacePtr pSysInfo; if ( !iot_public::createSysInfoInstance(pSysInfo) ) { - QMessageBox::critical(0,tr("错误"),tr("创建系统信息访问库失败")); + N_MessageBox::critical(this,tr("错误"),tr("创建系统信息访问库失败")); return; } // 查询位置信息 if ( iotSuccess != pSysInfo->getAllLocationInfo(m_vecLocationInfo) || m_vecLocationInfo.size() <= 0 ) { - QMessageBox::critical(0,tr("错误"),tr("获取所有位置信息失败")); + N_MessageBox::critical(this,tr("错误"),tr("获取所有位置信息失败")); return; } // 查询专业信息 if ( iotSuccess != pSysInfo->getAllSubsystemInfo(m_vecSubsystemInfo) || m_vecSubsystemInfo.size() <= 0 ) { - QMessageBox::critical(0,tr("错误"),tr("获取所有专业信息失败")); + N_MessageBox::critical(this,tr("错误"),tr("获取所有专业信息失败")); return; } loadGroup(); + + CustomUiDialog::setAutoLayout(true); } CGroup::~CGroup() @@ -68,7 +71,7 @@ void CGroup::closeEvent( QCloseEvent* pEvent ) this->accept(); else this->reject(); - QDialog::closeEvent( pEvent ); + CustomUiDialog::closeEvent( pEvent ); } void CGroup::loadGroup() @@ -79,7 +82,7 @@ void CGroup::loadGroup() CDbApi objDbApi(DB_CONN_MODEL_WRITE); if ( !objDbApi.open() ) { - QMessageBox::critical(0,tr("错误"),tr("打开数据库失败")); + N_MessageBox::critical(this,tr("错误"),tr("打开数据库失败")); return; } @@ -125,7 +128,7 @@ void CGroup::loadGroup() } else { - QMessageBox::critical(0,tr("错误"),tr("查询fbd_group表最大id失败")); + N_MessageBox::critical(this,tr("错误"),tr("查询fbd_group表最大id失败")); } ui->tableWidget->resizeColumnToContents(7); @@ -151,7 +154,7 @@ void CGroup::slotModify( bool ) { if ( ui->tableWidget->selectedItems().count() <= 0 ) { - QMessageBox::warning(0,tr("告警"),tr("请先选择一条记录")); + N_MessageBox::warning(this,tr("告警"),tr("请先选择一条记录")); return; } @@ -182,14 +185,14 @@ void CGroup::slotDelete( bool ) { if ( ui->tableWidget->selectedItems().count() <= 0 ) { - QMessageBox::warning(0,tr("告警"),tr("请先选择一条记录")); + N_MessageBox::warning(this,tr("告警"),tr("请先选择一条记录")); return; } CDbApi objDbApi(DB_CONN_MODEL_WRITE); if ( !objDbApi.open() ) { - QMessageBox::critical(0,tr("错误"),tr("打开数据库失败")); + N_MessageBox::critical(this,tr("错误"),tr("打开数据库失败")); return; } @@ -201,22 +204,22 @@ void CGroup::slotDelete( bool ) QString sSql = QString("select NAME FROM fbd_diagram WHERE GROUP_ID=%1").arg(nGroupId); if ( !objDbApi.execute(sSql,objQuery) ) { - QMessageBox::critical(0,tr("错误"),tr("查询此组包含的图失败")); + N_MessageBox::critical(this,tr("错误"),tr("查询此组包含的图失败")); return; } else if ( objQuery.next() ) { - QMessageBox::warning(0,tr("警告"),tr("此组内有未删除的图,请先删除图")); + N_MessageBox::warning(this,tr("警告"),tr("此组内有未删除的图,请先删除图")); return; } - QMessageBox::StandardButton eRet = QMessageBox::information(0,tr("提示"),tr("确认删除?"),QMessageBox::Yes,QMessageBox::No); - if ( eRet == QMessageBox::Yes ) + int eRet = N_MessageBox::information(this,tr("提示"),tr("确认删除?"),N_MessageBox::Yes,N_MessageBox::No); + if ( eRet == N_MessageBox::Yes ) { QString sSql = QString("DELETE FROM fbd_group WHERE ID=%1").arg(nGroupId); if ( !objDbApi.execute(sSql) ) { - QMessageBox::critical(0,tr("错误"),tr("删除失败")); + N_MessageBox::critical(this,tr("错误"),tr("删除失败")); } } diff --git a/platform/src/tools/fbd_designer/fbd_editor/CGroup.h b/platform/src/tools/fbd_designer/fbd_editor/CGroup.h index 773745c0..db687302 100644 --- a/platform/src/tools/fbd_designer/fbd_editor/CGroup.h +++ b/platform/src/tools/fbd_designer/fbd_editor/CGroup.h @@ -1,15 +1,15 @@ #ifndef CGROUP_H #define CGROUP_H -#include #include #include "pub_sysinfo_api/SysInfoApi.h" +#include "pub_widget/CustomDialog.h" namespace Ui { class CGroup; } -class CGroup : public QDialog +class CGroup : public CustomUiDialog { Q_OBJECT diff --git a/platform/src/tools/fbd_designer/fbd_editor/CGroupEdit.cpp b/platform/src/tools/fbd_designer/fbd_editor/CGroupEdit.cpp index e79281c7..c6979375 100644 --- a/platform/src/tools/fbd_designer/fbd_editor/CGroupEdit.cpp +++ b/platform/src/tools/fbd_designer/fbd_editor/CGroupEdit.cpp @@ -2,12 +2,13 @@ #include "ui_CGroupEdit.h" #include "pub_logger_api/logger.h" #include "pub_sysinfo_api/SysInfoApi.h" +#include "pub_widget/MessageBox.h" using namespace iot_public; using namespace iot_dbms; CGroupEdit::CGroupEdit(QMap objMap, QWidget *parent) : - QDialog(parent), + CustomUiDialog(parent), ui(new Ui::CGroupEdit), m_mapAllBusinessType(objMap) { @@ -31,7 +32,7 @@ CGroupEdit::CGroupEdit(QMap objMap, QWidget *parent) : CSysInfoInterfacePtr pSysInfo; if ( !iot_public::createSysInfoInstance(pSysInfo) ) { - QMessageBox::critical(0,tr("错误"),tr("创建系统信息访问库失败")); + N_MessageBox::critical(this,tr("错误"),tr("创建系统信息访问库失败")); return; } @@ -39,7 +40,7 @@ CGroupEdit::CGroupEdit(QMap objMap, QWidget *parent) : std::vector vecLocationInfo; if ( iotSuccess != pSysInfo->getAllLocationInfo(vecLocationInfo) || vecLocationInfo.size() <= 0 ) { - QMessageBox::critical(0,tr("错误"),tr("获取所有位置信息失败")); + N_MessageBox::critical(this,tr("错误"),tr("获取所有位置信息失败")); return; } @@ -47,7 +48,7 @@ CGroupEdit::CGroupEdit(QMap objMap, QWidget *parent) : std::vector vecSubsystemInfo; if ( iotSuccess != pSysInfo->getAllSubsystemInfo(vecSubsystemInfo) || vecSubsystemInfo.size() <= 0 ) { - QMessageBox::critical(0,tr("错误"),tr("获取所有专业信息失败")); + N_MessageBox::critical(this,tr("错误"),tr("获取所有专业信息失败")); return; } @@ -67,6 +68,8 @@ CGroupEdit::CGroupEdit(QMap objMap, QWidget *parent) : QString("%1-%2").arg(vecSubsystemInfo[i].strName.c_str()).arg(vecSubsystemInfo[i].strDesc.c_str()), vecSubsystemInfo[i].nId ); } + + CustomUiDialog::setAutoLayout(true); } CGroupEdit::~CGroupEdit() @@ -123,7 +126,7 @@ void CGroupEdit::slotOk( bool ) { if ( ui->lineEdit_name->text() == "" ) { - QMessageBox::critical(0,tr("错误"),tr("组名称不能为空")); + N_MessageBox::critical(this,tr("错误"),tr("组名称不能为空")); return; } @@ -134,7 +137,7 @@ void CGroupEdit::slotOk( bool ) if ( !objDbApi.open() ) { - QMessageBox::critical(0,tr("错误"),tr("打开数据库失败")); + N_MessageBox::critical(this,tr("错误"),tr("打开数据库失败")); return; } @@ -149,7 +152,7 @@ void CGroupEdit::slotOk( bool ) } else { - QMessageBox::critical(0,tr("错误"),tr("查询fbd_group表最大id失败")); + N_MessageBox::critical(this,tr("错误"),tr("查询fbd_group表最大id失败")); return; } objQuery.clear(); @@ -183,7 +186,7 @@ void CGroupEdit::slotOk( bool ) .arg(m_nGroupId); if ( !objDbApi.execute(sSql) ) { - QMessageBox::critical(0,tr("错误"),tr("SQL语句执行失败")); + N_MessageBox::critical(this,tr("错误"),tr("SQL语句执行失败")); return; } diff --git a/platform/src/tools/fbd_designer/fbd_editor/CGroupEdit.h b/platform/src/tools/fbd_designer/fbd_editor/CGroupEdit.h index 03d07a7a..1884c905 100644 --- a/platform/src/tools/fbd_designer/fbd_editor/CGroupEdit.h +++ b/platform/src/tools/fbd_designer/fbd_editor/CGroupEdit.h @@ -1,16 +1,16 @@ #ifndef CGROUPEDIT_H #define CGROUPEDIT_H -#include #include #include #include "db_api_ex/CDbApi.h" +#include "pub_widget/CustomDialog.h" namespace Ui { class CGroupEdit; } -class CGroupEdit : public QDialog +class CGroupEdit : public CustomUiDialog { Q_OBJECT diff --git a/platform/src/tools/fbd_designer/fbd_editor/CSetGroupDlg.cpp b/platform/src/tools/fbd_designer/fbd_editor/CSetGroupDlg.cpp index ac84d66f..590020af 100644 --- a/platform/src/tools/fbd_designer/fbd_editor/CSetGroupDlg.cpp +++ b/platform/src/tools/fbd_designer/fbd_editor/CSetGroupDlg.cpp @@ -6,12 +6,13 @@ #include #include "pub_sysinfo_api/SysInfoApi.h" #include "db_api_ex/CDbApi.h" +#include "pub_widget/MessageBox.h" using namespace iot_public; using namespace iot_dbms; CSetGroupDialog::CSetGroupDialog(int nCurrentBusinessTypeId, QWidget *parent) : - QDialog(parent), + CustomUiDialog(parent), ui(new Ui::CSetGroupDialog) { ui->setupUi(this); @@ -28,7 +29,7 @@ CSetGroupDialog::CSetGroupDialog(int nCurrentBusinessTypeId, QWidget *parent) : CDbApi objDbApi(DB_CONN_MODEL_READ); if ( !objDbApi.open() ) { - QMessageBox::critical(0,tr("错误"),tr("打开数据库失败")); + N_MessageBox::critical(this,tr("错误"),tr("打开数据库失败")); return; } @@ -44,6 +45,28 @@ CSetGroupDialog::CSetGroupDialog(int nCurrentBusinessTypeId, QWidget *parent) : } objQuery.clear(); } + + CustomUiDialog::setAutoLayout(true); +} + +CSetGroupDialog::CSetGroupDialog(QWidget *parent) + :CustomUiDialog(parent), + ui(new Ui::CSetGroupDialog) +{ + ui->setupUi(this); + this->setWindowTitle( tr("设置图属性") ); + + //隐藏相关标签 + ui->label->setVisible(false); + ui->labelInfo->setVisible(false); + ui->label_2->setVisible(false); + ui->lineEdit_name->setVisible(false); + ui->comboBox_group->setVisible(false); + + ui->comboBox_enable->addItem( tr("是"), 1 ); + ui->comboBox_enable->addItem( tr("否"), 0 ); + + CustomUiDialog::setAutoLayout(true); } CSetGroupDialog::~CSetGroupDialog() @@ -102,11 +125,19 @@ void CSetGroupDialog::setEnable( int nEnable ) void CSetGroupDialog::accept() { + + if( !ui->label->isVisible() && ! ui->labelInfo->isVisible()) + { + //用此判断是单个还是多个使能 + CustomUiDialog::accept(); + return; + } + bool bOK = false; ui->comboBox_group->currentData().toInt(&bOK); if ( bOK == false ) { - QMessageBox::critical(0,tr("错误"),tr("获取组ID失败")); + N_MessageBox::critical(this,tr("错误"),tr("获取组ID失败")); return; } @@ -116,7 +147,7 @@ void CSetGroupDialog::accept() // 不能以 Untitled Diagram 开头 if ( ui->lineEdit_name->text().startsWith("Untitled Diagram") ) { - QMessageBox::critical(0,tr("错误"),tr("请重新命名")); + N_MessageBox::critical(this,tr("错误"),tr("请重新命名")); return; } @@ -124,7 +155,7 @@ void CSetGroupDialog::accept() CDbApi objDbApi(DB_CONN_MODEL_WRITE); if ( !objDbApi.open() ) { - QMessageBox::critical(0,tr("错误"),tr("打开数据库失败")); + N_MessageBox::critical(this,tr("错误"),tr("打开数据库失败")); return; } @@ -135,19 +166,19 @@ void CSetGroupDialog::accept() { if ( objQuery.next() ) { - QMessageBox::critical(0,tr("错误"),tr("图名称重复")); + N_MessageBox::critical(this,tr("错误"),tr("图名称重复")); return; } objQuery.clear(); } else { - QMessageBox::critical(0,tr("错误"),tr("查询数据库失败")); + N_MessageBox::critical(this,tr("错误"),tr("查询数据库失败")); return; } } - QDialog::accept(); + CustomUiDialog::accept(); } diff --git a/platform/src/tools/fbd_designer/fbd_editor/CSetGroupDlg.h b/platform/src/tools/fbd_designer/fbd_editor/CSetGroupDlg.h index 8aa1b412..1d864cdc 100644 --- a/platform/src/tools/fbd_designer/fbd_editor/CSetGroupDlg.h +++ b/platform/src/tools/fbd_designer/fbd_editor/CSetGroupDlg.h @@ -1,18 +1,19 @@ #ifndef SET_GROUP_DLG_H #define SET_GROUP_DLG_H -#include +#include "pub_widget/CustomDialog.h" namespace Ui { class CSetGroupDialog; } -class CSetGroupDialog : public QDialog +class CSetGroupDialog : public CustomUiDialog { Q_OBJECT public: explicit CSetGroupDialog(int nCurrentBusinessTypeId, QWidget *parent = 0); + CSetGroupDialog(QWidget *parent = nullptr); ~CSetGroupDialog(); public: diff --git a/platform/src/tools/fbd_designer/fbd_editor/fbd_editor.ico b/platform/src/tools/fbd_designer/fbd_editor/fbd_editor.ico index 594c9bca5084b5f1246e04891a83da7b4b6c4746..b785b08c6280e6aff81ceac767964f3d4fd8cd6c 100644 GIT binary patch literal 4742 zcmcInO-NKx6h5Y)P+(+~prl}e;G%_rLP3Fx0v9b>v}obNMT-^&Eeu@v@QoU@2$7I5 zaM7Z`sD+Cb5+g|nsYuO?qfO>tR3@U3HG)64@4GWsUel=Wjn6yWIq#iw?svX>?(Y-H z!ms>{;J;MvoDexBA{D6Rs25SGXSoVn!O=w3iVXgOmgI%nq%Itgo=`wSAzN1PtWe{q zv9K+D&^1m4q$mS;Pfe0s8WHn*k^_0{TETY%_TGtrlz0l1;>@_fsYf1~Cy)!g=g{T7 zC56zB@5NzPn=QX4Y-w#$c@J`;zapIiHd5GWg6mv7s9v&m`BV)8_Fx#{Llp z`5SPyMT`Z;c5*S#@C(v+?!|SrJld^3KdCa~(m@~et;vby>DiVhVno`ch3#UGE7kH? zx0-)>L&pHmVcMN#+>+z;o$M@D+glroWqm1X{72}^e0$>IoNH*SF#<9|3}Txy)m5V7 zMBAmn$thyVG0o{=q1xJrYxnqKNc%!RL|@LYOgXVFF_;fx{P{MbV=&faXOZH1U|#6s zEXeCC`cL;(s~>Ng)Kpig=7jm#NI%#*GUbH%(n1VyYa|B8V=>sQWAUAHjP}$5o~5w= zv$i6(JmuWfd33o4q~(paoZrO4Uh*u(XZ(XD#i@MEyN=%`wP;fxX_ZRqsY5??4pXqq z*t(L$AQmyBtx^>U$W4q*E#JMA@O?Rlyao@#C8g~U`daOUgYgAUKl-(hg6Aq9F5Aq6 zTjhd@=SBi|#U*yeJTZ3H+;A~I;1fG+PT_Wsd9vm8VROQHciQB@jZB`88IQ|;{lU5k zx#8jTN$ypL#);>iGoIULv#;;hXU}$9;$J+Do8kP?k_yD*-O<;4abB1hnMj-ixA)?N zJ&b!s4`c(*p<9?I-AUbU{Ro=9JQF^q4aYt$FI)Ok?-y*t^BuhYJBz?K>UFId4(TNF z)dWo5uM_>pUcvsd>Rf^!Y}`NUcl0<5j6ZTXFlx!kbl3;cMcSnrF~-RadC+%N@aZ#g zcO-O-qt~u2OXTdwc Ya_vZh_hxo_xt*KPtKOua68tK*szO{6 zLRydT)N13^~stPMliG zHFr5ZJLm4obvcHgIy0xA`TTHhYx^&*lS2cscJkCe553&!yR#gtfS)=(pUrptom&`D z`wJt~g{W}e!bsZ1JezSpw9tzKeiOAS`v2JZXK7Lyli_d{yWzkEz!37%_e?l*5zO=Q!l}HOE(l z-paUYt&9`n_d+>5X?>1Ej$dMW+N3&Mo1~H`+<)}`P911KB@p|cKj%ju?nXeKlLQ_aI6m)O@PCBR z^Yp46f4nCF8DuZFAHCyG_az`h`S-6+$>a4YGL(LQJ9{7j8OpzZV_LR1rpZwL{hKqg zy*WdM((gandKd#T#G=G?^0}S?^2o|~gp)6iVnAJp`~3`^#$yG@(8SKzT=o6_?OD~? zo+X3C&e**F_wUSQot-%{XzYy5vwpvS`ub!DXh0rZ`!C-uXT1md_H+p3fD9b})7`u6 z(cPt1ZD~MP(m`Dr6uKe?bS-_;s(t^_S^U`x{IW0PLR_TIBK4$IBVu%g=-2A$&Ut&3 F{s2?XeTx79 diff --git a/platform/src/tools/fbd_designer/fbd_editor/fbd_editor.pro b/platform/src/tools/fbd_designer/fbd_editor/fbd_editor.pro index f26987a7..07efbc49 100644 --- a/platform/src/tools/fbd_designer/fbd_editor/fbd_editor.pro +++ b/platform/src/tools/fbd_designer/fbd_editor/fbd_editor.pro @@ -1,75 +1,79 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2019-03-21T11:01:36 -# -#------------------------------------------------- - -QT += core gui opengl xml network sql - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - -TARGET = fbd_editor -TEMPLATE = lib - -DEFINES += EDITOR_LIBRARY -DEFINES += QT_DEPRECATED_WARNINGS - -SOURCES += \ - CFBDMainWindow.cpp \ - CAbout.cpp \ - CSetGroupDlg.cpp \ - CGraphicsView.cpp \ - CGroup.cpp \ - CGroupEdit.cpp - -HEADERS += \ - ../../../include/tools/fbd_designer/fbd_editor/CFBDMainWindow_global.h \ - ../../../include/tools/fbd_designer/fbd_editor/CFBDMainWindow.h \ - CAbout.h \ - CSetGroupDlg.h \ - CGraphicsView.h \ - CGroup.h \ - CGroupEdit.h - -FORMS += \ - CFBDMainWindow.ui \ - CAbout.ui \ - CSetGroupDialog.ui \ - CGroup.ui \ - CGroupEdit.ui - -INCLUDEPATH += \ - ../../../include/tools/fbd_designer/fbd_editor \ - ../fbd_tree \ - ../fbd_block \ - ../fbd_diagram \ - ../fbd_renderer \ - ../fbd_property \ - ../fbd_retriever \ - -LIBS += \ - -llog4cplus \ - -lpub_logger_api \ - -lfbd_block \ - -lfbd_diagram \ - -lfbd_renderer \ - -lfbd_property \ - -lfbd_retriever \ - -lnet_msg_bus_api \ - -ldb_sysinfo_api \ - -lpub_utility_api \ - -lpub_sysinfo_api \ - -ldb_base_api \ - -ldb_api_ex \ - -RESOURCES += \ - ./fbd_editor.qrc - - -!include( ../../../idl_files/idl_files.pri ){ - error(the file idl_files.pri is not exist!!) -} - -!include( ../../../common.pri ){ - error(the file common.pri is not exist!!) -} +#------------------------------------------------- +# +# Project created by QtCreator 2019-03-21T11:01:36 +# +#------------------------------------------------- + +QT += core gui opengl xml network sql + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = fbd_editor +TEMPLATE = lib + +DEFINES += EDITOR_LIBRARY +DEFINES += QT_DEPRECATED_WARNINGS + +SOURCES += \ + CFBDMainWindow.cpp \ + CAbout.cpp \ + CSetGroupDlg.cpp \ + CGraphicsView.cpp \ + CGroup.cpp \ + CGroupEdit.cpp \ + CReplaceDialog.cpp + +HEADERS += \ + ../../../include/tools/fbd_designer/fbd_editor/CFBDMainWindow_global.h \ + ../../../include/tools/fbd_designer/fbd_editor/CFBDMainWindow.h \ + CAbout.h \ + CSetGroupDlg.h \ + CGraphicsView.h \ + CGroup.h \ + CGroupEdit.h \ + CReplaceDialog.h + +FORMS += \ + CFBDMainWindow.ui \ + CAbout.ui \ + CSetGroupDialog.ui \ + CGroup.ui \ + CGroupEdit.ui \ + CReplaceDialog.ui + +INCLUDEPATH += \ + ../../../include/tools/fbd_designer/fbd_editor \ + ../fbd_tree \ + ../fbd_block \ + ../fbd_diagram \ + ../fbd_renderer \ + ../fbd_property \ + ../fbd_retriever \ + +LIBS += \ + -llog4cplus \ + -lpub_logger_api \ + -lfbd_block \ + -lfbd_diagram \ + -lfbd_renderer \ + -lfbd_property \ + -lfbd_retriever \ + -lnet_msg_bus_api \ + -ldb_sysinfo_api \ + -lpub_utility_api \ + -lpub_sysinfo_api \ + -ldb_base_api \ + -ldb_api_ex \ + -lpub_widget + +RESOURCES += \ + ./fbd_editor.qrc + + +!include( ../../../idl_files/idl_files.pri ){ + error(the file idl_files.pri is not exist!!) +} + +!include( ../../../common.pri ){ + error(the file common.pri is not exist!!) +} diff --git a/platform/src/tools/fbd_designer/fbd_editor/fbd_editor.qrc b/platform/src/tools/fbd_designer/fbd_editor/fbd_editor.qrc index 0c143b15..a1fc6dbd 100644 --- a/platform/src/tools/fbd_designer/fbd_editor/fbd_editor.qrc +++ b/platform/src/tools/fbd_designer/fbd_editor/fbd_editor.qrc @@ -33,5 +33,6 @@ icons/diagram.png icons/diagram_blue.png icons/diagram_green.png + icons/replace.png diff --git a/platform/src/tools/fbd_designer/fbd_editor/icons/Help.png b/platform/src/tools/fbd_designer/fbd_editor/icons/Help.png index e3dc0f4810e328bb725116d06395f3e01bd18eff..9fc10ee46b6b2344ae7282d6bf8ae2b69918049b 100644 GIT binary patch delta 716 zcmV;-0yF)w1ndQnEPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj7fk{L`RCodHR^4$LF%bTAz&q)HJZAD^sKDn6;#3eih*JUXAf|%g4(tjb6~F+V zJepKsKW2uX&3;069O0ys#~#1f-;6+~TkWp)zTFk@(qN*b#(&a84W~LgMuHTArp}x0 z?L@Uq^nZj8<`R)Gl?LlL)7iIzp^&x(*0{uxIjgbpsS;uJ5a+3-kAj+gt@dalRF)Psod%~j@ox4pRGLiaX^;ro+RdGnceV&vao09 z5ra- zj)Ymyycau5i_1lFWjVJ%3`oSS(Fr~ozq3oH&+I#x90-;Ypwwv38eM6H3Spidp1>Qw8~MBzMWx%OhF4_G@bk+Dmsl^-=y5|wh54K;kw*0Jn0)9Ul0Rv`ow2= zle76WsDFsHw~kvKcN)eN)#y4)qjJM*n{NzV8dUff#qcf=!c=&Ow&lZrmxP^Rey;=< zcHV%$D^ZT+kKyhF`Yrb-_+jTJSd@^pw5RP()E9;E6ZhkBY(FN7HxM=f-YjCkZZwa( zftY~jEdE24Xt@=p!ys_yB9T%nDfZHL65>Gh^+onZTj5$$!c-O(f{edV;`OVFOWeJh yV87EPoOJ01FZU(%pXi0005wNklKHh*G4MAgy6-uo4Rr%1GA zuf)3;PNFf1WN$>YJeb&f&tA?W!e!12iOwoApd_M&wbm>y@idT@>`{)CA#0rMVa!F> z9`-yIt3PrU=b$3?pbfXGx{!ApULzV~051T>B5L?I5pC2`-g_@$FQWA=I-!;$6RMYU z+Nke005;;uRDYgFqu3yOgW)65Z4*mnw%#Uk%3;3-@Co1!z%76^%e?n{DG?o8rQ0NS z@=i5@u(=?jFY&5U-!y_Q7t3{yLzvA9CL(8u17XTo*7d9#&`G^oDt8(+mfkp;I6CWF zIp-* zq;;m?WNN)iCrcUVqJhyVz7DYr@eq=gcxIuJ#!;q1EqlX&sPzTG>eUMw5);{Ib)+Vj z4mBS4beQv4T>wg}Z>JD>8YYu@AsFl;@b|7h%8T<}_LKqVz25#7{@Gs`0N+x9=K7zm S`#Jys00{s|MNUMnLSTZ}gZTLX diff --git a/platform/src/tools/fbd_designer/fbd_editor/icons/Open.png b/platform/src/tools/fbd_designer/fbd_editor/icons/Open.png index a6d73f9ce9b6727bf962a2acfca74d93d1f6223a..04abc16ccbf583168bab5f5b53568a51f29e1d9f 100644 GIT binary patch delta 403 zcmV;E0c`%S1GNK?EPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj6N=ZaPRCodHmD^FmKoo|*MGBw`qolAVk~_EC>QZ>KIDoOgFLc11$#Dg9mg_pU0lThEDI9t6W5H5oWqf6XW0%)lU3Xu)(Fw4z!0kv#xk7RSE`US|`s4}+SMajBuGB0$3mPY;8iME#n|{F69ik4 z7=>1v2>uhJY{%|}UFzS+N~}}2XmA_5jRHFfJO=C<%hY%857r6DlH~FTILeyy6i1(6 r*8Cmcw+tPZ9TxfneGmR01Mmy&yK`U6S##b10000Px#1ZP1_K>z@;j|==^ z1poj5uSrBfRCob}l1mPQFc3p+Xr&&b+b(;Ap1eosrc#&9MIek5f*?OEflxe;Oq?OU z{ts!y3lBQ<^z(O2cD?JRJzojhC@-b1Q2hHt_6m@%3`Gib)X?Fxh^ z9k;*MV5tIWnTM8g80+~ns04F3f(0a93h)-%6A(4nb1kZ}9rGY!MH$!utfeP4(q-19(C#?PS7aAr%AZ0JhU{ad+&jEdT%j07*qo IM6N<$g6Jn+g#Z8m diff --git a/platform/src/tools/fbd_designer/fbd_editor/icons/continue.png b/platform/src/tools/fbd_designer/fbd_editor/icons/continue.png index a372891aac26f4b7c9e99ceb1043548d5fc048c8..5eebf9fbb23b3e83e66dba92b4fb9ab3545dec24 100644 GIT binary patch delta 338 zcmV-Y0j>Up1N8!sEPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj63Q0skRCodHmD>%1KoCXm692UX8c<^g+JT*D2Vw=-fu)EQ5G2N5I?w{taR;N} zu>=hagoKkovXA8M%92hr^l|mKLnY-zfFELTaa^bolMEZ^wn5ihcB$;YYi_T1< zdEWI`{ehjx{cC@1!ava5t8N8DCR>ZRTsWj11Sl5vX%ssQuz~>Q2EvZQ&7GUP5c!Bh z?Id^jlA=sH;!A+m`tKSJQ+sV&nPUvm5P28kR1@}k#s1D!bt?n;J02@9b`*9NLCodE kj>6*XFs*T>4SKrF3rewFaleFjdH?_b07*qoM6N<$g0x(Z0ssI2 delta 354 zcmV-o0iFK!0)+#REPoOJ01FZU(%pXi0003uNkl28+2LQgQr!l}~KNn7xw2=RBelRS;}J>MZ!#VK@l z66&7=6H7rX7rlc4i~y9xGU^)~Gyw2HEcdC!EmsrEBonj%aDQ1FKdX1QU0}l-E&?}M6w50QB+#-{X&ubrT3{`bZru}m$%t*$1PVeGjf-u9a1SS2ftSsD)gU2b5d z9dI;5*+`e{YFnn$48VgGtjpEO(6-Q)xk6qN%M*Z`+H`32v)t@t1Bus_c^tm0ce!pR z8zo(>-i6Q}$1F8bYXed5%Idag0sjAm=|=!Q0UPFEOlv~H;{X5v07*qoM6N<$f|G8i AEdT%j diff --git a/platform/src/tools/fbd_designer/fbd_editor/icons/copy.png b/platform/src/tools/fbd_designer/fbd_editor/icons/copy.png index 272c2f6b1a7242f69f8b9e961d5de1ec8367fc94..e3b9624497ef49dc6e63488d4dd9ca0345d284a6 100644 GIT binary patch delta 183 zcmV;o07(Cz0^0$QEPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj5a7jc#RCodHmPrx-5e!A6tFP1dKS&>lva=9V5W|04%9BqKqT4X+$Zsu4`3$@M zLrT2a8Hru96r{Cq#Vr)1v{A*9+a4sb;ThN5_DD)<6+;X$#4r$_DE9AckN&G#JP7`G lYU#DQh;sJ delta 251 zcmV{&nC3rc!AR;w@ z!#71q7VqwvPscso0qhmEHULf*;Fjd|(?TNh08mjjjFP$jsmj&R{c*O|Gg7hh_@!SjVd_k*X=cp^km7-g@WJd20$L*$iK= zi0rzPx#1ZP1_K>z@;j|==^ z1poj7&PhZ;RCodHR?TiwK@|Q5=)P~@?b1Y>@&qkUAUl`VCn!y{rmMozx@h|Z#k~pb z&W+*n1jRx$abfWZz@-Wtzcb9e3>0C&rmKF*x!gN5=V#9O&VLNR1MUfC?rckTAb7@A z5oL?->l|Hovpq`3{l@5{fxL;avg0dRM-C;v?Ric@t#$Z3!xMA5c&U%C5@CQkcNV3F zhPZ(4D2FC~;U{<1O9Ncvx*;C%Yll*_nMw4rDB!W_AP6m~Qv}y?L)pf%_(C1kRU2w6 z7$XJYZnm&0+JDqd?94%C=I9z~biRXS(Xu+VkfmlyQKn{-8aEhX2Y)Djjg@>^Xm++a zUrf1?;HfdoIxf*jDJ4rdG$>_sc{Rt0f|6xm8LOf@jNtdNp$OS7wv8^ZX&N)_EJOe) z?#fQ)ABr{G)5}720^4X2xvC`BCDR?Jq?(43ENe@lM}KS4jgHE(bdCGips^!pZN~&t z$4zhb?V1Y%9q`D^;bt|*zQTxLTeejU{DVauDZ!LnP5ESgFyK9Y@4CyR!}pjQsF;0A zz9k(8K#u7wgA?a)8X8>5yuy2b@W06=C(MNJw2y*$O;=g3-hxxRZlPnnY5J^FTh4jt z7u_i}8-D|G!QW{P=kku+7$CVCd)9g1Ub71vE4jonTFF(Tu`aXFb+=a?pQSY3vSqa0 zDMsXrD0TN6bH3nK?k;wm=RLYc4$@AT$l5fy zx^{sHvj+t delta 677 zcmV;W0$TmK2E_%CEPoOJ01FZU(%pXi0007aNkl=}sKg+AN2fgNCDOv;^4oHZ)|OM1vGBPY(ijn0cm6$AFEo;jdzbu1!vPlQYCGWCi~ zX#n?zMr;S?A~Nd%3>sPc!h6Re5@af->LW(5FQ|>W*J7&HeAUL7Ie>Xrt_Y} zYpq3(6Z7;!-G3Of;gPB7VE(KR0viJSjB3re0rf}pm~AMinUmwafol;_+N@Y~6Js75 zH}@(WJ+GA&(NJx~fM>>-Opg-t+nHl)1fAamSj*!NW6TBVTXt0<-6V6pCe;O*iEcP{ zjzf0o2+P`-fTtp|xSlPO6nWFhQY_-f_JvM!m;}`Or++k-NybR01lQlM?Ofh0e1KTQ z$DUZMz&is)`m`g!*T|b<2=GVJ*Wco{k$&Ll3czy!-vB%S@D9Mp27|o0E}yZI zX)9O3s?=pRk}HC|1n`U35$8eC^+xQQ6;?&%f~B-Znb>EZ5NzsfLUa5E!25PZ-X!+D zLo1gRmVaBhG`B7rp8#>k0S z$9F@(KGg*qIh@)%kM-2n%A^X=dqU9N`MgPkzyv>|VEpf`l{a3CNET7`PevM5b?}4U zY3P0Zb^E1q({mg$9;cKJr#r3L#kNhsuUuOjRvx+jrTu4rVF3IFT{9G8Hxpvt00000 LNkvXXu0mjfgZoJS diff --git a/platform/src/tools/fbd_designer/fbd_editor/icons/diagram.png b/platform/src/tools/fbd_designer/fbd_editor/icons/diagram.png index d405d2a831d3b285cb7810c55f234d12021a599d..14197fcec0e682b46a30a2290aa8941869c6c0e5 100644 GIT binary patch delta 631 zcmV--0*L*w1dj!fBYyx1a7bBm000XU000XU0RWnu7ytkO0drDELIAGL9O(c600d`2 zO+f$vv5yPB{TMM zt)8O-Ce(4s{{tWiiBVylI{YD^{jC4T`=Pt>|8Iclc|us1PJ+>Pk%WRY85SH7IR&TeM${vCcq{i zxhI{mg+*-pw(+5}s+0o4a0WcNP$FXY3;?;7>)EjCe;vVvfuUWCxju zM9(%k8CqNjUPcAZ-!}UEp8FR{_VBLgzGtxWzcIDhQb(SD&A=0l{3|+T`~d0QTa+`= Raqs{D002ovPDHLkV1l3-8YKV# delta 537 zcmV+!0_OdX1+fH>BYy$-Nklb8 z6CC#()tvzpb!>WaJDetp{EmWf4%l?YMXD2kHJgh^dsW~jCEU^zBn;^9BU0wy#?xH8 zGLv)yaD&KsKHc1>gz$bRl;YOAqI=1NZ4jLR6f%sZcz+y3G3!32ozL?@6pg7Z5}g1p zfb+7piqAs$8($yN`@Hldm{?gHi%9D^SqRn5K-E;Xni(xD>jrGNF({jHWyFG zOzYRSXj2s_8Zvku?lyDHA~@+ko?flLu3F~X5II2d?l)<}X}&kAMx<%!^D^8t5JSIR bIKVF&ni7~H|1E_*00000NkvXXu0mjf`S14S diff --git a/platform/src/tools/fbd_designer/fbd_editor/icons/diagram_blue.png b/platform/src/tools/fbd_designer/fbd_editor/icons/diagram_blue.png index 6cca638aa13c152b22536f94d596027c41c64262..8b6681d4176a8dd5a9ac365dddfb78f3a6b9a4c1 100644 GIT binary patch delta 936 zcmV;Z16Ta)2eAhsiBL{Q4GJ0x0000DNk~Le0000U0000U2nGNE06Q?QqLCpOe*tq+ zM?wIu&K&6g000DMK}|sb0I`n?{9y$E00TxzL_t(|0qs`3P9rf8o`l~9l!E?31r-+x zI;0CFRYDIUNL2ht{UI20u6(HRn6;v#55G85yf8QAIp4T|ZZgkh( zC#~$YJ@a`y;~7UN1THTxadDCEcDp%kIBr;4mY)D*ti8RxEDa()J3BjwL?WB$$9Mo%ZQ=Mz=jZ2l^vAle zSi}Zc?>BXj$FQj)_eU}5vub2yB!#AgMMcadDLibrfc?LzPe5M+%?GhTe=rSe3lO%@ zw`d4}^kC4MPsFe^j^-zX>0csLRR1UL14n*6VG1sqnwp}SnHhR}ds7vadMQCX*oatX za&pq%-rjy!=MbogcDtS6+tO$>3hsCW6J1@=#>R#qzrVky=jUg>2FabBogefUVYIkX zsR-hFy-w1iMKpbh^Z9(Ne^#p{aSgxFM>68O{EL&3X}!^6#>B*gM=asUc5Qce*LDYG z;ou~cHWI)EXpV4Vg+Rn6;EtD&@>bk`$Y#(mX)K6rv)NqBX0sx%8>5dC+a=DyXZ}f3Go%RJ6aD?Oi?#?U68y1PNu`w>Ke_5l&99#_7$2cZi zotJglvy^Ya`ue)qtcsAySV?RuyS&MwgkMo~BeP zC1k7Bsvzah1TMopGnX3CvTz8rTCIe>*0L-?=8`WjFMFg94-fSE`s!PcjVHqdmjJB) zs*f?LO1`kL;E_H(e?5KD0gK~CVh*m=)m2Xca7_ciq)LhvC#GAfAQm*ZyaxgD?z>5b zkJjBN%W;hGvFiaRQ8p5DfLvW&sXO*w6iD{AiB$FJ&CQL^=Q=sxl0d=5m*0KH%5>@I z#4aiORQLJ({JgIIdXxeJpm?Bk}h3mdAWPb;+6Ze&yvwRplV<76Ly6RI4F) zOiF!b#il@F^2f(V(JFc}+=hCANUH@<)Ys71A>}h}U5`?qmxV!)trq2vs|?6jFm@b3 z)RB(~uQWy>%oWF>fKaVwawy9}2WOjW@}Gc%&w}qWm|xUiFuwtJ)3g_%6vt5j0000< KMNUMnLSTYgf3yAo delta 996 zcmVRI+y?e7jKeZ z#YO-C17b-;K~#9!jxA%jb<&y{v)jZDj8-QyX>_m~gitx@0u>k|tt5h^ zpg&ep8U3y3M`05~yAUB|{fQz{e@;w8>DWLxC|zj7n$m8L&66gGOEkiJ58yHYX+n8I2$YL*0OT(n8z`>bEAS&QW=_jt(B*v0LC z7M#sHYefKPtFq72ltAD8f2%71V0**MEHDg9?-y0q3r4fW7xoV1|4fD7Ch&D6G&_}h zvX@$iG_Qe70~-c_@v($=^0UCZJ`(`wX6f~s5wPw$`UU_VSC>R5NGPs|_}-e0W{Xd! z&*G+RM!ywy&cVxm{Yh?(0oglh(+aFrMX7G$IY3n#WKxrYXvWS>F*WQzWLJM zE53Vvzg^9a(^4Q2e~Zd@$`f#g?Z_8LRA;gZCO!uf4z_@J-4@;7tke`c0ffb zw)@&CQEIv%C`x=vRzl4MKPa%N{_cxZ-~gc0XL0);`3AYN$}XeX;f diff --git a/platform/src/tools/fbd_designer/fbd_editor/icons/diagram_green.png b/platform/src/tools/fbd_designer/fbd_editor/icons/diagram_green.png index 19ae3ed67317d1e4580a9857a912f2660e9e4828..eb15e3cbff7af832034de274d912c4c0864f8867 100644 GIT binary patch delta 956 zcmV;t14I1m2gC;<)6gcapu;JliBU?591;z|$VWj6go06oAaQP& z+52&4pPf4kDxT!E_cw26clOPie<2E5Y7$0l4G>u{w88l*u2jny0!pOOTv;|rB?J;+ zRR5r6F$7rOo~D|obyd1rlK~dmw1~E+UdN>;3pkeeK3ScZ@wg_IL?Q5XtIx*izSGPv?%Gu;z)bVSKV3S})EsRYa7G~2|sn&?ZsIdu;&f6kY1|LjeB4lk3Z zDO{`SW?gPC>&aXpxLF$GGPU+0mcb?A1{Y_VZ-C6pp*;oCqZiP+xJ2JmQj%5dsOi9{ z&h0++2baRCu(OKw3PBMeAxY&9N_%ssW}qGHlIKdHuX6b!T6i7+Ml6kxkg?*BuJ6CW zqi?SqgV_kdWrK+uf6f>wG=(#>p-4+#o_lPtWVql0*1N~#$F7?qvwrSw54l4s`=#vq zNG&A71(y(i9s~wVEv~k=P~LlKt;$30CDjf-6X~-cigvi*VvsKiE4W6u<~$OdGb>Nt zG09W$NfgFsT~cYMOZ{vJExd9Go^y4#xzM83B%QA1iQ6W*e}loKrmPmA)mi?ijDRHvAnho81wS15Ct(&bn-e84|-Yj zFlX^zwbEaTvP?|mDDbMs&!g?NJato}f{sx#JHkTocrD50-<1we!My9f9nj6cGZaXa e4l~^^nBUJC5@Z=rx4^al0000RI+y?e7jKeZ z#YO-C17b-;K~#9!jxA%jb<&y{v)jZDj8-QyX>_m~gitx@0u>k|tt5h^ zpg&ep8U3y3M`05~yAUB|{fQz{e@;w8>DWLxC|zj7n$m8L&66gGOEkiJ58yHYX+n8I2$YL*0OT(n8z`2HdCeY!7Qg>w>v8?it3FP_dI10om4aay0ssfTz4T`2X5?!@e;_^_lv+%s zJb)k}BwMuzwE~|Mb2M{7d^jk9kkH??At9ljx(4wEvlcC;QvODUoqbwhGCP%f zvaL&pG_Qe7)({4O@x+*S^0PqSI}-rt^t1Gu5wITJ^#%YQmsCe5NGPs|y!Dxl7PC*6 zrRSz>M!yN>YY6Xr(=wv1e+?Oib#%J&Xw@s= zShP)$_W2$S{_O8ndqEZH{Oxri*$pXr0SFFpQQzWLJI zFTT6~yj{(X(^4Q2e~rm^7MA6W1|qDf*eW|ZU3p*_&a!*6*veN3t$c;B>P)4$`s_i0 zrm1b+p-+CdM*x6X*~ZY`k8Sc)#g|fnCd0=0qk#y^*E&T6XI)~ zV!BHF`E`J{X%!{XQee7OoN|d)QR3T3Y*cw1Qd8go07tIfCa<}8c83EPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj5*hxe|RCodHmQf1AFbszOst4&Fg(-LhPrgGa_~;JejBQaEqbz_y$@KJSGgdk>`Zh9Uq*lzJL9Rd!P$$hp?OHI@fW0 z3L;Ywqaez3u6NWqaTDRWcqEEf*g=C8w?NmifbSfas-AHIKXcrK&Ct0{SGuRQcU@Xz z6EP89HjCr?11hxQGDDu@SV*M-u>$ delta 324 zcmV-K0lWUg0_OsdEPoOJ01FZU(%pXi0003QNkl@cH+3LIF8W-+KsR_N!)P> zMPv%#80d3B@=#<{N5p#(nHL#3BQ`;@m8Y{Z(+6+@Fj8{(B7d(eVv-SnpLLGQg5(y!)@3dt-d_BBE%Sd# z1VNj`W0R4bmhn*uu{Mc`CEMupS|@P^B-cLuchy+?vRTW4p|c}Bkj$hzG}Q^|Do1C_ zPp&$L5+{z%#yxva2LM>|1d+=@5V1}c&*{RPM9Lng&)r;kw~TKVD}%-&{{O WzDw;DmPx#1ZP1_K>z@;j|==^ z1poj77)eAyRCodHR^4&JFbtMUd1nOr*t?d42?`s)1i%E)3CIS}34jUO4WJXGP3Z9m z8^8ciRgxW&n3V9>D-V2k4za9Q(q~Bq;EIcfk0|3v+`tw4!hgq(jDIkE(iz{TYIxY7 zOh9;0LuBeUW_LA}G-5T!H#*L4tOK(UPp79j<@ zBhG>=i8GCyT|o`#`L>y_p%Qb{#~ziGD>-qLVNM!^yo?phgjxnWp`aMqp=$KY;wV7N z$U8BIEvQ7PZhe|UZXgQUMte^44|=Ogqfq3OmJg(PXn%c{a~`mBV|Y{**gN8Q(mazB zcd{XhA#Ic?4!T-sv`6w1>DM4k!kv_dh}Naeg590?Og+;)e0+`RN9#U;@_58Li*c@WiGbpgb>(@~ z!#NMMep`+7*ihN5j-~#sZ<3RXTVFTCFvx;C4h-NR0Z-QLRlf2IEOy4eqX0MsK z?|z(l_nmv+Tq=qJ7a^A~1a&HbNfsn`{yQ*$K7idxgQt&NQGaHV+mps$nKTeU>n~#S zfl1B-n3YtX>k5G5#J&`|r2U+HS*0e~126#ay1^}M1N;6P;Do)4Bs+fp0$|%87Hf+Y z-$u!1wR<+s^#nka{i8u*hf&^{Xfa9coP6VutK)J9K(_>NX=f6jEE%hh-9C@3-t=?e z=SxZ5++5@KaevRHhRIZt?Zmch84Fm_aRSgvdbwv?wltQSqz+}YfBU$0wVku-E~*MF6|B+x<9vl{?@Rsi~m9<~kp zb{&g4whsZ5d^L)#lA?9?yk2-m>wXW}v(FIwowFX;WZ1I$%OxvqL7Zi)o05Xfv8zq5 zEmsJ*?;IgpRid3aV;jE$xSsg*JqmZ+Lb0=@$_MZIl86s!d$6RO_yORKKlG2BnbkJj zAbB6aV_qj~C1Vjjzp8Xi#<_}b9L)DVWH7n(pZm4BJj2@K#jtw-rChU5r600000NkvXXu0mjfB>f?Q diff --git a/platform/src/tools/fbd_designer/fbd_editor/icons/filecheck.png b/platform/src/tools/fbd_designer/fbd_editor/icons/filecheck.png index 50aa352df296ec17123e2f5273b2495955c01cfe..7b18660ab4857956ef176efcac61a2ad60449f5a 100644 GIT binary patch delta 771 zcmV+e1N{8v1fvF!EPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj7xJg7oRCodHR^4&hKoI^8C_t$o45)uCm3(Z8GnT!d_@gsJO}(HuwP=f z5@Uf|bj;A#oSRq(4X&B2>0vG5>m`oNtxL3qYSIB;BTG70ql6Gke890WI@kFb==1wT zx}8+U3CZBh#V&|vrgXivh_)q*w(RZQ zbv~;NzS(&I7i#G8n6ICYOw7-5K_<0R=lb7K-v*&==NK+5aK&=H$^=?rWbe+ZiD8Lf zF@XyWCYA0*T*Dc8vB@m$1`L8-^)htKJohYF+knKgsefT0eB%2HOD66NHL(mYe1-2h zJ2L{{CZ4O15N(q;aHsCCse7X>Lzg%)S6V)Gw0MW3oL;fa_982#ViwB#NBU^*+csMx zr@gF7O1fA+#w*<09d`E`lk8ohqw#b%hn8MTlC@Y)zwBK<_g+Z8nCJC#$0V#dtXyDf zFSBz~{C|{>@iG5Truu@9o3{;d+ugVFAqikPYU zBz|*VRtKMXcLIs+3KHi~7iKuo#O-Bx;$&Mw;u^4A&*%S~V#;-y_1UKb|4t&m>Gv=D z^ve$dCq`;9R#(Z&#ce(iIg#Hql7Pbzm62B;eSBo+S%MfnVGP*tL>DFXnl={cb|H^* zWc4j_ulUKe9oeuXe1EzQ8+^`O@)wdWWjxMYq-U<)I+@bOQcCWB%6z0Q@3yCHG3)7) zfQCm}|Mz9tyF-2ae{s^9qdl@X~ZDeR>X4f@CB&T6qw9s!g_zqa%UC2Oyj$3m_ za-@9w+)*j)IdRQfpd`;ExbR+wd10)C=pntuf_W*uM%@>LQG)pT-OaR@R*(8PrkosN)&4FEsUDW5f-EIjpJJRPt^?wDZ+gN3O+X1^eW3U??lbn$Z zqPdi~&QNY$VzUZ%ah$6Nc;8Yd)Q?C=#qesbt2tW_a<#e_WGI=1@>qh#_4>igvimr< zohH#C5w?)m>+0zgL4N@_0r2FNEZ25at<%IOI6PbS5~%O*lgM^a1N*oLJPG=-cEauD z>LXA4+CK5xbgx$Krmwl|WiAEJ;CsE$r*JbHa=zDlwLBcl<7Wc>{}<-pGys1AAF_$zgJP3WRu2D@>p%V2^U;1+M9I*E?z>uN?UVdve+@ajTyD1c+|$lrp+Y#fOJ2 z%tzHFrvJt7U8R6pgbknaqU}Fqi!TX!ZBzDF{`cLkaXU~s^>K-m9s-sfgK}vY5$oFH z5#Jn-c)Wm0M1MdL?^=XCWjut8hxK#;H5-ZO>B?v)dbc7ztvFBE?i?BeW9iIufthgv zoB$`l3Gj>-8E-uke_pYt5K!M@{md?4G-d%4w%3M#^%vy2HlkLFjuuP^W3yB*fy45w8aV1MQ~Z_IO+A93o z0vw@VikaWCp?^i`w(wvr=qLff75KMgeMEe7bC%0x$69OM_t^xvU{Msgt^JfO^s@>u z#_a91MnL00<3Qs;p#xDA^#I^K;K+R>BG;r8j>-qo#RZgQRP}$E1FjpMipVQ7537=g z;4_!eh?(6r{(l>0n^FMi6VW_`G!#>M9s4$`N?RTpdp--d>+s&o$aTB`(DO}Xtsr@m vMC8jqXjazmbwnqNRFUZV-i8$uI2!&74{eq(un{aY00000NkvXXu0mjf7P`{- diff --git a/platform/src/tools/fbd_designer/fbd_editor/icons/list-delete.png b/platform/src/tools/fbd_designer/fbd_editor/icons/list-delete.png index 883fae1039d1540cd56cf9e75c0c90cd7991d99a..b5aa87a4a4909faa7292826fa62f4e17ecbf6ed5 100644 GIT binary patch delta 801 zcmV++1K#|_1;7T7EPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj7)k#D_RCodHRzY%7K@feDkUcl>XK9tD-~>rdAUl^PC&*8g#&VTpnP?T^1WEQ* zfjc)AZ~`z;TIIr!6M#!2qjZ7l9ifueL9R#5zRSv2VMSq*JiJlo)nYy}$GL3IxQM9Z~Ib^Gu5R{3pNsjA0Vh6uC{2VL!R-w_^ zlYaOk0w(MQV}P6U)J1It()>R|-Gjtz&9?PANQf(=ujs%I_& zNb$e)to%i=Y-@T^s7zoP%_G+Z$@PKZuBD`!gpzF4rhh_PYr(A!)3I=l`&g&4LuhVC z1XIIJZ}*=$7anxLmYKoza)y0@A;EICR1EyaqK1@UO0K4SGB-T%9^ZG|WzyliMhA|~ zz9rv+h65m{G`51GGdKx7Tx?$A(qH^%a!HYq@QwDdZC=roAa6sjsSupmeRB=#P19$d z+H%gOUw?32YB~nwg70Yt=W4_ppvkd|VMEE8171peiRQ zaJ}R9jYVyeTwN!W=f8+10w8aZ$V4R2jaw_)!++WrdTbbGwpE6HeROt=`Jen{DKoz> z5QYn9APqk~->0sl;Y*s^+PEnnw>BRYTeBM4wu}g-7rak0oi`+Uo`0{A(dH7%I}$6& z?X3-Y615&lcwRrITw0ZLFweAhB&w>p6)Zhb|anVgMO{Ie-*E61epiKm}l}A%7yx6ym>XOu|dX(-RX> z+~~7o3pgS+#-v>N%(-U^V8iHxRpg~}ZLjA=qzV!HQZF6SPkJmO^+<*r94qyaN@)Vm zr)F#qu0&)xLf8wc_Jh|JBGRi=$klUZa4Mq@>_pPyvGJj^8kX%1^-MPG7`vjqk7oJ(H z!F+7G`^re``eq=(YvgS)h4?Gw8y|6pOuz8xH-L8lep0c*QEY*{y=$MLmT5az!LBp} zn~9P>0q~*o!a?3S@XDk&gCjF)*iY3CH}L&FaZ7l7IGaHIT7jS00000 LNkvXXu0mjfx86he diff --git a/platform/src/tools/fbd_designer/fbd_editor/icons/paste.png b/platform/src/tools/fbd_designer/fbd_editor/icons/paste.png index f2bf570aa01039099b6c57c7de810abaff6229be..0ab07b41a887cc65780a66de70de96b813432753 100644 GIT binary patch delta 214 zcmV;{04e{}0{Q`vEPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj5k4Z#9RCodHmO&1HAPfW-<9B$Y`bHjvCle18Dz%nI_FCgIOA7#hQy?oTXGj$T z`Tqq*TAN=~R!xeL*1*I)Vx;7VSkmpcBpmMXlWs4hWJc_CoKHB7Mr?^w;-2I572}k* zYCVPnD#pOxsGAu>$G8%ut}!)EzHg_Cszf0ervZrtG&19sgwJ2IsHZ;D30blp3uFgW QVE_OC07*qoM6N<$g2dBOHvj+t delta 305 zcmV-10nYyV0n`GJEPoOJ01FZU(%pXi00037NklB@1I{|_HlFi#BWL?)Gg%(MuDZxwi0TERI z4xa>N=FIiZbVfYV9l%}?YXjgE1Kcw6)i)3kH30G$V3C-)2Y**l!4V91WagJnP10OC zNey=fu#N$i8m=|9%_h}Pd6@0ZOseKJVgNM&+gvx_0v7;EOZ(LY4+WPV3yRhKpPx#1ZP1_K>z@;j|==^ z1poj6e@R3^RCodHmd#DWKoEuBCP*BC4#E+EqR>I;AXET!KnF1u;0{O!p@TpL#&!@# z+(9@)>|w?~kz*47VXqV^pR~?KTKkP>-;M{^Qx}^Id{7Tsv480vE)nMRSysG*CJ68h zg2$r=A2SYM0Bu-w%x^sn-&}@dK`ZYxPKg`PN?LqQkI;%kBNkr70nEa!NTG6Xc4^4h zF^?hsi(>P2afLJG$=`#GizK=(OrG7KDFPlpMT=ar;uJ}$#@RHL!lB!|RBsYB!^I94 z1FL2wa@oy^xqqB8=8~$D+)!WCTs=dwRSJnNit-6nSuY?9K1R9zST~nixp#spNT!yU z@@x>6&JM0|q25qh7+h-wA2zD+jS-7QqCOv)espBYlk80$D!O0&5f+v>!KL~_i*zz! zc;W9Mj?gmM@9|4`^?A><3I}+NXPSk5?j!)&+hNf;Y(bu+e~OBL#ui3!Xwr5UvHg22 yT|@u_MM%-;t5Z~DdzX2x9{8bmNSwZBSNR2udgm1ZOlo)l0000G_5?;ozeR~mVpmSH@GsFz9e?)o|NK;8 zt;G;J8H73{c$8}*p-c&20-&&3Zac^4IAfuV1Fjgp#lW+q+J9=f1~6lI1)vtnT=Whm zyi9>-HCGBeyQ^d2QRbp~3IMI=){y(=mam-ACRWQ&KcuysgfdeAa{!kKz>wU6-vOMq zf|;5M!1dm1x7tktY{XQbF@9{oox(mEQrWV*i>(bdeefq70-hQ6isvh!eD z6w0{E*0r&z* W0-7A~1AXxT0000uK5EPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj5+DSw~RCodHmhB0`Fc5~{QwQh>^{0rUBRGj}V%?;hID((x-)^7-C}#?7(bAF+ zlBQxFXd&T}mwR&;0(gSHMi*w-fRJH`6(*Fmg$&>VMvNEsxPNgBE#Vna_384&Sp1Kb z_>~v(MY+{=yPM`@YY!aZ%xN)q7vk%BxErgN^uU}pV)sOhB9VQH6DRJ4OQy6d#B-%> zcfzH31MY=e7%4~E>hXdeXKd2T3V6%7$5xvZmBR7-Ks%`vnT9)|xa2h1Y0&GzYB`p! o(EqdA&AYmdj~iq1mT{mn-ke!R9VuZGegFUf07*qoM6N<$g2=stbpQYW delta 342 zcmV-c0jd7Q0{H@vEPoOJ01FZU(%pXi0003iNklPx#1ZP1_K>z@;j|==^ z1poj5qe(T_>ZcuzzOMri4H6gED!%xlJG;1RYLV zWAK(9HA>R15CsktDl|sBL#`-@ruBp|UP1ecZy8fuQ7i=)cGQuZq>7VK^CYnXW#r1T0dGhn(O2UY;sz2`AJrOy!`*v~7 k(94m3iwy4_%yB}D0ow04bGO!G!TVVJo&z4X4Pn5&-gtRfh9e*+&&K;zXzUv z1qL1peTQ^#F1LZ31bGF{fK7|<0yqWUy1Y#m?9<}1OJ`kleB0uY7XpcvlB&$T5=C=6 z3%=_CEz(c$b3StYz0_?=7X7ZumbYm&VrJQWHIjd_y-McKC0DAIq`|?HMg0E@Gmd~y XYurpou|ZAp00000NkvXXu0mjfPTQ3@ diff --git a/platform/src/tools/fbd_designer/fbd_editor/icons/search.png b/platform/src/tools/fbd_designer/fbd_editor/icons/search.png index 3b1f9a8634c2fcd8d64cfdb9ed7ff060bcb5f0ae..29f8c57a2a87c48f1e4f9ab678d93ed0a0c63faf 100644 GIT binary patch delta 653 zcmV;80&@M91g!;-EPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj7LP;nu>!RMu>!RNJ3uM`fuoPo zfxH_WXC@mYn+@5Z9v}3cvk75m=I+nT-35LdOt9scS|A*vhJPb|NBmD@dxjikh*#WV z&)kQGD<>90gKH*h1Vo$i^Bh~|w#>AK)udg1_AKd4gA!VZv5BTJ`mXag(Bc25YDc)i zgf6i*#x&qY++Mhy1o=Er$J&$nuR+>X=Mg<)K#eM{YA=4`UuoteYAuxsB#dk*D%Z%bTzSZ> zQ>}hlQ>&krw0c6vK9l@;++=AZRh)?HxmTH7?B}{&lB6?Mt$rA>VB4HRGEw#?#vpjv z#ZK%$ZhtFwHlB zH`6fUguKnqGYwD%(mPjsk->5<7m$bFG9PK5XWM2EnPDmnGZmer{_ngc=V8^8(Zc6PY|+<l_-^TZ!~U0UvCgom)kSmWIO!q+?N@Ug`epSvEYOR4v8 za4xod#b69|wtpnfV{eTa6slT_NCBYW)R&vH)>6k~pfd^fDbX8^$D-Q+#|6g(n?iSX zTpCH8u>LeKC{A+l3R>_{8~PZo qs=s$WYF{07B&`7b{|oas0^kQ~BI%MBnNH~d0000Px#1ZP1_K>z@;j|==^ z1poj6BuPX;RCodHmF*3JFc5~{8V7I?O>_cr6F1Ne#0iWOsFT15Dsc|=uOXgCX%zV^ z@=<^AByCEs+~vJqTcD#Qg!W30NNe3lX!-2H5Pg&-OOb9y6o1APcY#}@d~ua5qAZLl z{+&R11@)rPc@=VQu|F>^&HML_My8A@{#H`;1@g$^e#OmFGcHHiV<-;srS&QH$mZUO z1ce+E2R=#L7wL+NUZA-BOmp_MQ(rcGY~`qjIk$}*`q@mHdu1Pqy~IPQ2gXeVzGUm`qSkjE-QedjnRq9+GV$L4?5XpG=keJcDa$7hT5S<{7NO0tqPyy+{ zp#wS~oZb<4fKvhH_)eq*Iv{ia6%aZAiM!ECV`f>*MN{n=|8h@DIXDtCs z!-4I`?3I|vNmT%#SU>I#61x+M7}`leJb0y-CU z)&S_v3h(?~M1Ky|>D*Y_OQ*I%N27*5Vw%ynX;M0dOBO4AvOHDxi+7zLk>8wb7k|yA)p-8@o&zBhCV! zaf5B$1t(^MWd`(BL@r5A?K^(NDWfqs29-oJ)6-LJpCXOnAzjyEAF^YA_C(|poj`S3 TCw-*w00000NkvXXu0mjfX?48+ diff --git a/platform/src/tools/fbd_designer/fbd_editor/icons/shape_align_bottom.png b/platform/src/tools/fbd_designer/fbd_editor/icons/shape_align_bottom.png index 5c99dd06ffb519e6199165cfc0dbf119411409e8..89d41f6445a6eb5fdbfd5efc5a7102809a932bdf 100644 GIT binary patch delta 171 zcmV;c0960?0nY)DEPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj5WJyFpRCodHl}QRfAq+#~=U>PBAH)OcR>YxBRA}C|i;y;?fHfR;2{Cr(-c>a| zDDmSIrL(~%)EwIrZr^w@tx_IN^<-M5Fx3>MFol;HHPx#1ZP1_K>z@;j|==^ z1poj5Xh}ptRCodHlwAry5fFvP?QX~Z7h*w_@IZdUFy<>y)O3#N17OflTHCXj50F3` z{8wL$)-Hu8T_2p-Q%MkLZ0Nn^y5Nr|OXc9it=rrQL38DB4JZ;aSB|JTHrF=TTq)Gd dg*KSkh5^ah7vY~fhf4qe002ovPDHLkV1kh(MS=hT delta 229 zcmVTEPoOJ01FZU(%pXi0002HNklr)gL4co;s2h_IqO~jIl21rb^ fRv*7GbpY@NSz;--EQ?R<00000NkvXXu0mjf9z$q7 diff --git a/platform/src/tools/fbd_designer/fbd_editor/icons/shape_align_right.png b/platform/src/tools/fbd_designer/fbd_editor/icons/shape_align_right.png index 16596a422405dae8d2d82fbfbfc60ecfecc09ced..288e50108c3a16b6711c7e71fd467e97dbe83e32 100644 GIT binary patch delta 184 zcmV;p07w6l0^9+REPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj5aY;l$RCodHlwAtIAPj@+*mZXQgX};K2HV4Cwf;x#2R>OSX+nsUX*jLD--nGl z(QWY_oN$~;#9@r@8(8r}K*5XfLhFTV0FP7C%>b-en&wCV6fqa}aG>VO^;DY+ZSmjZ m(&=UZP+X~@IMxf7(u@n=Di`5dR0Wy<0000afw`wkIztP8BBjp9MZd~f#jgLU73j!$)Ad= o*|9efPf7Bpm>qTd!psAJJ03qTAO>lpX8-^I07*qoM6N<$f*dzwk^lez diff --git a/platform/src/tools/fbd_designer/fbd_editor/icons/shape_align_top.png b/platform/src/tools/fbd_designer/fbd_editor/icons/shape_align_top.png index 59308b3483f2c92df95d049f8f5e176754956583..1c8c83d235606c01d0cd409dfa21a91104b7c11d 100644 GIT binary patch delta 177 zcmV;i08an*0o4JJEPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj5YDq*vRCodHmR$+}Aqa$Z+3W2653&cUmkJ6*gR&pydy9lgW=M&^?QnJaL!g;_ zT=X6SPOx~R`JMf;)-^2i_*E;~7fT&l>k`X4hA@O7e7>;$b1F@m(HnLwOqEd})o$pi fw$hn?Y?*FEQ5O{iqOaSK00000NkvXXu0mjfOMXU7 delta 210 zcmV;@04@L30rmlqEPoOJ01FZU(%pXi0001}Nkl++#4_549m&03{i8f(J{$~S1cxyyH2vpi%>V!Z M07*qoM6N<$f;*mD6aWAK diff --git a/platform/src/tools/fbd_designer/fbd_editor/icons/start.png b/platform/src/tools/fbd_designer/fbd_editor/icons/start.png index 6fb0c3b726d0e0c4648e7e7ef631636b858dbe54..509f1235410ceb3f3bc71953b1e9fa67d7479e01 100644 GIT binary patch delta 510 zcmVPx#1ZP1_K>z@;j|==^ z1poj6wMj%lRCodHmETdqKoG_^$b*lTfRD~70~LrJKm|$#Km~*ffC{7o=|HRi2s%EJ z5-0#%zrDL4qmav=17G-NE|a@l?z`Pz_Cj>loZIv-S}@Z)FMrV<>4+-q9c3z^jbQ#v zpIoAo8Ef+p?TOYT(f3_%;IQ$A9#qtN6K(WgU8djrGa`&dcb}=RItvddLcGZMbu4`e&IiL&tD>rqTZ(u?r!Huo3l?RF&0Vs14JCn%}{=J#_=1d z&;|H=NWWffhJSv8Zh*%kJL5Q2@qv}S>mB|TQ+`(d`HUl#y^$%uf$B^BOZlZbev>ec zQ$qf3BHq;{(U!UBOSSO#v?96El&`Q_8;rYVWQ8^WhTgvEZj6OxK^b1DzOdd<4${rB9a&1ATupUjP6A07*qoM6N<$f(+vB A#sB~S delta 348 zcmV-i0i*t)1pfk%EPoOJ01FZU(%pXi0003oNklHcMF<=YQgKh@lPDaiD#nPr zQK(~r?|)7ZO9NmEV5Kpf`vTv}cmd#Oix?D~Vgg`IENKBRLw|x#_I?ELPAq$3c^U$| z1@H{uVB;BpPh!~;%R`@FXbgLeVGdx~sz4S0S;t9ZNZF?{Zvb3s_|HDa>1b&TjV)kj z({BHr8;Hhm)EHh%{kuC?ssG}Z>GfZwS9|>bolC+KwxL$`OzaaUyJ$Xo0TWBw;f<9R z=K0M^Uq54FnN=Hb)|%esUZTH@MWJ7o4(Ox5k}4 udcogib$j%Ji#>Y4RXqL{|GzN91b{28>6gJ`wNifo0000Px#1ZP1_K>z@;j|==^ z1poj6)Ja4^RCodHmfumrKoG{iW8hh+z`Qybl@721r337M4oE6cE3gFVz;pnZaePe) z`05bO-ODB1Ktle^!T7*8!vVXO{bg_OHUZ8$k;I-QloCy}fq#!%;Z>b(51c4K8&9|r zQQ5>|uqy5&awCS}YD-)`Bg?xTkSJH{j4`j-~W)67YbQ*A)Yb=;_E) zT8(#nO9w{^qCsHHZJLQd|9ynCNrm8Eg@v!4vsqvT2Ec>}}RDhS)IE5zivU*C@m!TU4 z=*jegFL^;vDNn=M8We?Xl|Y9EG$5#-`2;TYca+)s%6}i|$b8)pjlix5vfj%<%q8TG zlxSt#sD~}gL*tBDoQ2u=mvW+h3%$8oI^)D{mc&04w%X=O;atxRX4;x$9P5nPp47V( zS{ekCkQ|<41k7o&6P{^}tE+Z9TU&j&l80!KPf%qch#B12a{8j;p@(h0Wd# gkMkmM))#-$A5qStCP9rA@c;k-07*qoM6N<$f<=G?Z~y=R delta 471 zcmV;|0Vw{z1o;DyEPoOJ01FZU(%pXi00052Nkl*Az zf&3)=?-5(4`y?V+Rh}F1&_E}uIyV#Y@{?AM`Q!8qz;zYyi+LZLWAFF-s%pZ?xW4fY z+hSlPx#1ZP1_K>z@;j|==^ z1poj6V@X6oRCodHmeEmzKoExiO9hrd0U0MH#0s&MBd^4E|1H*r}`|p1M7utyF3K>1aD_;~Kr+*C#6IS$yGcf6VBBvRC z5P=ZzRe}N^a861Oyvtp=(~P3B+|J1;tOSV{uz(jbTGpao45ghLRf0S2?>!u$>VM+g z#zbRD_{~d9)mz&GjjO-;SKwUCcmuCov6p^^JS=recd+6AG{pUsPTZxt4mN(krZgC?vGiI%Sy1sf#6`kdRuXC?BrdOCH>RjEH&blxUCjB1e6<;EhD`_kq{G-(UV>!CpfN~Ch5X2b$GU$FYo#H za~m0BIE0Q4LOmq-IAl?jWF24uEKM2@>i}=vV+(q&LzgCvmw)?$y`^?QM|D8G;1cL_ z9ney6(@-b44Jbu(MM>5b=K>uadeJykYkBDq9~8mgz)1}Wt$>NIQbq71aI4`L@DBX! z0PF!>D}Dn8CXLr#u)^cYU!mlO(&4Y=JA^Gn@@1N;2tAPgUWLXUt3*kGFzr zginDx4bMy(e}8P|N*jn8W2B)Rt%V-7T{KaniE^Q*2`9%oko0000Px#1ZP1_K>z@;j|==^ z1poj7S4l)cRCodHR?BhQFc5u^oO75Cbj^(ISQSL6Anw3Q1yU-II|yAt;tJvp6jwls z(nQCogXnI`o81LSeQW}d;_<=bH$#Gg-tGfH>?43zJQGYbbAL)b5I&=Yb8ZvvN!&j< zXUTDgYjn-8*mPlG5j6PDVx5R=3%+0C*j$IGE%-%KzK@;gQj-#TDDe&_#%SB--@uUj z7s@02z>L1(U`#3Fi}?D>*B~lpLPN(VjXyv%)!>5uAfwJcp~{yyiQjAH1@-Hh?kl<} zUd=q?JraeP8-H!=@;1RPJ88ZkWCvGE{ILHgkNzwWyUp>;dV5zJT(~yXHlu_C$B>;3 zuHQD^Hi$mXX}LUYu79sE;mozU>q%Uhq+2{YpaJG?4+!TTUw4yp->rK(_Y1=buQ1WJ zYZf>)U-)UV#X3@6%5`jKBAiw|*fmPmXKI&g6owOA!heSownl?4w^v@?I!{p85@jhv zI5v5ZWD?dy5Ny zr7k9~Vt>i5bsHxvI5pxzxqjG7WYNnmJmIfTD~*HqAAJh`o*E1t(^_Y#E|#k~$Of|| z)8lJ^$|!`l!WGYU%yAu!ZQ~Q(vlB)MTk$^MN17l6(lb||SIjQ2e3u)<<4>8txg<(X zYIKH`F)Y<|Z2jNVf}7YCzhkQnS@M%%eHIi0L6|>6Ba{i6 z5yAxIPoIPd2oum>{bd8X0m%e(gmeSA4iHY?&k-UsUH~NEMhHL3R#ZUNnfYViQQ&5K@Oc!{-`0TX2t4igs^&3PJUGB_gdIF!KUO zZ6P8V$T#r$5`Q|AQ^XNkJ19QTmI2dkZ7VtbkCx5`TpuqjA;RisAhmayGjoD*Rs0fI z5P1^L4|-)T57hjhBW1@Ei-#9e1- z+QBK4+WES~acjXBT#1!yi%`nzAT1$#@MSE67BOxUBVfo=uXK|%#ZGU~b*X7IG=GXh z-~iI=E_Y2*`e3I;*Y(<~u7>Z@A;q4jC}@yRTF`ez_@s5URgsh^r;hmlh4~v0(Kn^1 W?c{AP0}WjO0000Px#1ZP1_K>z@;j|==^ z1poj7VM#AYV#LcDs-lIs706u{N0RsQ=N>HsO*MB;K#wP?gqdugW(5@`V z$^s9#!9dO1nrkLzLWS={)@@;JL(dC*P&ZAY0qRMo^qg7JRE%mw*y0^}N=e_LcVJBO z8=4`0S$XMA>D>@NVwumF04o2>DDT(0 zv_xb*o58l^05hmO%Xx_n1}fcq%L2)T2*pQaVA*+Y$A5fSBXKH1i4OP3V^oPF+vdnf z3dH${?RaoVtRxCqxSty|+crOtGhRe8-&2?HTkqRZC1wtTYlmB_FvM|iDo@=+tnkB* z#yAF4Zs!`c#JsIqN?Rxi|0Q7kEE%1sxSrU2(lN$+fR;zHrkcV7ff)K_pM@>Xq;wBB}>WBKB?5>hgnxyb9UKJ0lGAWCi+ zQ!>1ikK%LA=hPgTh}t=_M8R^8xS||ABfYNZcJLAJi)z<==i>Sd`d_NWoy!E~C=VvC z%O3Lfx6GeLbb=xq z#3Q&9G(Ublf=9@gKX-z51Z9Ja5RXt~02eAwfi26jYSc|1JwPxZkvvhPD0oC z9?I%!j8sG_JN$XdX4GBLRuD_i;HH&GWyI4LjvlB}a(+vjqaGLh)?+b^fx5M4GfJHC z8_mc>I2&0=+mDu;# zWnw%?!jQwCEGNO0#C|odoK-Y!23g4za2lK5Z7|P}Q;7%h3aMT;)0p zRlhkN3A^!o0A~PC$&UmDT^3t%lXC2oF(kFP0q`&+KTAg=a3<+p?8Ihiedwu)g)6DA zX6%aZG<$)jphG@uL+_E>48Ocov)1ZXM{?jzx#0g7=63+#6R%><=Yfr{Pyhe`07*qo IM6N<$f{EAGT>t<8 diff --git a/platform/src/tools/fbd_designer/fbd_editor/icons/zoomobjects.png b/platform/src/tools/fbd_designer/fbd_editor/icons/zoomobjects.png index 59f74861353ac9cf5f2a8234f302a5292ecc7c4b..196b274dff6844175e9df58981867805a4448b99 100644 GIT binary patch delta 602 zcmV-g0;T=>1N#J!EPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj75J^NqRCodHR@+s=KoGqP7Jwa4fGAb~9Y_bzfph>=ARP!DU~6A|nY*)@nO)!?zXV||xuG@)cc`GlV}FfjYUYc>Rvf%zid*q) zYc88u5(+#rS>3|gf%_q@#57B^f^^a`_j5z)Dx-upj<`fa2sKvu9q9A?LCFy&*wOH9s^q1f)X(MlntFk!c}c_MzUNDh5i4xX zYHhbS33}T}*?-G~j9`C@qw@o^7{3it=TCZxUPq%^plil4%0R`~sdD~*`4k4BX+|f( z)KH~SLyXj$9Ob*5kAsJWdFrGS!w`R9g)(q74v3)2CBXkzWg@}mxyP>Rmz1$WOQhI2 z4=&d{H6!z<=pDpbN&0>f*m2T{J{@PA~U`tf!+dgJmqDXK+aXOd3b z;PaH!(NT{eUIwnX)=CdqFVmIO-F~?QfYc)M9UYtRX%03xlhQj?VvCZ1kp(|2%dk o-}P0hoN{apd7~+MmHHF-1k`+7F^MKwHUIzs07*qoM6N<$f+3$G{{R30 delta 472 zcmV;}0Vn?Z1o{JzEPoOJ01FZU(%pXi00053Nklzs|=$H)i7bnlJ|ENPJ&I}uqk-YUBu zb9*SOH^-1#aBV@^C3OYSvzR-6=jXG!S429GV38QNZhz(QZD{kp#TDQCR7?|=*GxuN zXAk~4F8B^6g@0P)fBPPBbUZmad+;q@IYK|h*3%iaI0)a;lqYiVw=W4B!;v^<&F2tn zCYDo_j6iklL(_hYZPj_8(BK%TRf%j?C~*^-^exs(vtkiA3Y67s4%UNEt!{V?PA-`k z*6Y?7lXZ^43tww(Lq$_aTgo1&D~JIxZxaPx#1ZP1_K>z@;j|==^ z1poj7AW1|)RCodHR@+s=KoGqP7Jwb_>p8xtK&(JJkPgHOv;(mMwF9jHQbBkf{ge*O zzsNWYNOGBbB~GBdltKehzpEjgkl2xq9^oPWm}zp1$|eYVoa2OiNd zJzsOh#6oCr&t!EEYZLBoux}oVL@UTA?Qq|9q>&mWG%>|44vf*U%FjTX-%nJI@PIMh zVr`5lW`e93x&B zyVd%-Hw)J7q<{7bArTzAcoWFk^TT)44=O`ziJR5|}wKBYl8c4Hr#zzl(#oiBgd zS$ej_pBN->M(U;$_#@yP@9AvH8xRJQRJlxIi-w6(PeOVFe~4@^u`?o>6%t1(6jCik z9-tg?kj%tR1{R486WaseI9auITMz4C$Nf62#>`@H&42LZ6w3V5JRE6HMZ^ZrZq~*o zU=lkI#lmr&mCExI#Ffjt7{%2~s?O`0wfZ$xtH*Tloyh8WEWt!tacZ2;-O}VDFM2kG zBCcA2AF<%jTtOmH4)!TRZ?}t_$j@&pnTyZA`V9FzjRVB!4Wq+`2f8T9bIDViGEHum zhzo_tePiN|ciUyXy6RSOiaj&&Bevu%?yuEA5lHV`E%umoubj&ntJ7dqkHwpc@U z7#D^}i;m6zr-U$#W%3U+mP+z3VtyUE#@3NjxBmvd0KeQ82LgO$RYumAu6 delta 448 zcmV;x0YCnW1>yscEPoOJ01FZU(%pXi0004$Nklu zD%3T>_c2Z)k^ndWF!!x9TmvWp6smfP1qaVqM4ka00qi5=RexrIs`@z_EFvkP8$L3b zeeh~q%FFJ=nQ+%{98BnYD^RYgMJSMnWX7+x(3cRr2j=#k7{EZ2*s~Ln9nag&-3@KK zud0u8pvLH%aPEe&yw(A8#kP?0DNqNV^XHy1d*)`G@m`Oe=?J`FF}7oN%mpXB2P-nt zY>dR`?t<+raeqy)D>&aas$3#s3gk5s_NJ)yyC&iz()2Y%4LnLTnqO_6@q= zashDZ8+5@|X|~kfS;o1xn!S49)9RAyHCZyz*Xv4Equyh%kgV30Ly{MOR-AhY6=e_1 zuZf*t;iKD5ACu`LAKd|X8uDMF5x5Zg5IU|!S|4UwhB-d3QGGSfE}PQqd76R_e9?wJ qRN;$ib*m$(*iQY}|6iEjF#um&X}+ZEe;afF0000Px#1ZP1_K>z@;j|==^ z1poj72uVaiRCod9SG!IEK@>ehh*m}uI~%dlMhzxZ+Su8t6jl~u=c5q5faMFoLT%*> zz%PKtjs&7HMjMufN+XfV#4z5=EWu?TEV_$@CmCkAd*`0HkAIz+6=2*;jegIl%^+B` zAaIRkkrG6jGf2k?jfvmDo_=BhYeGkmsLBY!sMDy$#Ih?~5d!0Y!56|G!8c-giR38y z{&_5rl^2M5Rrfd4Ar#~lBHmQ}MTAbD9?Zno}N zZ0^MD#Z*KYXQPwG84^n?($XRDln2Vxf3(yh&7jHl#pX`T;cb?I=e#n!Xc*?jywv)7 z{Oq-+&RSxP7`*Nu6-JhHcwGgf_GfE_}fM1KZ)`KlKcQM0UMQ}cj+qsCl# zOt_I#y0_Tg#DjD^kJ!FqL3M`wLR>Yid_VhNX@@` zDOlnT;!Bh&-HWQ9HxSoiva0{bTc+AzAL+6kH2NHLp?{ERDhdtbgrxVpJGhfs%60c-IaA1I9kb5bU6n7;u331RcrW?(}i`~_rziNS%XQ;(fWu9#ps^zKJ(C+8n2 zIrvIe?3ZVM?!9~Wd}dNgaL!KwOaKJ%tM33JA;gRYK|s*=o_~SM8WLETNEZNN8jTN< z$!ZLsPmvQ?n*WBrpi6L--HtW-h8oT7NvFxPl@b;qVS^@DAw;%WFwj%cB&^r=hE0J< z-C`>LB^at=6L!(Y@!pC>&sFP`8S%pT2nm}bl(hp`1?vuWxF&d6=SWzJP^MK5^{IX` z0Z!(?-neW(h<||>84ya~c?#?tx$dqlwrcQ$9a9pnaE*jAwDQ-9e^p;Hzf4sxI!&~;@2PZ7$M zbi2X!VQ+V7T?3zA<#tLvrTbY59A5y(=jACWi(a+P$#<<|9nIww_$l=D)l5UFz`n%V zMoVmO1Y9q4fmz>NHvoPx#1ZP1_K>z@;j|==^ z1poj7Q%OWYRCod9mp^aQKp4iKvs=+J5Lc>-$^b4%NK{26?H8y78!&WWZW&mi8EDz+ zEJ%gH5hGKW8440(5#<9w!@q`!7zQFlr8-hof=YATdydm2wttBu&SBsuC9>~c-*fMK z&sk>%;vKid|1I$|kSs133YcP9CPecM(SBl)@D3=`Uzk9KIY^RCZejpsapjUQmyPEc zLqBNfY4}H|6JFX{>?K^Cu*PiMexHsV4wdNo8kS3DoKV$kYyx~OPM~^oF_y;iN4slS zU_0F@aj2lqvwyfZnGdu#^ai4yOP?5meR-^T@BTPI?)f%~m7nt792u1T6i0neOS`bv zw+{#K%(j91Q^m0HBTH=zX_!5I6dRxR@MLRO3T)n-kZr_^8z*HOiBbQ`#ZlN-j<*l; z2eU_fsY%X@hAx{C7B8O%?o#H4hYappm}Spj2M$A7}~G33_2!>!f*$IXV>GKiaT zCsfYj*P0Z(Fn&a~`J%*|N==HV#H8AYFk4TqCQ)Z+znRe~W3buhUsr1fAy3u=EnQ2U z7TJvqYnY!gq%awbgsn@XC|nyy_SrYD%rhwzUR7Jm?7?{vtCQKDh4WWE!_ZpKKKvpx zCayoO2!At;NyGX5G>HxzQR}&|asPTBQ;Dg(flLWa&*1La_U+VdAIIghyC2@c*$Ios#=yZ7$hyEBWTh&bnMBI*-SgX+~gB65TfLx0w2Gyr{EGcc(Rz(RRC zCZZljQwK>!wMRrvcn)x+o^|SiCg3uG_=%`44U0JVzT>ObHsin$nHclX9RKkR~%P({qzc zeEC7`hacn*a;}|`g8^tf*`wC|_tbqfp?h09((~?BGkEJhqo@s zIfanfFph*mav`B`jW!}Oe7&1Afvq+b=3MZLw}0jh%SB&K&eKma+u=2`KVDAZ?5A#G zieMbHoPXx~u@HjM@5<#@P(Yx|Sp|f1E_qoVJBKKlU1YCzeLJseWrB-d$P#mdmUeqk zRHvzi-DwPx#1ZP1_K>z@;j|==^ z1poj5zez+vRCodHmr)7=ArOZD2@lW_>b)MiQ8$QAkewip(2as3daN7d0itQ#HhPmK zaaxx7KoJ!_#8F2=;>2F+m6S2+5<%EwMr#sjXr-F?B)%i9^nZaV7IZ^R4m^RwRa!BL zx#^q}L4(#e!k;j4chX*c;zLzjh>1;H4VNA5a$ItAGS_fVSDbq|3Lh7XY7-An?C>jv zIhyUUsyH^SizM5%`8p(_Kl27pcxb{1@5nszPCiphXnfj$ASYt`0@Kts9j=$lHvj+t M07*qoM6N<$g5w2fg8%>k delta 257 zcmV+c0sj7~0;K|wEPoOJ01FZU(%pXi0002jNkl%#GEoc0cd467N&HnEr5+=F5;Nxf|Yb2?@!m|pL*8P#4!)tqsVu{%(q#@ zC6mP~T1WXlE`F6Nu3|G5+QQG2ixzX`b2B#gof&I8&Y5a48ueCJ@$ZS%a?+SuMwvgp zT&eXmrF6LTtPol&IT0<3hF<6!`dOYZE;aI@$lMZf1ZM8;9}+_)+UI#m00000NkvXX Hu0mjf^OSKZ diff --git a/platform/src/tools/fbd_designer/fbd_plugins/add2plugin/icon/add.png b/platform/src/tools/fbd_designer/fbd_plugins/add2plugin/icon/add.png index 89de3dcf5f7d849a9acfd2dfb028b050a9d52985..9b3b1365b767f9e489560a997c6d7c0553a3e19b 100644 GIT binary patch delta 262 zcmV+h0r~!=0;&R#EPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj5zez+vRCodHmr)7=ArOZD2@lW_>b)MiQ8$QAkewip(2as3daN7d0itQ#HhPmK zaaxx7KoJ!_#8F2=;>2F+m6S2+5<%EwMr#sjXr-F?B)%i9^nZaV7IZ^R4m^RwRa!BL zx#^q}L4(#e!k;j4chX*c;zLzjh>1;H4VNA5a$ItAGS_fVSDbq|3Lh7XY7-An?C>jv zIhyUUsyH^SizM5%`8p(_Kl27pcxb{1@5nszPCiphXnfj$ASYt`0@Kts9j=$lHvj+t M07*qoM6N<$g5w2fg8%>k delta 257 zcmV+c0sj7~0;K|wEPoOJ01FZU(%pXi0002jNkl%#GEoc0cd467N&HnEr5+=F5;Nxf|Yb2?@!m|pL*8P#4!)tqsVu{%(q#@ zC6mP~T1WXlE`F6Nu3|G5+QQG2ixzX`b2B#gof&I8&Y5a48ueCJ@$ZS%a?+SuMwvgp zT&eXmrF6LTtPol&IT0<3hF<6!`dOYZE;aI@$lMZf1ZM8;9}+_)+UI#m00000NkvXX Hu0mjf^OSKZ diff --git a/platform/src/tools/fbd_designer/fbd_plugins/and2plugin/icon/and2.png b/platform/src/tools/fbd_designer/fbd_plugins/and2plugin/icon/and2.png index cfe5e5c23c4d91597b1d289a3941d6986ea7d2ee..fc9e4c11d208dc29e99497070e01cfee82620adb 100644 GIT binary patch delta 644 zcmV-~0(<@51f>O#EPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj7I!Q!9RCod9S3y?dKoI@K=$ox`g2DAD12=#Z%*+W!PoSJYJb~Omy@8&9+yE7Q zF3k;$YZJ<<>Q0D22u8t$|GiEsO((y*`d4*9P>i@I*8^!=Sbr@d5YDheT@up1CtW9c zO8f|2X^d^OD8wo;=Z-Z!X}1hk7be#>S6&FuQ)NcMxJcX+^UUm=to4d z;!Cqy6q$G27Bo?U#l-Go>CDxw57wOfHQ{%vrrC0Fsaxl{Rua9OGFRD?hFc2872ZXB z!)J0GWGhsGP0+`+9j6ZCoO{1{d!EGzG7kx54JpA zRsgEf>wTE^if%)Lwu^|1#icQ-N@l4F=OeHa%PGAxGmd7qYwG7^YA(&g-|^e*F`mSo zp$TkuTwTWfv@!YQl1HhlSA{QK?76+FSV_DI6Amfp@Ayc>(8D?*6^s+qjU;+K=-2V5 eO;5F5I(`9!i{3X$C^!ZH0000b^J1>OXZEPoOJ01FZU(%pXi0006INklY_T`?z z3e*bZD)6X4I`FJOtU#zhtw5|mea_1|X#gw0*<-`(+#G}(&A2l#Nyy!o-Tb==z0GC= zBANi00~jK$eF2y;^K)-F918R)F|cWcfLT5L1W?IpQjj#N6@P${crM_L{#K-dHsE!1 z`(ZFORBaU+CtaV+C?5bA16X@@A6=eh<~0#@11nIXa&E?Im3nraqt!oRPOz1Qs);BU z8Re7&oKaq?8pW2LT@S#S_D=y!l7InRnD$J*bbr5eY>*1P3#Dhb#x@FMD&0C2c$Wql zcV9CT~(|@Mae%SM=XU9pvnl52KuS|#qy66hUv3Z5RN){5lW34dg1hHj0wWhgSg0XOs4!pjCc z*ilt1mQD+EBHe4c1kp_P91gD;<#LUh9}?I>kM%+8)wQOUd~Qs5UjV$Bd862g70qJ} z>7A)u)&y2aq44ZPh?iyotM)f;ZFkvY=3ZsetProperty( C_PROPERTY_SHOWNAME, showName() ); + + QStringList listTmp; + listTmp<setProperty( (C_PREFIX_COMBOBOXITEM+QString("DelayMode")).toStdString().c_str(), listTmp ); + this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("DelayMode")).toStdString().c_str(), E_VALUEEDIT_COMBOBOX ); + + DelayMode = listTmp.at(0); } antishakePlugin::~antishakePlugin() diff --git a/platform/src/tools/fbd_designer/fbd_plugins/antishakeplugin/antishakeplugin.h b/platform/src/tools/fbd_designer/fbd_plugins/antishakeplugin/antishakeplugin.h index 9c5449ae..25349064 100644 --- a/platform/src/tools/fbd_designer/fbd_plugins/antishakeplugin/antishakeplugin.h +++ b/platform/src/tools/fbd_designer/fbd_plugins/antishakeplugin/antishakeplugin.h @@ -17,6 +17,10 @@ public: QString name() { return "antishake"; } QString showName() { return QObject::tr("防抖延时(D)"); } QIcon getIcon() { return QIcon(":/icon/"+name()+".png"); } + +private: + IMPL_PROPERTY( QString, DelayMode ) // 机组通讯异常数据策略 + Q_PROPERTY( QString DelayMode READ get_DelayMode WRITE set_DelayMode USER true DESIGNABLE true ) }; #endif // TEMPLATEPLUGIN_H diff --git a/platform/src/tools/fbd_designer/fbd_plugins/antishakeplugin/icon/antishake.png b/platform/src/tools/fbd_designer/fbd_plugins/antishakeplugin/icon/antishake.png index 11bc6c17cb8563a6aba8793dd416a85afb9de39d..8af0f25906e69740e02c289e115a4f1a6c85e631 100644 GIT binary patch delta 270 zcmV+p0rCEW1F-^-EPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj5#z{m$RCodHm){A(Fc61-Cmp~M^j#m^$PL5^j1!m<+(=NwN8P{-AfA_+qJn=? zB+-`ppe2+h9~bVzh2Yt+k@rNNF4E#aSYkj^5~&T+oER@Y!hc74LLVbKASEmAp}<~7 z&WpMHI3z+2g0F)gp<)#$qlo^qD!WfamSqDXu6Pwu?2ZI9t5uwg$E>cInNNAQ#$84H zNyOhY12yMrR;#$3VpooK(rl;Z=8%Sd%QKu|kQ0Wz7X6wRa+w+<$E6Lha@fo-KzK8K UuIn8%00000Ne4wvM6N<$f)^)m>i_@% delta 352 zcmV-m0iXV{0)qpPEPoOJ01FZU(%pXi0003sNkl=?5z0-;L96c0JzXb!}@&8e51htmiD|pz-JP0 zuLl4d&vpgiIW~CHuwJ`{Op1dinbYZL`t^-7DMSyE0DSSEEtBGAz>f`U_8tG{x&!bS z0Q))Y+ujEJo>}ZX{u8V#dJlm21GbPK-Of)TKr#t9P9hQMcyl_<;P_xGJ)_EHq;{=P yRk7eAvUCc1RaelTPx#1ZP1_K>z@;j|==^ z1poj6-bqA3RCodHSKCp-KomWzIDAS6#!np`u>wK`QbIZqD-bFGI)Dna1gHSS2cKdE z@-Mian_VC}2?@dAhn$%u`#yW`-p8UKc+@riUb7UCEhbQC<9|%uD3UfU={8Xl;&+Io zQyk+`jgck#+CdJltWAVi`<>@XVH>b~d-x;lh`l4 zSbu-eRrWPFw@Y^{<5!4*62qJOtw%g?hA~FEydXCy1P<(S-WAu5d6-tz=JBf5Xi`dt z#f3<%S^uyh_J2Z|u_=Pm-jcM6n7AKLtVnjM-dK8U4HkU@k!}VL2b9pXh19VtUBBJe zp$Ax{>N&B4p{`i9yFU389XncL5nJf;+p%>lh^6G2jbINNKoV7ZB)x-VFwJ{YRDD!3 z+4rR#*mdR_L|Y+9;!gJ@^B~fg4cmCqjnJ8f#7H;4qJIb^As#SscW9w?Us^-%VMDAJ zK$eEHG2)F2sL;3^k`^gx(e^bXXN&)8|LbvGfmUCqO{6d`kj&h1(ce_=TGSqmmT!dO z@8ZvS93u35S-n7BvsBkRd_e1c~hbv`N%s0Qv$GpO~&vga)7h00001oZ=uEPoOJ01FZU(%pXi0004}Nkll6S002ov JPDHLkV1l1d+nWFY diff --git a/platform/src/tools/fbd_designer/fbd_plugins/btoiplugin/icon/btoi.png b/platform/src/tools/fbd_designer/fbd_plugins/btoiplugin/icon/btoi.png index 6871020da699187f421e530fc90875f78ffe99bc..b7280161dcd0e427fba350d6c6a0a554c00d390a 100644 GIT binary patch delta 575 zcmV-F0>J&E1mFaaEPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj6^+`lQRCodHR$VePK@>gr%hdO52jbCBRII>c1?+$wNLC)f7B(qRTcqDtjd^;G}d>C=60_qi=FTxyfwEtVOK7k?=P`&g2OkTmh6lSI>q z?_oQA!W>qlgK^?q%ZPBxT581VIx8ZW1U%nA{1T?bQ{u598fuw>DQ1J7luK)&gfq+s zcl=Ug+O1KAs;+Hn^oV2XKsq$vxz6z4gmbL2#8{BKd}7c*Xb{3~-7`A4(V8PSQs4wK zWD|3yQ`Ty(eSf7@bg@C3O_(?--XP!A%2k$7W{KUdmG#F!R(sU4Jr4k}0}QN1nLpC*9|P*?mQ7 zV<*TCPvYD^0-}Qc7L)aXC$QKi&I|AdX^_KHx4325!-$AJw6J)G*P*SO=sg^Shi6Gz z_yUTE*GW)z0-;_cY}XmtT3~m`5QK}YV^NOr4dQB`N*x#DitPBY!Mn`v_b@*FW}Ci1 zro?}fI5^8XH^qYfV;FGoL4U2=Ol?g}64dtW?zWi#das4?BGY|}(F@z1rYgN_R{8({ N002ovPDHLkV1m&25nBKN delta 512 zcmV+b0{{Ks1fm3xEPoOJ01FZU(%pXi0005hNklz@-FDLVnhA3hPOS8F0ibki>R@72O8_1B+=-2AMSoqS8Tlr}l&IoE zeK;l5z6u=XJHGrlciD!j6ftp## zkh$d_TnZjGrhjA=Ln|U(0MCg*XA^@Px_3iP*9ZZ4tDjIkSv9hRA#8A5@D^_u?lj|e4-Yz4yHxN~oeHLB{A%qRz|M&QYhPx#1ZP1_K>z@;j|==^ z1poj5uSrBfRCodHm%#}FF%SS}_Du*vjS6s9SMr~)DBDmV%(f3;^!Vh z_TboogpfRjgw3)mWKOBpd8K1aSt7!onXE;np_N)vXYrkU({Be;7ILE`hcuz$s;ijA zso9*1U_t8}(GxCq@$ke|=jrE<|4T=1@TdNzU>fz{GQ)$*3>Uk2nBv&1E?R7t=IhXc w{+u>Esj(yx-kIr`cG^rWv1r;LXhz(=0ETugtj%ficmMzZ07*qoM6N<$f^!yca{vGU delta 274 zcmV+t0qy>p0<{8=EPoOJ01FZU(%pXi0002zNkl;v%Q_A*t+QjPx#1ZP1_K>z@;j|==^ z1poj6%t=H+RCod9mt9T*F%*SQk@)Nq@KFOMtblO|t^inpxB`Y1h${eABCdc0P#<9j z@~orRbLR(<2-EptH1Q;DhSKSG+unQIF;LCKWqr+Zg2QSBgMT5a=Ee}(51~cMRqzXR zrXEgFH%lB+6RDt#1)o+57QeA(42n?5E8&;)hrv@BVlGYOto`7bICTFe1PWi|X~2GP z&5Q|cvn*LE-wb%Bhh~tyS5KwIy302z;hRgmV}xTGbCw_sLtgT5dXff#E}xvW0l*kX z=vf(%I-JhU1AmRYB*^iB!4|ZbfOHE6wp)-soYVjhSAOn|qz1fkJ0=pF^UFvh9k`4R zG{?*OVA0vTxS&B6N(SBpA{{Up*cPasUqXY&UORqJ^|Hvbf07QSu^aW9$vxW|TVptW zd(>yb-!Z&$j8P8j0c6Jvga5mTLQ4}(iGAu!JTcl2)_=^Uxw=GX)r@um^=1L|8Q*s_ zYy}G?OCY;|9)Wc`V8pX?E=>v^mplt_OYz{j+!D~q3uq5Egz4glzlXi7Kzr~jX9u1_ zIbQ_h!NCl3ndPSb=VdQg#*9}PD}6C|p?{PvKKvU+abko7*=ovIH9W+N_-NBSP&2(x Y8K3O!zYohwr~m)}07*qoM6N<$f+l0?2LJ#7 delta 490 zcmVz>2Lo8zCo}PpZiz@ag$rF^Cc~50J_c}O zE^O#R6tJppRh5IE0JycCr-?JVAR_e`7kXv2s@AGnswxM+n8Jm@%Slx?o(m5_x9>vM zHqOydFut-qvwy_9Jkb5Z1BVlw1Z?kcX;*lP@!hX^sjBNUUMIMRI>IXN`Ewq9syg0k z5#eca7u^1#&NdcKZq>NKBvaM(C@_G^1HT&VdoWW+;8pOu9e^4w(F*1|77?!Bs!g32 zKPER;G2vwob!*GyUWwHSHg%b)TLj&`)eQ!l!h5g1vt##O3{iI|x^}Kc4ePOMRxjMO zehWp9MY6n|ZF9RyqH88v*y%sbqRSnxDW=Uze2*cbHw@)u@ig?t{A gHL-$>+&Nc$0x>GZ87kzQN&o-=07*qoM6N<$f@KKb3jhEB diff --git a/platform/src/tools/fbd_designer/fbd_plugins/cmpgfplugin/icon/gtf.png b/platform/src/tools/fbd_designer/fbd_plugins/cmpgfplugin/icon/gtf.png index baa99d49afbb2577c2261a0186e4fb9a5eab25d0..3a0664af5941bae20391e0412aae01fb751b5bb2 100644 GIT binary patch delta 486 zcmVPx#1ZP1_K>z@;j|==^ z1poj6ok>JNRCodHm)lXoKoo}m)f7Mp@aQNGbO4nA6^Ip(Q~*|BImthzQnt+wZYgE3EIoY#SD!L@ea46bzmXjumWxyLJuLuuf(E{%r| zv^Ne2x~zPQEPoChU%9jlo@2l#b$6cXbIrrWff5|^iYu9cG`RCIwjEA8QJbCU=@7V> z0`e^VJ*Yhtk4d-Y14qZIz?Qv^BD|Xhm=8Ra3h&TJ zUJni-ZA74lj7kTNfPL(bM=syv9fyYyIg||6V+9^;wO@)fA+UGsw2};d=lgT)E>j0i zF8OHsz{Es#* cv328p0o!A#6hLP38vprKNz5QJwe{wE#S9Y6_` z5O+W-ARS;Tz*G=AARXWmpn@D7Bo!>0Xe~~W72Cv@FjAz``SI=T?Tt4yGZaO!08j(S zkyhUTRw0B9^E?;yJu&cDrNF^g`URj;G$}}))e69^RxYslwSO`d^ay^)Zq`nwhPs+| zkoDa;r9ue1tAJzmf=ND*EG`Om;2OY|WKD8@5io#7G=9`Jk*uZ&;3U}0JKzU@xNj2&ihWeE$b&aH`!p zgF9IZ6>zC)9|OgZ6_f00i}pTOtI);(2Z2dy4_~GPw(3iD+#I~>_~;m&3q{|G%}kCY zr)o4l7d9A-U#FT}|F;844))eFsbWSJePgRs@S-T@Q7S_(9UA(p{DsN9k&oM(loF#1 bA#8pCRO_6DZ|;Rh00000NkvXXu0mjfKoh?P diff --git a/platform/src/tools/fbd_designer/fbd_plugins/cmpgplugin/icon/gt.png b/platform/src/tools/fbd_designer/fbd_plugins/cmpgplugin/icon/gt.png index baa99d49afbb2577c2261a0186e4fb9a5eab25d0..3a0664af5941bae20391e0412aae01fb751b5bb2 100644 GIT binary patch delta 486 zcmVPx#1ZP1_K>z@;j|==^ z1poj6ok>JNRCodHm)lXoKoo}m)f7Mp@aQNGbO4nA6^Ip(Q~*|BImthzQnt+wZYgE3EIoY#SD!L@ea46bzmXjumWxyLJuLuuf(E{%r| zv^Ne2x~zPQEPoChU%9jlo@2l#b$6cXbIrrWff5|^iYu9cG`RCIwjEA8QJbCU=@7V> z0`e^VJ*Yhtk4d-Y14qZIz?Qv^BD|Xhm=8Ra3h&TJ zUJni-ZA74lj7kTNfPL(bM=syv9fyYyIg||6V+9^;wO@)fA+UGsw2};d=lgT)E>j0i zF8OHsz{Es#* cv328p0o!A#6hLP38vprKNz5QJwe{wE#S9Y6_` z5O+W-ARS;Tz*G=AARXWmpn@D7Bo!>0Xe~~W72Cv@FjAz``SI=T?Tt4yGZaO!08j(S zkyhUTRw0B9^E?;yJu&cDrNF^g`URj;G$}}))e69^RxYslwSO`d^ay^)Zq`nwhPs+| zkoDa;r9ue1tAJzmf=ND*EG`Om;2OY|WKD8@5io#7G=9`Jk*uZ&;3U}0JKzU@xNj2&ihWeE$b&aH`!p zgF9IZ6>zC)9|OgZ6_f00i}pTOtI);(2Z2dy4_~GPw(3iD+#I~>_~;m&3q{|G%}kCY zr)o4l7d9A-U#FT}|F;844))eFsbWSJePgRs@S-T@Q7S_(9UA(p{DsN9k&oM(loF#1 bA#8pCRO_6DZ|;Rh00000NkvXXu0mjfKoh?P diff --git a/platform/src/tools/fbd_designer/fbd_plugins/cmpleplugin/icon/ltet.png b/platform/src/tools/fbd_designer/fbd_plugins/cmpleplugin/icon/ltet.png index 5897c1294afad7e4fda027adb6f9b7d638940663..b91ddcdef62632e0292db32edf9a39ba5838a2b9 100644 GIT binary patch delta 515 zcmV+e0{s211f>L!EPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj6x=BPqRCod9m+w)+KoG^>DFsjheDn{@P=VTk9T+MQDiA7w4#W=Z0IVQmK>Y|E zm;%)GZAdi0m|PMPXY|d4Id1Omw|Cjy+Zd?kGT`qupE}Bw4}XIRPEFqsIu4;#YM|g( z=uY3zM8~X9rd(;Dh9z6Rf+gr|8G|Ym@(%Dz`XgXZ94zG4W@rsXWq^9&DGf2k!}J58gA-4y@2ajM#Ewz4x5e$5F8?mmE$V z<8xQtAe{=GW`C_qykm+-UMw$6fw`qAEJ~Yc(p>8?PNO*sS<-+WvgnJK2KHn^z|}_I zvz&3xbi;t{F@?Z$IZs?%4e;2X#ei^Z@;h!B_1-R@6`w}%o^^4T2C0te)os(<8RO9) z`>m%)^Kg83deo5t@iA$+I-H;VK7NuLdbPvU*a-e>ihMl8&^o+w-^V9rNbm(`4#MMg z7;ej8ry0U4-?gYEQe;3B-;n`xo=9onxB-EPoOJ01FZU(%pXi0005tNklwg1!4v3JZ3X`*OFt(9Do!*%g2} zfDzK#8o(@su;geo67)GSux`1)!6W?uP--_RNUmxLV64amHh-VXQ$cI+t-6Ei$J9`_ zRrO)ewepx2Lf9k)lgzr-91TozNU|XL4&YPYlY$i;N#y|Djz>SWvZC#|lLLT-JHKd{ zeu@v$!C-%PGY6j5rq`bR7G}2D;bK2oSy->^LJUK?!s$wh+-Qvh$# zv+YHvE#fG$!V^M0s$D9~cKND!y}&i6b629i30=EMmw%7GQvWiSR?!R_q`e04sv_aV zB2AGnGi9rZU$dv^ER4Nav=)hjtCOox_-mMY?*^AX9XQ&+##K0%3SFr*Ne3boy4L(@ z&(#R_)-$Qaj6sz2%T(|z%Z5=yFWWZs|MC}R;ElYhOPx#1ZP1_K>z@;j|==^ z1poj6g-Jv~RCodHm)&uKKoo_~W+=cC^f{4<9cT%uAf$qr3M3VT4q^u>!K4BvNG6Zk zK`20Sy>|uV!GV93$Vng#A~Nuk*k*6M*O7@siy>w<8@;@ z0Q1as%S*h&M8~N}29RQ}+RDaNGTbm;w?4gs6aCae z{;k!K!5jJ?THrqmgT6!v4yT8R-uN)(p^rlw5J+j=18OR??7hy-V!Z delta 432 zcmV;h0Z;z$1JVPKEPoOJ01FZU(%pXi0004mNklK6O;{r z4Vn#L0=fZVgE9f#pdFzjzyz2L!UPY!%8^b{duc+BA}mFUa!I~-j{WYU03?L45RsLL zl#(|-MPzAaTP@3y&`oAwH!6b7XZkK8HPz%Gc~)x?nRDg@!+*!BT+j}DpWULpm>cS` zYfp;4JEsgYYt90WV{)*n235WPHL$AARFz)vAtJ97kQMAewh7zvF&bK=p1b%7kS^rM zWi+&RCjiMV83p!lSa&Rzz#72%ly?jQ9|3;(3{L_M0;}q+FCy~}kk?iKn#AM7!K!-g zFTa@z*v8*95Ptw~0GQ@GU%kXD_=)YqHuCD8790uK0btr6yn4F=dYx(%I1;c15Do~S zQwKl9OFaytCY~n4}3P`%vXt2W@0PN{-K)^;-ms!9^1iVB;Nz0t9om>ECdBqw4 zV5$2@FA@m>1oqnJ|Ji{I2K&}CYs8EqGJ-l6JcKZdHYxOs{f7Q5zc7Vw7Z@^0000Px#1ZP1_K>z@;j|==^ z1poj6g-Jv~RCodHm)&uKKoo_~W+=cC^f{4<9cT%uAf$qr3M3VT4q^u>!K4BvNG6Zk zK`20Sy>|uV!GV93$Vng#A~Nuk*k*6M*O7@siy>w<8@;@ z0Q1as%S*h&M8~N}29RQ}+RDaNGTbm;w?4gs6aCae z{;k!K!5jJ?THrqmgT6!v4yT8R-uN)(p^rlw5J+j=18OR??7hy-V!Z delta 432 zcmV;h0Z;z$1JVPKEPoOJ01FZU(%pXi0004mNklK6O;{r z4Vn#L0=fZVgE9f#pdFzjzyz2L!UPY!%8^b{duc+BA}mFUa!I~-j{WYU03?L45RsLL zl#(|-MPzAaTP@3y&`oAwH!6b7XZkK8HPz%Gc~)x?nRDg@!+*!BT+j}DpWULpm>cS` zYfp;4JEsgYYt90WV{)*n235WPHL$AARFz)vAtJ97kQMAewh7zvF&bK=p1b%7kS^rM zWi+&RCjiMV83p!lSa&Rzz#72%ly?jQ9|3;(3{L_M0;}q+FCy~}kk?iKn#AM7!K!-g zFTa@z*v8*95Ptw~0GQ@GU%kXD_=)YqHuCD8790uK0btr6yn4F=dYx(%I1;c15Do~S zQwKl9OFaytCY~n4}3P`%vXt2W@0PN{-K)^;-ms!9^1iVB;Nz0t9om>ECdBqw4 zV5$2@FA@m>1oqnJ|Ji{I2K&}CYs8EqGJ-l6JcKZdHYxOs{f7Q5zc7Vw7Z@^0000Px#1ZP1_K>z@;j|==^ z1poj6!AV3xRCodHmrqW@KorKm*BFaCj!<@zNQ4`31h|2oKv)soP&Niv;tli$+yHL? zYD|qAdjspnjne0vwgM$IOp(@wehJM?Vcu{4y!mDzC_S((&wms76p^hw5Uz1RZ4&4p zg61h(fnT9U`iT;1G@n3^lrvmN|aLwZ>qpI%p9G!v6ZGr4rZ^C@H=>IVNASWO)- zoLYvg>lUOlVhb5a2kgdbzOj`vdp)>N@M3l1Dz>2Y;9g0AZ)bJpR$!Nzg9A-(W{i-^2_N+A{`d)qdG?vlEgQ~4X;#@2?NmP|+Re#w51N6(i#5k$F+UKSO9$_)d zLyK(SyU(m0Eya1POru{e$+RD1In(EIrGt0S(B^k8wVr$CVHm}K!~2JeLCss+F5>-P z_HqS>>*B~|J8R7ua-o0ZE_~R?Q?l2?gu3TTNwXv5@uv-9Fcs>30Wc|^TY4cdd;kCd N07*qoL_{9 z8##laz5#p!IE(El8L(HXH8y2Ck3412(rspY{6&M4LwzgE zp|qQ872Ve!%6}4=D#TveP|u_LW(edFaCmIkLmCDA3~9mtJd_0TknRFs*=&QQ1;>?Z zEl12pU~0;?F=ea%Aa%+#WqasIAbgY-048F4506@`!6{S1dyZ^xl2|5ztou0TWhC5L(jT2 o^rQU3WYWkNf#)g3jDm=^zs`w=-*$8C(EtDd07*qoM6N<$g5T@Tt^fc4 diff --git a/platform/src/tools/fbd_designer/fbd_plugins/constplugin/icon/const.png b/platform/src/tools/fbd_designer/fbd_plugins/constplugin/icon/const.png index 011d112bf3bdbfd140c262dbaefbc2b3adbcca8a..b3c63b91b0cdd2bdab6888b68ef7bac52984d025 100644 GIT binary patch delta 523 zcmV+m0`&dh1FQs)EPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj6!AV3xRCodHmrqW@KorKm*BFaCj!<@zNQ4`31h|2oKv)soP&Niv;tli$+yHL? zYD|qAdjspnjne0vwgM$IOp(@wehJM?Vcu{4y!mDzC_S((&wms76p^hw5Uz1RZ4&4p zg61h(fnT9U`iT;1G@n3^lrvmN|aLwZ>qpI%p9G!v6ZGr4rZ^C@H=>IVNASWO)- zoLYvg>lUOlVhb5a2kgdbzOj`vdp)>N@M3l1Dz>2Y;9g0AZ)bJpR$!Nzg9A-(W{i-^2_N+A{`d)qdG?vlEgQ~4X;#@2?NmP|+Re#w51N6(i#5k$F+UKSO9$_)d zLyK(SyU(m0Eya1POru{e$+RD1In(EIrGt0S(B^k8wVr$CVHm}K!~2JeLCss+F5>-P z_HqS>>*B~|J8R7ua-o0ZE_~R?Q?l2?gu3TTNwXv5@uv-9Fcs>30Wc|^TY4cdd;kCd N07*qoL_{9 z8##laz5#p!IE(El8L(HXH8y2Ck3412(rspY{6&M4LwzgE zp|qQ872Ve!%6}4=D#TveP|u_LW(edFaCmIkLmCDA3~9mtJd_0TknRFs*=&QQ1;>?Z zEl12pU~0;?F=ea%Aa%+#WqasIAbgY-048F4506@`!6{S1dyZ^xl2|5ztou0TWhC5L(jT2 o^rQU3WYWkNf#)g3jDm=^zs`w=-*$8C(EtDd07*qoM6N<$g5T@Tt^fc4 diff --git a/platform/src/tools/fbd_designer/fbd_plugins/constsplugin/icon/consts.png b/platform/src/tools/fbd_designer/fbd_plugins/constsplugin/icon/consts.png index 011d112bf3bdbfd140c262dbaefbc2b3adbcca8a..b3c63b91b0cdd2bdab6888b68ef7bac52984d025 100644 GIT binary patch delta 523 zcmV+m0`&dh1FQs)EPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj6!AV3xRCodHmrqW@KorKm*BFaCj!<@zNQ4`31h|2oKv)soP&Niv;tli$+yHL? zYD|qAdjspnjne0vwgM$IOp(@wehJM?Vcu{4y!mDzC_S((&wms76p^hw5Uz1RZ4&4p zg61h(fnT9U`iT;1G@n3^lrvmN|aLwZ>qpI%p9G!v6ZGr4rZ^C@H=>IVNASWO)- zoLYvg>lUOlVhb5a2kgdbzOj`vdp)>N@M3l1Dz>2Y;9g0AZ)bJpR$!Nzg9A-(W{i-^2_N+A{`d)qdG?vlEgQ~4X;#@2?NmP|+Re#w51N6(i#5k$F+UKSO9$_)d zLyK(SyU(m0Eya1POru{e$+RD1In(EIrGt0S(B^k8wVr$CVHm}K!~2JeLCss+F5>-P z_HqS>>*B~|J8R7ua-o0ZE_~R?Q?l2?gu3TTNwXv5@uv-9Fcs>30Wc|^TY4cdd;kCd N07*qoL_{9 z8##laz5#p!IE(El8L(HXH8y2Ck3412(rspY{6&M4LwzgE zp|qQ872Ve!%6}4=D#TveP|u_LW(edFaCmIkLmCDA3~9mtJd_0TknRFs*=&QQ1;>?Z zEl12pU~0;?F=ea%Aa%+#WqasIAbgY-048F4506@`!6{S1dyZ^xl2|5ztou0TWhC5L(jT2 o^rQU3WYWkNf#)g3jDm=^zs`w=-*$8C(EtDd07*qoM6N<$g5T@Tt^fc4 diff --git a/platform/src/tools/fbd_designer/fbd_plugins/divfplugin/icon/divf.png b/platform/src/tools/fbd_designer/fbd_plugins/divfplugin/icon/divf.png index fcee8b145b25f068a8dbeb9b9408788d5bb591cb..ec19205672b3179b9105eeadab1746f3b00d4c21 100644 GIT binary patch delta 669 zcmV;O0%HAx1gHg&7k?lK1^@s61whDu00009a7bBm000XU000XU0RWnu7ytkO0drDE zLIAGL9O(c600d`2O+f$vv5yPQ)!i`LQau|#hW1LK zQ_;Nc?7z#9d{=D$YVcF2H~(hob(9^bB6|BF?cb%xr>jG&%3@p_y3`z9rr6i){mQCY zVTJO86MyO5LxDjps9{X!@x07*Q5ZOv7Ku~TQ}kdGovfD@4fNZ1-wfFf5vC5#Wk6`k zZFZqG$B!`ZdYTa0=hcQ=>A;stn*qC*=ciOHEZ00X6?k*A;8pnw%LA!%xmjJ*ENjnE z&ftOm509a@^xSQVCst>dM80N8e)At~;4yj6d=|L_mA>>RU=~Z-00000NkvXXu0mjf DvGO=C delta 502 zcmVKz_a&$$>DIQ(0`AffybIE*qhTY0J-+2 z50Ygy2XLp(6)g7Kv@hrpe4pJcH1-WOmEk6fMUWhkT#zhD<|GH_QoZ-vaDNel0{FDA zI{^0pv~AM#@@scnSnPP?*V|a!pN>UjrDG1@N?%~`$Cl8U4kv)x3`J9ID$Mz10(56? zeKMG2b#6ZZcz;cVu9`X;b3C%ER=T%zcLqhQxB!HQ-|V{U5*h`I$dcsLoEO&Yx`IZ* z0dA=dIuy&fP_(G(U+Myy4DJe=1g?XIWwmo~mrh%Q6QBcc!0 zj`U(hQ)!i`LQau|#hW1LK zQ_;Nc?7z#9d{=D$YVcF2H~(hob(9^bB6|BF?cb%xr>jG&%3@p_y3`z9rr6i){mQCY zVTJO86MyO5LxDjps9{X!@x07*Q5ZOv7Ku~TQ}kdGovfD@4fNZ1-wfFf5vC5#Wk6`k zZFZqG$B!`ZdYTa0=hcQ=>A;stn*qC*=ciOHEZ00X6?k*A;8pnw%LA!%xmjJ*ENjnE z&ftOm509a@^xSQVCst>dM80N8e)At~;4yj6d=|L_mA>>RU=~Z-00000NkvXXu0mjf DvGO=C delta 502 zcmVKz_a&$$>DIQ(0`AffybIE*qhTY0J-+2 z50Ygy2XLp(6)g7Kv@hrpe4pJcH1-WOmEk6fMUWhkT#zhD<|GH_QoZ-vaDNel0{FDA zI{^0pv~AM#@@scnSnPP?*V|a!pN>UjrDG1@N?%~`$Cl8U4kv)x3`J9ID$Mz10(56? zeKMG2b#6ZZcz;cVu9`X;b3C%ER=T%zcLqhQxB!HQ-|V{U5*h`I$dcsLoEO&Yx`IZ* z0dA=dIuy&fP_(G(U+Myy4DJe=1g?XIWwmo~mrh%Q6QBcc!0 zj`U(hPx#1ZP1_K>z@;j|==^ z1poj6iAh93RCodHm)}vsKoG{ib%L*2g1&=d2Xq1*h!t>D0Cpf1Xa_RI%7=)$57y%;Ga~2OK@R|GOfDb(n{`eKd)m<`!eJAS^?`@ z=eL6WCg0T5Hc-Jk3(aGAsn^7IaV;hWMrg7uwqdz2iw3QuY{YJv_-;k0I4`x{w(!HN zpvPc!2prP0A%EYdi)z3kSG&PA>830Tj$!;XvrPv&#aXaC5o)*~2zx3ot2gz<1A{nE#~dwgv6i#1FmPF282E%xpG!A&E?~WvD~U}1qsoIo2`<40 z1^Y%l&uIRK)|$Zs{j2S;w;CK%7JXkdrnVOvLh&DMKwta(FM9ui8%3#-3IG5A07*qo IM6N<$f_4MXVE_OC delta 436 zcmV;l0Zab$1J(nOEPoOJ01FZU(%pXi0004qNkl_G(;=14%lMjL;NHp_K%Mlc4mjDX&MmG z9KZ@dim*BWSTge_O4C%J>%hRi3IVfP`T?Mnw+TT~ua*Gr#D8)DH#$~?g7)C8cjK-z zG*q?iZsMVtQ;M1Ei-28S!GES3A1I+r;_byVw6kpTgtC67+X0wcHnsDNHcTy>$j9)4 z9Z6EDopzN_mOGj5UBVN<0{{ufe5}WYz)Qh<%f z2h0$7p|0)pW`EhRJ0YQLrq&*&1V8rLTeZ$r*}c@1VELAn({}I0+690o*@Tu&`E&XC z;L5kT6e=P03gA;d$th5rn?TgkwL`iS`i-=m@^;rBzU@bj^%4Nh(axX){i7ja66!fCDpufm3Oss``aq6*l eri4*2^X3Z>MuP%0DQ#c?0000Px#1ZP1_K>z@;j|==^ z1poj5nMp)JRCodH*TD$_F%X5}f5ZYTLGOC7BRdc)aIL_UU`K)?9<>8gfH+Rp1uIDQ z@*X4%xqRd{&nUTi7xy;KjJnAfCziIeK+}M>OjqC+<)?2JtXb_z&76JClt)atz}`Qu z%xICpn=n!Y3l=O`uwcQ01q-eN=YG1!vRylWBNqCb@A=TtGEVxnhl?MhOl@dU+8{-1 aIeY;Gt0zW6Y>9XP0000urEPoOJ01FZU(%pXi0001}NklF!Kf@u z1|bl}q=hgFWAMjd3{tsrrKp!)YV}b6QT7!r@0lWcZ_~r-TMRFc;&WcXX z;66oRTBTnARbS&FSywB7hgPm|v$Nub?(ns{Y1{NhEuU?Xj!SNy8Iu1?;64Ed9B{w^ z2OMy~cZ6;9bWLw0`&MYG7cL@WH_&U=f&P*&OtL|~bd`HXjY4u>0NyV#zHr+sEdT%j M07*qoM6N<$f>dQ&9smFU diff --git a/platform/src/tools/fbd_designer/fbd_plugins/icons/template.png b/platform/src/tools/fbd_designer/fbd_plugins/icons/template.png index e6a09a9e62dc41417e7df2723178bc3271e4905f..1084378e0dc51d832558e213ede26666d7c09570 100644 GIT binary patch delta 404 zcmV;F0c-xn1GNK?D}M_U000XU0RWnu7ytkO0drDELIAGL9O(c600d`2O+f$vv5yP< zVFdsH0ZK_kK~#7F?N{w>!Y~kh7coG(LHoOX@%2273by7)eOkme=P)t{sc1fObd$y&N_s@L@<_jYQF3={02cyXeuj=vVT%T@J?gyRJN4%L`c2Dr@fEEMl2{h9d=E-+u{lzaWu>9MtZenhEDZ& zQHo`X<<>8$FENNs{Itv`aVKK8@w*K_;vwNPewX1#JtX|bZySEVA#u0Y+YFaz@;j(q!3lK=n!AY({UO#lFT zB>(_`g8%^e{{R4h=>PzAFaQARU;qF*m;eA5Z<1fdMgRZ-J4r-ARCwC#mpzV!AQXiU zW_s-{F06oFd*kk05A^mfK?@h)3eFTWkoSDz{OP<*#*^H{$bTgt0v;}kBmkhUYtHkG zGgX!)`o32Hph!Y%P5h$9aa5?PiXy_cZRwmNNt_YRIks&}5n)wTgosc?PKDmW122Ma z6W*u(A+**HgG=S6`UGCKp8ujKIF4g#ZD5Rv`$21+%uV$PdRf0%mIVMnQmxyRQg@(f znv%JxK0z6tq<;(iH^A1~xPeju03vcMco+s1;3Px#1ZP1_K>z@;j|==^ z1poj5tVu*cRCodHmoW+gF%U)H$R5BWXensnjl6-_*|~Oh?h(9^pvabb19JdzoUDst zsgPLgJV=hM~ED?w0Ul$Pg(-Pjl+vVLCocGfWvw6U&FJg?@H=*~i(Twu7rXd{XRdCDLsQijwo~(VSfD@Y tiaRAaQL1MrA9QQ|JtN1b4Jvy<>j(DHFc@(Ymlgm3002ovPDHLkV1f&8XYv35 delta 259 zcmV+e0sQ`#0;d9yEPoOJ01FZU(%pXi0002lNkls8G#k(D31-;!04h2vLYcM;S?nNt2lA;a#p0AUCtRqv;uGd5MY}tfHgBW zE`%WH(HQI}3d~yR89Izr5!WFLY@54j?PP?)2qvv8~H}+xggos-2 zkH2bdJxx;@UbhvJWQ7yaylChpZ9_lF7RGBMAB)N@BSvKA<_>krJfA)aI0^s&002ov JPDHLkV1lFTblLy_ diff --git a/platform/src/tools/fbd_designer/fbd_plugins/inputplugin/icon/input.png b/platform/src/tools/fbd_designer/fbd_plugins/inputplugin/icon/input.png index abc8a4a2e110b243aeb5fbcc4a264d7fe6118f03..76389ccc66c72a926599ae5ba896d90deecc501d 100644 GIT binary patch delta 243 zcmVPx#1ZP1_K>z@;j|==^ z1poj5tVu*cRCodHmoW+gF%U)H$R5BWXensnjl6-_*|~Oh?h(9^pvabb19JdzoUDst zsgPLgJV=hM~ED?w0Ul$Pg(-Pjl+vVLCocGfWvw6U&FJg?@H=*~i(Twu7rXd{XRdCDLsQijwo~(VSfD@Y tiaRAaQL1MrA9QQ|JtN1b4Jvy<>j(DHFc@(Ymlgm3002ovPDHLkV1f&8XYv35 delta 259 zcmV+e0sQ`#0;d9yEPoOJ01FZU(%pXi0002lNkls8G#k(D31-;!04h2vLYcM;S?nNt2lA;a#p0AUCtRqv;uGd5MY}tfHgBW zE`%WH(HQI}3d~yR89Izr5!WFLY@54j?PP?)2qvv8~H}+xggos-2 zkH2bdJxx;@UbhvJWQ7yaylChpZ9_lF7RGBMAB)N@BSvKA<_>krJfA)aI0^s&002ov JPDHLkV1lFTblLy_ diff --git a/platform/src/tools/fbd_designer/fbd_plugins/inputplugin/inputplugin.cpp b/platform/src/tools/fbd_designer/fbd_plugins/inputplugin/inputplugin.cpp index 1054e045..35719405 100644 --- a/platform/src/tools/fbd_designer/fbd_plugins/inputplugin/inputplugin.cpp +++ b/platform/src/tools/fbd_designer/fbd_plugins/inputplugin/inputplugin.cpp @@ -8,6 +8,11 @@ inputPlugin::inputPlugin(): CBlock() this->setProperty( C_PROPERTY_SHOWNAME, showName() ); this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("InputKeyId")).toStdString().c_str(), E_VALUEEDIT_LINEEDIT); + QStringList listTmp2; + listTmp2<setProperty( (C_PREFIX_COMBOBOXITEM+QString("IsOutputKeyId")).toStdString().c_str(), listTmp2 ); + this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("IsOutputKeyId")).toStdString().c_str(), E_VALUEEDIT_COMBOBOX ); + IsOutputKeyId = listTmp2.at(0); } inputPlugin::~inputPlugin() @@ -18,6 +23,8 @@ QString inputPlugin::propertyShowName( QString sPropertyName ) { if ( sPropertyName == "InputKeyId" ) return tr("输入测点串"); + else if ( sPropertyName == "IsOutputKeyId" ) + return tr("是否输出测点串"); return sPropertyName; } @@ -26,3 +33,23 @@ void inputPlugin::setInputKeyId( QString sValue ) m_sInputKeyId = sValue; } +QString inputPlugin::getIsOutputKeyId() +{ + return IsOutputKeyId; +} + +void inputPlugin::setIsOutputKeyId( QString sValue ) +{ + if ( !sValue.startsWith("0") ) + { + insertOutPort( 1, CPort(this, "O2", E_PORTDATA_STRING) ); + setOutPortShowName("O2",tr("测点串")); + } + else + { + removeOutPort( "O2" ); + } + emit signalPortSizeChanged(); + + IsOutputKeyId = sValue; +} diff --git a/platform/src/tools/fbd_designer/fbd_plugins/inputplugin/inputplugin.h b/platform/src/tools/fbd_designer/fbd_plugins/inputplugin/inputplugin.h index 9d333676..4895d47e 100644 --- a/platform/src/tools/fbd_designer/fbd_plugins/inputplugin/inputplugin.h +++ b/platform/src/tools/fbd_designer/fbd_plugins/inputplugin/inputplugin.h @@ -10,6 +10,7 @@ class inputPlugin : public CBlock Q_INTERFACES( CBlock ) // Q_INTERFACES 宏用于告诉Qt该类实现的接口 Q_PROPERTY( QString InputKeyId READ getInputKeyId WRITE setInputKeyId USER true DESIGNABLE true ) + Q_PROPERTY( QString IsOutputKeyId READ getIsOutputKeyId WRITE setIsOutputKeyId USER true DESIGNABLE true ) public: Q_INVOKABLE inputPlugin(); @@ -24,9 +25,12 @@ public: public: QString getInputKeyId() { return m_sInputKeyId; } void setInputKeyId( QString sValue ); + QString getIsOutputKeyId(); + void setIsOutputKeyId( QString sValue ); private: QString m_sInputKeyId; + QString IsOutputKeyId; }; #endif // TEMPLATEPLUGIN_H diff --git a/platform/src/tools/fbd_designer/fbd_plugins/inputswitchplugin/icon/inputswitch.png b/platform/src/tools/fbd_designer/fbd_plugins/inputswitchplugin/icon/inputswitch.png index 1dae888f1eed2ddd8bd106217f7bb63d0fed1e77..e0c0a1c7b197187ca7021bdd8d0f21178af666f9 100644 GIT binary patch delta 364 zcmV-y0h9jI1CIlcEPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj6BuPX;RCodHmtAVYKoo_)Ytwg^U>^&WlAUx3-9dE)#uexix`ghaOOUpdKDIk( z7N8mLH4#BkGLs)g@m;;^21|ZsKiy0{?3p%x+R!u`%5)7#JY-!LmvuV;0000< KMNUMnLSTY`8Kf}) delta 433 zcmV;i0Z#sp1JeVLEPoOJ01FZU(%pXi0004nNkl$fr#)PXmn z8}D9*hN{-PhuHV$ImOJ|i-6m@KJZPuky2jhLei(ove}#!3?Kn;@3Bcvg?51@l9|V5 zA8ktc6hL9w_(rK8Y}stvbFEJbeNzY6vKh4w99>+N&03dP(K4l+#@M^XwU44lGlh!g zI`p>yB;sNy_7l%j*fLeflu0e0r1uF+fp1QqK4;I^-;2H zDovAYc@GErko54b;pR9Qkf)7Szbnc2hj#wc@%@jD8*wqDxVomC=KIcLdk`#My?boB zq8%-F0gPx#1ZP1_K>z@;j|==^ z1poj6;7LS5RCodHSKUzpF%bUt#PLx}IA0zAs6g$24#WzS3V;fr1F-_J0Cqx5jMmd;*}vaQ&TsZ#ZK88Jl{b?z6~FJ zp8d4cVsre7w;(bv1}~9NQ>Y&F6dtjI-LbA|vQ}EY;YE8n#F-NPpWg9^+*cfIlX7=GDM!a3>ce zeM%g6AaC?@gFW|A&g2m+XKEQ=7y|Ap&ku2Lg9&phNz3H<)S%0TvfA&6T|!ZuM?AN~ z0D2#PoDU5sf%CCpKfyAyi4SFeN;dzpu<&JKQ=K-%|C87y@YhHYUk$!Ec%gq`mKpMp suM@1{?jyiAP01GTb^K}5iv(->CwH2pEQdP+kpKVy07*qoM6N<$g6rJ&bpQYW delta 489 zcmVxXw z3L7v28}zzCJ3-l?bb`_iV1l|E922-QdWX_9aDa&Tpiim$BN9U>Au0Rhxzwxq8IU_`%TW@eh1^9yFSNPSy)Ik|ZUb7QUf zj|ImA&kOoun`GvsR>yH}4c{SBPuO7A0AAQ=9IsR&hPT8g#(8{~t+-w4j9gO@QOa9W z)-OID#I@f`rG4Zu z_d+N7q=9FwJf72tDPOb0RdbdJmS#3|18~b^>qaUaM;wuMxvOE@98W}+Qx>gfOnGPg zj)DvDOb4@g7KQgjWXNnEM05Tu;E?1RMK5qX(7>~diDEtOBboo6tBM?PbB>yfb7+g1 zH*Gh?_6DM=vWMVo2qA3v{=dgpM9iyaQN$b_wlzmpiadnSi!Stz&4vCVe_=Yj$d99) fmxObSRdxOY<0!`#wa#aZ00000NkvXXu0mjfgMH)m diff --git a/platform/src/tools/fbd_designer/fbd_plugins/itofplugin/icon/itof.png b/platform/src/tools/fbd_designer/fbd_plugins/itofplugin/icon/itof.png index 659f3875748a02488c1596a56142ba74b0469a57..037bd0991e7fb718c16d062605aa945a2fb01588 100644 GIT binary patch delta 492 zcmVPx#1ZP1_K>z@;j|==^ z1poj6qe(ocoTF^;2c|qu2^psbu*M)V?RRt{0mqYzBDkprI2e4P z`sR13({<6cmT4Es8^%?OtaT7;6YBS0^+I>eT3huKwJo#Ow%lel&;P1-$>wh_eA6yx z=ppgMoP!#fGlk$dU^~5@>3oB$9jP=hUwMuW2dnL-A!T5gc^rtn+N7o%#|2wM5p`nG zdCpjV!`{jVH&i`!@8=D}UK@%sJC)%73AUE@oRPqft#1Z5^iSGj8uU@5n9psnFZ7UM i-$N09+GNwfT>S}ZD1Qj?*+WSH0000 z&_cl3 zxbNFqbx9-nV0D|r%DSbV&hVo7QP1y0Rr6mFhy06wjIlCNBANS}b*-9ZU!DgpfN9_5 z8926TwtTzmcUdyridEAID@w%$Tm$346JUT@U^9{I+^RVXx<3HD==MAwu8Q~oSOhk# znmm!rMX&_y0DqylH(aIn__Wxn*^jEOym%z4L>#joOdv!O$=X4=6aT)9Do!L@1!jO3 zt7bQ9b_dR0RQGjpB3T+7qlX1u+$pyml(lG_O5#MaDL=4#x^D}jb>u}$8}sQ6#7BAu zOuBEYX0FPlW2!`a3rzUy8Na~{uxc9LDegua!K43_kxv)gQ_5QgqNPx#1ZP1_K>z@;j|==^ z1poj6hDk(0RCodHS5Z#FKoEUf%eQa>@Y4h%oPc-&If9-5J%Qx};0e$Z=n?b;Vnz8Z zH?V#hh4Ia{Y1Gu3sx67>OSWuhhJ7>3%9(>4u1yLnbf8J5-%7s@-7Jvx$@A;Bys8k@@@5Za2VxG1|(}i5@|i%^fxfr zOy+ZzpMwzzr;NBk$zIl1vm^FplFXM(sFl4zDB%%x4f`pH{(WTnyN4cX1IPoAEPoOJ01FZU(%pXi0004cNkl$$^?u+n4pZ1PQbB2m>}py7i76@+61g3l_y!TeNLX=onxP8ZQDXbt^uq7 zIHbh~fIC&KX3ja1z9c4$QIc3q=>~x3Y*H|pS3Q6^m6NzNTYs5~G$QZ3oAsTkNeyp( zB|9|oH=(M{Nr*$7AMr)pAtD8U96+P0bt>Xrin)WW?U@XJ$JIj!!k~nRu+BbqbpNP` z2!JK43>SckW8=?`RosW+#@dCo*G5XhcL2`-9soQ7sBJPoB0dJ(^Y5(?mpqY@5}Uid zxtaU&r)7I)%ZJ7e*?Yc8F%Hkw zDR%sy$LB?Csb^Az9GP7!2%n0a$7hhx6J0`ok}FJRi649!C{GD;l&V^N0rlFzzdC@y QdjJ3c07*qoM6N<$g76Q-h5!Hn diff --git a/platform/src/tools/fbd_designer/fbd_plugins/luaplugin/luaplugin.cpp b/platform/src/tools/fbd_designer/fbd_plugins/luaplugin/luaplugin.cpp index d35e848e..dbacb5a8 100644 --- a/platform/src/tools/fbd_designer/fbd_plugins/luaplugin/luaplugin.cpp +++ b/platform/src/tools/fbd_designer/fbd_plugins/luaplugin/luaplugin.cpp @@ -1,7 +1,6 @@ #include "luaplugin.h" #include #include -#include #include #include #include @@ -258,6 +257,7 @@ void luaPlugin::setLuaContent( QString sValue ) void luaPlugin::customWindow(QString) { + using namespace ScriptForm_lua; ScriptForm* pForm = new ScriptForm(); pForm->setContentText( m_sContent ); pForm->exec(); diff --git a/platform/src/tools/fbd_designer/fbd_plugins/luaplugin/luaplugin.pro b/platform/src/tools/fbd_designer/fbd_plugins/luaplugin/luaplugin.pro index 44fb96a6..e2a3ff1c 100644 --- a/platform/src/tools/fbd_designer/fbd_plugins/luaplugin/luaplugin.pro +++ b/platform/src/tools/fbd_designer/fbd_plugins/luaplugin/luaplugin.pro @@ -17,6 +17,7 @@ INCLUDEPATH += \ LIBS += \ -lfbd_block \ -lScriptForm_lua \ + -lpub_widget RESOURCES += \ icon.qrc diff --git a/platform/src/tools/fbd_designer/fbd_plugins/mulfplugin/icon/mulf.png b/platform/src/tools/fbd_designer/fbd_plugins/mulfplugin/icon/mulf.png index 17b9821c5cc7fd99dbbf0ed42af6889cdb7085ce..46cf6c406986d535096c51788b12501cbec21544 100644 GIT binary patch delta 389 zcmV;00eb$h1E>R#EPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj6JxN4CRCodHm(6X$KoEuB#6-$5C4^%na!3j3BppPlAWj9i1UjJvB!0vZI=}@0 z!;EbNvW#cf#>>S|vc0m_`+2N+Piul|!LgiwHdRIK0~w9-9> z_@phm)QsOSz(z)?f;qeSL4*)0cu#ncdT=le%o$7GWY-8^csII!EnR!SG#ig-SU1(K z_$UV>Ur-mepgQ*mQ#SY@l`^)q@N1~f)n{6RHB{>0RZxc@at{zqok##A01`k{ROJix z4v?zK8&rChpMIUn@P<&8ZKtwcpr2PeJ(s@vGrZ+jak-JKZodn-s(W3m)(U*fGM3d^ zfi0glgu5h{ZJ8=~YjB>`wq>s24q4rAeR^=G;4~X~MqVRb7_y;X@t?GRjF4g^xrOFD j7Gr%Q#7`TLh;{!@@vY~{#`P?J00000NkvXXu0mjfzFw-- delta 398 zcmV;90dfAQ1F!>-EPoOJ01FZU(%pXi0004ENklsIUIDxV z=;0eb0N$8+zv%m3&<|%YjzM77O1}Y&@@qUK9n}%QMk*J0(tqy;FEqk$qub3ly-|(N z`9oJ~`N&}AOBKALHLYm9wAzv*xw$q;SQ8I2JQiHr%8(v%c&=g@7S^Y*3J=hY=3Y{5 zlkk~OlC;xlR>UJza(3E>4YuG`v-!&}j6IDvoZWkyYKgdYJs>vgoEX84g| zf`k8bu5_;4w13E$D!%g|z35dn&zs=X(`#L1OmJz+wBn`RscN3K;JMw&v^ZGtT*Z<^ zmc=2$N&B$DXFkccwzVz}0lw8f?#5H0lVoBA{;M1& diff --git a/platform/src/tools/fbd_designer/fbd_plugins/mulplugin/icon/mul.png b/platform/src/tools/fbd_designer/fbd_plugins/mulplugin/icon/mul.png index 17b9821c5cc7fd99dbbf0ed42af6889cdb7085ce..46cf6c406986d535096c51788b12501cbec21544 100644 GIT binary patch delta 389 zcmV;00eb$h1E>R#EPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj6JxN4CRCodHm(6X$KoEuB#6-$5C4^%na!3j3BppPlAWj9i1UjJvB!0vZI=}@0 z!;EbNvW#cf#>>S|vc0m_`+2N+Piul|!LgiwHdRIK0~w9-9> z_@phm)QsOSz(z)?f;qeSL4*)0cu#ncdT=le%o$7GWY-8^csII!EnR!SG#ig-SU1(K z_$UV>Ur-mepgQ*mQ#SY@l`^)q@N1~f)n{6RHB{>0RZxc@at{zqok##A01`k{ROJix z4v?zK8&rChpMIUn@P<&8ZKtwcpr2PeJ(s@vGrZ+jak-JKZodn-s(W3m)(U*fGM3d^ zfi0glgu5h{ZJ8=~YjB>`wq>s24q4rAeR^=G;4~X~MqVRb7_y;X@t?GRjF4g^xrOFD j7Gr%Q#7`TLh;{!@@vY~{#`P?J00000NkvXXu0mjfzFw-- delta 398 zcmV;90dfAQ1F!>-EPoOJ01FZU(%pXi0004ENklsIUIDxV z=;0eb0N$8+zv%m3&<|%YjzM77O1}Y&@@qUK9n}%QMk*J0(tqy;FEqk$qub3ly-|(N z`9oJ~`N&}AOBKALHLYm9wAzv*xw$q;SQ8I2JQiHr%8(v%c&=g@7S^Y*3J=hY=3Y{5 zlkk~OlC;xlR>UJza(3E>4YuG`v-!&}j6IDvoZWkyYKgdYJs>vgoEX84g| zf`k8bu5_;4w13E$D!%g|z35dn&zs=X(`#L1OmJz+wBn`RscN3K;JMw&v^ZGtT*Z<^ zmc=2$N&B$DXFkccwzVz}0lw8f?#5H0lVoBA{;M1& diff --git a/platform/src/tools/fbd_designer/fbd_plugins/notplugin/icon/not.png b/platform/src/tools/fbd_designer/fbd_plugins/notplugin/icon/not.png index 8b019d32fde6f524fa7cb7206026fe784738a6a6..82508b8f08ebd8e310de0b46ccbc15f9143611f9 100644 GIT binary patch delta 369 zcmV-%0gnFY0+a)gEPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj6DM>^@RCod9m&;AVKoEw%g^05|AlyO16+kI;091gf0GB{1P(j2qN74c2$RkW< zym?)BHgOc?lkBy8`8?L{Kf3|rMJl~t>Q%5_8UptmhwGrydVebIlFG!NSfzg)QHBxg zWFUQdeCShSVrgHVgg_TeeS2((-4pjnWgxcX7R$~#Aw3lr?aZ8A?{bKP{9pae7Y_2p zWoU5V5xYeBVrPZ<;$?&pPPQySg1^!{@d`d*iz3tb=Sn}h(26r=xb??bPfo#_dWJ9k zR}WSADlw;RjA~6InRM|lr@DUo?X!&soZ%o{Jmz5@95(*&gacn>jw#vayd9nW*f*A7)N(rk3Ql7lQOUQc P00000NkvXXu0mjfcs!!= delta 325 zcmV-L0lNN_1Ly*fEPoOJ01FZU(%pXi0003RNkl9TXl{DE}I(Hn&-BsdSu!tA&IqW=xykgGc&wGhoEQjm=iyxfh^l-gtFtFdA z?tUZjz@GL~cjFRQ(yRcy*vF$A*kAk+@ou#i4Qq>a0Z*4s;5}UHKjLul)p*4l06*3? zo(ZNZlVlN=-aZTw8GTd6R(eKDCr4@53MEC!MPxNA=#{aczsnV-v_ig}Wgdw-T9Vx! XkQ!2zg1%CU00000NkvXXu0mjfme`xL diff --git a/platform/src/tools/fbd_designer/fbd_plugins/or2plugin/icon/or2.png b/platform/src/tools/fbd_designer/fbd_plugins/or2plugin/icon/or2.png index b6a7cd6e175db9b1c563f64696e54ae70e94dd64..deee2cacadd3b67dc860ca5650eb61b84bb52c82 100644 GIT binary patch delta 458 zcmV;*0X6>m1MCBkEPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj6fk{L`RCodHmtRuCFc8MSV8>^UP#>KE9BzO&;0C}6)DuuoU~gbK33vj=R>wzr z1N-iubvF$IBBoH<_#od*GHs{LZ?oCmqza;h0`9N4HBqlJD1Ss~sT;-6&_G=(5b!Hx zrtdgISEZ;^bMoO~!B?4pNk42W1s5{B2L4D#urqn6T61dR1bxoelmm7KC*Xv747>-y z=ewC{TV;23Oc9=FfFi}zH}zm@poRJ!oLfKOfdsy=8lZ52yxeBm#Rq|9eF!6Nsh-8U z0WVyE)SO$xDpuvW`ag!)6q2j2PfjwN~`?e{|5U@cHC@DKwTr4wNMe4!8Vz5LtbWTNkmPxkI}*xW?nq@dWZez?r_<-0JGk ziopl^XBy*^%b`mV!aQAKy3-rEi=Q?ipF delta 472 zcmV;}0Vn?K1NsAyEPoOJ01FZU(%pXi00053Nkly>ABRiuqzIY>02B&vmHx9bDe1-w#VYjm33;kO^x#zW$< zXUAQ^V)dgT+r-@HrXjHPiTN=0qzynPaM%Ky6zo5=+)?`@TG4k0!pwsfP%k2)ig&Z~ z_#gcDU~N64s?JDsI~2`h!HH;CYv@H)Lw}RMFo`zua^Q!^V@enqGZ$Z3Zj9(H2WZ^@ O0000Px#1ZP1_K>z@;j|==^ z1poj6{7FPXRCod9mrG8=Fc60S2?(<64G1e#1QOgJ+<+sbC!j1)Rk3KhK){M}12_R3 zp*JY+vVw8~x-1gSFirwErK!{O!J@yEDxTW@Y|nV?5R~q@Du2Iw^5igGbwIel2JMqT z>k)L8sw(h1)J#9Iifw9RnrgCxMZC&eM}avoZW3V@ig*_ON%IF@L>3)9Y++$xD|q)= zwg}zeG~XVf2aFb6<)@-FselLW_lDRD#sNgUbl_q$2iv}qHy0+6<>7ek5(aQOAKUg> zAG86BiopZPM1Q*cUOjMyL1rJ9pLS&lJR`x$!WCoX7PQ12%lUTR5+JRb;Z!sKX z24i^RabyCwV=n=-=}H6@3srQx+i8!-Y#&27R!5QU$u6hJEQ9=Sm( zfD&*8qyuv06m#NA3GN`203C!I$4Lc&3N{*RRvK+=)=OAfd6FgX?5sb}c=pGcwHC&h z1%MrZ0%`RH;Ejm(Sy2=W{YVV-RWg_)(i4D+-zEh~vRVO{aDU_sw$fLof_m^KySX!_ zhKdgECJ%W&Qbcqa1g!NGJ0M%1rvMh7d2hGl!P;v%9f030y@z^udN$S-8K<4Z?> zBV$a%>y>JO9&SJ(eFyOks_!@6$^3KL0C{j2JRfeqE7NmV z%41UP7gAe9zJF~VdT1Z8QTNBTNW^wjrs*TVT6AaMpTV~(wpTU(3$R|1W^MCSY_pCr zcY}H1xT<#5;-hU>y$f|IxK?w;X6theU?rxNL|9Av6~IyrsYA;qA~uOi=B8V{mLAOM z)RB>2>Q&Ve!Q7jxzPNARCtAd8iw^#%Z83U37C;oFO+SO3K!yj)(KD$uBbVO_R+S2F wj2Wo|J*zp;5Aq9>%R#setProperty( C_PROPERTY_SHOWNAME, showName() ); this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("OutputKeyId")).toStdString().c_str(), E_VALUEEDIT_LINEEDIT); + + QStringList listTmp; + listTmp<<"0-NO"<<"1-YES"; + this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("EnableWhenInvalid")).toStdString().c_str(), E_VALUEEDIT_COMBOBOX ); + this->setProperty( (C_PREFIX_COMBOBOXITEM+QString("EnableWhenInvalid")).toStdString().c_str(), listTmp); + + EnableWhenInvalid = listTmp.at(0); + + QStringList listTmp1; + listTmp1<setProperty( (C_PREFIX_COMBOBOXITEM+QString("OutputModeStr")).toStdString().c_str(), listTmp1 ); + this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("OutputModeStr")).toStdString().c_str(), E_VALUEEDIT_COMBOBOX ); + OutputModeStr=listTmp1.at(0); } outputfPlugin::~outputfPlugin() @@ -18,6 +34,10 @@ QString outputfPlugin::propertyShowName( QString sPropertyName ) { if ( sPropertyName == "OutputKeyId" ) return tr("输出测点串"); + else if(sPropertyName == "EnableWhenInvalid") + return tr("仅判断使能端口值不判断值是否有效"); + else if(sPropertyName == "OutputModeStr") + return tr("输出模式"); return sPropertyName; } @@ -25,3 +45,15 @@ void outputfPlugin::setOutputKeyId(QString value) { m_pKeyId = value; } + +QString outputfPlugin::get_OutputModeStr() +{ + return OutputModeStr; +} + +void outputfPlugin::set_OutputModeStr( QString sValue ) +{ + OutputModeStr = sValue; +} + + diff --git a/platform/src/tools/fbd_designer/fbd_plugins/outputfplugin/outputfplugin.h b/platform/src/tools/fbd_designer/fbd_plugins/outputfplugin/outputfplugin.h index 5bfbd2b5..3ab5fbe1 100644 --- a/platform/src/tools/fbd_designer/fbd_plugins/outputfplugin/outputfplugin.h +++ b/platform/src/tools/fbd_designer/fbd_plugins/outputfplugin/outputfplugin.h @@ -9,7 +9,12 @@ class outputfPlugin : public CBlock Q_PLUGIN_METADATA( IID Block_iid ) // Q_PLUGIN_METADATA 宏用于描述插件元数据 Q_INTERFACES( CBlock ) // Q_INTERFACES 宏用于告诉Qt该类实现的接口 + IMPL_PROPERTY( QString, EnableWhenInvalid ) + Q_PROPERTY( QString OutputKeyId READ getOutputKeyId WRITE setOutputKeyId USER true DESIGNABLE true ) + Q_PROPERTY( QString EnableWhenInvalid READ get_EnableWhenInvalid WRITE set_EnableWhenInvalid USER true DESIGNABLE true ) + Q_PROPERTY( QString OutputModeStr READ get_OutputModeStr WRITE set_OutputModeStr USER true DESIGNABLE true ) + public: Q_INVOKABLE outputfPlugin(); @@ -24,9 +29,14 @@ public: public: QString getOutputKeyId() { return m_pKeyId; } void setOutputKeyId( QString sValue ); + QString get_OutputModeStr(); + void set_OutputModeStr( QString sValue ); + private: QString m_pKeyId; + QString OutputModeStr; + }; #endif // TEMPLATEPLUGIN_H diff --git a/platform/src/tools/fbd_designer/fbd_plugins/outputplugin/icon/output.png b/platform/src/tools/fbd_designer/fbd_plugins/outputplugin/icon/output.png index 1de5f97055170374a9b0ec2d8a92311bad20bbae..b888a007c24f7fea1b4d5bf9fa45d735fd2c944b 100644 GIT binary patch delta 582 zcmV-M0=fO@1Lp*gEPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj6{7FPXRCod9mrG8=Fc60S2?(<64G1e#1QOgJ+<+sbC!j1)Rk3KhK){M}12_R3 zp*JY+vVw8~x-1gSFirwErK!{O!J@yEDxTW@Y|nV?5R~q@Du2Iw^5igGbwIel2JMqT z>k)L8sw(h1)J#9Iifw9RnrgCxMZC&eM}avoZW3V@ig*_ON%IF@L>3)9Y++$xD|q)= zwg}zeG~XVf2aFb6<)@-FselLW_lDRD#sNgUbl_q$2iv}qHy0+6<>7ek5(aQOAKUg> zAG86BiopZPM1Q*cUOjMyL1rJ9pLS&lJR`x$!WCoX7PQ12%lUTR5+JRb;Z!sKX z24i^RabyCwV=n=-=}H6@3srQx+i8!-Y#&27R!5QU$u6hJEQ9=Sm( zfD&*8qyuv06m#NA3GN`203C!I$4Lc&3N{*RRvK+=)=OAfd6FgX?5sb}c=pGcwHC&h z1%MrZ0%`RH;Ejm(Sy2=W{YVV-RWg_)(i4D+-zEh~vRVO{aDU_sw$fLof_m^KySX!_ zhKdgECJ%W&Qbcqa1g!NGJ0M%1rvMh7d2hGl!P;v%9f030y@z^udN$S-8K<4Z?> zBV$a%>y>JO9&SJ(eFyOks_!@6$^3KL0C{j2JRfeqE7NmV z%41UP7gAe9zJF~VdT1Z8QTNBTNW^wjrs*TVT6AaMpTV~(wpTU(3$R|1W^MCSY_pCr zcY}H1xT<#5;-hU>y$f|IxK?w;X6theU?rxNL|9Av6~IyrsYA;qA~uOi=B8V{mLAOM z)RB>2>Q&Ve!Q7jxzPNARCtAd8iw^#%Z83U37C;oFO+SO3K!yj)(KD$uBbVO_R+S2F wj2Wo|J*zp;5Aq9>%R#setProperty( C_PROPERTY_SHOWNAME, showName() ); this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("OutputKeyId")).toStdString().c_str(), E_VALUEEDIT_LINEEDIT); + + QStringList listTmp; + listTmp<<"0-NO"<<"1-YES"; + this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("EnableWhenInvalid")).toStdString().c_str(), E_VALUEEDIT_COMBOBOX ); + this->setProperty( (C_PREFIX_COMBOBOXITEM+QString("EnableWhenInvalid")).toStdString().c_str(), listTmp); + + EnableWhenInvalid = listTmp.at(0); + QStringList listTmp1; + listTmp1<setProperty( (C_PREFIX_COMBOBOXITEM+QString("OutputModeStr")).toStdString().c_str(), listTmp1 ); + this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("OutputModeStr")).toStdString().c_str(), E_VALUEEDIT_COMBOBOX ); + OutputModeStr=listTmp1.at(0); } outputPlugin::~outputPlugin() @@ -18,6 +33,10 @@ QString outputPlugin::propertyShowName( QString sPropertyName ) { if ( sPropertyName == "OutputKeyId" ) return tr("输出测点串"); + else if(sPropertyName == "EnableWhenInvalid") + return tr("仅判断使能端口值不判断值是否有效"); + else if(sPropertyName == "OutputModeStr") + return tr("输出模式"); return sPropertyName; } @@ -25,3 +44,12 @@ void outputPlugin::setOutputKeyId(QString value) { m_pKeyId = value; } +QString outputPlugin::get_OutputModeStr() +{ + return OutputModeStr; +} + +void outputPlugin::set_OutputModeStr( QString sValue ) +{ + OutputModeStr = sValue; +} diff --git a/platform/src/tools/fbd_designer/fbd_plugins/outputplugin/outputplugin.h b/platform/src/tools/fbd_designer/fbd_plugins/outputplugin/outputplugin.h index 4e8eedce..ff405e59 100644 --- a/platform/src/tools/fbd_designer/fbd_plugins/outputplugin/outputplugin.h +++ b/platform/src/tools/fbd_designer/fbd_plugins/outputplugin/outputplugin.h @@ -9,7 +9,12 @@ class outputPlugin : public CBlock Q_PLUGIN_METADATA( IID Block_iid ) // Q_PLUGIN_METADATA 宏用于描述插件元数据 Q_INTERFACES( CBlock ) // Q_INTERFACES 宏用于告诉Qt该类实现的接口 + IMPL_PROPERTY( QString, EnableWhenInvalid ) + + Q_PROPERTY( QString OutputKeyId READ getOutputKeyId WRITE setOutputKeyId USER true DESIGNABLE true ) + Q_PROPERTY( QString EnableWhenInvalid READ get_EnableWhenInvalid WRITE set_EnableWhenInvalid USER true DESIGNABLE true ) + Q_PROPERTY( QString OutputModeStr READ get_OutputModeStr WRITE set_OutputModeStr USER true DESIGNABLE true ) public: Q_INVOKABLE outputPlugin(); @@ -24,9 +29,12 @@ public: public: QString getOutputKeyId() { return m_pKeyId; } void setOutputKeyId( QString sValue ); + QString get_OutputModeStr(); + void set_OutputModeStr( QString sValue ); private: QString m_pKeyId; + QString OutputModeStr; }; #endif // TEMPLATEPLUGIN_H diff --git a/platform/src/tools/fbd_designer/fbd_plugins/subfplugin/icon/subf.png b/platform/src/tools/fbd_designer/fbd_plugins/subfplugin/icon/subf.png index d27bfad9d0396ee8c38adca3939849006c67bc5d..008d36bc998db10dd4d1e49b1e0ffc24a669f5f6 100644 GIT binary patch delta 256 zcmV+b0ssDy0;B?vEPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj5xk*GpRCodHm%#}FF%U)n$QED;de?&;*@0Mru>w)FLwT(9jwu#$MNSSnL4^yW z5XIU)&P7my&Nsr3FtLeEY~taGtKMv*8{Q6SIQIYTr{tej4Ae-kxb92ZSTwPTP5hNO zw9%Q%c5dDdF7zi3f=6;&Ohe&cZStr)HqRwWeA)mXr`8ijlQSG9IJR{F0000%0xM9{9AW`BFuLd>S&0K3AT9wxG-}c zQc8l}jKOKLz^s)%0Cch&3rSD418|bc1ui<5tiD+Ln^pc^W n-{c7swUN(N<(3g6Gjsn1B@#Gcrt3?s00000NkvXXu0mjfw1Z=M diff --git a/platform/src/tools/fbd_designer/fbd_plugins/subplugin/icon/sub.png b/platform/src/tools/fbd_designer/fbd_plugins/subplugin/icon/sub.png index d27bfad9d0396ee8c38adca3939849006c67bc5d..008d36bc998db10dd4d1e49b1e0ffc24a669f5f6 100644 GIT binary patch delta 256 zcmV+b0ssDy0;B?vEPoRK01FcV0GgZ_00001b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^ z1poj5xk*GpRCodHm%#}FF%U)n$QED;de?&;*@0Mru>w)FLwT(9jwu#$MNSSnL4^yW z5XIU)&P7my&Nsr3FtLeEY~taGtKMv*8{Q6SIQIYTr{tej4Ae-kxb92ZSTwPTP5hNO zw9%Q%c5dDdF7zi3f=6;&Ohe&cZStr)HqRwWeA)mXr`8ijlQSG9IJR{F0000%0xM9{9AW`BFuLd>S&0K3AT9wxG-}c zQc8l}jKOKLz^s)%0Cch&3rSD418|bc1ui<5tiD+Ln^pc^W n-{c7swUN(N<(3g6Gjsn1B@#Gcrt3?s00000NkvXXu0mjfw1Z=M diff --git a/platform/src/tools/fbd_designer/fbd_property/CPropertyModel.cpp b/platform/src/tools/fbd_designer/fbd_property/CPropertyModel.cpp index 4dced6b1..b2867f95 100644 --- a/platform/src/tools/fbd_designer/fbd_property/CPropertyModel.cpp +++ b/platform/src/tools/fbd_designer/fbd_property/CPropertyModel.cpp @@ -110,7 +110,7 @@ QVariant CPropertyModel::data( const QModelIndex &index, int role /*= Qt::Displa case Qt::BackgroundRole: if (item->isRoot()) { - return QApplication::palette("QTreeView").brush(QPalette::Normal, QPalette::Button).color(); + //return QApplication::palette("QTreeView").brush(QPalette::Normal, QPalette::Button).color(); } break; }; diff --git a/platform/src/tools/fbd_designer/fbd_property/CPropertyTreeView.cpp b/platform/src/tools/fbd_designer/fbd_property/CPropertyTreeView.cpp index f3df0a2d..0d1db057 100644 --- a/platform/src/tools/fbd_designer/fbd_property/CPropertyTreeView.cpp +++ b/platform/src/tools/fbd_designer/fbd_property/CPropertyTreeView.cpp @@ -138,3 +138,68 @@ void CPropertyTreeView::slotCustomWindow( QString str ) } } } + +void CPropertyTreeView::slotReplaceTagValue(QString before, QString after, int type ,bool sensitive) +{ + int res = searchAndReplace(m_pPropertyModel->index(0, 0),before , after , type ,sensitive ); + emit sendConnectPrompt(tr("已成功修改 ") + std::to_string(res).c_str() + tr(" 个测点串属性值"), 1); +} + +int CPropertyTreeView::searchAndReplace(const QModelIndex &parentIndex, QString before, QString after, int type , bool sensitive) +{ + int modifiedCount = 0; + + Qt::CaseSensitivity cs = sensitive?Qt::CaseSensitive : Qt::CaseInsensitive; + + QModelIndex rootIndex = m_pPropertyModel->parent(parentIndex); + // 遍历当前节点的所有子项 + int rowCount = m_pPropertyModel->rowCount(rootIndex); + for (int row = 0; row < rowCount; ++row) + { + QModelIndex currentIndex = this->model()->index(row, 0, rootIndex); + + if( !currentIndex.isValid() ) continue; + //获取子节点 + int itemRow = m_pPropertyModel->rowCount(currentIndex); + for( int i = 0; i < itemRow ; i++ ) + { + QModelIndex itemIndex = this->model()->index(i, 0, currentIndex); + CProperty *itemProperty = static_cast(itemIndex.internalPointer()); + if( itemProperty && itemProperty->propertyObject()->inherits("CBlock") ) + { + QString astr = itemIndex.data().toString(); + if (astr.indexOf(tr("测点串")) == -1) + { + continue; + } + QString propertyName = itemProperty->name(); + QString propertyValue = itemProperty->value().toString(); + if( !propertyValue.contains(before , cs) ) continue; + + QString tmp = propertyValue; + + switch (type) { + case 1: //设备组 + propertyValue.replace(before , after , cs); + if( after.split(".").length() < 2 || before.split(".").length() < 2 ) return 0; + propertyValue.replace(before.section(".",0,0), after.section(".",0,0), cs); + break; + case 2: //设备 + case 3: //位置 + propertyValue.replace(before , after , cs); + break; + default: + continue; + }; + if( propertyValue != tmp ) + { + itemProperty->propertyObject()->setProperty(propertyName.toStdString().c_str(), propertyValue); + modifiedCount ++ ; + emit propertyChanged(); + } + } + } + } + + return modifiedCount; +} diff --git a/platform/src/tools/fbd_designer/fbd_property/CPropertyTreeView.h b/platform/src/tools/fbd_designer/fbd_property/CPropertyTreeView.h index 636dc882..86007cdd 100644 --- a/platform/src/tools/fbd_designer/fbd_property/CPropertyTreeView.h +++ b/platform/src/tools/fbd_designer/fbd_property/CPropertyTreeView.h @@ -128,8 +128,8 @@ signals: public slots: void slotCustomWindow(QString upstr); - - + void slotReplaceTagValue(QString before , QString after , int type , bool sensitive ); //用以替换修改相关输出测点 + int searchAndReplace(const QModelIndex& parentIndex, QString before, QString after , int type , bool sensitive = false); private: /// The Model for this view CPropertyModel *m_pPropertyModel; diff --git a/platform/src/tools/fbd_designer/fbd_property/CVariantDelegate.cpp b/platform/src/tools/fbd_designer/fbd_property/CVariantDelegate.cpp index c82bf703..b15c0a29 100644 --- a/platform/src/tools/fbd_designer/fbd_property/CVariantDelegate.cpp +++ b/platform/src/tools/fbd_designer/fbd_property/CVariantDelegate.cpp @@ -170,3 +170,18 @@ QSize CVariantDelegate::sizeHint( const QStyleOptionViewItem &option, const QMod size.setHeight( size.height() + 5); return size; } + +void CVariantDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const +{ + QColor c; + QStyleOptionViewItem opt = option; + if (opt.state & QStyle::State_MouseOver) + { + c = opt.palette.color(QPalette::Highlight); + opt.palette.setColor(QPalette::Text, opt.palette.color(QPalette::HighlightedText)); + if (c.isValid()) + painter->fillRect(option.rect, c); + } + + QItemDelegate::paint(painter, option, index); +} diff --git a/platform/src/tools/fbd_designer/fbd_property/CVariantDelegate.h b/platform/src/tools/fbd_designer/fbd_property/CVariantDelegate.h index d7308dcb..3a5cea5a 100644 --- a/platform/src/tools/fbd_designer/fbd_property/CVariantDelegate.h +++ b/platform/src/tools/fbd_designer/fbd_property/CVariantDelegate.h @@ -25,7 +25,7 @@ #include #include - +#include class QSignalMapper; @@ -73,6 +73,10 @@ public: QSize sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const; + + void paint(QPainter *painter, const QStyleOptionViewItem &option, + const QModelIndex &index) const; + private slots: void eidtorText(QString str); void setTime(); diff --git a/platform/src/tools/fbd_designer/fbd_renderer/CBlockItem.cpp b/platform/src/tools/fbd_designer/fbd_renderer/CBlockItem.cpp index f0e6c28e..1b8ad3c9 100644 --- a/platform/src/tools/fbd_designer/fbd_renderer/CBlockItem.cpp +++ b/platform/src/tools/fbd_designer/fbd_renderer/CBlockItem.cpp @@ -7,10 +7,6 @@ #include "CLineItem.h" #include "pub_logger_api/logger.h" -#define BG_DEFAULT "#888888" // 图元背景色 -#define BG_ERROR "#FF0000" // 错误时的图元背景色 -#define TEXT_COLOR "#000000" // 图元文字颜色 - #ifdef OS_LINUX #define C_OFFSET_Y_PORTTEXT -5 // 输入端口文字和输出端口文字在Y轴的偏移量 #else @@ -20,103 +16,22 @@ #define DBG(str) //cout << __PRETTY_FUNCTION__ << str << endl; -// 以下常量仅适用于功率控制图元 -#define CN_HEIGHTSPACE 70 // 输入(输出、文字)上下之间的间隔 -#define CN_FIRSTHEIGHT (CN_HEIGHTSPACE-14)/2 // 第一个输入(输出、文字)与顶的距离 -#define CN_WIDTH 360 // 图元宽度 -#define CN_GENHEADINPUTNUM 4 // GEN顶框输入个数 -#define CN_GENHEADOUTPUTNUM 5 // GEN顶框输出个数 -#define CN_GENINPUTNUM 5 // GEN框输入个数 -#define CN_GENOUTPUTNUM 4 // GEN框输出个数 -#define CN_PCSHEADINPUTNUM 8 // PCS顶框输入个数 -#define CN_PCSHEADOUTPUTNUM 6 // PCS顶框输出个数 -#define CN_PCSINPUTNUM 4 // PCS框输入个数 -#define CN_PCSOUTPUTNUM 4 // PCS框输出个数 -#define CN_MAXGENHEADNUM (CN_GENHEADINPUTNUM>=CN_GENHEADOUTPUTNUM ? CN_GENHEADINPUTNUM : CN_GENHEADOUTPUTNUM) -#define CN_MAXGENNUM (CN_GENINPUTNUM>=CN_GENOUTPUTNUM ? CN_GENINPUTNUM : CN_GENOUTPUTNUM) -#define CN_MAXPCSHEADNUM (CN_PCSHEADINPUTNUM>=CN_PCSHEADOUTPUTNUM ? CN_PCSHEADINPUTNUM : CN_PCSHEADOUTPUTNUM) -#define CN_MAXPCSNUM (CN_PCSINPUTNUM>=CN_PCSOUTPUTNUM ? CN_PCSINPUTNUM : CN_PCSOUTPUTNUM) -#define CN_GENHEADHEIGHT CN_MAXGENHEADNUM*CN_HEIGHTSPACE // GEN顶框的高度 -#define CN_GENHEIGHT CN_MAXGENNUM*CN_HEIGHTSPACE // GEN框的高度 -#define CN_PCSHEADHEIGHT CN_MAXPCSHEADNUM*CN_HEIGHTSPACE // PCS顶框的高度 -#define CN_PCSHEIGHT CN_MAXPCSNUM*CN_HEIGHTSPACE // PCS框的高度 - -int getPCSInputHeight( int nIndex ) -{ - int nRet = 0; - if ( nIndex < CN_PCSHEADINPUTNUM ) - nRet = nIndex * CN_HEIGHTSPACE; - else - { - nRet = CN_PCSHEADHEIGHT+ - (nIndex-CN_PCSHEADINPUTNUM)/CN_PCSINPUTNUM*CN_PCSHEIGHT+ - (nIndex-CN_PCSHEADINPUTNUM)%CN_PCSINPUTNUM*CN_HEIGHTSPACE; - } - return nRet + CN_FIRSTHEIGHT; -} - -int getPCSOutputHeight( int nIndex ) -{ - int nRet = 0; - if ( nIndex < CN_PCSHEADOUTPUTNUM ) - nRet = nIndex * CN_HEIGHTSPACE; - else - { - nRet = CN_PCSHEADHEIGHT+ - (nIndex-CN_PCSHEADOUTPUTNUM)/CN_PCSOUTPUTNUM*CN_PCSHEIGHT+ - (nIndex-CN_PCSHEADOUTPUTNUM)%CN_PCSOUTPUTNUM*CN_HEIGHTSPACE; - } - return nRet + CN_FIRSTHEIGHT; -} - -int getGENInputHeight( int nIndex ) -{ - int nRet = 0; - if ( nIndex < CN_GENHEADINPUTNUM ) - nRet = nIndex * CN_HEIGHTSPACE; - else - { - nRet = CN_GENHEADHEIGHT+ - (nIndex-CN_GENHEADINPUTNUM)/CN_GENINPUTNUM*CN_GENHEIGHT+ - (nIndex-CN_GENHEADINPUTNUM)%CN_GENINPUTNUM*CN_HEIGHTSPACE; - } - return nRet + CN_FIRSTHEIGHT; -} - -int getGENOutputHeight( int nIndex ) -{ - int nRet = 0; - if ( nIndex < CN_GENHEADOUTPUTNUM ) - nRet = nIndex * CN_HEIGHTSPACE; - else - { - nRet = CN_GENHEADHEIGHT+ - (nIndex-CN_GENHEADOUTPUTNUM)/CN_GENOUTPUTNUM*CN_GENHEIGHT+ - (nIndex-CN_GENHEADOUTPUTNUM)%CN_GENOUTPUTNUM*CN_HEIGHTSPACE; - } - return nRet + CN_FIRSTHEIGHT; -} - -CBlockItem::CBlockItem( CBlock *pBlock ) +CBlockItem::CBlockItem( CBlock *pBlock, + QColor selectBorderColor, + QColor normalBorderColor, + QColor defaultColor, + QColor errorColor, + QColor textColor): + m_selectBorderColor(selectBorderColor), + m_normalBorderColor(normalBorderColor), + m_defaultColor(defaultColor), + m_errorColor(errorColor), + m_textColor(textColor) { m_pIcon = NULL; m_pHeadTextItem = NULL; m_pBlock = pBlock; - - // 功率控制图元特殊处理 - m_bPowerControlPCS = false; - m_bPowerControlGEN = false; - QString sName = m_pBlock->name().toLower(); - if ( sName == "powercontrolpcs" ) - { - m_bPowerControlPCS = true; - m_pBlock->setIconSize( CN_WIDTH, CN_MAXPCSHEADNUM*CN_HEIGHTSPACE ); - } - else if ( sName == "powercontrolgen" ) - { - m_bPowerControlGEN = true; - m_pBlock->setIconSize( CN_WIDTH, CN_MAXGENHEADNUM*CN_HEIGHTSPACE ); - } + m_pBlock->setDefaultIconSize(); connect(m_pBlock, SIGNAL(signalShowNameChanged()), this, SLOT(slotShowNameChanged())); connect(m_pBlock, SIGNAL(signalPortChanged()), this, SLOT(slotUpdatePortItem())); @@ -131,11 +46,8 @@ CBlockItem::CBlockItem( CBlock *pBlock ) m_minHeight = m_height; // Set Polygon Top-Left: 0/0 - m_myPolygon << QPointF(0, 0) << QPointF( m_width, 0) - << QPointF(m_width, m_height) << QPointF(0, m_height) - << QPointF(0, 0); - setPolygon(m_myPolygon); - setBackgroundColor( BG_DEFAULT ); + setPolygon(m_pBlock->getPolygon(m_width,m_height)); + setBackgroundColor( m_defaultColor ); // Block Properties setFlag(QGraphicsItem::ItemIsMovable, true); @@ -145,7 +57,7 @@ CBlockItem::CBlockItem( CBlock *pBlock ) // 图元标题头文字 m_pHeadTextItem = new QGraphicsTextItem("", this/*, this->scene()*/); - m_pHeadTextItem->setDefaultTextColor(TEXT_COLOR); + m_pHeadTextItem->setDefaultTextColor(m_textColor); setText( m_pBlock->property(C_PROPERTY_SHOWNAME).toString() ); m_pHeadTextItem->setPos( -m_pHeadTextItem->boundingRect().width() / 2 + boundingRect().width() / 2, -25); @@ -155,18 +67,10 @@ CBlockItem::CBlockItem( CBlock *pBlock ) { QString sText = m_pBlock->getInPortShowName(i); QGraphicsTextItem* pInPortItem = new QGraphicsTextItem("", this); - pInPortItem->setDefaultTextColor(TEXT_COLOR); + pInPortItem->setDefaultTextColor(m_textColor); pInPortItem->setPlainText(sText); - if ( m_bPowerControlPCS ) - pInPortItem->setPos( 1, getPCSInputHeight(i) ); - else if ( m_bPowerControlGEN ) - pInPortItem->setPos( 1, getGENInputHeight(i) ); - else - { - int nY = (listInPort.size()==1) ? 5 : -5; - pInPortItem->setPos( -18-pInPortItem->boundingRect().width(), - nY+m_pBlock->getPortSpace()*i+C_OFFSET_Y_PORTTEXT ); - } + pInPortItem->setPos(m_pBlock->getInputTextPos(i,pInPortItem->boundingRect().width())); + m_listInPortTextItem.push_back(pInPortItem); } @@ -176,31 +80,19 @@ CBlockItem::CBlockItem( CBlock *pBlock ) { QString sText = m_pBlock->getOutPortShowName(i); QGraphicsTextItem *pOutPortItem = new QGraphicsTextItem("", this); - pOutPortItem->setDefaultTextColor(TEXT_COLOR); + pOutPortItem->setDefaultTextColor(m_textColor); pOutPortItem->setPlainText( sText ); - if ( m_bPowerControlPCS ) - { - pOutPortItem->setPos( CN_WIDTH-pOutPortItem->boundingRect().width(), getPCSOutputHeight(i) ); - } - else if ( m_bPowerControlGEN ) - { - pOutPortItem->setPos( CN_WIDTH-pOutPortItem->boundingRect().width(), getGENOutputHeight(i) ); - } - else - { - int nY = (listOutPort.count()==1) ? 5 : -5; - pOutPortItem->setPos( boundingRect().width() + 10, nY+m_pBlock->getPortSpace()*i+C_OFFSET_Y_PORTTEXT ); - } + + int nItemTextWidth = m_pBlock->isCustomItemPos() ? pOutPortItem->boundingRect().width() : boundingRect().width(); + pOutPortItem->setPos(m_pBlock->getOutputTextPos(i,nItemTextWidth)); + m_listOutPortTextItem.push_back(pOutPortItem); } QPixmap pixmap = m_pBlock->getIcon().pixmap(30, 30); m_pIcon = new QGraphicsPixmapItem( this); m_pIcon->setPixmap(pixmap); - int nX = 5; - if ( m_bPowerControlPCS || m_bPowerControlGEN ) - nX = (CN_WIDTH - pixmap.width()) / 2; - m_pIcon->setPos(nX, 5); + m_pIcon->setPos(m_pBlock->getIconPos(pixmap.size())); setBlockTip(); // Add the ports ... @@ -208,13 +100,8 @@ CBlockItem::CBlockItem( CBlock *pBlock ) // qDebug("boundringRect item %f %f %f %f", boundingRect().left(), boundingRect().top(), // boundingRect().width(), boundingRect().height()); - // 功率控制图元,机组个数默认为1 - if ( m_bPowerControlGEN || m_bPowerControlPCS ) - { - int nUnitCount = m_pBlock->property("UnitCnt").toInt(); - if ( nUnitCount == 0 ) - m_pBlock->setProperty("UnitCnt",1); - } + // 各图元可以做一些特例化的内容 + m_pBlock->afterInitialize(); } CBlockItem::~CBlockItem() @@ -280,7 +167,8 @@ void CBlockItem::clearInputRealValue() { QString sText = m_pBlock->getInPortShowName(i); m_listInPortTextItem[i]->setPlainText( sText ); - if ( !m_bPowerControlPCS && !m_bPowerControlGEN ) + + if(!m_pBlock->isCustomItemPos()) { m_listInPortTextItem[i]->setPos( -18-m_listInPortTextItem[i]->boundingRect().width(), m_listInPortTextItem[i]->pos().y() ); @@ -309,26 +197,29 @@ void CBlockItem::setOutputRealValue( int nIndex, QString sValue, int nStatus ) QString sText = m_pBlock->getOutPortShowName(nIndex); if ( nStatus == E_DATASTATUS_VALID ) + { m_listOutPortTextItem.at(nIndex)->setDefaultTextColor( QColor(0,255,0) ); + } else if ( nStatus == E_DATASTATUS_INVALID ) + { m_listOutPortTextItem.at(nIndex)->setDefaultTextColor( QColor(255,0,0) ); + } else + { m_listOutPortTextItem.at(nIndex)->setDefaultTextColor( QColor(255,255,255) ); + } - if ( m_bPowerControlPCS || m_bPowerControlGEN ) - m_listOutPortTextItem.at(nIndex)->setPlainText( sText+"\n"+sValue ); - else - m_listOutPortTextItem.at(nIndex)->setPlainText( sText+":"+sValue ); + m_listOutPortTextItem.at(nIndex)->setPlainText( sText+ m_pBlock->getOutputRealValueSep() +sValue ); } void CBlockItem::setErrorBackgroundColor() { - setBackgroundColor( BG_ERROR ); + setBackgroundColor( m_errorColor ); } void CBlockItem::setNormalBackgroundColor() { - setBackgroundColor( BG_DEFAULT ); + setBackgroundColor( m_defaultColor ); } CBlock* CBlockItem::getBlock() @@ -348,7 +239,7 @@ void CBlockItem::clearOutputRealValue() for ( int i=0; isetDefaultTextColor( TEXT_COLOR ); + m_listOutPortTextItem[i]->setDefaultTextColor( m_textColor ); QString sText = m_pBlock->getOutPortShowName(i); m_listOutPortTextItem[i]->setPlainText( sText ); @@ -371,7 +262,8 @@ void CBlockItem::slotInPortNameChanged() { QString sText = m_pBlock->getInPortShowName(i); m_listInPortTextItem.at(i)->setPlainText( sText ); - if ( !m_bPowerControlGEN && !m_bPowerControlPCS ) + + if(!m_pBlock->isCustomItemPos()) { m_listInPortTextItem.at(i)->setPos( -18-m_listInPortTextItem.at(i)->boundingRect().width(), m_listInPortTextItem.at(i)->pos().y() ); @@ -394,19 +286,19 @@ void CBlockItem::setInputRealValue( int nIndex, QString sValue ) return; QString sInputName = m_pBlock->getInPortName(nIndex); - if ( m_bPowerControlPCS || m_bPowerControlGEN ) - m_listInPortTextItem.at(nIndex)->setPlainText(sInputName+"\n"+sValue); - else + + m_listInPortTextItem.at(nIndex)->setPlainText( sInputName + m_pBlock->getOutputRealValueSep() + sValue ); + + if(!m_pBlock->isCustomItemPos()) { - m_listInPortTextItem.at(nIndex)->setPlainText( sInputName+":"+sValue ); m_listInPortTextItem.at(nIndex)->setPos( -18-m_listInPortTextItem.at(nIndex)->boundingRect().width(), m_listInPortTextItem.at(nIndex)->pos().y() ); } } -void CBlockItem::setBackgroundColor( QString col ) +void CBlockItem::setBackgroundColor( QColor col ) { - this->setBrush( QBrush(QColor(col)) ); + this->setBrush( QBrush(col) ); } void CBlockItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* pEvent) @@ -523,13 +415,13 @@ void CBlockItem::updatePortItem() m_width = m_pBlock->getIconWidth(); m_height = m_pBlock->getIconHeight(); int nPortHeight = CPortItem::height_; - int heightIn = (m_bPowerControlPCS || m_bPowerControlGEN) ? CN_FIRSTHEIGHT : 0;// 输入端口总体高度 - int heightOut = (m_bPowerControlPCS || m_bPowerControlGEN) ? CN_FIRSTHEIGHT : 0;// 输出端口总体高度 + int heightIn = m_pBlock->getFirstHeight(); //< 先设置一个初始高度 + int heightOut = m_pBlock->getFirstHeight(); int offsetY = 12;// Y轴统一偏移距离 int inOffset = -5;// 输入端口X轴坐标 int outOffset = m_width + 5;// 输出端口X轴坐标 // 输入(输出)端口上下之间的距离,上一个端口左上角到下一个端口左上角的Y轴间距 - int deltaPorts = (m_bPowerControlPCS || m_bPowerControlGEN) ? CN_HEIGHTSPACE : m_pBlock->getPortSpace(); +// int deltaPorts = (m_bPowerControlPCS || m_bPowerControlGEN||m_bPowerControlPCSLinear||m_bPowerControlPCSReactive) ? CN_HEIGHTSPACE : m_pBlock->getPortSpace(); // input if (inportsofar.count() == 1) @@ -548,17 +440,7 @@ void CBlockItem::updatePortItem() CPortItem *pPortItem = p.second; pPortItem->setFlag(QGraphicsItem::ItemStacksBehindParent); pPortItem->setPos(inOffset, heightIn + offsetY); - if ( m_bPowerControlPCS ) - heightIn = getPCSInputHeight(i+1); - else if ( m_bPowerControlGEN ) - heightIn = getGENInputHeight(i+1); - else - { - if ( i != inportsofar.count()-1 ) - heightIn += deltaPorts; - else - heightIn += nPortHeight; - } + heightIn = m_pBlock->getInputHeight(i,inportsofar.count(),nPortHeight); } } // output @@ -578,17 +460,7 @@ void CBlockItem::updatePortItem() CPortItem *pPortItem = p.second; pPortItem->setFlag(QGraphicsItem::ItemStacksBehindParent); pPortItem->setPos(outOffset, heightOut + offsetY); - if ( m_bPowerControlPCS ) - heightOut = getPCSOutputHeight(i+1); - else if ( m_bPowerControlGEN ) - heightOut = getGENOutputHeight(i+1); - else - { - if ( i != outportsofar.count()-1 ) - heightOut += deltaPorts; - else - heightOut += nPortHeight; - } + heightOut = m_pBlock->getOutputHeight(i,outportsofar.count(),nPortHeight); } } @@ -596,31 +468,7 @@ void CBlockItem::updatePortItem() m_height = qMax(heightIn, heightOut) + offsetY + 2; m_height = qMax(m_height, m_minHeight); - m_myPolygon.clear(); - m_myPolygon << QPointF(0, 0) << QPointF(m_width, 0) - << QPointF(m_width, m_height) << QPointF(0, m_height) - << QPointF(0, 0); - - if ( m_bPowerControlPCS ) - { - const int nPCSNum = m_pBlock->property("UnitCnt").toInt(); - for ( int i=0; iproperty("UnitCnt").toInt(); - for ( int i=0; igetPolygon(m_width,m_height)); } void CBlockItem::updateInPortText() @@ -636,23 +484,14 @@ void CBlockItem::updateInPortText() for ( int i=0; isetDefaultTextColor(TEXT_COLOR); + inport->setDefaultTextColor(m_textColor); m_listInPortTextItem.push_back(inport); } for ( int i=0; igetInPortShowName(i); m_listInPortTextItem.at(i)->setPlainText(sText); - if ( m_bPowerControlPCS ) - m_listInPortTextItem.at(i)->setPos(1, getPCSInputHeight(i)); - else if ( m_bPowerControlGEN ) - m_listInPortTextItem.at(i)->setPos(1, getGENInputHeight(i)); - else - { - int nY = (listPort.count()==1) ? 5 : -5; - m_listInPortTextItem.at(i)->setPos(-18-m_listInPortTextItem.at(i)->boundingRect().width(), - nY+m_pBlock->getPortSpace()*i+C_OFFSET_Y_PORTTEXT); - } + m_listInPortTextItem.at(i)->setPos(m_pBlock->getInputTextPos(i,m_listInPortTextItem.at(i)->boundingRect().width())); } } @@ -669,7 +508,7 @@ void CBlockItem::updateOutPortText() for (int i = 0; i < listPort.size(); i++) { QGraphicsTextItem *port = new QGraphicsTextItem("", this); - port->setDefaultTextColor(TEXT_COLOR); + port->setDefaultTextColor(m_textColor); m_listOutPortTextItem.push_back(port); } @@ -677,19 +516,9 @@ void CBlockItem::updateOutPortText() { QString sText = m_pBlock->getOutPortShowName(i); m_listOutPortTextItem.at(i)->setPlainText( sText ); - if ( m_bPowerControlPCS ) - { - m_listOutPortTextItem.at(i)->setPos( CN_WIDTH-m_listOutPortTextItem.at(i)->boundingRect().width(), getPCSOutputHeight(i) ); - } - else if ( m_bPowerControlGEN ) - { - m_listOutPortTextItem.at(i)->setPos( CN_WIDTH-m_listOutPortTextItem.at(i)->boundingRect().width(), getGENOutputHeight(i) ); - } - else - { - int nY = (listPort.count()==1) ? 5 : -5; - m_listOutPortTextItem.at(i)->setPos( boundingRect().width()+10, nY+m_pBlock->getPortSpace()*i+C_OFFSET_Y_PORTTEXT ); - } + + int nItemTextWidth = m_pBlock->isCustomItemPos() ? m_listOutPortTextItem.at(i)->boundingRect().width() : boundingRect().width(); + m_listOutPortTextItem.at(i)->setPos(m_pBlock->getOutputTextPos(i,nItemTextWidth)); } } @@ -697,9 +526,9 @@ void CBlockItem::paint( QPainter* pPainter, const QStyleOptionGraphicsItem* pOpt { // 根据选择状态修改pen的颜色 if ( this->isSelected() ) - this->setPen(QPen(QBrush(QColor("#FFFFFF")), 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + this->setPen(QPen(QBrush(m_selectBorderColor), 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); else - this->setPen(QPen(QBrush(QColor("#111111")), 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + this->setPen(QPen(QBrush(m_normalBorderColor), 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); QStyleOptionGraphicsItem opt = *pOption; opt.state = pOption->state & (~QStyle::State_Selected); diff --git a/platform/src/tools/fbd_designer/fbd_renderer/CBlockItem.h b/platform/src/tools/fbd_designer/fbd_renderer/CBlockItem.h index dd83e325..d516a616 100644 --- a/platform/src/tools/fbd_designer/fbd_renderer/CBlockItem.h +++ b/platform/src/tools/fbd_designer/fbd_renderer/CBlockItem.h @@ -9,9 +9,13 @@ class CBlock; class RENDERER_EXPORT CBlockItem : public QObject, public QGraphicsPolygonItem { Q_OBJECT - public: - CBlockItem( CBlock* pBlock ); + CBlockItem( CBlock* pBlock , + QColor selectBorderColor, + QColor normalBorderColor, + QColor defaultColor, + QColor errorColor, + QColor textColor); ~CBlockItem(); public: @@ -34,7 +38,8 @@ public: void clearOutputRealValue(); void setErrorBackgroundColor(); // 图元自检失败时置背景色 void setNormalBackgroundColor();// 图元恢复背景色 - void setBackgroundColor( QString color ); + void setBackgroundColor( QColor color ); + CBlock* getBlock(); public slots: @@ -56,7 +61,7 @@ private: private: CBlock* m_pBlock; - QPolygonF m_myPolygon; // 用于画图元外边框的折线 +// QPolygonF m_myPolygon; // 用于画图元外边框的折线 QGraphicsPixmapItem* m_pIcon;// 背景图片 QGraphicsTextItem* m_pHeadTextItem;// 用于图元顶部显示图元名称 QList m_listInPortTextItem;// 用于显示输入端口描述 @@ -65,8 +70,12 @@ private: int m_height; int m_minWidth; int m_minHeight; - bool m_bPowerControlGEN;// 用来判断是否是功率控制图元GEN - bool m_bPowerControlPCS;// 用来判断是否是功率控制图元PCS + + QColor m_selectBorderColor; + QColor m_normalBorderColor; + QColor m_defaultColor; + QColor m_errorColor; + QColor m_textColor; }; #endif // FLOWDIAGRAMITEM_H diff --git a/platform/src/tools/fbd_designer/fbd_renderer/CCellWidget.cpp b/platform/src/tools/fbd_designer/fbd_renderer/CCellWidget.cpp index e96c113c..179e381f 100644 --- a/platform/src/tools/fbd_designer/fbd_renderer/CCellWidget.cpp +++ b/platform/src/tools/fbd_designer/fbd_renderer/CCellWidget.cpp @@ -13,6 +13,7 @@ CCellWidget::CCellWidget(const QString &_text, QIcon _icon, QUuid _id) QLabel *label = new QLabel(); label->setPixmap(icon.pixmap(25, 25)); QLabel *label2 = new QLabel(text); + label2->setObjectName("CellWidget_item"); label2->setFixedHeight(25); label2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); QHBoxLayout *layout = new QHBoxLayout(); @@ -22,11 +23,6 @@ CCellWidget::CCellWidget(const QString &_text, QIcon _icon, QUuid _id) //layout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed)); this->setLayout(layout); - label2->setStyleSheet("\ - QWidget:hover{\ - background-color: #D6DCF2;\ - }\ - "); } void CCellWidget::mousePressEvent(QMouseEvent *event) diff --git a/platform/src/tools/fbd_designer/fbd_renderer/CRenderer.cpp b/platform/src/tools/fbd_designer/fbd_renderer/CRenderer.cpp index 13e6033b..0dc088a6 100644 --- a/platform/src/tools/fbd_designer/fbd_renderer/CRenderer.cpp +++ b/platform/src/tools/fbd_designer/fbd_renderer/CRenderer.cpp @@ -11,7 +11,8 @@ CRenderer *CRenderer::m_pInstance = 0; -CRenderer::CRenderer() +CRenderer::CRenderer(): + m_defaultColor(136, 136, 136),m_errorColor(255, 0, 0),m_textColor(0, 0, 0) { } @@ -31,7 +32,12 @@ CBlockItem* CRenderer::renderItem(CBlock *block) CBlockItem *ret = 0; if (block != NULL) { - ret = new CBlockItem(block); + ret = new CBlockItem(block, + m_selectBorderColor, + m_normalBorderColor, + m_defaultColor, + m_errorColor, + m_textColor); } return ret; } @@ -48,6 +54,56 @@ QWidget* CRenderer::createTemplateWidget( const QString &sTemplateName, const QB return widget; } +QColor CRenderer::itemSelectBorderColor() +{ + return m_selectBorderColor; +} + +QColor CRenderer::itemNormalBorderColor() +{ + return m_normalBorderColor; +} + +QColor CRenderer::itemDefaultBackgroundColor() +{ + return m_defaultColor; +} + +QColor CRenderer::itemErrorBackgroundColor() +{ + return m_errorColor; +} + +QColor CRenderer::itemTextBackgroundColor() +{ + return m_textColor; +} + +void CRenderer::setItemSelectBorderColor(QColor color) +{ + m_selectBorderColor = color; +} + +void CRenderer::setItemNormalBorderColor(QColor color) +{ + m_normalBorderColor = color; +} + + +void CRenderer::setItemDefaultBackgroundColor(QColor color) +{ + m_defaultColor = color; +} + +void CRenderer::setItemErrorBackgroundColor(QColor color) +{ + m_errorColor = color; +} + +void CRenderer::setItemTextBackgroundColor(QColor color) +{ + m_textColor = color; +} diff --git a/platform/src/tools/fbd_designer/fbd_renderer/CRenderer.h b/platform/src/tools/fbd_designer/fbd_renderer/CRenderer.h index 658b52f2..7929d5db 100644 --- a/platform/src/tools/fbd_designer/fbd_renderer/CRenderer.h +++ b/platform/src/tools/fbd_designer/fbd_renderer/CRenderer.h @@ -19,8 +19,24 @@ public: QWidget* createCellWidget( const QString &sText, QIcon oIcon, QUuid oId ); QWidget* createTemplateWidget( const QString& sTemplateName, const QByteArray& byXml ); + QColor itemSelectBorderColor(); + QColor itemNormalBorderColor(); + QColor itemDefaultBackgroundColor(); + QColor itemErrorBackgroundColor(); + QColor itemTextBackgroundColor(); + void setItemSelectBorderColor( QColor color ); + void setItemNormalBorderColor( QColor color ); + void setItemDefaultBackgroundColor( QColor color ); + void setItemErrorBackgroundColor( QColor color ); + void setItemTextBackgroundColor( QColor color ); private: static CRenderer *m_pInstance; + + QColor m_selectBorderColor; + QColor m_normalBorderColor; + QColor m_defaultColor; + QColor m_errorColor; + QColor m_textColor; }; #endif // FLOWRENDERER_H diff --git a/platform/src/tools/fbd_designer/fbd_renderer/CTemplateWidget.cpp b/platform/src/tools/fbd_designer/fbd_renderer/CTemplateWidget.cpp index 7b041eea..0a67a1b0 100644 --- a/platform/src/tools/fbd_designer/fbd_renderer/CTemplateWidget.cpp +++ b/platform/src/tools/fbd_designer/fbd_renderer/CTemplateWidget.cpp @@ -14,6 +14,7 @@ CTemplateWidget::CTemplateWidget( const QString &sTemplateName, const QByteArray QLabel *label = new QLabel(); label->setPixmap(objIcon.pixmap(25, 25)); QLabel *label2 = new QLabel(sTemplateName); + label2->setObjectName("TemplateWidget_item"); label2->setFixedHeight(25); label2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); QHBoxLayout *layout = new QHBoxLayout(); @@ -27,16 +28,11 @@ CTemplateWidget::CTemplateWidget( const QString &sTemplateName, const QByteArray connect( this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(slotContextMenuPolicy(const QPoint&)) ); this->setLayout(layout); - label2->setStyleSheet("\ - QWidget:hover{\ - background-color: #D6DCF2;\ - }\ - "); } void CTemplateWidget::slotContextMenuPolicy( const QPoint& ) { - QMenu menu; + QMenu menu(this); menu.addAction( tr("删除此模板"), this, SLOT(slotDeleteTemplate()) ); menu.exec( QCursor::pos() ); } diff --git a/platform/src/tools/fbd_designer/fbd_retriever/CRetriever.cpp b/platform/src/tools/fbd_designer/fbd_retriever/CRetriever.cpp index 4f43461c..eaefb92a 100644 --- a/platform/src/tools/fbd_designer/fbd_retriever/CRetriever.cpp +++ b/platform/src/tools/fbd_designer/fbd_retriever/CRetriever.cpp @@ -9,8 +9,9 @@ #include #include -CFBDRetriever::CFBDRetriever(QWidget *parent, Qt::WindowFlags f) : - QDialog(parent, f), +//CFBDRetriever::CFBDRetriever(QWidget *parent, Qt::WindowFlags f) : +CFBDRetriever::CFBDRetriever(QWidget *parent) : + CustomUiDialog(parent), ui(new Ui::CFBDRetriever), m_pDb(Q_NULLPTR), m_device_tableModel(Q_NULLPTR), @@ -21,6 +22,8 @@ CFBDRetriever::CFBDRetriever(QWidget *parent, Qt::WindowFlags f) : m_tableProperty_valueModel(Q_NULLPTR) { ui->setupUi(this); + this->setWindowTitle(tr("检索器")); + initialize(); if(!parent) @@ -28,6 +31,8 @@ CFBDRetriever::CFBDRetriever(QWidget *parent, Qt::WindowFlags f) : setWindowFlag(Qt::WindowStaysOnTopHint); setAttribute(Qt::WA_DeleteOnClose); } + + CustomUiDialog::setAutoLayout(true); } CFBDRetriever::~CFBDRetriever() @@ -144,6 +149,7 @@ void CFBDRetriever::initPanel() ui->DeviceFilter->setTextMargins(0, 0, 21, 0); QPushButton * pDeviceFilter = new QPushButton(this); + pDeviceFilter->setObjectName("pDeviceFilter"); pDeviceFilter->setMaximumSize(21, 22); pDeviceFilter->setCursor(QCursor(Qt::ArrowCursor)); QHBoxLayout * pDeviceLayout = new QHBoxLayout(); @@ -156,6 +162,7 @@ void CFBDRetriever::initPanel() ui->TableFilter->setTextMargins(0, 0, 21, 0); QPushButton * pTableFilter = new QPushButton(this); + pTableFilter->setObjectName("pTableFilter"); pTableFilter->setMaximumSize(21, 22); pTableFilter->setCursor(QCursor(Qt::ArrowCursor)); QHBoxLayout * pTableLayout = new QHBoxLayout(); @@ -168,6 +175,7 @@ void CFBDRetriever::initPanel() ui->TagNameFilter->setTextMargins(0, 0, 21, 0); QPushButton * pTagNameFilter = new QPushButton(this); + pTagNameFilter->setObjectName("pTagNameFilter"); pTagNameFilter->setMaximumSize(21, 22); pTagNameFilter->setCursor(QCursor(Qt::ArrowCursor)); QHBoxLayout * pTagNameLayout = new QHBoxLayout(); @@ -178,18 +186,6 @@ void CFBDRetriever::initPanel() connect(pTagNameFilter, SIGNAL(clicked()), this, SLOT(slot_tagNameFilter())); connect(ui->TagNameFilter, SIGNAL(editingFinished()), this, SLOT(slot_tagNameFilter())); connect(ui->Property_ValueView, &CFBDListView::itemTriggered, this, &CFBDRetriever::itemTriggered); - QString searchButtonStyle = QString("QPushButton{ background:#F0F0F0; \ - border:1px solid transparent; \ - border-left-color: darkgray;\ - padding-left: -1px; padding-top: -1px; \ - image:url(:/resource/search.png);} \ - QPushButton:hover{background:#E0E0E0;} \ - QPushButton:pressed{background:#E0E0E0;padding:0px; }"); - pDeviceFilter->setStyleSheet(searchButtonStyle); - pTableFilter->setStyleSheet(searchButtonStyle); - pTagNameFilter->setStyleSheet(searchButtonStyle); - setStyleSheet("QLineEdit {border: 1px solid #787878;}"); - } void CFBDRetriever::setValidLocation(QStringList &locations) @@ -326,7 +322,7 @@ void CFBDRetriever::setCurrentTagName(const QString &tagName) void CFBDRetriever::closeEvent(QCloseEvent *e) { emit closed(); - QDialog::closeEvent(e); + CustomUiDialog::closeEvent(e); } void CFBDRetriever::queryCurrentProfessionID(E_RETRIEVER_TYPE type, int &id) @@ -409,7 +405,9 @@ void CFBDRetriever::queryCurrentLocationID(E_RETRIEVER_TYPE type, int &id) } if(!locationDescription.isEmpty()) { - m_pDb->execute(QString("select location_id from sys_model_location_info where description = '%1'").arg(locationDescription), query); + + QString tmp = locationDescription.replace("'", "''"); //法语中的表述存在' 导致查询失败 手动转义 + m_pDb->execute(QString("select location_id from sys_model_location_info where description = '%1'").arg(tmp), query); if(query.isActive()) { while(query.next()) diff --git a/platform/src/tools/fbd_designer/fbd_retriever/CRetriever.ui b/platform/src/tools/fbd_designer/fbd_retriever/CRetriever.ui index 87754e21..6393fb2d 100644 --- a/platform/src/tools/fbd_designer/fbd_retriever/CRetriever.ui +++ b/platform/src/tools/fbd_designer/fbd_retriever/CRetriever.ui @@ -15,16 +15,16 @@ - 3 + 7 - 3 + 7 - 3 + 7 - 3 + 7 2 @@ -113,9 +113,6 @@ QComboBox QAbstractItemView::item{min-height: 23px;} - - QComboBox::AdjustToMinimumContentsLength - 12 @@ -152,9 +149,6 @@ QComboBox QAbstractItemView::item{min-height: 23px;} - - QComboBox::AdjustToMinimumContentsLength - 12 @@ -369,9 +363,6 @@ QComboBox QAbstractItemView::item{min-height: 23px;} - - QComboBox::AdjustToMinimumContentsLength - 12 @@ -408,9 +399,6 @@ QComboBox QAbstractItemView::item{min-height: 23px;} - - QComboBox::AdjustToMinimumContentsLength - 12 @@ -637,7 +625,7 @@ - 0 + 1 diff --git a/platform/src/tools/fbd_designer/fbd_retriever/fbd_retriever.pro b/platform/src/tools/fbd_designer/fbd_retriever/fbd_retriever.pro index ea3f70d6..1a5d1195 100644 --- a/platform/src/tools/fbd_designer/fbd_retriever/fbd_retriever.pro +++ b/platform/src/tools/fbd_designer/fbd_retriever/fbd_retriever.pro @@ -25,7 +25,8 @@ LIBS += \ -lpub_logger_api \ -ldb_base_api \ -ldb_api_ex \ - -ldb_sysinfo_api + -ldb_sysinfo_api \ + -lpub_widget !include( ../../../common.pri ){ error(the file common.pri is not exist!!) diff --git a/platform/src/tools/model_common/common.cpp b/platform/src/tools/model_common/common.cpp index ee9ba026..6ff851c5 100644 --- a/platform/src/tools/model_common/common.cpp +++ b/platform/src/tools/model_common/common.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" #include "pub_utility_api/I18N.h" #include "pub_utility_api/FileStyle.h" #include "CPluginWidget.h" @@ -40,44 +40,28 @@ void Common::initPath() m_pathSysModelConfig = m_pathIscsHome + "/data/sys_model_info"; m_path61850Cfg = m_pathIscsHome +"/data/config61850"; m_language = iot_public::getCurLanguage().c_str(); - m_pathStyle = m_pathIscsHome + "/platform/common/resource/" + m_language + "/model_studio/setting/style/"; + m_pathStyle = m_pathIscsHome + "/resource/" + m_language + "/model_studio/setting/style/"; } QString Common::getTranslatePath(QString strFileName) { - QString strFilePath = m_pathIscsHome + "/product/common/resource/" + m_language + "/model_studio/translate/" + strFileName; - if (QFile::exists(strFilePath)) - return strFilePath; - else - return m_pathIscsHome + "/platform/common/resource/" + m_language + "/model_studio/translate/" + strFileName; + return m_pathIscsHome + "/resource/" + m_language + "/model_studio/translate/" + strFileName; } QString Common::getTablePath(QString strFileName) { - QString strFilePath = m_pathIscsHome + "/product/common/resource/" + m_language + "/model_studio/setting/table/" + strFileName; - if (QFile::exists(strFilePath)) - return strFilePath; - else - return m_pathIscsHome + "/platform/common/resource/" + m_language + "/model_studio/setting/table/" + strFileName; + return m_pathIscsHome + "/resource/" + m_language + "/model_studio/setting/table/" + strFileName; } QString Common::getTreePath(QString strFileName) { - QString strFilePath = m_pathIscsHome + "/product/common/resource/" + m_language + "/model_studio/setting/tree/" + strFileName; - if (QFile::exists(strFilePath)) - return strFilePath; - else - return m_pathIscsHome + "/platform/common/resource/" + m_language + "/model_studio/setting/tree/" + strFileName; + return m_pathIscsHome + "/resource/" + m_language + "/model_studio/setting/tree/" + strFileName; } QString Common::getResourcePath(QString strFileName) { - QString strFilePath = m_pathIscsHome + "/product/common/resource/" + m_language + "/model_studio/icons/" + strFileName; - if (QFile::exists(strFilePath)) - return strFilePath; - else - return m_pathIscsHome + "/platform/common/resource/" + m_language + "/model_studio/icons/" + strFileName; + return m_pathIscsHome + "/resource/" + m_language + "/model_studio/icons/" + strFileName; } QString Common::getIscsHome() @@ -111,6 +95,11 @@ QString Common::getSoftwareVersion() return QString::fromStdString(strValue); } +QString Common::getLanguage() +{ + return m_language; +} + /** * @brief Common::isInTablePath 判断xmlFileName对应的xml表格文件是否在对应的路径下 * @param xmlFileName @@ -119,7 +108,7 @@ QString Common::getSoftwareVersion() bool Common::isInTablePath(const QString &xmlFileName) { QDir dir; - QString strTablePath = m_pathIscsHome + "/product/common/resource/" + m_language + "/model_studio/setting/table"; + QString strTablePath = m_pathIscsHome + "/resource/" + m_language + "/model_studio/setting/table"; dir.setPath(strTablePath); dir.setFilter(QDir::Files|QDir::NoSymLinks|QDir::NoDotAndDotDot); QFileInfoList productList = dir.entryInfoList(); @@ -128,7 +117,7 @@ bool Common::isInTablePath(const QString &xmlFileName) return true; } - strTablePath = m_pathIscsHome + "/platform/common/resource/" + m_language + "/model_studio/setting/table"; + strTablePath = m_pathIscsHome + "/resource/resource/" + m_language + "/model_studio/setting/table"; dir.setPath(strTablePath); dir.setFilter(QDir::Files|QDir::NoSymLinks|QDir::NoDotAndDotDot); QFileInfoList platformList = dir.entryInfoList(); @@ -526,7 +515,7 @@ QString Common::getTableChineseName(const QString &tableName) bool Common::isRemove(QWidget *parent) { - if ( QMessageBox::Yes == QMessageBox::warning(parent,QObject::tr("消息"),QObject::tr("确定删除?"),QMessageBox::Yes,QMessageBox::No) ) + if ( N_MessageBox::Yes == N_MessageBox::warning(parent,QObject::tr("消息"),QObject::tr("确定删除?"),N_MessageBox::Yes,N_MessageBox::No) ) return true; return false; } @@ -535,7 +524,7 @@ bool Common::isSelect(QWidget *parent, int n) { if ( n <= 0 ) { - QMessageBox::warning(parent,QObject::tr("消息"),QObject::tr("请先选择要删除的内容")); + N_MessageBox::warning(parent,QObject::tr("消息"),QObject::tr("请先选择要删除的内容")); return false; } return isRemove(parent); diff --git a/platform/src/tools/model_common/model_common.pro b/platform/src/tools/model_common/model_common.pro index 02463519..ea473cf4 100644 --- a/platform/src/tools/model_common/model_common.pro +++ b/platform/src/tools/model_common/model_common.pro @@ -20,6 +20,7 @@ exists($$PWD/../../common.pri) { LIBS += -lpub_logger_api LIBS += -llog4cplus -lpub_utility_api LIBS += -lrdb_api +LIBS += -lpub_widget DEFINES += COMMON_LIBRARY @@ -47,7 +48,9 @@ unix { INSTALLS += target } -TRANSLATIONS += model_common_EN.ts +TRANSLATIONS += model_common_EN.ts\ + model_common_FR.ts + #CODECFORTR = utf-8 DEFAULTCODEC = utf-8 #CODEC = utf-8 diff --git a/platform/src/tools/model_common/model_common_EN.ts b/platform/src/tools/model_common/model_common_EN.ts index 54bd3b1c..61f2156c 100644 --- a/platform/src/tools/model_common/model_common_EN.ts +++ b/platform/src/tools/model_common/model_common_EN.ts @@ -4,45 +4,45 @@ QObject - - 成功读取中英文翻译配置%1 - + + 获取版本信息失败! + Failed to obtain version information! - - - 读取中英文翻译配置不成功 - - - - + 模拟量 - + Analog Quantity - + 数字量 - + Digital Quantity - - 枚举量 - + + 混合量 + Mixed Quantity - + + 确定删除? + Are you sure you want to delete? + + + + 请先选择要删除的内容 + Please select the content to delete first + + + 累积量 - + Accumulative Quantity - + + 消息 - - - - - 是否删除? - + Message diff --git a/platform/src/tools/model_plugin/AlarmWidget/AlarmWidget.pro b/platform/src/tools/model_plugin/AlarmWidget/AlarmWidget.pro index 3f6d5d94..d559b180 100644 --- a/platform/src/tools/model_plugin/AlarmWidget/AlarmWidget.pro +++ b/platform/src/tools/model_plugin/AlarmWidget/AlarmWidget.pro @@ -46,4 +46,5 @@ HEADERS += \ LIBS += -lmodel_common LIBS += -lmodel_table +LIBS += -lpub_widget diff --git a/platform/src/tools/model_plugin/AlarmWidget/alarmdefinepluginwidget.h b/platform/src/tools/model_plugin/AlarmWidget/alarmdefinepluginwidget.h index 78d57b65..c778ba9e 100644 --- a/platform/src/tools/model_plugin/AlarmWidget/alarmdefinepluginwidget.h +++ b/platform/src/tools/model_plugin/AlarmWidget/alarmdefinepluginwidget.h @@ -7,7 +7,7 @@ class AlarmDefinePluginWidget : public QObject, public CPluginWidgetInterface { Q_OBJECT - Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0") + Q_PLUGIN_METADATA(IID HMI_WidgetPlugin_IID) Q_INTERFACES(CPluginWidgetInterface) public: diff --git a/platform/src/tools/model_plugin/AlarmWidget/alarmwidget.cpp b/platform/src/tools/model_plugin/AlarmWidget/alarmwidget.cpp index d0463519..77bc3ae3 100644 --- a/platform/src/tools/model_plugin/AlarmWidget/alarmwidget.cpp +++ b/platform/src/tools/model_plugin/AlarmWidget/alarmwidget.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" #define CLK_ALARM_MANNER "CLK_ALARM_MANNER" #define CLK_ALARM_LEVEL "CLK_ALARM_LEVEL" @@ -91,15 +91,21 @@ QWidget *AlarmWidget::initTotal() m_barTotal = new QToolBar(widget); m_tableTotal = new KbdTable(widget,REWRITE_COMMIT); - m_barTotal->setIconSize(QSize(24,24)); //< 注意顺序,添加、删除、导入按钮在下方 onLeftTreeClick() 函数中有设置其使能 - m_barTotal->addAction(QIcon(":/icons/icons/new.png"),tr("添加记录"),this,SLOT(onAddTableTotalRow())); - m_barTotal->addAction(QIcon(":/icons/icons/delete.png"),tr("删除记录"),m_tableTotal,SLOT(onRemoveRowNotCommit())); - m_barTotal->addAction(QIcon(":/icons/icons/undo.png"),tr("撤销更改"),m_tableTotal,SLOT(onUndo())); - m_barTotal->addAction(QIcon(":/icons/icons/save.png"),tr("保存"),this,SLOT(onSaveTableTotal())); + QAction* act = nullptr; + act = m_barTotal->addAction(tr("添加记录"),this,SLOT(onAddTableTotalRow())); + m_barTotal->widgetForAction(act)->setObjectName("icon_add"); + act = m_barTotal->addAction(tr("删除记录"),m_tableTotal,SLOT(onRemoveRowNotCommit())); + m_barTotal->widgetForAction(act)->setObjectName("icon_delete"); + act = m_barTotal->addAction(tr("撤销更改"),m_tableTotal,SLOT(onUndo())); + m_barTotal->widgetForAction(act)->setObjectName("icon_undo"); + act = m_barTotal->addAction(tr("保存"),this,SLOT(onSaveTableTotal())); + m_barTotal->widgetForAction(act)->setObjectName("icon_save"); m_barTotal->addSeparator(); - m_barTotal->addAction(QIcon(":/icons/icons/Excel-export.png"),tr("Excel导出"),m_tableTotal,SLOT(onExcelExport())); - m_barTotal->addAction(QIcon(":/icons/icons/Excel-Impor.png"),tr("Excel导入"),m_tableTotal,SLOT(onImportExcel())); + act = m_barTotal->addAction(tr("Excel导出"),m_tableTotal,SLOT(onExcelExport())); + m_barTotal->widgetForAction(act)->setObjectName("icon_excel_export"); + act = m_barTotal->addAction(tr("Excel导入"),m_tableTotal,SLOT(onImportExcel())); + m_barTotal->widgetForAction(act)->setObjectName("icon_excel_import"); vLayout1->addWidget(m_barTotal); vLayout1->addWidget(m_tableTotal); @@ -117,11 +123,15 @@ QWidget *AlarmWidget::initAlarmManner() m_tableAlarmManner = new KbdTable(splitter,REWRITE_COMMIT); m_tableAlarmManner->setEditTriggers(QAbstractItemView::DoubleClicked); - bar1->setIconSize(QSize(24,24)); - bar1->addAction(QIcon(":/icons/icons/new.png"),tr("添加记录"),this,SLOT(onAddTableAlarmMannerRow())); - bar1->addAction(QIcon(":/icons/icons/delete.png"),tr("删除记录"),m_tableAlarmManner,SLOT(onRemoveRowNotCommit())); - bar1->addAction(QIcon(":/icons/icons/undo.png"),tr("撤销更改"),m_tableAlarmManner,SLOT(onUndo())); - bar1->addAction(QIcon(":/icons/icons/save.png"),tr("保存"),this,SLOT(onSaveTableAlarmManner())); + QAction* act = nullptr; + act = bar1->addAction(tr("添加记录"),this,SLOT(onAddTableAlarmMannerRow())); + bar1->widgetForAction(act)->setObjectName("icon_add"); + act = bar1->addAction(tr("删除记录"),m_tableAlarmManner,SLOT(onRemoveRowNotCommit())); + bar1->widgetForAction(act)->setObjectName("icon_delete"); + act = bar1->addAction(tr("撤销更改"),m_tableAlarmManner,SLOT(onUndo())); + bar1->widgetForAction(act)->setObjectName("icon_undo"); + act = bar1->addAction(tr("保存"),this,SLOT(onSaveTableAlarmManner())); + bar1->widgetForAction(act)->setObjectName("icon_save"); vLayout1->addWidget(bar1); vLayout1->addWidget(m_tableAlarmManner); vLayout1->setMargin(0); @@ -169,11 +179,15 @@ QWidget *AlarmWidget::initAlarmLevel() m_tableLevel = new KbdTable(splitter,REWRITE_COMMIT); m_tableLevel->setEditTriggers(QAbstractItemView::DoubleClicked); - bar1->setIconSize(QSize(24,24)); - bar1->addAction(QIcon(":/icons/icons/new.png"),tr("添加记录"),this,SLOT(onAddTableLevel())); - bar1->addAction(QIcon(":/icons/icons/delete.png"),tr("删除记录"),m_tableLevel,SLOT(onRemoveRowNotCommit())); - bar1->addAction(QIcon(":/icons/icons/undo.png"),tr("撤销更改"),m_tableLevel,SLOT(onUndo())); - bar1->addAction(QIcon(":/icons/icons/save.png"),tr("保存"),this,SLOT(onSaveTableLevel())); + QAction* act = nullptr; + act = bar1->addAction(tr("添加记录"),this,SLOT(onAddTableLevel())); + bar1->widgetForAction(act)->setObjectName("icon_add"); + act = bar1->addAction(tr("删除记录"),m_tableLevel,SLOT(onRemoveRowNotCommit())); + bar1->widgetForAction(act)->setObjectName("icon_delete"); + act = bar1->addAction(tr("撤销更改"),m_tableLevel,SLOT(onUndo())); + bar1->widgetForAction(act)->setObjectName("icon_undo"); + act = bar1->addAction(tr("保存"),this,SLOT(onSaveTableLevel())); + bar1->widgetForAction(act)->setObjectName("icon_save"); vLayout1->addWidget(bar1); vLayout1->addWidget(m_tableLevel); vLayout1->setMargin(0); @@ -233,6 +247,9 @@ void AlarmWidget::initData() void AlarmWidget::onLocationAndSubsystemChange() { + if ( m_cbLocation->currentData().toString() == "" || m_cbSubSystem->currentData().toString() == "" ) + return; + QString locationId = QString( "LOCATION_ID = %1" ).arg(m_cbLocation->currentData().toString()); QString subsystemId = QString( "SUB_SYSTEM = %1" ).arg(m_cbSubSystem->currentData().toString()); @@ -248,8 +265,8 @@ void AlarmWidget::onDevInstModelClicked(const QModelIndex &index) if(m_isAlarmPlanTextChanged) { - if(QMessageBox::information(this,tr("消息"),tr("是否保存当前预案"),QMessageBox::Yes,QMessageBox::No) - == QMessageBox::Yes) + if(N_MessageBox::information(this,tr("消息"),tr("是否保存当前预案"),N_MessageBox::Yes,N_MessageBox::No) + == N_MessageBox::Yes) { onSaveClicked(); } @@ -276,8 +293,8 @@ void AlarmWidget::onDevPointClicked(const QModelIndex &index) { if(m_isAlarmPlanTextChanged) { - if(QMessageBox::information(this,tr("消息"),tr("是否保存当前预案"),QMessageBox::Yes,QMessageBox::No) - == QMessageBox::Yes) + if(N_MessageBox::information(this,tr("消息"),tr("是否保存当前预案"),N_MessageBox::Yes,N_MessageBox::No) + == N_MessageBox::Yes) { onSaveClicked(); } @@ -344,8 +361,8 @@ void AlarmWidget::onCheckBoxChanged() if(m_isAlarmPlanTextChanged) { - if(QMessageBox::information(this,tr("消息"),tr("是否保存当前预案"),QMessageBox::Yes,QMessageBox::No) - == QMessageBox::Yes) + if(N_MessageBox::information(this,tr("消息"),tr("是否保存当前预案"),N_MessageBox::Yes,N_MessageBox::No) + == N_MessageBox::Yes) { onSaveClicked(); } diff --git a/platform/src/tools/model_plugin/DevModelWidget/DevModelWidget.pro b/platform/src/tools/model_plugin/DevModelWidget/DevModelWidget.pro index 374d0347..b576436f 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/DevModelWidget.pro +++ b/platform/src/tools/model_plugin/DevModelWidget/DevModelWidget.pro @@ -56,6 +56,10 @@ SOURCES += \ kbddevgrouplistdlg.cpp \ kbdbatchmodifydevgroup.cpp + + + + HEADERS += \ devicemodelpluginwidget.h \ devwidget.h \ @@ -84,6 +88,7 @@ HEADERS += \ LIBS += -lmodel_common -llog4cplus -lpub_logger_api LIBS += -lmodel_table -lboost_system -lpub_utility_api LIBS += -lmodel_excel +LIBS += -lpub_widget FORMS += \ kbdfesdevtempdlg.ui diff --git a/platform/src/tools/model_plugin/DevModelWidget/devicemodelpluginwidget.h b/platform/src/tools/model_plugin/DevModelWidget/devicemodelpluginwidget.h index 0895be49..f2834ad9 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/devicemodelpluginwidget.h +++ b/platform/src/tools/model_plugin/DevModelWidget/devicemodelpluginwidget.h @@ -7,7 +7,7 @@ class DeviceModelPluginWidget : public QObject, public CPluginWidgetInterface { Q_OBJECT - Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0") + Q_PLUGIN_METADATA(IID HMI_WidgetPlugin_IID) Q_INTERFACES(CPluginWidgetInterface) public: diff --git a/platform/src/tools/model_plugin/DevModelWidget/devwidget.cpp b/platform/src/tools/model_plugin/DevModelWidget/devwidget.cpp index 6d68f886..8b2a160d 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/devwidget.cpp +++ b/platform/src/tools/model_plugin/DevModelWidget/devwidget.cpp @@ -10,7 +10,7 @@ #include #include "kbdpropertydlg.h" #include "kbddbdesign.h" -#include +#include "pub_widget/MessageBox.h" #include #include "kbdcheckrole.h" #include "kbdfesdevdlg.h" @@ -46,8 +46,7 @@ #include "CustomWidget/kbdtreeview.h" #include "kbddevgrouplistdlg.h" #include "kbdbatchmodifydevgroup.h" -#include -#include "pub_logger_api/logger.h" + #define TN_ANALOG_MAP_TO_FES "ANALOG_MAP_TO_FES" #define TN_ACCUML_MAP_TO_FES "ACCUML_MAP_TO_FES" #define TN_MIX_MAP_TO_FES "MIX_MAP_TO_FES" @@ -82,18 +81,27 @@ void DevWidget::initLayout() QWidget *widgetRight = new QWidget(this); - QGroupBox *boxTitle = new QGroupBox(tr("显示模式"),widgetRight); + QGroupBox *boxTitle = new QGroupBox(tr(""),widgetRight); + QLabel *titleLable = new QLabel(tr("显示模式:"),boxTitle); QRadioButton *btDetail = new QRadioButton(tr("详细模式"),boxTitle); QRadioButton *btTable = new QRadioButton(tr("表格模式"),boxTitle); //QRadioButton *btFes = new QRadioButton(tr("前置关联"),boxTitle);//隐藏前置关联模式 + m_searchText = new kbdSearchWidget(boxTitle); + m_searchText->setPlaceholderText(tr("请输入描述")); + connect(m_searchText,&kbdSearchWidget::sigSearch,this,&DevWidget::onSearchTableText); QHBoxLayout *hLayoutBt = new QHBoxLayout; + hLayoutBt->addSpacing(10); + hLayoutBt->addWidget(titleLable); + hLayoutBt->addSpacing(5); hLayoutBt->addWidget(btDetail); hLayoutBt->addSpacing(20); hLayoutBt->addWidget(btTable); - hLayoutBt->addSpacing(20); + hLayoutBt->addSpacing(25); + hLayoutBt->addWidget(m_searchText); //hLayoutBt->addWidget(btFes); hLayoutBt->addStretch(); + hLayoutBt->setMargin(0); boxTitle->setLayout(hLayoutBt); m_stackRight = new QStackedWidget(widgetRight); @@ -110,6 +118,7 @@ void DevWidget::initLayout() QHBoxLayout *hLayout = new QHBoxLayout; hLayout->addWidget(hSplitter); + //hLayout->setMargin(0); setLayout(hLayout); m_btGrp = new QButtonGroup(this); @@ -122,8 +131,8 @@ void DevWidget::initLayout() QWidget *DevWidget::initDevInstWidget() { - QGroupBox *boxInst = new QGroupBox(tr("设备实例"),this); + boxInst->setAlignment(Qt::AlignCenter); QVBoxLayout *vLayout = new QVBoxLayout; QHBoxLayout *hLayoutTool = new QHBoxLayout; @@ -149,7 +158,7 @@ QWidget *DevWidget::initDevInstWidget() label1 = new QLabel(tr("RTU:"),boxInst); m_cbRtu = new QComboBox(boxInst); m_cbRtu->setView(new QListView); - m_cbRtu->setMinimumWidth(450); + m_cbRtu->setMaximumWidth(450); hLayoutTool = new QHBoxLayout; hLayoutTool->setSpacing(0); hLayoutTool->setMargin(0); @@ -164,32 +173,14 @@ QWidget *DevWidget::initDevInstWidget() m_modelDevInst = new KbdDomModel(Common::getTreePath("devInstTree.xml"),this); m_treeDevInst->setModel(m_modelDevInst); - search = new kbdSearchWidget(this); + kbdSearchWidget* search = new kbdSearchWidget(this); - QCheckBox* ck = new QCheckBox(tr("多选"), this); - Allck = new QPushButton(tr("全选"), this); - m_btnSearch = new QPushButton(tr("查询"),this); - QHBoxLayout *hLayoutSearch= new QHBoxLayout; - hLayoutSearch->setSpacing(0); - hLayoutSearch->setMargin(0); - m_btnSearch->setVisible(false); - m_btnSearch->setMaximumWidth(60); - Allck->setVisible(false); - Allck->setMaximumWidth(60); - - connect(ck, &QCheckBox::clicked,this, &DevWidget::onSetCheckEnable); - connect(Allck, &QPushButton::clicked,this, &DevWidget::onAllSetCheckEnable); - connect(m_btnSearch, &QPushButton::clicked, this, &DevWidget::onSearch); vLayout->addLayout(hLayoutTool); vLayout->addWidget(search); vLayout->addWidget(m_treeDevInst); - hLayoutSearch->addWidget(ck); - hLayoutSearch->addWidget(Allck); - hLayoutSearch->addWidget(m_btnSearch); - vLayout->addLayout(hLayoutSearch); boxInst->setLayout(vLayout); - connect(search,&kbdSearchWidget::sigSearch,m_treeDevInst,&KbdTreeView::onCardSearchItemText); + connect(search,&kbdSearchWidget::sigSearch,m_treeDevInst,&KbdTreeView::onSearchItemText); return boxInst; } @@ -282,47 +273,8 @@ QWidget *DevWidget::initPropertyWidget() QWidget *DevWidget::initTableWidget() { - LOGINFO("进入表格模式成功,开始添加框架"); - QVBoxLayout *vLayout = new QVBoxLayout; QWidget *w = new QWidget(m_stackRight); QGridLayout *gridLayout = new QGridLayout; - QGroupBox *box = new QGroupBox(tr("后台测点"),w); - - LOGINFO("添加矿建成功,开始添加搜索框"); - QToolBar * bar = new QToolBar(w); - searchCombox_1=new QComboBox(this); - searchCombox_2=new QComboBox(this); - searchCombox_3=new QComboBox(this); - searchCombox_1->setView(new QListView); - searchCombox_3->setView(new QListView); - searchCombox_2->setView(new QListView); - tableSearch_1 = new kbdSearchWidget(this); - tableSearch_1->setMaximumWidth(350); - tableSearch_1->setPlaceholderText(tr("请输入")); - connect(tableSearch_1,&kbdSearchWidget::sigSearch,this,&DevWidget::onSearchTableText); - tableSearch_2 = new kbdSearchWidget(this); - tableSearch_2->setMaximumWidth(350); - tableSearch_2->setPlaceholderText(tr("请输入")); - connect(tableSearch_2,&kbdSearchWidget::sigSearch,this,&DevWidget::onSearchTableText); - tableSearch_3 = new kbdSearchWidget(this); - tableSearch_3->setMaximumWidth(350); - tableSearch_3->setPlaceholderText(tr("请输入")); - connect(tableSearch_3,&kbdSearchWidget::sigSearch,this,&DevWidget::onSearchTableText); - bar->setIconSize(QSize(24,24)); - connect(searchCombox_1,&QComboBox::currentTextChanged,this,&DevWidget::onSearchTableText); - connect(searchCombox_2,&QComboBox::currentTextChanged,this,&DevWidget::onSearchTableText); - connect(searchCombox_3,&QComboBox::currentTextChanged,this,&DevWidget::onSearchTableText); - - bar->addWidget(searchCombox_1); - bar->addWidget(tableSearch_1); - bar->addSeparator(); - bar->addWidget(searchCombox_2); - bar->addWidget(tableSearch_2); - bar->addSeparator(); - bar->addWidget(searchCombox_3); - bar->addWidget(tableSearch_3); - LOGINFO("添加搜索框成功"); - m_tabbarPointType = new QTabBar(w); m_tabbarPointType->addTab(Common::pointTypeDesc(Common::ANAGroup)); @@ -349,11 +301,7 @@ QWidget *DevWidget::initTableWidget() gridLayout->setSpacing(0); gridLayout->setMargin(0); - box->setLayout(gridLayout); - vLayout->addWidget(bar); - vLayout->addWidget(box); - w->setLayout(vLayout); - LOGINFO("添加图形框成功"); + w->setLayout(gridLayout); return w; } @@ -780,219 +728,6 @@ KbdTableModel *DevWidget::instDevPointModel(const QString &devTagName, Common::K return model; } -KbdTableModel *DevWidget::instListDevPointModel(const QStringList &devTagNameList, Common::KbdGroup group, const QString &pointAttr) -{ - KbdTableModel * model = NULL; - if(group == Common::ACCGroup) - { - if(pointAttr == TAB_BASE) - { - QString devTagName="NULL, "; - for(auto devItor=devTagNameList.begin();devItor!=devTagNameList.end();devItor++) - { - devTagName+="'"+*devItor+"', "; - } - devTagName=devTagName.left(devTagName.length()-2); - QString filter = QString("%1 in (%2) ORDER BY SEQ_NO").arg(CN_DEV).arg(devTagName); - model = KbdTableDataMgr::getInstance() - ->createModel(Common::createViewName(TBL_ACC,filter)); - } - else if(pointAttr == TAB_CONTROL) - { - model = NULL; - } - else if(pointAttr == TAB_FES) - { - QString filter=""; - for(auto devItor=devTagNameList.begin();devItor!=devTagNameList.end();devItor++) - { - filter+=QString(" (%1 LIKE 'accuml.%2.%') or").arg(CN_KEY_ID_TAG).arg(*devItor); - } - filter=filter.left(filter.length()-2); - model = KbdTableDataMgr::getInstance() - ->createModel(Common::createViewName(TBL_ACCUML_MAP_TO_FES,filter)); - } - else if(pointAttr == TAB_LIMIT) - { - QString filter=""; - for(auto devItor=devTagNameList.begin();devItor!=devTagNameList.end();devItor++) - { - filter+=QString(" (%1 LIKE '%2.%') or").arg(CN_TAG_NAME).arg(*devItor); - } - filter=filter.left(filter.length()-2); - model = KbdTableDataMgr::getInstance() - ->createModel(Common::createViewName(TBL_ACCUML_LIMIT_INFO,filter)); - } - } - else if(group == Common::ANAGroup) - { - if(pointAttr == TAB_BASE) - { - QString devTagName="NULL, "; - for(auto devItor=devTagNameList.begin();devItor!=devTagNameList.end();devItor++) - { - devTagName+="'"+*devItor+"', "; - } - devTagName=devTagName.left(devTagName.length()-2); - QString filter = QString("%1 in (%2) ORDER BY SEQ_NO").arg(CN_DEV).arg(devTagName); - model = KbdTableDataMgr::getInstance() - ->createModel(Common::createViewName(TBL_ANA,filter)); - } - else if(pointAttr == TAB_CONTROL) - { - QString filter=""; - for(auto devItor=devTagNameList.begin();devItor!=devTagNameList.end();devItor++) - { - filter+=QString(" (%1 LIKE '%2.%') or").arg(CN_TAG_NAME).arg(*devItor); - } - filter=filter.left(filter.length()-2); - model = KbdTableDataMgr::getInstance() - ->createModel(Common::createViewName(TBL_ANALOG_CONTROL,filter)); - } - else if(pointAttr == TAB_FES) - { - QString filter=""; - for(auto devItor=devTagNameList.begin();devItor!=devTagNameList.end();devItor++) - { - filter+=QString(" (%1 LIKE 'analog.%2.%') or").arg(CN_KEY_ID_TAG).arg(*devItor); - } - filter=filter.left(filter.length()-2); - model = KbdTableDataMgr::getInstance() - ->createModel(Common::createViewName(TBL_ANALOG_MAP_TO_FES,filter)); - } - else if(pointAttr == TAB_LIMIT) - { - QString filter=""; - for(auto devItor=devTagNameList.begin();devItor!=devTagNameList.end();devItor++) - { - filter+=QString(" (%1 LIKE '%2.%') or").arg(CN_TAG_NAME).arg(*devItor); - } - filter=filter.left(filter.length()-2); - model = KbdTableDataMgr::getInstance() - ->createModel(Common::createViewName(TBL_ANALOG_LIMIT_INFO,filter)); - } - else if(pointAttr == TAB_LOCK_PARAM) - { - - QString filter=""; - for(auto devItor=devTagNameList.begin();devItor!=devTagNameList.end();devItor++) - { - filter+=QString(" (%1 LIKE '%2.%') or").arg(CN_TAG_NAME).arg(*devItor); - } - filter=filter.left(filter.length()-2); - model = KbdTableDataMgr::getInstance() - ->createModel(Common::createViewName(TBL_OPT_INTERLOCK_PARA, filter)); - } - } - else if(group == Common::DIGroup) - { - if(pointAttr == TAB_BASE) - { - QString devTagName="NULL, "; - for(auto devItor=devTagNameList.begin();devItor!=devTagNameList.end();devItor++) - { - devTagName+="'"+*devItor+"' ,"; - } - devTagName=devTagName.left(devTagName.length()-2); - QString filter = QString("%1 in (%2) ORDER BY SEQ_NO").arg(CN_DEV).arg(devTagName); - model = KbdTableDataMgr::getInstance() - ->createModel(Common::createViewName(TBL_DIG,filter)); - } - else if(pointAttr == TAB_CONTROL) - { - QString filter=""; - for(auto devItor=devTagNameList.begin();devItor!=devTagNameList.end();devItor++) - { - filter+=QString(" (%1 LIKE '%2.%') or").arg(CN_TAG_NAME).arg(*devItor); - } - filter=filter.left(filter.length()-2); - model = KbdTableDataMgr::getInstance() - ->createModel(Common::createViewName(TBL_DIGITAL_CONTROL,filter)); - } - else if(pointAttr == TAB_FES) - { - QString filter=""; - for(auto devItor=devTagNameList.begin();devItor!=devTagNameList.end();devItor++) - { - filter+=QString(" (%1 LIKE 'digital.%2.%') or").arg(CN_KEY_ID_TAG).arg(*devItor); - } - filter=filter.left(filter.length()-2); - model = KbdTableDataMgr::getInstance() - ->createModel(Common::createViewName(TBL_DIGITAL_MAP_TO_FES,filter)); - } - else if(pointAttr == TAB_LIMIT) - { - model = NULL; - } - else if (pointAttr == TAB_LOCK_PARAM) - { - QString filter=""; - for(auto devItor=devTagNameList.begin();devItor!=devTagNameList.end();devItor++) - { - filter+=QString(" (%1 LIKE '%2.%') or").arg(CN_TAG_NAME).arg(*devItor); - } - filter=filter.left(filter.length()-2); - model = KbdTableDataMgr::getInstance() - ->createModel(Common::createViewName(TBL_OPT_INTERLOCK_PARA, filter)); - } - } - else if(group == Common::MIXGroup) - { - if(pointAttr == TAB_BASE) - { - QString devTagName="NULL, "; - for(auto devItor=devTagNameList.begin();devItor!=devTagNameList.end();devItor++) - { - devTagName+="'"+*devItor+"', "; - } - devTagName=devTagName.left(devTagName.length()-2); - QString filter = QString("%1 in (%2) ORDER BY SEQ_NO").arg(CN_DEV).arg(devTagName); - model = KbdTableDataMgr::getInstance() - ->createModel(Common::createViewName(TBL_MIX,filter)); - } - else if(pointAttr == TAB_CONTROL) - { - QString filter=""; - for(auto devItor=devTagNameList.begin();devItor!=devTagNameList.end();devItor++) - { - filter+=QString(" (%1 LIKE '%2.%') or").arg(CN_TAG_NAME).arg(*devItor); - } - filter=filter.left(filter.length()-2); - model = KbdTableDataMgr::getInstance() - ->createModel(Common::createViewName(TBL_MIX_CONTROL,filter)); - } - else if(pointAttr == TAB_FES) - { - QString filter=""; - for(auto devItor=devTagNameList.begin();devItor!=devTagNameList.end();devItor++) - { - filter+=QString(" (%1 LIKE 'mix.%2.%') or").arg(CN_KEY_ID_TAG).arg(*devItor); - } - filter=filter.left(filter.length()-2); - model = KbdTableDataMgr::getInstance() - ->createModel(Common::createViewName(TBL_MIX_MAP_TO_FES,filter)); - } - else if(pointAttr == TAB_LIMIT) - { - model = NULL; - } - else if (pointAttr == TAB_LOCK_PARAM) - { - QString filter=""; - for(auto devItor=devTagNameList.begin();devItor!=devTagNameList.end();devItor++) - { - filter+=QString(" (%1 LIKE '%2.%') or").arg(CN_TAG_NAME).arg(*devItor); - } - filter=filter.left(filter.length()-2); - model = KbdTableDataMgr::getInstance() - ->createModel(Common::createViewName(TBL_OPT_INTERLOCK_PARA, filter)); - } - } - - - return model; -} - void DevWidget::setAccGroupPanel(const QString &ptTagName) { KbdTableModel *modelLimit = KbdTableDataMgr::getInstance()->createModel( @@ -1247,12 +982,14 @@ void DevWidget::showTableMode(KbdTreeView *tree) { m_tabbarPointType->setVisible(true); m_tabbarPointAttr->setVisible(true); + showDev(Common::getIDData(index)); } else//点击了设备组 { m_tabbarPointType->setVisible(false); m_tabbarPointAttr->setVisible(false); + showDevGroup(Common::getIDData(index)); } @@ -1269,64 +1006,8 @@ void DevWidget::showDevGroup(const QString &devGroupTagName) QString filter = QString("%1='%2'").arg(CN_GROUP_TAG_NAME).arg(devGroupTagName); KbdTableModel *model = KbdTableDataMgr::getInstance() ->createModel(Common::createViewName(TBL_DEV_INFO,filter)); - searchCombox_1->clear(); - searchCombox_2->clear(); - searchCombox_3->clear(); - comBoxsqlNameList.clear(); - ColMgrDataList cols=model->getHeadColsNoConst(); - QStringList comBoxDescList=cols.getDescList(); - QStringList currentComBoxsqlNameList=cols.getSqlName(); - QStringList mustComBoxDescList; - if(m_tabbarPointAttr->currentIndex()==0) - { - for(int i=0;iaddItems(mustComBoxDescList); - searchCombox_2->addItems(mustComBoxDescList); - searchCombox_3->addItems(mustComBoxDescList); - QFontMetrics fm(this->font()); - int max_len=0; - for(int i=0;icount();i++) - { - QRect rect=fm.boundingRect(searchCombox_1->itemText(i)); - if(max_lenview()->setFixedWidth(max_len); - searchCombox_3->view()->setFixedWidth(max_len); - searchCombox_2->view()->setFixedWidth(max_len); + m_tableMode->getTable()->setModel(model); - tableSearch_1->clear(); - tableSearch_2->clear(); - tableSearch_3->clear(); } void DevWidget::showDev(const QString &devTagName) @@ -1338,101 +1019,6 @@ void DevWidget::showDev(const QString &devTagName) onTableTabChanged(); } -void DevWidget::showListDev(const QStringList &devTagNameList) -{ - QString tempOrInst = m_tableMode->getTable()->statusTip(); - searchCombox_1->clear(); - searchCombox_2->clear(); - searchCombox_3->clear(); - comBoxsqlNameList.clear(); - if(tempOrInst.isEmpty() || devTagNameList.isEmpty()) - return; - QString pointType = m_tabbarPointType->tabText(m_tabbarPointType->currentIndex()); - KbdTableModel *model = NULL; - if(tempOrInst == CUR_INST) - { - if(pointType == Common::pointTypeDesc(Common::ACCGroup)) - { - model = instListDevPointModel(devTagNameList,Common::ACCGroup, - m_tabbarPointAttr->tabText(m_tabbarPointAttr->currentIndex())); - } - else if(pointType == Common::pointTypeDesc(Common::ANAGroup)) - { - model = instListDevPointModel(devTagNameList,Common::ANAGroup, - m_tabbarPointAttr->tabText(m_tabbarPointAttr->currentIndex())); - } - else if(pointType == Common::pointTypeDesc(Common::DIGroup)) - { - model = instListDevPointModel(devTagNameList,Common::DIGroup, - m_tabbarPointAttr->tabText(m_tabbarPointAttr->currentIndex())); - } - else if(pointType == Common::pointTypeDesc(Common::MIXGroup)) - { - model = instListDevPointModel(devTagNameList,Common::MIXGroup, - m_tabbarPointAttr->tabText(m_tabbarPointAttr->currentIndex())); - } - - m_tableMode->getTable()->setModel(model); - } - if(model!=NULL) - { - ColMgrDataList cols=model->getHeadColsNoConst(); - QStringList comBoxDescList=cols.getDescList(); - QStringList currentComBoxsqlNameList=cols.getSqlName(); - QStringList mustComBoxDescList; - if(m_tabbarPointAttr->currentIndex()==0) - { - for(int i=0;iaddItems(mustComBoxDescList); - searchCombox_2->addItems(mustComBoxDescList); - searchCombox_3->addItems(mustComBoxDescList); - QFontMetrics fm(this->font()); - int max_len=0; - for(int i=0;icount();i++) - { - QRect rect=fm.boundingRect(searchCombox_1->itemText(i)); - if(max_lenview()->setFixedWidth(max_len); - searchCombox_3->view()->setFixedWidth(max_len); - searchCombox_2->view()->setFixedWidth(max_len); - } - tableSearch_1->clear(); - tableSearch_2->clear(); - tableSearch_3->clear(); - - -} - bool DevWidget::clearFesRelation(KbdTableModel *model, const QStringList &oldDatas, const QStringList &newDatas) { QString oldRtuTag; @@ -2063,11 +1649,13 @@ void DevWidget::onSwitchMode() clearPointList(); clearPanels(); m_stackRight->setCurrentIndex(0); + m_searchText->setPlaceholderText(tr("请输入描述")); } else if(disPlayMode() == TABLE_MODE) { clearTableMode(); m_stackRight->setCurrentIndex(1); + m_searchText->setPlaceholderText(tr("请输入标签或描述")); } else if(disPlayMode() == FES_MODE) { @@ -2077,6 +1665,7 @@ void DevWidget::onSwitchMode() if(m_treeLastClicked == m_treeDevInst) onDevInstModelClicked(m_treeDevInst->currentIndex()); + m_searchText->clear(); } void DevWidget::onLocationAndSubsystemChange() @@ -2112,43 +1701,15 @@ void DevWidget::onLocationAndSubsystemChange() { subsystemId = condTrue; } - /* - QStringList list; - if(subsystemId=="-1") - { - for(int i = 0; i < m_cbSubSystem->count(); i++) - { - list << "'" + m_cbSubSystem->itemData(i).toString() + "'"; - } - subsystemId = list.join(","); - } - else - { - subsystemId="'"+m_cbSubSystem->currentData().toString()+"'"; - } - list.clear(); - if(locationId=="-1") - { - for(int i = 0; i < m_cbLocation->count(); i++) - { - list << "'" + m_cbLocation->itemData(i).toString() + "'"; - } - locationId = list.join(","); - } - else - { - locationId="'"+m_cbLocation->currentData().toString()+"'"; - }*/ emit sigLocationAndSubsystemChange(locationId, subsystemId); KbdDbDesign ds; - QString sql = "SELECT RTU_NAME,DESCRIPTION,RTU_NO FROM fes_rtu_para WHERE (%1) " + QString sql = "SELECT RTU_NAME,RTU_NO FROM fes_rtu_para WHERE (%1) " "AND (%2) ORDER BY RTU_NO;"; disconnect(m_cbRtu,&QComboBox::currentTextChanged,this,&DevWidget::onRtuChange); m_cbRtu->clear(); - ds.getSqlInfoToCombobox(sql.arg(locationId).arg(subsystemId),CN_RTU_NAME,CN_DESC,CN_RTU_NO,m_cbRtu); - + ds.getSqlInfoToCombobox(sql.arg(locationId).arg(subsystemId),CN_RTU_NAME,CN_RTU_NO,m_cbRtu); m_cbRtu->insertItem(0,tr("全部")," 1=1 "); m_cbRtu->setCurrentIndex(0); connect(m_cbRtu,&QComboBox::currentTextChanged,this,&DevWidget::onRtuChange); @@ -2159,9 +1720,7 @@ void DevWidget::onLocationAndSubsystemChange() m_modelDevInst->setItemSqlArgs(0,QStringList()<refresh(); m_treeDevInst->setCurrentIndex(m_treeDevInst->rootIndex()); - QString currentSearchText=search->text(); - search->setText(""); - search->setText(currentSearchText); + clearPointList(); clearPanels(); clearTableMode(); @@ -2215,9 +1774,7 @@ void DevWidget::onRtuChange() m_modelDevInst->setItemSqlArgs(0,QStringList()<refresh(); m_treeDevInst->setCurrentIndex(m_treeDevInst->rootIndex()); - QString currentSearchText=search->text(); - search->setText(""); - search->setText(currentSearchText); + clearPointList(); clearPanels(); clearTableMode(); @@ -2231,9 +1788,9 @@ void DevWidget::onNeedSave() if(panel && panel->propertyIsChanged()) { - if(QMessageBox::information(this,tr("提示"),tr("测点属性已经修改,是否保存?"), - QMessageBox::Yes, - QMessageBox::No) == QMessageBox::Yes) + if(N_MessageBox::information(this,tr("提示"),tr("测点属性已经修改,是否保存?"), + N_MessageBox::Yes, + N_MessageBox::No) == N_MessageBox::Yes) { onSave(); } @@ -2444,8 +2001,6 @@ bool DevWidget::onSave() void DevWidget::onDevInstModelClicked(const QModelIndex &index) { - if (m_bCheckEnable) - return; m_treeLastClicked = m_treeDevInst; if(!index.isValid()) return; @@ -2897,7 +2452,7 @@ void DevWidget::onRelationToRtu() return; } - KbdSelectPointDlg dlg; + KbdSelectPointDlg dlg(this); dlg.setWindowTitle(tr("关联RTU/清除前置RTU")); QStringList list; list <currentData().toString()== "-1" || m_cbSubSystem->currentData().toString() == "-1") + if(m_cbLocation->currentIndex() == -1 || m_cbSubSystem->currentIndex() == -1) { - onMsg(tr("请先选择具体的位置和专业后添加 ")); + onMsg(tr("请先选择位置和专业")); return; } KbdTableModel *modelDevGroup = KbdTableDataMgr::getInstance()->createModel(TBL_DEV_GROUP); @@ -3022,6 +2577,7 @@ void DevWidget::onImportDevGroup() { ParsingDevFile ParseFile; KbdImportDevGroupDlg Dlg(this,&ParseFile); + Dlg.setWindowTitle(tr("导入建模实例")); if(!Dlg.exec()) return; @@ -3049,6 +2605,7 @@ void DevWidget::onExportDevGroup() { ParsingDevFile exportFile; KbdImportDevGroupDlg Dlg(this,&exportFile,true); + Dlg.setWindowTitle(tr("导出建模实例")); if(!Dlg.exec()) return; @@ -3225,6 +2782,7 @@ void DevWidget::onRemoveDevGroup() void DevWidget::onBatchModifyDevGroup() { kbdBatchModifyDevGroup dlg; + dlg.setWindowTitle(tr("批量修改设备组")); dlg.exec(); } @@ -3235,16 +2793,9 @@ void DevWidget::onRefreshDevInst() void DevWidget::onTableTabChanged() { - QString tagName; - QString tempOrInst; - tempOrInst= m_tableMode->getTable()->statusTip(); - tagName= m_tableMode->getTable()->toolTip(); + QString tempOrInst = m_tableMode->getTable()->statusTip(); + QString tagName = m_tableMode->getTable()->toolTip(); - searchCombox_1->clear(); - searchCombox_2->clear(); - searchCombox_3->clear(); - - comBoxsqlNameList.clear(); if(tempOrInst.isEmpty() || tagName.isEmpty()) return; @@ -3255,116 +2806,29 @@ void DevWidget::onTableTabChanged() { if(pointType == Common::pointTypeDesc(Common::ACCGroup)) { - if(m_bCheckEnable==true) - { - model = instListDevPointModel(devTagNameList,Common::ACCGroup, - m_tabbarPointAttr->tabText(m_tabbarPointAttr->currentIndex())); - } - else - { - model = instDevPointModel(tagName,Common::ACCGroup, - m_tabbarPointAttr->tabText(m_tabbarPointAttr->currentIndex())); - } - + model = instDevPointModel(tagName,Common::ACCGroup, + m_tabbarPointAttr->tabText(m_tabbarPointAttr->currentIndex())); } else if(pointType == Common::pointTypeDesc(Common::ANAGroup)) { - if(m_bCheckEnable==true) - { - model = instListDevPointModel(devTagNameList,Common::ANAGroup, - m_tabbarPointAttr->tabText(m_tabbarPointAttr->currentIndex())); - } - else - { - model = instDevPointModel(tagName,Common::ANAGroup, - m_tabbarPointAttr->tabText(m_tabbarPointAttr->currentIndex())); - } + model = instDevPointModel(tagName,Common::ANAGroup, + m_tabbarPointAttr->tabText(m_tabbarPointAttr->currentIndex())); } else if(pointType == Common::pointTypeDesc(Common::DIGroup)) { - if(m_bCheckEnable==true) - { - model = instListDevPointModel(devTagNameList,Common::DIGroup, - m_tabbarPointAttr->tabText(m_tabbarPointAttr->currentIndex())); - } - else - { - model = instDevPointModel(tagName,Common::DIGroup, - m_tabbarPointAttr->tabText(m_tabbarPointAttr->currentIndex())); - } + model = instDevPointModel(tagName,Common::DIGroup, + m_tabbarPointAttr->tabText(m_tabbarPointAttr->currentIndex())); } else if(pointType == Common::pointTypeDesc(Common::MIXGroup)) { - if(m_bCheckEnable==true) - { - model = instListDevPointModel(devTagNameList,Common::MIXGroup, - m_tabbarPointAttr->tabText(m_tabbarPointAttr->currentIndex())); - } - else - { - model = instDevPointModel(tagName,Common::MIXGroup, - m_tabbarPointAttr->tabText(m_tabbarPointAttr->currentIndex())); - } + model = instDevPointModel(tagName,Common::MIXGroup, + m_tabbarPointAttr->tabText(m_tabbarPointAttr->currentIndex())); } m_tableMode->getTable()->setModel(model); } - if(model!=NULL) - { - ColMgrDataList cols=model->getHeadColsNoConst(); - QStringList comBoxDescList=cols.getDescList(); - QStringList currentComBoxsqlNameList=cols.getSqlName(); - QStringList mustComBoxDescList; - if(m_tabbarPointAttr->currentIndex()==0) - { - for(int i=0;iaddItems(mustComBoxDescList); - searchCombox_2->addItems(mustComBoxDescList); - searchCombox_3->addItems(mustComBoxDescList); - QFontMetrics fm(this->font()); - int max_len=0; - for(int i=0;icount();i++) - { - QRect rect=fm.boundingRect(searchCombox_1->itemText(i)); - if(max_lenview()->setFixedWidth(max_len); - searchCombox_3->view()->setFixedWidth(max_len); - searchCombox_2->view()->setFixedWidth(max_len); - } - tableSearch_1->clear(); - tableSearch_2->clear(); - tableSearch_3->clear(); + onSearchTableText(m_searchText->text()); } void DevWidget::onModifyTable() @@ -3383,6 +2847,8 @@ void DevWidget::onModifyTable() if(retStr.isEmpty()) { KbdPropertyDlg dlg(true, this); + QString dlgTitleText = tr("修改") + m_tabbarPointType->tabText( m_tabbarPointType->currentIndex()) + tr("参数"); + dlg.setWindowTitle(dlgTitleText); dlg.panel()->setDisplayRow(model,index.row()); if(dlg.exec()) @@ -3977,6 +3443,11 @@ void DevWidget::onUpdateDescByFes() return; } + if ( N_MessageBox::Yes != N_MessageBox::warning(this,QObject::tr("消息"),QObject::tr("确定更新测点描述?"),N_MessageBox::Yes,N_MessageBox::No) ) + { + return; + } + QString errorMsg; Worker w; KbdWaitPrgDlg dlg(boost::bind(&Worker::updateDescByFes,&w,devTagList),this); @@ -4048,11 +3519,6 @@ void DevWidget::onDropDataFromFesDev(const QStringList &itemPointFormats) void DevWidget::onAddDevNoTemp() { - if(m_cbLocation->currentData().toString()== "-1" || m_cbSubSystem->currentData().toString() == "-1") - { - onMsg(tr("请先选择位置和专业")); - return; - } KbdTableModel *model = KbdTableDataMgr::getInstance()->createModel(TBL_DEV_INFO_FOR_EMPTY_ADD); if(model == NULL) return; @@ -4086,6 +3552,7 @@ void DevWidget::onAddDevNoTemp() } KbdPropertyDlg dlg(false, this); + dlg.setWindowTitle(tr("添加设备")); dlg.panel()->setDisplayRow(model,model->rowCount()); dlg.panel()->setDotStringPrefix(CN_TAG_NAME,locationTag); dlg.panel()->setPropertyValue(CN_LOCATION_ID,locationId+":"+locationDesc); @@ -4342,11 +3809,6 @@ void DevWidget::onPropertychange(const QString &sqlName, const QString &text) void DevWidget::onRefreshSelectPoint() { - if(m_cbLocation->currentData().toString()== "-1" || m_cbSubSystem->currentData().toString() == "-1") - { - onMsg(tr("请先选择具体的位置和专业")); - return; - } QList items = m_listPointInst->selectedItems(); if(items.isEmpty()) return; @@ -4392,150 +3854,27 @@ void DevWidget::onRefreshSameTagPoint() int group = items.first()->data(Common::GroupRole).toInt(); QString tagName = items.first()->data(Qt::UserRole).toString(); - KbdDevGroupListDlg dlg; + KbdDevGroupListDlg dlg(this); dlg.setSelectPoint(tagName,group); dlg.exec(); } -void DevWidget::onSearchTableText(const QString &text) +void DevWidget::onSearchTableText(const QString text) { - if(searchCombox_1->count()==0||searchCombox_2->count()==0||searchCombox_3->count()==0) - return; - if(comBoxsqlNameList.size()==0) - { - return; - } - int index_1=searchCombox_1->currentIndex(); - int index_2=searchCombox_2->currentIndex(); - int index_3=searchCombox_3->currentIndex(); - m_tableMode->getTable()->searchItemListText(QStringList()<text()<text()<text()); -} - -void DevWidget::onSetCheckEnable(bool checked) -{ - m_modelDevInst->setCheckEnable(checked); - m_btnSearch->setVisible(checked); - Allck->setVisible(checked); - m_bCheckEnable = checked; - m_treeDevInst->onSearchItemText(search->text()); - if(checked==true) - { - m_btGrp->button(1)->setChecked(true); - clearTableMode(); - m_stackRight->setCurrentIndex(1); - } - if(checked==false) - { - //Allck->setChecked(false); - } - clearTableMode(); -} - -void DevWidget::onAllSetCheckEnable() -{ - bool checked=true; - // m_treeDevInst->onSelectAll(); -// int rowCount = m_modelDevInst->rowCount(); -// for(int i = 0;i < rowCount;i++) -// { -// QStandardItem* item = m_modelDevInst->itemFromIndex(m_modelDevInst->index(i,0)); -// if(item->isCheckable()) -// item->setCheckState(Qt::Checked); -// } - for (int i = 0;i < m_modelDevInst->rowCount();i++) - { - - QModelIndex index = m_modelDevInst->index(i,0); - QStandardItem* item = m_modelDevInst->itemFromIndex(index); - - int count = item->rowCount(); - for(int j = 0;j < count;j++) - { - QModelIndex childIndex = index.child(j,0); - QStandardItem* childItem = m_modelDevInst->itemFromIndex(childIndex); - if(!m_treeDevInst->isRowHidden(i,index.parent())) - { - if(checked==true) - { - item->setCheckState(Qt::Checked); - childItem->setCheckState(Qt::Checked); - } - else - { - item->setCheckState(Qt::Unchecked); - childItem->setCheckState(Qt::Unchecked); - } - } - } - - } -} - -void DevWidget::onSearch() -{ - QList listItem; - m_tableMode->getTable()->setStatusTip(CUR_INST); - for (int i = 0;i < m_modelDevInst->rowCount();i++) - { - QStandardItem* item = m_modelDevInst->item(i, 0); - - if(item->checkState() == Qt::Unchecked) - continue; - - if (item->checkState() == Qt::Checked) - getItems(listItem, item); - - if (item->checkState() == Qt::PartiallyChecked) - getItems(listItem, item); - } if(disPlayMode() == DETAIL_MODE) { - return; + for(int i = 0;i < m_listPointInst->count();i++) + { + QListWidgetItem* item = m_listPointInst->item(i); + if(item->text().contains(text)) + item->setHidden(false); + else + item->setHidden(true); + } } - if(disPlayMode() == TABLE_MODE) + else if(disPlayMode() == TABLE_MODE) { - devTagNameList.clear(); - - for(auto itemItor=listItem.begin();itemItor!=listItem.end();itemItor++) - { - QModelIndex index = (*itemItor)->index(); - - if(index.parent().isValid()) //如果是设备 - { - m_tabbarPointType->setVisible(true); - m_tabbarPointAttr->setVisible(true); - - m_tableMode->getTable()->setToolTip(Common::getIDData(index)); - devTagNameList<getTable()->setModel(model); - showListDev(devTagNameList); + m_tableMode->getTable()->searchItemText(QStringList()<& listItem, QStandardItem* item) -{ - if (item->hasChildren()) - { - for (int i = 0;i < item->rowCount();i++) - { - QStandardItem* itemChild = item->child(i); - - if (itemChild->checkState() == Qt::Unchecked) - continue; - - if (itemChild->checkState() == Qt::Checked) - listItem << itemChild; - - if (itemChild->checkState() == Qt::PartiallyChecked) - getItems(listItem, itemChild); - } - } - -} diff --git a/platform/src/tools/model_plugin/DevModelWidget/devwidget.h b/platform/src/tools/model_plugin/DevModelWidget/devwidget.h index b89547d1..4249b552 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/devwidget.h +++ b/platform/src/tools/model_plugin/DevModelWidget/devwidget.h @@ -21,8 +21,6 @@ class QButtonGroup; class KbdDevAndFesWidget; class MyDevPointListWidget; class kbdSearchWidget; -class QPushButton; -class QCheckBox; class DevWidget : public KbdWidget { @@ -63,7 +61,6 @@ private: KbdTableModel *pointInstModelByGroup(Common::KbdGroup pointType); KbdTableModel *instDevPointModel(const QString &devTagName,Common::KbdGroup group,const QString &pointAttr); - KbdTableModel *instListDevPointModel(const QStringList &devTagName, Common::KbdGroup group, const QString &pointAttr); void setAccGroupPanel(const QString &ptTagName); void setAnaGroupPanel(const QString &ptTagName); @@ -81,7 +78,6 @@ private: void showTableMode(KbdTreeView *tree); void showDevGroup(const QString &devGroupTagName); void showDev(const QString &devTagName); - void showListDev(const QStringList &devTagNameList); /** * @brief clearFesRelation 根据map_to_Fes的内容,清除新数据中fes表里,原有的关联.主要是为了避免fes表中已关联其他点, @@ -111,7 +107,6 @@ private: Common::KbdGroup fesTableToGroup(const QString &fesTableName); QString getMapToFesTable(const QString &tableName); int getUnitInfoByPointSort(const int point_sort, QString &unit_id, QString &unit_desc); - void getItems(QList& listItem, QStandardItem* item); //左边 @@ -120,7 +115,6 @@ private: QComboBox *m_cbSubSystem; QComboBox * m_cbLocation; QComboBox * m_cbRtu; - kbdSearchWidget* search; //右边 QButtonGroup *m_btGrp; QStackedWidget *m_stackRight; @@ -128,6 +122,7 @@ private: QListWidget *m_listPointInst; //前置关联 KbdDevAndFesWidget *m_devAndFes; + kbdSearchWidget *m_searchText; QTabWidget *m_tabPointDetail; KbdPropertyPanel * m_panelBaseProperty; @@ -139,17 +134,6 @@ private: QTabBar *m_tabbarPointType; QTabBar *m_tabbarPointAttr; kbdtableproperty *m_tableMode; - QComboBox *searchCombox_1; - QComboBox *searchCombox_2; - QComboBox *searchCombox_3; - kbdSearchWidget* tableSearch_1; - kbdSearchWidget* tableSearch_2; - kbdSearchWidget* tableSearch_3; - QStringList comBoxsqlNameList; - QPushButton *m_btnSearch; - QPushButton* Allck; - bool m_bCheckEnable=false; - QStringList devTagNameList; //菜单 QMenu *m_menuInst; @@ -219,10 +203,7 @@ private slots: void onRefreshSameTagPoint(); - void onSearchTableText(const QString &text); - void onSetCheckEnable(bool checked); - void onAllSetCheckEnable(); - void onSearch(); + void onSearchTableText(const QString text); }; #endif // DEVWIDGET_H diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbdaddtempgroupdlg.cpp b/platform/src/tools/model_plugin/DevModelWidget/kbdaddtempgroupdlg.cpp index 87f67da5..01c09c95 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbdaddtempgroupdlg.cpp +++ b/platform/src/tools/model_plugin/DevModelWidget/kbdaddtempgroupdlg.cpp @@ -10,9 +10,9 @@ #include "kbdtabledatamgr.h" #include "../model_common/common.h" #include "kbdcheckrole.h" -#include +#include "pub_widget/MessageBox.h" -KbdAddTempGroupDlg::KbdAddTempGroupDlg(QWidget *parent) : QDialog(parent) +KbdAddTempGroupDlg::KbdAddTempGroupDlg(QWidget *parent) : CustomDialog(parent) { initLayout(); } @@ -154,5 +154,5 @@ void KbdAddTempGroupDlg::onOk() void KbdAddTempGroupDlg::onMsg(const QString &msg) { - QMessageBox::information(this,tr("消息"),msg); + N_MessageBox::information(this,tr("消息"),msg); } diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbdaddtempgroupdlg.h b/platform/src/tools/model_plugin/DevModelWidget/kbdaddtempgroupdlg.h index 6e3be5dd..03f3d21c 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbdaddtempgroupdlg.h +++ b/platform/src/tools/model_plugin/DevModelWidget/kbdaddtempgroupdlg.h @@ -1,12 +1,12 @@ #ifndef KBDADDTEMPGROUPDLG_H #define KBDADDTEMPGROUPDLG_H -#include +#include "pub_widget/CustomDialog.h" class QLineEdit; class QCheckBox; -class KbdAddTempGroupDlg : public QDialog +class KbdAddTempGroupDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbdbatchmodifydevgroup.cpp b/platform/src/tools/model_plugin/DevModelWidget/kbdbatchmodifydevgroup.cpp index a0d88e7b..4c130fe8 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbdbatchmodifydevgroup.cpp +++ b/platform/src/tools/model_plugin/DevModelWidget/kbdbatchmodifydevgroup.cpp @@ -10,7 +10,7 @@ #include #include -kbdBatchModifyDevGroup::kbdBatchModifyDevGroup(QWidget *parent) : QDialog(parent) +kbdBatchModifyDevGroup::kbdBatchModifyDevGroup(QWidget *parent) : CustomDialog(parent) { initLayout(); initData(); @@ -92,9 +92,16 @@ void kbdBatchModifyDevGroup::onRtuChange(int index) QString rtuNo = m_cbRTU->currentData().toString(); QString filter; - if(index != 0) - filter = QString("LOCATION_ID = '%1' and SUB_SYSTEM = '%2' and RTU_NO = '%3'") - .arg(locationId).arg(subsystemId).arg(rtuNo); + if(index != 0)//金仓数据库PostgreSQL语句避免使用RTU_NO = "",修改为RTU_NO = NULL + { + if (rtuNo.isEmpty()) + {filter = QString("LOCATION_ID = '%1' and SUB_SYSTEM = '%2' and RTU_NO is NULL") + .arg(locationId).arg(subsystemId);} + else { + filter = QString("LOCATION_ID = '%1' and SUB_SYSTEM = '%2' and RTU_NO = '%3'") + .arg(locationId).arg(subsystemId).arg(rtuNo); + } + } else filter = QString("LOCATION_ID = '%1' and SUB_SYSTEM = '%2'") .arg(locationId).arg(subsystemId); diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbdbatchmodifydevgroup.h b/platform/src/tools/model_plugin/DevModelWidget/kbdbatchmodifydevgroup.h index 7ad25bc8..7465954e 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbdbatchmodifydevgroup.h +++ b/platform/src/tools/model_plugin/DevModelWidget/kbdbatchmodifydevgroup.h @@ -1,11 +1,12 @@ #ifndef KBDBATCHMODIFYDEVGROUP_H #define KBDBATCHMODIFYDEVGROUP_H -#include +#include "pub_widget/CustomDialog.h" + class KbdTable; class QComboBox; -class kbdBatchModifyDevGroup : public QDialog +class kbdBatchModifyDevGroup : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbdcreatedevbyfes.cpp b/platform/src/tools/model_plugin/DevModelWidget/kbdcreatedevbyfes.cpp index c7372d9f..40328411 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbdcreatedevbyfes.cpp +++ b/platform/src/tools/model_plugin/DevModelWidget/kbdcreatedevbyfes.cpp @@ -4,7 +4,7 @@ #include "kbddbdesign.h" #include "kbdtable.h" #include -#include +#include "pub_widget/MessageBox.h" #include #include #include @@ -150,11 +150,15 @@ QWizardPage *KbdCreateDevByFES::initRegPage() QVBoxLayout *vLayout1 = new QVBoxLayout; QToolBar *bar = new QToolBar(page); m_tableReg = new KbdTable(page,REWRITE_COMMIT); - bar->setIconSize(QSize(24,24)); - bar->addAction(QIcon(":/icons/icons/new.png"),tr("添加记录"),this,SLOT(onAddReg())); - bar->addAction(QIcon(":/icons/icons/delete.png"),tr("删除记录"),m_tableReg,SLOT(onRemoveRowNotCommit())); - bar->addAction(QIcon(":/icons/icons/undo.png"),tr("撤销更改"),m_tableReg,SLOT(onUndo())); - bar->addAction(QIcon(":/icons/icons/save.png"),tr("保存"),this,SLOT(onSaveReg())); + QAction* act = nullptr; + act = bar->addAction(tr("添加记录"),this,SLOT(onAddReg())); + bar->widgetForAction(act)->setObjectName("icon_add"); + act = bar->addAction(tr("删除记录"),m_tableReg,SLOT(onRemoveRowNotCommit())); + bar->widgetForAction(act)->setObjectName("icon_delete"); + act = bar->addAction(tr("撤销更改"),m_tableReg,SLOT(onUndo())); + bar->widgetForAction(act)->setObjectName("icon_undo"); + act = bar->addAction(tr("保存"),this,SLOT(onSaveReg())); + bar->widgetForAction(act)->setObjectName("icon_save"); vLayout1->addWidget(bar); vLayout1->addWidget(m_tableReg); page->setLayout(vLayout1); @@ -623,7 +627,7 @@ void KbdCreateDevByFES::onCompleteCreateDevByFes(const QString &result) void KbdCreateDevByFES::onMsg(const QString &msg) { - QMessageBox::information(this,tr("消息"),msg); + N_MessageBox::information(this,tr("消息"),msg); } diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbddevandfeswidget.cpp b/platform/src/tools/model_plugin/DevModelWidget/kbddevandfeswidget.cpp index ce14ae40..11f4c2c3 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbddevandfeswidget.cpp +++ b/platform/src/tools/model_plugin/DevModelWidget/kbddevandfeswidget.cpp @@ -15,7 +15,7 @@ #include #include #include "kbdtabledatamgr.h" -#include +#include "pub_widget/MessageBox.h" #include "kbddbdesign.h" #include "kbdmsgcontrl.h" #include "worker.h" @@ -1806,7 +1806,7 @@ void KbdDevAndFesWidget::onLinkDev(const QModelIndex &index) void KbdDevAndFesWidget::onMsg(const QString &text) { - QMessageBox::information(this,tr("消息"),text); + N_MessageBox::information(this,tr("消息"),text); } @@ -1814,7 +1814,7 @@ void KbdDevAndFesWidget::onMsg(const QString &text) QStringList MyFesCheckTreeModel::mimeTypes() const { - return QStringList()<<"KbdDomModel/data"<<"MyFesDevListWidget2/data"; + return QStringList()<<"CustomDomModel/data"<<"MyFesDevListWidget2/data"; } bool MyFesCheckTreeModel::canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const @@ -1824,7 +1824,7 @@ bool MyFesCheckTreeModel::canDropMimeData(const QMimeData *data, Qt::DropAction Q_UNUSED(parent); Q_UNUSED(column); - if (data->hasFormat("KbdDomModel/data")) + if (data->hasFormat("CustomDomModel/data")) { return true; } @@ -1846,7 +1846,7 @@ bool MyFesCheckTreeModel::dropMimeData(const QMimeData *data, Qt::DropAction act return true; //直接扔信号 - if(data->hasFormat("KbdDomModel/data")) + if(data->hasFormat("CustomDomModel/data")) { emit sigDropData(parent); return true; @@ -1908,7 +1908,7 @@ void MyAnalogModel::reloadData(const QString &devTagName) QSqlQuery result; if(!KbdTableDataMgr::getInstance()->selectOnly(sql,result)) { - QMessageBox::information(0,tr("消息"),tr("查找模拟量数据出错")); + N_MessageBox::information(0,tr("消息"),tr("查找模拟量数据出错")); return; } @@ -2152,7 +2152,7 @@ void MyDigitalModel::reloadData(const QString &devTagName) QSqlQuery result; if(!KbdTableDataMgr::getInstance()->selectOnly(sql,result)) { - QMessageBox::information(0,tr("消息"),tr("查找数字量数据出错")); + N_MessageBox::information(0,tr("消息"),tr("查找数字量数据出错")); return; } @@ -2264,7 +2264,7 @@ void MyDigitalModel::reloadData(const QString &devTagName) AND fes_digital.TAG_NAME = concat(digital_map_to_fes.RTU_TAG,'.',digital_map_to_fes.DOT_NO2);"); if(!KbdTableDataMgr::getInstance()->selectOnly(sql,result)) { - QMessageBox::information(0,tr("消息"),tr("查找数字量前置分量2出错")); + N_MessageBox::information(0,tr("消息"),tr("查找数字量前置分量2出错")); return; } while(result.next()) @@ -2290,7 +2290,7 @@ void MyDigitalModel::reloadData(const QString &devTagName) AND fes_digital.TAG_NAME = concat(digital_map_to_fes.RTU_TAG,'.',digital_map_to_fes.DOT_NO3);"); if(!KbdTableDataMgr::getInstance()->selectOnly(sql,result)) { - QMessageBox::information(0,tr("消息"),tr("查找数字量前置分量3出错")); + N_MessageBox::information(0,tr("消息"),tr("查找数字量前置分量3出错")); return; } while(result.next()) @@ -2316,7 +2316,7 @@ void MyDigitalModel::reloadData(const QString &devTagName) AND fes_digital.TAG_NAME = concat(digital_map_to_fes.RTU_TAG,'.',digital_map_to_fes.DOT_NO4);"); if(!KbdTableDataMgr::getInstance()->selectOnly(sql,result)) { - QMessageBox::information(0,tr("消息"),tr("查找数字量前置分量4出错")); + N_MessageBox::information(0,tr("消息"),tr("查找数字量前置分量4出错")); return; } while(result.next()) @@ -2342,7 +2342,7 @@ void MyDigitalModel::reloadData(const QString &devTagName) AND fes_digital.TAG_NAME = concat(digital_map_to_fes.RTU_TAG,'.',digital_map_to_fes.DOT_NO5);"); if(!KbdTableDataMgr::getInstance()->selectOnly(sql,result)) { - QMessageBox::information(0,tr("消息"),tr("查找数字量前置分量5出错")); + N_MessageBox::information(0,tr("消息"),tr("查找数字量前置分量5出错")); return; } while(result.next()) @@ -2368,7 +2368,7 @@ void MyDigitalModel::reloadData(const QString &devTagName) AND fes_digital_ctrl.TAG_NAME = concat(digital_control.RTU_TAG,'.',digital_control.OFFSET_NO2);"); if(!KbdTableDataMgr::getInstance()->selectOnly(sql,result)) { - QMessageBox::information(0,tr("消息"),tr("查找数字量输出分量2出错")); + N_MessageBox::information(0,tr("消息"),tr("查找数字量输出分量2出错")); return; } while(result.next()) @@ -2394,7 +2394,7 @@ void MyDigitalModel::reloadData(const QString &devTagName) AND fes_digital_ctrl.TAG_NAME = concat(digital_control.RTU_TAG,'.',digital_control.OFFSET_NO3);"); if(!KbdTableDataMgr::getInstance()->selectOnly(sql,result)) { - QMessageBox::information(0,tr("消息"),tr("查找数字量输出分量3出错")); + N_MessageBox::information(0,tr("消息"),tr("查找数字量输出分量3出错")); return; } while(result.next()) @@ -2420,7 +2420,7 @@ void MyDigitalModel::reloadData(const QString &devTagName) AND fes_digital_ctrl.TAG_NAME = concat(digital_control.RTU_TAG,'.',digital_control.OFFSET_NO4);"); if(!KbdTableDataMgr::getInstance()->selectOnly(sql,result)) { - QMessageBox::information(0,tr("消息"),tr("查找数字量输出分量4出错")); + N_MessageBox::information(0,tr("消息"),tr("查找数字量输出分量4出错")); return; } while(result.next()) @@ -2446,7 +2446,7 @@ void MyDigitalModel::reloadData(const QString &devTagName) AND fes_digital_ctrl.TAG_NAME = concat(digital_control.RTU_TAG,'.',digital_control.OFFSET_NO5);"); if(!KbdTableDataMgr::getInstance()->selectOnly(sql,result)) { - QMessageBox::information(0,tr("消息"),tr("查找数字量输出分量5出错")); + N_MessageBox::information(0,tr("消息"),tr("查找数字量输出分量5出错")); return; } while(result.next()) @@ -2556,7 +2556,7 @@ void MyAccumlModel::reloadData(const QString &devTagName) QSqlQuery result; if(!KbdTableDataMgr::getInstance()->selectOnly(sql,result)) { - QMessageBox::information(0,tr("消息"),tr("查找累积量数据出错")); + N_MessageBox::information(0,tr("消息"),tr("查找累积量数据出错")); return; } @@ -2689,7 +2689,7 @@ void MyMixModel::reloadData(const QString &devTagName) QSqlQuery result; if(!KbdTableDataMgr::getInstance()->selectOnly(sql,result)) { - QMessageBox::information(0,tr("消息"),tr("查找累积量数据出错")); + N_MessageBox::information(0,tr("消息"),tr("查找累积量数据出错")); return; } diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbddevgrouplistdlg.cpp b/platform/src/tools/model_plugin/DevModelWidget/kbddevgrouplistdlg.cpp index f5bab7c8..f9152bf4 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbddevgrouplistdlg.cpp +++ b/platform/src/tools/model_plugin/DevModelWidget/kbddevgrouplistdlg.cpp @@ -1,7 +1,7 @@ #include "kbddevgrouplistdlg.h" #include "kbddbdesign.h" #include "kbdtabledatamgr.h" -#include "QMessageBox" +#include "pub_widget/MessageBox.h" #include #include #include @@ -11,7 +11,7 @@ #include -KbdDevGroupListDlg::KbdDevGroupListDlg(QWidget *parent) : QDialog(parent) +KbdDevGroupListDlg::KbdDevGroupListDlg(QWidget *parent) : CustomDialog(parent) { initLayout(); initData(); @@ -79,7 +79,7 @@ void KbdDevGroupListDlg::initData() void KbdDevGroupListDlg::onMsg(const QString &msg) { - QMessageBox::information(this,tr("消息"),msg); + N_MessageBox::information(this,tr("消息"),msg); } QStringList KbdDevGroupListDlg::getRelateTagPoints() @@ -338,7 +338,7 @@ void KbdDevGroupListDlg::accept() if(KbdTableDataMgr::getInstance()->executeOnly(listSql)) onMsg(tr("更新成功")); - QDialog::accept(); + CustomDialog::accept(); } KbdTableModel *KbdDevGroupListDlg::getRowDatas(const QString &table, const QString filter, QStringList &rowDatas) diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbddevgrouplistdlg.h b/platform/src/tools/model_plugin/DevModelWidget/kbddevgrouplistdlg.h index ab253256..ac99ac03 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbddevgrouplistdlg.h +++ b/platform/src/tools/model_plugin/DevModelWidget/kbddevgrouplistdlg.h @@ -1,12 +1,12 @@ #ifndef KBDDEVGROUPLISTDLG_H #define KBDDEVGROUPLISTDLG_H -#include +#include "pub_widget/CustomDialog.h" class QListWidget; class QComboBox; class KbdTableModel; -class KbdDevGroupListDlg : public QDialog +class KbdDevGroupListDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbddevinfo.cpp b/platform/src/tools/model_plugin/DevModelWidget/kbddevinfo.cpp index 3459c12a..00928813 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbddevinfo.cpp +++ b/platform/src/tools/model_plugin/DevModelWidget/kbddevinfo.cpp @@ -7,7 +7,7 @@ #include "kbddbdesign.h" #include -KbdDevInfo::KbdDevInfo(QWidget *parent) : QDialog(parent) +KbdDevInfo::KbdDevInfo(QWidget *parent) : CustomDialog(parent) { setWindowTitle(tr("设备实例")); initLayout(); diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbddevinfo.h b/platform/src/tools/model_plugin/DevModelWidget/kbddevinfo.h index 5dce9b11..b421b8a8 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbddevinfo.h +++ b/platform/src/tools/model_plugin/DevModelWidget/kbddevinfo.h @@ -1,13 +1,13 @@ #ifndef KBDDEVINFO_H #define KBDDEVINFO_H -#include +#include "pub_widget/CustomDialog.h" class QListWidget; class QLineEdit; class QGroupBox; -class KbdDevInfo : public QDialog +class KbdDevInfo : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbdfesdevdlg.cpp b/platform/src/tools/model_plugin/DevModelWidget/kbdfesdevdlg.cpp index 5521fc2c..f9b759f0 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbdfesdevdlg.cpp +++ b/platform/src/tools/model_plugin/DevModelWidget/kbdfesdevdlg.cpp @@ -8,7 +8,7 @@ #include "../model_common/common.h" #include #include "kbdtabledatamgr.h" -#include +#include "pub_widget/MessageBox.h" #include #include #include @@ -16,7 +16,7 @@ #include KbdFesDevDlg::KbdFesDevDlg(const QString &devTagName, const QString &devDesc, - const QStringList &fesDevTempList, QWidget *parent): QDialog(parent) + const QStringList &fesDevTempList, QWidget *parent): CustomDialog(parent) { m_devTagName = devTagName; m_fesDevTempList.clear(); @@ -43,7 +43,7 @@ void KbdFesDevDlg::closeEvent(QCloseEvent *event) // return; // } - return QDialog::closeEvent(event); + return CustomDialog::closeEvent(event); } void KbdFesDevDlg::initLayout() @@ -206,7 +206,7 @@ void KbdFesDevDlg::onStartTransactionError(const QString&erroStr) void KbdFesDevDlg::onMsg(const QString &info) { - QMessageBox::information(this,tr("消息"),info); + N_MessageBox::information(this,tr("消息"),info); } diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbdfesdevdlg.h b/platform/src/tools/model_plugin/DevModelWidget/kbdfesdevdlg.h index 96d5a2ad..3a585814 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbdfesdevdlg.h +++ b/platform/src/tools/model_plugin/DevModelWidget/kbdfesdevdlg.h @@ -1,14 +1,14 @@ #ifndef KBDFESDEVDLG_H #define KBDFESDEVDLG_H -#include +#include "pub_widget/CustomDialog.h" class KbdFindPointWidget; class QLabel; /** * @brief The KbdFesDevDlg class 前置设备对话框 */ -class KbdFesDevDlg : public QDialog +class KbdFesDevDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbdfesdevtempdlg.cpp b/platform/src/tools/model_plugin/DevModelWidget/kbdfesdevtempdlg.cpp index d9b2f463..ad04f792 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbdfesdevtempdlg.cpp +++ b/platform/src/tools/model_plugin/DevModelWidget/kbdfesdevtempdlg.cpp @@ -2,10 +2,12 @@ #include "ui_kbdfesdevtempdlg.h" KbdFesDevTempDlg::KbdFesDevTempDlg(QWidget *parent) : - QDialog(parent), + CustomUiDialog(parent), ui(new Ui::KbdFesDevTempDlg) { ui->setupUi(this); + + CustomUiDialog::setAutoLayout(true); } KbdFesDevTempDlg::~KbdFesDevTempDlg() diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbdfesdevtempdlg.h b/platform/src/tools/model_plugin/DevModelWidget/kbdfesdevtempdlg.h index d2b2bc9e..29c5ce6b 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbdfesdevtempdlg.h +++ b/platform/src/tools/model_plugin/DevModelWidget/kbdfesdevtempdlg.h @@ -1,7 +1,7 @@ #ifndef KBDFESDEVTEMPDLG_H #define KBDFESDEVTEMPDLG_H -#include +#include "pub_widget/CustomDialog.h" namespace Ui { class KbdFesDevTempDlg; @@ -9,7 +9,7 @@ class KbdFesDevTempDlg; class QListWidget; -class KbdFesDevTempDlg : public QDialog +class KbdFesDevTempDlg : public CustomUiDialog { Q_OBJECT diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbdgeneratefesdlg.cpp b/platform/src/tools/model_plugin/DevModelWidget/kbdgeneratefesdlg.cpp index a97e0a8f..b7d1da59 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbdgeneratefesdlg.cpp +++ b/platform/src/tools/model_plugin/DevModelWidget/kbdgeneratefesdlg.cpp @@ -8,10 +8,11 @@ #include "kbdtabledatamgr.h" #include "../model_common/common.h" #include -#include +#include "pub_widget/MessageBox.h" +#include "pub_widget/CustomDialog.h" KbdGenerateFesDlg::KbdGenerateFesDlg(const QString &subSystem, const QString &devTagName, const QString &devDesc, QWidget *parent) - :QDialog(parent) + :CustomDialog(parent) { m_subSystem = subSystem; m_devTagName = devTagName; @@ -96,5 +97,5 @@ void KbdGenerateFesDlg::onGenerate() void KbdGenerateFesDlg::onMsg(const QString &msg) { - QMessageBox::information(this,tr("消息"),msg); + N_MessageBox::information(this,tr("消息"),msg); } diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbdgeneratefesdlg.h b/platform/src/tools/model_plugin/DevModelWidget/kbdgeneratefesdlg.h index 603530b2..64c9e069 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbdgeneratefesdlg.h +++ b/platform/src/tools/model_plugin/DevModelWidget/kbdgeneratefesdlg.h @@ -1,10 +1,10 @@ #ifndef KBDGENERATEFESDLG_H #define KBDGENERATEFESDLG_H -#include +#include "pub_widget/CustomDialog.h" class KbdPropertyPanel; -class KbdGenerateFesDlg: public QDialog +class KbdGenerateFesDlg: public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbdimportdevgroupdlg.cpp b/platform/src/tools/model_plugin/DevModelWidget/kbdimportdevgroupdlg.cpp index 512513ff..e5da4d27 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbdimportdevgroupdlg.cpp +++ b/platform/src/tools/model_plugin/DevModelWidget/kbdimportdevgroupdlg.cpp @@ -10,11 +10,11 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" #include "kbdwaitprgdlg.h" #include -KbdImportDevGroupDlg::KbdImportDevGroupDlg(QWidget *parent,ParsingDevFile *ParseFile,bool bExport) : QDialog(parent) +KbdImportDevGroupDlg::KbdImportDevGroupDlg(QWidget *parent,ParsingDevFile *ParseFile,bool bExport) : CustomDialog(parent) { m_ParseFile = ParseFile; m_bExport = bExport; @@ -188,16 +188,16 @@ void KbdImportDevGroupDlg::onDownTempFile() QFile::remove(strDstPath); if(srcFile.copy(strDstPath)) - QMessageBox::information(this,tr("消息"),tr("模板下载成功")); + N_MessageBox::information(this,tr("消息"),tr("模板下载成功")); else - QMessageBox::information(this,tr("消息"),tr("模板下载失败")); + N_MessageBox::information(this,tr("消息"),tr("模板下载失败")); } else - QMessageBox::information(this,tr("消息"),tr("模板文件不存在")); + N_MessageBox::information(this,tr("消息"),tr("模板文件不存在")); } void KbdImportDevGroupDlg::onMsg(const QString &text) { - QMessageBox::information(this,tr("消息"),text); + N_MessageBox::information(this,tr("消息"),text); } diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbdimportdevgroupdlg.h b/platform/src/tools/model_plugin/DevModelWidget/kbdimportdevgroupdlg.h index a90b828c..c870df49 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbdimportdevgroupdlg.h +++ b/platform/src/tools/model_plugin/DevModelWidget/kbdimportdevgroupdlg.h @@ -1,14 +1,14 @@ #ifndef KBDIMPORTDEVGROUPDLG_H #define KBDIMPORTDEVGROUPDLG_H -#include +#include "pub_widget/CustomDialog.h" class QComboBox; class QLineEdit; class ParsingDevFile; class QLabel; -class KbdImportDevGroupDlg : public QDialog +class KbdImportDevGroupDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbdpointtypedlg.cpp b/platform/src/tools/model_plugin/DevModelWidget/kbdpointtypedlg.cpp index a14918c6..ffc620ba 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbdpointtypedlg.cpp +++ b/platform/src/tools/model_plugin/DevModelWidget/kbdpointtypedlg.cpp @@ -8,10 +8,10 @@ #include "kbddbdesign.h" #include #include -#include +#include "pub_widget/MessageBox.h" #include "kbdtabledatamgr.h" -KbdPointTypeDlg::KbdPointTypeDlg(const QStringList &poingts, int group,QWidget *parent) : QDialog(parent) +KbdPointTypeDlg::KbdPointTypeDlg(const QStringList &poingts, int group,QWidget *parent) : CustomDialog(parent) { m_points = poingts; m_group = group; @@ -564,5 +564,5 @@ void KbdPointTypeDlg::onOk() void KbdPointTypeDlg::onMsg(const QString &msg) { - QMessageBox::information(this,tr("消息"),msg); + N_MessageBox::information(this,tr("消息"),msg); } diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbdpointtypedlg.h b/platform/src/tools/model_plugin/DevModelWidget/kbdpointtypedlg.h index 7de1eb23..bdeff522 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbdpointtypedlg.h +++ b/platform/src/tools/model_plugin/DevModelWidget/kbdpointtypedlg.h @@ -1,13 +1,14 @@ #ifndef KBDPOINTTYPEDLG_H #define KBDPOINTTYPEDLG_H -#include #include +#include "pub_widget/CustomDialog.h" + class QComboBox; class QLineEdit; class KbdTableModel; -class KbdPointTypeDlg : public QDialog +class KbdPointTypeDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbdrelationfesdlg.cpp b/platform/src/tools/model_plugin/DevModelWidget/kbdrelationfesdlg.cpp index 31e11a7a..dc4d4c8e 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbdrelationfesdlg.cpp +++ b/platform/src/tools/model_plugin/DevModelWidget/kbdrelationfesdlg.cpp @@ -1,7 +1,7 @@ #include "kbdrelationfesdlg.h" #include #include -#include +#include "pub_widget/MessageBox.h" #include #include #include @@ -15,7 +15,7 @@ #include "kbdcontrolmgr.h" #include -KbdRelationFesDlg::KbdRelationFesDlg(QWidget *parent) : QDialog(parent) +KbdRelationFesDlg::KbdRelationFesDlg(QWidget *parent) : CustomDialog(parent) { m_hasComplete = true; @@ -151,12 +151,12 @@ void KbdRelationFesDlg::closeEvent(QCloseEvent *event) { if(!m_hasComplete) { - QMessageBox::information(this,tr("消息"),tr("处理未完成,请等待")); + N_MessageBox::information(this,tr("消息"),tr("处理未完成,请等待")); event->ignore(); return; } - QDialog::closeEvent(event); + CustomDialog::closeEvent(event); } int KbdRelationFesDlg::findTheSameFesDev(const QString &devTagName) @@ -204,7 +204,7 @@ void KbdRelationFesDlg::onComplete(const QString &result) { m_hasComplete = true; m_bar->setVisible(false); - QMessageBox::information(this,tr("消息"),result); + N_MessageBox::information(this,tr("消息"),result); } @@ -260,7 +260,7 @@ void KbdRelationFesDlg::onRelation() QString error = checkTable(); if(!error.isEmpty()) { - QMessageBox::information(this,tr("消息"),error); + N_MessageBox::information(this,tr("消息"),error); return; } diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbdrelationfesdlg.h b/platform/src/tools/model_plugin/DevModelWidget/kbdrelationfesdlg.h index 14be3809..f395e2bf 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbdrelationfesdlg.h +++ b/platform/src/tools/model_plugin/DevModelWidget/kbdrelationfesdlg.h @@ -1,15 +1,15 @@ #ifndef KBDRELATIONFESDLG_H #define KBDRELATIONFESDLG_H -#include #include +#include "pub_widget/CustomDialog.h" class QProgressBar; class QLabel; class QTableView; class QStandardItemModel; -class KbdRelationFesDlg : public QDialog +class KbdRelationFesDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbdtempgroupinstdlg.cpp b/platform/src/tools/model_plugin/DevModelWidget/kbdtempgroupinstdlg.cpp index fb2509a1..ebcf4f47 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbdtempgroupinstdlg.cpp +++ b/platform/src/tools/model_plugin/DevModelWidget/kbdtempgroupinstdlg.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" #include #include "../model_common/common.h" #include "kbdtable.h" @@ -13,7 +13,8 @@ #include "kbdtabledatamgr.h" #include "kbdpropertypanel.h" -KbdTempGroupInstDlg::KbdTempGroupInstDlg(QWidget *parent) : QDialog(parent) + +KbdTempGroupInstDlg::KbdTempGroupInstDlg(QWidget *parent) : CustomDialog(parent) { initLayout(); initData(); @@ -47,8 +48,9 @@ void KbdTempGroupInstDlg::initLayout() QVBoxLayout *vLayout1 = new QVBoxLayout; QToolBar *bar = new QToolBar(this); m_list = new QListWidget(this); - bar->setIconSize(QSize(24,24)); - bar->addAction(QIcon(":/icons/icons/new.png"),tr("添加记录"),this,SLOT(onAddDevGroup())); + QAction* act = nullptr; + act = bar->addAction(tr("添加记录"),this,SLOT(onAddDevGroup())); + bar->widgetForAction(act)->setObjectName("icon_add"); vLayout1->addWidget(bar); vLayout1->addWidget(m_list); box->setLayout(vLayout1); @@ -170,5 +172,5 @@ void KbdTempGroupInstDlg::onCheck() void KbdTempGroupInstDlg::onMsg(const QString &text) { - QMessageBox::information(this,tr("消息"),text); + N_MessageBox::information(this,tr("消息"),text); } diff --git a/platform/src/tools/model_plugin/DevModelWidget/kbdtempgroupinstdlg.h b/platform/src/tools/model_plugin/DevModelWidget/kbdtempgroupinstdlg.h index a0398bca..c4900f5c 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/kbdtempgroupinstdlg.h +++ b/platform/src/tools/model_plugin/DevModelWidget/kbdtempgroupinstdlg.h @@ -1,15 +1,14 @@ #ifndef KBDTEMPGROUPINSTDLG_H #define KBDTEMPGROUPINSTDLG_H -#include #include - +#include "pub_widget/CustomDialog.h" class KbdTable; class QComboBox; class QListWidget; -class KbdTempGroupInstDlg:public QDialog +class KbdTempGroupInstDlg:public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_plugin/DevModelWidget/parsingdevfile.cpp b/platform/src/tools/model_plugin/DevModelWidget/parsingdevfile.cpp index 7556e092..ee76ef51 100644 --- a/platform/src/tools/model_plugin/DevModelWidget/parsingdevfile.cpp +++ b/platform/src/tools/model_plugin/DevModelWidget/parsingdevfile.cpp @@ -3,7 +3,7 @@ #include "kbdtabledatamgr.h" #include "kbddbdesign.h" #include "common_global.h" -#include +#include "pub_widget/MessageBox.h" #include #include diff --git a/platform/src/tools/model_plugin/FESWidget/FESWidget.pro b/platform/src/tools/model_plugin/FESWidget/FESWidget.pro index 4356ede1..0b1bb428 100644 --- a/platform/src/tools/model_plugin/FESWidget/FESWidget.pro +++ b/platform/src/tools/model_plugin/FESWidget/FESWidget.pro @@ -75,10 +75,9 @@ HEADERS += \ kbdfesprotocolwidget.h \ kbdupdatepsc3000dlg.h \ kbddevimportdlg.h \ - kbd61850model.h \ kbdForwardrtudlg.h LIBS += -lmodel_common -llog4cplus -lboost_system -ldb_base_api LIBS += -lmodel_table -lmodel_excel -lpub_logger_api - +LIBS += -lpub_widget diff --git a/platform/src/tools/model_plugin/FESWidget/fescfgpluginwidget.h b/platform/src/tools/model_plugin/FESWidget/fescfgpluginwidget.h index 53c7517e..49d37ec9 100644 --- a/platform/src/tools/model_plugin/FESWidget/fescfgpluginwidget.h +++ b/platform/src/tools/model_plugin/FESWidget/fescfgpluginwidget.h @@ -7,7 +7,7 @@ class FesCfgPluginWidget : public QObject, public CPluginWidgetInterface { Q_OBJECT - Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0") + Q_PLUGIN_METADATA(IID HMI_WidgetPlugin_IID) Q_INTERFACES(CPluginWidgetInterface) public: diff --git a/platform/src/tools/model_plugin/FESWidget/feswidget.cpp b/platform/src/tools/model_plugin/FESWidget/feswidget.cpp index 16653389..dbb6018c 100644 --- a/platform/src/tools/model_plugin/FESWidget/feswidget.cpp +++ b/platform/src/tools/model_plugin/FESWidget/feswidget.cpp @@ -11,7 +11,7 @@ #include "CustomWidget/kbdsqltreemodel.h" #include #include -#include +#include "pub_widget/MessageBox.h" #include "kbdpropertydlg.h" #include "kbdpropertypanel.h" #include @@ -58,6 +58,7 @@ //TN TABLE_NAME缩写 #define TN_FES_CHANNEL_PARA "FES_CHANNEL_PARA" #define TN_FES_DEV_TYPE_DEF "FES_DEV_TYPE_DEF" +#define TN_FES_DEV_INFO "FES_DEV_INFO" #define TN_FES_ACCUML "FES_ACCUML" #define TN_FES_ANALOG "FES_ANALOG" #define TN_FES_DIGITAL "FES_DIGITAL" @@ -94,14 +95,22 @@ void FesWidget::refresh() void FesWidget::initLayout() { + QVBoxLayout *mainLayout = new QVBoxLayout; + QHBoxLayout *hLayout = new QHBoxLayout; QSplitter *hSplitter = new QSplitter(Qt::Horizontal,this); m_tree = new KbdTreeView(hSplitter); m_tree->setHeaderVisible(false); m_treeModel = new KbdSqlTreeModel(Common::getTreePath("fesTree.xml"),this); m_tree->setModel(m_treeModel); + m_tree->setMinimumWidth(200); + m_tree->hide(); //把树隐藏,使用tabbar代替 hSplitter->addWidget(m_tree); + //因为借用了m_treeModel的解析数据,所以tabbar初始化必须放在m_treeModel后面 + m_mainTabBar = initMainTabBar(m_treeModel); + mainLayout->addWidget(m_mainTabBar); + m_stackForTree = new QStackedWidget(hSplitter); initStackWidget(); @@ -112,8 +121,26 @@ void FesWidget::initLayout() hSplitter->addWidget(m_stackForTree); hSplitter->setSizes(QList()<<100<<300); hLayout->addWidget(hSplitter); - this->setLayout(hLayout); + mainLayout->addLayout(hLayout); + this->setLayout(mainLayout); +} + +QTabBar* FesWidget::initMainTabBar(const KbdSqlTreeModel *pModel) +{ + QTabBar *mainTabBar = new QTabBar; + mainTabBar->setObjectName("fesMainTabBar"); + mainTabBar->setExpanding(false); + + for(int i = 0;i < pModel->rowCount();i++) + { + QStandardItem *item = pModel->item(i,0); + + mainTabBar->addTab(item->icon(),item->text()); + mainTabBar->setTabData(i,item->data(Common::ClickRole)); + } + + return mainTabBar; } void FesWidget::initStackWidget() @@ -140,14 +167,19 @@ QWidget *FesWidget::initTotalWidget() QToolBar *bar = new QToolBar(widget); m_tableTotal = new KbdTable(widget); - bar->setIconSize(QSize(24,24)); - bar->addAction(QIcon(":/icons/icons/new.png"),tr("添加记录"),this,SLOT(onAddTotalTableRow())); - bar->addAction(QIcon(":/icons/icons/modify.png"),tr("修改记录"),this,SLOT(onModifyTotalTableRow())); - bar->addAction(QIcon(":/icons/icons/delete.png"),tr("删除记录"),this,SLOT(onRemoveTotalTableRow())) - ->setShortcut(QKeySequence::Delete); + QAction* act = nullptr; + act = bar->addAction(tr("添加记录"),this,SLOT(onAddTotalTableRow())); + bar->widgetForAction(act)->setObjectName("icon_add"); + act = bar->addAction(tr("修改记录"),this,SLOT(onModifyTotalTableRow())); + bar->widgetForAction(act)->setObjectName("icon_edit"); + act = bar->addAction(tr("删除记录"),this,SLOT(onRemoveTotalTableRow())); + act->setShortcut(QKeySequence::Delete); + bar->widgetForAction(act)->setObjectName("icon_delete"); bar->addSeparator(); - bar->addAction(QIcon(":/icons/icons/Excel-export.png"),tr("Excel导出"),m_tableTotal,SLOT(onExcelExport())); - bar->addAction(QIcon(":/icons/icons/Excel-Impor.png"),tr("Excel导入"),m_tableTotal,SLOT(onImportExcel())); + act = bar->addAction(tr("Excel导出"),m_tableTotal,SLOT(onExcelExport())); + bar->widgetForAction(act)->setObjectName("icon_excel_export"); + act = bar->addAction(tr("Excel导入"),m_tableTotal,SLOT(onImportExcel())); + bar->widgetForAction(act)->setObjectName("icon_excel_import"); vLayout->addWidget(bar); vLayout->addWidget(m_tableTotal); @@ -160,8 +192,13 @@ QWidget *FesWidget::initTotalWidget() void FesWidget::initData() { - m_stackForTree->setCurrentIndex(m_stackForTree->count() - 1); +// m_stackForTree->setCurrentIndex(m_stackForTree->count() - 1); + //默认展示第一个tab + m_mainTabBar->setCurrentIndex(0); + onMainTabBarCurrentChanged(0); + connect(m_tree,SIGNAL(clicked(const QModelIndex &)),this,SLOT(onLeftTreeClick(const QModelIndex &))); + connect(m_mainTabBar,SIGNAL(currentChanged(int)),this,SLOT(onMainTabBarCurrentChanged(int))); } @@ -213,6 +250,15 @@ void FesWidget::onAddTotalTableRow() return; KbdPropertyDlg dlg(false, this); + if(model->getTableName() == TN_FES_DEV_TYPE_DEF) + { + dlg.setWindowTitle(tr("新增前置设备类型")); + } + else if(model->getTableName() == TN_FES_DEV_INFO) + { + dlg.setWindowTitle(tr("新增前置设备")); + } + dlg.panel()->setDisplayRow(model,model->rowCount()); if(dlg.exec() == QDialog::Rejected) return; @@ -253,6 +299,14 @@ void FesWidget::onModifyTotalTableRow() return; KbdPropertyDlg dlg(false, this); + if(model->getTableName() == TN_FES_DEV_TYPE_DEF) + { + dlg.setWindowTitle(tr("修改前置设备类型")); + } + else if(model->getTableName() == TN_FES_DEV_INFO) + { + dlg.setWindowTitle(tr("修改前置设备")); + } dlg.panel()->setDisplayRow(model,index.row()); if(dlg.exec() == QDialog::Rejected) @@ -357,10 +411,7 @@ void FesWidget::onRemoveTotalTableRow() KbdMsgContrl::getInstance()->showMsg(tr("删除成功"),this); } - - - - - - - +void FesWidget::onMainTabBarCurrentChanged(int index) +{ + onLeftTreeClick(m_treeModel->index(index,0)); +} diff --git a/platform/src/tools/model_plugin/FESWidget/feswidget.h b/platform/src/tools/model_plugin/FESWidget/feswidget.h index 8ca4425c..76a19c19 100644 --- a/platform/src/tools/model_plugin/FESWidget/feswidget.h +++ b/platform/src/tools/model_plugin/FESWidget/feswidget.h @@ -32,6 +32,7 @@ public: private: void initLayout(); + QTabBar* initMainTabBar(const KbdSqlTreeModel *pModel); void initStackWidget(); QWidget *initTotalWidget();//包括规约,通道,模板类型 void initData(); @@ -46,6 +47,7 @@ private: KbdFesProtocolWidget *m_ProtocolWidget; KbdChanWidget *m_ChanWidget; KbdRtuListWidget *m_RtuListWidget; + QTabBar *m_mainTabBar; private slots: void onLeftTreeClick(const QModelIndex &index); @@ -53,6 +55,7 @@ private slots: void onAddTotalTableRow(); void onModifyTotalTableRow(); void onRemoveTotalTableRow(); + void onMainTabBarCurrentChanged(int index); signals: void sigTreeSelChenge(); diff --git a/platform/src/tools/model_plugin/FESWidget/kbdForwardrtudlg.cpp b/platform/src/tools/model_plugin/FESWidget/kbdForwardrtudlg.cpp index c866bf10..1e94b3a4 100644 --- a/platform/src/tools/model_plugin/FESWidget/kbdForwardrtudlg.cpp +++ b/platform/src/tools/model_plugin/FESWidget/kbdForwardrtudlg.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" #include #include #include @@ -15,7 +15,7 @@ #include "kbdmsgcontrl.h" #include "kbdtabledatamgr.h" -KbdForwardrtuDlg::KbdForwardrtuDlg(QString SrcRtuTagName,QWidget *parent) : QDialog(parent) +KbdForwardrtuDlg::KbdForwardrtuDlg(QString SrcRtuTagName,QWidget *parent) : CustomDialog(parent) { m_SrcRtuTagName = SrcRtuTagName; @@ -52,10 +52,21 @@ void KbdForwardrtuDlg::initView() m_cbRtuForward->setView(new QListView); m_cbRtuForward->setMinimumWidth(200); + //< 固定左侧label长度 + labelForwardLoc->adjustSize(); + labelForwardSub->adjustSize(); + labelForwardRtu->adjustSize(); + QVector labelSize = {labelForwardLoc->width(),labelForwardRtu->width(),labelForwardSub->width()}; + int *pLabelMaxWidth = std::max_element(std::begin(labelSize),std::end(labelSize)); + labelForwardLoc->setMaximumWidth(*pLabelMaxWidth); + labelForwardSub->setMaximumWidth(*pLabelMaxWidth); + labelForwardRtu->setMaximumWidth(*pLabelMaxWidth); + //hLayout = new QHBoxLayout; hLayout->addWidget(labelForwardLoc); hLayout->addWidget(m_combLocFwd); hLayout->addSpacing(5); + vLayout->addStretch(); vLayout->addLayout(hLayout); hLayout = new QHBoxLayout; @@ -70,8 +81,8 @@ void KbdForwardrtuDlg::initView() hLayout->addSpacing(5); vLayout->addLayout(hLayout); - m_workSWdg = new QStackedWidget(this); - vLayout->addWidget(m_workSWdg); +// m_workSWdg = new QStackedWidget(this); +// vLayout->addWidget(m_workSWdg); hLayout = new QHBoxLayout; hLayout->addStretch(); @@ -81,6 +92,7 @@ void KbdForwardrtuDlg::initView() hLayout->addWidget(m_closeBtn); vLayout->addLayout(hLayout); + vLayout->addStretch(); setLayout(vLayout); this->resize(230, 150); @@ -139,6 +151,11 @@ void KbdForwardrtuDlg::initFowdRtu() { QString locationId = m_combLocFwd->currentData().toString(); QString subSystemId = m_combSubFwd->currentData().toString(); + if(locationId.isEmpty() || subSystemId.isEmpty()) + { + return; + } + QStringList list; if(subSystemId=="-1") { @@ -194,7 +211,7 @@ void KbdForwardrtuDlg::slot_onOkCheck() QString rtuTagName = m_cbRtuForward->currentData().toString(); if(rtuTagName == m_SrcRtuTagName) { - QMessageBox::information(this,tr("消息"),"复制目的RTU和源RTU相同,请重新选择!"); + N_MessageBox::information(this,tr("消息"),"复制目的RTU和源RTU相同,请重新选择!"); return; } @@ -225,5 +242,5 @@ void KbdForwardrtuDlg::slot_onCloseCheck() void KbdForwardrtuDlg::onMsg(const QString &text) { - QMessageBox::information(this,tr("消息"),text); + N_MessageBox::information(this,tr("消息"),text); } diff --git a/platform/src/tools/model_plugin/FESWidget/kbdForwardrtudlg.h b/platform/src/tools/model_plugin/FESWidget/kbdForwardrtudlg.h index 12decb10..411cd75e 100644 --- a/platform/src/tools/model_plugin/FESWidget/kbdForwardrtudlg.h +++ b/platform/src/tools/model_plugin/FESWidget/kbdForwardrtudlg.h @@ -1,10 +1,10 @@ #ifndef KBDBATCHDLG_H #define KBDBATCHDLG_H -#include #include #include #include "tablemodule_global.h" +#include "pub_widget/CustomDialog.h" class QLineEdit; class QTextEdit; @@ -12,7 +12,7 @@ class QRadioButton; class QStackedWidget; class QPushButton; class QSpinBox; -class KbdForwardrtuDlg : public QDialog +class KbdForwardrtuDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_plugin/FESWidget/kbdbatchfesdevdlg.cpp b/platform/src/tools/model_plugin/FESWidget/kbdbatchfesdevdlg.cpp index 197c4895..afaaf892 100644 --- a/platform/src/tools/model_plugin/FESWidget/kbdbatchfesdevdlg.cpp +++ b/platform/src/tools/model_plugin/FESWidget/kbdbatchfesdevdlg.cpp @@ -1,7 +1,7 @@ #include "kbdbatchfesdevdlg.h" #include "kbdpropertypanel.h" -#include +#include "pub_widget/MessageBox.h" #include #include #include @@ -18,7 +18,7 @@ #include #include -KbdBatchFesDevDlg::KbdBatchFesDevDlg(QWidget *parent) : QDialog(parent) +KbdBatchFesDevDlg::KbdBatchFesDevDlg(QWidget *parent) : CustomDialog(parent) { setWindowTitle(tr("批量实例化")); initLayout(); @@ -271,5 +271,5 @@ void KbdBatchFesDevDlg::onCheckBatchInst(bool check) void KbdBatchFesDevDlg::onMsg(const QString &msg) { - QMessageBox::information(this,tr("消息"),msg); + N_MessageBox::information(this,tr("消息"),msg); } diff --git a/platform/src/tools/model_plugin/FESWidget/kbdbatchfesdevdlg.h b/platform/src/tools/model_plugin/FESWidget/kbdbatchfesdevdlg.h index b2b7e65a..2e1fe76b 100644 --- a/platform/src/tools/model_plugin/FESWidget/kbdbatchfesdevdlg.h +++ b/platform/src/tools/model_plugin/FESWidget/kbdbatchfesdevdlg.h @@ -1,8 +1,8 @@ #ifndef KBDBATCHFESDEVDLG_H #define KBDBATCHFESDEVDLG_H -#include #include "control.h" +#include "pub_widget/CustomDialog.h" class KbdPropertyPanel; class QGroupBox; @@ -15,7 +15,7 @@ class QProgressBar; /** * @brief The KbdBatchFesDevDlg class 批量实例化对话框 */ -class KbdBatchFesDevDlg : public QDialog +class KbdBatchFesDevDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_plugin/FESWidget/kbdchanwidget.cpp b/platform/src/tools/model_plugin/FESWidget/kbdchanwidget.cpp index 0a79b141..cf771134 100644 --- a/platform/src/tools/model_plugin/FESWidget/kbdchanwidget.cpp +++ b/platform/src/tools/model_plugin/FESWidget/kbdchanwidget.cpp @@ -9,7 +9,7 @@ #include "kbdpropertydlg.h" #include "kbdpropertypanel.h" #include "kbdtableproperty.h" -#include +#include "pub_widget/MessageBox.h" #include #include "kbdmsgcontrl.h" #include @@ -98,8 +98,12 @@ void KbdChanWidget::onAddTable() { KbdTableModel *model = qobject_cast(m_tableProperty->getTable()->model()); if(model == NULL) + { return; + } + KbdPropertyDlg dlg(false, this); + dlg.setWindowTitle(tr("新增通道")); dlg.panel()->setDisplayRow(model,model->rowCount()); dlg.panel()->setPropertyValue(CN_TAG_NAME,"XX"); QModelIndex index = m_tree->currentIndex(); @@ -233,6 +237,7 @@ void KbdChanWidget::onModifyTable() } KbdPropertyDlg dlg(false, this); + dlg.setWindowTitle(tr("修改通道配置")); dlg.panel()->setDisplayRow(model,index.row()); //周工要求主键不能修改,这里的主键由车站,专业和通道名称组成,故也不能修改 dlg.panel()->setPropertyEditable(CN_TAG_NAME,false); @@ -389,7 +394,7 @@ void KbdChanWidget::onCopyTable() return; } - int num = QInputDialog::getInt(this,tr("复制"),tr("复制数量")); + int num = QInputDialog::getInt(this,tr("复制通道"),tr("复制数量"), 0, -2147483647, 2147483647, 1, nullptr, Qt::FramelessWindowHint); if(num <= 0) return; @@ -477,7 +482,7 @@ void KbdChanWidget::onSearch() m_tableProperty->getTable()->setModel(NULL); return; } - QString subSystemId= m_cbSubSystem->currentData().toString();; + QString subSystemId; QStringList list; if(subSystemId=="-1") { diff --git a/platform/src/tools/model_plugin/FESWidget/kbddevimportdlg.cpp b/platform/src/tools/model_plugin/FESWidget/kbddevimportdlg.cpp index b7c6480b..893f82f3 100644 --- a/platform/src/tools/model_plugin/FESWidget/kbddevimportdlg.cpp +++ b/platform/src/tools/model_plugin/FESWidget/kbddevimportdlg.cpp @@ -7,32 +7,28 @@ #include #include #include -#include -#include +#include "pub_widget/MessageBox.h" -kbdDevImportDlg::kbdDevImportDlg(QWidget *parent) : QDialog(parent) +kbdDevImportDlg::kbdDevImportDlg(QWidget *parent) : CustomDialog(parent) { setWindowTitle(tr("导入前置设备")); QVBoxLayout* vLayout = new QVBoxLayout; QHBoxLayout* hLayout = new QHBoxLayout; - m_modelTypeGroupbox= new QGroupBox(tr("模板类型"),this); - m_pcsDev = new QRadioButton(tr("PCS3000设备")); - m_otherDev = new QRadioButton(tr("第三方设备")); - m_pcsDev->setChecked(true); + m_pcsDev = new QRadioButton(tr("PCS3000设备"),this); + m_otherDev = new QRadioButton(tr("第三方设备"),this); + m_otherDev->setChecked(true); + m_pcsDev->hide(); + hLayout->addWidget(m_pcsDev); + hLayout->addWidget(m_otherDev); + hLayout->setMargin(0); - QHBoxLayout* hLayout1 = new QHBoxLayout; - hLayout1->addWidget(m_pcsDev); - hLayout1->addWidget(m_otherDev); - hLayout1->setMargin(10); - m_modelTypeGroupbox->setLayout(hLayout1); - hLayout->addWidget(m_modelTypeGroupbox); + vLayout->addStretch(); vLayout->addLayout(hLayout); vLayout->addSpacing(10); - hLayout = new QHBoxLayout; - QLabel* lable = new QLabel(tr("文件路径:"),this); + QLabel* lable = new QLabel(tr("路径:"),this); m_linePath = new QLineEdit(this); QPushButton* btnOpenFile = new QPushButton(tr("选择文件"),this); hLayout->addWidget(lable); @@ -41,35 +37,17 @@ kbdDevImportDlg::kbdDevImportDlg(QWidget *parent) : QDialog(parent) vLayout->addLayout(hLayout); vLayout->addSpacing(10); - + hLayout = new QHBoxLayout; QPushButton* btnTemp = new QPushButton(tr("下载导入模板"),this); - QPushButton* btnUpdate = new QPushButton(tr("更新设备"),this); - QPushButton* btnOk = new QPushButton(tr("导入设备"),this); - QPushButton* btnAddSub = new QPushButton(tr("增删设备点"),this); - - hLayout = new QHBoxLayout; - hLayout->setMargin(0); - hLayout->addWidget(btnOk); - hLayout->addWidget(btnUpdate); - hLayout->addWidget(btnAddSub); - vLayout->addLayout(hLayout); - - vLayout->addSpacing(20); - QVBoxLayout* vLayoutmpt = new QVBoxLayout; - lable = new QLabel(tr("备注:"),this); - vLayoutmpt->addWidget(lable); - lable = new QLabel(tr("1 导入设备:导入通道设备及点数据,必须是之前未添加设备"),this); - vLayoutmpt->addWidget(lable); - lable = new QLabel(tr("2 更新设备:更新已存在设备点属性信息,不能添加设备及设备点"),this); - vLayoutmpt->addWidget(lable); - lable = new QLabel(tr("3 增删设备点:对已有设备点进行增加或删除,不会修改现有设备点属性"),this); - vLayoutmpt->addWidget(lable); - vLayout->addLayout(vLayoutmpt); - - hLayout = new QHBoxLayout; + QPushButton* btnUpdate = new QPushButton(tr("更新"),this); + QPushButton* btnOk = new QPushButton(tr("导入"),this); hLayout->addWidget(btnTemp); + hLayout->addStretch(); + hLayout->addWidget(btnUpdate); + hLayout->addWidget(btnOk); + hLayout->setMargin(0); vLayout->addLayout(hLayout); - + vLayout->addStretch(); setLayout(vLayout); resize(370,210); @@ -77,7 +55,6 @@ kbdDevImportDlg::kbdDevImportDlg(QWidget *parent) : QDialog(parent) connect(btnTemp,&QPushButton::clicked,this,&kbdDevImportDlg::onDownTempFile); connect(btnOk,&QPushButton::clicked,this,&kbdDevImportDlg::accept); connect(btnUpdate,&QPushButton::clicked,[this](){done(2);}); - connect(btnAddSub,&QPushButton::clicked,[this](){done(3);}); } QString kbdDevImportDlg::getFilePath() @@ -120,10 +97,10 @@ void kbdDevImportDlg::onDownTempFile() QFile::remove(strDstPath); if(srcFile.copy(strDstPath)) - QMessageBox::information(this,tr("消息"),tr("模板下载成功")); + N_MessageBox::information(this,tr("消息"),tr("模板下载成功")); else - QMessageBox::information(this,tr("消息"),tr("模板下载失败")); + N_MessageBox::information(this,tr("消息"),tr("模板下载失败")); } else - QMessageBox::information(this,tr("消息"),tr("模板文件不存在")); + N_MessageBox::information(this,tr("消息"),tr("模板文件不存在")); } diff --git a/platform/src/tools/model_plugin/FESWidget/kbddevimportdlg.h b/platform/src/tools/model_plugin/FESWidget/kbddevimportdlg.h index d1d438b9..147f64e3 100644 --- a/platform/src/tools/model_plugin/FESWidget/kbddevimportdlg.h +++ b/platform/src/tools/model_plugin/FESWidget/kbddevimportdlg.h @@ -1,13 +1,12 @@ #ifndef KBDDEVIMPORTDLG_H #define KBDDEVIMPORTDLG_H -#include -#include +#include "pub_widget/CustomDialog.h" class QRadioButton; class QLineEdit; -class kbdDevImportDlg : public QDialog +class kbdDevImportDlg : public CustomDialog { Q_OBJECT public: @@ -24,7 +23,6 @@ private: QRadioButton* m_pcsDev; QRadioButton* m_otherDev; QLineEdit* m_linePath; - QGroupBox* m_modelTypeGroupbox; }; #endif // KBDDEVIMPORTDLG_H diff --git a/platform/src/tools/model_plugin/FESWidget/kbdfesdevwidget.cpp b/platform/src/tools/model_plugin/FESWidget/kbdfesdevwidget.cpp index f399bab3..f9cdfc9e 100644 --- a/platform/src/tools/model_plugin/FESWidget/kbdfesdevwidget.cpp +++ b/platform/src/tools/model_plugin/FESWidget/kbdfesdevwidget.cpp @@ -9,7 +9,7 @@ #include "kbdtable.h" #include "kbdtabledatamgr.h" #include "kbddbdesign.h" -#include +#include "pub_widget/MessageBox.h" #include "kbdbatchfesdevdlg.h" #include "kbdpropertydlg.h" #include "kbdpropertypanel.h" @@ -308,17 +308,17 @@ void KbdFesDevWidget::onMenuRefresh(int row, int column, int menuType, const QSt void KbdFesDevWidget::onStartTransactionError(const QString&erroStr) { - QMessageBox::information(this,tr("消息"),erroStr); + N_MessageBox::information(this,tr("消息"),erroStr); } void KbdFesDevWidget::onCommitError() { - QMessageBox::information(this,tr("消息"),tr("此次修改失败,已启动回滚!")); + N_MessageBox::information(this,tr("消息"),tr("此次修改失败,已启动回滚!")); } void KbdFesDevWidget::onMsg(const QString &text) { - QMessageBox::information(this,tr("消息"),text); + N_MessageBox::information(this,tr("消息"),text); } void KbdFesDevWidget::onNeedRefresh() diff --git a/platform/src/tools/model_plugin/FESWidget/kbdfespointwidget.cpp b/platform/src/tools/model_plugin/FESWidget/kbdfespointwidget.cpp index 98b86ad9..836976b4 100644 --- a/platform/src/tools/model_plugin/FESWidget/kbdfespointwidget.cpp +++ b/platform/src/tools/model_plugin/FESWidget/kbdfespointwidget.cpp @@ -8,7 +8,7 @@ #include #include "kbdtable.h" #include "kbdtabledatamgr.h" -#include +#include "pub_widget/MessageBox.h" #include #include "kbdpage.h" #include "kbddbdesign.h" @@ -28,7 +28,6 @@ #include "CustomWidget/kbdsearchwidget.h" #include "kbdupdatepsc3000dlg.h" #include "kbddevimportdlg.h" -#include //TN TABLE_NAME缩写 #define TN_FES_ACCUML "FES_ACCUML" @@ -79,20 +78,22 @@ QLayout* KbdFesPointWidget::initLeftDevLayout() m_TreeFesDev = new KbdTreeView(this); m_TreeFesDev->setMousePressEvent(false); QToolBar *bar = new QToolBar(this); - m_editSearch = new kbdSearchWidget(this); - m_editSearch->setPlaceholderText(tr("请输入位置或设备描述关键字")); - connect(m_editSearch,&kbdSearchWidget::sigSearch,m_TreeFesDev,&KbdTreeView::onSearchItemText); + kbdSearchWidget* search = new kbdSearchWidget(this); + search->setPlaceholderText(tr("请输入位置或设备描述关键字")); + connect(search,&kbdSearchWidget::sigSearch,m_TreeFesDev,&KbdTreeView::onSearchItemText); bar->setIconSize(QSize(24,24)); - bar->addAction(QIcon(":/icons/icons/new.png"),tr("添加设备"),this,SLOT(onAddDevByNoTemp())); + QAction* act = bar->addAction(tr("添加设备"),this,SLOT(onAddDevByNoTemp())); + bar->widgetForAction(act)->setObjectName("icon_add"); + grid->addWidget(bar,1,0,1,4); - grid->addWidget(m_editSearch,1,1,1,3); + grid->addWidget(search,1,1,1,3); m_TreeFesDev->setSelectionMode(QAbstractItemView::ExtendedSelection); m_modelFesDev = new KbdDomModel(Common::getTreePath("fesDevTreeAll.xml"),this); m_TreeFesDev->setModel(m_modelFesDev); grid->addWidget(m_TreeFesDev,3,0,1,4); - QCheckBox* ck = new QCheckBox(tr("多选"), this); + QCheckBox* ck = new QCheckBox(tr("多选"), this); m_btnSearch = new QPushButton(tr("查询"),this); m_btnSearch->setVisible(false); m_btnSearch->setMaximumWidth(60); @@ -111,49 +112,32 @@ QLayout *KbdFesPointWidget::initRightPointLayout() QGroupBox *box = new QGroupBox(tr("前置测点"),this); m_tabFesPoint = new QTabBar(box); m_pageTable = new KbdPage(box); - searchCombox_1=new QComboBox(this); - searchCombox_2=new QComboBox(this); - searchCombox_3=new QComboBox(this); - searchCombox_1->setView(new QListView); - searchCombox_2->setView(new QListView); - searchCombox_3->setView(new QListView); - tableSearch_1 = new kbdSearchWidget(this); - tableSearch_1->setMaximumWidth(350); - tableSearch_1->setPlaceholderText(tr("请输入")); - connect(tableSearch_1,&kbdSearchWidget::sigSearch,this,&KbdFesPointWidget::onSearch_1_tableText); + m_tableSearch = new kbdSearchWidget(this); + m_tableSearch->setMaximumWidth(350); + m_tableSearch->setPlaceholderText(tr("请输入标签或描述")); + connect(m_tableSearch,&kbdSearchWidget::sigSearch,this,&KbdFesPointWidget::onSearchTableText); - tableSearch_2 = new kbdSearchWidget(this); - tableSearch_2->setMaximumWidth(350); - tableSearch_2->setPlaceholderText(tr("请输入")); - connect(tableSearch_2,&kbdSearchWidget::sigSearch,this,&KbdFesPointWidget::onSearch_2_tableText); - - tableSearch_3 = new kbdSearchWidget(this); - tableSearch_3->setMaximumWidth(350); - tableSearch_3->setPlaceholderText(tr("请输入")); - connect(tableSearch_3,&kbdSearchWidget::sigSearch,this,&KbdFesPointWidget::onSearch_3_tableText); - - connect(searchCombox_1,&QComboBox::currentTextChanged,this,&KbdFesPointWidget::onSearchTableText); - connect(searchCombox_2,&QComboBox::currentTextChanged,this,&KbdFesPointWidget::onSearchTableText); - connect(searchCombox_3,&QComboBox::currentTextChanged,this,&KbdFesPointWidget::onSearchTableText); QToolBar * bar = new QToolBar(this); - bar->setIconSize(QSize(24,24)); - bar->addAction(QIcon(":/icons/icons/new.png"),tr("添加记录"),this,SLOT(onAddFesPoint())); - bar->addAction(QIcon(":/icons/icons/modify.png"),tr("修改记录"),this,SLOT(onModifyFesPoint())); - bar->addAction(QIcon(":/icons/icons/copy.png"),tr("复制记录"),this,SLOT(onCopyFesPoint())); - bar->addAction(QIcon(":/icons/icons/delete.png"),tr("删除记录"),this,SLOT(onRemoveFesPoint())); + QAction* act = nullptr; + act = bar->addAction(tr("添加记录"),this,SLOT(onAddFesPoint())); + bar->widgetForAction(act)->setObjectName("icon_add"); + act = bar->addAction(tr("修改记录"),this,SLOT(onModifyFesPoint())); + bar->widgetForAction(act)->setObjectName("icon_edit"); + m_copyAction=new QAction(tr("复制记录"),this); + bar->addAction(m_copyAction); + bar->widgetForAction(m_copyAction)->setObjectName("icon_copy"); + + act = bar->addAction(tr("删除记录"),this,SLOT(onRemoveFesPoint())); + bar->widgetForAction(act)->setObjectName("icon_delete"); bar->addSeparator(); - bar->addAction(QIcon(":/icons/icons/Excel-export.png"),tr("Excel导出"),m_pageTable,SLOT(onExcelExport())); - bar->addAction(QIcon(":/icons/icons/Excel-Impor.png"),tr("Excel导入"),m_pageTable,SLOT(onImportExcel())); - bar->addAction(QIcon(":/icons/icons/ID.png"),tr("按照设备ID重排规约参数1"),this,SLOT(onSortRes1())); + act = bar->addAction(tr("Excel导出"),m_pageTable,SLOT(onExcelExport())); + bar->widgetForAction(act)->setObjectName("icon_excel_export"); + act = bar->addAction(tr("Excel导入"),m_pageTable,SLOT(onImportExcel())); + bar->widgetForAction(act)->setObjectName("icon_excel_import"); + act = bar->addAction(tr("按照设备ID重排规约参数1"),this,SLOT(onSortRes1())); + bar->widgetForAction(act)->setObjectName("icon_sort_id"); bar->addSeparator(); - bar->addWidget(searchCombox_1); - bar->addWidget(tableSearch_1); - bar->addSeparator(); - bar->addWidget(searchCombox_2); - bar->addWidget(tableSearch_2); - bar->addSeparator(); - bar->addWidget(searchCombox_3); - bar->addWidget(tableSearch_3); + bar->addWidget(m_tableSearch); QVBoxLayout *vLayoutBox = new QVBoxLayout; m_tabFesPoint->setExpanding(false); @@ -244,7 +228,7 @@ void KbdFesPointWidget::initData() void KbdFesPointWidget::initConnet() { - //connect(m_copyAction,SIGNAL(triggered(bool)),this,SLOT(onCopyFesPoint())); + connect(m_copyAction,SIGNAL(triggered(bool)),this,SLOT(onCopyFesPoint())); connect(m_cbSubSystem,SIGNAL(currentIndexChanged(int)),this,SLOT(onLocationAndSubSysTemChange())); connect(m_TreeFesDev,SIGNAL(clicked(const QModelIndex &)),this,SLOT(onFesDevClicked())); @@ -254,7 +238,6 @@ void KbdFesPointWidget::initConnet() connect(m_pageTable->table(),SIGNAL(doubleClicked(const QModelIndex &)),this,SLOT(onModifyFesPoint())); connect(m_pageTable->table(),SIGNAL(beforeMenuExecute(int,int,int,const QString &)), this,SLOT(onBeforeMenuExecute(int,int,int,const QString &))); - connect(m_pageTable,SIGNAL(currentPageChange()),this,SLOT(onCurrentPageChange())); connect(m_btnSearch, &QPushButton::clicked, this, &KbdFesPointWidget::onSearch); } @@ -378,7 +361,6 @@ void KbdFesPointWidget::onLocationAndSubSysTemChange() { m_pageTable->initState(); onChangeShowType(); - m_TreeFesDev->onSearchItemText(m_editSearch->text()); } @@ -392,74 +374,38 @@ void KbdFesPointWidget::onFesDevClicked() void KbdFesPointWidget::onTabBarChange(int index) { - if (m_bCheckEnable) - { - onSearch(); - return; - } + if (m_bCheckEnable) + { + onSearch(); + onSearchTableText(m_tableSearch->text()); + return; + } - QString whereSql, countSql; - QStringList whereArgs; - getWhereSql(whereSql, whereArgs); - QString tableXml = getTableXml(m_tabFesPoint->tabText(m_tabFesPoint->currentIndex())); - countSql = "SELECT count(*) FROM "+ getTableName(m_tabFesPoint->tabText(index)) + " WHERE " + whereSql; + QString whereSql, countSql; + QStringList whereArgs; + getWhereSql(whereSql, whereArgs); + QString tableXml = getTableXml(m_tabFesPoint->tabText(index)); + countSql = "SELECT count(*) FROM "+ getTableName(m_tabFesPoint->tabText(index)) + " WHERE " + whereSql; - if (tableXml == TBL_FES_ACCUML || + if (tableXml == TBL_FES_ACCUML || tableXml == TBL_FES_ANALOG || tableXml == TBL_FES_DIGITAL || tableXml == TBL_FES_MIX || tableXml == TBL_FES_ANALOG_CTRL || tableXml == TBL_FES_DIGITAL_CTRL || tableXml == TBL_FES_MIX_CTRL || - tableXml == TBL_FES_CONST ) + tableXml == TBL_FES_CONST) { - if(!whereSql.isEmpty()){ + //m_copyAction->setVisible(true); + if(!whereSql.isEmpty()) whereSql = whereSql + " ORDER BY RES_PARA_INT1 "; - } - } - - searchCombox_1->clear(); - searchCombox_2->clear(); - searchCombox_3->clear(); - m_listComBoxsqlName.clear(); - TableFrom from; - ColMgrDataList cols; - ColMgrDataList::readSetting(Common::getTablePath(tableXml),cols,from); - QStringList comBoxDescList=cols.getDescList(); - QStringList currentComBoxsqlNameList=cols.getSqlName(); - QStringList mustComBoxDescList; - for(int i=0;iaddItems(mustComBoxDescList); - searchCombox_2->addItems(mustComBoxDescList); - searchCombox_3->addItems(mustComBoxDescList); - QFontMetrics fm(this->font()); - int max_len=0; - for(int i=0;icount();i++) - { - QRect rect=fm.boundingRect(searchCombox_1->itemText(i)); - if(max_lenview()->setFixedWidth(max_len); - searchCombox_3->view()->setFixedWidth(max_len); - searchCombox_2->view()->setFixedWidth(max_len); - tableSearch_1->clear(); - tableSearch_2->clear(); - tableSearch_3->clear(); - + } + //else + //{ + // m_copyAction->setVisible(false);//如果是数据块则隐藏 + //} m_pageTable->setTable(tableXml, whereSql, whereArgs, countSql, whereArgs); - - return; + onSearchTableText(m_tableSearch->text()); } void KbdFesPointWidget::getWhereSql(QString& whereSql, QStringList& whereArgs) @@ -521,15 +467,17 @@ void KbdFesPointWidget::getWhereSqlByCheck(QList listItem, QStri QStringList listSql; QString sql; QString subSystemId = m_cbSubSystem->currentData().toString(); - QStringList list; + QStringList list; if(subSystemId == "-1") { for(int i = 0; i < m_cbSubSystem->count(); i++) { list << "'" + m_cbSubSystem->itemData(i).toString() + "'"; } + subSystemId = list.join(","); + } else { @@ -590,6 +538,7 @@ void KbdFesPointWidget::onAddDevByNoTemp() } KbdPropertyDlg dlg(false, this); + dlg.setWindowTitle(tr("新增前置设备")); dlg.panel()->setDisplayRow(model,model->rowCount()); dlg.panel()->setPropertyValue(CN_TAG_NAME,rtuTag); //后面修改 dlg.panel()->setPropertyValue(CN_LOCATION_ID,locationId); @@ -654,6 +603,7 @@ void KbdFesPointWidget::onModifyDev() if(retStr.isEmpty()) { KbdPropertyDlg dlg(false, this); + dlg.setWindowTitle(tr("修改前置设备")); dlg.panel()->setDisplayRow(modelFesDev,0); if(dlg.exec()) @@ -747,7 +697,7 @@ void KbdFesPointWidget::onRemoveDev() else note = tr("当前选中包含场站或RTU,是否删除其下全部前置设备?"); - if (QMessageBox::No == QMessageBox::information(this, tr("消息"), note, QMessageBox::Yes, QMessageBox::No)) + if (N_MessageBox::No == N_MessageBox::information(this, tr("消息"), note, N_MessageBox::Yes, N_MessageBox::No)) return; bool success = false; @@ -786,7 +736,6 @@ void KbdFesPointWidget::onRemoveDev() void KbdFesPointWidget::onImportDataFromPsc3000() { - QModelIndex index = m_TreeFesDev->currentIndex(); if (index.data(Common::ClickRole).toString() != "RTU") { @@ -798,53 +747,32 @@ void KbdFesPointWidget::onImportDataFromPsc3000() int nRtn = devImportDlg.exec(); QString csvFile = devImportDlg.getFilePath(); - if(csvFile.isEmpty()) return; if(nRtn == 0) return; - if(nRtn == 2 || nRtn == 3) + if(nRtn == 2) { - - updateDataFromPsc3000(csvFile,nRtn); + updateDataFromPsc3000(csvFile); return; } - - KbdPsc3000Dlg dlg(index.data(Common::IDRole).toString()); QString errMsg; - //每次导入,先清空该文件夹下的文件 - QDir dir(Common::getStylePath()+"../fileLogic"); - if(!dir.exists()) - { - dir.mkdir(Common::getStylePath()+"../fileLogic"); - } - else - { - QFileInfoList infoList = dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot); - for(int i = 0 ; i < infoList.size() ; i++) - { - if(infoList.at(i).fileName().compare("configcheck.xml" , Qt::CaseInsensitive) == 0) - { - continue; - } - else - { - infoList.at(i).dir().remove(infoList.at(i).fileName()); - } - } - } if (csvFile.endsWith(".xlsx")) { + QDir dir(Common::getStylePath()+"../fileLogic"); + if(!dir.exists()) + { + dir.mkdir(Common::getStylePath()+"../fileLogic"); + } QString strDstPath = Common::getStylePath()+"../fileLogic/fesImportPsc3000.xlsx"; if(QFile::exists(strDstPath)) QFile::remove(strDstPath); - QFile srcFile(csvFile); if(!srcFile.copy(strDstPath)) { @@ -855,9 +783,7 @@ void KbdFesPointWidget::onImportDataFromPsc3000() errMsg = dlg.openPsc3000XlsxFile(strDstPath); } else - { - errMsg = dlg.openPsc3000File(csvFile); - } + errMsg = dlg.openPsc3000File(csvFile); if(!errMsg.isEmpty()) { @@ -868,44 +794,28 @@ void KbdFesPointWidget::onImportDataFromPsc3000() onRefreshDev(); } -void KbdFesPointWidget::updateDataFromPsc3000(QString csvFile,int menuType) +void KbdFesPointWidget::updateDataFromPsc3000(QString csvFile) { QModelIndex index = m_TreeFesDev->currentIndex(); - KbdUpdatePsc3000Dlg dlg(index.data(Common::IDRole).toString(),menuType); + KbdUpdatePsc3000Dlg dlg(index.data(Common::IDRole).toString()); QString errMsg = dlg.openPsc3000File(csvFile); if(!errMsg.isEmpty()) { onMsg(errMsg); return; } - dlg.exec(); onRefreshDev(); } void KbdFesPointWidget::onRefreshDev() { - QString strCurrentText = m_cbSubSystem->currentText(); m_cbSubSystem->clear(); KbdDbDesign ds; QString sql; sql = "SELECT * FROM SYS_MODEL_SUB_SYSTEM_INFO WHERE SUB_SYSTEM_ID not in (1,2,3);"; ds.getSqlInfoToCombobox(sql, CN_DESC, CN_SUB_SYSTEM_ID, m_cbSubSystem); - m_cbSubSystem->insertItem(0,tr("所有"),"-1");//刷新时所有消失 - bool isFind = false; - for(int i = 0 ; i < m_cbSubSystem->count() ; i++) - { - if(m_cbSubSystem->itemText(i) == strCurrentText) - { - m_cbSubSystem->setCurrentIndex(i); - isFind = true; - break; - } - } - if(!isFind) - { - m_cbSubSystem->setCurrentIndex(0); - } + } void KbdFesPointWidget::onAddFesPoint() @@ -1000,6 +910,7 @@ void KbdFesPointWidget::onAddFesPoint() if(retStr.isEmpty()) { KbdPropertyDlg dlg(false, this); + dlg.setWindowTitle(tr("新增") + getTabDesc(model->getTableName())); const ColMgrDataList& modelCols = model->getHeadCols(); dlg.panel()->setDisplayRow(model,model->rowCount()); dlg.panel()->setPropertyValue(CN_LOCATION_ID,locationId); @@ -1056,6 +967,7 @@ void KbdFesPointWidget::onAddDataBlock(QString devTag, QString rtuTag) if(retStr.isEmpty()) { KbdPropertyDlg dlg(false, this); + dlg.setWindowTitle(tr("新增数据块")); dlg.panel()->setDisplayRow(model,model->rowCount()); dlg.panel()->setDotStringPrefix(CN_TAG_NAME,devTag); dlg.panel()->setPropertyValue(CN_LOCATION_ID,locationId); @@ -1130,6 +1042,7 @@ void KbdFesPointWidget::onAddFesConst(QString devTag, QString rtuTag) if(retStr.isEmpty()) { KbdPropertyDlg dlg(false, this); + dlg.setWindowTitle(tr("新增保护定值")); dlg.panel()->setDisplayRow(model,model->rowCount()); dlg.panel()->setPropertyValue(CN_LOCATION_ID,locationId); dlg.panel()->setPropertyValue(CN_SUB_SYSTEM,subsystemId); @@ -1190,6 +1103,7 @@ void KbdFesPointWidget::onModifyFesPoint() if(retStr.isEmpty()) { KbdPropertyDlg dlg(false, this); + dlg.setWindowTitle(tr("修改") + getTabDesc(model->getTableName())); dlg.panel()->setDisplayRow(model,index.row()); //周工:主键不允许修改 //dlg.panel()->setPropertyEditable(CN_DOT_NO,false);//移到配置文件处理 @@ -1216,6 +1130,8 @@ void KbdFesPointWidget::onModifyFesPoint() void KbdFesPointWidget::onCopyFesPoint() { + + QModelIndex index = m_pageTable->table()->currentIndex(); if(!index.isValid()) return; @@ -1242,13 +1158,13 @@ void KbdFesPointWidget::onCopyFesPoint() QString tagPrefix = Common::getBeforeLastDot(rowDatas.at(colTagName)); QString desc = rowDatas.at(colDesc); + KbdDbDesign ds; bool isNull; - int maxResPara1 = 0; int maxDotNo = 0; int maxSeqNo = 0; - if(sTableName != TN_FES_DATA_BLOCK) + if(sTableName!= TN_FES_DATA_BLOCK) { if(!ds.getMax("SELECT max(RES_PARA_INT1) FROM " + sTableName + ";",maxResPara1,isNull)) { @@ -1262,6 +1178,7 @@ void KbdFesPointWidget::onCopyFesPoint() return; } + if(!ds.getMax("SELECT max(SEQ_NO) FROM " + sTableName + ";",maxSeqNo,isNull)) { onMsg(tr("获取最大设备点序号不成功!")); @@ -1272,21 +1189,24 @@ void KbdFesPointWidget::onCopyFesPoint() { if(!ds.getMax("SELECT max(BLOCK_ID) FROM " + sTableName + ";",maxSeqNo,isNull)) { - onMsg(tr("获取最大数据块ID(序号)不成功!")); + onMsg(tr("获取最大数据块不成功!")); return; } } + bool success = false; QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); if(retStr.isEmpty()) { + for(int i = 0; i < num; i++ ) { rowDatas.replace(colDesc,desc+QString::number(i+1)); - if(sTableName != TN_FES_DATA_BLOCK) + if(sTableName!= TN_FES_DATA_BLOCK) { rowDatas.replace(colTagName,tagPrefix+"." + QString::number(maxDotNo + i + 1)); + rowDatas.replace(colResPara1,QString::number(maxResPara1 + 1 + i)); rowDatas.replace(colDotNo,QString::number(maxDotNo + 1 + i)); rowDatas.replace(colSeqNo,QString::number(maxSeqNo + 1 + i)); @@ -1316,19 +1236,20 @@ void KbdFesPointWidget::onCopyFesPoint() int colNum = modelCols.findCol(CN_BLOCK_ID); if(colNum > 0) rowDatas.replace(colNum,QString::number(maxSeqNo + 1 + i)); - rowDatas.replace(colTagName,tagPrefix+".block-Copy" + QString::number(maxSeqNo + i + 1)); + + rowDatas.replace(colTagName,tagPrefix+".block_copy" + QString::number(maxSeqNo+i + 1)); } success = model->addRow(rowDatas,true); if(!success) break; } + if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) onCommitError(); } - else{ + else onStartTransactionError(retStr); - } if(!success) { @@ -1354,6 +1275,7 @@ void KbdFesPointWidget::onModifyDataBlock() if(retStr.isEmpty()) { KbdPropertyDlg dlg(false, this); + dlg.setWindowTitle(tr("修改数据块")); dlg.panel()->setDisplayRow(model,index.row()); dlg.panel()->setPropertyEditable(CN_BLOCK_ID,true); dlg.panel()->setPropertyEditable(CN_FUNC_CODE,true); @@ -1382,7 +1304,7 @@ void KbdFesPointWidget::onModifyDataBlock() void KbdFesPointWidget::onRemoveFesPoint() { - if(QMessageBox::No == QMessageBox::information(this,tr("消息"),tr("是否删除前置测点?"),QMessageBox::Yes,QMessageBox::No)) + if(N_MessageBox::No == N_MessageBox::information(this,tr("消息"),tr("是否删除前置测点?"),N_MessageBox::Yes,N_MessageBox::No)) return; QString tabText = m_tabFesPoint->tabText(m_tabFesPoint->currentIndex()); if(getTableName(tabText) == TN_FES_DATA_BLOCK) @@ -1487,17 +1409,17 @@ void KbdFesPointWidget::onBeforeMenuExecute(int row, int column, int menuType, c void KbdFesPointWidget::onStartTransactionError(const QString&erroStr) { - QMessageBox::information(this,tr("消息"),erroStr); + N_MessageBox::information(this,tr("消息"),erroStr); } void KbdFesPointWidget::onCommitError() { - QMessageBox::information(this,tr("消息"),tr("此次修改失败,已启动回滚!")); + N_MessageBox::information(this,tr("消息"),tr("此次修改失败,已启动回滚!")); } void KbdFesPointWidget::onMsg(const QString &text) { - QMessageBox::information(this,tr("消息"),text); + N_MessageBox::information(this,tr("消息"),text); } void KbdFesPointWidget::onDeleteShortcut() @@ -1519,7 +1441,7 @@ void KbdFesPointWidget::onSortRes1() QString rtutag = index.data(Common::IDRole).toString(); - if(QMessageBox::No == QMessageBox::information(this,tr("消息"),tr("是否排序?"),QMessageBox::Yes,QMessageBox::No)) + if(N_MessageBox::No == N_MessageBox::information(this,tr("消息"),tr("是否排序?"),N_MessageBox::Yes,N_MessageBox::No)) return ; bool success = false; @@ -1600,55 +1522,12 @@ void KbdFesPointWidget::onSearch() tableXml == TBL_FES_ANALOG_CTRL || tableXml == TBL_FES_DIGITAL_CTRL || tableXml == TBL_FES_MIX_CTRL || - tableXml == TBL_FES_CONST ) + tableXml == TBL_FES_CONST) { if (!whereSql.isEmpty()) whereSql = whereSql + " ORDER BY RES_PARA_INT1 "; } - m_pageTable->setTable(tableXml, whereSql, whereArgs, countSql, whereArgs); - - searchCombox_1->clear(); - searchCombox_2->clear(); - searchCombox_3->clear(); - m_listComBoxsqlName.clear(); - TableFrom from; - ColMgrDataList cols; - ColMgrDataList::readSetting(Common::getTablePath(tableXml),cols,from); - QStringList comBoxDescList=cols.getDescList(); - QStringList currentComBoxsqlNameList=cols.getSqlName(); - QStringList mustComBoxDescList; - for(int i=0;iaddItems(mustComBoxDescList); - searchCombox_2->addItems(mustComBoxDescList); - searchCombox_3->addItems(mustComBoxDescList); - - QFontMetrics fm(this->font()); - int max_len=0; - for(int i=0;icount();i++) - { - QRect rect=fm.boundingRect(searchCombox_1->itemText(i)); - if(max_lenview()->setFixedWidth(max_len); - searchCombox_3->view()->setFixedWidth(max_len); - searchCombox_2->view()->setFixedWidth(max_len); - - tableSearch_1->clear(); - tableSearch_2->clear(); - tableSearch_3->clear(); + m_pageTable->setTable(tableXml, whereSql, whereArgs, countSql, whereArgs); } void KbdFesPointWidget::getItems(QList& listItem, QStandardItem* item) @@ -1681,13 +1560,15 @@ void KbdFesPointWidget::onChangeShowType() { list << "'" + m_cbSubSystem->itemData(i).toString() + "'"; } + subSystemId = list.join(","); + } else { subSystemId = "'" + m_cbSubSystem->currentData().toString() + "'"; } - if(subSystemId.isEmpty()) + if(subSystemId.isEmpty() || subSystemId == "''") //caodingfa:kingbase不支持 in('')为空的情况 return; if(m_bShowDev && !m_bShowRTU && !m_bShowLocation) @@ -1731,163 +1612,6 @@ void KbdFesPointWidget::onChangeShowType() void KbdFesPointWidget::onSearchTableText(const QString &text) { - if(searchCombox_1->count()==0||searchCombox_2->count()==0||searchCombox_3->count()==0) - return; - - int index_1=searchCombox_1->currentIndex(); - int index_2=searchCombox_2->currentIndex(); - int index_3=searchCombox_3->currentIndex(); - if(!m_bCheckEnable) - { - QString whereSql, countSql; - QStringList whereArgs; - QString text1,text2,text3; - getWhereSql(whereSql, whereArgs); - - QString tableXml = getTableXml(m_tabFesPoint->tabText(m_tabFesPoint->currentIndex())); - if(tableSearch_1->text()=="1"||tableSearch_1->text()=="2") - { - text1=tableSearch_1->text(); - } - else - { - text1=tableSearch_1->text(); - } - if(tableSearch_2->text()=="1"||tableSearch_2->text()=="2") - { - text2=tableSearch_2->text(); - } - else - { - text2=tableSearch_2->text(); - } - if(tableSearch_3->text()=="1"||tableSearch_3->text()=="2") - { - text3=tableSearch_3->text(); - } - else - { - text3=tableSearch_3->text(); - } - QString addSql=""; - if(text1!="") - addSql+=QString(" and ") + m_listComBoxsqlName.at(index_1)+QString(" regexp '")+text1+QString("'"); - if(text2!="") - addSql+=QString(" and ") + m_listComBoxsqlName.at(index_2)+QString(" regexp '")+text2+QString("'"); - if(text3!="") - addSql+=QString(" and ") + m_listComBoxsqlName.at(index_3)+QString(" regexp '")+text3+QString("' "); - whereSql=whereSql+addSql; - countSql = "SELECT count(*) FROM " + getTableName(m_tabFesPoint->tabText(m_tabFesPoint->currentIndex())) + " WHERE " + whereSql; - //LOGINFO(whereSql.toStdString().c_str()); - if (tableXml == TBL_FES_ACCUML || - tableXml == TBL_FES_ANALOG || - tableXml == TBL_FES_DIGITAL || - tableXml == TBL_FES_MIX || - tableXml == TBL_FES_ANALOG_CTRL || - tableXml == TBL_FES_DIGITAL_CTRL || - tableXml == TBL_FES_MIX_CTRL || - tableXml == TBL_FES_CONST ) - { - if (!whereSql.isEmpty()) - whereSql = whereSql + " ORDER BY RES_PARA_INT1 "; - } - m_pageTable->setTable(tableXml, whereSql, whereArgs, countSql, whereArgs); - return; - } - QList listItem; - for (int i = 0;i < m_modelFesDev->rowCount();i++) - { - QStandardItem* item = m_modelFesDev->item(i, 0); - - if(item->checkState() == Qt::Unchecked) - continue; - - if (item->checkState() == Qt::Checked) - listItem << item; - - if (item->checkState() == Qt::PartiallyChecked) - getItems(listItem, item); - } - - QString whereSql, countSql; - QStringList whereArgs; - QString text1,text2,text3; - getWhereSqlByCheck(listItem,whereSql); - - QString tableXml = getTableXml(m_tabFesPoint->tabText(m_tabFesPoint->currentIndex())); - if(tableSearch_1->text()=="1"||tableSearch_1->text()=="2") - { - text1=tableSearch_1->text(); - } - else - { - text1=tableSearch_1->text(); - } - if(tableSearch_2->text()=="1"||tableSearch_2->text()=="2") - { - text2=tableSearch_2->text(); - } - else - { - text2=tableSearch_2->text(); - } - if(tableSearch_3->text()=="1"||tableSearch_3->text()=="2") - { - text3=tableSearch_3->text(); - } - else - { - text3=tableSearch_3->text(); - } - - QString addSql=""; - if(text1!="") - addSql+=QString(" and ")+m_listComBoxsqlName.at(index_1)+QString(" regexp '")+text1+QString("'"); - if(text2!="") - addSql+=QString(" and ")+m_listComBoxsqlName.at(index_2)+QString(" regexp '")+text2+QString("'"); - if(text3!="") - addSql+=QString(" and ")+m_listComBoxsqlName.at(index_3)+QString(" regexp '")+text3+QString("' "); - whereSql=whereSql+addSql; - countSql = "SELECT count(*) FROM " + getTableName(m_tabFesPoint->tabText(m_tabFesPoint->currentIndex())) + " WHERE " + whereSql; - //LOGINFO(whereSql.toStdString().c_str()); - if (tableXml == TBL_FES_ACCUML || - tableXml == TBL_FES_ANALOG || - tableXml == TBL_FES_DIGITAL || - tableXml == TBL_FES_MIX || - tableXml == TBL_FES_ANALOG_CTRL || - tableXml == TBL_FES_DIGITAL_CTRL || - tableXml == TBL_FES_MIX_CTRL || - tableXml == TBL_FES_CONST ) - { - if (!whereSql.isEmpty()) - whereSql = whereSql + " ORDER BY RES_PARA_INT1 "; - } - m_pageTable->setTable(tableXml, whereSql, whereArgs, countSql, whereArgs); -} - -void KbdFesPointWidget::onCurrentPageChange() -{ - onSearchTableText(""); -} - -void KbdFesPointWidget::onSearch_1_tableText(const QString &text) -{ - onSearchTableText(text); - tableSearch_1->setFocus(); - tableSearch_1->setCursorPosition(tableSearch_1->text().size()); -} - -void KbdFesPointWidget::onSearch_2_tableText(const QString &text) -{ - onSearchTableText(text); - tableSearch_2->setFocus(); - tableSearch_2->setCursorPosition(tableSearch_2->text().size()); -} - -void KbdFesPointWidget::onSearch_3_tableText(const QString &text) -{ - onSearchTableText(text); - tableSearch_3->setFocus(); - tableSearch_3->setCursorPosition(tableSearch_3->text().size()); + m_pageTable->table()->searchItemText(QStringList()< listItem, QString& whereSql); - void updateDataFromPsc3000(QString csvFile,int menuType ); + void updateDataFromPsc3000(QString csvFile); private slots: void onLocationAndSubSysTemChange(); @@ -78,25 +79,12 @@ private slots: void onChangeShowType(); void onSearchTableText(const QString &text); - void onCurrentPageChange(); - void onSearch_1_tableText(const QString &text); - void onSearch_2_tableText(const QString &text); - void onSearch_3_tableText(const QString &text); - private: QComboBox *m_cbSubSystem; - kbdSearchWidget* m_editSearch; - QComboBox *searchCombox_1; - QComboBox *searchCombox_2; - QComboBox *searchCombox_3; - kbdSearchWidget* tableSearch_1; - kbdSearchWidget* tableSearch_2; - kbdSearchWidget* tableSearch_3; KbdTreeView *m_TreeFesDev; KbdDomModel* m_modelFesDev; QTabBar *m_tabFesPoint; KbdPage *m_pageTable; - QStringList m_listComBoxsqlName; QAction * m_copyAction; QMenu *m_menu; @@ -107,6 +95,7 @@ private: bool m_bShowDev; QPushButton* m_btnSearch; + kbdSearchWidget* m_tableSearch; }; diff --git a/platform/src/tools/model_plugin/FESWidget/kbdfesprotocolwidget.cpp b/platform/src/tools/model_plugin/FESWidget/kbdfesprotocolwidget.cpp index 2757b205..f248894a 100644 --- a/platform/src/tools/model_plugin/FESWidget/kbdfesprotocolwidget.cpp +++ b/platform/src/tools/model_plugin/FESWidget/kbdfesprotocolwidget.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" #include #include "kbdtable.h" @@ -18,6 +18,7 @@ #include "kbdpropertypanel.h" #include "kbdmsgcontrl.h" #include "kbddbdesign.h" +#include "pub_widget/CustomDialog.h" #define TN_FES_CHANNEL_PARA "FES_CHANNEL_PARA" @@ -45,14 +46,19 @@ void KbdFesProtocolWidget::initLayout() QToolBar *bar = new QToolBar(this); m_tableTotal = new KbdTable(vSplitter); - bar->setIconSize(QSize(24,24)); - bar->addAction(QIcon(":/icons/icons/new.png"),tr("添加记录"),this,SLOT(onAddTotalTableRow())); - bar->addAction(QIcon(":/icons/icons/modify.png"),tr("修改记录"),this,SLOT(onModifyTotalTableRow())); - bar->addAction(QIcon(":/icons/icons/delete.png"),tr("删除记录"),this,SLOT(onRemoveTotalTableRow())) - ->setShortcut(QKeySequence::Delete); + QAction* act = nullptr; + act = bar->addAction(tr("添加记录"),this,SLOT(onAddTotalTableRow())); + bar->widgetForAction(act)->setObjectName("icon_add"); + act = bar->addAction(tr("修改记录"),this,SLOT(onModifyTotalTableRow())); + bar->widgetForAction(act)->setObjectName("icon_edit"); + act = bar->addAction(tr("删除记录"),this,SLOT(onRemoveTotalTableRow())); + act->setShortcut(QKeySequence::Delete); + bar->widgetForAction(act)->setObjectName("icon_delete"); bar->addSeparator(); - bar->addAction(QIcon(":/icons/icons/Excel-export.png"),tr("Excel导出"),m_tableTotal,SLOT(onExcelExport())); - bar->addAction(QIcon(":/icons/icons/Excel-Impor.png"),tr("Excel导入"),m_tableTotal,SLOT(onImportExcel())); + act = bar->addAction(tr("Excel导出"),m_tableTotal,SLOT(onExcelExport())); + bar->widgetForAction(act)->setObjectName("icon_excel_export"); + act = bar->addAction(tr("Excel导入"),m_tableTotal,SLOT(onImportExcel())); + bar->widgetForAction(act)->setObjectName("icon_excel_import"); vLayout->addWidget(bar); // vLayout->addWidget(m_tableTotal); @@ -282,7 +288,8 @@ void KbdFesProtocolWidget::addModule() { QString protocolName; QString protocolDesc; - QDialog dlg; + CustomDialog dlg(this); + dlg.setWindowTitle(tr("新增模块")); QLabel *name = new QLabel(tr("模块名称")); QLineEdit *nameLine = new QLineEdit(&dlg); nameLine->setText(protocolName); @@ -333,6 +340,8 @@ void KbdFesProtocolWidget::addModule() void KbdFesProtocolWidget::delModule() { QModelIndexList indexList = m_tableModuleWidget->selectionModel()->selectedRows(); + QUESTION_REMOVE_WITH_SELECT(this,indexList.size()); + QVector vtRows; for(int i = 0;i < indexList.size();i++) vtRows.push_back(indexList.at(i).row()); @@ -346,7 +355,7 @@ void KbdFesProtocolWidget::delModule() QString text = m_tableModuleWidget->item(vtRows.at(i),0)->text(); if(text.contains("?")) { - QMessageBox::information(this,tr("消息"),QString(tr("%1 模板数据无法删除")).arg(text)); + N_MessageBox::information(this,tr("消息"),QString(tr("%1 模板数据无法删除")).arg(text)); continue; } m_data.removeAt(vtRows.at(i)); @@ -393,7 +402,8 @@ void KbdFesProtocolWidget::copyModule() bool KbdFesProtocolWidget::copyStyle(QString &modulename, int &nameStart, int ©Num) { formartString(modulename); - QDialog dlg; + CustomDialog dlg(this); + dlg.setWindowTitle(tr("复制模块")); QVBoxLayout *vlayout = new QVBoxLayout(&dlg); QHBoxLayout *hlayout1 = new QHBoxLayout(&dlg); QHBoxLayout *hlayout2 = new QHBoxLayout(&dlg); @@ -426,8 +436,8 @@ bool KbdFesProtocolWidget::copyStyle(QString &modulename, int &nameStart, int &c connect(buttonBox,&QDialogButtonBox::accepted,&dlg,&QDialog::accept); connect(buttonBox,&QDialogButtonBox::rejected,&dlg,&QDialog::reject); vlayout->addWidget(buttonBox); - dlg.setLayout(vlayout); + if(dlg.exec()==QDialog::Accepted) { modulename = nameLine->text(); @@ -472,7 +482,8 @@ void KbdFesProtocolWidget::addParam() QString paramName; QString paramValue; QString paramDesc; - QDialog dlg; + CustomDialog dlg(this); + dlg.setWindowTitle(tr("新增参数")); QLabel *name = new QLabel(tr("参数名称")); QLineEdit *nameLine = new QLineEdit(&dlg); nameLine->setText(paramName); @@ -504,6 +515,7 @@ void KbdFesProtocolWidget::addParam() connect(buttonBox,&QDialogButtonBox::rejected,&dlg,&QDialog::reject); glayout->addWidget(buttonBox,3,1); dlg.setLayout(glayout); + if(dlg.exec()==QDialog::Accepted) { paramName = nameLine->text(); @@ -537,10 +549,9 @@ void KbdFesProtocolWidget::addParam() void KbdFesProtocolWidget::delParam() { int moduleRow = m_tableModuleWidget->currentRow(); - if(moduleRow<-1 ||moduleRow>=m_data.count()) - { - return ; - } + bool bNoSelectRow = moduleRow < 0 ||moduleRow>=m_data.count(); + QUESTION_REMOVE_WITH_SELECT(this,bNoSelectRow ? 0 : 1); + QVector ¶mVec = m_data[moduleRow].paramVec; int paramRow = m_tableParamWidget->currentRow(); @@ -568,6 +579,7 @@ void KbdFesProtocolWidget::onAddTotalTableRow() return; KbdPropertyDlg dlg(false, this); + dlg.setWindowTitle(tr("新增协议")); dlg.panel()->setDisplayRow(model,model->rowCount()); if(dlg.exec() == QDialog::Rejected) return; @@ -607,6 +619,7 @@ void KbdFesProtocolWidget::onModifyTotalTableRow() return; KbdPropertyDlg dlg(false, this); + dlg.setWindowTitle(tr("修改协议参数")); dlg.panel()->setDisplayRow(model,index.row()); if(dlg.exec() == QDialog::Rejected) @@ -764,7 +777,8 @@ void KbdFesProtocolWidget::onEditModule(int row, int col) Q_UNUSED(col); QString protocolName = m_tableModuleWidget->item(row,0)->text(); QString protocolDesc = m_tableModuleWidget->item(row,1)->text(); - QDialog dlg; + CustomDialog dlg(this); + dlg.setWindowTitle(tr("修改模块参数")); QLabel *name = new QLabel(tr("模块名称")); QLineEdit *nameLine = new QLineEdit(&dlg); nameLine->setText(protocolName); @@ -788,6 +802,7 @@ void KbdFesProtocolWidget::onEditModule(int row, int col) connect(buttonBox,&QDialogButtonBox::rejected,&dlg,&QDialog::reject); glayout->addWidget(buttonBox,2,1); dlg.setLayout(glayout); + if(dlg.exec()==QDialog::Accepted) { updateModule(protocolName,nameLine->text(),descLine->text()); @@ -808,7 +823,8 @@ void KbdFesProtocolWidget::onEditParam(int row, int col) QString paramName = m_tableParamWidget->item(row,0)->text(); QString paramValue = m_tableParamWidget->item(row,1)->text(); QString paramDesc = m_tableParamWidget->item(row,2)->text(); - QDialog dlg; + CustomDialog dlg(this); + dlg.setWindowTitle(tr("修改参数")); QLabel *name = new QLabel(tr("参数名称")); QLineEdit *nameLine = new QLineEdit(&dlg); nameLine->setText(paramName); @@ -838,6 +854,7 @@ void KbdFesProtocolWidget::onEditParam(int row, int col) connect(buttonBox,&QDialogButtonBox::rejected,&dlg,&QDialog::reject); glayout->addWidget(buttonBox,3,1); dlg.setLayout(glayout); + if(dlg.exec()==QDialog::Accepted) { updateParam(paramName,nameLine->text(),valueLine->text(),descLine->text()); diff --git a/platform/src/tools/model_plugin/FESWidget/kbdforwardbackwidget.cpp b/platform/src/tools/model_plugin/FESWidget/kbdforwardbackwidget.cpp index 27deeecd..32841d6a 100644 --- a/platform/src/tools/model_plugin/FESWidget/kbdforwardbackwidget.cpp +++ b/platform/src/tools/model_plugin/FESWidget/kbdforwardbackwidget.cpp @@ -14,7 +14,7 @@ #include "../model_common/common.h" #include #include "kbdtable.h" -#include +#include "pub_widget/MessageBox.h" #include #include #include @@ -119,6 +119,7 @@ KbdForwardBackWidget::KbdForwardBackWidget(QWidget *parent) : QWidget(parent) void KbdForwardBackWidget::initLayout() { QHBoxLayout *hLayout = new QHBoxLayout; + QHBoxLayout *hLayout2 = new QHBoxLayout; QSplitter *hSplitter = new QSplitter(Qt::Horizontal,this); //转发点 @@ -162,21 +163,23 @@ void KbdForwardBackWidget::initLayout() hLayout->addSpacing(5); hLayout->addWidget(labelForwardSub); hLayout->addWidget(m_combSubFwd); - hLayout->addSpacing(5); - hLayout->addWidget(labelForwardRtu); - hLayout->addWidget(m_cbRtuForward); - hLayout->addSpacing(5); - hLayout->addWidget(buttonExport); - hLayout->addSpacing(5); - hLayout->addWidget(buttonImport); - hLayout->addSpacing(5); - hLayout->addWidget(buttonCopy); - hLayout->addSpacing(5); - hLayout->addWidget(btnRefresh); hLayout->addStretch(); + hLayout2->addWidget(labelForwardRtu); + hLayout2->addWidget(m_cbRtuForward); + hLayout2->addSpacing(5); + hLayout2->addWidget(buttonExport); + hLayout2->addSpacing(5); + hLayout2->addWidget(buttonImport); + hLayout2->addSpacing(5); + hLayout2->addWidget(buttonCopy); + hLayout2->addSpacing(5); + hLayout2->addWidget(btnRefresh); + hLayout2->addStretch(); + m_tabWidgetFowd = new QTabWidget(widgetFowd); vLayout2->addLayout(hLayout); + vLayout2->addLayout(hLayout2); vLayout2->addWidget(m_tabWidgetFowd); widgetFowd->setLayout(vLayout2); @@ -212,8 +215,8 @@ void KbdForwardBackWidget::initLayout() vLayout->addWidget(buttonIst); vLayout->addStretch(); widgetCtrl->setLayout(vLayout); - widgetCtrl->setMaximumWidth(100); - widgetCtrl->setMinimumWidth(100); + widgetCtrl->setMaximumWidth(60); + widgetCtrl->setMinimumWidth(55); //后台挑点 m_stackWidget = new QStackedWidget(hSplitter); @@ -471,11 +474,12 @@ void KbdForwardBackWidget::initSubsystem() m_combSubBack->addItem(desc,subID); } m_combSubBack->insertItem(0,tr("所有"), "-1"); - m_combSubFwd->insertItem(0,tr("所有"),"-1"); + m_combSubFwd->insertItem(0,tr("所有"),"-1"); } void KbdForwardBackWidget::initFowdRtu() { + QString locationId = m_combLocFwd->currentData().toString(); QString subSystemId = m_combSubFwd->currentData().toString(); QStringList list; @@ -485,7 +489,9 @@ void KbdForwardBackWidget::initFowdRtu() { list << "'" + m_combSubFwd->itemData(i).toString() + "'"; } + subSystemId = list.join(","); + } else { @@ -498,7 +504,9 @@ void KbdForwardBackWidget::initFowdRtu() { list << "'" + m_combLocFwd->itemData(i).toString() + "'"; } + locationId = list.join(","); + } else { @@ -712,6 +720,119 @@ void KbdForwardBackWidget::tabChange() return; } +bool KbdForwardBackWidget::loadTagName2FesTagInfo(const QString &sTableName, + QMultiMap &mapAppTag2FesTag, + QMap &mapAppTag2OffsetNum) +{ + //获取选择的设备列表 + QList selectDevTagName = getSelectTagNames(); + + QString devFilter; + for(int i = 0;i< selectDevTagName.size();i++) + { + if(selectDevTagName.isEmpty()) + { + continue; + } + + for(int nDevIdx = 0; nDevIdx < selectDevTagName[i].count();nDevIdx++) + { + if(devFilter.isEmpty()) + { + devFilter = "'" + selectDevTagName[i][nDevIdx] + "'"; + } + else + { + devFilter += ",'" + selectDevTagName[i][nDevIdx] + "'"; + } + } + } + + if(devFilter.isEmpty()) + { + QString error = "当前选择的设备组中没有设备实例!"; + qDebug() << error; + MS_LOG_ERROR(error); + return false; + } + + QString sSql; + if(sTableName.compare(TN_ANALOG, Qt::CaseInsensitive) == 0 || + sTableName.compare(TN_ACCUML, Qt::CaseInsensitive) == 0 || + sTableName.compare(TN_MIX, Qt::CaseInsensitive) == 0) + { + sSql = QString("SELECT f.app_tag_name,f.tag_name,1 value_num FROM fes_%1 AS f,%1 AS b WHERE f.app_tag_name = b.tag_name and b.rtu_tag= f.rtu_tag and b.device IN(%2);").arg(sTableName).arg(devFilter); + } + else if(sTableName.compare(TN_DIGITAL, Qt::CaseInsensitive) == 0) + { + sSql = QString("SELECT f.app_tag_name,f.tag_name,b.value_num FROM fes_digital AS f,digital AS b WHERE f.app_tag_name = b.tag_name and b.rtu_tag= f.rtu_tag and b.device IN(%1);").arg(devFilter); + } + else + { + //其它表暂不缓存 + return true; + } + + QSqlQuery result; + QString error; + if(!KbdTableDataMgr::getInstance()->selectOnly(sSql,result)) + { + error = "查询表:" + sTableName + "关联信息失败!"; + qDebug() << error; + MS_LOG_ERROR(error); + return false; + } + + while(result.next()) + { + mapAppTag2FesTag.insert(result.value(0).toString(),result.value(1).toString()); + mapAppTag2OffsetNum[result.value(0).toString()] = result.value(2).toInt(); + } + + return true; +} + +bool KbdForwardBackWidget::getOffsetMsgByCache(const QSqlQuery &result, const QMultiMap &mapAppTag2FesTag, const QMap &mapAppTag2OffsetNum) +{ + //查询关联前置信息,所有点类型统一存放在m_back2FesPointMap,关联信息异常则跳过(digital_control,digital) + QString sTagName = result.value(0).toString(); + if(m_sTableNameBack.endsWith("_CONTROL")) + { + //控制点暂时没有提前加入缓存 + return false; + } + + QStringList fesTagList = mapAppTag2FesTag.values(sTagName); + if(fesTagList.isEmpty()) + { + return false; //未找到 + } + + + //非正常情况,digital_control/digital + if(m_sTableNameBack.compare(TN_DIGITAL, Qt::CaseInsensitive) == 0 ) + { + QMap::const_iterator pNum = mapAppTag2OffsetNum.find(sTagName); + if(pNum == mapAppTag2OffsetNum.end() || pNum.value() != fesTagList.size()) + { + QString error = "缓存表:" + m_sTableNameBack + "中点:" + sTagName + "分量数与实际查询出来的分量数" + QString::number(fesTagList.size()) + "不一致!"; + qDebug() << error; + MS_LOG_ERROR(error); + return false; + } + } + + //正常情况 + FesOffset fesOffset; + fesOffset.offset_num = fesTagList.size(); + foreach (QString tag, fesTagList) { + fesOffset.fesTagNames.append(tag); + } + + m_back2FesPointMap.insert(sTagName,fesOffset); + return true; +} + void KbdForwardBackWidget::reloadData(int selMode) { //获取当前使用指针 @@ -741,6 +862,11 @@ void KbdForwardBackWidget::reloadData(int selMode) if(selMode == SEL_NONE || selMode == SEL_ALL) m_selectedRows.clear(); + //先获取所有选中设备的测点映射,提高性能 + QMultiMap mapAppTag2FesTag; + QMap mapAppTag2OffsetNum; + loadTagName2FesTagInfo(m_sTableNameBack,mapAppTag2FesTag,mapAppTag2OffsetNum); + int row = 0; for(int i = 0;i< result.size();i++) { @@ -762,8 +888,12 @@ void KbdForwardBackWidget::reloadData(int selMode) item2->setEditable(false); //获取前置分量 - if(!getOffsetMsg(result[i])) - continue; + if(!getOffsetMsgByCache(result[i],mapAppTag2FesTag,mapAppTag2OffsetNum)) + { + //先尝试从缓存获取,失败则按原逻辑获取 + if(!getOffsetMsg(result[i])) + continue; + } //判断转发表的所有标签名包含后台标签名或前置标签名,说明已经在转发表中,不显示 if( ifExist(tagNameList, result[i].value(0).toString()) ) @@ -835,33 +965,37 @@ void KbdForwardBackWidget::reFreshDevGroup() } locationId = list.join(","); - } else { locationId="'"+m_combLocBack->currentData().toString()+"'"; } list.clear(); - if(rtuNo=="-1") + + if(rtuNo != "-1") { - for(int i = 0; i < m_combRtuBack->count(); i++) - { - list << "'" + m_combRtuBack->itemData(i).toString() + "'"; - } + rtuNo = "'" + m_combRtuBack->currentData().toString()+"'"; + } - rtuNo = list.join(","); + if(locationId.isEmpty() || subSystemId.isEmpty()) + { + return; + } + KbdDbDesign ds; + QString sql; + if(rtuNo.size() == 2 || rtuNo == "-1") //rtuNo为空即 '' 时 + { + sql = QString("SELECT * FROM DEV_GROUP WHERE LOCATION_ID in (%1) " + "AND SUB_SYSTEM in (%2) ORDER BY DEV_GROUP_NO;") + .arg(locationId).arg(subSystemId); } else { - rtuNo="'"+m_combRtuBack->currentData().toString()+"'"; - } - if(locationId.isEmpty() || subSystemId.isEmpty()) - return; - KbdDbDesign ds; - QString sql = QString("SELECT * FROM DEV_GROUP WHERE LOCATION_ID in (%1) " - "AND SUB_SYSTEM in (%2) AND RTU_NO in (%3) ORDER BY LOCATION_ID, SUB_SYSTEM,RTU_NO,DEV_GROUP_NO;") + sql = QString("SELECT * FROM DEV_GROUP WHERE LOCATION_ID in (%1) " + "AND SUB_SYSTEM in (%2) AND RTU_NO in (%3) ORDER BY DEV_GROUP_NO;") .arg(locationId).arg(subSystemId).arg(rtuNo); + } reloadListWidget(m_listDevGrpBack, ds.getSqlItems(sql,CN_DESC,CN_TAG_NAME,false)); @@ -1730,8 +1864,39 @@ void KbdForwardBackWidget::getOffsetInfo( const QString& sTagName, QStringList & { QString sql; QSqlQuery result; - - sql = QString("select * from( \ + iot_dbms::EDbType dbType = KbdTableDataMgr::getInstance()->getDbPara().getDbType(); + if(dbType == iot_dbms::EDbType::DB_KINGBASE || dbType == iot_dbms::EDbType::DB_OPENGAUSS) + { + sql= QString("select * from \ + (SELECT OFFSET_NUM from digital_control where TAG_NAME = '%1') as table13, \ + \ + (select * from \ + (SELECT OFFSET_NO1 as FES_DOT_NO1 from digital_control where TAG_NAME = '%1') as table6, \ + (SELECT OFFSET_NO2 as FES_DOT_NO2 from digital_control where TAG_NAME = '%1') as table7, \ + (SELECT OFFSET_NO3 as FES_DOT_NO3 from digital_control where TAG_NAME = '%1') as table8, \ + (SELECT OFFSET_NO4 as FES_DOT_NO4 from digital_control where TAG_NAME = '%1') as table9, \ + (SELECT OFFSET_NO5 as FES_DOT_NO5 from digital_control where TAG_NAME = '%1') as table10" + ") \ + as table11, \ + \ + \ + (select * from \ + (SELECT TAG_NAME as FES_DOT_TAG_NAME1 FROM fes_digital_ctrl where DOT_NO::VARCHAR = ( SELECT COALESCE(NULLIF(TRIM(OFFSET_NO1), ''), '-1') \ + FROM digital_control where TAG_NAME = '%1') and RTU_TAG = (SELECT RTU_TAG FROM DIGITAL_CONTROL WHERE TAG_NAME = '%1') ) as table1, \ + (SELECT COALESCE((SELECT TAG_NAME FROM fes_digital_ctrl where DOT_NO::VARCHAR = (SELECT COALESCE(NULLIF(TRIM(OFFSET_NO2), ''), '-1') \ + FROM digital_control where TAG_NAME = '%1') and RTU_TAG = (SELECT RTU_TAG FROM DIGITAL_CONTROL WHERE TAG_NAME = '%1')),'') as FES_DOT_TAG_NAME2) as table2, \ + (SELECT COALESCE((SELECT TAG_NAME FROM fes_digital_ctrl where DOT_NO::VARCHAR = (SELECT COALESCE(NULLIF(TRIM(OFFSET_NO3), ''), '-1') \ + FROM digital_control where TAG_NAME = '%1') and RTU_TAG = (SELECT RTU_TAG FROM DIGITAL_CONTROL WHERE TAG_NAME = '%1')),'') as FES_DOT_TAG_NAME3) as table3, \ + (SELECT COALESCE((SELECT TAG_NAME FROM fes_digital_ctrl where DOT_NO::VARCHAR = (SELECT COALESCE(NULLIF(TRIM(OFFSET_NO4), ''), '-1') \ + FROM digital_control where TAG_NAME = '%1') and RTU_TAG = (SELECT RTU_TAG FROM DIGITAL_CONTROL WHERE TAG_NAME = '%1')),'') as FES_DOT_TAG_NAME4) as table4, \ + (SELECT COALESCE((SELECT TAG_NAME FROM fes_digital_ctrl where DOT_NO::VARCHAR = (SELECT COALESCE(NULLIF(TRIM(OFFSET_NO5), ''), '-1') \ + FROM digital_control where TAG_NAME = '%1') and RTU_TAG = (SELECT RTU_TAG FROM DIGITAL_CONTROL WHERE TAG_NAME = '%1')),'') as FES_DOT_TAG_NAME5) as table5 \ + ) \ + as table12;").arg(sTagName); + } + else + { + sql = QString("select * from( \ (SELECT OFFSET_NUM from digital_control where TAG_NAME = '%1') as table13, \ \ (select * from ( \ @@ -1756,6 +1921,7 @@ void KbdForwardBackWidget::getOffsetInfo( const QString& sTagName, QStringList & FROM digital_control where TAG_NAME = '%1') and RTU_TAG = (SELECT RTU_TAG FROM DIGITAL_CONTROL WHERE TAG_NAME = '%1')),'') as FES_DOT_TAG_NAME5) as table5 \ )) \ as table12);").arg(sTagName); + } if(!KbdTableDataMgr::getInstance()->selectOnly(sql,result)) { @@ -1818,25 +1984,25 @@ bool KbdForwardBackWidget::getSqlQuery(QList &resultList) if(m_sTableNameBack.compare(TN_ANALOG_CONTROL, Qt::CaseInsensitive) == 0 || m_sTableNameBack.compare(TN_MIX_CONTROL, Qt::CaseInsensitive) == 0) { - sSql = QString("select %1.TAG_NAME,%1.DESCRIPTION,%1.DEVICE,dev_info.DESCRIPTION,%3.OFFSET_NO \ - from %1 \ - INNER JOIN " + m_sTableNameBack + " on %1.TAG_NAME = " + m_sTableNameBack + ".TAG_NAME \ - INNER JOIN dev_info on %1.DEVICE = dev_info.TAG_NAME %2 ORDER BY SEQ_NO \ + sSql = QString("select %1.TAG_NAME,%1.DESCRIPTION,%1.DEVICE,dev_info.DESCRIPTION,%3.OFFSET_NO \ + from %1 \ + INNER JOIN " + m_sTableNameBack + " on %1.TAG_NAME = " + m_sTableNameBack + ".TAG_NAME \ + INNER JOIN dev_info on %1.DEVICE = dev_info.TAG_NAME %2 ORDER BY DEVICE ASC,SEQ_NO ASC \ ").arg(m_sTableNameBack.split("_")[0]).arg(condition[i]).arg(m_sTableNameBack); } else if(m_sTableNameBack.compare(TN_DIGITAL_CONTROL, Qt::CaseInsensitive) == 0) { - sSql = QString("select %1.TAG_NAME,%1.DESCRIPTION,%1.DEVICE,dev_info.DESCRIPTION, \ - %3.OFFSET_NUM,%3.OFFSET_NO1,%3.OFFSET_NO2,%3.OFFSET_NO3,%3.OFFSET_NO4,%3.OFFSET_NO5 \ - from %1 \ - INNER JOIN " + m_sTableNameBack + " on %1.TAG_NAME = " + m_sTableNameBack + ".TAG_NAME \ - INNER JOIN dev_info on %1.DEVICE = dev_info.TAG_NAME %2 ORDER BY SEQ_NO \ + sSql = QString("select %1.TAG_NAME,%1.DESCRIPTION,%1.DEVICE,dev_info.DESCRIPTION, \ + %3.OFFSET_NUM,%3.OFFSET_NO1,%3.OFFSET_NO2,%3.OFFSET_NO3,%3.OFFSET_NO4,%3.OFFSET_NO5 \ + from %1 \ + INNER JOIN " + m_sTableNameBack + " on %1.TAG_NAME = " + m_sTableNameBack + ".TAG_NAME \ + INNER JOIN dev_info on %1.DEVICE = dev_info.TAG_NAME %2 ORDER BY DEVICE ASC,SEQ_NO ASC \ ").arg(m_sTableNameBack.split("_")[0]).arg(condition[i]).arg(m_sTableNameBack); } else - sSql = QString("select %1.TAG_NAME,%1.DESCRIPTION,%1.DEVICE,dev_info.DESCRIPTION \ - from %1 \ - INNER JOIN dev_info on %1.DEVICE = dev_info.TAG_NAME %2 ORDER BY SEQ_NO \ + sSql = QString("select %1.TAG_NAME,%1.DESCRIPTION,%1.DEVICE,dev_info.DESCRIPTION \ + from %1 \ + INNER JOIN dev_info on %1.DEVICE = dev_info.TAG_NAME %2 ORDER BY DEVICE ASC,SEQ_NO ASC \ ").arg(m_sTableNameBack).arg(condition[i]); @@ -2050,7 +2216,7 @@ QList KbdForwardBackWidget::getSelectTagNames() QList itemList = getCheckedItems(m_listDevGrpBack); if(itemList.count() <= 0) { -// QMessageBox::information(this,tr("提示"),tr("请选择一个设备组!")); +// N_MessageBox::information(this,tr("提示"),tr("请选择一个设备组!")); return devListList; } @@ -2131,12 +2297,12 @@ void KbdForwardBackWidget::onAddAllClicked() success = getRowData(sTagName, pointSrc, rowDataList); if(!success) { - QMessageBox::information(this,tr("消息"),tr("获取行数据失败!")); + N_MessageBox::information(this,tr("消息"),tr("获取行数据失败!")); break; } if(rowDataList.count() == 0) { - QMessageBox::information(this,tr("消息"),QString( sTagName + "获取行数据为空!") ); + N_MessageBox::information(this,tr("消息"),QString( sTagName + "获取行数据为空!") ); success = false; break; } @@ -2146,7 +2312,7 @@ void KbdForwardBackWidget::onAddAllClicked() success = m_pCurrentFowdModel->addRow(rowDataList[i],false); if(!success) { - QMessageBox::information(this,tr("消息"),tr("添加失败!")); + N_MessageBox::information(this,tr("消息"),tr("添加失败!")); break; } } @@ -2157,11 +2323,11 @@ void KbdForwardBackWidget::onAddAllClicked() } } if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) - QMessageBox::information(this,tr("消息"),tr("提交事务失败,已回滚")); + N_MessageBox::information(this,tr("消息"),tr("提交事务失败,已回滚")); } else { - QMessageBox::information(this,tr("消息"),tr("开启事务失败!")); + N_MessageBox::information(this,tr("消息"),tr("开启事务失败!")); } if(!success) @@ -2169,7 +2335,7 @@ void KbdForwardBackWidget::onAddAllClicked() reloadData(); m_pCurrentFowdTable->reFresh(); - QMessageBox::information(this,tr("消息"),tr("添加成功!")); + N_MessageBox::information(this,tr("消息"),tr("添加成功!")); } void KbdForwardBackWidget::onSelectAllDevGrp() @@ -2263,6 +2429,7 @@ void KbdForwardBackWidget::onPointFowdDoubleClicked() if(retStr.isEmpty()) { KbdPropertyDlg dlg(true, this); + dlg.setWindowTitle(tr("修改") + m_tabWidgetFowd->tabText(m_tabWidgetFowd->currentIndex())); dlg.panel()->setDisplayRow(pModel,index.row()); if(dlg.exec()) @@ -2302,66 +2469,66 @@ void KbdForwardBackWidget::onExportTableFowd() err = m_modelAna->exportExcel(xlsx,m_modelAna->getTableName(),true); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } err = m_modelAnaCtrl->exportExcel(xlsx,m_modelAnaCtrl->getTableName(),true); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } err = m_modelDigSingle->exportExcel(xlsx,m_modelDigSingle->getTableName(),true); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } err = m_modelDigDouble->exportExcel(xlsx,m_modelDigDouble->getTableName(),true); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } err = m_modelDigCtrl->exportExcel(xlsx,m_modelDigCtrl->getTableName(),true); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } err = m_modelAcc->exportExcel(xlsx,m_modelAcc->getTableName(),true); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } err = m_modelMix->exportExcel(xlsx,m_modelMix->getTableName(),true); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } err = m_modelMixCtrl->exportExcel(xlsx,m_modelMixCtrl->getTableName(),true); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } if(!xlsx.saveAs(filePath)) { - QMessageBox::information(this,tr("消息"),tr("导出失败")); + N_MessageBox::information(this,tr("消息"),tr("导出失败")); return; } - QMessageBox::information(this,tr("消息"),tr("导出成功")); + N_MessageBox::information(this,tr("消息"),tr("导出成功")); return; } @@ -2369,8 +2536,8 @@ void KbdForwardBackWidget::onExportTableFowd() void KbdForwardBackWidget::onImportTableFowd() { - if(QMessageBox::information(this,tr("消息"),tr("导入操作会直接修改数据库,需确保数据正确有效,否则会导致配置错误!") - ,tr("已知悉风险"),tr("取消"),"")) + if(N_MessageBox::information(this,tr("消息"),tr("导入操作会直接修改数据库,需确保数据正确有效,否则会导致配置错误!") + ,N_MessageBox::Ok,N_MessageBox::Cancel) != N_MessageBox::Ok) return; QString strPath = QFileDialog::getOpenFileName(this,tr("打开文件"),"","*.xlsx"); @@ -2380,7 +2547,7 @@ void KbdForwardBackWidget::onImportTableFowd() QFile file(strPath); if(!file.open(QIODevice::ReadOnly)) { - QMessageBox::information(this,tr("消息"),tr("文件打开失败!")); + N_MessageBox::information(this,tr("消息"),tr("文件打开失败!")); return; } @@ -2395,42 +2562,42 @@ void KbdForwardBackWidget::onImportTableFowd() err = m_modelAna->importExcel(xlsx); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } err = m_modelAnaCtrl->importExcel(xlsx); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } err = m_modelDigSingle->importExcel(xlsx); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } err = m_modelAcc->importExcel(xlsx); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } err = m_modelMix->importExcel(xlsx); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } err = m_modelMixCtrl->importExcel(xlsx); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } @@ -2447,7 +2614,7 @@ void KbdForwardBackWidget::onImportTableFowd() err = m_modelAna->importExcel(xlsx); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } @@ -2462,7 +2629,7 @@ void KbdForwardBackWidget::onImportTableFowd() if(!err.isEmpty()) { //reFresh(); - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } @@ -2476,7 +2643,7 @@ void KbdForwardBackWidget::onImportTableFowd() err = m_modelDigSingle->importExcel(xlsx); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } @@ -2490,7 +2657,7 @@ void KbdForwardBackWidget::onImportTableFowd() err = m_modelDigDouble->importExcel(xlsx); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } @@ -2504,7 +2671,7 @@ void KbdForwardBackWidget::onImportTableFowd() err = m_modelDigCtrl->importExcel(xlsx); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } @@ -2518,7 +2685,7 @@ void KbdForwardBackWidget::onImportTableFowd() err = m_modelAcc->importExcel(xlsx); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } @@ -2532,7 +2699,7 @@ void KbdForwardBackWidget::onImportTableFowd() err = m_modelMix->importExcel(xlsx); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } @@ -2546,7 +2713,7 @@ void KbdForwardBackWidget::onImportTableFowd() err = m_modelMixCtrl->importExcel(xlsx); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } @@ -2555,16 +2722,16 @@ void KbdForwardBackWidget::onImportTableFowd() if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) { - QMessageBox::information(this,tr("消息"),tr("此次修改失败,已启动回滚!")); + N_MessageBox::information(this,tr("消息"),tr("此次修改失败,已启动回滚!")); return; } - QMessageBox::information(this,tr("消息"),tr("导入成功")); + N_MessageBox::information(this,tr("消息"),tr("导入成功")); onRefresh(); } else { - QMessageBox::information(this,tr("消息"),retStr); + N_MessageBox::information(this,tr("消息"),retStr); return; } @@ -2693,17 +2860,17 @@ void KbdForwardBackWidget::onCopyTableFowd() success= onCopyTable(i,destData); if(!success) { - QMessageBox::information(this,tr("消息"),tr("提交事务失败,已回滚")); + N_MessageBox::information(this,tr("消息"),tr("提交事务失败,已回滚")); return; } } if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) { - QMessageBox::information(this,tr("消息"),tr("提交事务失败,已回滚")); + N_MessageBox::information(this,tr("消息"),tr("提交事务失败,已回滚")); }else { - QMessageBox::information(this,tr("消息"),tr("拷贝完成!")); + N_MessageBox::information(this,tr("消息"),tr("拷贝完成!")); } } @@ -2753,13 +2920,13 @@ void KbdForwardBackWidget::onPointDoubleClicked(const QModelIndex &index) if(!success) { - QMessageBox::information(this,tr("消息"),tr("获取行数据失败!")); + N_MessageBox::information(this,tr("消息"),tr("获取行数据失败!")); return; } if(rowDataList.count() == 0) { - QMessageBox::information(this,tr("消息"),QString( sTagName + "获取行数据为空!") ); + N_MessageBox::information(this,tr("消息"),QString( sTagName + "获取行数据为空!") ); success = false; } @@ -2768,24 +2935,24 @@ void KbdForwardBackWidget::onPointDoubleClicked(const QModelIndex &index) success = m_pCurrentFowdModel->addRow(rowDataList[i],true); if(!success) { - QMessageBox::information(this,tr("消息"),tr("添加失败!")); + N_MessageBox::information(this,tr("消息"),tr("添加失败!")); break; } } if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) - QMessageBox::information(this,tr("消息"),tr("提交事务失败,已回滚")); + N_MessageBox::information(this,tr("消息"),tr("提交事务失败,已回滚")); } else { - QMessageBox::information(this,tr("消息"),tr("开启事务失败!")); + N_MessageBox::information(this,tr("消息"),tr("开启事务失败!")); } if(!success) return; reloadData(); - QMessageBox::information(this,tr("消息"),tr("添加成功!")); + N_MessageBox::information(this,tr("消息"),tr("添加成功!")); onRefresh(); } @@ -2838,7 +3005,7 @@ QString KbdForwardBackWidget::exportTable(const QString &sql, const QStringList void KbdForwardBackWidget::onMsg(const QString &text) { - QMessageBox::information(this,tr("消息"),text); + N_MessageBox::information(this,tr("消息"),text); } bool KbdForwardBackWidget::getBack2FesRelateInfo(const QString &sTableName, const QString &sTagName, QMap &map) diff --git a/platform/src/tools/model_plugin/FESWidget/kbdforwardbackwidget.h b/platform/src/tools/model_plugin/FESWidget/kbdforwardbackwidget.h index 653aed79..b3baf7e0 100644 --- a/platform/src/tools/model_plugin/FESWidget/kbdforwardbackwidget.h +++ b/platform/src/tools/model_plugin/FESWidget/kbdforwardbackwidget.h @@ -127,6 +127,18 @@ private: void inserFowdData(); bool checkAddPointTable(); + + //mapAppTag2FesTag返回 <后台测点Tag,前置测点Tag> ,可能存在一个后台测点对应多个前置测点(分量>1) + //mapAppTag2OffsetNum返回 <后台测点Tag,前置分量> + //增加此函数是为了避免转发表一个测点一条sql查询的情况 + bool loadTagName2FesTagInfo(const QString &sTableName, + QMultiMap &mapAppTag2FesTag, + QMap &mapAppTag2OffsetNum); + //从缓存中获取前置分量(之前是每个测点一条sql查询,现在先一次性加入缓存,减少sql查询) + bool getOffsetMsgByCache(const QSqlQuery& result, + const QMultiMap &mapAppTag2FesTag, + const QMap &mapAppTag2OffsetNum); + bool onCopyTable(int tableIndex, const QStringList &destData); private slots: void onFwdLocOrSubChanged(); diff --git a/platform/src/tools/model_plugin/FESWidget/kbdforwardwizard.cpp b/platform/src/tools/model_plugin/FESWidget/kbdforwardwizard.cpp index 055cd106..43284b24 100644 --- a/platform/src/tools/model_plugin/FESWidget/kbdforwardwizard.cpp +++ b/platform/src/tools/model_plugin/FESWidget/kbdforwardwizard.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" #include "kbdtabledatamgr.h" #include @@ -638,6 +638,6 @@ void KbdForwardWizard::onRemoveDev() void KbdForwardWizard::onMsg(const QString &msg) { - QMessageBox::information(this,tr("消息"),msg); + N_MessageBox::information(this,tr("消息"),msg); } diff --git a/platform/src/tools/model_plugin/FESWidget/kbdimportdlg.cpp b/platform/src/tools/model_plugin/FESWidget/kbdimportdlg.cpp index 3dca49bd..0ac56620 100644 --- a/platform/src/tools/model_plugin/FESWidget/kbdimportdlg.cpp +++ b/platform/src/tools/model_plugin/FESWidget/kbdimportdlg.cpp @@ -8,12 +8,13 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" #include #include "kbddbdesign.h" #include "kbdcontrolmgr.h" -KbdImportDlg::KbdImportDlg(QWidget *parent) : QDialog(parent) + +KbdImportDlg::KbdImportDlg(QWidget *parent) : CustomDialog(parent) { setWindowTitle(tr("导入前置与后台映射表")); m_hasComplete = true; @@ -57,12 +58,12 @@ void KbdImportDlg::closeEvent(QCloseEvent *event) { if(!m_hasComplete) { - QMessageBox::information(this,tr("警告"),tr("导入未完成!")); + N_MessageBox::information(this,tr("警告"),tr("导入未完成!")); event->ignore(); return; } - QDialog::closeEvent(event); + CustomDialog::closeEvent(event); } void KbdImportDlg::onScanpath() @@ -98,7 +99,7 @@ void KbdImportDlg::onCompleteImport(const QString &result) m_labelProgress->hide(); m_hasComplete = true; m_timer->stop(); - QMessageBox::information(this,tr("消息"),result); + N_MessageBox::information(this,tr("消息"),result); } void KbdImportDlg::onUpdateProgress() diff --git a/platform/src/tools/model_plugin/FESWidget/kbdimportdlg.h b/platform/src/tools/model_plugin/FESWidget/kbdimportdlg.h index ddffe79c..1443dfde 100644 --- a/platform/src/tools/model_plugin/FESWidget/kbdimportdlg.h +++ b/platform/src/tools/model_plugin/FESWidget/kbdimportdlg.h @@ -1,14 +1,13 @@ #ifndef KBDIMPORTDLG_H #define KBDIMPORTDLG_H -#include - +#include "pub_widget/CustomDialog.h" class QLineEdit; class QLabel; class QProgressBar; class QTimer; -class KbdImportDlg : public QDialog +class KbdImportDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_plugin/FESWidget/kbdpagewidget.cpp b/platform/src/tools/model_plugin/FESWidget/kbdpagewidget.cpp index da95f76c..747574a0 100644 --- a/platform/src/tools/model_plugin/FESWidget/kbdpagewidget.cpp +++ b/platform/src/tools/model_plugin/FESWidget/kbdpagewidget.cpp @@ -9,7 +9,7 @@ #include "../model_common/common.h" #include #include "kbddbdesign.h" -#include +#include "pub_widget/MessageBox.h" #include #include @@ -181,5 +181,5 @@ void KbdPageWidget::onNextPage() void KbdPageWidget::onMsg(const QString &text) { - QMessageBox::information(this,tr("消息"),text); + N_MessageBox::information(this,tr("消息"),text); } diff --git a/platform/src/tools/model_plugin/FESWidget/kbdpsc3000dlg.cpp b/platform/src/tools/model_plugin/FESWidget/kbdpsc3000dlg.cpp index eacebdf4..ba6daa23 100644 --- a/platform/src/tools/model_plugin/FESWidget/kbdpsc3000dlg.cpp +++ b/platform/src/tools/model_plugin/FESWidget/kbdpsc3000dlg.cpp @@ -12,7 +12,7 @@ #include "kbdtable.h" #include #include "kbdcsvreader.h" -#include +#include "pub_widget/MessageBox.h" #include #include #include "kbddbdesign.h" @@ -132,11 +132,11 @@ void KbdPsc3000Dlg::accept() QString regionId = modelReg->getRowData(rowReg).at(modelRegCols.findCol(CN_REGION_ID)); //最后的提示 - if(QMessageBox::No == QMessageBox::information(this,tr("消息"), + if(N_MessageBox::No == N_MessageBox::information(this,tr("消息"), tr("本操作将覆盖此RTU %1下的所有设备数据\r\n" "以及套件对应的后台设备数据\r\n" "是否更新?").arg(m_rtuTag), - QMessageBox::Yes,QMessageBox::No)) + N_MessageBox::Yes,N_MessageBox::No)) { return; } @@ -171,9 +171,9 @@ void KbdPsc3000Dlg::accept() void KbdPsc3000Dlg::reject() { - if (QMessageBox::No == QMessageBox::information(this, tr("消息"), + if (N_MessageBox::No == N_MessageBox::information(this, tr("消息"), tr("确定取消导入?"), - QMessageBox::Yes, QMessageBox::No)) + N_MessageBox::Yes, N_MessageBox::No)) { return; } @@ -279,11 +279,15 @@ QWizardPage *KbdPsc3000Dlg::initRegionPage() QVBoxLayout *vLayout1 = new QVBoxLayout; QToolBar *bar = new QToolBar(page); m_tableReg = new KbdTable(page,REWRITE_COMMIT); - bar->setIconSize(QSize(24,24)); - bar->addAction(QIcon(":/icons/icons/new.png"),tr("添加记录"),this,SLOT(onAddReg())); - bar->addAction(QIcon(":/icons/icons/delete.png"),tr("删除记录"),m_tableReg,SLOT(onRemoveRowNotCommit())); - bar->addAction(QIcon(":/icons/icons/undo.png"),tr("撤销更改"),m_tableReg,SLOT(onUndo())); - bar->addAction(QIcon(":/icons/icons/save.png"),tr("保存"),this,SLOT(onSaveReg())); + QAction* act = nullptr; + act = bar->addAction(tr("添加记录"),this,SLOT(onAddReg())); + bar->widgetForAction(act)->setObjectName("icon_add"); + act = bar->addAction(tr("删除记录"),m_tableReg,SLOT(onRemoveRowNotCommit())); + bar->widgetForAction(act)->setObjectName("icon_delete"); + act = bar->addAction(tr("撤销更改"),m_tableReg,SLOT(onUndo())); + bar->widgetForAction(act)->setObjectName("icon_undo"); + act = bar->addAction(tr("保存"),this,SLOT(onSaveReg())); + bar->widgetForAction(act)->setObjectName("icon_save"); vLayout1->addWidget(bar); vLayout1->addWidget(m_tableReg); page->setLayout(vLayout1); @@ -578,7 +582,7 @@ void KbdPsc3000Dlg::getChanTagName() QString sql = QString("SELECT CHAN_TAG FROM FES_RTU_PARA WHERE TAG_NAME = '%1';").arg(m_rtuTag); if(!KbdTableDataMgr::getInstance()->selectOnly(sql,result)) { - QMessageBox::information(this,tr("消息"),tr("查询通道标签名失败!")); + N_MessageBox::information(this,tr("消息"),tr("查询通道标签名失败!")); return; } while (result.next()) { @@ -592,7 +596,7 @@ void KbdPsc3000Dlg::getAllRtuInChannel(QStringList &rtuList) QString sql = QString("SELECT TAG_NAME FROM FES_RTU_PARA WHERE CHAN_TAG = '%1';").arg(m_chanTag); if(!KbdTableDataMgr::getInstance()->selectOnly(sql,result)) { - QMessageBox::information(this,tr("消息"),tr("查询通道下所有RTU标签名失败!")); + N_MessageBox::information(this,tr("消息"),tr("查询通道下所有RTU标签名失败!")); return; } while(result.next()){ @@ -614,7 +618,7 @@ bool KbdPsc3000Dlg::updateDevGrpMsg(QString locationTag) int devGrpCount; if(!KbdTableDataMgr::getInstance()->selectOnly(sql,result)) { - QMessageBox::information(this,tr("消息"),tr("查询设备组总数失败!")); + N_MessageBox::information(this,tr("消息"),tr("查询设备组总数失败!")); return false; } while(result.next()){ @@ -1164,8 +1168,8 @@ bool KbdPsc3000Dlg::checkPage0() { // QString error = QString("存在标签名冲突的后台设备组\r\n%1").arg(col2list.join("\r\n")); QString error = QString("存在标签名冲突的后台设备组,是否自动修改?"); - if(QMessageBox::Yes == QMessageBox::information(this,tr("消息"),error, - QMessageBox::Yes,QMessageBox::No)) + if(N_MessageBox::Yes == N_MessageBox::information(this,tr("消息"),error, + N_MessageBox::Yes,N_MessageBox::No)) { updateDevGrpMsg(locationTag); return false; @@ -1229,8 +1233,8 @@ bool KbdPsc3000Dlg::checkPage0() if(distributeDevList.size() != fesDevList.size()) { - if(QMessageBox::Yes == QMessageBox::information(this,tr("消息"),tr("存在未分配的前置设备,是否继续导入?"), - QMessageBox::Yes,QMessageBox::No)) + if(N_MessageBox::Yes == N_MessageBox::information(this,tr("消息"),tr("存在未分配的前置设备,是否继续导入?"), + N_MessageBox::Yes,N_MessageBox::No)) return true; else return false; @@ -1570,7 +1574,7 @@ void KbdPsc3000Dlg::rule2(const QString &pluginName, const QString &pluginDesc, void KbdPsc3000Dlg::onMsg(const QString &msg) { - QMessageBox::information(this,tr("消息"),msg); + N_MessageBox::information(this,tr("消息"),msg); } diff --git a/platform/src/tools/model_plugin/FESWidget/kbdrtulistwidget.cpp b/platform/src/tools/model_plugin/FESWidget/kbdrtulistwidget.cpp index c0b01c8a..0cae548f 100644 --- a/platform/src/tools/model_plugin/FESWidget/kbdrtulistwidget.cpp +++ b/platform/src/tools/model_plugin/FESWidget/kbdrtulistwidget.cpp @@ -9,7 +9,7 @@ #include "kbdpropertydlg.h" #include "kbdpropertypanel.h" #include "kbdtableproperty.h" -#include +#include "pub_widget/MessageBox.h" #include #include "kbdmsgcontrl.h" #include "CustomWidget/kbddommodel.h" @@ -124,7 +124,7 @@ void KbdRtuListWidget::onAddTable() return; } KbdPropertyDlg dlg(false, this); - dlg.setWindowTitle(tr("添加RTU")); + dlg.setWindowTitle(tr("新增RTU")); dlg.panel()->setDisplayRow(model,model->rowCount()); //不确定的值先随便填,后面再替换掉 dlg.panel()->setPropertyValue(CN_TAG_NAME,"XX"); @@ -196,7 +196,7 @@ void KbdRtuListWidget::onModifyTable() return; KbdPropertyDlg dlg(false, this); - dlg.setWindowTitle(tr("修改RTU")); + dlg.setWindowTitle(tr("修改RTU配置")); dlg.panel()->setDisplayRow(model,index.row()); //周工:主键不允许修改 //dlg.panel()->setPropertyEditable(CN_RTU_NAME,false); @@ -248,8 +248,8 @@ void KbdRtuListWidget::onModifyTable() void KbdRtuListWidget::onRemoveTable() { - if(QMessageBox::No == QMessageBox::information(this,tr("消息"),tr("删除RTU将同时删除该RTU下的设备,\r\n是否删除?"), - QMessageBox::Yes,QMessageBox::No)) + if(N_MessageBox::No == N_MessageBox::information(this,tr("消息"),tr("删除RTU将同时删除该RTU下的设备,\r\n是否删除?"), + N_MessageBox::Yes,N_MessageBox::No)) return; KbdTableModel *model = qobject_cast(m_tableProperty->getTable()->model()); @@ -297,7 +297,7 @@ void KbdRtuListWidget::onCopyTable() return; } - int num = QInputDialog::getInt(this,tr("复制"),tr("复制数量")); + int num = QInputDialog::getInt(this,tr("复制RTU"),tr("复制数量")); if(num <= 0) return; diff --git a/platform/src/tools/model_plugin/FESWidget/kbdselectdevdlg.cpp b/platform/src/tools/model_plugin/FESWidget/kbdselectdevdlg.cpp index a601c869..a646b8d6 100644 --- a/platform/src/tools/model_plugin/FESWidget/kbdselectdevdlg.cpp +++ b/platform/src/tools/model_plugin/FESWidget/kbdselectdevdlg.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" #include #include #include @@ -25,7 +25,7 @@ #define TN_EXPORT_SEQ "export_seq" -KbdSelectDevDlg::KbdSelectDevDlg(QWidget *parent) : QDialog(parent) +KbdSelectDevDlg::KbdSelectDevDlg(QWidget *parent) : CustomDialog(parent) { //布局 setWindowTitle(tr("导出前置与后台映射表")); @@ -104,12 +104,12 @@ void KbdSelectDevDlg::closeEvent(QCloseEvent *event) { if(!m_hasComplete) { - QMessageBox::information(this,tr("警告"),tr("导出未完成!")); + N_MessageBox::information(this,tr("警告"),tr("导出未完成!")); event->ignore(); return; } - QDialog::closeEvent(event); + CustomDialog::closeEvent(event); } void KbdSelectDevDlg::initData() @@ -195,7 +195,7 @@ void KbdSelectDevDlg::onExport() QString sql = QString("SELECT * FROM DEV_INFO ORDER BY LOCATION_ID;"); if(!KbdTableDataMgr::getInstance()->selectOnly(sql,result)) { - QMessageBox::information(this,tr("消息"),tr("读取数据库不成功,导出设备失败!")); + N_MessageBox::information(this,tr("消息"),tr("读取数据库不成功,导出设备失败!")); return; } int count = 0; @@ -215,7 +215,7 @@ void KbdSelectDevDlg::onExport() if(values.isEmpty()) { - QMessageBox::information(this,tr("消息"),tr("无设备需要导出!")); + N_MessageBox::information(this,tr("消息"),tr("无设备需要导出!")); return; } @@ -245,7 +245,7 @@ void KbdSelectDevDlg::onCompleteExport(const QString &result) m_timer->stop(); this->setDisabled(false); KbdTableDataMgr::getInstance()->truncateTable(TN_EXPORT_SEQ,NULL);//导出完毕,清空对应输入表 - QMessageBox::information(this,tr("消息"),result); + N_MessageBox::information(this,tr("消息"),result); } void KbdSelectDevDlg::onAddDev() diff --git a/platform/src/tools/model_plugin/FESWidget/kbdselectdevdlg.h b/platform/src/tools/model_plugin/FESWidget/kbdselectdevdlg.h index 64886482..d6d4e275 100644 --- a/platform/src/tools/model_plugin/FESWidget/kbdselectdevdlg.h +++ b/platform/src/tools/model_plugin/FESWidget/kbdselectdevdlg.h @@ -1,8 +1,8 @@ #ifndef KBDSELECTDEVDLG_H #define KBDSELECTDEVDLG_H -#include #include +#include "pub_widget/CustomDialog.h" class QListWidget; class QProgressBar; @@ -15,7 +15,7 @@ class QCheckBox; /** * @brief The KbdSelectDevDlg class 选择设备对话框 */ -class KbdSelectDevDlg : public QDialog +class KbdSelectDevDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_plugin/FESWidget/kbdupdatepsc3000dlg.cpp b/platform/src/tools/model_plugin/FESWidget/kbdupdatepsc3000dlg.cpp index 78d4b994..1b251762 100644 --- a/platform/src/tools/model_plugin/FESWidget/kbdupdatepsc3000dlg.cpp +++ b/platform/src/tools/model_plugin/FESWidget/kbdupdatepsc3000dlg.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" #include #include #include @@ -18,10 +18,9 @@ #include "kbddbdesign.h" #include "kbdwaitprgdlg.h" -KbdUpdatePsc3000Dlg::KbdUpdatePsc3000Dlg(const QString &rtuTag,int operType, QWidget *parent) : QDialog(parent) +KbdUpdatePsc3000Dlg::KbdUpdatePsc3000Dlg(const QString &rtuTag, QWidget *parent) : CustomDialog(parent) { m_rtuTag = rtuTag; - m_operType = operType; setWindowTitle(tr("更新PCS3000数据")); initLayout(); initData(); @@ -36,19 +35,9 @@ void KbdUpdatePsc3000Dlg::initLayout() m_table = new QTableWidget(this); QPushButton* btnSelAll = new QPushButton(tr("全选"),this); QPushButton* btnSelRev = new QPushButton(tr("反选"),this); + QPushButton* btnOk = new QPushButton(tr("更新"),this); - QPushButton* btnOk; - QLabel* lable; - if(m_operType ==2) - { - btnOk = new QPushButton(tr("更新设备点"),this); - lable = new QLabel(tr("注:只支持更新设备测点属性,无法增加设备及增删设备点!"),this); - }else if(m_operType ==3) - { - btnOk = new QPushButton(tr("增删设备点"),this); - lable = new QLabel(tr("注:只支持添加,删除设备测点,无法更新现有测点属性!"),this); - } - + QLabel* lable = new QLabel(tr("注:只支持添加,删除前置测点和更新前置测点属性,无法创建后台设备以及处理双点!"),this); hLayout->addWidget(btnSelAll); hLayout->addWidget(btnSelRev); @@ -173,13 +162,10 @@ void KbdUpdatePsc3000Dlg::updateTable() QString KbdUpdatePsc3000Dlg::openPsc3000File(const QString &csvFile) { - - QString xlsxPath; QString errorMsg; if(!csvFile.endsWith(".xlsx")) { - KbdCSVReader reader; QDir dir(Common::getStylePath()+"../fileLogic"); if(!dir.exists()) @@ -200,7 +186,6 @@ QString KbdUpdatePsc3000Dlg::openPsc3000File(const QString &csvFile) else xlsxPath = csvFile; - errorMsg = readXlsx(xlsxPath); if(errorMsg.isEmpty()) updateTable(); @@ -425,105 +410,97 @@ void KbdUpdatePsc3000Dlg::UpdatePcs3000Data() bool KbdUpdatePsc3000Dlg::UpdateDigitalPoints(QString devId,QString fesDevTag,QString devGroupTag) { - //删除PCS3000中不存在的点及把区分更新点,增加点及删除点 + //删除PCS3000中不存在的点 if(!deleteUselessFesPoint("PSC3000_DIG","fes_digital","digital",devId,fesDevTag)) return false; - QString sql; - if (m_operType == EoperType::OPER_UPDATE) + //更新后台点描述 + UpdateDevPointDes(devId,fesDevTag,"psc3000_dig","fes_digital"); + + //更新测点属性 + QList listSql; + QString sql; + if(KbdTableDataMgr::getInstance()->getDbPara().getDbType() == iot_dbms::DB_MYSQL) { - //更新后台点描述 - UpdateDevPointDes(devId,fesDevTag,"psc3000_dig","fes_digital"); - - //更新测点属性 - QList listSql; - - if(KbdTableDataMgr::getInstance()->getDbPara().getDbType() == iot_dbms::DB_MYSQL) - { - sql = "UPDATE fes_digital t1,psc3000_dig t2 SET t1.DESCRIPTION = t2.DESCRIPTION,\ - t1.RES_PARA_INT1 = t2.REMOTE_NO,t1.SEQ_NO = t2.REMOTE_NO WHERE t1.DEV_TAG = '%1' AND t2.DEV_ID = '%2' \ - AND t1.FES_POINT_TP_NAME = '%3' AND t2.TAG_NAME = '%4';"; - } - else - { - sql = "UPDATE fes_digital SET DESCRIPTION = psc3000_dig.DESCRIPTION,\ - RES_PARA_INT1 = psc3000_dig.REMOTE_NO,SEQ_NO = psc3000_dig.REMOTE_NO from psc3000_dig WHERE fes_digital.DEV_TAG = '%1' AND psc3000_dig.DEV_ID = '%2' \ - AND fes_digital.FES_POINT_TP_NAME = '%3' AND psc3000_dig.TAG_NAME = '%4';"; - } - - for(auto iter = m_setTempTag.begin();iter != m_setTempTag.end();iter++) - listSql << sql.arg(fesDevTag).arg(devId).arg(m_mapFesTempTag.value(*iter)).arg(*iter); - if(!KbdTableDataMgr::getInstance()->executeOnly(listSql)) - return false; + sql = "UPDATE fes_digital t1,psc3000_dig t2 SET t1.DESCRIPTION = t2.DESCRIPTION,\ + t1.RES_PARA_INT1 = t2.REMOTE_NO,t1.SEQ_NO = t2.REMOTE_NO WHERE t1.DEV_TAG = '%1' AND t2.DEV_ID = '%2' \ + AND t1.FES_POINT_TP_NAME = '%3' AND t2.TAG_NAME = '%4';"; + } + else + { + sql = "UPDATE fes_digital SET DESCRIPTION = psc3000_dig.DESCRIPTION,\ + RES_PARA_INT1 = psc3000_dig.REMOTE_NO,SEQ_NO = psc3000_dig.REMOTE_NO from psc3000_dig WHERE fes_digital.DEV_TAG = '%1' AND psc3000_dig.DEV_ID = '%2' \ + AND fes_digital.FES_POINT_TP_NAME = '%3' AND psc3000_dig.TAG_NAME = '%4';"; } - if (m_operType == EoperType::OPER_ADD_REMOVE) + for(auto iter = m_setTempTag.begin();iter != m_setTempTag.end();iter++) + listSql << sql.arg(fesDevTag).arg(devId).arg(m_mapFesTempTag.value(*iter)).arg(*iter); + if(!KbdTableDataMgr::getInstance()->executeOnly(listSql)) + return false; + + //添加新加的点 + if (m_setUpdateTag.isEmpty()) + return true; + + QStringList sqlFilter; + QList listPcsPoint; + for(auto iter = m_setUpdateTag.begin();iter != m_setUpdateTag.end();iter++) + sqlFilter << QString("TAG_NAME = '%1'").arg(*iter); + + sql = "SELECT * FROM psc3000_dig WHERE DEV_ID = '%1' AND (%2);"; + QSqlQuery result; + if(!KbdTableDataMgr::getInstance()->selectOnly(sql.arg(devId).arg(sqlFilter.join(" or ")),result)) + return false; + while (result.next()) { - //添加新加的点 - if (m_setUpdateTag.isEmpty()) - return true; - - QStringList sqlFilter; - QList listPcsPoint; - for(auto iter = m_setUpdateTag.begin();iter != m_setUpdateTag.end();iter++) - sqlFilter << QString("TAG_NAME = '%1'").arg(*iter); - - sql = "SELECT * FROM psc3000_dig WHERE DEV_ID = '%1' AND (%2);"; - QSqlQuery result; - if(!KbdTableDataMgr::getInstance()->selectOnly(sql.arg(devId).arg(sqlFilter.join(" or ")),result)) - return false; - while (result.next()) - { - QStringList listPoint; - listPoint << result.value(CN_TAG_NAME).toString(); - listPoint << result.value(CN_DESC).toString(); - listPoint << result.value(CN_REMOTE_NO).toString(); - listPcsPoint << listPoint; - } - - int max = 0; - bool isNull = false; - KbdDbDesign ds; - if(!ds.getMax(QString("SELECT max(DOT_NO) FROM fes_digital WHERE RTU_TAG='%1';").arg(m_rtuTag),max,isNull)) - { - emit sigUpdateResult(tr("获取RTU信息失败!")); - return false; - } - - if(max == 0&& isNull) - { - max = 0; - } - else - max = max +1; - - KbdTableModel* model = KbdTableDataMgr::getInstance()->createModel(TBL_FES_DIGITAL); - const ColMgrDataList& modelCols = model->getHeadCols(); - QStringList point = model->createDefaultValue(); - QList listDatas; - int ndotNo = max; - for(auto iter = listPcsPoint.begin();iter != listPcsPoint.end();iter++) - { - point.replace(modelCols.findCol(CN_TAG_NAME),m_rtuTag+"."+QString::number(ndotNo)); - point.replace(modelCols.findCol(CN_DESC),iter->at(1)); - point.replace(modelCols.findCol(CN_FES_POINT_TP_NAME),iter->at(0)); - point.replace(modelCols.findCol(CN_DOT_NO),QString::number(ndotNo)); - point.replace(modelCols.findCol(CN_RTU_TAG),m_rtuTag); - point.replace(modelCols.findCol(CN_RTU_NO),m_rtuNo); - point.replace(modelCols.findCol(CN_DEV_TAG),fesDevTag); - point.replace(modelCols.findCol(CN_LOCATION_ID),m_locationId); - point.replace(modelCols.findCol(CN_SUB_SYSTEM),m_subsystemId); - point.replace(modelCols.findCol(CN_RES_PARA_INT1),iter->at(2)); - point.replace(modelCols.findCol(CN_SEQ_NO),iter->at(2)); - listDatas << point; - ndotNo++; - } - if(!model->addRows(listDatas)) - return false; - - return creatDigitalDevPointValue(devGroupTag,listPcsPoint,max); + QStringList listPoint; + listPoint << result.value(CN_TAG_NAME).toString(); + listPoint << result.value(CN_DESC).toString(); + listPoint << result.value(CN_REMOTE_NO).toString(); + listPcsPoint << listPoint; } - return true; + + int max = 0; + bool isNull = false; + KbdDbDesign ds; + if(!ds.getMax(QString("SELECT max(DOT_NO) FROM fes_digital WHERE RTU_TAG='%1';").arg(m_rtuTag),max,isNull)) + { + emit sigUpdateResult(tr("获取RTU信息失败!")); + return false; + } + + if(max == 0&& isNull) + { + max = 0; + } + else + max = max +1; + + KbdTableModel* model = KbdTableDataMgr::getInstance()->createModel(TBL_FES_DIGITAL); + const ColMgrDataList& modelCols = model->getHeadCols(); + QStringList point = model->createDefaultValue(); + QList listDatas; + int ndotNo = max; + for(auto iter = listPcsPoint.begin();iter != listPcsPoint.end();iter++) + { + point.replace(modelCols.findCol(CN_TAG_NAME),m_rtuTag+"."+QString::number(ndotNo)); + point.replace(modelCols.findCol(CN_DESC),iter->at(1)); + point.replace(modelCols.findCol(CN_FES_POINT_TP_NAME),iter->at(0)); + point.replace(modelCols.findCol(CN_DOT_NO),QString::number(ndotNo)); + point.replace(modelCols.findCol(CN_RTU_TAG),m_rtuTag); + point.replace(modelCols.findCol(CN_RTU_NO),m_rtuNo); + point.replace(modelCols.findCol(CN_DEV_TAG),fesDevTag); + point.replace(modelCols.findCol(CN_LOCATION_ID),m_locationId); + point.replace(modelCols.findCol(CN_SUB_SYSTEM),m_subsystemId); + point.replace(modelCols.findCol(CN_RES_PARA_INT1),iter->at(2)); + point.replace(modelCols.findCol(CN_SEQ_NO),iter->at(2)); + listDatas << point; + ndotNo++; + } + if(!model->addRows(listDatas)) + return false; + + return creatDigitalDevPointValue(devGroupTag,listPcsPoint,max); } bool KbdUpdatePsc3000Dlg::UpdateAnalogPoints(QString devId,QString fesDevTag,QString devGroupTag) @@ -532,15 +509,12 @@ bool KbdUpdatePsc3000Dlg::UpdateAnalogPoints(QString devId,QString fesDevTag,QSt if(!deleteUselessFesPoint("PSC3000_ANA","fes_analog","analog",devId,fesDevTag)) return false; - QString sql; - if (m_operType == EoperType::OPER_UPDATE) - { //更新后台点描述 - UpdateDevPointDes(devId,fesDevTag,"psc3000_ana","fes_analog"); + UpdateDevPointDes(devId,fesDevTag,"psc3000_ana","fes_analog"); //更新测点属性 QList listSql; - + QString sql; if(KbdTableDataMgr::getInstance()->getDbPara().getDbType() == iot_dbms::DB_MYSQL) { sql = "UPDATE fes_analog t1,psc3000_ana t2 SET t1.DESCRIPTION = t2.DESCRIPTION,\ @@ -557,10 +531,7 @@ bool KbdUpdatePsc3000Dlg::UpdateAnalogPoints(QString devId,QString fesDevTag,QSt listSql << sql.arg(fesDevTag).arg(devId).arg(m_mapFesTempTag.value(*iter)).arg(*iter); if(!KbdTableDataMgr::getInstance()->executeOnly(listSql)) return false; - } - if (m_operType == EoperType::OPER_ADD_REMOVE) - { //添加新加入的点 if (m_setUpdateTag.isEmpty()) return true; @@ -626,8 +597,6 @@ bool KbdUpdatePsc3000Dlg::UpdateAnalogPoints(QString devId,QString fesDevTag,QSt //添加后台设备点 return creatAnalogDevPointValue(devGroupTag,listPcsPoint,max); - } - return true; } bool KbdUpdatePsc3000Dlg::UpdateAccumlPoints(QString devId,QString fesDevTag,QString devGroupTag) @@ -635,15 +604,13 @@ bool KbdUpdatePsc3000Dlg::UpdateAccumlPoints(QString devId,QString fesDevTag,QSt //删除PCS3000中不存在的点 if(!deleteUselessFesPoint("PSC3000_ACC","fes_accuml","accuml",devId,fesDevTag)) return false; - QString sql; - if (m_operType == EoperType::OPER_UPDATE) - { + //更新后台点描述 UpdateDevPointDes(devId,fesDevTag,"psc3000_acc","fes_accuml"); //更新测点属性 QList listSql; - + QString sql; if(KbdTableDataMgr::getInstance()->getDbPara().getDbType() == iot_dbms::DB_MYSQL) { sql = "UPDATE fes_accuml t1,psc3000_acc t2 SET t1.DESCRIPTION = t2.DESCRIPTION,\ @@ -662,9 +629,7 @@ bool KbdUpdatePsc3000Dlg::UpdateAccumlPoints(QString devId,QString fesDevTag,QSt if(!KbdTableDataMgr::getInstance()->executeOnly(listSql)) return false; -} - if (m_operType == EoperType::OPER_ADD_REMOVE) - { + //添加新加入的点 if (m_setUpdateTag.isEmpty()) return true; @@ -731,8 +696,6 @@ bool KbdUpdatePsc3000Dlg::UpdateAccumlPoints(QString devId,QString fesDevTag,QSt //添加后台设备点 return creatAccumlDevPointValue(devGroupTag,listPcsPoint,max); - } - return true; } bool KbdUpdatePsc3000Dlg::UpdateDigitalCtrlPoints(QString devId, QString fesDevTag) @@ -763,20 +726,13 @@ bool KbdUpdatePsc3000Dlg::UpdateDigitalCtrlPoints(QString devId, QString fesDevT } QSet setDeletePoints = setFesPoints - setPcsPoints; - + sql = "DELETE FROM fes_digital_ctrl WHERE POINT_TP_NAME = '%2' AND DEV_TAG = '%3';"; QStringList listSql; - if (m_operType == EoperType::OPER_ADD_REMOVE) - { - sql = "DELETE FROM fes_digital_ctrl WHERE POINT_TP_NAME = '%2' AND DEV_TAG = '%3';"; + for(auto iter = setDeletePoints.begin();iter != setDeletePoints.end();iter++) + listSql << sql.arg(m_mapFesTempTag.value(*iter)).arg(fesDevTag); + if(!KbdTableDataMgr::getInstance()->executeOnly(listSql)) + return false; - for(auto iter = setDeletePoints.begin();iter != setDeletePoints.end();iter++) - listSql << sql.arg(m_mapFesTempTag.value(*iter)).arg(fesDevTag); - if(!KbdTableDataMgr::getInstance()->executeOnly(listSql)) - return false; - } - - if (m_operType == EoperType::OPER_UPDATE) - { //更新点属性 listSql.clear(); QSet setUpdatePoints = setPcsPoints & setFesPoints; @@ -796,18 +752,13 @@ bool KbdUpdatePsc3000Dlg::UpdateDigitalCtrlPoints(QString devId, QString fesDevT listSql << sql.arg(*iter).arg(m_mapFesTempTag.value(*iter)).arg(devId).arg(fesDevTag); if(!KbdTableDataMgr::getInstance()->executeOnly(listSql)) return false; - } - if (m_operType == EoperType::OPER_ADD_REMOVE) - { //添加pcs中新加入的点 QSet setAddPoints = setPcsPoints - setFesPoints; if (setAddPoints.isEmpty()) return true; return addDigitalCtrlPoints(setAddPoints.toList(),devId,fesDevTag); - } - return true; } bool KbdUpdatePsc3000Dlg::deleteUselessFesPoint(QString pcsTable, QString fesTable, QString devTable, QString devId, QString fesDevTag) @@ -830,7 +781,6 @@ bool KbdUpdatePsc3000Dlg::deleteUselessFesPoint(QString pcsTable, QString fesTab sql = "SELECT FES_POINT_TP_NAME FROM %1 WHERE DEV_TAG = '%2';"; if(!KbdTableDataMgr::getInstance()->selectOnly(sql.arg(fesTable).arg(fesDevTag),result)) return false; - while (result.next()) { QString strPoint; @@ -841,41 +791,32 @@ bool KbdUpdatePsc3000Dlg::deleteUselessFesPoint(QString pcsTable, QString fesTab //删除前置及对应后台点 QSet setDeletePoints = setFesPoints - setPcsPoints; - - //需要更新的点 m_setTempTag = setFesPoints & setPcsPoints; - - //新增的点 m_setUpdateTag = setPcsPoints - setFesPoints; if (setDeletePoints.isEmpty()) return true; + QString sqlFilter = "FES_POINT_TP_NAME = '%1'"; + QStringList listFesTp; + for (auto iter = setDeletePoints.begin(); iter != setDeletePoints.end(); iter++) + listFesTp << sqlFilter.arg(m_mapFesTempTag.value(*iter)); - if (m_operType == EoperType::OPER_ADD_REMOVE) + sql = "SELECT TAG_NAME,APP_TAG_NAME FROM %1 WHERE DEV_TAG = '%2' AND (%3);"; + KbdDbDesign ds; + QStringList listCol1, listCol2; + ds.getTwoColumnResult(sql.arg(fesTable).arg(fesDevTag).arg(listFesTp.join(" OR ")), listCol1, listCol2); + + sql = "DELETE FROM %1 WHERE TAG_NAME = '%2';"; + QStringList listSql; + for(int i = 0;i < listCol1.size(); i++) { - QString sqlFilter = "FES_POINT_TP_NAME = '%1'"; - QStringList listFesTp; - for (auto iter = setDeletePoints.begin(); iter != setDeletePoints.end(); iter++) - listFesTp << sqlFilter.arg(m_mapFesTempTag.value(*iter)); - - sql = "SELECT TAG_NAME,APP_TAG_NAME FROM %1 WHERE DEV_TAG = '%2' AND (%3);"; - KbdDbDesign ds; - QStringList listCol1, listCol2; - ds.getTwoColumnResult(sql.arg(fesTable).arg(fesDevTag).arg(listFesTp.join(" OR ")), listCol1, listCol2); - - - sql = "DELETE FROM %1 WHERE TAG_NAME = '%2';"; - QStringList listSql; - for(int i = 0;i < listCol1.size(); i++) - { - if(!listCol2.at(i).isEmpty()) - listSql << sql.arg(devTable).arg(listCol2.at(i)); - if (!listCol1.at(i).isEmpty()) - listSql << sql.arg(fesTable).arg(listCol1.at(i)); - } - if(!KbdTableDataMgr::getInstance()->executeOnly(listSql)) - return false; + if(!listCol2.at(i).isEmpty()) + listSql << sql.arg(devTable).arg(listCol2.at(i)); + if (!listCol1.at(i).isEmpty()) + listSql << sql.arg(fesTable).arg(listCol1.at(i)); } + if(!KbdTableDataMgr::getInstance()->executeOnly(listSql)) + return false; return true; } @@ -909,8 +850,6 @@ bool KbdUpdatePsc3000Dlg::UpdateConstPoints(QString devId, QString fesDevTag) setFesPoints.insert(listPoint); } - if (m_operType == EoperType::OPER_ADD_REMOVE) - { //删除pcs3000中不存在的定值点 QSet setDeletePoints = setFesPoints - setPcsPoints; sql = "DELETE FROM fes_const WHERE GROUP_NO = '%1' AND SEQ_NO = '%2';"; @@ -919,39 +858,31 @@ bool KbdUpdatePsc3000Dlg::UpdateConstPoints(QString devId, QString fesDevTag) listSql << sql.arg(iter->at(0)).arg(iter->at(1)); if(!KbdTableDataMgr::getInstance()->executeOnly(listSql)) return false; - } - if (m_operType == EoperType::OPER_UPDATE) + //更新PCS3000中属性被修改的点 + if(KbdTableDataMgr::getInstance()->getDbPara().getDbType() == iot_dbms::DB_MYSQL) { - //更新PCS3000中属性被修改的点 - if(KbdTableDataMgr::getInstance()->getDbPara().getDbType() == iot_dbms::DB_MYSQL) - { - sql = "UPDATE psc3000_const t1,fes_const t2 SET t2.DESCRIPTION = t1.DESCRIPTION,\ - t2.VALUE_RATIO = t1.RATIO,t2.VALUE_ADDED = t1.REVISE,t2.VALUE_TEXT = t1.VALUE_TEXT,\ - t2.DZ_SEQ = t1.DZ_SEQ WHERE t1.GROUP_NO = t2.GROUP_NO AND t1.SEQ_NO = t2.SEQ_NO AND \ - t1.DEV_ID = '%1' AND t2.DEV_TAG = '%2';"; - } - else - { - sql = "UPDATE fes_const SET DESCRIPTION = psc3000_const.DESCRIPTION,\ - VALUE_RATIO = psc3000_const.RATIO,VALUE_ADDED = psc3000_const.REVISE,VALUE_TEXT = psc3000_const.VALUE_TEXT,\ - DZ_SEQ = psc3000_const.DZ_SEQ from psc3000_const WHERE psc3000_const.GROUP_NO = fes_const.GROUP_NO AND psc3000_const.SEQ_NO = fes_const.SEQ_NO AND \ - psc3000_const.DEV_ID = '%1' AND fes_const.DEV_TAG = '%2';"; - } - - if(!KbdTableDataMgr::getInstance()->executeOnly(sql.arg(devId).arg(fesDevTag))) - return false; + sql = "UPDATE psc3000_const t1,fes_const t2 SET t2.DESCRIPTION = t1.DESCRIPTION,\ + t2.VALUE_RATIO = t1.RATIO,t2.VALUE_ADDED = t1.REVISE,t2.VALUE_TEXT = t1.VALUE_TEXT,\ + t2.DZ_SEQ = t1.DZ_SEQ WHERE t1.GROUP_NO = t2.GROUP_NO AND t1.SEQ_NO = t2.SEQ_NO AND \ + t1.DEV_ID = '%1' AND t2.DEV_TAG = '%2';"; } - - if (m_operType == EoperType::OPER_UPDATE) + else { - //添加前置中不存在的定值点 - QSet setAddPoints = setPcsPoints - setFesPoints; - if (setAddPoints.isEmpty()) - return true; - return addFesConstPoints(setAddPoints.toList(),fesDevTag); + sql = "UPDATE fes_const SET DESCRIPTION = psc3000_const.DESCRIPTION,\ + VALUE_RATIO = psc3000_const.RATIO,VALUE_ADDED = psc3000_const.REVISE,VALUE_TEXT = psc3000_const.VALUE_TEXT,\ + DZ_SEQ = psc3000_const.DZ_SEQ from psc3000_const WHERE psc3000_const.GROUP_NO = fes_const.GROUP_NO AND psc3000_const.SEQ_NO = fes_const.SEQ_NO AND \ + psc3000_const.DEV_ID = '%1' AND fes_const.DEV_TAG = '%2';"; } - return true; + + if(!KbdTableDataMgr::getInstance()->executeOnly(sql.arg(devId).arg(fesDevTag))) + return false; + + //添加前置中不存在的定值点 + QSet setAddPoints = setPcsPoints - setFesPoints; + if (setAddPoints.isEmpty()) + return true; + return addFesConstPoints(setAddPoints.toList(),fesDevTag); } bool KbdUpdatePsc3000Dlg::addDigitalCtrlPoints(QList listPcsData,QString devId,QString fesDevTag) @@ -1567,12 +1498,11 @@ void KbdUpdatePsc3000Dlg::onSelectOver() void KbdUpdatePsc3000Dlg::onMsg(const QString &msg) { - QMessageBox::information(this,tr("消息"),msg); + N_MessageBox::information(this,tr("消息"),msg); } void KbdUpdatePsc3000Dlg::accept() { - if(!checkCfgInfo()) return; getCfgIfo(); @@ -1595,7 +1525,7 @@ void KbdUpdatePsc3000Dlg::accept() } onMsg(tr("更新成功")); - QDialog::accept(); + CustomDialog::accept(); } diff --git a/platform/src/tools/model_plugin/FESWidget/kbdupdatepsc3000dlg.h b/platform/src/tools/model_plugin/FESWidget/kbdupdatepsc3000dlg.h index 767da12f..abe1c9ae 100644 --- a/platform/src/tools/model_plugin/FESWidget/kbdupdatepsc3000dlg.h +++ b/platform/src/tools/model_plugin/FESWidget/kbdupdatepsc3000dlg.h @@ -1,25 +1,19 @@ #ifndef KBDUPDATEPSC3000DLG_H #define KBDUPDATEPSC3000DLG_H -#include #include #include #include "xlsxdocument.h" +#include "pub_widget/CustomDialog.h" + class QTableWidget; class QComboBox; - -enum EoperType -{ - OPER_UPDATE = 2, - OPER_ADD_REMOVE = 3, -}; - -class KbdUpdatePsc3000Dlg : public QDialog +class KbdUpdatePsc3000Dlg : public CustomDialog { Q_OBJECT public: - explicit KbdUpdatePsc3000Dlg(const QString & rtuTag,int operType,QWidget *parent = nullptr); + explicit KbdUpdatePsc3000Dlg(const QString & rtuTag, QWidget *parent = nullptr); QString openPsc3000File(const QString &csvFile); private: @@ -68,7 +62,6 @@ private: QString m_subsystemId; QString m_rtuNo; QString m_rtuTag; - QString m_operType; //2:更新设备点属性 3:增删设备点 QXlsx::Document* m_xlsx; QMap m_mapPcsDev; QMap m_mapFesDev; diff --git a/platform/src/tools/model_plugin/SystemConfigWizard/SystemConfigWizard.pro b/platform/src/tools/model_plugin/SystemConfigWizard/SystemConfigWizard.pro index bd9b437b..6a29d8f8 100644 --- a/platform/src/tools/model_plugin/SystemConfigWizard/SystemConfigWizard.pro +++ b/platform/src/tools/model_plugin/SystemConfigWizard/SystemConfigWizard.pro @@ -39,6 +39,7 @@ INCLUDEPATH += $$PWD\ LIBS += -lmodel_common LIBS += -lmodel_table +LIBS += -lpub_widget HEADERS += \ systemconfigpluginwidget.h \ diff --git a/platform/src/tools/model_plugin/SystemConfigWizard/systemconfigpluginwidget.h b/platform/src/tools/model_plugin/SystemConfigWizard/systemconfigpluginwidget.h index c567cdd7..ce3a160b 100644 --- a/platform/src/tools/model_plugin/SystemConfigWizard/systemconfigpluginwidget.h +++ b/platform/src/tools/model_plugin/SystemConfigWizard/systemconfigpluginwidget.h @@ -7,7 +7,7 @@ class SystemConfigPluginWidget : public QObject, public CPluginWidgetInterface { Q_OBJECT - Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0") + Q_PLUGIN_METADATA(IID HMI_WidgetPlugin_IID) Q_INTERFACES(CPluginWidgetInterface) public: diff --git a/platform/src/tools/model_plugin/SystemConfigWizard/systemconfigwizard.cpp b/platform/src/tools/model_plugin/SystemConfigWizard/systemconfigwizard.cpp index a5ac765a..ad53b7aa 100644 --- a/platform/src/tools/model_plugin/SystemConfigWizard/systemconfigwizard.cpp +++ b/platform/src/tools/model_plugin/SystemConfigWizard/systemconfigwizard.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" #include #include #include @@ -690,13 +690,13 @@ void SystemConfigWizard::onAddDbNodeData() QTableWidgetItem* item = new QTableWidgetItem("2:MySQL"); m_tableDbNode->setItem(nCount,2,item); - item = new QTableWidgetItem("iscs6000"); + item = new QTableWidgetItem(EMS_DEFAULT_DATABASE); m_tableDbNode->setItem(nCount,3,item); item = new QTableWidgetItem("root"); m_tableDbNode->setItem(nCount,4,item); - item = new QTableWidgetItem("kbdct@0755"); + item = new QTableWidgetItem(EMS_DEFAULT_PASSWD); m_tableDbNode->setItem(nCount,5,item); item = new QTableWidgetItem("3306"); @@ -972,8 +972,8 @@ void SystemConfigWizard::writeConfigToDb() if(success) { onMsg(tr("配置成功")); - int nRtn = QMessageBox::information(this,tr("消息"),tr("是否导出全部配置?"),QMessageBox::Yes,QMessageBox::No); - if(nRtn == QMessageBox::Yes) + int nRtn = N_MessageBox::information(this,tr("消息"),tr("是否导出全部配置?"),N_MessageBox::Yes,N_MessageBox::No); + if(nRtn == N_MessageBox::Yes) { if(configExportAll()) onMsg(tr("导出成功")); @@ -1103,8 +1103,8 @@ bool SystemConfigWizard::createStation() { QStringList cfgInfo; cfgInfo << m_tableLocation->item(i,0)->text(); - cfgInfo << m_tableLocation->item(i,1)->text(); - cfgInfo << m_tableLocation->item(i,2)->text(); + cfgInfo << m_tableLocation->item(i,1)->text().replace("'", "''"); + cfgInfo << m_tableLocation->item(i,2)->text().replace("'", "''"); cfgInfo << "1"; cfgInfo << m_tableLocation->item(i,0)->text(); listLocation << "('" + cfgInfo.join("','") + "')"; @@ -1317,7 +1317,7 @@ bool SystemConfigWizard::createDbDomain() void SystemConfigWizard::onMsg(const QString &text) { - QMessageBox::information(this,tr("消息"),text); + N_MessageBox::information(this,tr("消息"),text); } CboxDelegate::CboxDelegate(QList listBoxData,QObject *parent) : QItemDelegate(parent) diff --git a/platform/src/tools/model_plugin/TempPlugin/TempPlugin.pro b/platform/src/tools/model_plugin/TempPlugin/TempPlugin.pro index 5bec20ab..85313b94 100644 --- a/platform/src/tools/model_plugin/TempPlugin/TempPlugin.pro +++ b/platform/src/tools/model_plugin/TempPlugin/TempPlugin.pro @@ -79,4 +79,4 @@ HEADERS += \ LIBS += -lmodel_common -llog4cplus -lpub_logger_api LIBS += -lmodel_table -lboost_system -lpub_utility_api LIBS += -lmodel_excel - +LIBS += -lpub_widget diff --git a/platform/src/tools/model_plugin/TempPlugin/editrelationdlg.cpp b/platform/src/tools/model_plugin/TempPlugin/editrelationdlg.cpp index b6dde984..2d4ba8d9 100644 --- a/platform/src/tools/model_plugin/TempPlugin/editrelationdlg.cpp +++ b/platform/src/tools/model_plugin/TempPlugin/editrelationdlg.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" #include #include "../model_common/common.h" #include @@ -26,7 +26,7 @@ void EditRelationDlg::initLayout() QWidget *widget = new QWidget(this); QLabel *label = new QLabel(widget); label->setText(tr("点类型:")); - label->setMaximumWidth(50); + label->setMaximumWidth(70); m_comboBox = new QComboBox(widget); m_comboBox->setView(new QListView); m_buttonAdd = new QPushButton(widget); @@ -38,7 +38,7 @@ void EditRelationDlg::initLayout() m_buttonAccept->setText(tr("确定")); m_buttonCancel = new QPushButton(widget); m_buttonCancel->setText(tr("取消")); - widget->setMinimumWidth(400); + widget->setMinimumWidth(500); widget->setMinimumHeight(400); QGridLayout *layout = new QGridLayout; layout->addWidget(label,0,0,1,1); @@ -49,6 +49,10 @@ void EditRelationDlg::initLayout() layout->addWidget(m_buttonAccept,2,2,1,1); layout->addWidget(m_buttonCancel,2,3,1,1); widget->setLayout(layout); + + QHBoxLayout *hMain = new QHBoxLayout; + hMain->addWidget(widget); + setLayout(hMain); } void EditRelationDlg::initConnect() @@ -130,7 +134,7 @@ bool EditRelationDlg::checkData() QString itemStr = item->text().trimmed(); if(itemStr.isEmpty()) { - QMessageBox::warning(this,tr("警告"),tr("不允许表格为空!")); + N_MessageBox::warning(this,tr("警告"),tr("不允许表格为空!")); return false; } @@ -138,7 +142,7 @@ bool EditRelationDlg::checkData() { if(backFlag.contains(itemStr)) { - QMessageBox::warning(this,tr("警告"),tr("后台标志不允许重复!")); + N_MessageBox::warning(this,tr("警告"),tr("后台标志不允许重复!")); return false; } backFlag.append(itemStr); @@ -219,10 +223,10 @@ void EditRelationDlg::onAcceptClicked() file.write(m_json.toJson()); file.close(); - QDialog::accept(); + CustomDialog::accept(); } void EditRelationDlg::onCancelClicked() { - QDialog::close(); + CustomDialog::close(); } diff --git a/platform/src/tools/model_plugin/TempPlugin/editrelationdlg.h b/platform/src/tools/model_plugin/TempPlugin/editrelationdlg.h index c298c83f..7c363f7f 100644 --- a/platform/src/tools/model_plugin/TempPlugin/editrelationdlg.h +++ b/platform/src/tools/model_plugin/TempPlugin/editrelationdlg.h @@ -1,9 +1,10 @@ -#ifndef EDITRELATIONDLG_H +#ifndef EDITRELATIONDLG_H #define EDITRELATIONDLG_H -#include + #include #include #include +#include "pub_widget/CustomDialog.h" class QComboBox; @@ -18,7 +19,7 @@ enum pointType MIX_CTRL = 6 }; -class EditRelationDlg : public QDialog +class EditRelationDlg : public CustomDialog { Q_OBJECT diff --git a/platform/src/tools/model_plugin/TempPlugin/festempwidget.cpp b/platform/src/tools/model_plugin/TempPlugin/festempwidget.cpp index 48d2ec62..11b563d1 100644 --- a/platform/src/tools/model_plugin/TempPlugin/festempwidget.cpp +++ b/platform/src/tools/model_plugin/TempPlugin/festempwidget.cpp @@ -1,2097 +1,2124 @@ -#include "festempwidget.h" -#include -#include -#include "kbdtable.h" -#include "../model_common/common.h" -#include -#include -#include -#include "kbdtabledatamgr.h" -#include "kbdtablemodel.h" -#include "kbdpropertydlg.h" -#include "kbdpropertypanel.h" -#include "kbdmsgcontrl.h" -#include "kbddbdesign.h" -#include -#include "kbdcsvreader.h" -#include -#include "../FESWidget/kbdbatchfesdevdlg.h" -#include "kbdfestempdlg.h" -#include "kbdfesdevlistdlg.h" -#include "kbdfestemppointmodifydlg.h" -#include "kbdtableproperty.h" - -//TAB标签页 -#define TAB_FES_ACCUNL getTabDesc(1) -#define TAB_FES_ANALOG getTabDesc(2) -#define TAB_FES_DIGITAL getTabDesc(3) -#define TAB_FES_MIX getTabDesc(4) -#define TAB_FES_ANALOG_CTRL getTabDesc(5) -#define TAB_FES_DIGITAL_CTRL getTabDesc(6) -#define TAB_FES_MIX_CTRL getTabDesc(7) -#define TAB_FES_DATA_BLOCK getTabDesc(8) -#define TAB_FES_CONST getTabDesc(9) - -#define SN_FES_DEV_TEMP getSheetName(1) -#define SN_FES_ACC getSheetName(2) -#define SN_FES_ANA getSheetName(3) -#define SN_FES_DIG getSheetName(4) -#define SN_FES_MIX getSheetName(5) -#define SN_FES_ANA_CTL getSheetName(6) -#define SN_FES_DIG_CTL getSheetName(7) -#define SN_FES_MIX_CTL getSheetName(8) -#define SN_FES_DATA_BLOCK getSheetName(9) -#define SN_FES_CONST getSheetName(10) - -#define FES_DEV_MIX_TEMP_DEF "FES_DEV_MIX_TEMP_DEF.xml" -#define FES_DEV_MIX_CTRL_TEMP_DEF "FES_DEV_MIX_CTRL_TEMP_DEF.xml" -#define FES_DEV_DIGITAL_TEMP_DEF "FES_DEV_DIGITAL_TEMP_DEF.xml" -#define FES_DEV_DIGITAL_CTRL_TEMP_DEF "FES_DEV_DIGITAL_CTRL_TEMP_DEF.xml" -#define FES_DEV_ANALOG_TEMP_DEF "FES_DEV_ANALOG_TEMP_DEF.xml" -#define FES_DEV_ANALOG_CTRL_TEMP_DEF "FES_DEV_ANALOG_CTRL_TEMP_DEF.xml" -#define FES_DEV_ACCUNL_TEMP_DEF "FES_DEV_ACCUNL_TEMP_DEF.xml" - -FesTempWidget::FesTempWidget(QWidget *parent) : KbdWidget(parent) -{ - m_listTemp = NULL; - m_listTempPlugin = NULL; - initLayout(); - initMenu(); - initData(); -} - -void FesTempWidget::setFesTempList(QListWidget *list) -{ - Q_ASSERT(list != NULL); - m_listTemp = list; -} - -void FesTempWidget::setFesTempListPlugin(QListWidget *list) -{ - Q_ASSERT(list != NULL); - m_listTempPlugin = list; -} - -bool FesTempWidget::tableHasFocus() -{ - return m_tableTempPoint->getTable()->hasFocus(); -} - -QString FesTempWidget::importPcs3000Temp(const QString &filePath, const QString &subSystem, const QString &devTypeId, bool startTransaction) -{ - KbdCSVReader csvReader; - QString xlsxFilePath; - - QString msg = csvReader.convertToFesTemp(Common::getTreePath("pcs3000ToFes.json"), - filePath, - subSystem,devTypeId,xlsxFilePath); - - if(!msg.isEmpty()) - return msg; - - return importFesTemp(xlsxFilePath,startTransaction); -} - -void FesTempWidget::initLayout() -{ - QToolBar *bar = new QToolBar(this); - m_tabTempPoint = new QTabBar(this); - m_tableTempPoint = new kbdtableproperty(this); - m_tableTempPoint->getTable()->useDefineMenu(); - m_tableTempPoint->getTable()->addMenuAction(tr("属性同步至实例设备"),this,SLOT(onBatchModifyProperty())); - - bar->setIconSize(QSize(24,24)); - bar->addAction(QIcon(":/icons/icons/new.png"),tr("添加记录"),this,SLOT(onAddTempPoint())); - bar->addAction(QIcon(":/icons/icons/modify.png"),tr("修改"),this,SLOT(onModifyTempPoint())); - bar->addAction(QIcon(":/icons/icons/copy.png"),tr("复制点"),this,SLOT(onCopyTempPoint())); - bar->addSeparator(); - bar->addAction(QIcon(":/icons/icons/delete.png"),tr("删除记录"),this,SLOT(onRemoveTempPoint())); - bar->addSeparator(); - bar->addAction(QIcon(":/icons/icons/Excel-export.png"),tr("Excel导出"),m_tableTempPoint->getTable(),SLOT(onExcelExport())); - bar->addAction(QIcon(":/icons/icons/Excel-Impor.png"),tr("Excel导入"),m_tableTempPoint->getTable(),SLOT(onImportExcel())); - bar->addSeparator(); - bar->addAction(tr("操作应用至前置设备"),this,SLOT(onShowApplyOpMenu())); - - m_tabTempPoint->setExpanding(false); - m_tabTempPoint->addTab(TAB_FES_ANALOG); - m_tabTempPoint->addTab(TAB_FES_DIGITAL); - m_tabTempPoint->addTab(TAB_FES_ACCUNL); - m_tabTempPoint->addTab(TAB_FES_MIX); - m_tabTempPoint->addTab(TAB_FES_DIGITAL_CTRL); - m_tabTempPoint->addTab(TAB_FES_ANALOG_CTRL); - m_tabTempPoint->addTab(TAB_FES_MIX_CTRL); - m_tabTempPoint->addTab(TAB_FES_CONST); - m_tabTempPoint->addTab(TAB_FES_DATA_BLOCK); - - QGroupBox *box = new QGroupBox(tr("模板点列表"),this); - QVBoxLayout *vLayout1 = new QVBoxLayout; - QVBoxLayout *vLayout2 = new QVBoxLayout; - vLayout1->addWidget(bar); - vLayout2->addWidget(m_tabTempPoint); - vLayout2->addWidget(m_tableTempPoint); - vLayout2->setSpacing(0); - box->setLayout(vLayout2); - vLayout1->addWidget(box); - vLayout1->setMargin(0); - setLayout(vLayout1); -} - -void FesTempWidget::initMenu() -{ - m_menuApplyOp = new QMenu(this); - m_menuApplyOp->addAction(tr("添加应用至前置设备"),this,SLOT(onApplyAddToDev())); - m_menuApplyOp->addAction(tr("删除应用至前置设备"),this,SLOT(onApplyRemoveToDev())); -} - -void FesTempWidget::initData() -{ - connect(m_tabTempPoint,SIGNAL(currentChanged(int)),this,SLOT(onTabTempPointChanged(int))); - connect(m_tableTempPoint->getTable(),SIGNAL(doubleClicked(const QModelIndex &)),this,SLOT(onModifyTempPoint())); -} - -QString FesTempWidget::getTabDesc(int tabNum) -{ - QString desc; - switch (tabNum) { - case 1: - desc = tr("累积量"); - break; - case 2: - desc = tr("模拟量"); - break; - case 3: - desc = tr("数字量"); - break; - case 4: - desc = tr("混合量"); - break; - case 5: - desc = tr("模拟量控制"); - break; - case 6: - desc = tr("数字量控制"); - break; - case 7: - desc = tr("混合量控制"); - break; - case 8: - desc = tr("数据块"); - break; - case 9: - desc = tr("保护定值"); - break; - default: - break; - } - - return desc; -} - -QString FesTempWidget::getTempPointType(const QString &tabText) -{ - QString ptType; - if(tabText == TAB_FES_ACCUNL) - { - ptType = Common::getFesPointTempType(Common::FES_ACCUML_TEMP); - } - else if(tabText == TAB_FES_ANALOG) - { - ptType = Common::getFesPointTempType(Common::FES_ANALOG_TEMP); - } - else if(tabText == TAB_FES_DIGITAL) - { - ptType = Common::getFesPointTempType(Common::FES_DIGITAL_TEMP); - } - else if(tabText == TAB_FES_MIX) - { - ptType = Common::getFesPointTempType(Common::FES_MIX_TEMP); - } - else if(tabText == TAB_FES_MIX_CTRL) - { - ptType = Common::getFesPointTempType(Common::FES_MIX_CTRL_TEMP); - } - else if(tabText == TAB_FES_ANALOG_CTRL) - { - ptType = Common::getFesPointTempType(Common::FES_ANALOG_CTRL_TEMP); - } - else if(tabText == TAB_FES_DIGITAL_CTRL) - { - ptType = Common::getFesPointTempType(Common::FES_DIGITAL_CTRL_TEMP); - } - return ptType; -} - -QString FesTempWidget::getPointTableName(const QString tabText) -{ - QString ptTableName; - if(tabText == TAB_FES_ACCUNL) - { - ptTableName = FES_DEV_ACCUNL_TEMP_DEF; - } - else if(tabText == TAB_FES_ANALOG) - { - ptTableName = FES_DEV_ANALOG_TEMP_DEF; - } - else if(tabText == TAB_FES_DIGITAL) - { - ptTableName = FES_DEV_DIGITAL_TEMP_DEF; - } - else if(tabText == TAB_FES_MIX) - { - ptTableName = FES_DEV_MIX_TEMP_DEF; - } - else if(tabText == TAB_FES_MIX_CTRL) - { - ptTableName = FES_DEV_MIX_CTRL_TEMP_DEF; - } - else if(tabText == TAB_FES_ANALOG_CTRL) - { - ptTableName = FES_DEV_ANALOG_CTRL_TEMP_DEF; - } - else if(tabText == TAB_FES_DIGITAL_CTRL) - { - ptTableName = FES_DEV_DIGITAL_CTRL_TEMP_DEF; - } - return ptTableName; -} - -QListWidgetItem *FesTempWidget::addListWidgetItem(QListWidget *listWidget, const QString &desc, const QString &tag) -{ - QListWidgetItem *item = new QListWidgetItem(desc); - item->setData(Qt::UserRole,tag); - listWidget->addItem(item); - return item; -} - -QListWidgetItem *FesTempWidget::findItem(QListWidget *list, const QString &tag) -{ - for(int i = 0; i < list->count(); i++) - { - if(list->item(i)->data(Qt::UserRole).toString() == tag) - return list->item(i); - } - - return NULL; -} - -void FesTempWidget::deleteListWidgetItem(QListWidget *listWidget, QList items) -{ - if(listWidget == NULL) - return; - - QList rows; - foreach (QListWidgetItem *it, items) { - rows << listWidget->row(it); - } - - if(rows.isEmpty()) - return; - //排序,升序,行号越大越靠后 - std::sort(rows.begin(),rows.end()); - - //从后面往前删除 - QList deleteItems; - for(int i = rows.size()-1;i >= 0;i--) - { - deleteItems << listWidget->takeItem(rows.at(i)); - } - - qDeleteAll(deleteItems); -} - -void FesTempWidget::reloadList(QListWidget *list, QList items) -{ - if(list == NULL) - return; - list->clear(); - foreach (QListWidgetItem *item, items) { - list->addItem(item); - } -} - -QString FesTempWidget::getSheetName(int sheetNum) -{ - QString desc; - switch (sheetNum) { - case 1: - desc = tr("前置设备模板"); - break; - case 2: - desc = tr("累积量模板点"); - break; - case 3: - desc = tr("模拟量模板点"); - break; - case 4: - desc = tr("数字量模板点"); - break; - case 5: - desc = tr("混合量模板点"); - break; - case 6: - desc = tr("模拟量控制点"); - break; - case 7: - desc = tr("数字量控制点"); - break; - case 8: - desc = tr("混合量控制点"); - break; - case 9: - desc = tr("数据块"); - break; - case 10: - desc = tr("保护定值"); - break; - default: - break; - } - - return desc; -} - -QString FesTempWidget::exportFesTempPoint(QXlsx::Document &xlsx, Common::FesPtTempType type, - const QString &sheetName,const QString &tempTagName) -{ - QString filter = QString("%1='%2' AND %3='%4' ORDER BY SEQ_NO").arg(CN_DEV_TP_NAME).arg(tempTagName) - .arg(CN_POINT_TYPE).arg(Common::getFesPointTempType(type)); - KbdTableModel * model = KbdTableDataMgr::getInstance()->createModel(Common::createViewName( - TBL_FES_DEV_PT_TEMP_DEF,filter)); - if(model == NULL) - return tr("导出%1不成功").arg(sheetName); - - return model->exportExcel(xlsx,sheetName); - -} - -QString FesTempWidget::exportFesDataBlockTemp(QXlsx::Document &xlsx, const QString &sheetName, const QString &tempTagName) -{ - QString filter = QString("%1='%2' ORDER BY BLOCK_ID").arg(CN_DEV_TP_NAME).arg(tempTagName); - KbdTableModel * model = KbdTableDataMgr::getInstance()->createModel(Common::createViewName( - TBL_FES_DATA_BLOCK_TEMP,filter)); - if(model == NULL) - return tr("导出%1不成功").arg(sheetName); - - return model->exportExcel(xlsx,sheetName); -} - -QString FesTempWidget::exportFesConstTemp(QXlsx::Document &xlsx, const QString &sheetName, const QString &tempTagName) -{ - QString filter = QString("%1='%2' ORDER BY SEQ_NO").arg(CN_DEV_TP_NAME).arg(tempTagName); - KbdTableModel * model = KbdTableDataMgr::getInstance()->createModel(Common::createViewName( - TBL_FES_CONST_TEMP,filter)); - if(model == NULL) - return tr("导出%1不成功").arg(sheetName); - - return model->exportExcel(xlsx,sheetName); -} - -QString FesTempWidget::afterExportFesTemp(QXlsx::Document &xlsx) -{ - QString err; - err = err + KbdModelExcelFun::removeSheetColumn(xlsx,SN_FES_ACC,CN_DEV_TP_NAME); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::removeSheetColumn(xlsx,SN_FES_ANA,CN_DEV_TP_NAME); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::removeSheetColumn(xlsx,SN_FES_DIG,CN_DEV_TP_NAME); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::removeSheetColumn(xlsx,SN_FES_MIX,CN_DEV_TP_NAME); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::removeSheetColumn(xlsx,SN_FES_ANA_CTL,CN_DEV_TP_NAME); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::removeSheetColumn(xlsx,SN_FES_DIG_CTL,CN_DEV_TP_NAME); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::removeSheetColumn(xlsx,SN_FES_MIX_CTL,CN_DEV_TP_NAME); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::removeSheetColumn(xlsx,SN_FES_CONST,CN_DEV_TP_NAME); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::removeSheetColumn(xlsx,SN_FES_DATA_BLOCK,CN_DEV_TP_NAME); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::removeColumnLastDot(xlsx,SN_FES_ACC,CN_TAG_NAME); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::removeColumnLastDot(xlsx,SN_FES_ANA,CN_TAG_NAME); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::removeColumnLastDot(xlsx,SN_FES_DIG,CN_TAG_NAME); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::removeColumnLastDot(xlsx,SN_FES_MIX,CN_TAG_NAME); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::removeColumnLastDot(xlsx,SN_FES_ANA_CTL,CN_TAG_NAME); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::removeColumnLastDot(xlsx,SN_FES_DIG_CTL,CN_TAG_NAME); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::removeColumnLastDot(xlsx,SN_FES_MIX_CTL,CN_TAG_NAME); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::removeColumnLastDot(xlsx,SN_FES_CONST,CN_TAG_NAME); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::removeColumnLastDot(xlsx,SN_FES_DATA_BLOCK,CN_TAG_NAME); - if(!err.isEmpty()) - return err; - - return err; -} - -QString FesTempWidget::importFesTemp(const QString &filePath, bool startTransaction) -{ - QFile file(filePath); - if(!file.open(QIODevice::ReadOnly)) - return tr("文件打开不成功!"); - - QXlsx::Document xlsx(&file); - QString error; - error = befortImportFesTemp(xlsx); - - if(!error.isEmpty()) - return error; - - if(startTransaction) - { - //开启事务,调用存储过程 - QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); - if(retStr.isEmpty()) - { - KbdTableDataMgr::getInstance()->beginBatch(); - if(error.isEmpty()) - error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_DEV_TEMP,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_TEMP_DEF)); - if(error.isEmpty()) - error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_ACC,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); - if(error.isEmpty()) - error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_ANA,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); - if(error.isEmpty()) - error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_DIG,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); - if(error.isEmpty()) - error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_MIX,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); - if(error.isEmpty()) - error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_ANA_CTL,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); - if(error.isEmpty()) - error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_DIG_CTL,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); - if(error.isEmpty()) - error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_MIX_CTL,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); - if(error.isEmpty()) - error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_DATA_BLOCK,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DATA_BLOCK_TEMP)); - if(error.isEmpty()) - error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_CONST,KbdTableDataMgr::getInstance()->createModel(TBL_FES_CONST_TEMP)); - - KbdTableDataMgr::getInstance()->endBatch(); - - //由于以上操作,有可能有非数据库操作导致的失败,比如文件打不开等,这里判断是否有错误,有错误则强制回滚事务 - if(!error.isEmpty()) - { - KbdTableDataMgr::getInstance()->resetTransactionExe(false); - } - if(!KbdTableDataMgr::getInstance()->commit()) - error = tr("导入失败!事务已回滚!原因:")+error; - } - else - error = tr("导入失败!原因:事务开启失败"); - - } - else - { - KbdTableDataMgr::getInstance()->beginBatch(); - if(error.isEmpty()) - { - error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_DEV_TEMP,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_TEMP_DEF)); - } - if(error.isEmpty()) - { - error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_ACC,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); - } - if(error.isEmpty()) - { - error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_ANA,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); - } - if(error.isEmpty()) - { - error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_DIG,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); - } - if(error.isEmpty()) - { - error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_MIX,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); - } - if(error.isEmpty()) - { - error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_ANA_CTL,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); - } - if(error.isEmpty()) - { - error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_DIG_CTL,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); - } - if(error.isEmpty()) - { - error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_MIX_CTL,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); - } - if(error.isEmpty()) - { - error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_DATA_BLOCK,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DATA_BLOCK_TEMP)); - } - if(error.isEmpty()) - { - error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_CONST,KbdTableDataMgr::getInstance()->createModel(TBL_FES_CONST_TEMP)); - } - - KbdTableDataMgr::getInstance()->endBatch(); - //由于以上操作,有可能有非数据库操作导致的失败,比如文件打不开等,这里判断是否有错误,有错误则强制回滚事务 - // if(!error.isEmpty()) - // { - // KbdTableDataMgr::getInstance()->resetTransactionExe(false); - // } - - } - - - return error; -} - -QString FesTempWidget::befortImportFesTemp(QXlsx::Document &xlsx) -{ - //在导入前置模板之前的一些工作,比如增加设备模板名 - if(!xlsx.selectSheet(SN_FES_DEV_TEMP)) - return tr("excel文件中没有%1表").arg(SN_FES_DEV_TEMP); - - int col = KbdModelExcelFun::findXlsxColumn(xlsx,CN_TAG_NAME); - if(col < 0) - return tr("表格%1中没有%2列").arg(SN_FES_DEV_TEMP).arg(CN_TAG_NAME); - //获取模板名 - QString devTagName = xlsx.read(3,col).toString(); - if(devTagName.isEmpty()) - return tr("设备模板名为空!"); - - int colDesc = KbdModelExcelFun::findXlsxColumn(xlsx,CN_DESC); - if(colDesc < 0) - return tr("表格%1中没有%2列").arg(SN_FES_DEV_TEMP).arg(CN_DESC); - - QString devDesc = xlsx.read(3,colDesc).toString(); - KbdDbDesign ds; - bool hasTemp = false; - QString sql = QString("SELECT * FROM FES_DEV_TEMP_DEF WHERE TAG_NAME = '%1'").arg(devTagName); - ds.isExist(sql,hasTemp); - if(hasTemp) - { -// if(QMessageBox::Yes == QMessageBox::information(this,tr("消息"), -// tr("存在同名模板%1,是否修改模板标签名?").arg(devTagName), -// QMessageBox::Yes,QMessageBox::No)) -// { -// KbdPropertyDlg dlg(false); -// KbdTableModel *model = KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_TEMP_DEF); -// if(model == NULL) -// return tr("缺失模板xml配置"); - -// QList showCols; -// showCols << modelCols.findCol(CN_TAG_NAME) <setDisplayRow(model,model->rowCount(),QMap>(),showCols); -// dlg.panel()->setPropertyValue(CN_DEV_TYPE_ID,"4");//随便添加一些值,让检查通过就行 - -// dlg.setWindowTitle(tr("请输入新的模板名称和描述")); -// if(dlg.exec()) -// { -// QStringList rowDatas = dlg.panel()->getPropertyData(); -// devTagName = rowDatas.at(modelCols.findCol(CN_TAG_NAME)); -// devDesc = rowDatas.at(modelCols.findCol(CN_DESC)); -// } -// else -// return tr("存在同名模板%1,无法导入").arg(devTagName); -// } -// else - return tr("存在同名模板%1,无法导入").arg(devTagName); - } - - if(!xlsx.write(3,col,devTagName)) - return tr("写入TAG_NAME失败"); - - if(!xlsx.write(3,colDesc,devDesc)) - return tr("写入设备描述失败"); - - QString err; - err = err + KbdModelExcelFun::addColumnLastDot(xlsx,SN_FES_ACC,CN_TAG_NAME,devTagName); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::addColumnLastDot(xlsx,SN_FES_ANA,CN_TAG_NAME,devTagName); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::addColumnLastDot(xlsx,SN_FES_DIG,CN_TAG_NAME,devTagName); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::addColumnLastDot(xlsx,SN_FES_MIX,CN_TAG_NAME,devTagName); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::addColumnLastDot(xlsx,SN_FES_ANA_CTL,CN_TAG_NAME,devTagName); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::addColumnLastDot(xlsx,SN_FES_DIG_CTL,CN_TAG_NAME,devTagName); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::addColumnLastDot(xlsx,SN_FES_MIX_CTL,CN_TAG_NAME,devTagName); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::addColumnLastDot(xlsx,SN_FES_CONST,CN_TAG_NAME,devTagName); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::addColumnLastDot(xlsx,SN_FES_DATA_BLOCK,CN_TAG_NAME,devTagName); - if(!err.isEmpty()) - return err; - - - //描述可以随便写 - err = err + KbdModelExcelFun::addColumnSameValue(xlsx,SN_FES_ACC,CN_DEV_TP_NAME,"DESC",devTagName); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::addColumnSameValue(xlsx,SN_FES_ANA,CN_DEV_TP_NAME,"DESC",devTagName); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::addColumnSameValue(xlsx,SN_FES_DIG,CN_DEV_TP_NAME,"DESC",devTagName); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::addColumnSameValue(xlsx,SN_FES_MIX,CN_DEV_TP_NAME,"DESC",devTagName); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::addColumnSameValue(xlsx,SN_FES_ANA_CTL,CN_DEV_TP_NAME,"DESC",devTagName); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::addColumnSameValue(xlsx,SN_FES_DIG_CTL,CN_DEV_TP_NAME,"DESC",devTagName); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::addColumnSameValue(xlsx,SN_FES_MIX_CTL,CN_DEV_TP_NAME,"DESC",devTagName); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::addColumnSameValue(xlsx,SN_FES_CONST,CN_DEV_TP_NAME,"DESC",devTagName); - if(!err.isEmpty()) - return err; - - err = err + KbdModelExcelFun::addColumnSameValue(xlsx,SN_FES_DATA_BLOCK,CN_DEV_TP_NAME,"DESC",devTagName); - if(!err.isEmpty()) - return err; - - return err; - -} - -void FesTempWidget::afterImportFesTemp(QStringList listOldFesTemp) -{ - //更新模板标签名,避免与pcs3000导入前置点时标签名冲突 - - QStringList listTagName,listDes; - KbdDbDesign ds; - ds.getTwoColumnResult("select TAG_NAME,DESCRIPTION from fes_dev_temp_def", listTagName, listDes); - - for (int i = 0; i < listTagName.size(); i++) - { - if(listOldFesTemp.contains(listTagName.at(i))) - continue; - QString sql = "UPDATE fes_dev_temp_def SET TAG_NAME = '%1' WHERE TAG_NAME = '%2';"; - sql = sql.arg("TEMP_" + listTagName[i]).arg(listTagName[i]); - KbdTableDataMgr::getInstance()->executeOnly(sql); - } -} - -QString FesTempWidget::getXlsxVaue(QXlsx::Document &xlsx, const QString &sheetName, const QString &colName, QStringList &values) -{ - if(!xlsx.selectSheet(sheetName)) - return tr("错误:没有%1表!").arg(sheetName); - - int col = KbdModelExcelFun::findXlsxColumn(xlsx,colName); - if(col < 0) - return tr("错误:没有此列%1").arg(colName); - - values.clear(); - for(int r = 3 ; r <= xlsx.currentWorksheet()->dimension().lastRow(); r++) - { - values << xlsx.read(r,col).toString(); - } - - return ""; -} - - -void FesTempWidget::onListTempItemChange() -{ - onTabTempPointChanged(m_tabTempPoint->currentIndex()); -} - -void FesTempWidget::onTabTempPointChanged(int index) -{ - if(index < 0) - return; - QModelIndex indexTemp = m_listTemp->currentIndex(); - if(!indexTemp.isValid()) - return; - if(m_tabTempPoint->tabText(index) == TAB_FES_DATA_BLOCK) - { - QString filter = QString("%1='%2'") - .arg(CN_DEV_TP_NAME).arg(indexTemp.data(Qt::UserRole).toString()); - m_tableTempPoint->getTable()->setModel(KbdTableDataMgr::getInstance()-> - createModel(Common::createViewName(TBL_FES_DATA_BLOCK_TEMP,filter))); - } - else if(m_tabTempPoint->tabText(index) == TAB_FES_CONST) - { - QString filter = QString("%1='%2'") - .arg(CN_DEV_TP_NAME).arg(indexTemp.data(Qt::UserRole).toString()); - m_tableTempPoint->getTable()->setModel(KbdTableDataMgr::getInstance()-> - createModel(Common::createViewName(TBL_FES_CONST_TEMP,filter))); - } - else - { - QString filter = QString("%1='%2' AND %3='%4' ORDER BY SEQ_NO") - .arg(CN_POINT_TYPE).arg(getTempPointType(m_tabTempPoint->tabText(index))) - .arg(CN_DEV_TP_NAME).arg(indexTemp.data(Qt::UserRole).toString()); - m_tableTempPoint->getTable()->setModel(KbdTableDataMgr::getInstance()-> - createModel(Common::createViewName(getPointTableName(m_tabTempPoint->tabText(index)),filter))); - } -} - -void FesTempWidget::onAddTempPoint() -{ - QModelIndex index = m_listTemp->currentIndex(); - if(!index.isValid()) - { - onMsg(tr("请选中要添加测点的模板!")); - return; - } - KbdTableModel *model = qobject_cast(m_tableTempPoint->getTable()->model()); - if(model == NULL) - return; - - //数据块的模板使用该函数 - if(m_tabTempPoint->tabText(m_tabTempPoint->currentIndex()) == TAB_FES_DATA_BLOCK) - { - onAddTempPointDataBlock(); - return; - } - else if(m_tabTempPoint->tabText(m_tabTempPoint->currentIndex()) == TAB_FES_CONST) - { - onAddTempPointConst(); - return; - } - - KbdPropertyDlg dlg(false,this); - dlg.panel()->setDisplayRow(model,model->rowCount()); - dlg.panel()->setDotStringPrefix(CN_TAG_NAME,index.data(Qt::UserRole).toString()); - QString ptType = getTempPointType(m_tabTempPoint->tabText(m_tabTempPoint->currentIndex())); - dlg.panel()->setPropertyValue(CN_POINT_TYPE,ptType); - dlg.panel()->setPropertyValue(CN_DEV_TP_NAME,index.data(Qt::UserRole).toString()); - //设备点序号从0开始 - if(model->rowCount() == 0) - { - dlg.panel()->setPropertyValue(CN_SEQ_NO,"0"); - } - QStringList rowDatas; - if(dlg.exec()) - { - rowDatas = dlg.panel()->getPropertyData(); - } - if(rowDatas.isEmpty()) - return; - - bool success = true; - QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); - if(retStr.isEmpty()) - { - success = model->addRow(rowDatas,true); - if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) - onCommitError(); - } - else - onStartTransactionError(retStr); - - if(!success) - { - onMsg(tr("添加失败")); - return; - } - m_tableTempPoint->getTable()->reFresh(); - KbdMsgContrl::getInstance()->showMsg(tr("添加成功"),this); -} - -void FesTempWidget::onAddTempPointDataBlock() -{ - QModelIndex index = m_listTemp->currentIndex(); - if(!index.isValid()) - { - onMsg(tr("请选中要添加测点的模板!")); - return; - } - KbdTableModel *model = qobject_cast(m_tableTempPoint->getTable()->model()); - if(model == NULL) - return; - - KbdPropertyDlg dlg(false, this); - dlg.panel()->setDisplayRow(model,model->rowCount()); - dlg.panel()->setDotStringPrefix(CN_TAG_NAME,index.data(Qt::UserRole).toString()); - dlg.panel()->setPropertyValue(CN_DEV_TP_NAME,index.data(Qt::UserRole).toString()); - - QStringList rowDatas; - if(dlg.exec()) - { - rowDatas = dlg.panel()->getPropertyData(); - } - if(rowDatas.isEmpty()) - return; - - bool success = true; - QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); - if(retStr.isEmpty()) - { - success = model->addRow(rowDatas,true); - if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) - onCommitError(); - } - else - onStartTransactionError(retStr); - - if(!success) - { - onMsg(tr("添加失败")); - return; - } - - KbdMsgContrl::getInstance()->showMsg(tr("添加成功"),this); - -} - -void FesTempWidget::onAddTempPointConst() -{ - QModelIndex index = m_listTemp->currentIndex(); - if(!index.isValid()) - { - onMsg(tr("请选中要添加测点的模板!")); - return; - } - KbdTableModel *model = qobject_cast(m_tableTempPoint->getTable()->model()); - if(model == NULL) - return; - - KbdPropertyDlg dlg(false, this); - dlg.panel()->setDisplayRow(model,model->rowCount()); - dlg.panel()->setDotStringPrefix(CN_TAG_NAME,index.data(Qt::UserRole).toString()); - dlg.panel()->setPropertyValue(CN_DEV_TP_NAME,index.data(Qt::UserRole).toString()); - - QStringList rowDatas; - if(dlg.exec()) - { - rowDatas = dlg.panel()->getPropertyData(); - } - if(rowDatas.isEmpty()) - return; - - bool success = true; - QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); - if(retStr.isEmpty()) - { - success = model->addRow(rowDatas,true); - if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) - onCommitError(); - } - else - onStartTransactionError(retStr); - - if(!success) - { - onMsg(tr("添加失败")); - return; - } - KbdMsgContrl::getInstance()->showMsg(tr("添加成功"),this); - -} - -void FesTempWidget::onModifyTempPoint() -{ - KbdTableModel *model = qobject_cast(m_tableTempPoint->getTable()->model()); - if(model == NULL) - return; - - QListWidgetItem *devTempItem = m_listTemp->currentItem(); - if(devTempItem == NULL) - { - onMsg(tr("请选中要修改的模板")); - return; - } - - QModelIndex index = m_tableTempPoint->getTable()->currentIndex(); - if(!index.isValid()) - { - onMsg(tr("请选中要修改的行")); - return; - } - - KbdFesTempPointModifyDlg dlg(devTempItem->data(Qt::UserRole).toString()); - dlg.panel()->setDisplayRow(model,index.row()); - dlg.panel()->relayoutByEditable(); - if(dlg.exec()) - { - m_tableTempPoint->getTable()->reFresh(); - } -} - -void FesTempWidget::onCopyTempPoint() -{ - QModelIndex index = m_tableTempPoint->getTable()->currentIndex(); - if(!index.isValid()) - { - onMsg(tr("请选中要复制的模板点")); - return; - } - KbdTableModel *modelPointTemp = qobject_cast(m_tableTempPoint->getTable()->model()); - if(modelPointTemp == NULL) - return; - - //数据块的模板使用该函数 - if(m_tabTempPoint->tabText(m_tabTempPoint->currentIndex()) == TAB_FES_DATA_BLOCK) - { - onCopyTempPointDataBlock(); - return; - } - - bool success = false; - QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); - if(retStr.isEmpty()) - { - QStringList rowDatas = modelPointTemp->getRowData(index.row()); - //TAG_NAME SEQ_NO DESC要修改 - const ColMgrDataList& modelPointTempCols = modelPointTemp->getHeadCols(); - //要确保TAG_NAME唯一 - int colTagName = modelPointTempCols.findCol(CN_TAG_NAME); - QString tagName = rowDatas.at(modelPointTempCols.findCol(CN_DEV_TP_NAME)) + "." + - Common::getAfterLastDot(rowDatas.at(colTagName)) + - QString::number(modelPointTemp->getMaxValue(CN_SEQ_NO) +1); - rowDatas.replace(colTagName,tagName); - - int colDesc = modelPointTempCols.findCol(CN_DESC); - rowDatas.replace(colDesc,rowDatas.at(colDesc)); - rowDatas.replace(modelPointTempCols.findCol(CN_SEQ_NO),QString::number(modelPointTemp->getMaxValue(CN_SEQ_NO) +1)); - - success = modelPointTemp->addRow(rowDatas,true); - if(!success) - onMsg(tr("复制点失败!")); - - if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) - onCommitError(); - } - else - onStartTransactionError(retStr); - - if(!success) - return; - -} - -void FesTempWidget::onCopyTempPointDataBlock() -{ - QModelIndex index = m_tableTempPoint->getTable()->currentIndex(); - if(!index.isValid()) - { - onMsg(tr("请选中要复制的模板点")); - return; - } - KbdTableModel *modelPointTemp = qobject_cast(m_tableTempPoint->getTable()->model()); - if(modelPointTemp == NULL) - return; - - bool success = false; - QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); - if(retStr.isEmpty()) - { - QStringList rowDatas = modelPointTemp->getRowData(index.row()); - const ColMgrDataList& modelPointTempCols = modelPointTemp->getHeadCols(); - //要确保TAG_NAME唯一 - int colTagName = modelPointTempCols.findCol(CN_TAG_NAME); - QString tagName = rowDatas.at(modelPointTempCols.findCol(CN_DEV_TP_NAME)) + "." + - Common::getAfterLastDot(rowDatas.at(colTagName)) + - QString::number(modelPointTemp->rowCount() +1); - rowDatas.replace(colTagName,tagName); - - success = modelPointTemp->addRow(rowDatas,true); - if(!success) - onMsg(tr("复制点失败!")); - - if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) - onCommitError(); - } - else - onStartTransactionError(retStr); - - if(!success) - return; -} - -void FesTempWidget::onRemoveTempPoint() -{ - QModelIndexList selRows = m_tableTempPoint->getTable()->selectionModel()->selectedRows(); - if(selRows.isEmpty()) - { - QMessageBox::information(this,tr("消息"),tr("请至少选择一条数据!")); - return; - } - - if(QMessageBox::No == QMessageBox::information(this,tr("消息"),tr("是否删除前置测点?"),QMessageBox::Yes,QMessageBox::No)) - return; - - KbdTableModel *model = qobject_cast(m_tableTempPoint->getTable()->model()); - if(model == NULL) - return; - QList list; - foreach (QModelIndex index, m_tableTempPoint->getTable()->selectionModel()->selectedRows()) { - list<< index.row(); - } - if(list.isEmpty()) - return; - - bool success = false; - QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); - if(retStr.isEmpty()) - { - success = model->removeTableRows(list); - if(!success) - onMsg(tr("删除失败!")); - - if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) - onCommitError(); - } - else - onStartTransactionError(retStr); - - if(!success) - return; - - KbdMsgContrl::getInstance()->showMsg(tr("删除成功"),this); -} - -void FesTempWidget::onAddDevTemp() -{ - KbdTableModel * modelDevTemp = KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_TEMP_DEF_FOR_ADD); - if(modelDevTemp == NULL) - return; - - KbdPropertyDlg dlg(true,this); - dlg.panel()->setDisplayRow(modelDevTemp,modelDevTemp->rowCount()); - - bool success = false; - QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); - if(retStr.isEmpty()) - { - - if(dlg.exec()) - { - success = true; - } - else - { - success =false; - } - - if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) - onCommitError(); - } - else - onStartTransactionError(retStr); - - if(!success) - return; - //刷新对应控件 - QStringList rowDatas = dlg.panel()->getPropertyData(); - const ColMgrDataList& modelDevTempCols = modelDevTemp->getHeadCols(); - addListWidgetItem(m_listTemp,rowDatas.at(modelDevTempCols.findCol(CN_DESC)), - rowDatas.at(modelDevTempCols.findCol(CN_TAG_NAME))); - m_tableTempPoint->getTable()->setModel(NULL); - KbdMsgContrl::getInstance()->showMsg(tr("添加成功!"),this); - -} - -void FesTempWidget::onModifyDevTemp() -{ - QModelIndex index = m_listTemp->currentIndex(); - if(!index.isValid()) - { - onMsg(tr("请选中要修改的模板")); - return; - } - QString filter = QString("%1='%2'").arg(CN_TAG_NAME).arg(index.data(Qt::UserRole).toString()); - KbdTableModel * modelDevTemp = KbdTableDataMgr::getInstance()->createModel(Common::createViewName(TBL_FES_DEV_TEMP_DEF,filter)); - if(modelDevTemp == NULL) - return; - - if(!modelDevTemp->load(true)) - return; - - if(modelDevTemp->rowCount() != 1) - { - onMsg(tr("该模板在数据库中的数据不唯一")); - return; - } - - KbdPropertyDlg dlg(true, this); - dlg.panel()->setDisplayRow(modelDevTemp,0); - dlg.panel()->relayoutByEditable(); - QStringList oldDatas = dlg.panel()->getPropertyData(); - bool success = false; - QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); - if(retStr.isEmpty()) - { - if(dlg.exec()) - { - success = true; - } - - if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) - onCommitError(); - } - else - onStartTransactionError(retStr); - - if(!success) - return; - //刷新对应控件 - QStringList newDatas = dlg.panel()->getPropertyData(); - QString oldDesc,newDesc, oldTag,newTag; - const ColMgrDataList& modelDevTempCols = modelDevTemp->getHeadCols(); - oldDesc = oldDatas.at(modelDevTempCols.findCol(CN_DESC)); - newDesc = newDatas.at(modelDevTempCols.findCol(CN_DESC)); - oldTag = oldDatas.at(modelDevTempCols.findCol(CN_TAG_NAME)); - newTag = newDatas.at(modelDevTempCols.findCol(CN_TAG_NAME)); - if(oldDesc != newDesc || oldTag != newTag) - { - QListWidgetItem *item = findItem(m_listTemp,oldTag); - if(item) - { - item->setText(newDesc); - item->setData(Qt::UserRole,newTag); - } - } - - m_tableTempPoint->getTable()->setModel(NULL); - KbdMsgContrl::getInstance()->showMsg(tr("修改成功!"),this); - -} - -void FesTempWidget::onRemoveDevTemp() -{ - if(QMessageBox::No == QMessageBox::information(this,tr("消息"),tr("是否删除前置模板?"),QMessageBox::Yes,QMessageBox::No)) - return; - - QList selectItems = m_listTemp->selectedItems(); - if(selectItems.isEmpty()) - return; - - KbdTableModel * modelDevTemp = KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_TEMP_DEF); - if(modelDevTemp == NULL) - return; - - KbdDbDesign ds; - QStringList rtuList; - foreach (QListWidgetItem *item, selectItems) { - if(!ds.isExistFesDevByTemp(item->data(Qt::UserRole).toString(),rtuList)) - { - onMsg(tr("链接数据库查询失败")); - return; - } - - if(!rtuList.isEmpty()) - { - if(QMessageBox::No == QMessageBox::information(this,tr("消息"), - tr("有以下RTU引用了模板%1:\n%2 \n 是否强制删除此模板?") - .arg(item->text()) - .arg(rtuList.join("\n")), - QMessageBox::Yes,QMessageBox::No)) - return; - } - } - - QMap filterMap; - bool success = false; - QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); - if(retStr.isEmpty()) - { - foreach (QListWidgetItem *item, selectItems) { - filterMap.clear(); - filterMap.insert(CN_TAG_NAME,item->data(Qt::UserRole).toString()); - success = modelDevTemp->removeTableRows(filterMap); - - if(!success) - { - onMsg(tr("删除失败")); - break; - } - } - - if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) - onCommitError(); - } - else - onStartTransactionError(retStr); - - if(!success) - return; - - deleteListWidgetItem(m_listTemp,selectItems); - m_tableTempPoint->getTable()->setModel(NULL); - KbdMsgContrl::getInstance()->showMsg(tr("删除设备成功"),this); - -} - -void FesTempWidget::onExportFesTemp() -{ - QModelIndex index = m_listTemp->currentIndex(); - if(!index.isValid()) - { - onMsg(tr("请选中需要导出的设备")); - return; - } - - QDir dir; - QString strDir = Common::getIscsHome() + "/data/modelstudio/fesTemplate/"; - if(!dir.exists(strDir)) - dir.mkpath(strDir); - - QString tempTagName = index.data(Qt::UserRole).toString(); - QString filePath = QFileDialog::getSaveFileName(this,tr("保存模板"), - strDir + tempTagName+"-"+index.data().toString()+".xlsx", - "(*.xlsx)"); - if(filePath.isEmpty()) - return; - - QString error; - QString filter; - KbdTableModel *model = NULL; - QXlsx::Document xlsx; - filter = QString("%1='%2'").arg(CN_TAG_NAME).arg(tempTagName); - model = KbdTableDataMgr::getInstance()->createModel( - Common::createViewName(TBL_FES_DEV_TEMP_DEF,filter)); - if(model == NULL) - { - onMsg(tr("导出模板不成功!")); - return; - } - //导出设备模板 - error = model->exportExcel(xlsx,SN_FES_DEV_TEMP); - if(!error.isEmpty()) - { - onMsg(tr("导出设备模板不成功!\n原因:%1").arg(error)); - return; - } - //导出模板点 - error = exportFesTempPoint(xlsx,Common::FES_ACCUML_TEMP,SN_FES_ACC,tempTagName); - if(!error.isEmpty()) - { - onMsg(tr("导出设备模板不成功!\n原因:%1").arg(error)); - return; - } - - error = exportFesTempPoint(xlsx,Common::FES_ANALOG_TEMP,SN_FES_ANA,tempTagName); - if(!error.isEmpty()) - { - onMsg(tr("导出设备模板不成功!\n原因:%1").arg(error)); - return; - } - - error = exportFesTempPoint(xlsx,Common::FES_DIGITAL_TEMP,SN_FES_DIG,tempTagName); - if(!error.isEmpty()) - { - onMsg(tr("导出设备模板不成功!\n原因:%1").arg(error)); - return; - } - - error = exportFesTempPoint(xlsx,Common::FES_MIX_TEMP,SN_FES_MIX,tempTagName); - if(!error.isEmpty()) - { - onMsg(tr("导出设备模板不成功!\n原因:%1").arg(error)); - return; - } - - error = exportFesTempPoint(xlsx,Common::FES_ANALOG_CTRL_TEMP,SN_FES_ANA_CTL,tempTagName); - if(!error.isEmpty()) - { - onMsg(tr("导出设备模板不成功!\n原因:%1").arg(error)); - return; - } - - error = exportFesTempPoint(xlsx,Common::FES_DIGITAL_CTRL_TEMP,SN_FES_DIG_CTL,tempTagName); - if(!error.isEmpty()) - { - onMsg(tr("导出设备模板不成功!\n原因:%1").arg(error)); - return; - } - - error = exportFesTempPoint(xlsx,Common::FES_MIX_CTRL_TEMP,SN_FES_MIX_CTL,tempTagName); - if(!error.isEmpty()) - { - onMsg(tr("导出设备模板不成功!\n原因:%1").arg(error)); - return; - } - - error = exportFesConstTemp(xlsx,SN_FES_CONST,tempTagName); - if(!error.isEmpty()) - { - onMsg(tr("导出设备模板不成功!\n原因:%1").arg(error)); - return; - } - - error = exportFesDataBlockTemp(xlsx,SN_FES_DATA_BLOCK,tempTagName); - if(!error.isEmpty()) - { - onMsg(tr("导出设备模板不成功!\n原因:%1").arg(error)); - return; - } - //修改模板,去掉一些不必要的列,和修改列值 - error = afterExportFesTemp(xlsx); - if(!error.isEmpty()) - { - onMsg(tr("导出设备模板不成功!\n原因:%1").arg(error)); - return; - } - - if(!xlsx.saveAs(filePath)) - { - onMsg(tr("保存文件失败!\n%1").arg(filePath)); - return; - } - - KbdMsgContrl::getInstance()->showMsg(tr("导出成功!导出路径:\n %1").arg(filePath),this); - -} - -void FesTempWidget::onImportFesTemp() -{ - QDir dir; - QString strDir = Common::getIscsHome() + "/data/modelstudio/fesTemplate"; - if(!dir.exists(strDir)) - dir.mkpath(strDir); - QStringList list = QFileDialog::getOpenFileNames(this,tr("模板导入"),strDir,"Excel (*.xlsx)"); - if(list.isEmpty()) - return; - - QString error; - foreach (QString filePath, list) { - error = importFesTemp(filePath); - if(!error.isEmpty()) - { - onMsg(tr("导入失败!\n" - "失败文件:%1\n" - "失败原因:%2\n").arg(filePath).arg(error)); - onRefresh(); - m_tableTempPoint->getTable()->setModel(NULL); - return; - } - } - - //刷新控件 - onRefresh(); - m_tableTempPoint->getTable()->setModel(NULL); - KbdMsgContrl::getInstance()->showMsg(tr("导入成功"),this); - -} - -void FesTempWidget::onImportPcs3000Temp() -{ - QStringList list = QFileDialog::getOpenFileNames(this,tr("模板导入"),"","CSV (*.CSV *.csv)"); - if(list.isEmpty()) - return; - - KbdTableModel *model = KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_TEMP_DEF_FOR_IMPORT); - if(model == NULL) - { - onMsg(tr("导入失败")); - return; - } - KbdPropertyDlg dlg(false, this); - dlg.setWindowTitle(tr("请输入模板所属的专业和类型")); - dlg.panel()->setDisplayRow(model,model->rowCount()); - if(dlg.exec() == QDialog::Rejected) - return; - const ColMgrDataList& modelCols = model->getHeadCols(); - QStringList dataList = model->unwrapData(dlg.panel()->getPropertyData()); - QString subSystem = dataList.at(modelCols.findCol(CN_SUB_SYSTEM)); - QString devType = dataList.at(modelCols.findCol(CN_DEV_TYPE_ID)); - - QString error; - foreach (QString filePath, list) { - error = importPcs3000Temp(filePath,subSystem,devType); - if(!error.isEmpty()) - { - onMsg(tr("导入失败!\n" - "失败文件:%1\n" - "失败原因:%2\n").arg(filePath).arg(error)); - onRefresh(); - m_tableTempPoint->getTable()->setModel(NULL); - return; - } - } - - //刷新控件 - onRefresh(); - m_tableTempPoint->getTable()->setModel(NULL); - - KbdMsgContrl::getInstance()->showMsg(tr("导入成功"),this); -} - -void FesTempWidget::onReadTempFromPsc3000() -{ - QString csvFile = QFileDialog::getOpenFileName(this,tr("选择PSC3000导出的转发数据"),""); - if(csvFile.isEmpty()) - return; - - KbdCSVReader reader; - QString xlsxPath; - QString errorMsg = reader.convertPsc3000Data(Common::getTreePath("pcs3000ImportData.json"), - csvFile,xlsxPath); - if(!errorMsg.isEmpty()) - { - onMsg(errorMsg); - return; - } - - QFile file(xlsxPath); - if(!file.open(QIODevice::ReadOnly)) - { - onMsg(tr("文件打开不成功!")); - return; - } - - QStringList listOldFesTemp, listDes; - KbdDbDesign ds; - ds.getTwoColumnResult("select TAG_NAME,DESCRIPTION from fes_dev_temp_def", listOldFesTemp, listDes); - - QXlsx::Document xlsx(&file); - QString error; - QStringList fesTempList; - //刷新前置模板 - error = getXlsxVaue(xlsx,"设备",CN_DEV_MODEL,fesTempList); - if(!error.isEmpty()) - { - onMsg(error); - return; - } - - QMap mapTemp; - foreach (QString str, fesTempList) { - mapTemp.insert(str,0); - } - fesTempList = mapTemp.uniqueKeys(); - if(fesTempList.isEmpty()) - { - onMsg(tr("未检测到任何设备模板")); - return; - } - QFileInfo info(xlsxPath); - KbdFesTempDlg dlg(info.absolutePath(),fesTempList); - if(dlg.exec()) - { - QStandardItemModel *model = dlg.getModel(); - for(int i = 0 ; i< model->rowCount(); i++) - { - if(model->item(i,0)->checkState() == Qt::Checked) - { - error = importPcs3000Temp(model->item(i,0)->data(Qt::UserRole).toString(), - "4", - model->item(i,1)->data(Qt::DisplayRole).toString().split(":").first()); - if(!error.isEmpty()) - { - onMsg(tr("导入失败!\n" - "失败原因:%1\n").arg(error)); - onRefresh(); - m_tableTempPoint->getTable()->setModel(NULL); - return; - } - } - - } - } - afterImportFesTemp(listOldFesTemp); - onRefresh(); - m_tableTempPoint->getTable()->setModel(NULL); - - KbdMsgContrl::getInstance()->showMsg(tr("导入成功"),this); -} - -void FesTempWidget::onRefresh() -{ - KbdDbDesign ds; - QString sql = QString("SELECT TAG_NAME,DESCRIPTION FROM fes_dev_temp_def;"); - reloadList(m_listTemp,ds.getSqlItems(sql,CN_DESC,CN_TAG_NAME)); - reloadList(m_listTempPlugin,ds.getSqlItems(sql,CN_DESC,CN_TAG_NAME)); -} - -void FesTempWidget::onInstDev() -{ - KbdTableModel *modelFesDev = KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_INFO_FOR_ADD); - if(modelFesDev == NULL) - return; - - QListWidgetItem *item = m_listTemp->currentItem(); - if(item == NULL) - { - onMsg(tr("请选择要实例化的前置模板")); - return; - } - KbdDbDesign ds; - QString sql = QString("SELECT TAG_NAME,DEV_TYPE_ID FROM fes_dev_temp_def WHERE TAG_NAME = '%1';") - .arg(item->data(Qt::UserRole).toString()); - QStringList tagList,typeList; - if(!ds.getTwoColumnResult(sql,tagList,typeList)) - { - onMsg(tr("获取模板信息失败!")); - return; - } - if(typeList.size() != 1) - { - onMsg(tr("模板信息错误")); - return; - } - - KbdBatchFesDevDlg dlg; - dlg.panel()->setDisplayRow(modelFesDev,modelFesDev->rowCount()); - dlg.panel()->setPropertyValue(CN_DEV_TP_NAME,item->data(Qt::UserRole).toString()); - dlg.panel()->setPropertyValue(CN_DEV_TYPE_ID,typeList.first()); - - if(dlg.exec()) - { - onMsg(tr("实例化成功!")); -// KbdMsgContrl::getInstance()->showMsg(tr("实例化成功!"),this); - } - -} - -void FesTempWidget::onCopyFesTemp() -{ - QListWidgetItem *item = m_listTemp->currentItem(); - if(item == NULL) - return; - - QString devTempTagName = item->data(Qt::UserRole).toString(); - - KbdTableModel * modelDevTemp = KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_TEMP_DEF_FOR_ADD); - if(modelDevTemp == NULL) - return; - - QStringList datas; - QMap > tempMap; - QList showCols; - const ColMgrDataList& modelDevTempCols = modelDevTemp->getHeadCols(); - showCols << modelDevTempCols.findCol(CN_TAG_NAME); - showCols << modelDevTempCols.findCol(CN_DESC); - KbdPropertyDlg dlg(false, this); - dlg.panel()->setDisplayRow(modelDevTemp,modelDevTemp->rowCount(),tempMap,showCols); - dlg.setWindowTitle(tr("复制前置设备模板")); - dlg.panel()->setPropertyEditableOnly(QStringList()<setPropertyValue(CN_TAG_NAME,""); - dlg.panel()->setPropertyValue(CN_DESC,""); - dlg.panel()->setPropertyValue(CN_SUB_SYSTEM,"4"); - dlg.panel()->setPropertyValue(CN_DEV_TYPE_ID,"1"); - if(dlg.exec()) - { - datas = dlg.panel()->getPropertyData(); - datas = modelDevTemp->unwrapData(datas); - KbdDbDesign ds; - QString sql = QString("SELECT TAG_NAME FROM fes_dev_temp_def WHERE TAG_NAME = '%1'") - .arg(datas.at(modelDevTempCols.findCol(CN_TAG_NAME))); - bool exist = false; - if(!ds.isExist(sql,exist)) - { - onMsg(tr("数据库链接错误")); - return; - } - if(exist) - { - onMsg(tr("标签名已存在,请修改")); - return; - } - - } - - if(datas.isEmpty()) - return; - - bool success = false; - QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); - if(retStr.isEmpty()) - { - - - success = KbdTableDataMgr::getInstance()->callProcedure(PROC_COPY_FES_TEMP, - QStringList()<commit()?false:((success=false)||true)) - onCommitError(); - } - else - onStartTransactionError(retStr); - - if(!success) - { - onMsg(tr("复制失败!")); - return; - } - - addListWidgetItem(m_listTemp,datas.at(modelDevTempCols.findCol(CN_DESC)),datas.at(modelDevTempCols.findCol(CN_TAG_NAME))); - m_tableTempPoint->getTable()->setModel(NULL); - KbdMsgContrl::getInstance()->showMsg(tr("复制成功!"),this); - -} - -void FesTempWidget::onShowApplyOpMenu() -{ - m_menuApplyOp->exec(QCursor::pos()); -} - -void FesTempWidget::onApplyAddToDev() -{ - KbdTableModel *model = qobject_cast(m_tableTempPoint->getTable()->model()); - if(model == NULL) - return; - //添加时要判断对应的测点是否已经添加,至少能报错 - QModelIndexList selectIndexs = m_tableTempPoint->getTable()->selectionModel()->selectedRows(); - if(selectIndexs.isEmpty()) - { - onMsg(tr("未选中模板点")); - return; - } - - QListWidgetItem *devTempItem = m_listTemp->currentItem(); - if(devTempItem == NULL) - { - onMsg(tr("请选中要修改的模板")); - return; - } - - KbdFesDevListDlg dlg(devTempItem->data(Qt::UserRole).toString()); - dlg.setWindowTitle(tr("选中要添加的设备")); - if(dlg.exec() != QDialog::Accepted) - return; - - QStringList devInstTagList = dlg.getCheckedDevs(); - if(devInstTagList.isEmpty()) - return; - - //检查设备中是否已经存在对应的模板点 - const ColMgrDataList& modelCols = model->getHeadCols(); - int colTag = modelCols.findCol(CN_TAG_NAME); - //插入操作 - bool success = false; - QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); - if(retStr.isEmpty()) - { - foreach (QModelIndex index, selectIndexs) { - QStringList rowDatas = model->getRowData(index.row()); - QString pointTempTagName = rowDatas.at(colTag); - QString ptType = ""; - QString tableName = model->getTableName(); - if(tableName.compare("FES_DEV_PT_TEMP_DEF",Qt::CaseInsensitive) == 0) - { - ptType = rowDatas.at(modelCols.findCol(CN_POINT_TYPE)); - } - - QString sql; - if(tableName.compare("FES_DEV_PT_TEMP_DEF",Qt::CaseInsensitive) == 0) - { - if(ptType == Common::getFesPointTempType(Common::FES_ACCUML_TEMP)) - { - sql = "INSERT INTO fes_accuml( " - "TAG_NAME, LOCATION_ID, SUB_SYSTEM, DOT_NO, RTU_TAG, DEV_TAG, SEQ_NO, APP_TABLE_NAME, APP_TAG_NAME, APP_COLUMN_NAME, BASE, COEFF, RTU_NO, RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4, DESCRIPTION, FES_POINT_TP_NAME, PATH61850,POSITION61850) SELECT " - "concat(fes_dev_info.RTU_TAG, '.' , getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_ACC'))), fes_dev_info.LOCATION_ID ,fes_dev_info.SUB_SYSTEM ,getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_ACC')), fes_dev_info.RTU_TAG,fes_dev_info.TAG_NAME,fes_dev_pt_temp_def.SEQ_NO,'', '', '', '0', '1', fes_dev_info.RTU_NO ,RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4, fes_dev_pt_temp_def.DESCRIPTION ,fes_dev_pt_temp_def.TAG_NAME ,PATH61850,POSITION61850 " - "FROM fes_dev_pt_temp_def,fes_dev_info " - "WHERE fes_dev_pt_temp_def.TAG_NAME = '%1' AND fes_dev_info.TAG_NAME IN (%2)"; - } - else if(ptType == Common::getFesPointTempType(Common::FES_ANALOG_TEMP)) - { - sql = "INSERT INTO fes_analog( " - "TAG_NAME, LOCATION_ID, SUB_SYSTEM, DEV_TAG, SEQ_NO, RTU_TAG, RTU_NO, DOT_NO, APP_TABLE_NAME, APP_TAG_NAME, APP_COLUMN_NAME, IS_FILTER, PERCENT, DEADBAND_TYPE, DEADBAND, ZEROBAND, BASE, COEFF, MAX_RANGE, MIN_RANGE, RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4, DESCRIPTION, FES_POINT_TP_NAME, PATH61850,POSITION61850) SELECT " - "concat(fes_dev_info.RTU_TAG, '.' , getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_ANA'))), fes_dev_info.LOCATION_ID ,fes_dev_info.SUB_SYSTEM , fes_dev_info.TAG_NAME,SEQ_NO, fes_dev_info.RTU_TAG,fes_dev_info.RTU_NO , getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_ANA')),'', '', '', 0, 0, '0', '0', '0', '0', '1', 65536, 0, RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4, fes_dev_pt_temp_def.DESCRIPTION , fes_dev_pt_temp_def.TAG_NAME ,PATH61850,POSITION61850 " - "FROM fes_dev_pt_temp_def,fes_dev_info " - "WHERE fes_dev_pt_temp_def.TAG_NAME = '%1' AND fes_dev_info.TAG_NAME IN (%2);"; - } - else if(ptType == Common::getFesPointTempType(Common::FES_DIGITAL_TEMP)) - { - sql = "INSERT INTO fes_digital( " - "TAG_NAME, LOCATION_ID, SUB_SYSTEM, DEV_TAG, SEQ_NO, RTU_TAG, DOT_NO, APP_TABLE_NAME, APP_TAG_NAME, APP_COLUMN_NAME, FILTER_ERR, FILTER_DISTURB, DISTURB_TIME, REVERS, RTU_NO, RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4, DESCRIPTION, FES_POINT_TP_NAME, PATH61850,POSITION61850) SELECT " - "concat(fes_dev_info.RTU_TAG, '.' , getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_DIG'))), fes_dev_info.LOCATION_ID ,fes_dev_info.SUB_SYSTEM , fes_dev_info.TAG_NAME,SEQ_NO, fes_dev_info.RTU_TAG,getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_DIG')), '', '', '', 0, 0, 0, 0, fes_dev_info.RTU_NO , RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4, fes_dev_pt_temp_def.DESCRIPTION , fes_dev_pt_temp_def.TAG_NAME ,PATH61850,POSITION61850 " - "FROM fes_dev_pt_temp_def,fes_dev_info " - "WHERE fes_dev_pt_temp_def.TAG_NAME = '%1' AND fes_dev_info.TAG_NAME IN (%2);"; - } - else if(ptType == Common::getFesPointTempType(Common::FES_MIX_TEMP)) - { - sql = "INSERT INTO fes_mix( " - "TAG_NAME, DESCRIPTION, LOCATION_ID, SUB_SYSTEM, RTU_TAG, RTU_NO, DOT_NO, DEV_TAG, SEQ_NO, APP_TABLE_NAME, APP_TAG_NAME, APP_COLUMN_NAME, BASE, COEFF, MAX_RANGE, MIN_RANGE, RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4, FES_POINT_TP_NAME, PATH61850,POSITION61850) SELECT " - "concat(fes_dev_info.RTU_TAG, '.' , getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_MIX'))), fes_dev_pt_temp_def.DESCRIPTION ,fes_dev_info.LOCATION_ID ,fes_dev_info.SUB_SYSTEM , fes_dev_info.RTU_TAG,fes_dev_info.RTU_NO, getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_MIX')), fes_dev_info.TAG_NAME, SEQ_NO, '', '', '', '0', '1', 65536, 0, RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4, fes_dev_pt_temp_def.TAG_NAME ,PATH61850,POSITION61850 " - "FROM fes_dev_pt_temp_def,fes_dev_info " - "WHERE fes_dev_pt_temp_def.TAG_NAME = '%1' AND fes_dev_info.TAG_NAME IN (%2);"; - } - else if(ptType == Common::getFesPointTempType(Common::FES_ANALOG_CTRL_TEMP)) - { - sql = "INSERT INTO fes_analog_ctrl( " - "TAG_NAME, DESCRIPTION, LOCATION_ID, SUB_SYSTEM, RTU_TAG, RTU_NO, DOT_NO, DEV_TAG, SEQ_NO, BASE, COEFF, MAX_RANGE, MIN_RANGE, POINT_TP_NAME, RES_PARA_INT1,RES_PARA_INT2,RES_PARA_INT3,RES_PARA_INT4,PATH61850,POSITION61850)SELECT " - "concat(fes_dev_info.RTU_TAG, '.' , getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_ANA_CTRL'))),fes_dev_pt_temp_def.DESCRIPTION,fes_dev_info.LOCATION_ID ,fes_dev_info.SUB_SYSTEM , fes_dev_info.RTU_TAG,fes_dev_info.RTU_NO, getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_ANA_CTRL')), fes_dev_info.TAG_NAME,SEQ_NO, '0', '1', 65536, 0, fes_dev_pt_temp_def.TAG_NAME ,RES_PARA_INT1,RES_PARA_INT2,RES_PARA_INT3,RES_PARA_INT4,PATH61850,POSITION61850 " - "FROM fes_dev_pt_temp_def,fes_dev_info " - "WHERE fes_dev_pt_temp_def.TAG_NAME = '%1' AND fes_dev_info.TAG_NAME IN (%2);"; - } - else if(ptType == Common::getFesPointTempType(Common::FES_DIGITAL_CTRL_TEMP)) - { - sql = "INSERT INTO fes_digital_ctrl( " - "TAG_NAME, DESCRIPTION, LOCATION_ID, SUB_SYSTEM, RTU_TAG, RTU_NO, DOT_NO, DEV_TAG, SEQ_NO, REVERS, POINT_TP_NAME, RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4,PATH61850,POSITION61850,YK_SELECT61850, YK_EXE61850, YK_CANCLE61850, YK_DOUBLE_SELECT61850, YK_DOUBLE_EXE61850, YK_DOUBLE_CANCLE61850, PULSE_TIME)SELECT " - "concat(fes_dev_info.RTU_TAG, '.' , getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_DIG_CTRL'))),fes_dev_pt_temp_def.DESCRIPTION,fes_dev_info.LOCATION_ID ,fes_dev_info.SUB_SYSTEM , fes_dev_info.RTU_TAG,fes_dev_info.RTU_NO, getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_DIG_CTRL')), fes_dev_info.TAG_NAME,SEQ_NO, 0, fes_dev_pt_temp_def.TAG_NAME, RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4,PATH61850,POSITION61850,YK_SELECT61850, YK_EXE61850, YK_CANCLE61850, YK_DOUBLE_SELECT61850, YK_DOUBLE_EXE61850, YK_DOUBLE_CANCLE61850, PULSE_TIME " - "FROM fes_dev_pt_temp_def,fes_dev_info " - "WHERE fes_dev_pt_temp_def.TAG_NAME = '%1' AND fes_dev_info.TAG_NAME IN (%2);"; - } - else if(ptType == Common::getFesPointTempType(Common::FES_MIX_CTRL_TEMP)) - { - sql = "INSERT INTO fes_mix_ctrl( " - "TAG_NAME, DESCRIPTION, LOCATION_ID, SUB_SYSTEM, RTU_TAG, RTU_NO, DOT_NO, DEV_TAG, SEQ_NO, BASE, COEFF, MIN_RANGE, MAX_RANGE, POINT_TP_NAME, RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4,PATH61850,POSITION61850)SELECT " - "concat(fes_dev_info.RTU_TAG, '.' , getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_MIX_CTRL'))),fes_dev_pt_temp_def.DESCRIPTION,fes_dev_info.LOCATION_ID ,fes_dev_info.SUB_SYSTEM , fes_dev_info.RTU_TAG,fes_dev_info.RTU_NO, getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_MIX_CTRL')), fes_dev_info.TAG_NAME,SEQ_NO, '0', '1', 0, 65536, fes_dev_pt_temp_def.TAG_NAME, RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4,PATH61850,POSITION61850 " - "FROM fes_dev_pt_temp_def,fes_dev_info " - "WHERE fes_dev_pt_temp_def.TAG_NAME = '%1' AND fes_dev_info.TAG_NAME IN (%2);"; - } - } - else if(tableName.compare("FES_CONST_TEMP",Qt::CaseInsensitive) == 0) - { - sql = "INSERT INTO fes_const( " - "TAG_NAME, DESCRIPTION, GROUP_NO, RTU_TAG, RTU_NO, DOT_NO, SEQ_NO,SUB_SYSTEM, LOCATION_ID, DEV_TAG, VALUE,VALUE_TYPE,UNIT_ID,VALUE_TEXT, VALUE_RATIO,VALUE_ADDED,VALUE_MAX,VALUE_MIN,VALUE_DEFAULT,VALUE_VERIFY,EX_INFO,FES_POINT_TP_NAME, PATH61850,POSITION61850) SELECT " - "concat(fes_dev_info.RTU_TAG, '.' , getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_CONST'))), fes_const_temp.DESCRIPTION,GROUP_NO, fes_dev_info.RTU_TAG,fes_dev_info.RTU_NO,getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_CONST')),SEQ_NO,fes_dev_info.SUB_SYSTEM,fes_dev_info.LOCATION_ID,fes_dev_info.TAG_NAME,VALUE,VALUE_TYPE,UNIT_ID,VALUE_TEXT, VALUE_RATIO,VALUE_ADDED,VALUE_MAX,VALUE_MIN,VALUE_DEFAULT,VALUE_VERIFY,EX_INFO,fes_const_temp.TAG_NAME, PATH61850,POSITION61850 " - "FROM fes_const_temp,fes_dev_info " - "WHERE fes_const_temp.TAG_NAME = '%1' AND fes_dev_info.TAG_NAME IN (%2);"; - } - else if(tableName.compare("FES_DATA_BLOCK_TEMP",Qt::CaseInsensitive) == 0) - { - sql = "INSERT INTO fes_data_block( " - "TAG_NAME, BLOCK_ID, RTU_TAG, RTU_NO, FUNC_CODE,STAR_ADDR,DATA_LEN, DATA_FARME_TYPE, REF_CYCLE, IS_CREATE_SOE, PARA_INT1, PARA_INT2, DESCRIPTION, LOCATION_ID, SUB_SYSTEM, LD, CALL_MODE, DATA_SET,DATA_SET_TYPE,DATA_SET_CALL_TIME,REPORT_CTRL, FES_POINT_TP_NAME, DEV_TAG) SELECT " - "concat(fes_dev_info.TAG_NAME,'.',getAfterLastDot(fes_data_block_temp.TAG_NAME)), BLOCK_ID, fes_dev_info.RTU_TAG,fes_dev_info.RTU_NO,FUNC_CODE,STAR_ADDR,DATA_LEN, DATA_FARME_TYPE, REF_CYCLE, IS_CREATE_SOE, PARA_INT1, PARA_INT2, fes_data_block_temp.DESCRIPTION,fes_dev_info.LOCATION_ID,fes_dev_info.SUB_SYSTEM,LD, CALL_MODE, DATA_SET,DATA_SET_TYPE,DATA_SET_CALL_TIME,REPORT_CTRL,fes_data_block_temp.TAG_NAME,fes_dev_info.TAG_NAME " - "FROM fes_data_block_temp,fes_dev_info " - "WHERE fes_data_block_temp.TAG_NAME = '%1' AND fes_dev_info.TAG_NAME IN (%2);"; - } - - sql = sql.arg(pointTempTagName) - .arg("'"+devInstTagList.join("','")+"'"); - success = KbdTableDataMgr::getInstance()->executeOnly(sql); - if(!success) - break; - } - - if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) - onCommitError(); - } - else - onStartTransactionError(retStr); - - if(!success) - { - onMsg(tr("添加点失败!")); - return; - } - - onMsg(tr("添加成功")); - KbdMsgContrl::getInstance()->showMsg(tr("添加成功!"),this); - -} - -void FesTempWidget::onApplyRemoveToDev() -{ - KbdTableModel *model = qobject_cast(m_tableTempPoint->getTable()->model()); - if(model == NULL) - return; - //添加时要判断对应的测点是否已经添加,至少能报错 - QModelIndexList selectIndexs = m_tableTempPoint->getTable()->selectionModel()->selectedRows(); - if(selectIndexs.isEmpty()) - { - onMsg(tr("未选中模板点")); - return; - } - - QListWidgetItem *devTempItem = m_listTemp->currentItem(); - if(devTempItem == NULL) - { - onMsg(tr("请选中要修改的模板")); - return; - } - - KbdFesDevListDlg dlg(devTempItem->data(Qt::UserRole).toString()); - dlg.setWindowTitle(tr("选中要删除的设备")); - if(dlg.exec() != QDialog::Accepted) - return; - - const ColMgrDataList& modelCols = model->getHeadCols(); - QStringList devInstTagList = dlg.getCheckedDevs(); - int colTag = modelCols.findCol(CN_TAG_NAME); - - bool success = false; - QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); - if(retStr.isEmpty()) - { - foreach (QModelIndex index, selectIndexs) { - QStringList rowDatas = model->getRowData(index.row()); - QString pointTempTagName = rowDatas.at(colTag); - QString ptType = ""; - QString tableName = model->getTableName(); - if(tableName.compare("FES_DEV_PT_TEMP_DEF",Qt::CaseInsensitive) == 0) - { - ptType = rowDatas.at(modelCols.findCol(CN_POINT_TYPE)); - } - - QString sql; - - if(!devInstTagList.isEmpty()) - { - if(tableName.compare("FES_DEV_PT_TEMP_DEF",Qt::CaseInsensitive) == 0) - { - if(ptType == Common::getFesPointTempType(Common::FES_ACCUML_TEMP)) - { - sql = "DELETE FROM fes_accuml WHERE FES_POINT_TP_NAME = '%1' AND DEV_TAG IN (%2);"; - } - else if(ptType == Common::getFesPointTempType(Common::FES_ANALOG_TEMP)) - { - sql = "DELETE FROM fes_analog WHERE FES_POINT_TP_NAME = '%1' AND DEV_TAG IN (%2);"; - } - else if(ptType == Common::getFesPointTempType(Common::FES_DIGITAL_TEMP)) - { - sql = "DELETE FROM fes_digital WHERE FES_POINT_TP_NAME = '%1' AND DEV_TAG IN (%2);"; - } - else if(ptType == Common::getFesPointTempType(Common::FES_MIX_TEMP)) - { - sql = "DELETE FROM fes_mix WHERE FES_POINT_TP_NAME = '%1' AND DEV_TAG IN (%2);"; - } - else if(ptType == Common::getFesPointTempType(Common::FES_ANALOG_CTRL_TEMP)) - { - sql = "DELETE FROM fes_analog_ctrl WHERE POINT_TP_NAME = '%1' AND DEV_TAG IN (%2);"; - } - else if(ptType == Common::getFesPointTempType(Common::FES_DIGITAL_CTRL_TEMP)) - { - sql = "DELETE FROM fes_digital_ctrl WHERE POINT_TP_NAME = '%1' AND DEV_TAG IN (%2);"; - } - else if(ptType == Common::getFesPointTempType(Common::FES_MIX_CTRL_TEMP)) - { - sql = "DELETE FROM fes_mix_ctrl WHERE POINT_TP_NAME = '%1' AND DEV_TAG IN (%2);"; - } - } - else if(tableName.compare("FES_CONST_TEMP",Qt::CaseInsensitive) == 0) - { - sql = "DELETE FROM fes_const WHERE FES_POINT_TP_NAME = '%1' AND DEV_TAG IN (%2);"; - } - else if(tableName.compare("FES_DATA_BLOCK_TEMP",Qt::CaseInsensitive) == 0) - { - sql = "DELETE FROM fes_data_block WHERE FES_POINT_TP_NAME = '%1' AND DEV_TAG IN (%2);"; - } - - sql = sql.arg(pointTempTagName) - .arg("'"+devInstTagList.join("','")+"'"); - success = KbdTableDataMgr::getInstance()->executeOnly(sql); - if(!success) - break; - } - - //删除自身模板点 - if(tableName.compare("FES_DEV_PT_TEMP_DEF",Qt::CaseInsensitive) == 0) - { - sql = "DELETE FROM FES_DEV_PT_TEMP_DEF WHERE TAG_NAME = '%1';"; - } - else if(tableName.compare("FES_CONST_TEMP",Qt::CaseInsensitive) == 0) - { - sql = "DELETE FROM FES_CONST_TEMP WHERE TAG_NAME = '%1';"; - } - else if(tableName.compare("FES_DATA_BLOCK_TEMP",Qt::CaseInsensitive) == 0) - { - sql = "DELETE FROM FES_DATA_BLOCK_TEMP WHERE TAG_NAME = '%1';"; - } - - sql = sql.arg(pointTempTagName); - success = KbdTableDataMgr::getInstance()->executeOnly(sql); - if(!success) - break; - } - - if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) - onCommitError(); - } - else - onStartTransactionError(retStr); - - if(!success) - { - onMsg(tr("删除点失败!")); - return; - } - - m_tableTempPoint->getTable()->reFresh(); - onMsg(tr("删除点成功")); - KbdMsgContrl::getInstance()->showMsg(tr("删除点成功!"),this); -} - -void FesTempWidget::onBatchModifyProperty() -{ - QModelIndex index = m_tableTempPoint->getTable()->currentIndex(); - if(!index.isValid()) - return; - - KbdTableModel *model = qobject_cast(m_tableTempPoint->getTable()->model()); - if(model == NULL) - return; - - QModelIndexList indexList = m_tableTempPoint->getTable()->selectionModel()->selectedRows(index.column()); - - if(m_tableTempPoint->getTable()->needSave()) - { - onMsg(tr("请先保存修改")); - return; - } - - if(indexList.isEmpty()) - return; - - const ColMgrDataList& headCols = model->getHeadCols(); - if(!headCols.at(indexList.first().column()).editable) - { - onMsg(tr("该列不可编辑")); - return; - } - if(headCols.at(indexList.first().column()).isPrimaryKey) - { - onMsg(tr("该列是主键,不可编辑")); - return; - } - - QListWidgetItem *devTempItem = m_listTemp->currentItem(); - if(devTempItem == NULL) - { - onMsg(tr("请选中要修改的模板")); - return; - } - - KbdFesDevListDlg dlg(devTempItem->data(Qt::UserRole).toString()); - dlg.setWindowTitle(tr("选中要修改的设备")); - if(dlg.exec() != QDialog::Accepted) - return; - - QStringList devInstTagList = dlg.getCheckedDevs(); - if(devInstTagList.isEmpty()) - return; - - QString strProperty = headCols.at(indexList.first().column()).sqlName; - QString ptType = ""; - QStringList newDatas = model->unwrapData(model->getRowData(indexList.first().row())); - if(model->getTableName().compare("FES_DEV_PT_TEMP_DEF",Qt::CaseInsensitive) == 0) - { - const ColMgrDataList& modelCols = model->getHeadCols(); - ptType = newDatas.at(modelCols.findCol(CN_POINT_TYPE)); - } - - QStringList instTableNameList = KbdFesTempPointModifyDlg::locateTable(model->getTableName() - ,strProperty - ,ptType); - if(instTableNameList.isEmpty()) - { - onMsg(tr("当前属性无法同步")); - return; - } - - bool success = false; - const ColMgrDataList& modelCols = model->getHeadCols(); - int colTagName = modelCols.findCol(CN_TAG_NAME); - - QString sql; - QString value; - QString tempPointTagName; - MS_LOG_DEBUG(tr("开始执行批量菜单")); - QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); - if(retStr.isEmpty()) - { - KbdTableDataMgr::getInstance()->beginBatch(); - - foreach (QModelIndex index, indexList) - { - newDatas = model->unwrapData(model->getRowData(index.row())); - value = newDatas.at(index.column()); - tempPointTagName = newDatas.at(colTagName); - - foreach (QString tableName, instTableNameList) - { - sql.clear(); - - if(tableName == "fes_mix_ctrl" || tableName == "fes_analog_ctrl" || tableName == "fes_digital_ctrl") - { - sql = QString("UPDATE %1 SET %2 WHERE DEV_TAG IN (%3) AND POINT_TP_NAME ='%4';"); - } - else - { - sql = QString("UPDATE %1 SET %2 WHERE DEV_TAG IN (%3) AND FES_POINT_TP_NAME ='%4';"); - } - - sql = sql.arg(tableName) - .arg(QString("%1 = '%2'").arg(strProperty).arg(value)) - .arg("'"+devInstTagList.join("','")+"'") - .arg(tempPointTagName); - success = KbdTableDataMgr::getInstance()->executeOnly(sql); - if(!success) - break; - } - if(!success) - break; - } - success = KbdTableDataMgr::getInstance()->endBatch(); - - if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) - onCommitError(); - } - else - onStartTransactionError(retStr); - - MS_LOG_DEBUG(tr("结束执行批量菜单")); - - if(!success) - { - onMsg(tr("修改失败")); - return; - } - - onMsg(tr("修改成功")); - KbdMsgContrl::getInstance()->showMsg(tr("修改成功"),this); - -} - - - +#include "festempwidget.h" +#include +#include +#include "kbdtable.h" +#include "../model_common/common.h" +#include +#include +#include +#include "kbdtabledatamgr.h" +#include "kbdtablemodel.h" +#include "kbdpropertydlg.h" +#include "kbdpropertypanel.h" +#include "kbdmsgcontrl.h" +#include "kbddbdesign.h" +#include +#include "kbdcsvreader.h" +#include "pub_widget/MessageBox.h" +#include "../FESWidget/kbdbatchfesdevdlg.h" +#include "kbdfestempdlg.h" +#include "kbdfesdevlistdlg.h" +#include "kbdfestemppointmodifydlg.h" +#include "kbdtableproperty.h" +#include "CustomWidget/kbdsearchwidget.h" + +//TAB标签页 +#define TAB_FES_ACCUNL getTabDesc(1) +#define TAB_FES_ANALOG getTabDesc(2) +#define TAB_FES_DIGITAL getTabDesc(3) +#define TAB_FES_MIX getTabDesc(4) +#define TAB_FES_ANALOG_CTRL getTabDesc(5) +#define TAB_FES_DIGITAL_CTRL getTabDesc(6) +#define TAB_FES_MIX_CTRL getTabDesc(7) +#define TAB_FES_DATA_BLOCK getTabDesc(8) +#define TAB_FES_CONST getTabDesc(9) + +#define SN_FES_DEV_TEMP getSheetName(1) +#define SN_FES_ACC getSheetName(2) +#define SN_FES_ANA getSheetName(3) +#define SN_FES_DIG getSheetName(4) +#define SN_FES_MIX getSheetName(5) +#define SN_FES_ANA_CTL getSheetName(6) +#define SN_FES_DIG_CTL getSheetName(7) +#define SN_FES_MIX_CTL getSheetName(8) +#define SN_FES_DATA_BLOCK getSheetName(9) +#define SN_FES_CONST getSheetName(10) + +#define FES_DEV_MIX_TEMP_DEF "FES_DEV_MIX_TEMP_DEF.xml" +#define FES_DEV_MIX_CTRL_TEMP_DEF "FES_DEV_MIX_CTRL_TEMP_DEF.xml" +#define FES_DEV_DIGITAL_TEMP_DEF "FES_DEV_DIGITAL_TEMP_DEF.xml" +#define FES_DEV_DIGITAL_CTRL_TEMP_DEF "FES_DEV_DIGITAL_CTRL_TEMP_DEF.xml" +#define FES_DEV_ANALOG_TEMP_DEF "FES_DEV_ANALOG_TEMP_DEF.xml" +#define FES_DEV_ANALOG_CTRL_TEMP_DEF "FES_DEV_ANALOG_CTRL_TEMP_DEF.xml" +#define FES_DEV_ACCUNL_TEMP_DEF "FES_DEV_ACCUNL_TEMP_DEF.xml" + +FesTempWidget::FesTempWidget(QWidget *parent) : KbdWidget(parent) +{ + m_listTemp = NULL; + m_listTempPlugin = NULL; + initLayout(); + initMenu(); + initData(); +} + +void FesTempWidget::setFesTempList(QListWidget *list) +{ + Q_ASSERT(list != NULL); + m_listTemp = list; +} + +void FesTempWidget::setFesTempListPlugin(QListWidget *list) +{ + Q_ASSERT(list != NULL); + m_listTempPlugin = list; +} + +bool FesTempWidget::tableHasFocus() +{ + return m_tableTempPoint->getTable()->hasFocus(); +} + +QString FesTempWidget::importPcs3000Temp(const QString &filePath, const QString &subSystem, const QString &devTypeId, bool startTransaction) +{ + KbdCSVReader csvReader; + QString xlsxFilePath; + + QString msg = csvReader.convertToFesTemp(Common::getTreePath("pcs3000ToFes.json"), + filePath, + subSystem,devTypeId,xlsxFilePath); + + if(!msg.isEmpty()) + return msg; + + return importFesTemp(xlsxFilePath,startTransaction); +} + +void FesTempWidget::initLayout() +{ + m_tableSearch = new kbdSearchWidget(this); + m_tableSearch->setMaximumWidth(350); + m_tableSearch->setPlaceholderText(tr("请输入标签或描述")); + connect(m_tableSearch,&kbdSearchWidget::sigSearch,this,&FesTempWidget::onSearchTableText); + + QToolBar *bar = new QToolBar(this); + m_tabTempPoint = new QTabBar(this); + m_tableTempPoint = new kbdtableproperty(this); + m_tableTempPoint->getTable()->useDefineMenu(); + m_tableTempPoint->getTable()->addMenuAction(tr("属性同步至实例设备"),this,SLOT(onBatchModifyProperty())); + + QAction* act = nullptr; + act = bar->addAction(tr("添加记录"),this,SLOT(onAddTempPoint())); + bar->widgetForAction(act)->setObjectName("icon_add"); + act = bar->addAction(tr("修改"),this,SLOT(onModifyTempPoint())); + bar->widgetForAction(act)->setObjectName("icon_edit"); + act = bar->addAction(tr("复制点"),this,SLOT(onCopyTempPoint())); + bar->widgetForAction(act)->setObjectName("icon_copy"); + bar->addSeparator(); + act = bar->addAction(tr("删除记录"),this,SLOT(onRemoveTempPoint())); + bar->widgetForAction(act)->setObjectName("icon_delete"); + bar->addSeparator(); + act = bar->addAction(tr("Excel导出"),m_tableTempPoint->getTable(),SLOT(onExcelExport())); + bar->widgetForAction(act)->setObjectName("icon_excel_export"); + act = bar->addAction(tr("Excel导入"),m_tableTempPoint->getTable(),SLOT(onImportExcel())); + bar->widgetForAction(act)->setObjectName("icon_excel_import"); + bar->addSeparator(); + act = bar->addAction(tr("批量修改前置设备"),this,SLOT(onShowApplyOpMenu())); + bar->addSeparator(); + bar->addWidget(m_tableSearch); + + m_tabTempPoint->setExpanding(false); + m_tabTempPoint->addTab(TAB_FES_ANALOG); + m_tabTempPoint->addTab(TAB_FES_DIGITAL); + m_tabTempPoint->addTab(TAB_FES_ACCUNL); + m_tabTempPoint->addTab(TAB_FES_MIX); + m_tabTempPoint->addTab(TAB_FES_DIGITAL_CTRL); + m_tabTempPoint->addTab(TAB_FES_ANALOG_CTRL); + m_tabTempPoint->addTab(TAB_FES_MIX_CTRL); + m_tabTempPoint->addTab(TAB_FES_CONST); + m_tabTempPoint->addTab(TAB_FES_DATA_BLOCK); + + QVBoxLayout *mainLayout = new QVBoxLayout; + QVBoxLayout *displayLayout = new QVBoxLayout; + + mainLayout->setMargin(0); + mainLayout->addWidget(bar); + mainLayout->addLayout(displayLayout); + + displayLayout->addWidget(m_tabTempPoint); + displayLayout->addWidget(m_tableTempPoint); + setLayout(mainLayout); +} + +void FesTempWidget::initMenu() +{ + m_menuApplyOp = new QMenu(this); + m_menuApplyOp->addAction(tr("添加应用至前置设备"),this,SLOT(onApplyAddToDev())); + m_menuApplyOp->addAction(tr("删除应用至前置设备"),this,SLOT(onApplyRemoveToDev())); +} + +void FesTempWidget::initData() +{ + connect(m_tabTempPoint,SIGNAL(currentChanged(int)),this,SLOT(onTabTempPointChanged(int))); + connect(m_tableTempPoint->getTable(),SIGNAL(doubleClicked(const QModelIndex &)),this,SLOT(onModifyTempPoint())); +} + +QString FesTempWidget::getTabDesc(int tabNum) +{ + QString desc; + switch (tabNum) { + case 1: + desc = tr("累积量"); + break; + case 2: + desc = tr("模拟量"); + break; + case 3: + desc = tr("数字量"); + break; + case 4: + desc = tr("混合量"); + break; + case 5: + desc = tr("模拟量控制"); + break; + case 6: + desc = tr("数字量控制"); + break; + case 7: + desc = tr("混合量控制"); + break; + case 8: + desc = tr("数据块"); + break; + case 9: + desc = tr("保护定值"); + break; + default: + break; + } + + return desc; +} + +QString FesTempWidget::getTempPointType(const QString &tabText) +{ + QString ptType; + if(tabText == TAB_FES_ACCUNL) + { + ptType = Common::getFesPointTempType(Common::FES_ACCUML_TEMP); + } + else if(tabText == TAB_FES_ANALOG) + { + ptType = Common::getFesPointTempType(Common::FES_ANALOG_TEMP); + } + else if(tabText == TAB_FES_DIGITAL) + { + ptType = Common::getFesPointTempType(Common::FES_DIGITAL_TEMP); + } + else if(tabText == TAB_FES_MIX) + { + ptType = Common::getFesPointTempType(Common::FES_MIX_TEMP); + } + else if(tabText == TAB_FES_MIX_CTRL) + { + ptType = Common::getFesPointTempType(Common::FES_MIX_CTRL_TEMP); + } + else if(tabText == TAB_FES_ANALOG_CTRL) + { + ptType = Common::getFesPointTempType(Common::FES_ANALOG_CTRL_TEMP); + } + else if(tabText == TAB_FES_DIGITAL_CTRL) + { + ptType = Common::getFesPointTempType(Common::FES_DIGITAL_CTRL_TEMP); + } + return ptType; +} + +QString FesTempWidget::getPointTableName(const QString tabText) +{ + QString ptTableName; + if(tabText == TAB_FES_ACCUNL) + { + ptTableName = FES_DEV_ACCUNL_TEMP_DEF; + } + else if(tabText == TAB_FES_ANALOG) + { + ptTableName = FES_DEV_ANALOG_TEMP_DEF; + } + else if(tabText == TAB_FES_DIGITAL) + { + ptTableName = FES_DEV_DIGITAL_TEMP_DEF; + } + else if(tabText == TAB_FES_MIX) + { + ptTableName = FES_DEV_MIX_TEMP_DEF; + } + else if(tabText == TAB_FES_MIX_CTRL) + { + ptTableName = FES_DEV_MIX_CTRL_TEMP_DEF; + } + else if(tabText == TAB_FES_ANALOG_CTRL) + { + ptTableName = FES_DEV_ANALOG_CTRL_TEMP_DEF; + } + else if(tabText == TAB_FES_DIGITAL_CTRL) + { + ptTableName = FES_DEV_DIGITAL_CTRL_TEMP_DEF; + } + return ptTableName; +} + +QListWidgetItem *FesTempWidget::addListWidgetItem(QListWidget *listWidget, const QString &desc, const QString &tag) +{ + QListWidgetItem *item = new QListWidgetItem(desc); + item->setData(Qt::UserRole,tag); + listWidget->addItem(item); + return item; +} + +QListWidgetItem *FesTempWidget::findItem(QListWidget *list, const QString &tag) +{ + for(int i = 0; i < list->count(); i++) + { + if(list->item(i)->data(Qt::UserRole).toString() == tag) + return list->item(i); + } + + return NULL; +} + +void FesTempWidget::deleteListWidgetItem(QListWidget *listWidget, QList items) +{ + if(listWidget == NULL) + return; + + QList rows; + foreach (QListWidgetItem *it, items) { + rows << listWidget->row(it); + } + + if(rows.isEmpty()) + return; + //排序,升序,行号越大越靠后 + std::sort(rows.begin(),rows.end()); + + //从后面往前删除 + QList deleteItems; + for(int i = rows.size()-1;i >= 0;i--) + { + deleteItems << listWidget->takeItem(rows.at(i)); + } + + qDeleteAll(deleteItems); +} + +void FesTempWidget::reloadList(QListWidget *list,const QList &items) +{ + if(list == NULL) + return; + list->clear(); + foreach (QListWidgetItem *item, items) { + item->setText(item->text() + " 【" + item->data(Qt::UserRole).toString() + "】"); + list->addItem(item); + } +} + +QString FesTempWidget::getSheetName(int sheetNum) +{ + QString desc; + switch (sheetNum) { + case 1: + desc = tr("前置设备模板"); + break; + case 2: + desc = tr("累积量模板点"); + break; + case 3: + desc = tr("模拟量模板点"); + break; + case 4: + desc = tr("数字量模板点"); + break; + case 5: + desc = tr("混合量模板点"); + break; + case 6: + desc = tr("模拟量控制点"); + break; + case 7: + desc = tr("数字量控制点"); + break; + case 8: + desc = tr("混合量控制点"); + break; + case 9: + desc = tr("数据块"); + break; + case 10: + desc = tr("保护定值"); + break; + default: + break; + } + + return desc; +} + +QString FesTempWidget::exportFesTempPoint(QXlsx::Document &xlsx, Common::FesPtTempType type, + const QString &sheetName,const QString &tempTagName) +{ + QString filter = QString("%1='%2' AND %3='%4' ORDER BY SEQ_NO").arg(CN_DEV_TP_NAME).arg(tempTagName) + .arg(CN_POINT_TYPE).arg(Common::getFesPointTempType(type)); + KbdTableModel * model = KbdTableDataMgr::getInstance()->createModel(Common::createViewName( + TBL_FES_DEV_PT_TEMP_DEF,filter)); + if(model == NULL) + return tr("导出%1不成功").arg(sheetName); + + return model->exportExcel(xlsx,sheetName); + +} + +QString FesTempWidget::exportFesDataBlockTemp(QXlsx::Document &xlsx, const QString &sheetName, const QString &tempTagName) +{ + QString filter = QString("%1='%2' ORDER BY BLOCK_ID").arg(CN_DEV_TP_NAME).arg(tempTagName); + KbdTableModel * model = KbdTableDataMgr::getInstance()->createModel(Common::createViewName( + TBL_FES_DATA_BLOCK_TEMP,filter)); + if(model == NULL) + return tr("导出%1不成功").arg(sheetName); + + return model->exportExcel(xlsx,sheetName); +} + +QString FesTempWidget::exportFesConstTemp(QXlsx::Document &xlsx, const QString &sheetName, const QString &tempTagName) +{ + QString filter = QString("%1='%2' ORDER BY SEQ_NO").arg(CN_DEV_TP_NAME).arg(tempTagName); + KbdTableModel * model = KbdTableDataMgr::getInstance()->createModel(Common::createViewName( + TBL_FES_CONST_TEMP,filter)); + if(model == NULL) + return tr("导出%1不成功").arg(sheetName); + + return model->exportExcel(xlsx,sheetName); +} + +QString FesTempWidget::afterExportFesTemp(QXlsx::Document &xlsx) +{ + QString err; + err = err + KbdModelExcelFun::removeSheetColumn(xlsx,SN_FES_ACC,CN_DEV_TP_NAME); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::removeSheetColumn(xlsx,SN_FES_ANA,CN_DEV_TP_NAME); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::removeSheetColumn(xlsx,SN_FES_DIG,CN_DEV_TP_NAME); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::removeSheetColumn(xlsx,SN_FES_MIX,CN_DEV_TP_NAME); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::removeSheetColumn(xlsx,SN_FES_ANA_CTL,CN_DEV_TP_NAME); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::removeSheetColumn(xlsx,SN_FES_DIG_CTL,CN_DEV_TP_NAME); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::removeSheetColumn(xlsx,SN_FES_MIX_CTL,CN_DEV_TP_NAME); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::removeSheetColumn(xlsx,SN_FES_CONST,CN_DEV_TP_NAME); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::removeSheetColumn(xlsx,SN_FES_DATA_BLOCK,CN_DEV_TP_NAME); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::removeColumnLastDot(xlsx,SN_FES_ACC,CN_TAG_NAME); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::removeColumnLastDot(xlsx,SN_FES_ANA,CN_TAG_NAME); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::removeColumnLastDot(xlsx,SN_FES_DIG,CN_TAG_NAME); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::removeColumnLastDot(xlsx,SN_FES_MIX,CN_TAG_NAME); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::removeColumnLastDot(xlsx,SN_FES_ANA_CTL,CN_TAG_NAME); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::removeColumnLastDot(xlsx,SN_FES_DIG_CTL,CN_TAG_NAME); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::removeColumnLastDot(xlsx,SN_FES_MIX_CTL,CN_TAG_NAME); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::removeColumnLastDot(xlsx,SN_FES_CONST,CN_TAG_NAME); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::removeColumnLastDot(xlsx,SN_FES_DATA_BLOCK,CN_TAG_NAME); + if(!err.isEmpty()) + return err; + + return err; +} + +QString FesTempWidget::importFesTemp(const QString &filePath, bool startTransaction) +{ + QFile file(filePath); + if(!file.open(QIODevice::ReadOnly)) + return tr("文件打开不成功!"); + + QXlsx::Document xlsx(&file); + QString error; + error = befortImportFesTemp(xlsx); + + if(!error.isEmpty()) + return error; + + if(startTransaction) + { + //开启事务,调用存储过程 + QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); + if(retStr.isEmpty()) + { + KbdTableDataMgr::getInstance()->beginBatch(); + if(error.isEmpty()) + error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_DEV_TEMP,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_TEMP_DEF)); + if(error.isEmpty()) + error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_ACC,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); + if(error.isEmpty()) + error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_ANA,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); + if(error.isEmpty()) + error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_DIG,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); + if(error.isEmpty()) + error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_MIX,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); + if(error.isEmpty()) + error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_ANA_CTL,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); + if(error.isEmpty()) + error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_DIG_CTL,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); + if(error.isEmpty()) + error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_MIX_CTL,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); + if(error.isEmpty()) + error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_DATA_BLOCK,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DATA_BLOCK_TEMP)); + if(error.isEmpty()) + error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_CONST,KbdTableDataMgr::getInstance()->createModel(TBL_FES_CONST_TEMP)); + + KbdTableDataMgr::getInstance()->endBatch(); + + //由于以上操作,有可能有非数据库操作导致的失败,比如文件打不开等,这里判断是否有错误,有错误则强制回滚事务 + if(!error.isEmpty()) + { + KbdTableDataMgr::getInstance()->resetTransactionExe(false); + } + if(!KbdTableDataMgr::getInstance()->commit()) + error = tr("导入失败!事务已回滚!原因:")+error; + } + else + error = tr("导入失败!原因:事务开启失败"); + + } + else + { + KbdTableDataMgr::getInstance()->beginBatch(); + if(error.isEmpty()) + { + error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_DEV_TEMP,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_TEMP_DEF)); + } + if(error.isEmpty()) + { + error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_ACC,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); + } + if(error.isEmpty()) + { + error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_ANA,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); + } + if(error.isEmpty()) + { + error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_DIG,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); + } + if(error.isEmpty()) + { + error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_MIX,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); + } + if(error.isEmpty()) + { + error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_ANA_CTL,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); + } + if(error.isEmpty()) + { + error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_DIG_CTL,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); + } + if(error.isEmpty()) + { + error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_MIX_CTL,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_PT_TEMP_DEF)); + } + if(error.isEmpty()) + { + error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_DATA_BLOCK,KbdTableDataMgr::getInstance()->createModel(TBL_FES_DATA_BLOCK_TEMP)); + } + if(error.isEmpty()) + { + error = KbdModelExcelFun::directImportExcel(xlsx,SN_FES_CONST,KbdTableDataMgr::getInstance()->createModel(TBL_FES_CONST_TEMP)); + } + + KbdTableDataMgr::getInstance()->endBatch(); + //由于以上操作,有可能有非数据库操作导致的失败,比如文件打不开等,这里判断是否有错误,有错误则强制回滚事务 + // if(!error.isEmpty()) + // { + // KbdTableDataMgr::getInstance()->resetTransactionExe(false); + // } + + } + + + return error; +} + +QString FesTempWidget::befortImportFesTemp(QXlsx::Document &xlsx) +{ + //在导入前置模板之前的一些工作,比如增加设备模板名 + if(!xlsx.selectSheet(SN_FES_DEV_TEMP)) + return tr("excel文件中没有%1表").arg(SN_FES_DEV_TEMP); + + int col = KbdModelExcelFun::findXlsxColumn(xlsx,CN_TAG_NAME); + if(col < 0) + return tr("表格%1中没有%2列").arg(SN_FES_DEV_TEMP).arg(CN_TAG_NAME); + //获取模板名 + QString devTagName = xlsx.read(3,col).toString(); + if(devTagName.isEmpty()) + return tr("设备模板名为空!"); + + int colDesc = KbdModelExcelFun::findXlsxColumn(xlsx,CN_DESC); + if(colDesc < 0) + return tr("表格%1中没有%2列").arg(SN_FES_DEV_TEMP).arg(CN_DESC); + + QString devDesc = xlsx.read(3,colDesc).toString(); + KbdDbDesign ds; + bool hasTemp = false; + QString sql = QString("SELECT * FROM FES_DEV_TEMP_DEF WHERE TAG_NAME = '%1'").arg(devTagName); + ds.isExist(sql,hasTemp); + if(hasTemp) + { +// if(N_MessageBox::Yes == N_MessageBox::information(this,tr("消息"), +// tr("存在同名模板%1,是否修改模板标签名?").arg(devTagName), +// N_MessageBox::Yes,N_MessageBox::No)) +// { +// KbdPropertyDlg dlg(false); +// KbdTableModel *model = KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_TEMP_DEF); +// if(model == NULL) +// return tr("缺失模板xml配置"); + +// QList showCols; +// showCols << modelCols.findCol(CN_TAG_NAME) <setDisplayRow(model,model->rowCount(),QMap>(),showCols); +// dlg.panel()->setPropertyValue(CN_DEV_TYPE_ID,"4");//随便添加一些值,让检查通过就行 + +// dlg.setWindowTitle(tr("请输入新的模板名称和描述")); +// if(dlg.exec()) +// { +// QStringList rowDatas = dlg.panel()->getPropertyData(); +// devTagName = rowDatas.at(modelCols.findCol(CN_TAG_NAME)); +// devDesc = rowDatas.at(modelCols.findCol(CN_DESC)); +// } +// else +// return tr("存在同名模板%1,无法导入").arg(devTagName); +// } +// else + return tr("存在同名模板%1,无法导入").arg(devTagName); + } + + if(!xlsx.write(3,col,devTagName)) + return tr("写入TAG_NAME失败"); + + if(!xlsx.write(3,colDesc,devDesc)) + return tr("写入设备描述失败"); + + QString err; + err = err + KbdModelExcelFun::addColumnLastDot(xlsx,SN_FES_ACC,CN_TAG_NAME,devTagName); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::addColumnLastDot(xlsx,SN_FES_ANA,CN_TAG_NAME,devTagName); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::addColumnLastDot(xlsx,SN_FES_DIG,CN_TAG_NAME,devTagName); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::addColumnLastDot(xlsx,SN_FES_MIX,CN_TAG_NAME,devTagName); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::addColumnLastDot(xlsx,SN_FES_ANA_CTL,CN_TAG_NAME,devTagName); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::addColumnLastDot(xlsx,SN_FES_DIG_CTL,CN_TAG_NAME,devTagName); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::addColumnLastDot(xlsx,SN_FES_MIX_CTL,CN_TAG_NAME,devTagName); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::addColumnLastDot(xlsx,SN_FES_CONST,CN_TAG_NAME,devTagName); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::addColumnLastDot(xlsx,SN_FES_DATA_BLOCK,CN_TAG_NAME,devTagName); + if(!err.isEmpty()) + return err; + + + //描述可以随便写 + err = err + KbdModelExcelFun::addColumnSameValue(xlsx,SN_FES_ACC,CN_DEV_TP_NAME,"DESC",devTagName); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::addColumnSameValue(xlsx,SN_FES_ANA,CN_DEV_TP_NAME,"DESC",devTagName); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::addColumnSameValue(xlsx,SN_FES_DIG,CN_DEV_TP_NAME,"DESC",devTagName); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::addColumnSameValue(xlsx,SN_FES_MIX,CN_DEV_TP_NAME,"DESC",devTagName); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::addColumnSameValue(xlsx,SN_FES_ANA_CTL,CN_DEV_TP_NAME,"DESC",devTagName); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::addColumnSameValue(xlsx,SN_FES_DIG_CTL,CN_DEV_TP_NAME,"DESC",devTagName); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::addColumnSameValue(xlsx,SN_FES_MIX_CTL,CN_DEV_TP_NAME,"DESC",devTagName); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::addColumnSameValue(xlsx,SN_FES_CONST,CN_DEV_TP_NAME,"DESC",devTagName); + if(!err.isEmpty()) + return err; + + err = err + KbdModelExcelFun::addColumnSameValue(xlsx,SN_FES_DATA_BLOCK,CN_DEV_TP_NAME,"DESC",devTagName); + if(!err.isEmpty()) + return err; + + return err; + +} + +void FesTempWidget::afterImportFesTemp(QStringList listOldFesTemp) +{ + //更新模板标签名,避免与pcs3000导入前置点时标签名冲突 + + QStringList listTagName,listDes; + KbdDbDesign ds; + ds.getTwoColumnResult("select TAG_NAME,DESCRIPTION from fes_dev_temp_def", listTagName, listDes); + + for (int i = 0; i < listTagName.size(); i++) + { + if(listOldFesTemp.contains(listTagName.at(i))) + continue; + QString sql = "UPDATE fes_dev_temp_def SET TAG_NAME = '%1' WHERE TAG_NAME = '%2';"; + sql = sql.arg("TEMP_" + listTagName[i]).arg(listTagName[i]); + KbdTableDataMgr::getInstance()->executeOnly(sql); + } +} + +QString FesTempWidget::getXlsxVaue(QXlsx::Document &xlsx, const QString &sheetName, const QString &colName, QStringList &values) +{ + if(!xlsx.selectSheet(sheetName)) + return tr("错误:没有%1表!").arg(sheetName); + + int col = KbdModelExcelFun::findXlsxColumn(xlsx,colName); + if(col < 0) + return tr("错误:没有此列%1").arg(colName); + + values.clear(); + for(int r = 3 ; r <= xlsx.currentWorksheet()->dimension().lastRow(); r++) + { + values << xlsx.read(r,col).toString(); + } + + return ""; +} + + +void FesTempWidget::onListTempItemChange() +{ + onTabTempPointChanged(m_tabTempPoint->currentIndex()); +} + +void FesTempWidget::onTabTempPointChanged(int index) +{ + if(index < 0) + return; + QModelIndex indexTemp = m_listTemp->currentIndex(); + if(!indexTemp.isValid()) + return; + if(m_tabTempPoint->tabText(index) == TAB_FES_DATA_BLOCK) + { + QString filter = QString("%1='%2'") + .arg(CN_DEV_TP_NAME).arg(indexTemp.data(Qt::UserRole).toString()); + m_tableTempPoint->getTable()->setModel(KbdTableDataMgr::getInstance()-> + createModel(Common::createViewName(TBL_FES_DATA_BLOCK_TEMP,filter))); + } + else if(m_tabTempPoint->tabText(index) == TAB_FES_CONST) + { + QString filter = QString("%1='%2'") + .arg(CN_DEV_TP_NAME).arg(indexTemp.data(Qt::UserRole).toString()); + m_tableTempPoint->getTable()->setModel(KbdTableDataMgr::getInstance()-> + createModel(Common::createViewName(TBL_FES_CONST_TEMP,filter))); + } + else + { + QString filter = QString("%1='%2' AND %3='%4' ORDER BY SEQ_NO") + .arg(CN_POINT_TYPE).arg(getTempPointType(m_tabTempPoint->tabText(index))) + .arg(CN_DEV_TP_NAME).arg(indexTemp.data(Qt::UserRole).toString()); + m_tableTempPoint->getTable()->setModel(KbdTableDataMgr::getInstance()-> + createModel(Common::createViewName(getPointTableName(m_tabTempPoint->tabText(index)),filter))); + } + + onSearchTableText(m_tableSearch->text()); +} + +void FesTempWidget::onAddTempPoint() +{ + QModelIndex index = m_listTemp->currentIndex(); + if(!index.isValid()) + { + onMsg(tr("请选中要添加测点的模板!")); + return; + } + KbdTableModel *model = qobject_cast(m_tableTempPoint->getTable()->model()); + if(model == NULL) + return; + + //数据块的模板使用该函数 + if(m_tabTempPoint->tabText(m_tabTempPoint->currentIndex()) == TAB_FES_DATA_BLOCK) + { + onAddTempPointDataBlock(); + return; + } + else if(m_tabTempPoint->tabText(m_tabTempPoint->currentIndex()) == TAB_FES_CONST) + { + onAddTempPointConst(); + return; + } + + KbdPropertyDlg dlg(false,this); + dlg.setWindowTitle(tr("添加前置测点模板")); + dlg.panel()->setDisplayRow(model,model->rowCount()); + dlg.panel()->setDotStringPrefix(CN_TAG_NAME,index.data(Qt::UserRole).toString()); + QString ptType = getTempPointType(m_tabTempPoint->tabText(m_tabTempPoint->currentIndex())); + dlg.panel()->setPropertyValue(CN_POINT_TYPE,ptType); + dlg.panel()->setPropertyValue(CN_DEV_TP_NAME,index.data(Qt::UserRole).toString()); + //设备点序号从0开始 + if(model->rowCount() == 0) + { + dlg.panel()->setPropertyValue(CN_SEQ_NO,"0"); + } + QStringList rowDatas; + if(dlg.exec()) + { + rowDatas = dlg.panel()->getPropertyData(); + } + if(rowDatas.isEmpty()) + return; + + bool success = true; + QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); + if(retStr.isEmpty()) + { + success = model->addRow(rowDatas,true); + if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) + onCommitError(); + } + else + onStartTransactionError(retStr); + + if(!success) + { + onMsg(tr("添加失败")); + return; + } + m_tableTempPoint->getTable()->reFresh(); + KbdMsgContrl::getInstance()->showMsg(tr("添加成功"),this); +} + +void FesTempWidget::onAddTempPointDataBlock() +{ + QModelIndex index = m_listTemp->currentIndex(); + if(!index.isValid()) + { + onMsg(tr("请选中要添加测点的模板!")); + return; + } + KbdTableModel *model = qobject_cast(m_tableTempPoint->getTable()->model()); + if(model == NULL) + return; + + KbdPropertyDlg dlg(false, this); + dlg.setWindowTitle(tr("添加数据块")); + dlg.panel()->setDisplayRow(model,model->rowCount()); + dlg.panel()->setDotStringPrefix(CN_TAG_NAME,index.data(Qt::UserRole).toString()); + dlg.panel()->setPropertyValue(CN_DEV_TP_NAME,index.data(Qt::UserRole).toString()); + + QStringList rowDatas; + if(dlg.exec()) + { + rowDatas = dlg.panel()->getPropertyData(); + } + if(rowDatas.isEmpty()) + return; + + bool success = true; + QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); + if(retStr.isEmpty()) + { + success = model->addRow(rowDatas,true); + if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) + onCommitError(); + } + else + onStartTransactionError(retStr); + + if(!success) + { + onMsg(tr("添加失败")); + return; + } + + KbdMsgContrl::getInstance()->showMsg(tr("添加成功"),this); + +} + +void FesTempWidget::onAddTempPointConst() +{ + QModelIndex index = m_listTemp->currentIndex(); + if(!index.isValid()) + { + onMsg(tr("请选中要添加测点的模板!")); + return; + } + KbdTableModel *model = qobject_cast(m_tableTempPoint->getTable()->model()); + if(model == NULL) + return; + + KbdPropertyDlg dlg(false, this); + dlg.setWindowTitle(tr("添加保护定值")); + dlg.panel()->setDisplayRow(model,model->rowCount()); + dlg.panel()->setDotStringPrefix(CN_TAG_NAME,index.data(Qt::UserRole).toString()); + dlg.panel()->setPropertyValue(CN_DEV_TP_NAME,index.data(Qt::UserRole).toString()); + + QStringList rowDatas; + if(dlg.exec()) + { + rowDatas = dlg.panel()->getPropertyData(); + } + if(rowDatas.isEmpty()) + return; + + bool success = true; + QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); + if(retStr.isEmpty()) + { + success = model->addRow(rowDatas,true); + if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) + onCommitError(); + } + else + onStartTransactionError(retStr); + + if(!success) + { + onMsg(tr("添加失败")); + return; + } + KbdMsgContrl::getInstance()->showMsg(tr("添加成功"),this); + +} + +void FesTempWidget::onModifyTempPoint() +{ + KbdTableModel *model = qobject_cast(m_tableTempPoint->getTable()->model()); + if(model == NULL) + return; + + QListWidgetItem *devTempItem = m_listTemp->currentItem(); + if(devTempItem == NULL) + { + onMsg(tr("请选中要修改的模板")); + return; + } + + QModelIndex index = m_tableTempPoint->getTable()->currentIndex(); + if(!index.isValid()) + { + onMsg(tr("请选中要修改的行")); + return; + } + + KbdFesTempPointModifyDlg dlg(devTempItem->data(Qt::UserRole).toString()); + dlg.panel()->setDisplayRow(model,index.row()); + dlg.panel()->relayoutByEditable(); + if(dlg.exec()) + { + m_tableTempPoint->getTable()->reFresh(); + } +} + +void FesTempWidget::onCopyTempPoint() +{ + QModelIndex index = m_tableTempPoint->getTable()->currentIndex(); + if(!index.isValid()) + { + onMsg(tr("请选中要复制的模板点")); + return; + } + KbdTableModel *modelPointTemp = qobject_cast(m_tableTempPoint->getTable()->model()); + if(modelPointTemp == NULL) + return; + + //数据块的模板使用该函数 + if(m_tabTempPoint->tabText(m_tabTempPoint->currentIndex()) == TAB_FES_DATA_BLOCK) + { + onCopyTempPointDataBlock(); + return; + } + + bool success = false; + QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); + if(retStr.isEmpty()) + { + QStringList rowDatas = modelPointTemp->getRowData(index.row()); + //TAG_NAME SEQ_NO DESC要修改 + const ColMgrDataList& modelPointTempCols = modelPointTemp->getHeadCols(); + //要确保TAG_NAME唯一 + int colTagName = modelPointTempCols.findCol(CN_TAG_NAME); + QString tagName = rowDatas.at(modelPointTempCols.findCol(CN_DEV_TP_NAME)) + "." + + Common::getAfterLastDot(rowDatas.at(colTagName)) + + QString::number(modelPointTemp->getMaxValue(CN_SEQ_NO) +1); + rowDatas.replace(colTagName,tagName); + + int colDesc = modelPointTempCols.findCol(CN_DESC); + rowDatas.replace(colDesc,rowDatas.at(colDesc)); + rowDatas.replace(modelPointTempCols.findCol(CN_SEQ_NO),QString::number(modelPointTemp->getMaxValue(CN_SEQ_NO) +1)); + + success = modelPointTemp->addRow(rowDatas,true); + if(!success) + onMsg(tr("复制点失败!")); + + if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) + onCommitError(); + } + else + onStartTransactionError(retStr); + + if(!success) + return; + +} + +void FesTempWidget::onCopyTempPointDataBlock() +{ + QModelIndex index = m_tableTempPoint->getTable()->currentIndex(); + if(!index.isValid()) + { + onMsg(tr("请选中要复制的模板点")); + return; + } + KbdTableModel *modelPointTemp = qobject_cast(m_tableTempPoint->getTable()->model()); + if(modelPointTemp == NULL) + return; + + bool success = false; + QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); + if(retStr.isEmpty()) + { + QStringList rowDatas = modelPointTemp->getRowData(index.row()); + const ColMgrDataList& modelPointTempCols = modelPointTemp->getHeadCols(); + //要确保TAG_NAME唯一 + int colTagName = modelPointTempCols.findCol(CN_TAG_NAME); + QString tagName = rowDatas.at(modelPointTempCols.findCol(CN_DEV_TP_NAME)) + "." + + Common::getAfterLastDot(rowDatas.at(colTagName)) + + QString::number(modelPointTemp->rowCount() +1); + rowDatas.replace(colTagName,tagName); + + success = modelPointTemp->addRow(rowDatas,true); + if(!success) + onMsg(tr("复制点失败!")); + + if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) + onCommitError(); + } + else + onStartTransactionError(retStr); + + if(!success) + return; +} + +void FesTempWidget::onRemoveTempPoint() +{ + QModelIndexList selRows = m_tableTempPoint->getTable()->selectionModel()->selectedRows(); + if(selRows.isEmpty()) + { + N_MessageBox::information(this,tr("消息"),tr("请至少选择一条数据!")); + return; + } + + if(N_MessageBox::No == N_MessageBox::information(this,tr("消息"),tr("是否删除前置测点?"),N_MessageBox::Yes,N_MessageBox::No)) + return; + + KbdTableModel *model = qobject_cast(m_tableTempPoint->getTable()->model()); + if(model == NULL) + return; + QList list; + foreach (QModelIndex index, m_tableTempPoint->getTable()->selectionModel()->selectedRows()) { + list<< index.row(); + } + if(list.isEmpty()) + return; + + bool success = false; + QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); + if(retStr.isEmpty()) + { + success = model->removeTableRows(list); + if(!success) + onMsg(tr("删除失败!")); + + if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) + onCommitError(); + } + else + onStartTransactionError(retStr); + + if(!success) + return; + + KbdMsgContrl::getInstance()->showMsg(tr("删除成功"),this); +} + +void FesTempWidget::onAddDevTemp() +{ + KbdTableModel * modelDevTemp = KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_TEMP_DEF_FOR_ADD); + if(modelDevTemp == NULL) + return; + + KbdPropertyDlg dlg(true,this); + dlg.setWindowTitle(tr("添加前置模板")); + dlg.panel()->setDisplayRow(modelDevTemp,modelDevTemp->rowCount()); + + bool success = false; + QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); + if(retStr.isEmpty()) + { + + if(dlg.exec()) + { + success = true; + } + else + { + success =false; + } + + if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) + onCommitError(); + } + else + onStartTransactionError(retStr); + + if(!success) + return; + //刷新对应控件 + QStringList rowDatas = dlg.panel()->getPropertyData(); + const ColMgrDataList& modelDevTempCols = modelDevTemp->getHeadCols(); + addListWidgetItem(m_listTemp,rowDatas.at(modelDevTempCols.findCol(CN_DESC)), + rowDatas.at(modelDevTempCols.findCol(CN_TAG_NAME))); + m_tableTempPoint->getTable()->setModel(NULL); + KbdMsgContrl::getInstance()->showMsg(tr("添加成功!"),this); + +} + +void FesTempWidget::onModifyDevTemp() +{ + QModelIndex index = m_listTemp->currentIndex(); + if(!index.isValid()) + { + onMsg(tr("请选中要修改的模板")); + return; + } + QString filter = QString("%1='%2'").arg(CN_TAG_NAME).arg(index.data(Qt::UserRole).toString()); + KbdTableModel * modelDevTemp = KbdTableDataMgr::getInstance()->createModel(Common::createViewName(TBL_FES_DEV_TEMP_DEF,filter)); + if(modelDevTemp == NULL) + return; + + if(!modelDevTemp->load(true)) + return; + + if(modelDevTemp->rowCount() != 1) + { + onMsg(tr("该模板在数据库中的数据不唯一")); + return; + } + + KbdPropertyDlg dlg(true, this); + dlg.setWindowTitle(tr("修改前置模板")); + dlg.panel()->setDisplayRow(modelDevTemp,0); + dlg.panel()->relayoutByEditable(); + QStringList oldDatas = dlg.panel()->getPropertyData(); + bool success = false; + QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); + if(retStr.isEmpty()) + { + if(dlg.exec()) + { + success = true; + } + + if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) + onCommitError(); + } + else + onStartTransactionError(retStr); + + if(!success) + return; + //刷新对应控件 + QStringList newDatas = dlg.panel()->getPropertyData(); + QString oldDesc,newDesc, oldTag,newTag; + const ColMgrDataList& modelDevTempCols = modelDevTemp->getHeadCols(); + oldDesc = oldDatas.at(modelDevTempCols.findCol(CN_DESC)); + newDesc = newDatas.at(modelDevTempCols.findCol(CN_DESC)); + oldTag = oldDatas.at(modelDevTempCols.findCol(CN_TAG_NAME)); + newTag = newDatas.at(modelDevTempCols.findCol(CN_TAG_NAME)); + if(oldDesc != newDesc || oldTag != newTag) + { + QListWidgetItem *item = findItem(m_listTemp,oldTag); + if(item) + { + item->setText(newDesc); + item->setData(Qt::UserRole,newTag); + } + } + + m_tableTempPoint->getTable()->setModel(NULL); + KbdMsgContrl::getInstance()->showMsg(tr("修改成功!"),this); + +} + +void FesTempWidget::onRemoveDevTemp() +{ + if(N_MessageBox::No == N_MessageBox::information(this,tr("消息"),tr("是否删除前置模板?"),N_MessageBox::Yes,N_MessageBox::No)) + return; + + QList selectItems = m_listTemp->selectedItems(); + if(selectItems.isEmpty()) + return; + + KbdTableModel * modelDevTemp = KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_TEMP_DEF); + if(modelDevTemp == NULL) + return; + + KbdDbDesign ds; + QStringList rtuList; + foreach (QListWidgetItem *item, selectItems) { + if(!ds.isExistFesDevByTemp(item->data(Qt::UserRole).toString(),rtuList)) + { + onMsg(tr("链接数据库查询失败")); + return; + } + + if(!rtuList.isEmpty()) + { + if(N_MessageBox::No == N_MessageBox::information(this,tr("消息"), + tr("有以下RTU引用了模板%1:\n%2 \n 是否强制删除此模板?") + .arg(item->text()) + .arg(rtuList.join("\n")), + N_MessageBox::Yes,N_MessageBox::No)) + return; + } + } + + QMap filterMap; + bool success = false; + QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); + if(retStr.isEmpty()) + { + foreach (QListWidgetItem *item, selectItems) { + filterMap.clear(); + filterMap.insert(CN_TAG_NAME,item->data(Qt::UserRole).toString()); + success = modelDevTemp->removeTableRows(filterMap); + + if(!success) + { + onMsg(tr("删除失败")); + break; + } + } + + if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) + onCommitError(); + } + else + onStartTransactionError(retStr); + + if(!success) + return; + + deleteListWidgetItem(m_listTemp,selectItems); + m_tableTempPoint->getTable()->setModel(NULL); + KbdMsgContrl::getInstance()->showMsg(tr("删除设备成功"),this); + +} + +void FesTempWidget::onExportFesTemp() +{ + QModelIndex index = m_listTemp->currentIndex(); + if(!index.isValid()) + { + onMsg(tr("请选中需要导出的设备")); + return; + } + + QDir dir; + QString strDir = Common::getIscsHome() + "/data/modelstudio/fesTemplate/"; + if(!dir.exists(strDir)) + dir.mkpath(strDir); + + QString tempTagName = index.data(Qt::UserRole).toString(); + QString filePath = QFileDialog::getSaveFileName(this,tr("保存模板"), + strDir + tempTagName+"-"+index.data().toString()+".xlsx", + "(*.xlsx)"); + if(filePath.isEmpty()) + return; + + QString error; + QString filter; + KbdTableModel *model = NULL; + QXlsx::Document xlsx; + filter = QString("%1='%2'").arg(CN_TAG_NAME).arg(tempTagName); + model = KbdTableDataMgr::getInstance()->createModel( + Common::createViewName(TBL_FES_DEV_TEMP_DEF,filter)); + if(model == NULL) + { + onMsg(tr("导出模板不成功!")); + return; + } + //导出设备模板 + error = model->exportExcel(xlsx,SN_FES_DEV_TEMP); + if(!error.isEmpty()) + { + onMsg(tr("导出设备模板不成功!\n原因:%1").arg(error)); + return; + } + //导出模板点 + error = exportFesTempPoint(xlsx,Common::FES_ACCUML_TEMP,SN_FES_ACC,tempTagName); + if(!error.isEmpty()) + { + onMsg(tr("导出设备模板不成功!\n原因:%1").arg(error)); + return; + } + + error = exportFesTempPoint(xlsx,Common::FES_ANALOG_TEMP,SN_FES_ANA,tempTagName); + if(!error.isEmpty()) + { + onMsg(tr("导出设备模板不成功!\n原因:%1").arg(error)); + return; + } + + error = exportFesTempPoint(xlsx,Common::FES_DIGITAL_TEMP,SN_FES_DIG,tempTagName); + if(!error.isEmpty()) + { + onMsg(tr("导出设备模板不成功!\n原因:%1").arg(error)); + return; + } + + error = exportFesTempPoint(xlsx,Common::FES_MIX_TEMP,SN_FES_MIX,tempTagName); + if(!error.isEmpty()) + { + onMsg(tr("导出设备模板不成功!\n原因:%1").arg(error)); + return; + } + + error = exportFesTempPoint(xlsx,Common::FES_ANALOG_CTRL_TEMP,SN_FES_ANA_CTL,tempTagName); + if(!error.isEmpty()) + { + onMsg(tr("导出设备模板不成功!\n原因:%1").arg(error)); + return; + } + + error = exportFesTempPoint(xlsx,Common::FES_DIGITAL_CTRL_TEMP,SN_FES_DIG_CTL,tempTagName); + if(!error.isEmpty()) + { + onMsg(tr("导出设备模板不成功!\n原因:%1").arg(error)); + return; + } + + error = exportFesTempPoint(xlsx,Common::FES_MIX_CTRL_TEMP,SN_FES_MIX_CTL,tempTagName); + if(!error.isEmpty()) + { + onMsg(tr("导出设备模板不成功!\n原因:%1").arg(error)); + return; + } + + error = exportFesConstTemp(xlsx,SN_FES_CONST,tempTagName); + if(!error.isEmpty()) + { + onMsg(tr("导出设备模板不成功!\n原因:%1").arg(error)); + return; + } + + error = exportFesDataBlockTemp(xlsx,SN_FES_DATA_BLOCK,tempTagName); + if(!error.isEmpty()) + { + onMsg(tr("导出设备模板不成功!\n原因:%1").arg(error)); + return; + } + //修改模板,去掉一些不必要的列,和修改列值 + error = afterExportFesTemp(xlsx); + if(!error.isEmpty()) + { + onMsg(tr("导出设备模板不成功!\n原因:%1").arg(error)); + return; + } + + if(!xlsx.saveAs(filePath)) + { + onMsg(tr("保存文件失败!\n%1").arg(filePath)); + return; + } + + KbdMsgContrl::getInstance()->showMsg(tr("导出成功!导出路径:\n %1").arg(filePath),this); + +} + +void FesTempWidget::onImportFesTemp() +{ + QDir dir; + QString strDir = Common::getIscsHome() + "/data/modelstudio/fesTemplate"; + if(!dir.exists(strDir)) + dir.mkpath(strDir); + QStringList list = QFileDialog::getOpenFileNames(this,tr("模板导入"),strDir,"Excel (*.xlsx)"); + if(list.isEmpty()) + return; + + QString error; + foreach (QString filePath, list) { + error = importFesTemp(filePath); + if(!error.isEmpty()) + { + onMsg(tr("导入失败!\n" + "失败文件:%1\n" + "失败原因:%2\n").arg(filePath).arg(error)); + onRefresh(); + m_tableTempPoint->getTable()->setModel(NULL); + return; + } + } + + //刷新控件 + onRefresh(); + m_tableTempPoint->getTable()->setModel(NULL); + KbdMsgContrl::getInstance()->showMsg(tr("导入成功"),this); + +} + +void FesTempWidget::onImportPcs3000Temp() +{ + QStringList list = QFileDialog::getOpenFileNames(this,tr("模板导入"),"","CSV (*.CSV *.csv)"); + if(list.isEmpty()) + return; + + KbdTableModel *model = KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_TEMP_DEF_FOR_IMPORT); + if(model == NULL) + { + onMsg(tr("导入失败")); + return; + } + KbdPropertyDlg dlg(false, this); + dlg.setWindowTitle(tr("请输入模板所属的专业和类型")); + dlg.panel()->setDisplayRow(model,model->rowCount()); + if(dlg.exec() == QDialog::Rejected) + return; + const ColMgrDataList& modelCols = model->getHeadCols(); + QStringList dataList = model->unwrapData(dlg.panel()->getPropertyData()); + QString subSystem = dataList.at(modelCols.findCol(CN_SUB_SYSTEM)); + QString devType = dataList.at(modelCols.findCol(CN_DEV_TYPE_ID)); + + QString error; + foreach (QString filePath, list) { + error = importPcs3000Temp(filePath,subSystem,devType); + if(!error.isEmpty()) + { + onMsg(tr("导入失败!\n" + "失败文件:%1\n" + "失败原因:%2\n").arg(filePath).arg(error)); + onRefresh(); + m_tableTempPoint->getTable()->setModel(NULL); + return; + } + } + + //刷新控件 + onRefresh(); + m_tableTempPoint->getTable()->setModel(NULL); + + KbdMsgContrl::getInstance()->showMsg(tr("导入成功"),this); +} + +void FesTempWidget::onReadTempFromPsc3000() +{ + QString csvFile = QFileDialog::getOpenFileName(this,tr("选择PSC3000导出的转发数据"),""); + if(csvFile.isEmpty()) + return; + + KbdCSVReader reader; + QString xlsxPath; + QString errorMsg = reader.convertPsc3000Data(Common::getTreePath("pcs3000ImportData.json"), + csvFile,xlsxPath); + if(!errorMsg.isEmpty()) + { + onMsg(errorMsg); + return; + } + + QFile file(xlsxPath); + if(!file.open(QIODevice::ReadOnly)) + { + onMsg(tr("文件打开不成功!")); + return; + } + + QStringList listOldFesTemp, listDes; + KbdDbDesign ds; + ds.getTwoColumnResult("select TAG_NAME,DESCRIPTION from fes_dev_temp_def", listOldFesTemp, listDes); + + QXlsx::Document xlsx(&file); + QString error; + QStringList fesTempList; + //刷新前置模板 + error = getXlsxVaue(xlsx,"设备",CN_DEV_MODEL,fesTempList); + if(!error.isEmpty()) + { + onMsg(error); + return; + } + + QMap mapTemp; + foreach (QString str, fesTempList) { + mapTemp.insert(str,0); + } + fesTempList = mapTemp.uniqueKeys(); + if(fesTempList.isEmpty()) + { + onMsg(tr("未检测到任何设备模板")); + return; + } + QFileInfo info(xlsxPath); + KbdFesTempDlg dlg(info.absolutePath(),fesTempList); + if(dlg.exec()) + { + QStandardItemModel *model = dlg.getModel(); + for(int i = 0 ; i< model->rowCount(); i++) + { + if(model->item(i,0)->checkState() == Qt::Checked) + { + error = importPcs3000Temp(model->item(i,0)->data(Qt::UserRole).toString(), + "4", + model->item(i,1)->data(Qt::DisplayRole).toString().split(":").first()); + if(!error.isEmpty()) + { + onMsg(tr("导入失败!\n" + "失败原因:%1\n").arg(error)); + onRefresh(); + m_tableTempPoint->getTable()->setModel(NULL); + return; + } + } + + } + } + afterImportFesTemp(listOldFesTemp); + onRefresh(); + m_tableTempPoint->getTable()->setModel(NULL); + + KbdMsgContrl::getInstance()->showMsg(tr("导入成功"),this); +} + +void FesTempWidget::onRefresh() +{ + KbdDbDesign ds; + QString sql = QString("SELECT TAG_NAME,DESCRIPTION FROM fes_dev_temp_def;"); + reloadList(m_listTemp,ds.getSqlItems(sql,CN_DESC,CN_TAG_NAME)); + reloadList(m_listTempPlugin,ds.getSqlItems(sql,CN_DESC,CN_TAG_NAME)); +} + +void FesTempWidget::onInstDev() +{ + KbdTableModel *modelFesDev = KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_INFO_FOR_ADD); + if(modelFesDev == NULL) + return; + + QListWidgetItem *item = m_listTemp->currentItem(); + if(item == NULL) + { + onMsg(tr("请选择要实例化的前置模板")); + return; + } + KbdDbDesign ds; + QString sql = QString("SELECT TAG_NAME,DEV_TYPE_ID FROM fes_dev_temp_def WHERE TAG_NAME = '%1';") + .arg(item->data(Qt::UserRole).toString()); + QStringList tagList,typeList; + if(!ds.getTwoColumnResult(sql,tagList,typeList)) + { + onMsg(tr("获取模板信息失败!")); + return; + } + if(typeList.size() != 1) + { + onMsg(tr("模板信息错误")); + return; + } + + KbdBatchFesDevDlg dlg; + dlg.setWindowTitle(tr("批量实例化前置设备")); + dlg.panel()->setDisplayRow(modelFesDev,modelFesDev->rowCount()); + dlg.panel()->setPropertyValue(CN_DEV_TP_NAME,item->data(Qt::UserRole).toString()); + dlg.panel()->setPropertyValue(CN_DEV_TYPE_ID,typeList.first()); + + if(dlg.exec()) + { + onMsg(tr("实例化成功!")); +// KbdMsgContrl::getInstance()->showMsg(tr("实例化成功!"),this); + } + +} + +void FesTempWidget::onCopyFesTemp() +{ + QListWidgetItem *item = m_listTemp->currentItem(); + if(item == NULL) + return; + + QString devTempTagName = item->data(Qt::UserRole).toString(); + + KbdTableModel * modelDevTemp = KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_TEMP_DEF_FOR_ADD); + if(modelDevTemp == NULL) + return; + + QStringList datas; + QMap > tempMap; + QList showCols; + const ColMgrDataList& modelDevTempCols = modelDevTemp->getHeadCols(); + showCols << modelDevTempCols.findCol(CN_TAG_NAME); + showCols << modelDevTempCols.findCol(CN_DESC); + KbdPropertyDlg dlg(false, this); + dlg.panel()->setDisplayRow(modelDevTemp,modelDevTemp->rowCount(),tempMap,showCols); + dlg.setWindowTitle(tr("复制前置设备模板")); + dlg.panel()->setPropertyEditableOnly(QStringList()<setPropertyValue(CN_TAG_NAME,""); + dlg.panel()->setPropertyValue(CN_DESC,""); + dlg.panel()->setPropertyValue(CN_SUB_SYSTEM,"4"); + dlg.panel()->setPropertyValue(CN_DEV_TYPE_ID,"1"); + if(dlg.exec()) + { + datas = dlg.panel()->getPropertyData(); + datas = modelDevTemp->unwrapData(datas); + KbdDbDesign ds; + QString sql = QString("SELECT TAG_NAME FROM fes_dev_temp_def WHERE TAG_NAME = '%1'") + .arg(datas.at(modelDevTempCols.findCol(CN_TAG_NAME))); + bool exist = false; + if(!ds.isExist(sql,exist)) + { + onMsg(tr("数据库链接错误")); + return; + } + if(exist) + { + onMsg(tr("标签名已存在,请修改")); + return; + } + + } + + if(datas.isEmpty()) + return; + + bool success = false; + QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); + if(retStr.isEmpty()) + { + + + success = KbdTableDataMgr::getInstance()->callProcedure(PROC_COPY_FES_TEMP, + QStringList()<commit()?false:((success=false)||true)) + onCommitError(); + } + else + onStartTransactionError(retStr); + + if(!success) + { + onMsg(tr("复制失败!")); + return; + } + + addListWidgetItem(m_listTemp,datas.at(modelDevTempCols.findCol(CN_DESC)),datas.at(modelDevTempCols.findCol(CN_TAG_NAME))); + m_tableTempPoint->getTable()->setModel(NULL); + KbdMsgContrl::getInstance()->showMsg(tr("复制成功!"),this); + +} + +void FesTempWidget::onShowApplyOpMenu() +{ + m_menuApplyOp->exec(QCursor::pos()); +} + +void FesTempWidget::onApplyAddToDev() +{ + KbdTableModel *model = qobject_cast(m_tableTempPoint->getTable()->model()); + if(model == NULL) + return; + //添加时要判断对应的测点是否已经添加,至少能报错 + QModelIndexList selectIndexs = m_tableTempPoint->getTable()->selectionModel()->selectedRows(); + if(selectIndexs.isEmpty()) + { + onMsg(tr("未选中模板点")); + return; + } + + QListWidgetItem *devTempItem = m_listTemp->currentItem(); + if(devTempItem == NULL) + { + onMsg(tr("请选中要修改的模板")); + return; + } + + KbdFesDevListDlg dlg(devTempItem->data(Qt::UserRole).toString()); + dlg.setWindowTitle(tr("选中要添加的设备")); + if(dlg.exec() != QDialog::Accepted) + return; + + QStringList devInstTagList = dlg.getCheckedDevs(); + if(devInstTagList.isEmpty()) + return; + + //检查设备中是否已经存在对应的模板点 + const ColMgrDataList& modelCols = model->getHeadCols(); + int colTag = modelCols.findCol(CN_TAG_NAME); + //插入操作 + bool success = false; + QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); + if(retStr.isEmpty()) + { + foreach (QModelIndex index, selectIndexs) { + QStringList rowDatas = model->getRowData(index.row()); + QString pointTempTagName = rowDatas.at(colTag); + QString ptType = ""; + QString tableName = model->getTableName(); + if(tableName.compare("FES_DEV_PT_TEMP_DEF",Qt::CaseInsensitive) == 0) + { + ptType = rowDatas.at(modelCols.findCol(CN_POINT_TYPE)); + } + + QString sql; + if(tableName.compare("FES_DEV_PT_TEMP_DEF",Qt::CaseInsensitive) == 0) + { + if(ptType == Common::getFesPointTempType(Common::FES_ACCUML_TEMP)) + { + sql = "INSERT INTO fes_accuml( " + "TAG_NAME,LOCATION_ID,SUB_SYSTEM,DOT_NO,RTU_TAG,DEV_TAG,SEQ_NO,APP_TABLE_NAME,APP_TAG_NAME,APP_COLUMN_NAME, BASE, COEFF, RTU_NO, RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4,RES_PARA_INT5,RES_PARA_INT6,RES_PARA_INT7,RES_PARA_INT8,RES_PARA_STR1,RES_PARA_STR2, DESCRIPTION, FES_POINT_TP_NAME, PATH61850,POSITION61850) SELECT " + "concat(fes_dev_info.RTU_TAG, '.' , getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_ACC'))), fes_dev_info.LOCATION_ID ,fes_dev_info.SUB_SYSTEM ,getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_ACC')), fes_dev_info.RTU_TAG,fes_dev_info.TAG_NAME,fes_dev_pt_temp_def.SEQ_NO,'', '', '', '0', '1', fes_dev_info.RTU_NO ,RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4,RES_PARA_INT5,RES_PARA_INT6,RES_PARA_INT7,RES_PARA_INT8,RES_PARA_STR1,RES_PARA_STR2, fes_dev_pt_temp_def.DESCRIPTION ,fes_dev_pt_temp_def.TAG_NAME ,PATH61850,POSITION61850 " + "FROM fes_dev_pt_temp_def,fes_dev_info " + "WHERE fes_dev_pt_temp_def.TAG_NAME = '%1' AND fes_dev_info.TAG_NAME IN (%2)"; + } + else if(ptType == Common::getFesPointTempType(Common::FES_ANALOG_TEMP)) + { + sql = "INSERT INTO fes_analog( " + "TAG_NAME,LOCATION_ID,SUB_SYSTEM,DEV_TAG,SEQ_NO, RTU_TAG,RTU_NO,DOT_NO,APP_TABLE_NAME,APP_TAG_NAME,APP_COLUMN_NAME,IS_FILTER,PERCENT,DEADBAND_TYPE,DEADBAND,ZEROBAND,BASE,COEFF,MAX_RANGE,MIN_RANGE,RES_PARA_INT1,RES_PARA_INT2,RES_PARA_INT3,RES_PARA_INT4,RES_PARA_INT5,RES_PARA_INT6,RES_PARA_INT7,RES_PARA_INT8,RES_PARA_STR1,RES_PARA_STR2,DESCRIPTION,FES_POINT_TP_NAME,PATH61850,POSITION61850) SELECT " + "concat(fes_dev_info.RTU_TAG, '.' , getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_ANA'))), fes_dev_info.LOCATION_ID ,fes_dev_info.SUB_SYSTEM , fes_dev_info.TAG_NAME,SEQ_NO, fes_dev_info.RTU_TAG,fes_dev_info.RTU_NO , getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_ANA')),'','','',0,0,'0','0','0','0','1',65536,0,RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4,RES_PARA_INT5,RES_PARA_INT6,RES_PARA_INT7,RES_PARA_INT8,RES_PARA_STR1,RES_PARA_STR2, fes_dev_pt_temp_def.DESCRIPTION , fes_dev_pt_temp_def.TAG_NAME ,PATH61850,POSITION61850 " + "FROM fes_dev_pt_temp_def,fes_dev_info " + "WHERE fes_dev_pt_temp_def.TAG_NAME = '%1' AND fes_dev_info.TAG_NAME IN (%2);"; + } + else if(ptType == Common::getFesPointTempType(Common::FES_DIGITAL_TEMP)) + { + sql = "INSERT INTO fes_digital( " + "TAG_NAME,LOCATION_ID,SUB_SYSTEM,DEV_TAG, SEQ_NO,RTU_TAG,DOT_NO,APP_TABLE_NAME, APP_TAG_NAME, APP_COLUMN_NAME, FILTER_ERR, FILTER_DISTURB, DISTURB_TIME, REVERS, RTU_NO,RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4,RES_PARA_INT5,RES_PARA_INT6,RES_PARA_INT7,RES_PARA_INT8,RES_PARA_STR1,RES_PARA_STR2, DESCRIPTION,FES_POINT_TP_NAME,PATH61850,POSITION61850) SELECT " + "concat(fes_dev_info.RTU_TAG, '.' , getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_DIG'))), fes_dev_info.LOCATION_ID ,fes_dev_info.SUB_SYSTEM , fes_dev_info.TAG_NAME,SEQ_NO, fes_dev_info.RTU_TAG,getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_DIG')), '', '', '', 0, 0, 0, 0, fes_dev_info.RTU_NO , RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4,RES_PARA_INT5,RES_PARA_INT6,RES_PARA_INT7,RES_PARA_INT8,RES_PARA_STR1,RES_PARA_STR2, fes_dev_pt_temp_def.DESCRIPTION , fes_dev_pt_temp_def.TAG_NAME ,PATH61850,POSITION61850 " + "FROM fes_dev_pt_temp_def,fes_dev_info " + "WHERE fes_dev_pt_temp_def.TAG_NAME = '%1' AND fes_dev_info.TAG_NAME IN (%2);"; + } + else if(ptType == Common::getFesPointTempType(Common::FES_MIX_TEMP)) + { + sql = "INSERT INTO fes_mix( " + "TAG_NAME,DESCRIPTION,LOCATION_ID,SUB_SYSTEM,RTU_TAG,RTU_NO,DOT_NO,DEV_TAG,SEQ_NO, APP_TABLE_NAME, APP_TAG_NAME, APP_COLUMN_NAME, BASE, COEFF, MAX_RANGE, MIN_RANGE, RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4,RES_PARA_INT5,RES_PARA_INT6,RES_PARA_INT7,RES_PARA_INT8,RES_PARA_STR1,RES_PARA_STR2, FES_POINT_TP_NAME,PATH61850,POSITION61850) SELECT " + "concat(fes_dev_info.RTU_TAG, '.' , getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_MIX'))), fes_dev_pt_temp_def.DESCRIPTION ,fes_dev_info.LOCATION_ID ,fes_dev_info.SUB_SYSTEM , fes_dev_info.RTU_TAG,fes_dev_info.RTU_NO, getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_MIX')), fes_dev_info.TAG_NAME, SEQ_NO, '', '', '', '0', '1', 65536, 0, RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4,RES_PARA_INT5,RES_PARA_INT6,RES_PARA_INT7,RES_PARA_INT8,RES_PARA_STR1,RES_PARA_STR2, fes_dev_pt_temp_def.TAG_NAME ,PATH61850,POSITION61850 " + "FROM fes_dev_pt_temp_def,fes_dev_info " + "WHERE fes_dev_pt_temp_def.TAG_NAME = '%1' AND fes_dev_info.TAG_NAME IN (%2);"; + } + else if(ptType == Common::getFesPointTempType(Common::FES_ANALOG_CTRL_TEMP)) + { + sql = "INSERT INTO fes_analog_ctrl( " + "TAG_NAME,DESCRIPTION,LOCATION_ID,SUB_SYSTEM,RTU_TAG,RTU_NO,DOT_NO,DEV_TAG,SEQ_NO, BASE, COEFF, MAX_RANGE, MIN_RANGE, POINT_TP_NAME,RES_PARA_INT1,RES_PARA_INT2,RES_PARA_INT3,RES_PARA_INT4,RES_PARA_INT5,RES_PARA_INT6,RES_PARA_INT7,RES_PARA_INT8,RES_PARA_STR1,RES_PARA_STR2,PATH61850,POSITION61850)SELECT " + "concat(fes_dev_info.RTU_TAG, '.' , getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_ANA_CTRL'))),fes_dev_pt_temp_def.DESCRIPTION,fes_dev_info.LOCATION_ID ,fes_dev_info.SUB_SYSTEM , fes_dev_info.RTU_TAG,fes_dev_info.RTU_NO, getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_ANA_CTRL')), fes_dev_info.TAG_NAME,SEQ_NO, '0', '1', 65536, 0, fes_dev_pt_temp_def.TAG_NAME ,RES_PARA_INT1,RES_PARA_INT2,RES_PARA_INT3,RES_PARA_INT4,RES_PARA_INT5,RES_PARA_INT6,RES_PARA_INT7,RES_PARA_INT8,RES_PARA_STR1,RES_PARA_STR2,PATH61850,POSITION61850 " + "FROM fes_dev_pt_temp_def,fes_dev_info " + "WHERE fes_dev_pt_temp_def.TAG_NAME = '%1' AND fes_dev_info.TAG_NAME IN (%2);"; + } + else if(ptType == Common::getFesPointTempType(Common::FES_DIGITAL_CTRL_TEMP)) + { + sql = "INSERT INTO fes_digital_ctrl( " + "TAG_NAME,DESCRIPTION,LOCATION_ID,SUB_SYSTEM,RTU_TAG,RTU_NO,DOT_NO,DEV_TAG,SEQ_NO, REVERS, POINT_TP_NAME, RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4,RES_PARA_INT5,RES_PARA_INT6,RES_PARA_INT7,RES_PARA_INT8,RES_PARA_STR1,RES_PARA_STR2,PATH61850,POSITION61850,YK_SELECT61850, YK_EXE61850, YK_CANCLE61850, YK_DOUBLE_SELECT61850, YK_DOUBLE_EXE61850, YK_DOUBLE_CANCLE61850, PULSE_TIME) SELECT " + "concat(fes_dev_info.RTU_TAG, '.' , getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_DIG_CTRL'))),fes_dev_pt_temp_def.DESCRIPTION,fes_dev_info.LOCATION_ID ,fes_dev_info.SUB_SYSTEM , fes_dev_info.RTU_TAG,fes_dev_info.RTU_NO, getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_DIG_CTRL')), fes_dev_info.TAG_NAME,SEQ_NO, 0, fes_dev_pt_temp_def.TAG_NAME, RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4,RES_PARA_INT5,RES_PARA_INT6,RES_PARA_INT7,RES_PARA_INT8,RES_PARA_STR1,RES_PARA_STR2,PATH61850,POSITION61850,YK_SELECT61850, YK_EXE61850, YK_CANCLE61850, YK_DOUBLE_SELECT61850, YK_DOUBLE_EXE61850, YK_DOUBLE_CANCLE61850, PULSE_TIME " + "FROM fes_dev_pt_temp_def,fes_dev_info " + "WHERE fes_dev_pt_temp_def.TAG_NAME = '%1' AND fes_dev_info.TAG_NAME IN (%2);"; + } + else if(ptType == Common::getFesPointTempType(Common::FES_MIX_CTRL_TEMP)) + { + sql = "INSERT INTO fes_mix_ctrl( " + "TAG_NAME,DESCRIPTION,LOCATION_ID,SUB_SYSTEM,RTU_TAG,RTU_NO,DOT_NO,DEV_TAG,SEQ_NO, BASE, COEFF, MIN_RANGE, MAX_RANGE, POINT_TP_NAME,RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4,RES_PARA_INT5,RES_PARA_INT6,RES_PARA_INT7,RES_PARA_INT8,RES_PARA_STR1,RES_PARA_STR2,PATH61850,POSITION61850) SELECT " + "concat(fes_dev_info.RTU_TAG, '.' , getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_MIX_CTRL'))),fes_dev_pt_temp_def.DESCRIPTION,fes_dev_info.LOCATION_ID ,fes_dev_info.SUB_SYSTEM , fes_dev_info.RTU_TAG,fes_dev_info.RTU_NO, getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_MIX_CTRL')), fes_dev_info.TAG_NAME,SEQ_NO, '0', '1', 0, 65536, fes_dev_pt_temp_def.TAG_NAME, RES_PARA_INT1, RES_PARA_INT2, RES_PARA_INT3, RES_PARA_INT4,RES_PARA_INT5,RES_PARA_INT6,RES_PARA_INT7,RES_PARA_INT8,RES_PARA_STR1,RES_PARA_STR2,PATH61850,POSITION61850 " + "FROM fes_dev_pt_temp_def,fes_dev_info " + "WHERE fes_dev_pt_temp_def.TAG_NAME = '%1' AND fes_dev_info.TAG_NAME IN (%2);"; + } + } + else if(tableName.compare("FES_CONST_TEMP",Qt::CaseInsensitive) == 0) + { + sql = "INSERT INTO fes_const( " + "TAG_NAME,DESCRIPTION,GROUP_NO,RTU_TAG,RTU_NO,DOT_NO,SEQ_NO,SUB_SYSTEM,LOCATION_ID,DEV_TAG,VALUE,VALUE_TYPE,UNIT_ID,VALUE_TEXT, VALUE_RATIO,VALUE_ADDED,VALUE_MAX,VALUE_MIN,VALUE_DEFAULT,VALUE_VERIFY,EX_INFO,FES_POINT_TP_NAME,RES_PARA_INT1,RES_PARA_INT2,RES_PARA_INT3,RES_PARA_INT4,RES_PARA_INT5,RES_PARA_INT6,RES_PARA_INT7,RES_PARA_INT8,RES_PARA_STR1,RES_PARA_STR2,PATH61850,POSITION61850) SELECT " + "concat(fes_dev_info.RTU_TAG, '.' , getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_CONST'))), fes_const_temp.DESCRIPTION,GROUP_NO, fes_dev_info.RTU_TAG,fes_dev_info.RTU_NO,getMaxRtuDotNo(fes_dev_info.RTU_TAG,getFesPointType('FES_CONST')),SEQ_NO,fes_dev_info.SUB_SYSTEM,fes_dev_info.LOCATION_ID,fes_dev_info.TAG_NAME,VALUE,VALUE_TYPE,UNIT_ID,VALUE_TEXT, VALUE_RATIO,VALUE_ADDED,VALUE_MAX,VALUE_MIN,VALUE_DEFAULT,VALUE_VERIFY,EX_INFO,fes_const_temp.TAG_NAME,RES_PARA_INT1,RES_PARA_INT2,RES_PARA_INT3,RES_PARA_INT4,RES_PARA_INT5,RES_PARA_INT6,RES_PARA_INT7,RES_PARA_INT8,RES_PARA_STR1,RES_PARA_STR2, PATH61850,POSITION61850 " + "FROM fes_const_temp,fes_dev_info " + "WHERE fes_const_temp.TAG_NAME = '%1' AND fes_dev_info.TAG_NAME IN (%2);"; + } + else if(tableName.compare("FES_DATA_BLOCK_TEMP",Qt::CaseInsensitive) == 0) + { + sql = "INSERT INTO fes_data_block( " + "TAG_NAME,BLOCK_ID,RTU_TAG,RTU_NO,FUNC_CODE,STAR_ADDR,DATA_LEN, DATA_FARME_TYPE, REF_CYCLE, IS_CREATE_SOE,PARA_INT1,PARA_INT2,PARA_INT3,PARA_INT4,PARA_STR1,PARA_STR2,DESCRIPTION,LOCATION_ID,SUB_SYSTEM,LD, CALL_MODE, DATA_SET,DATA_SET_TYPE,DATA_SET_CALL_TIME,REPORT_CTRL, FES_POINT_TP_NAME, DEV_TAG) SELECT " + "concat(fes_dev_info.TAG_NAME,'.',getAfterLastDot(fes_data_block_temp.TAG_NAME)), BLOCK_ID, fes_dev_info.RTU_TAG,fes_dev_info.RTU_NO,FUNC_CODE,STAR_ADDR,DATA_LEN, DATA_FARME_TYPE, REF_CYCLE, IS_CREATE_SOE, fes_data_block_temp.PARA_INT1, fes_data_block_temp.PARA_INT2,fes_data_block_temp.PARA_INT3,fes_data_block_temp.PARA_INT4,fes_data_block_temp.PARA_STR1,fes_data_block_temp.PARA_STR2, fes_data_block_temp.DESCRIPTION,fes_dev_info.LOCATION_ID,fes_dev_info.SUB_SYSTEM,LD, CALL_MODE, DATA_SET,DATA_SET_TYPE,DATA_SET_CALL_TIME,REPORT_CTRL,fes_data_block_temp.TAG_NAME,fes_dev_info.TAG_NAME " + "FROM fes_data_block_temp,fes_dev_info " + "WHERE fes_data_block_temp.TAG_NAME = '%1' AND fes_dev_info.TAG_NAME IN (%2);"; + } + + sql = sql.arg(pointTempTagName) + .arg("'"+devInstTagList.join("','")+"'"); + success = KbdTableDataMgr::getInstance()->executeOnly(sql); + if(!success) + break; + } + + if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) + onCommitError(); + } + else + onStartTransactionError(retStr); + + if(!success) + { + onMsg(tr("添加点失败!")); + return; + } + + onMsg(tr("添加成功")); + KbdMsgContrl::getInstance()->showMsg(tr("添加成功!"),this); + +} + +void FesTempWidget::onApplyRemoveToDev() +{ + KbdTableModel *model = qobject_cast(m_tableTempPoint->getTable()->model()); + if(model == NULL) + return; + //添加时要判断对应的测点是否已经添加,至少能报错 + QModelIndexList selectIndexs = m_tableTempPoint->getTable()->selectionModel()->selectedRows(); + if(selectIndexs.isEmpty()) + { + onMsg(tr("未选中模板点")); + return; + } + + QListWidgetItem *devTempItem = m_listTemp->currentItem(); + if(devTempItem == NULL) + { + onMsg(tr("请选中要修改的模板")); + return; + } + + KbdFesDevListDlg dlg(devTempItem->data(Qt::UserRole).toString()); + dlg.setWindowTitle(tr("选中要删除的设备")); + if(dlg.exec() != QDialog::Accepted) + return; + + const ColMgrDataList& modelCols = model->getHeadCols(); + QStringList devInstTagList = dlg.getCheckedDevs(); + int colTag = modelCols.findCol(CN_TAG_NAME); + + bool success = false; + QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); + if(retStr.isEmpty()) + { + foreach (QModelIndex index, selectIndexs) { + QStringList rowDatas = model->getRowData(index.row()); + QString pointTempTagName = rowDatas.at(colTag); + QString ptType = ""; + QString tableName = model->getTableName(); + if(tableName.compare("FES_DEV_PT_TEMP_DEF",Qt::CaseInsensitive) == 0) + { + ptType = rowDatas.at(modelCols.findCol(CN_POINT_TYPE)); + } + + QString sql; + + if(!devInstTagList.isEmpty()) + { + if(tableName.compare("FES_DEV_PT_TEMP_DEF",Qt::CaseInsensitive) == 0) + { + if(ptType == Common::getFesPointTempType(Common::FES_ACCUML_TEMP)) + { + sql = "DELETE FROM fes_accuml WHERE FES_POINT_TP_NAME = '%1' AND DEV_TAG IN (%2);"; + } + else if(ptType == Common::getFesPointTempType(Common::FES_ANALOG_TEMP)) + { + sql = "DELETE FROM fes_analog WHERE FES_POINT_TP_NAME = '%1' AND DEV_TAG IN (%2);"; + } + else if(ptType == Common::getFesPointTempType(Common::FES_DIGITAL_TEMP)) + { + sql = "DELETE FROM fes_digital WHERE FES_POINT_TP_NAME = '%1' AND DEV_TAG IN (%2);"; + } + else if(ptType == Common::getFesPointTempType(Common::FES_MIX_TEMP)) + { + sql = "DELETE FROM fes_mix WHERE FES_POINT_TP_NAME = '%1' AND DEV_TAG IN (%2);"; + } + else if(ptType == Common::getFesPointTempType(Common::FES_ANALOG_CTRL_TEMP)) + { + sql = "DELETE FROM fes_analog_ctrl WHERE POINT_TP_NAME = '%1' AND DEV_TAG IN (%2);"; + } + else if(ptType == Common::getFesPointTempType(Common::FES_DIGITAL_CTRL_TEMP)) + { + sql = "DELETE FROM fes_digital_ctrl WHERE POINT_TP_NAME = '%1' AND DEV_TAG IN (%2);"; + } + else if(ptType == Common::getFesPointTempType(Common::FES_MIX_CTRL_TEMP)) + { + sql = "DELETE FROM fes_mix_ctrl WHERE POINT_TP_NAME = '%1' AND DEV_TAG IN (%2);"; + } + } + else if(tableName.compare("FES_CONST_TEMP",Qt::CaseInsensitive) == 0) + { + sql = "DELETE FROM fes_const WHERE FES_POINT_TP_NAME = '%1' AND DEV_TAG IN (%2);"; + } + else if(tableName.compare("FES_DATA_BLOCK_TEMP",Qt::CaseInsensitive) == 0) + { + sql = "DELETE FROM fes_data_block WHERE FES_POINT_TP_NAME = '%1' AND DEV_TAG IN (%2);"; + } + + sql = sql.arg(pointTempTagName) + .arg("'"+devInstTagList.join("','")+"'"); + success = KbdTableDataMgr::getInstance()->executeOnly(sql); + if(!success) + break; + } + + //删除自身模板点 + if(tableName.compare("FES_DEV_PT_TEMP_DEF",Qt::CaseInsensitive) == 0) + { + sql = "DELETE FROM FES_DEV_PT_TEMP_DEF WHERE TAG_NAME = '%1';"; + } + else if(tableName.compare("FES_CONST_TEMP",Qt::CaseInsensitive) == 0) + { + sql = "DELETE FROM FES_CONST_TEMP WHERE TAG_NAME = '%1';"; + } + else if(tableName.compare("FES_DATA_BLOCK_TEMP",Qt::CaseInsensitive) == 0) + { + sql = "DELETE FROM FES_DATA_BLOCK_TEMP WHERE TAG_NAME = '%1';"; + } + + sql = sql.arg(pointTempTagName); + success = KbdTableDataMgr::getInstance()->executeOnly(sql); + if(!success) + break; + } + + if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) + onCommitError(); + } + else + onStartTransactionError(retStr); + + if(!success) + { + onMsg(tr("删除点失败!")); + return; + } + + m_tableTempPoint->getTable()->reFresh(); + onMsg(tr("删除点成功")); + KbdMsgContrl::getInstance()->showMsg(tr("删除点成功!"),this); +} + +void FesTempWidget::onBatchModifyProperty() +{ + QModelIndex index = m_tableTempPoint->getTable()->currentIndex(); + if(!index.isValid()) + return; + + KbdTableModel *model = qobject_cast(m_tableTempPoint->getTable()->model()); + if(model == NULL) + return; + + QModelIndexList indexList = m_tableTempPoint->getTable()->selectionModel()->selectedRows(index.column()); + + if(m_tableTempPoint->getTable()->needSave()) + { + onMsg(tr("请先保存修改")); + return; + } + + if(indexList.isEmpty()) + return; + + const ColMgrDataList& headCols = model->getHeadCols(); + if(!headCols.at(indexList.first().column()).editable) + { + onMsg(tr("该列不可编辑")); + return; + } + if(headCols.at(indexList.first().column()).isPrimaryKey) + { + onMsg(tr("该列是主键,不可编辑")); + return; + } + + QListWidgetItem *devTempItem = m_listTemp->currentItem(); + if(devTempItem == NULL) + { + onMsg(tr("请选中要修改的模板")); + return; + } + + KbdFesDevListDlg dlg(devTempItem->data(Qt::UserRole).toString()); + dlg.setWindowTitle(tr("选中要修改的设备")); + if(dlg.exec() != QDialog::Accepted) + return; + + QStringList devInstTagList = dlg.getCheckedDevs(); + if(devInstTagList.isEmpty()) + return; + + QString strProperty = headCols.at(indexList.first().column()).sqlName; + QString ptType = ""; + QStringList newDatas = model->unwrapData(model->getRowData(indexList.first().row())); + if(model->getTableName().compare("FES_DEV_PT_TEMP_DEF",Qt::CaseInsensitive) == 0) + { + const ColMgrDataList& modelCols = model->getHeadCols(); + ptType = newDatas.at(modelCols.findCol(CN_POINT_TYPE)); + } + + QStringList instTableNameList = KbdFesTempPointModifyDlg::locateTable(model->getTableName() + ,strProperty + ,ptType); + if(instTableNameList.isEmpty()) + { + onMsg(tr("当前属性无法同步")); + return; + } + + bool success = false; + const ColMgrDataList& modelCols = model->getHeadCols(); + int colTagName = modelCols.findCol(CN_TAG_NAME); + + QString sql; + QString value; + QString tempPointTagName; + MS_LOG_DEBUG(tr("开始执行批量菜单")); + QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); + if(retStr.isEmpty()) + { + KbdTableDataMgr::getInstance()->beginBatch(); + + foreach (QModelIndex index, indexList) + { + newDatas = model->unwrapData(model->getRowData(index.row())); + value = newDatas.at(index.column()); + tempPointTagName = newDatas.at(colTagName); + + foreach (QString tableName, instTableNameList) + { + sql.clear(); + + if(tableName == "fes_mix_ctrl" || tableName == "fes_analog_ctrl" || tableName == "fes_digital_ctrl") + { + sql = QString("UPDATE %1 SET %2 WHERE DEV_TAG IN (%3) AND POINT_TP_NAME ='%4';"); + } + else + { + sql = QString("UPDATE %1 SET %2 WHERE DEV_TAG IN (%3) AND FES_POINT_TP_NAME ='%4';"); + } + + sql = sql.arg(tableName) + .arg(QString("%1 = '%2'").arg(strProperty).arg(value)) + .arg("'"+devInstTagList.join("','")+"'") + .arg(tempPointTagName); + success = KbdTableDataMgr::getInstance()->executeOnly(sql); + if(!success) + break; + } + if(!success) + break; + } + success = KbdTableDataMgr::getInstance()->endBatch(); + + if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) + onCommitError(); + } + else + onStartTransactionError(retStr); + + MS_LOG_DEBUG(tr("结束执行批量菜单")); + + if(!success) + { + onMsg(tr("修改失败")); + return; + } + + onMsg(tr("修改成功")); + KbdMsgContrl::getInstance()->showMsg(tr("修改成功"),this); + +} + +void FesTempWidget::onSearchTableText(const QString &text) +{ + m_tableTempPoint->getTable()->searchItemText(QStringList()< items ); - void reloadList(QListWidget *list,QList items); + void reloadList(QListWidget *list,const QList &items); static QString getSheetName(int sheetNum); QString exportFesTempPoint(QXlsx::Document &xlsx, Common::FesPtTempType type, @@ -75,9 +76,14 @@ public slots: void onApplyAddToDev(); void onApplyRemoveToDev(); void onBatchModifyProperty();//批量修改属性 + +private slots: + void onSearchTableText(const QString &text); + private: QListWidget *m_listTemp;//前置设备模板列表 QListWidget *m_listTempPlugin;//套件前置设备模板列表 + kbdSearchWidget* m_tableSearch; QTabBar *m_tabTempPoint; kbdtableproperty *m_tableTempPoint; diff --git a/platform/src/tools/model_plugin/TempPlugin/kbdbatchinstancedlg.cpp b/platform/src/tools/model_plugin/TempPlugin/kbdbatchinstancedlg.cpp index 8dc2bc75..cb2f089c 100644 --- a/platform/src/tools/model_plugin/TempPlugin/kbdbatchinstancedlg.cpp +++ b/platform/src/tools/model_plugin/TempPlugin/kbdbatchinstancedlg.cpp @@ -1,6 +1,6 @@ #include "kbdbatchinstancedlg.h" #include "kbdpropertypanel.h" -#include +#include "pub_widget/MessageBox.h" #include #include #include @@ -20,7 +20,7 @@ #include #include -KbdBatchInstanceDlg::KbdBatchInstanceDlg(QWidget *parent) : QDialog(parent) +KbdBatchInstanceDlg::KbdBatchInstanceDlg(QWidget *parent) : CustomDialog(parent) { setWindowTitle(tr("批量实例化")); initLayout(); @@ -36,7 +36,7 @@ void KbdBatchInstanceDlg::closeEvent(QCloseEvent *event) return; } - QDialog::closeEvent(event); + CustomDialog::closeEvent(event); } void KbdBatchInstanceDlg::initLayout() @@ -489,5 +489,5 @@ void KbdBatchInstanceDlg::onCheckBatchFes(bool check) void KbdBatchInstanceDlg::onMsg(const QString &msg) { - QMessageBox::information(this,tr("消息"),msg); + N_MessageBox::information(this,tr("消息"),msg); } diff --git a/platform/src/tools/model_plugin/TempPlugin/kbdbatchinstancedlg.h b/platform/src/tools/model_plugin/TempPlugin/kbdbatchinstancedlg.h index 401cbb8e..e45fdf82 100644 --- a/platform/src/tools/model_plugin/TempPlugin/kbdbatchinstancedlg.h +++ b/platform/src/tools/model_plugin/TempPlugin/kbdbatchinstancedlg.h @@ -1,7 +1,7 @@ #ifndef KBDBATCHINSTANCEDLG_H #define KBDBATCHINSTANCEDLG_H -#include +#include "pub_widget/CustomDialog.h" class KbdPropertyPanel; class QGroupBox; @@ -13,7 +13,7 @@ class QProgressBar; /** * @brief The KbdBathInstanceDlg class 批量实例化对话框 */ -class KbdBatchInstanceDlg : public QDialog +class KbdBatchInstanceDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_plugin/TempPlugin/kbdcustominstplugindlg.cpp b/platform/src/tools/model_plugin/TempPlugin/kbdcustominstplugindlg.cpp index d2ad85bb..9b09aace 100644 --- a/platform/src/tools/model_plugin/TempPlugin/kbdcustominstplugindlg.cpp +++ b/platform/src/tools/model_plugin/TempPlugin/kbdcustominstplugindlg.cpp @@ -1,5 +1,5 @@ #include "kbdcustominstplugindlg.h" -#include +#include "pub_widget/MessageBox.h" #include #include #include @@ -12,12 +12,14 @@ #include #include "kbddbdesign.h" #include "kbdtabledatamgr.h" +#include "pub_utility_api/FileStyle.h" +#include "pub_utility_api/FileUtil.h" #include "worker.h" #include "kbdwaitprgdlg.h" #include "kbdxlsxread.h" #include "kbdregexpvalidator.h" -kbdCustomInstPluginDlg::kbdCustomInstPluginDlg(QWidget *parent) : QDialog(parent) +kbdCustomInstPluginDlg::kbdCustomInstPluginDlg(QWidget *parent) : CustomDialog(parent) { initLayout(); initData(); @@ -199,9 +201,11 @@ void kbdCustomInstPluginDlg::onDelete() void kbdCustomInstPluginDlg::onLoadFile() { + std::string curDir = iot_public::CFileUtil::getCurModuleDir(); + QString dirStr = QString("%1../../data/mod_instance").arg(QString::fromStdString(curDir)); disconnect(m_table,&QTableWidget::itemChanged,this,&kbdCustomInstPluginDlg::onTableItemChange); kbdXlsxRead Xlsx; - QString path = QFileDialog::getOpenFileName(this,tr("选择文件"),"","*.xlsx"); + QString path = QFileDialog::getOpenFileName(this,tr("选择文件"),dirStr,"*.xlsx"); if(path.isEmpty()) return; if(!Xlsx.readXlsxFile(path)) @@ -242,7 +246,15 @@ void kbdCustomInstPluginDlg::onLoadFile() void kbdCustomInstPluginDlg::onCreatTempFile() { - QString path = QFileDialog::getSaveFileName(this,tr("保存文件"),"","*.xlsx"); + std::string curDir = iot_public::CFileUtil::getCurModuleDir(); + QString dirStr = QString("%1../../data/mod_instance").arg(QString::fromStdString(curDir)); + QDir saveDefaultDir(dirStr); + if(!saveDefaultDir.exists()) + { + saveDefaultDir.mkdir(dirStr); + } + QString path = QFileDialog::getSaveFileName(this,tr("保存文件"),dirStr,"*.xlsx"); + path = path + ".xlsx"; if(path.isEmpty()) return; QMap mapColLable; @@ -287,26 +299,65 @@ void kbdCustomInstPluginDlg::onExportTempFile() QFile::remove(strDstPath); if(srcFile.copy(strDstPath)) - QMessageBox::information(this,tr("消息"),tr("模板下载成功")); + N_MessageBox::information(this,tr("消息"),tr("模板下载成功")); else - QMessageBox::information(this,tr("消息"),tr("模板下载失败")); + N_MessageBox::information(this,tr("消息"),tr("模板下载失败")); } else - QMessageBox::information(this,tr("消息"),tr("模板文件不存在")); + N_MessageBox::information(this,tr("消息"),tr("模板文件不存在")); } void kbdCustomInstPluginDlg::onUpdatePointRelate() { + KbdDbDesign ds; + if(!checkUpdateDevInfo()) return; - if (!findUpdatePoint()) + + //汇总选中的套件,m_mapUpdateDevInfo中肯定不为空,上面为空值时已经返回了 + QSet setPluginName; + for(auto devGrpIter = m_mapUpdateDevInfo.begin();devGrpIter != m_mapUpdateDevInfo.end();++devGrpIter) + { + setPluginName.insert(devGrpIter.value().at(0)); + } + + QString devTempSQL = "select temp_name from temp_plugin_dev_map where plugin_name in("; + for(auto pluginIter = setPluginName.begin();pluginIter != setPluginName.end();++pluginIter) + { + if(pluginIter != setPluginName.begin()) + { + devTempSQL += ","; + } + devTempSQL += "'" + *pluginIter + "'"; + } + devTempSQL += ");"; + + QStringList listDevTemp; + ds.getOneColumnResult(devTempSQL,listDevTemp); + + //拼接套件过滤SQL + QString pluginFilterSQL = ""; + for(auto pluginIter = listDevTemp.begin();pluginIter != listDevTemp.end();++pluginIter) + { + if(!pluginFilterSQL.isEmpty()) + { + pluginFilterSQL += " OR "; + } + pluginFilterSQL += "POINT_TP_NAME LIKE '" + *pluginIter + ".%'"; + } + + if(!pluginFilterSQL.isEmpty()) + { + pluginFilterSQL = "and (" + pluginFilterSQL + ")"; + } + + if (!findUpdatePoint(pluginFilterSQL)) return; //更新ACC - KbdDbDesign ds; QStringList listAccPoint,listAccPointTP; - QString sql = "select KEY_ID_TAG,POINT_TP_NAME from accuml_map_to_fes where DOT_NO = '-1' and POINT_TP_NAME is not null;"; - ds.getTwoColumnResult(sql,listAccPoint,listAccPointTP); + QString sql = "select KEY_ID_TAG,POINT_TP_NAME from accuml_map_to_fes where DOT_NO = '-1' and POINT_TP_NAME is not null %1;"; + ds.getTwoColumnResult(sql.arg(pluginFilterSQL),listAccPoint,listAccPointTP); for(int i = 0;i < listAccPoint.size(); i++) { QString accFesTag = listAccPoint.at(i); @@ -345,8 +396,8 @@ void kbdCustomInstPluginDlg::onUpdatePointRelate() //更新Ana控制 QStringList listAnaControl,listAnaControlTP; - sql = "select TAG_NAME,POINT_TP_NAME from analog_control where OFFSET_NO = '-1' and POINT_TP_NAME is not null;"; - ds.getTwoColumnResult(sql,listAnaControl,listAnaControlTP); + sql = "select TAG_NAME,POINT_TP_NAME from analog_control where OFFSET_NO = '-1' and POINT_TP_NAME is not null %1;"; + ds.getTwoColumnResult(sql.arg(pluginFilterSQL),listAnaControl,listAnaControlTP); for(int i = 0;i < listAnaControl.size(); i++) { QString AnaFesTag = listAnaControl.at(i); @@ -385,8 +436,8 @@ void kbdCustomInstPluginDlg::onUpdatePointRelate() //更新ANA QStringList listAnaPoint,listAnaPointTP; - sql = "select KEY_ID_TAG,POINT_TP_NAME from analog_map_to_fes where DOT_NO = '-1' and POINT_TP_NAME is not null;"; - ds.getTwoColumnResult(sql,listAnaPoint,listAnaPointTP); + sql = "select KEY_ID_TAG,POINT_TP_NAME from analog_map_to_fes where DOT_NO = '-1' and POINT_TP_NAME is not null %1;"; + ds.getTwoColumnResult(sql.arg(pluginFilterSQL),listAnaPoint,listAnaPointTP); for(int i = 0;i < listAnaPoint.size(); i++) { QString AnaFesTag = listAnaPoint.at(i); @@ -425,8 +476,8 @@ void kbdCustomInstPluginDlg::onUpdatePointRelate() //更新Mix控制 QStringList listMixControl,listMixControlTP; - sql = "select TAG_NAME,POINT_TP_NAME from mix_control where OFFSET_NO = '-1' and POINT_TP_NAME is not null;"; - ds.getTwoColumnResult(sql,listMixControl,listMixControlTP); + sql = "select TAG_NAME,POINT_TP_NAME from mix_control where OFFSET_NO = '-1' and POINT_TP_NAME is not null %1;"; + ds.getTwoColumnResult(sql.arg(pluginFilterSQL),listMixControl,listMixControlTP); for(int i = 0;i < listMixControl.size(); i++) { QString MixFesTag = listMixControl.at(i); @@ -465,8 +516,8 @@ void kbdCustomInstPluginDlg::onUpdatePointRelate() //更新Mix QStringList listMixPoint,listMixPointTP; - sql = "select KEY_ID_TAG,POINT_TP_NAME from mix_map_to_fes where DOT_NO = '-1' and POINT_TP_NAME is not null;"; - ds.getTwoColumnResult(sql,listMixPoint,listMixPointTP); + sql = "select KEY_ID_TAG,POINT_TP_NAME from mix_map_to_fes where DOT_NO = '-1' and POINT_TP_NAME is not null %1;"; + ds.getTwoColumnResult(sql.arg(pluginFilterSQL),listMixPoint,listMixPointTP); for(int i = 0;i < listMixPoint.size(); i++) { QString MixFesTag = listMixPoint.at(i); @@ -505,8 +556,8 @@ void kbdCustomInstPluginDlg::onUpdatePointRelate() //更新Digital QStringList listDigitalPoint,listDigitalPointTP; - sql = "select KEY_ID_TAG,POINT_TP_NAME from digital_map_to_fes where DOT_NO1 = '-1' and POINT_TP_NAME is not null;"; - ds.getTwoColumnResult(sql,listDigitalPoint,listDigitalPointTP); + sql = "select KEY_ID_TAG,POINT_TP_NAME from digital_map_to_fes where DOT_NO1 = '-1' and POINT_TP_NAME is not null %1;"; + ds.getTwoColumnResult(sql.arg(pluginFilterSQL),listDigitalPoint,listDigitalPointTP); for(int i = 0;i < listDigitalPoint.size(); i++) { QString digFesTag = listDigitalPoint.at(i); @@ -556,8 +607,8 @@ void kbdCustomInstPluginDlg::onUpdatePointRelate() //更新Digital控制 QStringList listDigitalControl,listDigitalControlTP; - sql = "select TAG_NAME,POINT_TP_NAME from digital_control where OFFSET_NO1 = '-1' and POINT_TP_NAME is not null;"; - ds.getTwoColumnResult(sql,listDigitalControl,listDigitalControlTP); + sql = "select TAG_NAME,POINT_TP_NAME from digital_control where OFFSET_NO1 = '-1' and POINT_TP_NAME is not null %1;"; + ds.getTwoColumnResult(sql.arg(pluginFilterSQL),listDigitalControl,listDigitalControlTP); for(int i = 0;i < listDigitalControl.size(); i++) { QString digFesTag = listDigitalControl.at(i); @@ -605,7 +656,7 @@ void kbdCustomInstPluginDlg::onUpdatePointRelate() } onMsg(tr("更新成功")); - QDialog::accept(); + //QDialog::accept();//更新成功不主动关闭窗口 } void kbdCustomInstPluginDlg::onSelectAll() @@ -1003,7 +1054,7 @@ bool kbdCustomInstPluginDlg::creatRTU() return true; } -bool kbdCustomInstPluginDlg::creatDevGroup() +bool kbdCustomInstPluginDlg::creatDevGroup(const QStringList &listExistDevGrpTag) { QString locationId = m_cbLocation->currentData().toString(); QString subSystemId = m_cbSubsystem->currentData().toString(); @@ -1042,6 +1093,11 @@ bool kbdCustomInstPluginDlg::creatDevGroup() for(auto iterGrp = m_listGrpInfo.begin();iterGrp!=m_listGrpInfo.end();iterGrp++) { QString strTagName = iterGrp->at(0); + if(listExistDevGrpTag.contains(strTagName)) //已经存在了,跳过 + { + continue; + } + QString strDesCol = iterGrp->at(1); QString rtuTag = iterGrp->at(2); @@ -1115,8 +1171,8 @@ bool kbdCustomInstPluginDlg::beginInst() void kbdCustomInstPluginDlg::accept() { QString errorMsg; - - if(!checkDevGrp()) + QStringList listExistDevGrpTag; + if(!checkDevGrp(listExistDevGrpTag)) return; getInstDevCfg(); @@ -1133,7 +1189,7 @@ void kbdCustomInstPluginDlg::accept() return; } - if(!creatDevGroup()) + if(!creatDevGroup(listExistDevGrpTag)) { onMsg(tr("创建设备组失败!")); return; @@ -1154,10 +1210,10 @@ void kbdCustomInstPluginDlg::accept() onMsg(tr("实例化成功")); else onMsg(errorMsg); - QDialog::accept(); + //QDialog::accept();//实例化成功不主动关闭窗口 } -bool kbdCustomInstPluginDlg::checkDevGrp() +bool kbdCustomInstPluginDlg::checkDevGrp(QStringList &listExistDevGrpTag) { QString locationId = m_cbLocation->currentData().toString(); QString subSystemId = m_cbSubsystem->currentData().toString(); @@ -1229,8 +1285,18 @@ bool kbdCustomInstPluginDlg::checkDevGrp() ds.isExist(sql.arg(listDevTag.at(i).first()),bExist); if(bExist) { - onMsg(QString(tr("错误:后台设备%1 已经存在")).arg(listDevTag.at(i).first())); - return false; +// onMsg(QString(tr("错误:后台设备%1 已经存在")).arg(listDevTag.at(i).first())); +// return false; +// onMsg(QString(tr("提示:后台设备组%1 已经存在,不再重新创建")).arg(listDevTag.at(i).first())); + int btnReply = + N_MessageBox::question(this,tr("询问"), + QString(tr("后台设备组%1 已经存在,是否复用原有设备组继续创建?")).arg(listDevTag.at(i).first()), + N_MessageBox::Yes|N_MessageBox::No ); + if(btnReply != N_MessageBox::Yes) + { + return false; + } + listExistDevGrpTag.push_back(listDevTag.at(i).first() ); } sql = "select* from fes_dev_info where TAG_NAME = '%1';"; @@ -1491,14 +1557,14 @@ QStringList kbdCustomInstPluginDlg::getDigitalFesTempTagByPlugin(QString PluginT return fesTempPoint; } -bool kbdCustomInstPluginDlg::findUpdatePoint() +bool kbdCustomInstPluginDlg::findUpdatePoint(QString pluginFilterSQL) { //标记ACC QStringList listSql; KbdDbDesign ds; QStringList listAccPoint,listAccDotNo; - QString sql = "select KEY_ID_TAG,DOT_NO from accuml_map_to_fes where DOT_NO != '-1' and POINT_TP_NAME is not null;"; - ds.getTwoColumnResult(sql,listAccPoint,listAccDotNo); + QString sql = "select KEY_ID_TAG,DOT_NO from accuml_map_to_fes where DOT_NO != '-1' and POINT_TP_NAME is not null %1;"; + ds.getTwoColumnResult(sql.arg(pluginFilterSQL),listAccPoint,listAccDotNo); for(int i = 0;i < listAccPoint.size(); i++) { QString accFesTag = listAccPoint.at(i); @@ -1520,8 +1586,8 @@ bool kbdCustomInstPluginDlg::findUpdatePoint() //标记Ana QStringList listAnaPoint,listAnaDotNo; - sql = "select KEY_ID_TAG,DOT_NO from analog_map_to_fes where DOT_NO != '-1' and POINT_TP_NAME is not null;"; - ds.getTwoColumnResult(sql,listAnaPoint,listAnaDotNo); + sql = "select KEY_ID_TAG,DOT_NO from analog_map_to_fes where DOT_NO != '-1' and POINT_TP_NAME is not null %1;"; + ds.getTwoColumnResult(sql.arg(pluginFilterSQL),listAnaPoint,listAnaDotNo); for(int i = 0;i < listAnaPoint.size(); i++) { QString AnaFesTag = listAnaPoint.at(i); @@ -1543,8 +1609,8 @@ bool kbdCustomInstPluginDlg::findUpdatePoint() //标记Mix QStringList listMixPoint,listMixDotNo; - sql = "select KEY_ID_TAG,DOT_NO from mix_map_to_fes where DOT_NO != '-1' and POINT_TP_NAME is not null;"; - ds.getTwoColumnResult(sql,listMixPoint,listMixDotNo); + sql = "select KEY_ID_TAG,DOT_NO from mix_map_to_fes where DOT_NO != '-1' and POINT_TP_NAME is not null %1;"; + ds.getTwoColumnResult(sql.arg(pluginFilterSQL),listMixPoint,listMixDotNo); for(int i = 0;i < listMixPoint.size(); i++) { QString MixFesTag = listMixPoint.at(i); @@ -1566,8 +1632,8 @@ bool kbdCustomInstPluginDlg::findUpdatePoint() //标记Digital QStringList listDigitalPoint; - sql = "select KEY_ID_TAG from digital_map_to_fes where POINT_TP_NAME is not null;"; - ds.getOneColumnResult(sql, listDigitalPoint); + sql = "select KEY_ID_TAG from digital_map_to_fes where POINT_TP_NAME is not null %1;"; + ds.getOneColumnResult(sql.arg(pluginFilterSQL), listDigitalPoint); for (int i = 0; i < listDigitalPoint.size(); i++) { QString DigitalFesTag = listDigitalPoint.at(i); @@ -1607,7 +1673,7 @@ bool kbdCustomInstPluginDlg::findUpdatePoint() void kbdCustomInstPluginDlg::onMsg(const QString &text) { - QMessageBox::information(this,tr("消息"),text); + N_MessageBox::information(this,tr("消息"),text); } CboxDelegate::CboxDelegate(QList listBoxData,bool bEdit,QObject *parent) : QItemDelegate(parent) diff --git a/platform/src/tools/model_plugin/TempPlugin/kbdcustominstplugindlg.h b/platform/src/tools/model_plugin/TempPlugin/kbdcustominstplugindlg.h index 55917a19..de99ddc0 100644 --- a/platform/src/tools/model_plugin/TempPlugin/kbdcustominstplugindlg.h +++ b/platform/src/tools/model_plugin/TempPlugin/kbdcustominstplugindlg.h @@ -2,14 +2,15 @@ #define KBDCUSTOMINSTPLUGINDLG_H #include -#include #include +#include "pub_widget/CustomDialog.h" + class QTableWidget; class QComboBox; class QTableWidgetItem; class QLineEdit; -class kbdCustomInstPluginDlg : public QDialog +class kbdCustomInstPluginDlg : public CustomDialog { Q_OBJECT public: @@ -22,12 +23,12 @@ private: void getInstDevCfg(); bool creatChannel(); bool creatRTU(); - bool creatDevGroup(); + bool creatDevGroup(const QStringList &listExistDevGrpTag); bool beginInst(); void accept(); void onMsg(const QString &text); - bool checkDevGrp(); + bool checkDevGrp(QStringList &listExistDevGrpTag); bool checkUpdateDevInfo(); QList reorderDataByIndex(QList listData,int nIndex); @@ -35,7 +36,7 @@ private: QString getFesTempTagByPlugin(QString PluginTag,QString devPointTag,QString pointType); QStringList getDigitalFesTempTagByDotNo(QString fesDevTag, QStringList dotNo); QStringList getDigitalFesTempTagByPlugin(QString PluginTag, QString devPointTag); - bool findUpdatePoint(); + bool findUpdatePoint(QString pluginFilterSQL); signals: void sigInstDevProcess(int process); diff --git a/platform/src/tools/model_plugin/TempPlugin/kbddevlistdlg.cpp b/platform/src/tools/model_plugin/TempPlugin/kbddevlistdlg.cpp index 60e3fe46..8081efea 100644 --- a/platform/src/tools/model_plugin/TempPlugin/kbddevlistdlg.cpp +++ b/platform/src/tools/model_plugin/TempPlugin/kbddevlistdlg.cpp @@ -7,7 +7,7 @@ #include #include -KbdDevListDlg::KbdDevListDlg(const QString &devTemptag, QWidget *parent) : QDialog(parent) +KbdDevListDlg::KbdDevListDlg(const QString &devTemptag, QWidget *parent) : CustomDialog(parent) { initLayout(devTemptag); resize(QSize(400,600)); diff --git a/platform/src/tools/model_plugin/TempPlugin/kbddevlistdlg.h b/platform/src/tools/model_plugin/TempPlugin/kbddevlistdlg.h index 029bda8a..870c6681 100644 --- a/platform/src/tools/model_plugin/TempPlugin/kbddevlistdlg.h +++ b/platform/src/tools/model_plugin/TempPlugin/kbddevlistdlg.h @@ -1,13 +1,13 @@ #ifndef KBDDEVLISTDLG_H #define KBDDEVLISTDLG_H -#include +#include "pub_widget/CustomDialog.h" class QTreeView; class KbdDomModel; class QStandardItem; class QStandardItemModel; -class KbdDevListDlg : public QDialog +class KbdDevListDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_plugin/TempPlugin/kbdfesdevlistdlg.cpp b/platform/src/tools/model_plugin/TempPlugin/kbdfesdevlistdlg.cpp index 715e50c4..9394b5f0 100644 --- a/platform/src/tools/model_plugin/TempPlugin/kbdfesdevlistdlg.cpp +++ b/platform/src/tools/model_plugin/TempPlugin/kbdfesdevlistdlg.cpp @@ -7,7 +7,7 @@ #include #include -KbdFesDevListDlg::KbdFesDevListDlg(const QString &devTemptag, QWidget *parent) : QDialog(parent) +KbdFesDevListDlg::KbdFesDevListDlg(const QString &devTemptag, QWidget *parent) : CustomDialog(parent) { initLayout(devTemptag); resize(QSize(400,600)); diff --git a/platform/src/tools/model_plugin/TempPlugin/kbdfesdevlistdlg.h b/platform/src/tools/model_plugin/TempPlugin/kbdfesdevlistdlg.h index 35211ce3..910c7a5b 100644 --- a/platform/src/tools/model_plugin/TempPlugin/kbdfesdevlistdlg.h +++ b/platform/src/tools/model_plugin/TempPlugin/kbdfesdevlistdlg.h @@ -1,13 +1,13 @@ #ifndef KBDFESDEVLISTDLG_H #define KBDFESDEVLISTDLG_H -#include +#include "pub_widget/CustomDialog.h" class QTreeView; class KbdDomModel; class QStandardItem; class QStandardItemModel; -class KbdFesDevListDlg : public QDialog +class KbdFesDevListDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_plugin/TempPlugin/kbdfestempdlg.cpp b/platform/src/tools/model_plugin/TempPlugin/kbdfestempdlg.cpp index bef79720..66d1dca8 100644 --- a/platform/src/tools/model_plugin/TempPlugin/kbdfestempdlg.cpp +++ b/platform/src/tools/model_plugin/TempPlugin/kbdfestempdlg.cpp @@ -11,7 +11,7 @@ #include #include -KbdFesTempDlg::KbdFesTempDlg(const QString &dirPath, const QStringList &tempList, QWidget *parent) : QDialog(parent) +KbdFesTempDlg::KbdFesTempDlg(const QString &dirPath, const QStringList &tempList, QWidget *parent) : CustomDialog(parent) { initLayout(); initData(dirPath,tempList); diff --git a/platform/src/tools/model_plugin/TempPlugin/kbdfestempdlg.h b/platform/src/tools/model_plugin/TempPlugin/kbdfestempdlg.h index c6eccd4c..156a5d72 100644 --- a/platform/src/tools/model_plugin/TempPlugin/kbdfestempdlg.h +++ b/platform/src/tools/model_plugin/TempPlugin/kbdfestempdlg.h @@ -1,7 +1,7 @@ #ifndef KBDFESTEMPDLG_H #define KBDFESTEMPDLG_H -#include +#include "pub_widget/CustomDialog.h" class KbdTableModel; class QTableView; @@ -9,7 +9,7 @@ class QStandardItemModel; /* * 从PSC3000中读取模板的前置模板对话框 */ -class KbdFesTempDlg : public QDialog +class KbdFesTempDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_plugin/TempPlugin/kbdfestemppointmodifydlg.cpp b/platform/src/tools/model_plugin/TempPlugin/kbdfestemppointmodifydlg.cpp index da72d4ec..1cd929f6 100644 --- a/platform/src/tools/model_plugin/TempPlugin/kbdfestemppointmodifydlg.cpp +++ b/platform/src/tools/model_plugin/TempPlugin/kbdfestemppointmodifydlg.cpp @@ -1,6 +1,6 @@ #include "kbdfestemppointmodifydlg.h" #include "kbdpropertypanel.h" -#include +#include "pub_widget/MessageBox.h" #include #include #include @@ -12,8 +12,10 @@ #include #include "kbdfesdevlistdlg.h" #include "../model_common/common.h" +#include "pub_utility_api/FileStyle.h" -KbdFesTempPointModifyDlg::KbdFesTempPointModifyDlg(const QString &devTempTag, QWidget *parent) : QDialog(parent) +KbdFesTempPointModifyDlg::KbdFesTempPointModifyDlg(const QString &devTempTag, QWidget *parent) + : CustomDialog(parent) { m_devTempTag = devTempTag; setWindowTitle(tr("修改前置模板测点")); @@ -39,6 +41,8 @@ KbdFesTempPointModifyDlg::KbdFesTempPointModifyDlg(const QString &devTempTag, QW vLayout->addWidget(m_panelProperty); vLayout->addLayout(hLayout); this->setLayout(vLayout); + +// this->addUserLayout(vLayout); } void KbdFesTempPointModifyDlg::showEvent(QShowEvent *event) @@ -46,7 +50,7 @@ void KbdFesTempPointModifyDlg::showEvent(QShowEvent *event) qDebug()<<"show event property dlg"; fixSize(); - QDialog::showEvent(event); + CustomDialog::showEvent(event); } void KbdFesTempPointModifyDlg::fixSize() @@ -396,5 +400,5 @@ void KbdFesTempPointModifyDlg::onCheckBox(bool bCheck) void KbdFesTempPointModifyDlg::onMsg(const QString &error) { - QMessageBox::warning(this,tr("消息"),error); + N_MessageBox::warning(this,tr("消息"),error); } diff --git a/platform/src/tools/model_plugin/TempPlugin/kbdfestemppointmodifydlg.h b/platform/src/tools/model_plugin/TempPlugin/kbdfestemppointmodifydlg.h index 383fdece..38d1715d 100644 --- a/platform/src/tools/model_plugin/TempPlugin/kbdfestemppointmodifydlg.h +++ b/platform/src/tools/model_plugin/TempPlugin/kbdfestemppointmodifydlg.h @@ -1,12 +1,12 @@ #ifndef KBDFESTEMPPOINTMODIFYDLG_H #define KBDFESTEMPPOINTMODIFYDLG_H -#include +#include "pub_widget/CustomDialog.h" class KbdPropertyPanel; class QCheckBox; -class KbdFesTempPointModifyDlg : public QDialog +class KbdFesTempPointModifyDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_plugin/TempPlugin/kbdgeneratetempwizard.cpp b/platform/src/tools/model_plugin/TempPlugin/kbdgeneratetempwizard.cpp index 10ec4069..9f48c5fb 100644 --- a/platform/src/tools/model_plugin/TempPlugin/kbdgeneratetempwizard.cpp +++ b/platform/src/tools/model_plugin/TempPlugin/kbdgeneratetempwizard.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" #include #include @@ -675,7 +675,7 @@ void KbdGenerateTempWizard::onCurrentPageChange(int id) void KbdGenerateTempWizard::onMsg(const QString &msg) { - QMessageBox::information(this,tr("消息"),msg); + N_MessageBox::information(this,tr("消息"),msg); } diff --git a/platform/src/tools/model_plugin/TempPlugin/kbdinstplugindlg.cpp b/platform/src/tools/model_plugin/TempPlugin/kbdinstplugindlg.cpp index 58c5f778..669786ee 100644 --- a/platform/src/tools/model_plugin/TempPlugin/kbdinstplugindlg.cpp +++ b/platform/src/tools/model_plugin/TempPlugin/kbdinstplugindlg.cpp @@ -18,12 +18,12 @@ #include "kbdpropertypanel.h" #include "kbdtabledatamgr.h" #include "kbdtablemodel.h" -#include +#include "pub_widget/MessageBox.h" #include "kbdwaitprgdlg.h" #include "worker.h" #include "QInputDialog" -KbdInstPluginDlg::KbdInstPluginDlg(QWidget *parent) : QDialog(parent) +KbdInstPluginDlg::KbdInstPluginDlg(QWidget *parent) : CustomDialog(parent) { m_nGroupNum = 0; initLayout(); @@ -92,8 +92,9 @@ void KbdInstPluginDlg::initLayout() m_listDevGroup = new QListWidget(this); m_listDevGroup->setSelectionMode(QAbstractItemView::ExtendedSelection); - bar->setIconSize(QSize(24,24)); - bar->addAction(QIcon(":/icons/icons/new.png"),tr("添加记录"),this,SLOT(onAddDevGroup())); + QAction* act = nullptr; + act = bar->addAction(tr("添加记录"),this,SLOT(onAddDevGroup())); + bar->widgetForAction(act)->setObjectName("icon_add"); bar->addSeparator(); bar->addAction(tr("批量添加"),this,SLOT(onBatchCreateGroup())); vLayout1->addWidget(bar); @@ -416,7 +417,7 @@ void KbdInstPluginDlg::onAddDevGroup() void KbdInstPluginDlg::onMsg(const QString &text) { - QMessageBox::information(this,tr("消息"),text); + N_MessageBox::information(this,tr("消息"),text); } bool KbdInstPluginDlg::check() diff --git a/platform/src/tools/model_plugin/TempPlugin/kbdinstplugindlg.h b/platform/src/tools/model_plugin/TempPlugin/kbdinstplugindlg.h index 05f7a11f..a785d9e3 100644 --- a/platform/src/tools/model_plugin/TempPlugin/kbdinstplugindlg.h +++ b/platform/src/tools/model_plugin/TempPlugin/kbdinstplugindlg.h @@ -1,7 +1,7 @@ #ifndef KBDINSTPLUGINDLG_H #define KBDINSTPLUGINDLG_H -#include +#include "pub_widget/CustomDialog.h" class QComboBox; class QListWidget; @@ -9,7 +9,7 @@ class QCheckBox; class QSpinBox; class QLabel; -class KbdInstPluginDlg : public QDialog +class KbdInstPluginDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_plugin/TempPlugin/kbdpointfromtextdlg.cpp b/platform/src/tools/model_plugin/TempPlugin/kbdpointfromtextdlg.cpp index 75c9df02..bc2cd2bc 100644 --- a/platform/src/tools/model_plugin/TempPlugin/kbdpointfromtextdlg.cpp +++ b/platform/src/tools/model_plugin/TempPlugin/kbdpointfromtextdlg.cpp @@ -6,10 +6,10 @@ #include "kbdtabledatamgr.h" #include "kbdtablemodel.h" #include "../model_common/common.h" -#include +#include "pub_widget/MessageBox.h" #include -KbdPointFromTextDlg::KbdPointFromTextDlg(const QString &devTempTagName, QWidget *parent) : QDialog(parent) +KbdPointFromTextDlg::KbdPointFromTextDlg(const QString &devTempTagName, QWidget *parent) : CustomDialog(parent) { m_devTempTagName = devTempTagName; setWindowTitle(tr("添加设备模板测点")); @@ -466,7 +466,7 @@ void KbdPointFromTextDlg::onSelect() void KbdPointFromTextDlg::onMsg(const QString &msg) { - QMessageBox::information(this,tr("消息"),msg); + N_MessageBox::information(this,tr("消息"),msg); } void KbdPointFromTextDlg::onTableClicked(const QModelIndex &index) diff --git a/platform/src/tools/model_plugin/TempPlugin/kbdpointfromtextdlg.h b/platform/src/tools/model_plugin/TempPlugin/kbdpointfromtextdlg.h index 07fc2ab5..3c2d6924 100644 --- a/platform/src/tools/model_plugin/TempPlugin/kbdpointfromtextdlg.h +++ b/platform/src/tools/model_plugin/TempPlugin/kbdpointfromtextdlg.h @@ -1,12 +1,12 @@ #ifndef KBDPOINTFROMTEXTDLG_H #define KBDPOINTFROMTEXTDLG_H -#include +#include "pub_widget/CustomDialog.h" class QTabWidget; class KbdTable; -class KbdPointFromTextDlg : public QDialog +class KbdPointFromTextDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_plugin/TempPlugin/tempmanagepluginwidget.cpp b/platform/src/tools/model_plugin/TempPlugin/tempmanagepluginwidget.cpp index c5010b37..e9a75f52 100644 --- a/platform/src/tools/model_plugin/TempPlugin/tempmanagepluginwidget.cpp +++ b/platform/src/tools/model_plugin/TempPlugin/tempmanagepluginwidget.cpp @@ -15,7 +15,20 @@ bool KitManagePluginWidget::createWidget(QWidget *parent, bool editMode, QWidget { Q_UNUSED(ptrVec) Q_UNUSED(editMode) - TempPluginWidget *pWidget = new TempPluginWidget(parent); + + QStringList listParam; + for(int i = 0; i < ptrVec.size(); i++) + { + QVariant *pVar = (QVariant*)ptrVec[i]; + if(pVar == NULL) + { + continue; + } + + listParam.push_back(pVar->toString()); + } + + TempPluginWidget *pWidget = new TempPluginWidget(listParam,parent); *widget = (QWidget *)pWidget; *pTrendWindow = (IPluginWidget *)pWidget; return true; diff --git a/platform/src/tools/model_plugin/TempPlugin/tempmanagepluginwidget.h b/platform/src/tools/model_plugin/TempPlugin/tempmanagepluginwidget.h index 26e18430..bc1b9031 100644 --- a/platform/src/tools/model_plugin/TempPlugin/tempmanagepluginwidget.h +++ b/platform/src/tools/model_plugin/TempPlugin/tempmanagepluginwidget.h @@ -7,7 +7,7 @@ class KitManagePluginWidget : public QObject, public CPluginWidgetInterface { Q_OBJECT - Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0") + Q_PLUGIN_METADATA(IID HMI_WidgetPlugin_IID) Q_INTERFACES(CPluginWidgetInterface) public: diff --git a/platform/src/tools/model_plugin/TempPlugin/temppluginwidget.cpp b/platform/src/tools/model_plugin/TempPlugin/temppluginwidget.cpp index 3c124838..0f171084 100644 --- a/platform/src/tools/model_plugin/TempPlugin/temppluginwidget.cpp +++ b/platform/src/tools/model_plugin/TempPlugin/temppluginwidget.cpp @@ -23,7 +23,7 @@ #include "kbdpropertydlg.h" #include "kbdpropertypanel.h" #include "kbdmsgcontrl.h" -#include +#include "pub_widget/MessageBox.h" #include #include #include "kbdinstplugindlg.h" @@ -37,11 +37,24 @@ #define TAB_ACC getTabDesc(3) #define TAB_MIX getTabDesc(4) -TempPluginWidget::TempPluginWidget(QWidget *parent) : KbdWidget(parent) +TempPluginWidget::TempPluginWidget(const QStringList &listParam,QWidget *parent) + : KbdWidget(parent) { + m_bIsConnentMangager = false; + if(!listParam.isEmpty()) + { + if(listParam.at(0) == "bind") + { + m_bIsConnentMangager = true; + } + } + initLayout(); initMenu(); initData(); + + //为了切换,否则默认显示还是套件管理 + onTabChange(0); } void TempPluginWidget::initLayout() @@ -49,6 +62,7 @@ void TempPluginWidget::initLayout() QSplitter *hSplitter = new QSplitter(Qt::Horizontal, this); QStackedWidget *m_stack = new QStackedWidget(this); + m_tabOperateStackWidget = m_stack; m_tempWidget = new TempWidget(m_stack); m_fesTempWidget = new FesTempWidget(m_stack); m_stack->addWidget(pluginWidget(m_stack)); @@ -72,7 +86,7 @@ void TempPluginWidget::initLayout() mainLayout->addWidget(hSplitter); setLayout(mainLayout); - connect(m_barShowType,SIGNAL(currentChanged(int)),m_stack,SLOT(setCurrentIndex(int))); + //connect(m_barShowType,SIGNAL(currentChanged(int)),m_stack,SLOT(setCurrentIndex(int))); } void TempPluginWidget::initMenu() @@ -90,8 +104,9 @@ void TempPluginWidget::initMenu() }); m_menuFesTemp->addSeparator(); m_menuFesTemp->addAction(tr("导入模板"),m_fesTempWidget,SLOT(onImportFesTemp())); - m_menuFesTemp->addAction(tr("导入PCS3000模板"),m_fesTempWidget,SLOT(onImportPcs3000Temp())); - m_menuFesTemp->addAction(tr("从PCS3000配置中读取模板"),m_fesTempWidget,SLOT(onReadTempFromPsc3000())); + //用不到,停用PCS3000对应的功能 + //m_menuFesTemp->addAction(tr("导入PCS3000模板"),m_fesTempWidget,SLOT(onImportPcs3000Temp())); + //m_menuFesTemp->addAction(tr("从PCS3000配置中读取模板"),m_fesTempWidget,SLOT(onReadTempFromPsc3000())); m_menuFesTemp->addAction(tr("导出模板"),m_fesTempWidget,SLOT(onExportFesTemp())); m_menuFesTemp->addAction(tr("刷新"),m_fesTempWidget,SLOT(onRefresh())); @@ -124,7 +139,8 @@ void TempPluginWidget::initMenu() m_menuPlugin = new QMenu(this); m_menuPlugin->addAction(tr("添加套件"),this,SLOT(onAddPlugin())); m_menuPlugin->addAction(tr("实例化套件"),this,SLOT(onInstPlugin())); - m_menuPlugin->addAction(tr("实例化61850设备"),this,SLOT(onInst61850Device())); + //停用cisco版本的61850功能 + //m_menuPlugin->addAction(tr("实例化61850设备"),this,SLOT(onInst61850Device())); m_menuPlugin->addAction(tr("修改套件"),this,SLOT(onModifyPlugin())); m_menuPlugin->addAction(tr("复制套件"),this,SLOT(onCopyPlugin())); m_menuPlugin->addSeparator(); @@ -147,8 +163,8 @@ void TempPluginWidget::initMenu() void TempPluginWidget::initData() { - m_tempWidget->onRefresh(); - m_fesTempWidget->onRefresh(); +// m_tempWidget->onRefresh(); +// m_fesTempWidget->onRefresh(); onRefreshplugin(); connect(m_listTemp,SIGNAL(itemSelectionChanged()),this,SLOT(onListTempClicked())); @@ -214,11 +230,20 @@ QLayout *TempPluginWidget::initShowType() { QVBoxLayout *vLayout = new QVBoxLayout; m_barShowType = new QTabBar(this); - QStackedWidget* stackWidget = new QStackedWidget(this); + m_barShowType->setAutoHide(true); - m_barShowType->addTab(tr("套件模式")); - m_barShowType->addTab(tr("前置模板")); - m_barShowType->addTab(tr("后台模板")); + QStackedWidget* stackWidget = new QStackedWidget(this); + m_tabTreeStackWidget = stackWidget; + + if(m_bIsConnentMangager) + { + m_barShowType->addTab(tr("套件模式")); + } + else + { + m_barShowType->addTab(tr("前置模板")); + m_barShowType->addTab(tr("后台模板")); + } stackWidget->addWidget(initPluginList()); stackWidget->addWidget(initFesTempList()); @@ -228,7 +253,7 @@ QLayout *TempPluginWidget::initShowType() vLayout->addWidget(stackWidget); vLayout->setMargin(0); vLayout->setSpacing(0); - connect(m_barShowType,&QTabBar::currentChanged,stackWidget,&QStackedWidget::setCurrentIndex); + //connect(m_barShowType,&QTabBar::currentChanged,stackWidget,&QStackedWidget::setCurrentIndex); connect(m_barShowType,&QTabBar::currentChanged,this,&TempPluginWidget::onTabChange); return vLayout; } @@ -286,17 +311,35 @@ QWidget *TempPluginWidget::initTempList() QWidget *TempPluginWidget::pluginWidget(QWidget *parent) { - QHBoxLayout* mainLayout = new QHBoxLayout; + QVBoxLayout *mainLayout = new QVBoxLayout; //垂直布局,上面放topLayout + bottomLayout + QHBoxLayout *topLayout = new QHBoxLayout; //水平布局,放套件+后台模板+前置模板 + QVBoxLayout *bottomLayout = new QVBoxLayout; //垂直布局,放测点信息 + mainLayout->addLayout(topLayout); + mainLayout->addSpacing(3); + mainLayout->addLayout(bottomLayout); + mainLayout->setStretchFactor(topLayout,4); + mainLayout->setStretchFactor(bottomLayout,10); + + QVBoxLayout *connectLayout = new QVBoxLayout; + QVBoxLayout *devTempLayout = new QVBoxLayout; + QVBoxLayout *fesTempLayout = new QVBoxLayout; + topLayout->addLayout(connectLayout); + topLayout->addLayout(devTempLayout); + topLayout->addLayout(fesTempLayout); + topLayout->setStretchFactor(connectLayout,2); + topLayout->setStretchFactor(devTempLayout,1); + topLayout->setStretchFactor(fesTempLayout,1); + + //填充模板管理布局内容,对应connectLayout QWidget *w = new QWidget(parent); m_tabPlugin = new QTabBar(w); - m_tabPlugin->addTab(tr(" ")); + m_tabPlugin->addTab(tr(" ")); QHBoxLayout *hLayoutTop = new QHBoxLayout; hLayoutTop->addWidget(m_tabPlugin); hLayoutTop->addStretch(); - QVBoxLayout *vLayoutTop = new QVBoxLayout; m_treePlugin = new QTreeView(w); m_treePlugin->setSelectionMode(QAbstractItemView::ExtendedSelection); m_treePlugin->setEditTriggers(QAbstractItemView::NoEditTriggers); @@ -306,34 +349,53 @@ QWidget *TempPluginWidget::pluginWidget(QWidget *parent) m_treePlugin->header()->setVisible(false); m_modelPlugin = new MyPluginTreeModel(this); m_treePlugin->setModel(m_modelPlugin); - vLayoutTop->addLayout(hLayoutTop); - vLayoutTop->addWidget(m_treePlugin); - vLayoutTop->setSpacing(0); + //connectLayout->addWidget(m_tabPlugin); + connectLayout->addLayout(hLayoutTop); + connectLayout->addWidget(m_treePlugin); + connectLayout->setSpacing(0); + + + //填充后台模板 + QLabel* lable = new QLabel(tr("后台模板"),this); + QFont font = lable->font(); + font.setPointSize(11); + lable->setFont(font); + m_listTempPlugin = new MyTempListWidget(this); //后台模板列表 + m_listTempPlugin->setDragEnabled(true); + m_listTempPlugin->viewport()->setAcceptDrops(true); + m_listTempPlugin->setDropIndicatorShown(true); + m_tempWidget->setDevTempListPlugin(m_listTempPlugin); + + devTempLayout->addWidget(lable); + //devTempLayout->addSpacing(3); + devTempLayout->addWidget(m_listTempPlugin); + //devTempLayout->addSpacing(12); + + //填充前置模板 + lable = new QLabel(tr("前置模板"),this); + lable->setFont(font); + m_listFesTempPlugin = new MyFesTempListWidget(this); //前置模板列表 + m_listFesTempPlugin->setDragEnabled(true); + m_listFesTempPlugin->viewport()->setAcceptDrops(true); + m_listFesTempPlugin->setDropIndicatorShown(true); + m_fesTempWidget->setFesTempListPlugin(m_listFesTempPlugin); + + fesTempLayout->addWidget(lable); + //devTempLayout->addSpacing(3); + fesTempLayout->addWidget(m_listFesTempPlugin); + + //下方测点布局 QGridLayout *gridLayout = new QGridLayout; m_tabPluginDev = new QTabBar(w); m_tabPluginDev->addTab(tr(" ")); - QPushButton *btCheck = new QPushButton(tr("检测套件"),w); - QPushButton *btEdit = new QPushButton(tr("编辑自动关联配置"),w); - QPushButton *btSelect = new QPushButton(tr("仅自动生成当前后台设备"),w); + QPushButton *btCheck = new QPushButton(tr("检查关联"),w); + QPushButton *btEdit = new QPushButton(tr("关联配置"),w); + QPushButton *btSelect = new QPushButton(tr("仅生成后台设备"),w); QPushButton *btAuto = new QPushButton(tr("全部自动生成"),w); QPushButton *btSave = new QPushButton(tr("保存"),w); - QHBoxLayout *hLayoutButtom = new QHBoxLayout; - hLayoutButtom->addWidget(m_tabPluginDev); - hLayoutButtom->addStretch(); - hLayoutButtom->addWidget(btCheck); - hLayoutButtom->addSpacing(15); - hLayoutButtom->addWidget(btEdit); - hLayoutButtom->addSpacing(15); - hLayoutButtom->addWidget(btSelect); - hLayoutButtom->addSpacing(15); - hLayoutButtom->addWidget(btAuto); - hLayoutButtom->addSpacing(15); - hLayoutButtom->addWidget(btSave); - hLayoutButtom->addSpacing(50); - m_tabPointType = new QTabBar(w); m_tabPointType->addTab(TAB_ANA); m_tabPointType->addTab(TAB_DIG); @@ -341,48 +403,31 @@ QWidget *TempPluginWidget::pluginWidget(QWidget *parent) m_tabPointType->addTab(TAB_MIX); m_tabPointType->setExpanding(false); - m_tabPointType->setShape(QTabBar::RoundedWest); - m_tabPointType->setStyle(new TabProxyStyle()); + m_tabPluginDev->setShape(QTabBar::RoundedWest); + m_tabPluginDev->setStyle(new TabProxyStyle()); m_tablePoint = new KbdTable(w,REWRITE_COMMIT); + QHBoxLayout *hLayoutButtom = new QHBoxLayout; + hLayoutButtom->addWidget(m_tabPointType); + hLayoutButtom->addStretch(); + hLayoutButtom->addWidget(btCheck); + hLayoutButtom->addSpacing(15); + hLayoutButtom->addWidget(btEdit); + hLayoutButtom->addSpacing(15); + hLayoutButtom->addWidget(btAuto); + hLayoutButtom->addSpacing(15); + hLayoutButtom->addWidget(btSelect); + hLayoutButtom->addSpacing(15); + hLayoutButtom->addWidget(btSave); + hLayoutButtom->addSpacing(50); + gridLayout->addLayout(hLayoutButtom,0,1,1,1); - gridLayout->addWidget(m_tabPointType,1,0,1,1,Qt::AlignTop); + gridLayout->addWidget(m_tabPluginDev,1,0,1,1,Qt::AlignTop); gridLayout->addWidget(m_tablePoint,1,1,1,1); gridLayout->setSpacing(0); - QVBoxLayout *vLayout = new QVBoxLayout; - vLayout->addLayout(vLayoutTop); - vLayout->addSpacing(10); - vLayout->addLayout(gridLayout); - - QVBoxLayout *tempListLayout = new QVBoxLayout; - tempListLayout->addSpacing(2); - - QLabel* lable = new QLabel(tr("后台模板"),this); - tempListLayout->addWidget(lable); - m_listTempPlugin = new MyTempListWidget(this); //后台模板列表 - m_listTempPlugin->setDragEnabled(true); - m_listTempPlugin->viewport()->setAcceptDrops(true); - m_listTempPlugin->setDropIndicatorShown(true); - m_tempWidget->setDevTempListPlugin(m_listTempPlugin); - tempListLayout->addWidget(m_listTempPlugin); - tempListLayout->addSpacing(12); - - lable = new QLabel(tr("前置模板"),this); - tempListLayout->addWidget(lable); - m_listFesTempPlugin = new MyFesTempListWidget(this); //前置模板列表 - m_listFesTempPlugin->setDragEnabled(true); - m_listFesTempPlugin->viewport()->setAcceptDrops(true); - m_listFesTempPlugin->setDropIndicatorShown(true); - m_fesTempWidget->setFesTempListPlugin(m_listFesTempPlugin); - tempListLayout->addWidget(m_listFesTempPlugin); - - mainLayout->addLayout(vLayout); - mainLayout->addLayout(tempListLayout); - mainLayout->setStretch(0,4); - mainLayout->setStretch(0,1); - mainLayout->setMargin(0); + bottomLayout->addLayout(gridLayout); w->setLayout(mainLayout); connect(btAuto,SIGNAL(clicked(bool)),this,SLOT(onAutoRelationByPlugin())); @@ -934,9 +979,9 @@ QString TempPluginWidget::importCheckPlugin(QXlsx::Document &xlsx, QString &newP if(exist) { -// if(QMessageBox::Yes == QMessageBox::information(this,tr("消息"), +// if(N_MessageBox::Yes == N_MessageBox::information(this,tr("消息"), // tr("存在同名套件%1,是否修改套件名?").arg(pluginName), -// QMessageBox::Yes,QMessageBox::No)) +// N_MessageBox::Yes,N_MessageBox::No)) // { // KbdPropertyDlg dlg(false); // dlg.panel()->setDisplayRow(model,model->rowCount()); @@ -2418,7 +2463,7 @@ void TempPluginWidget::onCopyPlugin() void TempPluginWidget::onRemovePlugin() { - if(QMessageBox::No == QMessageBox::information(this,tr("消息"),tr("是否删除套件?"),QMessageBox::Yes,QMessageBox::No)) + if(N_MessageBox::No == N_MessageBox::information(this,tr("消息"),tr("是否删除套件?"),N_MessageBox::Yes,N_MessageBox::No)) return; KbdTableModel *modelPlugin = KbdTableDataMgr::getInstance()->createModel(TBL_TEMP_PLUGIN); @@ -2475,8 +2520,8 @@ void TempPluginWidget::onRefreshplugin() void TempPluginWidget::onInstPlugin() { - kbdCustomInstPluginDlg dlg; + dlg.setWindowTitle(tr("实例化套件")); dlg.exec(); } @@ -2753,7 +2798,7 @@ void TempPluginWidget::onRemovePluginOfFesTemp() void TempPluginWidget::onRemovePluginTree() { - if(QMessageBox::No == QMessageBox::information(this,tr("消息"),tr("是否删除套件中的模板?"),QMessageBox::Yes,QMessageBox::No)) + if(N_MessageBox::No == N_MessageBox::information(this,tr("消息"),tr("是否删除套件中的模板?"),N_MessageBox::Yes,N_MessageBox::No)) return; onRemovePluginOfFesTemp(); onRemovePluginOfTemp(); @@ -2783,11 +2828,19 @@ void TempPluginWidget::onTabPointTypeChange() pointModel->load(true); m_tablePoint->setModel(pointModel); -// m_tablePoint->resizeColumnsToContents(); + if(pointModel->rowCount() > 0) + { + m_tablePoint->resizeColumnsToContents(); + } } void TempPluginWidget::onAutoRelationByPlugin() { + if(N_MessageBox::No == N_MessageBox::information(this,tr("消息"),tr("是否继续生成前置和后台设备?"),N_MessageBox::Yes,N_MessageBox::No)) + { + return; + } + QListWidgetItem *pluginItem = m_listPlugin->currentItem(); if(pluginItem == NULL) return; @@ -2835,6 +2888,11 @@ void TempPluginWidget::onAutoRelationByPlugin() void TempPluginWidget::onAutoRelationSelect() { + if(N_MessageBox::No == N_MessageBox::information(this,tr("消息"),tr("是否继续生成后台设备?"),N_MessageBox::Yes,N_MessageBox::No)) + { + return; + } + QListWidgetItem *pluginItem = m_listPlugin->currentItem(); if(pluginItem == NULL) return; @@ -3003,6 +3061,7 @@ void TempPluginWidget::onEditAutoRelation() m_file->close(); EditRelationDlg editDlg(m_json); + editDlg.setWindowTitle(tr("关联配置")); editDlg.exec(); } @@ -3122,8 +3181,16 @@ void TempPluginWidget::onAddFesTempToAll() } -void TempPluginWidget::onTabChange() +void TempPluginWidget::onTabChange(int index) { + int nBaseIndex = 0; + if(!m_bIsConnentMangager) + { + nBaseIndex = 1; + } + m_tabTreeStackWidget->setCurrentIndex(index + nBaseIndex); + m_tabOperateStackWidget->setCurrentIndex(index + nBaseIndex); + m_tempWidget->onRefresh(); m_fesTempWidget->onRefresh(); } @@ -3140,6 +3207,15 @@ void TempPluginWidget::onSearchlistPluginText(const QString text) } } +void TempPluginWidget::showEvent(QShowEvent *event) +{ + QWidget::showEvent(event); + if( m_bIsConnentMangager ) + { + onTabChange(0); + } +} + //void TempPluginWidget::onEditDlgAccepted() //{ // m_file = new QFile(Common::getTreePath()+"autoRelation.json"); diff --git a/platform/src/tools/model_plugin/TempPlugin/temppluginwidget.h b/platform/src/tools/model_plugin/TempPlugin/temppluginwidget.h index 7f5e2651..13edd108 100644 --- a/platform/src/tools/model_plugin/TempPlugin/temppluginwidget.h +++ b/platform/src/tools/model_plugin/TempPlugin/temppluginwidget.h @@ -25,12 +25,13 @@ class KbdSqlTable; class KbdTable; class QButtonGroup; class QRadioButton; +class QStackedWidget; class TempPluginWidget : public KbdWidget { Q_OBJECT public: - explicit TempPluginWidget(QWidget *parent = nullptr); + explicit TempPluginWidget(const QStringList &listParam,QWidget *parent = nullptr); private: void initLayout(); @@ -131,13 +132,17 @@ private slots: void onAddFesTempToAll(); - void onTabChange(); + void onTabChange(int index); void onSearchlistPluginText(const QString text); // void onEditDlgAccepted(); -private: +protected: + void showEvent(QShowEvent *event) override; + +private: + bool m_bIsConnentMangager; //为true时显示套件管理,为false显示前置模板和后台模板 MyFesTempListWidget *m_listFesTemp; //前置模板列表 MyFesTempListWidget *m_listFesTempPlugin; //套件前置模板列表 MyTempListWidget *m_listTemp; //后台模板列表 @@ -164,6 +169,9 @@ private: QFile *m_file; QJsonDocument m_json; + + QStackedWidget* m_tabTreeStackWidget; //左侧tab标签下面的展示区 + QStackedWidget *m_tabOperateStackWidget; //右侧的操作区 }; diff --git a/platform/src/tools/model_plugin/TempPlugin/tempwidget.cpp b/platform/src/tools/model_plugin/TempPlugin/tempwidget.cpp index 3ef99d26..ca3f4f28 100644 --- a/platform/src/tools/model_plugin/TempPlugin/tempwidget.cpp +++ b/platform/src/tools/model_plugin/TempPlugin/tempwidget.cpp @@ -20,13 +20,15 @@ #include "kbdmsgcontrl.h" #include "kbdgeneratetempwizard.h" #include "kbdcheckrole.h" -#include +#include "pub_widget/MessageBox.h" #include "kbdpropertydlg.h" #include "kbdpropertypanel.h" #include #include "kbdbatchinstancedlg.h" #include "kbddevlistdlg.h" #include "kbdtableproperty.h" +#include +#include "CustomWidget/kbdsearchwidget.h" #define TAB_BASE getTabDesc(1) #define TAB_LIMIT getTabDesc(2) @@ -75,24 +77,43 @@ bool TempWidget::pointListHasFocus() void TempWidget::initLayout() { - QGroupBox *boxTitle = new QGroupBox(tr("显示模式"),this); + QVBoxLayout *mainLayout = new QVBoxLayout; + QHBoxLayout *topLayout = new QHBoxLayout; + QVBoxLayout *bottomLayout = new QVBoxLayout; + + mainLayout->setMargin(0); + mainLayout->addLayout(topLayout); + mainLayout->addLayout(bottomLayout); + setLayout(mainLayout); + + QGroupBox *boxTitle = new QGroupBox(tr(""),this); + QLabel *lable = new QLabel(tr("显示模式:"),boxTitle); m_btDetail = new QRadioButton(tr("详细模式"),boxTitle); QRadioButton *btTable = new QRadioButton(tr("表格模式"),boxTitle); m_btDetail->setChecked(true); - QHBoxLayout *hLayoutBt = new QHBoxLayout; - hLayoutBt->addWidget(m_btDetail); - hLayoutBt->addSpacing(20); - hLayoutBt->addWidget(btTable); - hLayoutBt->addStretch(); - boxTitle->setLayout(hLayoutBt); + + m_searchText = new kbdSearchWidget(boxTitle); + m_searchText->setPlaceholderText(tr("请输入描述")); + connect(m_searchText,&kbdSearchWidget::sigSearch,this,&TempWidget::onSearchTableText); + + QHBoxLayout *boxLayout = new QHBoxLayout; + boxLayout->setMargin(3); + boxLayout->addSpacing(10); + boxLayout->addWidget(lable); + boxLayout->addSpacing(5); + boxLayout->addWidget(m_btDetail); + boxLayout->addSpacing(20); + boxLayout->addWidget(btTable); + boxLayout->addSpacing(25); + boxLayout->addWidget(m_searchText); + boxLayout->addStretch(); + boxTitle->setLayout(boxLayout); + + topLayout->addWidget(boxTitle); m_stackRight = new QStackedWidget(this); initStackRight(); - QVBoxLayout *vLayoutRight = new QVBoxLayout; - vLayoutRight->addWidget(boxTitle); - vLayoutRight->addWidget(m_stackRight); - vLayoutRight->setMargin(0); - setLayout(vLayoutRight); + bottomLayout->addWidget(m_stackRight); QButtonGroup *group = new QButtonGroup(this); group->addButton(m_btDetail,0); @@ -120,6 +141,7 @@ QWidget *TempWidget::initPointTempWidget() { QTabWidget *tab = new QTabWidget(this); QWidget *w = new QWidget(this); + w->setProperty("type","tag"); QVBoxLayout *vLayout = new QVBoxLayout; QToolBar *barPointTemp = new QToolBar(w); @@ -131,6 +153,7 @@ QWidget *TempWidget::initPointTempWidget() m_listPointTemp = new QListWidget(w); m_listPointTemp->setSelectionMode(QAbstractItemView::ExtendedSelection); + m_listPointTemp->setObjectName("devTempDetailListWidget"); vLayout->addWidget(barPointTemp); vLayout->addWidget(m_listPointTemp); @@ -138,7 +161,7 @@ QWidget *TempWidget::initPointTempWidget() tab->addTab(w,tr("模板测点")); - m_listPointTemp->setStyleSheet("background: #EEE8CD"); + //m_listPointTemp->setStyleSheet("background: #EEE8CD"); return tab; } @@ -678,12 +701,13 @@ QStringList TempWidget::locateTable(const QString &tableName, const QString &col return tableList; } -void TempWidget::reloadList(QListWidget *list, QList items) +void TempWidget::reloadList(QListWidget *list,const QList &items) { if(list == NULL) return; list->clear(); foreach (QListWidgetItem *item, items) { + item->setText(item->text() + " 【" + item->data(Qt::UserRole).toString() + "】"); list->addItem(item); } } @@ -705,7 +729,7 @@ QString TempWidget::exportExcelTemp(const QString &tempTagName, const QString &f } //导出模板点 - filter = QString("%1='%2' order by SEQ_NO").arg(CN_DEV_TP_NAME).arg(tempTagName); + filter = QString("%1='%2'").arg(CN_DEV_TP_NAME).arg(tempTagName); model = KbdTableDataMgr::getInstance()->createModel(Common::createViewName( TBL_ACC_TP_DEF,filter)); if(model == NULL) @@ -727,6 +751,8 @@ QString TempWidget::exportExcelTemp(const QString &tempTagName, const QString &f { return tr("导出ANA模板点不成功"); } + + model = KbdTableDataMgr::getInstance()->createModel(Common::createViewName( TBL_DIG_TP_DEF,filter)); if(model == NULL) @@ -889,9 +915,9 @@ QString TempWidget::beforeImportTemp(QXlsx::Document &xlsx) KbdDbDesign ds; if(ds.isExistDevTemp(devTagName)) { - if(QMessageBox::Yes == QMessageBox::information(this,tr("消息"), + if(N_MessageBox::Yes == N_MessageBox::information(this,tr("消息"), tr("存在同名模板%1,是否修改模板标签名?").arg(devTagName), - QMessageBox::Yes,QMessageBox::No)) + N_MessageBox::Yes,N_MessageBox::No)) { KbdPropertyDlg dlg(false, this); KbdTableModel *model = KbdTableDataMgr::getInstance()->createModel(TBL_DEV_TEMP_DEF); @@ -1016,15 +1042,18 @@ void TempWidget::onSwitchMode() clearPointList(); clearPanels(); m_stackRight->setCurrentIndex(0); + m_searchText->setPlaceholderText(tr("请输入描述")); } else { clearTableMode(); m_stackRight->setCurrentIndex(1); + m_searchText->setPlaceholderText(tr("请输入标签或描述")); } onDevTempListItemChange(); + m_searchText->clear(); //清空搜索条件 } void TempWidget::onDevTempListItemChange() @@ -1090,6 +1119,8 @@ void TempWidget::onTableTabChanged() m_tableMode->getTable()->setModel(model); + //保持搜索内容 + onSearchTableText(m_searchText->text()); } void TempWidget::onShowMenuForAdd() @@ -1248,7 +1279,7 @@ void TempWidget::onRemovePointTemp() if(selectItems.isEmpty()) return; - if(QMessageBox::No == QMessageBox::information(this,tr("消息"),tr("是否删除后台模板测点?"),QMessageBox::Yes,QMessageBox::No)) + if(N_MessageBox::No == N_MessageBox::information(this,tr("消息"),tr("是否删除后台模板测点?"),N_MessageBox::Yes,N_MessageBox::No)) return; bool success = false; @@ -1475,9 +1506,9 @@ void TempWidget::onNeedSave() if(panel && panel->propertyIsChanged()) { - if(QMessageBox::information(this,tr("提示"),tr("测点属性已经修改,是否保存?"), - QMessageBox::Yes, - QMessageBox::No) == QMessageBox::Yes) + if(N_MessageBox::information(this,tr("提示"),tr("测点属性已经修改,是否保存?"), + N_MessageBox::Yes, + N_MessageBox::No) == N_MessageBox::Yes) { onSave(); } @@ -1652,6 +1683,7 @@ void TempWidget::onModifyTable() if(retStr.isEmpty()) { KbdPropertyDlg dlg(true, this); + dlg.setWindowTitle(tr("修改后台测点模板")); dlg.panel()->setDisplayRow(model,index.row()); if(dlg.exec()) @@ -1842,7 +1874,7 @@ void TempWidget::onModifyDevTemp() void TempWidget::onRemoveDevTemp() { - if(QMessageBox::No == QMessageBox::information(this,tr("消息"),tr("是否删除后台模板?"),QMessageBox::Yes,QMessageBox::No)) + if(N_MessageBox::No == N_MessageBox::information(this,tr("消息"),tr("是否删除后台模板?"),N_MessageBox::Yes,N_MessageBox::No)) return; KbdTableModel *modelDevTemp = KbdTableDataMgr::getInstance()->createModel(TBL_DEV_TEMP_DEF); @@ -1863,10 +1895,10 @@ void TempWidget::onRemoveDevTemp() tempTag = it->data(Qt::UserRole).toString(); if(ds.isExistDevTempInDevInfo(tempTag)) { - if(QMessageBox::No == QMessageBox::information(this,tr("消息"), + if(N_MessageBox::No == N_MessageBox::information(this,tr("消息"), tr("该模板 %1 存在已实例化的设备 \n 是否强制删除此模板?") .arg(it->text()), - QMessageBox::Yes,QMessageBox::No)) + N_MessageBox::Yes,N_MessageBox::No)) return; } @@ -1930,6 +1962,7 @@ void TempWidget::onInstDevTemp() } QStringList devTempRowDatas = modelDevTemp->getRowData(0); KbdBatchInstanceDlg dlg; + dlg.setWindowTitle(tr("批量实例化后台设备")); const ColMgrDataList& modelDevTempCols = modelDevTemp->getHeadCols(); dlg.panel()->setDisplayRow(modelDev,modelDev->rowCount()); @@ -2202,6 +2235,7 @@ void TempWidget::onApplyAddToInst() } KbdDevListDlg dlg(devTempTagName); + dlg.setWindowTitle(tr("添加应用至对应设备")); if(dlg.exec() != QDialog::Accepted) return; @@ -2214,6 +2248,12 @@ void TempWidget::onApplyAddToInst() QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); if(retStr.isEmpty()) { +// QString strJoinTemplate = QString(" LEFT JOIN " +// "(SELECT tmp_rtu.TAG_NAME as RTU_TAG,tmp_ret_rtu_no.DEV_NAME as DEV_NAME FROM fes_rtu_para as tmp_rtu " +// "RIGHT JOIN " +// "(SELECT tmp_ret_grp_name.TAG_NAME as DEV_NAME,tmp_dev_grp.TAG_NAME,tmp_dev_grp.RTU_NO FROM dev_group as tmp_dev_grp " +// "RIGHT JOIN (SELECT dev_info.GROUP_TAG_NAME,dev_info.TAG_NAME FROM dev_info WHERE dev_info.TAG_NAME IN(%1)) as tmp_ret_grp_name on tmp_ret_grp_name.GROUP_TAG_NAME = tmp_dev_grp.TAG_NAME) as tmp_ret_rtu_no on tmp_rtu.RTU_NO = tmp_ret_rtu_no.RTU_NO) tmp_ret_rtu_tag ON tmp_ret_rtu_tag.DEV_NAME=tmp_dev_info.TAG_NAME "); + foreach (QListWidgetItem *item, selectItems) { QString pointTempTagName = item->data(Qt::UserRole).toString(); Common::KbdGroup pointType = (Common::KbdGroup)item->data(Common::GroupRole).toInt(); @@ -2291,6 +2331,7 @@ void TempWidget::onApplyRemoveToInst() } KbdDevListDlg dlg(devTempTagName); + dlg.setWindowTitle(tr("删除应用至对应设备")); if(dlg.exec() != QDialog::Accepted) return; @@ -2777,3 +2818,22 @@ void TempWidget::anaLimitNumChange(KbdPropertyPanel *panel, int isLimit, int lim } } +void TempWidget::onSearchTableText(const QString text) +{ + if(isDetailMode()) + { + for(int i = 0;i < m_listPointTemp->count();i++) + { + QListWidgetItem* item = m_listPointTemp->item(i); + if(item->text().contains(text)) + item->setHidden(false); + else + item->setHidden(true); + } + } + else + { + m_tableMode->getTable()->searchItemText(QStringList()< items); + void reloadList(QListWidget *list,const QList &items); QString exportExcelTemp(const QString &tempTagName,const QString &filePath); QString afterExportTemp(QXlsx::Document &xlsx); @@ -119,12 +120,16 @@ public slots: void onPropertychange(const QString &sqlName, const QString &text); void digCtrlNumChange(KbdPropertyPanel *panel, int isCtrl, int offsetNum); void anaLimitNumChange(KbdPropertyPanel *panel, int isLimit, int limitNum); + + void onSearchTableText(const QString text); + private: QListWidget *m_listDevTemp;//设备模板列表 QListWidget *m_listDevTempPlugin;//套件设备模板列表 QRadioButton *m_btDetail; QStackedWidget *m_stackRight; + kbdSearchWidget* m_searchText; QAction *m_actionAddPointTemp; QListWidget *m_listPointTemp; diff --git a/platform/src/tools/model_plugin/UserWidget/usermanagepluginwidget.h b/platform/src/tools/model_plugin/UserWidget/usermanagepluginwidget.h index 25155389..59d303dd 100644 --- a/platform/src/tools/model_plugin/UserWidget/usermanagepluginwidget.h +++ b/platform/src/tools/model_plugin/UserWidget/usermanagepluginwidget.h @@ -7,7 +7,7 @@ class UserManagePluginWidget : public QObject, public CPluginWidgetInterface { Q_OBJECT - Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0") + Q_PLUGIN_METADATA(IID HMI_WidgetPlugin_IID) Q_INTERFACES(CPluginWidgetInterface) public: diff --git a/platform/src/tools/model_plugin/UserWidget/userwidget.cpp b/platform/src/tools/model_plugin/UserWidget/userwidget.cpp index 56e07d80..41217d5a 100644 --- a/platform/src/tools/model_plugin/UserWidget/userwidget.cpp +++ b/platform/src/tools/model_plugin/UserWidget/userwidget.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include "CustomWidget/kbdsqltreemodel.h" #include "CustomWidget/kbdtreeview.h" #include "../../model_user/kbduserwidget.h" @@ -26,21 +27,52 @@ UserWidget::UserWidget(QWidget *parent) : KbdWidget(parent) void UserWidget::initLayout() { + QVBoxLayout *mainLayout = new QVBoxLayout; + QHBoxLayout *hLayout = new QHBoxLayout; QSplitter *hSplitter = new QSplitter(Qt::Horizontal,this); m_tree = new KbdTreeView(hSplitter); m_tree->setHeaderVisible(false); - m_tree->setModel(new KbdSqlTreeModel(Common::getTreePath("userTree.xml"),this)); + m_treeModel = new KbdSqlTreeModel(Common::getTreePath("userTree.xml"),this); + m_tree->setModel(m_treeModel); + m_tree->hide(); //把树隐藏,使用tabbar代替 hSplitter->addWidget(m_tree); + //因为借用了m_treeModel的解析数据,所以tabbar初始化必须放在m_treeModel后面 + m_mainTabBar = initMainTabBar(m_treeModel); + mainLayout->addWidget(m_mainTabBar); + m_stack = new KbdUserWidget(this); hSplitter->addWidget(m_stack); hSplitter->setSizes(QList()<<70<<600); hLayout->addWidget(hSplitter); - this->setLayout(hLayout); + mainLayout->addLayout(hLayout); + this->setLayout(mainLayout); connect(m_tree,SIGNAL(clicked(const QModelIndex &)),this,SLOT(onLeftTreeClicked(const QModelIndex &))); + connect(m_mainTabBar,SIGNAL(currentChanged(int)),this,SLOT(onMainTabBarCurrentChanged(int))); + + //默认展示第一个tab + m_mainTabBar->setCurrentIndex(0); + onMainTabBarCurrentChanged(0); +} + +QTabBar *UserWidget::initMainTabBar(const KbdSqlTreeModel *pModel) +{ + QTabBar *mainTabBar = new QTabBar; + mainTabBar->setObjectName("userMainTabBar"); + mainTabBar->setExpanding(false); + + for(int i = 0;i < pModel->rowCount();i++) + { + QStandardItem *item = pModel->item(i,0); + + mainTabBar->addTab(item->icon(),item->text()); + mainTabBar->setTabData(i,item->data(Common::ClickRole)); + } + + return mainTabBar; } void UserWidget::onLeftTreeClicked(const QModelIndex &index) @@ -68,3 +100,8 @@ void UserWidget::onLeftTreeClicked(const QModelIndex &index) m_stack->setCurrentCfg(KbdUserWidget::ACS_DEV); } + +void UserWidget::onMainTabBarCurrentChanged(int index) +{ + onLeftTreeClicked(m_tree->model()->index(index,0)); +} diff --git a/platform/src/tools/model_plugin/UserWidget/userwidget.h b/platform/src/tools/model_plugin/UserWidget/userwidget.h index 2212087b..7460a02d 100644 --- a/platform/src/tools/model_plugin/UserWidget/userwidget.h +++ b/platform/src/tools/model_plugin/UserWidget/userwidget.h @@ -9,6 +9,9 @@ class KbdUserWidget; class KbdTreeView; +class QTabBar; +class KbdSqlTreeModel; + class UserWidget : public KbdWidget { Q_OBJECT @@ -17,12 +20,16 @@ public: private: void initLayout(); + QTabBar* initMainTabBar(const KbdSqlTreeModel *pModel); KbdUserWidget *m_stack; KbdTreeView *m_tree; + KbdSqlTreeModel* m_treeModel; + QTabBar *m_mainTabBar; + private slots: void onLeftTreeClicked(const QModelIndex &index); - + void onMainTabBarCurrentChanged(int index); }; diff --git a/platform/src/tools/model_plugin/model_plugin.pro b/platform/src/tools/model_plugin/model_plugin.pro index aa9eb362..ed9b1620 100644 --- a/platform/src/tools/model_plugin/model_plugin.pro +++ b/platform/src/tools/model_plugin/model_plugin.pro @@ -6,3 +6,5 @@ SUBDIRS+= \ TempPlugin \ UserWidget \ SystemConfigWizard + +TRANSLATIONS += model_plugin_EN.ts diff --git a/platform/src/tools/model_studio/icons.qrc b/platform/src/tools/model_studio/icons.qrc index d162d0d1..491b3967 100644 --- a/platform/src/tools/model_studio/icons.qrc +++ b/platform/src/tools/model_studio/icons.qrc @@ -1,23 +1,13 @@ - icons/dev.png icons/generate.png - icons/exit.png - icons/alarm.png - icons/common.png - icons/fes.png icons/sysconfig.png - icons/user.png - icons/formula.png - icons/sample.png icons/studio.ico icons/acc.png icons/ana.png icons/const.png icons/dig.png icons/mix.png - icons/linkage.png - icons/seq.png icons/export.png icons/import.png icons/fesCfg.png @@ -28,5 +18,20 @@ icons/finish.png icons/config.png icons/ID.png + icons/light/alarm.png + icons/light/common.png + icons/light/dev.png + icons/light/exit.png + icons/light/fes.png + icons/light/formula.png + icons/light/linkage.png + icons/light/logo.png + icons/light/plan_curves.png + icons/light/sample.png + icons/light/seq.png + icons/light/template.png + icons/light/template_bind.png + icons/light/tools.png + icons/light/user.png diff --git a/platform/src/tools/model_studio/icons/alarm.png b/platform/src/tools/model_studio/icons/alarm.png deleted file mode 100644 index c2c36f0c5f03769934f1a674fc4a16b10dcb92a8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 761 zcmVo;-L;@6t9W4`Q2uMK_x_BX4(;ZtYvs3LRJ`Z{NK6 z=6myFL#m3?l-zNBPrjE~VYHN}tc1m|N*l*HH zKLO6a37f*GJI9GrpI!~Cw3y|Cvo@Trs-B^G{J4Ud~R(nRY$5xk(Xos!Bh}I@P zYU@M{rq_ZQVQeb_!nCS{#`pP&?%#H2-r1HAY7s+5HMqq`uFK1SMVE|Ku%KhCdYwD@ zdD|=+L5D?QEE-;4zL&=8e0)fo-|iK<#Sc=+e^T!~v(+UdE*PCVHUNuGC3oL;>p~!{ ziN36OgAv_vwvO>h7`TH@x2M;Faxsugg+Mlaw!3%o8xdPM34lb@v9(a@76Ln42n5AI zGV49bmsh-<>>?tHe-{Hm=one{CVFI_(N10f7m*|gE_!1LgN!?l?Oi$h_s23A0=VaY z7#zvLwdcKZQbEzW7})5V98flcILQ}Z{4S4WV63jYfi{dNA8OlJsTxZ=nE;{?B@pX6 zfJ%Dr(5Sfnbg!vQ^<=T%dP!}GChmV5iM`upB#1d2;k=9-Faoal6WMq zetvi^b3*#$%F2FAnQAcz?rtrV)(-(xAN}YG(NsL|Q*%EaWPTknP1}!j?`y48K9mF3 zSmZVpDeauN3ZbYBU0x)~Po&+n1%XJRaSq_(rBuNk04QeE>TKjxW3Zv|FzN0CL#hXw zlJ}GbjsV-pSCOWm=6sAg8C2yx^e)LPfEcydRZlK9S r=qEZCkB&&^Yzzt*ubCRKJT8Q4pSav%7&P$womC?JN}%vC~F9Y%I(bwsP4< z5dQ$d#!Ii2h@eFdI}btATx;+jFaf)Ot%XQ-J<+?}_e0*xzTM5GdJ9*G1H;>W^Ua%? z@68)jO2KgoJJ!I~bOksZzNz83&mh*1`U#qoOLU zJw6Z~jyPd-xWRUg+MP#*bv*y}Am*O2we`x0f$%Wlgpl6EqJ5o5g_R(cTH8UY#zCrv zjZ}`8|8l(oaD4ukUhNOK$3}v1Jl|?=TI`wk=?6jB=N?AMZEpwaj*1{vqr8IYk*cQo z{%D0Fa2ypuDx=2opk5W*NM$b%5Uo*k_1Qw@9W)b!*FQgO#rpXR!iiwe)f9cb*DNmi z+S5hM3EP?`?%`Ar_PB?APMFLGCyFF%jf%VqATnLkXA=9uU@#$CeOk3fg_e(xPlul# soeE33R5W|g3cuVxxkB+jJ}Lmm~kFIsoVsq~zoiC_5q<%+fcWK$iR)J145KouTg{C|<|VcPsZloGIN|-3vL$Ioj8+ zW#$^LD3YMK0tKMTvPesP?Z+oRnF?AdzTYTfJvcE%GL@oR0D8vmnR}aWp$GF6nZst0 z27uSAdqD{~XC1&(6Jqnl6eY$!o+8T_9c>p{YrBKIx$X9AnHFjVEch%G5hqS^`Q<5_ zU9$iF+09F>io5Mmn~Ap6KKinmB@OW4#VK2tm)@N5@=7j4X}0R@xn&uCuCI_e2i#PR z(I?PM)bup!i7-CZtLZ>E5zm_G$awZ+8_gL-S1JGIA1zJRb_b=gC%WSd-3UE_aYkUQ zv`5+wJ#iMgR1PcD`zwI#c?5UDa6Lk(HN%}qxD%mmwx? diff --git a/platform/src/tools/model_studio/icons/exit.png b/platform/src/tools/model_studio/icons/exit.png deleted file mode 100644 index 3789372eebf84c4a5e9f52917a263649a8d8c0e6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 774 zcmV+h1Nr=kP)Es}(;3P;QIEX{*;9{|NgM$u2gWw`aad5H4tE5%a{@#<{<#N5` zl8_sGaNO|wz3=D!`~7|>BJe+rl4y@Eb0xhZl_WliGO%9n%C17FPbwVLXDCTD=>`M& z+G=2*o+Uc6*eD-*wUh4zWE$KKU6Fjsk@CQRV=w+#M_>M3C6=Pn;v8OVOhp0d2w?OL zPbn71>`ghcnsUVI3&=hHZ4ryBwAe}uC@s|=m(okE^-Kp~`#dd?ma1Yfdukpj*Vky ziCR{lR29WiH4xHL99iaE44_y_)QnHS6B(U26XC7_l6d?!-AVJsY z2QkIqu?V2-9dsXH((KQv*W( z5a8Y(TT?9egA}LFJ^0yoB%^lnN!?r*(?K5>zFr+!Yc0nfobmaMRUxq1A6uw0V(Hzj zgI!1W^y6O^6O;vU+DsrL);?d`e=52s2AG&zw*2pH+f=iJtqJqAjVJ)0n8wQ+Ebx6-v9sr07*qoM6N<$ Eg6h^(x&QzG diff --git a/platform/src/tools/model_studio/icons/fes.png b/platform/src/tools/model_studio/icons/fes.png deleted file mode 100644 index 8f09e2c9727e004009a92f9af0607690f2fac255..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 964 zcmV;#13UbQP)+P4?Q+iXNoJUD`gAW7bA44Ho2RW04` z&CFW}YfQ+&f_~jy-CbXI)mOzs=Nvpp5f9Wl04V=??DN}wCt#Biz#)P|02XCmAG2Q* zupIk!fv`9y0BSY{rj31kd~~b92si#^a}A{2cM#-GfB^bsfl81AoNsV$``0&DdiUd! z)o*Bo2wiW_O9=84pWbpF@#nKggZAOCjWY_tDg+aW-9~OQ8{uY{E8+En#?)k1iM~<^aAeUNB=1(oHq*B$|8WoV;$BXx>R@)cU2n(n~e(C7L(W z8I2$PLO18<1(zTT07-BFz`r1!@phuAooXKWc@i46Cufe}?{B2pGnb~#pWZs!N;MBs z&Bqf>3vzfD&F$4(1T_ExLt=9E+*;=6&wp^ky9aE9TTgwwpIaqH>zY4%c9`#_B@z63 zR&&vm0S^K=T*e^Lyz7Ho1N4FQK?fPw*|SzTG5WnJ(C2x)AI`l znx4FvJD(iipKmNt?m`~&E{?ns53k`XN9 zR1mHSCBC9ywFFqQi0%QP;5;b;0k;3@#Eqoj^`zjvSTn3%q2`iB6-{4w|N7`|jX(Y2 z{zhEzFxEVsoH-I0^yh0yo@nj|(1ORcAOj#eUyr({-n-si6t7S@m&L1A49_N-GfDWH zRCxT!Pi{7TICm_sUe)xBo3pCQ12>o_N11fhxXKS%>3pmtm%8sRG{#B68zDam&RQSs zcTQZsxe;p`#s$M4uP2=ai|$okdgt0k#U8M-ERJOp@Z;O7c;5hXX}^1|NeahSVfO8X z^-g{5P=Mzy=B*+YSrOryi3JpqfWr4NhOvpo)Tm{dzLTiKZnkopKv@SWMlhjwpe%#3 mB8u&B)tiH)%I%8^M8P z-|m|?Gr!-=yg_D$|0zaf`^;On#E1_W0SEzDAm}w?{T=?(YXOb#XuqKgFzx5DbTHNs z!Pz%^Sw{RFA3!|dq{X0UJxlI;<+qUcrxaZFJ=i5+M~NK$yDNaA{aI#gqe z18x6b5I_ZxS9S7_M8FLI{bjEh7+4Gp0ltCIyQ`jC9!&&>sQw%^i|Iu*6-X=u2G07U zX1TxY*~G`7h#M63xOCoEI4l)RONHR2#K-iOnh-?er{8(ylz}B7vATQHC~N&6h16yz zg!?Gs21V8$fiw`RV^-WagY#}tD*PT8I41}*QsPv!XDv~Y1cIN(xy}w0L&T%y66nYW z7Iru=5PU=A*T?&ui!ZlVBxz*0S{>_kv~K2okTWH|QsLR8gE%#UIYd#XNNJihlDvL; zT&i4t_Q$q78cumsOL;Uju&`4IBlJ0I`V3}3T~HJvU|5~VI??{M$F8QPCKcM!Kqnxa z9h}>C%(MYS2!h%tIYyxCxruuO42AIH1&6L-P$W!mL8m{m_FNP mz#2(SuUn1pL-1b&0R93m}060000lf?N#+c(;A$6-JE`vL%)Q?d2AaLH!0=9kYYA4FV@oRm1e7M% zj>tQ%jNeFPIe=7Wpr*8K3xN8*=yqapWimAi{j+K2_q8aI5I7bU00Vhh z_V-WnzBN!tR<-Zfi9Rdy;tb*{QUw)PjlrnQF0t%N;n&4ItlhVf`a~OTC!6+|aI7La zKipU?oruLt#10*#g)G+tSRm7NW>M=i&{>qsWmwj_Gh-+_R%;&4z`bMj8wLjZCwa;Q z_n7eX>yxcKFc1uCxY8^#EU94`8Y`2%)4U6z4=M)h&LRguRG4m$?W#0yO%(Ri7~#DfPiJ3)XoUY zW~Qf|MNHV2ymU{!>hJ6K)$8{LjWMv57Hlax0El}9_kMmS)`V>(a9$JEH6bWMa94o? z4ln_LPTs_HGmK3odh(O?jwU>&MF5HbGzFjuK#2f~L|Py)!l}H8?fWKp`plnwCGNhl z2fL&RSCqiiuff+jp%AQ~8e`Mim@{!^kTX9(CmxT*+S*WRg4lc4*^vWx@5t`^wP zjCDnrguN1p&7kZDKfJl{?8j?M(_+(n_j1;)eI-rx>)gzIr#i(wBZmu%l(FOkc7RHl*S71HLXuxH{j_?~6iiZV_snLZIJ za{>X8y?bbx%56Hl3WjX zoUv8GXHXwi(f$h?b0OhgUo{X21kKn2pu_@^Kp;jSJ#_fj+ED3Gnlumqn#awK&WR5me(LPH%i@RkcBhw*@0yDwFGd;PE)d!K#a|Y8%>DNIOghFe zEng_BSB}oEOb~>UJH7&}k4n`Ob%i!@l=1uCW_R$T zHP=D?*LeQQ(b-lRWSUjK(MwkQjTeHYa(IH^&<8hbwqd#6FI+XOYQomlBRi+|`^Ub> z?7ZkI!iL|!Z~a9|Hzlz4{K*?NO_(S@VEluwU2DQr3E!^iZoBqzyEagS^J_1Mx9&+W zwC7IV=xBk*N>dDU>E6dqU4L!+{STZ%HZdc#wI7*dA~)Rznu0_TbgsSq(ElHq56ZUo cUj+dC11On0FH$~X-T(jq07*qoM6N<$g3VsdFaQ7m diff --git a/platform/src/tools/model_studio/icons/seq.png b/platform/src/tools/model_studio/icons/seq.png deleted file mode 100644 index d55790f57a0a88c9bac843d760de40acca4be392..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 749 zcmVf4&FN=Jz#|&-mB|miqFK=}hBwV@Iz}b}8_2U&6HdP=4~OZsgU|ouHN)3lf&#$6 zc`rdYBbsm|Dq&?u1UyxBujE{&kVz_vh~_O~9#MH1xvTG6xM*=n%PG{MLpHV}g58Y6PdAI2Vbdb} zayf^YB=2SjX#zz6o}+EgeZVD6c@!(}L(c@fX@d64)(19FTZ-{U7ud-c6yca=m>&-} zmNmmrFf6zNVn1|94qm9>z)Kza%B+co30;CVvD5D-2l3;z0sMR=hugdI1>DmwIR zv!WS3aqw%3;ndn$zTU47Cho2V3%5tR&LrP4KdT8q5iEVZl&kzx1l2TQS4gc$%h*O^y!1l1dBIEs$80yZIzJb9G50Odi%K#GC8oLaciV9 zac6bKV>sh6tS3PXXa=Btm^<<4$6VS6!pf8&S!dhE&pxhC-}~N0a@ugIWG%(8xH37| fljQyVYyp734tnh59R@LB00000NkvXXu0mjfcZ^f( diff --git a/platform/src/tools/model_studio/icons/studio.ico b/platform/src/tools/model_studio/icons/studio.ico index a91ae219008530ca390033e9ba70bcef3905ca14..63b5c58a0cd0a5b670fba74b1e79ba94f868f765 100644 GIT binary patch literal 4286 zcmeHLv2GJV5PcQ}1wxL5l-4Qf;13)rAHXNTA3zBO@)}B8v?#%AIowu`hX9FGi9vwli_;vss0(dDRCLD{XT|Z8I zFP^Q$8xohx5sqgW%57yn!nw}1VW$He_;{yyZS8e!!Oge97ToI?w=RC2?>};1E(R6B zb%7iDX2O%?zHFL5^Okw-^s8>l zbv*7WLyvJTz6k&8eH+t0&oIz=TB9?wFN?Ev&BSq=_K9J&-|vwBoHb&{*>(z#=UL`E z857i``fLo__MA(u)mh4|@4j{dKbS`ztFeJEjwxftjCm>i$A0Z^;$L$3Zs&Pkt9xSX zv*WZa*lVuLUf6M0r+Cjk*ZPmH?wM1m74c02f6e{0QO(PF*@(Z&S8><*gwKVk?hE5k z^DM+QPyde$A2b*CgS^7{JkRyooGZpmX}gac^I-hdn#cOAW6b+>RKs=o=dz})MeFis zhBxs#7Q&C7SHB;IU#>CEpZ2!3^`3wKjJ~^#Eu?zWAlm}tJRsN7)3wqI zbTaBanP)&xSiY%OxY3sb>_aAv)X*nQmusinYQ1>#hyz%|ZuLOV*7~A#S~dT2Uc7xQ z2Ux?!JP8~ibG^5v*IvAPJOyYIGU#(eM7x<^O0Gxge!l~_LpY@e0|dB3Q0d{Iz#W3h zk8FWE1eIq_2)qd{`j&iNFxnt%&`T}QSeUy8O=}L7pPm%B4H?v%o``N9#al=7z(L&x zSs&YP2O19=d0)HHcR@RUsyrVO*g#hI4Cdv>c(2yUW3+?1K57~d^CY}827k$<%8OG1 z8z9{?m{(s9vqmIMSVraLX##A(=w1JKo;4zA!ZNC_h6%6%qxag^3k33jWv&bd>W;1n z%c#CNLx2rzc$a9v1}zH9671+co%0Ce_}L2yDPZEmdC_PpmCX5%2)}qnulkUAW$BW1n~9{4Y)8^F()u zzhqMF!#RON@X&LCh3jogrhaJOA8zH@(5Prc>#vcuVct}CM+J_8o*T?t_m@)pj0a>SJvV*KZE5(WjXo(XW|3KSuTWF^+>elBJt`h?pL$J9^e+FmWEF}qL*Y+V{ua8 zh`5c#2@A-GHGd$r9{6C4>_=-E+)p#Omqy2Hu34H&;ChpQy`S)X@>}qcOx(*a3b>bV z3m5Bz?XH*SF35eY6A*v9lmgr#NcM~D8^He=4|$fS)ZV;Odt~I9AIvMO%*)f9RcbfM zPY3$Zw_mB^9TodorkGb&>(o_jWtCzvqS*AZQiISO=<<1@RN{(Kah!MIt8$mU;YOH& F*l#^bEtdcQ diff --git a/platform/src/tools/model_studio/icons/user.png b/platform/src/tools/model_studio/icons/user.png deleted file mode 100644 index a9aa7d12ba66877d74cdab940e8b7a70f16906ca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 938 zcmV;b16BNqP)y}iA`w2|3JPQw zh=#%uLP)9NP((C{%TYlQETy7A+7nVlLE#8c3IwqLiGt>?K#0y)APSD0SAkr}dS}qQ zUHf*udk0NMT0QCgeBXRC^WH2}mF}n2{tNr$7ja8~o-%a==qeKl=(+-9Wg6Xmktc_p zuT=2Z=l}GC(NR!OKuu*BDCI|m5rLFxTRrbRa?N+ManhP^PX20Z2F-L6I^> z0y3{{&WJn8s4o+nIwBgzD;O6Dp8WLAba5aB-?A_W)9CkC9~f83uYWb`D4R;yc-kv6 zWsKbcP${-YzSV{S#4DICuN}LQw3KNepbO^U-YUc9dA@-Y zr9hNeXuJ%5;>);w{KhPFvFrwk?z)>Ax|`b0@45YQFyTZ;fe^9m=XFs<25$3UDw&IQ z#6nGGJM01aNq`O!TKTjB5cDLhVZMs;<&EyIH#Twb%!(U4$zn7Dg#KscA z96XRBK`oZHn;E!n|Is@#x%G;hxS39j(AJg}EMqJ}WO0L40HHwOVhu%T%|g_?wl_`! zOkIG}%!pVhEGY08p#0t1SCIGw`!R37zVXPk7E73hNS}AHc3rF%uJF&UD^!!6O>rs+ zY;t*VZoj;Fbl_sWnB{?7EEj)!?ZLtFzIg=&l{rZENvfEj zgfUc5SJEC4*~|L#TSqr52{Mqjf<^)~)9&S)%4GqDKU_NDfuFlFZKN+J-dpSeZ3|Ox z>-_P8x&wRi>iW)_fCjmy5-DgXKr8D3^{jnH3Jia`P+zOUIkf4ouJ1IIXsC>S+DH~1 zZr;5%lri}6?MA6T{4atWQA #include "kbdreplacedlg.h" -#include +#include "pub_widget/MessageBox.h" #include "kbdwaitprgdlg.h" #include "worker.h" #include -#include "pub_logger_api/logger.h" + enum tabWidgetIndex { BASEINDEX = 0, @@ -25,7 +25,7 @@ enum tabWidgetIndex }; KbdBackPointPatch::KbdBackPointPatch(QWidget *parent) : - QDialog(parent), + CustomUiDialog(parent), ui(new Ui::KbdBackPointPatch) { ui->setupUi(this); @@ -34,6 +34,8 @@ KbdBackPointPatch::KbdBackPointPatch(QWidget *parent) : initTabWidget(); initConnect(); initMenu(); + + CustomUiDialog::setAutoLayout(true); } KbdBackPointPatch::~KbdBackPointPatch() @@ -62,14 +64,12 @@ void KbdBackPointPatch::initComboBox() void KbdBackPointPatch::initConnect() { - connect(m_tab,SIGNAL(currentChanged(int)),this,SLOT(onTabChanged(int))); + connect(m_tab,SIGNAL(currentChanged(int)),this,SLOT(onTabChanged())); connect(ui->pushButton_search, SIGNAL(clicked(bool)), this, SLOT(onPushButtonSearchClicked())); connect(ui->comboBox_location,SIGNAL(currentIndexChanged(int)),this,SLOT(onLocationAndSubsystemChange())); connect(ui->comboBox_subSystem,SIGNAL(currentIndexChanged(int)),this,SLOT(onLocationAndSubsystemChange())); connect(ui->comboBox_devGroup,SIGNAL(currentIndexChanged(int)),this,SLOT(onDevGroupChanged())); connect(ui->lineEdit_search,SIGNAL(textChanged(const QString &)),this,SLOT(onSearchTextChanged(const QString &))); - connect(ui->lineEdit_search_2,SIGNAL(textChanged(const QString &)),this,SLOT(onSearchTextChanged(const QString &))); - connect(ui->lineEdit_search_3,SIGNAL(textChanged(const QString &)),this,SLOT(onSearchTextChanged(const QString &))); } void KbdBackPointPatch::initPointType() @@ -251,34 +251,11 @@ void KbdBackPointPatch::reloadAccTableData(QTableView *table,QStandardItemModel } //隐藏某些列 - QList showCols = cols.getShowCol(); for(int i = 0; i < model->columnCount(); i++) { if(showCols.contains(i)) - { table->showColumn(i); - if(tabIndex == BASEINDEX) - { - comboxBaseList<headerData(i,Qt::Horizontal).toString(); - intBaseVec.push_back(i); - } - else if(tabIndex == FESINDEX) - { - comboxFesList<headerData(i,Qt::Horizontal).toString(); - intFesVec.push_back(i); - } - else if(tabIndex == LIMITINDEX) - { - comboxLimitList<headerData(i,Qt::Horizontal).toString(); - intLimitVec.push_back(i); - } - else if(tabIndex == CTRLINDEX) - { - comboxCtrlList<headerData(i,Qt::Horizontal).toString(); - intCtrlVec.push_back(i); - } - } else table->hideColumn(i); } @@ -383,33 +360,9 @@ void KbdBackPointPatch::reloadAnaTableData(QTableView *table,QStandardItemModel for(int i = 0; i < model->columnCount(); i++) { if(showCols.contains(i)) - { table->showColumn(i); - if(tabIndex == BASEINDEX) - { - comboxBaseList<headerData(i,Qt::Horizontal).toString(); - intBaseVec.push_back(i); - } - else if(tabIndex == FESINDEX) - { - comboxFesList<headerData(i,Qt::Horizontal).toString(); - intFesVec.push_back(i); - } - else if(tabIndex == LIMITINDEX) - { - comboxLimitList<headerData(i,Qt::Horizontal).toString(); - intLimitVec.push_back(i); - } - else if(tabIndex == CTRLINDEX) - { - comboxCtrlList<headerData(i,Qt::Horizontal).toString(); - intCtrlVec.push_back(i); - } - } else - { table->hideColumn(i); - } } } @@ -505,29 +458,7 @@ void KbdBackPointPatch::reloadDigTableData(QTableView *table,QStandardItemModel for(int i = 0; i < model->columnCount(); i++) { if(showCols.contains(i)) - { table->showColumn(i); - if(tabIndex == BASEINDEX) - { - comboxBaseList<headerData(i,Qt::Horizontal).toString(); - intBaseVec.push_back(i); - } - else if(tabIndex == FESINDEX) - { - comboxFesList<headerData(i,Qt::Horizontal).toString(); - intFesVec.push_back(i); - } - else if(tabIndex == LIMITINDEX) - { - comboxLimitList<headerData(i,Qt::Horizontal).toString(); - intLimitVec.push_back(i); - } - else if(tabIndex == CTRLINDEX) - { - comboxCtrlList<headerData(i,Qt::Horizontal).toString(); - intCtrlVec.push_back(i); - } - } else table->hideColumn(i); } @@ -624,29 +555,7 @@ void KbdBackPointPatch::reloadMixTableData(QTableView *table,QStandardItemModel for(int i = 0; i < model->columnCount(); i++) { if(showCols.contains(i)) - { table->showColumn(i); - if(tabIndex == BASEINDEX) - { - comboxBaseList<headerData(i,Qt::Horizontal).toString(); - intBaseVec.push_back(i); - } - else if(tabIndex == FESINDEX) - { - comboxFesList<headerData(i,Qt::Horizontal).toString(); - intFesVec.push_back(i); - } - else if(tabIndex == LIMITINDEX) - { - comboxLimitList<headerData(i,Qt::Horizontal).toString(); - intLimitVec.push_back(i); - } - else if(tabIndex == CTRLINDEX) - { - comboxCtrlList<headerData(i,Qt::Horizontal).toString(); - intCtrlVec.push_back(i); - } - } else table->hideColumn(i); } @@ -800,7 +709,7 @@ void KbdBackPointPatch::increment(const QString &textFormat, int startNum, const if(!textFormat.contains("%1")) { - QMessageBox::information(this,tr("消息"),tr("%1\n文本格式不对")); + N_MessageBox::information(this,tr("消息"),tr("%1\n文本格式不对")); return; } const ColMgrDataList& kbdModelCols = kbdModel->getHeadCols(); @@ -810,19 +719,19 @@ void KbdBackPointPatch::increment(const QString &textFormat, int startNum, const { if(textFormat != "%1") { - QMessageBox::information(this,tr("消息"),tr("%1\n文本格式不对").arg(textFormat)); + N_MessageBox::information(this,tr("消息"),tr("%1\n文本格式不对").arg(textFormat)); return; } } if(!kbdModelCols.at(indexList.first().column()).editable) { - QMessageBox::information(this,tr("消息"),tr("该列不可编辑")); + N_MessageBox::information(this,tr("消息"),tr("该列不可编辑")); return; } if(kbdModelCols.at(indexList.first().column()).isPrimaryKey) { - QMessageBox::information(this,tr("消息"),tr("该列是主键,不可编辑")); + N_MessageBox::information(this,tr("消息"),tr("该列是主键,不可编辑")); return; } @@ -856,7 +765,7 @@ void KbdBackPointPatch::increment(const QString &textFormat, int startNum, const MS_LOG_DEBUG(tr("自增菜单结束")); if(!errorMsg.isEmpty()) { - QMessageBox::information(this,tr("消息"),errorMsg); + N_MessageBox::information(this,tr("消息"),errorMsg); return; } @@ -877,7 +786,7 @@ void KbdBackPointPatch::increment(const QString &textFormat, int startNum, const } } - QMessageBox::information(this,tr("消息"),tr("修改成功!")); + N_MessageBox::information(this,tr("消息"),tr("修改成功!")); } void KbdBackPointPatch::sameValue(const QString &textFormat, const QModelIndexList &indexList) @@ -904,12 +813,12 @@ void KbdBackPointPatch::sameValue(const QString &textFormat, const QModelIndexLi const ColMgrDataList& kbdModelCols = kbdModel->getHeadCols(); if(!kbdModelCols.at(indexList.first().column()).editable) { - QMessageBox::information(this,tr("消息"),tr("该列不可编辑")); + N_MessageBox::information(this,tr("消息"),tr("该列不可编辑")); return; } if(kbdModelCols.at(indexList.first().column()).isPrimaryKey) { - QMessageBox::information(this,tr("消息"),tr("该列是主键,不可编辑")); + N_MessageBox::information(this,tr("消息"),tr("该列是主键,不可编辑")); return; } @@ -940,7 +849,7 @@ void KbdBackPointPatch::sameValue(const QString &textFormat, const QModelIndexLi MS_LOG_DEBUG(tr("取相同值菜单结束")); if(!errorMsg.isEmpty()) { - QMessageBox::information(this,tr("消息"),errorMsg); + N_MessageBox::information(this,tr("消息"),errorMsg); return; } @@ -959,7 +868,7 @@ void KbdBackPointPatch::sameValue(const QString &textFormat, const QModelIndexLi } } - QMessageBox::information(this,tr("消息"),tr("修改成功!")); + N_MessageBox::information(this,tr("消息"),tr("修改成功!")); } void KbdBackPointPatch::findAndReplace(const QString &strFind, const QString &strReplace, const QModelIndexList &indexList) @@ -985,12 +894,12 @@ void KbdBackPointPatch::findAndReplace(const QString &strFind, const QString &st const ColMgrDataList& kbdModelCols = kbdModel->getHeadCols(); if(!kbdModelCols.at(indexList.first().column()).editable) { - QMessageBox::information(this,tr("消息"),tr("该列不可编辑")); + N_MessageBox::information(this,tr("消息"),tr("该列不可编辑")); return; } if(kbdModelCols.at(indexList.first().column()).isPrimaryKey) { - QMessageBox::information(this,tr("消息"),tr("该列是主键,不可编辑")); + N_MessageBox::information(this,tr("消息"),tr("该列是主键,不可编辑")); return; } @@ -1024,7 +933,7 @@ void KbdBackPointPatch::findAndReplace(const QString &strFind, const QString &st MS_LOG_DEBUG(tr("查找与替换菜单结束")); if(!errorMsg.isEmpty()) { - QMessageBox::information(this,tr("消息"),errorMsg); + N_MessageBox::information(this,tr("消息"),errorMsg); return; } @@ -1035,7 +944,7 @@ void KbdBackPointPatch::findAndReplace(const QString &strFind, const QString &st model->setData(index,cell); } - QMessageBox::information(this,tr("消息"),tr("修改成功!")); + N_MessageBox::information(this,tr("消息"),tr("修改成功!")); } void KbdBackPointPatch::onLocationAndSubsystemChange() @@ -1107,20 +1016,13 @@ void KbdBackPointPatch::onPushButtonSearchClicked() m_modelFes->clear(); m_modelLimit->clear(); ui->lineEdit_search->setText(""); - ui->lineEdit_search_2->setText(""); - ui->lineEdit_search_3->setText(""); int pointType = ui->comboBox_pointType->currentData().toInt(); reloadTableData(m_tableBase, m_modelBase,BASEINDEX,pointType); reloadTableData(m_tableCtrl, m_modelCtrl,CTRLINDEX,pointType); reloadTableData(m_tableFes, m_modelFes,FESINDEX,pointType); reloadTableData(m_tableLimit, m_modelLimit,LIMITINDEX,pointType); - foreach(QString a,comboxBaseList) - { - ui->comboBox->addItem(a,Qt::DisplayRole); - ui->comboBox_3->addItem(a,Qt::DisplayRole); - ui->comboBox_2->addItem(a,Qt::DisplayRole); - } + } void KbdBackPointPatch::onSearchTextChanged(const QString &text) @@ -1137,48 +1039,17 @@ void KbdBackPointPatch::onSearchTextChanged(const QString &text) if(kbdModel == NULL) return; -// int tabIndex = m_tab->currentIndex(); -// //限值属性和控制属性没有描述 -// if(tabIndex != BASEINDEX && tabIndex != FESINDEX) -// return; -// const ColMgrDataList& kbdModelCols = kbdModel->getHeadCols(); -// int colDesc = kbdModelCols.findCol(CN_DESC); - int combox_index_1; - int combox_index_2; - int combox_index_3; - if(m_tab->currentIndex()==BASEINDEX) - { - combox_index_1=intBaseVec.at(ui->comboBox->currentIndex()); - combox_index_2=intBaseVec.at(ui->comboBox_2->currentIndex()); - combox_index_3=intBaseVec.at(ui->comboBox_3->currentIndex()); - } - else if(m_tab->currentIndex()==FESINDEX) - { - combox_index_1=intFesVec.at(ui->comboBox->currentIndex()); - combox_index_2=intFesVec.at(ui->comboBox_2->currentIndex()); - combox_index_3=intFesVec.at(ui->comboBox_3->currentIndex()); - } - else if(m_tab->currentIndex()==LIMITINDEX) - { - combox_index_1=intLimitVec.at(ui->comboBox->currentIndex()); - combox_index_2=intLimitVec.at(ui->comboBox_2->currentIndex()); - combox_index_3=intLimitVec.at(ui->comboBox_3->currentIndex()); - } - else if(m_tab->currentIndex()==CTRLINDEX) - { - combox_index_1=intCtrlVec.at(ui->comboBox->currentIndex()); - combox_index_2=intCtrlVec.at(ui->comboBox_2->currentIndex()); - combox_index_3=intCtrlVec.at(ui->comboBox_3->currentIndex()); - } + int tabIndex = m_tab->currentIndex(); + //限值属性和控制属性没有描述 + if(tabIndex != BASEINDEX && tabIndex != FESINDEX) + return; + const ColMgrDataList& kbdModelCols = kbdModel->getHeadCols(); + int colDesc = kbdModelCols.findCol(CN_DESC); int rowCount = model->rowCount(); for(int row = 0; row < rowCount; row++) { - if((!model->item(row,combox_index_1)->text().contains(ui->lineEdit_search->text()))|| - (!model->item(row,combox_index_2)->text().contains(ui->lineEdit_search_2->text()))|| - (!model->item(row,combox_index_3)->text().contains(ui->lineEdit_search_3->text()))) - { + if(!model->item(row,colDesc)->text().contains(text)) table->hideRow(row); - } else table->showRow(row); } @@ -1383,51 +1254,8 @@ void KbdBackPointPatch::onFindAndReplaceToSelect() } } -void KbdBackPointPatch::onTabChanged(int tabIndex) +void KbdBackPointPatch::onTabChanged() { ui->lineEdit_search->setText(""); - ui->lineEdit_search_2->setText(""); - ui->lineEdit_search_3->setText(""); - ui->comboBox->clear(); - ui->comboBox_2->clear(); - ui->comboBox_3->clear(); - if(tabIndex == BASEINDEX) - { - foreach(QString a,comboxBaseList) - { - ui->comboBox->addItem(a,Qt::DisplayRole); - ui->comboBox_3->addItem(a,Qt::DisplayRole); - ui->comboBox_2->addItem(a,Qt::DisplayRole); - } - } - else if(tabIndex == FESINDEX) - { - foreach(QString a,comboxFesList) - { - ui->comboBox->addItem(a,Qt::DisplayRole); - ui->comboBox_3->addItem(a,Qt::DisplayRole); - ui->comboBox_2->addItem(a,Qt::DisplayRole); - } - } - else if(tabIndex == LIMITINDEX) - { - foreach(QString a,comboxLimitList) - { - ui->comboBox->addItem(a,Qt::DisplayRole); - ui->comboBox_3->addItem(a,Qt::DisplayRole); - ui->comboBox_2->addItem(a,Qt::DisplayRole); - } - } - - else if(tabIndex == CTRLINDEX) - { - foreach(QString a,comboxCtrlList) - { - ui->comboBox->addItem(a,Qt::DisplayRole); - ui->comboBox_3->addItem(a,Qt::DisplayRole); - ui->comboBox_2->addItem(a,Qt::DisplayRole); - } - } - } diff --git a/platform/src/tools/model_studio/kbdbackpointpatch.h b/platform/src/tools/model_studio/kbdbackpointpatch.h index 562e4aa3..f413e0f9 100644 --- a/platform/src/tools/model_studio/kbdbackpointpatch.h +++ b/platform/src/tools/model_studio/kbdbackpointpatch.h @@ -1,8 +1,8 @@ #ifndef KBDBACKPOINTPATCH_H #define KBDBACKPOINTPATCH_H -#include #include +#include "pub_widget/CustomDialog.h" namespace Ui { class KbdBackPointPatch; @@ -16,7 +16,7 @@ class QMenu; /* * 批量修改后台测点对话框类 */ -class KbdBackPointPatch : public QDialog +class KbdBackPointPatch : public CustomUiDialog { Q_OBJECT @@ -54,7 +54,7 @@ private slots: void onIncrementToSelect(); void onSameValueToSelect(); void onFindAndReplaceToSelect(); - void onTabChanged(int index); + void onTabChanged(); private: Ui::KbdBackPointPatch *ui; QTabWidget *m_tab; @@ -80,14 +80,6 @@ private: //替换保存的值 QString m_strFind; QString m_strReplace; - QStringList comboxBaseList; - QStringList comboxFesList; - QStringList comboxLimitList; - QStringList comboxCtrlList; - QVector intBaseVec; - QVector intFesVec; - QVector intLimitVec; - QVector intCtrlVec; }; #endif // KBDBACKPOINTPATCH_H diff --git a/platform/src/tools/model_studio/kbdbackpointpatch.ui b/platform/src/tools/model_studio/kbdbackpointpatch.ui index 87c275dd..3a027196 100644 --- a/platform/src/tools/model_studio/kbdbackpointpatch.ui +++ b/platform/src/tools/model_studio/kbdbackpointpatch.ui @@ -6,8 +6,8 @@ 0 0 - 1101 - 642 + 1067 + 664 @@ -19,7 +19,7 @@ Dialog - + 0 @@ -32,22 +32,10 @@ 0 - + - - - 9 - - - 9 - - - 9 - - - 9 - - + + @@ -161,10 +149,14 @@ - + - + + + 描述包含字符: + + @@ -183,48 +175,20 @@ - - - - - + + + Qt::Horizontal + + - 200 - 0 + 40 + 20 - - - 100 - 16777215 - - - - - - - - - - - - 200 - 0 - - - - - 100 - 16777215 - - - + - - - diff --git a/platform/src/tools/model_studio/kbdconfigcheck.cpp b/platform/src/tools/model_studio/kbdconfigcheck.cpp index 222d0ca5..bffeba6b 100644 --- a/platform/src/tools/model_studio/kbdconfigcheck.cpp +++ b/platform/src/tools/model_studio/kbdconfigcheck.cpp @@ -15,13 +15,9 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" #include - -#define VALUE_USERG_HMI "0" -#define VALUE_USERG_REPORT "1" - kbdConfigCheck::kbdConfigCheck(QObject *parent) : QObject(parent) { initMap(); @@ -42,7 +38,7 @@ void kbdConfigCheck::initMap() m_mapCheckRules.insert("FUNC_CHECK_LINk",FUNC_CHECK_LINk); m_mapCheckRules.insert("FUNC_CHECK_LOCK_PARAM_IS_CONTROL",FUNC_CHECK_LOCK_PARAM_IS_CONTROL); m_mapCheckRules.insert("FUNC_CHECK_POINT_IS_EXIST",FUNC_CHECK_POINT_IS_EXIST); - m_mapCheckRules.insert("FUNC_CHECK_ACCESS",FUNC_CHECK_ACCESS); + m_mapCorrectRules.insert("FUNC_NULL",FUNC_NULL); m_mapCorrectRules.insert("FUNC_DELETE",FUNC_DELETE); } @@ -78,6 +74,7 @@ void kbdConfigCheck::initCheckItem() auto iterCheckRule = m_mapCheckRules.find(attrs.value("checkRule").toString()); stCheckItem.en_CheckRule = iterCheckRule == m_mapCheckRules.end()?FUNC_CHECK_NULL:iterCheckRule.value(); + auto iterCrtRule = m_mapCorrectRules.find(attrs.value("repairRule").toString()); stCheckItem.en_CorrectRule = iterCrtRule == m_mapCorrectRules.end()?FUNC_NULL:iterCrtRule.value(); if(stCheckItem.en_CorrectRule == FUNC_NULL) @@ -96,7 +93,6 @@ void kbdConfigCheck::initCheckItem() if(xml.name().toString() == "type") { m_listCheckType.append(stCheckType); - stCheckType.clear(); } if(xml.name().toString() == "checkitem") @@ -161,10 +157,7 @@ void kbdConfigCheck::executeCheck(ST_CfgCheckType *pCheckData) { item.listCheckError << checkPointIsExist(item.listParam); } - else if(item.en_CheckRule == FUNC_CHECK_ACCESS) - { - item.listCheckError << checkAccess(item.listParam); - } + if(item.listCheckError.size() > 0) pCheckData->bHasError = true; } @@ -760,448 +753,6 @@ QList kbdConfigCheck::checkPointIsExist(QStringList listParam) return listError; } -QList kbdConfigCheck::checkAccess(QStringList listParam) -{ - QList listError; - QList listCurrentError; - listCurrentError=refreshLocation(); - for(int i=0;i kbdConfigCheck::refreshLocation() -{ - QList listError; - KbdTableModel *modelUserG = KbdTableDataMgr::getInstance()->createModel(TBL_RM_USERG_DEF); - if(modelUserG == NULL) - return listError; - - KbdDbDesign ds; - QList allDescItems = ds.getSqlItems("SELECT * FROM SYS_MODEL_LOCATION_INFO;",CN_DESC,CN_LOCATION_ID); - //获取已选 - QStringList rowDatas = modelUserG->getRowData(0); - const ColMgrDataList& modelUserGCols = modelUserG->getHeadCols(); - QList IDs = ds.testBit(QList() - < selectItems;//所有选中的Item - QList allNameItems = ds.getSqlItems("SELECT * FROM SYS_MODEL_LOCATION_INFO;",CN_TAG_NAME,CN_LOCATION_ID); - for(int i = 0; i < allDescItems.size(); i++) - { - if(IDs.contains(allDescItems.at(i)->data(Qt::UserRole).toInt())) - selectItems << allDescItems.at(i); - else - { - ST_CfgCheckError err; - for(int j=0;jdata(Qt::UserRole).toInt()==allDescItems.at(i)->data(Qt::UserRole).toInt()) - { - err.strTagName = allNameItems.at(j)->text(); - } - } - err.strDes = allDescItems.at(i)->text(); - err.strError = QString(tr("用户组所属位置 %1 未配置")).arg(allDescItems.at(i)->text()); - listError << err; - } - } - - - return listError; -} - -QList kbdConfigCheck::refreshRoleSpclLocation() -{ - QList listError; - KbdTableModel *modelUserG = KbdTableDataMgr::getInstance()->createModel(TBL_RM_USERG_DEF); - if(modelUserG == NULL) - return listError; - const ColMgrDataList& modelUserGCols = modelUserG->getHeadCols(); - QString usergroupId = "1"; - QString filter = QString("%1='%2'").arg(CN_PERM_USER_GROUP).arg(usergroupId); - KbdTableModel *modelRspInfo = KbdTableDataMgr::getInstance()->createModel(Common::createViewName(TBL_RM_USERG_RSP_INFO,filter)); - if(modelRspInfo == NULL) - return listError; - modelRspInfo->load(true); - - KbdDbDesign ds; - KbdDbDesign ds1; - QStringList rspInfoDatas; - QString roleId; - QString spclId; - QMap filterMap; - //三级树形结构,角色-特殊功能-位置 - QList allNameItems = ds1.getSqlItems("SELECT * FROM SYS_MODEL_LOCATION_INFO;",CN_TAG_NAME,CN_LOCATION_ID); - const ColMgrDataList& modelRspInfoCols = modelRspInfo->getHeadCols(); - QList roleList = getSelectRole(); - for(int i = 0; i < roleList.size(); i++) - { - roleId = roleList.at(i)->data(0,Qt::UserRole).toString(); - QList spclList = getSelectRoleSpclFunc(roleId); - roleList.at(i)->addChildren(spclList); - for(int j = 0; j < spclList.size();j++) - { - QList locationList = getSelectLocation(); - spclId = spclList.at(j)->data(0,Qt::UserRole).toString(); - filterMap.clear(); - filterMap.insert(CN_PERM_ROLE,roleId); - filterMap.insert(CN_PERM_SPEFUNC,spclId); - rspInfoDatas = ds.getFilterDatas(modelRspInfo,filterMap); - if(rspInfoDatas.isEmpty()) - { - foreach (QTreeWidgetItem *treeLocation, locationList) { - treeLocation->setCheckState(0,Qt::Unchecked); - } - } - else - { - QList IDs = ds.testBit(QList() - <data(0,Qt::UserRole).toInt())) - treeLocation->setCheckState(0,Qt::Checked); - else - { - ST_CfgCheckError err; - for(int j=0;jdata(Qt::UserRole).toInt()==treeLocation->data(0,Qt::UserRole).toInt()) - { - - err.strTagName = allNameItems.at(j)->text(); - } - } - err.strDes=treeLocation->text(0); - err.strError = QString(tr("特殊功能 %1的子节点%2 未配置")).arg(spclList.at(j)->text(0)).arg(treeLocation->text(0)); - listError<setCheckState(0,Qt::Unchecked); - } - } - } - - // spclList.at(j)->addChildren(locationList); - - } - } - return listError; -} - -QList kbdConfigCheck::refreshHmi() -{ - QList listError; - KbdTableModel *modelUserG = KbdTableDataMgr::getInstance()->createModel(TBL_RM_USERG_DEF); - if(modelUserG == NULL) - return listError; - - const ColMgrDataList& modelUserGCols = modelUserG->getHeadCols(); - QString usrgId ="1"; - QString filter = QString("%1='%2' AND %3='%4' AND %5='%6'").arg(CN_PERM_USER_GROUP).arg(usrgId) - .arg(CN_PERM_TYPE).arg(VALUE_USERG_HMI).arg(CN_PERM_ATTRIBUTE).arg("1"); - KbdTableModel *modelUsergHmiInfo = KbdTableDataMgr::getInstance()->createModel( - Common::createViewName(TBL_RM_USERG_HMI_INFO,filter)); - if(modelUsergHmiInfo == NULL) - return listError; - - KbdDbDesign ds; - QList allItems = ds.getSqlItems("SELECT * FROM HMI_TYPE_INFO;",CN_HMI_NAME,CN_HMI_ID); - - //获取已选画面 - modelUsergHmiInfo->load(true); - - QList< int> IDs; - if(modelUsergHmiInfo->rowCount() == 0) - { - IDs.clear(); - } - else if(modelUsergHmiInfo->rowCount() == 1) - { - QStringList usergHmiInfoRowDatas = modelUsergHmiInfo->getRowData(0); - const ColMgrDataList& modelUsergHmiInfoCols = modelUsergHmiInfo->getHeadCols(); - IDs = ds.testBit(QList< int>() - < allDescItems = ds.getSqlItems("SELECT * FROM HMI_TYPE_INFO;","HMI_DESC",CN_HMI_ID); - QList selectItems;//所有选中的Item - QList unselectItems;//所有未选中的Item - for(int i = 0; i < allItems.size(); i++) - { - if(IDs.contains(allItems.at(i)->data(Qt::UserRole).toInt())) - {//selectItems << allItems.at(i); - } - else - { ST_CfgCheckError err; - - for(int j=0;jdata(Qt::UserRole).toInt()==allDescItems.at(j)->data(Qt::UserRole).toInt()) - { - err.strDes=allDescItems.at(j)->text(); - } - } - err.strTagName = allItems.at(i)->text(); - err.strError= QString(tr("画面权限 %1未配置")).arg(allItems.at(i)->text()); - listError< kbdConfigCheck::refreshReport() -{ - QList listError; - KbdTableModel *modelUserG = KbdTableDataMgr::getInstance()->createModel(TBL_RM_USERG_DEF); - if(modelUserG == NULL) - return listError; - const ColMgrDataList& modelUserGCols = modelUserG->getHeadCols(); - QString usrgId = "1"; - QString filter = QString("%1='%2' AND %3='%4' AND %5='%6'").arg(CN_PERM_USER_GROUP).arg(usrgId) - .arg(CN_PERM_TYPE).arg(VALUE_USERG_REPORT).arg(CN_PERM_ATTRIBUTE).arg("1"); - KbdTableModel *modelUsergHmiInfo = KbdTableDataMgr::getInstance()->createModel( - Common::createViewName(TBL_RM_USERG_HMI_INFO,filter)); - if(modelUsergHmiInfo == NULL) - return listError; - - KbdDbDesign ds; - QList allItems = ds.getSqlItems("SELECT * FROM REPORT_TYPE_INFO;",CN_REPORT_NAME,CN_REPORT_ID); - - //获取已选画面 - modelUsergHmiInfo->load(true); - - QList< int> IDs; - if(modelUsergHmiInfo->rowCount() == 0) - { - IDs.clear(); - } - else if(modelUsergHmiInfo->rowCount() == 1) - { - QStringList usergHmiInfoRowDatas = modelUsergHmiInfo->getRowData(0); - const ColMgrDataList& modelUsergHmiInfoCols = modelUsergHmiInfo->getHeadCols(); - IDs = ds.testBit(QList< int>() - < allDescItems = ds.getSqlItems("SELECT * FROM REPORT_TYPE_INFO;",CN_REPORT_DESC,CN_REPORT_ID); - QList selectItems;//所有选中的Item - QList unselectItems;//所有未选中的Item - for(int i = 0; i < allItems.size(); i++) - { - if(IDs.contains(allItems.at(i)->data(Qt::UserRole).toInt())) - { - } - else - { - ST_CfgCheckError err; - for(int j=0;jdata(Qt::UserRole).toInt()==allDescItems.at(j)->data(Qt::UserRole).toInt()) - { - err.strDes=allDescItems.at(j)->text(); - } - } - err.strTagName = allItems.at(i)->text(); - err.strError= QString(tr("报表浏览%1未配置")).arg(allItems.at(i)->text()); - listError< kbdConfigCheck::getSelectRole() -{ - QList temp; - KbdTableModel *modelUserG = KbdTableDataMgr::getInstance()->createModel(TBL_RM_USERG_DEF); - if(modelUserG == NULL) - return temp; - - KbdDbDesign ds; - QList allItems = ds.getSqlItems("SELECT * FROM RM_ROLE_DEF;",CN_PERM_NAME,CN_PERM_ID); - - //获取已选 - QStringList rowDatas = modelUserG->getRowData(0); - const ColMgrDataList& modelUserGCols = modelUserG->getHeadCols(); - QList IDs = ds.testBit(QList() - <data(Qt::UserRole).toInt())) - { - QTreeWidgetItem *treeItem = new QTreeWidgetItem(QStringList()<text()); - treeItem->setData(0,Qt::UserRole,allItems.at(i)->data(Qt::UserRole)); - - temp << treeItem; - } - - } - - qDeleteAll(allItems); - - return temp; -} - -QList kbdConfigCheck::getSelectLocation() -{ - QList temp; - KbdTableModel *modelUserG = KbdTableDataMgr::getInstance()->createModel(TBL_RM_USERG_DEF); - if(modelUserG == NULL) - return temp; - - KbdDbDesign ds; - QList allItems = ds.getSqlItems("SELECT * FROM SYS_MODEL_LOCATION_INFO;",CN_DESC,CN_LOCATION_ID); - - //获取已选 - QStringList rowDatas = modelUserG->getRowData(0); - const ColMgrDataList& modelUserGCols = modelUserG->getHeadCols(); - QList IDs = ds.testBit(QList() - <data(Qt::UserRole).toInt())) - { - QTreeWidgetItem *treeItem = new QTreeWidgetItem(QStringList()<text()); - treeItem->setData(0,Qt::UserRole,allItems.at(i)->data(Qt::UserRole)); - - temp << treeItem; - } - } - - qDeleteAll(allItems); - - return temp; -} - -QList kbdConfigCheck::getSelectRoleSpclFunc(const QString &roleId) -{ - QList temp; - - QString filter = QString("%1='%2'").arg(CN_PERM_ID).arg(roleId); - KbdTableModel *modelRole = KbdTableDataMgr::getInstance()->createModel(Common::createViewName(TBL_RM_ROLE_DEF,filter)); - if(modelRole == NULL) - return temp; - modelRole->load(true); - if(modelRole->rowCount() != 1) - return temp; - - QStringList roleDatas = modelRole->getRowData(0); - - KbdDbDesign ds; - QList allItems; - allItems = ds.getSqlItems("SELECT * FROM RM_SPCL_FUNC_DEF;",CN_PERM_NAME,CN_PERM_ID); - const ColMgrDataList& modelRoleCols = modelRole->getHeadCols(); - QList IDs = ds.testBit(QList() - <data(Qt::UserRole).toInt())) - { - QTreeWidgetItem *treeItem = new QTreeWidgetItem(QStringList()<text()); - treeItem->setData(0,Qt::UserRole,allItems.at(i)->data(Qt::UserRole)); - - temp << treeItem; - } - } - - qDeleteAll(allItems); - - return temp; -} - void kbdConfigCheck::deleteTableData(ST_CfgCheckItem* pCheckItem) { QString tableName = pCheckItem->listParam.at(0); @@ -1221,7 +772,7 @@ void kbdConfigCheck::deleteTableData(ST_CfgCheckItem* pCheckItem) -kbdConfigCheckDlg::kbdConfigCheckDlg(QWidget* parent):QDialog(parent) +kbdConfigCheckDlg::kbdConfigCheckDlg(QWidget* parent):CustomDialog(parent) { m_pCheckModel = nullptr; initLayout(); @@ -1501,7 +1052,7 @@ void kbdConfigCheckDlg::onCheckStatusChange() void kbdConfigCheckDlg::onMsg(QString msg) { - QMessageBox::information(this,tr("消息"),msg); + N_MessageBox::information(this,tr("消息"),msg); } void kbdConfigCheckDlg::onItemButtonClick() @@ -1581,7 +1132,7 @@ ST_CfgCheckType* checkListItem::getCheckData() -kbdErrorListDlg::kbdErrorListDlg(ST_CfgCheckItem* pData,QWidget* parent) : QDialog(parent) +kbdErrorListDlg::kbdErrorListDlg(ST_CfgCheckItem* pData,QWidget* parent) : CustomDialog(parent) { m_pCheckData = pData; initLayout(); diff --git a/platform/src/tools/model_studio/kbdconfigcheck.h b/platform/src/tools/model_studio/kbdconfigcheck.h index 8a28837b..937d8768 100644 --- a/platform/src/tools/model_studio/kbdconfigcheck.h +++ b/platform/src/tools/model_studio/kbdconfigcheck.h @@ -3,8 +3,9 @@ #include #include -#include #include +#include "pub_widget/CustomDialog.h" + class QStackedWidget; class QPushButton; class QLabel; @@ -14,7 +15,6 @@ class QTreeWidget; class QListWidget; class QCheckBox; class treeCheckWidget; -class QTreeWidgetItem; enum EN_CheckRule { @@ -29,8 +29,7 @@ enum EN_CheckRule FUNC_CHECK_DEV_POINT_LINK_FES, FUNC_CHECK_LINk, FUNC_CHECK_LOCK_PARAM_IS_CONTROL, - FUNC_CHECK_POINT_IS_EXIST, - FUNC_CHECK_ACCESS + FUNC_CHECK_POINT_IS_EXIST }; enum EN_CorrectRule @@ -120,14 +119,6 @@ private: QList checkLockParamControl(QStringList listParam); QList checkDevPointLinkFes(QStringList listParam); QList checkPointIsExist(QStringList listParam); - QList checkAccess(QStringList listParam); - QList refreshLocation(); - QList refreshRoleSpclLocation(); - QList refreshHmi(); - QList refreshReport(); - QList getSelectRole(); - QList getSelectLocation(); - QList getSelectRoleSpclFunc(const QString &roleId); private: void deleteTableData(ST_CfgCheckItem *pCheckItem); @@ -144,7 +135,7 @@ private: }; -class kbdConfigCheckDlg : public QDialog +class kbdConfigCheckDlg : public CustomDialog { Q_OBJECT public: @@ -210,7 +201,7 @@ public: -class kbdErrorListDlg : public QDialog +class kbdErrorListDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_studio/kbdfespointdlg.cpp b/platform/src/tools/model_studio/kbdfespointdlg.cpp index 734699e8..b80929e2 100644 --- a/platform/src/tools/model_studio/kbdfespointdlg.cpp +++ b/platform/src/tools/model_studio/kbdfespointdlg.cpp @@ -9,7 +9,7 @@ #include #include -KbdFesPointDlg::KbdFesPointDlg(QWidget *parent) : QDialog(parent) +KbdFesPointDlg::KbdFesPointDlg(QWidget *parent) : CustomDialog(parent) { setWindowTitle(tr("前置测点检索器")); initLayout(); diff --git a/platform/src/tools/model_studio/kbdfespointdlg.h b/platform/src/tools/model_studio/kbdfespointdlg.h index 3a148253..0d2accca 100644 --- a/platform/src/tools/model_studio/kbdfespointdlg.h +++ b/platform/src/tools/model_studio/kbdfespointdlg.h @@ -1,13 +1,14 @@ #ifndef KBDFESPOINTDLG_H #define KBDFESPOINTDLG_H -#include #include +#include "pub_widget/CustomDialog.h" + class QComboBox; class QLineEdit; class MyFesPointListWidget; -class KbdFesPointDlg : public QDialog +class KbdFesPointDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_studio/kbdfespointpatch.cpp b/platform/src/tools/model_studio/kbdfespointpatch.cpp index 45d119cc..4ec32411 100644 --- a/platform/src/tools/model_studio/kbdfespointpatch.cpp +++ b/platform/src/tools/model_studio/kbdfespointpatch.cpp @@ -6,7 +6,7 @@ #include #include "worker.h" #include "kbdwaitprgdlg.h" -#include +#include "pub_widget/MessageBox.h" #include "kbdinputdlg.h" #include "kbdreplacedlg.h" #include @@ -24,7 +24,7 @@ enum pointTypeIndex }; KbdFesPointPatch::KbdFesPointPatch(QWidget *parent) : - QDialog(parent), + CustomUiDialog(parent), ui(new Ui::KbdFesPointPatch) { ui->setupUi(this); @@ -34,6 +34,8 @@ KbdFesPointPatch::KbdFesPointPatch(QWidget *parent) : initPointType(); initConnect(); initMenu(); + + CustomUiDialog::setAutoLayout(true); } KbdFesPointPatch::~KbdFesPointPatch() @@ -75,8 +77,6 @@ void KbdFesPointPatch::initConnect() connect(ui->comboBox_subSystem,SIGNAL(currentIndexChanged(int)),this,SLOT(onLocationAndSubsystemChange())); connect(ui->comboBox_rtu,SIGNAL(currentIndexChanged(int)),this,SLOT(onRtuChanged())); connect(ui->lineEdit_search,SIGNAL(textChanged(const QString &)),this,SLOT(onSearchTextChanged(const QString &))); - connect(ui->lineEdit_search_2,SIGNAL(textChanged(const QString &)),this,SLOT(onSearchTextChanged(const QString &))); - connect(ui->lineEdit_search_3,SIGNAL(textChanged(const QString &)),this,SLOT(onSearchTextChanged(const QString &))); } void KbdFesPointPatch::initPointType() @@ -173,13 +173,7 @@ void KbdFesPointPatch::reloadTableData(QTableView *table, QStandardItemModel *mo for(int i = 0; i < model->columnCount(); i++) { if(showCols.contains(i)) - { - ui->comboBox->addItem(model->headerData(i,Qt::Horizontal).toString(),Qt::DisplayRole); - ui->comboBox_2->addItem(model->headerData(i,Qt::Horizontal).toString(),Qt::DisplayRole); - ui->comboBox_3->addItem(model->headerData(i,Qt::Horizontal).toString(),Qt::DisplayRole); - intVec.push_back(i); table->showColumn(i); - } else table->hideColumn(i); } @@ -293,7 +287,7 @@ void KbdFesPointPatch::increment(const QString &textFormat, int startNum, const if(!textFormat.contains("%1")) { - QMessageBox::information(this,tr("消息"),tr("%1\n文本格式不对")); + N_MessageBox::information(this,tr("消息"),tr("%1\n文本格式不对")); return; } const ColMgrDataList& kbdModelCols = kbdModel->getHeadCols(); @@ -303,19 +297,19 @@ void KbdFesPointPatch::increment(const QString &textFormat, int startNum, const { if(textFormat != "%1") { - QMessageBox::information(this,tr("消息"),tr("%1\n文本格式不对").arg(textFormat)); + N_MessageBox::information(this,tr("消息"),tr("%1\n文本格式不对").arg(textFormat)); return; } } if(!kbdModelCols.at(indexList.first().column()).editable) { - QMessageBox::information(this,tr("消息"),tr("该列不可编辑")); + N_MessageBox::information(this,tr("消息"),tr("该列不可编辑")); return; } if(kbdModelCols.at(indexList.first().column()).isPrimaryKey) { - QMessageBox::information(this,tr("消息"),tr("该列是主键,不可编辑")); + N_MessageBox::information(this,tr("消息"),tr("该列是主键,不可编辑")); return; } @@ -349,7 +343,7 @@ void KbdFesPointPatch::increment(const QString &textFormat, int startNum, const MS_LOG_DEBUG(tr("自增菜单结束")); if(!errorMsg.isEmpty()) { - QMessageBox::information(this,tr("消息"),errorMsg); + N_MessageBox::information(this,tr("消息"),errorMsg); return; } @@ -370,7 +364,7 @@ void KbdFesPointPatch::increment(const QString &textFormat, int startNum, const } } - QMessageBox::information(this,tr("消息"),tr("修改成功!")); + N_MessageBox::information(this,tr("消息"),tr("修改成功!")); } void KbdFesPointPatch::sameValue(const QString &textFormat, const QModelIndexList &indexList) @@ -397,12 +391,12 @@ void KbdFesPointPatch::sameValue(const QString &textFormat, const QModelIndexLis const ColMgrDataList& kbdModelCols = kbdModel->getHeadCols(); if(!kbdModelCols.at(indexList.first().column()).editable) { - QMessageBox::information(this,tr("消息"),tr("该列不可编辑")); + N_MessageBox::information(this,tr("消息"),tr("该列不可编辑")); return; } if(kbdModelCols.at(indexList.first().column()).isPrimaryKey) { - QMessageBox::information(this,tr("消息"),tr("该列是主键,不可编辑")); + N_MessageBox::information(this,tr("消息"),tr("该列是主键,不可编辑")); return; } @@ -433,7 +427,7 @@ void KbdFesPointPatch::sameValue(const QString &textFormat, const QModelIndexLis MS_LOG_DEBUG(tr("取相同值菜单结束")); if(!errorMsg.isEmpty()) { - QMessageBox::information(this,tr("消息"),errorMsg); + N_MessageBox::information(this,tr("消息"),errorMsg); return; } @@ -452,7 +446,7 @@ void KbdFesPointPatch::sameValue(const QString &textFormat, const QModelIndexLis } } - QMessageBox::information(this,tr("消息"),tr("修改成功!")); + N_MessageBox::information(this,tr("消息"),tr("修改成功!")); } void KbdFesPointPatch::findAndReplace(const QString &strFind, const QString &strReplace, const QModelIndexList &indexList) @@ -478,12 +472,12 @@ void KbdFesPointPatch::findAndReplace(const QString &strFind, const QString &str const ColMgrDataList& kbdModelCols = kbdModel->getHeadCols(); if(!kbdModelCols.at(indexList.first().column()).editable) { - QMessageBox::information(this,tr("消息"),tr("该列不可编辑")); + N_MessageBox::information(this,tr("消息"),tr("该列不可编辑")); return; } if(kbdModelCols.at(indexList.first().column()).isPrimaryKey) { - QMessageBox::information(this,tr("消息"),tr("该列是主键,不可编辑")); + N_MessageBox::information(this,tr("消息"),tr("该列是主键,不可编辑")); return; } @@ -517,7 +511,7 @@ void KbdFesPointPatch::findAndReplace(const QString &strFind, const QString &str MS_LOG_DEBUG(tr("查找与替换菜单结束")); if(!errorMsg.isEmpty()) { - QMessageBox::information(this,tr("消息"),errorMsg); + N_MessageBox::information(this,tr("消息"),errorMsg); return; } @@ -528,7 +522,7 @@ void KbdFesPointPatch::findAndReplace(const QString &strFind, const QString &str model->setData(index,cell); } - QMessageBox::information(this,tr("消息"),tr("修改成功!")); + N_MessageBox::information(this,tr("消息"),tr("修改成功!")); } @@ -604,8 +598,6 @@ void KbdFesPointPatch::onPushButtonSearchClicked() { m_model->clear(); ui->lineEdit_search->setText(""); - ui->lineEdit_search_2->setText(""); - ui->lineEdit_search_3->setText(""); int pointType = ui->comboBox_pointType->currentData().toInt(); reloadTableData(ui->tableView, m_model,pointType); @@ -616,23 +608,13 @@ void KbdFesPointPatch::onSearchTextChanged(const QString &text) KbdTableModel *kbdModel = getCurrentKbdModel(ui->comboBox_pointType->currentData().toInt()); if(kbdModel == NULL) return; - int combox_index_1; - int combox_index_2; - int combox_index_3; - combox_index_1=intVec.at(ui->comboBox->currentIndex()); - combox_index_2=intVec.at(ui->comboBox_2->currentIndex()); - combox_index_3=intVec.at(ui->comboBox_3->currentIndex()); - // const ColMgrDataList& kbdModelCols = kbdModel->getHeadCols(); - // int colDesc = kbdModelCols.findCol(CN_DESC); + const ColMgrDataList& kbdModelCols = kbdModel->getHeadCols(); + int colDesc = kbdModelCols.findCol(CN_DESC); int rowCount = m_model->rowCount(); for(int row = 0; row < rowCount; row++) { - if((!m_model->item(row,combox_index_1)->text().contains(ui->lineEdit_search->text()))|| - (!m_model->item(row,combox_index_2)->text().contains(ui->lineEdit_search_2->text()))|| - (!m_model->item(row,combox_index_3)->text().contains(ui->lineEdit_search_3->text()))) - { + if(!m_model->item(row,colDesc)->text().contains(text)) ui->tableView->hideRow(row); - } else ui->tableView->showRow(row); } diff --git a/platform/src/tools/model_studio/kbdfespointpatch.h b/platform/src/tools/model_studio/kbdfespointpatch.h index b759fa1f..128dc3a1 100644 --- a/platform/src/tools/model_studio/kbdfespointpatch.h +++ b/platform/src/tools/model_studio/kbdfespointpatch.h @@ -1,8 +1,8 @@ #ifndef KBDFESPOINTPATCH_H #define KBDFESPOINTPATCH_H -#include #include +#include "pub_widget/CustomDialog.h" namespace Ui { class KbdFesPointPatch; @@ -15,7 +15,7 @@ class QTableView; /* * 批量修改前置测点对话框类 */ -class KbdFesPointPatch : public QDialog +class KbdFesPointPatch : public CustomUiDialog { Q_OBJECT @@ -60,9 +60,6 @@ private: //相同值保存的值 QString m_sameText; - - QStringList comboxList; - QVector intVec; }; #endif // KBDFESPOINTPATCH_H diff --git a/platform/src/tools/model_studio/kbdfespointpatch.ui b/platform/src/tools/model_studio/kbdfespointpatch.ui index b45e42bc..3a3a8193 100644 --- a/platform/src/tools/model_studio/kbdfespointpatch.ui +++ b/platform/src/tools/model_studio/kbdfespointpatch.ui @@ -34,8 +34,48 @@ - - + + + + + + + 描述包含字符: + + + + + + + + 200 + 0 + + + + + 100 + 16777215 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + @@ -139,68 +179,7 @@ - - - - - - - - - - 200 - 0 - - - - - 100 - 16777215 - - - - - - - - - - - - 200 - 0 - - - - - 100 - 16777215 - - - - - - - - - - - - 200 - 0 - - - - - 100 - 16777215 - - - - - - - + diff --git a/platform/src/tools/model_studio/loginDialog/logindlg.cpp b/platform/src/tools/model_studio/loginDialog/logindlg.cpp index 3ef5e4c2..1df192ed 100644 --- a/platform/src/tools/model_studio/loginDialog/logindlg.cpp +++ b/platform/src/tools/model_studio/loginDialog/logindlg.cpp @@ -5,7 +5,7 @@ #include #include #include "kbdtabledatamgr.h" -#include +#include "pub_widget/MessageBox.h" #include #include #include @@ -18,7 +18,7 @@ #include "boost/thread.hpp" #include "pub_utility_api/FileUtil.h" -LoginDlg::LoginDlg(QWidget *parent) : QDialog(parent) +LoginDlg::LoginDlg(QWidget *parent) : CustomDialog(parent) { setWindowTitle(tr("登录")); initLayout(); @@ -37,7 +37,7 @@ void LoginDlg::initLayout() QSettings settings(Common::getModelConfigPath() + "/ModelConfig.ini",QSettings::IniFormat); m_leUser = new QLineEdit(settings.value("MySQL/login/user","root").toString(),this); - m_lePasswd = new QLineEdit(settings.value("MySQL/login/psw","kbdct@0755").toString(),this); + m_lePasswd = new QLineEdit(settings.value("MySQL/login/psw",EMS_DEFAULT_PASSWD).toString(),this); m_lePasswd->setEchoMode(QLineEdit::Password); m_leIp = new QLineEdit(settings.value("MySQL/login/ip","127.0.0.1").toString(),this); m_lePort = new QLineEdit(settings.value("MySQL/login/port","3306").toString(),this); @@ -49,7 +49,7 @@ void LoginDlg::initLayout() m_comboxDbType->addItem(tr("KingBase"),iot_dbms::EDbType::DB_KINGBASE); connect(m_comboxDbType,&QComboBox::currentTextChanged,this,&LoginDlg::onDbTypeChange); - m_leDbName = new QLineEdit(settings.value("MySQL/login/dbname","iscs6000").toString(),this); + m_leDbName = new QLineEdit(settings.value("MySQL/login/dbname",EMS_DEFAULT_DATABASE).toString(),this); m_comboxDbType->setCurrentText(settings.value("login/dbtype","MySQL").toString()); m_btLoad = new QPushButton(tr("登录"),this); @@ -173,9 +173,9 @@ void LoginDlg::onDbTypeChange(const QString &text) m_leUser->setText(user); m_lePort->setText(port); - m_lePasswd->setText(settings.value(text + "/login/psw","kbdct@0755").toString()); + m_lePasswd->setText(settings.value(text + "/login/psw",EMS_DEFAULT_PASSWD).toString()); m_leIp->setText(settings.value(text + "/login/ip","127.0.0.1").toString()); - m_leDbName->setText(settings.value(text + "/login/dbname","iscs6000").toString()); + m_leDbName->setText(settings.value(text + "/login/dbname",EMS_DEFAULT_DATABASE).toString()); } void LoginDlg::onLoad() @@ -217,7 +217,7 @@ void LoginDlg::onLoad() { KbdTableDataMgr::getInstance()->onSysQuit(); proc.close(); - QMessageBox::information(this,tr("登录失败"),tr("失败原因:\n")+err); + N_MessageBox::information(this,tr("登录失败"),tr("失败原因:\n")+err); } QSettings settings(Common::getModelConfigPath() + "/ModelConfig.ini",QSettings::IniFormat); @@ -357,7 +357,7 @@ void CModelStudiologin::onChangeToCenterLink() else { KbdTableDataMgr::getInstance()->onSysQuit(); - QMessageBox::information(nullptr,tr("登录失败"),tr("失败原因:\n")+err); + N_MessageBox::information(nullptr,tr("登录失败"),tr("失败原因:\n")+err); } } } diff --git a/platform/src/tools/model_studio/loginDialog/logindlg.h b/platform/src/tools/model_studio/loginDialog/logindlg.h index 2818122d..fb2d786f 100644 --- a/platform/src/tools/model_studio/loginDialog/logindlg.h +++ b/platform/src/tools/model_studio/loginDialog/logindlg.h @@ -5,15 +5,15 @@ #pragma execution_character_set("utf-8") #endif -#include #include "sys_login_api/CLoginDlg.h" +#include "pub_widget/CustomDialog.h" class QLabel; class QLineEdit; class QPushButton; class QComboBox; -class LoginDlg : public QDialog +class LoginDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_studio/main.cpp b/platform/src/tools/model_studio/main.cpp index f1c67420..74db8ef4 100644 --- a/platform/src/tools/model_studio/main.cpp +++ b/platform/src/tools/model_studio/main.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" #include "common/QtAppGlobalSet.h" #include "pub_logger_api/logger.h" @@ -14,6 +14,8 @@ #include "loginDialog/logindlg.h" #include "kbdtabledatamgr.h" #include "mainwindow.h" +#include "pub_utility_api/FileStyle.h" +#include "pub_widget/PubWidgetInit.h" #ifdef CODEC_EXECUTE #pragma execution_character_set("utf-8") @@ -25,12 +27,39 @@ int main(int argc, char *argv[]) QApplication::addLibraryPath("./sqldrivers"); SingleApplication a(argc, argv); - QCoreApplication::setOrganizationName("KbdSoft.ZHJK"); - QCoreApplication::setOrganizationDomain("KbdTech.com"); + QCoreApplication::setOrganizationName("IOT"); + QCoreApplication::setOrganizationDomain("iot.com"); // QCoreApplication::setApplicationName(QObject::tr("设备建模")); - qApp->setStyleSheet(Common::getStyleSheetPath("modelStudio.qss")); - qApp->setFont(QFont("Microsoft YaHei",10)); +// qApp->setStyleSheet(Common::getStyleSheetPath("modelStudio.qss")); + + + QString qss = QString(); + std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss","zh","light"); + + QFile qssfile1(QString::fromStdString(strFullPath)); + qssfile1.open(QFile::ReadOnly); + if (qssfile1.isOpen()) + { + qss += QLatin1String(qssfile1.readAll()); + qssfile1.close(); + } + + strFullPath = iot_public::CFileStyle::getPathOfStyleFile("modelStudio.qss","zh","light"); + QFile qssfile2(QString::fromStdString(strFullPath)); + qssfile2.open(QFile::ReadOnly); + if (qssfile2.isOpen()) + { + qss += QLatin1String(qssfile2.readAll()); + qssfile2.close(); + } + + if (!qss.isEmpty()) + { + qApp->setStyleSheet(qss); + } + +// qApp->setFont(QFont("Microsoft YaHei",10)); a.setWindowIcon(QIcon(":/icons/icons/studio.ico")); @@ -42,7 +71,7 @@ int main(int argc, char *argv[]) } catch (std::exception& e) { - QMessageBox::information(NULL,QObject::tr("消息"),QObject::tr("启动日志服务失败:")+QString(e.what())); + N_MessageBox::information(NULL,QObject::tr("消息"),QObject::tr("启动日志服务失败:")+QString(e.what())); return 0; } @@ -55,9 +84,16 @@ int main(int argc, char *argv[]) qtTranslator->load(Common::getTranslatePath("model_studio_EN.qm")); a.installTranslator(qtTranslator); + qtTranslator = new QTranslator; + qtTranslator->load(Common::getTranslatePath("model_plugin_EN.qm")); + a.installTranslator(qtTranslator); + qtTranslator = new QTranslator; qtTranslator->load(Common::getTranslatePath("qt_zh_CN.qm")); a.installTranslator(qtTranslator); + + iot_public::installTranslator(Common::getLanguage().toStdString()); + //登录 CModelStudiologin lg; int ret = 0; diff --git a/platform/src/tools/model_studio/mainwindow.cpp b/platform/src/tools/model_studio/mainwindow.cpp index 14bd7feb..010a6052 100644 --- a/platform/src/tools/model_studio/mainwindow.cpp +++ b/platform/src/tools/model_studio/mainwindow.cpp @@ -2,7 +2,7 @@ #include "ui_mainwindow.h" #include #include -#include +#include "pub_widget/MessageBox.h" #include #include #include @@ -16,6 +16,15 @@ #include "kbdtabledatamgr.h" #include "CustomWidget/kbddevinstwidget.h" #include +#include "logoWidget.h" +#include "kbdwidget.h" +#include +#include +#include +#include +#include "pub_widget/MainTitle.h" +#include "pub_widget/MenuFrame.h" +#include "pub_widget/WorkFrame.h" #define _VERSION_STUDIO "V1.00" @@ -31,8 +40,13 @@ #define W_COMMON_DEFINE "COMMON_DEFINE" #define W_TEMP_PLUGIN "TEMP_PLUGIN" +//主工具栏上面的特殊按钮 +#define Special_Tools "tools.special" +#define Special_Exit "exit.special" +#define Special_Logo "logo.special" + MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), + CustomUiMainWindow(parent), ui(new Ui::MainWindow) { m_dlgSearchFesPoint = NULL; @@ -40,7 +54,10 @@ MainWindow::MainWindow(QWidget *parent) : ui->setupUi(this); initLayout(); initConnet(); + KbdMsgContrl::getInstance()->installMainWindow(this); + + } MainWindow::~MainWindow() @@ -56,8 +73,8 @@ void MainWindow::setPrimaryKeyEditable(bool editable) void MainWindow::closeEvent(QCloseEvent *event) { - if(QMessageBox::information(this,tr("消息"),tr("确定退出软件"),QMessageBox::Yes,QMessageBox::No) - == QMessageBox::No) + if(N_MessageBox::information(this,tr("消息"),tr("确定退出软件"),N_MessageBox::Yes,N_MessageBox::No) + == N_MessageBox::No) { event->ignore(); return; @@ -69,16 +86,36 @@ void MainWindow::closeEvent(QCloseEvent *event) void MainWindow::initLayout() { setWindowTitle(tr("设备建模")); - m_stackWidget = new QStackedWidget(this); - this->setCentralWidget(m_stackWidget); + QGridLayout *gridLayout = new QGridLayout(); + gridLayout->setContentsMargins(0,0,0,0); + gridLayout->setSpacing(0); + QWidget* title = new QWidget(ui->centralWidget); + gridLayout->addWidget(title, 0, 0, 1, 2); + m_toolBar = new MenuFrame(ui->centralWidget); + m_toolBar->setObjectName(QStringLiteral("memuForm")); + gridLayout->addWidget(m_toolBar, 1, 0, 1, 1); + m_workframe = new WorkFrame(this); + gridLayout->addWidget(m_workframe, 1, 1, 1, 1); + m_stackWidget = new QStackedWidget(m_workframe); + QGridLayout* gridLayout_1 = new QGridLayout(); + gridLayout_1->setContentsMargins(0,0,0,0); + gridLayout_1->setSpacing(0); + gridLayout_1->addWidget(m_stackWidget,0,0,1,1); + m_workframe->setLayout(gridLayout_1); + + ui->menuBar->hide(); //不显示菜单栏 readToolBarSetting(Common::getTreePath("mainWindow.xml")); m_labelMsg = new QLabel(this); this->statusBar()->addPermanentWidget(m_labelMsg); onPermentStatus(KbdTableDataMgr::getInstance()->getDbInfo()); - ui->action_bak->setVisible(false); - ui->action_fes->setVisible(false); + + ui->centralWidget->setLayout(gridLayout); + + setTitleWidget(title); + + m_toolBar->setButtonClicked(0); } void MainWindow::initConnet() @@ -102,14 +139,13 @@ void MainWindow::readToolBarSetting(const QString &path) QXmlStreamReader xml(&file); QXmlStreamAttributes attrs; - QActionGroup *actGrp = new QActionGroup(this); - bool used = false; QString text = ""; QString id = ""; QString iconPath = ""; QString param; - int seqNo = 0; + QString exitDesc = tr("退出配置"); + QString exitIconPath = ""; while (!xml.atEnd()) { if (xml.readNext() == QXmlStreamReader::Invalid) @@ -124,28 +160,64 @@ void MainWindow::readToolBarSetting(const QString &path) id = attrs.value("id").toString(); iconPath = attrs.value("icon").toString(); param = attrs.value("param").toString(); - QWidget* widget = createWidget(id,param); + QWidget* widget = NULL; + if(id == Special_Logo) + { + continue; + } + else if(id == Special_Exit) //特殊处理退出按钮 + { + exitDesc = text; + exitIconPath = iconPath; + continue; + } + else if(id == Special_Tools) //特殊处理辅助工具按钮 + { + widget = createToolsWidget(); + } + else + { + widget = createWidget(id,param); + } if(used && widget != NULL) { - QAction *act = new QAction(QIcon(iconPath),text,this); m_stackWidget->addWidget(widget); - act->setData(seqNo++); - ui->mainToolBar->addAction(act); - act->setCheckable(true); - actGrp->addAction(act); + QPushButton* btn = m_toolBar->addToolBtn(text); + btn->setStyleSheet(QString("MenuFrame QPushButton{" + "background-image:url(%1);" + "}" + "MenuFrame QPushButton:hover{" + "background-image:url(%1) ;" + "}" + "MenuFrame QPushButton:pressed," + "MenuFrame QPushButton:checked," + "MenuFrame QPushButton:focus{" + "background-image:url(%1) ;" + "}").arg(iconPath)); + } + else if(!used && widget != NULL) + { + widget->hide(); } } } } - connect(actGrp,SIGNAL(triggered(QAction*)),this,SLOT(onActionGrpTrigger(QAction*))); + connect(m_toolBar,SIGNAL(buttonClicked(int)),this,SLOT(onMenuFrameChecked(int))); -//增加一个退出的Action - QAction *act = new QAction(QIcon(":/icons/icons/exit.png"),tr("退出"),this); - ui->mainToolBar->addSeparator(); - ui->mainToolBar->addAction(act); - connect(act,SIGNAL(triggered(bool)),this,SLOT(close())); + //增加一个退出的Action + QPushButton* btn = m_toolBar->addToolBtn(exitDesc); + btn->setStyleSheet(QString("\ + MenuFrame QPushButton{ \ + background-image:url(%1);\ + }\ + MenuFrame QPushButton:hover{\ + background-image:url(%1) ;\ + }\ + MenuFrame QPushButton:pressed, MenuFrame QPushButton:checked,MenuFrame QPushButton:focus{\ + background-image:url(%1) ;\ + }").arg(exitIconPath)); if (xml.hasError()) { @@ -164,20 +236,97 @@ QWidget *MainWindow::createWidget(const QString &id, const QString ¶m) QVariant* varParam = new QVariant(listParam.at(i)); listPtr.push_back((void*)varParam); } - return Common::createPluginWidget(this,id, listPtr); + MS_LOG_DEBUG(tr("开始创建插件,id=%1,param=%2").arg(id).arg(param)); + QWidget *pWidget = Common::createPluginWidget(this,id, listPtr); + MS_LOG_DEBUG(tr("结束创建插件,id=%1,param=%2").arg(id).arg(param)); + return pWidget; } -void MainWindow::onActionGrpTrigger(QAction *act) +QWidget *MainWindow::createToolsWidget() { - if(act == NULL) - return; + KbdWidget *widget = new KbdWidget(this); + QHBoxLayout *mainLayout = new QHBoxLayout; + widget->setLayout(mainLayout); - m_stackWidget->setCurrentIndex(act->data().toInt()); + QGroupBox *searchBox = new QGroupBox(tr("检索工具"),this); + QGroupBox *modifyBox = new QGroupBox(tr("批量修改"),this); + QGroupBox *checkBox = new QGroupBox(tr("检查工具"),this); + QGroupBox *advancedConfigBox = new QGroupBox(tr("高级参数"),this); + searchBox->setMinimumWidth(200); + modifyBox->setMinimumWidth(200); + checkBox->setMinimumWidth(200); + advancedConfigBox->setMinimumWidth(200); + + mainLayout->addStretch(); + mainLayout->addWidget(searchBox); + mainLayout->addSpacing(20); + mainLayout->addWidget(modifyBox); + mainLayout->addSpacing(20); + mainLayout->addWidget(checkBox); + mainLayout->addSpacing(20); + mainLayout->addWidget(advancedConfigBox); + mainLayout->addStretch(); + this->setLayout(mainLayout); + + //检索工具 + QVBoxLayout *searchLayout = new QVBoxLayout; + QPushButton *btnSearchDev = new QPushButton(tr("后台测点检索器"),searchBox); + QPushButton *btnSearchFes = new QPushButton(tr("前置测点检索器"),searchBox); + connect(btnSearchDev,SIGNAL(clicked()),this,SLOT(onPointSearch())); + connect(btnSearchFes,SIGNAL(clicked()),this,SLOT(onFesPointSearch())); + + searchLayout->addWidget(btnSearchDev); + searchLayout->addWidget(btnSearchFes); + searchLayout->addStretch(); + searchBox->setLayout(searchLayout); + + //批量修改工具 + QVBoxLayout *modifyLayout = new QVBoxLayout; + QPushButton *btnModifyDev = new QPushButton(tr("批量修改后台测点"),modifyBox); + QPushButton *btnModifyFes = new QPushButton(tr("批量修改前置测点"),modifyBox); + connect(btnModifyDev,SIGNAL(clicked()),this,SLOT(onShowBackStageDialog())); + connect(btnModifyFes,SIGNAL(clicked()),this,SLOT(onShowFesDialog())); + modifyLayout->addWidget(btnModifyDev); + modifyLayout->addWidget(btnModifyFes); + modifyLayout->addStretch(); + modifyBox->setLayout(modifyLayout); + + //检查工具 + QVBoxLayout *checkLayout = new QVBoxLayout; + QPushButton *btnCheck = new QPushButton(tr("配置检查"),checkBox); + connect(btnCheck,SIGNAL(clicked()),this,SLOT(onConfigCheck())); + checkLayout->addWidget(btnCheck); + checkLayout->addStretch(); + checkBox->setLayout(checkLayout); + + //高级参数配置 + QVBoxLayout *advancedConfigLayout = new QVBoxLayout; + QCheckBox *primaryKeyEditable = new QCheckBox(tr("属性面板主键可编辑"),advancedConfigBox); + connect(primaryKeyEditable,SIGNAL(clicked(bool)),this,SLOT(onPrimaryKeyEditable(bool))); + advancedConfigLayout->addWidget(primaryKeyEditable); + advancedConfigLayout->addStretch(); + advancedConfigBox->setLayout(advancedConfigLayout); + + return widget; +} + +void MainWindow::onMenuFrameChecked(int index) +{ + if(index == m_stackWidget->count()) + { + bool bRet = close(); + if(!bRet) + { + m_toolBar->setButtonClicked(0); + } + return; + } + m_stackWidget->setCurrentIndex(index); } void MainWindow::onDbError(const QString &error) { - QMessageBox::information(this,tr("数据库错误"),tr("数据库错误:")+error); + N_MessageBox::information(this,tr("数据库错误"),tr("数据库错误:")+error); } void MainWindow::onPrimaryKeyEditable(bool checked) @@ -192,7 +341,7 @@ void MainWindow::onPermentStatus(const QString &info) void MainWindow::onVersion() { - QMessageBox::about(this,tr("设备建模"),tr("版本号:%1").arg(Common::getSoftwareVersion())); + N_MessageBox::about(this,tr("设备建模"),tr("版本号:%1").arg(Common::getSoftwareVersion())); } void MainWindow::onPointSearch() @@ -201,7 +350,8 @@ void MainWindow::onPointSearch() wig->setPointValueEnable(false); wig->setMultiSelectPointEnable(false); - QDialog dlg; + CustomDialog dlg(this); + dlg.setWindowTitle(tr("后台测点检索器")); QHBoxLayout* hLayout = new QHBoxLayout; hLayout->addWidget(wig); hLayout->setMargin(0); @@ -240,5 +390,6 @@ void MainWindow::onShowFesDialog() void MainWindow::onConfigCheck() { kbdConfigCheckDlg* dlg = new kbdConfigCheckDlg(this); + dlg->setWindowTitle(tr("配置检查")); dlg->show(); } diff --git a/platform/src/tools/model_studio/mainwindow.h b/platform/src/tools/model_studio/mainwindow.h index cd9ded8f..153ef16f 100644 --- a/platform/src/tools/model_studio/mainwindow.h +++ b/platform/src/tools/model_studio/mainwindow.h @@ -1,4 +1,11 @@ -#ifndef MAINWINDOW_H + + + + + + + +#ifndef MAINWINDOW_H #define MAINWINDOW_H #ifdef CODEC_EXECUTE @@ -6,6 +13,10 @@ #endif #include +#include +#include "pub_widget/CustomMainWindow.h" +#include "pub_widget/MenuFrame.h" +#include "pub_widget/WorkFrame.h" namespace Ui { class MainWindow; @@ -18,7 +29,7 @@ class QTranslator; class KbdFesPointDlg; class KbdPointDlg; -class MainWindow : public QMainWindow +class MainWindow : public CustomUiMainWindow { Q_OBJECT @@ -35,16 +46,20 @@ private: void initConnet(); void readToolBarSetting(const QString &path); QWidget *createWidget(const QString &id, const QString ¶m); + QWidget *createToolsWidget(); private: Ui::MainWindow *ui; + WorkFrame* m_workframe; + MenuFrame* m_toolBar; + QStackedWidget *m_stackWidget; QLabel *m_labelMsg; KbdFesPointDlg *m_dlgSearchFesPoint; KbdPointDlg *m_dlgSearchPoint; private slots: - void onActionGrpTrigger(QAction *act); + void onMenuFrameChecked(int index); void onDbError(const QString &error); void onPrimaryKeyEditable(bool checked); void onPermentStatus(const QString &info); diff --git a/platform/src/tools/model_studio/mainwindow.ui b/platform/src/tools/model_studio/mainwindow.ui index 1cd0a96a..7e86dc5d 100644 --- a/platform/src/tools/model_studio/mainwindow.ui +++ b/platform/src/tools/model_studio/mainwindow.ui @@ -23,7 +23,7 @@ 0 0 1280 - 22 + 23 @@ -54,20 +54,6 @@ - - - false - - - Qt::ToolButtonTextUnderIcon - - - TopToolBarArea - - - false - - diff --git a/platform/src/tools/model_studio/model_studio.pro b/platform/src/tools/model_studio/model_studio.pro index 6330fab2..f8a6758e 100644 --- a/platform/src/tools/model_studio/model_studio.pro +++ b/platform/src/tools/model_studio/model_studio.pro @@ -43,7 +43,7 @@ LIBS += -llog4cplus -lpub_utility_api LIBS += -lsys_login_api LIBS += -lboost_thread -lboost_system - +LIBS += -lpub_widget #kbd61850 #LIBS += -llibcfgtool #DEFINES += CODEC_EXECUTE @@ -68,8 +68,8 @@ SOURCES += main.cpp\ kbdfespointdlg.cpp \ kbdbackpointpatch.cpp \ kbdfespointpatch.cpp \ - kbdconfigcheck.cpp - + kbdconfigcheck.cpp \ + logoWidget.cpp HEADERS += mainwindow.h \ SingleApplication.h \ @@ -78,8 +78,8 @@ HEADERS += mainwindow.h \ kbdfespointdlg.h \ kbdbackpointpatch.h \ kbdfespointpatch.h \ - kbdconfigcheck.h - + kbdconfigcheck.h \ + logoWidget.h FORMS += mainwindow.ui \ kbdbackpointpatch.ui \ diff --git a/platform/src/tools/model_studio/model_studio_EN.ts b/platform/src/tools/model_studio/model_studio_EN.ts deleted file mode 100644 index 7a4ef89d..00000000 --- a/platform/src/tools/model_studio/model_studio_EN.ts +++ /dev/null @@ -1,9500 +0,0 @@ - - - - - AlarmWidget - - - - - 添加记录 - Add record - - - - - - 删除记录 - Delete record - - - - - - 撤销更改 - Undo changes - - - - - - - - - 保存 - Save - - - - Excel导出 - ExcelExport - - - - Excel导入 - ExcelImport - - - - 所属告警状态选择 - 所属报警状态选择 - Select alarm status - - - - - 添加<< - Add<< - - - - - 删除>> - Delete>> - - - - 告警动作选择 - 报警动作选择 - Select alarm action - - - - - - 消息 - Message - - - - - - 是否保存当前预案 - Whether to save the current plan - - - - 超过了最大字符限制512 - Exceeded maximum character limit of 512 - - - - 保存成功! - Save successed! - - - - 设备实例 - Device instance - - - - 位置: - Location: - - - - 专业: - Subsystem: - - - - 设备测点 - Device point - - - - 只显示有预案的测点 - Only show points with plan - - - - 预案 - Plan - - - - 请选中对应的告警方式 - 请选中对应的报警方式 - Please select the corresponding alarm method - - - - 保存不成功 - Save failed - - - - 保存成功 - Save successed - - - - 请选中对应告警等级 - 请选中对应报警等级 - Please select the corresponding alarm level - - - - CModelStudiologin - - - 数据库查询域失败 - Select domain failed - - - - 数据库中不存在任何域 - There isn't any domain in database - - - - 数据库查询位置失败 - Select location failed - - - - 数据库中不存在任何位置 - There isn't any location in database - - - - 数据库查询应用失败 - Select apply failed - - - - 数据库中不存在任何应用 - There isn't any apply in database - - - - 数据库查询专业失败 - Select subsystem failed - - - - 数据库中不存在任何专业 - There isn't any subsystem in database - - - - 账号:%1 - account:%1 - - - - 登录失败 - Login failed! - - - - 失败原因: - - Failed reason: - - - - CommonWidget - - 导出当前配置 - Export current configuration - - - - 添加记录 - 导入当前配置 - Import current configuration - - - - 删除记录 - Delete record - - - - 撤销更改 - Undo change - - - - - 保存 - Save - - - - Excel导出 - - - - - Excel导入 - - - - - - 输出测点 %1 格式不正确 - Output point %1 incorrect format - - - - - - 数据库查询错误 - Database query error - - - - - - 输出测点%1 不存在对应的车站和专业信息 - Output point %1 corresponding station and subsystem information don't existed - - - - 超时输出测点 %1 格式不正确 - Timeout output point %1 incorrect format - - - - 输出测点和超时输出测点不属于同一个车站与专业 - Output point and timeout output point not belong to the same station and subsystem - - - - - - - - 消息 - Message - - - - - 文件打开不成功 - Open file failed - - - - 导出配置成功! -导出路径: - Export configuration success!export path: - - - - 保存失败 - Save failed - - - - 导出失败:%1 - Export failed:%1 - - - - 打开文件 - Open file - - - - 导入失败:%1 - Import failed:%1 - - - - 导入成功 - Import success - - - - DevWidget - - - 显示模式 - Display mode - - - - 详细模式 - Detailed mode - - - - 表格模式 - Table mode - - - - 设备实例 - Device instance - - - - 位置: - Location: - - - - 专业: - Subsystem: - - - - 设备测点 - Device point - - - - 属性面板 - Attribute panel - - - - 保存 - Save - - - - 刷新 - Refresh - - - - - 添加设备组 - Add device group - - - - 导入设备组 - import device group - - - - - 修改设备组 - Modify device group - - - - 删除设备组 - Delete device group - - - - 复制设备 - Copy Device - - - - 复制整个设备组设备 - Copy all devices of the device group - - - - 修改设备 - Modify device - - - - 删除设备 - Delete device - - - - 同步前置设备的描述到所选设备 - Synchronize description of Fes devices to selected devices - - - - - 关联RTU/清除前置RTU - Association RTU/Clear Fes RTU - - - - 添加累积量特殊点 - Add special accuml point - - - - 添加模拟量特殊点 - Add special accuml point - - - - 添加数字量特殊点 - Add special digital point - - - - 添加枚举量特殊点 - Add special mix point - - - - 删除特殊点 - Delete special point - - - - 强制删除测点 - Force delete point - - - - - 生成该测点的闭锁出口 - Generate interlock exit of the point - - - - 从前置设备添加测点 - Add point from Fes devices - - - - 刷新所选测点属性 - Refresh selected point attributes - - - - 基础属性 - Base - - - - 限值属性 - Lmt - - - - 前置属性 - Fes - - - - 控制属性 - Ctl - - - - 通过点类型获取单位失败 - Get unit by point type failed - - - 该设备的模板未与前置模板有任何关联, -请先关联! - The device's template is not associated with the Fes template,please associated first! - - - - 添加失败 - Add failed - - - - 提示 - Prompt - - - - 测点属性已经修改,是否保存? - The point attribute has been modified,whether to save? - - - - - - - 保存失败: - Save failed: - - - - 保存失败 - Save failed - - - - 保存成功! - Save success! - - - - 查询设备信息失败 - Query device message failed - - - - - 删除点失败! - Delete point failed! - - - - - 删除点成功! - Delete point success! - - - - 标签名已存在,请修改 - Tagname already existed,please modify - - - - - 复制失败! - Copy failed! - - - - 模板有错,请重新打开软件 - The templete is wrong,please reopen the software - - - - 未选中设备 - Unselected device - - - - 导出设备组 - Export Device Group - - - - 存在重复的前置分量! - - - - - 设备信息有误,请重新打开软件 - Device message is wrong,please reopen the software - - - - 复制设备-请输入新的设备名 - Copy device-please input new device name - - - - - 复制成功 - Copy success - - - - 请选中要复制的设备组 - Please select the device group you want to copy - - - - 复制设备组-请输入新的设备组名 - Copy device group-please input new device name - - - - 新的设备组名 - new device group name - - - - 标签名或描述不能为空 - Tagname and decription can't be null - - - - - - 数据库链接出错 - Database link error - - - - 设备组的标签名重复!请重新填写 - Duplicate tagname of device group!Please refill - - - - 请选择设备! - Please select device! - - - - 设备信息有错,请重新打开软件 - Device message is wrong,please reopen the software - - - - 修改设备属性 - Modify device attrubutes - - - - - - 修改成功 - Modify success - - - - 请选中要删除的设备 - Please select the device you want to delete - - - - 删除设备失败! - Delete Device failed! - - - - 删除设备成功 - Delete device success - - - - - 请选中要关联的设备实例 - Please select the device instance you want to associate - - - - 导入成功 - Import success - - - - 导出成功 - Export success - - - - 选择要添加的测点 - Select the point you want to add - - - - 请选中要添加的设备 - Select the device you want to add - - - - 不可添加的前置测点类型 - The Fes point type can't be added - - - - 请选中要添加的设备组 - Please device group you want to add - - - - 请选择同一类型的测点 - Please select the same type of point - - - - 选择前置设备进行关联 - Select a Fes device to associate - - - - 获取设备信息错误 - Get device message error - - - - 消息 - Message - - - - 未选择任何RTU,将执行清除RTU属性操作,是否执行? - No RTU selected,will chear RTU attributes,whether to execute? - - - - 执行失败! - Execute failed! - - - - 执行成功 - Execute success - - - - 请先选择位置和专业 - Please select location and subsystem - - - - - 获取车站标签信息失败 - Get location tag messsage failed - - - - - 添加成功 - Add success - - - - 请选中设备组 - Please select a device group - - - - 删除设备组失败! - Delete device group failed! - - - - 删除设备组成功 - Delete device group success - - - - 累计量无闭锁出口 - Accuml point doesn't has interlock exit - - - - - - - - - - 数据库链接错误 - Database link error - - - - 此测点非控制点,无法生成闭锁出口 - This point is not a control point,unable to generate interlock exit - - - - 请选中要生成出口的测点 - Please select the point to generate the exit - - - - 闭锁出口生成成功! - Generate interlock exit success! - - - - - - - 未选中具体设备! - No specific device selected! - - - - - - - - 获取设备信息失败! - Get device message failed! - - - 前置关联 - Fes association - - - - 直接添加设备 - Add devices directly - - - - 参数错误 - Para error - - - - 添加的数据格式不对 - The added data format is incorrect - - - - 无此数据%1 - No such data %1 - - - - - - - - - - - 获取测点序号信息失败! - Get the point serial number information failed! - - - - 缺少xml文件 - Missing xml file - - - - 此次修改失败,已启动回滚! - This modification failed,rollback has started! - - - - 添加不成功 - Add failed - - - - - - - 该测点 %1 不是特殊点,不可删除! - The point %1 is not special point,can't be delete! - - - - 请选中要同步更新描述的设备 - Please select the device you want to update description synchronously - - - - 更新描述完毕! - Update description complete! - - - - EditRelationDlg - - - 点类型: - Point type: - - - - 添加 - Add - - - - 移除 - Remove - - - - 确定 - Ok - - - - 取消 - Cancel - - - - 模拟量 - Analog - - - - 模拟量控制 - Analog control - - - - 数字量 - Digital - - - - 数字量控制 - Digital control - - - - 累积量 - Accuml - - - - 枚举量 - Mix - - - - 枚举量控制 - Mix control - - - - 后台测点标志 - Back point flag - - - - 前置测点标志 - Fes point flag - - - - - 警告 - Warnning - - - - 不允许表格为空! - The talbe can't be empty! - - - - 后台标志不允许重复! - Back flag does not allow duplicates! - - - - ExpressionWidget - - - - - 添加记录 - Add record - - - - - - 删除记录 - Delete record - - - - - 撤销更改 - Undo change - - - - - - 保存 - Save - - - - 添加 - Add - - - - 删除 - Delete - - - - 函数定义 - Function define - - - - 测试 - Test - - - - 车站 - Station - - - - 专业 - Subsystem - - - - 修改记录 - Modify record - - - - 计算输出点列表 - The list of calculation output point - - - - 输入变量列表 - The list of input variable - - - - - 所有 - All - - - - 链接数据库失败! - Database link failed! - - - - 函数定义中,有引用此分组ID:%1,请先删除引用了该分组的函数 - The function definition referenced this group ID %1,please delete the function that references the group first - - - - 请选中要添加的分类! - Please select the type want to add! - - - - - 请选中要删除的函数! - Please select the type want to delete! - - - - 链接数据库失败 - Database link failed - - - - 计算点中,有引用此函数的输出点:%1,请先删除该计算点 - In calculation point has point referenced to this function:%1,please delete the point first - - - - - 写入数据库不成功 - Write to database failed - - - - - 删除成功 - Delete success - - - - 保存成功 - Save success - - - - - - 获取车站信息失败! - Get station message failed! - - - - 添加失败 - Add failed - - - - 添加成功 - Add success - - - - 请选中要修改的输出 - Please select the output want to modify - - - - 选中的输出不唯一,数据库错误 - Select multiple outputs,database error - - - - 修改失败! - Modify failed! - - - - 修改成功 - Modify success - - - - 删除R失败! - Delete R failed! - - - - 请选中对应的输出 - Please select the corresponding output - - - - FesTempWidget - - - 属性同步至实例设备 - Synchronize attributes to device instance - - - - 添加记录 - Add record - - - - 修改 - Modify - - - - 复制点 - Copy point - - - - 删除记录 - Delete record - - - - 操作应用至前置设备 - Operational application to the Fes device - - - - 模板点列表 - Template point list - - - - 添加应用至前置设备 - Add application to the Fes device - - - - 删除应用至前置设备 - Delete application to the Fes device - - - - 累积量 - Accuml - - - - 模拟量 - Analog - - - - 数字量 - Digital - - - - 枚举量 - Mix - - - - 模拟量控制 - Analog control - - - - 数字量控制 - Digital control - - - - 枚举量控制 - Mix control - - - - - 数据块 - Data block - - - - - 保护定值 - Protection const - - - - 前置设备模板 - Fes device template - - - - 累积量模板点 - Accuml template point - - - - 模拟量模板点 - Analog template point - - - - 数字量模板点 - Digital template point - - - - 枚举量模板点 - Mix template point - - - - 模拟量控制点 - Analog control point - - - - 数字量控制点 - Digital control point - - - - 枚举量控制点 - Mix control point - - - - - - 导出%1不成功 - Export %1 failed - - - - - 文件打开不成功! - Open file failed! - - - - 导入失败!事务已回滚!原因: - Import failed!The transaction has been rolled back!reason: - - - - 导入失败!原因:事务开启失败 - Import failed!reason:Transaction open failed - - - - excel文件中没有%1表 - There is no %1 table in the excel file - - - - - 表格%1中没有%2列 - There is no %2 column in table %1 - - - - 设备模板名为空! - Device template name is null! - - - - 存在同名模板%1,无法导入 - There is a template with the same name %1,import failed - - - - 写入TAG_NAME失败 - Write TAG_NAME failed - - - - 写入设备描述失败 - Write device description failed - - - - 错误:没有%1表! - Error:no %1 table! - - - - 错误:没有此列%1 - Error:no %1 column - - - - - - 请选中要添加测点的模板! - Please select the template to add point! - - - - - - 添加失败 - Add failed - - - - - - - 添加成功 - Add success - - - - - - - - 请选中要修改的模板 - Please select the template to modify - - - - 请选中要修改的行 - Please select the line to modify - - - - - 请选中要复制的模板点 - Please select the template point to copy - - - - - 复制点失败! - Copy point failed! - - - - - - - 消息 - Message - - - - 请至少选择一条数据! - Please choose a piece of data - - - - 是否删除前置测点? - Do you want to delete the fes points? - - - - 删除失败! - Delete failed! - - - - 删除成功 - Delete success - - - - 添加成功! - Add success! - - - - 该模板在数据库中的数据不唯一 - The template's data in the database is not unique - - - - 修改成功! - Modify success! - - - - 是否删除前置模板? - Do you want to delete the fes template? - - - - 链接数据库查询失败 - Database query failed - - - - 有以下RTU引用了模板%1: -%2 - 是否强制删除此模板? - The following RTU references the template %1:%2 whether to force delete this template? - - - - 删除失败 - Delete failed - - - - 删除设备成功 - Delete device success - - - - 请选中需要导出的设备 - Please select the device you want to export - - - - 保存模板 - Save template - - - - 导出模板不成功! - Export template failed! - - - - - - - - - - - - - - 导出设备模板不成功! -原因:%1 - Export device template failed!reaseon:%1 - - - - 保存文件失败! -%1 - Save file failed!%1 - - - - 导出成功!导出路径: - %1 - Export success!export path:%1 - - - - - 模板导入 - Import template - - - - - 导入失败! -失败文件:%1 -失败原因:%2 - - Import failed! Failed file:%1 Failed reason:%2 - - - - - - 导入成功 - Import success - - - - 导入失败 - Import failed - - - - 请输入模板所属的专业和类型 - Please enter the subsystem and type belong to template - - - - 选择PSC3000导出的转发数据 - Select the forwarding data exported by PSC3000 - - - - 未检测到任何设备模板 - No device templates detected - - - - 导入失败! -失败原因:%1 - - Import failed!reason:%1 - - - - 请选择要实例化的前置模板 - Please select the Fes template to be instantiated - - - - 获取模板信息失败! - Get template message failed! - - - - 模板信息错误 - Template message error - - - - 实例化成功! - Instantiation success! - - - - 复制前置设备模板 - Copy Fes device template - - - - 数据库链接错误 - Database link error - - - - 标签名已存在,请修改 - Tag name already exists,please modify - - - - 复制失败! - Copy failed! - - - - 复制成功! - Copy success! - - - - - 未选中模板点 - Template point not selected - - - - 选中要添加的设备 - Select a device want to add - - - - 添加点失败! - Add point failed! - - - - 添加成功! - Add success! - - - - 选中要删除的设备 - Select the device want to delete - - - - 删除点失败! - Delete point failed! - - - - 删除点成功 - Delete point success - - - - 删除点成功! - Delete point success! - - - - 请先保存修改 - Please save changes first - - - - 该列不可编辑 - This column is not editable - - - - 该列是主键,不可编辑 - This column is the primary key,cannot be edited - - - - 选中要修改的设备 - Select the device want to modify - - - - 当前属性无法同步 - Current attributes cannot be synchronized - - - - 开始执行批量菜单 - Start executing the batch menu - - - - 结束执行批量菜单 - End executing the batch menu - - - - 修改失败 - Modify failed - - - - - 修改成功 - Modify success - - - - FesWidget - - - 添加记录 - Add record - - - - 修改记录 - Modify record - - - - 删除记录 - Delete record - - - - Excel导出 - ExcelExport - - - - Excel导入 - ExcelImport - - - - 添加失败 - Add failed - - - - 添加成功 - Add success - - - - 修改失败 - Modify failed - - - - 修改成功 - Modify success - - - - 以下通道设置中有引用该规约,请先删除通道! - - The protocol is referenced in the following channel,please delete the channel first! - - - - 有以下FES设备模板挂载在此设备类型,请先FES设备模板 - - The following FES device templates are mounted on this device type,please first handle FES device template - - - - 删除失败 - Delete failed - - - - 删除成功 - Delete success - - - - KbdAddTempGroupDlg - - - 模板组标签名 - Template group tag name - - - - 模板组描述 - Template group description - - - - 同时添加以下设备模板 - Add the following device template at the same time - - - - 间隔信息 - Interval information - - - - 断路器 - Breaker - - - - 上隔离刀 - Top isolation knife - - - - 下隔离刀 - Down isolation knife - - - - 接地刀闸 - On ground knife gate - - - - 手车 - Handcart - - - - 此次修改失败,已启动回滚! - This modification failed,rollback has started! - - - - 添加失败 - Add failed - - - - 消息 - Message - - - - KbdApcAnaWidget - - - 添加记录 - Add record - - - - 删除记录 - Delete record - - - - - - - - - - - - - - - 消息 - Message - - - - 输出测点 %1 格式不正确,请重新输入 - Output point %1 format is incorrect, please re-enter - - - - - - - 数据库查询错误 - Database query error - - - - 输出测点%1 不存在对应的车站和专业信息 - Output point %1 does not exist corresponding station and subsystem information - - - - 超时输出测点 %1 格式不正确 - Point %1 output timeout and format is incorrect - - - - 超时输出测点%1 不存在对应的车站和专业信息 - Point %1 output timeout and there is no corresponding station and subsystem information - - - - 超时输出测点与输出测点不是同一个车站和专业 - The timeout output point not belong to the same station and subsystem with output point - - - - 输出测点或者超时状态输出DI点 格式不正确,请重新输入 - The format of output point or timeout status output DI point is incorrect,please re-enter - - - - - 不存在对应的车站和专业信息 - There is no corresponding station and subsystem information - - - - 所选的输出测点和超时输出测点不是同一个车站 - The selected output point and timeout output point are not in the same station - - - - 所选的输出测点和超时输出测点不是同一个专业 - The selected output point and timeout output point are not in the same subsystem - - - - 添加失败 - Add failed - - - - 是否删除? - Delete or not? - - - - 删除失败 - Delete failed - - - - 修改失败 - Modify failed - - - - 此次修改失败,已启动回滚! - This modification failed,rollback has started! - - - - 回滚事务失败! - Rollback transaction failed! - - - - KbdApcDigWidget - - - 添加记录 - Add record - - - - 删除记录 - Delete record - - - - - - - - - - - 消息 - Message - - - - 输出测点 %1 格式不正确,请重新输入 - The format of output point %1 is incorrect,please re-enter - - - - 数据库查询错误 - Database query error - - - - 输出测点%1 不存在对应的车站和专业信息 - Output point %1 does not exist corresponding station and subsystem information - - - - 添加失败 - Add failed - - - - 是否删除? - Delete or not? - - - - 删除失败 - Delete failed - - - - 修改失败 - Modify failed - - - - 此次修改失败,已启动回滚! - This modification failed,rollback has started! - - - - 回滚事务失败! - Rollback transaction failed! - - - - KbdBackPointPatch - - - Dialog - Dialog - - - - 位置: - Location: - - - - 专业: - Subsystem: - - - - 设备组: - Dev group: - - - - 设备: - Device: - - - - 点类型: - Point type: - - - - 前置RTU: - Fes RTU: - - - - 查询 - Search - - - - 描述包含字符: - Charactors contained by description: - - - - 批量修改后台测点 - Batch modify backstage points - - - - 模拟量 - Analog point - - - - 数字量 - Digital point - - - - 累积量 - Accuml point - - - - 枚举量 - Mix point - - - - 基础属性 - Base attributes - - - - 前置属性 - Fes attributes - - - - 限值属性 - Limit attributes - - - - 控制属性 - Control attributes - - - - %1 选中行 从0开始自增 - %1 selected line increments from 0 - - - - %1 选中行 从1开始自增 - %1 selected line increments from 1 - - - - %1 选中行 自定义自增 - %1 selected line increments Customly - - - - %1 选中行 取相同值 - %1 selected line set same value - - - - %1 选中行 查找与替换 - %1 selected line find and replace - - - - - - - - - - - - - - - - - 消息 - Message - - - - - %1 -文本格式不对 - %1\ntext format is wrong - - - - - - 该列不可编辑 - This column is not editable - - - - - - 该列是主键,不可编辑 - This column is not editable due to as the key - - - - 开始执行自增菜单 - Start executing the self-increment menu - - - - 自增菜单结束 - Self-increment menu end - - - - - - 修改成功! - Modify success! - - - - 开始执行取相同值菜单 - Start executing the same value menu - - - - 取相同值菜单结束 - Execute the same value menu end - - - - 开始执行查找与替换菜单 - Start executing the find and replace menu - - - - 查找与替换菜单结束 - Execute the find and replace menu end - - - - - - - 所有 - All - - - - 取相同值 - set same value - - - - 请输入 - Please enter - - - - KbdBatchFesDevDlg - - - 批量实例化 - Batch instantiation - - - - 批量实例设备 - Batch instantiation device - - - - 批量设置 - Batch setting - - - - 批量实例数量 - Batch instantiation number - - - - 批量起始数字 - Batch start number - - - - 批量标签名格式(%1表示占位符) - Batch tag name format(%1 represents a placeholder) - - - - 示例:tagName%1 - Example:tagName%1 - - - - 批量描述格式(%1表示占位符) - Batch description format(%1 represents a placeholder) - - - - 示例:#%1电表 - Example:#%1ammeter - - - - - 实例化失败! - Instantiation failed! - - - - - 提交事务失败,已回滚 - Submit transaction failed,rolled back - - - - 批量标签名格式为空 - Batch setting tag name null - - - - 批量标签名格式中含有非法字符.号 - Batch tag name format contains illegal characters.char - - - - 批量标签名格式中没有包含占位符%1 - Batch tag name format doesn't contain placeholder %1 - - - - 批量描述格式为空 - Batch setting description null - - - - 批量描述格式中含有非法字符.号 - Batch description format contains illegal characters.char - - - - 批量描述格式中没有包含占位符%1 - Batch description format doesn't contain placeholder %1 - - - - 请先选择RTU - Please select RTU first - - - - 查询RTU信息失败! - Query RTU message failed! - - - - 消息 - Message - - - - KbdBatchInstanceDlg - - - 批量实例化 - Batch instantiation - - - - 批量处理未完成 - Batch processing is not completed - - - - 批量实例设备 - Batch instantiation device - - - - 后台设备批量设置 - Batch setting backstage device - - - - 批量实例数量 - Batch instantiation number - - - - 批量起始数字 - Batch start number - - - - 批量标签名格式(%1表示占位符) - Batch tag name format(%1 represents a placeholder) - - - - 示例:tagName%1 - Example:tagName%1 - - - - 批量描述格式(%1表示占位符) - Batch description format(%1 represents a placeholder) - - - - 示例:#%1电表 - Example:#%1ammeter - - - - 同时在前置中实例化对应设备 - Simultaneously instantiate the corresponding device in Fes - - - - 前置批量设置 - Batch setting Fes - - - - 选择同时要实例的前置RTU - Select the Fes RTU that you want to instantiate - - - - - - 实例化失败! - Instantiation failed! - - - - 提交事务失败,已回滚 - Submit transaction failed,rolled back - - - - 实例化成功! - Instantiation success! - - - - 批量标签名格式为空 - Batch setting tag name null - - - - 批量标签名格式中含有非法字符.号 - Batch tag name format contains illegal characters.char - - - - 批量标签名格式中没有包含占位符%1 - Batch tag name format doesn't contain placeholder %1 - - - - 批量描述格式为空 - Batch setting description null - - - - 批量描述格式中含有非法字符.号 - Batch description format contains illegal characters.char - - - - 批量描述格式中没有包含占位符%1 - Batch description format doesn't contain placeholder %1 - - - - 没有选择前置要实例的RTU,无法同时在前置中实例化对应设备 -请先选择! - Not select RTU that Fes want to instance,cannot instantiate the corresponding device in Fes at the same time\nPlease select first! - - - - 查询数据库失败 - Database query failed - - - - 所选择的后台模板的属性 二次设备模板名 为空 - The properties of the selected backsatge template the secondary device template name is empty - - - - 关联失败!数据库链接错误! - Association failed!database link error! - - - - 关联失败!不存在相同名称的前置设备,请手动关联! - Association failed!there is no Fes device with the same name,please manually associate! - - - - 关联失败!存在多个相同名称的前置设备,请手动关联 - Association failed!there are many Fes device with the same name,please manually associate - - - - 关联失败! - Association failed! - - - - 关联失败!启动回滚 - Association failed!rolled back - - - - 车站没有选择,请在属性框中选择 - No station selected, please select in the property box - - - - 专业没有选择,请在属性框中选择 - No subsystem selected, please select in the property box - - - - 获取RTU信息失败! - Get RTU message failed! - - - - 消息 - Message - - - - KbdCSVReader - - - - json文件打开不成功 - Open json file failed - - - - - - csv文件打开不成功 - Open csv file failed - - - - - xlsx文件打开不成功! - Open xlsx file failed! - - - - - - csv文件数据错误,有行数据大小小于2 - Has error in csv file,the line data more than or less than 2 - - - - - 临时文件保存失败%1 - Save temporary file failed %1 - - - - - 子设备ID - Sub device ID - - - - 设备ID - Device ID - - - - 属于的设备ID - Device ID belong to - - - - - 数据项列数不够 - Data item doesn't have enough columns - - - - - - 无此表单%1 - No such form %1 - - - - - - - 写错误%1:%2 - Write error%1:%2 - - - - 保存CSV文件不成功%1 - Save CSV file failed %1 - - - - KbdChanWidget - - - - 获取通道号不成功! - Get channel number failed! - - - - 获取车站信息和专业信息失败 - Get station and subsystem message failed - - - - 添加失败 - Add failed - - - - 添加成功 - Add success - - - - 写入失败,原因:获取车站信息和专业信息失败 - Write failed,reason:get station and subsystem message failed - - - - 修改失败 - Modify failed - - - - 修改成功 - Modify success - - - - 有以下RTU挂载在此通道,请先删除RTU - - The following RTUs are mounted on this channel,please delete RTU first - - - - 删除失败 - Delete failed - - - - 删除成功 - Delete success - - - - 请选中要复制的行 - Please select the line want to copy - - - - 复制 - Copy - - - - 复制数量 - Copy number - - - - 复制失败 - Copy failed - - - - 复制成功 - Copy success - - - - KbdCreateDevByFES - - - 按照前置设备实例化 - Instantiate according to the Fes device - - - - 下一步 - Next - - - - 取消 - Cancel - - - - 完成 - Complete - - - - 设备组名称 - Device group name - - - - 设备组描述 - Device group description - - - - 模板 - Template - - - - 对应的设备 - Corresponding device - - - - 选择模板组 %1 对应的前置设备(以光标为锚点进行添加,或者拖拽添加) - Select template group %1 corresponding Fes device(Add with the cursor as an anchor, or drag and drop to add) - - - - 位置 - Location - - - - 专业 - Subsystem - - - - 筛选 - Filter - - - - 添加时带RTU前缀 - Adding with RTU prefix - - - - 添加>> - Add>> - - - - >替换< - >Replace< - - - - <<删除 - <<Delete - - - - 选择责任区 - Select area of responsibility - - - - 添加记录 - Add record - - - - 删除记录 - Delete record - - - - 撤销更改 - Undo change - - - - 保存 - Save - - - - 责任区表格未保存! - Not saved reesponsibility area table! - - - - 请选择责任区 - Please select reesponsibility area - - - - 正在处理,请稍后.... - Processing,waiting... - - - - 设备组为空!请先添加设备组 - Device group is null!please add device group first - - - - 第%1行的设备组名称为空,请删除或修改! - The device group name in line %1 is empty,please delete or modify it! - - - - 设备组名称%1重复,请删除或修改! - The device group name %1 repeat,please delete or modify it! - - - - - 每次添加只能选择相同模板的设备! - Add devices that can only select the same template each time! - - - - - 未找到前置设备所对应的列! - The column corresponding to the Fes device was not found! - - - - - 表格中光标所处的位置不是设备模板所对应的位置, -请移动光标到正确的位置 - 表格中光标所处的位置不是设备模板所对应的位置, -请移动光标到正确的位置 - The position of the cursor in the table is not the location corresponding to the device template. \r\nPlease move the cursor to the correct position - - - - 请选择要替换的单元格 - Please select the cell to be replaced - - - - 按照前置设备批量生成成功 - Batch generation success according to the Fes device - - - - 消息 - Message - - - - KbdCtrlActWidget - - - - 添加记录 - Add record - - - - 修改记录 - Modify record - - - - - 删除记录 - Delete record - - - - 撤销更改 - Undo change - - - - 保存 - Save - - - - 请选中要添加的专业 - Please select the subsystem want to add - - - - 动作名%1 - Action name %1 - - - - 组名不允许为空! - Group name can't be empty! - - - - 修改失败 - Modify failed - - - - 修改成功 - Modify success - - - - 请选中要删除的数字量文本 - Please select the digital point text want to delete - - - - 删除失败 - Delete failed - - - - 删除成功 - Delete success - - - - 请选中对应的控制动作组 - Please select corresponding control action group - - - - 无法获得分量数 - Unable to get the number of components - - - - - - 消息 - Message - - - - 此次修改失败,已启动回滚! - This modification failed,rollback started! - - - - KbdDevAndFesWidget - - - 设备 - Device - - - - 关联状态 - Association status - - - - 前置 - Fes - - - - RTU - RTU - - - - 前置设备 - Fes device - - - - 前置测点 - Fes point - - - - 清空所选测点的关联 - Clear the association of selected points - - - - 移除设备组 - Remove device group - - - - 清空所选设备的关联(包括输入输出) - Clear associations for selected devices(including input and output) - - - - 同步所选设备的前置测点描述 - Synchronize the Fes point description of the selected device - - - - 刷新设备组关联状态 - Refresh device group association status - - - - 刷新 - Refresh - - - - 已关联:%1,未关联:%2 - Associated: %1,not associated: %2 - - - - 请选中设备组 - Please select the device group - - - - 所选设备组已经存在,请重新选择 - The selected device group already exists,please re-select - - - - 请选中设备组进行删除 - Please select the device group to delete - - - - - - - 请选择相同类型的点,控制点与普通测点不要同时选中 - Please select the same type of point,the control point and the common measuring point should not be selected at the same time - - - - - - - 所选测点类型与表格中的测点类型不一致 - The selected type of point is inconsistent with the type of point in the table - - - - 请选中模拟量的测点类型 - Please select the type of analog point - - - - - - - 请拖拽到前置分量上 - Please drag to the Fes component - - - - - - 请拖拽到输出分量上 - Please drag to the output component - - - - - - - 更新成功 - Update success - - - - 请选中累积量的测点类型 - Please select the type of accuml point - - - - 请选中数字量的测点类型 - Please select the type of digital point - - - - 请选中混合量的测点类型 - Please select the type of mix point - - - - - - - 清空执行完毕! - Clear execution completed! - - - - 请选中要同步更新描述的设备 - Please select the device you want to update description ynchronously - - - - 更新描述完毕! - Update description complete! - - - - 关联失败 - Association failed - - - - 关联成功 - Association success - - - - 消息 - Message - - - - KbdDevInfo - - - - 设备实例 - Device instance - - - - 搜索... - Searching... - - - - 全选 - Select all - - - - KbdFesDevDlg - - - 选择前置设备(设备的原有关联关系不覆盖,如需覆盖请先清空关联关系) - Select the Fes device.(the original association of the device is not overwritten.If you need to overwrite, clear the association first) - - - - 已选中关联设备 - Associated device selected - - - - 后台设备 - Backstage device - - - - 前置设备 - Fes device - - - - 关联 - Associate - - - - 取消 - Cancel - - - - 关联失败! - Associate faied! - - - - 关联成功! - Associate success! - - - - 此次修改失败,已启动回滚! - This modification failed,the rollback has started! - - - - 消息 - Message - - - - KbdFesDevTempDlg - - - 选择前置设备模板 - Select Fes device template - - - - KbdFesDevWidget - - - 位置 - Location - - - - 专业 - Subsystem - - - - RTU - RTU - - - - 实例化设备 - Instantiated device - - - - 修改设备 - Modify device - - - - 删除设备 - Delete device - - - - 刷新 - Refresh - - - - 前置设备 - Fes device - - - - 所有 - All - - - - 请先选择RTU - Please select RTU first - - - - 查询RTU信息失败! - Query RTU message failed! - - - - 实例化成功! - Instantiation success! - - - - 请选中对应设备! - Please select the corresponding device! - - - - 修改成功! - Modify success! - - - - 删除设备失败! - Delete device failed! - - - - 删除设备成功! - Delete device success! - - - - - - 消息 - Message - - - - 此次修改失败,已启动回滚! - This modification failed,rollback has started! - - - - KbdFesPointDlg - - - 前置测点检索器 - Fes point searcher - - - - 位置 - Location - - - - 专业 - Subsystem - - - - RTU - RTU - - - - 点类型 - Point type - - - - 模拟量 - Analog - - - - 数字量 - Digital - - - - 累积量 - Accuml - - - - 枚举量 - Mix - - - - 模拟量控制 - Analog control - - - - 数字量控制 - Digital control - - - - 枚举量控制 - Accuml control - - - - KbdFesPointPatch - - - Dialog - Dialog - - - - 位置: - Location: - - - - 专业: - Subsystem: - - - - RTU: - RTU: - - - - 设备: - Device: - - - - 点类型: - Point type: - - - - 查询 - search - - - - 描述包含字符: - Characters contained in description: - - - - 批量修改前置测点 - Batch modify Fes points - - - - 模拟量 - Analog point - - - - 数字量 - Digital point - - - - 累积量 - Accuml point - - - - 枚举量 - Mix point - - - - 模拟量控制 - Analog control point - - - - 数字量控制 - Digital control point - - - - 枚举量控制 - Mix control point - - - - %1 选中行 从0开始自增 - %1 selected line increments from 0 - - - - %1 选中行 从1开始自增 - %1 selected line increments from 1 - - - - %1 选中行 自定义自增 - %1 selected line increments Customly - - - - %1 选中行 取相同值 - %1 selected line set same value - - - - %1 选中行 查找与替换 - %1 selected line find and replace - - - - - - - - - - - - - - - - - 消息 - Message - - - - - %1 -文本格式不对 - %1 tet format incorrect - - - - - - 该列不可编辑 - This column is not editable - - - - - - 该列是主键,不可编辑 - This column is not editable due to as key - - - - 开始执行自增菜单 - Start executing the self-increment menu - - - - 自增菜单结束 - Executing the self-increment menu end - - - - - - 修改成功! - Modify success! - - - - 开始执行取相同值菜单 - Start executing the same value menu - - - - 取相同值菜单结束 - Executing the same value menu end - - - - 开始执行查找与替换菜单 - Start executing the find and replace menu - - - - 查找与替换菜单结束 - Executing the find and replace menu end - - - - - - 所有 - All - - - - 取相同值 - Set same value - - - - 请输入 - Please enter - - - - KbdFesPointWidget - - - 位置 - Location - - - - 专业 - Subsystem - - - - RTU - RTU - - - - 添加记录 - Add record - - - 修改 - Modify - - - - 删除记录 - Delete record - - - - - 刷新 - Refresh - - - - 添加设备 - Add device - - - - 修改设备 - Modify device - - - - 删除设备 - Delete device - - - - 导入PCS3000设备 - Import PCS3000 device - - - - 按照设备ID重排规约参数1 - Reorder parameter 1 according to device ID - - - - 前置测点 - Fes point - - - - 累积量 - Accuml point - - - - 模拟量 - Analog point - - - - 数字量 - Digital point - - - - 模拟量控制 - Analog control point - - - - 数字量控制 - Digital control point - - - - 数据块 - Data block - - - - 保护定值 - Protection const value - - - - 查询RTU信息失败! - Query RTU message failed! - - - - - - 请先选择前置设备 - Please select Fes device first - - - - - - - 获取RTU信息失败! - Get RTU message failed! - - - - - - - 添加失败 - Add failed - - - - 修改记录 - Modify record - - - - 复制记录 - Copy record - - - - Excel导出 - - - - - Excel导入 - - - - - 混合量 - Mix point - - - - 混合量控制 - Mix control point - - - - 请选择要添加的RTU - Please RTU to add - - - - 数据库链接出错 - Database link error - - - - - - - 添加成功 - Add success - - - - 请选中对应设备! - Please select corresponding device! - - - - 数据库链接错误,请重新打开软件 - Database link error,please reopen the software - - - - 修改成功! - Modify success! - - - - 是否删除前置设备? - Whether to delete Fes device? - - - - 删除前置设备失败 - Delete Fes device failed - - - - 删除设备成功! - Delete device succuss! - - - - 请选择要导入的RTU - Please select RTU want to import - - - - 选择PSC3000导出的转发数据 - Select the forwarding data exported by PSC3000 - - - - - 修改失败 - Modify failed - - - - - 修改成功 - Modify success - - - - 复制 - Copy - - - - 复制数量 - Copy number - - - - 获取最大规约参数不成功! - Get the max res para failed! - - - - 获取最大点号不成功! - Get the max dot no failed! - - - - 获取最大设备点序号不成功! - Get the max device seq no failed! - - - - 复制失败 - Copy failed - - - - 复制成功 - Copy success - - - - 是否删除前置测点? - Do you want to delete the Fes points? - - - - - 删除失败! - Delete failed! - - - - - 删除成功 - Delete success - - - - 点号不支持批量修改 - The dot number does not support batch modification - - - - 请选择要排序的RTU - Please select the RTU to sort - - - - 是否排序? - Whether to sort? - - - - 排序失败 - Sort failed - - - - - 排序成功 - Sort success - - - - - - - - - 消息 - Message - - - - 此次修改失败,已启动回滚! - This modification failed,rollback has started! - - - - KbdFesTempDlg - - - 全选 - Select all - - - - 反选 - Select Inverse - - - - - 无 - NULL - - - - KbdFesTempPointModifyDlg - - - 修改前置模板测点 - Modify the Fes template point - - - - 勾选更改 - Check the change - - - - 修改应用至前置设备 - Modify and apply to the Fes device - - - - 仅修改模板点 - Modify template points only - - - - 取消 - Cancel - - - - 当前属性表未关联相应模型! - The current attribute table is not associated with the corresponding model! - - - - - 此次修改失败,已启动回滚! - This modification failed,rollback has started! - - - - 修改失败 - Modify failed - - - - 修改成功 - Modify success - - - - 测点模型为空 - The point model is empty - - - - 未勾选任何属性 - Unchecked any attributes - - - - 选中要修改的设备 - Select devices want to modify - - - - 更新失败! - Update failed! - - - - 更新成功! - Update success! - - - - 消息 - Message - - - - KbdForwardBackWidget - - - 转发位置: - Forward location: - - - - 转发专业: - Forward subsystem: - - - - 转发RTU: - Forwarding RTU: - - - - 导出转发表 - Export forwarding table - - - - 刷新 - Refresh - - - - - - 模拟量 - Analog - - - - - - 模拟量控制 - Analog control - - - - - 单点数字量 - Single digital - - - - - 双点数字量 - Double digital - - - - - - 数字量控制 - Digital control - - - - - - 累积量 - Accuml - - - - - - 混合量 - Mix - - - - - - 混合量控制 - Mix control - - - - <<添加 - << add - - - - <<插入 - << insert - - - - <<全部添加 - << add all - - - - 设备组列表 - Device group list - - - - 位置 - Location - - - - 专业 - Subsystem - - - - - 全选 - Select all - - - - - 反选 - Select reverse - - - - - 全不选 - Select none - - - - 测点列表 - Point list - - - - 数字量 - Digital - - - - - - 双点数字量只能挑选数字量或数字量控制 - Double digital can only select digital or digital control - - - - 转发RTU为空! - Forward RTU is empty - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 消息 - Message - - - - - - - 获取行数据失败! - Get rowData failed! - - - - - - - 添加失败! - Add failed! - - - - - - - 提交事务失败,已回滚 - Commit transaction failed,rolled back - - - - - - - 开启事务失败! - start transaction failed! - - - - - - 添加成功! - Add success! - - - - 请选中一行作为插入位置 - Please select one line to insert - - - - 后移失败! - Mover back failed! - - - - 插入成功! - Insert success! - - - - 选择 - Select - - - - 点描述 - Point description - - - - 所属设备 - Owned equipment - - - - 点:%1不是双点,不允许添加,点标签是:%2! - Point:%1 not double,can't be added,the tag_name is:%2! - - - - 此次修改失败,已启动回滚! - Modify failed,rolled back! - - - - 开启事务失败! - start transaction failed! - - - - 修改成功 - Modify success - - - - 导出文件 - Export file - - - - *.xlsx - *.xlsx - - - - 导出成功!文件保存在:%1 - Export success!file save at:%1 - - - - %1 中的表的列数和描述数量不一致! - The number of column and description inconsistent in %1 table! - - - - 获取%1 信息失败! - Get %1 message failed! - - - - KbdForwardWidget - - RTU列表 - RTU list - - - 车站 - Location - - - 专业 - Subsystem - - - 设备列表 - Device list - - - 测点列表(挑点顺序是鼠标单击选中的顺序) - Point list(The order of picking points is the order in which the mouse clicks) - - - 批量模式 - Batch mode - - - 批量挑点 - Batch pick points - - - 测点类型 - Point type - - - >>添加 - >>Add - - - >>插入 - >>Insert - - - >>替换<< - >>replace<< - - - 删除<< - Delete<< - - - 转发RTU: - Forwarding RTU: - - - 所有编号从0自增 - All numbers increase from 0 - - - 所有远动号从0自增 - All telecontrol numbers increase from 0 - - - 修改所有系数 - Modify all coefficients - - - 修改所有修正值 - Modify all correction values - - - 导入转发表 - Import forwarding table - - - 导出转发表 - Export forwarding table - - - 所有 - All - - - 累积量 - Accuml point - - - 模拟量 - Analog point - - - 数字量 - Digital point - - - 模拟量控制 - Analog control point - - - 数字量控制 - Digital control point - - - 数据库链接错误 - Database link error - - - 添加失败 - Add failed - - - 请先选中要插入的位置 - Please select the location to insert first - - - 数据库链接出错 - Database link error - - - 插入失败 - Insert error - - - 插入成功 - Insert success - - - 两边要替换的数量不一致 - The number of replacements on both sides is inconsistent - - - 替换失败 - Replace failed - - - 替换成功 - Replace success - - - 未选中要删除的点 - The point you want to delete is not selected - - - 删除失败 - Delete failed - - - 删除成功 - Delete success - - - 修改成功! - Modify success! - - - 修改失败 - Modify failed - - - 修改成功 - Modify success - - - %1没有系数 - %1no coefficient - - - 输入 - Input - - - 系数 - Coefficient - - - %1没有修正值 - %1no correction value - - - 修正值 - Correction value - - - 导出文件 - Export file - - - *.xlsx - *.xlsx - - - 正在处理,请稍后.... - Processing,waiting... - - - 请选择导入104转发表文件 - Please select import 104 forwarding table file - - - 请选中要挑点的设备 - Please select the device you want to pick - - - 挑点成功 - Pick points success - - - 消息 - Message - - - 此次修改失败,已启动回滚! - This modification failed,rollback has started! - - - - KbdForwardWizard - - - 批量挑点导航 - Batch picking navigation - - - - 下一步 - Next - - - - 取消 - Cancel - - - - 完成 - Complete - - - - 未挑选任何测点 - No points picked - - - - - - - - 数据库链接错误 - Database link error - - - - - 数据库链接出错 - Database link error - - - - 事务提交失败,启动回滚 - This modification failed,rollback has started - - - - 开启事务失败 - Open the transaction failed - - - - 挑点失败 - Pick points failed - - - - 累积量 - Accuml point - - - - 模拟量 - Analog point - - - - 数字量 - Digital point - - - - 模拟量控制 - Analog control point - - - - 数字量控制 - Digital control point - - - - 以设备 %1 为模板挑选测点 - Device %1 picks a point as the template - - - - 应用同样的挑点模式到以下设备中 - Apply the same pick pattern to the following devices - - - - RTU列表 - RTU list - - - - 车站 - Location - - - - 专业 - Subsystem - - - - 设备列表 - Device list - - - - - 添加>> - Add>> - - - - - <<删除 - <<Delete - - - - 所选设备 - Devices selected - - - - - 所有 - All - - - - 选中设备:%1与挑点个数不一致, -请确保所选中设备中包含所挑的点一样的序号 - 选中设备:%1与挑点个数不一致, -请确保所选中设备中包含所挑的点一样的序号 - Select device: %1 is inconsistent with the number of picked points,\r\n Please make sure that the selected device contains the same number as the selected point - - - - 设备%1中不存在序号为%2的点 - There is no point with the sequence number %2 in device %1 - - - - 消息 - Message - - - - KbdGenerateFesDlg - - - 生成与后台设备模板一样的前置模板 - Generate a Fes template like the backstage device template - - - - 请输入前置模板属性 - Please enter attributes of Fes template - - - - 生成 - Generate - - - - 取消 - Cancel - - - - 提交事务失败,已回滚 - Commit transaction failed,rolled back - - - - 生成成功 - Generate success - - - - 消息 - Cancel - - - - KbdGenerateTempWizard - - - 从前置模板添加测点 - Add a point from the Fes template - - - - 下一步 - Next - - - - 取消 - Cancel - - - - 完成 - Complete - - - - 挑选前置模板 - Select Fes template - - - - 专业 - Subsystem - - - - 设备类型 - Device type - - - - 挑选模板测点 - Select template point - - - - 模拟量控制 - Analog control - - - - 数字量 - Digital point - - - - 模拟量 - Analog point - - - - 数字量控制 - Digital control - - - - 累积量 - Accuml point - - - - 枚举量 - Mix point - - - - 枚举量控制 - Mix control - - - - 全选 - Select all - - - - 反选 - Select inverse - - - - 此次修改失败,已启动回滚! - This modification failed,rollback has started! - - - - 所有 - All - - - - 消息 - Message - - - - KbdImportDevGroupDlg - - - 位置 - Location - - - - 专业 - Subsystem - - - - - RTU - RTU - - - - 遥控类型 - path - - - - 路径 - path - - - - 获取位置标签失败! - get location fail - - - - 获取专业标签失败! - get subsystem fail - - - - 获取RTU号失败! - get RTU fail - - - - 打开文件 - Open file - - - - 保存文件 - Save file - - - - 消息 - Message - - - - KbdImportDlg - - - 导入前置与后台映射表 - Import Fes and backstage mapping tables - - - - 浏览 - Browse - - - - 导入 - Import - - - - 取消 - Cancel - - - - 警告 - Warnning - - - - 导入未完成! - Import not completed! - - - - 选择要导入的文件 - Select the file want to import - - - - 预计耗时%1分钟,耗时仅供参考,实际情况可能有偏差! - Expected time consuming %1 minutes,Actual time may be biased! - - - - 消息 - Message - - - - KbdInstPluginDlg - - - 套件 - Plugin - - - - 位置 - Location - - - - 专业 - Subsystem - - - - 设备组自动创建RTU - Device group create RTU automatic - - - - RTU - RTU - - - - 通道 - channel - - - - 设备分组 - Device group - - - - 添加记录 - Add record - - - - 同时在所选设备组中批量实例 - Also batch instances in the selected device group - - - - 起止编号 - Starting and ending number - - - - 至 - To - - - - 获取通道号不成功! - Get channel number failed! - - - - 请先选择位置和专业 - Please select location and subsystem first - - - - 获取车站标签信息失败 - Get location tag name failed - - - - 添加设备组 - Add device group - - - - - 此次修改失败,已启动回滚! - This modification failed,rollback has started! - - - - 设备组自动创建通道及RTU - Device group create channel and RTU automatic - - - - - 批量添加 - Batch add - - - - 获取车站信息和专业信息失败 - Get station and subsystem message failed - - - - 设备组数量: - Device Group Number - - - - 消息 - Message - - - - 未选择要实例化的RTU - RTU not selected for instantiation - - - - 未选择要实例化的通道 - Not select channel! - - - - 未选择要实例化的设备组 - Device group not selected for instantiation - - - - 未选择套件 - Kits not selected - - - - 批量编号的起始数字大于结束数字 - The starting number of the batch number is greater than the ending number - - - - 获取通道号不成功 - Get channel number failed - - - - 创建RTU失败,已启动回滚! - create RTU failed! - - - - 实例化成功! - Instantiation success! - - - - KbdLockDefineWidget - - - - - - 消息 - Message - - - - 闭锁函数修改未提交,是否提交到数据库? - Interlock function modification is not submitted, whether submit to the database? - - - - 添加 - Add - - - - 删除 - Delete - - - - 闭锁函数定义 - Interlock fucntion definition - - - - 保存 - Save - - - - 请选中要添加的专业! - Please selct the subsystem to add! - - - - - 请选中要删除的闭锁函数! - Please select the interlock function to delete! - - - - - 写入数据库不成功 - Write to database failed - - - - 删除成功 - Delete success - - - - 保存成功 - Save success - - - - 此次修改失败,已启动回滚! - This modification failed,rollback has started! - - - - KbdLockParaWidget - - - 设备实例 - Device instance - - - - 位置: - Location: - - - - 专业: - Subsystem: - - - - 添加记录 - Add record - - - - 修改记录 - Modify record - - - - 删除记录 - Delete record - - - - Excel导出 - - - - - Excel导入 - - - - - 添加成功 - Add success - - - - 修改成功 - Modify success - - - - 写入数据库不成功 - Write into database failed - - - - 删除成功 - Delete success - - - - - - 消息 - Message - - - - 此次修改失败,已启动回滚! - This modification failed,rollback has started! - - - - KbdOutLineWidget - - - - 添加记录 - Add record - - - - - 删除记录 - Delete record - - - - 撤销更改 - Undo change - - - - 保存 - Save - - - - 删除失败 - Delete failed - - - - 删除成功 - Delete success - - - - - - 消息 - Message - - - - 此次修改失败,已启动回滚! - This modification failed,rollback has started! - - - - KbdPage - - - - 上一页 - Previous page - - - - - 下一页 - Next page - - - - 当前总页数是范围是1-%1,%2是非法值 - The current total number of pages is a range of 1-%1, and %2 is an illegal value - - - - 已到达首页 - Have arrived first page - - - - 已到达尾页 - Have arrived last page - - - - 消息 - Message - - - - KbdPageWidget - - - - 上一页 - Previous page - - - - - 下一页 - Next page - - - - 当前总页数是范围是1-%1,%2是非法值 - The current total number of pages is a range of 1-%1, and %2 is an illegal value - - - - 已到达首页 - Have arrived first page - - - - 已到达尾页 - Have arrived last page - - - - 消息 - Message - - - - KbdPointDlg - - - 位置 - Location - - - - 专业 - Subsystem - - - - 设备组 - Device group - - - - 点类型 - Point type - - - - 模拟量 - Analog point - - - - 数字量 - Digital point - - - - 累积量 - Accuml point - - - - 混合量 - Mix point - - - - KbdPointFromTextDlg - - - 添加设备模板测点 - Add device template points - - - - 模拟量 - Analog point - - - - 数字量 - Digital point - - - - 累计量 - Accuml point - - - - 混合量 - Mix point - - - - 全选 - Select all - - - - 反选 - Select inverse - - - - 事务提交失败,启动回滚 - Transaction submit failed,rollback has started - - - - 添加失败 - Add failed - - - - 消息 - Message - - - - KbdPointTypeDlg - - - 选择测点进行属性刷新 - Select points to refresh attributes - - - - 位置 - Location - - - - 专业 - Subsystem - - - - 设备组 - Device group - - - - 点类型 - Point type - - - - 累积量 - Accuml point - - - - 模拟量 - Analog point - - - - 数字量 - Digital point - - - - 混合量 - Mix point - - - - - 数据库链接错误 - Database link error - - - - 请选择要应用刷新的点 - Please select points to apply refresh - - - - 事务提交失败,启动回滚 - Transaction submit failed,rollback has started - - - - 添加失败 - Add failed - - - - 消息 - Message - - - - KbdPsc3000Dlg - - - 导入PCS3000数据 - Import PCS3000 data - - - - 取消 - Cancel - - - - 下一步 - Next - - - - 完成 - Complete - - - - - - - - - - - 消息 - Message - - - 本操作将覆盖此RTU %1下的所有设备数据 -以及套件对应的后台设备数据 -是否更新? - 本操作将覆盖此RTU %1下的所有设备数据 -以及套件对应的后台设备数据 -是否更新? - This operation will overwrite all device data under this RTU %1\r\nAnd the backsatege device data corresponding to the kit \r\nUpdate it? - - - - 导入成功 - Import success - - - - 确定取消导入? - Are you sure to cancel import? - - - - 套件构成 - Plugin composition - - - - 添加套件 - Add plugin - - - - - 请选择套件所在行进行删除 - Please select the row of the kit to delete - - - - 清除分配的设备 - Clear assigned devices - - - - 重置列表 - Reset list - - - - 套件 - Plugin - - - - 套件中的前置模板 - Fes templates in plugin - - - - 分配的前置设备 - Fes device sssigned - - - - 设备组名 - Device group name - - - - 设备组描述 - Device group description - - - - 设备列表 - Device list - - - - 前置设备标签 - Fes device tag name - - - - 前置设备描述 - Fes device decription - - - - 隐藏已分配的设备 - Hide assigned devices - - - - 隐藏已导入的设备 - Hide imported devices - - - - 所选设备分配至通用套件 - Selected device assigned to universal plugin - - - - 所选设备分配至指定套件 - Selected device assigned to designated plugin - - - - 选择责任区 - Select responsibility area - - - - 添加记录 - Add record - - - - 删除记录 - Delete record - - - - 撤销更改 - Undo change - - - - 保存 - Save - - - - - xlsx文件打开不成功! - Open xlsx file failed! - - - - - xlsx文件中无设备报表! - No device report in xlsx file! - - - - - 表格%1中没有%2列 - There is no %2 column in table %1 - - - - 重新写入xlsx文件不成功 - Rewrite into xlsx file failed - - - - 请勿重复分配设备:%1 - Please not re assign device:%1 - - - - 查询通道标签名失败! - Select channel tag_name failed! - - - - 查询通道下所有RTU标签名失败! - Select all RTU tag_name in one channel failed! - - - - 查询设备组总数失败! - Select device group count failed! - - - - - 请拖拽到分配的前置设备列 - Please drag to the assigned Fes device column - - - - 请勿重复分配 - Please not re assign - - - - 请选择要清除的分配前置设备列 - Please select the distribution Fes device column to be cleared - - - - 无法链接数据库 - Database link error - - - - 套件中不存在标签名为default的通用套件 - There is no universal plugin with the tag name default in the kit - - - - 没有构建任何套件 - Not build any plugin - - - - 存在空白套件行,请删除 - Blank kit line exists,please delete - - - - 分配前置设备列存在空白,请分配对应的设备 - There is a blank in the distribution Fes device column.Please assign the corresponding device - - - - 设备组标签存在空白,请填写 - The device group tag name is blank.Please fill in - - - - 设备组描述存在空白,请填写 - The device group decription is blank.Please fill in - - - - 分配的前置设备列,有重复分配的前置设备,请重新分配 %1 - The assigned Fes device column has duplicated Fes devices, please reassign %1 - - - - 存在重复的设备组名%1 - Duplicate device group name%1 - - - - 右边的PSC3000设备中,存在重复的前置设备标签%1 - In the PSC3000 device on the right,there is a duplicate Fes device tag name %1 - - - - 数据库错误,无法查询厂站信息 - Database error,unable to query location message - - - - 存在标签名冲突的前置设备 -%1 - The tag name conflicted in Fes device %1 - - - - 存在同一个通道内设备ID冲突的前置设备 -%1 - The Fes device ID conflicted in one channel %1 - - - - 存在前置模板冲突,请修改对应前置模板的标签名 -%1 - Fes template conflict, please modify the tag name of the corresponding Fes template %1 - - - 存在设备ID冲突的前置设备 -%1 - 存在设备ID冲突的前置设备 -%1 - The device ID conflicted in Fes device %1 - - - - 存在未分配的前置设备,是否继续导入? - There is an unassigned Fes device,continue importing? - - - - 未选择责任区 - Not select responsibility area - - - - KbdRelationFesDlg - - - 删除 - Delete - - - - 删除所有没有关联前置设备的行 - Delete all rows that do not have associated Fes devices - - - - 提示 - Prompt - - - - 关联 - Association - - - - 取消 - Cancel - - - - 后台设备标签 - Backstage device tag name - - - - 后台设备描述 - Backstage device description - - - - 前置设备标签 - Fes device tag name - - - - 前置设备描述 - Fes device description - - - - - - 消息 - Message - - - - 处理未完成,请等待 - Processing,please waiting - - - - 部分后台设备没有对应的前置设备,请填写完整 -或者删除没有关联前置设备的行 - 部分后台设备没有对应的前置设备,请填写完整 -或者删除没有关联前置设备的行 - Some backstage devices do not have corresponding Fes devices, please fill in the full\r\nor delete rows that are not associated with the Fes device - - - - KbdRtuListWidget - - - 请先选择要添加的车站与专业 - Please station and subsystem want to add - - - - 添加RTU - Add RTU - - - - - 获取通道号不成功 - Get channel number failed - - - - 添加失败 - Add failed - - - - 请选中要修改的RTU - Please select the RTU want to modify - - - - 修改RTU - Modify RTU - - - - 修改成功 - Modify success - - - - 消息 - Message - - - - 删除RTU将同时删除该RTU下的设备, -是否删除? - Delete RTU will delete devices belong to it at the same time,do it? - - - - 删除失败 - Delete failed - - - - 删除成功 - Delete success - - - - 请选中要复制的行 - Please select the line want to copy - - - - 复制 - Copy - - - - 复制数量 - Copy number - - - - 获取通道号不成功! - Get channel number failed! - - - - 复制失败 - Copy failed - - - - 复制成功 - Copy success - - - - KbdSelctLockParaDlg - - - 数字量出口 - Digital point exit - - - - 模拟量出口 - Analog point exit - - - - 在本车站,本专业中挑选具有相同描述的测点 - select the points with the same description at this station and subsystem - - - - <<删除 - <<Delete - - - - 该测点 -已挑选 - 该测点 -已挑选 - The point has been selected - - - - 消息 - Message - - - - 请先选中测点 - Please select point first - - - - KbdSelectDevDlg - - - 导出前置与后台映射表 - Export Fes and backstage mapping tables - - - - 所有设备 - All device - - - - 全选 - Select all - - - - 车站 - Station - - - - 专业 - Subsystem - - - - 添加>> - Add>> - - - - 删除<< - Delete<< - - - - 已选设备 - Devices selected - - - - 导出 - Export - - - - 取消 - Cancel - - - - 警告 - Warnning - - - - 导出未完成! - Export not complete! - - - - - 所有 - All - - - - 选择保存路径 - Select save path - - - - - - 消息 - Message - - - - 读取数据库不成功,导出设备失败! - Database read failed,export device failed! - - - - 无设备需要导出! - No device need export! - - - - 预计耗时%1分钟,耗时仅供参考,实际情况可能有偏差! - Expected time consuming %1 minutes,Actual time may be biased! - - - - KbdSplitter - - - - 添加记录 - Add record - - - - - 删除记录 - Delete record - - - - 修改记录 - Modify record - - - - 复制记录 - Copy record - - - - Excel导出 - ExcelExport - - - - Excel导入 - ExcelImport - - - - - - 消息 - Message - - - - 此次修改失败,已启动回滚! - This modification failed,rollback has started! - - - - KbdStateTextWidget - - - - 添加记录 - Add record - - - - - 删除记录 - Delete record - - - - 撤销更改 - Undo change - - - - 保存 - Save - - - - 请选中要添加的专业 - Please select subsystem to add - - - - 请选中要删除的数字量文本 - Please select digital text to delete - - - - 删除失败 - Delete failed - - - - 删除成功 - Delete success - - - - 请选中对应的数字量文本 - Please select the corresponding digital text - - - - - - 消息 - Message - - - - 此次修改失败,已启动回滚! - This modification failed,rollback has started! - - - - KbdTempGroupInstDlg - - - 位置 - Location - - - - 专业 - Subsystem - - - - 选择设备分组 - Select device group - - - - 添加记录 - Add record - - - - 请先选择位置和专业 - Please select station and subsystem first - - - - 获取车站标签信息失败 - Get station tag name message failed - - - - 添加设备组 - Add device group - - - - 此次修改失败,已启动回滚! - This modification failed,rollback has started! - - - - 请选择要实例化的设备组 - Please select the device group to instantiate - - - - 消息 - Message - - - - KbdWaitPrgDlg - - - 正在处理,请稍后.... - Processing,please waiting... - - - - KbdWidget - - - - - - 消息 - Message - - - - 此次修改失败,已启动回滚! - This modification failed,rollback has started! - - - - 回滚事务失败! - Rollback the transaction failed! - - - - LoginDlg - - - - 登录 - Login - - - 用户权限认证库调用失败 - User permission authentication library call failed - - - - 用户 - User - - - - 密码 - Password - - - - IP地址: - IP address: - - - - 端口 - Port - - - - 数据库类型 - Database type - - - - 数据库名称: - Database name: - - - 登录选项: - Login option: - - - 账号 - Account - - - 姓名 - Name - - - - Mysql - Mysql - - - - OraclSql - OraclSql - - - - 取消 - Cancel - - - 模型提交服务 - Model submit service - - - 直连数据库 - Direct database - - - 用户组 - User group - - - 权限接口错误 - Permission interface error - - - 程序分配内存出错 - Program allocation memory error - - - 无用户登录信息 - No user login message - - - 输入名称不存在 - The name you input not existed - - - 输入名称不唯一 - The name you input not unique - - - 不允许在该节点登录 - Login on this node is not allowed - - - 用户口令错误 - User password error - - - 用户已失效 - User has expired - - - 用户已锁定 - User locked - - - 用户不属于所选用户组 - The user not belong to the user group selected - - - 用户名或者密码错误 - The user name or password error - - - - 选择数据库失败 - Select database failed - - - - 数据库查询域失败 - Select domain failed - - - - 数据库中不存在任何域 - There isn't any domain in database - - - - 数据库查询位置失败 - Select location failed - - - - 数据库中不存在任何位置 - There isn't any location in database - - - - 数据库查询应用失败 - Select apply failed - - - - 数据库中不存在任何应用 - There isn't any apply in database - - - - 数据库查询专业失败 - Select subsystem failed - - - - 数据库中不存在任何专业 - There isn't any subsystem in database - - - 账号:%1 - account:%1 - - - 用户:%1 - User:%1 - - - - ,可能未进行系统建模! - May not do model system config! - - - 登陆失败 - Login failed - - - - 失败原因: - - Failed reason: - - - - 登录失败 - Login failed! - - - 获取用户组失败 - Get user group failed - - - - MainWindow - - - 建模工具 - Modeling tool - - - - 系统 - System - - - - 帮助 - Help - - - - 设置 - setting - - - - 前置测点检索器 - Fes point filter - - - - 后台测点检索器 - Backstage point filter - - - - 批量修改后台测点 - Batch modify backstage points - - - - 批量修改前置测点 - Batch modify Fes points - - - - 退出 - Exit - - - - 版本信息 - Version message - - - - 帮助文档 - Help document - - - - 属性面板主键可编辑 - Attributes panel keys unable to edit - - - - 消息 - Message - - - - 确定退出软件 - Are you sure to exit the software - - - - 设备建模 - Device Modeling - - - - 读取mainWindow.xml文件错误,请检查xml文件格式是否正确! - Read mainWindow.xml file error,please check if the xml file format is correct! - - - - 数据库错误 - Database error - - - - 数据库错误: - Database error: - - - - Model Studio - Model Studio - - - - 版本号:%1 - Version number:%1 - - - - MyAccumlModel - - - 描述 - Description - - - - 前置分量 - Fes offset - - - - 前置实例 - Fes instance - - - - 前置RTU - Fes RTU - - - - 消息 - Message - - - - 查找累积量数据出错 - Search accuml point data error - - - - MyAnalogModel - - - 描述 - Description - - - - 前置分量 - Fes offset - - - - 前置实例 - Fes instance - - - - 前置RTU - Fes RTU - - - - 输出分量 - Output offset - - - - 消息 - Message - - - - 查找模拟量数据出错 - Search analog point data error - - - - MyDigitalModel - - - 描述 - Description - - - - 前置分量1 - Fes offset1 - - - - 前置分量2 - Fes offset2 - - - - 前置分量3 - Fes offset3 - - - - 前置分量4 - Fes offset4 - - - - 前置分量5 - Fes offset5 - - - - 前置实例 - Fes instance - - - - 前置RTU - Fes RTU - - - - 输出分量1 - Output offset1 - - - - 输出分量2 - Output offset2 - - - - 输出分量3 - Output offset3 - - - - 输出分量4 - Output offset4 - - - - 输出分量5 - Output offset5 - - - - - - - - - - - - 消息 - Message - - - - 查找数字量数据出错 - Search digital point data error - - - - 查找数字量前置分量2出错 - Search digital point Fes component 2 error - - - - 查找数字量前置分量3出错 - Search digital point Fes component 3 error - - - - 查找数字量前置分量4出错 - Search digital point Fes component 4 error - - - - 查找数字量前置分量5出错 - Search digital point Fes component 5 error - - - - 查找数字量输出分量2出错 - Search digital point output component 2 error - - - - 查找数字量输出分量3出错 - Search digital point output component 3 error - - - - 查找数字量输出分量4出错 - Search digital point output component 4 error - - - - 查找数字量输出分量5出错 - Search digital point output component 5 error - - - - MyMixModel - - - 描述 - Description - - - - 前置分量 - Fes offset - - - - 前置实例 - Fes instance - - - - 前置RTU - Fes RTU - - - - 输出分量 - Output offset - - - - 消息 - Message - - - - 查找累积量数据出错 - Search accuml point data error - - - - ParsingDevFile - - - 打开失败: - open failed - - - - - - - - - - - - - - - - - - - - - 获取%1 信息失败! - Get %1 message failed! - - - - 设备点重复: - Device point reoeat! - - - - 数据写入失败,已启动回滚! - data write failed! - - - - 保存文件失败 - Save file Failed! - - - - 添加失败 - Add failed - - - - QObject - - - 消息 - Message - - - - 启动日志服务失败: - Start log service failed: - - - - SampleWidget - - - 模拟量 - Analog point - - - - 累积量 - Accuml point - - - - 数字量 - Digital point - - - - 混合量 - Mix point - - - - 原始数据与修改数据不一致,保存出错 - Raw data is inconsistent with modified data,save failed - - - - StatLinkInstDlg - - - - - - - - - - 消息 - Message - - - - 是否开始关联统计实例[ %1 ] -这将清空现有的参数组的子参数以及参数的测点绑定 - link [ %1 ]? - - - - - - 关联失败 - Association failed - - - - - - 关联成功 - Association success - - - - - - - 当前设备模板 - Current Dev Temp - - - - - - 当前统计关联 - Current Stat Link - - - - - 开始关联统计实例[ %1 ] -这将清空与[ %2 ]有关的参数组下的子参数和关联 -是否继续 - Link [ %1 ] and [ %2] -this will empty all args and rets in [ %2] -continue? - - - - - 开始关联统计实例[ %1 ] -这将清空[ %2 ]有关的关联和 -是否继续 - Link [ %1 ] and [ %2] -this will empty all args and rets in [ %2] -continue? - - - - 关联列表 - Link List - - - - 点绑定信息 - Bind info - - - - 开始关联 - link - - - - 取消 - Cancel - - - - 数据库链接错误 - Database link error - - - - - 删除 - Delete - - - - 添加设备到左侧列表 - add device to left list - - - - - 关联 - link - - - - 输入 - Input - - - - 输出 - Output - - - - 此次修改失败,已启动回滚! - This modification failed,rollback has started! - - - - StaticsWidget - - - - - - - 添加记录 - Add record - - - - - - - - 修改记录 - Modify record - - - - - - - - 删除记录 - Delete record - - - - - 输入 - Input - - - - - 输出 - Output - - - - - 参数编辑 - Parameter editing - - - - - - 保存 - Save - - - - 输入生成 - Input generating - - - - 输出生成 - Output generating - - - - 生成输入/输出并保存 - Generete input/output and save - - - - 函数体 - function body - - - - 车站 - Location - - - - 专业 - Subsystem - - - - 禁用所有统计实例 - Disable all statistical instances - - - - 输入参数关联 - InputPara Link - - - - 输出参数关联 - OutputPara Link - - - - - 添加 - Add - - - - - - - 删除 - Delete - - - - - - - 上移 - Move up - - - - - - - 下移 - Move down - - - - - - - 置顶 - Topping - - - - - - - 置底 - bottoming - - - - - - - 添加子参数 - Add sub parameter - - - - - 生成 - Generate - - - - 开始关联 - Start Link - - - - 复制关联 - Copy Link - - - - - - - - 添加失败 - Add failed - - - - - - - - - - 读取数据库失败 - Read database failed - - - - - - - - 删除失败 - Delete failed - - - - - 请先选择要添加的函数模板 - Please select the function template to add - - - - - 数据库链接不成功 - Database link failed - - - - - - 请选中要修改的条目 - Please select items to modify - - - - 请先选择要删除的函数模板 - Please select the function template to delete - - - - 复制关联-请输入新的关联名 - copy link - please enter new link name - - - - 标签名已存在,请修改 - tag_name exists, please use another - - - - 复制失败! - Copy failed! - - - - - 保存失败: - Save failed: - - - - - - 保存失败 - Save failed - - - - - - 保存成功 - Save success - - - - - 获取系统信息失败 - Get system message failed - - - - - - 修改失败 - Modify failed - - - - 禁用失败 - Disable failed - - - - 禁用成功 - Disable success - - - - - 请先选择前置设备 - Please select Fes device first - - - - - 添加成功 - Add success - - - - - 修改成功 - Modify success - - - - - 删除成功! - delete succeed - - - - - 无法读取数据库 - Read database failed - - - - - - - - - - 数据库链接错误 - Database link error - - - - 无法查询该数据类型 - Unable to query this data type - - - - - 无法查询位置和专业 - Unable to query location and subsystem - - - - - - - - - - - - - 请选中函数实例 - Please select function instance - - - - - - - 删除失败! - Delete failed! - - - - - 删除成功 - Delete success - - - - - - - - - - - 请选中对应函数 - Please select corresponding function - - - - - - - - - - - - - - - - - - - 请选中要移动的条目 - Please select the item to move - - - - - - - - - - - - - - - - - - - 数据库查询失败! - Database query failed! - - - - - - - 上移失败 - Move up failed - - - - - - - 下移失败 - Move down failed - - - - - - - - 置顶失败 - Topping failed - - - - - - 置底失败 - Bottoming failed - - - - 统计实例绑定数据异常 - fail to bind - - - - 暂无可用统计关联,请创建 - No avail link, please add one - - - - 请选择要绑定的计算实例 - Please select the compute instance to bind - - - - 数据格式不对 - Data format incorrect - - - - 消息 - Message - - - - %1 与 %2 进行绑定? - Bind %1 with %2? - - - - 绑定失败 - Bind failed - - - - 绑定成功 - Bind success - - - - - 无法识别拖拽数据的格式 - Unable to recognize the format of dragging data - - - - 请拖拽到正确的输入参数上 - Please drag to the correct input parameters - - - - 请拖拽到正确的输出参数上 - Please drag to the correct output parameters - - - - TempPluginWidget - - - 显示模式 - Display mode - - - - 套件模式 - Plugin mode - - - - - 前置模板 - Fes template - - - - - 后台模板 - Backstage template - - - - - 添加模板 - Add template - - - - 添加至套件中的所有后台设备 - Add to all backstage devices of plugin - - - - - 实例化模板 - Instantiated template - - - - - 复制模板 - Copy template - - - - - 修改模板 - Modify template - - - - - 删除模板 - Delete template - - - - - - 导入模板 - Import template - - - - - 导入PCS3000模板 - Import PCS3000 template - - - - - 从PCS3000配置中读取模板 - Read template from PCS3000 configuration - - - - - 导出模板 - Export template - - - - - - 刷新 - Refresh - - - - - 添加套件 - Add plugin - - - - - 实例化套件 - Instantiated plugin - - - - - 修改套件 - Modify plugin - - - - - 复制套件 - Copy plugin - - - - 删除套件 - Delete plugin - - - - 导入套件 - Import plugin - - - - 导出套件 - Export plugin - - - - 删除 - Delete - - - - 缺失配置目录 - Missing configuration directory - - - - 模板套件 - Template plugin - - - - - - 导入 - Import - - - - - - 导出 - Export - - - - - - - - - - - - - - 检测套件 - Detect plugin - - - - 编辑自动关联配置 - Edit auto-association - - - - 仅自动生成当前后台设备 - Only generate current backstage devices - - - - 全部自动生成 - All generate automatically - - - - 保存 - Save - - - - 模拟量 - Ana - - - - 数字量 - Dig - - - - 累积量 - Acc - - - - 混合量 - Mix - - - - 保存文件不成功 - Save file failed - - - - - 导出套件不成功! - Export plugin failed! - - - - - 导出套件后台设备不成功 - Export plugin's backstage device failed - - - - - 导出套件前置设备不成功 - Export plugin's Fes device failed - - - - - 导出套件模板测点ACC不成功 - Export plugin's template point ACC failed - - - - - 导出套件模板测点ANA不成功 - Export plugin's template point ANA failed - - - - - 导出套件模板测点DIG不成功 - Export plugin's template point DIG failed - - - - - 导出套件模板测点MIX不成功 - Export plugin's template point MIX failed - - - - 获取后台模板信息失败 - Get backstage template message failed - - - - 导出后台模板信息失败 - Export backstage template message failed - - - - - 导出ACC模板点不成功 - Export ACC template points failed - - - - - 导出ANA模板点不成功 - Export ANA template points failed - - - - - 导出DIG模板点不成功 - Export DIG template points failed - - - - - 导出MIX模板点不成功 - Export MIX template points failed - - - - 获取前置模板信息失败 - Get Fes template message failed - - - - 导出前置模板不成功 - Export Fes template failed - - - - - 导出前置设备模板点不成功 - Export Fes device template points failed - - - - - 导出前置模板定值不成功 - Export Fes template const values failed - - - - - 导出前置模板数据块不成功 - Export Fes template data block failed - - - - 文件打开不成功! - Open file failed! - - - - - 调用存储过程错误 - Call stored procedure failed - - - - 导入失败!事务已回滚!原因: - Import failed!ransaction rolled back!reason: - - - - 导入失败!原因:事务开启失败 - Import failed!reason:start transaction failed - - - - 缺失套件表xml - Missing plugin table xml - - - - excel文件中没有%1表 - No %1 table in excel file - - - - - 表格%1中没有%2列 - No %2 column in table %1 - - - - 套件名为空! - Plugin name is empty! - - - - - 数据块链接错误 - Database link error - - - - 存在同名套件%1,无法导入 - There is a plugin of the same name %1,import failed - - - - - - - - - 缺少xml配置:%1 - Missing xml configuration:%1 - - - - - - - - - - - - - - - - - - - - - 数据库链接错误 - Database link error - - - - 后台模板存在同名冲突 - %1 - 后台模板存在同名冲突 - %1 - Backstage template already conflicted with name %1 - - - - 前置模板存在同名冲突 - %1 - 前置模板存在同名冲突 - %1 - Fes template already conflicted with name %1 - - - 套件 %1 中的后台模板 %2 - 存在未关联的测点请关联 - 套件 %1 中的后台模板 %2 - 存在未关联的测点请关联 - Backstage template %2 in plugin %1 has unassociated points,please associate first - - - 套件 %1 中的前置模板 %2 - 存在规约参数1的值不为-1的点,请修改为-1 - 套件 %1 中的前置模板 %2 - 存在规约参数1的值不为-1的点,请修改为-1 - The Fes template %2 in plugin %1 has a point where the value of the specification parameter 1 is not -1,please change it to -1 - - - - - 参数长度有问题 - There is a problem with the parameter length - - - - - - 选择excel表格%1失败 - Select exel table %1 failed - - - - - - excel中不存在%1列 - No %1 column in excel file - - - - - tree文件夹下缺少autoRelation.json文件 - Missing autoRelation.json file in tree directory - - - - - - - json文件格式错误 - Json file format error - - - - 添加成功! - Add success! - - - - 请选中要修改的套件 - Please select the plugin want to modify - - - - 模板有错,请重新打开软件 - The template error,plase reopen the software - - - - 修改成功! - Modify success! - - - - 标签名已存在,请修改 - Tag name already exists,please modify - - - - 复制失败! - Copy failed! - - - - 复制成功! - Copy success! - - - - - 消息 - Message - - - - 是否删除套件? - kDo you want to remove the plugin? - - - - 请选中套件 - Please select a plugin - - - - 删除套件失败! - Delete plugin failed! - - - - 删除套件成功! - Delete plugin success! - - - - - 请先选中要添加的套件 - Please select plugin want to add - - - - 套件中已存在 %1 模板 - The plugin already existed %1 template - - - - 添加后台模板到套件不成功! - Add backstage template to plugin failed! - - - - 添加失败 - Add failed - - - - - 操作失败! - Operate failed! - - - - 是否删除套件中的模板? - Do you want to delete the template in plugin? - - - - - 关联失败! - Associate failed! - - - - - 关联成功!多分量测点和控制点,请手动填写多余分量或者控制关联信息 - Associate success!multi-component points and control points,please manually fill in excess components or control associated information - - - - 请选中套件控件中要自动关联的后台模板 - Please select the backstage template to be automatically associated in the kit control - - - - 检测通过 - Detect finish - - - - 套件导入 - Import plugin - - - - - 导入失败! -失败文件:%1 -失败原因:%2 - - Import failed!failed file:%1 failed reason:%2 - - - - - 导入成功 - Import success - - - - 请选中需要导出的套件 - Please select plugin need to export - - - - 保存套件 - Save plugin - - - - *.xlsx - *.xlsx - - - - 导出%1失败 -失败原因:%2 - Export %1 failed reason:%2 - - - - - 导出成功!导出路径: - %1 - Export success!exportpath:%1 - - - - 请选中要添加的前置模板 - Please select Fes template want to add - - - - TempWidget - - - 显示模式 - Display mode - - - - 详细模式 - Detail mode - - - - 表格模式 - Table mode - - - - 添加点模板 - Add template point - - - - 复制点模板 - Copy template point - - - - 删除点模板 - Delete template point - - - - 模板测点 - Template point - - - - 属性面板 - Attribute panel - - - - 勾选更改 - Check change - - - - 修改应用至对应设备 - Modify apply to corresponding device - - - - 保存 - Save - - - - 属性同步至实例设备 - Synchronize attributes to instance device - - - - 从文本库添加 - Add from text library - - - - 从前置模板添加 - Add from Fes template - - - - 添加应用至对应设备 - Add apply to corresponding device - - - - 删除应用至对应设备 - Delete apply to corresponding device - - - - 基础属性 - Base attributes - - - - 限值属性 - Limit attributes - - - - 前置属性 - Fes attributes - - - - 控制属性 - Control attributes - - - - - - 未选中设备模板! - Not select any device template! - - - - 添加失败 - Add failed - - - - - 导出模板不成功! - Export template failed! - - - - - 导出ACC模板点不成功 - Export ACC template point failed - - - - - 导出ANA模板点不成功 - Export ANA template point failed - - - - - 导出DIG模板点不成功 - Export DIG template point failed - - - - - 导出MIX模板点不成功 - Export MIX template point failed - - - - 保存文件不成功 - Save file failed - - - - 选中表格%1失败 - Select table %1 failed - - - - - - - 表格%1中没有%2列 - No column %2 in table %1 - - - - - 设备模板名为空! - Device template name is empty! - - - - 表格写入TAG_NAME不成功 - Table write into TAG_NAME failed - - - - 文件打开不成功! - Open file failed! - - - - 导入失败!事务已回滚!原因: - Import failed!transaction rolled back!reason: - - - - 导入失败!原因:事务开启失败 - Import failed!reason:start transaction failed - - - - excel文件中没有%1表 - No %1 table in excel file - - - - - - - 消息 - Message - - - - 存在同名模板%1,是否修改模板标签名? - There is template %1 of the same name, whether to modify the template tag name? - - - - 缺失模板xml配置 - Missing template xml configuration - - - - 请输入新的模板名称和描述 - Please input new template name and description - - - - - 存在同名模板%1,无法导入 - There is template %1 of the same name,unable to import - - - - 写入TAG_NAME失败 - Write into TAG_NAME failed - - - - 写入设备描述失败 - Write into device description failed - - - - - - - 添加成功! - Add success! - - - - 查询数据库失败 - Database query failed - - - - 查询设备信息失败 - Query device message failed - - - - - - 未选中模板点 - Not select template point - - - - 模板点信息有误,请重新打开软件 - Template point message mistaken,please reopen software - - - - 复制失败 - Copy failed - - - - 复制点失败! - Copy point failed! - - - - 是否删除后台模板测点? - Do you want to delete backstage template points? - - - - - 删除点失败! - Delete point failed! - - - - - 删除点成功! - Delete point success! - - - - - - - 保存失败: - Save failed: - - - - 保存失败 - Save failed - - - - 保存成功! - Save success! - - - - 提示 - Prompt - - - - 测点属性已经修改,是否保存? - The point attrubutes modified,are you save? - - - - 请选中要生成出口的测点模板 - Please select the point template need to generate exit - - - - 累计量无闭锁出口 - Accuml point without interlock exit - - - - - 数据库链接错误 - Database link error - - - - 此测点非控制点,无法生成闭锁出口 - This point not control point,unable generate interlock exit - - - - 批量生成闭锁出口 - Batch generate interlock exit - - - - 数据库出错 - Database error - - - - 添加闭锁出口失败 - Add interlock exit failed - - - - 添加闭锁出口成功! - Add interlock exit success! - - - - - - 修改成功 - Modify success - - - - 模板导入 - Import template - - - - 导入失败! -失败文件:%1 -失败原因:%2 - - Import failed! file:%1 reason:%2 - - - - 导入成功! - Import success! - - - - 请选中需要导出的设备模板 - Please select device template need to export - - - - 保存模板 - Save template - - - - *.xlsx - *.xlsx - - - - 导出%1失败 -失败原因:%2 - Export %1 failed reason:%2 - - - - 导出成功!导出路径: - %1 - Export success!export path:%1 - - - - 添加设备模板 - Add device template - - - - - 请选中要修改的设备模板 - Please select device template want to modify - - - - 模板有错,请重新打开软件 - Template error,please reopen software - - - - 修改设备模板 - Modify device template - - - - 修改成功! - Modify success! - - - - 是否删除后台模板? - Do you want to delete backstage template? - - - - - - - 请选中设备模板 - Please select device template - - - - 该模板 %1 存在已实例化的设备 - 是否强制删除此模板? - The template %1 has an instantiated device Is it mandatory to delete this template? - - - - 删除设备模板失败! - Delete device template failed! - - - - 删除设备模板成功! - Delete device template success! - - - - 请选中模板 - Please select template - - - - - 模板信息有误,请重新打开软件 - Template message error,please reopen software - - - - 复制设备模板 - Copy device template - - - - 标签名已存在,请修改 - Tag name existed,please modify - - - - 复制失败! - Copy failed! - - - - 复制成功! - Copy success! - - - - 请先保存添加的测点 - Please save points added first - - - - 请选中要修改的模板点 - Please select template points to modify - - - - 未勾选任何属性 - Not select any attribute - - - - - 选中要修改的设备 - Select device want to modify - - - - - 更新成功! - Update success! - - - - 更新失败! - Update failed! - - - - 添加点失败! - Add point failed! - - - - 添加成功 - Add success - - - - 请先保存修改 - Please save modify first - - - - 该列不可编辑 - The clumn unable to edit - - - - 该列是主键,不可编辑 - The column unable to edit,due to as key - - - - 开始执行批量菜单 - Start executing the batch menu - - - - 结束执行批量菜单 - Executing the batch menu end - - - - 修改失败 - Modify failed - - - - Worker - - - 调用%1存储过程失败!参数:%2 - Calling %1 stored procedure failed! Argument: %2 - - - - - - - - 提交事务失败!启动回滚 - Transaction submit failed,rollback has started - - - - 创建设备出错 - Create device error - - - - 实例化失败! - Instantiation failed! - - - - 批量处理错误! - Batch process error! - - - - 提交事务失败,已回滚 - Transaction submit failed,rollback has started - - - - 实例化成功 - Instantiation success - - - - 关联前置设备成功! - Associated with the Fes device successfully! - - - - - - - - 缺少配置文件%1 - Missing configuration file%1 - - - - 文件写入不成功,导出失败! - Write into file failed,export failed! - - - - 导出成功!文件保存在:%1 - Export success!file save at:%1 - - - - - 文件格式不对! - File format incorrect! - - - - 文件打开不成功! - Open file failed! - - - - 缺少必要的配置文件! - Missing necessary configuration files! - - - - - - - - 数据库操作:清空表格失败! - Database operation:clear table failed! - - - - - 导入失败!事务已回滚!原因: - Import failed!transaction rolled back!reason: - - - - - 导入失败!原因:事务开启失败 - Import failed! reason:start transaction failed - - - - 导入成功! - Import success! - - - 关联失败! -后台设备与前置设备数量不一致 - Association failed!the number of backstage devices and Fes devices inconsistent - - - - - 关联失败!,失败设备%1 - Association failed!failed device%1 - - - - - 关联失败!启动回滚,失败设备%1 - Association failed!start roll back,failed device %1 - - - - 关联成功! - Association success! - - - - 关联失败!失败设备组:%1 - Association failed!failed device group:%1 - - - - 关联失败!原因:提交事务失败!启动回滚 - Association failed!reason:transaction submit failed,rollback has started - - - - 关联完毕! - Association complete! - - - - 批量实例化设备组数据错误 - Batch instantiated device group data error - - - - 数据库链接出错 - Database link error - - - - 不存在前置设备%1 - No Fes device %1 - - - - - - - 获取后台点与前置点的关联sql执行失败 - The sql of relation back point and fes point execute failed - - - - - - - 获取一条后台记录失败 - Get one back record failed - - - - - - - 获取前置相关信息失败 - Get Fes message failed - - - - 获取表%1所有字段名失败 - Get table %1 all columns failed - - - - 插入记录失败 - Insert record failed - - - - 开始导入数据CSV:%1 RTU:%2 - Start import data CSV:%1 RTU:%2 - - - - 未检测到任何设备模板 - No device templates detected - - - - 设备 - Device - - - - - 累积量 - Accuml point - - - - - 模拟量 - Analog point - - - - - 数字量 - Digital point - - - - - 数字量控制 - Digital control point - - - - 保护定值 - Protected const value - - - - 调用存储过程失败! - Call stored procedure failed! - - - - 导入结束CSV:%1 - Import end CSV:%1 - - - - %1 中的表的列数和描述数量不一致! - The number of column and description inconsistent in %1 table! - - - - 获取%1 信息失败! - Get %1 message failed! - - - - 导入失败:没有%1表! - Import failed:no %1 table! - - - - - 导入失败:数据库导入失败! - Import failed:database import failed! - - - - - 存储过程实例化设备组失败!%1 - Stored procedure instantiated device group failed!%1 - - - - 套件数据格式不对! - Plugin data format is wrong! - - - - %1文件打开不成功! - Open file %1 failed! - - - - 未选择导入的RTU! - Not select imported RTU! - - - - - - - - - - 清空参数表%错误! - Clear parameters table % error! - - - - 执行SQL语句失败 - Execution of SQL statement failed - - - - 关联失败!数据库链接错误! - Association failed! database link error! - - - - 关联失败!不存在相同名称的前置设备%1,请手动关联! - Association failed! there is no fes device %1 of the same name,please associate it manually! - - - - 关联失败!存在多个相同名称的前置设备%1,请手动关联 - Association failed! there are multiple Fes device %1 with the same name,please associate it manually - - - - 错误:没有%1表! - Error:not table %1! - - - - 错误:没有此列%1 - Error:no column %1 - - - - 生成前置模板模型失败! - Generate Fes template model failed! - - - - 删除前置模板%1失败 - Delete Fes template model %1 failed - - - - 模拟量控制 - Analog control point - - - - kbdFirstInstWizardPage - - - 添加61850设备 - - - - - 修改61850设备 - - - - - 删除61850设备 - - - - - 校验模型文件 - - - - - 选择配置文件 - - - - - 路径: - - - - - 打开CID文件 - - - - - 打开61850配置文件 - - - - - kbdInst61850DevWizard - - - 61850设备实例化向导 - - - - - 无可实例化设备! - - - - - 保存设备类型失败! - - - - - 删除设备成功! - - - - - 创建通道失败! - - - - - 创建RTU失败! - - - - - 创建设备组失败! - - - - - - 设置报告控制块失败 - - - - - 实例化成功! - Instantiation success! - - - - - 获取车站信息和专业信息失败 - Get station and subsystem message failed - - - - 获取通道号不成功! - Get channel number failed! - - - - - 数据库链接出错 - Database link error - - - - - - 此次修改失败,已启动回滚! - - - - - 获取通道号不成功 - Get channel number failed - - - - - 获取车站标签信息失败 - - - - - 传递实例化设备失败! - - - - - 消息 - - - - - kbdRcbDialog - - - 控制报告块定义 - - - - - 控制报告块参数 - - - - - 控制报告块配置参数 - - - - - 触发条件 TrgOps - - - - - 触发定义 OptFilelds - - - - - 名称 - - - - - 描述 - Description - - - - 数据集 - - - - - 报告ID - - - - - Conf Rev - - - - - 缓冲时间(ms) - - - - - 启用缓冲 - - - - - Client Number(0-99) - - - - - 报告实例号 - - - - - 报告使能 - - - - - 总召周期(ms) - - - - - 报告使能循环周期 - - - - - 完整周期(ms) - - - - - kbdSecondInstWizardPage - - - 位置: - Location: - - - - 专业: - Subsystem: - - - - 责任区: - - - - - 刷新 - Refresh - - - - ICD文件名 - - - - - IEDName - - - - - IP地址 - - - - - 模板组 - - - - - 添加 - Add - - - - 删除 - Delete - - - - 保存 - Save - - - - 修改配置文件 - - - - - 设备组标签 - - - - - 设备组描述 - Device group description - - - - 前置设备标签 - Fes device tag name - - - - 前置设备描述 - - - - - 通道标签 - - - - - 通道描述 - - - - - RTU标签 - - - - - RTU描述 - - - - - - 错误:%1 不存在 - - - - - 获取车站信息和专业信息失败 - Get station and subsystem message failed - - - - 错误:后台设备%1 不存在 - - - - - 错误:前置设备%1 不存在 - - - - - 错误:后台设备%1 已经存在 - - - - - 错误:前置设备%1 已经存在 - - - - - 前置模板61850路径校验失败,%1 : %2 - - - - - 打开文件失败: - - - - - 数据库查询错误 - Database query error - - - - kbdThirdInstWizardPage - - - IEDName - - - - - 只显示已勾选项 - - - - - 保护类型 - - - - - 是否启用录波 - - - - - 录波路径 - - - - - 录波召唤时间(秒) - - - - - 报告块 - - - - - 1:是 - - - - - 0:否 - - - - diff --git a/platform/src/tools/model_studio/studio.ico b/platform/src/tools/model_studio/studio.ico index a91ae219008530ca390033e9ba70bcef3905ca14..63b5c58a0cd0a5b670fba74b1e79ba94f868f765 100644 GIT binary patch literal 4286 zcmeHLv2GJV5PcQ}1wxL5l-4Qf;13)rAHXNTA3zBO@)}B8v?#%AIowu`hX9FGi9vwli_;vss0(dDRCLD{XT|Z8I zFP^Q$8xohx5sqgW%57yn!nw}1VW$He_;{yyZS8e!!Oge97ToI?w=RC2?>};1E(R6B zb%7iDX2O%?zHFL5^Okw-^s8>l zbv*7WLyvJTz6k&8eH+t0&oIz=TB9?wFN?Ev&BSq=_K9J&-|vwBoHb&{*>(z#=UL`E z857i``fLo__MA(u)mh4|@4j{dKbS`ztFeJEjwxftjCm>i$A0Z^;$L$3Zs&Pkt9xSX zv*WZa*lVuLUf6M0r+Cjk*ZPmH?wM1m74c02f6e{0QO(PF*@(Z&S8><*gwKVk?hE5k z^DM+QPyde$A2b*CgS^7{JkRyooGZpmX}gac^I-hdn#cOAW6b+>RKs=o=dz})MeFis zhBxs#7Q&C7SHB;IU#>CEpZ2!3^`3wKjJ~^#Eu?zWAlm}tJRsN7)3wqI zbTaBanP)&xSiY%OxY3sb>_aAv)X*nQmusinYQ1>#hyz%|ZuLOV*7~A#S~dT2Uc7xQ z2Ux?!JP8~ibG^5v*IvAPJOyYIGU#(eM7x<^O0Gxge!l~_LpY@e0|dB3Q0d{Iz#W3h zk8FWE1eIq_2)qd{`j&iNFxnt%&`T}QSeUy8O=}L7pPm%B4H?v%o``N9#al=7z(L&x zSs&YP2O19=d0)HHcR@RUsyrVO*g#hI4Cdv>c(2yUW3+?1K57~d^CY}827k$<%8OG1 z8z9{?m{(s9vqmIMSVraLX##A(=w1JKo;4zA!ZNC_h6%6%qxag^3k33jWv&bd>W;1n z%c#CNLx2rzc$a9v1}zH9671+co%0Ce_}L2yDPZEmdC_PpmCX5%2)}qnulkUAW$BW1n~9{4Y)8^F()u zzhqMF!#RON@X&LCh3jogrhaJOA8zH@(5Prc>#vcuVct}CM+J_8o*T?t_m@)pj0a>SJvV*KZE5(WjXo(XW|3KSuTWF^+>elBJt`h?pL$J9^e+FmWEF}qL*Y+V{ua8 zh`5c#2@A-GHGd$r9{6C4>_=-E+)p#Omqy2Hu34H&;ChpQy`S)X@>}qcOx(*a3b>bV z3m5Bz?XH*SF35eY6A*v9lmgr#NcM~D8^He=4|$fS)ZV;Odt~I9AIvMO%*)f9RcbfM zPY3$Zw_mB^9TodorkGb&>(o_jWtCzvqS*AZQiISO=<<1@RN{(Kah!MIt8$mU;YOH& F*l#^bEtdcQ diff --git a/platform/src/tools/model_system_config/icons/systemConfig.ico b/platform/src/tools/model_system_config/icons/systemConfig.ico index 20aefc137b1d38e33ada762524f6f62d340fe8f7..9bfacd7be4cad7de0e3755984c15d5468bacc9e9 100644 GIT binary patch literal 4286 zcmeHKJ8r^25Pj*85(%V8X+xO~Zjju91LOc)A&O0uTeu`Q;0P%wC?G^pE%}A9~F5w`m>c#?SSoh2CGsJFNdBEHsx@+hMtio)yIIHpb*@hOvwAT=JtU zZ(?#zMy|1{?kh%3Icwv*##$SyeudN4HFzWcCc>QNtm=g7d(QR_@VBo&^Ztgny1vY3 zD_?%z$Fz`r?qyZ`0ru5A&P=LC^7A)g`95WOrqpp!znQM!PUmksAFMN49zVTz(V8#+|BT~IFWuJ% t`_A^K@Ap&tKfM{JT6REROKH9Lf7lIreHILQ(30acM_<|&KWi?2{s)2=U_k%? literal 4286 zcmb`EUyB??6vbAP9{hqED4?&>x{cLOr;^#91zkpZ4f|r=VgK7Vb3g$q^ff4f1Q`f< z*Y$hfVgI|gGGKsq;5&g6v*=lk^;oi)?-1kJ|NiX)&?zzSCw~6H5AP^YbZDF|C;U7Q zPYMj6Q=)m^J_pn73{VfjZ-yBO3SfHX*JZ0``)`h`gPUXOVQ#(d3I7D-+`}nB3Howe zt>n4pmP!Fdu<{MypExr$YSrcCsEwnAvS+RT_N7^K`w~Tv!J~i%b--^kQ|Kn(;a#lB zcK@Bry18?iHefpMY=e(;Dj-1$3|N;v={)npyYEs2n)kz}BfOkf0SVGI{<6!OK{JQ< z-lGVLb|%hi^D5*@Fmdv2Pd)41ze0zb$>5O@J~zw2uiE#%e)_R}*^gczP z;9+9C)|2yY|3OBzlJoObdb$|}4-?~UJ^o&MM@H%99R2bEMWEneV!Z6B>^}d5He1Pg za4kD}aLoV;z*^c-1w8(2?eDdB%-2qa=Kj&I*Ci-G4alKFov_C~xaW@Udb#F#);TZX z)6UrwJp=6AY%%{Z0R?EiI2GW2#kHMtPxLjQ4z77VWe?5-%mM2La2D(BZ_?fE?0+*4 zZ|KFt8wSjQa(At(;YmO{%Q|Waa!>;5A%mtmy?vi{es@PLc6Z3Zpw>XH-M_n&LYsgY zsDL}$SI@hB>``v^@uQDQKpqp z&~yCT$0?uyHP1nt2lUX~N6HdifsJuRU3cm!33YR2wleQjD5c U#regHV!S*jru5^0Xn#ci0@1+UCIA2c diff --git a/platform/src/tools/model_system_config/kbdchainwidget.cpp b/platform/src/tools/model_system_config/kbdchainwidget.cpp index d8b93f03..e9f2aade 100644 --- a/platform/src/tools/model_system_config/kbdchainwidget.cpp +++ b/platform/src/tools/model_system_config/kbdchainwidget.cpp @@ -5,12 +5,11 @@ #include "CustomWidget/kbdtreeview.h" #include "CustomWidget/kbdsqltreemodel.h" #include "../model_common/common.h" -#include +#include "pub_widget/MessageBox.h" #include "kbdtabledatamgr.h" #include #include #include -#include #include #include "mainwindow.h" @@ -90,19 +89,15 @@ void KbdChainWidget::onExport(bool isShowMsg) return; QString filePath = Common::getSysModelPath() + "/" + model->getTableName() + ".xml"; - QDir tempDir(filePath) ; - filePath = tempDir.absolutePath(); + bool success = model->exportFile(filePath); if(isShowMsg) { if(success) - { - - QMessageBox::information(this,tr("消息"),tr("导出配置成功!\n导出路径:")+filePath); - } + N_MessageBox::information(this,tr("消息"),tr("导出配置成功!\n导出路径:")+filePath); else - QMessageBox::information(this,tr("消息"),tr("导出失败")); + N_MessageBox::information(this,tr("消息"),tr("导出失败")); } } diff --git a/platform/src/tools/model_system_config/kbdnodewidget.cpp b/platform/src/tools/model_system_config/kbdnodewidget.cpp index c25197a8..2b4ee5ec 100644 --- a/platform/src/tools/model_system_config/kbdnodewidget.cpp +++ b/platform/src/tools/model_system_config/kbdnodewidget.cpp @@ -5,7 +5,7 @@ #include "CustomWidget/kbdtreeview.h" #include "CustomWidget/kbdsqltreemodel.h" #include "../model_common/common.h" -#include +#include "pub_widget/MessageBox.h" #include "kbdtabledatamgr.h" #include #include @@ -14,7 +14,7 @@ #include "mainwindow.h" #include "kbdpropertydlg.h" #include "kbdpropertypanel.h" -#include + KbdNodeWidget::KbdNodeWidget(bool isHorizontal, QWidget *parent) : QWidget(parent) { initLayout(isHorizontal); @@ -73,6 +73,7 @@ void KbdNodeWidget::onAddRow() } KbdPropertyDlg dlg(false,this); + dlg.setWindowTitle(tr("新增节点")); dlg.panel()->setDisplayRow(model,model->rowCount()); dlg.panel()->setPropertyValue(m_columnNameInTree,value); if(dlg.exec() == QDialog::Rejected) @@ -108,13 +109,13 @@ void KbdNodeWidget::onAddRow() void KbdNodeWidget::onRemoveRow() { - if(QMessageBox::No == QMessageBox::information(this,tr("消息"), + if(N_MessageBox::No == N_MessageBox::information(this,tr("消息"), tr( - "部署信息表,数据库部署配置\r\n" - "中相应的节点的值将被置空,\r\n" - "数据库节点配置中相应节点的配置将删除\r\n" - "是否删除所选记录?"), - QMessageBox::Yes,QMessageBox::No)) + "部署信息表,数据库部署\r\n" + "配置中相应的节点的值将\r\n" + "被置空,数据库节点配置\r\n" + "中相应节点的配置将删除"), + N_MessageBox::Yes,N_MessageBox::No)) return; KbdTableModel *model = qobject_cast(m_table->model()); @@ -263,6 +264,7 @@ void KbdNodeWidget::onModifyRow() return; const ColMgrDataList& modelCols = model->getHeadCols(); KbdPropertyDlg dlg(false,this); + dlg.setWindowTitle(tr("修改节点信息")); dlg.panel()->setDisplayRow(model,index.row()); dlg.panel()->setPropertyEditable("NODE_NAME",true); QStringList oldDatas = model->getRowData(index.row()); @@ -410,71 +412,26 @@ void KbdNodeWidget::onSave() { } -void KbdNodeWidget::inExport() -{ - KbdTableModel *model = KbdTableDataMgr::getInstance()->createModel(m_tableCfgFile); - QString strPath = QFileDialog::getOpenFileName(this,tr("打开文件"),Common::getSysModelPath(),"*.xlsx"); - if(strPath.isEmpty()) - return; - QFile file(strPath); - if(!file.open(QIODevice::ReadOnly)) - { - QMessageBox::information(this,tr("消息"),tr("文件打开失败!")); - return; - } - - QXlsx::Document xlsx(&file); - QString err = model->importExcel(xlsx); - if(!err.isEmpty()) - { - QMessageBox::information(this,tr("消息"),err); - return; - } - - QMessageBox::information(this,tr("消息"),tr("导入成功")); -} void KbdNodeWidget::onExport(bool isShowMsg) { - KbdTableModel *model = KbdTableDataMgr::getInstance()->createModel(m_tableCfgFile); + KbdTableModel *model = KbdTableDataMgr::getInstance()->createModel(m_tableCfgFile); if(model == NULL) return; QString filePath = Common::getSysModelPath() + "/" + model->getTableName() + ".xml"; - QDir tempDir(filePath) ; - filePath = tempDir.absolutePath(); + bool success = model->exportFile(filePath); if(isShowMsg) { if(success) - QMessageBox::information(this,tr("消息"),tr("导出配置成功!\n导出路径:")+filePath); + N_MessageBox::information(this,tr("消息"),tr("导出配置成功!\n导出路径:")+filePath); else - QMessageBox::information(this,tr("消息"),tr("导出失败")); + N_MessageBox::information(this,tr("消息"),tr("导出失败")); } } -void KbdNodeWidget::onExportExcel(bool isShowMsg) -{ - KbdTableModel *model = KbdTableDataMgr::getInstance()->createModel(m_tableCfgFile); - QString filePath = Common::getSysModelPath() + "/" + model->getTableName() + ".xlsx"; - QDir tempDir(filePath) ; - filePath = tempDir.absolutePath(); - if(model == NULL) - return; - QXlsx::Document xlsx; - if(!model->exportExcel(xlsx,model->getTableName()).isEmpty()) - { - QMessageBox::information(this,tr("消息"),tr("导出节点配置失败")); - } - if(!xlsx.saveAs(filePath)) - QMessageBox::information(this,tr("消息"),tr("保存文件不成功")); - else - { - QMessageBox::information(this,tr("消息"),tr("导出配置成功!\n导出路径:")+filePath); - } -} - void KbdNodeWidget::initLayout(bool isHorizontal) { if(isHorizontal) @@ -517,20 +474,20 @@ void KbdNodeWidget::onTreeClick(const QModelIndex &index) void KbdNodeWidget::onStartTransactionError(const QString&erroStr) { - QMessageBox::information(this,tr("消息"),erroStr); + N_MessageBox::information(this,tr("消息"),erroStr); } void KbdNodeWidget::onMsg(const QString &text) { - QMessageBox::information(this,tr("消息"),text); + N_MessageBox::information(this,tr("消息"),text); } void KbdNodeWidget::onCommitError() { - QMessageBox::information(this,tr("消息"),tr("此次修改失败,已启动回滚!")); + N_MessageBox::information(this,tr("消息"),tr("此次修改失败,已启动回滚!")); } void KbdNodeWidget::onRollbackError() { - QMessageBox::information(this,tr("消息"),tr("回滚事务失败!")); + N_MessageBox::information(this,tr("消息"),tr("回滚事务失败!")); } diff --git a/platform/src/tools/model_system_config/kbdnodewidget.h b/platform/src/tools/model_system_config/kbdnodewidget.h index 655620cc..ab35ba36 100644 --- a/platform/src/tools/model_system_config/kbdnodewidget.h +++ b/platform/src/tools/model_system_config/kbdnodewidget.h @@ -26,8 +26,6 @@ public slots: void onUndo(); void onSave(); void onExport(bool isShowMsg); - void onExportExcel(bool isShowMsg); - void inExport(); private: void initLayout(bool isHorizontal); diff --git a/platform/src/tools/model_system_config/kbdrttablewidget.cpp b/platform/src/tools/model_system_config/kbdrttablewidget.cpp index 1ff6fd3a..19c2912c 100644 --- a/platform/src/tools/model_system_config/kbdrttablewidget.cpp +++ b/platform/src/tools/model_system_config/kbdrttablewidget.cpp @@ -3,7 +3,7 @@ #include #include "kbdtable.h" #include "../model_common/common.h" -#include +#include "pub_widget/MessageBox.h" #include "kbdtabledatamgr.h" #include #include "mainwindow.h" @@ -69,11 +69,11 @@ void KbdRtTableWidget::onAddRow() void KbdRtTableWidget::onRemoveRow() { - if(QMessageBox::No == QMessageBox::information(this,tr("消息"), + if(N_MessageBox::No == N_MessageBox::information(this,tr("消息"), tr( "实时库列模式中的表将同时删除\r\n" "是否删除?"), - QMessageBox::Yes,QMessageBox::No)) + N_MessageBox::Yes,N_MessageBox::No)) return; KbdTableModel *model = qobject_cast(m_table->model()); @@ -200,9 +200,9 @@ void KbdRtTableWidget::onExport(bool isShowMsg) if(isShowMsg) { if(success) - QMessageBox::information(this,tr("消息"),tr("导出配置成功!\n导出路径:")+filePath); + N_MessageBox::information(this,tr("消息"),tr("导出配置成功!\n导出路径:")+filePath); else - QMessageBox::information(this,tr("消息"),tr("导出失败")); + N_MessageBox::information(this,tr("消息"),tr("导出失败")); } } @@ -221,20 +221,20 @@ void KbdRtTableWidget::initLayout() void KbdRtTableWidget::onStartTransactionError(const QString&erroStr) { - QMessageBox::information(this,tr("消息"),erroStr); + N_MessageBox::information(this,tr("消息"),erroStr); } void KbdRtTableWidget::onMsg(const QString &text) { - QMessageBox::information(this,tr("消息"),text); + N_MessageBox::information(this,tr("消息"),text); } void KbdRtTableWidget::onCommitError() { - QMessageBox::information(this,tr("消息"),tr("此次修改失败,已启动回滚!")); + N_MessageBox::information(this,tr("消息"),tr("此次修改失败,已启动回滚!")); } void KbdRtTableWidget::onRollbackError() { - QMessageBox::information(this,tr("消息"),tr("回滚事务失败!")); + N_MessageBox::information(this,tr("消息"),tr("回滚事务失败!")); } diff --git a/platform/src/tools/model_system_config/logindlg.cpp b/platform/src/tools/model_system_config/logindlg.cpp index 4ad79f0b..61c7b657 100644 --- a/platform/src/tools/model_system_config/logindlg.cpp +++ b/platform/src/tools/model_system_config/logindlg.cpp @@ -5,7 +5,7 @@ #include #include #include "kbdtabledatamgr.h" -#include +#include "pub_widget/MessageBox.h" #include #include #include @@ -19,7 +19,7 @@ #include "common.h" #include "tools/model_common/common.h" -LoginDlg::LoginDlg(QWidget *parent) : QDialog(parent) +LoginDlg::LoginDlg(QWidget *parent) : CustomDialog(parent) { setWindowTitle(tr("登录")); initLayout(); @@ -37,7 +37,7 @@ void LoginDlg::initLayout() QSettings settings(Common::getModelConfigPath() + "/ModelConfig.ini",QSettings::IniFormat); m_leUser = new QLineEdit(settings.value("MySQL/login/user","root").toString(),this); - m_lePasswd = new QLineEdit(settings.value("MySQL/login/psw","kbdct@0755").toString(),this); + m_lePasswd = new QLineEdit(settings.value("MySQL/login/psw",EMS_DEFAULT_PASSWD).toString(),this); m_lePasswd->setEchoMode(QLineEdit::PasswordEchoOnEdit); m_leIp = new QLineEdit(settings.value("MySQL/login/ip","127.0.0.1").toString(),this); m_lePort = new QLineEdit(settings.value("MySQL/login/port","3306").toString(),this); @@ -49,7 +49,7 @@ void LoginDlg::initLayout() m_comboxDbType->addItem(tr("KingBase"),iot_dbms::EDbType::DB_KINGBASE); connect(m_comboxDbType,&QComboBox::currentTextChanged,this,&LoginDlg::onDbTypeChange); - m_leDbName = new QLineEdit(settings.value("MySQL/login/dbname","iscs6000").toString(),this); + m_leDbName = new QLineEdit(settings.value("MySQL/login/dbname",EMS_DEFAULT_DATABASE).toString(),this); m_comboxDbType->setCurrentText(settings.value("login/dbtype","MySQL").toString()); m_btLoad = new QPushButton(tr("登录"),this); @@ -109,9 +109,9 @@ void LoginDlg::onDbTypeChange(const QString &text) m_leUser->setText(user); m_lePort->setText(port); - m_lePasswd->setText(settings.value(text + "/login/psw","kbdct@0755").toString()); + m_lePasswd->setText(settings.value(text + "/login/psw",EMS_DEFAULT_PASSWD).toString()); m_leIp->setText(settings.value(text + "/login/ip","127.0.0.1").toString()); - m_leDbName->setText(settings.value(text + "/login/dbname","iscs6000").toString()); + m_leDbName->setText(settings.value(text + "/login/dbname",EMS_DEFAULT_DATABASE).toString()); } void LoginDlg::onLoad() @@ -119,27 +119,27 @@ void LoginDlg::onLoad() // 非空判断 if ( m_leUser->text() == "" ) { - QMessageBox::critical(0,"error",tr("用户不能为空")); + N_MessageBox::critical(0,"error",tr("用户不能为空")); return; } if ( m_lePasswd->text() == "" ) { - QMessageBox::critical(0,"error",tr("密码不能为空")); + N_MessageBox::critical(0,"error",tr("密码不能为空")); return; } if ( m_leIp->text() == "" ) { - QMessageBox::critical(0,"error",tr("IP地址不能为空")); + N_MessageBox::critical(0,"error",tr("IP地址不能为空")); return; } if ( m_lePort->text() == "" ) { - QMessageBox::critical(0,"error",tr("端口不能为空")); + N_MessageBox::critical(0,"error",tr("端口不能为空")); return; } if ( m_leDbName->text() == "" ) { - QMessageBox::critical(0,"error",tr("数据库名称不能为空")); + N_MessageBox::critical(0,"error",tr("数据库名称不能为空")); return; } @@ -168,7 +168,7 @@ void LoginDlg::onLoad() { KbdTableDataMgr::getInstance()->onSysQuit(); proc.close(); - QMessageBox::information(this,tr("登录失败"),tr("失败原因:\n")+err); + N_MessageBox::information(this,tr("登录失败"),tr("失败原因:\n")+err); } QSettings settings(Common::getModelConfigPath() + "/ModelConfig.ini",QSettings::IniFormat); diff --git a/platform/src/tools/model_system_config/logindlg.h b/platform/src/tools/model_system_config/logindlg.h index 71fa937f..d8144d86 100644 --- a/platform/src/tools/model_system_config/logindlg.h +++ b/platform/src/tools/model_system_config/logindlg.h @@ -5,15 +5,14 @@ #pragma execution_character_set("utf-8") #endif -#include +#include "pub_widget/CustomDialog.h" class QLabel; class QLineEdit; class QPushButton; class QComboBox; - -class LoginDlg : public QDialog +class LoginDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_system_config/main.cpp b/platform/src/tools/model_system_config/main.cpp index 1aef29a2..cebbc2f0 100644 --- a/platform/src/tools/model_system_config/main.cpp +++ b/platform/src/tools/model_system_config/main.cpp @@ -1,6 +1,6 @@  #include -#include +#include "pub_widget/MessageBox.h" #include #include #include @@ -9,9 +9,11 @@ #include "../model_common/common.h" #include "kbdtabledatamgr.h" #include "logindlg.h" +#include "pub_widget/PubWidgetInit.h" #include "SingleApplication.h" #include "mainwindow.h" +#include "pub_utility_api/FileStyle.h" int main(int argc, char *argv[]) { @@ -19,11 +21,36 @@ int main(int argc, char *argv[]) QApplication::addLibraryPath("./sqldrivers"); SingleApplication a(argc, argv); - QCoreApplication::setOrganizationName("KbdSoft.ZHJK"); - QCoreApplication::setOrganizationDomain("KbdTech.com"); + QCoreApplication::setOrganizationName("IOT"); + QCoreApplication::setOrganizationDomain("iot.com"); QCoreApplication::setApplicationName("ISCS6000.tools"); - qApp->setStyleSheet(Common::getStyleSheetPath("modelStudio.qss")); - qApp->setFont(QFont("Microsoft YaHei",10)); + + QString qss = QString(); + std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss","zh","light"); + + QFile qssfile1(QString::fromStdString(strFullPath)); + qssfile1.open(QFile::ReadOnly); + if (qssfile1.isOpen()) + { + qss += QLatin1String(qssfile1.readAll()); + qssfile1.close(); + } + + strFullPath = iot_public::CFileStyle::getPathOfStyleFile("modelStudio.qss","zh","light"); + QFile qssfile2(QString::fromStdString(strFullPath)); + qssfile2.open(QFile::ReadOnly); + if (qssfile2.isOpen()) + { + qss += QLatin1String(qssfile2.readAll()); + qssfile2.close(); + } + + if (!qss.isEmpty()) + { + qApp->setStyleSheet(qss); + } + +// qApp->setFont(QFont("Microsoft YaHei",10)); a.setWindowIcon(QIcon(":/systemConfig.ico")); @@ -36,7 +63,7 @@ int main(int argc, char *argv[]) } catch (std::exception& e) { - QMessageBox::information(NULL,QObject::tr("消息"),QObject::tr("启动日志服务失败:")+QString(e.what())); + N_MessageBox::information(NULL,QObject::tr("消息"),QObject::tr("启动日志服务失败:")+QString(e.what())); return 0; } @@ -51,6 +78,8 @@ int main(int argc, char *argv[]) qtTranslator = new QTranslator; qtTranslator->load(Common::getTranslatePath("qt_zh_CN.qm")); a.installTranslator(qtTranslator); + + iot_public::installTranslator(Common::getLanguage().toStdString()); //登录 LoginDlg dlg; int ret = 0; @@ -64,7 +93,7 @@ int main(int argc, char *argv[]) QDialog* wid = static_cast(Common::createPluginWidget(nullptr,"system_config_plugin",ptrVec)); if(wid != nullptr) { - if(QMessageBox::information(nullptr,QObject::tr("消息"),QObject::tr("是否进入系统建模配置向导界面?"),QMessageBox::Yes,QMessageBox::No) == QMessageBox::Yes) + if(N_MessageBox::information(nullptr,QObject::tr("消息"),QObject::tr("是否进入系统建模配置向导界面?"),N_MessageBox::Yes,N_MessageBox::No) == N_MessageBox::Yes) wid->exec(); } settings.setValue("SystemConfigWizard/isShow","false"); diff --git a/platform/src/tools/model_system_config/mainwindow.cpp b/platform/src/tools/model_system_config/mainwindow.cpp index 64120cac..e914f032 100644 --- a/platform/src/tools/model_system_config/mainwindow.cpp +++ b/platform/src/tools/model_system_config/mainwindow.cpp @@ -3,34 +3,58 @@ #include "sysconfigwidget.h" #include #include "kbdtabledatamgr.h" -#include +#include "pub_widget/MessageBox.h" #include "../model_common/common.h" #include #include #include #include #include - +#include +#include "pub_widget/MainTitle.h" +#include "pub_widget/WorkFrame.h" #define _VERSION_SYSCFG "V1.00" bool MainWindow::m_hasModify = false; MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), + CustomUiMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); + setWindowTitle(tr("系统建模")); + QGridLayout *gridLayout = new QGridLayout(); + gridLayout->setContentsMargins(5,0,0,0); + gridLayout->setSpacing(0); + QWidget* title = new QWidget(ui->centralWidget); + gridLayout->addWidget(title, 0, 0, 1, 2); + + WorkFrame* m_workframe = new WorkFrame(this); + gridLayout->addWidget(m_workframe, 1, 1, 1, 1); + m_configWidget = new SysConfigWidget(this); - setCentralWidget(m_configWidget); - connect(ui->action_4,SIGNAL(triggered(bool)),this,SLOT(onConfigWizard())); - connect(ui->action_5,SIGNAL(triggered(bool)),this,SLOT(close())); + m_configWidget->setMouseTracking(true); + + QGridLayout* gridLayout_1 = new QGridLayout(); + gridLayout_1->setContentsMargins(0,0,0,0); + gridLayout_1->setSpacing(0); + gridLayout_1->addWidget(m_configWidget,0,0,1,1); + m_workframe->setLayout(gridLayout_1); + + ui->centralWidget->setLayout(gridLayout); + + setTitleWidget(title); + + +// connect(ui->action_4,SIGNAL(triggered(bool)),this,SLOT(onConfigWizard())); +// connect(ui->action_5,SIGNAL(triggered(bool)),this,SLOT(close())); QLabel * labelMsg = new QLabel(this); statusBar()->addPermanentWidget(labelMsg); labelMsg->setText(KbdTableDataMgr::getInstance()->getDbInfo()); connect(KbdTableDataMgr::getInstance(),SIGNAL(dbError(const QString &)),this,SLOT(onDbError(const QString &))); - connect(ui->action,SIGNAL(triggered(bool)),this,SLOT(onVersion())); + // connect(ui->action,SIGNAL(triggered(bool)),this,SLOT(onVersion())); } MainWindow::~MainWindow() @@ -42,18 +66,18 @@ void MainWindow::closeEvent(QCloseEvent *event) { if(hasModify()) { - int nRtn = QMessageBox::information(this,tr("消息"),tr("是否导出全部配置?"),QMessageBox::Yes,QMessageBox::No,QMessageBox::Cancel); - if(nRtn == QMessageBox::Yes) + int nRtn = N_MessageBox::information(this,tr("消息"),tr("是否导出全部配置?"),N_MessageBox::Yes,N_MessageBox::No,N_MessageBox::Cancel); + if(nRtn == N_MessageBox::Yes) { if(Common::isSysRun()) { - QMessageBox::information(this,tr("消息"),tr("系统正在运行,无法导出配置")); + N_MessageBox::information(this,tr("消息"),tr("系统正在运行,无法导出配置")); event->ignore(); return; } m_configWidget->onExportAll(); } - else if(nRtn == QMessageBox::Cancel) + else if(nRtn == N_MessageBox::Cancel) { event->ignore(); return; @@ -64,12 +88,12 @@ void MainWindow::closeEvent(QCloseEvent *event) } void MainWindow::onDbError(const QString &err) { - QMessageBox::information(this,tr("错误提示"),tr("错误详情:")+err); + N_MessageBox::information(this,tr("错误提示"),tr("错误详情:")+err); } void MainWindow::onVersion() { - QMessageBox::about(this,tr("系统建模"),tr("版本号:%1").arg(Common::getSoftwareVersion())); + N_MessageBox::about(this,tr("系统建模"),tr("版本号:%1").arg(Common::getSoftwareVersion())); } void MainWindow::onConfigWizard() diff --git a/platform/src/tools/model_system_config/mainwindow.h b/platform/src/tools/model_system_config/mainwindow.h index f6b6cf44..ce410caa 100644 --- a/platform/src/tools/model_system_config/mainwindow.h +++ b/platform/src/tools/model_system_config/mainwindow.h @@ -2,6 +2,7 @@ #define MAINWINDOW_H #include +#include "pub_widget/CustomMainWindow.h" class QTranslator; class SysConfigWidget; @@ -9,7 +10,7 @@ namespace Ui { class MainWindow; } -class MainWindow : public QMainWindow +class MainWindow : public CustomUiMainWindow { Q_OBJECT diff --git a/platform/src/tools/model_system_config/mainwindow.ui b/platform/src/tools/model_system_config/mainwindow.ui index ce463cd0..7533bdc2 100644 --- a/platform/src/tools/model_system_config/mainwindow.ui +++ b/platform/src/tools/model_system_config/mainwindow.ui @@ -17,32 +17,6 @@ 系统配置 - - - - 0 - 0 - 1280 - 22 - - - - - 系统 - - - - - - - - 帮助 - - - - - - diff --git a/platform/src/tools/model_system_config/model_system_config.pro b/platform/src/tools/model_system_config/model_system_config.pro index 84d4ac42..8b667a47 100644 --- a/platform/src/tools/model_system_config/model_system_config.pro +++ b/platform/src/tools/model_system_config/model_system_config.pro @@ -39,6 +39,7 @@ LIBS += -lmodel_table LIBS += -lpub_logger_api LIBS += -llog4cplus -lpub_utility_api LIBS += -lmodel_excel +LIBS += -lpub_widget SOURCES += \ main.cpp \ diff --git a/platform/src/tools/model_system_config/model_system_config_EN.ts b/platform/src/tools/model_system_config/model_system_config_EN.ts index da06385c..8e3d0baf 100644 --- a/platform/src/tools/model_system_config/model_system_config_EN.ts +++ b/platform/src/tools/model_system_config/model_system_config_EN.ts @@ -4,21 +4,21 @@ KbdChainWidget - - + + 消息 - Export failed + - + 导出配置成功! 导出路径: - Export configuration success! export path: + - + 导出失败 - Message + @@ -26,60 +26,57 @@ 添加失败 - Add failed + - - - - + + + + 消息 - Message + + 部署信息表,数据库部署配置 中相应的节点的值将被置空, 数据库节点配置中相应节点的配置将删除 是否删除所选记录? - 部署信息表,数据库部署配置 -中相应的节点的值将被置空, -数据库节点配置中相应节点的配置将删除 -是否删除所选记录? - Deployment information table,the value of the corresponding node is empty in database deployment configuration,the configuration of the corresponding node in the database node configuration will delete do you want to delete the selected record? + 删除失败 - Delete failed + 修改失败 - Modify success + 导出配置成功! 导出路径: - Export configuration success! export path: + 导出失败 - Export failed + - + 此次修改失败,已启动回滚! - This modification failed,rollback has started! + - + 回滚事务失败! - Transaction rolled back failed! + @@ -87,123 +84,155 @@ 添加失败 - Add failed + - - - - - - + + + + + + 消息 - Message + 实时库列模式中的表将同时删除 是否删除? - 实时库列模式中的表将同时删除 -是否删除? - Tables in memory library column mode will be deleted at the same time,do it? + - + 删除失败 - Delete failed + - + 修改失败 - Modify failed + - + 导出配置成功! 导出路径: - Export configuration success! export path: + - + 导出失败 - Export failed + - + 此次修改失败,已启动回滚! - This modification failed,rollback has started! + - + 回滚事务失败! - Transaction rolled back failed! + LoginDlg - - + + 登录 - Login - - - - 用户 - User - - - - 密码 - Password - - - - IP地址: - IP address: - - - - 端口 - Port + - 数据库类型 - Database type + 用户 + + 密码 + + + + + IP地址: + + + + + 端口 + + + + + 数据库类型 + + + + 数据库名称: - Database name: - - - - Mysql - Mysql - - - - OraclSql - OraclSql + + MySQL + + + + + Oracle + + + + + OpenGauss + + + + + KingBase + + + + 取消 - Cancel + - + + 用户不能为空 + + + + + 密码不能为空 + + + + + IP地址不能为空 + + + + + 端口不能为空 + + + + + 数据库名称不能为空 + + + + 登录失败 - 登陆失败 - Login failed + - + 失败原因: - Failed reason: + @@ -211,81 +240,78 @@ 系统配置 - System configuration + - - 系统 - System - - - - 帮助 - Help - - - + 退出 - Exit + - + 版本 - Version + - + + 配置向导 + + + + + 系统建模 - System Modeling + - - + + 消息 - Message + - + 是否导出全部配置? - Whether to export all configurations? + - + 系统正在运行,无法导出配置 - Unable to export configuration for system is running + - - 数据库错误 - Database error + + 错误提示 + - - 请检查数据库链接!错误详情: - Please check database link!error detail: + + 错误详情: + - - Model System Config - Model System Config - - - + 版本号:%1 - Version number:%1 + QObject - + + 消息 - Message + - + 启动日志服务失败: - Start log service failed: + + + + + 是否进入系统建模配置向导界面? + @@ -293,110 +319,118 @@ 添加记录 - Add record - - - - 删除记录 - Delete record + + 删除记录 + + + + 撤销更改 - Undo change - - - - 保存 - Save - - - - 导出配置 - Export configuration + - 导出全部配置 - Export all configuration + 保存 + - 重置全部 - Reset All + + 导出配置 + - + 重置节点 - Reset node + - - - - - - - - - + + 配置向导 + + + + + + + - - - - + + + + + + + + + + + 消息 - Message + - - + + 此次修改失败,已启动回滚! - This modification failed,rollback has started! + - - + + 部署失败 - Deploy failed + - - + + 系统正在运行,无法导出配置 - Unable to export configuration for system is running + - + 导出配置成功! 导出路径: - Export configuration success! export path: + - + 导出失败 - Export failed + - + 确定重置所有配置数据? - Are you sure to reset all configure data? + - + 确定重置节点配置? - Are you sure to reset node configure? + - + + 导出失败,多个数据库节点只能使用同一种数据库类型 + + + + + 节点%1,非本机节点,不能配置本地回环地址 + + + + 导出文件不成功! 不成功表格: - Export file failed! failed table: + - + 导出完成! -导出路径: - Export complete!export path: +导出路径:系统安装目录下data\sys_model_info + diff --git a/platform/src/tools/model_system_config/sysconfigwidget.cpp b/platform/src/tools/model_system_config/sysconfigwidget.cpp index efbe9654..0912040e 100644 --- a/platform/src/tools/model_system_config/sysconfigwidget.cpp +++ b/platform/src/tools/model_system_config/sysconfigwidget.cpp @@ -8,7 +8,7 @@ #include "kbdtabledelegate.h" #include #include -#include +#include "pub_widget/MessageBox.h" #include #include "CustomWidget/kbdsqltreemodel.h" #include @@ -51,19 +51,25 @@ void SysConfigWidget::initLayout() QVBoxLayout *vLayout1 = new QVBoxLayout; vLayout1->setMargin(0); QToolBar *bar = new QToolBar(rightWidget); - bar->setIconSize(QSize(24,24)); - bar->addAction(QIcon(":/icons/icons/new.png"),tr("添加记录"),this,SLOT(onAddRow())); - bar->addAction(QIcon(":/icons/icons/delete.png"),tr("删除记录"),this,SLOT(onRemoveRow())); - m_actUndo = bar->addAction(QIcon(":/icons/icons/undo.png"),tr("撤销更改"),this,SLOT(onUndo())); - m_actSave = bar->addAction(QIcon(":/icons/icons/save.png"),tr("保存"),this,SLOT(onSave())); + QAction* act = nullptr; + act = bar->addAction(tr("添加记录"),this,SLOT(onAddRow())); + bar->widgetForAction(act)->setObjectName("icon_add"); + act = bar->addAction(tr("删除记录"),this,SLOT(onRemoveRow())); + bar->widgetForAction(act)->setObjectName("icon_delete"); + m_actUndo = bar->addAction(tr("撤销更改"),this,SLOT(onUndo())); + bar->widgetForAction(m_actUndo)->setObjectName("icon_undo"); + m_actSave = bar->addAction(tr("保存"),this,SLOT(onSave())); + bar->widgetForAction(m_actSave)->setObjectName("icon_save"); bar->addSeparator(); - EXport=bar->addAction(QIcon(":/icons/icons/Excel-export.png"),tr("导出EXCL"),this,SLOT(onExport())); - Inport=bar->addAction(QIcon(":/icons/icons/Excel-Impor.png"),tr("导入EXCL"),this,SLOT(inPort())); - EXport->setVisible(false); - Inport->setVisible(false); - bar->addAction(QIcon(":/icons/export.png"),tr("导出配置"),this,SLOT(onExportAll())); + //bar->addAction(tr("导出配置"),this,SLOT(onExport())); + act = bar->addAction(tr("导出配置"),this,SLOT(onExportAll())); + bar->widgetForAction(act)->setObjectName("icon_export"); //bar->addAction(tr("重置全部"),this,SLOT(onReset())); - bar->addAction(QIcon(":/icons/icons/revoke.png"),tr("重置节点"),this,SLOT(onResetNode())); + act = bar->addAction(tr("重置节点"),this,SLOT(onResetNode())); + bar->widgetForAction(act)->setObjectName("icon_revoke"); + + act = bar->addAction(tr("配置向导"),this,SLOT(onWizard())); + bar->widgetForAction(act)->setObjectName("icon_wizard"); m_stack = new QStackedWidget(rightWidget); vLayout1->addWidget(bar); @@ -128,17 +134,17 @@ void SysConfigWidget::deploy() if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) { - QMessageBox::information(this,tr("消息"),tr("此次修改失败,已启动回滚!")); + N_MessageBox::information(this,tr("消息"),tr("此次修改失败,已启动回滚!")); } } else { - QMessageBox::information(this,tr("消息"),retStr); + N_MessageBox::information(this,tr("消息"),retStr); } if(!success) { - QMessageBox::information(this,tr("消息"),tr("部署失败")); + N_MessageBox::information(this,tr("消息"),tr("部署失败")); } } @@ -270,19 +276,41 @@ bool SysConfigWidget::createDbNode() QSettings settings(Common::getModelConfigPath() + "/ModelConfig.ini",QSettings::IniFormat); QString dbtype = settings.value("login/dbtype","MySQL").toString(); QString dbTypeCode; + QString dbDefaultPort = "3306"; if(dbtype == "Oracle") + { dbTypeCode = "1"; + dbDefaultPort = "1521"; + } else if(dbtype == "MySQL") + { dbTypeCode = "2"; + dbDefaultPort = "3306"; + } else if(dbtype == "OpenGauss") + { dbTypeCode = "3"; + dbDefaultPort = "5432"; + } else if(dbtype == "KingBase") + { dbTypeCode = "4"; + dbDefaultPort = "54321"; + } else + { dbTypeCode = "0"; + } + /* 为以后搜索方便,保留此注释 EMS_DEFAULT_DATABASE + * 当前逻辑是使用的配置文件中存储的数据库名、用户名、密码,如果找不到采用默认值 + * 由于在登录成功时后存储当前连接的参数,所以此处不修改应该没问题 + */ sql = "insert into sys_model_dbconfig_node (NODE_NAME,DB_TYPE,DB_SERVICE_NAME,USER_NAME,USER_PASSWORD,NIC_CUR_ID,DB_NAME,DB_HOST_PRIOR,IS_DB_SWITCH,IS_DIRECT_ACCESS,DB_PORT)" \ - "values ('" + QHostInfo::localHostName() + "',"+ dbTypeCode+ ",'" + settings.value(dbtype + "/login/dbname","iscs6000").toString() + "','root','kbdct@0755','1','0','1','1','1'," + settings.value(dbtype + "/login/port","iscs6000").toString()+");"; + "values ('" + QHostInfo::localHostName() + "',"+ dbTypeCode+ ",'" + + settings.value(dbtype + "/login/dbname",EMS_DEFAULT_DATABASE).toString() + + "','root','"+EMS_DEFAULT_PASSWD+"','1','0','1','1','1'," + + settings.value(dbtype + "/login/port",dbDefaultPort).toString()+");"; success = KbdTableDataMgr::getInstance()->executeOnly(sql); if(!success) { @@ -319,10 +347,9 @@ void SysConfigWidget::onTreeClick(const QModelIndex &index) if(!index.isValid()) return; QString strClickTable = index.data(Common::ClickRole).toString(); + if(strClickTable == CLK_NODE_CFG) { - EXport->setVisible(true); - Inport->setVisible(true); m_actUndo->setVisible(false); m_actSave->setVisible(false); m_stack->setCurrentIndex(2); @@ -330,8 +357,6 @@ void SysConfigWidget::onTreeClick(const QModelIndex &index) } else if(strClickTable == CLK_RT_TABLE) { - EXport->setVisible(false); - Inport->setVisible(false); m_actUndo->setVisible(false); m_actSave->setVisible(false); m_stack->setCurrentIndex(3); @@ -339,8 +364,6 @@ void SysConfigWidget::onTreeClick(const QModelIndex &index) } else if(strClickTable.contains(".json")) { - EXport->setVisible(false); - Inport->setVisible(false); m_actUndo->setVisible(true); m_actSave->setVisible(true); m_stack->setCurrentIndex(1); @@ -348,24 +371,13 @@ void SysConfigWidget::onTreeClick(const QModelIndex &index) } else if(strClickTable.contains(".xml")) { - EXport->setVisible(false); - Inport->setVisible(false); - if(strClickTable.contains("sys_model_location_info")) - { - EXport->setVisible(true); - Inport->setVisible(true); - } m_actUndo->setVisible(true); m_actSave->setVisible(true); m_stack->setCurrentIndex(0); m_table->setModel(KbdTableDataMgr::getInstance()->createModel(strClickTable)); } else - { - EXport->setVisible(false); - Inport->setVisible(false); m_stack->setCurrentIndex(m_stack->count() - 1); - } } void SysConfigWidget::onAddRow() @@ -460,66 +472,58 @@ void SysConfigWidget::onSave() void SysConfigWidget::onExport() { - //if(Common::isSysRun()) - // { - // QMessageBox::information(this,tr("消息"),tr("系统正在运行,无法导出配置")); - // return; - //} + if(Common::isSysRun()) + { + N_MessageBox::information(this,tr("消息"),tr("系统正在运行,无法导出配置")); + return; + } QDir dir(Common::getSysModelPath()); if(!dir.exists()) { dir.mkpath(Common::getSysModelPath()); } + int index = m_stack->currentIndex(); - QString strClickTable = m_tree->currentIndex().data(Common::ClickRole).toString(); - if(index == 0||strClickTable.contains("sys_model_location_info")) + if(index == 0) { KbdTableModel *model = qobject_cast(m_table->model()); - QString filePath = Common::getSysModelPath() + "/" + model->getTableName() + ".xlsx"; - QDir tempDir(filePath) ; - filePath = tempDir.absolutePath(); if(model == NULL) return; - QXlsx::Document xlsx; - if(!model->exportExcel(xlsx,model->getTableName()).isEmpty()) - { - QMessageBox::information(this,tr("消息"),tr("导出节点配置失败")); - } - if(!xlsx.saveAs(filePath)) - QMessageBox::information(this,tr("消息"),tr("保存文件不成功")); - else - { - QMessageBox::information(this,tr("消息"),tr("导出配置成功!\n导出路径:")+filePath); - } + QString filePath = Common::getSysModelPath() + "/" + model->getTableName() + ".xml"; + + if(model->exportFile(filePath)) + N_MessageBox::information(this,tr("消息"),tr("导出配置成功!\n导出路径:")+filePath); + else + N_MessageBox::information(this,tr("消息"),tr("导出失败")); + } + else if(index == 1) + { + m_widgetChain->onExport(true); } -// else if(index == 1) -// { -// m_widgetChain->onExport(true); -// } else if(index == 2) { - m_nodeCfgWidget->onExportExcel(true); + m_nodeCfgWidget->onExport(true); + } + else if(index == 3) + { + m_rtTableWidget->onExport(true); } -// else if(index == 3) -// { -// m_rtTableWidget->onExport(true); -// } } void SysConfigWidget::onReset() { - int ret =QMessageBox::information(this,tr("消息"),tr("确定重置所有配置数据?"),QMessageBox::Yes,QMessageBox::No); - if(ret == QMessageBox::Yes) + int ret =N_MessageBox::information(this,tr("消息"),tr("确定重置所有配置数据?"),N_MessageBox::Yes,N_MessageBox::No); + if(ret == N_MessageBox::Yes) deploy(); } void SysConfigWidget::onResetNode() { - int ret =QMessageBox::information(this,tr("消息"),tr("确定重置节点配置?"),QMessageBox::Yes,QMessageBox::No); - if(ret == QMessageBox::Yes) + int ret =N_MessageBox::information(this,tr("消息"),tr("确定重置节点配置?"),N_MessageBox::Yes,N_MessageBox::No); + if(ret == N_MessageBox::Yes) { bool success = false; QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); @@ -529,70 +533,34 @@ void SysConfigWidget::onResetNode() if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) { - QMessageBox::information(this,tr("消息"),tr("此次修改失败,已启动回滚!")); + N_MessageBox::information(this,tr("消息"),tr("此次修改失败,已启动回滚!")); } } else { - QMessageBox::information(this,tr("消息"),retStr); + N_MessageBox::information(this,tr("消息"),retStr); } if(!success) { - QMessageBox::information(this,tr("消息"),tr("部署失败")); + N_MessageBox::information(this,tr("消息"),tr("部署失败")); } } } -void SysConfigWidget::inPort() +void SysConfigWidget::onWizard() { - if(QMessageBox::information(this,tr("消息"),tr("导入操作会直接修改数据库,只能添加或者修改数据库,需确保数据正确有效,否则会导致配置错误!") - ,tr("已知悉风险"),tr("取消"),"")) - return; - int index = m_stack->currentIndex(); - if(index == 2) - { - m_nodeCfgWidget->inExport(); - onSave(); - m_nodeCfgWidget->reload(Common::getTreePath("location.json")); - return; - } - KbdTableModel *oldModel = qobject_cast(m_table->model()); - if(oldModel) - { - QString strPath = QFileDialog::getOpenFileName(this,tr("打开文件"),Common::getSysModelPath(),"*.xlsx"); - if(strPath.isEmpty()) - return; - - QFile file(strPath); - if(!file.open(QIODevice::ReadOnly)) - { - QMessageBox::information(this,tr("消息"),tr("文件打开失败!")); - return; - } - - QXlsx::Document xlsx(&file); - QString err = oldModel->importExcel(xlsx); - if(!err.isEmpty()) - { - QMessageBox::information(this,tr("消息"),err); - return; - } - - QMessageBox::information(this,tr("消息"),tr("导入成功")); - } - else - QMessageBox::information(this,tr("消息"),tr("控件未加载数据")); - onSave(); - QString strClickTable = m_tree->currentIndex().data(Common::ClickRole).toString(); - m_table->setModel(KbdTableDataMgr::getInstance()->createModel(strClickTable)); + QVector ptrVec; + QDialog* wid = static_cast(Common::createPluginWidget(this,"system_config_plugin",ptrVec)); + if(wid != nullptr) + wid->exec(); } void SysConfigWidget::onExportAll() { if(Common::isSysRun()) { - QMessageBox::information(this,tr("消息"),tr("系统正在运行,无法导出配置")); + N_MessageBox::information(this,tr("消息"),tr("系统正在运行,无法导出配置")); return; } @@ -610,7 +578,7 @@ void SysConfigWidget::onExportAll() if(setDbType.size() > 1) { - QMessageBox::information(this,tr("消息"),tr("导出失败,多个数据库节点只能使用同一种数据库类型")); + N_MessageBox::information(this,tr("消息"),tr("导出失败,多个数据库节点只能使用同一种数据库类型")); return; } @@ -628,7 +596,7 @@ void SysConfigWidget::onExportAll() { if(node != QHostInfo::localHostName() && isUse.split(":").first() == "1") { - QMessageBox::information(this,tr("消息"),QString(tr("节点%1,非本机节点,不能配置本地回环地址")).arg(node)); + N_MessageBox::information(this,tr("消息"),QString(tr("节点%1,非本机节点,不能配置本地回环地址")).arg(node)); return; } } @@ -664,9 +632,9 @@ void SysConfigWidget::onExportAll() if(!model->exportFile(Common::getSysModelPath() + "/" + model->getTableName() + ".xml")) { - int ret =QMessageBox::information(this,tr("消息"),tr("导出文件不成功!\n不成功表格:") + model->getTableName() - + "\n是否继续导出其他配置?",QMessageBox::Yes,QMessageBox::No); - if(ret == QMessageBox::Yes) + int ret =N_MessageBox::information(this,tr("消息"),tr("导出文件不成功!\n不成功表格:") + model->getTableName() + + "\n是否继续导出其他配置?",N_MessageBox::Yes,N_MessageBox::No); + if(ret == N_MessageBox::Yes) continue; else break; @@ -678,6 +646,6 @@ void SysConfigWidget::onExportAll() Common::reloadKeepalived(); - QMessageBox::information(this,tr("消息"),tr("导出完成!\n导出路径:系统安装目录下data\\sys_model_info")); + N_MessageBox::information(this,tr("消息"),tr("导出完成!\n导出路径:系统安装目录下data\\sys_model_info")); } diff --git a/platform/src/tools/model_system_config/sysconfigwidget.h b/platform/src/tools/model_system_config/sysconfigwidget.h index 3774e134..1943637a 100644 --- a/platform/src/tools/model_system_config/sysconfigwidget.h +++ b/platform/src/tools/model_system_config/sysconfigwidget.h @@ -44,14 +44,11 @@ private: QAction *m_actUndo; QAction *m_actSave; - QAction *EXport; - QAction *Inport; //表格控件 KbdTable *m_table; KbdChainWidget *m_widgetChain; KbdNodeWidget *m_nodeCfgWidget; KbdRtTableWidget *m_rtTableWidget; - private slots: void onTreeClick(const QModelIndex &index); void onAddRow(); @@ -61,7 +58,7 @@ private slots: void onExport(); void onReset(); void onResetNode(); - void inPort(); + void onWizard(); public slots: void onExportAll(); diff --git a/platform/src/tools/model_system_config/systemConfig.ico b/platform/src/tools/model_system_config/systemConfig.ico index 20aefc137b1d38e33ada762524f6f62d340fe8f7..9bfacd7be4cad7de0e3755984c15d5468bacc9e9 100644 GIT binary patch literal 4286 zcmeHKJ8r^25Pj*85(%V8X+xO~Zjju91LOc)A&O0uTeu`Q;0P%wC?G^pE%}A9~F5w`m>c#?SSoh2CGsJFNdBEHsx@+hMtio)yIIHpb*@hOvwAT=JtU zZ(?#zMy|1{?kh%3Icwv*##$SyeudN4HFzWcCc>QNtm=g7d(QR_@VBo&^Ztgny1vY3 zD_?%z$Fz`r?qyZ`0ru5A&P=LC^7A)g`95WOrqpp!znQM!PUmksAFMN49zVTz(V8#+|BT~IFWuJ% t`_A^K@Ap&tKfM{JT6REROKH9Lf7lIreHILQ(30acM_<|&KWi?2{s)2=U_k%? literal 4286 zcmb`EUyB??6vbAP9{hqED4?&>x{cLOr;^#91zkpZ4f|r=VgK7Vb3g$q^ff4f1Q`f< z*Y$hfVgI|gGGKsq;5&g6v*=lk^;oi)?-1kJ|NiX)&?zzSCw~6H5AP^YbZDF|C;U7Q zPYMj6Q=)m^J_pn73{VfjZ-yBO3SfHX*JZ0``)`h`gPUXOVQ#(d3I7D-+`}nB3Howe zt>n4pmP!Fdu<{MypExr$YSrcCsEwnAvS+RT_N7^K`w~Tv!J~i%b--^kQ|Kn(;a#lB zcK@Bry18?iHefpMY=e(;Dj-1$3|N;v={)npyYEs2n)kz}BfOkf0SVGI{<6!OK{JQ< z-lGVLb|%hi^D5*@Fmdv2Pd)41ze0zb$>5O@J~zw2uiE#%e)_R}*^gczP z;9+9C)|2yY|3OBzlJoObdb$|}4-?~UJ^o&MM@H%99R2bEMWEneV!Z6B>^}d5He1Pg za4kD}aLoV;z*^c-1w8(2?eDdB%-2qa=Kj&I*Ci-G4alKFov_C~xaW@Udb#F#);TZX z)6UrwJp=6AY%%{Z0R?EiI2GW2#kHMtPxLjQ4z77VWe?5-%mM2La2D(BZ_?fE?0+*4 zZ|KFt8wSjQa(At(;YmO{%Q|Waa!>;5A%mtmy?vi{es@PLc6Z3Zpw>XH-M_n&LYsgY zsDL}$SI@hB>``v^@uQDQKpqp z&~yCT$0?uyHP1nt2lUX~N6HdifsJuRU3cm!33YR2wleQjD5c U#regHV!S*jru5^0Xn#ci0@1+UCIA2c diff --git a/platform/src/tools/model_table/CustomWidget/kbddommodel.cpp b/platform/src/tools/model_table/CustomWidget/kbddommodel.cpp index 9961eb6a..501bec1b 100644 --- a/platform/src/tools/model_table/CustomWidget/kbddommodel.cpp +++ b/platform/src/tools/model_table/CustomWidget/kbddommodel.cpp @@ -91,7 +91,7 @@ QMimeData *KbdDomModel::mimeData(const QModelIndexList &indexes) const QMimeData *mimeData = new QMimeData(); QByteArray encodedData; - mimeData->setData("KbdDomModel/data", encodedData); + mimeData->setData("CustomDomModel/data", encodedData); return mimeData; } diff --git a/platform/src/tools/model_table/CustomWidget/kbdpassworddlg.cpp b/platform/src/tools/model_table/CustomWidget/kbdpassworddlg.cpp index efdb716f..f5b9130e 100644 --- a/platform/src/tools/model_table/CustomWidget/kbdpassworddlg.cpp +++ b/platform/src/tools/model_table/CustomWidget/kbdpassworddlg.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" #include "kbddbdesign.h" #include "pub_utility_api/Md5.h" @@ -145,7 +145,7 @@ void KbdPasswordDlg::onCheck() accept(); else { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } } @@ -172,13 +172,13 @@ void KbdPasswordDlg::onCheck() accept(); else { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } } else { - QMessageBox::information(this,tr("消息"),tr("旧密码错误")); + N_MessageBox::information(this,tr("消息"),tr("旧密码错误")); return; } } diff --git a/platform/src/tools/model_table/CustomWidget/kbdselectdevpointdlg.cpp b/platform/src/tools/model_table/CustomWidget/kbdselectdevpointdlg.cpp index 6f74348b..4b862223 100644 --- a/platform/src/tools/model_table/CustomWidget/kbdselectdevpointdlg.cpp +++ b/platform/src/tools/model_table/CustomWidget/kbdselectdevpointdlg.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" #include #include "../model_common/common.h" #include "kbdtabledatamgr.h" @@ -129,7 +129,7 @@ void KbdSelectDevPointDlg::onSelect() QSqlQuery result; if(!KbdTableDataMgr::getInstance()->selectOnly(sql.arg(instTable).arg(listTag.at(i)),result)) { - QMessageBox::information(this,tr("信息"),tr("获取%1 信息失败!").arg(sql)); + N_MessageBox::information(this,tr("信息"),tr("获取%1 信息失败!").arg(sql)); return; } diff --git a/platform/src/tools/model_table/CustomWidget/kbdselectpointdlg.cpp b/platform/src/tools/model_table/CustomWidget/kbdselectpointdlg.cpp index 0ddef5c4..b4b04130 100644 --- a/platform/src/tools/model_table/CustomWidget/kbdselectpointdlg.cpp +++ b/platform/src/tools/model_table/CustomWidget/kbdselectpointdlg.cpp @@ -4,12 +4,13 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" #include #include "../model_common/common.h" KbdSelectPointDlg::KbdSelectPointDlg(QObject *parent) : ValueDlg(qobject_cast(parent)) { + setWindowTitle(tr("选择测点")); m_dlgArg = ""; m_id = ""; m_labelSelect = nullptr; @@ -73,7 +74,7 @@ void KbdSelectPointDlg::initLayout(const QStringList &args) connect(m_findPointWidget,SIGNAL(lastSelect(const QString &,const QString &)), this,SLOT(onSelect(const QString &,const QString &))); - resize(QSize(700,400)); + resize(QSize(500,600)); } int KbdSelectPointDlg::findList(const QStringList &list, const QString &text) diff --git a/platform/src/tools/model_table/CustomWidget/kbdtreeview.cpp b/platform/src/tools/model_table/CustomWidget/kbdtreeview.cpp index f7006fbb..3adc7de5 100644 --- a/platform/src/tools/model_table/CustomWidget/kbdtreeview.cpp +++ b/platform/src/tools/model_table/CustomWidget/kbdtreeview.cpp @@ -100,74 +100,6 @@ void KbdTreeView::onSearchItemText(const QString &text) } } -void KbdTreeView::onCardSearchItemText(QString text) -{ - if(text.size()==0) - { - onSearchItemText(text); - return; - } - if(text.at(0)=="*"&&text.at(text.size()-1)!="*") - { - text=text.right(text.size()-1); - QStandardItemModel *itemModel = qobject_cast(model()); - if(itemModel == NULL) - return; - - int rowCount = itemModel->rowCount(); - for(int i = 0;i < rowCount;i++) - { - QModelIndex index = itemModel->index(i,0); - - if(index.data().toString().endsWith(text)) - { - setRowHidden(i,index.parent(),false); - endCardsearchChildItemText(itemModel,index,text,true); - } - else - { - if(endCardsearchChildItemText(itemModel,index,text,false)) - setRowHidden(i,index.parent(),false); - else - { - setRowHidden(i,index.parent(),true); - } - } - } - return; - } - if(text.at(0)!="*"&&text.at(text.size()-1)=="*") - { - text=text.left(text.size()-1); - QStandardItemModel *itemModel = qobject_cast(model()); - if(itemModel == NULL) - return; - - int rowCount = itemModel->rowCount(); - for(int i = 0;i < rowCount;i++) - { - QModelIndex index = itemModel->index(i,0); - - if(index.data().toString().startsWith(text)) - { - setRowHidden(i,index.parent(),false); - startCardsearchChildItemText(itemModel,index,text,true); - } - else - { - if(startCardsearchChildItemText(itemModel,index,text,false)) - setRowHidden(i,index.parent(),false); - else - { - setRowHidden(i,index.parent(),true); - } - } - } - return; - } - onSearchItemText(text); -} - bool KbdTreeView::searchChildItemText(QStandardItemModel *model, const QModelIndex &index, const QString &text, bool bFind) { bool bfind = false; @@ -202,75 +134,6 @@ bool KbdTreeView::searchChildItemText(QStandardItemModel *model, const QModelInd return bfind; } -bool KbdTreeView::endCardsearchChildItemText(QStandardItemModel *model, const QModelIndex &index, const QString &text, bool bFind) -{ - bool bfind = false; - QStandardItem* item = model->itemFromIndex(index); - if(!item->hasChildren()) - return bfind; - - int count = item->rowCount(); - for(int i = 0;i < count;i++) - { - QModelIndex childIndex = index.child(i,0); - - if(childIndex.data().toString().endsWith(text) || bFind) - { - setRowHidden(i,index,false); - endCardsearchChildItemText(model,childIndex,text,true); - bfind = true; - } - else - { - if(endCardsearchChildItemText(model,childIndex,text,false)) - { - bfind = true; - setRowHidden(i,index,false); - } - else - { - setRowHidden(i,index,true); - } - } - } - return bfind; -} - -bool KbdTreeView::startCardsearchChildItemText(QStandardItemModel *model, const QModelIndex &index, const QString &text, bool bFind) -{ - bool bfind = false; - QStandardItem* item = model->itemFromIndex(index); - if(!item->hasChildren()) - return bfind; - - int count = item->rowCount(); - for(int i = 0;i < count;i++) - { - QModelIndex childIndex = index.child(i,0); - - if(childIndex.data().toString().startsWith(text) || bFind) - { - setRowHidden(i,index,false); - startCardsearchChildItemText(model,childIndex,text,true); - bfind = true; - } - else - { - if(startCardsearchChildItemText(model,childIndex,text,false)) - { - bfind = true; - setRowHidden(i,index,false); - } - else - { - setRowHidden(i,index,true); - } - } - } - return bfind; -} - - void KbdTreeView::onSelectAll() { QStandardItemModel *itemModel = qobject_cast(model()); diff --git a/platform/src/tools/model_table/icons/arrowBottom.png b/platform/src/tools/model_table/icons/arrowBottom.png deleted file mode 100644 index 10fb526dadc0844671283c8c332e5f2f105d4462..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1040 zcmaJ=J8#oa7`0SXpwJ37id5<1E=9tR>o|36VnSj&G>C*KjnoVb_2Z_oTKgLNmbhJz zI+X>9k%d11Vnu?X6=GpxLPEg6Kgf)PRIbycWeBxo--pln&i8!QY}}ijxjw@%%xrDN zY|-^%_FkB#-(N4Luh3oeBZ|Cu6RAiVb-*0zFr~W{5 zalqRdhEIctvKgjWN+a9dLic4M@<+i1JHo384y zr8}UQYSci0hz-(UD@?RhXNPt*y3ei!77QU|Q)iEz>eQRSz%c@OKF_(L1c9RRFfXeR z-U5;ca{?3vN#!8aWJQC^VDzw5E%v%v%dC#H=t*aLghZMk^!t6jpW|`7AwX4C1yK?t ziK7TE*$IiAa$&MKwqT;fjs1xDI0TtR+risJXQ`*hAp}vqequOGMv0;+6H+@8ATJ6* zki|7bC!~c=-I$0@+B*>vS}4KWu}kaGT^y5X?#>p^@hIaR4tEV-bRjWUFmT&`9u zbGd4&`NFbUQKT`q7AC|FT{PDAsrHDgoXORU7}*5JZH%|ZUC``df|DMOfMI~8H9z!l zKe?Gz=r~{##r_lIRbw20VTv_>g1jhMIkgHcDqqN4uc#HHtjMNJd%!A7Id;VLCZuh| zt^SuQP-ld!KmO^L@fB^tYc-)x zyXV0DtC#k_9Xu^HZZ9k>%)eZ}{Ai~6##r0`c>ed?{NTsCLFxUq#jkq|IAmVemWqS4 Q^)s8%n$O>5LZ7@mGuw6>x`LB&JNUaFW)Ci{_1=vwpDcEPP>yV!a&o6PQpZZa{My4!*v z-dY4H_z#LAD1~12V4NKSgn)oZuPJ>Fqw}$&-=Xdeq?QKc6xO9!Y}|} zv@m0o=zJm`$A{?q%f`@YI`u`RX$@?BxcH5325V|j1z`K}$vx{>j0|ROM*y7KjYr=* z{M@03=ZU#U=5duYtq=j#!4 zv6z6{mp^}yqm}NQ-OVvWBs+5eWjuzeJ**YPC!t>2$GuccfaaiM_EX%wg@}kI51Q)IN z#AW=Gd$rLK zDWSh^^h8JHl>qT26yfF2runEQx?~!=qlIE1^+vfFx-=~Iw!UEyR&sB*TGt3tVw6YR9pwbP5AN~xMC>$;@sDuiY_r|CH@l@+r& zLo+i%s>?0-5wUz5b+uip-Qj9Sauq#97QtZ|<3_g%=IWT>sEz|h*O~DJ*LQF;x*TWd z;KBw9-FwKH3bDtuL#((xI@&($3OMbJ)%VzFAuAqZVvkg`Lt<5+8y8Tzg?i6r4|geJU(yl?e9+xT-q6Y3U_}0 z`uX+M_7&|G=s&mqaqIzDXB)%Ufw{4{nMgcY>la?`K0Ezl_tV(fGqWQj!2CQmJ@BXy P{}@2QoHe$zI}iT=k5LZ7!IwJS}pXThl+(U6~8daO!gz2&~?dI+Xc6l?ZWP{*<`jG+GJufb+ZLQ z#EafMiRh)^QTzdVs3+0C;6?8W;?09lC)?fXVQnCpcP8)iJny_8kJr~$W@j$Ua2z*V zUA5|LJ)OPNQ|$Zo>C_xs=BeGH8>B;fPK-I-BW(<-fwP6{*zx*zKj9^goAmugi?(XF zHJ1dUllh2g5HU2zEmhLUaknuAZM@}&W&X#z10MKZnQs#y#`cw=v^;qGm_ zs>fGufu&Sq1OcWFNQ0d)(b6(M;MJI&9ZNhIxX|q~e-u=!whl}ZV^9zaf(vB?6jelp zyo%6GAVZXs5R_z9KuF6g8Y+U}!!xzm>u7ard8oy9Wxh*kq)Ae**Asg=k;GdPQdL!g zvLwp_^AM7LNS#y&lf@B(g%daSBkGe7WQ-cXNW4)6`Kf+QSCuBEvSv@+7BQVR|$wHYUi$=Q>`>ZI=jz!$v0Ee_{ zm3j6@^n6cql@4^U0|nSoJ)sTrZ9!FFM{vDT2dV86bo1VbXBKkXVHaR-gsp}NbwU@9w0)*M#2P1JH8aKzC2@n0olzI8cL^m)mqfrc!L_Cz zdZd?J&nk3uVGGCpJ?t&VBmjdHYyKE{#a0k93q>Z+3_GtE72AR(ShSaIJtrId5bKRe z+Yqb#7b~$~q^v*w>6g(FYr@Pt?tZp8o*x{tp^4dae7palnN3#J(i`dL_V2^P%H*Z@ zr`+#f4h}22{p*~(e`a&zf5B8^DOw4UwzVecrILq~)pI>>l R>b=TFv}&(eZ;Z`{e*i#hLlpo3 diff --git a/platform/src/tools/model_table/icons/arrowTop.png b/platform/src/tools/model_table/icons/arrowTop.png deleted file mode 100644 index 9c7e913d868b0bf53d4b671fd566023b553df096..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1081 zcmaJ=%WKp?9M0MYTB&&GMJX6lgbHRelYL|p8cSYn7u;I53$3?iliA(SCKHpXyDcc% zn_kqL|A643Ry=s}P@$lB5%Hua^`?l3-h@J(Yr&|4;V^PtqwBm#1}R>&@s_y6LZLC5>U8-aWo+4(o(s$U4^cbV}WDa5VEXt`%W#E=2!zqh|Q&QyaPnYN^%mDa+?rB0r#f16r*aKKLPZdo&1SlpN#m$4Kv|XrAPS<$Qv@Hc z1;lRgK|I#AV4~QGypVV}U=xdW6|WMNqn_?R!4FHN1H(bw2^0;P(6U1Trh(x5$-CO< zn3U09H+rJu%36qoGK%qPF9mIu{OHwXQL0@^eY?T&BPUoOzj$`(znGCuF@?(I$Xoqf^&@aK_V zBi}!6pV_%FVu67#L!a-wJ$LW-lJ$O*Nj)e$+qiiv#c-RWPd=!R-zBYCv}VmMeQDzl Dw@6UY diff --git a/platform/src/tools/model_table/kbdbatchdlg.cpp b/platform/src/tools/model_table/kbdbatchdlg.cpp index 1de5b1c4..ed286793 100644 --- a/platform/src/tools/model_table/kbdbatchdlg.cpp +++ b/platform/src/tools/model_table/kbdbatchdlg.cpp @@ -5,14 +5,14 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" #include #include #include #include "model_common/common_global.h" #include "kbdmsgcontrl.h" -KbdBatchDlg::KbdBatchDlg(const QStringList& text,QWidget *parent) : QDialog(parent) +KbdBatchDlg::KbdBatchDlg(const QStringList& text,QWidget *parent) : CustomDialog(parent) { m_oldData = text; m_nMaxLength = -1; @@ -218,8 +218,8 @@ bool KbdBatchDlg::setustomList() QStringList textList = text.split("\n"); if (textList.length() != m_oldData.length()) { - int isContinue = QMessageBox::question(this, tr("询问"), tr("自定义内容和设置的内容行数不一致,请确认是否继续?")); - if (isContinue != QMessageBox::Yes) + int isContinue = N_MessageBox::question(this, tr("询问"), tr("自定义内容和设置的内容行数不一致,请确认是否继续?")); + if (isContinue != N_MessageBox::Ok) { return false; } @@ -303,5 +303,5 @@ void KbdBatchDlg::slot_customBtnChecked(bool isChecked) void KbdBatchDlg::onMsg(const QString &text) { - QMessageBox::information(this,tr("消息"),text); + N_MessageBox::information(this,tr("消息"),text); } diff --git a/platform/src/tools/model_table/kbdbatchdlg.h b/platform/src/tools/model_table/kbdbatchdlg.h index 959b025e..a61e43ec 100644 --- a/platform/src/tools/model_table/kbdbatchdlg.h +++ b/platform/src/tools/model_table/kbdbatchdlg.h @@ -1,8 +1,8 @@ #ifndef KBDBATCHDLG_H #define KBDBATCHDLG_H -#include #include "tablemodule_global.h" +#include "pub_widget/CustomDialog.h" class QLineEdit; class QTextEdit; @@ -10,7 +10,7 @@ class QRadioButton; class QStackedWidget; class QPushButton; class QSpinBox; -class TABLEMODULESHARED_EXPORT KbdBatchDlg : public QDialog +class TABLEMODULESHARED_EXPORT KbdBatchDlg : public CustomDialog { Q_OBJECT public: @@ -51,4 +51,4 @@ private: int m_nMaxLength; }; -#endif // KBDBATCHDLG_H \ No newline at end of file +#endif // KBDBATCHDLG_H diff --git a/platform/src/tools/model_table/kbddbdesign.cpp b/platform/src/tools/model_table/kbddbdesign.cpp index fc97adc5..3cc31aed 100644 --- a/platform/src/tools/model_table/kbddbdesign.cpp +++ b/platform/src/tools/model_table/kbddbdesign.cpp @@ -29,7 +29,7 @@ bool KbdDbDesign::getLoactionTagName(const QString &locationId, QString &desc, Q { desc.clear(); tagName.clear(); - QString sql = QString("SELECT %1,%2 FROM SYS_MODEL_LOCATION_INFO WHERE LOCATION_ID in (%3);") + QString sql = QString("SELECT %1,%2 FROM SYS_MODEL_LOCATION_INFO WHERE LOCATION_ID = '%3';") .arg(CN_TAG_NAME).arg(CN_DESC).arg(locationId); QSqlQuery result; @@ -240,7 +240,8 @@ QList KbdDbDesign::getSqlItems(const QString &sql, const QStr return temp; while (result.next()) { - QListWidgetItem *item = new QListWidgetItem(onlyLastDesc?result.value(colDesc).toString().split(".").last():result.value(colDesc).toString()); + const QString &retCol = result.value(colDesc).toString(); + QListWidgetItem *item = new QListWidgetItem(onlyLastDesc?retCol.split(".").last():retCol); item->setData(Qt::UserRole,result.value(colUserRole)); temp << item; @@ -871,41 +872,6 @@ bool KbdDbDesign::getSqlInfoToCombobox(const QString &sql, const QString &descFi return true; } -/** - * @brief getSqlInfoToCombobox 获取指定sql语句中的信息,写入下拉框控件cb中 - * @param sql 指定的sql语句 - * @param nameField sql中包含的字段,对应下拉框控件的显示文字(name) - * @param descField sql中包含的字段,对应下拉框控件的显示文字(desc),最终组合为:name:desc - * @param dataField sql中包含的字段,对应下拉框控件的用户数据 - * @param cb 下拉框控件指针 - * @return - */ -bool KbdDbDesign::getSqlInfoToCombobox(const QString &sql, const QString &nameField,const QString &descField, const QString &dataField, QComboBox *cb) -{ - if(cb == NULL) - return false; - - cb->clear(); - QSqlQuery result; - if(!KbdTableDataMgr::getInstance()->selectOnly(sql,result)){ - return false; - } - - while (result.next()) - { - if(descField.isEmpty() || descField=="") - { - cb->addItem(result.value(nameField).toString(),result.value(dataField).toString()); - } - else - { - cb->addItem(result.value(nameField).toString()+":"+result.value(descField).toString(), - result.value(dataField).toString()); - } - } - return true; -} - bool KbdDbDesign::getSqlSingleResult(const QString &sql, const QStringList &filedList, QStringList &resultList) { QSqlQuery result; diff --git a/platform/src/tools/model_table/kbdinputdlg.cpp b/platform/src/tools/model_table/kbdinputdlg.cpp index 0dada99d..d3296d7a 100644 --- a/platform/src/tools/model_table/kbdinputdlg.cpp +++ b/platform/src/tools/model_table/kbdinputdlg.cpp @@ -4,9 +4,9 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" -KbdInputDlg::KbdInputDlg(QWidget *parent) : QDialog(parent) +KbdInputDlg::KbdInputDlg(QWidget *parent) : CustomDialog(parent) { setWindowTitle(tr("自定义自增")); QGridLayout *grid = new QGridLayout; @@ -29,7 +29,7 @@ KbdInputDlg::KbdInputDlg(QWidget *parent) : QDialog(parent) setLayout(grid); } -KbdInputDlg::KbdInputDlg(QString &text, int step, QWidget *parent): QDialog(parent) +KbdInputDlg::KbdInputDlg(QString &text, int step, QWidget *parent): CustomDialog(parent) { m_text = text; m_step = step; @@ -80,7 +80,7 @@ void KbdInputDlg::onCheck() QString text = m_le->text(); if(!text.contains("%1")) { - QMessageBox::information(this,tr("消息"),tr("字符串格式需要包含占位符%1")); + N_MessageBox::information(this,tr("消息"),tr("字符串格式需要包含占位符%1")); return; } diff --git a/platform/src/tools/model_table/kbdmodelexcelfun.cpp b/platform/src/tools/model_table/kbdmodelexcelfun.cpp index b15eb141..92c3d51e 100644 --- a/platform/src/tools/model_table/kbdmodelexcelfun.cpp +++ b/platform/src/tools/model_table/kbdmodelexcelfun.cpp @@ -30,28 +30,7 @@ QString KbdModelExcelFun::directImportExcel( rowDatas.clear(); for (int i = 0; i < columns.size(); i++) { - - QString a=xlsx.read(row, findXlsxColumn(xlsx, columns.at(i))).toString(); - if(sheetName=="保护定值") - { - if(a=="Null") - { - a=""; - } - - a.replace(QRegExp(".ini"),""); - - /* - if(a.split(".").at(a.split(".").size()-1)=="ini") - { - a=a.left(a.size()-4); - }*/ - - } - rowDatas.append(a); - - // rowDatas.append(xlsx.read(row, findXlsxColumn(xlsx, columns.at(i))).toString()); - // LOGINFO(a.toStdString().c_str()); + rowDatas.append(xlsx.read(row, findXlsxColumn(xlsx, columns.at(i))).toString()); } //第一个字段为空就表示结束 diff --git a/platform/src/tools/model_table/kbdmodelwrap.cpp b/platform/src/tools/model_table/kbdmodelwrap.cpp index 5072c20b..7d1fcbef 100644 --- a/platform/src/tools/model_table/kbdmodelwrap.cpp +++ b/platform/src/tools/model_table/kbdmodelwrap.cpp @@ -59,6 +59,14 @@ void KbdModelWrap::wrapTable() unwrapData(m_model.getRowData(row))); if (!sqlExeList.contains(sqlStruct) && !sqlStruct.Desc.isEmpty()) { + //< 提高检索效率,避免遍历比对 + QHash > mapAllRows; + for (int i = 0; i < rowNum; i++) + { + it = m_model.item(i, col); + mapAllRows[it->text()].append(it); + } + //一次性写完与该sql查询结果相关的所有行 QSqlQuery result; KbdTableDataMgr::getInstance()->selectOnly(sqlStruct.sql, result); @@ -71,15 +79,15 @@ void KbdModelWrap::wrapTable() sqlDesc = result.value(sqlStruct.Desc).toString(); sqlChanNo = result.value(sqlStruct.chanNo).toString(); - for (int i = 0; i < rowNum; i++) + auto iterFind = mapAllRows.find(sqlValue); + if(iterFind != mapAllRows.end()) { - it = m_model.item(i, col); - if (sqlValue == it->text()) + foreach (QStandardItem * curItem, iterFind.value()) { if (sqlStruct.chanNo.isEmpty()) - it->setText(sqlValue + ":" + sqlDesc); + curItem->setText(sqlValue + ":" + sqlDesc); else - it->setText(sqlChanNo + ":" + sqlValue + ":" + sqlDesc); + curItem->setText(sqlChanNo + ":" + sqlValue + ":" + sqlDesc); padRow++; } } @@ -586,17 +594,26 @@ KbdModelWrap::syntaxSqlComboboxLimit( if (tempList.size() == 1) { sqlStruc.value = tempList.first(); + + sqlStruc.valueIndex = 0; } else if (tempList.size() == 2) { sqlStruc.value = tempList.first(); sqlStruc.Desc = tempList.last(); + + sqlStruc.valueIndex = 0; + sqlStruc.descIndex = tempList.count() - 1; } else if (tempList.size() == 3) { sqlStruc.chanNo = tempList.first(); sqlStruc.value = tempList.at(1); sqlStruc.Desc = tempList.last(); + + sqlStruc.chanNoIndex = 0; + sqlStruc.valueIndex = 1; + sqlStruc.descIndex = tempList.count() - 1; } //解析request@部分 diff --git a/platform/src/tools/model_table/kbdmsgcontrl.cpp b/platform/src/tools/model_table/kbdmsgcontrl.cpp index 769f73c1..17cf75e6 100644 --- a/platform/src/tools/model_table/kbdmsgcontrl.cpp +++ b/platform/src/tools/model_table/kbdmsgcontrl.cpp @@ -1,6 +1,6 @@ #include "kbdmsgcontrl.h" #include -#include +#include "pub_widget/MessageBox.h" #include #include @@ -36,6 +36,6 @@ void KbdMsgContrl::showMsg(const QString &msg, QWidget *parent) } else { - QMessageBox::information(parent,tr("消息"),msg); + N_MessageBox::information(parent,tr("消息"),msg); } } diff --git a/platform/src/tools/model_table/kbdpage.cpp b/platform/src/tools/model_table/kbdpage.cpp index cd45ab48..ab179396 100644 --- a/platform/src/tools/model_table/kbdpage.cpp +++ b/platform/src/tools/model_table/kbdpage.cpp @@ -10,7 +10,7 @@ #include "kbdtableproperty.h" #include #include "kbddbdesign.h" -#include +#include "pub_widget/MessageBox.h" #include #include @@ -58,7 +58,10 @@ void KbdPage::setCurrentPage(int page) QString strWhere = m_whereSql; joinString(strWhere,m_whereArgs); - QString filter = QString(strWhere+" LIMIT "+QString::number(m_maxRecord)+" offset "+QString::number(m_maxRecord * (page - 1))); + QString filter = QString("%1 LIMIT %3 offset %2") + .arg(strWhere) + .arg(m_maxRecord * (page - 1) ) + .arg(m_maxRecord); KbdTableModel *model = KbdTableDataMgr::getInstance()->createModel(Common::createViewName(m_tableDescFile,filter)); //因为是在外部修改,假如新旧模型一样,m_table->setModel(model)将什么也不做,这里强制刷新 @@ -186,7 +189,6 @@ void KbdPage::onEnter() return; } setCurrentPage(page); - //emit currentPageChange(); } void KbdPage::onPrePage() @@ -198,7 +200,6 @@ void KbdPage::onPrePage() return; } setCurrentPage(m_currentPage - 1); - //emit currentPageChange(); } void KbdPage::onNextPage() @@ -210,12 +211,11 @@ void KbdPage::onNextPage() return; } setCurrentPage(m_currentPage + 1); - //emit currentPageChange(); } void KbdPage::onMsg(const QString &text) { - QMessageBox::information(this,tr("消息"),text); + N_MessageBox::information(this,tr("消息"),text); } void KbdPage::onExcelExport() diff --git a/platform/src/tools/model_table/kbdpropertydlg.cpp b/platform/src/tools/model_table/kbdpropertydlg.cpp index e4466d80..9961579f 100644 --- a/platform/src/tools/model_table/kbdpropertydlg.cpp +++ b/platform/src/tools/model_table/kbdpropertydlg.cpp @@ -1,14 +1,15 @@ #include "kbdpropertydlg.h" #include "kbdpropertypanel.h" -#include +#include "pub_widget/MessageBox.h" #include #include #include #include "kbdtablemodel.h" #include "kbdtabledatamgr.h" -KbdPropertyDlg::KbdPropertyDlg(bool autoSave, QWidget *parent) : QDialog(parent) +KbdPropertyDlg::KbdPropertyDlg(bool autoSave, QWidget *parent) : CustomDialog(parent) { + setWindowTitle(tr("model_studio")); m_autoSave = autoSave; QVBoxLayout *vLayout = new QVBoxLayout; m_panelProperty = new KbdPropertyPanel(this); @@ -22,6 +23,7 @@ KbdPropertyDlg::KbdPropertyDlg(bool autoSave, QWidget *parent) : QDialog(parent) vLayout->addWidget(m_panelProperty); vLayout->addWidget(box); this->setLayout(vLayout); +// this->addUserLayout(vLayout); } void KbdPropertyDlg::showEvent(QShowEvent *event) @@ -29,7 +31,7 @@ void KbdPropertyDlg::showEvent(QShowEvent *event) qDebug()<<"show event property dlg"; fixSize(); - QDialog::showEvent(event); + CustomDialog::showEvent(event); } void KbdPropertyDlg::fixSize() @@ -98,5 +100,5 @@ void KbdPropertyDlg::onCheck() void KbdPropertyDlg::onError(const QString &error) { - QMessageBox::warning(this,tr("错误"),error); + N_MessageBox::warning(this,tr("错误"),error); } diff --git a/platform/src/tools/model_table/kbdreplacedlg.cpp b/platform/src/tools/model_table/kbdreplacedlg.cpp index bedf2fde..a337399e 100644 --- a/platform/src/tools/model_table/kbdreplacedlg.cpp +++ b/platform/src/tools/model_table/kbdreplacedlg.cpp @@ -4,9 +4,9 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" -KbdReplaceDlg::KbdReplaceDlg(QWidget *parent) : QDialog(parent) +KbdReplaceDlg::KbdReplaceDlg(QWidget *parent) : CustomDialog(parent) { setWindowTitle(tr("单元格内容替换")); QGridLayout *grid = new QGridLayout; @@ -56,7 +56,7 @@ void KbdReplaceDlg::onCheck() { if(m_leFind->text().isEmpty()) { - QMessageBox::information(this,tr("消息"),tr("查找内容不能为空")); + N_MessageBox::information(this,tr("消息"),tr("查找内容不能为空")); return; } diff --git a/platform/src/tools/model_table/kbdsplitter.cpp b/platform/src/tools/model_table/kbdsplitter.cpp index f7411b89..52e31402 100644 --- a/platform/src/tools/model_table/kbdsplitter.cpp +++ b/platform/src/tools/model_table/kbdsplitter.cpp @@ -8,7 +8,7 @@ #include "kbdtable.h" #include "kbdtableproperty.h" #include "kbddbdesign.h" -#include +#include "pub_widget/MessageBox.h" #include #include #include @@ -60,9 +60,11 @@ void KbdSplitter::initLayout() vLayout1->addWidget(m_seachWidTree); m_barTree = new QToolBar(widgetTree); - m_barTree->setIconSize(QSize(24,24)); - m_barTree->addAction(QIcon(":/icons/icons/new.png"),tr("添加记录"),this,SLOT(onAddTree())); - m_barTree->addAction(QIcon(":/icons/icons/delete.png"),tr("删除记录"),this,SLOT(onRemoveTree())); + QAction* act = nullptr; + act = m_barTree->addAction(tr("添加记录"),this,SLOT(onAddTree())); + m_barTree->widgetForAction(act)->setObjectName("icon_add"); + act = m_barTree->addAction(tr("删除记录"),this,SLOT(onRemoveTree())); + m_barTree->widgetForAction(act)->setObjectName("icon_delete"); m_tree = new KbdTreeView(widgetTree); m_tree->setContextMenuPolicy(Qt::CustomContextMenu); @@ -89,16 +91,21 @@ void KbdSplitter::initLayout() QToolBar *bar2 = new QToolBar(widgetDetail); m_tableProperty = new kbdtableproperty(widgetDetail); - bar2->setIconSize(QSize(24,24)); - bar2->addAction(QIcon(":/icons/icons/new.png"),tr("添加记录"),this,SLOT(onAddTable())); - bar2->addAction(QIcon(":/icons/icons/modify.png"),tr("修改记录"),this,SLOT(onModifyTable())); - m_actCopy = bar2->addAction(QIcon(":/icons/icons/copy.png"),tr("复制记录"),this,SLOT(onCopyTable())); + act = bar2->addAction(tr("添加记录"),this,SLOT(onAddTable())); + bar2->widgetForAction(act)->setObjectName("icon_add"); + act = bar2->addAction(tr("修改记录"),this,SLOT(onModifyTable())); + bar2->widgetForAction(act)->setObjectName("icon_edit"); + m_actCopy = bar2->addAction(tr("复制记录"),this,SLOT(onCopyTable())); + bar2->widgetForAction(m_actCopy)->setObjectName("icon_copy"); m_actCopy->setVisible(false); - bar2->addAction(QIcon(":/icons/icons/delete.png"),tr("删除记录"),this,SLOT(onRemoveTable())) - ->setShortcut(QKeySequence::Delete); + act = bar2->addAction(tr("删除记录"),this,SLOT(onRemoveTable())); + act->setShortcut(QKeySequence::Delete); + bar2->widgetForAction(act)->setObjectName("icon_delete"); bar2->addSeparator(); - bar2->addAction(QIcon(":/icons/icons/Excel-export.png"),tr("Excel导出"),m_tableProperty->getTable(),SLOT(onExcelExport())); - bar2->addAction(QIcon(":/icons/icons/Excel-Impor.png"),tr("Excel导入"),m_tableProperty->getTable(),SLOT(onImportExcel())); + act = bar2->addAction(tr("Excel导出"),m_tableProperty->getTable(),SLOT(onExcelExport())); + bar2->widgetForAction(act)->setObjectName("icon_excel_export"); + act = bar2->addAction(tr("Excel导入"),m_tableProperty->getTable(),SLOT(onImportExcel())); + bar2->widgetForAction(act)->setObjectName("icon_excel_import"); bar2->addSeparator(); m_searchWidRight = new kbdSearchWidget(this); m_searchWidRight->setPlaceholderText(tr("请输入通道描述的关键字")); @@ -128,8 +135,7 @@ void KbdSplitter::initData() QString sql; sql = "SELECT * FROM SYS_MODEL_SUB_SYSTEM_INFO WHERE SUB_SYSTEM_ID not in (1,2,3);"; ds.getSqlInfoToCombobox(sql,CN_DESC,CN_SUB_SYSTEM_ID,m_cbSubSystem); - m_cbSubSystem->insertItem(0,tr("所有"),"-1"); - m_cbSubSystem->setCurrentIndex(0); + m_Meun->addAction(tr("全选"),m_tree,SLOT(onSelectAll())); m_Meun->addAction(tr("反选"),m_tree,SLOT(onReverseSelect())); } @@ -171,18 +177,18 @@ void KbdSplitter::onCopyTable() void KbdSplitter::onMsg(const QString &msg) { - QMessageBox::information(this,tr("消息"),msg); + N_MessageBox::information(this,tr("消息"),msg); } void KbdSplitter::onCommitError() { - QMessageBox::information(this,tr("消息"),tr("此次修改失败,已启动回滚!")); + N_MessageBox::information(this,tr("消息"),tr("此次修改失败,已启动回滚!")); } void KbdSplitter::onStartTransactionError(const QString&erroStr) { - QMessageBox::information(this,tr("消息"),erroStr); + N_MessageBox::information(this,tr("消息"),erroStr); } diff --git a/platform/src/tools/model_table/kbdtable.cpp b/platform/src/tools/model_table/kbdtable.cpp index 035b5e79..44236d08 100644 --- a/platform/src/tools/model_table/kbdtable.cpp +++ b/platform/src/tools/model_table/kbdtable.cpp @@ -1,6 +1,6 @@ #include "kbdtable.h" #include -#include +#include "pub_widget/MessageBox.h" #include "../model_common/common.h" #include #include @@ -171,36 +171,6 @@ void KbdTable::searchItemText(const QStringList &listColDes,const QString &text) { bool bShow = false; for(int i = 0;i < listColDes.size();i++) - { - int colDesc = cols.findCol(listColDes.at(i)); - - if(kbdModel->item(row,colDesc)->text().contains(text)) - { - bShow = true; - showRow(row); - break; - } - } - - if(!bShow) - hideRow(row); - } -} - -void KbdTable::searchItemListText(const QStringList &listColDes, const QStringList &text) -{ - //LOGINFO(QString::number(text.size()).toStdString().c_str()); - KbdTableModel *kbdModel = qobject_cast(model()); - if(kbdModel == NULL) - return; - - const ColMgrDataList& cols = kbdModel->getHeadCols(); - int rowCount = kbdModel->rowCount(); - for(int row = 0; row < rowCount; row++) - { - bool bShow = true; - showRow(row); - for(int i = 0;i < listColDes.size();i++) { int colDesc = cols.findCol(listColDes.at(i)); if(colDesc==-1) @@ -208,10 +178,11 @@ void KbdTable::searchItemListText(const QStringList &listColDes, const QStringLi LOGINFO("存在-1"); continue; } - if(!kbdModel->item(row,colDesc)->text().contains(text.at(i))) + if(kbdModel->item(row,colDesc)->text().contains(text)) { - bShow = false; - hideRow(row); + bShow = true; + showRow(row); + break; } } @@ -288,17 +259,17 @@ void KbdTable::batchEditData( const QModelIndexList &indexList, const QStringLis success = KbdTableDataMgr::getInstance()->endBatch(); if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) - QMessageBox::information(this,tr("消息"),tr("提交事务失败!")); + N_MessageBox::information(this,tr("消息"),tr("提交事务失败!")); } else - QMessageBox::information(this,tr("消息"),retStr); + N_MessageBox::information(this,tr("消息"),retStr); //< modifyRow时writeToTable速度很慢,所以应当在修改完成后整体刷新界面 reFresh(); if(!success) { - QMessageBox::information(this,tr("消息"),tr("修改失败")); + N_MessageBox::information(this,tr("消息"),tr("修改失败")); return; } @@ -355,14 +326,14 @@ void KbdTable::findAndReplace(const QString &strFind, const QString &strReplace, success = KbdTableDataMgr::getInstance()->endBatch(); if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) - QMessageBox::information(this,tr("消息"),tr("提交事务失败!")); + N_MessageBox::information(this,tr("消息"),tr("提交事务失败!")); } else - QMessageBox::information(this,tr("消息"),retStr); + N_MessageBox::information(this,tr("消息"),retStr); if(!success) { - QMessageBox::information(this,tr("消息"),tr("修改失败")); + N_MessageBox::information(this,tr("消息"),tr("修改失败")); reFresh(); return; } @@ -379,14 +350,14 @@ bool KbdTable::pasteOneLine(QModelIndex &index, const QStringList &rowDatas) if(index.row() == -1) { - QMessageBox::information(this,tr("消息"),tr("行越界")); + N_MessageBox::information(this,tr("消息"),tr("行越界")); return false; } QStringList newDatas = kbdModel->getRowData(index.row()); if(index.column() + rowDatas.count() > newDatas.count()) { - QMessageBox::information(this,tr("消息"),tr("列越界")); + N_MessageBox::information(this,tr("消息"),tr("列越界")); return false; } @@ -397,7 +368,7 @@ bool KbdTable::pasteOneLine(QModelIndex &index, const QStringList &rowDatas) strCheckData.remove("\r"); if(!kbdModel->checkModifyData(index.row(), index.column() + col, strCheckData)) { - QMessageBox::information(this,tr("消息"), strCheckData + tr(":数据错误")); + N_MessageBox::information(this,tr("消息"), strCheckData + tr(":数据错误")); return false; } } @@ -500,10 +471,14 @@ void KbdTable::onEnterSaveState(bool needSave) if(needSave) { - setStyleSheet(QString("QTableView{alternate-background-color: #AED8D8;background: #88ADD2;}")); + setProperty("changed",true); + this->style()->polish(this); + //setStyleSheet(QString("QTableView{alternate-background-color: #AED8D8;background: #88ADD2;}")); } else { - setStyleSheet(QString("QTableView{alternate-background-color: #E6ECF2;background: white;}")); + setProperty("changed",false); + this->style()->polish(this); + //setStyleSheet(QString("QTableView{alternate-background-color: #E6ECF2;background: white;}")); } } @@ -521,6 +496,7 @@ void KbdTable::onUndo() kbdModel->load(true); onEnterSaveState(false); + kbdModel->layoutChanged(); } void KbdTable::onMenu() @@ -562,35 +538,25 @@ void KbdTable::onBatchEditToSelect() if (!index.isValid()) return; - QModelIndexList indexList_all = selectionModel()->selectedRows(index.column()); - QModelIndexList indexList; - KbdTableModel *kbdModel = qobject_cast(model()); - foreach(QModelIndex index, indexList_all) - { - if(!isRowHidden(index.row())) - { - indexList<selectedRows(index.column()); + if (needSave()) { - QMessageBox::information(this, tr("消息"), tr("请先保存修改")); + N_MessageBox::information(this, tr("消息"), tr("请先保存修改")); return; } if (indexList.isEmpty()) return; - + KbdTableModel *kbdModel = qobject_cast(model()); if (kbdModel == NULL) return; const ColMgrDataList& cols = kbdModel->getHeadCols(); if (!cols.at(indexList.first().column()).editable) { - QMessageBox::information(this, tr("消息"), tr("该列不可编辑")); + N_MessageBox::information(this, tr("消息"), tr("该列不可编辑")); return; } @@ -598,21 +564,21 @@ void KbdTable::onBatchEditToSelect() { if (KbdTableDataMgr::getInstance()->getPrimaryEditable()) { - if (QMessageBox::No == QMessageBox::information(this, tr("消息"), tr("该列是主键,是否仍然修改?"), - QMessageBox::Yes, QMessageBox::No)) + if (N_MessageBox::No == N_MessageBox::information(this, tr("消息"), tr("该列是主键,是否仍然修改?"), + N_MessageBox::Yes, N_MessageBox::No)) return; } else { - QMessageBox::information(this, tr("消息"), tr("该列是主键,不可编辑")); + N_MessageBox::information(this, tr("消息"), tr("该列是主键,不可编辑")); return; } } + //排序 std::sort(indexList.begin(), indexList.end(), compareIndex); QStringList newDatas; QStringList selectText; - foreach(QModelIndex index, indexList) { newDatas = kbdModel->getRowData(index.row()); const QString text = newDatas.at(index.column()); @@ -633,29 +599,21 @@ void KbdTable::onBatchEditToSelect() void KbdTable::onFindAndReplaceToSelect() { QModelIndex index = currentIndex(); - KbdTableModel *kbdModel = qobject_cast(model()); if (!index.isValid()) return; if (needSave()) { - QMessageBox::information(this, tr("消息"), tr("请先保存修改")); + N_MessageBox::information(this, tr("消息"), tr("请先保存修改")); return; } - QModelIndexList indexList_all = selectionModel()->selectedRows(index.column()); - QModelIndexList indexList; - foreach(QModelIndex index, indexList_all) - { - if(!isRowHidden(index.row())) - indexList<selectedRows(index.column()); if (indexList.isEmpty()) return; - + KbdTableModel *kbdModel = qobject_cast(model()); if (kbdModel == NULL) return; @@ -663,7 +621,7 @@ void KbdTable::onFindAndReplaceToSelect() //QString valueType = cols.at(indexList.first().column()).valueType; if (!cols.at(indexList.first().column()).editable) { - QMessageBox::information(this, tr("消息"), tr("该列不可编辑")); + N_MessageBox::information(this, tr("消息"), tr("该列不可编辑")); return; } @@ -671,13 +629,13 @@ void KbdTable::onFindAndReplaceToSelect() { if (KbdTableDataMgr::getInstance()->getPrimaryEditable()) { - if (QMessageBox::No == QMessageBox::information(this, tr("消息"), tr("该列是主键,是否仍然修改?"), - QMessageBox::Yes, QMessageBox::No)) + if (N_MessageBox::No == N_MessageBox::information(this, tr("消息"), tr("该列是主键,是否仍然修改?"), + N_MessageBox::Yes, N_MessageBox::No)) return; } else { - QMessageBox::information(this, tr("消息"), tr("该列是主键,不可编辑")); + N_MessageBox::information(this, tr("消息"), tr("该列是主键,不可编辑")); return; } } @@ -702,23 +660,17 @@ void KbdTable::onFindAndReplaceToSelect() void KbdTable::onDeleteSelect() { - int ret = QMessageBox::information(this,tr("消息"), tr("确定删除数据?"), - QMessageBox::Yes,QMessageBox::No); + int ret = N_MessageBox::information(this,tr("消息"), tr("确定删除数据?"), + N_MessageBox::Yes,N_MessageBox::No); - if(ret != QMessageBox::Yes) + if(ret != N_MessageBox::Yes) return; QModelIndex index = currentIndex(); if(!index.isValid()) return; - QModelIndexList indexList_all = selectionModel()->selectedRows(index.column()); - QModelIndexList indexList; - foreach(QModelIndex index, indexList_all) - { - if(!isRowHidden(index.row())) - indexList<selectedRows(index.column()); if(indexList.isEmpty()) return; @@ -742,14 +694,14 @@ void KbdTable::onDeleteSelect() return; success = KbdTableDataMgr::getInstance()->endBatch(); if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) - QMessageBox::information(this,tr("消息"),tr("提交事务失败!")); + N_MessageBox::information(this,tr("消息"),tr("提交事务失败!")); } else - QMessageBox::information(this,tr("消息"),tr("开启事务失败!")); + N_MessageBox::information(this,tr("消息"),tr("开启事务失败!")); if(!success) { - QMessageBox::information(this,tr("消息"),tr("删除失败")); + N_MessageBox::information(this,tr("消息"),tr("删除失败")); reFresh(); return; } @@ -772,15 +724,15 @@ void KbdTable::onExcelExport() err = oldModel->exportExcel(xlsx,oldModel->getTableName(),false); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } if(!xlsx.saveAs(strPath)) { - QMessageBox::information(this,tr("消息"),tr("导出失败")); + N_MessageBox::information(this,tr("消息"),tr("导出失败")); return; } - QMessageBox::information(this,tr("消息"),tr("导出成功")); + N_MessageBox::information(this,tr("消息"),tr("导出成功")); } else { @@ -793,8 +745,8 @@ void KbdTable::onImportExcel() KbdTableModel *oldModel = qobject_cast(model()); if(oldModel) { - if(QMessageBox::information(this,tr("消息"),tr("导入操作会直接修改数据库,需确保数据正确有效,否则会导致配置错误!") - ,tr("已知悉风险"),tr("取消"),"")) + if(N_MessageBox::information(this,tr("消息"),tr("导入操作会直接修改数据库,需确保数据正确有效,否则会导致配置错误!") + ,N_MessageBox::Ok,N_MessageBox::Cancel) != N_MessageBox::Ok) return; QString strPath = QFileDialog::getOpenFileName(this,tr("打开文件"),"","*.xlsx"); @@ -804,7 +756,7 @@ void KbdTable::onImportExcel() QFile file(strPath); if(!file.open(QIODevice::ReadOnly)) { - QMessageBox::information(this,tr("消息"),tr("文件打开失败!")); + N_MessageBox::information(this,tr("消息"),tr("文件打开失败!")); return; } @@ -812,14 +764,14 @@ void KbdTable::onImportExcel() QString err = oldModel->importExcel(xlsx); if(!err.isEmpty()) { - QMessageBox::information(this,tr("消息"),err); + N_MessageBox::information(this,tr("消息"),err); return; } - QMessageBox::information(this,tr("消息"),tr("导入成功")); + N_MessageBox::information(this,tr("消息"),tr("导入成功")); } else - QMessageBox::information(this,tr("消息"),tr("控件未加载数据")); + N_MessageBox::information(this,tr("消息"),tr("控件未加载数据")); reFresh(); } @@ -837,19 +789,19 @@ bool KbdTable::saveWithReWrite(bool needQuestion) QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); if(retStr.isEmpty()) { - int ret = QMessageBox::Yes; + int ret = N_MessageBox::Yes; if(needQuestion) { - ret = QMessageBox::information(this,tr("消息"), + ret = N_MessageBox::information(this,tr("消息"), Common::getTableChineseName(oldModel->getTableName()) + tr("表格内容未提交,是否提交到数据库?"), - QMessageBox::Yes,QMessageBox::No); + N_MessageBox::Yes,N_MessageBox::No); } - if(ret == QMessageBox::Yes) + if(ret == N_MessageBox::Yes) { QString error = oldModel->saveWithReWrite(); if(!error.isEmpty()) - QMessageBox::warning(this,tr("警告"), error); + N_MessageBox::warning(this,tr("警告"), error); else success = true; } @@ -859,10 +811,10 @@ bool KbdTable::saveWithReWrite(bool needQuestion) } if(KbdTableDataMgr::getInstance()->commit()?false:((success=false)||true)) - QMessageBox::critical(this,tr("错误"),tr("提交事务失败!")); + N_MessageBox::critical(this,tr("错误"),tr("提交事务失败!")); } else - QMessageBox::information(this,tr("消息"),retStr); + N_MessageBox::information(this,tr("消息"),retStr); if(success) { diff --git a/platform/src/tools/model_table/kbdtabledatamgr.cpp b/platform/src/tools/model_table/kbdtabledatamgr.cpp index 85cfdf41..80e84ad0 100644 --- a/platform/src/tools/model_table/kbdtabledatamgr.cpp +++ b/platform/src/tools/model_table/kbdtabledatamgr.cpp @@ -24,10 +24,10 @@ #include "CustomWidget/kbdpaaraedlg.h" #include "CustomWidget/kbdweekdlg.h" #include "CustomWidget/kbdctrlpropdlg.h" -#include +#include "pub_widget/MessageBox.h" #include #include - +#include "pub_widget/PubWidgetInit.h" KbdTableDataMgr *KbdTableDataMgr::m_pInst = NULL; QMutex KbdTableDataMgr::m_locker; @@ -774,6 +774,8 @@ void KbdTableDataMgr::loadTranslate() m_translates = new QTranslator; m_translates->load(Common::getTranslatePath("model_table_EN.qm")); qApp->installTranslator(m_translates); + + iot_public::installTranslator(Common::getLanguage().toStdString()); } void KbdTableDataMgr::removeTranslate() diff --git a/platform/src/tools/model_table/kbdtablemodel.cpp b/platform/src/tools/model_table/kbdtablemodel.cpp index 70e976a7..8ec48735 100644 --- a/platform/src/tools/model_table/kbdtablemodel.cpp +++ b/platform/src/tools/model_table/kbdtablemodel.cpp @@ -704,6 +704,10 @@ void KbdTableModel::onRowsInserted(const QModelIndex &parent, int first, int las if(m_modelload.isLoading()) return; Q_UNUSED(parent); + qDebug()<<"此表有行插入:tableName:"< +#include "pub_widget/MessageBox.h" #include KbdWidget::KbdWidget(QWidget *parent) : QWidget(parent) @@ -25,23 +25,23 @@ void KbdWidget::showEvent(QShowEvent *event) void KbdWidget::onStartTransactionError(const QString&erroStr) { - QMessageBox::information(this,tr("消息"),erroStr); + N_MessageBox::information(this,tr("消息"),erroStr); } void KbdWidget::onCommitError() { - QMessageBox::information(this,tr("消息"),tr("此次修改失败,已启动回滚!")); + N_MessageBox::information(this,tr("消息"),tr("此次修改失败,已启动回滚!")); } void KbdWidget::onRollbackError() { - QMessageBox::information(this,tr("消息"),tr("回滚事务失败!")); + N_MessageBox::information(this,tr("消息"),tr("回滚事务失败!")); } void KbdWidget::onMsg(const QString &text) { if(m_needToolTip) - QMessageBox::information(this,tr("消息"),text); + N_MessageBox::information(this,tr("消息"),text); } void KbdWidget::blockMsgTip(bool block) diff --git a/platform/src/tools/model_table/model_table.pro b/platform/src/tools/model_table/model_table.pro index 81047cd8..0e551d8c 100644 --- a/platform/src/tools/model_table/model_table.pro +++ b/platform/src/tools/model_table/model_table.pro @@ -37,6 +37,7 @@ LIBS += -ldb_sysinfo_api LIBS += -lmodel_excel LIBS += -lpub_logger_api -lboost_system LIBS += -llog4cplus -lpub_utility_api -lboost_thread +LIBS += -lpub_widget #DEFINES += CODEC_EXECUTE DEFINES += TABLEMODULE_LIBRARY diff --git a/platform/src/tools/model_table/model_table_EN.ts b/platform/src/tools/model_table/model_table_EN.ts index b566d36e..df75d181 100644 --- a/platform/src/tools/model_table/model_table_EN.ts +++ b/platform/src/tools/model_table/model_table_EN.ts @@ -4,9 +4,166 @@ ColorEdit - + 颜色选择 - + Color Selection + + + + KbdBatchDlg + + + 批量修改 + Batch Modify + + + + 相同值 + Same Value + + + + 按行递增 + Increment by Row + + + + 自定义 + Custom + + + + 确定 + OK + + + + 取消 + Cancel + + + + 设置值 + Set Value + + + + 格式 + Format + + + + 例:dev%1 + Example: dev%1 + + + + 起始值 + Start Value + + + + 输入选项值(每行一个) + Enter Option Values (one per line) + + + + + + 该属性最多只能为%1个字符 + The property can have a maximum of %1 characters + + + + 询问 + Query + + + + 自定义内容和设置的内容行数不一致,请确认是否继续? + The number of rows in the custom content does not match the set content, please confirm if you want to continue? + + + + 消息 + Message + + + + KbdCSVReader + + + + json文件打开不成功 + Failed to open JSON file + + + + + + csv文件打开不成功 + Failed to open CSV file + + + + + xlsx文件打开不成功! + Failed to open XLSX file! + + + + + + csv文件数据错误,有行数据大小小于2 + CSV file data error, some rows have less than 2 data elements + + + + + 临时文件保存失败%1 + Temporary file save failed %1 + + + + + 子设备ID + Sub-device ID + + + + 设备ID + Device ID + + + + 属于的设备ID + Belongs to Device ID + + + + + 数据项列数不够 + Not enough data item columns + + + + + + 无此表单%1 + No such form %1 + + + + + + + 写错误%1:%2 + Write error %1: %2 + + + + 保存CSV文件不成功%1 + Failed to save CSV file %1 @@ -15,177 +172,198 @@ 模型为空! - + Model is empty! - 模型为空!%1, -值:%2 - + 模型为空! +值:%1 + 模型为空!%1, +值:%2 + Model is empty! +Value: %1 检查的数据尺寸有问题 - + There is a problem with the size of the data checked 检查的数据尺寸有问题%1, 值:%2 - + Problems with the size of the data checked%1, +the Value:%2 不能为空%1, 值:%2 - + Cannot be null %1, +Value:%2 不能为空 - + Cannot be empty 超出取值范围: - + Out of range: 超出取值范围%1, 值:%2 - + Out of value range %1. +Value: %2 有重复 - + repetitive 有重复%1, 值:%2 - + with duplicates %1. +Value:%2 - 模型为空!%1, -旧值:%2, -新值:%3 - + 模型为空! +旧值:%1, +新值:%2 + Model is empty! +Old value:%1, +New value:%2 检查的数据尺寸有问题!表名:%1, 旧值:%2, 新值:%3 - + There is a problem with the size of the data being checked! Table name:%1, +Old value:%2, +New value:%3 检查的数据尺寸有问题! - + There is a problem with the size of the data being checked! 不能为空%1, 旧值:%2, 新值:%3 - + Cannot be empty %1, +Old value:%2, +New value:%3 超出取值范围%1, 旧值:%2, 新值:%3 - + Out of range %1, +Old value: %2, +New value: %3 有重复%1, 旧值:%2, 新值:%3 - + with duplicate %1, +Old value: %2, +New value: %3 不能为空%1 - + Cannot be empty %1 超出取值范围%1 - + Out of value range %1 有重复%1 - + Duplicate %1 KbdExportImportLogic - + xml文件错误,请检查xml文件格式是否正确! - + XML file error, please check if the XML file format is correct! KbdFindPointWidget - + 路径 - + Path - + 输入过滤条件 - + Enter filter conditions - + root - + root KbdInputDlg + 自定义自增 - + Custom Increment + 字符串格式(占位符%1) - + String format (placeholder %1) + 自增起始数字 - + Increment start number + 示例:dev%1 - + Example: dev%1 - + 消息 - + Message - + 字符串格式需要包含占位符%1 - + String format must include placeholder %1 @@ -193,88 +371,133 @@ 消息 - + Message + + + + KbdPage + + + + 上一页 + Previous Page + + + + + 下一页 + Next Page + + + + 当前总页数是范围是1-%1,%2是非法值 + The current total page range is 1-%1, %2 is an illegal value + + + + 已到达首页 + Reached the first page + + + + 已到达尾页 + Reached the last page + + + + 消息 + Message KbdPasswordDlg - - - 旧密码: - - - 请输入新密码: - + 旧密码: + Old Password: + 请输入新密码: + Please enter a new password: + + + 请重新确认密码: - + 请输入确认密码: + Please enter the confirm password: - + 两次输入的密码不一致 - + 新密码不允许为空 + The new password cannot be empty - + 确认密码不允许为空 + The confirm password cannot be empty + + + 密码不允许包含空格 + The password must not contain spaces + + + 密码不允许为空 - + Password is not allowed to be empty - + 密码长度小于安全策略规定的长度:%1 - + The password length is less than the security policy requires: %1 - + 密码中的字符个数小于安全策略规定的%1个 - + The number of characters in the password is less than the %1 required by the security policy - + 密码中的数字个数小于安全策略规定的%1个 - + The number of digits in the password is less than the %1 required by the security policy - - - + + + 消息 - + Message - + 旧密码错误 - + The old password is incorrect KbdPropertyDlg - + 当前属性表未关联相应模型! - + The current property table is not associated with the corresponding model! - + 写入数据库不成功 - + Failed to write to the database - + 错误 - + Error KbdPropertyPanel - + 浏览属性 - + Browse Properties @@ -282,794 +505,879 @@ 单元格内容替换 - + Cell Content Replacement 查找字符 - + Find Characters 替换字符 - + Replace Characters - + 消息 - + Message - + 查找内容不能为空 - + The search content cannot be empty + + + + KbdSelectDevPointDlg + + + 信息 + Information + + + + 获取%1 信息失败! + Failed to retrieve %1 information! KbdSelectPointDlg - + 已选中点 - + Selected Points + + + + KbdSplitter + + + 专业: + Specialty: + + + + + 添加记录 + Add Record + + + + + 删除记录 + Delete Record + + + + 多选 + Multi-select + + + + 查询 + Query + + + + 修改记录 + Modify Record + + + + 复制记录 + Copy Record + + + + Excel导出 + Export to Excel + + + + Excel导入 + Import from Excel + + + + 请输入通道描述的关键字 + Please enter the keyword for the channel description + + + 所有 + All + + + + 全选 + Select All + + + + 反选 + Invert Selection + + + + + + 消息 + Message + + + + 此次修改失败,已启动回滚! + The modification failed, a rollback has been initiated! KbdTable - - %1 选中行 从0开始自增 - + + 查找替换 + %1 选中行 查找与替换 + Find and Replace - - %1 选中行 从1开始自增 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 消息 + Message - - %1 选中行 自定义自增 - + + 行越界 + Row out of bounds + + + + 列越界 + Column out of bounds + + + + :数据错误 + :Data error + + + + + 请先保存修改 + Please save changes first + + + + + 该列不可编辑 + This column is not editable + + + + + 该列是主键,是否仍然修改? + This column is a primary key, do you still want to modify it? + + + + + 该列是主键,不可编辑 + This column is a primary key and cannot be edited + + + + + 开始执行自增菜单 + Start Executing Auto-increment Menu - %1 选中行 取相同值 - + 批量修改 + Batch Modify - - %1 选中行 查找与替换 - + + 删除行 + Delete Row - - %1 选中行 - + + + 开始执行批量修改 + Start Executing Batch Modify - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 消息 - - - - - - - 请先保存修改 - - - - - - %1 -文本格式不对 - - - - - - - 该列不可编辑 - - - - - - - 该列是主键,是否仍然修改? - - - - - - - 该列是主键,不可编辑 - - - - - - - - 开始执行自增菜单 - - - - - - - + + + + 提交事务失败! - + Transaction Submission Failed! - - - - - 开启事务失败! - - - - - - + + 修改失败 - - - - - - - 修改成功 - - - - - - 开始执行取相同值菜单 - - - - - 要删除的行的第一列是: - + Modification Failed - - 请输入 - + 确定删除数据? + Are you sure you want to delete the data? - - 取相同值 - + + + 开始执行删除菜单 + Starting to execute the delete menu - + + 开启事务失败! + Failed to start transaction! + + + + 删除失败 + Deletion failed + + + + 保存文件 + Save File + + + + 导出失败 + Export Failed + + + + 导出成功 + Export Successful + + + + 导入操作会直接修改数据库,需确保数据正确有效,否则会导致配置错误! + Importing will directly modify the database; ensure the data is correct and valid, otherwise it may cause configuration errors! + + + + 已知悉风险 + I acknowledge the risks + + + + 取消 + Cancel + + + + 打开文件 + Open File + + + + 文件打开失败! + Failed to Open File! + + + + 导入成功 + Import Successful + + + + 控件未加载数据 + Control has not loaded data + + + 表格内容未提交,是否提交到数据库? - + The table content has not been submitted, would you like to submit it to the database? - + + 警告 + Warning + + + + 错误 + Error + + + 保存成功! - + Saved Successfully! KbdTableDataMgr - - 消息 - - - - + 本用户无编辑权限 - + This user has no editing permissions - + + 开启事务失败 + Failed to start transaction + + + 系统退出,开始清理KbdTableDataMgr - + Exiting system, starting to clean up KbdTableDataMgr KbdTableModel - - 查询数据库失败 - - - - - 添加excel表格%1失败 - - - - - - - - - - 选择excel表格%1失败 - - - - - 没有%1表! - - - - - 没有对应模板 - - - - - 数据库添加失败 - - - - - 缺少必要的xml配置 - - - - - - - - excel中不存在%1列 - - - - + 非重写提交模式 - + Non-overwriting commit mode - - - 修改保存失败 - + + 删除数据失败! + Failed to delete data! + + + + 修改数据失败! + Failed to modify data! + + + + 插入数据失败! + Failed to insert data! + + + + KbdWaitPrgDlg + + + 正在处理,请稍候.... + Please wait while processing... + + + + KbdWidget + + + + + + 消息 + Message + + + + 此次修改失败,已启动回滚! + The modification failed, a rollback has been initiated! + + + + 回滚事务失败! + Transaction rollback failed! QObject - - 模型提交服务初始化失败! - - - - - load:%1:%2 User:%3 Psw:%4 - - - - - - 数据库链接初始化失败: - - - - - + + 数据库链接打开失败: - + Failed to open database connection: - - + + 当前数据库地址: - + Current database address: - - + + 数据库: - + Database: - - 启动批量处理 - - - - - 批量处理结束,处理条数%1 - - - - - - - 数据库报告: - - - - - 数据库链接已关闭! - - - - + + 用户: - + User: - + + 数据库链接已关闭!请重新打开软件 - + The database connection has been closed! Please restart the software - - + + 重新打开链接 - + Reopen connection QtBoolEdit - - - + + + True - + True - - + + False - + False QtBoolPropertyManager - + True - + True - + False - + False QtCharEdit - + Clear Char - + Clear Character QtColorEditWidget - + ... - + Choose Color... QtColorPropertyManager - + Red - + Red - + Green - + Green - + Blue - + Blue - + Alpha - + Alpha QtCursorDatabase - + Arrow - + Arrow - + Up Arrow - + Up Arrow - + Cross - + Cross - + Wait - + Wait - + IBeam - + IBeam - + Size Vertical - + Size Vertical - + Size Horizontal - + Size Horizontal - + Size Backslash - + Size Backslash - + Size Slash - + Size Slash - + Size All - + Size All - + Blank - + Blank - + Split Vertical - + Split Vertical - + Split Horizontal - + Split Horizontal - + Pointing Hand - + Pointing Hand - + Forbidden - + Forbidden - + Open Hand - + Open Hand - + Closed Hand - + Closed Hand - + What's This - + What's This - + Busy - + Busy QtFontEditWidget - + ... - + ... - + Select Font - + Select Font QtFontPropertyManager - + Family - + Family - + Point Size - + Point Size - + Bold - + Bold - + Italic - + Italic - + Underline - + Underline - + Strikeout - + Strikeout - + Kerning - + Kerning QtKeySequenceEdit - + Clear Shortcut - + Clear Shortcut QtLocalePropertyManager - + %1, %2 - + %1, %2 - + Language - + Language - + Country - + Country QtPointFPropertyManager - + (%1, %2) - + (%1, %2) - + X - + X - + Y - + Y QtPointPropertyManager - + (%1, %2) - + (%1, %2) - + X - + X - + Y - + Y QtPropertyBrowserUtils - + [%1, %2, %3] (%4) - + [%1, %2, %3] (%4) - + [%1, %2] - + [%1, %2] QtRectFPropertyManager - + [(%1, %2), %3 x %4] - + [(%1, %2), %3 x %4] - + X - + X - + Y - + Y - + Width - + Width - + Height - + Height QtRectPropertyManager - + [(%1, %2), %3 x %4] - + [(%1, %2), %3 x %4] - + X - + X - + Y - + Y - + Width - + Width - + Height - + Height QtSizeFPropertyManager - + %1 x %2 - + %1 x %2 - + Width - + Width - + Height - + Height QtSizePolicyPropertyManager - - + + <Invalid> - + <Invalid> - + [%1, %2, %3, %4] - + [%1, %2, %3, %4] - + Horizontal Policy - + Horizontal Policy - + Vertical Policy - + Vertical Policy - + Horizontal Stretch - + Horizontal Stretch - + Vertical Stretch - + Vertical Stretch QtSizePropertyManager - + %1 x %2 - + %1 x %2 - + Width - + Width - + Height - + Height QtTreePropertyBrowser - + 属性 - + Property - + 值 - + Value @@ -1077,12 +1385,550 @@ 车站编号 - + Station Number 描述 - + Description + + + + Worker + + + 调用%1存储过程失败!参数:%2 + Failed to call the %1 stored procedure! Parameters: %2 + + + + + + + + 提交事务失败!启动回滚 + Transaction submission failed! Initiating rollback + + + + + 存储过程实例化设备组失败!%1 + Failed to instantiate the device group in the stored procedure! %1 + + + + 套件数据格式不对! + The suite data format is incorrect! + + + + + 文件格式不对! + The file format is incorrect! + + + + %1文件打开不成功! + Failed to open %1 file! + + + + 未选择导入的RTU! + No RTU selected for import! + + + + 开始导入数据CSV:%1 RTU:%2 + Starting data import from CSV: %1 RTU: %2 + + + + + + + + + + 清空参数表%错误! + Error clearing parameter table %! + + + + 设备 + Device + + + + + 累积量 + Accumulative Quantity + + + + + 模拟量 + Analog Quantity + + + + + 数字量 + Digital Quantity + + + + + 数字量控制 + Digital Quantity Control + + + + + 保护定值 + Protection Setting + + + + + 导入失败:数据库导入失败! + Import Failed: Database Import Failed! + + + + 未检测到任何设备模板 + No device templates detected + + + + 调用存储过程失败! + Stored Procedure Call Failed! + + + + + + 导入失败!事务已回滚!原因: + Import Failed! Transaction has been rolled back! Reason: + + + + + + 导入失败!原因:事务开启失败 + Import Failed! Reason: Failed to start transaction + + + + 导入结束CSV:%1 + Import Completed CSV: %1 + + + + 执行SQL语句失败 + SQL Statement Execution Failed + + + + 创建设备出错 + Error creating device + + + + 实例化失败! + Instantiation failed! + + + + 批量处理错误! + Batch processing error! + + + + 提交事务失败,已回滚 + Transaction submission failed, has been rolled back + + + + 实例化成功 + Instantiation successful + + + + 关联前置设备成功! + Successfully associated front-end device! + + + + + + + + 缺少配置文件%1 + Missing configuration file %1 + + + + 文件写入不成功,导出失败! + File write failed, export failed! + + + + 导出成功!文件保存在:%1 + Export successful! File saved in: %1 + + + + + 文件打开不成功! + Failed to open file! + + + + 缺少必要的配置文件! + Missing required configuration file! + + + + + + + + 数据库操作:清空表格失败! + Database operation: Failed to clear table! + + + + 导入成功! + Import successful! + + + + + 关联失败! +后台设备与前置设备数量不一致 + 关联失败! +后台设备与前置设备数量不一致 + Association failed! +The number of backend devices does not match the front-end devices + + + + + 关联失败!,失败设备%1 + Association failed! Failed device %1 + + + + + 关联失败!启动回滚,失败设备%1 + Association failed! Initiating rollback, failed device %1 + + + + 关联成功! + Association successful! + + + + 关联失败!失败设备组:%1 + Association failed! Failed device group: %1 + + + + 关联失败!原因:提交事务失败!启动回滚 + Association failed! Reason: Transaction submission failed! Initiating rollback + + + + 关联完毕! + Association complete! + + + + 批量实例化设备组数据错误 + Batch instantiation of device group data error + + + + 数据库链接出错 + Database connection error + + + + 不存在前置设备%1 + Front-end device %1 does not exist + + + + %1 中的表的列数和描述数量不一致! + The number of columns in the %1 table does not match the number of descriptions! + + + + 获取%1 信息失败! + Failed to retrieve %1 information! + + + + 导入失败:没有%1表! + Import failed: No %1 table! + + + + 关联失败!数据库链接错误! + Association failed! Database connection error! + + + + 关联失败!不存在相同名称的前置设备%1,请手动关联! + Association failed! There is no front-end device with the same name %1, please associate manually! + + + + 关联失败!存在多个相同名称的前置设备%1,请手动关联 + Association failed! There are multiple front-end devices with the same name %1, please associate manually + + + + 错误:没有%1表! + Error: No %1 table! + + + + 错误:没有此列%1 + Error: No such column %1 + + + + 生成前置模板模型失败! + Failed to generate front-end template model! + + + + 删除前置模板%1失败 + Failed to delete front-end template %1 + + + + 模拟量控制 + Analog Control + + + + excel文件中没有%1表 + The excel file does not contain a %1 sheet + + + + + 表格%1中没有%2列 + The %1 sheet does not contain a %2 column + + + + 设备模板名为空! + The device template name is empty! + + + + 存在同名模板%1,无法导入 + A template with the same name %1 exists, cannot import + + + + 写入TAG_NAME失败 + Failed to write TAG_NAME + + + + 写入设备描述失败 + Failed to write device description + + + + 前置设备模板 + Front-end device template + + + + 累积量模板点 + Accumulative quantity template point + + + + 模拟量模板点 + Analog quantity template point + + + + 数字量模板点 + Digital quantity template point + + + + 混合量模板点 + Mixed quantity template point + + + + 模拟量控制点 + Analog control point + + + + 数字量控制点 + Digital Control Point + + + + 混合量控制点 + Mixed Quantity Control Point + + + + 数据块 + Data Block + + + + + + + 间隔信号 + Interval Signal + + + + kbdDevInstWidget + + + 专业 + Professional + + + + 多选 + Multi-select + + + + 查询 + Query + + + + + 全选 + Select All + + + + + 反选 + Invert Selection + + + + 显示位置 + Show Location + + + + 显示设备组 + Show Device Group + + + + 显示设备 + Show Device + + + + kbdDevPointWidget + + + 确定 + OK + + + + 点类型 + Point Type + + + + 点值 + Point Value + + + + 点状态 + Point Status + + + + 标签 + Label + + + + 模拟量 + Analog Quantity + + + + 数字量 + Digital Quantity + + + + 累积量 + Accumulative Quantity + + + + 混合量 + Mixed Quantity + + + + kbdSearchWidget + + + 搜索 + Search + + + + 清除 + Clear + + + + 位置、设备组或设备描述关键字 + Keywords for location, device group, or device description + + + + kbdXlsxRead + + + 打开失败: + Failed to open: + + + + kbdtableproperty + + + + 修改失败 + Modification Failed + + + + 修改成功 + Modification Successful diff --git a/platform/src/tools/model_table/qtpropertybrowser/qttreepropertybrowser.cpp b/platform/src/tools/model_table/qtpropertybrowser/qttreepropertybrowser.cpp index c5c8ec86..eb21231e 100644 --- a/platform/src/tools/model_table/qtpropertybrowser/qttreepropertybrowser.cpp +++ b/platform/src/tools/model_table/qtpropertybrowser/qttreepropertybrowser.cpp @@ -364,7 +364,13 @@ void QtPropertyEditorDelegate::paint(QPainter *painter, const QStyleOptionViewIt if (!hasValue && m_editorPrivate->markPropertiesWithoutValue()) { c = opt.palette.color(QPalette::Dark); opt.palette.setColor(QPalette::Text, opt.palette.color(QPalette::BrightText)); - } else { + } + else if (opt.state & QStyle::State_MouseOver) + { + c = opt.palette.color(QPalette::Highlight); + opt.palette.setColor(QPalette::Text, opt.palette.color(QPalette::HighlightedText)); + } + else { c = m_editorPrivate->calculatedBackgroundColor(m_editorPrivate->indexToBrowserItem(index)); if (c.isValid() && (opt.features & QStyleOptionViewItemV2::Alternate)) c = c.lighter(112); diff --git a/platform/src/tools/model_table/tableresource.qrc b/platform/src/tools/model_table/tableresource.qrc index ab478dd3..4cbcab59 100644 --- a/platform/src/tools/model_table/tableresource.qrc +++ b/platform/src/tools/model_table/tableresource.qrc @@ -10,10 +10,6 @@ icons/Excel-export.png icons/Excel-Impor.png icons/revoke.png - icons/arrowBottom.png - icons/arrowLeft.png - icons/arrowRight.png - icons/arrowTop.png icons/down.png icons/search.png icons/hideLeft.png diff --git a/platform/src/tools/model_table/valuedlg.cpp b/platform/src/tools/model_table/valuedlg.cpp index ec9b6378..fe180102 100644 --- a/platform/src/tools/model_table/valuedlg.cpp +++ b/platform/src/tools/model_table/valuedlg.cpp @@ -1,6 +1,6 @@ #include "valuedlg.h" -ValueDlg::ValueDlg(QWidget *parent) : QDialog(parent) +ValueDlg::ValueDlg(QWidget *parent) : CustomDialog(parent) { } diff --git a/platform/src/tools/model_table/worker.cpp b/platform/src/tools/model_table/worker.cpp index 562b85e0..c4ee9eef 100644 --- a/platform/src/tools/model_table/worker.cpp +++ b/platform/src/tools/model_table/worker.cpp @@ -1746,9 +1746,9 @@ QString Worker::befortImportFesTemp(QXlsx::Document &xlsx) ds.isExist(sql,hasTemp); if(hasTemp) { -// if(QMessageBox::Yes == QMessageBox::information(this,tr("消息"), +// if(N_MessageBox::Yes == N_MessageBox::information(this,tr("消息"), // tr("存在同名模板%1,是否修改模板标签名?").arg(devTagName), -// QMessageBox::Yes,QMessageBox::No)) +// N_MessageBox::Yes,N_MessageBox::No)) // { // KbdPropertyDlg dlg(false); // KbdTableModel *model = KbdTableDataMgr::getInstance()->createModel(TBL_FES_DEV_TEMP_DEF); @@ -1921,8 +1921,7 @@ void Worker::deleteEmptyDevPoint(const QStringList &listGroupTag) QStringList listPointTag; QStringList filter; //累积量 - sql = "SELECT TAG_NAME FROM accuml,accuml_map_to_fes WHERE accuml.DEVICE = '%1' AND \ - (accuml.TAG_NAME = getAfterFirstDot(accuml_map_to_fes.KEY_ID_TAG)) AND accuml_map_to_fes.DOT_NO = '-1';"; + sql = "SELECT TAG_NAME FROM accuml,accuml_map_to_fes WHERE accuml.DEVICE = '%1' AND (concat('accuml.', accuml.TAG_NAME) = accuml_map_to_fes.KEY_ID_TAG) AND accuml_map_to_fes.DOT_NO = '-1';"; ds.getOneColumnResult(sql.arg(listDevTag.at(i)),listPointTag); if(!listPointTag.isEmpty()) @@ -1937,8 +1936,7 @@ void Worker::deleteEmptyDevPoint(const QStringList &listGroupTag) //模拟量 listPointTag.clear(); filter.clear(); - sql = "SELECT TAG_NAME FROM analog,analog_map_to_fes WHERE analog.DEVICE = '%1' AND \ - (analog.TAG_NAME = getAfterFirstDot(analog_map_to_fes.KEY_ID_TAG)) AND analog_map_to_fes.DOT_NO = '-1';"; + sql = "SELECT TAG_NAME FROM analog,analog_map_to_fes WHERE analog.DEVICE = '%1' AND (concat('analog.',analog.TAG_NAME) = analog_map_to_fes.KEY_ID_TAG) AND analog_map_to_fes.DOT_NO = '-1';"; ds.getOneColumnResult(sql.arg(listDevTag.at(i)),listPointTag); for(int j = listPointTag.size() - 1;j >= 0;j--) @@ -1967,8 +1965,7 @@ void Worker::deleteEmptyDevPoint(const QStringList &listGroupTag) //数字量 listPointTag.clear(); filter.clear(); - sql = "SELECT TAG_NAME FROM digital,digital_map_to_fes WHERE digital.DEVICE = '%1' AND \ - (digital.TAG_NAME = getAfterFirstDot(digital_map_to_fes.KEY_ID_TAG)) AND digital_map_to_fes.DOT_NO1 = '-1';"; + sql = "SELECT TAG_NAME FROM digital,digital_map_to_fes WHERE digital.DEVICE = '%1' AND (concat('digital.',digital.TAG_NAME) = digital_map_to_fes.KEY_ID_TAG) AND digital_map_to_fes.DOT_NO1 = '-1';"; ds.getOneColumnResult(sql.arg(listDevTag.at(i)),listPointTag); for(int j = listPointTag.size() - 1;j >= 0;j--) @@ -1996,8 +1993,7 @@ void Worker::deleteEmptyDevPoint(const QStringList &listGroupTag) //混合量 listPointTag.clear(); filter.clear(); - sql = "SELECT TAG_NAME FROM mix,mix_map_to_fes WHERE mix.DEVICE = '%1' AND \ - (mix.TAG_NAME = getAfterFirstDot(mix_map_to_fes.KEY_ID_TAG)) AND mix_map_to_fes.DOT_NO = '-1';"; + sql = "SELECT TAG_NAME FROM mix,mix_map_to_fes WHERE mix.DEVICE = '%1' AND (concat('mix.',mix.TAG_NAME) = mix_map_to_fes.KEY_ID_TAG) AND mix_map_to_fes.DOT_NO = '-1';"; ds.getOneColumnResult(sql.arg(listDevTag.at(i)),listPointTag); for(int j = listPointTag.size() - 1;j >= 0;j--) diff --git a/platform/src/tools/model_user/kbdacscollectdlg.cpp b/platform/src/tools/model_user/kbdacscollectdlg.cpp index 841d364f..0bb3f979 100644 --- a/platform/src/tools/model_user/kbdacscollectdlg.cpp +++ b/platform/src/tools/model_user/kbdacscollectdlg.cpp @@ -6,12 +6,12 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" #include -using namespace iot_application; +using namespace iot_app; -kbdAcsCollectDlg::kbdAcsCollectDlg(QWidget *parent) : QDialog(parent) +kbdAcsCollectDlg::kbdAcsCollectDlg(QWidget *parent) : CustomDialog(parent) { initLayout(); initData(); @@ -172,7 +172,7 @@ void kbdAcsCollectDlg::handleFingerprintInfo(bool bSuccess, size_t nDataLen, con m_LabNotes->setText(tr("采集失败")); } -void kbdAcsCollectDlg::handleSetUserInfoResult(const std::list &, void *) +void kbdAcsCollectDlg::handleSetUserInfoResult(const std::list &, void *) { } @@ -182,5 +182,5 @@ void kbdAcsCollectDlg::handleIdentificationEvent(bool, int, size_t, const char * void kbdAcsCollectDlg::onMsg(const QString &text) { - QMessageBox::information(this,tr("消息"),text); + N_MessageBox::information(this,tr("消息"),text); } diff --git a/platform/src/tools/model_user/kbdacscollectdlg.h b/platform/src/tools/model_user/kbdacscollectdlg.h index fb3c4d8f..08c33466 100644 --- a/platform/src/tools/model_user/kbdacscollectdlg.h +++ b/platform/src/tools/model_user/kbdacscollectdlg.h @@ -2,7 +2,7 @@ #define KBDACSCOLLECTDLG_H #include "app_bio_identify/acs_device_api/CAcsDeviceApi.h" -#include +#include "pub_widget/CustomDialog.h" class QLabel; class QComboBox; @@ -24,7 +24,7 @@ enum EM_AcsCollectType EM_CapUserFinger, }; -class kbdAcsCollectDlg : public QDialog, private iot_application::CAcsDeviceApi +class kbdAcsCollectDlg : public CustomDialog, private iot_app::CAcsDeviceApi { Q_OBJECT public: @@ -37,7 +37,7 @@ public: private: void handleFaceInfo(bool bSuccess, size_t nDataLen, const char *pData, void *pUserData) override; void handleFingerprintInfo(bool bSuccess, size_t nDataLen, const char *pData, void *pUserData) override; - void handleSetUserInfoResult(const std::list &, void *) override; + void handleSetUserInfoResult(const std::list &, void *) override; void handleIdentificationEvent(bool , int , size_t , const char *) override; private: void initLayout(); diff --git a/platform/src/tools/model_user/kbdacsdevcfg.cpp b/platform/src/tools/model_user/kbdacsdevcfg.cpp index 6173c5cc..a6921832 100644 --- a/platform/src/tools/model_user/kbdacsdevcfg.cpp +++ b/platform/src/tools/model_user/kbdacsdevcfg.cpp @@ -10,7 +10,7 @@ #include #include "kbdpropertypanel.h" #include "kbdpropertydlg.h" -#include +#include "pub_widget/MessageBox.h" #include "kbddbdesign.h" #include #include @@ -47,10 +47,13 @@ void KbdAcsDevCfg::initLayout() QWidget *widgetTable = new QWidget(hSplitter); QToolBar *bar = new QToolBar(widgetTable); - bar->setIconSize(QSize(24,24)); - bar->addAction(QIcon(":/icons/icons/new.png"),tr("添加"),this,SLOT(onAddTableRow())); - bar->addAction(QIcon(":/icons/icons/delete.png"),tr("删除"),this,SLOT(onRemoveTable())); - bar->addAction(QIcon(":/icons/icons/modify.png"),tr("修改"),this,SLOT(onModifyTable())); + QAction* act = nullptr; + act = bar->addAction(tr("添加"),this,SLOT(onAddTableRow())); + bar->widgetForAction(act)->setObjectName("icon_add"); + act = bar->addAction(tr("删除"),this,SLOT(onRemoveTable())); + bar->widgetForAction(act)->setObjectName("icon_delete"); + act = bar->addAction(tr("修改"),this,SLOT(onModifyTable())); + bar->widgetForAction(act)->setObjectName("icon_edit"); bar->addSeparator(); bar->addAction(tr("下装到设备"),this,SLOT(onLoadAcsInfoToDecice())); @@ -419,10 +422,10 @@ void KbdAcsDevCfg::onNeedSave() { if(m_tabHasModify) { - if(QMessageBox::Yes == QMessageBox::information(this,tr("消息"), + if(N_MessageBox::Yes == N_MessageBox::information(this,tr("消息"), tr("%1已经修改,是否保存?") .arg(m_tabBar->tabText(m_tabBar->currentIndex())), - QMessageBox::Yes,QMessageBox::No)) + N_MessageBox::Yes,N_MessageBox::No)) { onSaveTotal(); m_tabHasModify = false; @@ -469,7 +472,7 @@ void KbdAcsDevCfg::onTabBarChanged(int index) void KbdAcsDevCfg::onMsg(const QString &text) { - QMessageBox::information(this,tr("消息"),text); + N_MessageBox::information(this,tr("消息"),text); } void KbdAcsDevCfg::onLoadAcsInfoToDecice() diff --git a/platform/src/tools/model_user/kbdloadacsinfotodevdlg.cpp b/platform/src/tools/model_user/kbdloadacsinfotodevdlg.cpp index 90c260ba..4dfedb57 100644 --- a/platform/src/tools/model_user/kbdloadacsinfotodevdlg.cpp +++ b/platform/src/tools/model_user/kbdloadacsinfotodevdlg.cpp @@ -8,12 +8,13 @@ #include #include #include -#include +#include "pub_widget/MessageBox.h" -using namespace iot_application; +using namespace iot_app; -kbdLoadAcsInfoToDevDlg::kbdLoadAcsInfoToDevDlg(QWidget *parent) : QDialog(parent) +kbdLoadAcsInfoToDevDlg::kbdLoadAcsInfoToDevDlg(QWidget *parent) : CustomDialog(parent) { + setWindowTitle(tr("下装到设备")); initLayout(); initData(); initTable(); @@ -27,7 +28,7 @@ kbdLoadAcsInfoToDevDlg::~kbdLoadAcsInfoToDevDlg() void kbdLoadAcsInfoToDevDlg::initLayout() { qRegisterMetaType("std::string"); - qRegisterMetaType>("std::list"); + qRegisterMetaType>("std::list"); qRegisterMetaType("size_t"); QVBoxLayout* vLayout = new QVBoxLayout; @@ -135,7 +136,7 @@ void kbdLoadAcsInfoToDevDlg::accept() for(int i = 0;i < m_listSelectAcsDevData.size();i++) { CAcsDevInst* acsInst = new CAcsDevInst(this); - connect(acsInst,SIGNAL(setUserInfoFinish(std::list,void*)),this,SLOT(onLoadAcsDevResult(std::list,void*))); + connect(acsInst,SIGNAL(setUserInfoFinish(std::list,void*)),this,SLOT(onLoadAcsDevResult(std::list,void*))); acsInst->setUserData(m_listUserData); if(acsInst->logIn(m_listSelectAcsDevData.at(i).at(0),m_listSelectAcsDevData.at(i).at(1).toInt(), m_listSelectAcsDevData.at(i).at(2), m_listSelectAcsDevData.at(i).at(3))) @@ -157,7 +158,7 @@ void kbdLoadAcsInfoToDevDlg::accept() } } -void kbdLoadAcsInfoToDevDlg::onLoadAcsDevResult(std::list listUserInfo, void *pUserData) +void kbdLoadAcsInfoToDevDlg::onLoadAcsDevResult(std::list listUserInfo, void *pUserData) { m_hasLoadNum++; int* index = (int*)pUserData; @@ -219,13 +220,13 @@ void kbdLoadAcsInfoToDevDlg::onLoadAcsDevResult(std::list &listUserInfo, void *pUserData) +void CAcsDevInst::handleSetUserInfoResult(const std::list &listUserInfo, void *pUserData) { emit setUserInfoFinish(listUserInfo,pUserData); } @@ -301,7 +302,7 @@ bool CAcsDevInst::loadDataToDevice(void *pUserData) } -CAcsErrorDlg::CAcsErrorDlg(QWidget *parent) : QDialog(parent) +CAcsErrorDlg::CAcsErrorDlg(QWidget *parent) : CustomDialog(parent) { setWindowTitle(tr("下装失败列表")); QVBoxLayout* vLayout = new QVBoxLayout; diff --git a/platform/src/tools/model_user/kbdloadacsinfotodevdlg.h b/platform/src/tools/model_user/kbdloadacsinfotodevdlg.h index 53193ec2..c99cb47f 100644 --- a/platform/src/tools/model_user/kbdloadacsinfotodevdlg.h +++ b/platform/src/tools/model_user/kbdloadacsinfotodevdlg.h @@ -1,14 +1,14 @@ #ifndef KBDLOADACSINFOTODEVDLG_H #define KBDLOADACSINFOTODEVDLG_H -#include #include "app_bio_identify/acs_device_api/CAcsDeviceApi.h" +#include "pub_widget/CustomDialog.h" + class QTableWidget; class kbdAcsCollectDlg; class CAcsErrorDlg; - -class CAcsDevInst : public QObject, private iot_application::CAcsDeviceApi +class CAcsDevInst : public QObject, private iot_app::CAcsDeviceApi { Q_OBJECT public: @@ -21,20 +21,20 @@ private: void handleFingerprintInfo(bool , size_t , const char *, void *) override; - void handleSetUserInfoResult(const std::list &listUserInfo, void *pUserData) override; + void handleSetUserInfoResult(const std::list &listUserInfo, void *pUserData) override; void handleIdentificationEvent(bool , int , size_t , const char *) override; signals: - void setUserInfoFinish(std::list listUserInfo, void *pUserData); + void setUserInfoFinish(std::list listUserInfo, void *pUserData); private: - std::list m_listUserInfo; + std::list m_listUserInfo; }; -class kbdLoadAcsInfoToDevDlg : public QDialog +class kbdLoadAcsInfoToDevDlg : public CustomDialog { Q_OBJECT public: @@ -51,7 +51,7 @@ private: public slots: void accept(); - void onLoadAcsDevResult(std::list listUserInfo, void *pUserData); + void onLoadAcsDevResult(std::list listUserInfo, void *pUserData); private: QTableWidget* m_tableAcsDev; @@ -67,7 +67,7 @@ private: }; -class CAcsErrorDlg : public QDialog +class CAcsErrorDlg : public CustomDialog { Q_OBJECT public: diff --git a/platform/src/tools/model_user/kbdroleview.cpp b/platform/src/tools/model_user/kbdroleview.cpp index d6780292..f5f94ad0 100644 --- a/platform/src/tools/model_user/kbdroleview.cpp +++ b/platform/src/tools/model_user/kbdroleview.cpp @@ -13,7 +13,7 @@ #include #include "kbdpropertypanel.h" #include "kbdpropertydlg.h" -#include +#include "pub_widget/MessageBox.h" #include "kbddbdesign.h" #include #include @@ -56,13 +56,13 @@ void KbdRoleView::initLayout() QAction* temp; QToolBar *bar = new QToolBar(widgetTable); - bar->setIconSize(QSize(24,24)); - temp = bar->addAction(QIcon(":/icons/icons/new.png"),tr("添加"),this,SLOT(onAddTableRow())); - bar->widgetForAction(temp)->setObjectName("Add"); - temp = bar->addAction(QIcon(":/icons/icons/delete.png"),tr("删除"),this,SLOT(onRemoveTable())); - bar->widgetForAction(temp)->setObjectName("Delete"); - temp = bar->addAction(QIcon(":/icons/icons/modify.png"),tr("修改"),this,SLOT(onModifyTable())); - bar->widgetForAction(temp)->setObjectName("Modify"); + QAction* act = nullptr; + temp = bar->addAction(tr("添加"),this,SLOT(onAddTableRow())); + bar->widgetForAction(temp)->setObjectName("icon_add"); + temp = bar->addAction(tr("删除"),this,SLOT(onRemoveTable())); + bar->widgetForAction(temp)->setObjectName("icon_delete"); + temp = bar->addAction(tr("修改"),this,SLOT(onModifyTable())); + bar->widgetForAction(temp)->setObjectName("icon_edit"); m_table = new KbdTable(widgetTable); vLayoutTable->addWidget(bar); @@ -1020,10 +1020,10 @@ void KbdRoleView::onNeedSave() { if(m_tabHasModify) { - if(QMessageBox::Yes == QMessageBox::information(this,tr("消息"), + if(N_MessageBox::Yes == N_MessageBox::information(this,tr("消息"), tr("%1已经修改,是否保存?") .arg(m_tabBar->tabText(m_tabBar->currentIndex())), - QMessageBox::Yes,QMessageBox::No)) + N_MessageBox::Yes,N_MessageBox::No)) { if(m_tabBar->tabText(m_tabBar->currentIndex()) == TAB_ROLE_SPCL_FUNC) { @@ -1308,7 +1308,7 @@ void KbdRoleView::onTabBarChanged(int index) void KbdRoleView::onMsg(const QString &text) { - QMessageBox::information(this,tr("消息"),text); + N_MessageBox::information(this,tr("消息"),text); } diff --git a/platform/src/tools/model_user/kbduserfuncwidget.cpp b/platform/src/tools/model_user/kbduserfuncwidget.cpp index 7dcb2aee..f2193727 100644 --- a/platform/src/tools/model_user/kbduserfuncwidget.cpp +++ b/platform/src/tools/model_user/kbduserfuncwidget.cpp @@ -4,7 +4,7 @@ #include "../model_common/common.h" #include "kbdtablemodel.h" #include "kbdtabledatamgr.h" -#include +#include "pub_widget/MessageBox.h" #include "kbdtable.h" #include "kbdpropertydlg.h" #include "kbdpropertypanel.h" @@ -199,15 +199,15 @@ void KbdUserFuncWidget::onRemoveFuncTableRow() void KbdUserFuncWidget::onStartTransactionError(const QString&erroStr) { - QMessageBox::information(this,tr("消息"),erroStr); + N_MessageBox::information(this,tr("消息"),erroStr); } void KbdUserFuncWidget::onCommitError() { - QMessageBox::information(this,tr("消息"),tr("提交事务失败,已回滚")); + N_MessageBox::information(this,tr("消息"),tr("提交事务失败,已回滚")); } void KbdUserFuncWidget::onMsg(const QString &msg) { - QMessageBox::information(this,tr("消息"),msg); + N_MessageBox::information(this,tr("消息"),msg); } diff --git a/platform/src/tools/model_user/kbdusergroupview.cpp b/platform/src/tools/model_user/kbdusergroupview.cpp index b3ee5869..fe2d8c96 100644 --- a/platform/src/tools/model_user/kbdusergroupview.cpp +++ b/platform/src/tools/model_user/kbdusergroupview.cpp @@ -13,7 +13,7 @@ #include #include "kbdpropertypanel.h" #include "kbdpropertydlg.h" -#include +#include "pub_widget/MessageBox.h" #include #include #include @@ -56,13 +56,12 @@ void KbdUserGroupView::initLayout() QAction* temp; QToolBar *bar = new QToolBar(widgetTable); - bar->setIconSize(QSize(24,24)); - temp = bar->addAction(QIcon(":/icons/icons/new.png"),tr("添加"),this,SLOT(onAddTableRow())); - bar->widgetForAction(temp)->setObjectName("Add"); - temp = bar->addAction(QIcon(":/icons/icons/delete.png"),tr("删除"),this,SLOT(onRemoveTable())); - bar->widgetForAction(temp)->setObjectName("Delete"); - temp = bar->addAction(QIcon(":/icons/icons/modify.png"),tr("修改"),this,SLOT(onModifyTable())); - bar->widgetForAction(temp)->setObjectName("Modify"); + temp = bar->addAction(tr("添加"),this,SLOT(onAddTableRow())); + bar->widgetForAction(temp)->setObjectName("icon_add"); + temp = bar->addAction(tr("删除"),this,SLOT(onRemoveTable())); + bar->widgetForAction(temp)->setObjectName("icon_delete"); + temp = bar->addAction(tr("修改"),this,SLOT(onModifyTable())); + bar->widgetForAction(temp)->setObjectName("icon_edit"); m_table = new KbdTable(widgetTable); vLayoutTable->addWidget(bar); @@ -1259,10 +1258,10 @@ void KbdUserGroupView::onNeedSave() { if(m_tabHasModify) { - if(QMessageBox::Yes == QMessageBox::information(this,tr("消息"), + if(N_MessageBox::Yes == N_MessageBox::information(this,tr("消息"), tr("%1已经修改,是否保存?") .arg(m_tabBar->tabText(m_tabBar->currentIndex())), - QMessageBox::Yes,QMessageBox::No)) + N_MessageBox::Yes,N_MessageBox::No)) { if(m_tabBar->tabText(m_tabBar->currentIndex()) == TAB_USERG_ROLE_LOCATION) { @@ -1322,7 +1321,7 @@ void KbdUserGroupView::onTabBarChanged(int index) void KbdUserGroupView::onMsg(const QString &text) { - QMessageBox::information(this,tr("消息"),text); + N_MessageBox::information(this,tr("消息"),text); } void KbdUserGroupView::onAddTotalWidget() diff --git a/platform/src/tools/model_user/kbduserview.cpp b/platform/src/tools/model_user/kbduserview.cpp index d5aaabbb..3f6d15b7 100644 --- a/platform/src/tools/model_user/kbduserview.cpp +++ b/platform/src/tools/model_user/kbduserview.cpp @@ -14,7 +14,7 @@ #include #include "kbdpropertypanel.h" #include "kbdpropertydlg.h" -#include +#include "pub_widget/MessageBox.h" #include #include "kbddbdesign.h" #include "kbdmsgcontrl.h" @@ -98,16 +98,16 @@ void KbdUserView::initLayout() QVBoxLayout *vLayoutTable = new QVBoxLayout; QWidget *widgetTable = new QWidget(hSplitter); + widgetTable->setObjectName("UserListFrame"); QToolBar *bar = new QToolBar(widgetTable); QAction* temp; - bar->setIconSize(QSize(24,24)); - temp = bar->addAction(QIcon(":/icons/icons/new.png"),tr("添加"),this,SLOT(onAddTableRow())); - bar->widgetForAction(temp)->setObjectName("Add"); - temp = bar->addAction(QIcon(":/icons/icons/delete.png"),tr("删除"),this,SLOT(onRemoveTable())); - bar->widgetForAction(temp)->setObjectName("Delete"); - temp = bar->addAction(QIcon(":/icons/icons/modify.png"),tr("修改"),this,SLOT(onModifyTable())); - bar->widgetForAction(temp)->setObjectName("Modify"); + temp = bar->addAction(tr("添加"),this,SLOT(onAddTableRow())); + bar->widgetForAction(temp)->setObjectName("icon_add"); + temp = bar->addAction(tr("删除"),this,SLOT(onRemoveTable())); + bar->widgetForAction(temp)->setObjectName("icon_delete"); + temp = bar->addAction(tr("修改"),this,SLOT(onModifyTable())); + bar->widgetForAction(temp)->setObjectName("icon_edit"); m_table = new KbdTable(widgetTable); vLayoutTable->addWidget(bar); @@ -557,11 +557,13 @@ QWidget* KbdUserView::initUserGroupCfgWidget() QVBoxLayout *vLayout2 = new QVBoxLayout; m_listTotalLeft = new QListWidget(widget); m_listTotalRight = new QListWidget(widget); - QPushButton *btAdd = new QPushButton(tr("添加<<"),widget); - QPushButton *btRemove = new QPushButton(tr("删除>>"),widget); + m_btAdd = new QPushButton(tr("添加<<"),widget); + m_btAdd->setEnabled(false); + m_btRemove = new QPushButton(tr("删除>>"),widget); + m_btRemove->setEnabled(false); QPushButton *btSave = new QPushButton(tr("保存"),widget); - vLayout2->addWidget(btAdd); - vLayout2->addWidget(btRemove); + vLayout2->addWidget(m_btAdd); + vLayout2->addWidget(m_btRemove); vLayout2->addWidget(btSave); hLayout2->addWidget(m_listTotalLeft); @@ -570,9 +572,11 @@ QWidget* KbdUserView::initUserGroupCfgWidget() hLayout2->setContentsMargins(0,0,0,0); widget->setLayout(hLayout2); - connect(btAdd,SIGNAL(clicked(bool)),this,SLOT(onAddTotalWidget())); - connect(btRemove,SIGNAL(clicked(bool)),this,SLOT(onRemoveTotalWidget())); + connect(m_btAdd,SIGNAL(clicked(bool)),this,SLOT(onAddTotalWidget())); + connect(m_btRemove,SIGNAL(clicked(bool)),this,SLOT(onRemoveTotalWidget())); connect(btSave,SIGNAL(clicked(bool)),this,SLOT(onSaveTotal())); + connect(m_listTotalLeft , &QListWidget::itemSelectionChanged , this , &KbdUserView::onListWidgetSelChange); + connect(m_listTotalRight , &QListWidget::itemSelectionChanged , this , &KbdUserView::onListWidgetSelChange); return widget; } @@ -861,6 +865,7 @@ void KbdUserView::onAddTableRow() if(createID == 0) dlg.panel()->setPropertyValue(CN_PERM_CREATE_DATE, QDateTime::currentDateTime().toString(_TIME_FORMAT)); + dlg.setWindowTitle(tr("新增用户信息")); if(dlg.exec()) { success = true; @@ -946,8 +951,14 @@ void KbdUserView::onModifyTable() { KbdPropertyDlg dlg(true,this); dlg.panel()->setDisplayRow(modelUser,index.row()); + if(m_table->selectionModel()->selectedRows().isEmpty()) + { + KbdMsgContrl::getInstance()->showMsg(tr("请选择对应的用户!"),this); + return; + } if(bModifyRight) dlg.panel()->setModifyOwn(true); + dlg.setWindowTitle(tr("修改用户信息")); if(dlg.exec()) { success = true; @@ -992,10 +1003,10 @@ void KbdUserView::onNeedSave() { if(m_tabHasModify) { - if(QMessageBox::Yes == QMessageBox::information(this,tr("消息"), + if(N_MessageBox::Yes == N_MessageBox::information(this,tr("消息"), tr("%1已经修改,是否保存?") .arg(m_tabBar->tabText(m_tabBar->currentIndex())), - QMessageBox::Yes,QMessageBox::No)) + N_MessageBox::Yes,N_MessageBox::No)) { onSaveTotal(); m_tabHasModify = false; @@ -1009,6 +1020,7 @@ void KbdUserView::onNeedSave() void KbdUserView::onTabBarChanged(int index) { + QString qq = m_tabBar->tabText(index); if(m_tabBar->tabText(index) == TAB_USER_BELONG_DEPT) { m_stackWidget->setCurrentIndex(0); @@ -1044,18 +1056,23 @@ void KbdUserView::onTabBarChanged(int index) void KbdUserView::onMsg(const QString &text) { - QMessageBox::information(this,tr("消息"),text); + N_MessageBox::information(this,tr("消息"),text); } void KbdUserView::onAddTotalWidget() { + if(!m_table->selectionModel()->hasSelection()) + return; switchItem(m_listTotalRight,m_listTotalLeft); m_tabHasModify = true; } void KbdUserView::onRemoveTotalWidget() { + if(!m_table->selectionModel()->hasSelection()) + return; switchItem(m_listTotalLeft,m_listTotalRight); + m_tabHasModify = true; } @@ -1159,7 +1176,8 @@ void KbdUserView::onDeviceCollectFacePic() QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); if(retStr.isEmpty()) { - kbdAcsCollectDlg dlg; + kbdAcsCollectDlg dlg(this); + dlg.setWindowTitle(tr("采集人脸")); if(dlg.CapUserFace()) { QByteArray byteAcsData; @@ -1250,7 +1268,8 @@ void KbdUserView::onAddFingerPic() QString retStr = KbdTableDataMgr::getInstance()->startTransaction(); if(retStr.isEmpty()) { - kbdAcsCollectDlg dlg; + kbdAcsCollectDlg dlg(this); + dlg.setWindowTitle(tr("采集指纹")); if(dlg.CapUserFinger()) { QByteArray byteAcsData; @@ -1443,6 +1462,20 @@ void KbdUserView::onDeleteElcSignature() updateElcSignature(); } +void KbdUserView::onListWidgetSelChange() +{ + if(m_listTotalLeft->selectionModel()->hasSelection()) + m_btRemove->setEnabled(true); + else + m_btRemove->setEnabled(false); + + if(m_listTotalRight->selectionModel()->hasSelection()) + m_btAdd->setEnabled(true); + else + m_btAdd->setEnabled(false); + +} + AcsCfgInfo::AcsCfgInfo(QWidget *parent) : QWidget(parent) { initLayout(); diff --git a/platform/src/tools/model_user/kbduserview.h b/platform/src/tools/model_user/kbduserview.h index 9c993ffb..9c300ec5 100644 --- a/platform/src/tools/model_user/kbduserview.h +++ b/platform/src/tools/model_user/kbduserview.h @@ -15,6 +15,7 @@ class QLineEdit; class QGroupBox; class AcsCfgInfo; class QMenu; +class QPushButton; class KbdUserView : public QWidget { @@ -89,6 +90,9 @@ private: QLabel* m_labSignature; bool m_tabHasModify;//tab控件中数据修改的标志 + + QPushButton *m_btAdd; + QPushButton *m_btRemove; private slots: void onAddTableRow(); void onRemoveTable(); @@ -116,6 +120,7 @@ private slots: void onAddElcSignature(); void onDeleteElcSignature(); + void onListWidgetSelChange(); }; class AcsCfgInfo : public QWidget diff --git a/platform/src/tools/model_user/kbduserwidget.cpp b/platform/src/tools/model_user/kbduserwidget.cpp index 711fa15e..6fe58f4c 100644 --- a/platform/src/tools/model_user/kbduserwidget.cpp +++ b/platform/src/tools/model_user/kbduserwidget.cpp @@ -7,19 +7,29 @@ #include "kbdroleview.h" #include "kbdacsdevcfg.h" #include "../model_common/common.h" +#include "pub_utility_api/I18N.h" +#include "pub_utility_api/FileStyle.h" +#include "pub_widget/PubWidgetInit.h" #include #include #include #include -KbdUserWidget::KbdUserWidget(QWidget *parent):QStackedWidget(parent) +using namespace iot_public; + +KbdUserWidget::KbdUserWidget(QWidget *parent): + QStackedWidget(parent), + m_translates(Q_NULLPTR) { - init(); loadTranslate(); + init(); } -KbdUserWidget::KbdUserWidget(QList listCfgType,QWidget *parent):QStackedWidget(parent) +KbdUserWidget::KbdUserWidget(QList listCfgType,QWidget *parent): + QStackedWidget(parent), + m_translates(Q_NULLPTR) { + loadTranslate(); initTableModule(); for(auto iter = listCfgType.begin();iter != listCfgType.end();iter++) @@ -48,8 +58,6 @@ KbdUserWidget::KbdUserWidget(QList listCfgType,QWidget *parent):QStack break; } } - - loadTranslate(); } KbdUserWidget::~KbdUserWidget() @@ -121,9 +129,19 @@ void KbdUserWidget::initLayout() void KbdUserWidget::loadTranslate() { + QString language = iot_public::getCurLanguage().c_str(); + QString qmFile = "model_user_" + language.toUpper() + ".qm"; m_translates = new QTranslator; - m_translates->load(Common::getTranslatePath("model_user_EN.qm")); + m_translates->load(Common::getTranslatePath(qmFile)); qApp->installTranslator(m_translates); + + qmFile = "model_common_" + language.toUpper() + ".qm"; + auto *pTrans = new QTranslator; + pTrans->load(Common::getTranslatePath(qmFile)); + qApp->installTranslator( pTrans ); + + iot_public::installTranslator(Common::getLanguage().toStdString()); + qApp->processEvents(); } void KbdUserWidget::removeTranslate() diff --git a/platform/src/tools/model_user/kbduserxmlwidget.cpp b/platform/src/tools/model_user/kbduserxmlwidget.cpp index d16db67e..e0324ef1 100644 --- a/platform/src/tools/model_user/kbduserxmlwidget.cpp +++ b/platform/src/tools/model_user/kbduserxmlwidget.cpp @@ -4,7 +4,7 @@ #include "../model_common/common.h" #include "kbdtablemodel.h" #include "kbdtabledatamgr.h" -#include +#include "pub_widget/MessageBox.h" #include "kbdtable.h" #include "kbdpropertydlg.h" #include "kbdpropertypanel.h" @@ -40,11 +40,14 @@ void KbdUserXmlWidget::initLayout() m_tableTotal = new KbdTable(this); m_tableTotal->useDefineMenu(); - bar->setIconSize(QSize(24,24)); - bar->addAction(QIcon(":/icons/icons/new.png"),tr("添加记录"),this,SLOT(onAddTotalTableRow())); - bar->addAction(QIcon(":/icons/icons/modify.png"),tr("修改记录"),this,SLOT(onModifyTotalTableRow())); + QAction* act = nullptr; + act = bar->addAction(tr("添加记录"),this,SLOT(onAddTotalTableRow())); + bar->widgetForAction(act)->setObjectName("icon_add"); + act = bar->addAction(tr("修改记录"),this,SLOT(onModifyTotalTableRow())); + bar->widgetForAction(act)->setObjectName("icon_edit"); bar->addSeparator(); - bar->addAction(QIcon(":/icons/icons/delete.png"),tr("删除记录"),this,SLOT(onRemoveTotalTableRow())); + act = bar->addAction(tr("删除记录"),this,SLOT(onRemoveTotalTableRow())); + bar->widgetForAction(act)->setObjectName("icon_delete"); vLayout->addWidget(bar); vLayout->addWidget(m_tableTotal); @@ -328,15 +331,15 @@ void KbdUserXmlWidget::onRemoveTotalTableRow() void KbdUserXmlWidget::onStartTransactionError(const QString& erroStr) { - QMessageBox::information(this,tr("消息"),erroStr); + N_MessageBox::information(this,tr("消息"),erroStr); } void KbdUserXmlWidget::onCommitError() { - QMessageBox::information(this,tr("消息"),tr("提交事务失败,已回滚")); + N_MessageBox::information(this,tr("消息"),tr("提交事务失败,已回滚")); } void KbdUserXmlWidget::onMsg(const QString &msg) { - QMessageBox::information(this,tr("消息"),msg); + N_MessageBox::information(this,tr("消息"),msg); } diff --git a/platform/src/tools/model_user/model_user.pro b/platform/src/tools/model_user/model_user.pro index 43427bda..94fb6aa0 100644 --- a/platform/src/tools/model_user/model_user.pro +++ b/platform/src/tools/model_user/model_user.pro @@ -38,14 +38,15 @@ DEFINES += QT_DEPRECATED_WARNINGS INCLUDEPATH += $$PWD/../../include/tools/model_common \ $$PWD/../../include/tools/model_table \ - $$PWD/../../include/tools/model_excel/xlsx + $$PWD/../../include/public/pub_excel/xlsx LIBS += -lmodel_common LIBS += -lmodel_table -LIBS += -lmodel_excel +LIBS += -lpub_excel LIBS += -lpub_logger_api LIBS += -llog4cplus -lpub_utility_api -lacs_device_api +LIBS += -lpub_widget SOURCES += \ kbduserwidget.cpp \ @@ -75,7 +76,9 @@ unix { INSTALLS += target } -TRANSLATIONS += model_user_EN.ts +TRANSLATIONS += model_user_EN.ts\ + model_user_FR.ts + #CODECFORTR = utf-8 DEFAULTCODEC = utf-8 #CODEC = utf-8 diff --git a/platform/src/tools/model_user/model_user_EN.ts b/platform/src/tools/model_user/model_user_EN.ts deleted file mode 100644 index 5597356f..00000000 --- a/platform/src/tools/model_user/model_user_EN.ts +++ /dev/null @@ -1,893 +0,0 @@ - - - - - CAcsErrorDlg - - - 下装失败列表 - Download failed list - - - - 设备标签 - Device label - - - - 用户名 - Username - - - - 用户卡 - User card - - - - 人脸 - User face - - - - 失败指纹ID - Failed fingerprint ID - - - - KbdAcsDevCfg - - - 添加 - Add - - - - 删除 - Delete - - - - 修改 - Modify - - - - 下装到设备 - Download to the device - - - - 请选择对应设备 - Please select the corresponding equipment - - - - 添加<< - Add<< - - - - 删除>> - Delete>> - - - - 保存 - Save - - - - 设备关联节点配置 - Device associated node configuration - - - - - - - 事务已回滚 - Transaction rolled back - - - - 保存成功! - Saved successfully - - - - 保存失败 - Save failed - - - - 添加成功! - Added successfully! - - - - 删除成功! - Deleted successfully! - - - - 修改成功! - Modified Successfully - - - - - 消息 - Message - - - - %1已经修改,是否保存? - %1 has been modified, do you want to save it? - - - - KbdRoleView - - - 添加 - Add - - - - 删除 - Delete - - - - 修改 - Modify - - - - 请选择对应角色 - Please select the corresponding role - - - - - 添加<< - Add<< - - - - - 删除>> - Delete>> - - - - - 保存 - Save - - - - 取消所有责任区 - Cancel all areas of responsibility - - - - 全选责任区 - Select all areas of responsibility - - - - 角色普通功能定义 - Definition of role general function - - - - 角色特殊功能定义 - Definition of role special function - - - - 角色画面浏览权限定义 - Role screen browsing authority definition - - - - 角色报表浏览权限定义 - Role report browsing permission definition - - - - 角色数据库表编辑权限定义 - Role database table editing permission definition - - - - - - - - - - - 事务已回滚 - Transaction rolled back - - - - - - - - 保存成功! - Saved successfully! - - - - - - - - 保存失败 - Save failed - - - - 添加成功! - Added successfully! - - - - 数据库链接错误 - Database link error - - - - 以下用户组引用了编号为 %1的角色,请先修改用户组的所属角色! - - The following user group references the role numbered %1, please modify the role of the user group first! - - - - 删除成功! - Deleted successfully! - - - - 修改成功! - Modified successfully! - - - - - 消息 - Message - - - - %1已经修改,是否保存? - %1 has been modified, do you want to save it? - - - - KbdUserFuncWidget - - - 添加记录 - Add record - - - - 修改记录 - Modify record - - - - 删除记录 - Delete Record - - - - 通用功能定义 - General function definition - - - - 特殊功能定义 - Special function definition - - - - - - 事务已回滚 - Transaction rolled back - - - - 添加成功! - Added successfully! - - - - 请选中要修改的行 - Please select the row to be modified - - - - 修改成功! - Modified Successfully! - - - - 基础数据,禁止删除 - Basic data, no deletion - - - - 删除成功! - Deleted successfully! - - - - - - 消息 - Message - - - - 提交事务失败,已回滚 - Failed to commit transaction and rolled back - - - - KbdUserGroupView - - - 添加 - Add - - - - 删除 - Delete - - - - 修改 - Modify - - - - 请选择对应用户组 - Please select the corresponding user group - - - - 添加<< - Add<< - - - - 删除>> - Delete>> - - - - - 保存 - Save - - - - 取消所有位置 - 取消所有车站 - Cancel all locations - - - - 全选所有位置 - 全选所有车站 - Select all locations - - - - 所属位置 - Owned Location - - - - 所属角色 - Owned role - - - - 角色特殊功能所属位置 - role special function location - - - - 画面浏览权限 - Screen browsing permissions - - - - 报表浏览权限 - Report browsing permissions - - - - 数据库表编辑权限 - Database table editing permissions - - - - - - - - - 事务已回滚 - Transaction rolled back - - - - - - - - - 保存成功! - Saved successfully! - - - - - - - - - 保存失败 - Save failed - - - - - - 事务已回滚! - Transaction rolled back - - - - 添加成功! - Added successfully! - - - - 数据库链接错误 - Database link error - - - - 以下用户引用了编号为 %1的用户组,请先修改用户的所属用户组! - - The following users refer to the user group numbered %1, please modify the user group to which the user belongs first! - - - - 删除成功! - Deleted successfully! - - - - 修改成功! - Modified successfully! - - - - - 消息 - Message - - - - %1已经修改,是否保存? - %1 has been modified, do you want to save it? - - - - KbdUserView - - - 添加 - Add - - - - 删除 - Delete - - - - 修改 - Modify - - - - 生物识别信息配置 - Biometric information configuration - - - - 添加<< - Add<< - - - - 删除>> - Delete>> - - - - 保存 - Save - - - - 所属用户组定义 - User group definition - - - - 组长所属用户组定义 - Definition of user group to which the leader belongs - - - - 所属部门定义 - Department definition - - - - - - - - - - - - 事务已回滚 - Transaction rolled back - - - - - - 保存成功! - Saved successfully! - - - - - - - - - - 保存失败 - Save failed - - - - 采集人脸 - Face collection - - - - 采集指纹 - Fingerprint collection - - - - 人脸信息 - Face information - - - - 指纹信息 - Fingerprint collection - - - - 上传人脸照片 - Upload face photos - - - - 设备采集人脸 - Device collects faces - - - - - 修改人脸描述 - Modify face description - - - - 修改指纹 - Modify fingerprint - - - - 删除指纹 - Modify fingerprint - - - - 请添加人脸信息 - Please add face information - - - - - - 提交回滚失败! - Failed to submit rollback! - - - - 添加成功! - Added successfully! - - - - 删除成功! - Deleted successfully! - - - - 修改成功! - Modified successfully! - - - - - 消息 - Message - - - - %1已经修改,是否保存? - %1 has been modified, do you want to save it? - - - - - - - - - 请选择用户 - Please select user - - - - 选择人脸图片 - Choose face picture - - - - 描述 - description - - - - 修改失败 - fail to edit - - - - 删除失败 - failed to delete - - - - KbdUserXmlWidget - - - 添加记录 - Add record - - - - 修改记录 - Modify record - - - - 删除记录 - Delete Record - - - - - 安全策略有且只允许有一条 - Only one security policy is allowed - - - - - - 事务已回滚 - Transaction rolled back - - - - 添加成功! - Added successfully! - - - - 请选中要修改的行 - Please select the row to be modified - - - - 修改成功! - Modified Successfully! - - - - - - - - 数据库链接错误 - Database link error - - - - 以下用户属于该部门 %1,请先修改用户所属部门! - - The following users belong to this department %1, please modify the user's department first! - - - - 以下角色引用了画面编号为 %1的画面,请先修改角色的画面浏览权限! - - The following roles refer to the screen with screen number %1, please modify the role's screen browsing permissions first! - - - - 以下用户组引用了画面编号为 %1的画面,请先修改用户组的画面浏览权限! - - The following user group refers to the screen with the screen number %1, please modify the screen browsing authority of the user group first! - - - - 以下角色引用了报表编号为 %1的报表,请先修改角色的报表浏览权限! - - The following roles refer to the report with the report number %1, please modify the report viewing permission of the role first! - - - - 以下用户组引用了报表编号为 %1的报表,请先修改用户组的报表浏览权限! - - The following user groups refer to the report with the report number %1, please modify the report browsing permissions of the user group first! - - - - 删除成功! - Deleted successfully! - - - - - - 消息 - Message - - - - 提交事务失败,已回滚 - Failed to commit transaction and rolled back - - - - kbdAcsCollectDlg - - - 开始采集 - Start collecting - - - - 设备 - Device - - - - 描述 - Description - - - - 获取设备配置信息失败 - Failed to obtain device configuration information - - - - 连接成功 - connection succeeded - - - - 连接失败 - Connection failed - - - - 采集中,请在设备上按提示操作 - During collection, please follow the prompts on the device - - - - - - 采集失败 - Collected failed - - - - - 采集成功 - Collected Successfully - - - - 消息 - Message - - - - kbdLoadAcsInfoToDevDlg - - - 选择下装设备 - Select download equipment - - - - 标签 - label - - - - 描述 - Description - - - - 启动下装失败: - Failed to start downloading: - - - - 登录失败: - Login failed: - - - - 下装成功 - download Successfully - - - - 消息 - Message - - - diff --git a/platform/src/tools/model_waiting_dlg/model_waiting_dlg_EN.ts b/platform/src/tools/model_waiting_dlg/model_waiting_dlg_EN.ts deleted file mode 100644 index f7c2ef97..00000000 --- a/platform/src/tools/model_waiting_dlg/model_waiting_dlg_EN.ts +++ /dev/null @@ -1,28 +0,0 @@ - - - - - Dialog - - - - 正在登陆数据库... - - - - - 请耐心等待。。。 - - - - - 正在提交登陆信息! - - - - - 正在等待数据库回复。。。 - - - - diff --git a/platform/src/tools/tools.pro b/platform/src/tools/tools.pro index 50edc3ee..6562a864 100644 --- a/platform/src/tools/tools.pro +++ b/platform/src/tools/tools.pro @@ -1,7 +1,7 @@ TEMPLATE = subdirs SUBDIRS += \ - ScriptForm \ + ScriptForm_lua \ model_common \ model_excel \ model_table \ @@ -10,7 +10,9 @@ SUBDIRS += \ model_waiting_dlg \ model_system_config \ model_plugin \ - fbd_designer + fbd_designer \ + tsdb_data_manager \ + tsdb_data_export model_table.depends = model_common model_excel model_user.depends = model_common model_table @@ -18,3 +20,5 @@ model_studio.depends = model_common model_table model_system_config.depends = model_common model_table model_plugin.depends = model_common model_table model_user fbd_designer.depends = model_excel +tsdb_data_export.depends = model_excel +tsdb_data_manager.depends = model_excel