diff --git a/client/images/controls/settings.svg b/client/images/controls/settings.svg new file mode 100644 index 000000000..0693fb4e2 --- /dev/null +++ b/client/images/controls/settings.svg @@ -0,0 +1,4 @@ + + + + diff --git a/client/resources.qrc b/client/resources.qrc index ff7139a80..ca1674af8 100644 --- a/client/resources.qrc +++ b/client/resources.qrc @@ -184,7 +184,6 @@ ui/qml/Controls2/DropDownType.qml ui/qml/Pages2/PageSetupWizardStart.qml ui/qml/main2.qml - ui/qml/PageLoader.qml images/amneziaBigLogo.png images/amneziaBigLogo.svg ui/qml/Controls2/FlickableType.qml @@ -215,7 +214,7 @@ images/controls/settings-2.svg images/controls/share-2.svg ui/qml/Pages2/PageHome.qml - ui/qml/Pages2/PageSettings.qml + ui/qml/Pages2/PageSettingsServersList.qml ui/qml/Pages2/PageShare.qml ui/qml/Controls2/TextTypes/Header1TextType.qml ui/qml/Controls2/TextTypes/LabelTextType.qml @@ -230,5 +229,10 @@ ui/qml/Controls2/ProgressBarType.qml ui/qml/Components/ConnectionTypeSelectionDrawer.qml ui/qml/Components/ContainersPageHomeListView.qml + ui/qml/Controls2/TextTypes/CaptionTextType.qml + images/controls/settings.svg + ui/qml/Pages2/PageSettings.qml + ui/qml/Controls2/PageType.qml + ui/qml/Controls2/PopupType.qml diff --git a/client/ui/controllers/installController.cpp b/client/ui/controllers/installController.cpp index 3e4809e64..31f58a2a4 100644 --- a/client/ui/controllers/installController.cpp +++ b/client/ui/controllers/installController.cpp @@ -3,6 +3,7 @@ #include #include "core/servercontroller.h" +#include "core/errorstrings.h" InstallController::InstallController(const QSharedPointer &serversModel, const QSharedPointer &containersModel, @@ -12,7 +13,7 @@ InstallController::InstallController(const QSharedPointer &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) diff --git a/client/ui/controllers/installController.h b/client/ui/controllers/installController.h index c0d6ad20a..d9e1ad95d 100644 --- a/client/ui/controllers/installController.h +++ b/client/ui/controllers/installController.h @@ -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 m_serversModel; QSharedPointer m_containersModel; diff --git a/client/ui/controllers/pageController.cpp b/client/ui/controllers/pageController.cpp index 101207672..63c3ba589 100644 --- a/client/ui/controllers/pageController.cpp +++ b/client/ui/controllers/pageController.cpp @@ -5,15 +5,15 @@ PageController::PageController(const QSharedPointer &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(); QString pageName = metaEnum.valueToKey(static_cast(page)); - return "Pages2/" + pageName + ".qml"; + return "qrc:/ui/qml/Pages2/" + pageName + ".qml"; } diff --git a/client/ui/controllers/pageController.h b/client/ui/controllers/pageController.h index 9bfd6bda4..f37edca9b 100644 --- a/client/ui/controllers/pageController.h +++ b/client/ui/controllers/pageController.h @@ -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 m_serversModel; diff --git a/client/ui/models/servers_model.cpp b/client/ui/models/servers_model.cpp index fe973811e..884009e8c 100644 --- a/client/ui/models/servers_model.cpp +++ b/client/ui/models/servers_model.cpp @@ -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(); @@ -59,7 +61,7 @@ QVariant ServersModel::data(const QModelIndex &index, int role) const //todo mode to setData? void ServersModel::setDefaultServerIndex(int index) { -// beginResetModel(); + // beginResetModel(); m_settings->setDefaultServer(index); // endResetModel(); } @@ -84,11 +86,17 @@ ServerCredentials ServersModel::getCurrentlyProcessedServerCredentials() return qvariant_cast(data(index(m_currenlyProcessedServerIndex), CredentialsRole)); } +void ServersModel::addServer() +{ + +} + QHash ServersModel::roleNames() const { QHash roles; roles[NameRole] = "name"; roles[HostNameRole] = "hostName"; roles[CredentialsRole] = "credentials"; roles[IsDefaultRole] = "isDefault"; + roles[IsCurrentlyProcessedRole] = "isCurrentlyProcessed"; return roles; } diff --git a/client/ui/models/servers_model.h b/client/ui/models/servers_model.h index 08b449761..ae1ec8d95 100644 --- a/client/ui/models/servers_model.h +++ b/client/ui/models/servers_model.h @@ -19,7 +19,8 @@ public: NameRole = Qt::UserRole + 1, HostNameRole, CredentialsRole, - IsDefaultRole + IsDefaultRole, + IsCurrentlyProcessedRole }; ServersModel(std::shared_ptr 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 roleNames() const override; diff --git a/client/ui/pages.h b/client/ui/pages.h index b2e191c7e..82c0d4095 100644 --- a/client/ui/pages.h +++ b/client/ui/pages.h @@ -21,18 +21,19 @@ public: namespace PageEnumNS { Q_NAMESPACE -enum class Page {Start = 0, NewServer, NewServerProtocols, Vpn, - Wizard, WizardLow, WizardMedium, WizardHigh, WizardVpnMode, ServerConfiguringProgress, - GeneralSettings, AppSettings, NetworkSettings, ServerSettings, - ServerContainers, ServersList, ShareConnection, Sites, - ProtocolSettings, ProtocolShare, QrDecoder, QrDecoderIos, About, ViewConfig, - AdvancedServerSettings, ClientManagement, ClientInfo, +enum class Page { Start = 0, NewServer, NewServerProtocols, Vpn, + Wizard, WizardLow, WizardMedium, WizardHigh, WizardVpnMode, ServerConfiguringProgress, + GeneralSettings, AppSettings, NetworkSettings, ServerSettings, + ServerContainers, ServersList, ShareConnection, Sites, + ProtocolSettings, ProtocolShare, QrDecoder, QrDecoderIos, About, ViewConfig, + AdvancedServerSettings, ClientManagement, ClientInfo, - PageSetupWizardStart, PageTest, PageSetupWizardCredentials, PageSetupWizardProtocols, PageSetupWizardEasy, - PageSetupWizardProtocolSettings, PageSetupWizardInstalling, PageSetupWizardConfigSource, - PageSetupWizardTextKey, + PageSetupWizardStart, PageTest, PageSetupWizardCredentials, PageSetupWizardProtocols, PageSetupWizardEasy, + PageSetupWizardProtocolSettings, PageSetupWizardInstalling, PageSetupWizardConfigSource, PageSetupWizardTextKey, - PageStart, PageHome, PageSettings, PageShare}; + PageSettings, PageSettingsServersList, + + PageStart, PageHome, PageShare}; Q_ENUM_NS(Page) static void declareQmlPageEnum() { diff --git a/client/ui/qml/Components/ConnectionTypeSelectionDrawer.qml b/client/ui/qml/Components/ConnectionTypeSelectionDrawer.qml index 3ae5b2781..20029eb07 100644 --- a/client/ui/qml/Components/ConnectionTypeSelectionDrawer.qml +++ b/client/ui/qml/Components/ConnectionTypeSelectionDrawer.qml @@ -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 } } diff --git a/client/ui/qml/Components/ContainersPageHomeListView.qml b/client/ui/qml/Components/ContainersPageHomeListView.qml index b3d34b62d..309b42177 100644 --- a/client/ui/qml/Components/ContainersPageHomeListView.qml +++ b/client/ui/qml/Components/ContainersPageHomeListView.qml @@ -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 } diff --git a/client/ui/qml/Controls2/Header2Type.qml b/client/ui/qml/Controls2/Header2Type.qml index f985d5237..ce9d804a9 100644 --- a/client/ui/qml/Controls2/Header2Type.qml +++ b/client/ui/qml/Controls2/Header2Type.qml @@ -36,7 +36,7 @@ Item { if (backButtonFunction && typeof backButtonFunction === "function") { backButtonFunction() } else { - PageController.closePage() + closePage() } } } diff --git a/client/ui/qml/Controls2/HeaderType.qml b/client/ui/qml/Controls2/HeaderType.qml index 6c4e78471..2c0fbd851 100644 --- a/client/ui/qml/Controls2/HeaderType.qml +++ b/client/ui/qml/Controls2/HeaderType.qml @@ -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() } } } diff --git a/client/ui/qml/Controls2/LabelWithButtonType.qml b/client/ui/qml/Controls2/LabelWithButtonType.qml index d8e195f1d..2530f5832 100644 --- a/client/ui/qml/Controls2/LabelWithButtonType.qml +++ b/client/ui/qml/Controls2/LabelWithButtonType.qml @@ -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() } } diff --git a/client/ui/qml/Controls2/PageType.qml b/client/ui/qml/Controls2/PageType.qml new file mode 100644 index 000000000..4eb517537 --- /dev/null +++ b/client/ui/qml/Controls2/PageType.qml @@ -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() + } + } +} diff --git a/client/ui/qml/Controls2/PopupType.qml b/client/ui/qml/Controls2/PopupType.qml new file mode 100644 index 000000000..dd92d5fed --- /dev/null +++ b/client/ui/qml/Controls2/PopupType.qml @@ -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() + } + } + } +} diff --git a/client/ui/qml/Controls2/TextTypes/CaptionTextType.qml b/client/ui/qml/Controls2/TextTypes/CaptionTextType.qml new file mode 100644 index 000000000..15cc96c10 --- /dev/null +++ b/client/ui/qml/Controls2/TextTypes/CaptionTextType.qml @@ -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 +} diff --git a/client/ui/qml/PageLoader.qml b/client/ui/qml/PageLoader.qml deleted file mode 100644 index b3d53a055..000000000 --- a/client/ui/qml/PageLoader.qml +++ /dev/null @@ -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() - } -} diff --git a/client/ui/qml/Pages2/PageHome.qml b/client/ui/qml/Pages2/PageHome.qml index a04b17444..d5455849a 100644 --- a/client/ui/qml/Pages2/PageHome.qml +++ b/client/ui/qml/Pages2/PageHome.qml @@ -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: } } diff --git a/client/ui/qml/Pages2/PageSettings.qml b/client/ui/qml/Pages2/PageSettings.qml index 5560aee72..9d5b74427 100644 --- a/client/ui/qml/Pages2/PageSettings.qml +++ b/client/ui/qml/Pages2/PageSettings.qml @@ -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() + } + } + } + } + } } diff --git a/client/ui/qml/Pages2/PageSettingsServersList.qml b/client/ui/qml/Pages2/PageSettingsServersList.qml new file mode 100644 index 000000000..79e24f75b --- /dev/null +++ b/client/ui/qml/Pages2/PageSettingsServersList.qml @@ -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" + } + } + } + } + } + } +} diff --git a/client/ui/qml/Pages2/PageSetupWizardConfigSource.qml b/client/ui/qml/Pages2/PageSetupWizardConfigSource.qml index 5f2bf2f35..53a408896 100644 --- a/client/ui/qml/Pages2/PageSetupWizardConfigSource.qml +++ b/client/ui/qml/Pages2/PageSetupWizardConfigSource.qml @@ -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) } } diff --git a/client/ui/qml/Pages2/PageSetupWizardCredentials.qml b/client/ui/qml/Pages2/PageSetupWizardCredentials.qml index 20c6e735e..95463c3e8 100644 --- a/client/ui/qml/Pages2/PageSetupWizardCredentials.qml +++ b/client/ui/qml/Pages2/PageSetupWizardCredentials.qml @@ -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) } } } diff --git a/client/ui/qml/Pages2/PageSetupWizardEasy.qml b/client/ui/qml/Pages2/PageSetupWizardEasy.qml index 9555c915c..8707c19b3 100644 --- a/client/ui/qml/Pages2/PageSetupWizardEasy.qml +++ b/client/ui/qml/Pages2/PageSetupWizardEasy.qml @@ -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) diff --git a/client/ui/qml/Pages2/PageSetupWizardInstalling.qml b/client/ui/qml/Pages2/PageSetupWizardInstalling.qml index b4f44fd91..fd8aac6b1 100644 --- a/client/ui/qml/Pages2/PageSetupWizardInstalling.qml +++ b/client/ui/qml/Pages2/PageSetupWizardInstalling.qml @@ -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() - } - } } } diff --git a/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml b/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml index e79176276..fa3ac8383 100644 --- a/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml +++ b/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml @@ -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) } } diff --git a/client/ui/qml/Pages2/PageSetupWizardProtocols.qml b/client/ui/qml/Pages2/PageSetupWizardProtocols.qml index f7cd382fb..bffe09cb2 100644 --- a/client/ui/qml/Pages2/PageSetupWizardProtocols.qml +++ b/client/ui/qml/Pages2/PageSetupWizardProtocols.qml @@ -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) } } diff --git a/client/ui/qml/Pages2/PageSetupWizardStart.qml b/client/ui/qml/Pages2/PageSetupWizardStart.qml index b7d56ce53..4d0f4c5c5 100644 --- a/client/ui/qml/Pages2/PageSetupWizardStart.qml +++ b/client/ui/qml/Pages2/PageSetupWizardStart.qml @@ -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 + } + } } diff --git a/client/ui/qml/Pages2/PageSetupWizardTextKey.qml b/client/ui/qml/Pages2/PageSetupWizardTextKey.qml index f94b9ff48..43dbda0e5 100644 --- a/client/ui/qml/Pages2/PageSetupWizardTextKey.qml +++ b/client/ui/qml/Pages2/PageSetupWizardTextKey.qml @@ -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) } } } diff --git a/client/ui/qml/Pages2/PageStart.qml b/client/ui/qml/Pages2/PageStart.qml index ade0980df..19ea3bc44 100644 --- a/client/ui/qml/Pages2/PageStart.qml +++ b/client/ui/qml/Pages2/PageStart.qml @@ -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 + } + } } diff --git a/client/ui/qml/main2.qml b/client/ui/qml/main2.qml index b10d749fb..5ca1b3458 100644 --- a/client/ui/qml/main2.qml +++ b/client/ui/qml/main2.qml @@ -27,9 +27,9 @@ Window { color: "#0E0E11" } - PageLoader { - id: pageLoader + StackView { anchors.fill: parent focus: true + initialItem: PageController.getInitialPage() } }