Skip to content

Commit

Permalink
Make UserStatusSelector a dismissible page pushed onto the tray window
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
  • Loading branch information
claucambra committed Jul 22, 2022
1 parent 384530a commit eccd780
Show file tree
Hide file tree
Showing 8 changed files with 781 additions and 778 deletions.
3 changes: 2 additions & 1 deletion resources.qrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<RCC>
<qresource prefix="/qml">
<file>src/gui/UserStatusSelector.qml</file>
<file>src/gui/UserStatusSelectorDialog.qml</file>
<file>src/gui/UserStatusSelectorPage.qml</file>
<file>src/gui/EmojiPicker.qml</file>
<file>src/gui/UserStatusSelectorButton.qml</file>
<file>src/gui/PredefinedStatusButton.qml</file>
<file>src/gui/BasicComboBox.qml</file>
<file>src/gui/ErrorBox.qml</file>
<file>src/gui/tray/Window.qml</file>
<file>src/gui/tray/MainTrayView.qml</file>
<file>src/gui/tray/UserLine.qml</file>
<file>src/gui/tray/HeaderButton.qml</file>
<file>src/gui/tray/SyncStatus.qml</file>
Expand Down
43 changes: 12 additions & 31 deletions src/gui/UserStatusSelector.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,10 @@ import Style 1.0

ColumnLayout {
id: rootLayout
spacing: 0
spacing: Style.standardSpacing
property NC.UserStatusSelectorModel userStatusSelectorModel

Label {
Layout.topMargin: Style.standardSpacing * 2
Layout.leftMargin: Style.standardSpacing
Layout.rightMargin: Style.standardSpacing
Layout.bottomMargin: Style.standardSpacing
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
font.bold: true
text: qsTr("Online status")
Expand All @@ -39,8 +35,6 @@ ColumnLayout {

GridLayout {
id: topButtonsLayout

Layout.margins: Style.standardSpacing
Layout.alignment: Qt.AlignTop
columns: 2
rows: 2
Expand All @@ -62,9 +56,6 @@ ColumnLayout {

Layout.fillWidth: true
implicitWidth: 200 // Pretty much a hack to ensure all the buttons are equal in width
Layout.preferredHeight: topButtonsLayout.maxButtonHeight
onImplicitHeightChanged: topButtonsLayout.updateMaxButtonHeight(implicitHeight)
Component.onCompleted: topButtonsLayout.updateMaxButtonHeight(implicitHeight)
}
UserStatusSelectorButton {
checked: NC.UserStatus.Away === userStatusSelectorModel.onlineStatus
Expand All @@ -76,10 +67,7 @@ ColumnLayout {

Layout.fillWidth: true
implicitWidth: 200 // Pretty much a hack to ensure all the buttons are equal in width
Layout.preferredHeight: topButtonsLayout.maxButtonHeight
onImplicitHeightChanged: topButtonsLayout.updateMaxButtonHeight(implicitHeight)
Component.onCompleted: topButtonsLayout.updateMaxButtonHeight(implicitHeight)


}
UserStatusSelectorButton {
checked: NC.UserStatus.DoNotDisturb === userStatusSelectorModel.onlineStatus
Expand Down Expand Up @@ -114,21 +102,14 @@ ColumnLayout {
}

Label {
Layout.topMargin: Style.standardSpacing * 2
Layout.leftMargin: Style.standardSpacing
Layout.rightMargin: Style.standardSpacing
Layout.bottomMargin: Style.standardSpacing
Layout.topMargin: Style.standardSpacing
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
font.bold: true
text: qsTr("Status message")
color: Style.ncTextColor
}

RowLayout {
Layout.topMargin: Style.standardSpacing
Layout.leftMargin: Style.standardSpacing
Layout.rightMargin: Style.standardSpacing
Layout.bottomMargin: Style.standardSpacing * 2
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true

Expand Down Expand Up @@ -252,8 +233,6 @@ ColumnLayout {
PredefinedStatusButton {
id: control
Layout.fillWidth: true
Layout.leftMargin: Style.standardSpacing
Layout.rightMargin: Style.standardSpacing
internalSpacing: Style.standardSpacing + fieldButton.padding + userStatusMessageTextField.padding

emoji: modelData.icon
Expand All @@ -263,10 +242,7 @@ ColumnLayout {
}

RowLayout {
Layout.topMargin: Style.standardSpacing * 2
Layout.leftMargin: Style.standardSpacing
Layout.rightMargin: Style.standardSpacing
Layout.bottomMargin: Style.standardSpacing
Layout.topMargin: Style.standardSpacing
Layout.alignment: Qt.AlignTop
spacing: Style.standardSpacing

Expand All @@ -288,26 +264,31 @@ ColumnLayout {
}

RowLayout {
Layout.margins: Style.standardSpacing
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop

UserStatusSelectorButton {
Layout.fillWidth: true
primary: true
text: qsTr("Cancel")
onClicked: finished()
}
UserStatusSelectorButton {
Layout.fillWidth: true
primary: true
text: qsTr("Clear status message")
onClicked: userStatusSelectorModel.clearUserStatus()
}
UserStatusSelectorButton {
Layout.fillWidth: true
primary: true
colored: true
Layout.fillWidth: true
text: qsTr("Set status message")
onClicked: userStatusSelectorModel.setUserStatus()
}
}

ErrorBox {
Layout.margins: Style.standardSpacing
Layout.fillWidth: true

visible: userStatusSelectorModel.errorMessage != ""
Expand Down
33 changes: 0 additions & 33 deletions src/gui/UserStatusSelectorDialog.qml

This file was deleted.

44 changes: 44 additions & 0 deletions src/gui/UserStatusSelectorPage.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (C) 2022 by Claudio Cambra <claudio.cambra@nextcloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/

import QtQuick 2.15
import QtQuick.Controls 2.15
import Style 1.0

import com.nextcloud.desktopclient 1.0 as NC

Page {
id: page

signal finished

property NC.UserStatusSelectorModel model: NC.UserStatusSelectorModel {
onFinished: page.finished()
}

property int userIndex
onUserIndexChanged: model.load(userIndex)

padding: Style.standardSpacing * 2

background: Rectangle {
color: Style.backgroundColor
radius: Style.trayWindowRadius
}

contentItem: UserStatusSelector {
id: userStatusSelector
userStatusSelectorModel: model
}
}
Loading

0 comments on commit eccd780

Please sign in to comment.