Skip to content

Commit

Permalink
Refs #2. Updated Session Viewer Widget and general presentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
SBriere committed Apr 10, 2024
1 parent 4891438 commit 7e93323
Show file tree
Hide file tree
Showing 12 changed files with 464 additions and 267 deletions.
76 changes: 54 additions & 22 deletions Frontend/DashboardsViewer/content/App.qml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import QtQuick 6.2
import QtQuick.VirtualKeyboard 6.2
import QtQuick.Controls 6.2
import QtQuick.Layouts

import DashboardsViewer
import "screens"
Expand All @@ -16,6 +16,9 @@ Window {
visible: true
title: "DashboardsViewer"
id: mainWindow

property string contextText: ""

Rectangle{
id: background
anchors.fill: parent
Expand All @@ -41,28 +44,57 @@ Window {
GradientStop { position: 1.0; color: Constants.backgroundColor }
}

//Login username
Text {
id: username
text: "username"
anchors.centerIn: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: "white"
}
RowLayout{
anchors.fill: parent
//Back button
BasicButton {
id: btnBack
text: qsTr("Back")
/*color: "darkred"
hoverColor: "red"*/

visible: stackview.depth > 2

//height: parent.height
onClicked: function () {
stackview.pop()
}
}
Text {
id: txtContext
Layout.leftMargin: 10
text: contextText
visible: stackview.depth > 2 && contextText
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
color: Constants.textAltColor
}

Item{
Layout.fillWidth: true
}

//Login username
Text {
id: username
Layout.rightMargin: 10
text: "username"
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
color: "white"
}

//Logout button
BasicButton {
id: logoutButton
text: qsTr("Logout")
color: "darkred"
hoverColor: "red"


//Logout button
BasicButton {
id: logoutButton
text: "Logout"
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
color: "darkred"
hoverColor: "red"
width: 100
//height: parent.height
onClicked: {
UserClient.disconnect();
onClicked: {
UserClient.disconnect();
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ Item {
else
{
//Insert response directly
response.dataSource = baseDataSource;
myModel.append(response);
//response.dataSource = baseDataSource;
//myModel.append(response);
myModel.clear();
}
modelChanged();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Item {
width: GridView.view.cellWidth - 10
height: mainLayout.implicitHeight + 10 //GridView.view.cellHeight - 10

signal itemClicked(var id, var definition)
signal itemClicked(var id, var name, var definition)
enabled: model.enabled
opacity: enabled ? 1.0 : 0.5
opacity: enabled ? 1.0 : 0.2

states: [
State {
Expand All @@ -32,7 +32,7 @@ Item {
cursorShape: Qt.PointingHandCursor
onClicked: function(){
//console.log("Click! " + model.id + " - " + model.definition);
itemClicked(model.id, model.definition);
itemClicked(model.id, model.name, model.definition);
}
}
Rectangle{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ BaseDelegate {
width: parent ? (parent.interactive ? parent.width - 20 : parent.width) : 0

function getEventIcon(){
if (model.id_session_event_type === undefined)
return "../images/icons/error.png";
switch(id_session_event_type){
case 0: // Error
return "../images/icons/error.png";
Expand Down Expand Up @@ -45,6 +47,8 @@ BaseDelegate {
}

function getEventName(){
if (model.id_session_event_type === undefined)
return qsTr("Error");
switch(id_session_event_type){
case 0: // Error
return qsTr("Error");
Expand Down
9 changes: 5 additions & 4 deletions Frontend/DashboardsViewer/content/screens/Dashboard.qml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Item {
}
}

Text {
/*Text {
id: dashboardText
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
Expand All @@ -73,13 +73,14 @@ Item {
onClicked: function () {
stackview.pop()
}
}
}*/

StackView {
id: dashboardStackView
anchors.top: dashboardText.bottom
anchors.fill: parent
/*anchors.top: dashboardText.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.right: parent.right*/
}
}
10 changes: 7 additions & 3 deletions Frontend/DashboardsViewer/content/screens/DashboardSelector.qml
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ Item {
delegate: DashboardDelegate {
id: siteProjectDelegateSite

onItemClicked: function (id, definition) {
onItemClicked: function (id, name, definition) {
mainWindow.contextText = name;
stackview.push("Dashboard.qml")

// Get the current pushed element (the Dashboard)
Expand Down Expand Up @@ -339,8 +340,9 @@ Item {
delegate: DashboardDelegate {
id: siteProjectDelegateProject

onItemClicked: function (id, definition) {
stackview.push("Dashboard.qml")
onItemClicked: function (id, name, definition) {
mainWindow.contextText = name;
stackview.push("Dashboard.qml");

// Get the current pushed element (the Dashboard)
var currentElement = stackview.currentItem
Expand All @@ -357,6 +359,8 @@ Item {
text: qsTr("Test Mode")
onClicked: function(){
let filename = ":/dashboards/DashboardsViewer/resources/json/TestDashboardv2.json";

mainWindow.contextText = qsTr("TestMode");
stackview.push("Dashboard.qml")

// get current pushed element
Expand Down
25 changes: 23 additions & 2 deletions Frontend/DashboardsViewer/content/ui/BasicDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ Item {
id: baseItem

property string title: ""
property bool showCloseButton: true
property bool showCloseButton: false

property Item stackView: null

default property alias contentItem: mainItem.data
property int contentItemHeight: mainItem.implicitHeight
Expand Down Expand Up @@ -95,7 +97,7 @@ Item {
height: 40
color: "#7da4cf"

ColumnLayout{
RowLayout{
anchors.fill: parent
Text{
id: txtTitle
Expand All @@ -108,6 +110,25 @@ Item {
color: Constants.textColor
font.pixelSize: Constants.largeFontSize
}
Image{
id: imgClose
visible: showCloseButton
source: "../images/icons/x.png"
height: 32
width: height
sourceSize.height: height
sourceSize.width: width
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
MouseArea{
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
if (stackView) {
stackView.pop();
}
}
}
}
}

}
Expand Down
3 changes: 3 additions & 0 deletions Frontend/DashboardsViewer/content/widgets/ButtonWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ BaseWidget {

property color hoverColor: "#047eff"

implicitHeight: control.implicitHeight
implicitWidth: control.implicitWidth + 10

Button {
id: control

Expand Down
10 changes: 10 additions & 0 deletions Frontend/DashboardsViewer/content/widgets/ListViewWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ BaseWidget {
property alias delegate: myListView.delegate
property var dataSource: null

readonly property bool itemSelected: myListView.currentIndex >= 0

Connections{
ignoreUnknownSignals: true
target: dataSource
onModelChanged: function() {
myListView.currentIndex = -1;
}
}

Rectangle{
anchors.fill: parent
color: "#88000000"
Expand Down
Loading

0 comments on commit 7e93323

Please sign in to comment.