Skip to content

Commit

Permalink
Refs #2. Refactored and removed .ui files.
Browse files Browse the repository at this point in the history
  • Loading branch information
SBriere committed Mar 15, 2024
1 parent 5102d64 commit df39bd1
Show file tree
Hide file tree
Showing 6 changed files with 303 additions and 337 deletions.
3 changes: 3 additions & 0 deletions Frontend/DashboardsViewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,7 @@ else()
add_custom_command(TARGET DashboardsViewerApp POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_BINARY_DIR}/qml/OpenTeraLibs ${CMAKE_CURRENT_SOURCE_DIR}/imports/generated/OpenTeraLibs)
add_custom_command(TARGET DashboardsViewerApp POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_BINARY_DIR}/qml/DashboardsViewer ${CMAKE_CURRENT_SOURCE_DIR}/imports/generated/DashboardsViewer)
endif()
2 changes: 0 additions & 2 deletions Frontend/DashboardsViewer/content/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ qt6_add_qml_module(content
App.qml
# Screens
screens/Dashboard.qml
screens/DashboardForm.ui.qml
screens/DashboardSelector.qml
screens/DashboardSelectorForm.ui.qml
screens/Login.qml
# Uis
ui/BasicButton.ui.qml
Expand Down
67 changes: 46 additions & 21 deletions Frontend/DashboardsViewer/content/screens/Dashboard.qml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import QtQuick 2.15
import QtQuick.Controls 2.15

import OpenTeraLibs.UserClient 1.0
import DashboardsViewer.ConfigParser 1.0

DashboardForm {
import DashboardsViewer

id: dashboard
property string definition : ""
Item {
width: 1024
height: 768
anchors.fill: parent
property string definition: ""

signal buttonClicked()
signal buttonClicked

ConfigParser {
id: parser
Expand All @@ -17,35 +21,56 @@ DashboardForm {
function loadDocument() {
console.log("should load document", definition)

var dynamicQML = parser.parseConfigString(definition);
var dynamicQML = parser.parseConfigString(definition)
console.log("dynamicQML", dynamicQML)

if (dynamicQML.length > 0)
{
for (var i = 0; i < dynamicQML.length; i++)
{
if (dynamicQML.length > 0) {
for (var i = 0; i < dynamicQML.length; i++) {

try {
try {
//Create object from dynamicQML
var dynamicObject = Qt.createQmlObject(dynamicQML[i], dashboardStackView);
var dynamicObject = Qt.createQmlObject(dynamicQML[i],
dashboardStackView)

console.log("dynamicObject", dynamicObject)

// Push to stackView
if (dynamicObject)
{
dashboardStackView.push(dynamicObject);
if (dynamicObject) {
dashboardStackView.push(dynamicObject)
}
} catch (e) {
console.log("Error", e)
}
}
}
}

Text {
id: dashboardText
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
text: qsTr("DASHBOARD")
font.pixelSize: 60
height: 60
horizontalAlignment: Text.AlignHCenter
}

}
catch(e) {
console.log("Error", e)
}
}
Button {
id: closeButton
anchors.left: loadButton.right
anchors.top: parent.top
width: 150
height: 60
text: qsTr("Close")
onClicked: function () {
stackview.pop()
}
}

closeButton.onClicked: function() {
stackview.pop();
StackView {
id: dashboardStackView
anchors.top: dashboardText.bottom
anchors.bottom: parent.bottom
width: parent.width
}
}
47 changes: 0 additions & 47 deletions Frontend/DashboardsViewer/content/screens/DashboardForm.ui.qml

This file was deleted.

Loading

0 comments on commit df39bd1

Please sign in to comment.