Compare commits

...

4 Commits

14 changed files with 148 additions and 170 deletions

2
3rdparty/RibbonUI vendored

@ -1 +1 @@
Subproject commit 79a17c3fb191dfa10a8822d61e907daef7630dcf Subproject commit edeee77c443075ffb80a7e981a822718b47c2c7f

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleName</key>
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
<key>CFBundleExecutable</key>
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
<key>CFBundleVersion</key>
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
<key>CFBundleShortVersionString</key>
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
<key>LSMinimumSystemVersion</key>
<string>${CMAKE_OSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key>
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
<key>CFBundleIconFile</key>
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
<key>CFBundleDevelopmentRegion</key>
<string>${MACOSX_BUNDLE_DEVELOPMENT_REGION}</string>
<key>CFBundleAllowMixedLocalizations</key>
<true/>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,37 @@
#include <windows.h>
IDI_ICON1 ICON "${PROJECT_SOURCE_DIR}/resources/imgs/icon.ico"
VS_VERSION_INFO VERSIONINFO
FILEVERSION ${version_str}
PRODUCTVERSION ${version_str}
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "Made by Mentalflow."
VALUE "CompanyName", "${PROJECT_COMPANY}"
VALUE "FileDescription", "${PROJECT_COPYRIGHT}"
VALUE "FileVersion", "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}"
VALUE "InternalName", "${PROJECT_BUNDLE_NAME}.exe"
VALUE "LegalCopyright", "${PROJECT_COPYRIGHT}"
VALUE "OriginalFilename", "${PROJECT_BUNDLE_NAME}.exe"
VALUE "ProductName", "${PROJECT_BUNDLE_NAME}"
VALUE "ProductVersion", "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

View File

@ -20,8 +20,9 @@ endif()
set(QML_IMPORT_PATH ${CMAKE_BINARY_DIR}/app_source CACHE STRING "Qt Creator extra QML import paths" FORCE) set(QML_IMPORT_PATH ${CMAKE_BINARY_DIR}/app_source CACHE STRING "Qt Creator extra QML import paths" FORCE)
string(TIMESTAMP TIME_YEAR %Y)
set(PROJECT_COMPANY "Mentalflow's Lab") set(PROJECT_COMPANY "Mentalflow's Lab")
set(PROJECT_COPYRIGHT "Copyright (c) 2023 Mentalflow's Lab. All rights reserved.") set(PROJECT_COPYRIGHT "Copyright (c) ${TIME_YEAR} Mentalflow's Lab. All rights reserved.")
set(PROJECT_DOMAIN "dev.ourdocs.cn.protocolparser") set(PROJECT_DOMAIN "dev.ourdocs.cn.protocolparser")
set(PROJECT_BUNDLE_NAME ${PROJECT_NAME}) set(PROJECT_BUNDLE_NAME ${PROJECT_NAME})
set(version_str "${CMAKE_PROJECT_VERSION_MAJOR},${CMAKE_PROJECT_VERSION_MINOR},${CMAKE_PROJECT_VERSION_PATCH}") set(version_str "${CMAKE_PROJECT_VERSION_MAJOR},${CMAKE_PROJECT_VERSION_MINOR},${CMAKE_PROJECT_VERSION_PATCH}")
@ -48,7 +49,7 @@ set(
qml/components/ZigBeeDataView.qml qml/components/TabBar.qml qml/components/CenterView.qml qml/components/ZigBeeDataView.qml qml/components/TabBar.qml qml/components/CenterView.qml
qml/components/ListTable.qml qml/components/DeviceList.qml qml/components/KeysList.qml qml/components/ListTable.qml qml/components/DeviceList.qml qml/components/KeysList.qml
qml/components/EventsHistoryList.qml qml/components/FrameChooser.qml qml/components/RibbonMarkDownViewer.qml qml/components/EventsHistoryList.qml qml/components/FrameChooser.qml qml/components/RibbonMarkDownViewer.qml
qml/components/HelpView.qml qml/HelperWindow.qml
) )
set(js_files js/markdown-it.js js/markdown-it-deflist.js js/markdown-it-emoji.js set(js_files js/markdown-it.js js/markdown-it-deflist.js js/markdown-it-emoji.js
@ -63,7 +64,7 @@ set(doc_files ${CMAKE_SOURCE_DIR}/README.md ${CMAKE_SOURCE_DIR}/documents/protoc
${CMAKE_SOURCE_DIR}/documents/pictures/home-light.png ${CMAKE_SOURCE_DIR}/app_source/resources/imgs/icon.png ${CMAKE_SOURCE_DIR}/documents/pictures/home-light.png ${CMAKE_SOURCE_DIR}/app_source/resources/imgs/icon.png
) )
INCLUDE_DIRECTORIES(dlln3x include) include_directories(dlln3x include)
add_subdirectory(sm_crypto) add_subdirectory(sm_crypto)
if(CMAKE_BUILD_TYPE STREQUAL "Debug") if(CMAKE_BUILD_TYPE STREQUAL "Debug")
@ -73,16 +74,17 @@ else()
endif() endif()
if (WIN32) if (WIN32)
set(app_icon_resource_windows resources/icon.rc) configure_file(.cmake/win_app.rc.in ${CMAKE_BINARY_DIR}/win_app.rc)
set(app_icon_resource_windows ${CMAKE_BINARY_DIR}/win_app.rc)
qt_add_executable(${PROJECT_NAME} qt_add_executable(${PROJECT_NAME}
${sources_files} ${sources_files}
resources/icon.rc ${app_icon_resource_windows}
) )
file(TO_CMAKE_PATH "/" PATH_SEPARATOR) file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(DLLPATH ../3rdparty/msvc/*.dll) set(DLLPATH ${CMAKE_SOURCE_DIR}/3rdparty/msvc/*.dll)
else() else()
set(DLLPATH ../3rdparty/mingw/*.dll) set(DLLPATH ${CMAKE_SOURCE_DIR}/3rdparty/mingw/*.dll)
endif() endif()
string(REPLACE "/" ${PATH_SEPARATOR} DLLPATH "${DLLPATH}") string(REPLACE "/" ${PATH_SEPARATOR} DLLPATH "${DLLPATH}")
file(GLOB DLL_FILES ${DLLPATH}) file(GLOB DLL_FILES ${DLLPATH})
@ -92,8 +94,17 @@ add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
) )
elseif(APPLE) elseif(APPLE)
set(MACOSX_BUNDLE_GUI_IDENTIFIER ${PROJECT_DOMAIN})
set(MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION})
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
set(MACOSX_BUNDLE_BUNDLE_NAME ${PROJECT_BUNDLE_NAME})
set(MACOSX_BUNDLE_COPYRIGHT ${PROJECT_COPYRIGHT})
set(MACOSX_BUNDLE_DEVELOPMENT_REGION "Chinese")
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "Minimum OS X deployment version" FORCE)
set(MACOSX_BUNDLE_EXECUTABLE_NAME ${PROJECT_BUNDLE_NAME})
set(MACOSX_BUNDLE_ICON_FILE AppIcon) set(MACOSX_BUNDLE_ICON_FILE AppIcon)
set(App_ICON "resources/imgs/AppIcon.icns") configure_file(.cmake/MacOSXBundleInfo.plist.in ${CMAKE_BINARY_DIR}/Info.plist)
set(App_ICON "${PROJECT_SOURCE_DIR}/resources/imgs/AppIcon.icns")
set_source_files_properties(${App_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") set_source_files_properties(${App_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
qt_add_executable(${PROJECT_NAME} qt_add_executable(${PROJECT_NAME}
${sources_files} ${sources_files}
@ -130,11 +141,7 @@ qt_add_qml_module(${PROJECT_NAME}
) )
set_target_properties(${PROJECT_NAME} PROPERTIES set_target_properties(${PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER ${PROJECT_DOMAIN} MACOSX_BUNDLE_INFO_PLIST ${CMAKE_BINARY_DIR}/Info.plist
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE_BUNDLE_NAME ${PROJECT_BUNDLE_NAME}
MACOSX_BUNDLE_COPYRIGHT ${PROJECT_COPYRIGHT}
MACOSX_BUNDLE TRUE MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE WIN32_EXECUTABLE TRUE
OUTPUT_NAME ${PROJECT_BUNDLE_NAME} OUTPUT_NAME ${PROJECT_BUNDLE_NAME}
@ -180,8 +187,6 @@ target_link_libraries(${PROJECT_NAME} PRIVATE
Qt::Core5Compat Qt::Core5Compat
RibbonUI RibbonUI
sm_crypto sm_crypto
FramelessHelper::Core
FramelessHelper::Quick
) )
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}_lupdate) add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}_lupdate)

View File

@ -5,37 +5,25 @@ import RibbonUI
import ProtocolParser import ProtocolParser
import "." import "."
Item { RibbonWindow {
id: root id: root
implicitHeight: 550 height: 550
implicitWidth: 550 width: 550
property string title: qsTr("帮助") flags: Qt.Window
title_bar.show_darkmode_btn: false
title_bar.show_style_switch: false
title: qsTr("帮助")
Component.onCompleted: Tools.writeDirtoTempDir(":/qt/qml/ProtocolParser/") Component.onCompleted: Tools.writeDirtoTempDir(":/qt/qml/ProtocolParser/")
RibbonButton{
anchors{
top:parent.top
margins: 4
right:parent.right
}
show_bg: false
show_hovered_bg: false
icon_source: RibbonIcons.Dismiss
onClicked: popup.close()
}
RibbonText{
anchors{
top:parent.top
topMargin: 10
horizontalCenter: parent.horizontalCenter
}
text: title
}
RibbonMarkDownViewer{ RibbonMarkDownViewer{
id: viewer id: viewer
anchors.fill: parent anchors.fill: parent
anchors{
topMargin: 10
leftMargin: anchors.topMargin
rightMargin: anchors.topMargin
bottomMargin: viewer.can_goback || viewer.can_goforward ? 30 : 10
}
file_name: 'qrc:/qt/qml/ProtocolParser/README.md' file_name: 'qrc:/qt/qml/ProtocolParser/README.md'
base_url: 'qrc:/qt/qml/ProtocolParser/' base_url: 'qrc:/qt/qml/ProtocolParser/'
resource_dir: Tools.baseDir resource_dir: Tools.baseDir
@ -43,10 +31,11 @@ Item {
RibbonButton{ RibbonButton{
anchors{ anchors{
bottom: root.bottom topMargin: 5
bottomMargin: 10 bottom: parent.bottom
left: root.left bottomMargin: 5
leftMargin: 30 left: parent.left
leftMargin: viewer.anchors.leftMargin
} }
show_bg: false show_bg: false
show_hovered_bg: false show_hovered_bg: false
@ -59,10 +48,11 @@ Item {
RibbonButton{ RibbonButton{
anchors{ anchors{
bottom: root.bottom topMargin: 5
bottomMargin: 10 bottom: parent.bottom
right: root.right bottomMargin: 5
rightMargin: 30 right: parent.right
rightMargin: viewer.anchors.rightMargin
} }
show_bg: false show_bg: false
show_hovered_bg: false show_hovered_bg: false

View File

@ -12,6 +12,7 @@ RibbonWindow {
minimumWidth: 1200 minimumWidth: 1200
height: 800 height: 800
minimumHeight: 800 minimumHeight: 800
comfirmed_quit: true
title: qsTr("Protocol Parser") + ` V${PPAPP_Version}` title: qsTr("Protocol Parser") + ` V${PPAPP_Version}`
title_bar.right_content:RowLayout{ title_bar.right_content:RowLayout{
@ -27,10 +28,9 @@ RibbonWindow {
text_color: title_bar.title_text_color text_color: title_bar.title_text_color
text_color_reverse: false text_color_reverse: false
onClicked: { onClicked: {
show_popup("qrc:/qt/qml/ProtocolParser/components/HelpView.qml") root.show_window("qrc:/qt/qml/ProtocolParser/HelperWindow.qml")
} }
} }
} }
CenterView{ CenterView{

View File

@ -86,18 +86,6 @@ Item{
} }
} }
RibbonButton{
anchors{
top:parent.top
margins: 4
right:parent.right
}
show_bg: false
show_hovered_bg: false
icon_source: RibbonIcons.Dismiss
onClicked: popup.close()
}
ColumnLayout{ ColumnLayout{
id:list_layout id:list_layout
anchors{ anchors{

View File

@ -38,18 +38,6 @@ Item {
} }
} }
RibbonButton{
anchors{
top:parent.top
margins: 4
right:parent.right
}
show_bg: false
show_hovered_bg: false
icon_source: RibbonIcons.Dismiss
onClicked: popup.close()
}
ColumnLayout{ ColumnLayout{
id:list_layout id:list_layout
anchors{ anchors{

View File

@ -61,18 +61,6 @@ Item {
} }
} }
RibbonButton{
anchors{
top:parent.top
margins: 4
right:parent.right
}
show_bg: false
show_hovered_bg: false
icon_source: RibbonIcons.Dismiss
onClicked: popup.close()
}
ColumnLayout{ ColumnLayout{
id:layout id:layout
anchors{ anchors{

View File

@ -38,18 +38,6 @@ Item {
} }
} }
RibbonButton{
anchors{
top:parent.top
margins: 4
right:parent.right
}
show_bg: false
show_hovered_bg: false
icon_source: RibbonIcons.Dismiss
onClicked: popup.close()
}
ColumnLayout{ ColumnLayout{
id:list_layout id:list_layout
anchors{ anchors{

View File

@ -27,13 +27,7 @@ Item {
WebView{ WebView{
id: viewer id: viewer
anchors{ anchors.fill: parent
top: parent.top
left: parent.left
margins: 30
}
width: parent.width
height: parent.height
settings.allowFileAccess: true settings.allowFileAccess: true
settings.localStorageEnabled: true settings.localStorageEnabled: true
settings.javaScriptEnabled: true settings.javaScriptEnabled: true
@ -54,8 +48,6 @@ Item {
} }
else if (request.status === WebView.LoadSucceededStatus) else if (request.status === WebView.LoadSucceededStatus)
{ {
viewer.width = parent.width - (anchors.margins * 2)
viewer.height = parent.height - (anchors.margins * 2)
viewer.runJavaScript(`document.body.scrollTop = ${viewer.pre_height};`) viewer.runJavaScript(`document.body.scrollTop = ${viewer.pre_height};`)
get_height() get_height()
} }

View File

@ -242,7 +242,7 @@ RibbonTabBar {
text: qsTr("等待队列") text: qsTr("等待队列")
show_tooltip: false show_tooltip: false
onClicked: { onClicked: {
show_popup("qrc:/qt/qml/ProtocolParser/components/DeviceList.qml",{list_type:0}) Window.window.popup.show_content("qrc:/qt/qml/ProtocolParser/components/DeviceList.qml",{list_type:0})
} }
} }
RibbonButton{ RibbonButton{
@ -251,7 +251,7 @@ RibbonTabBar {
text: qsTr("认证列表") text: qsTr("认证列表")
show_tooltip: false show_tooltip: false
onClicked: { onClicked: {
show_popup("qrc:/qt/qml/ProtocolParser/components/DeviceList.qml",{list_type:1}) Window.window.popup.show_content("qrc:/qt/qml/ProtocolParser/components/DeviceList.qml",{list_type:1})
} }
} }
RibbonButton{ RibbonButton{
@ -260,7 +260,7 @@ RibbonTabBar {
text: qsTr("黑名单列表") text: qsTr("黑名单列表")
show_tooltip: false show_tooltip: false
onClicked: { onClicked: {
show_popup("qrc:/qt/qml/ProtocolParser/components/DeviceList.qml",{list_type:2}) Window.window.popup.show_content("qrc:/qt/qml/ProtocolParser/components/DeviceList.qml",{list_type:2})
} }
} }
} }
@ -321,7 +321,7 @@ RibbonTabBar {
text: qsTr("历史密钥列表") text: qsTr("历史密钥列表")
show_tooltip: false show_tooltip: false
onClicked: { onClicked: {
show_popup("qrc:/qt/qml/ProtocolParser/components/KeysList.qml") Window.window.popup.show_content("qrc:/qt/qml/ProtocolParser/components/KeysList.qml")
} }
} }
function key_format_validate(str) { function key_format_validate(str) {
@ -393,7 +393,7 @@ RibbonTabBar {
text: qsTr("事件历史信息") text: qsTr("事件历史信息")
tip_text: qsTr("查看所有事件历史信息(包含调试信息)") tip_text: qsTr("查看所有事件历史信息(包含调试信息)")
onClicked: { onClicked: {
show_popup("qrc:/qt/qml/ProtocolParser/components/EventsHistoryList.qml") Window.window.popup.show_content("qrc:/qt/qml/ProtocolParser/components/EventsHistoryList.qml")
} }
} }
} }
@ -474,7 +474,7 @@ RibbonTabBar {
text: qsTr("自定义数据帧") text: qsTr("自定义数据帧")
tip_text: qsTr("自定义传感器数据帧结构") tip_text: qsTr("自定义传感器数据帧结构")
onClicked: { onClicked: {
show_popup("qrc:/qt/qml/ProtocolParser/components/FrameChooser.qml") Window.window.popup.show_content("qrc:/qt/qml/ProtocolParser/components/FrameChooser.qml")
} }
} }
} }

View File

@ -1,42 +0,0 @@
#include <windows.h>
IDI_ICON1 ICON "imgs/icon.ico"
#define STR(x) #x
#define VER_JOIN(a,b,c) STR(a.b.c)
#define VER_JOIN_(x) VER_JOIN x
#define VER_STR VER_JOIN_((PROTOCOLPARSER_VERSION))
VS_VERSION_INFO VERSIONINFO
FILEVERSION PROTOCOLPARSER_VERSION
PRODUCTVERSION PROTOCOLPARSER_VERSION
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "Made by Mentalflow."
VALUE "CompanyName", "Mentalflow"
VALUE "FileDescription", "Protocol Parser"
VALUE "FileVersion", VER_STR
VALUE "InternalName", ""
VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "OriginalFilename", ""
VALUE "ProductName", "Protocol Parser"
VALUE "ProductVersion", VER_STR
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

View File

@ -11,9 +11,8 @@ Q_IMPORT_QML_PLUGIN(RibbonUIPlugin)
#endif #endif
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
RibbonUI::init();
QtWebView::initialize(); QtWebView::initialize();
FramelessHelper::Quick::initialize(); RibbonUI::init();
QGuiApplication app(argc, argv); QGuiApplication app(argc, argv);
QTranslator translator; QTranslator translator;
bool result = translator.load(QLocale::system(), u""_qs, u""_qs, u":/translations"_qs); bool result = translator.load(QLocale::system(), u""_qs, u""_qs, u":/translations"_qs);