added PageSettings and PageSettingsServersList.

- replaced PageLoader with PageType with stackView property.
- added error handling when installing a server/container
This commit is contained in:
vladimir.kuznetsov 2023-05-25 15:40:17 +08:00
parent ca6b7fbeb2
commit e00656d757
31 changed files with 486 additions and 142 deletions

View file

@ -0,0 +1,4 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12.22 2H11.78C11.2496 2 10.7409 2.21071 10.3658 2.58579C9.99072 2.96086 9.78 3.46957 9.78 4V4.18C9.77964 4.53073 9.68706 4.87519 9.51154 5.17884C9.33602 5.48248 9.08374 5.73464 8.78 5.91L8.35 6.16C8.04596 6.33554 7.70108 6.42795 7.35 6.42795C6.99893 6.42795 6.65404 6.33554 6.35 6.16L6.2 6.08C5.74107 5.81526 5.19584 5.74344 4.684 5.88031C4.17217 6.01717 3.73555 6.35154 3.47 6.81L3.25 7.19C2.98526 7.64893 2.91345 8.19416 3.05031 8.706C3.18717 9.21783 3.52154 9.65445 3.98 9.92L4.13 10.02C4.43228 10.1945 4.68362 10.4451 4.85905 10.7468C5.03448 11.0486 5.1279 11.391 5.13 11.74V12.25C5.1314 12.6024 5.03965 12.949 4.86405 13.2545C4.68844 13.5601 4.43521 13.8138 4.13 13.99L3.98 14.08C3.52154 14.3456 3.18717 14.7822 3.05031 15.294C2.91345 15.8058 2.98526 16.3511 3.25 16.81L3.47 17.19C3.73555 17.6485 4.17217 17.9828 4.684 18.1197C5.19584 18.2566 5.74107 18.1847 6.2 17.92L6.35 17.84C6.65404 17.6645 6.99893 17.5721 7.35 17.5721C7.70108 17.5721 8.04596 17.6645 8.35 17.84L8.78 18.09C9.08374 18.2654 9.33602 18.5175 9.51154 18.8212C9.68706 19.1248 9.77964 19.4693 9.78 19.82V20C9.78 20.5304 9.99072 21.0391 10.3658 21.4142C10.7409 21.7893 11.2496 22 11.78 22H12.22C12.7504 22 13.2591 21.7893 13.6342 21.4142C14.0093 21.0391 14.22 20.5304 14.22 20V19.82C14.2204 19.4693 14.3129 19.1248 14.4885 18.8212C14.664 18.5175 14.9163 18.2654 15.22 18.09L15.65 17.84C15.954 17.6645 16.2989 17.5721 16.65 17.5721C17.0011 17.5721 17.346 17.6645 17.65 17.84L17.8 17.92C18.2589 18.1847 18.8042 18.2566 19.316 18.1197C19.8278 17.9828 20.2645 17.6485 20.53 17.19L20.75 16.8C21.0147 16.3411 21.0866 15.7958 20.9497 15.284C20.8128 14.7722 20.4785 14.3356 20.02 14.07L19.87 13.99C19.5648 13.8138 19.3116 13.5601 19.136 13.2545C18.9604 12.949 18.8686 12.6024 18.87 12.25V11.75C18.8686 11.3976 18.9604 11.051 19.136 10.7455C19.3116 10.4399 19.5648 10.1862 19.87 10.01L20.02 9.92C20.4785 9.65445 20.8128 9.21783 20.9497 8.706C21.0866 8.19416 21.0147 7.64893 20.75 7.19L20.53 6.81C20.2645 6.35154 19.8278 6.01717 19.316 5.88031C18.8042 5.74344 18.2589 5.81526 17.8 6.08L17.65 6.16C17.346 6.33554 17.0011 6.42795 16.65 6.42795C16.2989 6.42795 15.954 6.33554 15.65 6.16L15.22 5.91C14.9163 5.73464 14.664 5.48248 14.4885 5.17884C14.3129 4.87519 14.2204 4.53073 14.22 4.18V4C14.22 3.46957 14.0093 2.96086 13.6342 2.58579C13.2591 2.21071 12.7504 2 12.22 2V2Z" stroke="#CBCBCB" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z" stroke="#CBCBCB" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

@ -184,7 +184,6 @@
<file>ui/qml/Controls2/DropDownType.qml</file>
<file>ui/qml/Pages2/PageSetupWizardStart.qml</file>
<file>ui/qml/main2.qml</file>
<file>ui/qml/PageLoader.qml</file>
<file>images/amneziaBigLogo.png</file>
<file>images/amneziaBigLogo.svg</file>
<file>ui/qml/Controls2/FlickableType.qml</file>
@ -215,7 +214,7 @@
<file>images/controls/settings-2.svg</file>
<file>images/controls/share-2.svg</file>
<file>ui/qml/Pages2/PageHome.qml</file>
<file>ui/qml/Pages2/PageSettings.qml</file>
<file>ui/qml/Pages2/PageSettingsServersList.qml</file>
<file>ui/qml/Pages2/PageShare.qml</file>
<file>ui/qml/Controls2/TextTypes/Header1TextType.qml</file>
<file>ui/qml/Controls2/TextTypes/LabelTextType.qml</file>
@ -230,5 +229,10 @@
<file>ui/qml/Controls2/ProgressBarType.qml</file>
<file>ui/qml/Components/ConnectionTypeSelectionDrawer.qml</file>
<file>ui/qml/Components/ContainersPageHomeListView.qml</file>
<file>ui/qml/Controls2/TextTypes/CaptionTextType.qml</file>
<file>images/controls/settings.svg</file>
<file>ui/qml/Pages2/PageSettings.qml</file>
<file>ui/qml/Controls2/PageType.qml</file>
<file>ui/qml/Controls2/PopupType.qml</file>
</qresource>
</RCC>

View file

@ -3,6 +3,7 @@
#include <QJsonObject>
#include "core/servercontroller.h"
#include "core/errorstrings.h"
InstallController::InstallController(const QSharedPointer<ServersModel> &serversModel,
const QSharedPointer<ContainersModel> &containersModel,
@ -12,7 +13,7 @@ InstallController::InstallController(const QSharedPointer<ServersModel> &servers
}
ErrorCode InstallController::install(DockerContainer container, int port, TransportProto transportProto)
void InstallController::install(DockerContainer container, int port, TransportProto transportProto)
{
Proto mainProto = ContainerProps::defaultProtocol(container);
@ -26,13 +27,13 @@ ErrorCode InstallController::install(DockerContainer container, int port, Transp
};
if (m_shouldCreateServer) {
return installServer(container, config);
installServer(container, config);
} else {
return installContainer(container, config);
installContainer(container, config);
}
}
ErrorCode InstallController::installServer(DockerContainer container, QJsonObject& config)
void InstallController::installServer(DockerContainer container, QJsonObject& config)
{
//todo check if container already installed
ServerController serverController(m_settings);
@ -51,15 +52,14 @@ ErrorCode InstallController::installServer(DockerContainer container, QJsonObjec
m_settings->addServer(server);
m_settings->setDefaultServer(m_settings->serversCount() - 1);
//todo change to server finished
emit installContainerFinished();
emit installServerFinished();
return;
}
//todo error processing
return errorCode;
emit installationErrorOccurred(errorString(errorCode));
}
ErrorCode InstallController::installContainer(DockerContainer container, QJsonObject& config)
void InstallController::installContainer(DockerContainer container, QJsonObject& config)
{
//todo check if container already installed
ServerCredentials serverCredentials = m_serversModel->getCurrentlyProcessedServerCredentials();
@ -69,10 +69,10 @@ ErrorCode InstallController::installContainer(DockerContainer container, QJsonOb
if (errorCode == ErrorCode::NoError) {
m_containersModel->setData(m_containersModel->index(container), config, ContainersModel::Roles::ConfigRole);
emit installContainerFinished();
return;
}
//todo error processing
return errorCode;
emit installationErrorOccurred(errorString(errorCode));
}
void InstallController::setCurrentlyInstalledServerCredentials(const QString &hostName, const QString &userName, const QString &secretData)

View file

@ -18,15 +18,18 @@ public:
QObject *parent = nullptr);
public slots:
ErrorCode install(DockerContainer container, int port, TransportProto transportProto);
void install(DockerContainer container, int port, TransportProto transportProto);
void setCurrentlyInstalledServerCredentials(const QString &hostName, const QString &userName, const QString &secretData);
void setShouldCreateServer(bool shouldCreateServer);
signals:
void installContainerFinished();
void installServerFinished();
void installationErrorOccurred(QString errorMessage);
private:
ErrorCode installServer(DockerContainer container, QJsonObject& config);
ErrorCode installContainer(DockerContainer container, QJsonObject& config);
void installServer(DockerContainer container, QJsonObject& config);
void installContainer(DockerContainer container, QJsonObject& config);
QSharedPointer<ServersModel> m_serversModel;
QSharedPointer<ContainersModel> m_containersModel;

View file

@ -5,15 +5,15 @@ PageController::PageController(const QSharedPointer<ServersModel> &serversModel,
{
}
void PageController::setStartPage()
QString PageController::getInitialPage()
{
if (m_serversModel->getServersCount()) {
if (m_serversModel->getDefaultServerIndex() < 0) {
m_serversModel->setDefaultServerIndex(0);
}
emit goToPage(PageLoader::PageEnum::PageStart, false);
return getPagePath(PageLoader::PageEnum::PageStart);
} else {
emit goToPage(PageLoader::PageEnum::PageSetupWizardStart, false);
return getPagePath(PageLoader::PageEnum::PageSetupWizardStart);
}
}
@ -21,5 +21,5 @@ QString PageController::getPagePath(PageLoader::PageEnum page)
{
QMetaEnum metaEnum = QMetaEnum::fromType<PageLoader::PageEnum>();
QString pageName = metaEnum.valueToKey(static_cast<int>(page));
return "Pages2/" + pageName + ".qml";
return "qrc:/ui/qml/Pages2/" + pageName + ".qml";
}

View file

@ -36,12 +36,12 @@ public:
QObject *parent = nullptr);
public slots:
void setStartPage();
QString getInitialPage();
QString getPagePath(PageLoader::PageEnum page);
signals:
void goToPage(PageLoader::PageEnum page, bool slide = true);
void closePage();
void goToPageHome();
void showErrorMessage(QString errorMessage);
private:
QSharedPointer<ServersModel> m_serversModel;

View file

@ -51,6 +51,8 @@ QVariant ServersModel::data(const QModelIndex &index, int role) const
return QVariant::fromValue(m_settings->serverCredentials(index.row()));
case IsDefaultRole:
return index.row() == m_settings->defaultServerIndex();
case IsCurrentlyProcessedRole:
return index.row() == m_currenlyProcessedServerIndex;
}
return QVariant();
@ -84,11 +86,17 @@ ServerCredentials ServersModel::getCurrentlyProcessedServerCredentials()
return qvariant_cast<ServerCredentials>(data(index(m_currenlyProcessedServerIndex), CredentialsRole));
}
void ServersModel::addServer()
{
}
QHash<int, QByteArray> ServersModel::roleNames() const {
QHash<int, QByteArray> roles;
roles[NameRole] = "name";
roles[HostNameRole] = "hostName";
roles[CredentialsRole] = "credentials";
roles[IsDefaultRole] = "isDefault";
roles[IsCurrentlyProcessedRole] = "isCurrentlyProcessed";
return roles;
}

View file

@ -19,7 +19,8 @@ public:
NameRole = Qt::UserRole + 1,
HostNameRole,
CredentialsRole,
IsDefaultRole
IsDefaultRole,
IsCurrentlyProcessedRole
};
ServersModel(std::shared_ptr<Settings> settings, QObject *parent = nullptr);
@ -32,11 +33,14 @@ public:
public slots:
void setDefaultServerIndex(int index);
const int getDefaultServerIndex();
const int getServersCount();
void setCurrentlyProcessedServerIndex(int index);
ServerCredentials getCurrentlyProcessedServerCredentials();
void addServer();
protected:
QHash<int, QByteArray> roleNames() const override;

View file

@ -29,10 +29,11 @@ enum class Page {Start = 0, NewServer, NewServerProtocols, Vpn,
AdvancedServerSettings, ClientManagement, ClientInfo,
PageSetupWizardStart, PageTest, PageSetupWizardCredentials, PageSetupWizardProtocols, PageSetupWizardEasy,
PageSetupWizardProtocolSettings, PageSetupWizardInstalling, PageSetupWizardConfigSource,
PageSetupWizardTextKey,
PageSetupWizardProtocolSettings, PageSetupWizardInstalling, PageSetupWizardConfigSource, PageSetupWizardTextKey,
PageStart, PageHome, PageSettings, PageShare};
PageSettings, PageSettingsServersList,
PageStart, PageHome, PageShare};
Q_ENUM_NS(Page)
static void declareQmlPageEnum() {

View file

@ -57,8 +57,8 @@ Drawer {
text: "IP, логин и пароль от сервера"
buttonImage: "qrc:/images/controls/chevron-right.svg"
onClickedFunc: function() {
PageController.goToPage(PageEnum.PageSetupWizardCredentials)
clickedFunction: function() {
goToPage(PageEnum.PageSetupWizardCredentials)
root.visible = false
}
}
@ -73,8 +73,8 @@ Drawer {
text: "QR-код, ключ или файл настроек"
buttonImage: "qrc:/images/controls/chevron-right.svg"
onClickedFunc: function() {
PageController.goToPage(PageEnum.PageSetupWizardConfigSource)
clickedFunction: function() {
goToPage(PageEnum.PageSetupWizardConfigSource)
root.visible = false
}
}

View file

@ -96,7 +96,7 @@ ListView {
} else {
ContainersModel.setCurrentlyInstalledContainerIndex(proxyContainersModel.mapToSource(index))
InstallController.setShouldCreateServer(false)
PageController.goToPage(PageEnum.PageSetupWizardProtocolSettings)
goToPage(PageEnum.PageSetupWizardProtocolSettings)
containersDropDown.menuVisible = false
menu.visible = false
}

View file

@ -36,7 +36,7 @@ Item {
if (backButtonFunction && typeof backButtonFunction === "function") {
backButtonFunction()
} else {
PageController.closePage()
closePage()
}
}
}

View file

@ -36,7 +36,7 @@ Item {
if (backButtonFunction && typeof backButtonFunction === "function") {
backButtonFunction()
} else {
PageController.closePage()
closePage()
}
}
}
@ -61,8 +61,8 @@ Item {
visible: image ? true : false
onClicked: {
if (actionButtonImage && typeof actionButtonImage === "function") {
actionButtonImage()
if (actionButtonFunction && typeof actionButtonFunction === "function") {
actionButtonFunction()
}
}
}

View file

@ -8,7 +8,7 @@ Item {
property string text
property string descriptionText
property var onClickedFunc
property var clickedFunction
property alias buttonImage: button.image
property string iconImage
@ -68,8 +68,8 @@ Item {
hoverEnabled: false
image: buttonImage
onClicked: {
if (onClickedFunc && typeof onClickedFunc === "function") {
onClickedFunc()
if (clickedFunction && typeof clickedFunction === "function") {
clickedFunction()
}
}

View file

@ -0,0 +1,31 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
Item {
id: root
property StackView stackView: StackView.view
function goToPage(page, slide = true) {
if (slide) {
root.stackView.push(PageController.getPagePath(page), {}, StackView.PushTransition)
} else {
root.stackView.push(PageController.getPagePath(page), {}, StackView.Immediate)
}
}
function closePage() {
if (root.stackView.depth <= 1) {
return
}
root.stackView.pop()
}
function goToStartPage() {
while (root.stackView.depth > 1) {
root.stackView.pop()
}
}
}

View file

@ -0,0 +1,61 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import "TextTypes"
Popup {
id: root
property string popupErrorMessageText
property bool closeButtonVisible: true
leftMargin: 25
rightMargin: 25
bottomMargin: 70
width: parent.width - leftMargin - rightMargin
anchors.centerIn: parent
modal: true
closePolicy: Popup.CloseOnEscape
Overlay.modal: Rectangle {
color: Qt.rgba(14/255, 14/255, 17/255, 0.8)
}
background: Rectangle {
anchors.fill: parent
color: Qt.rgba(215/255, 216/255, 219/255, 0.95)
radius: 4
}
contentItem: RowLayout {
width: parent.width
CaptionTextType {
horizontalAlignment: Text.AlignHCenter
Layout.fillWidth: true
text: root.popupErrorMessageText
}
BasicButtonType {
visible: closeButtonVisible
defaultColor: Qt.rgba(215/255, 216/255, 219/255, 0.95)
hoveredColor: "#C1C2C5"
pressedColor: "#AEB0B7"
disabledColor: "#494B50"
textColor: "#0E0E11"
borderWidth: 0
text: "Close"
onClicked: {
root.close()
}
}
}
}

View file

@ -0,0 +1,13 @@
import QtQuick
Text {
height: 16
color: "#0E0E11"
font.pixelSize: 13
font.weight: Font.Normal
font.family: "PT Root UI VF"
font.letterSpacing: 0.02
wrapMode: Text.WordWrap
}

View file

@ -1,37 +0,0 @@
import QtQuick
import QtQuick.Controls
StackView {
id: stackView
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()
}
}

View file

@ -14,7 +14,7 @@ import "../Controls2/TextTypes"
import "../Config"
import "../Components"
Item {
PageType {
id: root
property string defaultColor: "#1C1D21"
@ -37,6 +37,21 @@ Item {
}
}
Connections {
target: InstallController
function onInstallContainerFinished() {
goToStartPage()
menu.visible = true
containersDropDown.menuVisible = true
}
function onInstallServerFinished() {
goToStartPage()
menu.visible = true
}
}
Rectangle {
id: buttonBackground
anchors.fill: buttonContent
@ -279,6 +294,15 @@ Item {
z: 1
Image {
source: "qrc:/images/controls/check.svg"
visible: serverRadioButton.checked
width: 24
height: 24
Layout.rightMargin: 8
}
Text {
id: serverRadioButtonText
@ -295,13 +319,10 @@ Item {
Layout.bottomMargin: 20
}
Image {
source: "qrc:/images/controls/check.svg"
visible: serverRadioButton.checked
width: 24
height: 24
ImageButtonType {
image: "qrc:/images/controls/settings.svg"
Layout.rightMargin: 8
// onClicked:
}
}

View file

@ -1,5 +1,71 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
Item {
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ContainerProps 1.0
import ProtocolProps 1.0
import "./"
import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
PageType {
id: root
SortFilterProxyModel {
id: proxyServersModel
sourceModel: ServersModel
filters: [
ValueFilter {
roleName: "isCurrentlyProcessed"
value: true
}
]
}
FlickableType {
id: fl
anchors.fill: parent
contentHeight: content.height
ColumnLayout {
id: content
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
spacing: 16
Repeater {
model: proxyServersModel
delegate: HeaderType {
id: header
Layout.fillWidth: true
Layout.topMargin: 20
Layout.leftMargin: 16
Layout.rightMargin: 16
actionButtonImage: "qrc:/images/controls/plus.svg"
backButtonImage: "qrc:/images/controls/arrow-left.svg"
headerText: name
actionButtonFunction: function() {
connectionTypeSelection.visible = true
}
backButtonFunction: function() {
closePage()
}
}
}
}
}
}

View file

@ -0,0 +1,111 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import ContainerProps 1.0
import "./"
import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
import "../Components"
PageType {
id: root
HeaderType {
id: header
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20
anchors.leftMargin: 16
anchors.rightMargin: 16
actionButtonImage: "qrc:/images/controls/plus.svg"
backButtonImage: "qrc:/images/controls/arrow-left.svg"
headerText: "Серверы"
actionButtonFunction: function() {
connectionTypeSelection.visible = true
}
backButtonFunction: function() {
PageController.goToPageHome()
}
}
ConnectionTypeSelectionDrawer {
id: connectionTypeSelection
}
FlickableType {
anchors.top: header.bottom
anchors.topMargin: 16
contentHeight: col.implicitHeight
Column {
id: col
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 16
anchors.rightMargin: 16
spacing: 16
ListView {
id: servers
width: parent.width
height: servers.contentItem.height
model: ServersModel
clip: true
delegate: Item {
implicitWidth: servers.width
implicitHeight: delegateContent.implicitHeight
ColumnLayout {
id: delegateContent
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
LabelWithButtonType {
id: server
Layout.fillWidth: true
Layout.topMargin: 16
Layout.bottomMargin: 16
text: name
descriptionText: hostName
buttonImage: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
ServersModel.setCurrentlyProcessedServerIndex(index)
goToPage(PageEnum.PageSettings)
}
}
Rectangle {
Layout.fillWidth: true
height: 1
color: "#2C2D30"
}
}
}
}
}
}
}

View file

@ -10,7 +10,7 @@ import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
Item {
PageType {
id: root
Connections {
@ -44,7 +44,7 @@ Item {
backButtonImage: "qrc:/images/controls/arrow-left.svg"
headerText: "Подключение к серверу"
headerText: "Подключение к серверу"
descriptionText: "Не используйте код подключения из публичных источников. Его могли создать, чтобы перехватывать ваши данные.\n
Всё в порядке, если код передал друг."
}
@ -64,7 +64,7 @@ Item {
buttonImage: "qrc:/images/controls/chevron-right.svg"
iconImage: "qrc:/images/controls/folder-open.svg"
onClickedFunc: function() {
clickedFunction: function() {
onClicked: fileDialog.open()
}
@ -89,7 +89,7 @@ Item {
buttonImage: "qrc:/images/controls/chevron-right.svg"
iconImage: "qrc:/images/controls/qr-code.svg"
onClickedFunc: function() {
clickedFunction: function() {
}
}
@ -106,8 +106,8 @@ Item {
buttonImage: "qrc:/images/controls/chevron-right.svg"
iconImage: "qrc:/images/controls/text-cursor.svg"
onClickedFunc: function() {
PageController.goToPage(PageEnum.PageSetupWizardTextKey)
clickedFunction: function() {
goToPage(PageEnum.PageSetupWizardTextKey)
}
}

View file

@ -8,7 +8,7 @@ import "./"
import "../Controls2"
import "../Config"
Item {
PageType {
id: root
FlickableType {
@ -69,7 +69,7 @@ Item {
InstallController.setShouldCreateServer(true)
InstallController.setCurrentlyInstalledServerCredentials(hostname.textField.text, username.textField.text, secretData.textField.text)
PageController.goToPage(PageEnum.PageSetupWizardEasy)
goToPage(PageEnum.PageSetupWizardEasy)
}
}
@ -90,7 +90,7 @@ Item {
InstallController.setShouldCreateServer(true)
InstallController.setCurrentlyInstalledServerCredentials(hostname.textField.text, username.textField.text, secretData.textField.text)
PageController.goToPage(PageEnum.PageSetupWizardProtocols)
goToPage(PageEnum.PageSetupWizardProtocols)
}
}
}

View file

@ -12,7 +12,7 @@ import "./"
import "../Controls2"
import "../Config"
Item {
PageType {
id: root
SortFilterProxyModel {
@ -34,7 +34,7 @@ Item {
id: fl
anchors.top: root.top
anchors.bottom: root.bottom
contentHeight: content.height
contentHeight: content.implicitHeight + buttonContinue.anchors.bottomMargin
Column {
id: content
@ -49,8 +49,9 @@ Item {
spacing: 16
HeaderType {
id: header
implicitWidth: parent.width
anchors.topMargin: 20
backButtonImage: "qrc:/images/controls/arrow-left.svg"
@ -117,6 +118,8 @@ Item {
}
BasicButtonType {
id: buttonContinue
implicitWidth: parent.width
anchors.topMargin: 24
anchors.bottomMargin: 32
@ -125,7 +128,7 @@ Item {
onClicked: function() {
ContainersModel.setCurrentlyInstalledContainerIndex(containers.dockerContainer)
PageController.goToPage(PageEnum.PageSetupWizardInstalling);
goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.install(containers.dockerContainer,
containers.containerDefaultPort,
containers.containerDefaultTransportProto)

View file

@ -11,11 +11,20 @@ import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
Item {
PageType {
id: root
property real progressBarValue: 0
Connections {
target: InstallController
function onInstallationErrorOccurred(errorMessage) {
closePage()
PageController.showErrorMessage(errorMessage)
}
}
SortFilterProxyModel {
id: proxyContainersModel
sourceModel: ContainersModel
@ -100,26 +109,5 @@ Item {
}
}
}
Timer {
id: closePageTimer
interval: 1000
repeat: false
running: false
onTriggered: {
// todo go to root installing page
PageController.goToPage(PageEnum.PageStart)
}
}
Connections {
target: InstallController
function onInstallContainerFinished() {
progressBarValue = 1
closePageTimer.start()
}
}
}
}

View file

@ -13,7 +13,7 @@ import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
Item {
PageType {
id: root
SortFilterProxyModel {
@ -156,7 +156,7 @@ Item {
text: qsTr("Установить")
onClicked: function() {
PageController.goToPage(PageEnum.PageSetupWizardInstalling);
goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.install(dockerContainer, port.textFieldText, transportProtoButtonGroup.currentIndex)
}
}

View file

@ -11,7 +11,7 @@ import "./"
import "../Controls2"
import "../Config"
Item {
PageType {
id: root
SortFilterProxyModel {
@ -86,9 +86,9 @@ Item {
descriptionText: description
buttonImage: "qrc:/images/controls/chevron-right.svg"
onClickedFunc: function() {
clickedFunction: function() {
ContainersModel.setCurrentlyInstalledContainerIndex(proxyContainersModel.mapToSource(index))
PageController.goToPage(PageEnum.PageSetupWizardProtocolSettings)
goToPage(PageEnum.PageSetupWizardProtocolSettings)
}
}

View file

@ -10,9 +10,27 @@ import "../Config"
import "../Controls2/TextTypes"
import "../Components"
Item {
PageType {
id: root
Connections {
target: PageController
function onShowErrorMessage(errorMessage) {
popupErrorMessage.popupErrorMessageText = errorMessage
popupErrorMessage.open()
}
}
Connections {
target: InstallController
function onInstallServerFinished() {
goToStartPage()
// goToPage(PageEnum.PageStart)
}
}
FlickableType {
id: fl
anchors.top: root.top
@ -44,7 +62,7 @@ Item {
Layout.leftMargin: 16
Layout.rightMargin: 16
text: "Бесплатный сервис для создания личного VPN на вашем сервере. Помогаем получать доступ к заблокированному контенту, не раскрывая конфиденциальность даже провайдерам VPN."
text: "Бесплатный сервис для создания личного VPN на вашем сервере. Помогаем получать доступ к заблокированному контенту, не раскрывая конфиденциальность даже провайдерам VPN."
}
BasicButtonType {
@ -76,7 +94,7 @@ Item {
text: qsTr("У меня ничего нет")
onClicked: {
PageController.goToPage(PageEnum.PageTest)
goToPage(PageEnum.PageTest)
}
}
}
@ -85,4 +103,16 @@ Item {
id: connectionTypeSelection
}
}
Item {
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: parent.bottom
implicitHeight: popupErrorMessage.height
PopupType {
id: popupErrorMessage
}
}
}

View file

@ -9,7 +9,7 @@ import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
Item {
PageType {
id: root
FlickableType {
@ -66,7 +66,7 @@ Item {
text: qsTr("Подключиться")
onClicked: function() {
// PageController.goToPage(PageEnum.PageSetupWizardInstalling)
// goToPage(PageEnum.PageSetupWizardInstalling)
}
}
}

View file

@ -9,9 +9,22 @@ import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
Item {
PageType {
id: root
Connections {
target: PageController
function onGoToPageHome() {
tabBar.currentIndex = 0
}
function onShowErrorMessage(errorMessage) {
popupErrorMessage.popupErrorMessageText = errorMessage
popupErrorMessage.open()
}
}
StackLayout {
id: stackLayout
currentIndex: tabBar.currentIndex
@ -24,10 +37,18 @@ Item {
width: parent.width
height: root.height - tabBar.implicitHeight
PageHome {
StackView {
id: homeStackView
initialItem: "PageHome.qml" //PageController.getPagePath(PageEnum.PageSettingsServersList)
}
PageSetupWizardEasy {
Item {
}
StackView {
id: settingsStackView
initialItem: "PageSettingsServersList.qml" //PageController.getPagePath(PageEnum.PageSettingsServersList)
}
}
@ -69,4 +90,16 @@ Item {
cursorShape: Qt.PointingHandCursor
enabled: false
}
Item {
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: parent.bottom
implicitHeight: popupErrorMessage.height
PopupType {
id: popupErrorMessage
}
}
}

View file

@ -27,9 +27,9 @@ Window {
color: "#0E0E11"
}
PageLoader {
id: pageLoader
StackView {
anchors.fill: parent
focus: true
initialItem: PageController.getInitialPage()
}
}