1. updated memory text when language changed,
2. updated initialize index
This commit is contained in:
parent
07d7fac490
commit
eaede032b4
5 changed files with 27 additions and 5 deletions
|
@ -87,6 +87,7 @@ void AmneziaApplication::init()
|
||||||
m_vpnConnectionThread.start();
|
m_vpnConnectionThread.start();
|
||||||
|
|
||||||
initModels();
|
initModels();
|
||||||
|
loadTranslator();
|
||||||
initControllers();
|
initControllers();
|
||||||
|
|
||||||
#ifdef Q_OS_ANDROID
|
#ifdef Q_OS_ANDROID
|
||||||
|
@ -231,16 +232,16 @@ void AmneziaApplication::updateTranslator(const QLocale &locale)
|
||||||
QCoreApplication::removeTranslator(m_translator.get());
|
QCoreApplication::removeTranslator(m_translator.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_settings->setAppLanguage(locale);
|
|
||||||
|
|
||||||
QString strFileName = QString(":/translations/amneziavpn")+QLatin1String("_")+locale.name()+".qm";
|
QString strFileName = QString(":/translations/amneziavpn")+QLatin1String("_")+locale.name()+".qm";
|
||||||
if (m_translator->load(strFileName)) {
|
if (m_translator->load(strFileName)) {
|
||||||
if (QCoreApplication::installTranslator(m_translator.get())) {
|
if (QCoreApplication::installTranslator(m_translator.get())) {
|
||||||
m_settings->setAppLanguage(locale);
|
m_settings->setAppLanguage(locale);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
m_settings->setAppLanguage(QLocale::English);
|
||||||
|
}
|
||||||
|
|
||||||
m_engine->retranslate();
|
m_engine->retranslate();
|
||||||
}
|
|
||||||
|
|
||||||
emit translationsUpdated();
|
emit translationsUpdated();
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,6 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
if (doExec) {
|
if (doExec) {
|
||||||
app.init();
|
app.init();
|
||||||
app.loadTranslator();
|
|
||||||
|
|
||||||
qInfo().noquote() << QString("Started %1 version %2").arg(APPLICATION_NAME, APP_VERSION);
|
qInfo().noquote() << QString("Started %1 version %2").arg(APPLICATION_NAME, APP_VERSION);
|
||||||
qInfo().noquote() << QString("%1 (%2)").arg(QSysInfo::prettyProductName(), QSysInfo::currentCpuArchitecture());
|
qInfo().noquote() << QString("%1 (%2)").arg(QSysInfo::prettyProductName(), QSysInfo::currentCpuArchitecture());
|
||||||
|
|
|
@ -19,6 +19,8 @@ ConnectionController::ConnectionController(const QSharedPointer<ServersModel> &s
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
connect(this, &ConnectionController::disconnectFromVpn, m_vpnConnection.get(), &VpnConnection::disconnectFromVpn,
|
connect(this, &ConnectionController::disconnectFromVpn, m_vpnConnection.get(), &VpnConnection::disconnectFromVpn,
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
|
|
||||||
|
m_state = Vpn::ConnectionState::Disconnected;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConnectionController::~ConnectionController()
|
ConnectionController::~ConnectionController()
|
||||||
|
@ -70,6 +72,8 @@ QString ConnectionController::getLastConnectionError()
|
||||||
|
|
||||||
void ConnectionController::onConnectionStateChanged(Vpn::ConnectionState state)
|
void ConnectionController::onConnectionStateChanged(Vpn::ConnectionState state)
|
||||||
{
|
{
|
||||||
|
m_state = state;
|
||||||
|
|
||||||
m_isConnected = false;
|
m_isConnected = false;
|
||||||
m_connectionStateText = tr("Connection...");
|
m_connectionStateText = tr("Connection...");
|
||||||
switch (state) {
|
switch (state) {
|
||||||
|
@ -126,6 +130,16 @@ void ConnectionController::onCurrentContainerUpdated()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConnectionController::translateMemoryText()
|
||||||
|
{
|
||||||
|
onConnectionStateChanged(getCurrentConnectionState());
|
||||||
|
}
|
||||||
|
|
||||||
|
Vpn::ConnectionState ConnectionController::getCurrentConnectionState()
|
||||||
|
{
|
||||||
|
return m_state;
|
||||||
|
}
|
||||||
|
|
||||||
QString ConnectionController::connectionStateText() const
|
QString ConnectionController::connectionStateText() const
|
||||||
{
|
{
|
||||||
return m_connectionStateText;
|
return m_connectionStateText;
|
||||||
|
|
|
@ -34,6 +34,8 @@ public slots:
|
||||||
|
|
||||||
void onCurrentContainerUpdated();
|
void onCurrentContainerUpdated();
|
||||||
|
|
||||||
|
void translateMemoryText();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void connectToVpn(int serverIndex, const ServerCredentials &credentials, DockerContainer container,
|
void connectToVpn(int serverIndex, const ServerCredentials &credentials, DockerContainer container,
|
||||||
const QJsonObject &containerConfig);
|
const QJsonObject &containerConfig);
|
||||||
|
@ -44,6 +46,8 @@ signals:
|
||||||
void reconnectWithUpdatedContainer(const QString &message);
|
void reconnectWithUpdatedContainer(const QString &message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Vpn::ConnectionState getCurrentConnectionState();
|
||||||
|
|
||||||
QSharedPointer<ServersModel> m_serversModel;
|
QSharedPointer<ServersModel> m_serversModel;
|
||||||
QSharedPointer<ContainersModel> m_containersModel;
|
QSharedPointer<ContainersModel> m_containersModel;
|
||||||
|
|
||||||
|
@ -52,6 +56,8 @@ private:
|
||||||
bool m_isConnected = false;
|
bool m_isConnected = false;
|
||||||
bool m_isConnectionInProgress = false;
|
bool m_isConnectionInProgress = false;
|
||||||
QString m_connectionStateText = tr("Connect");
|
QString m_connectionStateText = tr("Connect");
|
||||||
|
|
||||||
|
Vpn::ConnectionState m_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CONNECTIONCONTROLLER_H
|
#endif // CONNECTIONCONTROLLER_H
|
||||||
|
|
|
@ -171,6 +171,8 @@ PageType {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
tabBarStackView.goToTabBarPage(PageEnum.PageHome)
|
tabBarStackView.goToTabBarPage(PageEnum.PageHome)
|
||||||
ServersModel.currentlyProcessedIndex = ServersModel.defaultIndex
|
ServersModel.currentlyProcessedIndex = ServersModel.defaultIndex
|
||||||
|
|
||||||
|
ConnectionController.translateMemoryText()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TabImageButtonType {
|
TabImageButtonType {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue