diff --git a/client/resources.qrc b/client/resources.qrc index 5b919cf4..5b4d6ae7 100644 --- a/client/resources.qrc +++ b/client/resources.qrc @@ -214,5 +214,6 @@ images/controls/more-vertical.svg ui/qml/Controls2/ListViewWithLabelsType.qml ui/qml/Pages2/PageServiceDnsSettings.qml + ui/qml/Controls2/TopCloseButtonType.qml diff --git a/client/ui/controllers/pageController.cpp b/client/ui/controllers/pageController.cpp index 46a1b1fd..7b8f74ab 100644 --- a/client/ui/controllers/pageController.cpp +++ b/client/ui/controllers/pageController.cpp @@ -115,3 +115,33 @@ void PageController::showOnStartup() #endif } } + +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; + } +} diff --git a/client/ui/controllers/pageController.h b/client/ui/controllers/pageController.h index 508a9d58..a8f883fe 100644 --- a/client/ui/controllers/pageController.h +++ b/client/ui/controllers/pageController.h @@ -79,6 +79,11 @@ public slots: void showOnStartup(); + void updateDrawerRootPage(PageLoader::PageEnum page); + void goToDrawerRootPage(); + void drawerOpen(); + void drawerClose(); + signals: void goToPage(PageLoader::PageEnum page, bool slide = true); void goToStartPage(); @@ -105,10 +110,16 @@ signals: void showPassphraseRequestDrawer(); void passphraseRequestDrawerClosed(QString passphrase); + void showTopCloseButton(bool visible); + void forceCloseDrawer(); + private: QSharedPointer m_serversModel; std::shared_ptr m_settings; + + PageLoader::PageEnum m_currentRootPage; + int m_drawerLayer; }; #endif // PAGECONTROLLER_H diff --git a/client/ui/qml/Controls2/DrawerType.qml b/client/ui/qml/Controls2/DrawerType.qml index 35d03449..34b141b4 100644 --- a/client/ui/qml/Controls2/DrawerType.qml +++ b/client/ui/qml/Controls2/DrawerType.qml @@ -2,6 +2,16 @@ import QtQuick import QtQuick.Controls Drawer { + property bool needCloseButton: true + + Connections { + target: PageController + + function onForceCloseDrawer() { + visible = false + } + } + edge: Qt.BottomEdge clip: true @@ -38,6 +48,16 @@ Drawer { if (PageController.getInitialPageNavigationBarColor() !== 0xFF1C1D21) { PageController.updateNavigationBarColor(0xFF1C1D21) } + + if (needCloseButton) { + PageController.drawerOpen() + } + } + + onAboutToHide: { + if (needCloseButton) { + PageController.drawerClose() + } } onClosed: { diff --git a/client/ui/qml/Controls2/TextAreaType.qml b/client/ui/qml/Controls2/TextAreaType.qml index a7e2fee7..4b70c274 100644 --- a/client/ui/qml/Controls2/TextAreaType.qml +++ b/client/ui/qml/Controls2/TextAreaType.qml @@ -16,6 +16,9 @@ Rectangle { radius: 16 FlickableType { + id: fl + interactive: false + anchors.top: parent.top anchors.bottom: parent.bottom contentHeight: textArea.implicitHeight @@ -41,12 +44,23 @@ Rectangle { placeholderText: root.placeholderText text: root.text + onCursorVisibleChanged: { + if (textArea.cursorVisible) { + fl.interactive = true + } else { + fl.interactive = false + } + } + wrapMode: Text.Wrap MouseArea { anchors.fill: parent acceptedButtons: Qt.RightButton - onClicked: contextMenu.open() + onClicked: { + fl.interactive = true + contextMenu.open() + } } ContextMenuType { diff --git a/client/ui/qml/Controls2/TopCloseButtonType.qml b/client/ui/qml/Controls2/TopCloseButtonType.qml new file mode 100644 index 00000000..ed89b5a6 --- /dev/null +++ b/client/ui/qml/Controls2/TopCloseButtonType.qml @@ -0,0 +1,30 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Shapes + +Popup { + id: root + + modal: false + closePolicy: Popup.NoAutoClose + padding: 4 + + visible: false + + Overlay.modal: Rectangle { + color: Qt.rgba(14/255, 14/255, 17/255, 0.8) + } + + background: Rectangle { + color: "transparent" + } + + ImageButtonType { + image: "qrc:/images/svg/close_black_24dp.svg" + imageColor: "#D7D8DB" + + onClicked: { + PageController.goToDrawerRootPage() + } + } +} diff --git a/client/ui/qml/Pages2/PageShare.qml b/client/ui/qml/Pages2/PageShare.qml index 67083949..a03b3717 100644 --- a/client/ui/qml/Pages2/PageShare.qml +++ b/client/ui/qml/Pages2/PageShare.qml @@ -27,6 +27,8 @@ PageType { target: ExportController function onGenerateConfig(type) { + shareConnectionDrawer.needCloseButton = false + shareConnectionDrawer.open() shareConnectionDrawer.contentVisible = false PageController.showBusyIndicator(true) @@ -58,6 +60,10 @@ PageType { } PageController.showBusyIndicator(false) + + shareConnectionDrawer.needCloseButton = true + PageController.showTopCloseButton(true) + shareConnectionDrawer.contentVisible = true } diff --git a/client/ui/qml/Pages2/PageStart.qml b/client/ui/qml/Pages2/PageStart.qml index 4db22c3f..43366af7 100644 --- a/client/ui/qml/Pages2/PageStart.qml +++ b/client/ui/qml/Pages2/PageStart.qml @@ -19,16 +19,22 @@ PageType { function onGoToPageHome() { tabBar.currentIndex = 0 tabBarStackView.goToTabBarPage(PageEnum.PageHome) + + PageController.updateDrawerRootPage(PageEnum.PageHome) } function onGoToPageSettings() { tabBar.currentIndex = 2 tabBarStackView.goToTabBarPage(PageEnum.PageSettings) + + PageController.updateDrawerRootPage(PageEnum.PageSettings) } function onGoToPageViewConfig() { var pagePath = PageController.getPagePath(PageEnum.PageSetupWizardViewConfig) tabBarStackView.push(pagePath, { "objectName" : pagePath }, StackView.PushTransition) + + PageController.updateDrawerRootPage(PageEnum.PageSetupWizardViewConfig) } function onShowBusyIndicator(visible) { @@ -37,6 +43,10 @@ PageType { tabBar.enabled = !visible } + function onShowTopCloseButton(visible) { + topCloseButton.visible = visible + } + function onEnableTabBar(enabled) { tabBar.enabled = enabled } @@ -55,6 +65,8 @@ PageType { } else { tabBarStackView.push(pagePath, { "objectName" : pagePath }, StackView.Immediate) } + + PageController.updateDrawerRootPage(page) } function onGoToStartPage() { @@ -111,6 +123,8 @@ PageType { var pagePath = PageController.getPagePath(page) tabBarStackView.clear(StackView.Immediate) tabBarStackView.replace(pagePath, { "objectName" : pagePath }, StackView.Immediate) + + PageController.updateDrawerRootPage(page) } Component.onCompleted: { @@ -195,4 +209,10 @@ PageType { anchors.centerIn: parent z: 1 } + + TopCloseButtonType { + id: topCloseButton + x: tabBarStackView.width - topCloseButton.width + z: 1 + } }