ProtocolParser/app_source/qml/Main.qml

96 lines
2.2 KiB
QML

import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Window
import RibbonUI
import ProtocolParser
import org.wangwenx190.FramelessHelper
import "components"
RibbonWindow {
id:root
width: 1200
minimumWidth: 1200
height: 800
minimumHeight: 800
title: qsTr("Protocol Parser") + ` V${PPAPP_Version}`
title_bar.right_content:RowLayout{
spacing: 1
layoutDirection: Qt.RightToLeft
RibbonButton{
show_bg:false
icon_source: RibbonIcons.QuestionCircle
icon_source_filled: RibbonIcons_Filled.QuestionCircle
tip_text: qsTr("帮助")
hover_color: Qt.rgba(0,0,0, 0.3)
pressed_color: Qt.rgba(0,0,0, 0.4)
text_color: title_bar.title_text_color
text_color_reverse: false
onClicked: {
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
}
RibbonBottomBar{
id: bottom_bar
anchors{
left: parent.left
right: parent.right
bottom: center_view.bottom
}
}
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()
}
}