diff --git a/3rdparty/RibbonUI b/3rdparty/RibbonUI index 97c6b7c..95ddf6d 160000 --- a/3rdparty/RibbonUI +++ b/3rdparty/RibbonUI @@ -1 +1 @@ -Subproject commit 97c6b7cb0d43c068eba9db14beda88e645df0e2b +Subproject commit 95ddf6da9a56ca169b481e3deb2a435d7c70f324 diff --git a/app_source/CMakeLists.txt b/app_source/CMakeLists.txt index b18d22e..dda4053 100644 --- a/app_source/CMakeLists.txt +++ b/app_source/CMakeLists.txt @@ -44,7 +44,6 @@ set( set( qml_files qml/Main.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 qml/components/ListTable.qml qml/components/DeviceList.qml qml/components/KeysList.qml diff --git a/app_source/qml/components/RibbonMessage.qml b/app_source/qml/components/RibbonMessage.qml deleted file mode 100644 index f261452..0000000 --- a/app_source/qml/components/RibbonMessage.qml +++ /dev/null @@ -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 - } - } - } -} diff --git a/app_source/qml/components/RibbonMessageListView.qml b/app_source/qml/components/RibbonMessageListView.qml deleted file mode 100644 index 94a9bfd..0000000 --- a/app_source/qml/components/RibbonMessageListView.qml +++ /dev/null @@ -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: RibbonScrollBar { - anchors.right: message_list.right - anchors.rightMargin: 2 - } - } - - function scroll_to_up(){ - message_list.positionViewAtBeginning() - } - - function scroll_to_bottom(){ - message_list.positionViewAtEnd() - } - -} diff --git a/app_source/qml/components/ZigBeeDataView.qml b/app_source/qml/components/ZigBeeDataView.qml index dab2513..7fecee8 100644 --- a/app_source/qml/components/ZigBeeDataView.qml +++ b/app_source/qml/components/ZigBeeDataView.qml @@ -103,17 +103,13 @@ Item{ height: parent.height RibbonMessageListView{ id: data_view + 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"