minor ui fixes

This commit is contained in:
vladimir.kuznetsov 2023-08-20 13:36:54 +05:00
parent 0060f57b63
commit b5e1c78461
11 changed files with 132 additions and 66 deletions

View file

@ -81,7 +81,7 @@ QMap<DockerContainer, QString> ContainerProps::containerHumanNames()
{ {
return { { DockerContainer::None, "Not installed" }, return { { DockerContainer::None, "Not installed" },
{ DockerContainer::OpenVpn, "OpenVPN" }, { DockerContainer::OpenVpn, "OpenVPN" },
{ DockerContainer::ShadowSocks, "OpenVPN over ShadowSocks" }, { DockerContainer::ShadowSocks, "ShadowSocks" },
{ DockerContainer::Cloak, "OpenVPN over Cloak" }, { DockerContainer::Cloak, "OpenVPN over Cloak" },
{ DockerContainer::WireGuard, "WireGuard" }, { DockerContainer::WireGuard, "WireGuard" },
{ DockerContainer::Ipsec, QObject::tr("IPsec") }, { DockerContainer::Ipsec, QObject::tr("IPsec") },
@ -93,6 +93,33 @@ QMap<DockerContainer, QString> ContainerProps::containerHumanNames()
} }
QMap<DockerContainer, QString> ContainerProps::containerDescriptions() QMap<DockerContainer, QString> ContainerProps::containerDescriptions()
{
return { { DockerContainer::OpenVpn,
QObject::tr("OpenVPN is the most popular VPN protocol, with flexible configuration options. It uses its "
"own security protocol with SSL/TLS for key exchange.") },
{ DockerContainer::ShadowSocks,
QObject::tr("ShadowSocks - masks VPN traffic, making it similar to normal web traffic, but is "
"recognised by analysis systems in some highly censored regions.") },
{ DockerContainer::Cloak,
QObject::tr("OpenVPN over Cloak - OpenVPN with VPN masquerading as web traffic and protection against "
"active-probbing detection. Ideal for bypassing blocking in regions with the highest levels "
"of censorship.") },
{ DockerContainer::WireGuard,
QObject::tr("WireGuard - New popular VPN protocol with high performance, high speed and low power "
"consumption. Recommended for regions with low levels of censorship.") },
{ DockerContainer::Ipsec,
QObject::tr("IKEv2 - Modern stable protocol, a bit faster than others, restores connection after "
"signal loss. It has native support on the latest versions of Android and iOS.") },
{ DockerContainer::TorWebSite, QObject::tr("Deploy a WordPress site on the Tor network in two clicks.") },
{ DockerContainer::Dns,
QObject::tr("Replace the current DNS server with your own. This will increase your privacy level.") },
//{DockerContainer::FileShare, QObject::tr("SMB file sharing service - is Window file sharing protocol")},
{ DockerContainer::Sftp,
QObject::tr("Creates a file vault on your server to securely store and transfer files.") } };
}
QMap<DockerContainer, QString> ContainerProps::containerDetailedDescriptions()
{ {
return { { DockerContainer::OpenVpn, QObject::tr("OpenVPN container") }, return { { DockerContainer::OpenVpn, QObject::tr("OpenVPN container") },
{ DockerContainer::ShadowSocks, QObject::tr("Container with OpenVpn and ShadowSocks") }, { DockerContainer::ShadowSocks, QObject::tr("Container with OpenVpn and ShadowSocks") },

View file

@ -8,9 +8,11 @@
using namespace amnezia; using namespace amnezia;
namespace amnezia { namespace amnezia
{
namespace ContainerEnumNS { namespace ContainerEnumNS
{
Q_NAMESPACE Q_NAMESPACE
enum DockerContainer { enum DockerContainer {
None = 0, None = 0,
@ -45,6 +47,7 @@ public:
Q_INVOKABLE static QMap<amnezia::DockerContainer, QString> containerHumanNames(); Q_INVOKABLE static QMap<amnezia::DockerContainer, QString> containerHumanNames();
Q_INVOKABLE static QMap<amnezia::DockerContainer, QString> containerDescriptions(); Q_INVOKABLE static QMap<amnezia::DockerContainer, QString> containerDescriptions();
Q_INVOKABLE static QMap<amnezia::DockerContainer, QString> containerDetailedDescriptions();
// these protocols will be displayed in container settings // these protocols will be displayed in container settings
Q_INVOKABLE static QVector<amnezia::Proto> protocolsForContainer(amnezia::DockerContainer container); Q_INVOKABLE static QVector<amnezia::Proto> protocolsForContainer(amnezia::DockerContainer container);
@ -63,16 +66,10 @@ public:
static QString easySetupDescription(amnezia::DockerContainer container); static QString easySetupDescription(amnezia::DockerContainer container);
}; };
static void declareQmlContainerEnum()
{
static void declareQmlContainerEnum() { qmlRegisterUncreatableMetaObject(ContainerEnumNS::staticMetaObject, "ContainerEnum", 1, 0, "ContainerEnum",
qmlRegisterUncreatableMetaObject( "Error: only enums");
ContainerEnumNS::staticMetaObject,
"ContainerEnum",
1, 0,
"ContainerEnum",
"Error: only enums"
);
} }
} // namespace amnezia } // namespace amnezia

View file

@ -446,3 +446,18 @@ void InstallController::setEncryptedPassphrase(QString passphrase)
m_privateKeyPassphrase = passphrase; m_privateKeyPassphrase = passphrase;
emit passphraseRequestFinished(); emit passphraseRequestFinished();
} }
void InstallController::addEmptyServer()
{
QJsonObject server;
server.insert(config_key::hostName, m_currentlyInstalledServerCredentials.hostName);
server.insert(config_key::userName, m_currentlyInstalledServerCredentials.userName);
server.insert(config_key::password, m_currentlyInstalledServerCredentials.secretData);
server.insert(config_key::port, m_currentlyInstalledServerCredentials.port);
server.insert(config_key::description, m_settings->nextAvailableServerName());
m_serversModel->addServer(server);
m_serversModel->setDefaultServerIndex(m_serversModel->getServersCount() - 1);
emit installServerFinished(tr("Server added successfully"));
}

View file

@ -41,6 +41,8 @@ public slots:
void setEncryptedPassphrase(QString passphrase); void setEncryptedPassphrase(QString passphrase);
void addEmptyServer();
signals: signals:
void installContainerFinished(const QString &finishMessage, bool isServiceInstall); void installContainerFinished(const QString &finishMessage, bool isServiceInstall);
void installServerFinished(const QString &finishMessage); void installServerFinished(const QString &finishMessage);

View file

@ -24,7 +24,7 @@ bool ContainersModel::setData(const QModelIndex &index, const QVariant &value, i
switch (role) { switch (role) {
case NameRole: case NameRole:
// return ContainerProps::containerHumanNames().value(container); // return ContainerProps::containerHumanNames().value(container);
case DescRole: case DescriptionRole:
// return ContainerProps::containerDescriptions().value(container); // return ContainerProps::containerDescriptions().value(container);
case ConfigRole: { case ConfigRole: {
m_settings->setContainerConfig(m_currentlyProcessedServerIndex, container, value.toJsonObject()); m_settings->setContainerConfig(m_currentlyProcessedServerIndex, container, value.toJsonObject());
@ -62,7 +62,8 @@ QVariant ContainersModel::data(const QModelIndex &index, int role) const
switch (role) { switch (role) {
case NameRole: return ContainerProps::containerHumanNames().value(container); case NameRole: return ContainerProps::containerHumanNames().value(container);
case DescRole: return ContainerProps::containerDescriptions().value(container); case DescriptionRole: return ContainerProps::containerDescriptions().value(container);
case DetailedDescriptionRole: return ContainerProps::containerDetailedDescriptions().value(container);
case ConfigRole: { case ConfigRole: {
if (container == DockerContainer::None) { if (container == DockerContainer::None) {
return QJsonObject(); return QJsonObject();
@ -220,7 +221,8 @@ QHash<int, QByteArray> ContainersModel::roleNames() const
{ {
QHash<int, QByteArray> roles; QHash<int, QByteArray> roles;
roles[NameRole] = "name"; roles[NameRole] = "name";
roles[DescRole] = "description"; roles[DescriptionRole] = "description";
roles[DetailedDescriptionRole] = "detailedDescription";
roles[ServiceTypeRole] = "serviceType"; roles[ServiceTypeRole] = "serviceType";
roles[DockerContainerRole] = "dockerContainer"; roles[DockerContainerRole] = "dockerContainer";
roles[ConfigRole] = "config"; roles[ConfigRole] = "config";

View file

@ -17,7 +17,8 @@ public:
enum Roles { enum Roles {
NameRole = Qt::UserRole + 1, NameRole = Qt::UserRole + 1,
DescRole, DescriptionRole,
DetailedDescriptionRole,
ServiceTypeRole, ServiceTypeRole,
ConfigRole, ConfigRole,
DockerContainerRole, DockerContainerRole,

View file

@ -138,7 +138,7 @@ PageType {
text: qsTr("Remove website") text: qsTr("Remove website")
onClicked: { onClicked: {
questionDrawer.headerText = qsTr("Some description") questionDrawer.headerText = qsTr("The site with all data will be removed from the tor network.")
questionDrawer.yesButtonText = qsTr("Continue") questionDrawer.yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.noButtonText = qsTr("Cancel")

View file

@ -81,7 +81,7 @@ And if you don't like the app, all the more support it - the donation will be us
text: qsTr("Card on Patreon") text: qsTr("Card on Patreon")
clickedFunction: function() { onClicked: function() {
Qt.openUrlExternally(qsTr("https://www.patreon.com/amneziavpn")) Qt.openUrlExternally(qsTr("https://www.patreon.com/amneziavpn"))
} }
} }

View file

@ -43,7 +43,7 @@ PageType {
QtObject { QtObject {
id: onlyForwardSites id: onlyForwardSites
property string name: qsTr("Addresses from the list should always open via VPN") property string name: qsTr("Only the addresses in the list must be opened via VPN")
property int type: routeMode.onlyForwardSites property int type: routeMode.onlyForwardSites
} }
QtObject { QtObject {

View file

@ -126,6 +126,8 @@ PageType {
} }
} }
DividerType {}
CardType { CardType {
implicitWidth: parent.width implicitWidth: parent.width
@ -143,14 +145,14 @@ PageType {
id: continueButton id: continueButton
implicitWidth: parent.width implicitWidth: parent.width
anchors.bottomMargin: 24 anchors.topMargin: 24
text: qsTr("Continue") text: qsTr("Continue")
onClicked: function() { onClicked: function() {
if (root.isEasySetup) { if (root.isEasySetup) {
ContainersModel.setCurrentlyProcessedContainerIndex(containers.dockerContainer) ContainersModel.setCurrentlyProcessedContainerIndex(containers.dockerContainer)
goToPage(PageEnum.PageSetupWizardInstalling); goToPage(PageEnum.PageSetupWizardInstalling)
InstallController.install(containers.dockerContainer, InstallController.install(containers.dockerContainer,
containers.containerDefaultPort, containers.containerDefaultPort,
containers.containerDefaultTransportProto) containers.containerDefaultTransportProto)
@ -159,6 +161,26 @@ PageType {
} }
} }
} }
BasicButtonType {
implicitWidth: parent.width
anchors.topMargin: 8
anchors.bottomMargin: 24
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("Set up later")
onClicked: function() {
goToPage(PageEnum.PageSetupWizardInstalling)
InstallController.addEmptyServer()
}
}
} }
} }
} }

View file

@ -73,7 +73,7 @@ PageType {
Layout.fillWidth: true Layout.fillWidth: true
headerText: qsTr("Installing ") + name headerText: qsTr("Installing ") + name
descriptionText: qsTr("protocol description") descriptionText: description
} }
BasicButtonType { BasicButtonType {
@ -159,7 +159,7 @@ PageType {
font.weight: Font.Medium font.weight: Font.Medium
font.family: "PT Root UI VF" font.family: "PT Root UI VF"
text: qsTr("detailed protocol description") text: detailedDescription
wrapMode: Text.WordWrap wrapMode: Text.WordWrap