Merge branch 'dev' of github.com:amnezia-vpn/amnezia-client into fix/drawerTypePositioning
This commit is contained in:
commit
52124b15e8
9 changed files with 138 additions and 57 deletions
|
@ -214,6 +214,20 @@ bool ContainersModel::isAmneziaDnsContainerInstalled(const int serverIndex)
|
||||||
return containers.contains(DockerContainer::Dns);
|
return containers.contains(DockerContainer::Dns);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ContainersModel::isAnyContainerInstalled()
|
||||||
|
{
|
||||||
|
for (int row=0; row < rowCount(); row++) {
|
||||||
|
QModelIndex idx = this->index(row, 0);
|
||||||
|
|
||||||
|
if (this->data(idx, IsInstalledRole).toBool() &&
|
||||||
|
this->data(idx, ServiceTypeRole).toInt() == ServiceType::Vpn) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
QHash<int, QByteArray> ContainersModel::roleNames() const
|
QHash<int, QByteArray> ContainersModel::roleNames() const
|
||||||
{
|
{
|
||||||
QHash<int, QByteArray> roles;
|
QHash<int, QByteArray> roles;
|
||||||
|
|
|
@ -63,7 +63,7 @@ public slots:
|
||||||
bool isAmneziaDnsContainerInstalled();
|
bool isAmneziaDnsContainerInstalled();
|
||||||
bool isAmneziaDnsContainerInstalled(const int serverIndex);
|
bool isAmneziaDnsContainerInstalled(const int serverIndex);
|
||||||
|
|
||||||
// bool isOnlyServicesInstalled(const int serverIndex);
|
bool isAnyContainerInstalled();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QHash<int, QByteArray> roleNames() const override;
|
QHash<int, QByteArray> roleNames() const override;
|
||||||
|
|
|
@ -5,6 +5,7 @@ import QtQuick.Shapes
|
||||||
import Qt5Compat.GraphicalEffects
|
import Qt5Compat.GraphicalEffects
|
||||||
|
|
||||||
import ConnectionState 1.0
|
import ConnectionState 1.0
|
||||||
|
import PageEnum 1.0
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: root
|
id: root
|
||||||
|
@ -137,6 +138,13 @@ Button {
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
if (!ContainersModel.isAnyContainerInstalled()) {
|
||||||
|
ServersModel.currentlyProcessedIndex = ServersModel.getDefaultServerIndex()
|
||||||
|
PageController.goToPage(PageEnum.PageSetupWizardEasy)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (ConnectionController.isConnectionInProgress) {
|
if (ConnectionController.isConnectionInProgress) {
|
||||||
ConnectionController.closeConnection()
|
ConnectionController.closeConnection()
|
||||||
} else if (ConnectionController.isConnected) {
|
} else if (ConnectionController.isConnected) {
|
||||||
|
|
|
@ -123,4 +123,11 @@ RadioButton {
|
||||||
Layout.bottomMargin: 16
|
Layout.bottomMargin: 16
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
enabled: false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,16 +52,12 @@ Drawer {
|
||||||
}
|
}
|
||||||
|
|
||||||
onOpened: {
|
onOpened: {
|
||||||
isOpened = true
|
|
||||||
|
|
||||||
if (needCloseButton) {
|
if (needCloseButton) {
|
||||||
PageController.drawerOpen()
|
PageController.drawerOpen()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClosed: {
|
onClosed: {
|
||||||
isOpened = false
|
|
||||||
|
|
||||||
if (needCloseButton) {
|
if (needCloseButton) {
|
||||||
PageController.drawerClose()
|
PageController.drawerClose()
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,11 @@ Button {
|
||||||
property string imageColor: "#878B91"
|
property string imageColor: "#878B91"
|
||||||
property string disableImageColor: "#2C2D30"
|
property string disableImageColor: "#2C2D30"
|
||||||
|
|
||||||
implicitWidth: 40
|
property int backGroudRadius: 12
|
||||||
implicitHeight: 40
|
property int implicitSize: 40
|
||||||
|
|
||||||
|
implicitWidth: implicitSize
|
||||||
|
implicitHeight: implicitSize
|
||||||
|
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
||||||
|
@ -31,7 +34,7 @@ Button {
|
||||||
id: background
|
id: background
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
radius: 12
|
radius: backGroudRadius
|
||||||
color: {
|
color: {
|
||||||
if (root.enabled) {
|
if (root.enabled) {
|
||||||
if(root.pressed) {
|
if(root.pressed) {
|
||||||
|
|
|
@ -9,71 +9,99 @@ Rectangle {
|
||||||
property alias textArea: textArea
|
property alias textArea: textArea
|
||||||
property alias textAreaText: textArea.text
|
property alias textAreaText: textArea.text
|
||||||
|
|
||||||
|
property string borderHoveredColor: "#494B50"
|
||||||
|
property string borderNormalColor: "#2C2D30"
|
||||||
|
property string borderFocusedColor: "#d7d8db"
|
||||||
|
|
||||||
height: 148
|
height: 148
|
||||||
color: "#1C1D21"
|
color: "#1C1D21"
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: "#2C2D30"
|
border.color: getBorderColor(borderNormalColor)
|
||||||
radius: 16
|
radius: 16
|
||||||
|
|
||||||
FlickableType {
|
MouseArea {
|
||||||
id: fl
|
id: parentMouse
|
||||||
interactive: false
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.IBeamCursor
|
||||||
|
onClicked: textArea.forceActiveFocus()
|
||||||
|
hoverEnabled: true
|
||||||
|
|
||||||
anchors.top: parent.top
|
FlickableType {
|
||||||
anchors.bottom: parent.bottom
|
id: fl
|
||||||
contentHeight: textArea.implicitHeight
|
interactive: false
|
||||||
TextArea {
|
|
||||||
id: textArea
|
|
||||||
|
|
||||||
width: parent.width
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
contentHeight: textArea.implicitHeight
|
||||||
|
TextArea {
|
||||||
|
id: textArea
|
||||||
|
|
||||||
topPadding: 16
|
width: parent.width
|
||||||
leftPadding: 16
|
|
||||||
anchors.topMargin: 16
|
|
||||||
anchors.bottomMargin: 16
|
|
||||||
|
|
||||||
color: "#D7D8DB"
|
topPadding: 16
|
||||||
selectionColor: "#633303"
|
leftPadding: 16
|
||||||
selectedTextColor: "#D7D8DB"
|
anchors.topMargin: 16
|
||||||
placeholderTextColor: "#878B91"
|
anchors.bottomMargin: 16
|
||||||
|
|
||||||
font.pixelSize: 16
|
color: "#D7D8DB"
|
||||||
font.weight: Font.Medium
|
selectionColor: "#633303"
|
||||||
font.family: "PT Root UI VF"
|
selectedTextColor: "#D7D8DB"
|
||||||
|
placeholderTextColor: "#878B91"
|
||||||
|
|
||||||
placeholderText: root.placeholderText
|
font.pixelSize: 16
|
||||||
text: root.text
|
font.weight: Font.Medium
|
||||||
|
font.family: "PT Root UI VF"
|
||||||
|
|
||||||
onCursorVisibleChanged: {
|
placeholderText: root.placeholderText
|
||||||
if (textArea.cursorVisible) {
|
text: root.text
|
||||||
fl.interactive = true
|
|
||||||
} else {
|
onCursorVisibleChanged: {
|
||||||
fl.interactive = false
|
if (textArea.cursorVisible) {
|
||||||
|
fl.interactive = true
|
||||||
|
} else {
|
||||||
|
fl.interactive = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: textAreaMouse
|
||||||
|
anchors.fill: parent
|
||||||
|
acceptedButtons: Qt.RightButton
|
||||||
|
hoverEnabled: true
|
||||||
|
onClicked: {
|
||||||
|
fl.interactive = true
|
||||||
|
contextMenu.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onFocusChanged: {
|
||||||
|
root.border.color = getBorderColor(borderNormalColor)
|
||||||
|
}
|
||||||
|
|
||||||
|
ContextMenuType {
|
||||||
|
id: contextMenu
|
||||||
|
textObj: textArea
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wrapMode: Text.Wrap
|
onPressed: {
|
||||||
|
root.border.color = getBorderColor(borderFocusedColor)
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
onExited: {
|
||||||
anchors.fill: parent
|
root.border.color = getBorderColor(borderNormalColor)
|
||||||
acceptedButtons: Qt.RightButton
|
}
|
||||||
onClicked: {
|
|
||||||
fl.interactive = true
|
|
||||||
contextMenu.open()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ContextMenuType {
|
onEntered: {
|
||||||
id: contextMenu
|
root.border.color = getBorderColor(borderHoveredColor)
|
||||||
textObj: textArea
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo make whole background clickable, with code below we lose ability to select text by mouse
|
|
||||||
// MouseArea {
|
function getBorderColor(noneFocusedColor) {
|
||||||
// anchors.fill: parent
|
return textArea.focus ? root.borderFocusedColor : noneFocusedColor
|
||||||
// cursorShape: Qt.IBeamCursor
|
}
|
||||||
// onClicked: textArea.forceActiveFocus()
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ Item {
|
||||||
|
|
||||||
property string backgroundColor: "#1c1d21"
|
property string backgroundColor: "#1c1d21"
|
||||||
property string backgroundDisabledColor: "transparent"
|
property string backgroundDisabledColor: "transparent"
|
||||||
|
property string bgBorderHoveredColor: "#494B50"
|
||||||
|
|
||||||
implicitWidth: content.implicitWidth
|
implicitWidth: content.implicitWidth
|
||||||
implicitHeight: content.implicitHeight
|
implicitHeight: content.implicitHeight
|
||||||
|
@ -44,7 +45,7 @@ Item {
|
||||||
Layout.preferredHeight: input.implicitHeight
|
Layout.preferredHeight: input.implicitHeight
|
||||||
color: root.enabled ? root.backgroundColor : root.backgroundDisabledColor
|
color: root.enabled ? root.backgroundColor : root.backgroundDisabledColor
|
||||||
radius: 16
|
radius: 16
|
||||||
border.color: textField.focus ? root.borderFocusedColor : root.borderColor
|
border.color: getBackgroundBorderColor(root.borderColor)
|
||||||
border.width: 1
|
border.width: 1
|
||||||
|
|
||||||
Behavior on border.color {
|
Behavior on border.color {
|
||||||
|
@ -102,12 +103,17 @@ Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.RightButton
|
acceptedButtons: Qt.RightButton
|
||||||
onClicked: contextMenu.open()
|
onClicked: contextMenu.open()
|
||||||
|
enabled: true
|
||||||
}
|
}
|
||||||
|
|
||||||
ContextMenuType {
|
ContextMenuType {
|
||||||
id: contextMenu
|
id: contextMenu
|
||||||
textObj: textField
|
textObj: textField
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onFocusChanged: {
|
||||||
|
backgroud.border.color = getBackgroundBorderColor(root.borderColor)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,11 +155,28 @@ Item {
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: root
|
anchors.fill: root
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.IBeamCursor
|
||||||
|
|
||||||
|
hoverEnabled: true
|
||||||
|
|
||||||
onPressed: function(mouse) {
|
onPressed: function(mouse) {
|
||||||
textField.forceActiveFocus()
|
textField.forceActiveFocus()
|
||||||
mouse.accepted = false
|
mouse.accepted = false
|
||||||
|
|
||||||
|
backgroud.border.color = getBackgroundBorderColor(root.borderColor)
|
||||||
|
}
|
||||||
|
|
||||||
|
onEntered: {
|
||||||
|
backgroud.border.color = getBackgroundBorderColor(bgBorderHoveredColor)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onExited: {
|
||||||
|
backgroud.border.color = getBackgroundBorderColor(root.borderColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getBackgroundBorderColor(noneFocusedColor) {
|
||||||
|
return textField.focus ? root.borderFocusedColor : noneFocusedColor
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,6 +183,8 @@ PageType {
|
||||||
textColor: "#D7D8DB"
|
textColor: "#D7D8DB"
|
||||||
borderWidth: 1
|
borderWidth: 1
|
||||||
|
|
||||||
|
visible: ContainersModel.isAnyContainerInstalled()
|
||||||
|
|
||||||
text: qsTr("Set up later")
|
text: qsTr("Set up later")
|
||||||
|
|
||||||
onClicked: function() {
|
onClicked: function() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue