added icons for buttons in the drop-down window of connections sharing.

- corrections in texts
This commit is contained in:
vladimir.kuznetsov 2023-07-31 12:54:59 +09:00
parent 1092abe776
commit 66f9a82f31
13 changed files with 136 additions and 109 deletions

View file

@ -8,18 +8,23 @@ QDebug operator<<(QDebug debug, const amnezia::DockerContainer &c)
return debug;
}
amnezia::DockerContainer ContainerProps::containerFromString(const QString &container){
amnezia::DockerContainer ContainerProps::containerFromString(const QString &container)
{
QMetaEnum metaEnum = QMetaEnum::fromType<DockerContainer>();
for (int i = 0; i < metaEnum.keyCount(); ++i) {
DockerContainer c = static_cast<DockerContainer>(i);
if (container == containerToString(c)) return c;
if (container == containerToString(c))
return c;
}
return DockerContainer::None;
}
QString ContainerProps::containerToString(amnezia::DockerContainer c){
if (c == DockerContainer::None) return "none";
if (c == DockerContainer::Cloak) return "amnezia-openvpn-cloak";
QString ContainerProps::containerToString(amnezia::DockerContainer c)
{
if (c == DockerContainer::None)
return "none";
if (c == DockerContainer::Cloak)
return "amnezia-openvpn-cloak";
QMetaEnum metaEnum = QMetaEnum::fromType<DockerContainer>();
QString containerKey = metaEnum.valueToKey(static_cast<int>(c));
@ -27,9 +32,12 @@ QString ContainerProps::containerToString(amnezia::DockerContainer c){
return "amnezia-" + containerKey.toLower();
}
QString ContainerProps::containerTypeToString(amnezia::DockerContainer c){
if (c == DockerContainer::None) return "none";
if (c == DockerContainer::Ipsec) return "ikev2";
QString ContainerProps::containerTypeToString(amnezia::DockerContainer c)
{
if (c == DockerContainer::None)
return "none";
if (c == DockerContainer::Ipsec)
return "ikev2";
QMetaEnum metaEnum = QMetaEnum::fromType<DockerContainer>();
QString containerKey = metaEnum.valueToKey(static_cast<int>(c));
@ -40,29 +48,21 @@ QString ContainerProps::containerTypeToString(amnezia::DockerContainer c){
QVector<amnezia::Proto> ContainerProps::protocolsForContainer(amnezia::DockerContainer container)
{
switch (container) {
case DockerContainer::None:
return { };
case DockerContainer::None: return {};
case DockerContainer::OpenVpn:
return { Proto::OpenVpn };
case DockerContainer::OpenVpn: return { Proto::OpenVpn };
case DockerContainer::ShadowSocks:
return { Proto::OpenVpn, Proto::ShadowSocks };
case DockerContainer::ShadowSocks: return { Proto::OpenVpn, Proto::ShadowSocks };
case DockerContainer::Cloak:
return { Proto::OpenVpn, Proto::ShadowSocks, Proto::Cloak };
case DockerContainer::Cloak: return { Proto::OpenVpn, Proto::ShadowSocks, Proto::Cloak };
case DockerContainer::Ipsec:
return { Proto::Ikev2 /*, Protocol::L2tp */};
case DockerContainer::Ipsec: return { Proto::Ikev2 /*, Protocol::L2tp */ };
case DockerContainer::Dns:
return { };
case DockerContainer::Dns: return {};
case DockerContainer::Sftp:
return { Proto::Sftp};
case DockerContainer::Sftp: return { Proto::Sftp };
default:
return { defaultProtocol(container) };
default: return { defaultProtocol(container) };
}
}
@ -79,70 +79,67 @@ QList<DockerContainer> ContainerProps::allContainers()
QMap<DockerContainer, QString> ContainerProps::containerHumanNames()
{
return {
{DockerContainer::None, "Not installed"},
{DockerContainer::OpenVpn, "OpenVPN"},
{DockerContainer::ShadowSocks, "OpenVpn over ShadowSocks"},
{DockerContainer::Cloak, "OpenVpn over Cloak"},
{DockerContainer::WireGuard, "WireGuard"},
{DockerContainer::Ipsec, QObject::tr("IPsec")},
return { { DockerContainer::None, "Not installed" },
{ DockerContainer::OpenVpn, "OpenVPN" },
{ DockerContainer::ShadowSocks, "OpenVPN over ShadowSocks" },
{ DockerContainer::Cloak, "OpenVPN over Cloak" },
{ DockerContainer::WireGuard, "WireGuard" },
{ DockerContainer::Ipsec, QObject::tr("IPsec") },
{DockerContainer::TorWebSite, QObject::tr("Web site in Tor network")},
{DockerContainer::Dns, QObject::tr("DNS Service")},
//{DockerContainer::FileShare, QObject::tr("SMB file sharing service")},
{DockerContainer::Sftp, QObject::tr("Sftp file sharing service")}
};
{ DockerContainer::TorWebSite, QObject::tr("Web site in Tor network") },
{ DockerContainer::Dns, QObject::tr("Amnezia DNS") },
//{DockerContainer::FileShare, QObject::tr("SMB file sharing service")},
{ DockerContainer::Sftp, QObject::tr("Sftp file sharing service") } };
}
QMap<DockerContainer, QString> ContainerProps::containerDescriptions()
{
return {
{DockerContainer::OpenVpn, QObject::tr("OpenVPN container")},
{DockerContainer::ShadowSocks, QObject::tr("Container with OpenVpn and ShadowSocks")},
{DockerContainer::Cloak, QObject::tr("Container with OpenVpn and ShadowSocks protocols "
"configured with traffic masking by Cloak plugin")},
{DockerContainer::WireGuard, QObject::tr("WireGuard container")},
{DockerContainer::Ipsec, QObject::tr("IPsec container")},
return { { DockerContainer::OpenVpn, QObject::tr("OpenVPN container") },
{ DockerContainer::ShadowSocks, QObject::tr("Container with OpenVpn and ShadowSocks") },
{ DockerContainer::Cloak,
QObject::tr("Container with OpenVpn and ShadowSocks protocols "
"configured with traffic masking by Cloak plugin") },
{ DockerContainer::WireGuard, QObject::tr("WireGuard container") },
{ DockerContainer::Ipsec, QObject::tr("IPsec container") },
{DockerContainer::TorWebSite, QObject::tr("Web site in Tor network")},
{DockerContainer::Dns, QObject::tr("DNS Service")},
//{DockerContainer::FileShare, QObject::tr("SMB file sharing service - is Window file sharing protocol")},
{DockerContainer::Sftp, QObject::tr("Sftp file sharing service - is secure FTP service")}
};
{ DockerContainer::TorWebSite, QObject::tr("Web site in Tor network") },
{ DockerContainer::Dns, QObject::tr("DNS Service") },
//{DockerContainer::FileShare, QObject::tr("SMB file sharing service - is Window file sharing protocol")},
{ DockerContainer::Sftp, QObject::tr("Sftp file sharing service - is secure FTP service") } };
}
amnezia::ServiceType ContainerProps::containerService(DockerContainer c)
{
switch (c) {
case DockerContainer::None : return ServiceType::None;
case DockerContainer::OpenVpn : return ServiceType::Vpn;
case DockerContainer::Cloak : return ServiceType::Vpn;
case DockerContainer::ShadowSocks : return ServiceType::Vpn;
case DockerContainer::WireGuard : return ServiceType::Vpn;
case DockerContainer::Ipsec : return ServiceType::Vpn;
case DockerContainer::TorWebSite : return ServiceType::Other;
case DockerContainer::Dns : return ServiceType::Other;
//case DockerContainer::FileShare : return ServiceType::Other;
case DockerContainer::Sftp : return ServiceType::Other;
default: return ServiceType::Other;
case DockerContainer::None: return ServiceType::None;
case DockerContainer::OpenVpn: return ServiceType::Vpn;
case DockerContainer::Cloak: return ServiceType::Vpn;
case DockerContainer::ShadowSocks: return ServiceType::Vpn;
case DockerContainer::WireGuard: return ServiceType::Vpn;
case DockerContainer::Ipsec: return ServiceType::Vpn;
case DockerContainer::TorWebSite: return ServiceType::Other;
case DockerContainer::Dns: return ServiceType::Other;
// case DockerContainer::FileShare : return ServiceType::Other;
case DockerContainer::Sftp: return ServiceType::Other;
default: return ServiceType::Other;
}
}
Proto ContainerProps::defaultProtocol(DockerContainer c)
{
switch (c) {
case DockerContainer::None : return Proto::Any;
case DockerContainer::OpenVpn : return Proto::OpenVpn;
case DockerContainer::Cloak : return Proto::Cloak;
case DockerContainer::ShadowSocks : return Proto::ShadowSocks;
case DockerContainer::WireGuard : return Proto::WireGuard;
case DockerContainer::Ipsec : return Proto::Ikev2;
case DockerContainer::None: return Proto::Any;
case DockerContainer::OpenVpn: return Proto::OpenVpn;
case DockerContainer::Cloak: return Proto::Cloak;
case DockerContainer::ShadowSocks: return Proto::ShadowSocks;
case DockerContainer::WireGuard: return Proto::WireGuard;
case DockerContainer::Ipsec: return Proto::Ikev2;
case DockerContainer::TorWebSite : return Proto::TorWebSite;
case DockerContainer::Dns : return Proto::Dns;
//case DockerContainer::FileShare : return Protocol::FileShare;
case DockerContainer::Sftp : return Proto::Sftp;
default: return Proto::Any;
case DockerContainer::TorWebSite: return Proto::TorWebSite;
case DockerContainer::Dns: return Proto::Dns;
// case DockerContainer::FileShare : return Protocol::FileShare;
case DockerContainer::Sftp: return Proto::Sftp;
default: return Proto::Any;
}
}
@ -151,22 +148,23 @@ bool ContainerProps::isSupportedByCurrentPlatform(DockerContainer c)
#ifdef Q_OS_WINDOWS
return true;
#elif defined (Q_OS_IOS)
#elif defined(Q_OS_IOS)
switch (c) {
case DockerContainer::WireGuard: return true;
case DockerContainer::OpenVpn: return true;
case DockerContainer::Cloak: return true;
// case DockerContainer::ShadowSocks: return true;
case DockerContainer::Cloak:
return true;
// case DockerContainer::ShadowSocks: return true;
default: return false;
}
#elif defined (Q_OS_MAC)
#elif defined(Q_OS_MAC)
switch (c) {
case DockerContainer::WireGuard: return true;
case DockerContainer::Ipsec: return false;
default: return true;
}
#elif defined (Q_OS_ANDROID)
#elif defined(Q_OS_ANDROID)
switch (c) {
case DockerContainer::WireGuard: return true;
case DockerContainer::OpenVpn: return true;
@ -175,7 +173,7 @@ bool ContainerProps::isSupportedByCurrentPlatform(DockerContainer c)
default: return false;
}
#elif defined (Q_OS_LINUX)
#elif defined(Q_OS_LINUX)
switch (c) {
case DockerContainer::WireGuard: return true;
case DockerContainer::Ipsec: return false;
@ -183,44 +181,44 @@ bool ContainerProps::isSupportedByCurrentPlatform(DockerContainer c)
}
#else
return false;
return false;
#endif
}
QStringList ContainerProps::fixedPortsForContainer(DockerContainer c)
{
switch (c) {
case DockerContainer::Ipsec : return QStringList{"500", "4500"};
default: return {};
case DockerContainer::Ipsec: return QStringList { "500", "4500" };
default: return {};
}
}
bool ContainerProps::isEasySetupContainer(DockerContainer container)
{
switch (container) {
case DockerContainer::OpenVpn : return true;
case DockerContainer::Cloak : return true;
case DockerContainer::ShadowSocks : return true;
default: return false;
case DockerContainer::OpenVpn: return true;
case DockerContainer::Cloak: return true;
case DockerContainer::ShadowSocks: return true;
default: return false;
}
}
QString ContainerProps::easySetupHeader(DockerContainer container)
{
switch (container) {
case DockerContainer::OpenVpn : return tr("Low");
case DockerContainer::Cloak : return tr("High");
case DockerContainer::ShadowSocks : return tr("Medium");
default: return "";
case DockerContainer::OpenVpn: return tr("Low");
case DockerContainer::Cloak: return tr("High");
case DockerContainer::ShadowSocks: return tr("Medium");
default: return "";
}
}
QString ContainerProps::easySetupDescription(DockerContainer container)
{
switch (container) {
case DockerContainer::OpenVpn : return tr("Many foreign websites and VPN providers are blocked");
case DockerContainer::Cloak : return tr("Some foreign sites are blocked, but VPN providers are not blocked");
case DockerContainer::ShadowSocks : return tr("I just want to increase the level of privacy");
default: return "";
case DockerContainer::OpenVpn: return tr("I just want to increase the level of privacy");
case DockerContainer::Cloak: return tr("Some foreign sites are blocked, but VPN providers are not blocked");
case DockerContainer::ShadowSocks: return tr("Many foreign websites and VPN providers are blocked");
default: return "";
}
}

View file

@ -55,6 +55,7 @@ DrawerType {
Layout.topMargin: 16
text: qsTr("Share")
imageSource: "qrc:/images/controls/share-2.svg"
onClicked: {
ExportController.saveFile()
@ -73,6 +74,7 @@ DrawerType {
borderWidth: 1
text: qsTr("Copy")
imageSource: "qrc:/images/controls/copy.svg"
onClicked: {
configText.selectAll()

View file

@ -1,5 +1,7 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Qt5Compat.GraphicalEffects
import "TextTypes"
@ -16,6 +18,8 @@ Button {
property string borderColor: "#D7D8DB"
property int borderWidth: 0
property string imageSource
implicitHeight: 56
hoverEnabled: true
@ -48,11 +52,30 @@ Button {
cursorShape: Qt.PointingHandCursor
}
contentItem: ButtonTextType {
contentItem: Item {
anchors.fill: background
color: textColor
text: root.text
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
RowLayout {
anchors.centerIn: parent
Image {
source: root.imageSource
visible: root.imageSource === "" ? false : true
layer {
enabled: true
effect: ColorOverlay {
color: textColor
}
}
}
ButtonTextType {
color: textColor
text: root.text
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
}
}
}

View file

@ -155,7 +155,7 @@ PageType {
text: root.defaultContainerName
textColor: "#0E0E11"
headerText: qsTr("Connection protocol")
headerText: qsTr("VPN protocol")
headerBackButtonImage: "qrc:/images/controls/arrow-left.svg"
rootButtonClickedFunction: function() {

View file

@ -92,7 +92,7 @@ PageType {
Layout.fillWidth: true
Layout.topMargin: 32
headerText: qsTr("Masquerading as traffic from")
headerText: qsTr("Disguised as traffic from")
textFieldText: site
textField.onEditingFinished: {
@ -161,7 +161,7 @@ PageType {
Layout.topMargin: 24
Layout.bottomMargin: 24
text: qsTr("Save and Restart Amnesia")
text: qsTr("Save and Restart Amnezia")
onClicked: {
forceActiveFocus()

View file

@ -445,7 +445,7 @@ PageType {
Layout.topMargin: 24
Layout.bottomMargin: 24
text: qsTr("Save and Restart Amnesia")
text: qsTr("Save and Restart Amnezia")
onClicked: {
forceActiveFocus()

View file

@ -147,7 +147,7 @@ PageType {
Layout.topMargin: 24
Layout.bottomMargin: 24
text: qsTr("Save and Restart Amnesia")
text: qsTr("Save and Restart Amnezia")
onClicked: {
forceActiveFocus()

View file

@ -48,7 +48,7 @@ PageType {
Layout.leftMargin: 16
Layout.rightMargin: 16
text: qsTr("Use AmnesiaDNS if installed on the server")
text: qsTr("Use AmneziaDNS if installed on the server")
descriptionText: qsTr("Internal IP address 172.29.172.254")
checked: SettingsController.isAmneziaDnsEnabled()

View file

@ -110,7 +110,7 @@ PageType {
visible: content.isServerWithWriteAccess
Layout.fillWidth: true
text: qsTr("Check the server for previously installed Amnesia services")
text: qsTr("Check the server for previously installed Amnezia services")
descriptionText: qsTr("Add them to the application if they were not displayed")
clickedFunction: function() {

View file

@ -49,7 +49,7 @@ PageType {
Layout.fillWidth: true
headerText: qsTr("Server IP address [:port]")
textFieldPlaceholderText: qsTr("Enter the address in the format 255.255.255.255:88")
textFieldPlaceholderText: qsTr("255.255.255.255:88")
textField.validator: RegularExpressionValidator {
regularExpression: InstallController.ipAddressPortRegExp()
}
@ -60,13 +60,14 @@ PageType {
Layout.fillWidth: true
headerText: qsTr("Login to connect via SSH")
textFieldPlaceholderText: "root"
}
TextFieldWithHeaderType {
id: secretData
Layout.fillWidth: true
headerText: qsTr("Password / Private key")
headerText: qsTr("Password / SSH private key")
textField.echoMode: TextInput.Password
}

View file

@ -70,7 +70,7 @@ PageType {
width: parent.width
headerText: qsTr("Connection protocol")
headerText: qsTr("VPN protocol")
descriptionText: qsTr("Choose the one with the highest priority for you. Later, you can install other protocols and additional services, such as DNS proxy and SFTP.")
}
}

View file

@ -53,7 +53,8 @@ PageType {
Layout.leftMargin: 16
Layout.rightMargin: 16
text: qsTr("A free service to create a personal VPN on your server. We help you access blocked content without exposing your privacy even to VPN providers.")
text: qsTr("Free service for creating a personal VPN on your server.") +
qsTr(" Helps you access blocked content without revealing your privacy, even to VPN providers.")
}
BasicButtonType {

View file

@ -65,7 +65,7 @@ PageType {
QtObject {
id: amneziaConnectionFormat
property string name: qsTr("For the AmnesiaVPN app")
property string name: qsTr("For the AmneziaVPN app")
property var type: PageShare.ConfigType.AmneziaConnection
}
QtObject {
@ -135,7 +135,7 @@ PageType {
checked: root.currentIndex === 1
implicitWidth: (root.width - 32) / 2
text: qsTr("Full")
text: qsTr("Full access")
onClicked: {
accessTypeSelector.currentIndex = 1
@ -194,6 +194,8 @@ PageType {
protocolSelector.visible = true
root.shareButtonEnabled = false
} else {
shareConnectionDrawer.headerText = qsTr("Accessing ") + serverSelector.text
shareConnectionDrawer.configContentHeaderText = qsTr("File with connection settings to ") + serverSelector.text
serverSelector.menuVisible = false
}
}