diff --git a/client/amnezia_application.cpp b/client/amnezia_application.cpp index b4255a0c0..2cd616795 100644 --- a/client/amnezia_application.cpp +++ b/client/amnezia_application.cpp @@ -103,6 +103,9 @@ void AmneziaApplication::init() m_containersModel.reset(new ContainersModel(m_settings, this)); m_engine->rootContext()->setContextProperty("ContainersModel", m_containersModel.get()); + m_serversModel.reset(new ServersModel(m_settings, this)); + m_engine->rootContext()->setContextProperty("ServersModel", m_serversModel.get()); + m_uiLogic->registerPagesLogic(); #if defined(Q_OS_IOS) diff --git a/client/amnezia_application.h b/client/amnezia_application.h index abdb1f2a3..d15864e1e 100644 --- a/client/amnezia_application.h +++ b/client/amnezia_application.h @@ -12,6 +12,8 @@ #include "ui/uilogic.h" #include "configurators/vpn_configurator.h" +#include "ui/models/servers_model.h" +#include "ui/models/containers_model.h" #define amnApp (static_cast(QCoreApplication::instance())) @@ -57,6 +59,7 @@ class AmneziaApplication : public AMNEZIA_BASE_CLASS QCommandLineParser m_parser; QScopedPointer m_containersModel; + QScopedPointer m_serversModel; }; diff --git a/client/images/controls/home.svg b/client/images/controls/home.svg new file mode 100644 index 000000000..5ade1d33e --- /dev/null +++ b/client/images/controls/home.svg @@ -0,0 +1,4 @@ + + + + diff --git a/client/images/controls/settings-2.svg b/client/images/controls/settings-2.svg new file mode 100644 index 000000000..9f1cf9741 --- /dev/null +++ b/client/images/controls/settings-2.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/client/images/controls/share-2.svg b/client/images/controls/share-2.svg new file mode 100644 index 000000000..b0aa63317 --- /dev/null +++ b/client/images/controls/share-2.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/client/resources.qrc b/client/resources.qrc index 20eed74db..f5817eb0e 100644 --- a/client/resources.qrc +++ b/client/resources.qrc @@ -182,7 +182,7 @@ ui/qml/Controls2/CheckBoxType.qml images/controls/check.svg ui/qml/Controls2/DropDownType.qml - ui/qml/Pages2/PageStart.qml + ui/qml/Pages2/PageSetupWizardStart.qml ui/qml/main2.qml ui/qml/PageLoader.qml images/amneziaBigLogo.png @@ -195,7 +195,7 @@ ui/qml/Pages2/PageSetupWizardEasy.qml images/controls/chevron-down.svg images/controls/chevron-up.svg - ui/qml/Controls2/TextTypes/BodyTextType.qml + ui/qml/Controls2/TextTypes/ParagraphTextType.qml ui/qml/Controls2/TextTypes/Header2TextType.qml ui/qml/Controls2/HorizontalRadioButton.qml ui/qml/Controls2/VerticalRadioButton.qml @@ -209,5 +209,17 @@ images/controls/qr-code.svg images/controls/text-cursor.svg ui/qml/Pages2/PageSetupWizardTextKey.qml + ui/qml/Pages2/PageStart.qml + ui/qml/Controls2/TabImageButtonType.qml + images/controls/home.svg + images/controls/settings-2.svg + images/controls/share-2.svg + ui/qml/Pages2/PageHome.qml + ui/qml/Pages2/PageSettings.qml + ui/qml/Pages2/PageShare.qml + ui/qml/Controls2/TextTypes/Header1TextType.qml + ui/qml/Controls2/TextTypes/LabelTextType.qml + ui/qml/Controls2/TextTypes/ButtonTextType.qml + ui/qml/Controls2/Header2Type.qml diff --git a/client/ui/models/servers_model.cpp b/client/ui/models/servers_model.cpp index c4b0efb32..94d3ced43 100644 --- a/client/ui/models/servers_model.cpp +++ b/client/ui/models/servers_model.cpp @@ -1,29 +1,42 @@ #include "servers_model.h" -ServersModel::ServersModel(QObject *parent) : - QAbstractListModel(parent) +ServersModel::ServersModel(std::shared_ptr settings, QObject *parent) : m_settings(settings), QAbstractListModel(parent) { - + const QJsonArray &servers = m_settings->serversArray(); + int defaultServer = m_settings->defaultServerIndex(); + QVector serverListContent; + for(int i = 0; i < servers.size(); i++) { + ServerModelContent c; + auto server = servers.at(i).toObject(); + c.desc = server.value(config_key::description).toString(); + c.address = server.value(config_key::hostName).toString(); + if (c.desc.isEmpty()) { + c.desc = c.address; + } + c.isDefault = (i == defaultServer); + serverListContent.push_back(c); + } + setContent(serverListContent); } void ServersModel::clearData() { beginResetModel(); - content.clear(); + m_content.clear(); endResetModel(); } -void ServersModel::setContent(const std::vector &data) +void ServersModel::setContent(const QVector &data) { beginResetModel(); - content = data; + m_content = data; endResetModel(); } int ServersModel::rowCount(const QModelIndex &parent) const { Q_UNUSED(parent); - return static_cast(content.size()); + return static_cast(m_content.size()); } QHash ServersModel::roleNames() const { @@ -37,17 +50,17 @@ QHash ServersModel::roleNames() const { QVariant ServersModel::data(const QModelIndex &index, int role) const { if (!index.isValid() || index.row() < 0 - || index.row() >= static_cast(content.size())) { + || index.row() >= static_cast(m_content.size())) { return QVariant(); } if (role == DescRole) { - return content[index.row()].desc; + return m_content[index.row()].desc; } if (role == AddressRole) { - return content[index.row()].address; + return m_content[index.row()].address; } if (role == IsDefaultRole) { - return content[index.row()].isDefault; + return m_content[index.row()].isDefault; } return QVariant(); } diff --git a/client/ui/models/servers_model.h b/client/ui/models/servers_model.h index 7f2e3ad1f..e60aea6b8 100644 --- a/client/ui/models/servers_model.h +++ b/client/ui/models/servers_model.h @@ -2,8 +2,8 @@ #define SERVERSMODEL_H #include -#include -#include + +#include "settings.h" struct ServerModelContent { QString desc; @@ -15,7 +15,7 @@ class ServersModel : public QAbstractListModel { Q_OBJECT public: - ServersModel(QObject *parent = nullptr); + ServersModel(std::shared_ptr settings, QObject *parent = nullptr); public: enum SiteRoles { DescRole = Qt::UserRole + 1, @@ -24,7 +24,7 @@ class ServersModel : public QAbstractListModel }; void clearData(); - void setContent(const std::vector& data); + void setContent(const QVector& data); int rowCount(const QModelIndex &parent = QModelIndex()) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; @@ -33,7 +33,8 @@ class ServersModel : public QAbstractListModel QHash roleNames() const override; private: - std::vector content; + QVector m_content; + std::shared_ptr m_settings; }; #endif // SERVERSMODEL_H diff --git a/client/ui/pages.h b/client/ui/pages.h index 32ac775dc..b2e191c7e 100644 --- a/client/ui/pages.h +++ b/client/ui/pages.h @@ -28,9 +28,11 @@ enum class Page {Start = 0, NewServer, NewServerProtocols, Vpn, ProtocolSettings, ProtocolShare, QrDecoder, QrDecoderIos, About, ViewConfig, AdvancedServerSettings, ClientManagement, ClientInfo, - PageStart, PageTest, PageSetupWizardCredentials, PageSetupWizardProtocols, PageSetupWizardEasy, + PageSetupWizardStart, PageTest, PageSetupWizardCredentials, PageSetupWizardProtocols, PageSetupWizardEasy, PageSetupWizardProtocolSettings, PageSetupWizardInstalling, PageSetupWizardConfigSource, - PageSetupWizardTextKey}; + PageSetupWizardTextKey, + + PageStart, PageHome, PageSettings, PageShare}; Q_ENUM_NS(Page) static void declareQmlPageEnum() { diff --git a/client/ui/pages_logic/ServerListLogic.cpp b/client/ui/pages_logic/ServerListLogic.cpp index 79d13c8b4..4a17e2022 100644 --- a/client/ui/pages_logic/ServerListLogic.cpp +++ b/client/ui/pages_logic/ServerListLogic.cpp @@ -6,7 +6,7 @@ ServerListLogic::ServerListLogic(UiLogic *logic, QObject *parent): PageLogicBase(logic, parent), - m_serverListModel{new ServersModel(this)} + m_serverListModel{new ServersModel(m_settings, this)} { } @@ -33,7 +33,7 @@ void ServerListLogic::onUpdatePage() { const QJsonArray &servers = m_settings->serversArray(); int defaultServer = m_settings->defaultServerIndex(); - std::vector serverListContent; + QVector serverListContent; for(int i = 0; i < servers.size(); i++) { ServerModelContent c; auto server = servers.at(i).toObject(); diff --git a/client/ui/qml/Controls2/DropDownType.qml b/client/ui/qml/Controls2/DropDownType.qml index 696aa48a3..6f5111948 100644 --- a/client/ui/qml/Controls2/DropDownType.qml +++ b/client/ui/qml/Controls2/DropDownType.qml @@ -12,14 +12,20 @@ Item { property var onClickedFunc property string buttonImage: "qrc:/images/controls/chevron-down.svg" + property string buttonImageColor: "#494B50" + property string defaultColor: "#1C1D21" + property string textColor: "#d7d8db" + property string borderColor: "#494B50" + property int borderWidth: 1 property alias menuModel: menuContent.model - height: buttonContent.implicitHeight + implicitWidth: buttonContent.implicitWidth + implicitHeight: buttonContent.implicitHeight Rectangle { id: buttonBackground @@ -28,6 +34,7 @@ Item { radius: 16 color: defaultColor border.color: borderColor + border.width: borderWidth Behavior on border.width { PropertyAnimation { duration: 200 } @@ -37,72 +44,55 @@ Item { RowLayout { id: buttonContent anchors.fill: parent - anchors.rightMargin: 16 - anchors.leftMargin: 16 + + spacing: 0 ColumnLayout { Layout.leftMargin: 16 - Layout.rightMargin: 16 - Layout.topMargin: 16 - Layout.bottomMargin: 16 - Text { + LabelTextType { + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + visible: root.descriptionText !== "" - font.family: "PT Root UI" - font.styleName: "normal" - font.pixelSize: 13 - font.letterSpacing: 0.02 color: "#878B91" text: root.descriptionText - wrapMode: Text.WordWrap - - Layout.fillWidth: true - height: 16 + } - horizontalAlignment: Text.AlignLeft + ButtonTextType { + horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter - } - Text { - font.family: "PT Root UI" - font.styleName: "normal" - font.pixelSize: 16 - color: "#d7d8db" + color: root.textColor text: root.text - - Layout.fillWidth: true - height: 24 - - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter } } ImageButtonType { id: button + Layout.leftMargin: 4 Layout.rightMargin: 16 hoverEnabled: false image: buttonImage + imageColor: buttonImageColor onClicked: { if (onClickedFunc && typeof onClickedFunc === "function") { onClickedFunc() } } - - Layout.alignment: Qt.AlignRight } } MouseArea { - anchors.fill: parent + anchors.fill: buttonContent cursorShape: Qt.PointingHandCursor hoverEnabled: true onEntered: { - buttonBackground.border.width = 1 + buttonBackground.border.width = borderWidth } onExited: { @@ -119,7 +109,7 @@ Item { edge: Qt.BottomEdge width: parent.width - height: parent.height * 0.8 + height: parent.height * 0.9 clip: true modal: true @@ -129,6 +119,9 @@ Item { anchors.bottomMargin: -radius radius: 16 color: "#1C1D21" + + border.color: borderColor + border.width: 1 } Overlay.modal: Rectangle { diff --git a/client/ui/qml/Controls2/Header2Type.qml b/client/ui/qml/Controls2/Header2Type.qml new file mode 100644 index 000000000..e0173a73b --- /dev/null +++ b/client/ui/qml/Controls2/Header2Type.qml @@ -0,0 +1,56 @@ +import QtQuick +import QtQuick.Layouts + +import "TextTypes" + +Item { + id: root + + property string buttonImage + property string headerText + property string descriptionText + + implicitWidth: content.implicitWidth + implicitHeight: content.implicitHeight + + ColumnLayout { + id: content + anchors.fill: parent + + ImageButtonType { + id: backButton + + Layout.leftMargin: -6 + + image: root.buttonImage + imageColor: "#D7D8DB" + + visible: image ? true : false + + onClicked: { + UiLogic.closePage() + } + } + + Header2TextType { + id: header + + Layout.fillWidth: true + + text: root.headerText + } + + ParagraphTextType { + id: description + + Layout.topMargin: 16 + Layout.fillWidth: true + + text: root.descriptionText + + color: "#878B91" + + visible: root.descriptionText !== "" + } + } +} diff --git a/client/ui/qml/Controls2/HeaderType.qml b/client/ui/qml/Controls2/HeaderType.qml index 6e10e75cc..407f67f0f 100644 --- a/client/ui/qml/Controls2/HeaderType.qml +++ b/client/ui/qml/Controls2/HeaderType.qml @@ -1,6 +1,8 @@ import QtQuick import QtQuick.Layouts +import "TextTypes" + Item { id: root @@ -30,39 +32,23 @@ Item { } } - Text { + Header1TextType { id: header - text: root.headerText - - color: "#D7D8DB" - font.pixelSize: 36 - font.weight: 700 - font.family: "PT Root UI VF" - font.letterSpacing: -0.03 - - wrapMode: Text.WordWrap - - height: 38 Layout.fillWidth: true + + text: root.headerText } - Text { + ParagraphTextType { id: description + Layout.topMargin: 16 + Layout.fillWidth: true + text: root.descriptionText color: "#878B91" - font.pixelSize: 16 - font.weight: 400 - font.family: "PT Root UI VF" - font.letterSpacing: -0.03 - - wrapMode: Text.WordWrap - - height: 24 - Layout.topMargin: 16 - Layout.fillWidth: true } } } diff --git a/client/ui/qml/Controls2/TabImageButtonType.qml b/client/ui/qml/Controls2/TabImageButtonType.qml new file mode 100644 index 000000000..06b77e6ae --- /dev/null +++ b/client/ui/qml/Controls2/TabImageButtonType.qml @@ -0,0 +1,24 @@ +import QtQuick +import QtQuick.Controls + +TabButton { + id: root + + property string hoveredColor: "#412102" + property string defaultColor: "#D7D8DB" + property string selectedColor: "#FBB26A" + + property string image + + property bool isSelected: false + + hoverEnabled: true + + icon.source: image + icon.color: isSelected ? selectedColor : defaultColor + + background: Rectangle { + anchors.fill: parent + color: "transparent" + } +} diff --git a/client/ui/qml/Controls2/TextTypes/ButtonTextType.qml b/client/ui/qml/Controls2/TextTypes/ButtonTextType.qml new file mode 100644 index 000000000..93a36578a --- /dev/null +++ b/client/ui/qml/Controls2/TextTypes/ButtonTextType.qml @@ -0,0 +1,12 @@ +import QtQuick + +Text { + height: 24 + + color: "#D7D8DB" + font.pixelSize: 16 + font.weight: 500 + font.family: "PT Root UI VF" + + wrapMode: Text.WordWrap +} diff --git a/client/ui/qml/Controls2/TextTypes/Header1TextType.qml b/client/ui/qml/Controls2/TextTypes/Header1TextType.qml new file mode 100644 index 000000000..dbc04b6a7 --- /dev/null +++ b/client/ui/qml/Controls2/TextTypes/Header1TextType.qml @@ -0,0 +1,14 @@ +import QtQuick + +Text { + height: 38 + + color: "#D7D8DB" + font.pixelSize: 36 + font.weight: 700 + font.family: "PT Root UI VF" + font.letterSpacing: -0.03 + + wrapMode: Text.WordWrap +} + diff --git a/client/ui/qml/Controls2/TextTypes/Header2TextType.qml b/client/ui/qml/Controls2/TextTypes/Header2TextType.qml index 4bbbc0d67..1400ceb2b 100644 --- a/client/ui/qml/Controls2/TextTypes/Header2TextType.qml +++ b/client/ui/qml/Controls2/TextTypes/Header2TextType.qml @@ -1,10 +1,12 @@ import QtQuick Text { + height: 30 + color: "#D7D8DB" font.pixelSize: 25 font.weight: 700 font.family: "PT Root UI VF" - height: 30 + wrapMode: Text.WordWrap } diff --git a/client/ui/qml/Controls2/TextTypes/LabelTextType.qml b/client/ui/qml/Controls2/TextTypes/LabelTextType.qml new file mode 100644 index 000000000..386490229 --- /dev/null +++ b/client/ui/qml/Controls2/TextTypes/LabelTextType.qml @@ -0,0 +1,13 @@ +import QtQuick + +Text { + height: 16 + + color: "#878B91" + font.pixelSize: 13 + font.weight: 400 + font.family: "PT Root UI VF" + font.letterSpacing: 0.02 + + wrapMode: Text.WordWrap +} diff --git a/client/ui/qml/Controls2/TextTypes/BodyTextType.qml b/client/ui/qml/Controls2/TextTypes/ParagraphTextType.qml similarity index 87% rename from client/ui/qml/Controls2/TextTypes/BodyTextType.qml rename to client/ui/qml/Controls2/TextTypes/ParagraphTextType.qml index 9d789385b..269830bc5 100644 --- a/client/ui/qml/Controls2/TextTypes/BodyTextType.qml +++ b/client/ui/qml/Controls2/TextTypes/ParagraphTextType.qml @@ -1,12 +1,12 @@ import QtQuick Text { - text: root.bodyText - wrapMode: Text.WordWrap + height: 24 + color: "#D7D8DB" font.pixelSize: 16 font.weight: 400 font.family: "PT Root UI VF" - height: 24 + wrapMode: Text.WordWrap } diff --git a/client/ui/qml/PageLoader.qml b/client/ui/qml/PageLoader.qml index a44fa4b52..86f9e5a18 100644 --- a/client/ui/qml/PageLoader.qml +++ b/client/ui/qml/PageLoader.qml @@ -3,5 +3,5 @@ import QtQuick.Controls StackView { id: stackView - initialItem: "PageStart" + initialItem: "PageSetupWizardStart" } diff --git a/client/ui/qml/Pages2/PageHome.qml b/client/ui/qml/Pages2/PageHome.qml new file mode 100644 index 000000000..ad1b7d38c --- /dev/null +++ b/client/ui/qml/Pages2/PageHome.qml @@ -0,0 +1,266 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +import PageEnum 1.0 + +import "./" +import "../Pages" +import "../Controls2" +import "../Controls2/TextTypes" +import "../Config" + +PageBase { + id: root + page: PageEnum.PageHome + + property string defaultColor: "#1C1D21" + + property string borderColor: "#2C2D30" + + property string currentServerName: menuContent.currentItem.delegateData.desc + property string currentServerDescription: menuContent.currentItem.delegateData.address + + Rectangle { + id: buttonBackground + anchors.fill: buttonContent + anchors.bottomMargin: -radius + + radius: 16 + color: defaultColor + border.color: borderColor + border.width: 1 + + Rectangle { + width: parent.width + height: 1 + y: parent.height - height - parent.radius + + color: borderColor + } + } + + ColumnLayout { + id: buttonContent + anchors.right: parent.right + anchors.left: parent.left + anchors.bottom: parent.bottom + + RowLayout { + Layout.topMargin: 24 + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + + Header1TextType { + text: currentServerName + } + + Image { + Layout.preferredWidth: 18 + Layout.preferredHeight: 18 + + source: "qrc:/images/controls/chevron-down.svg" + } + } + + LabelTextType { + Layout.bottomMargin: 44 + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + + text: currentServerDescription + } + } + + MouseArea { + anchors.fill: buttonBackground + cursorShape: Qt.PointingHandCursor + hoverEnabled: true + + onClicked: { + menu.visible = true + } + } + + Drawer { + id: menu + + edge: Qt.BottomEdge + width: parent.width + height: parent.height * 0.90 + + clip: true + modal: true + + background: Rectangle { + anchors.fill: parent + anchors.bottomMargin: -radius + radius: 16 + + color: "#1C1D21" + border.color: borderColor + border.width: 1 + } + + Overlay.modal: Rectangle { + color: Qt.rgba(14/255, 14/255, 17/255, 0.8) + } + + ColumnLayout { + id: menuHeader + anchors.top: parent.top + anchors.right: parent.right + anchors.left: parent.left + + Header1TextType { + Layout.topMargin: 24 + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + + text: currentServerName + } + + LabelTextType { + Layout.bottomMargin: 24 + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + + text: currentServerDescription + } + + RowLayout { + + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + spacing: 8 + + DropDownType { + implicitHeight: 40 + + borderWidth: 0 + buttonImageColor: "#0E0E11" + + defaultColor: "#D7D8DB" + + textColor: "#0E0E11" + text: "testtesttest" + } + + BasicButtonType { + implicitHeight: 40 + + text: "Amnezia DNS" + } + } + + Header2Type { + Layout.leftMargin: 16 + Layout.rightMargin: 16 + + headerText: "Серверы" + } + } + + +// Header2TextType { +// id: menuHeader +// width: parent.width + +// text: "Данные для подключения" +// wrapMode: Text.WordWrap + +// anchors.top: parent.top +// anchors.left: parent.left +// anchors.right: parent.right +// anchors.topMargin: 16 +// anchors.leftMargin: 16 +// anchors.rightMargin: 16 +// } + + FlickableType { + anchors.top: menuHeader.bottom + anchors.topMargin: 16 + contentHeight: col.implicitHeight + + Column { + id: col + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + + spacing: 16 + + ButtonGroup { + id: radioButtonGroup + } + + ListView { + id: menuContent + width: parent.width + height: menuContent.contentItem.height + + model: ServersModel + currentIndex: 0 + + clip: true + interactive: false + + delegate: Item { + id: menuContentDelegate + + property variant delegateData: model + + implicitWidth: menuContent.width + implicitHeight: radioButton.implicitHeight + + RadioButton { + id: radioButton + + implicitWidth: parent.width + implicitHeight: radioButtonContent.implicitHeight + + hoverEnabled: true + + ButtonGroup.group: radioButtonGroup + + indicator: Rectangle { + anchors.fill: parent + color: radioButton.hovered ? "#2C2D30" : "#1C1D21" + } + + RowLayout { + id: radioButtonContent + anchors.fill: parent + + anchors.rightMargin: 16 + anchors.leftMargin: 16 + + z: 1 + + Text { + id: text + + text: desc + color: "#D7D8DB" + font.pixelSize: 16 + font.weight: 400 + font.family: "PT Root UI VF" + + height: 24 + + Layout.fillWidth: true + Layout.topMargin: 20 + Layout.bottomMargin: 20 + } + + Image { + source: "qrc:/images/controls/check.svg" + visible: radioButton.checked + width: 24 + height: 24 + + Layout.rightMargin: 8 + } + } + } + } + } + } + } + } +} diff --git a/client/ui/qml/Pages2/PageSettings.qml b/client/ui/qml/Pages2/PageSettings.qml new file mode 100644 index 000000000..5560aee72 --- /dev/null +++ b/client/ui/qml/Pages2/PageSettings.qml @@ -0,0 +1,5 @@ +import QtQuick + +Item { + +} diff --git a/client/ui/qml/Pages2/PageSetupWizardConfigSource.qml b/client/ui/qml/Pages2/PageSetupWizardConfigSource.qml index 26f25a15d..a6ba52bb8 100644 --- a/client/ui/qml/Pages2/PageSetupWizardConfigSource.qml +++ b/client/ui/qml/Pages2/PageSetupWizardConfigSource.qml @@ -64,7 +64,6 @@ PageBase { FileDialog { id: fileDialog -// currentFolder: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0] onAccepted: { } @@ -76,7 +75,7 @@ PageBase { color: "#2C2D30" } - //todo ifdef mobile platforms> + //todo ifdef mobile platforms LabelWithButtonType { Layout.fillWidth: true diff --git a/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml b/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml index 9b6e788fe..17c22b04c 100644 --- a/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml +++ b/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml @@ -41,7 +41,7 @@ PageBase { descriptionText: "Эти настройки можно будет изменить позже" } - BodyTextType { + ParagraphTextType { Layout.topMargin: 16 text: "Network protocol" diff --git a/client/ui/qml/Pages2/PageSetupWizardStart.qml b/client/ui/qml/Pages2/PageSetupWizardStart.qml new file mode 100644 index 000000000..0167ed1fe --- /dev/null +++ b/client/ui/qml/Pages2/PageSetupWizardStart.qml @@ -0,0 +1,163 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +import PageEnum 1.0 + +import "./" +import "../Pages" +import "../Controls2" +import "../Config" +import "../Controls2/TextTypes" + +PageBase { + id: root + page: PageEnum.PageSetupWizardStart + + FlickableType { + id: fl + anchors.top: root.top + anchors.bottom: root.bottom + contentHeight: content.height + + ColumnLayout { + id: content + + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + + Image { + id: image + source: "qrc:/images/amneziaBigLogo.png" + + Layout.alignment: Qt.AlignCenter + Layout.topMargin: 32 + Layout.leftMargin: 8 + Layout.rightMargin: 8 + Layout.preferredWidth: 344 + Layout.preferredHeight: 279 + } + + ParagraphTextType { + Layout.fillWidth: true + Layout.topMargin: 50 + Layout.leftMargin: 16 + Layout.rightMargin: 16 + + text: "Бесплатный сервис для создания личного VPN на вашем сервере. Помогаем получать доступ к заблокированному контенту, не раскрывая конфиденциальность даже провайдерам VPN." + } + + BasicButtonType { + Layout.fillWidth: true + Layout.topMargin: 32 + Layout.leftMargin: 16 + Layout.rightMargin: 16 + + text: qsTr("У меня есть данные для подключения") + + onClicked: { + drawer.visible = true + } + } + + BasicButtonType { + Layout.fillWidth: true + Layout.topMargin: 8 + Layout.leftMargin: 16 + Layout.rightMargin: 16 + + defaultColor: "transparent" + hoveredColor: Qt.rgba(1, 1, 1, 0.08) + pressedColor: Qt.rgba(1, 1, 1, 0.12) + disabledColor: "#878B91" + textColor: "#D7D8DB" + borderWidth: 1 + + text: qsTr("У меня ничего нет") + + onClicked: { + UiLogic.goToPage(PageEnum.PageTest) + } + } + } + + Drawer { + id: drawer + + edge: Qt.BottomEdge + width: parent.width + height: parent.height * 0.4375 + + clip: true + modal: true + + background: Rectangle { + anchors.fill: parent + anchors.bottomMargin: -radius + radius: 16 + color: "#1C1D21" + + border.color: borderColor + border.width: 1 + } + + Overlay.modal: Rectangle { + color: Qt.rgba(14/255, 14/255, 17/255, 0.8) + } + + ColumnLayout { + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + + anchors.rightMargin: 16 + anchors.leftMargin: 16 + + Header2TextType { + Layout.fillWidth: true + Layout.topMargin: 24 + Layout.alignment: Qt.AlignHCenter + + text: "Данные для подключения" + wrapMode: Text.WordWrap + } + + LabelWithButtonType { + id: ip + Layout.fillWidth: true + Layout.topMargin: 32 + + text: "IP, логин и пароль от сервера" + buttonImage: "qrc:/images/controls/chevron-right.svg" + + onClickedFunc: function() { + UiLogic.goToPage(PageEnum.PageSetupWizardCredentials) + drawer.visible = false + } + } + Rectangle { + Layout.fillWidth: true + height: 1 + color: "#2C2D30" + } + LabelWithButtonType { + Layout.fillWidth: true + + text: "QR-код, ключ или файл настроек" + buttonImage: "qrc:/images/controls/chevron-right.svg" + + onClickedFunc: function() { + UiLogic.goToPage(PageEnum.PageSetupWizardConfigSource) + drawer.visible = false + } + } + Rectangle { + Layout.fillWidth: true + height: 1 + color: "#2C2D30" + } + } + } + } +} diff --git a/client/ui/qml/Pages2/PageShare.qml b/client/ui/qml/Pages2/PageShare.qml new file mode 100644 index 000000000..5560aee72 --- /dev/null +++ b/client/ui/qml/Pages2/PageShare.qml @@ -0,0 +1,5 @@ +import QtQuick + +Item { + +} diff --git a/client/ui/qml/Pages2/PageStart.qml b/client/ui/qml/Pages2/PageStart.qml index e04ebbb6c..9e94ed28b 100644 --- a/client/ui/qml/Pages2/PageStart.qml +++ b/client/ui/qml/Pages2/PageStart.qml @@ -7,154 +7,74 @@ import PageEnum 1.0 import "./" import "../Pages" import "../Controls2" -import "../Config" import "../Controls2/TextTypes" +import "../Config" PageBase { id: root page: PageEnum.PageStart - FlickableType { - id: fl - anchors.top: root.top - anchors.bottom: root.bottom - contentHeight: content.height - - ColumnLayout { - id: content - - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - - Image { - id: image - source: "qrc:/images/amneziaBigLogo.png" - - Layout.alignment: Qt.AlignCenter - Layout.topMargin: 32 - Layout.leftMargin: 8 - Layout.rightMargin: 8 - Layout.preferredWidth: 344 - Layout.preferredHeight: 279 - } - - BodyTextType { - Layout.fillWidth: true - Layout.topMargin: 50 - Layout.leftMargin: 16 - Layout.rightMargin: 16 + StackLayout { + id: stackLayout + currentIndex: tabBar.currentIndex - text: "Бесплатный сервис для создания личного VPN на вашем сервере. Помогаем получать доступ к заблокированному контенту, не раскрывая конфиденциальность даже провайдерам VPN." - } + anchors.top: parent.top + anchors.right: parent.right + anchors.left: parent.left + anchors.bottom: tabBar.top - BasicButtonType { - Layout.fillWidth: true - Layout.topMargin: 32 - Layout.leftMargin: 16 - Layout.rightMargin: 16 - - text: qsTr("У меня есть данные для подключения") - - onClicked: { - drawer.visible = true - } - } - - BasicButtonType { - Layout.fillWidth: true - Layout.topMargin: 8 - Layout.leftMargin: 16 - Layout.rightMargin: 16 - - defaultColor: "transparent" - hoveredColor: Qt.rgba(1, 1, 1, 0.08) - pressedColor: Qt.rgba(1, 1, 1, 0.12) - disabledColor: "#878B91" - textColor: "#D7D8DB" - borderWidth: 1 - - text: qsTr("У меня ничего нет") - - onClicked: { - UiLogic.goToPage(PageEnum.PageTest) - } - } + width: { + console.log(parent.width) + return parent.width + } + height: { + console.log(root.height - tabBar.implicitHeight) + return root.height - tabBar.implicitHeight } - Drawer { - id: drawer - - edge: Qt.BottomEdge - width: parent.width - height: parent.height * 0.4375 - - clip: true - modal: true - - background: Rectangle { - anchors.fill: parent - anchors.bottomMargin: -radius - radius: 16 - color: "#1C1D21" - } - - Overlay.modal: Rectangle { - color: Qt.rgba(14/255, 14/255, 17/255, 0.8) - } - - ColumnLayout { - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - - anchors.rightMargin: 16 - anchors.leftMargin: 16 + PageHome { + } - Header2TextType { - Layout.fillWidth: true - Layout.topMargin: 24 - Layout.alignment: Qt.AlignHCenter + PageSetupWizardEasy { + } + } - text: "Данные для подключения" - wrapMode: Text.WordWrap - } + TabBar { + id: tabBar - LabelWithButtonType { - id: ip - Layout.fillWidth: true - Layout.topMargin: 32 + anchors.right: parent.right + anchors.left: parent.left + anchors.bottom: parent.bottom - text: "IP, логин и пароль от сервера" - buttonImage: "qrc:/images/controls/chevron-right.svg" + topPadding: 8 + bottomPadding: 34 + leftPadding: 96 + rightPadding: 96 - onClickedFunc: function() { - UiLogic.goToPage(PageEnum.PageSetupWizardCredentials) - drawer.visible = false - } - } - Rectangle { - Layout.fillWidth: true - height: 1 - color: "#2C2D30" - } - LabelWithButtonType { - Layout.fillWidth: true + background: Rectangle { + color: "#1C1D21" + } - text: "QR-код, ключ или файл настроек" - buttonImage: "qrc:/images/controls/chevron-right.svg" - onClickedFunc: function() { - UiLogic.goToPage(PageEnum.PageSetupWizardConfigSource) - drawer.visible = false - } - } - Rectangle { - Layout.fillWidth: true - height: 1 - color: "#2C2D30" - } - } + TabImageButtonType { + isSelected: tabBar.currentIndex === 0 + image: "qrc:/images/controls/home.svg" + } + TabImageButtonType { + isSelected: tabBar.currentIndex === 1 + image: "qrc:/images/controls/share-2.svg" } + TabImageButtonType { + isSelected: tabBar.currentIndex === 2 + image: "qrc:/images/controls/settings-2.svg" + } + } + + MouseArea { + anchors.fill: tabBar + anchors.leftMargin: 96 + anchors.rightMargin: 96 + cursorShape: Qt.PointingHandCursor + enabled: false } } diff --git a/client/ui/uilogic.cpp b/client/ui/uilogic.cpp index 63371420f..bb2f90b22 100644 --- a/client/ui/uilogic.cpp +++ b/client/ui/uilogic.cpp @@ -151,10 +151,10 @@ void UiLogic::initializeUiLogic() if (m_settings->serversCount() > 0) { if (m_settings->defaultServerIndex() < 0) m_settings->setDefaultServer(0); - emit goToPage(Page::Vpn, true, false); + emit goToPage(Page::PageStart, true, false); } else { - emit goToPage(Page::PageStart, true, false); + emit goToPage(Page::PageSetupWizardStart, true, false); } m_selectedServerIndex = m_settings->defaultServerIndex();