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,129 +5,136 @@ 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
ColumnLayout { implicitHeight: root.height * 0.9
id: backButton
anchors.top: parent.top Component.onCompleted: {
anchors.left: parent.left root.expandedHeight = container.implicitHeight
anchors.right: parent.right
anchors.topMargin: 16
BackButtonType {
backButtonImage: "qrc:/images/controls/arrow-left.svg"
backButtonFunction: function() {
root.close()
}
} }
}
FlickableType {
anchors.top: backButton.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
contentHeight: content.implicitHeight
ColumnLayout { ColumnLayout {
id: content id: backButton
anchors.fill: parent anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 16
Header2Type { BackButtonType {
id: header backButtonImage: "qrc:/images/controls/arrow-left.svg"
Layout.fillWidth: true backButtonFunction: function() {
Layout.topMargin: 16 root.close()
Layout.rightMargin: 16 }
Layout.leftMargin: 16
headerText: qsTr("Choose language")
} }
}
ListView { FlickableType {
id: listView anchors.top: backButton.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
contentHeight: content.implicitHeight
Layout.fillWidth: true ColumnLayout {
height: listView.contentItem.height id: content
clip: true anchors.fill: parent
interactive: false
model: LanguageModel Header2Type {
currentIndex: LanguageModel.currentLanguageIndex id: header
Layout.fillWidth: true
Layout.topMargin: 16
Layout.rightMargin: 16
Layout.leftMargin: 16
ButtonGroup { headerText: qsTr("Choose language")
id: buttonGroup
} }
delegate: Item { ListView {
implicitWidth: root.width id: listView
implicitHeight: delegateContent.implicitHeight
ColumnLayout { Layout.fillWidth: true
id: delegateContent height: listView.contentItem.height
anchors.fill: parent clip: true
interactive: false
RadioButton { model: LanguageModel
id: radioButton currentIndex: LanguageModel.currentLanguageIndex
implicitWidth: parent.width ButtonGroup {
implicitHeight: radioButtonContent.implicitHeight id: buttonGroup
}
hoverEnabled: true delegate: Item {
implicitWidth: root.width
implicitHeight: delegateContent.implicitHeight
indicator: Rectangle { ColumnLayout {
anchors.fill: parent id: delegateContent
color: radioButton.hovered ? "#2C2D30" : "#1C1D21"
Behavior on color { anchors.fill: parent
PropertyAnimation { duration: 200 }
}
}
RowLayout { RadioButton {
id: radioButtonContent id: radioButton
anchors.fill: parent
anchors.rightMargin: 16 implicitWidth: parent.width
anchors.leftMargin: 16 implicitHeight: radioButtonContent.implicitHeight
spacing: 0 hoverEnabled: true
z: 1 indicator: Rectangle {
anchors.fill: parent
color: radioButton.hovered ? "#2C2D30" : "#1C1D21"
ParagraphTextType { Behavior on color {
Layout.fillWidth: true PropertyAnimation { duration: 200 }
Layout.topMargin: 20 }
Layout.bottomMargin: 20
text: languageName
} }
Image { RowLayout {
source: "qrc:/images/controls/check.svg" id: radioButtonContent
visible: radioButton.checked anchors.fill: parent
width: 24 anchors.rightMargin: 16
height: 24 anchors.leftMargin: 16
Layout.rightMargin: 8 spacing: 0
z: 1
ParagraphTextType {
Layout.fillWidth: true
Layout.topMargin: 20
Layout.bottomMargin: 20
text: languageName
}
Image {
source: "qrc:/images/controls/check.svg"
visible: radioButton.checked
width: 24
height: 24
Layout.rightMargin: 8
}
} }
}
ButtonGroup.group: buttonGroup ButtonGroup.group: buttonGroup
checked: listView.currentIndex === index checked: listView.currentIndex === index
onClicked: { onClicked: {
listView.currentIndex = index listView.currentIndex = index
LanguageModel.changeLanguage(languageIndex) LanguageModel.changeLanguage(languageIndex)
root.close() root.close()
}
} }
} }
} }

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,82 +141,116 @@ 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
BackButtonType { anchors.fill: parent
id: backButton expandedHeight: parent.height * 0.9
anchors.top: parent.top expandedContent: Item {
anchors.left: parent.left id: configContentContainer
anchors.right: parent.right
anchors.topMargin: 16
backButtonFunction: function() { implicitHeight: configContentDrawer.expandedHeight
configContentDrawer.visible = false
Connections {
target: copyNativeConfigStringButton
function onClicked() {
nativeConfigString.selectAll()
nativeConfigString.copy()
nativeConfigString.select(0, 0)
PageController.showNotificationMessage(qsTr("Copied"))
}
} }
}
FlickableType { Connections {
anchors.top: backButton.bottom target: copyConfigTextButton
anchors.left: parent.left function onClicked() {
anchors.right: parent.right configText.selectAll()
anchors.bottom: parent.bottom configText.copy()
contentHeight: configContent.implicitHeight + configContent.anchors.topMargin + configContent.anchors.bottomMargin configText.select(0, 0)
PageController.showNotificationMessage(qsTr("Copied"))
ColumnLayout {
id: configContent
anchors.fill: parent
anchors.rightMargin: 16
anchors.leftMargin: 16
Header2Type {
id: configContentHeader
Layout.fillWidth: true
Layout.topMargin: 16
} }
}
TextField { BackButtonType {
id: nativeConfigString id: backButton
visible: false
text: ExportController.nativeConfigString anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 16
backButtonFunction: function() {
configContentDrawer.open()
} }
}
TextArea { FlickableType {
id: configText anchors.top: backButton.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
contentHeight: configContent.implicitHeight + configContent.anchors.topMargin + configContent.anchors.bottomMargin
Layout.fillWidth: true ColumnLayout {
Layout.topMargin: 16 id: configContent
Layout.bottomMargin: 16
padding: 0 anchors.fill: parent
leftPadding: 0 anchors.rightMargin: 16
height: 24 anchors.leftMargin: 16
readOnly: true Header2Type {
id: configContentHeader
Layout.fillWidth: true
Layout.topMargin: 16
color: "#D7D8DB" headerText: root.configContentHeaderText
selectionColor: "#633303" }
selectedTextColor: "#D7D8DB"
font.pixelSize: 16 TextField {
font.weight: Font.Medium id: nativeConfigString
font.family: "PT Root UI VF" visible: false
text: ExportController.nativeConfigString
text: ExportController.config onTextChanged: {
copyNativeConfigStringButton.visible = nativeConfigString.text !== ""
}
}
wrapMode: Text.Wrap TextArea {
id: configText
background: Rectangle { Layout.fillWidth: true
color: "transparent" Layout.topMargin: 16
Layout.bottomMargin: 16
padding: 0
leftPadding: 0
height: 24
readOnly: true
color: "#D7D8DB"
selectionColor: "#633303"
selectedTextColor: "#D7D8DB"
font.pixelSize: 16
font.weight: Font.Medium
font.family: "PT Root UI VF"
text: ExportController.config
wrapMode: Text.Wrap
background: Rectangle {
color: "transparent"
}
} }
} }
} }

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,60 +160,68 @@ 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
ColumnLayout { anchors.fill: parent
id: header expandedHeight: drawerParent.height * drawerHeight
anchors.top: parent.top expandedContent: Item {
anchors.left: parent.left id: container
anchors.right: parent.right
anchors.topMargin: 16
BackButtonType { implicitHeight: menu.expandedHeight
backButtonImage: root.headerBackButtonImage
backButtonFunction: function() {
root.menuVisible = false
}
}
}
FlickableType { ColumnLayout {
anchors.top: header.bottom id: header
anchors.topMargin: 16
contentHeight: col.implicitHeight
Column {
id: col
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
spacing: 16 BackButtonType {
backButtonImage: root.headerBackButtonImage
backButtonFunction: function() {
menu.close()
}
}
}
Header2Type { FlickableType {
anchors.top: header.bottom
anchors.topMargin: 16
contentHeight: col.implicitHeight
Column {
id: col
anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.leftMargin: 16
anchors.rightMargin: 16
headerText: root.headerText spacing: 16
width: parent.width Header2Type {
} anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 16
anchors.rightMargin: 16
Loader { headerText: root.headerText
id: listViewLoader
sourceComponent: root.listView width: parent.width
}
Loader {
id: listViewLoader
sourceComponent: root.listView
}
} }
} }
} }

View file

@ -18,484 +18,355 @@ 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 collapsedContent: ColumnLayout {
drag.axis: Drag.YAxis DividerType {
drag.maximumY: root.height - buttonContent.collapsedHeight Layout.topMargin: 10
drag.minimumY: root.height - root.height * 0.9 Layout.fillWidth: false
Layout.preferredWidth: 20
/** If drag area is released at any point other than min or max y, transition to the other state */ Layout.preferredHeight: 2
onReleased: { Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
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
}
}
]
DividerType {
Layout.topMargin: 10
Layout.fillWidth: false
Layout.preferredWidth: 20
Layout.preferredHeight: 2
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
visible: (buttonContent.collapsedVisibility || buttonContent.expandedVisibility)
}
RowLayout {
Layout.topMargin: 14
Layout.leftMargin: 24
Layout.rightMargin: 24
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
visible: buttonContent.collapsedVisibility
spacing: 0
Header1TextType {
id: collapsedButtonHeader
Layout.maximumWidth: buttonContent.width - 48 - 18 - 12 // todo
maximumLineCount: 2
elide: Qt.ElideRight
text: ServersModel.defaultServerName
horizontalAlignment: Qt.AlignHCenter
Behavior on opacity {
PropertyAnimation { duration: 200 }
}
}
ImageButtonType {
id: collapsedButtonChevron
Layout.leftMargin: 8
hoverEnabled: false
image: "qrc:/images/controls/chevron-down.svg"
imageColor: "#d7d8db"
icon.width: 18
icon.height: 18
backgroundRadius: 16
horizontalPadding: 4
topPadding: 4
bottomPadding: 3
onClicked: {
if (buttonContent.state === "collapsed") {
buttonContent.state = "expanded"
}
}
}
}
LabelTextType {
id: collapsedServerMenuDescription
Layout.bottomMargin: 44
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
visible: buttonContent.collapsedVisibility
text: ServersModel.defaultServerDescriptionCollapsed
}
ColumnLayout {
id: serversMenuHeader
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.fillWidth: true
visible: buttonContent.expandedVisibility
Header1TextType {
Layout.fillWidth: true
Layout.topMargin: 14
Layout.leftMargin: 16
Layout.rightMargin: 16
text: ServersModel.defaultServerName
horizontalAlignment: Qt.AlignHCenter
maximumLineCount: 2
elide: Qt.ElideRight
}
LabelTextType {
id: expandedServersMenuDescription
Layout.bottomMargin: 24
Layout.fillWidth: true
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
text: ServersModel.defaultServerDescriptionExpanded
} }
RowLayout { RowLayout {
Layout.topMargin: 14
Layout.leftMargin: 24
Layout.rightMargin: 24
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
spacing: 8
DropDownType { spacing: 0
id: containersDropDown
rootButtonImageColor: "#0E0E11" Connections {
rootButtonBackgroundColor: "#D7D8DB" target: drawer
rootButtonBackgroundHoveredColor: Qt.rgba(215, 216, 219, 0.8) function onEntered() {
rootButtonBackgroundPressedColor: Qt.rgba(215, 216, 219, 0.65) collapsedButtonChevron.backgroundColor = collapsedButtonChevron.hoveredColor
rootButtonHoveredBorderColor: "transparent" collapsedButtonHeader.opacity = 0.8
rootButtonDefaultBorderColor: "transparent"
rootButtonTextTopMargin: 8
rootButtonTextBottomMargin: 8
text: ServersModel.defaultContainerName
textColor: "#0E0E11"
headerText: qsTr("VPN protocol")
headerBackButtonImage: "qrc:/images/controls/arrow-left.svg"
rootButtonClickedFunction: function() {
ServersModel.currentlyProcessedIndex = serversMenuContent.currentIndex
containersDropDown.menuVisible = true
} }
listView: HomeContainersListView { function onExited() {
rootWidth: root.width 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 {
id: collapsedButtonHeader
Layout.maximumWidth: drawer.width - 48 - 18 - 12 // todo
maximumLineCount: 2
elide: Qt.ElideRight
text: ServersModel.defaultServerName
horizontalAlignment: Qt.AlignHCenter
Behavior on opacity {
PropertyAnimation { duration: 200 }
}
}
ImageButtonType {
id: collapsedButtonChevron
Layout.leftMargin: 8
hoverEnabled: false
image: "qrc:/images/controls/chevron-down.svg"
imageColor: "#d7d8db"
icon.width: 18
icon.height: 18
backgroundRadius: 16
horizontalPadding: 4
topPadding: 4
bottomPadding: 3
onClicked: {
if (drawer.isCollapsed) {
drawer.open()
}
}
}
}
LabelTextType {
id: collapsedServerMenuDescription
Layout.bottomMargin: 44
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
text: ServersModel.defaultServerDescriptionCollapsed
}
}
expandedContent: Item {
id: serverMenuContainer
implicitHeight: root.height * 0.9
Component.onCompleted: {
drawer.expandedHeight = serverMenuContainer.implicitHeight
}
ColumnLayout {
id: serversMenuHeader
anchors.top: parent.top
anchors.right: parent.right
anchors.left: parent.left
Header1TextType {
Layout.fillWidth: true
Layout.topMargin: 14
Layout.leftMargin: 16
Layout.rightMargin: 16
text: ServersModel.defaultServerName
horizontalAlignment: Qt.AlignHCenter
maximumLineCount: 2
elide: Qt.ElideRight
}
LabelTextType {
id: expandedServersMenuDescription
Layout.bottomMargin: 24
Layout.fillWidth: true
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
text: ServersModel.defaultServerDescriptionExpanded
}
RowLayout {
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
spacing: 8
DropDownType {
id: containersDropDown
rootButtonImageColor: "#0E0E11"
rootButtonBackgroundColor: "#D7D8DB"
rootButtonBackgroundHoveredColor: Qt.rgba(215, 216, 219, 0.8)
rootButtonBackgroundPressedColor: Qt.rgba(215, 216, 219, 0.65)
rootButtonHoveredBorderColor: "transparent"
rootButtonDefaultBorderColor: "transparent"
rootButtonTextTopMargin: 8
rootButtonTextBottomMargin: 8
text: ServersModel.defaultContainerName
textColor: "#0E0E11"
headerText: qsTr("VPN protocol")
headerBackButtonImage: "qrc:/images/controls/arrow-left.svg"
rootButtonClickedFunction: function() {
ServersModel.currentlyProcessedIndex = serversMenuContent.currentIndex
containersDropDown.open()
}
drawerParent: root
listView: HomeContainersListView {
rootWidth: root.width
Connections {
target: ServersModel
function onCurrentlyProcessedServerIndexChanged() {
updateContainersModelFilters()
}
}
function updateContainersModelFilters() {
if (ServersModel.isCurrentlyProcessedServerHasWriteAccess()) {
proxyContainersModel.filters = ContainersModelFilters.getWriteAccessProtocolsListFilters()
} else {
proxyContainersModel.filters = ContainersModelFilters.getReadAccessProtocolsListFilters()
}
}
model: SortFilterProxyModel {
id: proxyContainersModel
sourceModel: ContainersModel
}
Component.onCompleted: updateContainersModelFilters()
}
}
}
Header2Type {
Layout.fillWidth: true
Layout.topMargin: 48
Layout.leftMargin: 16
Layout.rightMargin: 16
headerText: qsTr("Servers")
}
}
Flickable {
id: serversContainer
anchors.top: serversMenuHeader.bottom
anchors.right: parent.right
anchors.left: parent.left
anchors.topMargin: 16
contentHeight: col.height + col.anchors.bottomMargin
implicitHeight: parent.height - serversMenuHeader.implicitHeight
clip: true
ScrollBar.vertical: ScrollBar {
id: scrollBar
policy: serversContainer.height >= serversContainer.contentHeight ? ScrollBar.AlwaysOff : ScrollBar.AlwaysOn
}
Keys.onUpPressed: scrollBar.decrease()
Keys.onDownPressed: scrollBar.increase()
Column {
id: col
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.bottomMargin: 32
spacing: 16
ButtonGroup {
id: serversRadioButtonGroup
}
ListView {
id: serversMenuContent
width: parent.width
height: serversMenuContent.contentItem.height
model: ServersModel
currentIndex: ServersModel.defaultIndex
Connections { Connections {
target: ServersModel target: ServersModel
function onDefaultServerIndexChanged(serverIndex) {
function onCurrentlyProcessedServerIndexChanged() { serversMenuContent.currentIndex = serverIndex
updateContainersModelFilters()
} }
} }
function updateContainersModelFilters() { clip: true
if (ServersModel.isCurrentlyProcessedServerHasWriteAccess()) { interactive: false
proxyContainersModel.filters = ContainersModelFilters.getWriteAccessProtocolsListFilters()
} else {
proxyContainersModel.filters = ContainersModelFilters.getReadAccessProtocolsListFilters()
}
}
model: SortFilterProxyModel { delegate: Item {
id: proxyContainersModel id: menuContentDelegate
sourceModel: ContainersModel
}
Component.onCompleted: updateContainersModelFilters() property variant delegateData: model
}
}
}
Header2Type { implicitWidth: serversMenuContent.width
Layout.fillWidth: true implicitHeight: serverRadioButtonContent.implicitHeight
Layout.topMargin: 48
Layout.leftMargin: 16
Layout.rightMargin: 16
visible: buttonContent.expandedVisibility
headerText: qsTr("Servers") ColumnLayout {
} id: serverRadioButtonContent
}
Flickable { anchors.fill: parent
id: serversContainer anchors.rightMargin: 16
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter anchors.leftMargin: 16
Layout.fillWidth: true
Layout.topMargin: 16
contentHeight: col.implicitHeight
implicitHeight: root.height - (root.height * 0.1) - serversMenuHeader.implicitHeight - 52 //todo 52 is tabbar height
visible: buttonContent.expandedVisibility
clip: true
ScrollBar.vertical: ScrollBar { spacing: 0
id: scrollBar
policy: serversContainer.height >= serversContainer.contentHeight ? ScrollBar.AlwaysOff : ScrollBar.AlwaysOn
}
Keys.onUpPressed: scrollBar.decrease() RowLayout {
Keys.onDownPressed: scrollBar.increase() VerticalRadioButton {
id: serverRadioButton
Column { Layout.fillWidth: true
id: col
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
spacing: 16 text: name
descriptionText: {
var fullDescription = ""
if (hasWriteAccess) {
if (SettingsController.isAmneziaDnsEnabled()
&& ServersModel.isAmneziaDnsContainerInstalled(index)) {
fullDescription += "Amnezia DNS | "
}
} else {
if (containsAmneziaDns) {
fullDescription += "Amnezia DNS | "
}
}
ButtonGroup { return fullDescription += serverDescription
id: serversRadioButtonGroup }
}
ListView { checked: index === serversMenuContent.currentIndex
id: serversMenuContent checkable: !ConnectionController.isConnected
width: parent.width
height: serversMenuContent.contentItem.height
model: ServersModel ButtonGroup.group: serversRadioButtonGroup
currentIndex: ServersModel.defaultIndex
Connections { onClicked: {
target: ServersModel if (ConnectionController.isConnected) {
function onDefaultServerIndexChanged(serverIndex) { PageController.showNotificationMessage(qsTr("Unable change server while there is an active connection"))
serversMenuContent.currentIndex = serverIndex return
} }
}
clip: true serversMenuContent.currentIndex = index
interactive: false
delegate: Item { ServersModel.currentlyProcessedIndex = index
id: menuContentDelegate ServersModel.defaultIndex = index
}
property variant delegateData: model MouseArea {
anchors.fill: serverRadioButton
cursorShape: Qt.PointingHandCursor
enabled: false
}
}
implicitWidth: serversMenuContent.width ImageButtonType {
implicitHeight: serverRadioButtonContent.implicitHeight image: "qrc:/images/controls/settings.svg"
imageColor: "#D7D8DB"
ColumnLayout { implicitWidth: 56
id: serverRadioButtonContent implicitHeight: 56
anchors.fill: parent z: 1
anchors.rightMargin: 16
anchors.leftMargin: 16
spacing: 0 onClicked: function() {
ServersModel.currentlyProcessedIndex = index
RowLayout { PageController.goToPage(PageEnum.PageSettingsServerInfo)
VerticalRadioButton { drawer.close()
id: serverRadioButton }
}
}
DividerType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: 0
text: name Layout.rightMargin: 0
descriptionText: {
var fullDescription = ""
if (hasWriteAccess) {
if (SettingsController.isAmneziaDnsEnabled()
&& ServersModel.isAmneziaDnsContainerInstalled(index)) {
fullDescription += "Amnezia DNS | "
}
} else {
if (containsAmneziaDns) {
fullDescription += "Amnezia DNS | "
}
}
return fullDescription += serverDescription
}
checked: index === serversMenuContent.currentIndex
checkable: !ConnectionController.isConnected
ButtonGroup.group: serversRadioButtonGroup
onClicked: {
if (ConnectionController.isConnected) {
PageController.showNotificationMessage(qsTr("Unable change server while there is an active connection"))
return
}
serversMenuContent.currentIndex = index
ServersModel.currentlyProcessedIndex = index
ServersModel.defaultIndex = index
}
MouseArea {
anchors.fill: serverRadioButton
cursorShape: Qt.PointingHandCursor
enabled: false
}
} }
ImageButtonType {
image: "qrc:/images/controls/settings.svg"
imageColor: "#D7D8DB"
implicitWidth: 56
implicitHeight: 56
z: 1
onClicked: function() {
ServersModel.currentlyProcessedIndex = index
PageController.goToPage(PageEnum.PageSettingsServerInfo)
buttonContent.state = "collapsed"
}
}
}
DividerType {
Layout.fillWidth: true
Layout.leftMargin: 0
Layout.rightMargin: 0
} }
} }
} }

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,71 +90,77 @@ PageType {
DividerType {} DividerType {}
DrawerType { DrawerType2 {
id: configContentDrawer id: configContentDrawer
width: parent.width expandedHeight: root.height * 0.9
height: parent.height * 0.9
BackButtonType { parent: root
id: backButton anchors.fill: parent
anchors.top: parent.top expandedContent: Item {
anchors.left: parent.left implicitHeight: configContentDrawer.expandedHeight
anchors.right: parent.right
anchors.topMargin: 16
backButtonFunction: function() { BackButtonType {
configContentDrawer.visible = false id: backButton
}
}
FlickableType { anchors.top: parent.top
anchors.top: backButton.bottom anchors.left: parent.left
anchors.left: parent.left anchors.right: parent.right
anchors.right: parent.right anchors.topMargin: 16
anchors.bottom: parent.bottom
contentHeight: configContent.implicitHeight + configContent.anchors.topMargin + configContent.anchors.bottomMargin
ColumnLayout { backButtonFunction: function() {
id: configContent configContentDrawer.close()
anchors.fill: parent
anchors.rightMargin: 16
anchors.leftMargin: 16
Header2Type {
Layout.fillWidth: true
Layout.topMargin: 16
headerText: qsTr("Connection options %1").arg(protocolName)
} }
}
TextArea { FlickableType {
id: configText anchors.top: backButton.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
contentHeight: configContent.implicitHeight + configContent.anchors.topMargin + configContent.anchors.bottomMargin
Layout.fillWidth: true ColumnLayout {
Layout.topMargin: 16 id: configContent
Layout.bottomMargin: 16
padding: 0 anchors.fill: parent
leftPadding: 0 anchors.rightMargin: 16
height: 24 anchors.leftMargin: 16
color: "#D7D8DB" Header2Type {
selectionColor: "#633303" Layout.fillWidth: true
selectedTextColor: "#D7D8DB" Layout.topMargin: 16
font.pixelSize: 16 headerText: qsTr("Connection options %1").arg(protocolName)
font.weight: Font.Medium }
font.family: "PT Root UI VF"
text: rawConfig TextArea {
id: configText
wrapMode: Text.Wrap Layout.fillWidth: true
Layout.topMargin: 16
Layout.bottomMargin: 16
background: Rectangle { padding: 0
color: "transparent" leftPadding: 0
height: 24
color: "#D7D8DB"
selectionColor: "#633303"
selectedTextColor: "#D7D8DB"
font.pixelSize: 16
font.weight: Font.Medium
font.family: "PT Root UI VF"
text: rawConfig
wrapMode: Text.Wrap
background: Rectangle {
color: "transparent"
}
} }
} }
} }
@ -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
showQuestionDrawer(headerText, "", yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
} }
} }
} }
} }
} }
} }
QuestionDrawer {
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
showQuestionDrawer(headerText, "", yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
} }
} }
} }
QuestionDrawer {
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 {
id: questionDrawer
}
} }
} }
SelectLanguageDrawer {
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,151 +271,155 @@ PageType {
} }
} }
DrawerType { DrawerType2 {
id: moreActionsDrawer id: moreActionsDrawer
width: parent.width anchors.fill: parent
height: parent.height * 0.4375 expandedHeight: parent.height * 0.4375
FlickableType { expandedContent: ColumnLayout {
anchors.fill: parent id: moreActionsDrawerContent
contentHeight: moreActionsDrawerContent.height
ColumnLayout {
id: moreActionsDrawerContent
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
Header2Type {
Layout.fillWidth: true
Layout.margins: 16
headerText: qsTr("Import / Export Sites")
}
LabelWithButtonType {
Layout.fillWidth: true
text: qsTr("Import")
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
importSitesDrawer.open()
}
}
DividerType {}
LabelWithButtonType {
Layout.fillWidth: true
text: qsTr("Save site list")
clickedFunction: function() {
var fileName = ""
if (GC.isMobile()) {
fileName = "amnezia_sites.json"
} else {
fileName = SystemController.getFileName(qsTr("Save sites"),
qsTr("Sites files (*.json)"),
StandardPaths.standardLocations(StandardPaths.DocumentsLocation) + "/amnezia_sites",
true,
".json")
}
if (fileName !== "") {
PageController.showBusyIndicator(true)
SitesController.exportSites(fileName)
moreActionsDrawer.close()
PageController.showBusyIndicator(false)
}
}
}
DividerType {}
}
}
}
DrawerType {
id: importSitesDrawer
width: parent.width
height: parent.height * 0.4375
BackButtonType {
id: importSitesDrawerBackButton
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
backButtonFunction: function() { Header2Type {
importSitesDrawer.close() Layout.fillWidth: true
Layout.margins: 16
headerText: qsTr("Import / Export Sites")
} }
LabelWithButtonType {
Layout.fillWidth: true
text: qsTr("Import")
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
importSitesDrawer.open()
}
}
DividerType {}
LabelWithButtonType {
Layout.fillWidth: true
text: qsTr("Save site list")
clickedFunction: function() {
var fileName = ""
if (GC.isMobile()) {
fileName = "amnezia_sites.json"
} else {
fileName = SystemController.getFileName(qsTr("Save sites"),
qsTr("Sites files (*.json)"),
StandardPaths.standardLocations(StandardPaths.DocumentsLocation) + "/amnezia_sites",
true,
".json")
}
if (fileName !== "") {
PageController.showBusyIndicator(true)
SitesController.exportSites(fileName)
moreActionsDrawer.close()
PageController.showBusyIndicator(false)
}
}
}
DividerType {}
} }
}
FlickableType { DrawerType2 {
anchors.top: importSitesDrawerBackButton.bottom id: importSitesDrawer
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
contentHeight: importSitesDrawerContent.height anchors.fill: parent
expandedHeight: parent.height * 0.4375
ColumnLayout { expandedContent: Item {
id: importSitesDrawerContent implicitHeight: importSitesDrawer.expandedHeight
BackButtonType {
id: importSitesDrawerBackButton
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
Header2Type { backButtonFunction: function() {
Layout.fillWidth: true
Layout.margins: 16
headerText: qsTr("Import a list of sites")
}
LabelWithButtonType {
Layout.fillWidth: true
text: qsTr("Replace site list")
clickedFunction: function() {
var fileName = SystemController.getFileName(qsTr("Open sites file"),
qsTr("Sites files (*.json)"))
if (fileName !== "") {
importSitesDrawerContent.importSites(fileName, true)
}
}
}
DividerType {}
LabelWithButtonType {
Layout.fillWidth: true
text: qsTr("Add imported sites to existing ones")
clickedFunction: function() {
var fileName = SystemController.getFileName(qsTr("Open sites file"),
qsTr("Sites files (*.json)"))
if (fileName !== "") {
importSitesDrawerContent.importSites(fileName, false)
}
}
}
function importSites(fileName, replaceExistingSites) {
PageController.showBusyIndicator(true)
SitesController.importSites(fileName, replaceExistingSites)
PageController.showBusyIndicator(false)
importSitesDrawer.close() importSitesDrawer.close()
moreActionsDrawer.close()
} }
}
DividerType {} FlickableType {
anchors.top: importSitesDrawerBackButton.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
contentHeight: importSitesDrawerContent.height
ColumnLayout {
id: importSitesDrawerContent
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
Header2Type {
Layout.fillWidth: true
Layout.margins: 16
headerText: qsTr("Import a list of sites")
}
LabelWithButtonType {
Layout.fillWidth: true
text: qsTr("Replace site list")
clickedFunction: function() {
var fileName = SystemController.getFileName(qsTr("Open sites file"),
qsTr("Sites files (*.json)"))
if (fileName !== "") {
importSitesDrawerContent.importSites(fileName, true)
}
}
}
DividerType {}
LabelWithButtonType {
Layout.fillWidth: true
text: qsTr("Add imported sites to existing ones")
clickedFunction: function() {
var fileName = SystemController.getFileName(qsTr("Open sites file"),
qsTr("Sites files (*.json)"))
if (fileName !== "") {
importSitesDrawerContent.importSites(fileName, false)
}
}
}
function importSites(fileName, replaceExistingSites) {
PageController.showBusyIndicator(true)
SitesController.importSites(fileName, replaceExistingSites)
PageController.showBusyIndicator(false)
importSitesDrawer.close()
moreActionsDrawer.close()
}
DividerType {}
}
} }
} }
} }
QuestionDrawer {
id: questionDrawer
}
} }

View file

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

View file

@ -97,76 +97,80 @@ 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
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 16
backButtonFunction: function() {
showDetailsDrawer.close()
}
}
FlickableType {
anchors.top: showDetailsBackButton.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
contentHeight: {
var emptySpaceHeight = parent.height - showDetailsBackButton.implicitHeight - showDetailsBackButton.anchors.topMargin
return (showDetailsDrawerContent.height > emptySpaceHeight) ?
showDetailsDrawerContent.height : emptySpaceHeight
}
ColumnLayout {
id: showDetailsDrawerContent
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.rightMargin: 16 anchors.topMargin: 16
anchors.leftMargin: 16
Header2Type { backButtonFunction: function() {
id: showDetailsDrawerHeader showDetailsDrawer.close()
Layout.fillWidth: true }
Layout.topMargin: 16 }
headerText: name FlickableType {
anchors.top: showDetailsBackButton.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
contentHeight: {
var emptySpaceHeight = parent.height - showDetailsBackButton.implicitHeight - showDetailsBackButton.anchors.topMargin
return (showDetailsDrawerContent.height > emptySpaceHeight) ?
showDetailsDrawerContent.height : emptySpaceHeight
} }
ParagraphTextType { ColumnLayout {
Layout.fillWidth: true id: showDetailsDrawerContent
Layout.topMargin: 16
Layout.bottomMargin: 16
text: detailedDescription anchors.top: parent.top
textFormat: Text.MarkdownText anchors.left: parent.left
} anchors.right: parent.right
anchors.rightMargin: 16
anchors.leftMargin: 16
Header2Type {
id: showDetailsDrawerHeader
Layout.fillWidth: true
Layout.topMargin: 16
headerText: name
}
ParagraphTextType {
Layout.fillWidth: true
Layout.topMargin: 16
Layout.bottomMargin: 16
text: detailedDescription
textFormat: Text.MarkdownText
}
Rectangle { Rectangle {
Layout.fillHeight: true Layout.fillHeight: true
color: "transparent" color: "transparent"
} }
BasicButtonType { BasicButtonType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.bottomMargin: 32 Layout.bottomMargin: 32
text: qsTr("Close") text: qsTr("Close")
onClicked: function() { onClicked: function() {
showDetailsDrawer.close() showDetailsDrawer.close()
}
} }
} }
} }

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,10 +138,10 @@ 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 {

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,19 @@ 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()
} }
questionDrawer.open()
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
} }
} }
} }
@ -690,12 +687,15 @@ PageType {
} }
} }
} }
QuestionDrawer {
id: questionDrawer
}
} }
} }
ShareConnectionDrawer {
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 {
id: shareConnectionDrawer
}
} }
} }
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