Skip to content

Commit

Permalink
Added a better solution for image border
Browse files Browse the repository at this point in the history
  • Loading branch information
Feqzz committed Aug 8, 2020
1 parent 7096b09 commit ac764f1
Showing 1 changed file with 18 additions and 28 deletions.
46 changes: 18 additions & 28 deletions view/session.qml
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,10 @@ Rectangle {
height: focusScreen ? screenGridArea.height : screenGridArea.height/parent.rows
color: "#161637"

Rectangle {
id: borderRectangle
width: parent.width
height: parent.height
anchors.verticalCenter: parent.verticalCenter
}

Image {
id: liveImage
width: parent.width - 2
height: parent.height - 2
width: parent.width - 4
height: parent.height - 4
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
property bool counter: false
Expand All @@ -89,47 +82,44 @@ Rectangle {
source: "image://live/10"
fillMode: Image.PreserveAspectFit
cache: false
onWidthChanged: {
borderRectangle.width = paintedWidth + 6
borderRectangle.height = paintedHeight + 6
}
onHeightChanged: {
borderRectangle.width = paintedWidth + 6
borderRectangle.height = paintedHeight + 6

Rectangle {
id: borderRectangle
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
width: parent.paintedWidth + 4
height: parent.paintedHeight + 4

anchors.margins: -border.width
z: -1
border.width: 4
border.color: "red"
color: "#161637"
}
//onHeightChanged: borderRectangle.height = paintedHeight + 2
//onWindowChanged: console.log("AAAA");

function reload() {
counter = !counter
var screenIndex = focusScreen ? selectedScreenIndex : index
//console.log(screenIndex)
source = "image://live/image?id=" + counter + "&" + screenIndex
//borderRectangle.width = liveImage.paintedWidth + 2
//borderRectangle.height = liveImage.paintedHeight + 2
if (imageHandler.getAudioIsDisabled(index)) {
borderRectangle.color = "#DB504A";
borderRectangle.border.color = "#DB504A";
}
else {
if (imageHandler.getIsTalking(index)) {
borderRectangle.color = "#FFB800"
borderRectangle.border.color = "#FFB800"
}
else {
//borderRectangle.color = "#161637"
borderRectangle.color = Qt.rgba(27/255, 29/255, 54/255, 1)
//QColor(27, 29, 54, 255)
borderRectangle.border.color = Qt.rgba(27/255, 29/255, 54/255, 1)
}
}
//console.log(paintedHeight)
//console.log(paintedWidth)
}

MouseArea {
anchors.fill: parent
onDoubleClicked: {
selectedScreenIndex = index
focusScreen = !focusScreen
//repeaterId.model = 0
repeaterId.model = focusScreen ? 1 : imageHandler.getNumberOfScreens()
}
}
Expand Down

0 comments on commit ac764f1

Please sign in to comment.