Skip to content

Commit

Permalink
Merge pull request #3388 from nextcloud/bugfix/qml-warnings
Browse files Browse the repository at this point in the history
Bugfix/qml warnings
  • Loading branch information
Camila authored Jun 16, 2021
2 parents 73d244c + 7ddc4ca commit 9ea8dd9
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 55 deletions.
27 changes: 8 additions & 19 deletions src/gui/tray/UserLine.qml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ MenuItem {
id: accountControlRowLayout
height: accountButton.height
width: accountButton.width
spacing: 0
spacing: Style.userStatusSpacing
Image {
id: accountAvatar
Layout.leftMargin: 7
Expand Down Expand Up @@ -99,13 +99,7 @@ MenuItem {

Column {
id: accountLabels
spacing: Style.accountLabelsSpacing
Layout.alignment: Qt.AlignLeft
Layout.leftMargin: Style.accountLabelsLayoutMargin
anchors.top: accountAvatar.top
anchors.topMargin: Style.userStatusAnchorsMargin
anchors.left: accountAvatar.right
anchors.leftMargin: Style.accountLabelsAnchorsMargin
Layout.leftMargin: Style.accountLabelsSpacing
Label {
id: accountUser
width: 128
Expand All @@ -116,36 +110,31 @@ MenuItem {
font.bold: true
}
Row {
id: userStatus
visible: model.isConnected &&
model.serverHasUserStatus
anchors.top: accountUser.bottom
width: Style.currentAccountLabelWidth + Style.userStatusEmojiSize
Label {
id: emoji
height: Style.topLinePixelSize
visible: model.statusEmoji !== ""
width: Style.userStatusEmojiSize
text: statusEmoji
topPadding: -Style.accountLabelsSpacing
}
Label {
id: message
anchors.bottom: emoji.bottom
anchors.left: emoji.right
anchors.leftMargin: emoji.width + Style.userStatusSpacing
height: Style.topLinePixelSize
visible: model.statusMessage !== ""
width: Style.currentAccountLabelWidth
text: statusMessage
elide: Text.ElideRight
color: "black"
font.pixelSize: Style.subLinePixelSize
leftPadding: Style.accountLabelsSpacing
}
}
Label {
id: accountServer
anchors.top: userStatus.bottom
anchors.topMargin: message.visible
? message.height + Style.accountServerAnchorsMargin
: Style.userStatusAnchorsMargin
width: Style.currentAccountLabelWidth
height: Style.topLinePixelSize
text: server
elide: Text.ElideRight
color: "black"
Expand Down
65 changes: 31 additions & 34 deletions src/gui/tray/Window.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ Window {

readonly property int maxMenuHeight: Style.trayWindowHeight - Style.trayWindowHeaderHeight - 2 * Style.trayWindowBorderWidth

Accessible.role: Accessible.Application
Accessible.name: qsTr("Nextcloud desktop main dialog")

Component.onCompleted: Systray.forceWindowInit(trayWindow)

// Close tray window when focus is lost (e.g. click somewhere else on the screen)
Expand Down Expand Up @@ -154,9 +151,6 @@ Window {
radius: Style.currentAccountButtonRadius
}

Accessible.role: PopupMenu
Accessible.name: qsTr("Account switcher and settings menu")

onClosed: {
// HACK: reload account Instantiator immediately by restting it - could be done better I guess
// see also onVisibleChanged above
Expand Down Expand Up @@ -359,25 +353,24 @@ Window {

Column {
id: accountLabels
spacing: Style.userStatusSpacing
Layout.alignment: Qt.AlignLeft
spacing: 0
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
Layout.leftMargin: Style.userStatusSpacing
anchors.top: currentAccountAvatar.top
anchors.topMargin: Style.userStatusSpacing
Label {
id: currentAccountUser
Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
width: Style.currentAccountLabelWidth
text: UserModel.currentUser.name
elide: Text.ElideRight
color: Style.ncTextColor
font.pixelSize: Style.topLinePixelSize
font.bold: true
}
Row {
RowLayout {
id: currentUserStatus
visible: UserModel.currentUser.isConnected &&
UserModel.currentUser.serverHasUserStatus
anchors.top: currentAccountUser.bottom
spacing: Style.accountLabelsSpacing
Label {
id: emoji
visible: UserModel.currentUser.statusEmoji !== ""
Expand All @@ -386,9 +379,7 @@ Window {
}
Label {
id: message
anchors.bottom: emoji.bottom
anchors.left: emoji.right
anchors.leftMargin: emoji.width + Style.userStatusSpacing
Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
visible: UserModel.currentUser.statusMessage !== ""
width: Style.currentAccountLabelWidth
text: UserModel.currentUser.statusMessage !== ""
Expand All @@ -413,6 +404,8 @@ Window {
source: "qrc:///client/theme/white/caret-down.svg"
sourceSize.width: Style.accountDropDownCaretSize
sourceSize.height: Style.accountDropDownCaretSize
Accessible.role: Accessible.PopupMenu
Accessible.name: qsTr("Account switcher and settings menu")
}
}
}
Expand All @@ -423,6 +416,7 @@ Window {
spacing: 0
Layout.preferredWidth: Style.trayWindowHeaderHeight
Layout.preferredHeight: Style.trayWindowHeaderHeight
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter

HeaderButton {
id: openLocalFolderButton
Expand All @@ -440,24 +434,27 @@ Window {
radius: width*0.5
z: 1
}
}

Image {
id: folderStateIndicator
visible: UserModel.currentUser.hasLocalFolder
source: UserModel.currentUser.isConnected
? Style.stateOnlineImageSource
: Style.stateOfflineImageSource
cache: false
anchors.top: openLocalFolderButton.verticalCenter
anchors.left: openLocalFolderButton.horizontalCenter

sourceSize.width: Style.folderStateIndicatorSize
sourceSize.height: Style.folderStateIndicatorSize

Accessible.role: Accessible.Indicator
Accessible.name: UserModel.currentUser.isConnected ? qsTr("Connected") : qsTr("Disconnected")
Image {
id: folderStateIndicator
visible: UserModel.currentUser.hasLocalFolder
source: UserModel.currentUser.isConnected
? Style.stateOnlineImageSource
: Style.stateOfflineImageSource
cache: false

anchors.top: openLocalFolderButton.verticalCenter
anchors.left: openLocalFolderButton.horizontalCenter
sourceSize.width: Style.folderStateIndicatorSize
sourceSize.height: Style.folderStateIndicatorSize

Accessible.role: Accessible.Indicator
Accessible.name: UserModel.currentUser.isConnected ? qsTr("Connected") : qsTr("Disconnected")
z: 2
}
}



Accessible.role: Accessible.Button
Accessible.name: qsTr("Open local folder of current account")
Expand Down Expand Up @@ -506,9 +503,6 @@ Window {
radius: 2
}

Accessible.role: Accessible.PopupMenu
Accessible.name: qsTr("Apps menu")

Instantiator {
id: appsMenuInstantiator
model: UserAppsModel
Expand All @@ -532,6 +526,9 @@ Window {
anchors.margins: 1
color: appEntry.hovered ? Style.lightHover : "transparent"
}

Accessible.role: Accessible.PopupMenu
Accessible.name: qsTr("Apps menu")
}

Accessible.role: Accessible.MenuItem
Expand Down
1 change: 0 additions & 1 deletion src/libsync/theme.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class OWNCLOUDSYNC_EXPORT Theme : public QObject
Q_PROPERTY(QString appName READ appName CONSTANT)
Q_PROPERTY(QUrl stateOnlineImageSource READ stateOnlineImageSource CONSTANT)
Q_PROPERTY(QUrl stateOfflineImageSource READ stateOfflineImageSource CONSTANT)
Q_PROPERTY(QUrl stateOnlineImageSource READ stateOnlineImageSource CONSTANT)
Q_PROPERTY(QUrl statusOnlineImageSource READ statusOnlineImageSource CONSTANT)
Q_PROPERTY(QUrl statusDoNotDisturbImageSource READ statusDoNotDisturbImageSource CONSTANT)
Q_PROPERTY(QUrl statusAwayImageSource READ statusAwayImageSource CONSTANT)
Expand Down
3 changes: 2 additions & 1 deletion theme/Style/Style.qml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ QtObject {
property int accountServerAnchorsMargin: 10
property int accountLabelsSpacing: 4
property int accountLabelsAnchorsMargin: 7
property int accountLabelsLayoutMargin: 9
property int accountLabelsLayoutMargin: 12
property int accountLabelsLayoutTopMargin: 10

// Visual behaviour
property bool hoverEffectsEnabled: true
Expand Down

0 comments on commit 9ea8dd9

Please sign in to comment.