added PageLoader and pageController
This commit is contained in:
parent
116fa6777b
commit
03a0e2084a
27 changed files with 265 additions and 193 deletions
|
@ -118,6 +118,9 @@ void AmneziaApplication::init()
|
||||||
m_vpnConnection.get(), &VpnConnection::disconnectFromVpn, Qt::QueuedConnection);
|
m_vpnConnection.get(), &VpnConnection::disconnectFromVpn, Qt::QueuedConnection);
|
||||||
m_engine->rootContext()->setContextProperty("ConnectionController", m_connectionController.get());
|
m_engine->rootContext()->setContextProperty("ConnectionController", m_connectionController.get());
|
||||||
|
|
||||||
|
m_pageController.reset(new PageController(m_serversModel));
|
||||||
|
m_engine->rootContext()->setContextProperty("PageController", m_pageController.get());
|
||||||
|
|
||||||
//
|
//
|
||||||
m_uiLogic->registerPagesLogic();
|
m_uiLogic->registerPagesLogic();
|
||||||
|
|
||||||
|
@ -185,6 +188,7 @@ void AmneziaApplication::registerTypes()
|
||||||
|
|
||||||
//
|
//
|
||||||
Vpn::declareQmlVpnConnectionStateEnum();
|
Vpn::declareQmlVpnConnectionStateEnum();
|
||||||
|
PageLoader::declareQmlPageEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AmneziaApplication::loadFonts()
|
void AmneziaApplication::loadFonts()
|
||||||
|
|
|
@ -13,9 +13,11 @@
|
||||||
|
|
||||||
#include "ui/uilogic.h"
|
#include "ui/uilogic.h"
|
||||||
#include "configurators/vpn_configurator.h"
|
#include "configurators/vpn_configurator.h"
|
||||||
|
|
||||||
#include "ui/models/servers_model.h"
|
#include "ui/models/servers_model.h"
|
||||||
#include "ui/models/containers_model.h"
|
#include "ui/models/containers_model.h"
|
||||||
#include "ui/controllers/connectionController.h"
|
#include "ui/controllers/connectionController.h"
|
||||||
|
#include "ui/controllers/pageController.h"
|
||||||
|
|
||||||
#define amnApp (static_cast<AmneziaApplication *>(QCoreApplication::instance()))
|
#define amnApp (static_cast<AmneziaApplication *>(QCoreApplication::instance()))
|
||||||
|
|
||||||
|
@ -66,6 +68,7 @@ private:
|
||||||
QScopedPointer<VpnConnection> m_vpnConnection;
|
QScopedPointer<VpnConnection> m_vpnConnection;
|
||||||
|
|
||||||
QScopedPointer<ConnectionController> m_connectionController;
|
QScopedPointer<ConnectionController> m_connectionController;
|
||||||
|
QScopedPointer<PageController> m_pageController;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
5
client/images/controls/download.svg
Normal file
5
client/images/controls/download.svg
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15" stroke="#CBCBCB" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M7 10L12 15L17 10" stroke="#CBCBCB" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<path d="M12 15V3" stroke="#CBCBCB" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 574 B |
|
@ -226,5 +226,6 @@
|
||||||
<file>images/connectionProgress.svg</file>
|
<file>images/connectionProgress.svg</file>
|
||||||
<file>images/connectionOff.svg</file>
|
<file>images/connectionOff.svg</file>
|
||||||
<file>images/connectionOn.svg</file>
|
<file>images/connectionOn.svg</file>
|
||||||
|
<file>images/controls/download.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
25
client/ui/controllers/pageController.cpp
Normal file
25
client/ui/controllers/pageController.cpp
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#include "pageController.h"
|
||||||
|
|
||||||
|
PageController::PageController(const QSharedPointer<ServersModel> &serversModel,
|
||||||
|
QObject *parent) : QObject(parent), m_serversModel(serversModel)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void PageController::setStartPage()
|
||||||
|
{
|
||||||
|
if (m_serversModel->getServersCount()) {
|
||||||
|
if (m_serversModel->getDefaultServerIndex() < 0) {
|
||||||
|
m_serversModel->setDefaultServerIndex(0);
|
||||||
|
}
|
||||||
|
emit goToPage(PageLoader::PageEnum::PageStart, false);
|
||||||
|
} else {
|
||||||
|
emit goToPage(PageLoader::PageEnum::PageSetupWizardStart, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString PageController::getPagePath(PageLoader::PageEnum page)
|
||||||
|
{
|
||||||
|
QMetaEnum metaEnum = QMetaEnum::fromType<PageLoader::PageEnum>();
|
||||||
|
QString pageName = metaEnum.valueToKey(static_cast<int>(page));
|
||||||
|
return "Pages2/" + pageName + ".qml";
|
||||||
|
}
|
50
client/ui/controllers/pageController.h
Normal file
50
client/ui/controllers/pageController.h
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
#ifndef PAGECONTROLLER_H
|
||||||
|
#define PAGECONTROLLER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
|
||||||
|
#include "ui/models/servers_model.h"
|
||||||
|
|
||||||
|
namespace PageLoader
|
||||||
|
{
|
||||||
|
Q_NAMESPACE
|
||||||
|
enum class PageEnum { PageStart = 0, PageHome, PageSettings, PageShare,
|
||||||
|
|
||||||
|
PageSetupWizardStart, PageTest, PageSetupWizardCredentials, PageSetupWizardProtocols, PageSetupWizardEasy,
|
||||||
|
PageSetupWizardProtocolSettings, PageSetupWizardInstalling, PageSetupWizardConfigSource,
|
||||||
|
PageSetupWizardTextKey
|
||||||
|
};
|
||||||
|
Q_ENUM_NS(PageEnum)
|
||||||
|
|
||||||
|
static void declareQmlPageEnum() {
|
||||||
|
qmlRegisterUncreatableMetaObject(
|
||||||
|
PageLoader::staticMetaObject,
|
||||||
|
"PageEnum",
|
||||||
|
1, 0,
|
||||||
|
"PageEnum",
|
||||||
|
"Error: only enums"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PageController : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit PageController(const QSharedPointer<ServersModel> &serversModel,
|
||||||
|
QObject *parent = nullptr);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void setStartPage();
|
||||||
|
QString getPagePath(PageLoader::PageEnum page);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void goToPage(PageLoader::PageEnum page, bool slide = true);
|
||||||
|
void closePage();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QSharedPointer<ServersModel> m_serversModel;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PAGECONTROLLER_H
|
|
@ -56,6 +56,7 @@ QVariant ServersModel::data(const QModelIndex &index, int role) const
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//todo mode to setData?
|
||||||
void ServersModel::setDefaultServerIndex(int index)
|
void ServersModel::setDefaultServerIndex(int index)
|
||||||
{
|
{
|
||||||
// beginResetModel();
|
// beginResetModel();
|
||||||
|
@ -63,11 +64,16 @@ void ServersModel::setDefaultServerIndex(int index)
|
||||||
// endResetModel();
|
// endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ServersModel::getDefaultServerIndex()
|
const int ServersModel::getDefaultServerIndex()
|
||||||
{
|
{
|
||||||
return m_settings->defaultServerIndex();
|
return m_settings->defaultServerIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int ServersModel::getServersCount()
|
||||||
|
{
|
||||||
|
return m_settings->serversCount();
|
||||||
|
}
|
||||||
|
|
||||||
QHash<int, QByteArray> ServersModel::roleNames() const {
|
QHash<int, QByteArray> ServersModel::roleNames() const {
|
||||||
QHash<int, QByteArray> roles;
|
QHash<int, QByteArray> roles;
|
||||||
roles[DescRole] = "desc";
|
roles[DescRole] = "desc";
|
||||||
|
|
|
@ -31,7 +31,8 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setDefaultServerIndex(int index);
|
void setDefaultServerIndex(int index);
|
||||||
int getDefaultServerIndex();
|
const int getDefaultServerIndex();
|
||||||
|
const int getServersCount();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QHash<int, QByteArray> roleNames() const override;
|
QHash<int, QByteArray> roleNames() const override;
|
||||||
|
|
|
@ -7,15 +7,8 @@ import ConnectionState 1.0
|
||||||
Button {
|
Button {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var isConnected: ConnectionController.isConnected
|
|
||||||
|
|
||||||
text: "Подключиться"
|
text: "Подключиться"
|
||||||
|
|
||||||
// implicitHeight: 190
|
|
||||||
// implicitWidth: 190
|
|
||||||
|
|
||||||
// color: "transparent"
|
|
||||||
|
|
||||||
background: Image {
|
background: Image {
|
||||||
id: border
|
id: border
|
||||||
|
|
||||||
|
@ -54,56 +47,55 @@ Button {
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
ConnectionController.onConnectionButtonClicked()
|
ConnectionController.onConnectionButtonClicked()
|
||||||
console.log(connectionProccess.from)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: ConnectionController
|
target: ConnectionController
|
||||||
function onConnectionStateChanged(state) {
|
function onConnectionStateChanged(state) {
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case ConnectionState.Unknown: {
|
case ConnectionState.Unknown: {
|
||||||
console.log("Unknown")
|
console.log("Unknown")
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case ConnectionState.Disconnected: {
|
case ConnectionState.Disconnected: {
|
||||||
console.log("Disconnected")
|
console.log("Disconnected")
|
||||||
connectionProccess.running = false
|
connectionProccess.running = false
|
||||||
root.text = "Подключиться"
|
root.text = "Подключиться"
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case ConnectionState.Preparing: {
|
case ConnectionState.Preparing: {
|
||||||
console.log("Preparing")
|
console.log("Preparing")
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case ConnectionState.Connecting: {
|
case ConnectionState.Connecting: {
|
||||||
console.log("Connecting")
|
console.log("Connecting")
|
||||||
connectionProccess.running = true
|
connectionProccess.running = true
|
||||||
root.text = "Подключение..."
|
root.text = "Подключение..."
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case ConnectionState.Connected: {
|
case ConnectionState.Connected: {
|
||||||
console.log("Connected")
|
console.log("Connected")
|
||||||
connectionProccess.running = false
|
connectionProccess.running = false
|
||||||
root.text = "Подключено"
|
root.text = "Подключено"
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case ConnectionState.Disconnecting: {
|
case ConnectionState.Disconnecting: {
|
||||||
console.log("Disconnecting")
|
console.log("Disconnecting")
|
||||||
connectionProccess.running = true
|
connectionProccess.running = true
|
||||||
root.text = "Отключение..."
|
root.text = "Отключение..."
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case ConnectionState.Reconnecting: {
|
case ConnectionState.Reconnecting: {
|
||||||
console.log("Reconnecting")
|
console.log("Reconnecting")
|
||||||
connectionProccess.running = true
|
connectionProccess.running = true
|
||||||
root.text = "Переподключение..."
|
root.text = "Переподключение..."
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case ConnectionState.Error: {
|
case ConnectionState.Error: {
|
||||||
console.log("Error")
|
console.log("Error")
|
||||||
connectionProccess.running = false
|
connectionProccess.running = false
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,6 +154,10 @@ Item {
|
||||||
anchors.topMargin: 16
|
anchors.topMargin: 16
|
||||||
anchors.leftMargin: 16
|
anchors.leftMargin: 16
|
||||||
anchors.rightMargin: 16
|
anchors.rightMargin: 16
|
||||||
|
|
||||||
|
backButtonFunction: function() {
|
||||||
|
root.menuVisible = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FlickableType {
|
FlickableType {
|
||||||
|
@ -190,6 +194,7 @@ Item {
|
||||||
id: loader
|
id: loader
|
||||||
sourceComponent: root.menuDelegate
|
sourceComponent: root.menuDelegate
|
||||||
property QtObject modelData: model
|
property QtObject modelData: model
|
||||||
|
property var delegateIndex: index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,8 @@ Item {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (backButtonFunction && typeof backButtonFunction === "function") {
|
if (backButtonFunction && typeof backButtonFunction === "function") {
|
||||||
backButtonFunction()
|
backButtonFunction()
|
||||||
|
} else {
|
||||||
|
PageController.closePage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,8 @@ Item {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (backButtonFunction && typeof backButtonFunction === "function") {
|
if (backButtonFunction && typeof backButtonFunction === "function") {
|
||||||
backButtonFunction()
|
backButtonFunction()
|
||||||
|
} else {
|
||||||
|
PageController.closePage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,5 +3,35 @@ import QtQuick.Controls
|
||||||
|
|
||||||
StackView {
|
StackView {
|
||||||
id: stackView
|
id: stackView
|
||||||
initialItem: "PageSetupWizardStart"
|
|
||||||
|
function gotoPage(page, slide) {
|
||||||
|
if (slide) {
|
||||||
|
stackView.push(PageController.getPagePath(page), {}, StackView.PushTransition)
|
||||||
|
} else {
|
||||||
|
stackView.push(PageController.getPagePath(page), {}, StackView.Immediate)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function closePage() {
|
||||||
|
if (stackView.depth <= 1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
stackView.pop()
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: PageController
|
||||||
|
function onGoToPage(page, slide) {
|
||||||
|
stackView.gotoPage(page, slide)
|
||||||
|
}
|
||||||
|
|
||||||
|
function onClosePage() {
|
||||||
|
stackView.closePage()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
PageController.setStartPage()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,15 +8,13 @@ import PageEnum 1.0
|
||||||
import ProtocolEnum 1.0
|
import ProtocolEnum 1.0
|
||||||
|
|
||||||
import "./"
|
import "./"
|
||||||
import "../Pages"
|
|
||||||
import "../Controls2"
|
import "../Controls2"
|
||||||
import "../Controls2/TextTypes"
|
import "../Controls2/TextTypes"
|
||||||
import "../Config"
|
import "../Config"
|
||||||
import "../Components"
|
import "../Components"
|
||||||
|
|
||||||
PageBase {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
page: PageEnum.PageHome
|
|
||||||
|
|
||||||
property string defaultColor: "#1C1D21"
|
property string defaultColor: "#1C1D21"
|
||||||
|
|
||||||
|
@ -143,10 +141,6 @@ PageBase {
|
||||||
ValueFilter {
|
ValueFilter {
|
||||||
roleName: "serviceType"
|
roleName: "serviceType"
|
||||||
value: ProtocolEnum.Vpn
|
value: ProtocolEnum.Vpn
|
||||||
},
|
|
||||||
ValueFilter {
|
|
||||||
roleName: "isInstalled"
|
|
||||||
value: true
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -196,6 +190,19 @@ PageBase {
|
||||||
indicator: Rectangle {
|
indicator: Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: containerRadioButton.hovered ? "#2C2D30" : "#1C1D21"
|
color: containerRadioButton.hovered ? "#2C2D30" : "#1C1D21"
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
PropertyAnimation { duration: 200 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
checkable: {
|
||||||
|
if (modelData !== null) {
|
||||||
|
if (modelData.isInstalled) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
@ -207,10 +214,33 @@ PageBase {
|
||||||
|
|
||||||
z: 1
|
z: 1
|
||||||
|
|
||||||
|
Image {
|
||||||
|
source: {
|
||||||
|
if (modelData !== null) {
|
||||||
|
if (modelData.isInstalled) {
|
||||||
|
return "qrc:/images/controls/check.svg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "qrc:/images/controls/download.svg"
|
||||||
|
}
|
||||||
|
visible: {
|
||||||
|
if (modelData !== null) {
|
||||||
|
if (modelData.isInstalled) {
|
||||||
|
return containerRadioButton.checked
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
width: 24
|
||||||
|
height: 24
|
||||||
|
|
||||||
|
Layout.rightMargin: 8
|
||||||
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: containerRadioButtonText
|
id: containerRadioButtonText
|
||||||
|
|
||||||
// todo remove dirty hack?
|
|
||||||
text: {
|
text: {
|
||||||
if (modelData !== null) {
|
if (modelData !== null) {
|
||||||
return modelData.name
|
return modelData.name
|
||||||
|
@ -228,22 +258,26 @@ PageBase {
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
Layout.bottomMargin: 20
|
Layout.bottomMargin: 20
|
||||||
}
|
}
|
||||||
|
|
||||||
Image {
|
|
||||||
source: "qrc:/images/controls/check.svg"
|
|
||||||
visible: containerRadioButton.checked
|
|
||||||
width: 24
|
|
||||||
height: 24
|
|
||||||
|
|
||||||
Layout.rightMargin: 8
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
modelData.isDefault = true
|
if (checked) {
|
||||||
|
modelData.isDefault = true
|
||||||
|
|
||||||
containersDropDown.text = containerRadioButtonText.text
|
containersDropDown.text = containerRadioButtonText.text
|
||||||
containersDropDown.menuVisible = false
|
containersDropDown.menuVisible = false
|
||||||
|
} else {
|
||||||
|
ContainersModel.setCurrentlyInstalledContainerIndex(proxyContainersModel.mapToSource(delegateIndex))
|
||||||
|
PageController.goToPage(PageEnum.PageSetupWizardProtocolSettings)
|
||||||
|
containersDropDown.menuVisible = false
|
||||||
|
menu.visible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: containerRadioButton
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
enabled: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,6 +360,10 @@ PageBase {
|
||||||
indicator: Rectangle {
|
indicator: Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: serverRadioButton.hovered ? "#2C2D30" : "#1C1D21"
|
color: serverRadioButton.hovered ? "#2C2D30" : "#1C1D21"
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
PropertyAnimation { duration: 200 }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
@ -370,6 +408,12 @@ PageBase {
|
||||||
ServersModel.setDefaultServerIndex(index)
|
ServersModel.setDefaultServerIndex(index)
|
||||||
ContainersModel.setSelectedServerIndex(index)
|
ContainersModel.setSelectedServerIndex(index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: serverRadioButton
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
enabled: false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,14 +6,12 @@ import QtQuick.Dialogs
|
||||||
import PageEnum 1.0
|
import PageEnum 1.0
|
||||||
|
|
||||||
import "./"
|
import "./"
|
||||||
import "../Pages"
|
|
||||||
import "../Controls2"
|
import "../Controls2"
|
||||||
import "../Controls2/TextTypes"
|
import "../Controls2/TextTypes"
|
||||||
import "../Config"
|
import "../Config"
|
||||||
|
|
||||||
PageBase {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
page: PageEnum.PageSetupWizardInstalling
|
|
||||||
|
|
||||||
FlickableType {
|
FlickableType {
|
||||||
id: fl
|
id: fl
|
||||||
|
@ -100,7 +98,7 @@ PageBase {
|
||||||
iconImage: "qrc:/images/controls/text-cursor.svg"
|
iconImage: "qrc:/images/controls/text-cursor.svg"
|
||||||
|
|
||||||
onClickedFunc: function() {
|
onClickedFunc: function() {
|
||||||
UiLogic.goToPage(PageEnum.PageSetupWizardTextKey)
|
PageController.goToPage(PageEnum.PageSetupWizardTextKey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
|
@ -5,13 +5,11 @@ import QtQuick.Layouts
|
||||||
import PageEnum 1.0
|
import PageEnum 1.0
|
||||||
|
|
||||||
import "./"
|
import "./"
|
||||||
import "../Pages"
|
|
||||||
import "../Controls2"
|
import "../Controls2"
|
||||||
import "../Config"
|
import "../Config"
|
||||||
|
|
||||||
PageBase {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
page: PageEnum.PageSetupWizardCredentials
|
|
||||||
|
|
||||||
FlickableType {
|
FlickableType {
|
||||||
id: fl
|
id: fl
|
||||||
|
@ -61,7 +59,7 @@ PageBase {
|
||||||
text: qsTr("Настроить сервер простым образом")
|
text: qsTr("Настроить сервер простым образом")
|
||||||
|
|
||||||
onClicked: function() {
|
onClicked: function() {
|
||||||
UiLogic.goToPage(PageEnum.PageSetupWizardEasy)
|
PageController.goToPage(PageEnum.PageSetupWizardEasy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +77,7 @@ PageBase {
|
||||||
text: qsTr("Выбрать протокол для установки")
|
text: qsTr("Выбрать протокол для установки")
|
||||||
|
|
||||||
onClicked: function() {
|
onClicked: function() {
|
||||||
UiLogic.goToPage(PageEnum.PageSetupWizardProtocols)
|
PageController.goToPage(PageEnum.PageSetupWizardProtocols)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,11 @@ import QtQuick.Layouts
|
||||||
import PageEnum 1.0
|
import PageEnum 1.0
|
||||||
|
|
||||||
import "./"
|
import "./"
|
||||||
import "../Pages"
|
|
||||||
import "../Controls2"
|
import "../Controls2"
|
||||||
import "../Config"
|
import "../Config"
|
||||||
|
|
||||||
PageBase {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
page: PageEnum.PageSetupWizardEasy
|
|
||||||
|
|
||||||
FlickableType {
|
FlickableType {
|
||||||
id: fl
|
id: fl
|
||||||
|
|
|
@ -5,14 +5,12 @@ import QtQuick.Layouts
|
||||||
import PageEnum 1.0
|
import PageEnum 1.0
|
||||||
|
|
||||||
import "./"
|
import "./"
|
||||||
import "../Pages"
|
|
||||||
import "../Controls2"
|
import "../Controls2"
|
||||||
import "../Controls2/TextTypes"
|
import "../Controls2/TextTypes"
|
||||||
import "../Config"
|
import "../Config"
|
||||||
|
|
||||||
PageBase {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
page: PageEnum.PageSetupWizardInstalling
|
|
||||||
|
|
||||||
FlickableType {
|
FlickableType {
|
||||||
id: fl
|
id: fl
|
||||||
|
|
|
@ -5,14 +5,12 @@ import QtQuick.Layouts
|
||||||
import PageEnum 1.0
|
import PageEnum 1.0
|
||||||
|
|
||||||
import "./"
|
import "./"
|
||||||
import "../Pages"
|
|
||||||
import "../Controls2"
|
import "../Controls2"
|
||||||
import "../Controls2/TextTypes"
|
import "../Controls2/TextTypes"
|
||||||
import "../Config"
|
import "../Config"
|
||||||
|
|
||||||
PageBase {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
page: PageEnum.PageSetupWizardProtocolSettings
|
|
||||||
|
|
||||||
FlickableType {
|
FlickableType {
|
||||||
id: fl
|
id: fl
|
||||||
|
@ -90,7 +88,7 @@ PageBase {
|
||||||
text: qsTr("Установить")
|
text: qsTr("Установить")
|
||||||
|
|
||||||
onClicked: function() {
|
onClicked: function() {
|
||||||
UiLogic.goToPage(PageEnum.PageSetupWizardInstalling)
|
PageController.goToPage(PageEnum.PageSetupWizardInstalling)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,13 +8,11 @@ import PageEnum 1.0
|
||||||
import ProtocolEnum 1.0
|
import ProtocolEnum 1.0
|
||||||
|
|
||||||
import "./"
|
import "./"
|
||||||
import "../Pages"
|
|
||||||
import "../Controls2"
|
import "../Controls2"
|
||||||
import "../Config"
|
import "../Config"
|
||||||
|
|
||||||
PageBase {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
page: PageEnum.PageSetupWizardProtocols
|
|
||||||
|
|
||||||
SortFilterProxyModel {
|
SortFilterProxyModel {
|
||||||
id: proxyContainersModel
|
id: proxyContainersModel
|
||||||
|
@ -89,7 +87,7 @@ PageBase {
|
||||||
|
|
||||||
onClickedFunc: function() {
|
onClickedFunc: function() {
|
||||||
ContainersModel.setCurrentlyInstalledContainerIndex(proxyContainersModel.mapToSource(index))
|
ContainersModel.setCurrentlyInstalledContainerIndex(proxyContainersModel.mapToSource(index))
|
||||||
UiLogic.goToPage(PageEnum.PageSetupWizardProtocolSettings)
|
PageController.goToPage(PageEnum.PageSetupWizardProtocolSettings)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,14 +5,12 @@ import QtQuick.Layouts
|
||||||
import PageEnum 1.0
|
import PageEnum 1.0
|
||||||
|
|
||||||
import "./"
|
import "./"
|
||||||
import "../Pages"
|
|
||||||
import "../Controls2"
|
import "../Controls2"
|
||||||
import "../Config"
|
import "../Config"
|
||||||
import "../Controls2/TextTypes"
|
import "../Controls2/TextTypes"
|
||||||
|
|
||||||
PageBase {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
page: PageEnum.PageSetupWizardStart
|
|
||||||
|
|
||||||
FlickableType {
|
FlickableType {
|
||||||
id: fl
|
id: fl
|
||||||
|
@ -77,7 +75,7 @@ PageBase {
|
||||||
text: qsTr("У меня ничего нет")
|
text: qsTr("У меня ничего нет")
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
UiLogic.goToPage(PageEnum.PageTest)
|
PageController.goToPage(PageEnum.PageTest)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,7 +130,7 @@ PageBase {
|
||||||
buttonImage: "qrc:/images/controls/chevron-right.svg"
|
buttonImage: "qrc:/images/controls/chevron-right.svg"
|
||||||
|
|
||||||
onClickedFunc: function() {
|
onClickedFunc: function() {
|
||||||
UiLogic.goToPage(PageEnum.PageSetupWizardCredentials)
|
PageController.goToPage(PageEnum.PageSetupWizardCredentials)
|
||||||
drawer.visible = false
|
drawer.visible = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,7 +146,7 @@ PageBase {
|
||||||
buttonImage: "qrc:/images/controls/chevron-right.svg"
|
buttonImage: "qrc:/images/controls/chevron-right.svg"
|
||||||
|
|
||||||
onClickedFunc: function() {
|
onClickedFunc: function() {
|
||||||
UiLogic.goToPage(PageEnum.PageSetupWizardConfigSource)
|
PageController.goToPage(PageEnum.PageSetupWizardConfigSource)
|
||||||
drawer.visible = false
|
drawer.visible = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,14 +5,12 @@ import QtQuick.Layouts
|
||||||
import PageEnum 1.0
|
import PageEnum 1.0
|
||||||
|
|
||||||
import "./"
|
import "./"
|
||||||
import "../Pages"
|
|
||||||
import "../Controls2"
|
import "../Controls2"
|
||||||
import "../Controls2/TextTypes"
|
import "../Controls2/TextTypes"
|
||||||
import "../Config"
|
import "../Config"
|
||||||
|
|
||||||
PageBase {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
page: PageEnum.PageSetupWizardInstalling
|
|
||||||
|
|
||||||
FlickableType {
|
FlickableType {
|
||||||
id: fl
|
id: fl
|
||||||
|
@ -68,7 +66,7 @@ PageBase {
|
||||||
text: qsTr("Подключиться")
|
text: qsTr("Подключиться")
|
||||||
|
|
||||||
onClicked: function() {
|
onClicked: function() {
|
||||||
// UiLogic.goToPage(PageEnum.PageSetupWizardInstalling)
|
// PageController.goToPage(PageEnum.PageSetupWizardInstalling)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,14 +5,12 @@ import QtQuick.Layouts
|
||||||
import PageEnum 1.0
|
import PageEnum 1.0
|
||||||
|
|
||||||
import "./"
|
import "./"
|
||||||
import "../Pages"
|
|
||||||
import "../Controls2"
|
import "../Controls2"
|
||||||
import "../Controls2/TextTypes"
|
import "../Controls2/TextTypes"
|
||||||
import "../Config"
|
import "../Config"
|
||||||
|
|
||||||
PageBase {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
page: PageEnum.PageStart
|
|
||||||
|
|
||||||
StackLayout {
|
StackLayout {
|
||||||
id: stackLayout
|
id: stackLayout
|
||||||
|
|
|
@ -4,15 +4,12 @@ import QtQuick.Layouts
|
||||||
import PageEnum 1.0
|
import PageEnum 1.0
|
||||||
|
|
||||||
import "./"
|
import "./"
|
||||||
import "../Pages"
|
|
||||||
import "../Controls2"
|
import "../Controls2"
|
||||||
import "../Config"
|
import "../Config"
|
||||||
import "../Controls2/TextTypes"
|
import "../Controls2/TextTypes"
|
||||||
|
|
||||||
PageBase {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
page: PageEnum.Test
|
|
||||||
logic: ViewConfigLogic
|
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: content
|
id: content
|
||||||
|
|
|
@ -22,83 +22,14 @@ Window {
|
||||||
|
|
||||||
title: "AmneziaVPN"
|
title: "AmneziaVPN"
|
||||||
|
|
||||||
function gotoPage(page, reset, slide) {
|
|
||||||
if (pageStackView.depth > 0) {
|
|
||||||
pageStackView.currentItem.deactivated()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (slide) {
|
|
||||||
pageStackView.push(UiLogic.pageEnumToString(page), {}, StackView.PushTransition)
|
|
||||||
} else {
|
|
||||||
pageStackView.push(UiLogic.pageEnumToString(page), {}, StackView.Immediate)
|
|
||||||
}
|
|
||||||
|
|
||||||
pageStackView.currentItem.activated(reset)
|
|
||||||
}
|
|
||||||
|
|
||||||
function closePage() {
|
|
||||||
if (pageStackView.depth <= 1) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
pageStackView.currentItem.deactivated()
|
|
||||||
pageStackView.pop()
|
|
||||||
}
|
|
||||||
|
|
||||||
function setStartPage(page, slide) {
|
|
||||||
if (pageStackView.depth > 0) {
|
|
||||||
pageStackView.currentItem.deactivated()
|
|
||||||
}
|
|
||||||
|
|
||||||
pageStackView.clear()
|
|
||||||
if (slide) {
|
|
||||||
pageStackView.push(UiLogic.pageEnumToString(page), {}, StackView.PushTransition)
|
|
||||||
} else {
|
|
||||||
pageStackView.push(UiLogic.pageEnumToString(page), {}, StackView.Immediate)
|
|
||||||
}
|
|
||||||
if (page === PageEnum.Start) {
|
|
||||||
UiLogic.pushButtonBackFromStartVisible = !pageStackView.empty
|
|
||||||
UiLogic.onUpdatePage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: "#0E0E11"
|
color: "#0E0E11"
|
||||||
}
|
}
|
||||||
|
|
||||||
StackView {
|
PageLoader {
|
||||||
id: pageStackView
|
id: pageLoader
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
focus: true
|
focus: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: UiLogic
|
|
||||||
function onGoToPage(page, reset, slide) {
|
|
||||||
root.gotoPage(page, reset, slide)
|
|
||||||
}
|
|
||||||
|
|
||||||
function onClosePage() {
|
|
||||||
root.closePage()
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSetStartPage(page, slide) {
|
|
||||||
root.setStartPage(page, slide)
|
|
||||||
}
|
|
||||||
|
|
||||||
function onShow() {
|
|
||||||
root.show()
|
|
||||||
UiLogic.initializeUiLogic()
|
|
||||||
}
|
|
||||||
|
|
||||||
function onHide() {
|
|
||||||
root.hide()
|
|
||||||
}
|
|
||||||
|
|
||||||
function onRaise() {
|
|
||||||
root.show()
|
|
||||||
root.raise()
|
|
||||||
root.requestActivate()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -617,9 +617,3 @@ bool UiLogic::isContainerAlreadyAddedToGui(DockerContainer container)
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString UiLogic::pageEnumToString(Page page) {
|
|
||||||
QMetaEnum metaEnum = QMetaEnum::fromType<Page>();
|
|
||||||
QString pageName = metaEnum.valueToKey(static_cast<int>(page));
|
|
||||||
return "Pages2/" + pageName + ".qml";
|
|
||||||
}
|
|
||||||
|
|
|
@ -123,8 +123,6 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE amnezia::ErrorCode addAlreadyInstalledContainersGui(bool &isServerCreated);
|
Q_INVOKABLE amnezia::ErrorCode addAlreadyInstalledContainersGui(bool &isServerCreated);
|
||||||
|
|
||||||
Q_INVOKABLE QString pageEnumToString(PageEnumNS::Page page);
|
|
||||||
|
|
||||||
void shareTempFile(const QString &suggestedName, QString ext, const QString& data);
|
void shareTempFile(const QString &suggestedName, QString ext, const QString& data);
|
||||||
static QString getOpenFileName(QWidget *parent = nullptr,
|
static QString getOpenFileName(QWidget *parent = nullptr,
|
||||||
const QString &caption = QString(),
|
const QString &caption = QString(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue