mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-23 02:00:20 +07:00
Merge branch 'dev' of github.com:amnezia-vpn/desktop-client into feature/new-gui
This commit is contained in:
+30
-4
@@ -12,12 +12,14 @@ import "Controls"
|
||||
import "Pages"
|
||||
import "Pages/Protocols"
|
||||
import "Pages/Share"
|
||||
import "Pages/ClientInfo"
|
||||
import "Config"
|
||||
|
||||
Window {
|
||||
property var pages: ({})
|
||||
property var protocolPages: ({})
|
||||
property var sharePages: ({})
|
||||
property var clientInfoPages: ({})
|
||||
|
||||
id: root
|
||||
visible: true
|
||||
@@ -38,6 +40,7 @@ Window {
|
||||
if (type === PageType.Basic) p_obj = pages[page]
|
||||
else if (type === PageType.Proto) p_obj = protocolPages[page]
|
||||
else if (type === PageType.ShareProto) p_obj = sharePages[page]
|
||||
else if (type === PageType.ClientInfo) p_obj = clientInfoPages[page]
|
||||
else return
|
||||
|
||||
//console.debug("QML gotoPage " + type + " " + page + " " + p_obj)
|
||||
@@ -61,8 +64,12 @@ Window {
|
||||
|
||||
function close_page() {
|
||||
if (pageLoader.depth <= 1) {
|
||||
if (GC.isMobile()) {
|
||||
root.close()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
pageLoader.currentItem.deactivated()
|
||||
pageLoader.pop()
|
||||
}
|
||||
@@ -119,7 +126,7 @@ Window {
|
||||
for (var i=0; i<folderModelPages.count; i++) {
|
||||
createPagesObjects(folderModelPages.get(i, "filePath"), PageType.Basic);
|
||||
}
|
||||
UiLogic.initalizeUiLogic()
|
||||
UiLogic.initializeUiLogic()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,9 +156,22 @@ Window {
|
||||
}
|
||||
}
|
||||
|
||||
FolderListModel {
|
||||
id: folderModelClientInfo
|
||||
folder: "qrc:/ui/qml/Pages/ClientInfo/"
|
||||
nameFilters: ["*.qml"]
|
||||
showDirs: false
|
||||
|
||||
onStatusChanged: if (status == FolderListModel.Ready) {
|
||||
for (var i=0; i<folderModelClientInfo.count; i++) {
|
||||
createPagesObjects(folderModelClientInfo.get(i, "filePath"), PageType.ClientInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createPagesObjects(file, type) {
|
||||
if (file.indexOf("Base") !== -1) return; // skip Base Pages
|
||||
//console.debug("Creating compenent " + file + " for " + type);
|
||||
//console.debug("Creating component " + file + " for " + type);
|
||||
|
||||
var c = Qt.createComponent("qrc" + file);
|
||||
|
||||
@@ -172,8 +192,11 @@ Window {
|
||||
else if (type === PageType.ShareProto) {
|
||||
sharePages[obj.protocol] = obj
|
||||
}
|
||||
else if (type === PageType.ClientInfo) {
|
||||
clientInfoPages[obj.protocol] = obj
|
||||
}
|
||||
|
||||
// console.debug("Created compenent " + component.url + " for " + type);
|
||||
// console.debug("Created component " + component.url + " for " + type);
|
||||
}
|
||||
} else if (component.status === Component.Error) {
|
||||
console.debug("Error loading component:", component.errorString());
|
||||
@@ -201,7 +224,10 @@ Window {
|
||||
//console.debug("Qml Connections onGoToShareProtocolPage " + protocol);
|
||||
root.gotoPage(PageType.ShareProto, protocol, reset, slide)
|
||||
}
|
||||
|
||||
function onGoToClientInfoPage(protocol, reset, slide) {
|
||||
//console.debug("Qml Connections onGoToClientInfoPage " + protocol);
|
||||
root.gotoPage(PageType.ClientInfo, protocol, reset, slide)
|
||||
}
|
||||
|
||||
function onClosePage() {
|
||||
root.close_page()
|
||||
|
||||
Reference in New Issue
Block a user