Compare commits
25 Commits
556191d443
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 4d955bb846 | |||
| 31bacbedae | |||
| a3e88f792d | |||
| b65bf5e640 | |||
| 0c36565aec | |||
| b6898b96f7 | |||
| 4f006072e8 | |||
| 472591fbf8 | |||
| f4be39d461 | |||
| 24c69edb82 | |||
| e1629897ed | |||
| f5d4423817 | |||
| 31cc50f4b9 | |||
| e5a46097f1 | |||
| cf1e809290 | |||
| 2622737a52 | |||
| 37480c9d1f | |||
| 4bb2cb414c | |||
|
|
c21f3c3c2d | ||
| fcaddf6ec8 | |||
|
|
6e11617ce8 | ||
|
|
c5824795e6 | ||
|
|
87dcb0db6a | ||
| faa1802095 | |||
| e77ad379ac |
224
.clang-format
Normal file
224
.clang-format
Normal file
@@ -0,0 +1,224 @@
|
|||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
AccessModifierOffset: -4
|
||||||
|
AlignAfterOpenBracket: Align
|
||||||
|
AlignArrayOfStructures: Left
|
||||||
|
AlignConsecutiveAssignments:
|
||||||
|
Enabled: true
|
||||||
|
AcrossEmptyLines: true
|
||||||
|
AcrossComments: true
|
||||||
|
AlignCompound: false
|
||||||
|
PadOperators: true
|
||||||
|
AlignConsecutiveBitFields:
|
||||||
|
Enabled: true
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: true
|
||||||
|
AlignCompound: false
|
||||||
|
PadOperators: true
|
||||||
|
AlignConsecutiveDeclarations:
|
||||||
|
Enabled: false
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
PadOperators: false
|
||||||
|
AlignConsecutiveMacros:
|
||||||
|
Enabled: true
|
||||||
|
AcrossEmptyLines: true
|
||||||
|
AcrossComments: true
|
||||||
|
AlignCompound: false
|
||||||
|
PadOperators: true
|
||||||
|
AlignEscapedNewlines: Left
|
||||||
|
AlignOperands: Align
|
||||||
|
AlignTrailingComments: true
|
||||||
|
AllowAllArgumentsOnNextLine: false
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortBlocksOnASingleLine: Empty
|
||||||
|
AllowShortCaseLabelsOnASingleLine: true
|
||||||
|
AllowShortFunctionsOnASingleLine: Inline
|
||||||
|
AllowShortLambdasOnASingleLine: All
|
||||||
|
AllowShortIfStatementsOnASingleLine: WithoutElse
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
|
AlwaysBreakTemplateDeclarations: Yes
|
||||||
|
AttributeMacros:
|
||||||
|
- __capability
|
||||||
|
BinPackArguments: false
|
||||||
|
BinPackParameters: false
|
||||||
|
BraceWrapping:
|
||||||
|
AfterCaseLabel: false
|
||||||
|
AfterClass: false
|
||||||
|
AfterControlStatement: Never
|
||||||
|
AfterEnum: false
|
||||||
|
AfterFunction: false
|
||||||
|
AfterNamespace: false
|
||||||
|
AfterObjCDeclaration: false
|
||||||
|
AfterStruct: false
|
||||||
|
AfterUnion: false
|
||||||
|
AfterExternBlock: false
|
||||||
|
BeforeCatch: false
|
||||||
|
BeforeElse: false
|
||||||
|
BeforeLambdaBody: false
|
||||||
|
BeforeWhile: false
|
||||||
|
IndentBraces: false
|
||||||
|
SplitEmptyFunction: false
|
||||||
|
SplitEmptyRecord: false
|
||||||
|
SplitEmptyNamespace: true
|
||||||
|
BreakBeforeBinaryOperators: None
|
||||||
|
BreakBeforeConceptDeclarations: Always
|
||||||
|
BreakBeforeBraces: Attach
|
||||||
|
BreakInheritanceList: BeforeComma
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
BreakConstructorInitializers: BeforeComma
|
||||||
|
BreakAfterJavaFieldAnnotations: false
|
||||||
|
BreakStringLiterals: true
|
||||||
|
ColumnLimit: 140
|
||||||
|
CommentPragmas: '^ IWYU pragma:'
|
||||||
|
QualifierAlignment: Leave
|
||||||
|
CompactNamespaces: false
|
||||||
|
ConstructorInitializerIndentWidth: 4
|
||||||
|
ContinuationIndentWidth: 4
|
||||||
|
Cpp11BracedListStyle: true
|
||||||
|
DeriveLineEnding: false
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
DisableFormat: false
|
||||||
|
EmptyLineAfterAccessModifier: Never
|
||||||
|
EmptyLineBeforeAccessModifier: Always
|
||||||
|
ExperimentalAutoDetectBinPacking: false
|
||||||
|
PackConstructorInitializers: CurrentLine
|
||||||
|
BasedOnStyle: ''
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||||
|
AllowAllConstructorInitializersOnNextLine: true
|
||||||
|
FixNamespaceComments: true
|
||||||
|
ForEachMacros:
|
||||||
|
- foreach
|
||||||
|
- Q_FOREACH
|
||||||
|
- BOOST_FOREACH
|
||||||
|
- piForeach
|
||||||
|
- piForeachC
|
||||||
|
- piForeachR
|
||||||
|
- piForeachRC
|
||||||
|
- piForeachCR
|
||||||
|
IfMacros:
|
||||||
|
- KJ_IF_MAYBE
|
||||||
|
IncludeBlocks: Regroup
|
||||||
|
IncludeCategories:
|
||||||
|
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||||
|
Priority: 2
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||||
|
Priority: 3
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
- Regex: '.*'
|
||||||
|
Priority: 1
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
IncludeIsMainRegex: '(Test)?$'
|
||||||
|
IncludeIsMainSourceRegex: ''
|
||||||
|
IndentAccessModifiers: false
|
||||||
|
IndentCaseLabels: false
|
||||||
|
IndentCaseBlocks: false
|
||||||
|
IndentGotoLabels: false
|
||||||
|
IndentPPDirectives: AfterHash
|
||||||
|
IndentExternBlock: NoIndent
|
||||||
|
IndentRequiresClause: true
|
||||||
|
IndentWidth: 4
|
||||||
|
IndentWrappedFunctionNames: false
|
||||||
|
InsertBraces: false
|
||||||
|
InsertTrailingCommas: Wrapped
|
||||||
|
JavaScriptQuotes: Leave
|
||||||
|
JavaScriptWrapImports: true
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||||
|
LambdaBodyIndentation: Signature
|
||||||
|
MacroBlockBegin: "PRIVATE_DEFINITION_START|STATIC_INITIALIZER_BEGIN"
|
||||||
|
MacroBlockEnd: "PRIVATE_DEFINITION_END|STATIC_INITIALIZER_END"
|
||||||
|
MaxEmptyLinesToKeep: 2
|
||||||
|
NamespaceIndentation: None
|
||||||
|
ObjCBinPackProtocolList: Auto
|
||||||
|
ObjCBlockIndentWidth: 2
|
||||||
|
ObjCBreakBeforeNestedBlockParam: true
|
||||||
|
ObjCSpaceAfterProperty: false
|
||||||
|
ObjCSpaceBeforeProtocolList: true
|
||||||
|
PenaltyBreakAssignment: 2
|
||||||
|
PenaltyBreakBeforeFirstCallParameter: 19
|
||||||
|
PenaltyBreakComment: 300
|
||||||
|
PenaltyBreakFirstLessLess: 120
|
||||||
|
PenaltyBreakOpenParenthesis: 0
|
||||||
|
PenaltyBreakString: 1000
|
||||||
|
PenaltyBreakTemplateDeclaration: 10
|
||||||
|
PenaltyExcessCharacter: 1000000
|
||||||
|
PenaltyReturnTypeOnItsOwnLine: 60
|
||||||
|
PenaltyIndentedWhitespace: 0
|
||||||
|
PointerAlignment: Middle
|
||||||
|
PPIndentWidth: 2
|
||||||
|
ReferenceAlignment: Middle
|
||||||
|
ReflowComments: true
|
||||||
|
RemoveBracesLLVM: false
|
||||||
|
RequiresClausePosition: OwnLine
|
||||||
|
SeparateDefinitionBlocks: Leave
|
||||||
|
ShortNamespaceLines: 1
|
||||||
|
SortIncludes: CaseSensitive
|
||||||
|
SortJavaStaticImport: Before
|
||||||
|
SortUsingDeclarations: true
|
||||||
|
SpaceAfterCStyleCast: false
|
||||||
|
SpaceAfterLogicalNot: false
|
||||||
|
SpaceAfterTemplateKeyword: false
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeCaseColon: false
|
||||||
|
SpaceBeforeCpp11BracedList: false
|
||||||
|
SpaceBeforeCtorInitializerColon: false
|
||||||
|
SpaceBeforeInheritanceColon: false
|
||||||
|
SpaceBeforeParens: ControlStatementsExceptControlMacros
|
||||||
|
SpaceBeforeParensOptions:
|
||||||
|
AfterControlStatements: true
|
||||||
|
AfterForeachMacros: false
|
||||||
|
AfterFunctionDefinitionName: false
|
||||||
|
AfterFunctionDeclarationName: false
|
||||||
|
AfterIfMacros: false
|
||||||
|
AfterOverloadedOperator: false
|
||||||
|
AfterRequiresInClause: false
|
||||||
|
AfterRequiresInExpression: false
|
||||||
|
BeforeNonEmptyParentheses: false
|
||||||
|
SpaceAroundPointerQualifiers: Both
|
||||||
|
SpaceBeforeRangeBasedForLoopColon: false
|
||||||
|
SpaceInEmptyBlock: false
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesBeforeTrailingComments: 1
|
||||||
|
SpacesInAngles: Never
|
||||||
|
SpacesInConditionalStatement: false
|
||||||
|
SpacesInContainerLiterals: false
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInLineCommentPrefix:
|
||||||
|
Minimum: 1
|
||||||
|
Maximum: -1
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
SpaceBeforeSquareBrackets: false
|
||||||
|
BitFieldColonSpacing: After
|
||||||
|
Standard: c++11
|
||||||
|
StatementAttributeLikeMacros:
|
||||||
|
- Q_EMIT
|
||||||
|
- PIMETA
|
||||||
|
StatementMacros:
|
||||||
|
- Q_UNUSED
|
||||||
|
- QT_REQUIRE_VERSION
|
||||||
|
- PRIVATE_DECLARATION
|
||||||
|
- NO_COPY_CLASS
|
||||||
|
- FOREVER_WAIT
|
||||||
|
- WAIT_FOREVER
|
||||||
|
TabWidth: 4
|
||||||
|
UseCRLF: false
|
||||||
|
UseTab: AlignWithSpaces
|
||||||
|
WhitespaceSensitiveMacros:
|
||||||
|
- STRINGIZE
|
||||||
|
- PP_STRINGIZE
|
||||||
|
- BOOST_PP_STRINGIZE
|
||||||
|
- NS_SWIFT_NAME
|
||||||
|
- CF_SWIFT_NAME
|
||||||
|
- PIMETA
|
||||||
|
...
|
||||||
|
|
||||||
6
.editorconfig
Normal file
6
.editorconfig
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*.{h,c,cpp}]
|
||||||
|
charset = utf-8
|
||||||
|
indent_style = tab
|
||||||
|
tab_width = 4
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
cmake_policy(SET CMP0017 NEW) # need include() with .cmake
|
cmake_policy(SET CMP0017 NEW) # need include() with .cmake
|
||||||
project(cd)
|
project(CD)
|
||||||
set(cd_MAJOR 1)
|
set(CD_MAJOR 1)
|
||||||
set(cd_MINOR 1)
|
set(CD_MINOR 1)
|
||||||
set(cd_REVISION 0)
|
set(CD_REVISION 1)
|
||||||
set(cd_SUFFIX )
|
set(CD_SUFFIX )
|
||||||
set(cd_COMPANY SHS)
|
set(CD_COMPANY SHS)
|
||||||
set(cd_DOMAIN org.SHS)
|
set(CD_DOMAIN org.SHS)
|
||||||
|
|
||||||
if ("x${CMAKE_MODULE_PATH}" STREQUAL "x")
|
if ("x${CMAKE_MODULE_PATH}" STREQUAL "x")
|
||||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(PIP REQUIRED)
|
find_package(PIP 4.0 REQUIRED)
|
||||||
find_package(QAD)
|
find_package(QAD)
|
||||||
include(SHSTKMacros)
|
include(SHSTKMacros)
|
||||||
shstk_begin_project(cd CD)
|
shstk_begin_project(CD)
|
||||||
if(QAD_FOUND)
|
if(QAD_FOUND)
|
||||||
include(QtWraps)
|
include(QtWraps)
|
||||||
include(SHSTKQtMacros)
|
include(SHSTKQtMacros)
|
||||||
@@ -29,12 +29,12 @@ if(QAD_FOUND)
|
|||||||
option(UTILS "Build various utils" ${_plugins_default_})
|
option(UTILS "Build various utils" ${_plugins_default_})
|
||||||
|
|
||||||
macro(cd_library NAME _MODULES _LIBS)
|
macro(cd_library NAME _MODULES _LIBS)
|
||||||
shstk_qad_project(cd_${NAME} FALSE "cd" "${_MODULES}" "${_LIBS}" ${ARGN})
|
shstk_qad_project(cd_${NAME} FALSE "CD" "${_MODULES}" "${_LIBS}" ${ARGN})
|
||||||
shstk_qad_install("cd" FALSE cd_${NAME} "${out_HDR}" "out_QM")
|
shstk_qad_install("cd" FALSE cd_${NAME} "${out_HDR}" "out_QM")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(cd_application NAME _MODULES _LIBS)
|
macro(cd_application NAME _MODULES _LIBS)
|
||||||
shstk_qad_project(${NAME} TRUE "cd" "${_MODULES}" "${_LIBS}" ${ARGN})
|
shstk_qad_project(${NAME} TRUE "CD" "${_MODULES}" "${_LIBS}" ${ARGN})
|
||||||
shstk_qad_install("cd" TRUE ${NAME} "" "out_QM")
|
shstk_qad_install("cd" TRUE ${NAME} "" "out_QM")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
@@ -42,15 +42,15 @@ if(QAD_FOUND)
|
|||||||
shstk_qad_plugin(cd_${NAME} "${_MODULES}" "cd_${NAME};${_LIBS}")
|
shstk_qad_plugin(cd_${NAME} "${_MODULES}" "cd_${NAME};${_LIBS}")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
shstk_install(cd FALSE "" "${cd_VERSION_FILE}")
|
|
||||||
file(GLOB CMAKES "cmake/*.cmake" "cmake/*.in")
|
|
||||||
install(FILES ${CMAKES} DESTINATION ${CMAKE_ROOT}/Modules)
|
|
||||||
|
|
||||||
set(_qt_libs cd_core)
|
set(_qt_libs cd_core)
|
||||||
set(_qt_plugs)
|
set(_qt_plugs)
|
||||||
set(_qt_apps )
|
set(_qt_apps )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
shstk_install(cd FALSE "" "${CD_VERSION_FILE}")
|
||||||
|
file(GLOB CMAKES "cmake/*.cmake" "cmake/*.in")
|
||||||
|
install(FILES ${CMAKES} DESTINATION ${CMAKE_ROOT}/Modules)
|
||||||
|
|
||||||
add_subdirectory(libs)
|
add_subdirectory(libs)
|
||||||
if (UTILS AND QAD_FOUND)
|
if (UTILS AND QAD_FOUND)
|
||||||
add_subdirectory(utils)
|
add_subdirectory(utils)
|
||||||
@@ -63,9 +63,9 @@ endif()
|
|||||||
|
|
||||||
message("----------CD-----------")
|
message("----------CD-----------")
|
||||||
message(" Build for ${QtVersions}")
|
message(" Build for ${QtVersions}")
|
||||||
message(" Version: ${cd_VERSION} ")
|
message(" Version: ${CD_VERSION} ")
|
||||||
message(" Linkage: ${cd_LIB_TYPE_MSG}")
|
message(" Linkage: ${CD_LIB_TYPE_MSG}")
|
||||||
message(" Type : ${cd_BUILD_TYPE}")
|
message(" Type : ${CD_BUILD_TYPE}")
|
||||||
if (NOT LOCAL)
|
if (NOT LOCAL)
|
||||||
message(" Install: \"${CMAKE_INSTALL_PREFIX}\"")
|
message(" Install: \"${CMAKE_INSTALL_PREFIX}\"")
|
||||||
else()
|
else()
|
||||||
|
|||||||
@@ -12,17 +12,14 @@ cmake_policy(SET CMP0011 NEW) # don`t affect includer policies
|
|||||||
cmake_policy(SET CMP0020 NEW) # Automatically link Qt executables to qtmain target on Windows
|
cmake_policy(SET CMP0020 NEW) # Automatically link Qt executables to qtmain target on Windows
|
||||||
find_package(PIP REQUIRED)
|
find_package(PIP REQUIRED)
|
||||||
find_package(QAD QUIET)
|
find_package(QAD QUIET)
|
||||||
include(QtWraps)
|
|
||||||
include(SHSTKMacros)
|
include(SHSTKMacros)
|
||||||
|
|
||||||
shstk_is_parent_exists(hasParent PARENT_DIRECTORY)
|
shstk_is_parent_exists(hasParent PARENT_DIRECTORY)
|
||||||
|
|
||||||
shstk_set_find_dirs(cd CD)
|
shstk_set_find_dirs(CD)
|
||||||
set(_SEARCH_DIR ${cd_LIBDIR})
|
|
||||||
|
|
||||||
if (NOT BUILDING_cd)
|
if (NOT BUILDING_CD)
|
||||||
list(APPEND _SEARCH_DIR $ENV{SMSDK_DIR}/lib)
|
shstk_find_header(CD "cd_version.h" ${CD_INCDIR})
|
||||||
shstk_find_header(cd CD "cd_version.h" "")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CD_FIND_VERSION VERSION_GREATER CD_VERSION)
|
if(CD_FIND_VERSION VERSION_GREATER CD_VERSION)
|
||||||
@@ -37,9 +34,9 @@ set( __inc_core "")
|
|||||||
set(__libs_core "")
|
set(__libs_core "")
|
||||||
set(__deps_core "PIP")
|
set(__deps_core "PIP")
|
||||||
|
|
||||||
if (BUILDING_cd)
|
if (BUILDING_CD)
|
||||||
|
|
||||||
if (NOT SET_TARGETS_cd)
|
if (NOT SET_TARGETS_CD)
|
||||||
#message("create aliases")
|
#message("create aliases")
|
||||||
foreach (_l ${__libs})
|
foreach (_l ${__libs})
|
||||||
set(_m ${__module_${_l}})
|
set(_m ${__module_${_l}})
|
||||||
@@ -55,12 +52,12 @@ else()
|
|||||||
#message("create interfaces")
|
#message("create interfaces")
|
||||||
foreach (_l ${__libs})
|
foreach (_l ${__libs})
|
||||||
set(_m ${__module_${_l}})
|
set(_m ${__module_${_l}})
|
||||||
find_library(CD_LIBRARY_${_l} cd_${_l} HINTS ${_SEARCH_DIR})
|
find_library(CD_LIBRARY_${_l} cd_${_l} HINTS ${CD_LIBDIR})
|
||||||
if((NOT TARGET CD::${_m}) AND CD_LIBRARY_${_l})
|
if((NOT TARGET CD::${_m}) AND CD_LIBRARY_${_l})
|
||||||
add_library(CD::${_m} UNKNOWN IMPORTED)
|
add_library(CD::${_m} UNKNOWN IMPORTED)
|
||||||
set_target_properties(CD::${_m} PROPERTIES
|
set_target_properties(CD::${_m} PROPERTIES
|
||||||
IMPORTED_LOCATION "${CD_LIBRARY_${_l}}"
|
IMPORTED_LOCATION "${CD_LIBRARY_${_l}}"
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${cd_INCLUDES};${__inc_${_l}}"
|
INTERFACE_INCLUDE_DIRECTORIES "${CD_INCLUDES};${__inc_${_l}}"
|
||||||
INTERFACE_LINK_LIBRARIES "${__deps_${_l}};${__libs_${_l}}")
|
INTERFACE_LINK_LIBRARIES "${__deps_${_l}};${__libs_${_l}}")
|
||||||
#message("imported CD::${_m} = ${CD_LIBRARY_${_l}} ${__deps_${_l}} ${__libs_${_l}} ${__inc_${_l}}")
|
#message("imported CD::${_m} = ${CD_LIBRARY_${_l}} ${__deps_${_l}} ${__libs_${_l}} ${__inc_${_l}}")
|
||||||
endif()
|
endif()
|
||||||
@@ -71,6 +68,7 @@ endif()
|
|||||||
|
|
||||||
if (QAD_FOUND OR BUILDING_qad)
|
if (QAD_FOUND OR BUILDING_qad)
|
||||||
|
|
||||||
|
include(QtWraps)
|
||||||
set(__libs "qt")
|
set(__libs "qt")
|
||||||
|
|
||||||
set(__module_qt Qt)
|
set(__module_qt Qt)
|
||||||
@@ -78,10 +76,10 @@ if (QAD_FOUND OR BUILDING_qad)
|
|||||||
set(__libs_qt "")
|
set(__libs_qt "")
|
||||||
set(__deps_qt "QAD::PIQt;QAD::Graphic;CD::Core")
|
set(__deps_qt "QAD::PIQt;QAD::Graphic;CD::Core")
|
||||||
|
|
||||||
if (BUILDING_cd)
|
if (BUILDING_CD)
|
||||||
|
|
||||||
if (NOT SET_TARGETS_cd)
|
if (NOT SET_TARGETS_CD)
|
||||||
set(SET_TARGETS_cd ON CACHE BOOL "")
|
set(SET_TARGETS_CD ON CACHE BOOL "")
|
||||||
#message("create aliases")
|
#message("create aliases")
|
||||||
foreach(_l ${__libs})
|
foreach(_l ${__libs})
|
||||||
foreach(_v ${_QT_VERSIONS_})
|
foreach(_v ${_QT_VERSIONS_})
|
||||||
@@ -102,7 +100,7 @@ if (QAD_FOUND OR BUILDING_qad)
|
|||||||
foreach(_l ${__libs})
|
foreach(_l ${__libs})
|
||||||
foreach(_v ${_QT_VERSIONS_})
|
foreach(_v ${_QT_VERSIONS_})
|
||||||
set(_m ${__module_${_l}})
|
set(_m ${__module_${_l}})
|
||||||
find_library(CD_LIBRARY_${_l}${_v} cd_${_l}${_v} HINTS ${cd_LIBDIR})
|
find_library(CD_LIBRARY_${_l}${_v} cd_${_l}${_v} HINTS ${CD_LIBDIR})
|
||||||
#message("found ${_l}${_v} = ${CD_LIBRARY_${_l}${_v}}")
|
#message("found ${_l}${_v} = ${CD_LIBRARY_${_l}${_v}}")
|
||||||
if((NOT TARGET CD::${_m}${_v}) AND CD_LIBRARY_${_l}${_v})
|
if((NOT TARGET CD::${_m}${_v}) AND CD_LIBRARY_${_l}${_v})
|
||||||
#message("imported CD::${_m}${_v} = ${CD_LIBRARY_${_l}${_v}}")
|
#message("imported CD::${_m}${_v} = ${CD_LIBRARY_${_l}${_v}}")
|
||||||
@@ -118,7 +116,7 @@ if (QAD_FOUND OR BUILDING_qad)
|
|||||||
endforeach()
|
endforeach()
|
||||||
set_target_properties(CD::${_m}${_v} PROPERTIES
|
set_target_properties(CD::${_m}${_v} PROPERTIES
|
||||||
IMPORTED_LOCATION "${CD_LIBRARY_${_l}${_v}}"
|
IMPORTED_LOCATION "${CD_LIBRARY_${_l}${_v}}"
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${cd_INCLUDES}"
|
INTERFACE_INCLUDE_DIRECTORIES "${CD_INCLUDES}"
|
||||||
INTERFACE_LINK_LIBRARIES "${_deps}")
|
INTERFACE_LINK_LIBRARIES "${_deps}")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
project(cd_core)
|
project(cd_core)
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
file(GLOB CPPS "cdutils_*.cpp")
|
file(GLOB CPPS "cdutils_*.cpp")
|
||||||
file(GLOB HDRS "cdutils_*.h")
|
file(GLOB HDRS "cdutils_*.h")
|
||||||
|
|
||||||
import_version(${PROJECT_NAME} cd)
|
import_version(${PROJECT_NAME} CD)
|
||||||
set_deploy_property(${PROJECT_NAME} ${cd_LIB_TYPE}
|
set_deploy_property(${PROJECT_NAME} ${CD_LIB_TYPE}
|
||||||
LABEL "Core CD library"
|
LABEL "Core CD library"
|
||||||
FULLNAME "${cd_DOMAIN}.${PROJECT_NAME}"
|
FULLNAME "${CD_DOMAIN}.${PROJECT_NAME}"
|
||||||
COMPANY "${cd_COMPANY}"
|
COMPANY "${CD_COMPANY}"
|
||||||
INFO "Control & Debug library")
|
INFO "Control & Debug library")
|
||||||
make_rc(${PROJECT_NAME} _RC)
|
make_rc(${PROJECT_NAME} _RC)
|
||||||
add_library(${PROJECT_NAME} ${cd_LIB_TYPE} ${CPPS} ${HDRS} ${_RC})
|
add_library(${PROJECT_NAME} ${CD_LIB_TYPE} ${CPPS} ${HDRS} ${_RC})
|
||||||
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
target_link_libraries(${PROJECT_NAME} PIP)
|
target_link_libraries(${PROJECT_NAME} PIP)
|
||||||
generate_export_header(${PROJECT_NAME})
|
generate_export_header(${PROJECT_NAME})
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "cdutils_c.h"
|
#include "cdutils_c.h"
|
||||||
|
|
||||||
#include "cdutils_core.h"
|
#include "cdutils_core.h"
|
||||||
|
|
||||||
using namespace CDUtils;
|
using namespace CDUtils;
|
||||||
@@ -6,8 +7,7 @@ using namespace CDUtils;
|
|||||||
CInterface C;
|
CInterface C;
|
||||||
|
|
||||||
|
|
||||||
CInterface::CInterface(): Interface(CDType::cdC) {
|
CInterface::CInterface(): Interface(CDType::cdC) {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CInterface::sendCommand(const CDType & c) {
|
void CInterface::sendCommand(const CDType & c) {
|
||||||
@@ -26,13 +26,12 @@ void CInterface::autoConnect(PIObject * o, const PIString & prefix) {
|
|||||||
if (!PIObject::__meta_data().contains(cid)) return;
|
if (!PIObject::__meta_data().contains(cid)) return;
|
||||||
PIMap<PIString, Handler> eh_map;
|
PIMap<PIString, Handler> eh_map;
|
||||||
PIObject::__MetaData & md(PIObject::__meta_data()[cid]);
|
PIObject::__MetaData & md(PIObject::__meta_data()[cid]);
|
||||||
PIMap<const void * , __MetaFunc>::const_iterator it;
|
for (auto it = md.eh_func.begin(); it != md.eh_func.end(); ++it) {
|
||||||
for (it = md.eh_func.constBegin(); it != md.eh_func.constEnd(); ++it) {
|
|
||||||
eh_map[it.value().func_name] = (Handler)it.value().addr;
|
eh_map[it.value().func_name] = (Handler)it.value().addr;
|
||||||
// piCout << "func" << it.value().func_name;
|
// piCout << "func" << it.value().func_name;
|
||||||
}
|
}
|
||||||
PIVector<CDType *> cl = C.root().children();
|
PIVector<CDType *> cl = C.root().children();
|
||||||
piForeachC (CDType * c, cl) {
|
for (const auto * c: cl) {
|
||||||
PIString cp = prefix + c->pathString().join("_");
|
PIString cp = prefix + c->pathString().join("_");
|
||||||
if (cp.isEmpty()) continue;
|
if (cp.isEmpty()) continue;
|
||||||
if (!eh_map.contains(cp)) continue;
|
if (!eh_map.contains(cp)) continue;
|
||||||
|
|||||||
@@ -20,26 +20,25 @@
|
|||||||
#ifndef CDUTILS_C_H
|
#ifndef CDUTILS_C_H
|
||||||
#define CDUTILS_C_H
|
#define CDUTILS_C_H
|
||||||
|
|
||||||
#include "cdutils_interface.h"
|
|
||||||
#include "cdutils_core.h"
|
#include "cdutils_core.h"
|
||||||
|
#include "cdutils_interface.h"
|
||||||
|
|
||||||
|
|
||||||
namespace CDUtils {
|
namespace CDUtils {
|
||||||
|
|
||||||
|
|
||||||
class CD_CORE_EXPORT CInterface: public Interface
|
class CD_CORE_EXPORT CInterface: public Interface {
|
||||||
{
|
|
||||||
PIOBJECT_SUBCLASS(CInterface, Interface);
|
PIOBJECT_SUBCLASS(CInterface, Interface);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CInterface();
|
CInterface();
|
||||||
|
|
||||||
void sendCommand(const CDType & c);
|
void sendCommand(const CDType & c);
|
||||||
void connect(const CDType & c, PIObject * o, Handler eh);
|
void connect(const CDType & c, PIObject * o, Handler eh);
|
||||||
void autoConnect(PIObject * o, const PIString & prefix = PIStringAscii("c_"));
|
void autoConnect(PIObject * o, const PIString & prefix = PIStringAscii("c_"));
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace CDUtils
|
||||||
|
|
||||||
extern CD_CORE_EXPORT CDUtils::CInterface C;
|
extern CD_CORE_EXPORT CDUtils::CInterface C;
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
#include "cdutils_core.h"
|
#include "cdutils_core.h"
|
||||||
|
|
||||||
#include "cdutils_parser.h"
|
#include "cdutils_parser.h"
|
||||||
#include "piconfig.h"
|
#include "piconfig.h"
|
||||||
#include "piiobytearray.h"
|
#include "piiobytearray.h"
|
||||||
#include "piiostring.h"
|
#include "piiostring.h"
|
||||||
#include "pifile.h"
|
#include "piliterals_time.h"
|
||||||
|
|
||||||
using namespace CDUtils;
|
using namespace CDUtils;
|
||||||
|
|
||||||
const char CDCore::app_config[] =
|
const char CDCore::app_config[] = "include = cd_ip.conf\n\
|
||||||
"include = cd_ip.conf\n\
|
|
||||||
port_rec = 2\n\
|
port_rec = 2\n\
|
||||||
port_send = 1\n\
|
port_send = 1\n\
|
||||||
[connection]\n\
|
[connection]\n\
|
||||||
@@ -17,8 +17,7 @@ const char CDCore::app_config[] =
|
|||||||
connectionmodel = AAAM2Xja7VXLTttAFD12QpsikKjUSixYlLbKEpIUtVIlVEfqhk2FWuiGRRolUYtoHgrmpYiv6IItf8AveMMH9E/YsG6Ph3sde5hGoQoblLGuPHfunTPjc49nADxDA110+LTYC7FrPCAPeAO+vZu+aX7c/8PGd45WCJC0OGcfT6FDnmfSTPtwhZFt3HjgDs/Qtu5jPbZHtI/x50XfIzMQbdwEolbg9INP4ku++myPaUtCHYRaT2j1ldIh3VP60/Qff8vSfXLu9BP6JX9K/0TVH6jqVe22P1X/fao/oddWu/paDs1vBf9Jv/EZ91clbyHqv7BL6sscDOd4v4WTqs6jzaHGJ8QJerxlpJSpdZ7IWFJvDW7I2JxZqIM62k6A57RZmMQGmlyrxdV+WGBnmR01mXPI267hBKwp4FeBeo9VPtssxyb7rzHg1B7T9nCMU45U8BZlWuVWtIcD/CRGOqtsbW09851tXsHN0UTlLIAdASjSXnLyLn+H7L2+xbGYvC63Ezqg543egkLmn8qnRF6USbM4Qp9godkhzI777Ne5bCIt/5UtGz2o/yGby0nKpjqmbOa1ynkjmyzIrzvIZUeBPjvlUmbh32EFJbGyJZhR8YcvlS+3TpjhqeWSyvUkpbI9plSWtcKLcsK05beOJVEnhaEFfHEH+RwpeMcpn1JKGqWMNOL+G6wZyahlpdVOtufKfbDS+guLke9O\n\
|
connectionmodel = AAAM2Xja7VXLTttAFD12QpsikKjUSixYlLbKEpIUtVIlVEfqhk2FWuiGRRolUYtoHgrmpYiv6IItf8AveMMH9E/YsG6Ph3sde5hGoQoblLGuPHfunTPjc49nADxDA110+LTYC7FrPCAPeAO+vZu+aX7c/8PGd45WCJC0OGcfT6FDnmfSTPtwhZFt3HjgDs/Qtu5jPbZHtI/x50XfIzMQbdwEolbg9INP4ku++myPaUtCHYRaT2j1ldIh3VP60/Qff8vSfXLu9BP6JX9K/0TVH6jqVe22P1X/fao/oddWu/paDs1vBf9Jv/EZ91clbyHqv7BL6sscDOd4v4WTqs6jzaHGJ8QJerxlpJSpdZ7IWFJvDW7I2JxZqIM62k6A57RZmMQGmlyrxdV+WGBnmR01mXPI267hBKwp4FeBeo9VPtssxyb7rzHg1B7T9nCMU45U8BZlWuVWtIcD/CRGOqtsbW09851tXsHN0UTlLIAdASjSXnLyLn+H7L2+xbGYvC63Ezqg543egkLmn8qnRF6USbM4Qp9godkhzI777Ne5bCIt/5UtGz2o/yGby0nKpjqmbOa1ynkjmyzIrzvIZUeBPjvlUmbh32EFJbGyJZhR8YcvlS+3TpjhqeWSyvUkpbI9plSWtcKLcsK05beOJVEnhaEFfHEH+RwpeMcpn1JKGqWMNOL+G6wZyahlpdVOtufKfbDS+guLke9O\n\
|
||||||
";
|
";
|
||||||
|
|
||||||
const char CDCore::pult_config[] =
|
const char CDCore::pult_config[] = "include = cd_ip.conf\n\
|
||||||
"include = cd_ip.conf\n\
|
|
||||||
port_rec = 1\n\
|
port_rec = 1\n\
|
||||||
port_send = 2\n\
|
port_send = 2\n\
|
||||||
[connection]\n\
|
[connection]\n\
|
||||||
@@ -55,12 +54,11 @@ __Core_Initializer__::~__Core_Initializer__() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CDCore::CDCore() {
|
CDCore::CDCore() {
|
||||||
setName("CDCore");
|
setName("CDCore");
|
||||||
x_timer.setName("__S__.CDCore.x_timer");
|
x_timer.setName("_S.CDCore.x_timer");
|
||||||
datatr.setPacketSize(960);
|
datatr.setPacketSize(960);
|
||||||
|
cout_buffer_id = PICout::registerExternalBufferID();
|
||||||
CONNECTU(&connection, dataReceivedEvent, this, dataReceived);
|
CONNECTU(&connection, dataReceivedEvent, this, dataReceived);
|
||||||
CONNECTU(PICout::Notifier::object(), finished, this, piCoutFinished);
|
CONNECTU(PICout::Notifier::object(), finished, this, piCoutFinished);
|
||||||
/*PIString s(app_config);
|
/*PIString s(app_config);
|
||||||
@@ -94,10 +92,10 @@ CDCore::CDCore() {
|
|||||||
|
|
||||||
|
|
||||||
CDCore::~CDCore() {
|
CDCore::~CDCore() {
|
||||||
x_timer.stop(true);
|
x_timer.stopAndWait();
|
||||||
datatr.stop();
|
datatr.stop();
|
||||||
sendt.stop();
|
sendt.stop();
|
||||||
sendt.waitForFinish(10);
|
sendt.waitForFinish(100_ms);
|
||||||
connection.stop();
|
connection.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,12 +108,11 @@ void CDCore::cd_write(CDSection * cd, PIIODevice * d) {
|
|||||||
void CDCore::cd_read(CDSection * cd, PIIODevice * d) {
|
void CDCore::cd_read(CDSection * cd, PIIODevice * d) {
|
||||||
PIConfig conf(d, PIIODevice::ReadOnly);
|
PIConfig conf(d, PIIODevice::ReadOnly);
|
||||||
cd->read(&(conf.rootEntry()));
|
cd->read(&(conf.rootEntry()));
|
||||||
if (cd->cd_type_ == CDType::cdX)
|
if (cd->cd_type_ == CDType::cdX) x_selected = cd->collectX();
|
||||||
x_selected = cd->collectX();
|
|
||||||
initRoot(cd);
|
initRoot(cd);
|
||||||
raiseChangedGlobal(cd->cd_type_);
|
raiseChangedGlobal(cd->cd_type_);
|
||||||
/*PIVector<PIIODevice * > ds = connection.allDevices();
|
/*PIVector<PIIODevice * > ds = connection.allDevices();
|
||||||
piForeach(PIIODevice * d, ds) {
|
for (PIIODevice * d: ds) {
|
||||||
if (d)
|
if (d)
|
||||||
piCoutObj << d->constructFullPath() << d->isOpened();
|
piCoutObj << d->constructFullPath() << d->isOpened();
|
||||||
}*/
|
}*/
|
||||||
@@ -218,8 +215,7 @@ void CDCore::init(const PIString & configuration, bool pult) {
|
|||||||
|
|
||||||
|
|
||||||
void CDCore::stop() {
|
void CDCore::stop() {
|
||||||
x_timer.stop();
|
x_timer.stopAndWait();
|
||||||
x_timer.waitForFinish(1000);
|
|
||||||
connection.stop();
|
connection.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,14 +228,12 @@ void CDCore::release() {
|
|||||||
|
|
||||||
void CDCore::startX(double freq) {
|
void CDCore::startX(double freq) {
|
||||||
// piCout << "start x" << x_timer.isRunning() << freq;
|
// piCout << "start x" << x_timer.isRunning() << freq;
|
||||||
if (!x_timer.isRunning())
|
if (!x_timer.isRunning()) x_timer.start(piMax(PISystemTime::Frequency::fromHertz(freq), 0.01_Hz));
|
||||||
x_timer.start(1000. / piMaxd(freq, 0.01));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDCore::stopX() {
|
void CDCore::stopX() {
|
||||||
x_timer.stop();
|
x_timer.stopAndWait();
|
||||||
x_timer.waitForFinish(1000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -327,29 +321,37 @@ void CDCore::sendThread() {
|
|||||||
bool ok = datatr.send(send_data);
|
bool ok = datatr.send(send_data);
|
||||||
switch (h.type) {
|
switch (h.type) {
|
||||||
case CD_KSend:
|
case CD_KSend:
|
||||||
if (ok) K_Sended();
|
if (ok)
|
||||||
else K_SendFail();
|
K_Sended();
|
||||||
|
else
|
||||||
|
K_SendFail();
|
||||||
break;
|
break;
|
||||||
case CD_KQuery:
|
case CD_KQuery:
|
||||||
if (!ok) K_ReceiveFail();
|
if (!ok) K_ReceiveFail();
|
||||||
break;
|
break;
|
||||||
case CD_XSend:
|
case CD_XSend:
|
||||||
if (ok) X_Sended();
|
if (ok)
|
||||||
else X_SendFail();
|
X_Sended();
|
||||||
|
else
|
||||||
|
X_SendFail();
|
||||||
break;
|
break;
|
||||||
case CD_XQuery:
|
case CD_XQuery:
|
||||||
if (!ok) X_ReceiveFail();
|
if (!ok) X_ReceiveFail();
|
||||||
break;
|
break;
|
||||||
case CD_CSend:
|
case CD_CSend:
|
||||||
if (ok) C_Sended();
|
if (ok)
|
||||||
else C_SendFail();
|
C_Sended();
|
||||||
|
else
|
||||||
|
C_SendFail();
|
||||||
break;
|
break;
|
||||||
case CD_CQuery:
|
case CD_CQuery:
|
||||||
if (!ok) C_ReceiveFail();
|
if (!ok) C_ReceiveFail();
|
||||||
break;
|
break;
|
||||||
case CD_MSend:
|
case CD_MSend:
|
||||||
if (ok) M_Sended();
|
if (ok)
|
||||||
else M_SendFail();
|
M_Sended();
|
||||||
|
else
|
||||||
|
M_SendFail();
|
||||||
break;
|
break;
|
||||||
case CD_MQuery:
|
case CD_MQuery:
|
||||||
if (!ok) M_ReceiveFail();
|
if (!ok) M_ReceiveFail();
|
||||||
@@ -375,7 +377,7 @@ void CDCore::xTimerTick() {
|
|||||||
} else {
|
} else {
|
||||||
ba = makeHeader(CD_XValues, 0);
|
ba = makeHeader(CD_XValues, 0);
|
||||||
ba << x_selected;
|
ba << x_selected;
|
||||||
piForeachC (PIDeque<int> & p, x_selected) {
|
for (const auto & p: x_selected) {
|
||||||
x_[p].writeX(ba);
|
x_[p].writeX(ba);
|
||||||
}
|
}
|
||||||
// piCout << "x app" << x_selected.size();
|
// piCout << "x app" << x_selected.size();
|
||||||
@@ -386,8 +388,8 @@ void CDCore::xTimerTick() {
|
|||||||
|
|
||||||
|
|
||||||
void CDCore::piCoutFinished(int id, PIString * buffer) {
|
void CDCore::piCoutFinished(int id, PIString * buffer) {
|
||||||
if (!buffer || !(id == 1)) return;
|
if ((id != cout_buffer_id) || !buffer) return;
|
||||||
PIString sp = buffer->takeRange("[", "]");
|
PIString sp = buffer->takeRange('[', ']');
|
||||||
PIDeque<int> p = CDCore::stringToPath(sp);
|
PIDeque<int> p = CDCore::stringToPath(sp);
|
||||||
sendMessage(m_[p], Log, *buffer);
|
sendMessage(m_[p], Log, *buffer);
|
||||||
delete buffer;
|
delete buffer;
|
||||||
@@ -406,7 +408,8 @@ PIByteArray CDCore::makeHeader(CDPacketType type, int session_id) const {
|
|||||||
PacketHeader h;
|
PacketHeader h;
|
||||||
h.type = type;
|
h.type = type;
|
||||||
h.session_id = session_id;
|
h.session_id = session_id;
|
||||||
PIByteArray ret; ret << h;
|
PIByteArray ret;
|
||||||
|
ret << h;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -434,15 +437,12 @@ void CDCore::procReceivedPacket(PIByteArray & ba) {
|
|||||||
case CD_Ping:
|
case CD_Ping:
|
||||||
// piCoutObj << "ping";
|
// piCoutObj << "ping";
|
||||||
break;
|
break;
|
||||||
case CD_KQuery:
|
case CD_KQuery: send(CDType::cdK); break;
|
||||||
send(CDType::cdK);
|
|
||||||
break;
|
|
||||||
case CD_KSend: {
|
case CD_KSend: {
|
||||||
PIByteArray k;
|
PIByteArray k;
|
||||||
ba >> k;
|
ba >> k;
|
||||||
k << uchar(0);
|
k << uchar(0);
|
||||||
PIString s = PIString::fromUTF8((const char *)k.data());
|
PIIOByteArray ios(k);
|
||||||
PIIOString ios(&s);
|
|
||||||
cd_read(&k_, &ios);
|
cd_read(&k_, &ios);
|
||||||
K_Received();
|
K_Received();
|
||||||
piCoutObj << "K received";
|
piCoutObj << "K received";
|
||||||
@@ -452,15 +452,12 @@ void CDCore::procReceivedPacket(PIByteArray & ba) {
|
|||||||
ba >> p;
|
ba >> p;
|
||||||
k_[p.path].setValue(p.value);
|
k_[p.path].setValue(p.value);
|
||||||
} break;
|
} break;
|
||||||
case CD_XQuery:
|
case CD_XQuery: send(CDType::cdX); break;
|
||||||
send(CDType::cdX);
|
|
||||||
break;
|
|
||||||
case CD_XSend: {
|
case CD_XSend: {
|
||||||
PIByteArray x;
|
PIByteArray x;
|
||||||
ba >> x;
|
ba >> x;
|
||||||
x << uchar(0);
|
x << uchar(0);
|
||||||
PIString s = PIString::fromUTF8((const char *)x.data());
|
PIIOByteArray ios(x);
|
||||||
PIIOString ios(&s);
|
|
||||||
cd_read(&x_, &ios);
|
cd_read(&x_, &ios);
|
||||||
x_selected = x_.collectX();
|
x_selected = x_.collectX();
|
||||||
X_Received();
|
X_Received();
|
||||||
@@ -474,7 +471,7 @@ void CDCore::procReceivedPacket(PIByteArray & ba) {
|
|||||||
ba >> x_selected;
|
ba >> x_selected;
|
||||||
// piCout << "X req" << x_selected.size();
|
// piCout << "X req" << x_selected.size();
|
||||||
x_.setSelectedX(false);
|
x_.setSelectedX(false);
|
||||||
piForeachC (PIDeque<int> & p, x_selected) {
|
for (const auto & p: x_selected) {
|
||||||
x_[p].x_enabled = true;
|
x_[p].x_enabled = true;
|
||||||
}
|
}
|
||||||
x_mutex.unlock();
|
x_mutex.unlock();
|
||||||
@@ -484,22 +481,19 @@ void CDCore::procReceivedPacket(PIByteArray & ba) {
|
|||||||
PIVector<PIDeque<int>> x_vals;
|
PIVector<PIDeque<int>> x_vals;
|
||||||
ba >> x_vals;
|
ba >> x_vals;
|
||||||
x_mutex.lock();
|
x_mutex.lock();
|
||||||
piForeachC (PIDeque<int> & p, x_vals) {
|
for (const auto & p: x_vals) {
|
||||||
x_[p].readX(ba);
|
x_[p].readX(ba);
|
||||||
}
|
}
|
||||||
x_mutex.unlock();
|
x_mutex.unlock();
|
||||||
X_ReceivedX(x_vals);
|
X_ReceivedX(x_vals);
|
||||||
} break;
|
} break;
|
||||||
case CD_CQuery:
|
case CD_CQuery: send(CDType::cdC); break;
|
||||||
send(CDType::cdC);
|
|
||||||
break;
|
|
||||||
case CD_CSend: {
|
case CD_CSend: {
|
||||||
piCoutObj << "C received";
|
piCoutObj << "C received";
|
||||||
PIByteArray c;
|
PIByteArray c;
|
||||||
ba >> c;
|
ba >> c;
|
||||||
c << uchar(0);
|
c << uchar(0);
|
||||||
PIString s = PIString::fromUTF8((const char *)c.data());
|
PIIOByteArray ios(c);
|
||||||
PIIOString ios(&s);
|
|
||||||
cd_read(&c_, &ios);
|
cd_read(&c_, &ios);
|
||||||
C_Received();
|
C_Received();
|
||||||
} break;
|
} break;
|
||||||
@@ -513,16 +507,13 @@ void CDCore::procReceivedPacket(PIByteArray & ba) {
|
|||||||
// piCoutObj << "found" << sp << h.first;
|
// piCoutObj << "found" << sp << h.first;
|
||||||
if (h.first && h.second) h.second(h.first);
|
if (h.first && h.second) h.second(h.first);
|
||||||
} break;
|
} break;
|
||||||
case CD_MQuery:
|
case CD_MQuery: send(CDType::cdM); break;
|
||||||
send(CDType::cdM);
|
|
||||||
break;
|
|
||||||
case CD_MSend: {
|
case CD_MSend: {
|
||||||
piCoutObj << "M received";
|
piCoutObj << "M received";
|
||||||
PIByteArray c;
|
PIByteArray m;
|
||||||
ba >> c;
|
ba >> m;
|
||||||
c << uchar(0);
|
m << uchar(0);
|
||||||
PIString s = PIString::fromUTF8((const char *)c.data());
|
PIIOByteArray ios(m);
|
||||||
PIIOString ios(&s);
|
|
||||||
cd_read(&m_, &ios);
|
cd_read(&m_, &ios);
|
||||||
M_Received();
|
M_Received();
|
||||||
} break;
|
} break;
|
||||||
@@ -567,7 +558,7 @@ PIString CDCore::pathToString(const PIDeque<int> & p) {
|
|||||||
PIDeque<int> CDCore::stringToPath(const PIString & p) {
|
PIDeque<int> CDCore::stringToPath(const PIString & p) {
|
||||||
PIDeque<int> ret;
|
PIDeque<int> ret;
|
||||||
PIStringList sl = p.split(".");
|
PIStringList sl = p.split(".");
|
||||||
piForeachC (PIString & s, sl)
|
for (const auto & s: sl)
|
||||||
ret << s.toInt();
|
ret << s.toInt();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -577,7 +568,7 @@ void CDUtils::CDCore::dataReceived(const PIString & from, const PIByteArray & da
|
|||||||
// piCoutObj << "dataReceived" << from << data.size();
|
// piCoutObj << "dataReceived" << from << data.size();
|
||||||
PIIODevice * d = connection.deviceByName("cd");
|
PIIODevice * d = connection.deviceByName("cd");
|
||||||
if (d && d == connection.deviceByFullPath(from)) {
|
if (d && d == connection.deviceByFullPath(from)) {
|
||||||
if (data.size() >= sizeof(4)) {
|
if (data.size() >= sizeof(int)) {
|
||||||
PIByteArray ba = data;
|
PIByteArray ba = data;
|
||||||
uchar header = ba.take_front();
|
uchar header = ba.take_front();
|
||||||
if (header == header_transfer) {
|
if (header == header_transfer) {
|
||||||
@@ -603,4 +594,3 @@ void CDCore::dtReceiveFinished(bool ok) {
|
|||||||
PIByteArray ba = datatr.data();
|
PIByteArray ba = datatr.data();
|
||||||
procReceivedPacket(ba);
|
procReceivedPacket(ba);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,11 +20,11 @@
|
|||||||
#ifndef CDUTILS_CORE_H
|
#ifndef CDUTILS_CORE_H
|
||||||
#define CDUTILS_CORE_H
|
#define CDUTILS_CORE_H
|
||||||
|
|
||||||
#include "cdutils_types.h"
|
#include "cd_core_export.h"
|
||||||
#include "cdutils_protocol.h"
|
#include "cdutils_protocol.h"
|
||||||
|
#include "cdutils_types.h"
|
||||||
#include "piconnection.h"
|
#include "piconnection.h"
|
||||||
#include "pidatatransfer.h"
|
#include "pidatatransfer.h"
|
||||||
#include "cd_core_export.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace CDUtils {
|
namespace CDUtils {
|
||||||
@@ -42,13 +42,14 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class CD_CORE_EXPORT CDCore: public PIObject
|
class CD_CORE_EXPORT CDCore: public PIObject {
|
||||||
{
|
|
||||||
PIOBJECT(CDUtils::CDCore);
|
PIOBJECT(CDUtils::CDCore);
|
||||||
friend class __Core_Initializer__;
|
friend class __Core_Initializer__;
|
||||||
friend class CDSection;
|
friend class CDSection;
|
||||||
friend class Interface;
|
friend class Interface;
|
||||||
friend class XInterface;
|
friend class XInterface;
|
||||||
|
friend class MInterface;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static CDCore * instance();
|
static CDCore * instance();
|
||||||
static bool destroy();
|
static bool destroy();
|
||||||
@@ -111,6 +112,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
CDCore();
|
CDCore();
|
||||||
~CDCore();
|
~CDCore();
|
||||||
|
|
||||||
EVENT_HANDLER2(void, dataReceived, const PIString &, from, const PIByteArray &, data);
|
EVENT_HANDLER2(void, dataReceived, const PIString &, from, const PIByteArray &, data);
|
||||||
EVENT_HANDLER1(void, dtSendRequest, PIByteArray &, data);
|
EVENT_HANDLER1(void, dtSendRequest, PIByteArray &, data);
|
||||||
EVENT_HANDLER1(void, dtReceiveFinished, bool, ok);
|
EVENT_HANDLER1(void, dtReceiveFinished, bool, ok);
|
||||||
@@ -136,13 +138,13 @@ private:
|
|||||||
PIMutex x_mutex;
|
PIMutex x_mutex;
|
||||||
PIVector<PIDeque<int>> x_selected;
|
PIVector<PIDeque<int>> x_selected;
|
||||||
PIMap<PIString, OHPair> c_handlers;
|
PIMap<PIString, OHPair> c_handlers;
|
||||||
|
int cout_buffer_id = 0;
|
||||||
bool need_rebuild_x, x_pult_side;
|
bool need_rebuild_x, x_pult_side;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static __Core_Initializer__ __Core_initializer__;
|
static __Core_Initializer__ __Core_initializer__;
|
||||||
|
|
||||||
}
|
} // namespace CDUtils
|
||||||
|
|
||||||
#endif // CDUTILS_CORE_H
|
#endif // CDUTILS_CORE_H
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "cdutils_interface.h"
|
#include "cdutils_interface.h"
|
||||||
|
|
||||||
#include "cdutils_core.h"
|
#include "cdutils_core.h"
|
||||||
#include "piconfig.h"
|
#include "piconfig.h"
|
||||||
#include "pifile.h"
|
#include "pifile.h"
|
||||||
|
|||||||
@@ -20,9 +20,9 @@
|
|||||||
#ifndef CDUTILS_INTERFACE_H
|
#ifndef CDUTILS_INTERFACE_H
|
||||||
#define CDUTILS_INTERFACE_H
|
#define CDUTILS_INTERFACE_H
|
||||||
|
|
||||||
|
#include "cd_core_export.h"
|
||||||
#include "cdutils_types.h"
|
#include "cdutils_types.h"
|
||||||
#include "piobject.h"
|
#include "piobject.h"
|
||||||
#include "cd_core_export.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace CDUtils {
|
namespace CDUtils {
|
||||||
@@ -30,9 +30,9 @@ namespace CDUtils {
|
|||||||
class CDCore;
|
class CDCore;
|
||||||
|
|
||||||
|
|
||||||
class CD_CORE_EXPORT Interface: public PIObject
|
class CD_CORE_EXPORT Interface: public PIObject {
|
||||||
{
|
|
||||||
PIOBJECT(CDUtils::Interface);
|
PIOBJECT(CDUtils::Interface);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Interface(CDType::cdT type_);
|
Interface(CDType::cdT type_);
|
||||||
|
|
||||||
@@ -86,11 +86,10 @@ protected:
|
|||||||
CDType::cdT type;
|
CDType::cdT type;
|
||||||
PIString file_;
|
PIString file_;
|
||||||
int file_size;
|
int file_size;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
} // namespace CDUtils
|
||||||
|
|
||||||
|
|
||||||
#endif // CDUTILS_INTERFACE_H
|
#endif // CDUTILS_INTERFACE_H
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "cdutils_k.h"
|
#include "cdutils_k.h"
|
||||||
|
|
||||||
#include "cdutils_core.h"
|
#include "cdutils_core.h"
|
||||||
|
|
||||||
using namespace CDUtils;
|
using namespace CDUtils;
|
||||||
@@ -6,8 +7,7 @@ using namespace CDUtils;
|
|||||||
KInterface K;
|
KInterface K;
|
||||||
|
|
||||||
|
|
||||||
KInterface::KInterface(): Interface(CDType::cdK) {
|
KInterface::KInterface(): Interface(CDType::cdK) {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KInterface::directChange(const CDType & k) {
|
void KInterface::directChange(const CDType & k) {
|
||||||
|
|||||||
@@ -20,16 +20,16 @@
|
|||||||
#ifndef CDUTILS_K_H
|
#ifndef CDUTILS_K_H
|
||||||
#define CDUTILS_K_H
|
#define CDUTILS_K_H
|
||||||
|
|
||||||
#include "cdutils_interface.h"
|
|
||||||
#include "cd_core_export.h"
|
#include "cd_core_export.h"
|
||||||
|
#include "cdutils_interface.h"
|
||||||
|
|
||||||
|
|
||||||
namespace CDUtils {
|
namespace CDUtils {
|
||||||
|
|
||||||
|
|
||||||
class CD_CORE_EXPORT KInterface: public Interface
|
class CD_CORE_EXPORT KInterface: public Interface {
|
||||||
{
|
|
||||||
PIOBJECT_SUBCLASS(KInterface, Interface);
|
PIOBJECT_SUBCLASS(KInterface, Interface);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
KInterface();
|
KInterface();
|
||||||
|
|
||||||
@@ -37,10 +37,9 @@ public:
|
|||||||
|
|
||||||
void directChange(const CDType & k);
|
void directChange(const CDType & k);
|
||||||
void directChange(const CDType & k, double v);
|
void directChange(const CDType & k, double v);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace CDUtils
|
||||||
|
|
||||||
extern CD_CORE_EXPORT CDUtils::KInterface K;
|
extern CD_CORE_EXPORT CDUtils::KInterface K;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "cdutils_m.h"
|
#include "cdutils_m.h"
|
||||||
|
|
||||||
#include "cdutils_core.h"
|
#include "cdutils_core.h"
|
||||||
|
|
||||||
using namespace CDUtils;
|
using namespace CDUtils;
|
||||||
@@ -18,5 +19,5 @@ void MInterface::messageBox(const CDType & m, const PIString & msg) {
|
|||||||
|
|
||||||
PICout MInterface::createPICout(const CDType & m) const {
|
PICout MInterface::createPICout(const CDType & m) const {
|
||||||
PIString * buff = new PIString("[" + CDCore::pathToString(m.path()) + "]");
|
PIString * buff = new PIString("[" + CDCore::pathToString(m.path()) + "]");
|
||||||
return PICout(buff, 1);
|
return PICout::withExternalBufferAndID(buff, core->cout_buffer_id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,16 +20,16 @@
|
|||||||
#ifndef CDUTILS_M_H
|
#ifndef CDUTILS_M_H
|
||||||
#define CDUTILS_M_H
|
#define CDUTILS_M_H
|
||||||
|
|
||||||
#include "cdutils_interface.h"
|
|
||||||
#include "cd_core_export.h"
|
#include "cd_core_export.h"
|
||||||
|
#include "cdutils_interface.h"
|
||||||
|
|
||||||
|
|
||||||
namespace CDUtils {
|
namespace CDUtils {
|
||||||
|
|
||||||
|
|
||||||
class CD_CORE_EXPORT MInterface: public Interface
|
class CD_CORE_EXPORT MInterface: public Interface {
|
||||||
{
|
|
||||||
PIOBJECT_SUBCLASS(MInterface, Interface);
|
PIOBJECT_SUBCLASS(MInterface, Interface);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MInterface();
|
MInterface();
|
||||||
|
|
||||||
@@ -46,10 +46,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
PICout createPICout(const CDType & m) const;
|
PICout createPICout(const CDType & m) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace CDUtils
|
||||||
|
|
||||||
extern CD_CORE_EXPORT CDUtils::MInterface M;
|
extern CD_CORE_EXPORT CDUtils::MInterface M;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#include "cdutils_parser.h"
|
#include "cdutils_parser.h"
|
||||||
|
|
||||||
#include "cdutils_types.h"
|
#include "cdutils_types.h"
|
||||||
#include "piiostring.h"
|
|
||||||
#include "piiobytearray.h"
|
|
||||||
#include "pifile.h"
|
#include "pifile.h"
|
||||||
|
#include "piiobytearray.h"
|
||||||
|
#include "piiostring.h"
|
||||||
|
|
||||||
using namespace CDUtils;
|
using namespace CDUtils;
|
||||||
|
|
||||||
@@ -94,7 +95,7 @@ CDSection CDParser::parse(PIIODevice * d, int cdsection_type) {
|
|||||||
content = PIString::fromUTF8((const char *)c.data());
|
content = PIString::fromUTF8((const char *)c.data());
|
||||||
}
|
}
|
||||||
if (PIStringAscii(d->className()) == PIStringAscii("PIIOString")) content = *(((PIIOString *)d)->string());
|
if (PIStringAscii(d->className()) == PIStringAscii("PIIOString")) content = *(((PIIOString *)d)->string());
|
||||||
if (PIStringAscii(d->className()) == PIStringAscii("PIIOByteArray")) content = PIString(*(((PIIOByteArray*)d)->byteArray()));
|
if (PIStringAscii(d->className()) == PIStringAscii("PIIOByteArray")) content = PIString::fromUTF8(*(((PIIOByteArray *)d)->byteArray()));
|
||||||
PIIOString ios(&content);
|
PIIOString ios(&content);
|
||||||
// int phase = 0;
|
// int phase = 0;
|
||||||
int cind = -1;
|
int cind = -1;
|
||||||
|
|||||||
@@ -34,6 +34,6 @@ CD_CORE_EXPORT CDSection parse(PIIODevice * d, int cdsection_type);
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace CDUtils
|
||||||
|
|
||||||
#endif // CDUTILS_PARSER_H
|
#endif // CDUTILS_PARSER_H
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
#ifndef CDUTILS_PROTOCOL_H
|
#ifndef CDUTILS_PROTOCOL_H
|
||||||
#define CDUTILS_PROTOCOL_H
|
#define CDUTILS_PROTOCOL_H
|
||||||
|
|
||||||
#include "pistring.h"
|
|
||||||
#include "cd_core_export.h"
|
#include "cd_core_export.h"
|
||||||
|
#include "pistring.h"
|
||||||
|
|
||||||
namespace CDUtils {
|
namespace CDUtils {
|
||||||
|
|
||||||
@@ -62,13 +62,25 @@ namespace CDUtils {
|
|||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
#ifdef PIP_BINARY_STREAM
|
#ifdef PIP_BINARY_STREAM
|
||||||
BINARY_STREAM_WRITE(PacketKDirectChange) {s << v.path << v.value; return s;}
|
BINARY_STREAM_WRITE(PacketKDirectChange) {
|
||||||
BINARY_STREAM_READ (PacketKDirectChange) {s >> v.path >> v.value; return s;}
|
s << v.path << v.value;
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
BINARY_STREAM_READ(PacketKDirectChange) {
|
||||||
|
s >> v.path >> v.value;
|
||||||
|
return s;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
inline PIByteArray & operator <<(PIByteArray & s, const PacketKDirectChange & v) {s << v.path << v.value; return s;}
|
inline PIByteArray & operator<<(PIByteArray & s, const PacketKDirectChange & v) {
|
||||||
inline PIByteArray & operator >>(PIByteArray & s, PacketKDirectChange & v) {s >> v.path >> v.value; return s;}
|
s << v.path << v.value;
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
inline PIByteArray & operator>>(PIByteArray & s, PacketKDirectChange & v) {
|
||||||
|
s >> v.path >> v.value;
|
||||||
|
return s;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
} // namespace CDUtils
|
||||||
|
|
||||||
#endif // CDUTILS_PROTOCOL_H
|
#endif // CDUTILS_PROTOCOL_H
|
||||||
|
|||||||
@@ -1,31 +1,14 @@
|
|||||||
#include "cdutils_types.h"
|
#include "cdutils_types.h"
|
||||||
#include "piconfig.h"
|
|
||||||
#include "pifile.h"
|
|
||||||
#include "pievaluator.h"
|
|
||||||
#include "cdutils_core.h"
|
#include "cdutils_core.h"
|
||||||
|
#include "piconfig.h"
|
||||||
|
#include "pievaluator.h"
|
||||||
|
|
||||||
using namespace CDUtils;
|
using namespace CDUtils;
|
||||||
|
|
||||||
//int cdtype_debug_cnt = 1;
|
|
||||||
|
|
||||||
const int cd_x_history_max_size = 4000;
|
const int cd_x_history_max_size = 4000;
|
||||||
|
|
||||||
CDType::CDType() {
|
|
||||||
index_ = -1;
|
|
||||||
value_d = 0.;
|
|
||||||
value_i = 0;
|
|
||||||
value_b = calculated = x_enabled = false;
|
|
||||||
cd_type_ = cdNull;
|
|
||||||
parent = 0;
|
|
||||||
avg_size = 1;
|
|
||||||
mode_ = rmode_ = X_Current;
|
|
||||||
// debug_cnt = cdtype_debug_cnt;
|
|
||||||
// cdtype_debug_cnt++;
|
|
||||||
// piCout << "[CDType]" << "create Null" << debug_cnt;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CDType::CDType(int i, const PIString & n, const PIString & t, const PIString & v, const PIString & f, const PIString & c, cdT cd_t) {
|
CDType::CDType(int i, const PIString & n, const PIString & t, const PIString & v, const PIString & f, const PIString & c, cdT cd_t) {
|
||||||
index_ = i;
|
index_ = i;
|
||||||
@@ -49,9 +32,8 @@ CDType::CDType(int i, const PIString & n, const PIString & t, const PIString & v
|
|||||||
// piCout << type_.size() << type_.toUTF8();
|
// piCout << type_.size() << type_.toUTF8();
|
||||||
// piCout << formula_.size() << formula_.toUTF8();
|
// piCout << formula_.size() << formula_.toUTF8();
|
||||||
// piCout << comment_.size() << comment_.toUTF8();
|
// piCout << comment_.size() << comment_.toUTF8();
|
||||||
// debug_cnt = cdtype_debug_cnt;
|
// piCout << "[CDType] create" << name_ << ":" << type_ << ":" << value_s << ":" << value_d << ":" << formula_ << ":" << comment_ <<
|
||||||
// cdtype_debug_cnt++;
|
//":" << (cd_type_ == cdK);
|
||||||
// piCout << "[CDType] create" << name_ << ":" << type_ << ":" << value_s << ":" << value_d << ":" << formula_ << ":" << comment_ << ":" << (cd_type_ == cdK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -63,14 +45,16 @@ CDType & CDType::operator =(double x) {
|
|||||||
avg_h << x;
|
avg_h << x;
|
||||||
double val = 0;
|
double val = 0;
|
||||||
if (avg_h.size_s() >= avg_size) {
|
if (avg_h.size_s() >= avg_size) {
|
||||||
for (int i = 0; i < avg_h.size_s(); i++)
|
for (int i = 0; i < avg_h.size_s(); i++) {
|
||||||
val += avg_h[i];
|
val += avg_h[i];
|
||||||
|
}
|
||||||
val /= avg_h.size();
|
val /= avg_h.size();
|
||||||
avg_h.clear();
|
avg_h.clear();
|
||||||
if (history.size() < cd_x_history_max_size)
|
if (history.size() < cd_x_history_max_size) {
|
||||||
history << val;
|
history << val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,29 +118,31 @@ PIStringList CDType::pathString() const {
|
|||||||
if (!ps) return ret;
|
if (!ps) return ret;
|
||||||
for (int i = 0; i < path_.size_s() - 1; ++i) {
|
for (int i = 0; i < path_.size_s() - 1; ++i) {
|
||||||
ps = &(ps->section(path_[i]));
|
ps = &(ps->section(path_[i]));
|
||||||
if (!ps->alias.isEmpty()) ret << ps->alias;
|
if (!ps->alias.isEmpty())
|
||||||
else ret << PIString::fromNumber(path_[i]);
|
ret << ps->alias;
|
||||||
|
else
|
||||||
|
ret << PIString::fromNumber(path_[i]);
|
||||||
}
|
}
|
||||||
if (!name_.isEmpty()) ret << name_;
|
if (!name_.isEmpty())
|
||||||
else ret << PIString::fromNumber(index_);
|
ret << name_;
|
||||||
|
else
|
||||||
|
ret << PIString::fromNumber(index_);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDType::readX(PIByteArray & ba) {
|
void CDType::readX(PIByteArray & ba) {
|
||||||
if (ba.size() < 5) return;
|
if (ba.size() < 5) return;
|
||||||
uchar t(0); ba >> t;
|
uchar t(0);
|
||||||
|
ba >> t;
|
||||||
rmode_ = (XMode)t;
|
rmode_ = (XMode)t;
|
||||||
switch (rmode_) {
|
switch (rmode_) {
|
||||||
case X_Current:
|
case X_Current: ba >> value_d; break;
|
||||||
ba >> value_d;
|
|
||||||
break;
|
|
||||||
case X_All_Avg: {
|
case X_All_Avg: {
|
||||||
PIVector<double> ah;
|
PIVector<double> ah;
|
||||||
ba >> ah;
|
ba >> ah;
|
||||||
history << ah;
|
history << ah;
|
||||||
if (!history.isEmpty())
|
if (!history.isEmpty()) value_d = history.back();
|
||||||
value_d = history.back();
|
|
||||||
} break;
|
} break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
@@ -168,9 +154,7 @@ void CDType::readX(PIByteArray & ba) {
|
|||||||
void CDType::writeX(PIByteArray & ba) {
|
void CDType::writeX(PIByteArray & ba) {
|
||||||
ba << uchar(mode_);
|
ba << uchar(mode_);
|
||||||
switch (mode_) {
|
switch (mode_) {
|
||||||
case X_Current:
|
case X_Current: ba << value_d; break;
|
||||||
ba << value_d;
|
|
||||||
break;
|
|
||||||
case X_All_Avg:
|
case X_All_Avg:
|
||||||
ba << history;
|
ba << history;
|
||||||
history.clear();
|
history.clear();
|
||||||
@@ -218,8 +202,7 @@ bool CDType::calculate(PIEvaluator * e, PIVector<const CDType * > stack) {
|
|||||||
error_ = e->error();
|
error_ = e->error();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else
|
} else if (e->isCorrect())
|
||||||
if (e->isCorrect())
|
|
||||||
ev = e->evaluate().real();
|
ev = e->evaluate().real();
|
||||||
// piCout << value_s << value_i << value_d << ev;
|
// piCout << value_s << value_i << value_d << ev;
|
||||||
// if ((value_d == 0.) || (piAbsd(value_d) < piAbsd(ev))) value_d = ev;
|
// if ((value_d == 0.) || (piAbsd(value_d) < piAbsd(ev))) value_d = ev;
|
||||||
@@ -250,7 +233,7 @@ PIVariantTypes::Enum CDType::parseEnumComment(PIString c) {
|
|||||||
if (type_ == "e") {
|
if (type_ == "e") {
|
||||||
PIStringList sl = c.inBrackets('{', '}').split(",");
|
PIStringList sl = c.inBrackets('{', '}').split(",");
|
||||||
int cval = 0;
|
int cval = 0;
|
||||||
piForeach (PIString & s, sl) {
|
for (PIString & s: sl) {
|
||||||
s.trim();
|
s.trim();
|
||||||
if (s.isEmpty()) continue;
|
if (s.isEmpty()) continue;
|
||||||
if (s[0].isDigit()) {
|
if (s[0].isDigit()) {
|
||||||
@@ -269,46 +252,6 @@ PIVariantTypes::Enum CDType::parseEnumComment(PIString c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//CDType::CDType(const CDType &cdt) {
|
|
||||||
// index_ = cdt.index_;
|
|
||||||
// name_ = cdt.name_;
|
|
||||||
// type_ = cdt.type_;
|
|
||||||
// value_s = cdt.value_s;
|
|
||||||
// formula_ = cdt.formula_;
|
|
||||||
// comment_ = cdt.comment_;
|
|
||||||
// value_d = cdt.value_d;
|
|
||||||
// value_i = cdt.value_i;
|
|
||||||
// value_b = cdt.value_b;
|
|
||||||
// cd_type_ = cdt.cd_type_;
|
|
||||||
// debug_cnt = cdtype_debug_cnt;
|
|
||||||
// cdtype_debug_cnt++;
|
|
||||||
// piCout << "[CDType] copy" << debug_cnt << "->" << cdt.debug_cnt << index_ << ":" << name_ << ":" << type_ << ":" << value_s << ":" << value_d << ":" << formula_ << ":" << comment_ << ":" << (cd_type_ == cdK);
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
//CDType &CDType::operator =(const CDType &cdt) {
|
|
||||||
// index_ = cdt.index_;
|
|
||||||
// name_ = cdt.name_;
|
|
||||||
// type_ = cdt.type_;
|
|
||||||
// value_s = cdt.value_s;
|
|
||||||
// formula_ = cdt.formula_;
|
|
||||||
// comment_ = cdt.comment_;
|
|
||||||
// value_d = cdt.value_d;
|
|
||||||
// value_i = cdt.value_i;
|
|
||||||
// value_b = cdt.value_b;
|
|
||||||
// cd_type_ = cdt.cd_type_;
|
|
||||||
// piCout << "[CDType] assign" << debug_cnt << "=" << cdt.debug_cnt << index_ << ":" << name_ << ":" << type_ << ":" << value_s << ":" << value_d << ":" << formula_ << ":" << comment_ << ":" << (cd_type_ == cdK);
|
|
||||||
// //debug_cnt = cdt.debug_cnt;
|
|
||||||
// return *this;
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
//CDType::~CDType() {
|
|
||||||
// piCout << "[CDType] delete" << debug_cnt << index_ << ":" << name_ << ":" << type_ << ":" << value_s << ":" << value_d << ":" << formula_ << ":" << comment_ << ":" << (cd_type_ == cdK);
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CDSection::CDSection(CDType::cdT type_) {
|
CDSection::CDSection(CDType::cdT type_) {
|
||||||
cd_type_ = type_;
|
cd_type_ = type_;
|
||||||
null.cd_type_ = type_;
|
null.cd_type_ = type_;
|
||||||
@@ -342,10 +285,10 @@ bool CDSection::exists(PIDeque<int> path) const {
|
|||||||
int CDSection::count(bool recursive) const {
|
int CDSection::count(bool recursive) const {
|
||||||
int ret = cd.size_s();
|
int ret = cd.size_s();
|
||||||
if (recursive) {
|
if (recursive) {
|
||||||
PIMap<int, CDSection>::const_iterator i;
|
for (auto i = s.begin(); i != s.end(); ++i) {
|
||||||
for (i = s.constBegin(); i != s.constEnd(); ++i)
|
|
||||||
ret += i.value().count(recursive);
|
ret += i.value().count(recursive);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,8 +334,10 @@ CDType & CDSection::getByName(const PIString & name_) {
|
|||||||
auto it = cs->s.makeIterator();
|
auto it = cs->s.makeIterator();
|
||||||
while (it.next()) {
|
while (it.next()) {
|
||||||
bool f = false;
|
bool f = false;
|
||||||
if (isd) f = (dv == it.key());
|
if (isd)
|
||||||
else f = (np[i] == it.value().alias);
|
f = (dv == it.key());
|
||||||
|
else
|
||||||
|
f = (np[i] == it.value().alias);
|
||||||
// piCout << "s..." << it.key() << it.value().alias << f;
|
// piCout << "s..." << it.key() << it.value().alias << f;
|
||||||
if (f) {
|
if (f) {
|
||||||
ns = &(it.value());
|
ns = &(it.value());
|
||||||
@@ -411,11 +356,12 @@ CDType & CDSection::getByName(const PIString & name_) {
|
|||||||
auto it = cs->cd.makeIterator();
|
auto it = cs->cd.makeIterator();
|
||||||
while (it.next()) {
|
while (it.next()) {
|
||||||
bool f = false;
|
bool f = false;
|
||||||
if (isd) f = (dv == it.key());
|
if (isd)
|
||||||
else f = (np.back() == it.value().name());
|
f = (dv == it.key());
|
||||||
|
else
|
||||||
|
f = (np.back() == it.value().name());
|
||||||
// piCout << "k..." << it.key() << it.value().name() << f;
|
// piCout << "k..." << it.key() << it.value().name() << f;
|
||||||
if (f)
|
if (f) return cs->cd[it.key()];
|
||||||
return cs->cd[it.key()];
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -437,9 +383,15 @@ void CDSection::write(PIIODevice * d, const PIString & prefix) {
|
|||||||
// piCout << "[CDSection] write start";
|
// piCout << "[CDSection] write start";
|
||||||
PIString l;
|
PIString l;
|
||||||
PIStringList cdtl;
|
PIStringList cdtl;
|
||||||
cdtl << "null" << "k" << "x" << "c" << "m";
|
cdtl << "null"
|
||||||
if (prefix.isEmpty()) l = "[" + cdtl[cd_type_] + "]";
|
<< "k"
|
||||||
else l = "[" + prefix + "." + cdtl[cd_type_] + "]";
|
<< "x"
|
||||||
|
<< "c"
|
||||||
|
<< "m";
|
||||||
|
if (prefix.isEmpty())
|
||||||
|
l = "[" + cdtl[cd_type_] + "]";
|
||||||
|
else
|
||||||
|
l = "[" + prefix + "." + cdtl[cd_type_] + "]";
|
||||||
l += "\n";
|
l += "\n";
|
||||||
d->write(l.toUTF8());
|
d->write(l.toUTF8());
|
||||||
l = "name = " + name + " \n";
|
l = "name = " + name + " \n";
|
||||||
@@ -459,7 +411,6 @@ void CDSection::write(PIIODevice * d, const PIString & prefix) {
|
|||||||
d->write(l.toUTF8());
|
d->write(l.toUTF8());
|
||||||
if (!ck.enumValues().enum_list.isEmpty()) {
|
if (!ck.enumValues().enum_list.isEmpty()) {
|
||||||
l = PIString::fromNumber(ck.index()) + ".ev = {";
|
l = PIString::fromNumber(ck.index()) + ".ev = {";
|
||||||
//PIVector<CDType::Enumerator> el = ck.enumValues();
|
|
||||||
for (const PIVariantTypes::Enumerator & e: ck.enumValues().enum_list) {
|
for (const PIVariantTypes::Enumerator & e: ck.enumValues().enum_list) {
|
||||||
l += PIString::fromNumber(e.value) + " - " + e.name + ", ";
|
l += PIString::fromNumber(e.value) + " - " + e.name + ", ";
|
||||||
}
|
}
|
||||||
@@ -471,7 +422,8 @@ void CDSection::write(PIIODevice * d, const PIString & prefix) {
|
|||||||
case CDType::cdX:
|
case CDType::cdX:
|
||||||
l = PIString::fromNumber(ck.index()) + ".name = " + ck.name() + " #s " + ck.comment() + " \n";
|
l = PIString::fromNumber(ck.index()) + ".name = " + ck.name() + " #s " + ck.comment() + " \n";
|
||||||
d->write(l.toUTF8());
|
d->write(l.toUTF8());
|
||||||
l = PIString::fromNumber(ck.index()) + ".mode = " + PIString::fromNumber((int)ck.xmode()) + " #e (0 - cur, 1 - all_avg) " + "\n";
|
l = PIString::fromNumber(ck.index()) + ".mode = " + PIString::fromNumber((int)ck.xmode()) + " #e (0 - cur, 1 - all_avg) " +
|
||||||
|
"\n";
|
||||||
d->write(l.toUTF8());
|
d->write(l.toUTF8());
|
||||||
l = PIString::fromNumber(ck.index()) + ".avg = " + PIString::fromNumber(ck.avg()) + " #n " + "\n";
|
l = PIString::fromNumber(ck.index()) + ".avg = " + PIString::fromNumber(ck.avg()) + " #n " + "\n";
|
||||||
d->write(l.toUTF8());
|
d->write(l.toUTF8());
|
||||||
@@ -486,8 +438,10 @@ void CDSection::write(PIIODevice * d, const PIString & prefix) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!s.isEmpty()) {
|
if (!s.isEmpty()) {
|
||||||
if (prefix.isEmpty()) l = "s";
|
if (prefix.isEmpty())
|
||||||
else l = prefix + ".s";
|
l = "s";
|
||||||
|
else
|
||||||
|
l = prefix + ".s";
|
||||||
auto j = s.makeIterator();
|
auto j = s.makeIterator();
|
||||||
while (j.next()) {
|
while (j.next()) {
|
||||||
j.value().write(d, l + "." + PIString::fromNumber(j.key()));
|
j.value().write(d, l + "." + PIString::fromNumber(j.key()));
|
||||||
@@ -504,7 +458,11 @@ void CDSection::write(PIIODevice * d, const PIString & prefix) {
|
|||||||
void CDSection::read(const void * ep) {
|
void CDSection::read(const void * ep) {
|
||||||
// piCout << "[CDSection] read start";
|
// piCout << "[CDSection] read start";
|
||||||
PIStringList cdtl;
|
PIStringList cdtl;
|
||||||
cdtl << "null" << "k" << "x" << "c" << "m";
|
cdtl << "null"
|
||||||
|
<< "k"
|
||||||
|
<< "x"
|
||||||
|
<< "c"
|
||||||
|
<< "m";
|
||||||
cd.clear();
|
cd.clear();
|
||||||
s.clear();
|
s.clear();
|
||||||
PIConfig::Entry & e(*(PIConfig::Entry *)ep);
|
PIConfig::Entry & e(*(PIConfig::Entry *)ep);
|
||||||
@@ -516,18 +474,21 @@ void CDSection::read(const void * ep) {
|
|||||||
bool ok = false;
|
bool ok = false;
|
||||||
int id = e->name().toInt(-1, &ok);
|
int id = e->name().toInt(-1, &ok);
|
||||||
// piCout << "[read]" << ke->name() << ke->value() << ok;
|
// piCout << "[read]" << ke->name() << ke->value() << ok;
|
||||||
// PIString n = ke->getValue("v").comment();
|
|
||||||
// PIString t = n.takeLeft(1);
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
CDType c;
|
CDType c;
|
||||||
PIString ev;
|
PIString ev;
|
||||||
switch (cd_type_) {
|
switch (cd_type_) {
|
||||||
case CDType::cdNull: break;
|
case CDType::cdNull: break;
|
||||||
case CDType::cdK:
|
case CDType::cdK:
|
||||||
c = CDType(id, e->getValue("v").comment(), e->getValue("v").type(), e->getValue("v").value(), e->getValue("f").value(), e->getValue("f").comment(), cd_type_);
|
c = CDType(id,
|
||||||
|
e->getValue("v").comment(),
|
||||||
|
e->getValue("v").type(),
|
||||||
|
e->getValue("v").value(),
|
||||||
|
e->getValue("f").value(),
|
||||||
|
e->getValue("f").comment(),
|
||||||
|
cd_type_);
|
||||||
ev = e->getValue("ev", "").value();
|
ev = e->getValue("ev", "").value();
|
||||||
if (!ev.isEmpty())
|
if (!ev.isEmpty()) c.enum_values = c.parseEnumComment(ev);
|
||||||
c.enum_values = c.parseEnumComment(ev);
|
|
||||||
break;
|
break;
|
||||||
case CDType::cdX:
|
case CDType::cdX:
|
||||||
c = CDType(id, e->getValue("name").value(), PIString(), PIString(), PIString(), e->getValue("name").comment(), cd_type_);
|
c = CDType(id, e->getValue("name").value(), PIString(), PIString(), PIString(), e->getValue("name").comment(), cd_type_);
|
||||||
@@ -565,174 +526,133 @@ void CDSection::update(CDSection & v, UpdateModeFlags mode) {
|
|||||||
|
|
||||||
PIMap<int, PIString> prev_cd_f_bi;
|
PIMap<int, PIString> prev_cd_f_bi;
|
||||||
PIMap<PIString, PIString> prev_cd_f_bn;
|
PIMap<PIString, PIString> prev_cd_f_bn;
|
||||||
PIMap<int, CDType>::iterator i;
|
|
||||||
if (mode[SaveByIndex]) {
|
if (mode[SaveByIndex]) {
|
||||||
for (i = cd.begin(); i != cd.end(); ++i)
|
for (auto i = cd.begin(); i != cd.end(); ++i) {
|
||||||
prev_cd_f_bi[i.key()] = i.value().formula();
|
prev_cd_f_bi[i.key()] = i.value().formula();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (mode[SaveByName]) {
|
if (mode[SaveByName]) {
|
||||||
for (i = cd.begin(); i != cd.end(); ++i)
|
for (auto i = cd.begin(); i != cd.end(); ++i) {
|
||||||
prev_cd_f_bn[i.value().name_] = i.value().formula();
|
prev_cd_f_bn[i.value().name_] = i.value().formula();
|
||||||
}
|
}
|
||||||
if (!mode[Merge])
|
}
|
||||||
cd.clear();
|
if (!mode[Merge]) cd.clear();
|
||||||
for (i = v.cd.begin(); i != v.cd.end(); ++i) {
|
for (auto i = v.cd.begin(); i != v.cd.end(); ++i) {
|
||||||
int id = i.key();
|
int id = i.key();
|
||||||
PIString n = i.value().name();
|
PIString n = i.value().name();
|
||||||
cd[id] = i.value();
|
cd[id] = i.value();
|
||||||
if (mode[SaveByIndex]) {
|
if (mode[SaveByIndex]) {
|
||||||
if (prev_cd_f_bi.contains(id))
|
if (prev_cd_f_bi.contains(id)) {
|
||||||
cd[id].setFormula(prev_cd_f_bi[id]);
|
cd[id].setFormula(prev_cd_f_bi[id]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (mode[SaveByName]) {
|
if (mode[SaveByName]) {
|
||||||
if (prev_cd_f_bn.contains(n))
|
if (prev_cd_f_bn.contains(n)) {
|
||||||
cd[id].setFormula(prev_cd_f_bn[n]);
|
cd[id].setFormula(prev_cd_f_bn[n]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PIMap<int, CDSection> prev_s_bi;
|
PIMap<int, CDSection> prev_s_bi;
|
||||||
PIMap<PIString, CDSection> prev_s_bn;
|
PIMap<PIString, CDSection> prev_s_bn;
|
||||||
PIMap<int, CDSection>::iterator j;
|
|
||||||
if (mode[SaveByIndex]) {
|
if (mode[SaveByIndex]) {
|
||||||
for (j = s.begin(); j != s.end(); ++j)
|
for (auto j = s.begin(); j != s.end(); ++j) {
|
||||||
prev_s_bi[j.key()] = j.value();
|
prev_s_bi[j.key()] = j.value();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (mode[SaveByName]) {
|
if (mode[SaveByName]) {
|
||||||
for (j = s.begin(); j != s.end(); ++j)
|
for (auto j = s.begin(); j != s.end(); ++j) {
|
||||||
prev_s_bn[j.value().alias] = j.value();
|
prev_s_bn[j.value().alias] = j.value();
|
||||||
}
|
}
|
||||||
if (!mode[Merge])
|
}
|
||||||
s.clear();
|
if (!mode[Merge]) s.clear();
|
||||||
for (j = v.s.begin(); j != v.s.end(); ++j) {
|
for (auto j = v.s.begin(); j != v.s.end(); ++j) {
|
||||||
int id = j.key();
|
int id = j.key();
|
||||||
PIString n = j.value().alias;
|
PIString n = j.value().alias;
|
||||||
s[id] = j.value();
|
s[id] = j.value();
|
||||||
if (mode[SaveByIndex]) {
|
if (mode[SaveByIndex]) {
|
||||||
if (prev_s_bi.contains(id))
|
if (prev_s_bi.contains(id)) s[id] = prev_s_bi[id];
|
||||||
s[id] = prev_s_bi[id];
|
|
||||||
}
|
}
|
||||||
if (mode[SaveByName]) {
|
if (mode[SaveByName]) {
|
||||||
if (prev_s_bn.contains(n))
|
if (prev_s_bn.contains(n)) s[id] = prev_s_bn[n];
|
||||||
s[id] = prev_s_bn[n];
|
|
||||||
}
|
}
|
||||||
s[id].update(j.value(), mode);
|
s[id].update(j.value(), mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*PISet<int> used;
|
|
||||||
for (i = k.begin(); i != k.end(); ++i) {
|
|
||||||
if (v.k.contains(i.key())) {
|
|
||||||
PIString f = k[i.key()].formula_;
|
|
||||||
CDType & cdt = v.k[i.key()];
|
|
||||||
cdt.formula_ = f;
|
|
||||||
k[i.key()] = cdt;
|
|
||||||
used << i.key();
|
|
||||||
}
|
|
||||||
if (mode) {
|
|
||||||
CDType & ck(k[i.key()]);
|
|
||||||
if (prev_k_f_bn.contains(ck.name_))
|
|
||||||
ck.setFormula(prev_k_f_bn[ck.name_]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//piCout << " after" << k.size();
|
|
||||||
for (i = v.k.begin(); i != v.k.end(); ++i) {
|
|
||||||
if (!used.contains(i.key()))
|
|
||||||
k[i.key()] = i.value();
|
|
||||||
CDType & ck(k[i.key()]);
|
|
||||||
ck.setFormula(prev_k_f_bn.value(ck.name_));
|
|
||||||
}
|
|
||||||
used.clear();
|
|
||||||
PIMap<int, CDSection>::iterator j;
|
|
||||||
for (j = s.begin(); j != s.end(); ++j) {
|
|
||||||
if (v.s.contains(j.key()))
|
|
||||||
j.value().update(v.s[j.key()], mode);
|
|
||||||
used << j.key();
|
|
||||||
}
|
|
||||||
for (j = v.s.begin(); j != v.s.end(); ++j) {
|
|
||||||
if (!used.contains(j.key()))
|
|
||||||
s[j.key()] = j.value();
|
|
||||||
}*/
|
|
||||||
// piCout << "[CDSection] update end";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CDSection::isSameStructure(CDSection & v) {
|
bool CDSection::isSameStructure(CDSection & v) {
|
||||||
PIMap<PIString, int> cd_ids;
|
PIMap<PIString, int> cd_ids;
|
||||||
PIMap<int, CDType>::iterator i;
|
for (auto i = cd.begin(); i != cd.end(); ++i) {
|
||||||
for (i = cd.begin(); i != cd.end(); ++i)
|
|
||||||
cd_ids[i.value().name()] = i.key();
|
cd_ids[i.value().name()] = i.key();
|
||||||
for (i = v.cd.begin(); i != v.cd.end(); ++i) {
|
}
|
||||||
|
for (auto i = v.cd.begin(); i != v.cd.end(); ++i) {
|
||||||
if (!cd_ids.contains(i.value().name())) continue;
|
if (!cd_ids.contains(i.value().name())) continue;
|
||||||
// piCout << i.key() << k[i.key()].name() << i.value().name();
|
// piCout << i.key() << k[i.key()].name() << i.value().name();
|
||||||
if (cd[cd_ids[i.value().name()]].index() != i.key())
|
if (cd[cd_ids[i.value().name()]].index() != i.key()) return false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
PIMap<int, CDSection>::iterator j;
|
for (auto j = v.s.begin(); j != v.s.end(); ++j) {
|
||||||
for (j = v.s.begin(); j != v.s.end(); ++j) {
|
|
||||||
if (!s.contains(j.key())) continue;
|
if (!s.contains(j.key())) continue;
|
||||||
if (!s[j.key()].isSameStructure(j.value()))
|
if (!s[j.key()].isSameStructure(j.value())) return false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDSection::prepareCalculate() {
|
void CDSection::prepareCalculate() {
|
||||||
PIMap<int, CDType>::iterator i;
|
for (auto i = cd.begin(); i != cd.end(); ++i) {
|
||||||
for (i = cd.begin(); i != cd.end(); ++i) {
|
|
||||||
i.value().parent = this;
|
i.value().parent = this;
|
||||||
i.value().calculated = false;
|
i.value().calculated = false;
|
||||||
}
|
}
|
||||||
PIMap<int, CDSection>::iterator j;
|
for (auto j = s.begin(); j != s.end(); ++j) {
|
||||||
for (j = s.begin(); j != s.end(); ++j)
|
|
||||||
j.value().prepareCalculate();
|
j.value().prepareCalculate();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDSection::calculateRecursive(PIEvaluator * e) {
|
void CDSection::calculateRecursive(PIEvaluator * e) {
|
||||||
PIMap<int, CDType>::iterator i;
|
for (auto i = cd.begin(); i != cd.end(); ++i) {
|
||||||
for (i = cd.begin(); i != cd.end(); ++i)
|
|
||||||
i.value().calculate(e);
|
i.value().calculate(e);
|
||||||
PIMap<int, CDSection>::iterator j;
|
}
|
||||||
for (j = s.begin(); j != s.end(); ++j)
|
for (auto j = s.begin(); j != s.end(); ++j) {
|
||||||
j.value().calculateRecursive(e);
|
j.value().calculateRecursive(e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDSection::setSelectedX(bool yes) {
|
void CDSection::setSelectedX(bool yes) {
|
||||||
PIMap<int, CDType>::iterator i;
|
for (auto i = cd.begin(); i != cd.end(); ++i) {
|
||||||
for (i = cd.begin(); i != cd.end(); ++i)
|
|
||||||
i.value().x_enabled = yes;
|
i.value().x_enabled = yes;
|
||||||
PIMap<int, CDSection>::iterator j;
|
}
|
||||||
for (j = s.begin(); j != s.end(); ++j)
|
for (auto j = s.begin(); j != s.end(); ++j) {
|
||||||
j.value().setSelectedX(yes);
|
j.value().setSelectedX(yes);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PIVector<PIDeque<int>> CDSection::collectX() const {
|
PIVector<PIDeque<int>> CDSection::collectX() const {
|
||||||
PIVector<PIDeque<int>> ret;
|
PIVector<PIDeque<int>> ret;
|
||||||
PIMap<int, CDType>::const_iterator i;
|
for (auto i = cd.begin(); i != cd.end(); ++i) {
|
||||||
for (i = cd.begin(); i != cd.end(); ++i) {
|
if (i.value().x_enabled) {
|
||||||
if (i.value().x_enabled)
|
|
||||||
ret << i.value().path();
|
ret << i.value().path();
|
||||||
}
|
}
|
||||||
PIMap<int, CDSection>::const_iterator j;
|
}
|
||||||
for (j = s.constBegin(); j != s.constEnd(); ++j)
|
for (auto j = s.begin(); j != s.end(); ++j) {
|
||||||
ret << j.value().collectX();
|
ret << j.value().collectX();
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDSection::makePath(PIDeque<int> p) {
|
void CDSection::makePath(PIDeque<int> p) {
|
||||||
PIDeque<int> tp;
|
PIDeque<int> tp;
|
||||||
PIMap<int, CDType>::iterator i;
|
for (auto i = cd.begin(); i != cd.end(); ++i) {
|
||||||
for (i = cd.begin(); i != cd.end(); ++i) {
|
|
||||||
tp = p;
|
tp = p;
|
||||||
tp << i.key();
|
tp << i.key();
|
||||||
i.value().path_ = tp;
|
i.value().path_ = tp;
|
||||||
// piCout << "path for" << i.value().name() << tp;
|
// piCout << "path for" << i.value().name() << tp;
|
||||||
}
|
}
|
||||||
PIMap<int, CDSection>::iterator j;
|
for (auto j = s.begin(); j != s.end(); ++j) {
|
||||||
for (j = s.begin(); j != s.end(); ++j) {
|
|
||||||
tp = p;
|
tp = p;
|
||||||
tp << j.key();
|
tp << j.key();
|
||||||
j.value().makePath(tp);
|
j.value().makePath(tp);
|
||||||
@@ -742,23 +662,21 @@ void CDSection::makePath(PIDeque<int> p) {
|
|||||||
|
|
||||||
PIVector<CDType *> CDSection::children(bool recursive) const {
|
PIVector<CDType *> CDSection::children(bool recursive) const {
|
||||||
PIVector<CDType *> ret;
|
PIVector<CDType *> ret;
|
||||||
PIMap<int, CDType>::const_iterator i;
|
for (auto i = cd.begin(); i != cd.end(); ++i) {
|
||||||
for (i = cd.begin(); i != cd.end(); ++i)
|
|
||||||
ret << const_cast<CDType *>(&(i.value()));
|
ret << const_cast<CDType *>(&(i.value()));
|
||||||
|
}
|
||||||
if (!recursive) return ret;
|
if (!recursive) return ret;
|
||||||
PIMap<int, CDSection>::const_iterator j;
|
for (auto j = s.begin(); j != s.end(); ++j) {
|
||||||
for (j = s.constBegin(); j != s.constEnd(); ++j)
|
|
||||||
ret << j.value().children(true);
|
ret << j.value().children(true);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PIVariantTypes::Enum CDSection::enumValues() const {
|
PIVariantTypes::Enum CDSection::enumValues() const {
|
||||||
PIVariantTypes::Enum ret;
|
PIVariantTypes::Enum ret;
|
||||||
PIMap<int, CDType>::const_iterator i;
|
for (auto i = cd.begin(); i != cd.end(); ++i) {
|
||||||
for (i = cd.constBegin(); i != cd.constEnd(); ++i)
|
|
||||||
ret << PIVariantTypes::Enumerator(i.key(), i.value().name());
|
ret << PIVariantTypes::Enumerator(i.key(), i.value().name());
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,10 +20,10 @@
|
|||||||
#ifndef CDUTILS_TYPES_H
|
#ifndef CDUTILS_TYPES_H
|
||||||
#define CDUTILS_TYPES_H
|
#define CDUTILS_TYPES_H
|
||||||
|
|
||||||
#include "pistring.h"
|
|
||||||
#include "pimap.h"
|
|
||||||
#include "pivariant.h"
|
|
||||||
#include "cd_core_export.h"
|
#include "cd_core_export.h"
|
||||||
|
#include "pimap.h"
|
||||||
|
#include "pistring.h"
|
||||||
|
#include "pivariant.h"
|
||||||
|
|
||||||
class PIIODevice;
|
class PIIODevice;
|
||||||
class PIEvaluator;
|
class PIEvaluator;
|
||||||
@@ -34,6 +34,12 @@ class CDItemModel;
|
|||||||
namespace CDUtils {
|
namespace CDUtils {
|
||||||
|
|
||||||
class CDSection;
|
class CDSection;
|
||||||
|
class CDCore;
|
||||||
|
class Interface;
|
||||||
|
class KInterface;
|
||||||
|
class XInterface;
|
||||||
|
class CInterface;
|
||||||
|
class MInterface;
|
||||||
|
|
||||||
enum UpdateMode {
|
enum UpdateMode {
|
||||||
SaveByIndex = 0x01,
|
SaveByIndex = 0x01,
|
||||||
@@ -53,11 +59,21 @@ class CD_CORE_EXPORT CDType {
|
|||||||
friend class CDCore;
|
friend class CDCore;
|
||||||
friend class Interface;
|
friend class Interface;
|
||||||
friend class XInterface;
|
friend class XInterface;
|
||||||
public:
|
|
||||||
enum cdT {cdNull, cdK, cdX, cdC, cdM};
|
|
||||||
enum XMode {X_Current, X_All_Avg};
|
|
||||||
|
|
||||||
CDType();
|
public:
|
||||||
|
enum cdT {
|
||||||
|
cdNull,
|
||||||
|
cdK,
|
||||||
|
cdX,
|
||||||
|
cdC,
|
||||||
|
cdM
|
||||||
|
};
|
||||||
|
enum XMode {
|
||||||
|
X_Current,
|
||||||
|
X_All_Avg
|
||||||
|
};
|
||||||
|
|
||||||
|
CDType() {}
|
||||||
CDType(int i, const PIString & n, const PIString & t, const PIString & v, const PIString & f, const PIString & c, cdT cd_t);
|
CDType(int i, const PIString & n, const PIString & t, const PIString & v, const PIString & f, const PIString & c, cdT cd_t);
|
||||||
|
|
||||||
CDType & operator=(double x);
|
CDType & operator=(double x);
|
||||||
@@ -97,19 +113,20 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
bool calculate(PIEvaluator * e, PIVector<const CDType *> stack = PIVector<const CDType *>());
|
bool calculate(PIEvaluator * e, PIVector<const CDType *> stack = PIVector<const CDType *>());
|
||||||
PIVariantTypes::Enum parseEnumComment(PIString c);
|
PIVariantTypes::Enum parseEnumComment(PIString c);
|
||||||
cdT cd_type_;
|
|
||||||
int index_;
|
cdT cd_type_ = cdNull;
|
||||||
|
int index_ = -1;
|
||||||
PIString name_, type_;
|
PIString name_, type_;
|
||||||
PIString value_s, formula_, comment_, error_;
|
PIString value_s, formula_, comment_, error_;
|
||||||
PIVariantTypes::Enum enum_values;
|
PIVariantTypes::Enum enum_values;
|
||||||
CDSection * parent;
|
CDSection * parent = nullptr;
|
||||||
PIDeque<int> path_;
|
PIDeque<int> path_;
|
||||||
double value_d;
|
double value_d = 0.;
|
||||||
int value_i;
|
int value_i = 0;
|
||||||
bool value_b, calculated, x_enabled;
|
bool value_b = false, calculated = false, x_enabled = false;
|
||||||
PIVector<double> avg_h;
|
PIVector<double> avg_h;
|
||||||
int avg_size;
|
int avg_size = 1;
|
||||||
XMode mode_, rmode_;
|
XMode mode_ = X_Current, rmode_ = X_Current;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -120,8 +137,8 @@ class CD_CORE_EXPORT CDSection {
|
|||||||
friend class ::CD_Pult;
|
friend class ::CD_Pult;
|
||||||
friend class ::CDItem;
|
friend class ::CDItem;
|
||||||
friend class ::CDItemModel;
|
friend class ::CDItemModel;
|
||||||
public:
|
|
||||||
|
|
||||||
|
public:
|
||||||
CDSection(CDType::cdT type_ = CDType::cdNull);
|
CDSection(CDType::cdT type_ = CDType::cdNull);
|
||||||
|
|
||||||
bool test(int v) { return cd.value(v).toBool(); }
|
bool test(int v) { return cd.value(v).toBool(); }
|
||||||
@@ -147,10 +164,7 @@ public:
|
|||||||
PIString alias;
|
PIString alias;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CDSection(PIMap<int, CDType> k_, PIMap<int, CDSection> s_) {
|
CDSection(PIMap<int, CDType> k_, PIMap<int, CDSection> s_): cd(k_), s(s_) {}
|
||||||
cd = k_;
|
|
||||||
s = s_;
|
|
||||||
}
|
|
||||||
CDType & getByName(const PIString & name_);
|
CDType & getByName(const PIString & name_);
|
||||||
CDType & getByPath(const PIDeque<int> & path_);
|
CDType & getByPath(const PIDeque<int> & path_);
|
||||||
void write(PIIODevice * d, const PIString & prefix = PIString());
|
void write(PIIODevice * d, const PIString & prefix = PIString());
|
||||||
@@ -168,7 +182,7 @@ protected:
|
|||||||
CDType::cdT cd_type_;
|
CDType::cdT cd_type_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace CDUtils
|
||||||
|
|
||||||
|
|
||||||
inline PICout operator<<(PICout s, const CDUtils::CDType & v) {
|
inline PICout operator<<(PICout s, const CDUtils::CDType & v) {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "cdutils_x.h"
|
#include "cdutils_x.h"
|
||||||
|
|
||||||
#include "cdutils_core.h"
|
#include "cdutils_core.h"
|
||||||
|
|
||||||
using namespace CDUtils;
|
using namespace CDUtils;
|
||||||
|
|||||||
@@ -20,16 +20,16 @@
|
|||||||
#ifndef CDUTILS_X_H
|
#ifndef CDUTILS_X_H
|
||||||
#define CDUTILS_X_H
|
#define CDUTILS_X_H
|
||||||
|
|
||||||
#include "cdutils_interface.h"
|
|
||||||
#include "cd_core_export.h"
|
#include "cd_core_export.h"
|
||||||
|
#include "cdutils_interface.h"
|
||||||
|
|
||||||
|
|
||||||
namespace CDUtils {
|
namespace CDUtils {
|
||||||
|
|
||||||
|
|
||||||
class CD_CORE_EXPORT XInterface: public Interface
|
class CD_CORE_EXPORT XInterface: public Interface {
|
||||||
{
|
|
||||||
PIOBJECT_SUBCLASS(XInterface, Interface);
|
PIOBJECT_SUBCLASS(XInterface, Interface);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
XInterface();
|
XInterface();
|
||||||
|
|
||||||
@@ -47,10 +47,9 @@ public:
|
|||||||
|
|
||||||
void start(double freq = 20.);
|
void start(double freq = 20.);
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace CDUtils
|
||||||
|
|
||||||
extern CD_CORE_EXPORT CDUtils::XInterface X;
|
extern CD_CORE_EXPORT CDUtils::XInterface X;
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
#include "cdutils_k.h"
|
|
||||||
#include "cdutils_x.h"
|
|
||||||
#include "cdutils_c.h"
|
|
||||||
#include "cdutils_m.h"
|
|
||||||
#include "cdutils_core.h"
|
|
||||||
#include "cdtest.h"
|
#include "cdtest.h"
|
||||||
#include "pip.h"
|
#include "cdutils_c.h"
|
||||||
|
#include "cdutils_core.h"
|
||||||
|
#include "cdutils_k.h"
|
||||||
|
#include "cdutils_m.h"
|
||||||
|
#include "cdutils_x.h"
|
||||||
#include "k_description.h"
|
#include "k_description.h"
|
||||||
|
#include "piliterals_time.h"
|
||||||
|
#include "pip.h"
|
||||||
|
|
||||||
using namespace CDUtils;
|
using namespace CDUtils;
|
||||||
|
|
||||||
class Core : public PIObject
|
class Core: public PIObject {
|
||||||
{
|
|
||||||
PIOBJECT(Core);
|
PIOBJECT(Core);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Core() {
|
Core() {
|
||||||
CDCore::instance()->initApp();
|
CDCore::instance()->initApp();
|
||||||
@@ -68,7 +69,7 @@ public:
|
|||||||
}
|
}
|
||||||
EVENT_HANDLER(void, xrecv) {
|
EVENT_HANDLER(void, xrecv) {
|
||||||
piCout << "received x";
|
piCout << "received x";
|
||||||
if (!timer.isRunning()) timer.start(10);
|
if (!timer.isRunning()) timer.start(100_Hz);
|
||||||
X.start();
|
X.start();
|
||||||
}
|
}
|
||||||
EVENT_HANDLER(void, timerDone) { test(); }
|
EVENT_HANDLER(void, timerDone) { test(); }
|
||||||
@@ -94,4 +95,3 @@ int main(int argc, char *argv[]) {
|
|||||||
piCout << "DELETED";
|
piCout << "DELETED";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,22 @@
|
|||||||
#include "qcd_core.h"
|
#include "qcd_core.h"
|
||||||
#include "cdutils_k.h"
|
|
||||||
#include "cdutils_core.h"
|
#include "cdutils_core.h"
|
||||||
|
#include "cdutils_k.h"
|
||||||
#include "piqt.h"
|
#include "piqt.h"
|
||||||
#include <QWidget>
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QGroupBox>
|
|
||||||
#include <QSpinBox>
|
|
||||||
#include <QSlider>
|
|
||||||
#include <QScrollBar>
|
|
||||||
#include <QDoubleSpinBox>
|
#include <QDoubleSpinBox>
|
||||||
|
#include <QGroupBox>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <spinslider.h>
|
#include <QScrollBar>
|
||||||
|
#include <QSlider>
|
||||||
|
#include <QSpinBox>
|
||||||
|
#include <QWidget>
|
||||||
#include <clineedit.h>
|
#include <clineedit.h>
|
||||||
#include <evalspinbox.h>
|
#include <evalspinbox.h>
|
||||||
#include <qvariantedit.h>
|
|
||||||
#include <qcd_view.h>
|
#include <qcd_view.h>
|
||||||
|
#include <qvariantedit.h>
|
||||||
|
#include <spinslider.h>
|
||||||
|
|
||||||
using namespace CDUtils;
|
using namespace CDUtils;
|
||||||
|
|
||||||
@@ -40,8 +42,6 @@ __QCore_Initializer__::~__QCore_Initializer__() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QCDCore::QCDCore() {
|
QCDCore::QCDCore() {
|
||||||
setObjectName("QCDCore");
|
setObjectName("QCDCore");
|
||||||
setName("QCDCore");
|
setName("QCDCore");
|
||||||
@@ -50,8 +50,7 @@ QCDCore::QCDCore() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QCDCore::~QCDCore() {
|
QCDCore::~QCDCore() {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void QCDCore::K_ChangedGlobal() {
|
void QCDCore::K_ChangedGlobal() {
|
||||||
@@ -141,7 +140,7 @@ bool QCDCore::bindWidget(QWidget * w) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PIVector<CDType *> ak = K.root().children();
|
PIVector<CDType *> ak = K.root().children();
|
||||||
piForeachC (CDType * k, ak) {
|
for (const auto * k: ak) {
|
||||||
if (!on.endsWith(PI2QString(k->pathString().join("_")))) continue;
|
if (!on.endsWith(PI2QString(k->pathString().join("_")))) continue;
|
||||||
if (bindWidget(w, *k)) return true;
|
if (bindWidget(w, *k)) return true;
|
||||||
}
|
}
|
||||||
@@ -256,16 +255,12 @@ bool QCDCore::unbindWidget(QWidget * w) {
|
|||||||
// qDebug() << "unbind" << w;
|
// qDebug() << "unbind" << w;
|
||||||
if (!binded_widgets.contains(w)) return false;
|
if (!binded_widgets.contains(w)) return false;
|
||||||
QString cn = w->metaObject()->className();
|
QString cn = w->metaObject()->className();
|
||||||
if (cn == "QCheckBox" || cn == "QGroupBox")
|
if (cn == "QCheckBox" || cn == "QGroupBox") disconnect(w, SIGNAL(toggled(bool)), this, SLOT(slotBool(bool)));
|
||||||
disconnect(w, SIGNAL(toggled(bool)), this, SLOT(slotBool(bool)));
|
if (cn == "QSpinBox" || cn == "QSlider" || cn == "QScrollBar") disconnect(w, SIGNAL(valueChanged(int)), this, SLOT(slotInt(int)));
|
||||||
if (cn == "QSpinBox" || cn == "QSlider" || cn == "QScrollBar")
|
|
||||||
disconnect(w, SIGNAL(valueChanged(int)), this, SLOT(slotInt(int)));
|
|
||||||
if (cn == "QDoubleSpinBox" || cn == "SpinSlider" || cn == "EvalSpinBox")
|
if (cn == "QDoubleSpinBox" || cn == "SpinSlider" || cn == "EvalSpinBox")
|
||||||
disconnect(w, SIGNAL(valueChanged(double)), this, SLOT(slotDouble(double)));
|
disconnect(w, SIGNAL(valueChanged(double)), this, SLOT(slotDouble(double)));
|
||||||
if (cn == "QLineEdit" || cn == "CLineEdit")
|
if (cn == "QLineEdit" || cn == "CLineEdit") disconnect(w, SIGNAL(textChanged(QString)), this, SLOT(slotText(QString)));
|
||||||
disconnect(w, SIGNAL(textChanged(QString)), this, SLOT(slotText(QString)));
|
if (cn == "QVariantEdit") disconnect(w, SIGNAL(valueChanged(QVariant)), this, SLOT(slotVariant(QVariant)));
|
||||||
if (cn == "QVariantEdit")
|
|
||||||
disconnect(w, SIGNAL(valueChanged(QVariant)), this, SLOT(slotVariant(QVariant)));
|
|
||||||
// qDebug() << "remove b" << binded_widgets.size();
|
// qDebug() << "remove b" << binded_widgets.size();
|
||||||
binded_widgets.remove(w);
|
binded_widgets.remove(w);
|
||||||
// qDebug() << "remove a" << binded_widgets.size();
|
// qDebug() << "remove a" << binded_widgets.size();
|
||||||
|
|||||||
@@ -20,12 +20,13 @@
|
|||||||
#ifndef QCD_CORE_H
|
#ifndef QCD_CORE_H
|
||||||
#define QCD_CORE_H
|
#define QCD_CORE_H
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QMultiMap>
|
|
||||||
#include <QVariant>
|
|
||||||
#include "piobject.h"
|
|
||||||
#include "cdutils_types.h"
|
|
||||||
#include "cd_qt_export.h"
|
#include "cd_qt_export.h"
|
||||||
|
#include "cdutils_types.h"
|
||||||
|
#include "piobject.h"
|
||||||
|
|
||||||
|
#include <QMultiMap>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
|
|
||||||
class QCDCore;
|
class QCDCore;
|
||||||
@@ -40,11 +41,13 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class CD_QT_EXPORT QCDCore: public QObject, public PIObject
|
class CD_QT_EXPORT QCDCore
|
||||||
{
|
: public QObject
|
||||||
|
, public PIObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
PIOBJECT(QCDCore);
|
PIOBJECT(QCDCore);
|
||||||
friend class __QCore_Initializer__;
|
friend class __QCore_Initializer__;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static QCDCore * instance() { return __QCore_Initializer__::__instance__; }
|
static QCDCore * instance() { return __QCore_Initializer__::__instance__; }
|
||||||
|
|
||||||
@@ -87,7 +90,6 @@ public slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void updateViewRequest();
|
void updateViewRequest();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
#include "qcd_graphic.h"
|
#include "qcd_graphic.h"
|
||||||
#include "ui_qcd_graphic.h"
|
|
||||||
#include "cdutils_core.h"
|
#include "cdutils_core.h"
|
||||||
#include "cdutils_x.h"
|
#include "cdutils_x.h"
|
||||||
#include "graphic.h"
|
#include "graphic.h"
|
||||||
#include "piqt.h"
|
#include "piqt.h"
|
||||||
|
#include "ui_qcd_graphic.h"
|
||||||
|
|
||||||
using namespace CDUtils;
|
using namespace CDUtils;
|
||||||
|
|
||||||
|
|||||||
@@ -20,15 +20,16 @@
|
|||||||
#ifndef QCD_GRAPHIC_H
|
#ifndef QCD_GRAPHIC_H
|
||||||
#define QCD_GRAPHIC_H
|
#define QCD_GRAPHIC_H
|
||||||
|
|
||||||
|
#include "cd_qt_export.h"
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <evalspinbox.h>
|
#include <evalspinbox.h>
|
||||||
#include <pistring.h>
|
#include <pistring.h>
|
||||||
#include "cd_qt_export.h"
|
|
||||||
|
|
||||||
namespace CDUtils {
|
namespace CDUtils {
|
||||||
class CDType;
|
class CDType;
|
||||||
class CDSection;
|
class CDSection;
|
||||||
}
|
} // namespace CDUtils
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class CDGraphicWidget;
|
class CDGraphicWidget;
|
||||||
@@ -42,6 +43,7 @@ class CD_QT_EXPORT CDGraphicWidget: public QWidget {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class CDGraphics;
|
friend class CDGraphics;
|
||||||
friend class GDockWidget;
|
friend class GDockWidget;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CDGraphicWidget(QWidget * p = 0);
|
CDGraphicWidget(QWidget * p = 0);
|
||||||
|
|
||||||
@@ -60,7 +62,6 @@ private:
|
|||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="Graphic" name="graphic">
|
<widget class="Graphic" name="graphic">
|
||||||
<property name="buttons">
|
<property name="buttons">
|
||||||
<set>Graphic::Autofit|Graphic::BorderInputs|Graphic::Clear|Graphic::Configure|Graphic::CursorAxis|Graphic::Fullscreen|Graphic::Legend|Graphic::Pause|Graphic::Save</set>
|
<set>Graphic::Autofit|Graphic::Clear|Graphic::Configure|Graphic::CursorAxis|Graphic::Export|Graphic::Fullscreen|Graphic::Legend|Graphic::Pause|Graphic::Record|Graphic::Save</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="borderInputsVisible">
|
<property name="borderInputsVisible">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "qcd_modedialog.h"
|
#include "qcd_modedialog.h"
|
||||||
|
|
||||||
#include "ui_qcd_modedialog.h"
|
#include "ui_qcd_modedialog.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -25,11 +26,8 @@ CDUtils::UpdateModeFlags QCDModeDialog::mode() const {
|
|||||||
void QCDModeDialog::changeEvent(QEvent * e) {
|
void QCDModeDialog::changeEvent(QEvent * e) {
|
||||||
QDialog::changeEvent(e);
|
QDialog::changeEvent(e);
|
||||||
switch (e->type()) {
|
switch (e->type()) {
|
||||||
case QEvent::LanguageChange:
|
case QEvent::LanguageChange: ui->retranslateUi(this); break;
|
||||||
ui->retranslateUi(this);
|
default: break;
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,17 +20,18 @@
|
|||||||
#ifndef QCD_MODEDIALOG_H
|
#ifndef QCD_MODEDIALOG_H
|
||||||
#define QCD_MODEDIALOG_H
|
#define QCD_MODEDIALOG_H
|
||||||
|
|
||||||
|
#include "cd_qt_export.h"
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <cdutils_types.h>
|
#include <cdutils_types.h>
|
||||||
#include "cd_qt_export.h"
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class QCDModeDialog;
|
class QCDModeDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CD_QT_EXPORT QCDModeDialog: public QDialog
|
class CD_QT_EXPORT QCDModeDialog: public QDialog {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QCDModeDialog(QWidget * parent = 0);
|
explicit QCDModeDialog(QWidget * parent = 0);
|
||||||
~QCDModeDialog();
|
~QCDModeDialog();
|
||||||
@@ -45,7 +46,6 @@ protected:
|
|||||||
private slots:
|
private slots:
|
||||||
void on_checkSaveIndex_clicked(bool checked);
|
void on_checkSaveIndex_clicked(bool checked);
|
||||||
void on_checkSaveName_clicked(bool checked);
|
void on_checkSaveName_clicked(bool checked);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QCD_MODEDIALOG_H
|
#endif // QCD_MODEDIALOG_H
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
#include "qcd_model.h"
|
#include "qcd_model.h"
|
||||||
#include "cdutils_interface.h"
|
|
||||||
#include "cdutils_core.h"
|
#include "cdutils_core.h"
|
||||||
|
#include "cdutils_interface.h"
|
||||||
#include "cdutils_x.h"
|
#include "cdutils_x.h"
|
||||||
#include "piqt.h"
|
#include "piqt.h"
|
||||||
#include <QDebug>
|
#include "qad_types.h"
|
||||||
|
#include "qvariantedit.h"
|
||||||
|
|
||||||
#include <QBrush>
|
#include <QBrush>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
#include <QDebug>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include "qvariantedit.h"
|
#include <QPainter>
|
||||||
#include "qad_types.h"
|
|
||||||
|
|
||||||
|
|
||||||
using namespace CDUtils;
|
using namespace CDUtils;
|
||||||
@@ -35,8 +38,10 @@ QVariant CDItem::data(int column, int role) const {
|
|||||||
switch (type_) {
|
switch (type_) {
|
||||||
case ItemCDType: {
|
case ItemCDType: {
|
||||||
CDType & t(interface->section(buildPath())[index_]);
|
CDType & t(interface->section(buildPath())[index_]);
|
||||||
if (t.errorString().isEmpty()) return QBrush(QColor(255, 250, 230));
|
if (t.errorString().isEmpty())
|
||||||
else return QBrush(QColor(255, 128, 128));
|
return QBrush(QColor(255, 250, 230));
|
||||||
|
else
|
||||||
|
return QBrush(QColor(255, 128, 128));
|
||||||
}
|
}
|
||||||
case ItemCDSection: return QBrush(QColor(230, 250, 230));
|
case ItemCDSection: return QBrush(QColor(230, 250, 230));
|
||||||
}
|
}
|
||||||
@@ -44,8 +49,10 @@ QVariant CDItem::data(int column, int role) const {
|
|||||||
if (role == Qt::CheckStateRole && type_ == ItemCDType) {
|
if (role == Qt::CheckStateRole && type_ == ItemCDType) {
|
||||||
CDType & t(interface->section(buildPath())[index_]);
|
CDType & t(interface->section(buildPath())[index_]);
|
||||||
if (column == cValue && t.cd_type() == CDType::cdK) {
|
if (column == cValue && t.cd_type() == CDType::cdK) {
|
||||||
if (t.type() == "b") return t.toBool() ? Qt::Checked : Qt::Unchecked;
|
if (t.type() == "b")
|
||||||
else QVariant();
|
return t.toBool() ? Qt::Checked : Qt::Unchecked;
|
||||||
|
else
|
||||||
|
QVariant();
|
||||||
}
|
}
|
||||||
if (column == cName_Cmd && t.cd_type() == CDType::cdX) {
|
if (column == cName_Cmd && t.cd_type() == CDType::cdX) {
|
||||||
return t.isSelectedX() ? Qt::Checked : Qt::Unchecked;
|
return t.isSelectedX() ? Qt::Checked : Qt::Unchecked;
|
||||||
@@ -95,8 +102,10 @@ QVariant CDItem::value(CDType & t, int role) const {
|
|||||||
if (t.type() == "e") {
|
if (t.type() == "e") {
|
||||||
QAD::Enum et = PI2QADEnum(t.enumValues());
|
QAD::Enum et = PI2QADEnum(t.enumValues());
|
||||||
et.selectValue(t.toInt());
|
et.selectValue(t.toInt());
|
||||||
if (role == Qt::EditRole) return QVariant::fromValue<QAD::Enum>(et);
|
if (role == Qt::EditRole)
|
||||||
else return et.selectedName();
|
return QVariant::fromValue<QAD::Enum>(et);
|
||||||
|
else
|
||||||
|
return et.selectedName();
|
||||||
}
|
}
|
||||||
return PI2QString(t.value());
|
return PI2QString(t.value());
|
||||||
}
|
}
|
||||||
@@ -112,15 +121,9 @@ bool CDItem::setData(int column, const QVariant & value) {
|
|||||||
}
|
}
|
||||||
if (t.cd_type() == CDType::cdX) {
|
if (t.cd_type() == CDType::cdX) {
|
||||||
switch (column) {
|
switch (column) {
|
||||||
case cName_Cmd:
|
case cName_Cmd: X.setEnabled(t, value.toBool()); return true;
|
||||||
X.setEnabled(t, value.toBool());
|
case cXMode: t.setXMode((CDType::XMode)value.toInt()); return true;
|
||||||
return true;
|
case cXAvg: t.setAvg(piMax(value.toInt(), 1)); return true;
|
||||||
case cXMode:
|
|
||||||
t.setXMode((CDType::XMode)value.toInt());
|
|
||||||
return true;
|
|
||||||
case cXAvg:
|
|
||||||
t.setAvg(piMax(value.toInt(), 1));
|
|
||||||
return true;
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -165,8 +168,7 @@ QString CDItem::stringType(const PIString & t) const {
|
|||||||
|
|
||||||
QAD::Enum CDItem::xModeEnum(int v) const {
|
QAD::Enum CDItem::xModeEnum(int v) const {
|
||||||
QAD::Enum ret;
|
QAD::Enum ret;
|
||||||
ret << QAD::Enumerator(CDType::X_Current, "Current")
|
ret << QAD::Enumerator(CDType::X_Current, "Current") << QAD::Enumerator(CDType::X_All_Avg, "All, Averaging");
|
||||||
<< QAD::Enumerator(CDType::X_All_Avg, "All, Averaging");
|
|
||||||
ret.selectValue(v);
|
ret.selectValue(v);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -174,8 +176,7 @@ QAD::Enum CDItem::xModeEnum(int v) const {
|
|||||||
|
|
||||||
// CDKDelegate
|
// CDKDelegate
|
||||||
|
|
||||||
CDDelegate::CDDelegate(QObject *parent) : QStyledItemDelegate(parent) {
|
CDDelegate::CDDelegate(QObject * parent): QStyledItemDelegate(parent) {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CDDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const {
|
void CDDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const {
|
||||||
@@ -194,8 +195,7 @@ void CDDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option,
|
|||||||
QPoint cp = v->mapFromGlobal(QCursor::pos());
|
QPoint cp = v->mapFromGlobal(QCursor::pos());
|
||||||
if (bo.rect.contains(cp, true)) {
|
if (bo.rect.contains(cp, true)) {
|
||||||
// bo.state |= QStyle::State_MouseOver;
|
// bo.state |= QStyle::State_MouseOver;
|
||||||
if (qApp->mouseButtons().testFlag(Qt::LeftButton))
|
if (qApp->mouseButtons().testFlag(Qt::LeftButton)) bo.state |= QStyle::State_On;
|
||||||
bo.state |= QStyle::State_On;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qApp->style()->drawControl(QStyle::CE_PushButton, &bo, painter);
|
qApp->style()->drawControl(QStyle::CE_PushButton, &bo, painter);
|
||||||
@@ -203,7 +203,6 @@ void CDDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QStyledItemDelegate::paint(painter, option, index);
|
QStyledItemDelegate::paint(painter, option, index);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -224,7 +223,8 @@ void CDDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const
|
|||||||
if (v.canConvert<QAD::Enum>()) {
|
if (v.canConvert<QAD::Enum>()) {
|
||||||
QAD::Enum et = v.value<QAD::Enum>();
|
QAD::Enum et = v.value<QAD::Enum>();
|
||||||
model->setData(index, et.selectedValue(), Qt::EditRole);
|
model->setData(index, et.selectedValue(), Qt::EditRole);
|
||||||
} else model->setData(index, v, Qt::EditRole);
|
} else
|
||||||
|
model->setData(index, v, Qt::EditRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -283,8 +283,10 @@ QModelIndex CDItemModel::index(int row, int column, const QModelIndex &parent) c
|
|||||||
if (parent.isValid() && parent.column() != cID) return QModelIndex();
|
if (parent.isValid() && parent.column() != cID) return QModelIndex();
|
||||||
CDItem * p = getItem(parent);
|
CDItem * p = getItem(parent);
|
||||||
CDItem * c = p->childs.value(row, 0);
|
CDItem * c = p->childs.value(row, 0);
|
||||||
if (c) return createIndex(row, column, c);
|
if (c)
|
||||||
else return QModelIndex();
|
return createIndex(row, column, c);
|
||||||
|
else
|
||||||
|
return QModelIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -316,18 +318,13 @@ Qt::ItemFlags CDItemModel::flags(const QModelIndex & index) const {
|
|||||||
if (item->type_ == CDItem::ItemCDType) {
|
if (item->type_ == CDItem::ItemCDType) {
|
||||||
CDType & t(interface->section(item->buildPath())[item->index_]);
|
CDType & t(interface->section(item->buildPath())[item->index_]);
|
||||||
if (t.cd_type() == CDType::cdK) {
|
if (t.cd_type() == CDType::cdK) {
|
||||||
if (index.column() == cExpression || index.column() == cValue)
|
if (index.column() == cExpression || index.column() == cValue) f |= Qt::ItemIsEditable;
|
||||||
f |= Qt::ItemIsEditable;
|
if (index.column() == cValue && t.type() == "b") f |= Qt::ItemIsUserCheckable;
|
||||||
if (index.column() == cValue && t.type() == "b")
|
if (index.column() == cName_Cmd) f |= Qt::ItemIsDragEnabled;
|
||||||
f |= Qt::ItemIsUserCheckable;
|
|
||||||
if (index.column() == cName_Cmd)
|
|
||||||
f |= Qt::ItemIsDragEnabled;
|
|
||||||
}
|
}
|
||||||
if (t.cd_type() == CDType::cdX) {
|
if (t.cd_type() == CDType::cdX) {
|
||||||
if (index.column() == cXMode || index.column() == cXAvg)
|
if (index.column() == cXMode || index.column() == cXAvg) f |= Qt::ItemIsEditable;
|
||||||
f |= Qt::ItemIsEditable;
|
if (index.column() == cName_Cmd) f |= Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled;
|
||||||
if (index.column() == cName_Cmd)
|
|
||||||
f |= Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return f;
|
return f;
|
||||||
@@ -375,8 +372,7 @@ QMimeData * CDItemModel::mimeData(const QModelIndexList & indexes) const {
|
|||||||
if (item) {
|
if (item) {
|
||||||
CDType & t(interface->section(item->buildPath())[item->index_]);
|
CDType & t(interface->section(item->buildPath())[item->index_]);
|
||||||
QMimeData * mime = new QMimeData();
|
QMimeData * mime = new QMimeData();
|
||||||
mime->setText(PI2QString(CDCore::instance()->typeLetter(interface->cdType()) +
|
mime->setText(PI2QString(CDCore::instance()->typeLetter(interface->cdType()) + CDCore::pathToString(t.path())));
|
||||||
CDCore::pathToString(t.path())));
|
|
||||||
return mime;
|
return mime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,11 +20,12 @@
|
|||||||
#ifndef QCD_MODEL_H
|
#ifndef QCD_MODEL_H
|
||||||
#define QCD_MODEL_H
|
#define QCD_MODEL_H
|
||||||
|
|
||||||
|
#include "cd_qt_export.h"
|
||||||
|
#include "pistring.h"
|
||||||
|
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
#include <QItemDelegate>
|
#include <QItemDelegate>
|
||||||
#include <QStyledItemDelegate>
|
#include <QStyledItemDelegate>
|
||||||
#include "pistring.h"
|
|
||||||
#include "cd_qt_export.h"
|
|
||||||
|
|
||||||
namespace CDUtils {
|
namespace CDUtils {
|
||||||
class CDType;
|
class CDType;
|
||||||
@@ -42,7 +43,7 @@ namespace CDUtils {
|
|||||||
cComment,
|
cComment,
|
||||||
cLastColumn,
|
cLastColumn,
|
||||||
};
|
};
|
||||||
}
|
} // namespace CDUtils
|
||||||
|
|
||||||
namespace QAD {
|
namespace QAD {
|
||||||
struct Enum;
|
struct Enum;
|
||||||
@@ -54,8 +55,12 @@ class CDItemModel;
|
|||||||
class CD_QT_EXPORT CDItem {
|
class CD_QT_EXPORT CDItem {
|
||||||
friend class CDItemModel;
|
friend class CDItemModel;
|
||||||
friend class CDView;
|
friend class CDView;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum CDItemType{ItemCDType, ItemCDSection};
|
enum CDItemType {
|
||||||
|
ItemCDType,
|
||||||
|
ItemCDSection
|
||||||
|
};
|
||||||
CDItem(CDUtils::Interface * interface, int _index, CDItemType type, CDItem * parent);
|
CDItem(CDUtils::Interface * interface, int _index, CDItemType type, CDItem * parent);
|
||||||
~CDItem();
|
~CDItem();
|
||||||
QVariant data(int column, int role) const;
|
QVariant data(int column, int role) const;
|
||||||
@@ -79,9 +84,9 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class CD_QT_EXPORT CDDelegate : public QStyledItemDelegate
|
class CD_QT_EXPORT CDDelegate: public QStyledItemDelegate {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CDDelegate(QObject * parent = 0);
|
CDDelegate(QObject * parent = 0);
|
||||||
|
|
||||||
@@ -91,13 +96,13 @@ public:
|
|||||||
void setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const;
|
void setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const;
|
||||||
void updateEditorGeometry(QWidget * editor, const QStyleOptionViewItem & option, const QModelIndex & index) const;
|
void updateEditorGeometry(QWidget * editor, const QStyleOptionViewItem & option, const QModelIndex & index) const;
|
||||||
QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const;
|
QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class CD_QT_EXPORT CDItemModel: public QAbstractItemModel {
|
class CD_QT_EXPORT CDItemModel: public QAbstractItemModel {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class CDView;
|
friend class CDView;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CDItemModel(int type_, QObject * parent = 0);
|
explicit CDItemModel(int type_, QObject * parent = 0);
|
||||||
~CDItemModel();
|
~CDItemModel();
|
||||||
@@ -127,7 +132,6 @@ private:
|
|||||||
CDItem * root;
|
CDItem * root;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QCD_MODEL_H
|
#endif // QCD_MODEL_H
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
|
#include "qcd_view.h"
|
||||||
|
|
||||||
|
#include "cdutils_c.h"
|
||||||
|
#include "cdutils_core.h"
|
||||||
|
#include "cdutils_k.h"
|
||||||
|
#include "cdutils_m.h"
|
||||||
|
#include "cdutils_x.h"
|
||||||
|
#include "pifile.h"
|
||||||
|
#include "piqt.h"
|
||||||
|
#include "qcd_model.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
#include "cdutils_k.h"
|
|
||||||
#include "cdutils_x.h"
|
|
||||||
#include "cdutils_c.h"
|
|
||||||
#include "cdutils_m.h"
|
|
||||||
#include "cdutils_core.h"
|
|
||||||
#include "qcd_view.h"
|
|
||||||
#include "qcd_model.h"
|
|
||||||
#include "piqt.h"
|
|
||||||
#include "pifile.h"
|
|
||||||
|
|
||||||
using namespace CDUtils;
|
using namespace CDUtils;
|
||||||
|
|
||||||
@@ -75,15 +77,13 @@ void CDView::setType(int cdt) {
|
|||||||
break;
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDView::mousePressEvent(QMouseEvent * e) {
|
void CDView::mousePressEvent(QMouseEvent * e) {
|
||||||
if (type_ == CDType::cdC) {
|
if (type_ == CDType::cdC) {
|
||||||
QModelIndex i = indexAt(e->pos());
|
QModelIndex i = indexAt(e->pos());
|
||||||
if (i.isValid() && i.column() == cName_Cmd)
|
if (i.isValid() && i.column() == cName_Cmd) update(i);
|
||||||
update(i);
|
|
||||||
}
|
}
|
||||||
QTreeView::mousePressEvent(e);
|
QTreeView::mousePressEvent(e);
|
||||||
}
|
}
|
||||||
@@ -92,8 +92,7 @@ void CDView::mousePressEvent(QMouseEvent * e) {
|
|||||||
void CDView::mouseReleaseEvent(QMouseEvent * e) {
|
void CDView::mouseReleaseEvent(QMouseEvent * e) {
|
||||||
if (type_ == CDType::cdC) {
|
if (type_ == CDType::cdC) {
|
||||||
QModelIndex i = indexAt(e->pos());
|
QModelIndex i = indexAt(e->pos());
|
||||||
if (i.isValid() && i.column() == cName_Cmd)
|
if (i.isValid() && i.column() == cName_Cmd) update(i);
|
||||||
update(i);
|
|
||||||
}
|
}
|
||||||
QTreeView::mouseReleaseEvent(e);
|
QTreeView::mouseReleaseEvent(e);
|
||||||
}
|
}
|
||||||
@@ -101,8 +100,7 @@ void CDView::mouseReleaseEvent(QMouseEvent * e) {
|
|||||||
|
|
||||||
void CDView::currentChanged(const QModelIndex & cur, const QModelIndex & prev) {
|
void CDView::currentChanged(const QModelIndex & cur, const QModelIndex & prev) {
|
||||||
if (type_ == CDType::cdC) {
|
if (type_ == CDType::cdC) {
|
||||||
if (prev.isValid() && prev.column() == cName_Cmd)
|
if (prev.isValid() && prev.column() == cName_Cmd) update(prev);
|
||||||
update(prev);
|
|
||||||
}
|
}
|
||||||
QTreeView::currentChanged(cur, prev);
|
QTreeView::currentChanged(cur, prev);
|
||||||
}
|
}
|
||||||
@@ -121,8 +119,7 @@ void CDView::refresh() {
|
|||||||
proxy_->setSourceModel(model_);
|
proxy_->setSourceModel(model_);
|
||||||
setModel(proxy_);
|
setModel(proxy_);
|
||||||
setItemDelegateForColumn(type_ == CDType::cdC ? cName_Cmd : cValue, new CDDelegate());
|
setItemDelegateForColumn(type_ == CDType::cdC ? cName_Cmd : cValue, new CDDelegate());
|
||||||
if (type_ == CDType::cdX)
|
if (type_ == CDType::cdX) setItemDelegateForColumn(cXMode, new CDDelegate());
|
||||||
setItemDelegateForColumn(cXMode, new CDDelegate());
|
|
||||||
}
|
}
|
||||||
model_->rebuildModel();
|
model_->rebuildModel();
|
||||||
switch ((CDType::cdT)type_) {
|
switch ((CDType::cdT)type_) {
|
||||||
@@ -130,9 +127,7 @@ void CDView::refresh() {
|
|||||||
setColumnHidden(cXMode, true);
|
setColumnHidden(cXMode, true);
|
||||||
setColumnHidden(cXAvg, true);
|
setColumnHidden(cXAvg, true);
|
||||||
break;
|
break;
|
||||||
case CDType::cdX:
|
case CDType::cdX: setColumnHidden(cExpression, true); break;
|
||||||
setColumnHidden(cExpression, true);
|
|
||||||
break;
|
|
||||||
case CDType::cdC:
|
case CDType::cdC:
|
||||||
case CDType::cdM:
|
case CDType::cdM:
|
||||||
setColumnHidden(cType, true);
|
setColumnHidden(cType, true);
|
||||||
@@ -144,7 +139,8 @@ void CDView::refresh() {
|
|||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
expandAll();
|
expandAll();
|
||||||
for (int i = 0; i < model_->columnCount(); i++) resizeColumnToContents(i);
|
for (int i = 0; i < model_->columnCount(); i++)
|
||||||
|
resizeColumnToContents(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -348,7 +344,7 @@ void CDView::cd_receivedX() {
|
|||||||
X.lock();
|
X.lock();
|
||||||
PIVector<PIDeque<int>> xl = X.enabledList();
|
PIVector<PIDeque<int>> xl = X.enabledList();
|
||||||
// piCout << "X" << xl.size();
|
// piCout << "X" << xl.size();
|
||||||
piForeachC (PIDeque<int> & x, xl) {
|
for (const auto & x: xl) {
|
||||||
CDType & t(X[x]);
|
CDType & t(X[x]);
|
||||||
// piCout << t;
|
// piCout << t;
|
||||||
// piCout << t.path();
|
// piCout << t.path();
|
||||||
@@ -368,7 +364,9 @@ void CDView::cd_changedGlobal() {
|
|||||||
|
|
||||||
|
|
||||||
void CDView::pi_cd_messageReceived(PIDeque<int> path, int type, PIString msg) {
|
void CDView::pi_cd_messageReceived(PIDeque<int> path, int type, PIString msg) {
|
||||||
QMetaObject::invokeMethod(this, "messageReceived", Qt::QueuedConnection,
|
QMetaObject::invokeMethod(this,
|
||||||
|
"messageReceived",
|
||||||
|
Qt::QueuedConnection,
|
||||||
Q_ARG(QString, PI2QString(CDCore::pathToString(path))),
|
Q_ARG(QString, PI2QString(CDCore::pathToString(path))),
|
||||||
Q_ARG(int, type),
|
Q_ARG(int, type),
|
||||||
Q_ARG(QString, PI2QString(msg)));
|
Q_ARG(QString, PI2QString(msg)));
|
||||||
|
|||||||
@@ -20,22 +20,25 @@
|
|||||||
#ifndef QCD_VIEW_H
|
#ifndef QCD_VIEW_H
|
||||||
#define QCD_VIEW_H
|
#define QCD_VIEW_H
|
||||||
|
|
||||||
#include <QTreeView>
|
|
||||||
#include "piobject.h"
|
|
||||||
#include "cd_qt_export.h"
|
#include "cd_qt_export.h"
|
||||||
|
#include "piobject.h"
|
||||||
|
|
||||||
|
#include <QTreeView>
|
||||||
|
|
||||||
namespace CDUtils {
|
namespace CDUtils {
|
||||||
class CDType;
|
class CDType;
|
||||||
class CDSection;
|
class CDSection;
|
||||||
}
|
} // namespace CDUtils
|
||||||
|
|
||||||
class CDItemModel;
|
class CDItemModel;
|
||||||
class QSortFilterProxyModel;
|
class QSortFilterProxyModel;
|
||||||
|
|
||||||
class CD_QT_EXPORT CDView: public QTreeView, public PIObject
|
class CD_QT_EXPORT CDView
|
||||||
{
|
: public QTreeView
|
||||||
|
, public PIObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
PIOBJECT(CDView);
|
PIOBJECT(CDView);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CDView(QWidget * parent = 0);
|
explicit CDView(QWidget * parent = 0);
|
||||||
~CDView();
|
~CDView();
|
||||||
@@ -50,9 +53,9 @@ public:
|
|||||||
CDItemModel * CDModel() { return model_; }
|
CDItemModel * CDModel() { return model_; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent * );
|
void mousePressEvent(QMouseEvent *) override;
|
||||||
void mouseReleaseEvent(QMouseEvent * );
|
void mouseReleaseEvent(QMouseEvent *) override;
|
||||||
void currentChanged(const QModelIndex & cur, const QModelIndex & prev);
|
void currentChanged(const QModelIndex & cur, const QModelIndex & prev) override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void refresh();
|
void refresh();
|
||||||
@@ -107,7 +110,6 @@ signals:
|
|||||||
void _qcd_receiveSucceed(); // PRIVATE
|
void _qcd_receiveSucceed(); // PRIVATE
|
||||||
void _qcd_receivedX(); // PRIVATE
|
void _qcd_receivedX(); // PRIVATE
|
||||||
void _qcd_changedGlobal(); // PRIVATE
|
void _qcd_changedGlobal(); // PRIVATE
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QCD_VIEW_H
|
#endif // QCD_VIEW_H
|
||||||
|
|||||||
@@ -1,20 +1,22 @@
|
|||||||
#include "cddirectk.h"
|
#include "cddirectk.h"
|
||||||
#include "ui_cddirectk_type_dialog.h"
|
|
||||||
#include "cdutils_core.h"
|
#include "cdutils_core.h"
|
||||||
#include "cdutils_k.h"
|
#include "cdutils_k.h"
|
||||||
#include "qcd_core.h"
|
|
||||||
#include "qcd_model.h"
|
|
||||||
#include "graphic.h"
|
#include "graphic.h"
|
||||||
#include "piqt.h"
|
#include "piqt.h"
|
||||||
|
#include "qcd_core.h"
|
||||||
|
#include "qcd_model.h"
|
||||||
#include "qvariantedit.h"
|
#include "qvariantedit.h"
|
||||||
#include <QFormLayout>
|
#include "ui_cddirectk_type_dialog.h"
|
||||||
#include <QMimeData>
|
|
||||||
|
#include <QDockWidget>
|
||||||
#include <QDragEnterEvent>
|
#include <QDragEnterEvent>
|
||||||
#include <QDragMoveEvent>
|
#include <QDragMoveEvent>
|
||||||
#include <QDropEvent>
|
#include <QDropEvent>
|
||||||
#include <QMainWindow>
|
#include <QFormLayout>
|
||||||
#include <QDockWidget>
|
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include <QMimeData>
|
||||||
|
|
||||||
using namespace CDUtils;
|
using namespace CDUtils;
|
||||||
|
|
||||||
@@ -59,9 +61,7 @@ void KDockWidget::addK(const CDType & t, CDDirectKTypeDialog::TypeInfo ti) {
|
|||||||
|
|
||||||
QByteArray KDockWidget::save() const {
|
QByteArray KDockWidget::save() const {
|
||||||
ChunkStream cs;
|
ChunkStream cs;
|
||||||
cs.add(1, windowTitle())
|
cs.add(1, windowTitle()).add(2, getList(k_list)).add(3, info_list);
|
||||||
.add(2, getList(k_list))
|
|
||||||
.add(3, info_list);
|
|
||||||
return cs.data();
|
return cs.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,21 +186,29 @@ void KDockWidget::removeRow(int r) {
|
|||||||
if (r < 0 || r >= lay->rowCount()) return;
|
if (r < 0 || r >= lay->rowCount()) return;
|
||||||
#if QT_VERSION >= 0x050800
|
#if QT_VERSION >= 0x050800
|
||||||
QFormLayout::TakeRowResult rr = lay->takeRow(r);
|
QFormLayout::TakeRowResult rr = lay->takeRow(r);
|
||||||
if (rr.fieldItem) {delete rr.fieldItem->widget(); delete rr.fieldItem;}
|
if (rr.fieldItem) {
|
||||||
if (rr.labelItem) {delete rr.labelItem->widget(); delete rr.labelItem;}
|
delete rr.fieldItem->widget();
|
||||||
|
delete rr.fieldItem;
|
||||||
|
}
|
||||||
|
if (rr.labelItem) {
|
||||||
|
delete rr.labelItem->widget();
|
||||||
|
delete rr.labelItem;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
piForTimes(2) {
|
piForTimes(2) {
|
||||||
QLayoutItem * i = lay->itemAt(r + r);
|
QLayoutItem * i = lay->itemAt(r + r);
|
||||||
lay->removeItem(i);
|
lay->removeItem(i);
|
||||||
if (i) {delete i->widget(); delete i;}
|
if (i) {
|
||||||
|
delete i->widget();
|
||||||
|
delete i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void KDockWidget::rename() {
|
void KDockWidget::rename() {
|
||||||
QString nn = QInputDialog::getText(this, tr("Rename area"), tr("New area name:"),
|
QString nn = QInputDialog::getText(this, tr("Rename area"), tr("New area name:"), QLineEdit::Normal, windowTitle());
|
||||||
QLineEdit::Normal, windowTitle());
|
|
||||||
if (nn.isEmpty()) return;
|
if (nn.isEmpty()) return;
|
||||||
setWindowTitle(nn);
|
setWindowTitle(nn);
|
||||||
}
|
}
|
||||||
@@ -212,14 +220,11 @@ void KDockWidget::removeK() {
|
|||||||
int ind = a->data().toInt();
|
int ind = a->data().toInt();
|
||||||
if (ind < 0 || ind >= k_list.size_s()) return;
|
if (ind < 0 || ind >= k_list.size_s()) return;
|
||||||
k_list.remove(ind);
|
k_list.remove(ind);
|
||||||
if (ind >= 0 && ind < info_list.size())
|
if (ind >= 0 && ind < info_list.size()) info_list.remove(ind);
|
||||||
info_list.remove(ind);
|
|
||||||
removeRow(ind);
|
removeRow(ind);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CDDirectK::CDDirectK(QWidget * parent): QWidget(parent), Ui::CDDirectK() {
|
CDDirectK::CDDirectK(QWidget * parent): QWidget(parent), Ui::CDDirectK() {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
da = new QMainWindow();
|
da = new QMainWindow();
|
||||||
@@ -229,8 +234,7 @@ CDDirectK::CDDirectK(QWidget * parent) : QWidget(parent), Ui::CDDirectK() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CDDirectK::~CDDirectK() {
|
CDDirectK::~CDDirectK() {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CDDirectK::reset() {
|
void CDDirectK::reset() {
|
||||||
@@ -245,9 +249,7 @@ QByteArray CDDirectK::save() const {
|
|||||||
foreach(KDockWidget * d, docks) {
|
foreach(KDockWidget * d, docks) {
|
||||||
dstates << d->save();
|
dstates << d->save();
|
||||||
}
|
}
|
||||||
cs.add(1, docks.size())
|
cs.add(1, docks.size()).add(2, dstates).add(3, da->saveState());
|
||||||
.add(2, dstates)
|
|
||||||
.add(3, da->saveState());
|
|
||||||
return cs.data();
|
return cs.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,8 +262,7 @@ void CDDirectK::load(QByteArray ba) {
|
|||||||
switch (cs.read()) {
|
switch (cs.read()) {
|
||||||
case 1: {
|
case 1: {
|
||||||
int s = cs.getData<int>();
|
int s = cs.getData<int>();
|
||||||
piForTimes (s)
|
piForTimes(s) addArea();
|
||||||
addArea();
|
|
||||||
} break;
|
} break;
|
||||||
case 2: {
|
case 2: {
|
||||||
QVector<QByteArray> dstates = cs.getData<QVector<QByteArray>>();
|
QVector<QByteArray> dstates = cs.getData<QVector<QByteArray>>();
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
#ifndef CDDIRECTK_H
|
#ifndef CDDIRECTK_H
|
||||||
#define CDDIRECTK_H
|
#define CDDIRECTK_H
|
||||||
|
|
||||||
|
#include "cddirectk_type_dialog.h"
|
||||||
#include "cdgraphics.h"
|
#include "cdgraphics.h"
|
||||||
#include "ui_cddirectk.h"
|
#include "ui_cddirectk.h"
|
||||||
#include "cddirectk_type_dialog.h"
|
|
||||||
|
|
||||||
class QFormLayout;
|
class QFormLayout;
|
||||||
|
|
||||||
|
|
||||||
class KDockWidget: public QDockWidget {
|
class KDockWidget: public QDockWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
KDockWidget(QString title = QString(), QMainWindow * p = 0);
|
KDockWidget(QString title = QString(), QMainWindow * p = 0);
|
||||||
|
|
||||||
@@ -39,15 +40,14 @@ private slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void removeRequest();
|
void removeRequest();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class CDDirectK
|
||||||
|
: public QWidget
|
||||||
class CDDirectK: public QWidget, public Ui::CDDirectK
|
, public Ui::CDDirectK {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CDDirectK(QWidget * parent = 0);
|
explicit CDDirectK(QWidget * parent = 0);
|
||||||
~CDDirectK();
|
~CDDirectK();
|
||||||
@@ -71,7 +71,6 @@ private slots:
|
|||||||
void on_buttonRemoveAll_clicked();
|
void on_buttonRemoveAll_clicked();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CDDIRECTK_H
|
#endif // CDDIRECTK_H
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
#include "cddirectk_type_dialog.h"
|
#include "cddirectk_type_dialog.h"
|
||||||
|
|
||||||
#include "cdutils_core.h"
|
#include "cdutils_core.h"
|
||||||
|
#include "piqt.h"
|
||||||
#include "qcd_core.h"
|
#include "qcd_core.h"
|
||||||
#include "qcd_model.h"
|
#include "qcd_model.h"
|
||||||
#include "piqt.h"
|
|
||||||
#include "spinslider.h"
|
|
||||||
#include "qvariantedit.h"
|
#include "qvariantedit.h"
|
||||||
|
#include "spinslider.h"
|
||||||
|
|
||||||
|
|
||||||
CDDirectKTypeDialog::CDDirectKTypeDialog(QWidget * parent): QDialog(parent), Ui::CDDirectKTypeDialog() {
|
CDDirectKTypeDialog::CDDirectKTypeDialog(QWidget * parent): QDialog(parent), Ui::CDDirectKTypeDialog() {
|
||||||
@@ -12,8 +13,7 @@ CDDirectKTypeDialog::CDDirectKTypeDialog(QWidget * parent) : QDialog(parent), Ui
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CDDirectKTypeDialog::~CDDirectKTypeDialog() {
|
CDDirectKTypeDialog::~CDDirectKTypeDialog() {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CDDirectKTypeDialog::TypeInfo CDDirectKTypeDialog::getType() const {
|
CDDirectKTypeDialog::TypeInfo CDDirectKTypeDialog::getType() const {
|
||||||
@@ -30,8 +30,6 @@ CDDirectKTypeDialog::TypeInfo CDDirectKTypeDialog::getType() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CDDirectKTypeDialog::TypeInfo::TypeInfo(int type_) {
|
CDDirectKTypeDialog::TypeInfo::TypeInfo(int type_) {
|
||||||
type = type_;
|
type = type_;
|
||||||
params_d.resize(4);
|
params_d.resize(4);
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
#ifndef CDDIRECTK_TYPE_DIALOG_H
|
#ifndef CDDIRECTK_TYPE_DIALOG_H
|
||||||
#define CDDIRECTK_TYPE_DIALOG_H
|
#define CDDIRECTK_TYPE_DIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
|
||||||
#include "ui_cddirectk_type_dialog.h"
|
#include "ui_cddirectk_type_dialog.h"
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
class CDDirectKTypeDialog: public QDialog, public Ui::CDDirectKTypeDialog
|
|
||||||
{
|
class CDDirectKTypeDialog
|
||||||
|
: public QDialog
|
||||||
|
, public Ui::CDDirectKTypeDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CDDirectKTypeDialog(QWidget * parent = 0);
|
explicit CDDirectKTypeDialog(QWidget * parent = 0);
|
||||||
~CDDirectKTypeDialog();
|
~CDDirectKTypeDialog();
|
||||||
@@ -23,13 +26,11 @@ public:
|
|||||||
TypeInfo getType() const;
|
TypeInfo getType() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline QDataStream & operator<<(QDataStream & s, const CDDirectKTypeDialog::TypeInfo & v) {
|
inline QDataStream & operator<<(QDataStream & s, const CDDirectKTypeDialog::TypeInfo & v) {
|
||||||
|
|||||||
@@ -2,25 +2,26 @@
|
|||||||
// #include "ui_qcd_graphic.h"
|
// #include "ui_qcd_graphic.h"
|
||||||
#include "cdutils_core.h"
|
#include "cdutils_core.h"
|
||||||
#include "cdutils_x.h"
|
#include "cdutils_x.h"
|
||||||
#include "qcd_core.h"
|
|
||||||
#include "qcd_model.h"
|
|
||||||
#include "qcd_graphic.h"
|
|
||||||
#include "graphic.h"
|
#include "graphic.h"
|
||||||
#include "piqt.h"
|
#include "piqt.h"
|
||||||
#include <QMimeData>
|
#include "qcd_core.h"
|
||||||
|
#include "qcd_graphic.h"
|
||||||
|
#include "qcd_model.h"
|
||||||
|
|
||||||
|
#include <QDockWidget>
|
||||||
#include <QDragEnterEvent>
|
#include <QDragEnterEvent>
|
||||||
#include <QDragMoveEvent>
|
#include <QDragMoveEvent>
|
||||||
#include <QDropEvent>
|
#include <QDropEvent>
|
||||||
#include <QMainWindow>
|
|
||||||
#include <QDockWidget>
|
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include <QMimeData>
|
||||||
|
|
||||||
using namespace CDUtils;
|
using namespace CDUtils;
|
||||||
|
|
||||||
|
|
||||||
QStringList CDUtils::getList(const PIVector<PIDeque<int>> & x_list) {
|
QStringList CDUtils::getList(const PIVector<PIDeque<int>> & x_list) {
|
||||||
QStringList ret;
|
QStringList ret;
|
||||||
piForeachC (PIDeque<int> & p, x_list)
|
for (const auto & p: x_list)
|
||||||
ret << PI2QString(CDCore::pathToString(p));
|
ret << PI2QString(CDCore::pathToString(p));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -28,14 +29,12 @@ QStringList CDUtils::getList(const PIVector<PIDeque<int> > & x_list) {
|
|||||||
|
|
||||||
PIVector<PIDeque<int>> CDUtils::setList(const QStringList & l) {
|
PIVector<PIDeque<int>> CDUtils::setList(const QStringList & l) {
|
||||||
PIVector<PIDeque<int>> ret;
|
PIVector<PIDeque<int>> ret;
|
||||||
foreach (QString s, l)
|
for (const auto & s: l)
|
||||||
ret << CDCore::stringToPath(Q2PIString(s));
|
ret << CDCore::stringToPath(Q2PIString(s));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GDockWidget::GDockWidget(QString title, QMainWindow * p): QDockWidget(title, p) {
|
GDockWidget::GDockWidget(QString title, QMainWindow * p): QDockWidget(title, p) {
|
||||||
da = p;
|
da = p;
|
||||||
menu = new QMenu(this);
|
menu = new QMenu(this);
|
||||||
@@ -188,8 +187,7 @@ CDGraphicWidget * GDockWidget::viewportGraphic(QObject * o) const {
|
|||||||
|
|
||||||
|
|
||||||
void GDockWidget::rename() {
|
void GDockWidget::rename() {
|
||||||
QString nn = QInputDialog::getText(this, tr("Rename area"), tr("New area name:"),
|
QString nn = QInputDialog::getText(this, tr("Rename area"), tr("New area name:"), QLineEdit::Normal, windowTitle());
|
||||||
QLineEdit::Normal, windowTitle());
|
|
||||||
if (nn.isEmpty()) return;
|
if (nn.isEmpty()) return;
|
||||||
setWindowTitle(nn);
|
setWindowTitle(nn);
|
||||||
}
|
}
|
||||||
@@ -205,8 +203,6 @@ void GDockWidget::removeX() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CDGraphics::CDGraphics(QWidget * parent): QWidget(parent), Ui::CDGraphics() {
|
CDGraphics::CDGraphics(QWidget * parent): QWidget(parent), Ui::CDGraphics() {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
da = new QMainWindow();
|
da = new QMainWindow();
|
||||||
@@ -216,8 +212,7 @@ CDGraphics::CDGraphics(QWidget * parent) : QWidget(parent), Ui::CDGraphics() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CDGraphics::~CDGraphics() {
|
CDGraphics::~CDGraphics() {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CDGraphics::reset() {
|
void CDGraphics::reset() {
|
||||||
@@ -232,9 +227,7 @@ QByteArray CDGraphics::save() const {
|
|||||||
foreach(GDockWidget * d, docks) {
|
foreach(GDockWidget * d, docks) {
|
||||||
dstates << d->save();
|
dstates << d->save();
|
||||||
}
|
}
|
||||||
cs.add(1, docks.size())
|
cs.add(1, docks.size()).add(2, dstates).add(3, da->saveState());
|
||||||
.add(2, dstates)
|
|
||||||
.add(3, da->saveState());
|
|
||||||
X.lock();
|
X.lock();
|
||||||
cs.add(4, getList(X.enabledList()));
|
cs.add(4, getList(X.enabledList()));
|
||||||
X.unlock();
|
X.unlock();
|
||||||
@@ -251,8 +244,7 @@ void CDGraphics::load(QByteArray ba) {
|
|||||||
switch (cs.read()) {
|
switch (cs.read()) {
|
||||||
case 1: {
|
case 1: {
|
||||||
int s = cs.getData<int>();
|
int s = cs.getData<int>();
|
||||||
piForTimes (s)
|
piForTimes(s) addGraphic();
|
||||||
addGraphic();
|
|
||||||
} break;
|
} break;
|
||||||
case 2: {
|
case 2: {
|
||||||
QVector<QByteArray> dstates = cs.getData<QVector<QByteArray>>();
|
QVector<QByteArray> dstates = cs.getData<QVector<QByteArray>>();
|
||||||
@@ -265,9 +257,7 @@ void CDGraphics::load(QByteArray ba) {
|
|||||||
X.setEnabledList(setList(cs.getData<QStringList>()));
|
X.setEnabledList(setList(cs.getData<QStringList>()));
|
||||||
X.unlock();
|
X.unlock();
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5: buttonConfigVisible->setChecked(cs.getData<bool>()); break;
|
||||||
buttonConfigVisible->setChecked(cs.getData<bool>());
|
|
||||||
break;
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -277,8 +267,7 @@ void CDGraphics::load(QByteArray ba) {
|
|||||||
GDockWidget * CDGraphics::graphicDock(Graphic * o) const {
|
GDockWidget * CDGraphics::graphicDock(Graphic * o) const {
|
||||||
if (!o) return 0;
|
if (!o) return 0;
|
||||||
foreach(GDockWidget * d, docks)
|
foreach(GDockWidget * d, docks)
|
||||||
if (d->widget() == o)
|
if (d->widget() == o) return d;
|
||||||
return d;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -305,7 +294,7 @@ void CDGraphics::receivedX() {
|
|||||||
X.lock();
|
X.lock();
|
||||||
PIVector<PIDeque<int>> x_list = X.enabledList();
|
PIVector<PIDeque<int>> x_list = X.enabledList();
|
||||||
PIVector<double> ch;
|
PIVector<double> ch;
|
||||||
piForeachC (PIDeque<int> & p, x_list) {
|
for (const auto & p: x_list) {
|
||||||
CDType & t(X[p]);
|
CDType & t(X[p]);
|
||||||
if (t.xmode_rec() == CDType::X_Current)
|
if (t.xmode_rec() == CDType::X_Current)
|
||||||
ch.resize(1).fill(t.toDouble());
|
ch.resize(1).fill(t.toDouble());
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
#ifndef CDGRAPHICS_H
|
#ifndef CDGRAPHICS_H
|
||||||
#define CDGRAPHICS_H
|
#define CDGRAPHICS_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include "qcd_graphic.h"
|
||||||
|
#include "ui_cdgraphics.h"
|
||||||
|
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include "ui_cdgraphics.h"
|
#include <QWidget>
|
||||||
#include "qcd_graphic.h"
|
|
||||||
#include <pistring.h>
|
#include <pistring.h>
|
||||||
|
|
||||||
namespace CDUtils {
|
namespace CDUtils {
|
||||||
@@ -13,16 +14,15 @@ namespace CDUtils {
|
|||||||
class CDSection;
|
class CDSection;
|
||||||
QStringList getList(const PIVector<PIDeque<int>> & x_list);
|
QStringList getList(const PIVector<PIDeque<int>> & x_list);
|
||||||
PIVector<PIDeque<int>> setList(const QStringList & l);
|
PIVector<PIDeque<int>> setList(const QStringList & l);
|
||||||
}
|
} // namespace CDUtils
|
||||||
|
|
||||||
class QMainWindow;
|
class QMainWindow;
|
||||||
class Graphic;
|
class Graphic;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class GDockWidget: public QDockWidget {
|
class GDockWidget: public QDockWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GDockWidget(QString title = QString(), QMainWindow * p = 0);
|
GDockWidget(QString title = QString(), QMainWindow * p = 0);
|
||||||
|
|
||||||
@@ -50,15 +50,14 @@ private slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void removeRequest();
|
void removeRequest();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class CDGraphics
|
||||||
|
: public QWidget
|
||||||
class CDGraphics : public QWidget, public Ui::CDGraphics
|
, public Ui::CDGraphics {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CDGraphics(QWidget * parent = 0);
|
explicit CDGraphics(QWidget * parent = 0);
|
||||||
~CDGraphics();
|
~CDGraphics();
|
||||||
@@ -86,7 +85,6 @@ private slots:
|
|||||||
void on_buttonRemoveAll_clicked();
|
void on_buttonRemoveAll_clicked();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CDGRAPHICS_H
|
#endif // CDGRAPHICS_H
|
||||||
|
|||||||
@@ -130,7 +130,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../../../qad/libs/graphic/qad_graphic.qrc">
|
<iconset resource="../../../qad/libs/graphic/qad_graphic.qrc">
|
||||||
<normaloff>:/icons/border-line.png</normaloff>:/icons/border-line.png</iconset>
|
<normaloff>:/icons/edit-rename.png</normaloff>:/icons/edit-rename.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
|||||||
@@ -1,22 +1,24 @@
|
|||||||
#include "edockwidget.h"
|
|
||||||
#include "cdpultwindow.h"
|
#include "cdpultwindow.h"
|
||||||
|
|
||||||
#include "cdutils_core.h"
|
#include "cdutils_core.h"
|
||||||
#include "cdutils_k.h"
|
#include "cdutils_k.h"
|
||||||
#include "cdutils_x.h"
|
|
||||||
#include "cdutils_m.h"
|
#include "cdutils_m.h"
|
||||||
#include "qcd_core.h"
|
#include "cdutils_x.h"
|
||||||
#include "qcd_view.h"
|
|
||||||
#include "qcd_model.h"
|
|
||||||
#include "qcd_modedialog.h"
|
|
||||||
#include "chunkstream.h"
|
#include "chunkstream.h"
|
||||||
#include "qvariantedit.h"
|
#include "edockwidget.h"
|
||||||
#include "piqt.h"
|
#include "piqt.h"
|
||||||
#include "piqt_highlighter.h"
|
#include "piqt_highlighter.h"
|
||||||
|
#include "qcd_core.h"
|
||||||
|
#include "qcd_modedialog.h"
|
||||||
|
#include "qcd_model.h"
|
||||||
|
#include "qcd_view.h"
|
||||||
#include "qcodeedit.h"
|
#include "qcodeedit.h"
|
||||||
|
#include "qvariantedit.h"
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QScrollBar>
|
|
||||||
#include <QImageReader>
|
#include <QImageReader>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QScrollBar>
|
||||||
|
|
||||||
using namespace CDUtils;
|
using namespace CDUtils;
|
||||||
|
|
||||||
@@ -59,13 +61,11 @@ CDPultWindow::CDPultWindow(QWidget *parent) : EMainWindow(parent), Ui::CDPultWin
|
|||||||
QCDCore::instance()->bindWidget(widgetK->view);
|
QCDCore::instance()->bindWidget(widgetK->view);
|
||||||
QCDCore::instance()->setDirectKEnabled(true);
|
QCDCore::instance()->setDirectKEnabled(true);
|
||||||
X.start();
|
X.start();
|
||||||
if (windowState() == Qt::WindowMinimized)
|
if (windowState() == Qt::WindowMinimized) setWindowState(Qt::WindowNoState);
|
||||||
setWindowState(Qt::WindowNoState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CDPultWindow::~CDPultWindow() {
|
CDPultWindow::~CDPultWindow() {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CDPultWindow::loadFile(const QString & fp) {
|
void CDPultWindow::loadFile(const QString & fp) {
|
||||||
@@ -87,12 +87,11 @@ void CDPultWindow::apply(bool sessions) {
|
|||||||
if (sessions) {
|
if (sessions) {
|
||||||
widgetGraphics->load(session_gr);
|
widgetGraphics->load(session_gr);
|
||||||
widgetDirectK->load(session_dk);
|
widgetDirectK->load(session_dk);
|
||||||
if (!session_mw.isEmpty())
|
if (!session_mw.isEmpty()) restoreState(session_mw);
|
||||||
restoreState(session_mw);
|
|
||||||
X.lock();
|
X.lock();
|
||||||
PIVector<PIDeque<int>> x_list = X.enabledList();
|
PIVector<PIDeque<int>> x_list = X.enabledList();
|
||||||
X.unlock();
|
X.unlock();
|
||||||
piForeachC (PIDeque<int> & p, x_list)
|
for (const auto & p: x_list)
|
||||||
X.enable(X[p]);
|
X.enable(X[p]);
|
||||||
((CDItemModel *)widgetX->view->model())->updateModel();
|
((CDItemModel *)widgetX->view->model())->updateModel();
|
||||||
widgetX->view->expandAll();
|
widgetX->view->expandAll();
|
||||||
@@ -107,8 +106,7 @@ void CDPultWindow::apply(bool sessions) {
|
|||||||
|
|
||||||
void CDPultWindow::closeEvent(QCloseEvent * e) {
|
void CDPultWindow::closeEvent(QCloseEvent * e) {
|
||||||
EMainWindow::closeEvent(e);
|
EMainWindow::closeEvent(e);
|
||||||
if (!e->isAccepted())
|
if (!e->isAccepted()) return;
|
||||||
return;
|
|
||||||
QApplication::closeAllWindows();
|
QApplication::closeAllWindows();
|
||||||
session.save();
|
session.save();
|
||||||
session.setFile(QString());
|
session.setFile(QString());
|
||||||
@@ -141,8 +139,7 @@ bool CDPultWindow::load(const QString & path) {
|
|||||||
checkHasM->setChecked(conf.getValue("has_m").toBool());
|
checkHasM->setChecked(conf.getValue("has_m").toBool());
|
||||||
checkDefaultConfig->setChecked(conf.getValue("default_config").toBool());
|
checkDefaultConfig->setChecked(conf.getValue("default_config").toBool());
|
||||||
codeConfig->setText(QByteArray2QString(conf.getValue("config").toByteArray()));
|
codeConfig->setText(QByteArray2QString(conf.getValue("config").toByteArray()));
|
||||||
if (codeConfig->text().isEmpty())
|
if (codeConfig->text().isEmpty()) codeConfig->setText(def_config);
|
||||||
codeConfig->setText(def_config);
|
|
||||||
session_gr = conf.getValue("session_gr").toByteArray();
|
session_gr = conf.getValue("session_gr").toByteArray();
|
||||||
session_dk = conf.getValue("session_dk").toByteArray();
|
session_dk = conf.getValue("session_dk").toByteArray();
|
||||||
session_mw = conf.getValue("session_mw").toByteArray();
|
session_mw = conf.getValue("session_mw").toByteArray();
|
||||||
@@ -231,8 +228,7 @@ void CDPultWindow::messageReceived(QString path, int type, QString msg) {
|
|||||||
MessageType mt = (MessageType)type;
|
MessageType mt = (MessageType)type;
|
||||||
const CDType & t(M.root()[CDCore::stringToPath(Q2PIString(path))]);
|
const CDType & t(M.root()[CDCore::stringToPath(Q2PIString(path))]);
|
||||||
if (t.cd_type() != CDType::cdM) return;
|
if (t.cd_type() != CDType::cdM) return;
|
||||||
if (mt == MessageBox)
|
if (mt == MessageBox) QMessageBox::information(this, windowTitle(), QString("[%1]\n%2").arg(PI2QString(t.name()), msg));
|
||||||
QMessageBox::information(this, windowTitle(), QString("[%1]\n%2").arg(PI2QString(t.name()), msg));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -262,13 +258,15 @@ void CDPultWindow::on_editFileK_valueChanged(const QVariant & p) {
|
|||||||
}
|
}
|
||||||
if (!fi.path().isEmpty() && fi.path() != ".") {
|
if (!fi.path().isEmpty() && fi.path() != ".") {
|
||||||
dir = fi.path();
|
dir = fi.path();
|
||||||
if (!dir.endsWith("/"))
|
if (!dir.endsWith("/")) dir += "/";
|
||||||
dir += "/";
|
|
||||||
}
|
}
|
||||||
QAD::File f = editFileK->value().value<QAD::File>();
|
QAD::File f = editFileK->value().value<QAD::File>();
|
||||||
f.file = dir + xn + dot + ext; editFileX->setValue(QVariant::fromValue(f));
|
f.file = dir + xn + dot + ext;
|
||||||
f.file = dir + cn + dot + ext; editFileC->setValue(QVariant::fromValue(f));
|
editFileX->setValue(QVariant::fromValue(f));
|
||||||
f.file = dir + mn + dot + ext; editFileM->setValue(QVariant::fromValue(f));
|
f.file = dir + cn + dot + ext;
|
||||||
|
editFileC->setValue(QVariant::fromValue(f));
|
||||||
|
f.file = dir + mn + dot + ext;
|
||||||
|
editFileM->setValue(QVariant::fromValue(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -284,7 +282,9 @@ void CDPultWindow::on_lineSessionName_textChanged(const QString & t) {
|
|||||||
|
|
||||||
void CDPultWindow::on_buttonIcon_clicked() {
|
void CDPultWindow::on_buttonIcon_clicked() {
|
||||||
QList<QByteArray> ifl = QImageReader::supportedImageFormats();
|
QList<QByteArray> ifl = QImageReader::supportedImageFormats();
|
||||||
QStringList sfl; foreach (QByteArray s, ifl) sfl << ("*." + QString(s).toLower());
|
QStringList sfl;
|
||||||
|
foreach(QByteArray s, ifl)
|
||||||
|
sfl << ("*." + QString(s).toLower());
|
||||||
QString f = QFileDialog::getOpenFileName(this, tr("Select icon"), last_icon, tr("Images") + " (" + sfl.join(" ") + ")");
|
QString f = QFileDialog::getOpenFileName(this, tr("Select icon"), last_icon, tr("Images") + " (" + sfl.join(" ") + ")");
|
||||||
if (f.isEmpty()) return;
|
if (f.isEmpty()) return;
|
||||||
last_icon = f;
|
last_icon = f;
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
#ifndef CDPULTWINDOW_H
|
#ifndef CDPULTWINDOW_H
|
||||||
#define CDPULTWINDOW_H
|
#define CDPULTWINDOW_H
|
||||||
|
|
||||||
#include "emainwindow.h"
|
|
||||||
#include "ui_cdpultwindow.h"
|
|
||||||
#include "cdviewwidget.h"
|
#include "cdviewwidget.h"
|
||||||
#include "ribbon.h"
|
#include "emainwindow.h"
|
||||||
#include "piobject.h"
|
#include "piobject.h"
|
||||||
|
#include "ribbon.h"
|
||||||
|
#include "ui_cdpultwindow.h"
|
||||||
|
|
||||||
|
|
||||||
class CDPultWindow : public EMainWindow, public Ui::CDPultWindow
|
class CDPultWindow
|
||||||
{
|
: public EMainWindow
|
||||||
|
, public Ui::CDPultWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_ENUMS(LogIcon)
|
Q_ENUMS(LogIcon)
|
||||||
public:
|
|
||||||
|
|
||||||
|
public:
|
||||||
explicit CDPultWindow(QWidget * parent = 0);
|
explicit CDPultWindow(QWidget * parent = 0);
|
||||||
~CDPultWindow();
|
~CDPultWindow();
|
||||||
void loadFile(const QString & fp);
|
void loadFile(const QString & fp);
|
||||||
void apply(bool sessions);
|
void apply(bool sessions);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void closeEvent(QCloseEvent *);
|
void closeEvent(QCloseEvent *);
|
||||||
void reset(bool full = false);
|
void reset(bool full = false);
|
||||||
bool load(const QString & path);
|
bool load(const QString & path);
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
#include "cdviewwidget.h"
|
#include "cdviewwidget.h"
|
||||||
|
|
||||||
#include "cdutils_core.h"
|
#include "cdutils_core.h"
|
||||||
#include "qcd_core.h"
|
#include "qcd_core.h"
|
||||||
#include "qcd_model.h"
|
|
||||||
#include "qcd_modedialog.h"
|
#include "qcd_modedialog.h"
|
||||||
|
#include "qcd_model.h"
|
||||||
#include "qvariantedit.h"
|
#include "qvariantedit.h"
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
|
||||||
|
|
||||||
@@ -17,8 +19,7 @@ CDViewWidget::CDViewWidget(QWidget * parent) : QWidget(parent), Ui::CDViewWidget
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CDViewWidget::~CDViewWidget() {
|
CDViewWidget::~CDViewWidget() {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CDViewWidget::reset() {
|
void CDViewWidget::reset() {
|
||||||
@@ -41,14 +42,20 @@ void CDViewWidget::setFile(const QString & f) {
|
|||||||
|
|
||||||
|
|
||||||
void CDViewWidget::on_buttonSend_clicked() {
|
void CDViewWidget::on_buttonSend_clicked() {
|
||||||
if (view->inProgress()) {addToLog(WaitIcon, "processing..."); return;}
|
if (view->inProgress()) {
|
||||||
|
addToLog(WaitIcon, "processing...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
addToLog(WaitIcon, "Sending " + tl_u + "...");
|
addToLog(WaitIcon, "Sending " + tl_u + "...");
|
||||||
view->send();
|
view->send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDViewWidget::on_buttonReceive_clicked() {
|
void CDViewWidget::on_buttonReceive_clicked() {
|
||||||
if (view->inProgress()) {addToLog(WaitIcon, "processing..."); return;}
|
if (view->inProgress()) {
|
||||||
|
addToLog(WaitIcon, "processing...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
addToLog(WaitIcon, "Receiving " + tl_u + "...");
|
addToLog(WaitIcon, "Receiving " + tl_u + "...");
|
||||||
view->receive();
|
view->receive();
|
||||||
}
|
}
|
||||||
@@ -65,7 +72,9 @@ void CDViewWidget::on_buttonSave_clicked() {
|
|||||||
|
|
||||||
|
|
||||||
void CDViewWidget::on_buttonParse_clicked() {
|
void CDViewWidget::on_buttonParse_clicked() {
|
||||||
QString path = QFileDialog::getOpenFileName(this, "Select header file", "",
|
QString path = QFileDialog::getOpenFileName(this,
|
||||||
|
"Select header file",
|
||||||
|
"",
|
||||||
QString("%1 Description(%2_description.h);;Headers(*.h)").arg(tl_u, tl_l));
|
QString("%1 Description(%2_description.h);;Headers(*.h)").arg(tl_u, tl_l));
|
||||||
if (path.isEmpty()) return;
|
if (path.isEmpty()) return;
|
||||||
CDUtils::UpdateModeFlags mode = CDUtils::SaveByName;
|
CDUtils::UpdateModeFlags mode = CDUtils::SaveByName;
|
||||||
|
|||||||
@@ -1,18 +1,26 @@
|
|||||||
#ifndef CDVIEWWIDGET_H
|
#ifndef CDVIEWWIDGET_H
|
||||||
#define CDVIEWWIDGET_H
|
#define CDVIEWWIDGET_H
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include "ui_cdviewwidget.h"
|
#include "ui_cdviewwidget.h"
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
class CDViewWidget : public QWidget, public Ui::CDViewWidget
|
|
||||||
{
|
class CDViewWidget
|
||||||
|
: public QWidget
|
||||||
|
, public Ui::CDViewWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CDViewWidget(QWidget * parent = 0);
|
explicit CDViewWidget(QWidget * parent = 0);
|
||||||
~CDViewWidget();
|
~CDViewWidget();
|
||||||
|
|
||||||
enum LogIcon {NoIcon, OKIcon, FailIcon, WaitIcon};
|
enum LogIcon {
|
||||||
|
NoIcon,
|
||||||
|
OKIcon,
|
||||||
|
FailIcon,
|
||||||
|
WaitIcon
|
||||||
|
};
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
void setType(int t);
|
void setType(int t);
|
||||||
@@ -35,7 +43,6 @@ private slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void addToLog(CDViewWidget::LogIcon icon, const QString & msg);
|
void addToLog(CDViewWidget::LogIcon icon, const QString & msg);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CDVIEWWIDGET_H
|
#endif // CDVIEWWIDGET_H
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#include <QApplication>
|
|
||||||
#include "cdpultwindow.h"
|
#include "cdpultwindow.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
int main(int argc, char * argv[]) {
|
int main(int argc, char * argv[]) {
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
enableHighDPI();
|
enableHighDPI();
|
||||||
CDPultWindow w;
|
CDPultWindow w;
|
||||||
w.show();
|
w.show();
|
||||||
if (a.arguments().size() > 1)
|
if (a.arguments().size() > 1) w.loadFile(a.arguments()[1]);
|
||||||
w.loadFile(a.arguments()[1]);
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user