From 2ea558c8e37f57ec0f3bbb90c933c0df8d9fdb94 Mon Sep 17 00:00:00 2001 From: pouya Date: Sun, 4 Sep 2022 21:58:22 +0430 Subject: [PATCH] ready to test --- .gitignore | 73 +++++++++ LoggerUI.pro | 25 +++ UI/CFilters.qml | 45 ++++++ UI/CSection.qml | 6 + UI/CTextField.qml | 65 ++++++++ UI/UserList/CTableDeligateChild.qml | 53 +++++++ UI/UserList/C_DataField.qml | 23 +++ UI/UserList/C_TableDelegate.qml | 121 ++++++++++++++ UI/UserList/C_TableUsers.qml | 34 ++++ UI/UserList/C_Title.qml | 65 ++++++++ UI/UserList/C_Titles.qml | 68 ++++++++ UI/UserList/P_UserList.qml | 146 +++++++++++++++++ UI/log.svg | 61 ++++++++ UI/main.qml | 234 ++++++++++++++++++++++++++++ UI/qml.qrc | 17 ++ UI/qtquickcontrols2.conf | 2 + bridge.cpp | 41 +++++ bridge.h | 32 ++++ main.cpp | 22 +++ 19 files changed, 1133 insertions(+) create mode 100644 .gitignore create mode 100644 LoggerUI.pro create mode 100644 UI/CFilters.qml create mode 100644 UI/CSection.qml create mode 100644 UI/CTextField.qml create mode 100644 UI/UserList/CTableDeligateChild.qml create mode 100644 UI/UserList/C_DataField.qml create mode 100644 UI/UserList/C_TableDelegate.qml create mode 100644 UI/UserList/C_TableUsers.qml create mode 100644 UI/UserList/C_Title.qml create mode 100644 UI/UserList/C_Titles.qml create mode 100644 UI/UserList/P_UserList.qml create mode 100644 UI/log.svg create mode 100644 UI/main.qml create mode 100644 UI/qml.qrc create mode 100644 UI/qtquickcontrols2.conf create mode 100644 bridge.cpp create mode 100644 bridge.h create mode 100644 main.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fab7372 --- /dev/null +++ b/.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 + diff --git a/LoggerUI.pro b/LoggerUI.pro new file mode 100644 index 0000000..b7f10f8 --- /dev/null +++ b/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 diff --git a/UI/CFilters.qml b/UI/CFilters.qml new file mode 100644 index 0000000..d9015ba --- /dev/null +++ b/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 + } +} diff --git a/UI/CSection.qml b/UI/CSection.qml new file mode 100644 index 0000000..59fdcf5 --- /dev/null +++ b/UI/CSection.qml @@ -0,0 +1,6 @@ +import QtQuick 2.15 + +Rectangle { + + color: "#F5F5F5" +} diff --git a/UI/CTextField.qml b/UI/CTextField.qml new file mode 100644 index 0000000..f40c806 --- /dev/null +++ b/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 + } + } +} diff --git a/UI/UserList/CTableDeligateChild.qml b/UI/UserList/CTableDeligateChild.qml new file mode 100644 index 0000000..a811c92 --- /dev/null +++ b/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 + } + } +} diff --git a/UI/UserList/C_DataField.qml b/UI/UserList/C_DataField.qml new file mode 100644 index 0000000..01b220c --- /dev/null +++ b/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 + } +} diff --git a/UI/UserList/C_TableDelegate.qml b/UI/UserList/C_TableDelegate.qml new file mode 100644 index 0000000..f22d25b --- /dev/null +++ b/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 + } + } +} diff --git a/UI/UserList/C_TableUsers.qml b/UI/UserList/C_TableUsers.qml new file mode 100644 index 0000000..b49ede4 --- /dev/null +++ b/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 + } + } +} diff --git a/UI/UserList/C_Title.qml b/UI/UserList/C_Title.qml new file mode 100644 index 0000000..ab696c3 --- /dev/null +++ b/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() + } + } +} diff --git a/UI/UserList/C_Titles.qml b/UI/UserList/C_Titles.qml new file mode 100644 index 0000000..72657a2 --- /dev/null +++ b/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) + } +} diff --git a/UI/UserList/P_UserList.qml b/UI/UserList/P_UserList.qml new file mode 100644 index 0000000..7c9c13e --- /dev/null +++ b/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; + } + } +} + + diff --git a/UI/log.svg b/UI/log.svg new file mode 100644 index 0000000..c9cf220 --- /dev/null +++ b/UI/log.svg @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/UI/main.qml b/UI/main.qml new file mode 100644 index 0000000..b9babe3 --- /dev/null +++ b/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) + } + } + } + } + } +} diff --git a/UI/qml.qrc b/UI/qml.qrc new file mode 100644 index 0000000..a3bb70d --- /dev/null +++ b/UI/qml.qrc @@ -0,0 +1,17 @@ + + + main.qml + qtquickcontrols2.conf + log.svg + CSection.qml + CTextField.qml + CFilters.qml + UserList/C_DataField.qml + UserList/C_TableDelegate.qml + UserList/C_TableUsers.qml + UserList/C_Title.qml + UserList/C_Titles.qml + UserList/P_UserList.qml + UserList/CTableDeligateChild.qml + + diff --git a/UI/qtquickcontrols2.conf b/UI/qtquickcontrols2.conf new file mode 100644 index 0000000..c0be4ff --- /dev/null +++ b/UI/qtquickcontrols2.conf @@ -0,0 +1,2 @@ +[Controls] +Style=Material \ No newline at end of file diff --git a/bridge.cpp b/bridge.cpp new file mode 100644 index 0000000..5c202fa --- /dev/null +++ b/bridge.cpp @@ -0,0 +1,41 @@ +#include "bridge.h" + +#include +#include +#include +#include +#include + + + +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); + }); +} diff --git a/bridge.h b/bridge.h new file mode 100644 index 0000000..13c1745 --- /dev/null +++ b/bridge.h @@ -0,0 +1,32 @@ +#ifndef BRIDGE_H +#define BRIDGE_H + +#include + +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 diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..ab52a53 --- /dev/null +++ b/main.cpp @@ -0,0 +1,22 @@ +#include +#include +#include + +#include + +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(); +}