mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-17 23:56:56 +00:00
Merge branch 'release/congo' into devel
This commit is contained in:
@ -87,7 +87,7 @@ Item {
|
||||
Text { // Status
|
||||
anchors {
|
||||
left : parent.left
|
||||
leftMargin : Style.accounts.leftMargin2
|
||||
leftMargin : viewContent.width/2
|
||||
verticalCenter : parent.verticalCenter
|
||||
}
|
||||
visible: root.numAccounts!=0
|
||||
@ -99,7 +99,7 @@ Item {
|
||||
Text { // Actions
|
||||
anchors {
|
||||
left : parent.left
|
||||
leftMargin : Style.accounts.leftMargin3
|
||||
leftMargin : 5.5*viewContent.width/8
|
||||
verticalCenter : parent.verticalCenter
|
||||
}
|
||||
visible: root.numAccounts!=0
|
||||
|
||||
@ -327,6 +327,7 @@ Window {
|
||||
|
||||
function show() {
|
||||
prefill()
|
||||
description.focus=true
|
||||
root.visible=true
|
||||
}
|
||||
|
||||
|
||||
@ -30,10 +30,12 @@ CheckBox {
|
||||
property color uncheckedColor : Style.main.textInactive
|
||||
property string checkedSymbol : Style.fa.check_square_o
|
||||
property string uncheckedSymbol : Style.fa.square_o
|
||||
property alias symbolPointSize : symbol.font.pointSize
|
||||
background: Rectangle {
|
||||
color: Style.transparent
|
||||
}
|
||||
indicator: Text {
|
||||
id: symbol
|
||||
text : root.checked ? root.checkedSymbol : root.uncheckedSymbol
|
||||
color : root.checked ? root.checkedColor : root.uncheckedColor
|
||||
font {
|
||||
|
||||
@ -123,12 +123,12 @@ Dialog {
|
||||
wrapMode: Text.Wrap
|
||||
text: {
|
||||
switch (go.progressDescription) {
|
||||
case 1: return qsTr("Checking the current version.")
|
||||
case 2: return qsTr("Downloading the update files.")
|
||||
case 3: return qsTr("Verifying the update files.")
|
||||
case 4: return qsTr("Unpacking the update files.")
|
||||
case 5: return qsTr("Starting the update.")
|
||||
case 6: return qsTr("Quitting the application.")
|
||||
case "1": return qsTr("Checking the current version.")
|
||||
case "2": return qsTr("Downloading the update files.")
|
||||
case "3": return qsTr("Verifying the update files.")
|
||||
case "4": return qsTr("Unpacking the update files.")
|
||||
case "5": return qsTr("Starting the update.")
|
||||
case "6": return qsTr("Quitting the application.")
|
||||
default: return ""
|
||||
}
|
||||
}
|
||||
@ -220,7 +220,7 @@ Dialog {
|
||||
function clear() {
|
||||
root.hasError = false
|
||||
go.progress = 0.0
|
||||
go.progressDescription = 0
|
||||
go.progressDescription = "0"
|
||||
}
|
||||
|
||||
function finished(hasError) {
|
||||
|
||||
@ -60,7 +60,7 @@ Row {
|
||||
|
||||
FileDialog {
|
||||
id: pathDialog
|
||||
title: root.title + ":"
|
||||
title: root.title
|
||||
folder: shortcuts.home
|
||||
onAccepted: sanitizePath(pathDialog.fileUrl.toString())
|
||||
selectFolder: true
|
||||
|
||||
@ -138,6 +138,11 @@ Column {
|
||||
}
|
||||
}
|
||||
|
||||
function clear() {
|
||||
inputField.text = ""
|
||||
rightIcon = ""
|
||||
}
|
||||
|
||||
function checkNonEmpty() {
|
||||
if (inputField.text == "") {
|
||||
rightIcon = Style.fa.exclamation_triangle
|
||||
@ -154,6 +159,17 @@ Column {
|
||||
if (root.isPassword) inputField.echoMode = TextInput.Password
|
||||
}
|
||||
|
||||
function checkIsANumber(){
|
||||
if (/^\d+$/.test(inputField.text)) {
|
||||
rightIcon = Style.fa.check_circle
|
||||
return true
|
||||
}
|
||||
rightIcon = Style.fa.exclamation_triangle
|
||||
root.placeholderText = ""
|
||||
inputField.focus = true
|
||||
return false
|
||||
}
|
||||
|
||||
function forceFocus() {
|
||||
inputField.forceActiveFocus()
|
||||
}
|
||||
|
||||
@ -23,9 +23,26 @@ import ProtonUI 1.0
|
||||
Rectangle {
|
||||
id: root
|
||||
color: Style.transparent
|
||||
property alias text: message.text
|
||||
property alias text : message.text
|
||||
property alias checkbox : checkbox
|
||||
property alias buttonQuit : buttonQuit
|
||||
property alias buttonOkay : buttonOkay
|
||||
property alias buttonYes : buttonYes
|
||||
property alias buttonNo : buttonNo
|
||||
property alias buttonRetry : buttonRetry
|
||||
property alias buttonSkip : buttonSkip
|
||||
property alias buttonCancel : buttonCancel
|
||||
property alias msgWidth : backgroundInp.width
|
||||
property string msgID : ""
|
||||
visible: false
|
||||
|
||||
signal clickedOkay()
|
||||
signal clickedYes()
|
||||
signal clickedNo()
|
||||
signal clickedRetry()
|
||||
signal clickedSkip()
|
||||
signal clickedCancel()
|
||||
|
||||
MouseArea { // prevent action below
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
@ -58,14 +75,29 @@ Rectangle {
|
||||
wrapMode: Text.Wrap
|
||||
}
|
||||
|
||||
ButtonRounded {
|
||||
text : qsTr("Okay", "todo")
|
||||
isOpaque : true
|
||||
color_main : Style.dialog.background
|
||||
color_minor : Style.dialog.textBlue
|
||||
onClicked : root.hide()
|
||||
CheckBoxLabel {
|
||||
id: checkbox
|
||||
text: ""
|
||||
checked: false
|
||||
visible: (text != "")
|
||||
textColor : Style.errorDialog.text
|
||||
checkedColor: Style.errorDialog.text
|
||||
uncheckedColor: Style.errorDialog.text
|
||||
anchors.horizontalCenter : parent.horizontalCenter
|
||||
}
|
||||
|
||||
Row {
|
||||
spacing: Style.dialog.spacing
|
||||
anchors.horizontalCenter : parent.horizontalCenter
|
||||
|
||||
ButtonRounded { id : buttonQuit ; text : qsTr ( "Stop & quit", "" ) ; onClicked : root.clickedYes ( ) ; visible : false ; isOpaque : true ; color_main : Style.errorDialog.text ; color_minor : Style.dialog.textBlue ; }
|
||||
ButtonRounded { id : buttonNo ; text : qsTr ( "No" , "Button No" ) ; onClicked : root.clickedNo ( ) ; visible : false ; isOpaque : false ; color_main : Style.errorDialog.text ; color_minor : Style.transparent ; }
|
||||
ButtonRounded { id : buttonYes ; text : qsTr ( "Yes" , "Button Yes" ) ; onClicked : root.clickedYes ( ) ; visible : false ; isOpaque : true ; color_main : Style.errorDialog.text ; color_minor : Style.dialog.textBlue ; }
|
||||
ButtonRounded { id : buttonRetry ; text : qsTr ( "Retry" , "Button Retry" ) ; onClicked : root.clickedRetry ( ) ; visible : false ; isOpaque : false ; color_main : Style.errorDialog.text ; color_minor : Style.transparent ; }
|
||||
ButtonRounded { id : buttonSkip ; text : qsTr ( "Skip" , "Button Skip" ) ; onClicked : root.clickedSkip ( ) ; visible : false ; isOpaque : false ; color_main : Style.errorDialog.text ; color_minor : Style.transparent ; }
|
||||
ButtonRounded { id : buttonCancel ; text : qsTr ( "Cancel" , "Button Cancel" ) ; onClicked : root.clickedCancel ( ) ; visible : false ; isOpaque : true ; color_main : Style.errorDialog.text ; color_minor : Style.dialog.textBlue ; }
|
||||
ButtonRounded { id : buttonOkay ; text : qsTr ( "Okay" , "Button Okay" ) ; onClicked : root.clickedOkay ( ) ; visible : true ; isOpaque : true ; color_main : Style.errorDialog.text ; color_minor : Style.dialog.textBlue ; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,7 +107,16 @@ Rectangle {
|
||||
}
|
||||
|
||||
function hide() {
|
||||
root.state = "Okay"
|
||||
root.visible=false
|
||||
|
||||
root .text = ""
|
||||
checkbox .text = ""
|
||||
|
||||
buttonNo .visible = false
|
||||
buttonYes .visible = false
|
||||
buttonRetry .visible = false
|
||||
buttonSkip .visible = false
|
||||
buttonCancel .visible = false
|
||||
buttonOkay .visible = true
|
||||
}
|
||||
}
|
||||
|
||||
115
internal/frontend/qml/ProtonUI/RoundedRectangle.qml
Normal file
115
internal/frontend/qml/ProtonUI/RoundedRectangle.qml
Normal file
@ -0,0 +1,115 @@
|
||||
// Copyright (c) 2020 Proton Technologies AG
|
||||
//
|
||||
// This file is part of ProtonMail Bridge.
|
||||
//
|
||||
// ProtonMail Bridge 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ProtonMail Bridge 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.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import QtQuick 2.8
|
||||
import ProtonUI 1.0
|
||||
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
color: Style.transparent
|
||||
|
||||
property color fillColor : Style.main.background
|
||||
property color strokeColor : Style.main.line
|
||||
property real strokeWidth : Style.dialog.borderInput
|
||||
property real radiusTopLeft : Style.dialog.radiusButton
|
||||
property real radiusBottomLeft : Style.dialog.radiusButton
|
||||
property real radiusTopRight : Style.dialog.radiusButton
|
||||
property real radiusBottomRight : Style.dialog.radiusButton
|
||||
|
||||
function paint() {
|
||||
canvas.requestPaint()
|
||||
}
|
||||
|
||||
onFillColorChanged : root.paint()
|
||||
onStrokeColorChanged : root.paint()
|
||||
onStrokeWidthChanged : root.paint()
|
||||
onRadiusTopLeftChanged : root.paint()
|
||||
onRadiusBottomLeftChanged : root.paint()
|
||||
onRadiusTopRightChanged : root.paint()
|
||||
onRadiusBottomRightChanged : root.paint()
|
||||
|
||||
|
||||
Canvas {
|
||||
id: canvas
|
||||
anchors.fill: root
|
||||
|
||||
onPaint: {
|
||||
var ctx = getContext("2d")
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
ctx.fillStyle = root.fillColor
|
||||
ctx.strokeStyle = root.strokeColor
|
||||
ctx.lineWidth = root.strokeWidth
|
||||
var dimensions = {
|
||||
x: ctx.lineWidth,
|
||||
y: ctx.lineWidth,
|
||||
w: canvas.width-2*ctx.lineWidth,
|
||||
h: canvas.height-2*ctx.lineWidth,
|
||||
}
|
||||
var radius = {
|
||||
tl: root.radiusTopLeft,
|
||||
tr: root.radiusTopRight,
|
||||
bl: root.radiusBottomLeft,
|
||||
br: root.radiusBottomRight,
|
||||
}
|
||||
|
||||
root.roundRect(
|
||||
ctx,
|
||||
dimensions,
|
||||
radius, true, true
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// adapted from: https://stackoverflow.com/questions/1255512/how-to-draw-a-rounded-rectangle-on-html-canvas/3368118#3368118
|
||||
function roundRect(ctx, dim, radius, fill, stroke) {
|
||||
if (typeof stroke == 'undefined') {
|
||||
stroke = true;
|
||||
}
|
||||
if (typeof radius === 'undefined') {
|
||||
radius = 5;
|
||||
}
|
||||
if (typeof radius === 'number') {
|
||||
radius = {tl: radius, tr: radius, br: radius, bl: radius};
|
||||
} else {
|
||||
var defaultRadius = {tl: 0, tr: 0, br: 0, bl: 0};
|
||||
for (var side in defaultRadius) {
|
||||
radius[side] = radius[side] || defaultRadius[side];
|
||||
}
|
||||
}
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(dim.x + radius.tl, dim.y);
|
||||
ctx.lineTo(dim.x + dim.w - radius.tr, dim.y);
|
||||
ctx.quadraticCurveTo(dim.x + dim.w, dim.y, dim.x + dim.w, dim.y + radius.tr);
|
||||
ctx.lineTo(dim.x + dim.w, dim.y + dim.h - radius.br);
|
||||
ctx.quadraticCurveTo(dim.x + dim.w, dim.y + dim.h, dim.x + dim.w - radius.br, dim.y + dim.h);
|
||||
ctx.lineTo(dim.x + radius.bl, dim.y + dim.h);
|
||||
ctx.quadraticCurveTo(dim.x, dim.y + dim.h, dim.x, dim.y + dim.h - radius.bl);
|
||||
ctx.lineTo(dim.x, dim.y + radius.tl);
|
||||
ctx.quadraticCurveTo(dim.x, dim.y, dim.x + radius.tl, dim.y);
|
||||
ctx.closePath();
|
||||
if (fill) {
|
||||
ctx.fill();
|
||||
}
|
||||
if (stroke) {
|
||||
ctx.stroke();
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: root.paint()
|
||||
}
|
||||
@ -221,6 +221,31 @@ QtObject {
|
||||
property real leftMargin3 : 30 * px
|
||||
}
|
||||
|
||||
property QtObject importing : QtObject {
|
||||
property color rowBackground : dialog.background
|
||||
property color rowLine : dialog.line
|
||||
}
|
||||
|
||||
property QtObject dropDownLight: QtObject {
|
||||
property color background : dialog.background
|
||||
property color text : dialog.text
|
||||
property color inactive : dialog.line
|
||||
property color highlight : dialog.textBlue
|
||||
property color separator : dialog.line
|
||||
property color line : dialog.line
|
||||
property bool labelBold : true
|
||||
}
|
||||
|
||||
property QtObject dropDownDark : QtObject {
|
||||
property color background : dialog.text
|
||||
property color text : dialog.background
|
||||
property color inactive : dialog.line
|
||||
property color highlight : dialog.textBlue
|
||||
property color separator : dialog.line
|
||||
property color line : dialog.line
|
||||
property bool labelBold : true
|
||||
}
|
||||
|
||||
property int okInfoBar : 0
|
||||
property int warnInfoBar : 1
|
||||
property int warnBubbleMessage : 2
|
||||
|
||||
@ -23,7 +23,9 @@ import ProtonUI 1.0
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
height: root.isDarwin ? Style.titleMacOS.height : Style.title.height
|
||||
height: visible ? (
|
||||
root.isDarwin ? Style.titleMacOS.height : Style.title.height
|
||||
) : 0
|
||||
color: "transparent"
|
||||
property bool isDarwin : (go.goos == "darwin")
|
||||
property QtObject window
|
||||
|
||||
@ -23,6 +23,7 @@ InputField 1.0 InputField.qml
|
||||
InstanceExistsWindow 1.0 InstanceExistsWindow.qml
|
||||
LogoHeader 1.0 LogoHeader.qml
|
||||
PopupMessage 1.0 PopupMessage.qml
|
||||
RoundedRectangle 1.0 RoundedRectangle.qml
|
||||
TabButton 1.0 TabButton.qml
|
||||
TabLabels 1.0 TabLabels.qml
|
||||
TextLabel 1.0 TextLabel.qml
|
||||
|
||||
Reference in New Issue
Block a user