feature/custom-drawer (#563)

Replaced all the DrawerType with DrawerType2
This commit is contained in:
Nethius 2024-02-16 15:24:06 +05:00 committed by GitHub
parent fd030a5fd4
commit 074562b141
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 1331 additions and 1319 deletions

View file

@ -160,7 +160,6 @@
<file>ui/qml/Components/SettingsContainersListView.qml</file> <file>ui/qml/Components/SettingsContainersListView.qml</file>
<file>ui/qml/Controls2/TextTypes/ListItemTitleType.qml</file> <file>ui/qml/Controls2/TextTypes/ListItemTitleType.qml</file>
<file>ui/qml/Controls2/DividerType.qml</file> <file>ui/qml/Controls2/DividerType.qml</file>
<file>ui/qml/Controls2/DrawerType.qml</file>
<file>ui/qml/Controls2/StackViewType.qml</file> <file>ui/qml/Controls2/StackViewType.qml</file>
<file>ui/qml/Pages2/PageSettings.qml</file> <file>ui/qml/Pages2/PageSettings.qml</file>
<file>images/controls/amnezia.svg</file> <file>images/controls/amnezia.svg</file>
@ -225,5 +224,6 @@
<file>ui/qml/Pages2/PageShareFullAccess.qml</file> <file>ui/qml/Pages2/PageShareFullAccess.qml</file>
<file>images/controls/close.svg</file> <file>images/controls/close.svg</file>
<file>images/controls/search.svg</file> <file>images/controls/search.svg</file>
<file>ui/qml/Controls2/DrawerType2.qml</file>
</qresource> </qresource>
</RCC> </RCC>

View file

@ -118,36 +118,6 @@ void PageController::showOnStartup()
} }
} }
void PageController::updateDrawerRootPage(PageLoader::PageEnum page)
{
m_drawerLayer = 0;
m_currentRootPage = page;
}
void PageController::goToDrawerRootPage()
{
m_drawerLayer = 0;
emit showTopCloseButton(false);
emit forceCloseDrawer();
}
void PageController::drawerOpen()
{
m_drawerLayer = m_drawerLayer + 1;
emit showTopCloseButton(true);
}
void PageController::drawerClose()
{
m_drawerLayer = m_drawerLayer -1;
if (m_drawerLayer <= 0) {
emit showTopCloseButton(false);
m_drawerLayer = 0;
}
}
bool PageController::isTriggeredByConnectButton() bool PageController::isTriggeredByConnectButton()
{ {
return m_isTriggeredByConnectButton; return m_isTriggeredByConnectButton;

View file

@ -82,11 +82,6 @@ public slots:
void showOnStartup(); void showOnStartup();
void updateDrawerRootPage(PageLoader::PageEnum page);
void goToDrawerRootPage();
void drawerOpen();
void drawerClose();
bool isTriggeredByConnectButton(); bool isTriggeredByConnectButton();
void setTriggeredBtConnectButton(bool trigger); void setTriggeredBtConnectButton(bool trigger);
@ -118,17 +113,11 @@ signals:
void showPassphraseRequestDrawer(); void showPassphraseRequestDrawer();
void passphraseRequestDrawerClosed(QString passphrase); void passphraseRequestDrawerClosed(QString passphrase);
void showTopCloseButton(bool visible);
void forceCloseDrawer();
private: private:
QSharedPointer<ServersModel> m_serversModel; QSharedPointer<ServersModel> m_serversModel;
std::shared_ptr<Settings> m_settings; std::shared_ptr<Settings> m_settings;
PageLoader::PageEnum m_currentRootPage;
int m_drawerLayer;
bool m_isTriggeredByConnectButton; bool m_isTriggeredByConnectButton;
}; };

View file

@ -8,18 +8,24 @@ import "../Controls2"
import "../Controls2/TextTypes" import "../Controls2/TextTypes"
import "../Config" import "../Config"
DrawerType { DrawerType2 {
id: root id: root
width: parent.width width: parent.width
height: parent.height * 0.4375 height: parent.height
expandedContent: ColumnLayout {
id: content
ColumnLayout {
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
spacing: 0 spacing: 0
Component.onCompleted: {
root.expandedHeight = content.implicitHeight + 32
}
Header2Type { Header2Type {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 24 Layout.topMargin: 24
@ -40,7 +46,7 @@ DrawerType {
clickedFunction: function() { clickedFunction: function() {
PageController.goToPage(PageEnum.PageSetupWizardCredentials) PageController.goToPage(PageEnum.PageSetupWizardCredentials)
root.visible = false root.close()
} }
} }
@ -54,7 +60,7 @@ DrawerType {
clickedFunction: function() { clickedFunction: function() {
PageController.goToPage(PageEnum.PageSetupWizardConfigSource) PageController.goToPage(PageEnum.PageSetupWizardConfigSource)
root.visible = false root.close()
} }
} }

View file

@ -60,7 +60,7 @@ ListView {
} }
if (checked) { if (checked) {
containersDropDown.menuVisible = false containersDropDown.close()
ServersModel.setDefaultContainer(ServersModel.defaultIndex, proxyContainersModel.mapToSource(index)) ServersModel.setDefaultContainer(ServersModel.defaultIndex, proxyContainersModel.mapToSource(index))
} else { } else {
if (!isSupported && isInstalled) { if (!isSupported && isInstalled) {
@ -71,7 +71,7 @@ ListView {
ContainersModel.setCurrentlyProcessedContainerIndex(proxyContainersModel.mapToSource(index)) ContainersModel.setCurrentlyProcessedContainerIndex(proxyContainersModel.mapToSource(index))
InstallController.setShouldCreateServer(false) InstallController.setShouldCreateServer(false)
PageController.goToPage(PageEnum.PageSetupWizardProtocolSettings) PageController.goToPage(PageEnum.PageSetupWizardProtocolSettings)
containersDropDown.menuVisible = false containersDropDown.close()
} }
} }

View file

@ -5,7 +5,7 @@ import QtQuick.Layouts
import "../Controls2" import "../Controls2"
import "../Controls2/TextTypes" import "../Controls2/TextTypes"
DrawerType { DrawerType2 {
id: root id: root
property string headerText property string headerText
@ -16,23 +16,24 @@ DrawerType {
property var yesButtonFunction property var yesButtonFunction
property var noButtonFunction property var noButtonFunction
width: parent.width expandedContent: ColumnLayout {
height: content.implicitHeight + 32
ColumnLayout {
id: content id: content
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.topMargin: 16
anchors.rightMargin: 16
anchors.leftMargin: 16
spacing: 8 spacing: 8
onImplicitHeightChanged: {
root.expandedHeight = content.implicitHeight + 32
}
Header2TextType { Header2TextType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 16
Layout.rightMargin: 16
Layout.leftMargin: 16
text: headerText text: headerText
} }
@ -40,6 +41,8 @@ DrawerType {
ParagraphTextType { ParagraphTextType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 8 Layout.topMargin: 8
Layout.rightMargin: 16
Layout.leftMargin: 16
text: descriptionText text: descriptionText
} }
@ -47,6 +50,8 @@ DrawerType {
BasicButtonType { BasicButtonType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 16 Layout.topMargin: 16
Layout.rightMargin: 16
Layout.leftMargin: 16
text: yesButtonText text: yesButtonText
@ -59,6 +64,8 @@ DrawerType {
BasicButtonType { BasicButtonType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.rightMargin: 16
Layout.leftMargin: 16
defaultColor: "transparent" defaultColor: "transparent"
hoveredColor: Qt.rgba(1, 1, 1, 0.08) hoveredColor: Qt.rgba(1, 1, 1, 0.08)

View file

@ -5,11 +5,17 @@ import QtQuick.Layouts
import "../Controls2" import "../Controls2"
import "../Controls2/TextTypes" import "../Controls2/TextTypes"
DrawerType { DrawerType2 {
id: root id: root
width: parent.width expandedContent: Item {
height: parent.height * 0.9 id: container
implicitHeight: root.height * 0.9
Component.onCompleted: {
root.expandedHeight = container.implicitHeight
}
ColumnLayout { ColumnLayout {
id: backButton id: backButton
@ -135,4 +141,5 @@ DrawerType {
} }
} }
} }
}
} }

View file

@ -16,19 +16,18 @@ import "../Controls2/TextTypes"
import "../Config" import "../Config"
import "../Components" import "../Components"
DrawerType { DrawerType2 {
id: root id: root
property alias headerText: header.headerText property string headerText
property alias configContentHeaderText: configContentHeader.headerText property string configContentHeaderText
property alias contentVisible: content.visible property string contentVisible
property string configExtension: ".vpn" property string configExtension: ".vpn"
property string configCaption: qsTr("Save AmneziaVPN config") property string configCaption: qsTr("Save AmneziaVPN config")
property string configFileName: "amnezia_config" property string configFileName: "amnezia_config"
width: parent.width expandedHeight: parent.height * 0.9
height: parent.height * 0.9
onClosed: { onClosed: {
configExtension = ".vpn" configExtension = ".vpn"
@ -36,8 +35,8 @@ DrawerType {
configFileName = "amnezia_config" configFileName = "amnezia_config"
} }
Item { expandedContent: Item {
anchors.fill: parent implicitHeight: root.expandedHeight
Header2Type { Header2Type {
id: header id: header
@ -47,6 +46,8 @@ DrawerType {
anchors.topMargin: 20 anchors.topMargin: 20
anchors.leftMargin: 16 anchors.leftMargin: 16
anchors.rightMargin: 16 anchors.rightMargin: 16
headerText: root.headerText
} }
FlickableType { FlickableType {
@ -64,6 +65,8 @@ DrawerType {
anchors.leftMargin: 16 anchors.leftMargin: 16
anchors.rightMargin: 16 anchors.rightMargin: 16
visible: root.contentVisible
BasicButtonType { BasicButtonType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 16 Layout.topMargin: 16
@ -91,6 +94,7 @@ DrawerType {
} }
BasicButtonType { BasicButtonType {
id: copyConfigTextButton
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 8 Layout.topMargin: 8
@ -103,20 +107,14 @@ DrawerType {
text: qsTr("Copy") text: qsTr("Copy")
imageSource: "qrc:/images/controls/copy.svg" imageSource: "qrc:/images/controls/copy.svg"
onClicked: {
configText.selectAll()
configText.copy()
configText.select(0, 0)
PageController.showNotificationMessage(qsTr("Copied"))
}
} }
BasicButtonType { BasicButtonType {
id: copyNativeConfigStringButton
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 8 Layout.topMargin: 8
visible: nativeConfigString.text !== "" visible: false
defaultColor: "transparent" defaultColor: "transparent"
hoveredColor: Qt.rgba(1, 1, 1, 0.08) hoveredColor: Qt.rgba(1, 1, 1, 0.08)
@ -127,13 +125,6 @@ DrawerType {
text: qsTr("Copy config string") text: qsTr("Copy config string")
imageSource: "qrc:/images/controls/copy.svg" imageSource: "qrc:/images/controls/copy.svg"
onClicked: {
nativeConfigString.selectAll()
nativeConfigString.copy()
nativeConfigString.select(0, 0)
PageController.showNotificationMessage(qsTr("Copied"))
}
} }
BasicButtonType { BasicButtonType {
@ -150,15 +141,42 @@ DrawerType {
text: qsTr("Show connection settings") text: qsTr("Show connection settings")
onClicked: { onClicked: {
configContentDrawer.visible = true configContentDrawer.open()
} }
} }
DrawerType { DrawerType2 {
id: configContentDrawer id: configContentDrawer
width: parent.width parent: root.parent
height: parent.height * 0.9
anchors.fill: parent
expandedHeight: parent.height * 0.9
expandedContent: Item {
id: configContentContainer
implicitHeight: configContentDrawer.expandedHeight
Connections {
target: copyNativeConfigStringButton
function onClicked() {
nativeConfigString.selectAll()
nativeConfigString.copy()
nativeConfigString.select(0, 0)
PageController.showNotificationMessage(qsTr("Copied"))
}
}
Connections {
target: copyConfigTextButton
function onClicked() {
configText.selectAll()
configText.copy()
configText.select(0, 0)
PageController.showNotificationMessage(qsTr("Copied"))
}
}
BackButtonType { BackButtonType {
id: backButton id: backButton
@ -169,7 +187,7 @@ DrawerType {
anchors.topMargin: 16 anchors.topMargin: 16
backButtonFunction: function() { backButtonFunction: function() {
configContentDrawer.visible = false configContentDrawer.open()
} }
} }
@ -191,12 +209,18 @@ DrawerType {
id: configContentHeader id: configContentHeader
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 16 Layout.topMargin: 16
headerText: root.configContentHeaderText
} }
TextField { TextField {
id: nativeConfigString id: nativeConfigString
visible: false visible: false
text: ExportController.nativeConfigString text: ExportController.nativeConfigString
onTextChanged: {
copyNativeConfigStringButton.visible = nativeConfigString.text !== ""
}
} }
TextArea { TextArea {
@ -231,6 +255,7 @@ DrawerType {
} }
} }
} }
}
Rectangle { Rectangle {
Layout.fillWidth: true Layout.fillWidth: true

View file

@ -1,84 +0,0 @@
import QtQuick
import QtQuick.Controls
import "../Config"
Drawer {
id: drawer
property bool needCloseButton: true
Connections {
target: PageController
function onForceCloseDrawer() {
visible = false
}
}
edge: Qt.BottomEdge
clip: true
modal: true
dragMargin: -10
enter: Transition {
SmoothedAnimation {
velocity: 4
}
}
exit: Transition {
SmoothedAnimation {
velocity: 4
}
}
background: Rectangle {
anchors.fill: parent
anchors.bottomMargin: -radius
radius: 16
color: "#1C1D21"
border.color: "#2C2D30"
border.width: 1
Rectangle {
visible: GC.isMobile()
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: 10
width: 20
height: 2
color: "#2C2D30"
}
}
Overlay.modal: Rectangle {
color: Qt.rgba(14/255, 14/255, 17/255, 0.8)
}
onAboutToShow: {
if (PageController.getInitialPageNavigationBarColor() !== 0xFF1C1D21) {
PageController.updateNavigationBarColor(0xFF1C1D21)
}
}
onOpened: {
if (needCloseButton) {
PageController.drawerOpen()
}
}
onClosed: {
if (needCloseButton) {
PageController.drawerClose()
}
var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor()
if (initialPageNavigationBarColor !== 0xFF1C1D21) {
PageController.updateNavigationBarColor(initialPageNavigationBarColor)
}
}
}

View file

@ -0,0 +1,241 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import "TextTypes"
Item {
id: root
readonly property string drawerExpanded: "expanded"
readonly property string drawerCollapsed: "collapsed"
readonly property bool isOpened: drawerContent.state === root.drawerExpanded || (drawerContent.state === root.drawerCollapsed && dragArea.drag.active === true)
readonly property bool isClosed: drawerContent.state === root.drawerCollapsed && dragArea.drag.active === false
readonly property bool isExpanded: drawerContent.state === root.drawerExpanded
readonly property bool isCollapsed: drawerContent.state === root.drawerCollapsed
property Component collapsedContent
property Component expandedContent
property string defaultColor: "#1C1D21"
property string borderColor: "#2C2D30"
property real expandedHeight
property real collapsedHeight: 0
signal entered
signal exited
signal pressed(bool pressed, bool entered)
signal aboutToHide
signal aboutToShow
signal close
signal open
signal closed
signal opened
Connections {
target: root
function onClose() {
if (isCollapsed) {
return
}
aboutToHide()
drawerContent.state = root.drawerCollapsed
closed()
}
function onOpen() {
if (isExpanded) {
return
}
aboutToShow()
drawerContent.state = root.drawerExpanded
opened()
}
}
/** Set once based on first implicit height change once all children are layed out */
Component.onCompleted: {
if (root.isCollapsed && root.collapsedHeight == 0) {
root.collapsedHeight = drawerContent.implicitHeight
}
}
Rectangle {
id: background
anchors.fill: parent
color: root.isCollapsed ? "transparent" : Qt.rgba(14/255, 14/255, 17/255, 0.8)
Behavior on color {
PropertyAnimation { duration: 200 }
}
}
MouseArea {
id: emptyArea
anchors.fill: parent
enabled: root.isExpanded
onClicked: {
root.close()
}
}
MouseArea {
id: dragArea
anchors.fill: drawerContentBackground
cursorShape: root.isCollapsed ? Qt.PointingHandCursor : Qt.ArrowCursor
hoverEnabled: true
enabled: drawerContent.implicitHeight > 0
drag.target: drawerContent
drag.axis: Drag.YAxis
drag.maximumY: root.height - root.collapsedHeight
drag.minimumY: root.height - root.expandedHeight
/** If drag area is released at any point other than min or max y, transition to the other state */
onReleased: {
if (root.isCollapsed && drawerContent.y < dragArea.drag.maximumY) {
root.open()
return
}
if (root.isExpanded && drawerContent.y > dragArea.drag.minimumY) {
root.close()
return
}
}
onEntered: {
root.entered()
}
onExited: {
root.exited()
}
onPressedChanged: {
root.pressed(pressed, entered)
}
onClicked: {
if (root.isCollapsed) {
root.open()
}
}
}
Rectangle {
id: drawerContentBackground
anchors { left: drawerContent.left; right: drawerContent.right; top: drawerContent.top }
height: root.height
radius: 16
color: root.defaultColor
border.color: root.borderColor
border.width: 1
Rectangle {
width: parent.radius
height: parent.radius
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
color: parent.color
}
}
Item {
id: drawerContent
Drag.active: dragArea.drag.active
anchors.right: root.right
anchors.left: root.left
y: root.height - drawerContent.height
state: root.drawerCollapsed
implicitHeight: root.isCollapsed ? collapsedLoader.implicitHeight : expandedLoader.implicitHeight
onStateChanged: {
if (root.isCollapsed) {
var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor()
if (initialPageNavigationBarColor !== 0xFF1C1D21) {
PageController.updateNavigationBarColor(initialPageNavigationBarColor)
}
return
}
if (root.isExpanded) {
if (PageController.getInitialPageNavigationBarColor() !== 0xFF1C1D21) {
PageController.updateNavigationBarColor(0xFF1C1D21)
}
return
}
}
states: [
State {
name: root.drawerCollapsed
PropertyChanges {
target: drawerContent
y: root.height - root.collapsedHeight
}
},
State {
name: root.drawerExpanded
PropertyChanges {
target: drawerContent
y: dragArea.drag.minimumY
}
}
]
transitions: [
Transition {
from: root.drawerCollapsed
to: root.drawerExpanded
PropertyAnimation {
target: drawerContent
properties: "y"
duration: 200
}
},
Transition {
from: root.drawerExpanded
to: root.drawerCollapsed
PropertyAnimation {
target: drawerContent
properties: "y"
duration: 200
}
}
]
Loader {
id: collapsedLoader
visible: root.isCollapsed
sourceComponent: root.collapsedContent
anchors.right: parent.right
anchors.left: parent.left
}
Loader {
id: expandedLoader
visible: root.isExpanded
sourceComponent: root.expandedContent
anchors.right: parent.right
anchors.left: parent.left
}
}
}

View file

@ -36,19 +36,23 @@ Item {
property int rootButtonTextBottomMargin: 16 property int rootButtonTextBottomMargin: 16
property real drawerHeight: 0.9 property real drawerHeight: 0.9
property Item drawerParent
property Component listView property Component listView
property alias menuVisible: menu.visible signal open
signal close
implicitWidth: rootButtonContent.implicitWidth implicitWidth: rootButtonContent.implicitWidth
implicitHeight: rootButtonContent.implicitHeight implicitHeight: rootButtonContent.implicitHeight
onMenuVisibleChanged: { onOpen: {
if (menuVisible) { menu.open()
rootButtonBackground.border.color = rootButtonPressedBorderColor rootButtonBackground.border.color = rootButtonPressedBorderColor
} else {
rootButtonBackground.border.color = rootButtonDefaultBorderColor
} }
onClose: {
menu.close()
rootButtonBackground.border.color = rootButtonDefaultBorderColor
} }
onEnabledChanged: { onEnabledChanged: {
@ -133,21 +137,21 @@ Item {
hoverEnabled: root.enabled ? true : false hoverEnabled: root.enabled ? true : false
onEntered: { onEntered: {
if (menu.visible === false) { if (menu.isClosed) {
rootButtonBackground.border.color = rootButtonHoveredBorderColor rootButtonBackground.border.color = rootButtonHoveredBorderColor
rootButtonBackground.color = rootButtonBackgroundHoveredColor rootButtonBackground.color = rootButtonBackgroundHoveredColor
} }
} }
onExited: { onExited: {
if (menu.visible === false) { if (menu.isClosed) {
rootButtonBackground.border.color = rootButtonDefaultBorderColor rootButtonBackground.border.color = rootButtonDefaultBorderColor
rootButtonBackground.color = rootButtonBackgroundColor rootButtonBackground.color = rootButtonBackgroundColor
} }
} }
onPressed: { onPressed: {
if (menu.visible === false) { if (menu.isClosed) {
rootButtonBackground.color = pressed ? rootButtonBackgroundPressedColor : entered ? rootButtonHoveredBorderColor : rootButtonDefaultBorderColor rootButtonBackground.color = pressed ? rootButtonBackgroundPressedColor : entered ? rootButtonHoveredBorderColor : rootButtonDefaultBorderColor
} }
} }
@ -156,16 +160,23 @@ Item {
if (rootButtonClickedFunction && typeof rootButtonClickedFunction === "function") { if (rootButtonClickedFunction && typeof rootButtonClickedFunction === "function") {
rootButtonClickedFunction() rootButtonClickedFunction()
} else { } else {
menu.visible = true menu.open()
} }
} }
} }
DrawerType { DrawerType2 {
id: menu id: menu
width: parent.width parent: drawerParent
height: parent.height * drawerHeight
anchors.fill: parent
expandedHeight: drawerParent.height * drawerHeight
expandedContent: Item {
id: container
implicitHeight: menu.expandedHeight
ColumnLayout { ColumnLayout {
id: header id: header
@ -178,7 +189,7 @@ Item {
BackButtonType { BackButtonType {
backButtonImage: root.headerBackButtonImage backButtonImage: root.headerBackButtonImage
backButtonFunction: function() { backButtonFunction: function() {
root.menuVisible = false menu.close()
} }
} }
} }
@ -214,4 +225,5 @@ Item {
} }
} }
} }
}
} }

View file

@ -18,199 +18,38 @@ import "../Components"
PageType { PageType {
id: root id: root
property string defaultColor: "#1C1D21"
property string borderColor: "#2C2D30"
Connections { Connections {
target: PageController target: PageController
function onRestorePageHomeState(isContainerInstalled) { function onRestorePageHomeState(isContainerInstalled) {
buttonContent.state = "expanded" drawer.open()
if (isContainerInstalled) { if (isContainerInstalled) {
containersDropDown.rootButtonClickedFunction() containersDropDown.rootButtonClickedFunction()
} }
} }
function onForceCloseDrawer() {
buttonContent.state = "collapsed"
}
}
MouseArea {
anchors.fill: parent
enabled: buttonContent.state === "expanded"
onClicked: {
buttonContent.state = "collapsed"
}
} }
Item { Item {
anchors.fill: parent anchors.fill: parent
anchors.bottomMargin: buttonContent.collapsedHeight anchors.bottomMargin: drawer.collapsedHeight
ConnectButton { ConnectButton {
anchors.centerIn: parent anchors.centerIn: parent
} }
} }
MouseArea {
id: dragArea
anchors.fill: buttonBackground DrawerType2 {
cursorShape: buttonContent.state === "collapsed" ? Qt.PointingHandCursor : Qt.ArrowCursor id: drawer
hoverEnabled: true anchors.fill: parent
drag.target: buttonContent
drag.axis: Drag.YAxis
drag.maximumY: root.height - buttonContent.collapsedHeight
drag.minimumY: root.height - root.height * 0.9
/** If drag area is released at any point other than min or max y, transition to the other state */
onReleased: {
if (buttonContent.state === "collapsed" && buttonContent.y < dragArea.drag.maximumY) {
buttonContent.state = "expanded"
return
}
if (buttonContent.state === "expanded" && buttonContent.y > dragArea.drag.minimumY) {
buttonContent.state = "collapsed"
return
}
}
onEntered: {
collapsedButtonChevron.backgroundColor = collapsedButtonChevron.hoveredColor
collapsedButtonHeader.opacity = 0.8
}
onExited: {
collapsedButtonChevron.backgroundColor = collapsedButtonChevron.defaultColor
collapsedButtonHeader.opacity = 1
}
onPressedChanged: {
collapsedButtonChevron.backgroundColor = pressed ? collapsedButtonChevron.pressedColor : entered ? collapsedButtonChevron.hoveredColor : collapsedButtonChevron.defaultColor
collapsedButtonHeader.opacity = 0.7
}
onClicked: {
if (buttonContent.state === "collapsed") {
buttonContent.state = "expanded"
}
}
}
Rectangle {
id: buttonBackground
anchors { left: buttonContent.left; right: buttonContent.right; top: buttonContent.top }
height: root.height
radius: 16
color: root.defaultColor
border.color: root.borderColor
border.width: 1
Rectangle {
width: parent.radius
height: parent.radius
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
color: parent.color
}
}
ColumnLayout {
id: buttonContent
/** Initial height of button content */
property int collapsedHeight: 0
/** True when expanded objects should be visible */
property bool expandedVisibility: buttonContent.state === "expanded" || (buttonContent.state === "collapsed" && dragArea.drag.active === true)
/** True when collapsed objects should be visible */
property bool collapsedVisibility: buttonContent.state === "collapsed" && dragArea.drag.active === false
Drag.active: dragArea.drag.active
anchors.right: root.right
anchors.left: root.left
y: root.height - buttonContent.height
Component.onCompleted: {
buttonContent.state = "collapsed"
}
/** Set once based on first implicit height change once all children are layed out */
onImplicitHeightChanged: {
if (buttonContent.state === "collapsed" && collapsedHeight == 0) {
collapsedHeight = implicitHeight
}
}
onStateChanged: {
if (buttonContent.state === "collapsed") {
var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor()
if (initialPageNavigationBarColor !== 0xFF1C1D21) {
PageController.updateNavigationBarColor(initialPageNavigationBarColor)
}
PageController.drawerClose()
return
}
if (buttonContent.state === "expanded") {
if (PageController.getInitialPageNavigationBarColor() !== 0xFF1C1D21) {
PageController.updateNavigationBarColor(0xFF1C1D21)
}
PageController.drawerOpen()
return
}
}
/** Two states of buttonContent, great place to add any future animations for the drawer */
states: [
State {
name: "collapsed"
PropertyChanges {
target: buttonContent
y: root.height - collapsedHeight
}
},
State {
name: "expanded"
PropertyChanges {
target: buttonContent
y: dragArea.drag.minimumY
}
}
]
transitions: [
Transition {
from: "collapsed"
to: "expanded"
PropertyAnimation {
target: buttonContent
properties: "y"
duration: 200
}
},
Transition {
from: "expanded"
to: "collapsed"
PropertyAnimation {
target: buttonContent
properties: "y"
duration: 200
}
}
]
collapsedContent: ColumnLayout {
DividerType { DividerType {
Layout.topMargin: 10 Layout.topMargin: 10
Layout.fillWidth: false Layout.fillWidth: false
Layout.preferredWidth: 20 Layout.preferredWidth: 20
Layout.preferredHeight: 2 Layout.preferredHeight: 2
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
visible: (buttonContent.collapsedVisibility || buttonContent.expandedVisibility)
} }
RowLayout { RowLayout {
@ -218,13 +57,30 @@ PageType {
Layout.leftMargin: 24 Layout.leftMargin: 24
Layout.rightMargin: 24 Layout.rightMargin: 24
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
visible: buttonContent.collapsedVisibility
spacing: 0 spacing: 0
Connections {
target: drawer
function onEntered() {
collapsedButtonChevron.backgroundColor = collapsedButtonChevron.hoveredColor
collapsedButtonHeader.opacity = 0.8
}
function onExited() {
collapsedButtonChevron.backgroundColor = collapsedButtonChevron.defaultColor
collapsedButtonHeader.opacity = 1
}
function onPressed(pressed, entered) {
collapsedButtonChevron.backgroundColor = pressed ? collapsedButtonChevron.pressedColor : entered ? collapsedButtonChevron.hoveredColor : collapsedButtonChevron.defaultColor
collapsedButtonHeader.opacity = 0.7
}
}
Header1TextType { Header1TextType {
id: collapsedButtonHeader id: collapsedButtonHeader
Layout.maximumWidth: buttonContent.width - 48 - 18 - 12 // todo Layout.maximumWidth: drawer.width - 48 - 18 - 12 // todo
maximumLineCount: 2 maximumLineCount: 2
elide: Qt.ElideRight elide: Qt.ElideRight
@ -254,8 +110,8 @@ PageType {
bottomPadding: 3 bottomPadding: 3
onClicked: { onClicked: {
if (buttonContent.state === "collapsed") { if (drawer.isCollapsed) {
buttonContent.state = "expanded" drawer.open()
} }
} }
} }
@ -265,16 +121,26 @@ PageType {
id: collapsedServerMenuDescription id: collapsedServerMenuDescription
Layout.bottomMargin: 44 Layout.bottomMargin: 44
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
visible: buttonContent.collapsedVisibility
text: ServersModel.defaultServerDescriptionCollapsed text: ServersModel.defaultServerDescriptionCollapsed
} }
}
expandedContent: Item {
id: serverMenuContainer
implicitHeight: root.height * 0.9
Component.onCompleted: {
drawer.expandedHeight = serverMenuContainer.implicitHeight
}
ColumnLayout { ColumnLayout {
id: serversMenuHeader id: serversMenuHeader
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter anchors.top: parent.top
Layout.fillWidth: true anchors.right: parent.right
visible: buttonContent.expandedVisibility anchors.left: parent.left
Header1TextType { Header1TextType {
Layout.fillWidth: true Layout.fillWidth: true
@ -320,9 +186,11 @@ PageType {
rootButtonClickedFunction: function() { rootButtonClickedFunction: function() {
ServersModel.currentlyProcessedIndex = serversMenuContent.currentIndex ServersModel.currentlyProcessedIndex = serversMenuContent.currentIndex
containersDropDown.menuVisible = true containersDropDown.open()
} }
drawerParent: root
listView: HomeContainersListView { listView: HomeContainersListView {
rootWidth: root.width rootWidth: root.width
@ -357,7 +225,6 @@ PageType {
Layout.topMargin: 48 Layout.topMargin: 48
Layout.leftMargin: 16 Layout.leftMargin: 16
Layout.rightMargin: 16 Layout.rightMargin: 16
visible: buttonContent.expandedVisibility
headerText: qsTr("Servers") headerText: qsTr("Servers")
} }
@ -365,12 +232,14 @@ PageType {
Flickable { Flickable {
id: serversContainer id: serversContainer
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.fillWidth: true anchors.top: serversMenuHeader.bottom
Layout.topMargin: 16 anchors.right: parent.right
contentHeight: col.implicitHeight anchors.left: parent.left
implicitHeight: root.height - (root.height * 0.1) - serversMenuHeader.implicitHeight - 52 //todo 52 is tabbar height anchors.topMargin: 16
visible: buttonContent.expandedVisibility
contentHeight: col.height + col.anchors.bottomMargin
implicitHeight: parent.height - serversMenuHeader.implicitHeight
clip: true clip: true
ScrollBar.vertical: ScrollBar { ScrollBar.vertical: ScrollBar {
@ -386,6 +255,7 @@ PageType {
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.bottomMargin: 32
spacing: 16 spacing: 16
@ -487,7 +357,7 @@ PageType {
onClicked: function() { onClicked: function() {
ServersModel.currentlyProcessedIndex = index ServersModel.currentlyProcessedIndex = index
PageController.goToPage(PageEnum.PageSettingsServerInfo) PageController.goToPage(PageEnum.PageSettingsServerInfo)
buttonContent.state = "collapsed" drawer.close()
} }
} }
} }
@ -503,4 +373,5 @@ PageType {
} }
} }
} }
}
} }

View file

@ -275,20 +275,18 @@ PageType {
text: qsTr("Remove AmneziaWG") text: qsTr("Remove AmneziaWG")
onClicked: { onClicked: {
questionDrawer.headerText = qsTr("Remove AmneziaWG from server?") var headerText = qsTr("Remove AmneziaWG from server?")
questionDrawer.descriptionText = qsTr("All users with whom you shared a connection will no longer be able to connect to it.") var descriptionText = qsTr("All users with whom you shared a connection will no longer be able to connect to it.")
questionDrawer.yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel") var noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() { var yesButtonFunction = function() {
questionDrawer.visible = false
PageController.goToPage(PageEnum.PageDeinstalling) PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeCurrentlyProcessedContainer() InstallController.removeCurrentlyProcessedContainer()
} }
questionDrawer.noButtonFunction = function() { var noButtonFunction = function() {
questionDrawer.visible = false
} }
questionDrawer.visible = true showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
} }
} }
@ -320,9 +318,5 @@ PageType {
} }
} }
} }
QuestionDrawer {
id: questionDrawer
}
} }
} }

View file

@ -122,6 +122,8 @@ PageType {
descriptionText: qsTr("Cipher") descriptionText: qsTr("Cipher")
headerText: qsTr("Cipher") headerText: qsTr("Cipher")
drawerParent: root
listView: ListViewWithRadioButtonType { listView: ListViewWithRadioButtonType {
id: cipherListView id: cipherListView
@ -138,7 +140,7 @@ PageType {
clickedFunction: function() { clickedFunction: function() {
cipherDropDown.text = selectedText cipherDropDown.text = selectedText
cipher = cipherDropDown.text cipher = cipherDropDown.text
cipherDropDown.menuVisible = false cipherDropDown.close()
} }
Component.onCompleted: { Component.onCompleted: {

View file

@ -162,6 +162,8 @@ PageType {
descriptionText: qsTr("Hash") descriptionText: qsTr("Hash")
headerText: qsTr("Hash") headerText: qsTr("Hash")
drawerParent: root
listView: ListViewWithRadioButtonType { listView: ListViewWithRadioButtonType {
id: hashListView id: hashListView
@ -183,7 +185,7 @@ PageType {
clickedFunction: function() { clickedFunction: function() {
hashDropDown.text = selectedText hashDropDown.text = selectedText
hash = hashDropDown.text hash = hashDropDown.text
hashDropDown.menuVisible = false hashDropDown.close()
} }
Component.onCompleted: { Component.onCompleted: {
@ -208,6 +210,8 @@ PageType {
descriptionText: qsTr("Cipher") descriptionText: qsTr("Cipher")
headerText: qsTr("Cipher") headerText: qsTr("Cipher")
drawerParent: root
listView: ListViewWithRadioButtonType { listView: ListViewWithRadioButtonType {
id: cipherListView id: cipherListView
@ -229,7 +233,7 @@ PageType {
clickedFunction: function() { clickedFunction: function() {
cipherDropDown.text = selectedText cipherDropDown.text = selectedText
cipher = cipherDropDown.text cipher = cipherDropDown.text
cipherDropDown.menuVisible = false cipherDropDown.close()
} }
Component.onCompleted: { Component.onCompleted: {
@ -364,20 +368,19 @@ PageType {
text: qsTr("Remove OpenVPN") text: qsTr("Remove OpenVPN")
onClicked: { onClicked: {
questionDrawer.headerText = qsTr("Remove OpenVpn from server?") var headerText = qsTr("Remove OpenVpn from server?")
questionDrawer.descriptionText = qsTr("All users with whom you shared a connection will no longer be able to connect to it.") var descriptionText = qsTr("All users with whom you shared a connection will no longer be able to connect to it.")
questionDrawer.yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel") var noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() { var yesButtonFunction = function() {
questionDrawer.visible = false
PageController.goToPage(PageEnum.PageDeinstalling) PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeCurrentlyProcessedContainer() InstallController.removeCurrentlyProcessedContainer()
} }
questionDrawer.noButtonFunction = function() { var noButtonFunction = function() {
questionDrawer.visible = false
} }
questionDrawer.visible = true
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
} }
} }
@ -398,9 +401,5 @@ PageType {
} }
} }
} }
QuestionDrawer {
id: questionDrawer
}
} }
} }

View file

@ -90,11 +90,16 @@ PageType {
DividerType {} DividerType {}
DrawerType { DrawerType2 {
id: configContentDrawer id: configContentDrawer
width: parent.width expandedHeight: root.height * 0.9
height: parent.height * 0.9
parent: root
anchors.fill: parent
expandedContent: Item {
implicitHeight: configContentDrawer.expandedHeight
BackButtonType { BackButtonType {
id: backButton id: backButton
@ -105,7 +110,7 @@ PageType {
anchors.topMargin: 16 anchors.topMargin: 16
backButtonFunction: function() { backButtonFunction: function() {
configContentDrawer.visible = false configContentDrawer.close()
} }
} }
@ -163,6 +168,7 @@ PageType {
} }
} }
} }
}
LabelWithButtonType { LabelWithButtonType {
id: removeButton id: removeButton
@ -175,20 +181,19 @@ PageType {
textColor: "#EB5757" textColor: "#EB5757"
clickedFunction: function() { clickedFunction: function() {
questionDrawer.headerText = qsTr("Remove %1 from server?").arg(ContainersModel.getCurrentlyProcessedContainerName()) var headerText = qsTr("Remove %1 from server?").arg(ContainersModel.getCurrentlyProcessedContainerName())
questionDrawer.descriptionText = qsTr("All users with whom you shared a connection will no longer be able to connect to it.") var descriptionText = qsTr("All users with whom you shared a connection will no longer be able to connect to it.")
questionDrawer.yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel") var noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() { var yesButtonFunction = function() {
questionDrawer.visible = false
PageController.goToPage(PageEnum.PageDeinstalling) PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeCurrentlyProcessedContainer() InstallController.removeCurrentlyProcessedContainer()
} }
questionDrawer.noButtonFunction = function() { var noButtonFunction = function() {
questionDrawer.visible = false
} }
questionDrawer.visible = true
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
} }
MouseArea { MouseArea {
@ -200,9 +205,5 @@ PageType {
DividerType {} DividerType {}
} }
QuestionDrawer {
id: questionDrawer
}
} }
} }

View file

@ -100,6 +100,8 @@ PageType {
descriptionText: qsTr("Cipher") descriptionText: qsTr("Cipher")
headerText: qsTr("Cipher") headerText: qsTr("Cipher")
drawerParent: root
listView: ListViewWithRadioButtonType { listView: ListViewWithRadioButtonType {
id: cipherListView id: cipherListView
@ -116,7 +118,7 @@ PageType {
clickedFunction: function() { clickedFunction: function() {
cipherDropDown.text = selectedText cipherDropDown.text = selectedText
cipher = cipherDropDown.text cipher = cipherDropDown.text
cipherDropDown.menuVisible = false cipherDropDown.close()
} }
Component.onCompleted: { Component.onCompleted: {

View file

@ -63,19 +63,18 @@ PageType {
textColor: "#EB5757" textColor: "#EB5757"
clickedFunction: function() { clickedFunction: function() {
questionDrawer.headerText = qsTr("Remove %1 from server?").arg(ContainersModel.getCurrentlyProcessedContainerName()) var headerText = qsTr("Remove %1 from server?").arg(ContainersModel.getCurrentlyProcessedContainerName())
questionDrawer.yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel") var noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() { var yesButtonFunction = function() {
questionDrawer.visible = false
PageController.goToPage(PageEnum.PageDeinstalling) PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeCurrentlyProcessedContainer() InstallController.removeCurrentlyProcessedContainer()
} }
questionDrawer.noButtonFunction = function() { var noButtonFunction = function() {
questionDrawer.visible = false
} }
questionDrawer.visible = true
showQuestionDrawer(headerText, "", yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
} }
MouseArea { MouseArea {
@ -86,10 +85,6 @@ PageType {
} }
DividerType {} DividerType {}
QuestionDrawer {
id: questionDrawer
}
} }
} }
} }

View file

@ -248,28 +248,23 @@ PageType {
text: qsTr("Remove SFTP and all data stored there") text: qsTr("Remove SFTP and all data stored there")
onClicked: { onClicked: {
questionDrawer.headerText = qsTr("Remove SFTP and all data stored there?") var headerText = qsTr("Remove SFTP and all data stored there?")
questionDrawer.yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel") var noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() { var yesButtonFunction = function() {
questionDrawer.visible = false
PageController.goToPage(PageEnum.PageDeinstalling) PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeCurrentlyProcessedContainer() InstallController.removeCurrentlyProcessedContainer()
} }
questionDrawer.noButtonFunction = function() { var noButtonFunction = function() {
questionDrawer.visible = false
}
questionDrawer.visible = true
}
}
}
}
}
} }
QuestionDrawer { showQuestionDrawer(headerText, "", yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
id: questionDrawer }
}
}
}
}
} }
} }
} }

View file

@ -126,25 +126,20 @@ PageType {
text: qsTr("Remove website") text: qsTr("Remove website")
onClicked: { onClicked: {
questionDrawer.headerText = qsTr("The site with all data will be removed from the tor network.") var headerText = qsTr("The site with all data will be removed from the tor network.")
questionDrawer.yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel") var noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() { var yesButtonFunction = function() {
questionDrawer.visible = false
PageController.goToPage(PageEnum.PageDeinstalling) PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeCurrentlyProcessedContainer() InstallController.removeCurrentlyProcessedContainer()
} }
questionDrawer.noButtonFunction = function() { var noButtonFunction = function() {
questionDrawer.visible = false
}
questionDrawer.visible = true
}
}
} }
QuestionDrawer { showQuestionDrawer(headerText, "", yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
id: questionDrawer }
}
} }
} }
} }

View file

@ -117,10 +117,6 @@ PageType {
} }
} }
SelectLanguageDrawer {
id: selectLanguageDrawer
}
DividerType {} DividerType {}
@ -145,28 +141,30 @@ PageType {
rightImageSource: "qrc:/images/controls/chevron-right.svg" rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() { clickedFunction: function() {
questionDrawer.headerText = qsTr("Reset settings and remove all data from the application?") var headerText = qsTr("Reset settings and remove all data from the application?")
questionDrawer.descriptionText = qsTr("All settings will be reset to default. All installed AmneziaVPN services will still remain on the server.") var descriptionText = qsTr("All settings will be reset to default. All installed AmneziaVPN services will still remain on the server.")
questionDrawer.yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel") var noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() { var yesButtonFunction = function() {
questionDrawer.visible = false
SettingsController.clearSettings() SettingsController.clearSettings()
PageController.replaceStartPage() PageController.replaceStartPage()
} }
questionDrawer.noButtonFunction = function() { var noButtonFunction = function() {
questionDrawer.visible = false
} }
questionDrawer.visible = true
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
} }
} }
DividerType {} DividerType {}
}
}
QuestionDrawer { SelectLanguageDrawer {
id: questionDrawer id: selectLanguageDrawer
}
} width: root.width
height: root.height
} }
} }

View file

@ -133,24 +133,19 @@ PageType {
} }
function restoreBackup(filePath) { function restoreBackup(filePath) {
questionDrawer.headerText = qsTr("Import settings from a backup file?") var headerText = qsTr("Import settings from a backup file?")
questionDrawer.descriptionText = qsTr("All current settings will be reset"); var descriptionText = qsTr("All current settings will be reset");
questionDrawer.yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel") var noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() { var yesButtonFunction = function() {
questionDrawer.visible = false
PageController.showBusyIndicator(true) PageController.showBusyIndicator(true)
SettingsController.restoreAppConfig(filePath) SettingsController.restoreAppConfig(filePath)
PageController.showBusyIndicator(false) PageController.showBusyIndicator(false)
} }
questionDrawer.noButtonFunction = function() { var noButtonFunction = function() {
questionDrawer.visible = false
}
questionDrawer.visible = true
} }
QuestionDrawer { showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
id: questionDrawer
} }
} }

View file

@ -95,22 +95,21 @@ PageType {
text: qsTr("Restore default") text: qsTr("Restore default")
onClicked: function() { onClicked: function() {
questionDrawer.headerText = qsTr("Restore default DNS settings?") var headerText = qsTr("Restore default DNS settings?")
questionDrawer.yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel") var noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() { var yesButtonFunction = function() {
questionDrawer.visible = false
SettingsController.primaryDns = "1.1.1.1" SettingsController.primaryDns = "1.1.1.1"
primaryDns.textFieldText = SettingsController.primaryDns primaryDns.textFieldText = SettingsController.primaryDns
SettingsController.secondaryDns = "1.0.0.1" SettingsController.secondaryDns = "1.0.0.1"
secondaryDns.textFieldText = SettingsController.secondaryDns secondaryDns.textFieldText = SettingsController.secondaryDns
PageController.showNotificationMessage(qsTr("Settings have been reset")) PageController.showNotificationMessage(qsTr("Settings have been reset"))
} }
questionDrawer.noButtonFunction = function() { var noButtonFunction = function() {
questionDrawer.visible = false
} }
questionDrawer.visible = true
showQuestionDrawer(headerText, "", yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
} }
} }
@ -130,8 +129,5 @@ PageType {
} }
} }
} }
QuestionDrawer {
id: questionDrawer
}
} }
} }

View file

@ -143,21 +143,20 @@ PageType {
image: "qrc:/images/controls/delete.svg" image: "qrc:/images/controls/delete.svg"
onClicked: function() { onClicked: function() {
questionDrawer.headerText = qsTr("Clear logs?") var headerText = qsTr("Clear logs?")
questionDrawer.yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel") var noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() { var yesButtonFunction = function() {
questionDrawer.visible = false
PageController.showBusyIndicator(true) PageController.showBusyIndicator(true)
SettingsController.clearLogs() SettingsController.clearLogs()
PageController.showBusyIndicator(false) PageController.showBusyIndicator(false)
PageController.showNotificationMessage(qsTr("Logs have been cleaned up")) PageController.showNotificationMessage(qsTr("Logs have been cleaned up"))
} }
questionDrawer.noButtonFunction = function() { var noButtonFunction = function() {
questionDrawer.visible = false
} }
questionDrawer.visible = true
showQuestionDrawer(headerText, "", yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
} }
} }
@ -170,10 +169,6 @@ PageType {
} }
} }
} }
QuestionDrawer {
id: questionDrawer
}
} }
} }
} }

View file

@ -92,21 +92,20 @@ PageType {
descriptionText: qsTr("May be needed when changing other settings") descriptionText: qsTr("May be needed when changing other settings")
clickedFunction: function() { clickedFunction: function() {
questionDrawer.headerText = qsTr("Clear cached profiles?") var headerText = qsTr("Clear cached profiles?")
questionDrawer.descriptionText = qsTr("") var descriptionText = qsTr("")
questionDrawer.yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel") var noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() { var yesButtonFunction = function() {
questionDrawer.visible = false
PageController.showBusyIndicator(true) PageController.showBusyIndicator(true)
SettingsController.clearCachedProfiles() SettingsController.clearCachedProfiles()
PageController.showBusyIndicator(false) PageController.showBusyIndicator(false)
} }
questionDrawer.noButtonFunction = function() { var noButtonFunction = function() {
questionDrawer.visible = false
} }
questionDrawer.visible = true
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
} }
} }
@ -140,13 +139,12 @@ PageType {
textColor: "#EB5757" textColor: "#EB5757"
clickedFunction: function() { clickedFunction: function() {
questionDrawer.headerText = qsTr("Do you want to reboot the server?") var headerText = qsTr("Do you want to reboot the server?")
questionDrawer.descriptionText = qsTr("The reboot process may take approximately 30 seconds. Are you sure you wish to proceed?") var descriptionText = qsTr("The reboot process may take approximately 30 seconds. Are you sure you wish to proceed?")
questionDrawer.yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel") var noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() { var yesButtonFunction = function() {
questionDrawer.visible = false
PageController.showBusyIndicator(true) PageController.showBusyIndicator(true)
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) { if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
ConnectionController.closeConnection() ConnectionController.closeConnection()
@ -154,10 +152,10 @@ PageType {
InstallController.rebootCurrentlyProcessedServer() InstallController.rebootCurrentlyProcessedServer()
PageController.showBusyIndicator(false) PageController.showBusyIndicator(false)
} }
questionDrawer.noButtonFunction = function() { var noButtonFunction = function() {
questionDrawer.visible = false
} }
questionDrawer.visible = true
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
} }
} }
@ -172,13 +170,12 @@ PageType {
textColor: "#EB5757" textColor: "#EB5757"
clickedFunction: function() { clickedFunction: function() {
questionDrawer.headerText = qsTr("Do you want to remove the server from application?") var headerText = qsTr("Do you want to remove the server from application?")
questionDrawer.descriptionText = qsTr("All installed AmneziaVPN services will still remain on the server.") var descriptionText = qsTr("All installed AmneziaVPN services will still remain on the server.")
questionDrawer.yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel") var noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() { var yesButtonFunction = function() {
questionDrawer.visible = false
PageController.showBusyIndicator(true) PageController.showBusyIndicator(true)
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) { if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
ConnectionController.closeConnection() ConnectionController.closeConnection()
@ -186,10 +183,10 @@ PageType {
InstallController.removeCurrentlyProcessedServer() InstallController.removeCurrentlyProcessedServer()
PageController.showBusyIndicator(false) PageController.showBusyIndicator(false)
} }
questionDrawer.noButtonFunction = function() { var noButtonFunction = function() {
questionDrawer.visible = false
} }
questionDrawer.visible = true
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
} }
} }
@ -203,23 +200,22 @@ PageType {
textColor: "#EB5757" textColor: "#EB5757"
clickedFunction: function() { clickedFunction: function() {
questionDrawer.headerText = qsTr("Do you want to clear server from Amnezia software?") var headerText = qsTr("Do you want to clear server from Amnezia software?")
questionDrawer.descriptionText = qsTr("All containers will be deleted on the server. This means that configuration files, keys and certificates will be deleted.") var descriptionText = qsTr("All containers will be deleted on the server. This means that configuration files, keys and certificates will be deleted.")
questionDrawer.yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel") var noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() { var yesButtonFunction = function() {
questionDrawer.visible = false
PageController.goToPage(PageEnum.PageDeinstalling) PageController.goToPage(PageEnum.PageDeinstalling)
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) { if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
ConnectionController.closeConnection() ConnectionController.closeConnection()
} }
InstallController.removeAllContainers() InstallController.removeAllContainers()
} }
questionDrawer.noButtonFunction = function() { var noButtonFunction = function() {
questionDrawer.visible = false
} }
questionDrawer.visible = true
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
} }
} }
@ -235,31 +231,26 @@ PageType {
textColor: "#EB5757" textColor: "#EB5757"
clickedFunction: function() { clickedFunction: function() {
questionDrawer.headerText = qsTr("Do you want to reset API config?") var headerText = qsTr("Do you want to reset API config?")
questionDrawer.descriptionText = "" var descriptionText = ""
questionDrawer.yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel") var noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() { var yesButtonFunction = function() {
questionDrawer.visible = false
PageController.showBusyIndicator(true) PageController.showBusyIndicator(true)
ApiController.clearApiConfig() ApiController.clearApiConfig()
PageController.showBusyIndicator(false) PageController.showBusyIndicator(false)
} }
questionDrawer.noButtonFunction = function() { var noButtonFunction = function() {
questionDrawer.visible = false
} }
questionDrawer.visible = true
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
} }
} }
DividerType { DividerType {
visible: ServersModel.isCurrentlyProcessedServerFromApi() visible: ServersModel.isCurrentlyProcessedServerFromApi()
} }
QuestionDrawer {
id: questionDrawer
}
} }
} }
} }

View file

@ -71,30 +71,33 @@ PageType {
} }
actionButtonFunction: function() { actionButtonFunction: function() {
serverNameEditDrawer.visible = true serverNameEditDrawer.open()
} }
} }
DrawerType { DrawerType2 {
id: serverNameEditDrawer id: serverNameEditDrawer
width: root.width parent: root
height: root.height * 0.35
onVisibleChanged: { anchors.fill: parent
if (serverNameEditDrawer.visible) { expandedHeight: root.height * 0.35
serverName.textField.forceActiveFocus()
}
}
ColumnLayout { expandedContent: ColumnLayout {
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.topMargin: 16 anchors.topMargin: 32
anchors.leftMargin: 16 anchors.leftMargin: 16
anchors.rightMargin: 16 anchors.rightMargin: 16
Connections {
target: serverNameEditDrawer
function onOpened() {
serverName.textField.forceActiveFocus()
}
}
TextFieldWithHeaderType { TextFieldWithHeaderType {
id: serverName id: serverName
@ -118,7 +121,7 @@ PageType {
if (serverName.textFieldText !== name) { if (serverName.textFieldText !== name) {
name = serverName.textFieldText name = serverName.textFieldText
} }
serverNameEditDrawer.visible = false serverNameEditDrawer.close()
} }
} }
} }

View file

@ -113,20 +113,19 @@ PageType {
textColor: "#EB5757" textColor: "#EB5757"
clickedFunction: function() { clickedFunction: function() {
questionDrawer.headerText = qsTr("Remove %1 from server?").arg(ContainersModel.getCurrentlyProcessedContainerName()) var headerText = qsTr("Remove %1 from server?").arg(ContainersModel.getCurrentlyProcessedContainerName())
questionDrawer.descriptionText = qsTr("All users with whom you shared a connection will no longer be able to connect to it.") var descriptionText = qsTr("All users with whom you shared a connection will no longer be able to connect to it.")
questionDrawer.yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel") var noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() { var yesButtonFunction = function() {
questionDrawer.visible = false
PageController.goToPage(PageEnum.PageDeinstalling) PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeCurrentlyProcessedContainer() InstallController.removeCurrentlyProcessedContainer()
} }
questionDrawer.noButtonFunction = function() { var noButtonFunction = function() {
questionDrawer.visible = false
} }
questionDrawer.visible = true
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
} }
MouseArea { MouseArea {
@ -138,9 +137,9 @@ PageType {
DividerType {} DividerType {}
} }
}
QuestionDrawer { QuestionDrawer {
id: questionDrawer id: questionDrawer
} }
}
} }

View file

@ -121,6 +121,7 @@ PageType {
Layout.rightMargin: 16 Layout.rightMargin: 16
drawerHeight: 0.4375 drawerHeight: 0.4375
drawerParent: root
enabled: root.pageEnabled enabled: root.pageEnabled
@ -135,7 +136,7 @@ PageType {
clickedFunction: function() { clickedFunction: function() {
selector.text = selectedText selector.text = selectedText
selector.menuVisible = false selector.close()
if (SitesModel.routeMode !== root.routeModesModel[currentIndex].type) { if (SitesModel.routeMode !== root.routeModesModel[currentIndex].type) {
SitesModel.routeMode = root.routeModesModel[currentIndex].type SitesModel.routeMode = root.routeModesModel[currentIndex].type
} }
@ -202,26 +203,21 @@ PageType {
rightImageColor: "#D7D8DB" rightImageColor: "#D7D8DB"
clickedFunction: function() { clickedFunction: function() {
questionDrawer.headerText = qsTr("Remove ") + url + "?" var headerText = qsTr("Remove ") + url + "?"
questionDrawer.yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel") var noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() { var yesButtonFunction = function() {
questionDrawer.visible = false
SitesController.removeSite(index) SitesController.removeSite(index)
} }
questionDrawer.noButtonFunction = function() { var noButtonFunction = function() {
questionDrawer.visible = false
} }
questionDrawer.visible = true
showQuestionDrawer(headerText, "", yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
} }
} }
DividerType {} DividerType {}
QuestionDrawer {
id: questionDrawer
}
} }
} }
} }
@ -275,16 +271,13 @@ PageType {
} }
} }
DrawerType { DrawerType2 {
id: moreActionsDrawer id: moreActionsDrawer
width: parent.width
height: parent.height * 0.4375
FlickableType {
anchors.fill: parent anchors.fill: parent
contentHeight: moreActionsDrawerContent.height expandedHeight: parent.height * 0.4375
ColumnLayout {
expandedContent: ColumnLayout {
id: moreActionsDrawerContent id: moreActionsDrawerContent
anchors.top: parent.top anchors.top: parent.top
@ -338,13 +331,15 @@ PageType {
DividerType {} DividerType {}
} }
} }
}
DrawerType { DrawerType2 {
id: importSitesDrawer id: importSitesDrawer
width: parent.width anchors.fill: parent
height: parent.height * 0.4375 expandedHeight: parent.height * 0.4375
expandedContent: Item {
implicitHeight: importSitesDrawer.expandedHeight
BackButtonType { BackButtonType {
id: importSitesDrawerBackButton id: importSitesDrawerBackButton
@ -422,4 +417,9 @@ PageType {
} }
} }
} }
}
QuestionDrawer {
id: questionDrawer
}
} }

View file

@ -192,7 +192,6 @@ PageType {
return ContainersModel.isAnyContainerInstalled() return ContainersModel.isAnyContainerInstalled()
} }
return true return true
} }

View file

@ -97,11 +97,14 @@ PageType {
} }
} }
DrawerType { DrawerType2 {
id: showDetailsDrawer id: showDetailsDrawer
parent: root
width: parent.width anchors.fill: parent
height: parent.height * 0.9 expandedHeight: parent.height * 0.9
expandedContent: Item {
implicitHeight: showDetailsDrawer.expandedHeight
BackButtonType { BackButtonType {
id: showDetailsBackButton id: showDetailsBackButton
@ -172,6 +175,7 @@ PageType {
} }
} }
} }
}
ParagraphTextType { ParagraphTextType {
id: transportProtoHeader id: transportProtoHeader

View file

@ -116,7 +116,7 @@ PageType {
text: qsTr("I have the data to connect") text: qsTr("I have the data to connect")
onClicked: { onClicked: {
connectionTypeSelection.visible = true connectionTypeSelection.open()
} }
} }
@ -138,11 +138,11 @@ PageType {
onClicked: Qt.openUrlExternally(qsTr("https://amnezia.org/instructions/0_starter-guide")) onClicked: Qt.openUrlExternally(qsTr("https://amnezia.org/instructions/0_starter-guide"))
} }
} }
}
ConnectionTypeSelectionDrawer { ConnectionTypeSelectionDrawer {
id: connectionTypeSelection id: connectionTypeSelection
} }
}
BusyIndicatorType { BusyIndicatorType {
id: busyIndicator id: busyIndicator

View file

@ -41,8 +41,6 @@ PageType {
shareConnectionDrawer.headerText = qsTr("Connection to ") + serverSelector.text shareConnectionDrawer.headerText = qsTr("Connection to ") + serverSelector.text
shareConnectionDrawer.configContentHeaderText = qsTr("File with connection settings to ") + serverSelector.text shareConnectionDrawer.configContentHeaderText = qsTr("File with connection settings to ") + serverSelector.text
shareConnectionDrawer.needCloseButton = false
shareConnectionDrawer.open() shareConnectionDrawer.open()
shareConnectionDrawer.contentVisible = false shareConnectionDrawer.contentVisible = false
PageController.showBusyIndicator(true) PageController.showBusyIndicator(true)
@ -80,11 +78,6 @@ PageType {
} }
PageController.showBusyIndicator(false) PageController.showBusyIndicator(false)
shareConnectionDrawer.needCloseButton = true
PageController.showTopCloseButton(true)
shareConnectionDrawer.contentVisible = true
} }
function onExportErrorOccurred(errorMessage) { function onExportErrorOccurred(errorMessage) {
@ -154,14 +147,15 @@ PageType {
shareFullAccessDrawer.open() shareFullAccessDrawer.open()
} }
DrawerType { DrawerType2 {
id: shareFullAccessDrawer id: shareFullAccessDrawer
width: root.width parent: root
height: root.height * 0.45
anchors.fill: parent
expandedHeight: root.height * 0.45
ColumnLayout { expandedContent: ColumnLayout {
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@ -276,6 +270,7 @@ PageType {
Layout.topMargin: 16 Layout.topMargin: 16
drawerHeight: 0.4375 drawerHeight: 0.4375
drawerParent: root
descriptionText: qsTr("Server") descriptionText: qsTr("Server")
headerText: qsTr("Server") headerText: qsTr("Server")
@ -305,7 +300,7 @@ PageType {
serverSelector.severSelectorIndexChanged() serverSelector.severSelectorIndexChanged()
} }
serverSelector.menuVisible = false serverSelector.close()
} }
Component.onCompleted: { Component.onCompleted: {
@ -328,6 +323,7 @@ PageType {
Layout.topMargin: 16 Layout.topMargin: 16
drawerHeight: 0.5 drawerHeight: 0.5
drawerParent: root
descriptionText: qsTr("Protocol") descriptionText: qsTr("Protocol")
headerText: qsTr("Protocol") headerText: qsTr("Protocol")
@ -358,7 +354,7 @@ PageType {
clickedFunction: function() { clickedFunction: function() {
handler() handler()
protocolSelector.menuVisible = false protocolSelector.close()
} }
Connections { Connections {
@ -423,6 +419,7 @@ PageType {
Layout.topMargin: 16 Layout.topMargin: 16
drawerHeight: 0.4375 drawerHeight: 0.4375
drawerParent: root
visible: accessTypeSelector.currentIndex === 0 visible: accessTypeSelector.currentIndex === 0
enabled: root.connectionTypesModel.length > 1 enabled: root.connectionTypesModel.length > 1
@ -446,7 +443,7 @@ PageType {
clickedFunction: function() { clickedFunction: function() {
exportTypeSelector.text = selectedText exportTypeSelector.text = selectedText
exportTypeSelector.currentIndex = currentIndex exportTypeSelector.currentIndex = currentIndex
exportTypeSelector.menuVisible = false exportTypeSelector.close()
} }
Component.onCompleted: { Component.onCompleted: {
@ -456,10 +453,6 @@ PageType {
} }
} }
ShareConnectionDrawer {
id: shareConnectionDrawer
}
BasicButtonType { BasicButtonType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 40 Layout.topMargin: 40
@ -561,13 +554,15 @@ PageType {
DividerType {} DividerType {}
DrawerType { DrawerType2 {
id: clientInfoDrawer id: clientInfoDrawer
width: root.width parent: root
height: root.height * 0.5
ColumnLayout { anchors.fill: parent
expandedHeight: root.height * 0.5
expandedContent: ColumnLayout {
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@ -602,26 +597,29 @@ PageType {
clientNameEditDrawer.open() clientNameEditDrawer.open()
} }
DrawerType { DrawerType2 {
id: clientNameEditDrawer id: clientNameEditDrawer
width: root.width parent: root
height: root.height * 0.35
onVisibleChanged: { anchors.fill: parent
if (clientNameEditDrawer.visible) { expandedHeight: root.height * 0.35
clientNameEditor.textField.forceActiveFocus()
}
}
ColumnLayout { expandedContent: ColumnLayout {
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.topMargin: 16 anchors.topMargin: 32
anchors.leftMargin: 16 anchors.leftMargin: 16
anchors.rightMargin: 16 anchors.rightMargin: 16
Connections {
target: clientNameEditDrawer
function onOpened() {
clientNameEditor.textField.forceActiveFocus()
}
}
TextFieldWithHeaderType { TextFieldWithHeaderType {
id: clientNameEditor id: clientNameEditor
Layout.fillWidth: true Layout.fillWidth: true
@ -669,20 +667,21 @@ PageType {
text: qsTr("Revoke") text: qsTr("Revoke")
onClicked: function() { onClicked: function() {
questionDrawer.headerText = qsTr("Revoke the config for a user - %1?").arg(clientName) var headerText = qsTr("Revoke the config for a user - %1?").arg(clientName)
questionDrawer.descriptionText = qsTr("The user will no longer be able to connect to your server.") var descriptionText = qsTr("The user will no longer be able to connect to your server.")
questionDrawer.yesButtonText = qsTr("Continue") var yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel") var noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() { var yesButtonFunction = function() {
questionDrawer.close()
clientInfoDrawer.close() clientInfoDrawer.close()
root.revokeConfig(index) root.revokeConfig(index)
} }
questionDrawer.noButtonFunction = function() { var noButtonFunction = function() {
questionDrawer.close() }
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
}
} }
questionDrawer.open()
} }
} }
} }
@ -691,11 +690,12 @@ PageType {
} }
} }
QuestionDrawer { ShareConnectionDrawer {
id: questionDrawer id: shareConnectionDrawer
}
} anchors.fill: parent
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onPressed: function(mouse) { onPressed: function(mouse) {

View file

@ -69,6 +69,7 @@ PageType {
Layout.topMargin: 16 Layout.topMargin: 16
drawerHeight: 0.4375 drawerHeight: 0.4375
drawerParent: root
descriptionText: qsTr("Server") descriptionText: qsTr("Server")
headerText: qsTr("Server") headerText: qsTr("Server")
@ -99,7 +100,7 @@ PageType {
shareConnectionDrawer.headerText = qsTr("Accessing ") + serverSelector.text shareConnectionDrawer.headerText = qsTr("Accessing ") + serverSelector.text
shareConnectionDrawer.configContentHeaderText = qsTr("File with accessing settings to ") + serverSelector.text shareConnectionDrawer.configContentHeaderText = qsTr("File with accessing settings to ") + serverSelector.text
serverSelector.menuVisible = false serverSelector.close()
} }
Component.onCompleted: { Component.onCompleted: {
@ -126,8 +127,6 @@ PageType {
shareConnectionDrawer.headerText = qsTr("Connection to ") + serverSelector.text shareConnectionDrawer.headerText = qsTr("Connection to ") + serverSelector.text
shareConnectionDrawer.configContentHeaderText = qsTr("File with connection settings to ") + serverSelector.text shareConnectionDrawer.configContentHeaderText = qsTr("File with connection settings to ") + serverSelector.text
shareConnectionDrawer.needCloseButton = false
shareConnectionDrawer.open() shareConnectionDrawer.open()
shareConnectionDrawer.contentVisible = false shareConnectionDrawer.contentVisible = false
PageController.showBusyIndicator(true) PageController.showBusyIndicator(true)
@ -140,16 +139,15 @@ PageType {
PageController.showBusyIndicator(false) PageController.showBusyIndicator(false)
shareConnectionDrawer.needCloseButton = true
PageController.showTopCloseButton(true)
shareConnectionDrawer.contentVisible = true shareConnectionDrawer.contentVisible = true
} }
} }
}
}
ShareConnectionDrawer { ShareConnectionDrawer {
id: shareConnectionDrawer id: shareConnectionDrawer
}
} anchors.fill: parent
} }
} }

View file

@ -20,22 +20,16 @@ PageType {
function onGoToPageHome() { function onGoToPageHome() {
tabBar.setCurrentIndex(0) tabBar.setCurrentIndex(0)
tabBarStackView.goToTabBarPage(PageEnum.PageHome) tabBarStackView.goToTabBarPage(PageEnum.PageHome)
PageController.updateDrawerRootPage(PageEnum.PageHome)
} }
function onGoToPageSettings() { function onGoToPageSettings() {
tabBar.setCurrentIndex(2) tabBar.setCurrentIndex(2)
tabBarStackView.goToTabBarPage(PageEnum.PageSettings) tabBarStackView.goToTabBarPage(PageEnum.PageSettings)
PageController.updateDrawerRootPage(PageEnum.PageSettings)
} }
function onGoToPageViewConfig() { function onGoToPageViewConfig() {
var pagePath = PageController.getPagePath(PageEnum.PageSetupWizardViewConfig) var pagePath = PageController.getPagePath(PageEnum.PageSetupWizardViewConfig)
tabBarStackView.push(pagePath, { "objectName" : pagePath }, StackView.PushTransition) tabBarStackView.push(pagePath, { "objectName" : pagePath }, StackView.PushTransition)
PageController.updateDrawerRootPage(PageEnum.PageSetupWizardViewConfig)
} }
function onShowBusyIndicator(visible) { function onShowBusyIndicator(visible) {
@ -44,10 +38,6 @@ PageType {
tabBar.enabled = !visible tabBar.enabled = !visible
} }
// function onShowTopCloseButton(visible) {
// topCloseButton.visible = visible
// }
function onEnableTabBar(enabled) { function onEnableTabBar(enabled) {
tabBar.enabled = enabled tabBar.enabled = enabled
} }
@ -66,8 +56,6 @@ PageType {
} else { } else {
tabBarStackView.push(pagePath, { "objectName" : pagePath }, StackView.Immediate) tabBarStackView.push(pagePath, { "objectName" : pagePath }, StackView.Immediate)
} }
PageController.updateDrawerRootPage(page)
} }
function onGoToStartPage() { function onGoToStartPage() {
@ -146,8 +134,6 @@ PageType {
var pagePath = PageController.getPagePath(page) var pagePath = PageController.getPagePath(page)
tabBarStackView.clear(StackView.Immediate) tabBarStackView.clear(StackView.Immediate)
tabBarStackView.replace(pagePath, { "objectName" : pagePath }, StackView.Immediate) tabBarStackView.replace(pagePath, { "objectName" : pagePath }, StackView.Immediate)
PageController.updateDrawerRootPage(page)
} }
Component.onCompleted: { Component.onCompleted: {
@ -155,11 +141,6 @@ PageType {
ServersModel.currentlyProcessedIndex = ServersModel.defaultIndex ServersModel.currentlyProcessedIndex = ServersModel.defaultIndex
tabBarStackView.push(pagePath, { "objectName" : pagePath }) tabBarStackView.push(pagePath, { "objectName" : pagePath })
} }
// onWidthChanged: {
// topCloseButton.x = tabBarStackView.x + tabBarStackView.width -
// topCloseButton.buttonWidth - topCloseButton.rightPadding
// }
} }
TabBar { TabBar {
@ -253,13 +234,6 @@ PageType {
z: 1 z: 1
} }
// TopCloseButtonType {
// id: topCloseButton
// x: tabBarStackView.width - topCloseButton.buttonWidth - topCloseButton.rightPadding
// z: 1
// }
ConnectionTypeSelectionDrawer { ConnectionTypeSelectionDrawer {
id: connectionTypeSelection id: connectionTypeSelection

View file

@ -8,6 +8,7 @@ import PageEnum 1.0
import "Config" import "Config"
import "Controls2" import "Controls2"
import "Components"
Window { Window {
id: root id: root
@ -130,32 +131,15 @@ Window {
} }
Item { Item {
anchors.right: parent.right anchors.fill: parent
anchors.left: parent.left
anchors.bottom: parent.bottom
implicitHeight: popupErrorMessage.height DrawerType2 {
DrawerType {
id: privateKeyPassphraseDrawer id: privateKeyPassphraseDrawer
width: root.width anchors.fill: parent
height: root.height * 0.35 expandedHeight: root.height * 0.35
onVisibleChanged: { expandedContent: ColumnLayout {
if (privateKeyPassphraseDrawer.visible) {
passphrase.textFieldText = ""
passphrase.textField.forceActiveFocus()
}
}
onAboutToHide: {
PageController.showBusyIndicator(true)
}
onAboutToShow: {
PageController.showBusyIndicator(false)
}
ColumnLayout {
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@ -163,6 +147,24 @@ Window {
anchors.leftMargin: 16 anchors.leftMargin: 16
anchors.rightMargin: 16 anchors.rightMargin: 16
Connections {
target: privateKeyPassphraseDrawer
function onOpened() {
passphrase.textFieldText = ""
passphrase.textField.forceActiveFocus()
}
function onAboutToHide() {
if (passphrase.textFieldText !== "") {
PageController.showBusyIndicator(true)
}
}
function onAboutToShow() {
PageController.showBusyIndicator(false)
}
}
TextFieldWithHeaderType { TextFieldWithHeaderType {
id: passphrase id: passphrase
@ -199,6 +201,37 @@ Window {
} }
} }
Item {
anchors.fill: parent
QuestionDrawer {
id: questionDrawer
anchors.fill: parent
}
}
function showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction) {
questionDrawer.headerText = headerText
questionDrawer.descriptionText = descriptionText
questionDrawer.yesButtonText = yesButtonText
questionDrawer.noButtonText = noButtonText
questionDrawer.yesButtonFunction = function() {
questionDrawer.close()
if (yesButtonFunction && typeof yesButtonFunction === "function") {
yesButtonFunction()
}
}
questionDrawer.noButtonFunction = function() {
questionDrawer.close()
if (noButtonFunction && typeof noButtonFunction === "function") {
noButtonFunction()
}
}
questionDrawer.open()
}
FileDialog { FileDialog {
id: mainFileDialog id: mainFileDialog