Merge pull request 'ButtonTextField, Some Theme Updates and Bug Fixes' (#278) from sarah-ui into master
the build was successful Details

This commit is contained in:
Dan Ballard 2020-04-27 12:28:16 -07:00
commit 427808b646
8 changed files with 93 additions and 40 deletions

View File

@ -144,7 +144,7 @@ ApplicationWindow {
} }
Rectangle { // THE RIGHT PANE WHERE THE MESSAGES AND STUFF GO Rectangle { // THE RIGHT PANE WHERE THE MESSAGES AND STUFF GO
color: "#EEEEFF" color: Theme.backgroundPaneColor
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true

View File

@ -8,12 +8,14 @@ import QtQuick.Controls 1.4
import "../widgets" as Widgets import "../widgets" as Widgets
import "../styles" import "../styles"
import "../theme"
ColumnLayout { // peerSettingsPane ColumnLayout { // peerSettingsPane
id: root id: root
anchors.fill: parent anchors.fill: parent
property bool blocked property bool blocked
Widgets.StackToolbar { Widgets.StackToolbar {
id: toolbar id: toolbar
aux.visible: false aux.visible: false
@ -38,40 +40,34 @@ ColumnLayout { // peerSettingsPane
leftPadding: 10 leftPadding: 10
spacing: 5 spacing: 5
Widgets.ScalingLabel { Widgets.EllipsisLabel {
color: Theme.mainTextColor
text: qsTr("address-label") text: qsTr("address-label")
} }
TextField { Widgets.ButtonTextField {
id: txtOnion id: txtOnion
style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 } //style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 }
readOnly: true readOnly: true
button_text: qsTr("copy-btn")
onClicked: {
//: notification: copied to clipboard
gcd.popup(qsTr("copied-to-clipboard-notification"))
txtOnion.selectAll()
txtOnion.copy()
}
} }
Widgets.Button {
icon: "regular/clipboard"
text: qsTr("copy-btn")
onClicked: { Widgets.EllipsisLabel {
//: notification: copied to clipboard color: Theme.mainTextColor
gcd.popup(qsTr("copied-to-clipboard-notification"))
txtOnion.selectAll()
txtOnion.copy()
}
}
Widgets.ScalingLabel{
text: qsTr("display-name-label") text: qsTr("display-name-label")
} }
TextField {
Widgets.ButtonTextField {
id: txtDisplayName id: txtDisplayName
style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 } button_text: qsTr("save-btn")
}
Widgets.Button {
text: qsTr("save-btn")
onClicked: { onClicked: {
gcd.savePeerSettings(txtOnion.text, txtDisplayName.text) gcd.savePeerSettings(txtOnion.text, txtDisplayName.text)
theStack.title = txtDisplayName.text theStack.title = txtDisplayName.text
@ -80,19 +76,20 @@ ColumnLayout { // peerSettingsPane
} }
Widgets.Button {
icon: "solid/hand-paper"
text: root.blocked ? qsTr("unblock-btn") : qsTr("block-btn")
onClicked: { Widgets.Button {
if (root.blocked) { icon: "solid/hand-paper"
gcd.unblockPeer(txtOnion.text) text: root.blocked ? qsTr("unblock-btn") : qsTr("block-btn")
} else {
gcd.blockPeer(txtOnion.text) onClicked: {
} if (root.blocked) {
root.blocked = !root.blocked gcd.unblockPeer(txtOnion.text)
} } else {
} gcd.blockPeer(txtOnion.text)
}
root.blocked = !root.blocked
}
}
Widgets.Button { Widgets.Button {
icon: "regular/trash-alt" icon: "regular/trash-alt"
@ -118,4 +115,6 @@ ColumnLayout { // peerSettingsPane
root.blocked = blocked root.blocked = blocked
} }
} }
} }

View File

@ -10,10 +10,10 @@ ThemeType {
readonly property color hotPink: "#D01972" readonly property color hotPink: "#D01972"
backgroundMainColor: darkGrayPurple backgroundMainColor: darkGrayPurple
backgroundPaneColor: mauvePurple backgroundPaneColor: deepPurple
mainTextColor: whitePurple mainTextColor: whitePurple
defaultButtonColor: hotPink defaultButtonColor: mauvePurple
defaultButtonActiveColor: pink defaultButtonActiveColor: pink
defaultButtonTextColor: whitePurple defaultButtonTextColor: whitePurple
@ -30,4 +30,5 @@ ThemeType {
portraitContactBadgeColor: hotPink portraitContactBadgeColor: hotPink
portraitContactBadgeTextColor: whitePurple portraitContactBadgeTextColor: whitePurple
portraitProfileBadgeColor: mauvePurple portraitProfileBadgeColor: mauvePurple
dropShadowColor: darkGrayPurple
} }

View File

@ -30,4 +30,5 @@ ThemeType {
portraitContactBadgeColor: hotPink portraitContactBadgeColor: hotPink
portraitContactBadgeTextColor: whitePurple portraitContactBadgeTextColor: whitePurple
portraitProfileBadgeColor: brightPurple portraitProfileBadgeColor: brightPurple
dropShadowColor: purple
} }

View File

@ -11,6 +11,8 @@ Item {
readonly property color defaultButtonActiveColor: theme.defaultButtonActiveColor readonly property color defaultButtonActiveColor: theme.defaultButtonActiveColor
readonly property color defaultButtonTextColor: theme.defaultButtonTextColor readonly property color defaultButtonTextColor: theme.defaultButtonTextColor
readonly property color dropShadowColor: theme.dropShadowColor
readonly property color portraitOnlineBorderColor: theme.portraitOnlineBorderColor readonly property color portraitOnlineBorderColor: theme.portraitOnlineBorderColor
readonly property color portraitOnlineBackgroundColor: theme.portraitOnlineBackgroundColor readonly property color portraitOnlineBackgroundColor: theme.portraitOnlineBackgroundColor
readonly property color portraitOnlineTextColor: theme.portraitOnlineTextColor readonly property color portraitOnlineTextColor: theme.portraitOnlineTextColor

View File

@ -22,6 +22,8 @@ QtObject {
property color portraitContactBadgeColor: "red" property color portraitContactBadgeColor: "red"
property color portraitContactBadgeTextColor: "red" property color portraitContactBadgeTextColor: "red"
property color portraitProfileBadgeColor: "red" property color portraitProfileBadgeColor: "red"
property color dropShadowColor: "black"
// ... more to come // ... more to come

View File

@ -16,12 +16,13 @@ Rectangle {
Layout.minimumHeight: height Layout.minimumHeight: height
Layout.maximumHeight: height Layout.maximumHeight: height
color: mousedown ? Theme.defaultButtonActiveColor : Theme.defaultButtonColor color: mousedown ? Theme.defaultButtonActiveColor : Theme.defaultButtonColor
border.color: Theme.defaultButtonColor border.color: mousedown ? Theme.defaultButtonActiveColor : Theme.defaultButtonColor
border.width: 1 border.width: 1
radius: (height / 2.0) radius: override_radius
antialiasing: true antialiasing: true
property bool checked: false property bool checked: false
property double override_radius: (height / 2.0)
property alias text: buttonText.text property alias text: buttonText.text
property alias font: buttonText.font.family property alias font: buttonText.font.family
property string icon property string icon
@ -36,7 +37,7 @@ Rectangle {
Image { Image {
anchors.left: parent.left anchors.left: parent.left
id: ico id: ico
source: gcd.assetPath + "fontawesome/"+(icon!=""?icon:"regular/window-maximize")+".svg" source: icon!="" ? gcd.assetPath + "fontawesome/"+icon+".svg" : "";
height: button.height / 2 height: button.height / 2
sourceSize.height: button.height / 2 sourceSize.height: button.height / 2
} }

View File

@ -0,0 +1,47 @@
import QtQuick 2.7
import QtQuick.Controls 2.13
import QtQuick.Controls.Styles 1.4
import QtGraphicalEffects 1.12
import "." as Widgets
import "../theme"
// ButtonTextField integrates a text field and a button
TextField {
color: Theme.mainTextColor
font.pointSize: 10 * gcd.themeScale
width: parent.width - 20
property string icon
property string button_text
signal clicked
smooth: true
background: Rectangle {
radius: 10
color: Theme.backgroundMainColor
border.color: Theme.backgroundMainColor
layer.enabled: true
layer.effect: DropShadow {
transparentBorder: true
horizontalOffset: 4
verticalOffset: 4
samples:10
color: Theme.dropShadowColor
}
}
Widgets.Button {
icon: ""
text: button_text
anchors { top: parent.top; right: parent.right }
override_radius: 10
height: parent.height; width: parent.height * 4
onClicked: {
parent.focus = true;
parent.clicked();
}
}
}