Compare commits

...

12 Commits
v1.0.4 ... main

28 changed files with 200 additions and 460 deletions

View File

@ -57,7 +57,7 @@ jobs:
# 拷贝依赖
sudo macdeployqt /Users/runner/work/ProtocolParser/ProtocolParser/build/app/release/${targetName}.app -qmldir=. -verbose=1 -dmg
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: ${{ env.targetName }}_${{ matrix.os }}_${{matrix.qt_ver}}_shared.zip
path: /Users/runner/work/ProtocolParser/ProtocolParser/build/app/release/${{ env.targetName }}.dmg

View File

@ -57,7 +57,7 @@ jobs:
# 拷贝依赖
macdeployqt /Users/runner/work/ProtocolParser/ProtocolParser/build/app/release/${targetName}.app -qmldir=. -verbose=1 -dmg
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: ${{ env.targetName }}_${{ matrix.os }}_${{matrix.qt_ver}}_static.zip
path: /Users/runner/work/ProtocolParser/ProtocolParser/build/app/release/${{ env.targetName }}.dmg

View File

@ -74,7 +74,7 @@ jobs:
linuxdeploy-x86_64.AppImage --plugin=qt --output=appimage --create-desktop-file --icon-file=${targetName}.svg --executable=/home/runner/work/ProtocolParser/ProtocolParser/build/app/release/${targetName} --appdir /home/runner/work/ProtocolParser/ProtocolParser/build/app/release/
mv ${{ env.targetName }}-*.AppImage ${{ env.targetName }}_${{ matrix.os }}_${{matrix.qt_ver}}_shared.AppImage
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: ${{ env.targetName }}_${{ matrix.os }}_${{matrix.qt_ver}}_shared
path: ${{ env.targetName }}_${{ matrix.os }}_${{matrix.qt_ver}}_shared.AppImage

View File

@ -74,7 +74,7 @@ jobs:
linuxdeploy-x86_64.AppImage --plugin=qt --output=appimage --create-desktop-file --icon-file=${targetName}.svg --executable=/home/runner/work/ProtocolParser/ProtocolParser/build/app/release/${targetName} --appdir /home/runner/work/ProtocolParser/ProtocolParser/build/app/release/
mv ${{ env.targetName }}-*.AppImage ${{ env.targetName }}_${{ matrix.os }}_Qt${{ matrix.qt_ver }}_static.AppImage
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: ${{ env.targetName }}_${{ matrix.os }}_Qt${{ matrix.qt_ver }}_static
path: ${{ env.targetName }}_${{ matrix.os }}_Qt${{ matrix.qt_ver }}_static.AppImage

View File

@ -74,7 +74,7 @@ jobs:
$name = ${env:archiveName}
echo "packageName=$name" >> $env:GITHUB_OUTPUT
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.package.outputs.packageName }}
path: ${{ steps.package.outputs.packageName }}

View File

@ -74,7 +74,7 @@ jobs:
$name = ${env:archiveName}
echo "packageName=$name" >> $env:GITHUB_OUTPUT
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.package.outputs.packageName }}
path: ${{ steps.package.outputs.packageName }}

2
3rdparty/RibbonUI vendored

@ -1 +1 @@
Subproject commit c8d7d6d4689b422bdbe7cf1ef0cdcaf2948aeee6
Subproject commit 87c11a384af7ea474246780c98b221ef28a69a18

View File

@ -1,8 +1,7 @@
cmake_minimum_required(VERSION 3.20)
project(ProtocolParser_APP VERSION 1.0.4 LANGUAGES CXX)
project(ProtocolParser_APP VERSION 1.0.5 LANGUAGES CXX)
set(RIBBONUI_BUILD_FRAMELESSHEPLER ON)
set(RIBBONUI_BUILD_EXAMPLES OFF)
add_subdirectory(3rdparty/RibbonUI)
add_subdirectory(app_source)

View File

@ -2,7 +2,7 @@
<div align="center">
<img src="app_source/resources/imgs/icon.png" alt="Logo" style="width:40%; height:auto;">
</div>
<h1 align="center"> ProtocolParser 协议解析器 V1.0.4</h1>
<h1 align="center"> ProtocolParser 协议解析器 V1.0.5</h1>
## 一、介绍
这是一个用于与DKY的THM3682实验箱搭配使用的上位机协议解析器具体如何使用请看[使用说明](#使用说明)。

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)
string(TIMESTAMP TIME_YEAR %Y)
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_BUNDLE_NAME ${PROJECT_NAME})
set(version_str "${CMAKE_PROJECT_VERSION_MAJOR},${CMAKE_PROJECT_VERSION_MINOR},${CMAKE_PROJECT_VERSION_PATCH}")
@ -43,13 +44,12 @@ set(
)
set(
qml_files qml/Main.qml qml/components/RibbonWindow.qml qml/components/ZigBeeFrame.qml
qml/components/RibbonMessageListView.qml qml/components/RibbonMessage.qml
qml_files qml/Main.qml qml/components/ZigBeeFrame.qml
qml/components/ZigBeeMessage.qml qml/components/SerialPortAssistant.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/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
@ -64,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
)
INCLUDE_DIRECTORIES(dlln3x include)
include_directories(dlln3x include)
add_subdirectory(sm_crypto)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
@ -74,27 +74,37 @@ else()
endif()
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}
${sources_files}
resources/icon.rc
${app_icon_resource_windows}
)
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(DLLPATH ${CMAKE_SOURCE_DIR}/3rdparty/msvc/*.dll)
else()
set(DLLPATH ${CMAKE_SOURCE_DIR}/3rdparty/mingw/*.dll)
endif()
string(REPLACE "/" ${PATH_SEPARATOR} DLLPATH "${DLLPATH}")
file(GLOB DLL_FILES ${DLLPATH})
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${DLL_FILES}
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(DLLPATH ../3rdparty/msvc/*.dll)
else()
set(DLLPATH ../3rdparty/mingw/*.dll)
endif()
string(REPLACE "/" ${PATH_SEPARATOR} DLLPATH "${DLLPATH}")
file(GLOB DLL_FILES ${DLLPATH})
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${DLL_FILES}
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
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(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")
qt_add_executable(${PROJECT_NAME}
${sources_files}
@ -131,11 +141,7 @@ qt_add_qml_module(${PROJECT_NAME}
)
set_target_properties(${PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER ${PROJECT_DOMAIN}
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_INFO_PLIST ${CMAKE_BINARY_DIR}/Info.plist
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
OUTPUT_NAME ${PROJECT_BUNDLE_NAME}
@ -147,31 +153,42 @@ qt_add_translations(${PROJECT_NAME}
)
if(RIBBONUI_BUILD_STATIC_LIB)
add_definitions(-DRIBBONUI_BUILD_STATIC_LIB)
target_link_libraries(${PROJECT_NAME} PRIVATE
Qt::Quick
Qt::SerialPort
Qt::WebView
Qt::Core5Compat
RibbonUIplugin
sm_crypto
FramelessHelper::Core
FramelessHelper::Quick
)
target_compile_definitions(${PROJECT_NAME} PRIVATE
RIBBONUI_BUILD_STATIC_LIB
)
else()
target_link_libraries(${PROJECT_NAME} PRIVATE
Qt::Quick
Qt::SerialPort
Qt::WebView
Qt::Core5Compat
RibbonUI
sm_crypto
FramelessHelper::Core
FramelessHelper::Quick
)
if(WIN32)
if (MINGW)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${RIBBONUI_QML_PLUGIN_DIRECTORY}/RibbonUI.dll"
${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
else()
if (NOT RIBBONUI_BUILD_STATIC_LIB)
if (CMAKE_BUILD_TYPE MATCHES "Debug")
set(DEBUG_POSTFIX "d")
endif()
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${RIBBONUI_QML_PLUGIN_DIRECTORY}/RibbonUI${DEBUG_POSTFIX}.dll"
${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endif()
endif()
endif()
endif()
target_link_libraries(${PROJECT_NAME} PRIVATE
Qt::Quick
Qt::SerialPort
Qt::WebView
Qt::Core5Compat
RibbonUI
sm_crypto
)
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}_lupdate)
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}_lrelease)
target_compile_definitions(${PROJECT_NAME} PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)

View File

@ -5,37 +5,24 @@ import RibbonUI
import ProtocolParser
import "."
Item {
id:root
implicitHeight: 550
implicitWidth: 550
property string title: qsTr("帮助")
RibbonWindow {
id: root
height: 550
width: 550
title_bar.show_darkmode_btn: false
title_bar.show_style_switch: false
title: qsTr("帮助")
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: window_popup.close()
}
RibbonText{
anchors{
top:parent.top
topMargin: 10
horizontalCenter: parent.horizontalCenter
}
text: title
}
RibbonMarkDownViewer{
id: viewer
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'
base_url: 'qrc:/qt/qml/ProtocolParser/'
resource_dir: Tools.baseDir
@ -43,10 +30,11 @@ Item {
RibbonButton{
anchors{
bottom: root.bottom
bottomMargin: 10
left: root.left
leftMargin: 30
topMargin: 5
bottom: parent.bottom
bottomMargin: 5
left: parent.left
leftMargin: viewer.anchors.leftMargin
}
show_bg: false
show_hovered_bg: false
@ -59,10 +47,11 @@ Item {
RibbonButton{
anchors{
bottom: root.bottom
bottomMargin: 10
right: root.right
rightMargin: 30
topMargin: 5
bottom: parent.bottom
bottomMargin: 5
right: parent.right
rightMargin: viewer.anchors.rightMargin
}
show_bg: false
show_hovered_bg: false

View File

@ -5,7 +5,6 @@ import QtQuick.Window
import RibbonUI
import ProtocolParser
import org.wangwenx190.FramelessHelper
import "components"
RibbonWindow {
id:root
@ -13,6 +12,7 @@ RibbonWindow {
minimumWidth: 1200
height: 800
minimumHeight: 800
comfirmed_quit: true
title: qsTr("Protocol Parser") + ` V${PPAPP_Version}`
title_bar.right_content:RowLayout{
@ -28,27 +28,25 @@ RibbonWindow {
text_color: title_bar.title_text_color
text_color_reverse: false
onClicked: {
show_popup("components/HelpView.qml")
root.show_window("qrc:/qt/qml/ProtocolParser/HelperWindow.qml")
}
}
}
TabBar{
id: tab_bar
center_view: center_view
}
CenterView{
id: center_view
z:-2
anchors{
top: parent.top
bottom: parent.bottom
}
width:parent.width
tab_bar: tab_bar
bottom_bar: bottom_bar
bottom_bar: bottom_bar
}
TabBar{
id: tab_bar
center_view: center_view
}
RibbonBottomBar{
@ -63,33 +61,4 @@ RibbonWindow {
Component.onCompleted: {
RibbonTheme.modern_style=true
}
RibbonPopup{
id:window_popup
onClosed: window_popup.contentItem.destroy()
}
function show_popup(content_url, argument)
{
let component = Qt.createComponent(content_url,window_popup)
if (component.status === Component.Error) {
console.log(qsTr("Error loading component:"), component.errorString());
return
}
else
{
if (typeof(argument)!='undefined')
window_popup.contentItem = component.createObject(window_popup,argument)
else
window_popup.contentItem = component.createObject(window_popup)
}
window_popup.open()
}
function close_popup()
{
window_popup.close()
window_popup.contentItem.destroy()
}
}

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: window_popup.close()
}
ColumnLayout{
id:list_layout
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: window_popup.close()
}
ColumnLayout{
id:list_layout
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: window_popup.close()
}
ColumnLayout{
id:layout
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: window_popup.close()
}
ColumnLayout{
id:list_layout
anchors{

View File

@ -138,7 +138,7 @@ Item {
NumberAnimation { properties: "y"; from: list_table.height; duration: 200 }
}
ScrollBar.vertical: ScrollBar {
ScrollBar.vertical: RibbonScrollBar {
anchors.right: list_table.right
anchors.rightMargin: 2
}

View File

@ -27,13 +27,7 @@ Item {
WebView{
id: viewer
anchors{
top: parent.top
left: parent.left
margins: 30
}
width: parent.width
height: parent.height
anchors.fill: parent
settings.allowFileAccess: true
settings.localStorageEnabled: true
settings.javaScriptEnabled: true
@ -54,8 +48,6 @@ Item {
}
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};`)
get_height()
}

View File

@ -1,55 +0,0 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import RibbonUI
Rectangle{
id: bubble
color: "transparent"
property double padding: 10
default property alias content: message_layout.data
property var data_model: model
property int font_size: 13
property string sender_text: "sender"
width: ListView.view.width
height: bubble_layout.height + padding*2
ColumnLayout{
id: bubble_layout
anchors{
top: parent.top
topMargin: parent.padding
}
layoutDirection: data_model.recieved ? Qt.LeftToRight : Qt.RightToLeft
Component.onCompleted: {
if (data_model.recieved)
{
anchors.left = parent.left
anchors.leftMargin = parent.padding
}
else{
anchors.right = parent.right
anchors.rightMargin = parent.padding
}
}
RibbonText{
id: sender_text
text: bubble.sender_text
padding: bubble.padding
color: RibbonTheme.dark_mode ? "white" : "black"
}
RibbonRectangle{
id: bubble_bg
color: data_model.recieved ? RibbonTheme.dark_mode ? "#202020" : "#FFFFFF" : RibbonTheme.dark_mode ? "#272727" : "#4397F7"
height: message_layout.height + bubble.padding*2
width: message_layout.width + bubble.padding*2
radius: 10
topLeftRadius: data_model.recieved ? 2 : bubble.padding
topRightRadius: !data_model.recieved ? 2 : bubble.padding
ColumnLayout{
id: message_layout
anchors.centerIn: parent
}
}
}
}

View File

@ -1,64 +0,0 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import RibbonUI
RibbonView{
id: view
anchors{
top: parent.top
bottom: parent.bottom
}
spacing: 0
property int max_msg_num: 10
property bool auto_scroll_to_bottom: false
property int animation_time: 200
property alias delegate: message_list.delegate
property alias message_model: message_model
property alias view: message_list
ListModel{
id: message_model
onCountChanged: auto_scroll_btn_timer.restart()
}
Timer{
id: auto_scroll_btn_timer
interval: animation_time
repeat: false
onTriggered: {
if(view.auto_scroll_to_bottom)
view.scroll_to_bottom()
}
}
ListView{
id: message_list
cacheBuffer: message_list.height * 2
Layout.alignment: Qt.AlignHCenter
Layout.preferredHeight: parent.height
Layout.preferredWidth: parent.width
model: message_model
add: Transition {
NumberAnimation {
properties: "y"
from: message_list.height
duration: animation_time
}
}
ScrollBar.vertical: ScrollBar {
anchors.right: message_list.right
anchors.rightMargin: 2
}
}
function scroll_to_up(){
message_list.positionViewAtBeginning()
}
function scroll_to_bottom(){
message_list.positionViewAtEnd()
}
}

View File

@ -1,85 +0,0 @@
import QtQuick
import RibbonUI
import org.wangwenx190.FramelessHelper
Window {
id:window
default property alias content: container.data
property alias title_bar: titleBar
property alias popup: pop
property bool comfirmed_quit: false
visible: false
color: {
if (FramelessHelper.blurBehindWindowEnabled) {
return "transparent";
}
if (FramelessUtils.systemTheme === FramelessHelperConstants.Dark) {
return FramelessUtils.defaultSystemDarkColor;
}
return FramelessUtils.defaultSystemLightColor;
}
FramelessHelper.onReady: {
if (Qt.platform.os === 'windows')
{
FramelessHelper.setSystemButton(titleBar.minimizeBtn, FramelessHelperConstants.Minimize);
FramelessHelper.setSystemButton(titleBar.maximizeBtn, FramelessHelperConstants.Maximize);
FramelessHelper.setSystemButton(titleBar.closeBtn, FramelessHelperConstants.Close);
}
FramelessHelper.setHitTestVisible(titleBar.left_container)
FramelessHelper.setHitTestVisible(titleBar.right_container)
FramelessHelper.titleBarItem = titleBar;
FramelessHelper.moveWindowToDesktopCenter();
window.visible = true;
}
RibbonTitleBar {
id: titleBar
}
Item{
id:container
anchors{
top: titleBar.bottom
left: parent.left
right: parent.right
bottom: parent.bottom
}
clip: true
}
Connections{
target: RibbonTheme
function onTheme_modeChanged() {
if (RibbonTheme.dark_mode)
FramelessUtils.systemTheme = FramelessHelperConstants.Dark
else
FramelessUtils.systemTheme = FramelessHelperConstants.Light
}
}
Rectangle{
z:99
anchors.fill: parent
color: !RibbonTheme.dark_mode ? Qt.rgba(255,255,255,0.3) : Qt.rgba(0,0,0,0.3)
visible: !Window.active
}
RibbonPopup{
id: pop
}
RibbonPopupDialog{
id: dialog
positiveText: qsTr("Quit")
neutralText: qsTr("Minimize")
negativeText: qsTr("Cancel")
message: qsTr("Do you want to quit the APP?")
title: qsTr("Please note")
buttonFlags: RibbonPopupDialogType.NegativeButton | RibbonPopupDialogType.PositiveButton | RibbonPopupDialogType.NeutralButton
onNeutralClicked: window.visibility = Window.Minimized
onPositiveClicked: {
comfirmed_quit = true
Qt.quit()
}
}
onClosing:function(event){
window.raise()
event.accepted = comfirmed_quit
if (!comfirmed_quit)
dialog.open()
}
}

View File

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

View File

@ -103,17 +103,13 @@ Item{
height: parent.height
RibbonMessageListView{
id: data_view
top_padding: control.top_padding + data_title_bar.height
anchors.fill: parent
top_padding: control.top_padding + data_title_bar.height + (!RibbonTheme.modern_style ? 10 : 0)
bottom_padding: bottom_bar.height
width: parent.width / 2
delegate: ZigBeeMessage{
show_tooltip: control.show_tooltip
component_width: data_view.width / 2
}
view.onHeightChanged: {
if (control.auto_scroll_to_bottom)
scroll_to_bottom()
}
Event{
id:data_view_event
type: "zigbee_recv_data_view"

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

@ -1,35 +1,25 @@
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QtQml/qqmlextensionplugin.h>
#include <FramelessHelper/Quick/framelessquickmodule.h>
#include <FramelessHelper/Core/private/framelessconfig_p.h>
#include <QTranslator>
#include <QQmlContext>
#include <QtWebView>
#include "ribbonui.h"
FRAMELESSHELPER_USE_NAMESPACE
#ifdef RIBBONUI_BUILD_STATIC_LIB
Q_IMPORT_QML_PLUGIN(RibbonUIPlugin)
#endif
int main(int argc, char *argv[])
{
qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
QtWebView::initialize();
FramelessHelper::Quick::initialize();
RibbonUI::init();
QGuiApplication app(argc, argv);
#ifdef Q_OS_WIN
FramelessConfig::instance()->set(Global::Option::ForceHideWindowFrameBorder);
FramelessConfig::instance()->set(Global::Option::WindowUseRoundCorners);
#endif
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
FramelessConfig::instance()->set(Global::Option::CenterWindowBeforeShow);
QTranslator translator;
bool result = translator.load(QLocale::system(), u""_qs, u""_qs, u":/translations"_qs);
if (result)
app.installTranslator(&translator);
QQmlApplicationEngine engine;
FramelessHelper::Quick::registerTypes(&engine);
RibbonUI::registerTypes(&engine);
QList<int> verl = {PROTOCOLPARSER_VERSION};
QString version = QString::number(verl[0])+'.'+QString::number(verl[1])+'.'+QString::number(verl[2]);
engine.rootContext()->setContextProperty("PPAPP_Version",version);

View File

@ -453,13 +453,13 @@ QString ZigBeeDataResolver::sensor_data_reader(void **data,QString type)
}
else if (type=="float")
{
d = QString::number(*(float*)(*data), 'g', 1);
d = QString::number(*(float*)(*data), 'f', 3);
*pdata += sizeof(float);
return d;
}
else if (type=="double")
{
d = QString::number(*(double*)(*data), 'g', 1);
d = QString::number(*(double*)(*data), 'f', 3);
*pdata += sizeof(double);
return d;
}