added close button when drawer shown in the topright corner
This commit is contained in:
parent
c0aca97083
commit
8a3bdf136b
7 changed files with 124 additions and 0 deletions
|
@ -213,5 +213,6 @@
|
||||||
<file>images/controls/trash.svg</file>
|
<file>images/controls/trash.svg</file>
|
||||||
<file>images/controls/more-vertical.svg</file>
|
<file>images/controls/more-vertical.svg</file>
|
||||||
<file>ui/qml/Controls2/ListViewWithLabelsType.qml</file>
|
<file>ui/qml/Controls2/ListViewWithLabelsType.qml</file>
|
||||||
|
<file>ui/qml/Controls2/TopCloseButtonType.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -115,3 +115,33 @@ void PageController::showOnStartup()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PageController::updateDrawerRootPage(PageLoader::PageEnum page)
|
||||||
|
{
|
||||||
|
m_drwaerLayer = 0;
|
||||||
|
m_currentRootPage = page;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PageController::goToDrawerRootPage()
|
||||||
|
{
|
||||||
|
|
||||||
|
m_drwaerLayer = 0;
|
||||||
|
|
||||||
|
emit showTopCloseButton(false);
|
||||||
|
emit forceCloseDrawer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PageController::drawerOpen()
|
||||||
|
{
|
||||||
|
m_drwaerLayer = m_drwaerLayer + 1;
|
||||||
|
emit showTopCloseButton(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PageController::drawerClose()
|
||||||
|
{
|
||||||
|
m_drwaerLayer = m_drwaerLayer -1;
|
||||||
|
if (m_drwaerLayer <= 0) {
|
||||||
|
emit showTopCloseButton(false);
|
||||||
|
m_drwaerLayer = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -78,6 +78,11 @@ public slots:
|
||||||
|
|
||||||
void showOnStartup();
|
void showOnStartup();
|
||||||
|
|
||||||
|
void updateDrawerRootPage(PageLoader::PageEnum page);
|
||||||
|
void goToDrawerRootPage();
|
||||||
|
void drawerOpen();
|
||||||
|
void drawerClose();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void goToPage(PageLoader::PageEnum page, bool slide = true);
|
void goToPage(PageLoader::PageEnum page, bool slide = true);
|
||||||
void goToStartPage();
|
void goToStartPage();
|
||||||
|
@ -104,10 +109,16 @@ 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_drwaerLayer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PAGECONTROLLER_H
|
#endif // PAGECONTROLLER_H
|
||||||
|
|
|
@ -2,6 +2,16 @@ import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
|
||||||
Drawer {
|
Drawer {
|
||||||
|
property bool needCloseButton: true
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: PageController
|
||||||
|
|
||||||
|
function onForceCloseDrawer() {
|
||||||
|
visible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
edge: Qt.BottomEdge
|
edge: Qt.BottomEdge
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
|
@ -40,7 +50,18 @@ Drawer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onOpened: {
|
||||||
|
if (needCloseButton) {
|
||||||
|
PageController.drawerOpen()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
onClosed: {
|
onClosed: {
|
||||||
|
if (needCloseButton) {
|
||||||
|
PageController.drawerClose()
|
||||||
|
}
|
||||||
|
|
||||||
var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor()
|
var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor()
|
||||||
if (initialPageNavigationBarColor !== 0xFF1C1D21) {
|
if (initialPageNavigationBarColor !== 0xFF1C1D21) {
|
||||||
PageController.updateNavigationBarColor(initialPageNavigationBarColor)
|
PageController.updateNavigationBarColor(initialPageNavigationBarColor)
|
||||||
|
|
35
client/ui/qml/Controls2/TopCloseButtonType.qml
Normal file
35
client/ui/qml/Controls2/TopCloseButtonType.qml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Shapes
|
||||||
|
|
||||||
|
Popup {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
modal: false
|
||||||
|
closePolicy: Popup.NoAutoClose
|
||||||
|
width: 40
|
||||||
|
height: 40
|
||||||
|
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"
|
||||||
|
|
||||||
|
implicitWidth: 32
|
||||||
|
implicitHeight: 32
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
PageController.goToDrawerRootPage()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,6 +27,8 @@ PageType {
|
||||||
target: ExportController
|
target: ExportController
|
||||||
|
|
||||||
function onGenerateConfig(type) {
|
function onGenerateConfig(type) {
|
||||||
|
shareConnectionDrawer.needCloseButton = false
|
||||||
|
|
||||||
shareConnectionDrawer.open()
|
shareConnectionDrawer.open()
|
||||||
shareConnectionDrawer.contentVisible = false
|
shareConnectionDrawer.contentVisible = false
|
||||||
PageController.showBusyIndicator(true)
|
PageController.showBusyIndicator(true)
|
||||||
|
@ -58,6 +60,10 @@ PageType {
|
||||||
}
|
}
|
||||||
|
|
||||||
PageController.showBusyIndicator(false)
|
PageController.showBusyIndicator(false)
|
||||||
|
|
||||||
|
shareConnectionDrawer.needCloseButton = true
|
||||||
|
PageController.showTopCloseButton(true)
|
||||||
|
|
||||||
shareConnectionDrawer.contentVisible = true
|
shareConnectionDrawer.contentVisible = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,16 +19,22 @@ PageType {
|
||||||
function onGoToPageHome() {
|
function onGoToPageHome() {
|
||||||
tabBar.currentIndex = 0
|
tabBar.currentIndex = 0
|
||||||
tabBarStackView.goToTabBarPage(PageEnum.PageHome)
|
tabBarStackView.goToTabBarPage(PageEnum.PageHome)
|
||||||
|
|
||||||
|
PageController.updateDrawerRootPage(PageEnum.PageHome)
|
||||||
}
|
}
|
||||||
|
|
||||||
function onGoToPageSettings() {
|
function onGoToPageSettings() {
|
||||||
tabBar.currentIndex = 2
|
tabBar.currentIndex = 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) {
|
||||||
|
@ -37,6 +43,10 @@ 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
|
||||||
}
|
}
|
||||||
|
@ -55,6 +65,8 @@ PageType {
|
||||||
} else {
|
} else {
|
||||||
tabBarStackView.push(pagePath, { "objectName" : pagePath }, StackView.Immediate)
|
tabBarStackView.push(pagePath, { "objectName" : pagePath }, StackView.Immediate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PageController.updateDrawerRootPage(page)
|
||||||
}
|
}
|
||||||
|
|
||||||
function onGoToStartPage() {
|
function onGoToStartPage() {
|
||||||
|
@ -99,6 +111,8 @@ 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: {
|
||||||
|
@ -183,4 +197,10 @@ PageType {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
z: 1
|
z: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TopCloseButtonType {
|
||||||
|
id: topCloseButton
|
||||||
|
x: tabBarStackView.width - topCloseButton.width
|
||||||
|
z: 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue