mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-05-18 00:45:58 +03:00
Compare commits
7 Commits
fix/clicka
...
bugfix/api
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6161cde620 | ||
|
|
5dd3ea9f9b | ||
|
|
04289b441d | ||
|
|
4a4204b120 | ||
|
|
10a26a463a | ||
|
|
62c33e373e | ||
|
|
6f31943cac |
@@ -363,22 +363,16 @@ void AmneziaApplication::initControllers()
|
||||
new ConnectionController(m_serversModel, m_containersModel, m_clientManagementModel, m_vpnConnection, m_settings));
|
||||
m_engine->rootContext()->setContextProperty("ConnectionController", m_connectionController.get());
|
||||
|
||||
connect(m_connectionController.get(), qOverload<const QString &>(&ConnectionController::connectionErrorOccurred), this, [this](const QString &errorMessage) {
|
||||
connect(m_connectionController.get(), &ConnectionController::connectionErrorOccurred, this, [this](const QString &errorMessage) {
|
||||
emit m_pageController->showErrorMessage(errorMessage);
|
||||
emit m_vpnConnection->connectionStateChanged(Vpn::ConnectionState::Disconnected);
|
||||
});
|
||||
|
||||
connect(m_connectionController.get(), qOverload<ErrorCode>(&ConnectionController::connectionErrorOccurred), this, [this](ErrorCode errorCode) {
|
||||
emit m_pageController->showErrorMessage(errorCode);
|
||||
emit m_vpnConnection->connectionStateChanged(Vpn::ConnectionState::Disconnected);
|
||||
});
|
||||
|
||||
connect(m_connectionController.get(), &ConnectionController::connectButtonClicked, m_connectionController.get(),
|
||||
&ConnectionController::toggleConnection, Qt::QueuedConnection);
|
||||
|
||||
connect(this, &AmneziaApplication::translationsUpdated, m_connectionController.get(), &ConnectionController::onTranslationsUpdated);
|
||||
|
||||
m_pageController.reset(new PageController(m_serversModel, m_settings, m_languageModel));
|
||||
m_pageController.reset(new PageController(m_serversModel, m_settings));
|
||||
m_engine->rootContext()->setContextProperty("PageController", m_pageController.get());
|
||||
|
||||
m_installController.reset(new InstallController(m_serversModel, m_containersModel, m_protocolsModel, m_clientManagementModel, m_settings));
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "amnezia_application.h"
|
||||
#include "configurators/wireguard_configurator.h"
|
||||
#include "version.h"
|
||||
#include "core/errorstrings.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -21,10 +21,7 @@ namespace
|
||||
constexpr char certificate[] = "certificate";
|
||||
constexpr char publicKey[] = "public_key";
|
||||
constexpr char protocol[] = "protocol";
|
||||
|
||||
constexpr char uuid[] = "installation_uuid";
|
||||
constexpr char osVersion[] = "os_version";
|
||||
constexpr char appVersion[] = "app_version";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,10 +62,6 @@ QJsonObject ApiController::fillApiPayload(const QString &protocol, const ApiCont
|
||||
} else if (protocol == configKey::awg) {
|
||||
obj[configKey::publicKey] = apiPayloadData.wireGuardClientPubKey;
|
||||
}
|
||||
|
||||
obj[configKey::osVersion] = QSysInfo::productType();
|
||||
obj[configKey::appVersion] = QString(APP_VERSION);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
@@ -109,7 +102,7 @@ void ApiController::updateServerConfigFromApi(const QString &installationUuid, c
|
||||
QByteArray ba = QByteArray::fromBase64(data.toUtf8(), QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals);
|
||||
|
||||
if (ba.isEmpty()) {
|
||||
emit errorOccurred(ErrorCode::ApiConfigEmptyError);
|
||||
emit errorOccurred(errorString(ErrorCode::ApiConfigEmptyError));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -134,14 +127,14 @@ void ApiController::updateServerConfigFromApi(const QString &installationUuid, c
|
||||
} else {
|
||||
if (reply->error() == QNetworkReply::NetworkError::OperationCanceledError
|
||||
|| reply->error() == QNetworkReply::NetworkError::TimeoutError) {
|
||||
emit errorOccurred(ErrorCode::ApiConfigTimeoutError);
|
||||
emit errorOccurred(errorString(ErrorCode::ApiConfigTimeoutError));
|
||||
} else {
|
||||
QString err = reply->errorString();
|
||||
qDebug() << QString::fromUtf8(reply->readAll());
|
||||
qDebug() << reply->error();
|
||||
qDebug() << err;
|
||||
qDebug() << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
|
||||
emit errorOccurred(ErrorCode::ApiConfigDownloadError);
|
||||
emit errorOccurred(errorString(ErrorCode::ApiConfigDownloadError));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +145,7 @@ void ApiController::updateServerConfigFromApi(const QString &installationUuid, c
|
||||
[this, reply](QNetworkReply::NetworkError error) { qDebug() << reply->errorString() << error; });
|
||||
connect(reply, &QNetworkReply::sslErrors, [this, reply](const QList<QSslError> &errors) {
|
||||
qDebug().noquote() << errors;
|
||||
emit errorOccurred(ErrorCode::ApiConfigSslError);
|
||||
emit errorOccurred(errorString(ErrorCode::ApiConfigSslError));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public slots:
|
||||
void updateServerConfigFromApi(const QString &installationUuid, const int serverIndex, QJsonObject serverConfig);
|
||||
|
||||
signals:
|
||||
void errorOccurred(ErrorCode errorCode);
|
||||
void errorOccurred(const QString &errorMessage);
|
||||
void configUpdated(const bool updateConfig, const QJsonObject &config, const int serverIndex);
|
||||
|
||||
private:
|
||||
|
||||
@@ -36,11 +36,7 @@ namespace amnezia
|
||||
}
|
||||
};
|
||||
|
||||
namespace error_code_ns
|
||||
{
|
||||
Q_NAMESPACE
|
||||
// TODO: change to enum class
|
||||
enum ErrorCode {
|
||||
enum ErrorCode {
|
||||
// General error codes
|
||||
NoError = 0,
|
||||
UnknownError = 100,
|
||||
@@ -79,7 +75,7 @@ namespace amnezia
|
||||
AmneziaServiceConnectionFailed = 603,
|
||||
ExecutableMissing = 604,
|
||||
XrayExecutableMissing = 605,
|
||||
Tun2SockExecutableMissing = 606,
|
||||
Tun2SockExecutableMissing = 606,
|
||||
|
||||
// VPN errors
|
||||
OpenVpnAdaptersInUseError = 700,
|
||||
@@ -114,11 +110,7 @@ namespace amnezia
|
||||
UnspecifiedError = 1203,
|
||||
FatalError = 1204,
|
||||
AbortError = 1205
|
||||
};
|
||||
Q_ENUM_NS(ErrorCode)
|
||||
}
|
||||
|
||||
using ErrorCode = error_code_ns::ErrorCode;
|
||||
};
|
||||
|
||||
} // namespace amnezia
|
||||
|
||||
|
||||
@@ -8,68 +8,65 @@ QString errorString(ErrorCode code) {
|
||||
switch (code) {
|
||||
|
||||
// General error codes
|
||||
case(ErrorCode::NoError): errorMessage = QObject::tr("No error"); break;
|
||||
case(ErrorCode::UnknownError): errorMessage = QObject::tr("Unknown Error"); break;
|
||||
case(ErrorCode::NotImplementedError): errorMessage = QObject::tr("Function not implemented"); break;
|
||||
case(ErrorCode::AmneziaServiceNotRunning): errorMessage = QObject::tr("Background service is not running"); break;
|
||||
case(NoError): errorMessage = QObject::tr("No error"); break;
|
||||
case(UnknownError): errorMessage = QObject::tr("Unknown Error"); break;
|
||||
case(NotImplementedError): errorMessage = QObject::tr("Function not implemented"); break;
|
||||
case(AmneziaServiceNotRunning): errorMessage = QObject::tr("Background service is not running"); break;
|
||||
|
||||
// Server errors
|
||||
case(ErrorCode::ServerCheckFailed): errorMessage = QObject::tr("Server check failed"); break;
|
||||
case(ErrorCode::ServerPortAlreadyAllocatedError): errorMessage = QObject::tr("Server port already used. Check for another software"); break;
|
||||
case(ErrorCode::ServerContainerMissingError): errorMessage = QObject::tr("Server error: Docker container missing"); break;
|
||||
case(ErrorCode::ServerDockerFailedError): errorMessage = QObject::tr("Server error: Docker failed"); break;
|
||||
case(ErrorCode::ServerCancelInstallation): errorMessage = QObject::tr("Installation canceled by user"); break;
|
||||
case(ErrorCode::ServerUserNotInSudo): errorMessage = QObject::tr("The user does not have permission to use sudo"); break;
|
||||
case(ErrorCode::ServerPacketManagerError): errorMessage = QObject::tr("Server error: Packet manager error"); break;
|
||||
case(ServerCheckFailed): errorMessage = QObject::tr("Server check failed"); break;
|
||||
case(ServerPortAlreadyAllocatedError): errorMessage = QObject::tr("Server port already used. Check for another software"); break;
|
||||
case(ServerContainerMissingError): errorMessage = QObject::tr("Server error: Docker container missing"); break;
|
||||
case(ServerDockerFailedError): errorMessage = QObject::tr("Server error: Docker failed"); break;
|
||||
case(ServerCancelInstallation): errorMessage = QObject::tr("Installation canceled by user"); break;
|
||||
case(ServerUserNotInSudo): errorMessage = QObject::tr("The user does not have permission to use sudo"); break;
|
||||
case(ServerPacketManagerError): errorMessage = QObject::tr("Server error: Packet manager error"); break;
|
||||
|
||||
// Libssh errors
|
||||
case(ErrorCode::SshRequestDeniedError): errorMessage = QObject::tr("Ssh request was denied"); break;
|
||||
case(ErrorCode::SshInterruptedError): errorMessage = QObject::tr("Ssh request was interrupted"); break;
|
||||
case(ErrorCode::SshInternalError): errorMessage = QObject::tr("Ssh internal error"); break;
|
||||
case(ErrorCode::SshPrivateKeyError): errorMessage = QObject::tr("Invalid private key or invalid passphrase entered"); break;
|
||||
case(ErrorCode::SshPrivateKeyFormatError): errorMessage = QObject::tr("The selected private key format is not supported, use openssh ED25519 key types or PEM key types"); break;
|
||||
case(ErrorCode::SshTimeoutError): errorMessage = QObject::tr("Timeout connecting to server"); break;
|
||||
case(SshRequestDeniedError): errorMessage = QObject::tr("Ssh request was denied"); break;
|
||||
case(SshInterruptedError): errorMessage = QObject::tr("Ssh request was interrupted"); break;
|
||||
case(SshInternalError): errorMessage = QObject::tr("Ssh internal error"); break;
|
||||
case(SshPrivateKeyError): errorMessage = QObject::tr("Invalid private key or invalid passphrase entered"); break;
|
||||
case(SshPrivateKeyFormatError): errorMessage = QObject::tr("The selected private key format is not supported, use openssh ED25519 key types or PEM key types"); break;
|
||||
case(SshTimeoutError): errorMessage = QObject::tr("Timeout connecting to server"); break;
|
||||
|
||||
// Ssh scp errors
|
||||
case(ErrorCode::SshScpFailureError): errorMessage = QObject::tr("Scp error: Generic failure"); break;
|
||||
case(SshScpFailureError): errorMessage = QObject::tr("Scp error: Generic failure"); break;
|
||||
|
||||
// Local errors
|
||||
case (ErrorCode::OpenVpnConfigMissing): errorMessage = QObject::tr("OpenVPN config missing"); break;
|
||||
case (ErrorCode::OpenVpnManagementServerError): errorMessage = QObject::tr("OpenVPN management server error"); break;
|
||||
case (OpenVpnConfigMissing): errorMessage = QObject::tr("OpenVPN config missing"); break;
|
||||
case (OpenVpnManagementServerError): errorMessage = QObject::tr("OpenVPN management server error"); break;
|
||||
|
||||
// Distro errors
|
||||
case (ErrorCode::OpenVpnExecutableMissing): errorMessage = QObject::tr("OpenVPN executable missing"); break;
|
||||
case (ErrorCode::ShadowSocksExecutableMissing): errorMessage = QObject::tr("ShadowSocks (ss-local) executable missing"); break;
|
||||
case (ErrorCode::CloakExecutableMissing): errorMessage = QObject::tr("Cloak (ck-client) executable missing"); break;
|
||||
case (ErrorCode::AmneziaServiceConnectionFailed): errorMessage = QObject::tr("Amnezia helper service error"); break;
|
||||
case (ErrorCode::OpenSslFailed): errorMessage = QObject::tr("OpenSSL failed"); break;
|
||||
case (OpenVpnExecutableMissing): errorMessage = QObject::tr("OpenVPN executable missing"); break;
|
||||
case (ShadowSocksExecutableMissing): errorMessage = QObject::tr("ShadowSocks (ss-local) executable missing"); break;
|
||||
case (CloakExecutableMissing): errorMessage = QObject::tr("Cloak (ck-client) executable missing"); break;
|
||||
case (AmneziaServiceConnectionFailed): errorMessage = QObject::tr("Amnezia helper service error"); break;
|
||||
case (OpenSslFailed): errorMessage = QObject::tr("OpenSSL failed"); break;
|
||||
|
||||
// VPN errors
|
||||
case (ErrorCode::OpenVpnAdaptersInUseError): errorMessage = QObject::tr("Can't connect: another VPN connection is active"); break;
|
||||
case (ErrorCode::OpenVpnTapAdapterError): errorMessage = QObject::tr("Can't setup OpenVPN TAP network adapter"); break;
|
||||
case (ErrorCode::AddressPoolError): errorMessage = QObject::tr("VPN pool error: no available addresses"); break;
|
||||
case (OpenVpnAdaptersInUseError): errorMessage = QObject::tr("Can't connect: another VPN connection is active"); break;
|
||||
case (OpenVpnTapAdapterError): errorMessage = QObject::tr("Can't setup OpenVPN TAP network adapter"); break;
|
||||
case (AddressPoolError): errorMessage = QObject::tr("VPN pool error: no available addresses"); break;
|
||||
|
||||
case (ErrorCode::ImportInvalidConfigError): errorMessage = QObject::tr("The config does not contain any containers and credentials for connecting to the server"); break;
|
||||
case (ImportInvalidConfigError): errorMessage = QObject::tr("The config does not contain any containers and credentials for connecting to the server"); break;
|
||||
|
||||
// Android errors
|
||||
case (ErrorCode::AndroidError): errorMessage = QObject::tr("VPN connection error"); break;
|
||||
case (AndroidError): errorMessage = QObject::tr("VPN connection error"); break;
|
||||
|
||||
// Api errors
|
||||
case (ErrorCode::ApiConfigDownloadError): errorMessage = QObject::tr("Error when retrieving configuration from API"); break;
|
||||
case (ErrorCode::ApiConfigAlreadyAdded): errorMessage = QObject::tr("This config has already been added to the application"); break;
|
||||
case (ErrorCode::ApiConfigEmptyError): errorMessage = QObject::tr("In the response from the server, an empty config was received"); break;
|
||||
case (ErrorCode::ApiConfigSslError): errorMessage = QObject::tr("SSL error occurred"); break;
|
||||
case (ErrorCode::ApiConfigTimeoutError): errorMessage = QObject::tr("Server response timeout on api request"); break;
|
||||
|
||||
// QFile errors
|
||||
case(ErrorCode::OpenError): errorMessage = QObject::tr("QFile error: The file could not be opened"); break;
|
||||
case(ErrorCode::ReadError): errorMessage = QObject::tr("QFile error: An error occurred when reading from the file"); break;
|
||||
case(ErrorCode::PermissionsError): errorMessage = QObject::tr("QFile error: The file could not be accessed"); break;
|
||||
case(ErrorCode::UnspecifiedError): errorMessage = QObject::tr("QFile error: An unspecified error occurred"); break;
|
||||
case(ErrorCode::FatalError): errorMessage = QObject::tr("QFile error: A fatal error occurred"); break;
|
||||
case(ErrorCode::AbortError): errorMessage = QObject::tr("QFile error: The operation was aborted"); break;
|
||||
case (ApiConfigDownloadError): errorMessage = QObject::tr("Error when retrieving configuration from API"); break;
|
||||
case (ApiConfigAlreadyAdded): errorMessage = QObject::tr("This config has already been added to the application"); break;
|
||||
|
||||
case(ErrorCode::InternalError):
|
||||
// QFile errors
|
||||
case(OpenError): errorMessage = QObject::tr("QFile error: The file could not be opened"); break;
|
||||
case(ReadError): errorMessage = QObject::tr("QFile error: An error occurred when reading from the file"); break;
|
||||
case(PermissionsError): errorMessage = QObject::tr("QFile error: The file could not be accessed"); break;
|
||||
case(UnspecifiedError): errorMessage = QObject::tr("QFile error: An unspecified error occurred"); break;
|
||||
case(FatalError): errorMessage = QObject::tr("QFile error: A fatal error occurred"); break;
|
||||
case(AbortError): errorMessage = QObject::tr("QFile error: The operation was aborted"); break;
|
||||
|
||||
case(InternalError):
|
||||
default:
|
||||
errorMessage = QObject::tr("Internal error"); break;
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ ErrorCode AndroidController::start(const QJsonObject &vpnConfig)
|
||||
callActivityMethod("start", "(Ljava/lang/String;)V",
|
||||
QJniObject::fromString(config).object<jstring>());
|
||||
|
||||
return ErrorCode::NoError;
|
||||
return NoError;
|
||||
}
|
||||
|
||||
void AndroidController::stop()
|
||||
|
||||
@@ -2944,8 +2944,8 @@ For more detailed information, you can
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../containers/containers_defs.cpp" line="115"/>
|
||||
<source>IKEv2 - Modern stable protocol, a bit faster than others, restores connection after signal loss.</source>
|
||||
<translation>بروتوكول IKEv2 - بروتوكول مستقر حديث, اسرع بقليل من الباقي, يسترجع الاتصال بعد خسارة الاشارة.</translation>
|
||||
<source>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.</source>
|
||||
<translation>بروتوكول IKEv2 - بروتوكول مستقر حديث, اسرع بقليل من الباقي, يسترجع الاتصال بعد خسارة الاشارة. لدية يتمتع بدعم أصلي على أحدث إصدارات Android وiOS.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../containers/containers_defs.cpp" line="118"/>
|
||||
|
||||
@@ -2850,8 +2850,8 @@ While it offers a blend of security, stability, and speed, it's essential t
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../containers/containers_defs.cpp" line="115"/>
|
||||
<source>IKEv2 - Modern stable protocol, a bit faster than others, restores connection after signal loss.</source>
|
||||
<translation>پروتکل IKEv2 پروتکلی پایدار و مدرن که مقداری سریعتر از سایر پروتکلهاست. بعد از قطع سیگنال دوباره اتصال را بازیابی میکند.</translation>
|
||||
<source>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.</source>
|
||||
<translation>پروتکل IKEv2 پروتکلی پایدار و مدرن که مقداری سریعتر از سایر پروتکلهاست. بعد از قطع سیگنال دوباره اتصال را بازیابی میکند. به صورت پیشفرض بر روی آخرین نسخه دستگاههای اندروید و iOS پیشتیبانی میشود.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../containers/containers_defs.cpp" line="118"/>
|
||||
|
||||
@@ -2998,8 +2998,8 @@ For more detailed information, you can
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../containers/containers_defs.cpp" line="124"/>
|
||||
<source>IKEv2 - Modern stable protocol, a bit faster than others, restores connection after signal loss.</source>
|
||||
<translation>IKEv2 - आधुनिक स्थिर प्रोटोकॉल, दूसरों की तुलना में थोड़ा तेज़, सिग्नल हानि के बाद कनेक्शन पुनर्स्थापित करता है।</translation>
|
||||
<source>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.</source>
|
||||
<translation>IKEv2 - आधुनिक स्थिर प्रोटोकॉल, दूसरों की तुलना में थोड़ा तेज़, सिग्नल हानि के बाद कनेक्शन पुनर्स्थापित करता है। इसे Android और iOS के नवीनतम संस्करणों पर मूल समर्थन प्राप्त है.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../containers/containers_defs.cpp" line="127"/>
|
||||
|
||||
@@ -2851,8 +2851,8 @@ IKEv2 သည် လုံခြုံရေး၊ တည်ငြိမ်မှ
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../containers/containers_defs.cpp" line="115"/>
|
||||
<source>IKEv2 - Modern stable protocol, a bit faster than others, restores connection after signal loss.</source>
|
||||
<translation>IKEv2 - ခေတ်မီတည်ငြိမ်သောပရိုတိုကော၊ အခြားအရာများထက်အနည်းငယ်ပိုမြန်သည်၊ signal ပျောက်ဆုံးပြီးနောက် ချိတ်ဆက်မှုကို ပြန်လည်ရယူပေးသည်.</translation>
|
||||
<source>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.</source>
|
||||
<translation>IKEv2 - ခေတ်မီတည်ငြိမ်သောပရိုတိုကော၊ အခြားအရာများထက်အနည်းငယ်ပိုမြန်သည်၊ signal ပျောက်ဆုံးပြီးနောက် ချိတ်ဆက်မှုကို ပြန်လည်ရယူပေးသည်. ၎င်းသည် Android နှင့် iOS ၏နောက်ဆုံးဗားရှင်းများတွင် မူရင်းအတိုင်းထောက်ပံ့မှုရရှိသည်.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../containers/containers_defs.cpp" line="118"/>
|
||||
|
||||
@@ -2997,8 +2997,8 @@ While it offers a blend of security, stability, and speed, it's essential t
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../containers/containers_defs.cpp" line="121"/>
|
||||
<source>IKEv2 - Modern stable protocol, a bit faster than others, restores connection after signal loss.</source>
|
||||
<translation>IKEv2 Современный стабильный протокол, немного быстрее других восстанавливает соединение после потери сигнала.</translation>
|
||||
<source>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.</source>
|
||||
<translation>IKEv2 Современный стабильный протокол, немного быстрее других восстанавливает соединение после потери сигнала. Имеет нативную поддержку последних версиий Android и iOS.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../containers/containers_defs.cpp" line="124"/>
|
||||
|
||||
@@ -3191,8 +3191,8 @@ While it offers a blend of security, stability, and speed, it's essential t
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../containers/containers_defs.cpp" line="124"/>
|
||||
<source>IKEv2 - Modern stable protocol, a bit faster than others, restores connection after signal loss.</source>
|
||||
<translation>IKEv2 сучасний стабільний протокол, трішки швидше за інших відновлює підключення.</translation>
|
||||
<source>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.</source>
|
||||
<translation>IKEv2 сучасний стабільний протокол, трішки швидше за інших відновлює підключення. Підтримується в останніх версіях Android и iOS самими операційними системами.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../containers/containers_defs.cpp" line="127"/>
|
||||
|
||||
@@ -2947,8 +2947,8 @@ For more detailed information, you can
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../containers/containers_defs.cpp" line="124"/>
|
||||
<source>IKEv2 - Modern stable protocol, a bit faster than others, restores connection after signal loss.</source>
|
||||
<translation>IKEv2 - جدید مستحکم پروٹوکول، دوسروں کے مقابلے میں تھوڑا تیز، سگنل ضائع ہونے کے بعد کنکشن بحال کرتا ہے۔</translation>
|
||||
<source>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.</source>
|
||||
<translation>IKEv2 - جدید مستحکم پروٹوکول، دوسروں کے مقابلے میں تھوڑا تیز، سگنل ضائع ہونے کے بعد کنکشن بحال کرتا ہے۔ اسے اینڈرائیڈ اور آئی او ایس کے تازہ ترین ورژنز پر مقامی حمایت حاصل ہے۔</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../containers/containers_defs.cpp" line="127"/>
|
||||
|
||||
@@ -3057,8 +3057,8 @@ WireGuard非常容易被阻挡,因为其独特的数据包签名。与一些
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../containers/containers_defs.cpp" line="115"/>
|
||||
<source>IKEv2 - Modern stable protocol, a bit faster than others, restores connection after signal loss.</source>
|
||||
<translation>IKEv2 - 现代稳定协议,相比其他协议较快一些,在信号丢失后恢复连接。</translation>
|
||||
<source>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.</source>
|
||||
<translation>IKEv2 - 现代稳定协议,相比其他协议较快一些,在信号丢失后恢复连接。Android 和 iOS最新版原生支持。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../containers/containers_defs.cpp" line="118"/>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <QtConcurrent>
|
||||
|
||||
#include "core/controllers/vpnConfigurationController.h"
|
||||
#include "core/errorstrings.h"
|
||||
#include "version.h"
|
||||
|
||||
ConnectionController::ConnectionController(const QSharedPointer<ServersModel> &serversModel,
|
||||
@@ -29,7 +30,7 @@ ConnectionController::ConnectionController(const QSharedPointer<ServersModel> &s
|
||||
|
||||
connect(&m_apiController, &ApiController::configUpdated, this,
|
||||
static_cast<void (ConnectionController::*)(const bool, const QJsonObject &, const int)>(&ConnectionController::openConnection));
|
||||
connect(&m_apiController, qOverload<ErrorCode>(&ApiController::errorOccurred), this, qOverload<ErrorCode>(&ConnectionController::connectionErrorOccurred));
|
||||
connect(&m_apiController, &ApiController::errorOccurred, this, &ConnectionController::connectionErrorOccurred);
|
||||
|
||||
m_state = Vpn::ConnectionState::Disconnected;
|
||||
}
|
||||
@@ -39,7 +40,7 @@ void ConnectionController::openConnection()
|
||||
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
|
||||
if (!Utils::processIsRunning(Utils::executable(SERVICE_NAME, false), true))
|
||||
{
|
||||
emit connectionErrorOccurred(ErrorCode::AmneziaServiceNotRunning);
|
||||
emit connectionErrorOccurred(errorString(ErrorCode::AmneziaServiceNotRunning));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -62,9 +63,9 @@ void ConnectionController::closeConnection()
|
||||
emit disconnectFromVpn();
|
||||
}
|
||||
|
||||
ErrorCode ConnectionController::getLastConnectionError()
|
||||
QString ConnectionController::getLastConnectionError()
|
||||
{
|
||||
return m_vpnConnection->lastError();
|
||||
return errorString(m_vpnConnection->lastError());
|
||||
}
|
||||
|
||||
void ConnectionController::onConnectionStateChanged(Vpn::ConnectionState state)
|
||||
@@ -217,7 +218,7 @@ void ConnectionController::openConnection(const bool updateConfig, const QJsonOb
|
||||
ServerCredentials credentials = m_serversModel->getServerCredentials(serverIndex);
|
||||
ErrorCode errorCode = updateProtocolConfig(container, credentials, containerConfig, serverController);
|
||||
if (errorCode != ErrorCode::NoError) {
|
||||
emit connectionErrorOccurred(errorCode);
|
||||
emit connectionErrorOccurred(errorString(errorCode));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public slots:
|
||||
void openConnection();
|
||||
void closeConnection();
|
||||
|
||||
ErrorCode getLastConnectionError();
|
||||
QString getLastConnectionError();
|
||||
void onConnectionStateChanged(Vpn::ConnectionState state);
|
||||
|
||||
void onCurrentContainerUpdated();
|
||||
@@ -50,7 +50,6 @@ signals:
|
||||
void connectionStateChanged();
|
||||
|
||||
void connectionErrorOccurred(const QString &errorMessage);
|
||||
void connectionErrorOccurred(ErrorCode errorCode);
|
||||
void reconnectWithUpdatedContainer(const QString &message);
|
||||
|
||||
void noInstalledContainers();
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <QStandardPaths>
|
||||
|
||||
#include "core/controllers/vpnConfigurationController.h"
|
||||
#include "core/errorstrings.h"
|
||||
#include "systemController.h"
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include "platforms/android/android_utils.h"
|
||||
@@ -100,7 +101,7 @@ void ExportController::generateConnectionConfig(const QString &clientName)
|
||||
|
||||
errorCode = m_clientManagementModel->appendClient(container, credentials, containerConfig, clientName, serverController);
|
||||
if (errorCode != ErrorCode::NoError) {
|
||||
emit exportErrorOccurred(errorCode);
|
||||
emit exportErrorOccurred(errorString(errorCode));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -170,7 +171,7 @@ void ExportController::generateOpenVpnConfig(const QString &clientName)
|
||||
}
|
||||
|
||||
if (errorCode) {
|
||||
emit exportErrorOccurred(errorCode);
|
||||
emit exportErrorOccurred(errorString(errorCode));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -188,7 +189,7 @@ void ExportController::generateWireGuardConfig(const QString &clientName)
|
||||
QJsonObject nativeConfig;
|
||||
ErrorCode errorCode = generateNativeConfig(DockerContainer::WireGuard, clientName, Proto::WireGuard, nativeConfig);
|
||||
if (errorCode) {
|
||||
emit exportErrorOccurred(errorCode);
|
||||
emit exportErrorOccurred(errorString(errorCode));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -208,7 +209,7 @@ void ExportController::generateAwgConfig(const QString &clientName)
|
||||
QJsonObject nativeConfig;
|
||||
ErrorCode errorCode = generateNativeConfig(DockerContainer::Awg, clientName, Proto::Awg, nativeConfig);
|
||||
if (errorCode) {
|
||||
emit exportErrorOccurred(errorCode);
|
||||
emit exportErrorOccurred(errorString(errorCode));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -236,7 +237,7 @@ void ExportController::generateShadowSocksConfig()
|
||||
}
|
||||
|
||||
if (errorCode) {
|
||||
emit exportErrorOccurred(errorCode);
|
||||
emit exportErrorOccurred(errorString(errorCode));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -262,7 +263,7 @@ void ExportController::generateCloakConfig()
|
||||
QJsonObject nativeConfig;
|
||||
ErrorCode errorCode = generateNativeConfig(DockerContainer::Cloak, "", Proto::Cloak, nativeConfig);
|
||||
if (errorCode) {
|
||||
emit exportErrorOccurred(errorCode);
|
||||
emit exportErrorOccurred(errorString(errorCode));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -282,7 +283,7 @@ void ExportController::generateXrayConfig()
|
||||
QJsonObject nativeConfig;
|
||||
ErrorCode errorCode = generateNativeConfig(DockerContainer::Xray, "", Proto::Xray, nativeConfig);
|
||||
if (errorCode) {
|
||||
emit exportErrorOccurred(errorCode);
|
||||
emit exportErrorOccurred(errorString(errorCode));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -319,7 +320,7 @@ void ExportController::updateClientManagementModel(const DockerContainer contain
|
||||
QSharedPointer<ServerController> serverController(new ServerController(m_settings));
|
||||
ErrorCode errorCode = m_clientManagementModel->updateModel(container, credentials, serverController);
|
||||
if (errorCode != ErrorCode::NoError) {
|
||||
emit exportErrorOccurred(errorCode);
|
||||
emit exportErrorOccurred(errorString(errorCode));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,7 +330,7 @@ void ExportController::revokeConfig(const int row, const DockerContainer contain
|
||||
ErrorCode errorCode =
|
||||
m_clientManagementModel->revokeClient(row, container, credentials, m_serversModel->getProcessedServerIndex(), serverController);
|
||||
if (errorCode != ErrorCode::NoError) {
|
||||
emit exportErrorOccurred(errorCode);
|
||||
emit exportErrorOccurred(errorString(errorCode));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,7 +339,7 @@ void ExportController::renameClient(const int row, const QString &clientName, co
|
||||
QSharedPointer<ServerController> serverController(new ServerController(m_settings));
|
||||
ErrorCode errorCode = m_clientManagementModel->renameClient(row, clientName, container, credentials, serverController);
|
||||
if (errorCode != ErrorCode::NoError) {
|
||||
emit exportErrorOccurred(errorCode);
|
||||
emit exportErrorOccurred(errorString(errorCode));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@ public slots:
|
||||
signals:
|
||||
void generateConfig(int type);
|
||||
void exportErrorOccurred(const QString &errorMessage);
|
||||
void exportErrorOccurred(ErrorCode errorCode);
|
||||
|
||||
void exportConfigChanged();
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <QRandomGenerator>
|
||||
#include <QStandardPaths>
|
||||
|
||||
#include "core/errorstrings.h"
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include "platforms/android/android_controller.h"
|
||||
#endif
|
||||
@@ -220,7 +221,7 @@ void ImportController::importConfig()
|
||||
} else if (m_config.contains(config_key::configVersion)) {
|
||||
quint16 crc = qChecksum(QJsonDocument(m_config).toJson());
|
||||
if (m_serversModel->isServerFromApiAlreadyExists(crc)) {
|
||||
emit importErrorOccurred(ErrorCode::ApiConfigAlreadyAdded, true);
|
||||
emit importErrorOccurred(errorString(ErrorCode::ApiConfigAlreadyAdded), true);
|
||||
} else {
|
||||
m_config.insert(config_key::crc, crc);
|
||||
|
||||
@@ -230,7 +231,7 @@ void ImportController::importConfig()
|
||||
} else {
|
||||
qDebug() << "Failed to import profile";
|
||||
qDebug().noquote() << QJsonDocument(m_config).toJson();
|
||||
emit importErrorOccurred(ErrorCode::ImportInvalidConfigError, false);
|
||||
emit importErrorOccurred(errorString(ErrorCode::ImportInvalidConfigError), false);
|
||||
}
|
||||
|
||||
m_config = {};
|
||||
@@ -307,7 +308,7 @@ QJsonObject ImportController::extractWireGuardConfig(const QString &data)
|
||||
hostName = hostNameAndPortMatch.captured(1);
|
||||
} else {
|
||||
qDebug() << "Key parameter 'Endpoint' is missing";
|
||||
emit importErrorOccurred(ErrorCode::ImportInvalidConfigError, false);
|
||||
emit importErrorOccurred(errorString(ErrorCode::ImportInvalidConfigError), false);
|
||||
return QJsonObject();
|
||||
}
|
||||
|
||||
@@ -333,7 +334,7 @@ QJsonObject ImportController::extractWireGuardConfig(const QString &data)
|
||||
lastConfig[config_key::server_pub_key] = configMap.value("PublicKey");
|
||||
} else {
|
||||
qDebug() << "One of the key parameters is missing (PrivateKey, Address, PublicKey)";
|
||||
emit importErrorOccurred(ErrorCode::ImportInvalidConfigError, false);
|
||||
emit importErrorOccurred(errorString(ErrorCode::ImportInvalidConfigError), false);
|
||||
return QJsonObject();
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@ public slots:
|
||||
signals:
|
||||
void importFinished();
|
||||
void importErrorOccurred(const QString &errorMessage, bool goToPageHome);
|
||||
void importErrorOccurred(ErrorCode errorCode, bool goToPageHome);
|
||||
|
||||
void qrDecodingFinished();
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "core/controllers/serverController.h"
|
||||
#include "core/controllers/vpnConfigurationController.h"
|
||||
#include "core/errorstrings.h"
|
||||
#include "core/networkUtilities.h"
|
||||
#include "logger.h"
|
||||
#include "ui/models/protocols/awgConfigModel.h"
|
||||
@@ -148,7 +149,7 @@ void InstallController::install(DockerContainer container, int port, TransportPr
|
||||
QMap<DockerContainer, QJsonObject> installedContainers;
|
||||
ErrorCode errorCode = getAlreadyInstalledContainers(serverCredentials, serverController, installedContainers);
|
||||
if (errorCode) {
|
||||
emit installationErrorOccurred(errorCode);
|
||||
emit installationErrorOccurred(errorString(errorCode));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -157,7 +158,7 @@ void InstallController::install(DockerContainer container, int port, TransportPr
|
||||
if (!installedContainers.contains(container)) {
|
||||
errorCode = serverController->setupContainer(serverCredentials, container, config);
|
||||
if (errorCode) {
|
||||
emit installationErrorOccurred(errorCode);
|
||||
emit installationErrorOccurred(errorString(errorCode));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -168,7 +169,7 @@ void InstallController::install(DockerContainer container, int port, TransportPr
|
||||
}
|
||||
|
||||
if (errorCode) {
|
||||
emit installationErrorOccurred(errorCode);
|
||||
emit installationErrorOccurred(errorString(errorCode));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -203,7 +204,7 @@ void InstallController::installServer(const DockerContainer container, const QMa
|
||||
auto errorCode = vpnConfigurationController.createProtocolConfigForContainer(m_processedServerCredentials, iterator.key(),
|
||||
containerConfig);
|
||||
if (errorCode) {
|
||||
emit installationErrorOccurred(errorCode);
|
||||
emit installationErrorOccurred(errorString(errorCode));
|
||||
return;
|
||||
}
|
||||
containerConfigs.append(containerConfig);
|
||||
@@ -211,7 +212,7 @@ void InstallController::installServer(const DockerContainer container, const QMa
|
||||
errorCode = m_clientManagementModel->appendClient(iterator.key(), serverCredentials, containerConfig,
|
||||
QString("Admin [%1]").arg(QSysInfo::prettyProductName()), serverController);
|
||||
if (errorCode) {
|
||||
emit installationErrorOccurred(errorCode);
|
||||
emit installationErrorOccurred(errorString(errorCode));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -243,7 +244,7 @@ void InstallController::installContainer(const DockerContainer container, const
|
||||
auto errorCode =
|
||||
vpnConfigurationController.createProtocolConfigForContainer(serverCredentials, iterator.key(), containerConfig);
|
||||
if (errorCode) {
|
||||
emit installationErrorOccurred(errorCode);
|
||||
emit installationErrorOccurred(errorString(errorCode));
|
||||
return;
|
||||
}
|
||||
m_serversModel->addContainerConfig(iterator.key(), containerConfig);
|
||||
@@ -251,7 +252,7 @@ void InstallController::installContainer(const DockerContainer container, const
|
||||
errorCode = m_clientManagementModel->appendClient(iterator.key(), serverCredentials, containerConfig,
|
||||
QString("Admin [%1]").arg(QSysInfo::prettyProductName()), serverController);
|
||||
if (errorCode) {
|
||||
emit installationErrorOccurred(errorCode);
|
||||
emit installationErrorOccurred(errorString(errorCode));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -309,7 +310,7 @@ void InstallController::scanServerForInstalledContainers()
|
||||
auto errorCode =
|
||||
vpnConfigurationController.createProtocolConfigForContainer(serverCredentials, container, containerConfig);
|
||||
if (errorCode) {
|
||||
emit installationErrorOccurred(errorCode);
|
||||
emit installationErrorOccurred(errorString(errorCode));
|
||||
return;
|
||||
}
|
||||
m_serversModel->addContainerConfig(container, containerConfig);
|
||||
@@ -318,7 +319,7 @@ void InstallController::scanServerForInstalledContainers()
|
||||
QString("Admin [%1]").arg(QSysInfo::prettyProductName()),
|
||||
serverController);
|
||||
if (errorCode) {
|
||||
emit installationErrorOccurred(errorCode);
|
||||
emit installationErrorOccurred(errorString(errorCode));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -333,7 +334,7 @@ void InstallController::scanServerForInstalledContainers()
|
||||
return;
|
||||
}
|
||||
|
||||
emit installationErrorOccurred(errorCode);
|
||||
emit installationErrorOccurred(errorString(errorCode));
|
||||
}
|
||||
|
||||
ErrorCode InstallController::getAlreadyInstalledContainers(const ServerCredentials &credentials,
|
||||
@@ -514,7 +515,7 @@ void InstallController::updateContainer(QJsonObject config)
|
||||
return;
|
||||
}
|
||||
|
||||
emit installationErrorOccurred(errorCode);
|
||||
emit installationErrorOccurred(errorString(errorCode));
|
||||
}
|
||||
|
||||
void InstallController::rebootProcessedServer()
|
||||
@@ -527,7 +528,7 @@ void InstallController::rebootProcessedServer()
|
||||
if (errorCode == ErrorCode::NoError) {
|
||||
emit rebootProcessedServerFinished(tr("Server '%1' was rebooted").arg(serverName));
|
||||
} else {
|
||||
emit installationErrorOccurred(errorCode);
|
||||
emit installationErrorOccurred(errorString(errorCode));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -551,7 +552,7 @@ void InstallController::removeAllContainers()
|
||||
emit removeAllContainersFinished(tr("All containers from server '%1' have been removed").arg(serverName));
|
||||
return;
|
||||
}
|
||||
emit installationErrorOccurred(errorCode);
|
||||
emit installationErrorOccurred(errorString(errorCode));
|
||||
}
|
||||
|
||||
void InstallController::removeProcessedContainer()
|
||||
@@ -569,7 +570,7 @@ void InstallController::removeProcessedContainer()
|
||||
emit removeProcessedContainerFinished(tr("%1 has been removed from the server '%2'").arg(containerName, serverName));
|
||||
return;
|
||||
}
|
||||
emit installationErrorOccurred(errorCode);
|
||||
emit installationErrorOccurred(errorString(errorCode));
|
||||
}
|
||||
|
||||
void InstallController::removeApiConfig(const int serverIndex)
|
||||
@@ -737,7 +738,7 @@ bool InstallController::checkSshConnection(QSharedPointer<ServerController> serv
|
||||
if (errorCode == ErrorCode::NoError) {
|
||||
m_processedServerCredentials.secretData = decryptedPrivateKey;
|
||||
} else {
|
||||
emit installationErrorOccurred(errorCode);
|
||||
emit installationErrorOccurred(errorString(errorCode));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -746,7 +747,7 @@ bool InstallController::checkSshConnection(QSharedPointer<ServerController> serv
|
||||
output = serverController->checkSshConnection(m_processedServerCredentials, errorCode);
|
||||
|
||||
if (errorCode != ErrorCode::NoError) {
|
||||
emit installationErrorOccurred(errorCode);
|
||||
emit installationErrorOccurred(errorString(errorCode));
|
||||
return false;
|
||||
} else {
|
||||
if (output.contains(tr("Please login as the user"))) {
|
||||
|
||||
@@ -64,7 +64,6 @@ signals:
|
||||
void removeProcessedContainerFinished(const QString &finishedMessage);
|
||||
|
||||
void installationErrorOccurred(const QString &errorMessage);
|
||||
void installationErrorOccurred(ErrorCode errorCode);
|
||||
|
||||
void serverAlreadyExists(int serverIndex);
|
||||
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
#include "pageController.h"
|
||||
#include "utils/converter.h"
|
||||
#include "ui/models/servers_model.h"
|
||||
#include "ui/models/languageModel.h"
|
||||
#include "core/errorstrings.h"
|
||||
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||
#include <QGuiApplication>
|
||||
@@ -20,10 +16,8 @@
|
||||
#endif
|
||||
|
||||
PageController::PageController(const QSharedPointer<ServersModel> &serversModel,
|
||||
const std::shared_ptr<Settings> &settings,
|
||||
const QSharedPointer<LanguageModel> &languageModel,
|
||||
QObject *parent)
|
||||
: QObject(parent), m_serversModel(serversModel), m_settings(settings), m_languageModel(languageModel)
|
||||
const std::shared_ptr<Settings> &settings, QObject *parent)
|
||||
: QObject(parent), m_serversModel(serversModel), m_settings(settings)
|
||||
{
|
||||
#ifdef Q_OS_ANDROID
|
||||
// Change color of navigation and status bar's
|
||||
@@ -44,8 +38,6 @@ PageController::PageController(const QSharedPointer<ServersModel> &serversModel,
|
||||
connect(this, &PageController::raiseMainWindow, []() { setDockIconVisible(true); });
|
||||
connect(this, &PageController::hideMainWindow, []() { setDockIconVisible(false); });
|
||||
#endif
|
||||
|
||||
connect(this, qOverload<ErrorCode>(&PageController::showErrorMessage), this, &PageController::onShowErrorMessage);
|
||||
|
||||
m_isTriggeredByConnectButton = false;
|
||||
}
|
||||
@@ -169,14 +161,3 @@ int PageController::getDrawerDepth()
|
||||
{
|
||||
return m_drawerDepth;
|
||||
}
|
||||
|
||||
void PageController::onShowErrorMessage(ErrorCode errorCode)
|
||||
{
|
||||
const auto fullErrorMessage = errorString(errorCode);
|
||||
const auto errorMessage = fullErrorMessage.mid(fullErrorMessage.indexOf(". ") + 1); // remove ErrorCode %1.
|
||||
const auto baseUrl = m_languageModel->getDocsEndpoint();
|
||||
const auto errorUrl = QStringLiteral("%1/troubleshooting/error-codes/#error-%2-%3").arg(baseUrl).arg(static_cast<int>(errorCode)).arg(utils::enumToString(errorCode).toLower());
|
||||
const auto fullMessage = QStringLiteral("<a href=\"%1\" style=\"color: #FBB26A;\">ErrorCode: %2</a>. %3").arg(errorUrl).arg(static_cast<int>(errorCode)).arg(errorMessage);
|
||||
|
||||
emit showErrorMessage(fullMessage);
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
#include <QObject>
|
||||
#include <QQmlEngine>
|
||||
|
||||
#include "core/defs.h"
|
||||
#include "ui/models/servers_model.h"
|
||||
#include "ui/models/languageModel.h"
|
||||
|
||||
namespace PageLoader
|
||||
{
|
||||
@@ -72,7 +70,7 @@ class PageController : public QObject
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PageController(const QSharedPointer<ServersModel> &serversModel, const std::shared_ptr<Settings> &settings,
|
||||
const QSharedPointer<LanguageModel> & languageModel,QObject *parent = nullptr);
|
||||
QObject *parent = nullptr);
|
||||
|
||||
public slots:
|
||||
QString getInitialPage();
|
||||
@@ -95,9 +93,6 @@ public slots:
|
||||
void setDrawerDepth(const int depth);
|
||||
int getDrawerDepth();
|
||||
|
||||
private slots:
|
||||
void onShowErrorMessage(amnezia::ErrorCode errorCode);
|
||||
|
||||
signals:
|
||||
void goToPage(PageLoader::PageEnum page, bool slide = true);
|
||||
void goToStartPage();
|
||||
@@ -112,7 +107,6 @@ signals:
|
||||
void restorePageHomeState(bool isContainerInstalled = false);
|
||||
void replaceStartPage();
|
||||
|
||||
void showErrorMessage(amnezia::ErrorCode);
|
||||
void showErrorMessage(const QString &errorMessage);
|
||||
void showNotificationMessage(const QString &message);
|
||||
|
||||
@@ -137,8 +131,6 @@ private:
|
||||
|
||||
std::shared_ptr<Settings> m_settings;
|
||||
|
||||
QSharedPointer<LanguageModel> m_languageModel;
|
||||
|
||||
bool m_isTriggeredByConnectButton;
|
||||
|
||||
int m_drawerDepth = 0;
|
||||
|
||||
@@ -90,24 +90,6 @@ int LanguageModel::getCurrentLanguageIndex()
|
||||
}
|
||||
}
|
||||
|
||||
QString LanguageModel::getDocsEndpoint()
|
||||
{
|
||||
QString baseUrl = "https://docs.amnezia.org";
|
||||
auto locale = m_settings->getAppLanguage();
|
||||
switch (locale.language()) {
|
||||
case QLocale::Russian:
|
||||
baseUrl += "/ru";
|
||||
break;
|
||||
case QLocale::Ukrainian:
|
||||
baseUrl += "/ru";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
int LanguageModel::getLineHeightAppend()
|
||||
{
|
||||
int langIndex = getCurrentLanguageIndex();
|
||||
|
||||
@@ -59,7 +59,6 @@ public slots:
|
||||
int getCurrentLanguageIndex();
|
||||
int getLineHeightAppend();
|
||||
QString getCurrentLanguageName();
|
||||
QString getDocsEndpoint();
|
||||
|
||||
signals:
|
||||
void updateTranslations(const QLocale &locale);
|
||||
|
||||
@@ -57,17 +57,7 @@ Popup {
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
Layout.fillWidth: true
|
||||
|
||||
onLinkActivated: function(link) {
|
||||
Qt.openUrlExternally(link)
|
||||
}
|
||||
|
||||
text: root.text
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.NoButton
|
||||
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
|
||||
@@ -76,9 +76,9 @@ PageType {
|
||||
Connections {
|
||||
target: InstallController
|
||||
|
||||
function onInstallationErrorOccurred(error) {
|
||||
function onInstallationErrorOccurred(errorMessage) {
|
||||
PageController.showBusyIndicator(false)
|
||||
PageController.showErrorMessage(error)
|
||||
PageController.showErrorMessage(errorMessage)
|
||||
|
||||
var currentPageName = stackView.currentItem.objectName
|
||||
|
||||
@@ -97,8 +97,8 @@ PageType {
|
||||
PageController.showBusyIndicator(false)
|
||||
}
|
||||
|
||||
function onImportErrorOccurred(error, goToPageHome) {
|
||||
PageController.showErrorMessage(error)
|
||||
function onImportErrorOccurred(errorMessage, goToPageHome) {
|
||||
PageController.showErrorMessage(errorMessage)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -102,10 +102,9 @@ PageType {
|
||||
PageController.showBusyIndicator(false)
|
||||
}
|
||||
|
||||
function onExportErrorOccurred(error) {
|
||||
function onExportErrorOccurred(errorMessage) {
|
||||
shareConnectionDrawer.close()
|
||||
|
||||
PageController.showErrorMessage(error)
|
||||
PageController.showErrorMessage(errorMessage)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -99,10 +99,9 @@ PageType {
|
||||
Connections {
|
||||
target: InstallController
|
||||
|
||||
function onInstallationErrorOccurred(error) {
|
||||
function onInstallationErrorOccurred(errorMessage) {
|
||||
PageController.showBusyIndicator(false)
|
||||
|
||||
PageController.showErrorMessage(error)
|
||||
PageController.showErrorMessage(errorMessage)
|
||||
|
||||
var needCloseCurrentPage = false
|
||||
var currentPageName = tabBarStackView.currentItem.objectName
|
||||
@@ -147,8 +146,8 @@ PageType {
|
||||
Connections {
|
||||
target: ImportController
|
||||
|
||||
function onImportErrorOccurred(error, goToPageHome) {
|
||||
PageController.showErrorMessage(error)
|
||||
function onImportErrorOccurred(errorMessage, goToPageHome) {
|
||||
PageController.showErrorMessage(errorMessage)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <QMetaEnum>
|
||||
|
||||
namespace utils
|
||||
{
|
||||
template<typename Enum>
|
||||
QString enumToString(Enum value)
|
||||
{
|
||||
auto metaEnum = QMetaEnum::fromType<Enum>();
|
||||
return metaEnum.valueToKey(static_cast<int>(value));
|
||||
}
|
||||
|
||||
template<typename Enum>
|
||||
Enum enumFromString(const QString &str, Enum defaultValue = {})
|
||||
{
|
||||
auto metaEnum = QMetaEnum::fromType<Enum>();
|
||||
bool isOk;
|
||||
auto value = metaEnum.keyToValue(str.toLatin1(), &isOk);
|
||||
if (isOk) {
|
||||
return static_cast<Enum>(value);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user