Compare commits

..

No commits in common. "b5a0aa63a44f07919eb7b1263cf937e93e53c8da" and "b16e902dbe513c8a8450d3d8c1034dc8fb9d2b4d" have entirely different histories.

14 changed files with 171 additions and 39 deletions

2
3rdparty/RibbonUI vendored

@ -1 +1 @@
Subproject commit 326fbdeeb8cb85e2462e591894e46c0f93a0e2c8
Subproject commit c8d7d6d4689b422bdbe7cf1ef0cdcaf2948aeee6

View File

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

View File

@ -43,7 +43,7 @@ set(
)
set(
qml_files qml/Main.qml qml/components/ZigBeeFrame.qml
qml_files qml/Main.qml qml/components/RibbonWindow.qml qml/components/ZigBeeFrame.qml
qml/components/RibbonMessageListView.qml qml/components/RibbonMessage.qml
qml/components/ZigBeeMessage.qml qml/components/SerialPortAssistant.qml
qml/components/ZigBeeDataView.qml qml/components/TabBar.qml qml/components/CenterView.qml
@ -147,25 +147,31 @@ 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
)
endif()
target_link_libraries(${PROJECT_NAME} PRIVATE
Qt::Quick
Qt::SerialPort
Qt::WebView
Qt::Core5Compat
RibbonUI
sm_crypto
FramelessHelper::Core
FramelessHelper::Quick
)
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,6 +5,7 @@ import QtQuick.Window
import RibbonUI
import ProtocolParser
import org.wangwenx190.FramelessHelper
import "components"
RibbonWindow {
id:root
@ -27,26 +28,27 @@ RibbonWindow {
text_color: title_bar.title_text_color
text_color_reverse: false
onClicked: {
show_popup("qrc:/qt/qml/ProtocolParser/components/HelpView.qml")
show_popup("components/HelpView.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
}
TabBar{
id: tab_bar
center_view: center_view
bottom_bar: bottom_bar
}
RibbonBottomBar{
@ -61,4 +63,33 @@ 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

@ -95,7 +95,7 @@ Item{
show_bg: false
show_hovered_bg: false
icon_source: RibbonIcons.Dismiss
onClicked: popup.close()
onClicked: window_popup.close()
}
ColumnLayout{

View File

@ -47,7 +47,7 @@ Item {
show_bg: false
show_hovered_bg: false
icon_source: RibbonIcons.Dismiss
onClicked: popup.close()
onClicked: window_popup.close()
}
ColumnLayout{

View File

@ -70,7 +70,7 @@ Item {
show_bg: false
show_hovered_bg: false
icon_source: RibbonIcons.Dismiss
onClicked: popup.close()
onClicked: window_popup.close()
}
ColumnLayout{

View File

@ -21,7 +21,7 @@ Item {
show_bg: false
show_hovered_bg: false
icon_source: RibbonIcons.Dismiss
onClicked: popup.close()
onClicked: window_popup.close()
}
RibbonText{

View File

@ -47,7 +47,7 @@ Item {
show_bg: false
show_hovered_bg: false
icon_source: RibbonIcons.Dismiss
onClicked: popup.close()
onClicked: window_popup.close()
}
ColumnLayout{

View File

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

View File

@ -47,7 +47,7 @@ RibbonView{
duration: animation_time
}
}
ScrollBar.vertical: RibbonScrollBar {
ScrollBar.vertical: ScrollBar {
anchors.right: message_list.right
anchors.rightMargin: 2
}

View File

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

View File

@ -1,26 +1,35 @@
#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[])
{
RibbonUI::init();
qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
QtWebView::initialize();
FramelessHelper::Quick::initialize();
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;
RibbonUI::registerTypes(&engine);
FramelessHelper::Quick::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);