Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

streamline top bar UI and controls #75

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions resources/qml/content/AccountList.ui.qml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ScrollView {
spacing: 10

Image {
source: Util.getProfilePicture(modelData.picture, modelData.npub)
source: Util.getProfilePicture(modelData.picture || "", modelData.npub || "")
Layout.preferredWidth: 40
Layout.preferredHeight: 40
Layout.alignment: Qt.AlignVCenter
Expand Down Expand Up @@ -81,7 +81,7 @@ ScrollView {
anchors.left: parent.left
anchors.bottom: parent.verticalCenter
font: Constants.font
text: modelData.displayName
text: modelData.displayName || ""
elide: Text.ElideRight
width: parent.width
color: Material.primaryTextColor
Expand All @@ -90,7 +90,7 @@ ScrollView {
Text {
anchors.left: parent.left
anchors.top: parent.verticalCenter
text: modelData.npub
text: modelData.npub || ""
font.pixelSize: Constants.font.pixelSize * 0.8
elide: Text.ElideRight
width: parent.width
Expand Down
14 changes: 0 additions & 14 deletions resources/qml/content/App.qml
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,4 @@ ApplicationWindow {
}
active: currentScreen === "Home" || currentScreen === "KeyMgmt"
}

Button {
id: themeToggle
anchors.top: parent.top
anchors.right: parent.right
anchors.margins: 10
icon.source: isDarkTheme ? "qrc:/icons/light_mode.svg" : "qrc:/icons/dark_mode.svg"
icon.color: Material.foreground
onClicked: isDarkTheme = !isDarkTheme
flat: true

ToolTip.visible: hovered
ToolTip.text: qsTr("Switch to " + (isDarkTheme ? "Light" : "Dark") + " Mode")
}
}
10 changes: 1 addition & 9 deletions resources/qml/content/MainContent.ui.qml
Original file line number Diff line number Diff line change
Expand Up @@ -335,15 +335,7 @@ Rectangle {
wrapMode: Text.Wrap
color: Material.foreground
}
/*
Text {
Layout.alignment: message ? (message.author.npub == mynpub ? Qt.AlignRight : Qt.AlignLeft) : Qt.AlignLeft
text: message ? message.timestamp : ""
font: Constants.smallFontMedium
color: Material.secondaryTextColor
opacity: 0.9
}
*/

RowLayout {
Layout.fillWidth: true
spacing: Constants.spacing_s
Expand Down
121 changes: 65 additions & 56 deletions resources/qml/content/TopBar.ui.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,80 +2,89 @@ import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Controls.Material 2.15
import QtQuick.Layouts 1.15
import QtGraphicalEffects 1.15

import Futr 1.0

Item {
id: topBar

RoundButton {
id: profileButton
RowLayout {
id: controlsLayout
anchors.right: parent.right
anchors.rightMargin: 100
anchors.verticalCenter: parent.verticalCenter
width: 75
height: 75
flat: true

icon.width: 65
icon.height: 65
icon.color: "transparent"
icon.source: Util.getProfilePicture(mypicture, mynpub)

Material.elevation: 6

onClicked: profileMenu.open()
anchors.rightMargin: 10
spacing: 10

background: Rectangle {
color: "transparent"
Image {
id: profilePicture
Layout.preferredWidth: 60
Layout.preferredHeight: 60
source: Util.getProfilePicture(mypicture, mynpub)
fillMode: Image.PreserveAspectCrop

layer.enabled: true
layer.effect: OpacityMask {
maskSource: Rectangle {
width: profilePicture.width
height: profilePicture.height
radius: width / 2
}
}
}

states: [
State {
name: "pressed"
when: profileButton.pressed
PropertyChanges { target: profileButton; opacity: 0.8 }
}
]
Button {
id: themeToggle
Layout.preferredWidth: 40
Layout.preferredHeight: 40
icon.source: isDarkTheme ? "qrc:/icons/light_mode.svg" : "qrc:/icons/dark_mode.svg"
icon.color: Material.foreground
onClicked: isDarkTheme = !isDarkTheme
flat: true

ToolTip.visible: hovered
ToolTip.text: qsTr("Switch to " + (isDarkTheme ? "Light" : "Dark") + " Mode")
}

Menu {
id: profileMenu
y: profileButton.height
Button {
id: menuButton
Layout.preferredWidth: 40
Layout.preferredHeight: 40
flat: true

icon.source: "qrc:/icons/menu.svg"
icon.width: 24
icon.height: 24

onClicked: profileMenu.open()
}
}

MenuItem {
text: qsTr("My Profile")
onTriggered: {
setCurrentProfile(mynpub)
chatLoader.source = ""
profileLoader.setSource(
"Profile/Profile.ui.qml",
{ "profileData": currentProfile, "npub": mynpub }
)
profileMenu.close()
}
}
Menu {
id: profileMenu
y: menuButton.y + menuButton.height + 10
x: parent.width - width - 10

MenuItem {
text: qsTr("Relay Management")
onTriggered: {
profileMenu.close()
relayMgmtDialog.open()
}
MenuItem {
text: qsTr("Relay Management")
onTriggered: {
profileMenu.close()
relayMgmtDialog.open()
}
}

MenuItem {
text: qsTr("My Keys")
onTriggered: {
profileMenu.close()
showKeysDialog.open()
}
MenuItem {
text: qsTr("My Keys")
onTriggered: {
profileMenu.close()
showKeysDialog.open()
}
}

MenuItem {
text: qsTr("Logout")
onTriggered: {
logout()
}
MenuItem {
text: qsTr("Logout")
onTriggered: {
logout()
}
}
}
Expand Down