Browse Source

ready to test

master
pouya 2 years ago
commit
2ea558c8e3
  1. 73
      .gitignore
  2. 25
      LoggerUI.pro
  3. 45
      UI/CFilters.qml
  4. 6
      UI/CSection.qml
  5. 65
      UI/CTextField.qml
  6. 53
      UI/UserList/CTableDeligateChild.qml
  7. 23
      UI/UserList/C_DataField.qml
  8. 121
      UI/UserList/C_TableDelegate.qml
  9. 34
      UI/UserList/C_TableUsers.qml
  10. 65
      UI/UserList/C_Title.qml
  11. 68
      UI/UserList/C_Titles.qml
  12. 146
      UI/UserList/P_UserList.qml
  13. 61
      UI/log.svg
  14. 234
      UI/main.qml
  15. 17
      UI/qml.qrc
  16. 2
      UI/qtquickcontrols2.conf
  17. 41
      bridge.cpp
  18. 32
      bridge.h
  19. 22
      main.cpp

73
.gitignore

@ -0,0 +1,73 @@
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------
*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash
# qtcreator generated files
*.pro.user*
# xemacs temporary files
*.flc
# Vim temporary files
.*.swp
# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*
# MinGW generated files
*.Debug
*.Release
# Python byte code
*.pyc
# Binaries
# --------
*.dll
*.exe

25
LoggerUI.pro

@ -0,0 +1,25 @@
QT += quick quickcontrols2
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
bridge.cpp \
main.cpp
RESOURCES += UI/qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
HEADERS += \
bridge.h

45
UI/CFilters.qml

@ -0,0 +1,45 @@
import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import QtQuick.Controls.Material 2.15
Item {
property string input: idText.text
property string name: ""
anchors.topMargin: 5
width: parent.width
height: 57
function clear() {
idText.clear()
}
Label {
id: idName
anchors.left: parent.left
text: parent.name + ":"
y: 0
Material.foreground: "#167a72"
font.pointSize: 10
visible: false
}
TextField {
id: idText
y: 10
horizontalAlignment: TextInput.AlignHCenter
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width
selectByMouse: true
onTextChanged: {
if (text === "") {
placeholderText = name
idName.visible = false
} else {
placeholderText = ""
idName.visible = true
}
}
placeholderText: name
}
}

6
UI/CSection.qml

@ -0,0 +1,6 @@
import QtQuick 2.15
Rectangle {
color: "#F5F5F5"
}

65
UI/CTextField.qml

@ -0,0 +1,65 @@
import QtQuick 2.0
import QtQuick.Controls 2.13
TextField {
id: customTextField
property bool isEmpty: text == ""
property string title: "Camera Name"
width: 250
height: 56
text: ""
font.pixelSize: 14
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignTop
topPadding: 25
Text {
id: titleText
font.pixelSize: parent.isEmpty ? 14 : 12
y: parent.isEmpty ? 25 : 10
x: 10
text: parent.title
color: parent.isEmpty ? "gray" : "red"
Behavior on y {
NumberAnimation {
duration: Theme.easingDuration
easing.type: Easing.InOutQuad
}
}
Behavior on font.pixelSize {
NumberAnimation {
duration: Theme.easingDuration
easing.type: Easing.InOutQuad
}
}
}
background: Rectangle {
radius: 5
implicitWidth: parent.width
implicitHeight: parent.height
color: parent.focus ? Theme.tertiary : Theme.secondary
Rectangle {
id: cornerFiller
width: parent.width
height: parent.radius
anchors.bottom: parent.bottom
color: parent.color
}
Rectangle {
id: focusSign
width: parent.width
height: 2
anchors.bottom: parent.bottom
color: Theme.primary
visible: customTextField.focus
}
}
}

53
UI/UserList/CTableDeligateChild.qml

@ -0,0 +1,53 @@
import QtQuick 2.12
import QtQuick.Layouts 1.12
import "../"
Rectangle {
id: root
color: "#e6f0ea"
property var userData
property var indexOfDelegate
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - 30
onIndexOfDelegateChanged: {
if (indexOfDelegate % 2 == 0) {
root.color = "#debaba"
} else {
root.color = "#ded1ba"
}
}
onUserDataChanged: {
id_source.text = userData.source
id_destination.text = userData.destination
id_message.text = userData.message
id_duration.text = userData.duration
}
RowLayout {
anchors.fill: parent
clip: true
C_DataField {
id: id_source
Layout.minimumWidth: 200
Layout.preferredWidth: 200
}
C_DataField {
id: id_destination
Layout.minimumWidth: 200
Layout.preferredWidth: 200
}
C_DataField {
id: id_message
Layout.minimumWidth: 200
Layout.preferredWidth: 200
Layout.fillWidth: true
}
C_DataField {
id: id_duration
Layout.minimumWidth: 100
Layout.preferredWidth: 100
}
}
}

23
UI/UserList/C_DataField.qml

@ -0,0 +1,23 @@
import QtQuick 2.15
Item {
height: parent.height
property alias text: id_text.text
property bool makeGreen: false
property bool isBold: false
Text {
id: id_text
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: {
if (makeGreen) {
return "#3e8740"
} else {
return "#505550"
}
}
font.bold: isBold
}
}

121
UI/UserList/C_TableDelegate.qml

@ -0,0 +1,121 @@
import QtQuick 2.12
import QtQuick.Layouts 1.12
import "../"
Rectangle {
id: root
color: "#e6f0ea"
radius: 6
property var userData
property var indexOfDelegate
height: 40
onIndexOfDelegateChanged: {
if (indexOfDelegate % 2 == 0) {
root.color = "#bed6bc"
} else {
root.color = "#bcd6d4"
}
}
clip: true
onUserDataChanged: {
id_source.text = userData.source
id_destination.text = userData.destination
id_message.text = userData.message
id_duration.text = userData.duration
id_modelChild.clear()
for (var i = 0; i < userData.child.length; i++) {
id_modelChild.append({
"info": userData.child[i]
})
}
idChildList.height = 40 * userData.child.length
}
Item {
id: idTitle
width: parent.width
height: 40
anchors.top: parent.top
RowLayout {
anchors.fill: parent
clip: true
Item {
Layout.minimumWidth: 15
Layout.preferredWidth: 15
}
C_DataField {
id: id_source
Layout.minimumWidth: 200
Layout.preferredWidth: 200
isBold: true
}
C_DataField {
id: id_destination
Layout.minimumWidth: 200
Layout.preferredWidth: 200
isBold: true
}
C_DataField {
id: id_message
Layout.minimumWidth: 200
Layout.preferredWidth: 200
Layout.fillWidth: true
isBold: true
}
C_DataField {
id: id_duration
Layout.minimumWidth: 100
Layout.preferredWidth: 100
isBold: true
}
Item {
Layout.minimumWidth: 15
Layout.preferredWidth: 15
}
}
MouseArea {
property bool isExapnded: false
anchors.fill: parent
onClicked: {
if (isExapnded) {
isExapnded = false
root.height = 40
} else {
isExapnded = true
root.height = 40 + idChildList.height + 15
}
}
}
}
Item {
id: idChildList
anchors.top: idTitle.bottom
width: parent.width
visible: true
ListView {
anchors.fill: parent
model: id_modelChild
spacing: 0
clip: true
delegate: CTableDeligateChild {
userData: info
height: 40
indexOfDelegate: index
}
}
ListModel {
id: id_modelChild
}
}
Behavior on height {
NumberAnimation {
duration: 200
}
}
}

34
UI/UserList/C_TableUsers.qml

@ -0,0 +1,34 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import "../"
Item {
id: root
function updateListOfMessages(listOfMesseges) {
id_model.clear()
for (var i = 0; i < listOfMesseges.length; i++) {
id_model.append({
"info": listOfMesseges[i]
})
}
}
ListModel {
id: id_model
}
ListView {
anchors.fill: parent
model: id_model
spacing: 5
clip: true
delegate: C_TableDelegate {
userData: info
width: root.width
indexOfDelegate: index
}
}
}

65
UI/UserList/C_Title.qml

@ -0,0 +1,65 @@
import QtQuick 2.0
Item {
id: root
height: parent.height
property alias text: id_text.text
property int sortState: 0
signal clicked
onSortStateChanged: {
if (sortState === 0) {
id_text.color = "#848984"
id_text.font.bold = false
} else {
id_text.color = "#0091ff"
id_text.font.bold = true
}
}
Rectangle {
id: idRectangle
radius: 100
opacity: 0
color: "black"
anchors.fill: parent
Behavior on opacity {
NumberAnimation {
duration: 100
}
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
onHoveredChanged: {
if (containsMouse) {
idRectangle.opacity = 0.05
} else {
idRectangle.opacity = 0
}
}
}
}
Text {
id: id_text
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: "#848984"
}
MouseArea {
anchors.fill: parent
onClicked: {
if (sortState === 0)
sortState = 1
else if (sortState === 1)
sortState = -1
else if (sortState === -1)
sortState = 0
root.clicked()
}
}
}

68
UI/UserList/C_Titles.qml

@ -0,0 +1,68 @@
import QtQuick 2.12
import QtQuick.Layouts 1.12
RowLayout {
Item {
Layout.minimumWidth: 15
Layout.preferredWidth: 15
}
C_Title {
id: src
Layout.minimumWidth: 200
Layout.preferredWidth: 200
text: "Source"
onClicked: {
des.sortState = 0
mess.sortState = 0
dur.sortState = 0
setSortState()
}
}
C_Title {
id: des
Layout.minimumWidth: 200
Layout.preferredWidth: 200
text: "Destination"
onClicked: {
src.sortState = 0
mess.sortState = 0
dur.sortState = 0
setSortState()
}
}
C_Title {
id: mess
Layout.minimumWidth: 200
Layout.preferredWidth: 200
Layout.fillWidth: true
text: "Message"
onClicked: {
src.sortState = 0
des.sortState = 0
dur.sortState = 0
setSortState()
}
}
C_Title {
id: dur
Layout.minimumWidth: 100
Layout.preferredWidth: 100
text: "Duration"
onClicked: {
src.sortState = 0
des.sortState = 0
mess.sortState = 0
setSortState()
}
}
Item {
Layout.minimumWidth: 15
Layout.preferredWidth: 15
}
function setSortState() {
cpp.sortsChanged(src.sortState, des.sortState, mess.sortState,
dur.sortState)
}
}

146
UI/UserList/P_UserList.qml

@ -0,0 +1,146 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import "../Components"
import "../"
Item{
Item{
id: root
anchors.fill: parent
C_RectangleWithShadow {
anchors.top: parent.top
width: parent.width
height: 55
radius: 0
color: "#D3D8D5"
Text {
height: parent.height
width: 200
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
anchors.horizontalCenter: parent.horizontalCenter
id: name
text: StateManager.lastEmail
color: "#008299"
font: Style.fontTitle
}
C_Button{
width: 200
height: 37
anchors.verticalCenter: parent.verticalCenter
text: "Update Users List"
anchors.right: parent.right
anchors.rightMargin: 40
mainColor: Style.secondaryColor
hoverColor: Style.secondaryColorDarker
onClicked: {
StateManager.requestUsersList();
}
}
C_Button{
width: 130
height: 37
anchors.verticalCenter: parent.verticalCenter
text: "Log Out"
anchors.left: parent.left
anchors.leftMargin: 40
mainColor: "#de4e4e"
hoverColor: "#c74242"
onClicked: {
StateManager.requestLogOut();
}
}
}
C_RectangleWithShadow {
anchors.fill: parent
anchors.rightMargin: 35
anchors.leftMargin: 35
anchors.topMargin: 90
anchors.bottomMargin: 40
radius: 10
color: "#eff6f2"
Flickable {
anchors.fill: parent
anchors.rightMargin: 4
anchors.leftMargin: 4
onWidthChanged: {
if(width>990){
contentWidth = parent.width
}
else{
contentWidth = 990;
}
}
contentWidth: 990
contentHeight: parent.height
flickableDirection: Flickable.HorizontalFlick
boundsBehavior: Flickable.StopAtBounds
ScrollIndicator.horizontal: ScrollIndicator { }
clip: true
C_Titles{
id:id_titels
anchors.top: parent.top
anchors.topMargin: 5
anchors.right: parent.right
anchors.left: parent.left
anchors.rightMargin: 10
anchors.leftMargin: 10
height: 25
}
C_TableUsers{
id:tableUsers
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: parent.bottom
anchors.top: id_titels.bottom
anchors.topMargin: 10
anchors.rightMargin: 10
anchors.leftMargin: 10
}
}
}
Connections {
target: StateManager
onOpenUserEditWindow: function(userInfo){
id_editUserWindow.visible = true;
id_blur.visible = true;
}
}
}
C_Blur{
id:id_blur
target: root
z:2
}
C_UserEdit {
id: id_editUserWindow
anchors.centerIn: parent
width: 420
height: 600
z:3
onCloseWithOutSaving: {
id_editUserWindow.opacity = 0;
id_blur.opacity = 0;
}
}
}

61
UI/log.svg

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 360 360" style="enable-background:new 0 0 360 360;" xml:space="preserve">
<g id="XMLID_227_">
<path id="XMLID_228_" d="M344.259,126.683h-48.518V77.834L212.719,0H15.741v360h280v-50.59h48.518V126.683z M314.259,279.41h-210
V156.683h210V279.41z"/>
<polygon id="XMLID_231_" points="170.892,234.942 139.035,234.942 139.035,183.11 126.892,183.11 126.892,245.59 170.892,245.59
"/>
<path id="XMLID_232_" d="M178.943,236.218c2.669,2.963,5.866,5.339,9.593,7.128c3.725,1.79,7.876,2.684,12.451,2.684
c4.4,0,8.477-0.865,12.232-2.596c3.754-1.73,6.98-4.048,9.68-6.952c2.698-2.904,4.811-6.248,6.336-10.032
c1.525-3.784,2.288-7.758,2.288-11.924c0-3.93-0.734-7.802-2.199-11.616c-1.468-3.813-3.521-7.216-6.16-10.208
c-2.641-2.992-5.823-5.412-9.548-7.26c-3.727-1.848-7.848-2.772-12.364-2.772c-4.4,0-8.479,0.866-12.232,2.596
c-3.755,1.732-6.996,4.064-9.724,6.996c-2.729,2.935-4.87,6.307-6.424,10.12c-1.556,3.814-2.332,7.803-2.332,11.968
c0,3.991,0.733,7.892,2.2,11.704C174.205,229.868,176.273,233.256,178.943,236.218z M184.048,206.738
c0.792-2.493,1.949-4.722,3.476-6.688c1.525-1.965,3.433-3.549,5.721-4.752c2.288-1.202,4.898-1.804,7.832-1.804
c2.815,0,5.352,0.572,7.611,1.716c2.258,1.144,4.165,2.684,5.721,4.62c1.554,1.936,2.757,4.166,3.607,6.688
c0.85,2.523,1.276,5.134,1.276,7.831c0,2.583-0.397,5.119-1.189,7.612c-0.792,2.494-1.966,4.738-3.52,6.732
c-1.556,1.995-3.463,3.594-5.721,4.796c-2.259,1.203-4.854,1.804-7.787,1.804c-2.876,0-5.442-0.586-7.7-1.76
c-2.26-1.173-4.166-2.728-5.72-4.664c-1.556-1.936-2.743-4.165-3.564-6.688c-0.822-2.521-1.232-5.133-1.232-7.832
C182.859,211.769,183.256,209.232,184.048,206.738z"/>
<path id="XMLID_236_" d="M245.823,236.79c2.669,2.875,5.809,5.134,9.416,6.776c3.608,1.643,7.465,2.464,11.572,2.464
c6.629,0,12.436-2.493,17.424-7.48v7.04h10.032v-32.12h-22.616v8.888h12.584v4.4c-4.87,5.691-10.326,8.536-16.368,8.536
c-2.64,0-5.09-0.542-7.348-1.628c-2.259-1.085-4.21-2.566-5.852-4.444c-1.644-1.877-2.935-4.092-3.872-6.644
c-0.939-2.552-1.408-5.293-1.408-8.228c0-2.816,0.425-5.485,1.276-8.008c0.85-2.521,2.053-4.752,3.607-6.688
c1.554-1.936,3.432-3.461,5.632-4.576c2.2-1.114,4.62-1.672,7.261-1.672c3.344,0,6.438,0.822,9.283,2.464
c2.845,1.644,5.061,4.02,6.645,7.128l9.064-6.688c-2.111-4.165-5.266-7.48-9.46-9.944c-4.195-2.464-9.226-3.696-15.092-3.696
c-4.342,0-8.36,0.836-12.056,2.508c-3.696,1.672-6.908,3.931-9.637,6.776c-2.728,2.847-4.87,6.16-6.424,9.944
c-1.555,3.784-2.332,7.818-2.332,12.1c0,4.518,0.777,8.727,2.332,12.628C241.041,230.528,243.153,233.916,245.823,236.79z"/>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

234
UI/main.qml

@ -0,0 +1,234 @@
import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import QtQuick.Controls.Material 2.15
import QtQuick.Dialogs 1.3
import "./UserList"
Window {
id: root
width: 1200
height: 800
visible: true
title: "Logger"
Material.theme: Material.Light
Material.primary: Material.Red
Material.accent: Material.Cyan
Rectangle {
anchors.fill: parent
color: "#E4E4E4"
Item {
id: idMenu
anchors.left: parent.left
height: parent.height
width: 300
CSection {
id: idOpenFile
width: parent.width
height: 70
Item {
width: parent.width - 30
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 10
Button {
text: "Open Log File"
anchors.horizontalCenter: parent.horizontalCenter
Material.accent: Material.Orange
highlighted: true
Material.background: Material.Teal
width: parent.width
onClicked: fileDialog.open()
FileDialog {
id: fileDialog
title: "Please choose a Log"
folder: shortcuts.home
onAccepted: {
root.title = fileDialog.fileUrls[0]
cpp.fileLogChanged(fileDialog.fileUrls[0])
}
Component.onCompleted: visible = false
}
}
}
}
CSection {
width: parent.width
anchors.top: idOpenFile.bottom
anchors.topMargin: 5
anchors.bottom: parent.bottom
Label {
id: idLabel
text: "Filters"
anchors.left: parent.left
anchors.top: parent.top
anchors.topMargin: 4
anchors.leftMargin: 4
font.pointSize: 12
Material.foreground: "#a5a5a5"
}
Item {
id: idFilters
property bool isSignalDisable: false
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.top: idLabel.bottom
anchors.margins: 16
anchors.topMargin: 15
CFilters {
id: idSource
name: "Source"
onInputChanged: idFilters.setFilters()
}
CFilters {
id: idDistination
name: "Destination"
anchors.top: idSource.bottom
onInputChanged: idFilters.setFilters()
}
CFilters {
id: idMessage
name: "Message"
anchors.top: idDistination.bottom
onInputChanged: idFilters.setFilters()
}
CFilters {
id: idMinMessageLength
name: "Min Message Length"
anchors.top: idMessage.bottom
anchors.topMargin: 32
onInputChanged: idFilters.setFilters()
}
CFilters {
id: idMaxMessageLength
name: "Max Message Length"
anchors.top: idMinMessageLength.bottom
onInputChanged: idFilters.setFilters()
}
CFilters {
id: idMinMessageDuration
name: "Min Message Time"
anchors.top: idMaxMessageLength.bottom
anchors.topMargin: 32
onInputChanged: idFilters.setFilters()
}
CFilters {
id: idMaxMessageDuration
name: "Max Message Time"
anchors.top: idMinMessageDuration.bottom
onInputChanged: idFilters.setFilters()
}
function setFilters() {
if (!idFilters.isSignalDisable) {
cpp.filtersChanged(idSource.input,
idDistination.input,
idMessage.input,
idMinMessageLength.input,
idMaxMessageLength.input,
idMinMessageDuration.input,
idMaxMessageDuration.input)
}
}
Button {
text: "Clear All Filters"
anchors.horizontalCenter: parent.horizontalCenter
Material.accent: Material.Orange
highlighted: true
Material.background: Material.Orange
width: parent.width
anchors.top: idMaxMessageDuration.bottom
anchors.topMargin: 0
onClicked: {
idFilters.isSignalDisable = true
idMaxMessageDuration.clear()
idMinMessageDuration.clear()
idMaxMessageLength.clear()
idMinMessageLength.clear()
idMessage.clear()
idDistination.clear()
idSource.clear()
idFilters.isSignalDisable = false
idFilters.setFilters()
}
}
}
}
}
CSection {
id: idMain
anchors.right: parent.right
height: parent.height
anchors.left: idMenu.right
anchors.leftMargin: 5
C_Titles {
id: id_titels
anchors.top: parent.top
anchors.topMargin: 5
anchors.right: parent.right
anchors.left: parent.left
anchors.rightMargin: 10
anchors.leftMargin: 10
height: 25
}
C_TableUsers {
id: tableUsers
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: parent.bottom
anchors.top: id_titels.bottom
anchors.topMargin: 10
anchors.rightMargin: 10
anchors.leftMargin: 10
// Component.onCompleted: {
// let messeges = []
// let messege1 = {
// "source": "source1",
// "destination": "dest1",
// "message": "message1",
// "duration": "120ms",
// "child": [{
// "source": "child source1",
// "destination": "child dest1",
// "message": "chld message1",
// "duration": "120ms"
// }, {
// "source": "child source2",
// "destination": "child dest2",
// "message": "chld message3",
// "duration": "220ms"
// }]
// }
// messeges.push(messege1)
// messeges.push(messege1)
// messeges.push(messege1)
// messeges.push(messege1)
// updateListOfMessages(messeges)
// }
Connections {
target: cpp
function onSetJsonData(jsonData) {
// console.log(jsonData)
let jsonObj = JSON.parse(jsonData)
tableUsers.updateListOfMessages(jsonObj)
}
}
}
}
}
}

17
UI/qml.qrc

@ -0,0 +1,17 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>qtquickcontrols2.conf</file>
<file>log.svg</file>
<file>CSection.qml</file>
<file>CTextField.qml</file>
<file>CFilters.qml</file>
<file>UserList/C_DataField.qml</file>
<file>UserList/C_TableDelegate.qml</file>
<file>UserList/C_TableUsers.qml</file>
<file>UserList/C_Title.qml</file>
<file>UserList/C_Titles.qml</file>
<file>UserList/P_UserList.qml</file>
<file>UserList/CTableDeligateChild.qml</file>
</qresource>
</RCC>

2
UI/qtquickcontrols2.conf

@ -0,0 +1,2 @@
[Controls]
Style=Material

41
bridge.cpp

@ -0,0 +1,41 @@
#include "bridge.h"
#include <QJsonArray>
#include <QJsonObject>
#include <QJsonDocument>
#include <QDebug>
#include <QTimer>
Bridge::Bridge(QObject *parent)
: QObject{parent}
{
QJsonDocument jsonDoc;
QJsonArray mainArray;
QJsonObject obj1;
obj1.insert ("source","source1");
obj1.insert ("destination","destination1");
obj1.insert ("message","message1");
obj1.insert ("duration","duration1");
QJsonArray childArray;
childArray.append (obj1);
childArray.append (obj1);
obj1.insert ("child",childArray);
mainArray.append (obj1);
mainArray.append (obj1);
jsonDoc.setArray (mainArray);
QString jsonString = jsonDoc.toJson();
connect (this,&Bridge::sortsChanged ,[=](int path,int path1,int path2,
int path3){
qDebug() << "___________--";
qDebug() << path << " " << path1;
});
QTimer::singleShot(2000, this, [=](){
emit setJsonData (jsonString);
});
}

32
bridge.h

@ -0,0 +1,32 @@
#ifndef BRIDGE_H
#define BRIDGE_H
#include <QObject>
class Bridge : public QObject
{
Q_OBJECT
public:
explicit Bridge(QObject *parent = nullptr);
signals://===from qml===
void filtersChanged(QString source,QString destination,QString message,
QString minMessageLength,QString maxMessageLenght,
QString minMessageTime, QString maxMessageTile);
//1 assending , -1 desending , 0 non
void sortsChanged(int sourceOrder, int distinationOrder,
int messageOrder,int durationOrder);
void fileLogChanged(QString path);
signals://===from cpp===
void setJsonData(QString jsonData);
};
#endif // BRIDGE_H

22
main.cpp

@ -0,0 +1,22 @@
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <bridge.h>
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
app.setOrganizationName("Sepanta");
app.setOrganizationDomain("Sepanta");
QQmlApplicationEngine engine;
Bridge *brdige = new Bridge;
engine.rootContext ()->setContextProperty ("cpp",brdige);
engine.load("qrc:/main.qml");
return app.exec();
}
Loading…
Cancel
Save