From 1cacf606e3c29f39980a0a901c6007f3e9987b25 Mon Sep 17 00:00:00 2001 From: "littletux89@gmail.com" <littletux89@gmail.com> Date: Mon, 9 Sep 2019 15:32:39 +0300 Subject: [PATCH] =?UTF-8?q?[*]=20=D0=A1ode=20refactoring.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DapUiQmlScreenDashboard.qml | 187 ------------------ .../DapUiQmlScreenExchangeForm.ui.qml | 11 +- KelvinDashboardGUI/DapUiQmlScreenHistory.qml | 24 +-- .../DapUiQmlScreenHistoryForm.ui.qml | 18 ++ .../DapUiQmlScreenMainWindow.qml | 102 ++++++++++ .../DapUiQmlScreenMainWindow.ui.qml | 8 - .../DapUiQmlScreenMainWindowForm.ui.qml | 117 +++++++++++ ...UiQmlWidgetExchangeOrderButtonForm.ui.qml} | 0 ...iQmlWidgetExchangeOrderContentForm.ui.qml} | 2 +- ...=> DapUiQmlWidgetExchangeOrderForm.ui.qml} | 10 +- ...pUiQmlWidgetExchangeOrderTitleForm.ui.qml} | 0 KelvinDashboardGUI/main.qml | 16 +- KelvinDashboardGUI/qml.qrc | 15 +- 13 files changed, 280 insertions(+), 230 deletions(-) delete mode 100755 KelvinDashboardGUI/DapUiQmlScreenDashboard.qml create mode 100644 KelvinDashboardGUI/DapUiQmlScreenHistoryForm.ui.qml create mode 100644 KelvinDashboardGUI/DapUiQmlScreenMainWindow.qml delete mode 100644 KelvinDashboardGUI/DapUiQmlScreenMainWindow.ui.qml create mode 100644 KelvinDashboardGUI/DapUiQmlScreenMainWindowForm.ui.qml rename KelvinDashboardGUI/{DapUiQmlWidgetExchangeOrderButton.ui.qml => DapUiQmlWidgetExchangeOrderButtonForm.ui.qml} (100%) rename KelvinDashboardGUI/{DapUiQmlWidgetExchangeOrderContent.ui.qml => DapUiQmlWidgetExchangeOrderContentForm.ui.qml} (97%) rename KelvinDashboardGUI/{DapUiQmlWidgetExchangeOrder.ui.qml => DapUiQmlWidgetExchangeOrderForm.ui.qml} (78%) rename KelvinDashboardGUI/{DapUiQmlWidgetExchangeOrderTitle.ui.qml => DapUiQmlWidgetExchangeOrderTitleForm.ui.qml} (100%) diff --git a/KelvinDashboardGUI/DapUiQmlScreenDashboard.qml b/KelvinDashboardGUI/DapUiQmlScreenDashboard.qml deleted file mode 100755 index 0d56a0eb4..000000000 --- a/KelvinDashboardGUI/DapUiQmlScreenDashboard.qml +++ /dev/null @@ -1,187 +0,0 @@ -import QtQuick 2.9 -import QtQuick.Controls 1.4 -import QtQuick.Controls 2.2 -import QtQuick.Controls.Styles 1.4 - -Page { - id: dapUiQmlScreenDashboard - title: qsTr("General") - - Rectangle - { - id: rectangleTabsBorder - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.left: parent.left - color: "#B5B5B5" - width: 150 - Rectangle { - id: rectangleTabs - anchors.fill: parent - anchors.leftMargin: 1 - anchors.rightMargin: 1 - - color: "#E1E4E6" - ListView { - id: listViewTabs - anchors.fill: parent - model: listModelTabs - spacing: 3 - - ListModel { - id: listModelTabs - - ListElement { - name: qsTr("Home") - page: "DapUiQmlScreenDialog.qml" - source: "qrc:/Resources/Icons/defaul_icon.png" - } - ListElement { - name: qsTr("Exchange") - page: "DapUiQmlScreenExchangeForm.ui.qml" - source: "qrc:/Resources/Icons/defaul_icon.png" - } - ListElement { - name: qsTr("Settings") - page: "DapQmlScreenAbout.qml" - source: "qrc:/Resources/Icons/defaul_icon.png" - } - ListElement { - name: qsTr("Logs") - page: "DapUiQmlWidgetChainNodeLogs.qml" - source: "qrc:/Resources/Icons/defaul_icon.png" - } - ListElement { - name: qsTr("History") - page: "DapUiQmlScreenHistory.qml" - source: "qrc:/Resources/Icons/defaul_icon.png" - } - ListElement { - name: qsTr("About") - page: "DapQmlScreenAbout.qml" - source: "qrc:/Resources/Icons/defaul_icon.png" - } - } - - - - delegate: - Column { - id: componentTab - height: 148 - Rectangle { - id: componentItem - property bool isPushed: listViewTabs.currentIndex === index - - width: listViewTabs.width - height: 150 - color: "transparent" - Rectangle - { - id: spacerItem1 - height: 25 - anchors.top: parent.top - } - Image - { - id: imageItem - anchors.top: spacerItem1.bottom - source: model.source - height: 60 - width: 60 - anchors.horizontalCenter: parent.horizontalCenter - } - Rectangle - { - id: spacerItem2 - anchors.top: imageItem.bottom - height: 16 - } - Text - { - id: textItemMenu - anchors.top: spacerItem2.bottom - text: qsTr(name) - color: "#505559" - anchors.horizontalCenter: parent.horizontalCenter - font.family: "Roboto" - font.weight: componentItem.isPushed ? Font.Normal : Font.Light - font.pointSize: 16 - } - Rectangle - { - id: spacerItem3 - anchors.top: textItemMenu.bottom - height: 30 - } - MouseArea { - anchors.fill: parent - hoverEnabled: true - onEntered: - { - textItemMenu.font.weight = Font.Normal - if(!componentItem.isPushed) componentItem.color ="#B0B0B5" - } - onExited: - { - textItemMenu.font.weight = Font.Light - if(!componentItem.isPushed) componentItem.color = "transparent" - } - - onClicked: - { - listViewTabs.currentIndex = index - stackViewScreenDashboard.setSource(Qt.resolvedUrl(page)) - } - } - - onIsPushedChanged: { - componentItem.color = (isPushed ? "#D0D3D6" : "transparent"); - } - } - Rectangle - { - id: borderItem - height: 1 - color: "#B5B5B5" - width: parent.width - } - } - } - focus: true - } - } - - Rectangle - { - id: rectangleStatusBar - anchors.left: rectangleTabsBorder.right - anchors.top: parent.top - anchors.right: parent.right - color: "#B5B5B5" - height: 60 - Rectangle - { - anchors.fill: parent - anchors.bottomMargin: 1 - color: "#F2F2F4" - } - } - - Rectangle { - id: mainDashboard - anchors.left: rectangleTabsBorder.right - anchors.top: rectangleStatusBar.bottom - anchors.bottom: parent.bottom - anchors.right: parent.right - border.color: "whitesmoke" - - Loader { - id: stackViewScreenDashboard - clip: true - anchors.fill: parent - source: "DapUiQmlScreenDialog.qml" - } - } -} - diff --git a/KelvinDashboardGUI/DapUiQmlScreenExchangeForm.ui.qml b/KelvinDashboardGUI/DapUiQmlScreenExchangeForm.ui.qml index 6cf2560f0..7e796a587 100644 --- a/KelvinDashboardGUI/DapUiQmlScreenExchangeForm.ui.qml +++ b/KelvinDashboardGUI/DapUiQmlScreenExchangeForm.ui.qml @@ -12,13 +12,20 @@ Page { anchors.bottomMargin: 42 * pt spacing: 68 * pt - DapUiQmlWidgetExchangeOrder { + DapUiQmlWidgetExchangeOrderForm { titleOrder: qsTr("Buy") } - DapUiQmlWidgetExchangeOrder { + DapUiQmlWidgetExchangeOrderForm { titleOrder: qsTr("Sell") } } } + + + +/*##^## Designer { + D{i:0;autoSize:true;height:480;width:640} +} + ##^##*/ diff --git a/KelvinDashboardGUI/DapUiQmlScreenHistory.qml b/KelvinDashboardGUI/DapUiQmlScreenHistory.qml index 71473ee8c..286a6cd3a 100644 --- a/KelvinDashboardGUI/DapUiQmlScreenHistory.qml +++ b/KelvinDashboardGUI/DapUiQmlScreenHistory.qml @@ -5,19 +5,11 @@ import QtQuick.Layouts 1.12 import DapTransactionHistory 1.0 -Page { - ListView { - id: dapListView - anchors.fill: parent - model: dapHistoryModel - delegate: dapDelegate - section.property: "date" - section.criteria: ViewSection.FullString - section.delegate: dapDate - } +DapUiQmlScreenHistoryForm { + id: dapUiQmlScreenHistory Component { - id: dapDate + id: delDate Rectangle { width: dapListView.width height: 30 * pt @@ -36,8 +28,9 @@ Page { } } + Component { - id: dapDelegate + id: delegateD Column { Rectangle { @@ -249,4 +242,11 @@ Page { } } } + + +} + +/*##^## Designer { + D{i:0;autoSize:true;height:480;width:640} } + ##^##*/ diff --git a/KelvinDashboardGUI/DapUiQmlScreenHistoryForm.ui.qml b/KelvinDashboardGUI/DapUiQmlScreenHistoryForm.ui.qml new file mode 100644 index 000000000..816540d0c --- /dev/null +++ b/KelvinDashboardGUI/DapUiQmlScreenHistoryForm.ui.qml @@ -0,0 +1,18 @@ +import QtQuick 2.9 +import QtQml 2.12 +import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.12 + +import DapTransactionHistory 1.0 + +Page { + ListView { + id: dapListView + anchors.fill: parent + model: dapHistoryModel + delegate: delegateD + section.property: "date" + section.criteria: ViewSection.FullString + section.delegate: delDate + } +} diff --git a/KelvinDashboardGUI/DapUiQmlScreenMainWindow.qml b/KelvinDashboardGUI/DapUiQmlScreenMainWindow.qml new file mode 100644 index 000000000..3e3535ac0 --- /dev/null +++ b/KelvinDashboardGUI/DapUiQmlScreenMainWindow.qml @@ -0,0 +1,102 @@ +import QtQuick 2.9 +import QtQuick.Controls 1.4 + +DapUiQmlScreenMainWindowForm { + id: dapQmlScreenMainWindow + + Component{ + id: componentItemMainMenuTab + Column { + id: columnTab + height: 148 + Rectangle { + id: componentItem + property bool isPushed: listViewTabs.currentIndex === index + + width: listViewTabs.width + height: 150 + color: "transparent" + Rectangle + { + id: spacerItem1 + height: 25 + anchors.top: parent.top + } + Image + { + id: imageItem + anchors.top: spacerItem1.bottom + source: model.source + height: 60 + width: 60 + anchors.horizontalCenter: parent.horizontalCenter + } + Rectangle + { + id: spacerItem2 + anchors.top: imageItem.bottom + height: 16 + } + Text + { + id: textItemMenu + anchors.top: spacerItem2.bottom + text: qsTr(name) + color: "#505559" + anchors.horizontalCenter: parent.horizontalCenter + font.family: "Roboto" + font.weight: componentItem.isPushed ? Font.Normal : Font.Light + font.pointSize: 16 + } + Rectangle + { + id: spacerItem3 + anchors.top: textItemMenu.bottom + height: 30 + } + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: + { + textItemMenu.font.weight = Font.Normal + if(!componentItem.isPushed) componentItem.color ="#B0B0B5" + } + onExited: + { + textItemMenu.font.weight = Font.Light + if(!componentItem.isPushed) componentItem.color = "transparent" + } + + onClicked: + { + listViewTabs.currentIndex = index + stackViewScreenDashboard.setSource(Qt.resolvedUrl(page)) + } + } + + onIsPushedChanged: { + componentItem.color = (isPushed ? "#D0D3D6" : "transparent"); + } + } + Rectangle + { + id: borderItem + height: 1 + color: "#B5B5B5" + width: parent.width + } + } + } +} + + + + + + + +/*##^## Designer { + D{i:0;autoSize:true;height:480;width:640} +} + ##^##*/ diff --git a/KelvinDashboardGUI/DapUiQmlScreenMainWindow.ui.qml b/KelvinDashboardGUI/DapUiQmlScreenMainWindow.ui.qml deleted file mode 100644 index 4f6d67ec1..000000000 --- a/KelvinDashboardGUI/DapUiQmlScreenMainWindow.ui.qml +++ /dev/null @@ -1,8 +0,0 @@ -import QtQuick 2.9 -import QtQuick.Controls 1.4 -import QtQuick.Controls 2.2 - -Page { - - title: qsTr("General") -} diff --git a/KelvinDashboardGUI/DapUiQmlScreenMainWindowForm.ui.qml b/KelvinDashboardGUI/DapUiQmlScreenMainWindowForm.ui.qml new file mode 100644 index 000000000..855645840 --- /dev/null +++ b/KelvinDashboardGUI/DapUiQmlScreenMainWindowForm.ui.qml @@ -0,0 +1,117 @@ +import QtQuick 2.9 +import QtQuick.Controls 1.4 +import QtQuick.Controls 2.2 +import QtQuick.Controls.Styles 1.4 + +import KelvinDashboard 1.0 + +Page { + id: dapUiQmlScreenMainWindow + title: qsTr("General") + + property alias listViewTabs: listViewTabs + property alias stackViewScreenDashboard: stackViewScreenDashboard + + + Rectangle + { + id: rectangleTabsBorder + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.left: parent.left + color: "#B5B5B5" + width: 150 + Rectangle { + id: rectangleTabs + anchors.fill: parent + anchors.leftMargin: 1 + anchors.rightMargin: 1 + + color: "#E1E4E6" + ListView { + id: listViewTabs + anchors.fill: parent + model: listModelTabs + spacing: 3 + + ListModel { + id: listModelTabs + + ListElement { + name: qsTr("Dashboard") + page: "DapUiQmlScreenDialog.qml" + source: "qrc:/Resources/Icons/defaul_icon.png" + } + ListElement { + name: qsTr("Exchange") + page: "DapUiQmlScreenExchangeForm.ui.qml" + source: "qrc:/Resources/Icons/defaul_icon.png" + } + ListElement { + name: qsTr("Settings") + page: "DapQmlScreenAbout.qml" + source: "qrc:/Resources/Icons/defaul_icon.png" + } + ListElement { + name: qsTr("Logs") + page: "DapUiQmlWidgetChainNodeLogs.qml" + source: "qrc:/Resources/Icons/defaul_icon.png" + } + ListElement { + name: qsTr("History") + page: "DapUiQmlScreenHistory.qml" + source: "qrc:/Resources/Icons/defaul_icon.png" + } + ListElement { + name: qsTr("About") + page: "DapQmlScreenAbout.qml" + source: "qrc:/Resources/Icons/defaul_icon.png" + } + } + delegate: componentItemMainMenuTab + + } + focus: true + } + } + + Rectangle + { + id: rectangleStatusBar + anchors.left: rectangleTabsBorder.right + anchors.top: parent.top + anchors.right: parent.right + color: "#B5B5B5" + height: 60 + Rectangle + { + anchors.fill: parent + anchors.bottomMargin: 1 + color: "#F2F2F4" + } + } + + Rectangle { + id: mainDashboard + anchors.left: rectangleTabsBorder.right + anchors.top: rectangleStatusBar.bottom + anchors.bottom: parent.bottom + anchors.right: parent.right + border.color: "whitesmoke" + + Loader { + id: stackViewScreenDashboard + clip: true + anchors.fill: parent + source: "DapUiQmlScreenDialog.qml" + } + } +} + + + + +/*##^## Designer { + D{i:0;autoSize:true;height:480;width:640} +} + ##^##*/ diff --git a/KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderButton.ui.qml b/KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderButtonForm.ui.qml similarity index 100% rename from KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderButton.ui.qml rename to KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderButtonForm.ui.qml diff --git a/KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderContent.ui.qml b/KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderContentForm.ui.qml similarity index 97% rename from KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderContent.ui.qml rename to KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderContentForm.ui.qml index 78a5461c4..3fc8fb2bb 100644 --- a/KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderContent.ui.qml +++ b/KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderContentForm.ui.qml @@ -63,7 +63,7 @@ Item { color: currencyTextInput.readOnly ? "#ACACAF" : "#737880" font.family: fontExchange.name font.pixelSize: 12 * pt - text: index === 0 ? currencyName : "USD" + text: index === 0 ? currencyName : qsTr("USD") } } } diff --git a/KelvinDashboardGUI/DapUiQmlWidgetExchangeOrder.ui.qml b/KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderForm.ui.qml similarity index 78% rename from KelvinDashboardGUI/DapUiQmlWidgetExchangeOrder.ui.qml rename to KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderForm.ui.qml index 2a3bdecbb..52ef1c085 100644 --- a/KelvinDashboardGUI/DapUiQmlWidgetExchangeOrder.ui.qml +++ b/KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderForm.ui.qml @@ -5,7 +5,7 @@ import QtQuick.Layouts 1.12 Item { property alias titleOrder: orderTitle.orderText - property string currencyName: "KLVN" + property string currencyName: qsTr("KLVN") property string balance: "0" width: childrenRect.width @@ -18,13 +18,13 @@ Item { ColumnLayout { - DapUiQmlWidgetExchangeOrderTitle { + DapUiQmlWidgetExchangeOrderTitleForm { id: orderTitle orderFont: fontExchange.name } Text { - text: "Balance: " + balance + " " + currencyName + text: qsTr("Balance: ") + balance + " " + currencyName color: "#ACACAF" font.family: fontExchange.name font.pixelSize: 12 * pt @@ -36,7 +36,7 @@ Item { } - DapUiQmlWidgetExchangeOrderContent { + DapUiQmlWidgetExchangeOrderContentForm { contentFont: fontExchange.name } @@ -45,7 +45,7 @@ Item { width: parent.width } - DapUiQmlWidgetExchangeOrderButton { + DapUiQmlWidgetExchangeOrderButtonForm { buttonFont: fontExchange.name buttonText: titleOrder } diff --git a/KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderTitle.ui.qml b/KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderTitleForm.ui.qml similarity index 100% rename from KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderTitle.ui.qml rename to KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderTitleForm.ui.qml diff --git a/KelvinDashboardGUI/main.qml b/KelvinDashboardGUI/main.qml index 5fb41f07e..7a9e4cb62 100755 --- a/KelvinDashboardGUI/main.qml +++ b/KelvinDashboardGUI/main.qml @@ -17,10 +17,10 @@ ApplicationWindow { console.log("Close") window.hide() } - + Connections { target: dapServiceController - + onActivateWindow: { if(window.visibility === Window.Hidden) { window.show() @@ -30,7 +30,7 @@ ApplicationWindow { window.hide() } } - + // onErrorConnect: { // imageNetwork.visible = false // if(imageErrorNetwork.visible) @@ -38,15 +38,15 @@ ApplicationWindow { // else // imageErrorNetwork.visible = true // } - + // onConnectedToService: { // imageNetwork.visible = true // imageErrorNetwork.visible = false // console.log("Connected") // } } - - + + // header: // Column // { @@ -125,7 +125,7 @@ ApplicationWindow { // color: "green" // } // } - + Drawer { id: drawerMenu width: window.width * 0.3 @@ -197,7 +197,7 @@ ApplicationWindow { StackView { id: stackView - initialItem: "DapUiQmlScreenDashboard.qml" + initialItem: "DapUiQmlScreenMainWindow.qml" anchors.fill: parent } } diff --git a/KelvinDashboardGUI/qml.qrc b/KelvinDashboardGUI/qml.qrc index ba29b8fc1..c5fbd286b 100755 --- a/KelvinDashboardGUI/qml.qrc +++ b/KelvinDashboardGUI/qml.qrc @@ -1,8 +1,6 @@ <RCC> <qresource prefix="/"> <file>main.qml</file> - <file>DapUiQmlScreenDashboard.qml</file> - <file>DapUiQmlScreenMainWindow.ui.qml</file> <file>KelvinDashboardGUI.conf</file> <file>DapUiQmlWidgetChainBlockExplorer.ui.qml</file> <file>DapUiQmlWidgetChainExchanges.ui.qml</file> @@ -27,7 +25,6 @@ <file>DapUiQmlWidgetConsoleForm.ui.qml</file> <file>DapUiQmlWidgetConsole.qml</file> <file>DapUiQmlWidgetNodeNetworkExplorer.qml</file> - <file>DapUiQmlScreenHistory.qml</file> <file>Resources/Icons/defaul_icon.png</file> <file>DapUiQmlScreenExchangeForm.ui.qml</file> <file>Resources/Fonts/roboto_black.ttf</file> @@ -42,9 +39,13 @@ <file>Resources/Fonts/roboto_regular.ttf</file> <file>Resources/Fonts/roboto_thin.ttf</file> <file>Resources/Fonts/roboto_thin_italic.ttf</file> - <file>DapUiQmlWidgetExchangeOrder.ui.qml</file> - <file>DapUiQmlWidgetExchangeOrderTitle.ui.qml</file> - <file>DapUiQmlWidgetExchangeOrderContent.ui.qml</file> - <file>DapUiQmlWidgetExchangeOrderButton.ui.qml</file> + <file>DapUiQmlWidgetExchangeOrderForm.ui.qml</file> + <file>DapUiQmlWidgetExchangeOrderTitleForm.ui.qml</file> + <file>DapUiQmlWidgetExchangeOrderContentForm.ui.qml</file> + <file>DapUiQmlWidgetExchangeOrderButtonForm.ui.qml</file> + <file>DapUiQmlScreenHistory.qml</file> + <file>DapUiQmlScreenHistoryForm.ui.qml</file> + <file>DapUiQmlScreenMainWindow.qml</file> + <file>DapUiQmlScreenMainWindowForm.ui.qml</file> </qresource> </RCC> -- GitLab