General improvements and bug fixes

This commit is contained in:
driftingsun 2020-12-30 17:03:05 +03:00
parent 07974a7e34
commit 187fa0080a
10 changed files with 762 additions and 144 deletions

View file

@ -2,7 +2,7 @@ QT += widgets core gui network xml
TARGET = AmneziaVPN TARGET = AmneziaVPN
TEMPLATE = app TEMPLATE = app
#CONFIG += console CONFIG += console
DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_DEPRECATED_WARNINGS
@ -21,6 +21,7 @@ HEADERS += \
message.h \ message.h \
openvpnprotocol.h \ openvpnprotocol.h \
runguard.h \ runguard.h \
settings.h \
ui/Controls/SlidingStackedWidget.h \ ui/Controls/SlidingStackedWidget.h \
ui/mainwindow.h \ ui/mainwindow.h \
utils.h \ utils.h \
@ -39,6 +40,7 @@ SOURCES += \
message.cpp \ message.cpp \
openvpnprotocol.cpp \ openvpnprotocol.cpp \
runguard.cpp \ runguard.cpp \
settings.cpp \
ui/Controls/SlidingStackedWidget.cpp \ ui/Controls/SlidingStackedWidget.cpp \
ui/mainwindow.cpp \ ui/mainwindow.cpp \
utils.cpp \ utils.cpp \

View file

@ -26,9 +26,9 @@ int main(int argc, char *argv[])
QApplication app(argc, argv); QApplication app(argc, argv);
loadTranslator(); loadTranslator();
if (! RunGuard::instance().tryToRun()) { if (!RunGuard::instance().tryToRun()) {
qDebug() << "Tried to run second instance. Exiting..."; qDebug() << "Tried to run second instance. Exiting...";
QMessageBox::information(NULL, QObject::tr("Notify"), QObject::tr("AmneziaVPN is already running.")); QMessageBox::information(NULL, QObject::tr("Notification"), QObject::tr("AmneziaVPN is already running."));
return 0; return 0;
} }

64
client/settings.cpp Normal file
View file

@ -0,0 +1,64 @@
#include <QSettings>
#include "defines.h"
#include "settings.h"
Settings::Settings(QObject* parent) : QObject(parent)
{
m_settings = new QSettings(ORGANIZATION_NAME, APPLICATION_NAME, this);
read();
}
void Settings::read()
{
m_settings->beginGroup("Server");
m_login = m_settings->value("login", QString()).toString();
m_password = m_settings->value("password", QString()).toString();
m_serverName = m_settings->value("serverName", QString()).toString();
m_settings->endGroup();
}
void Settings::save()
{
m_settings->beginGroup("Server");
m_settings->setValue("login", m_login);
m_settings->setValue("password", m_password);
m_settings->setValue("serverName", m_serverName);
m_settings->endGroup();
}
bool Settings::haveAuthData() const
{
return (!serverName().isEmpty() && !login().isEmpty() && !password().isEmpty());
}
void Settings::setLogin(const QString& login)
{
m_login = login;
}
void Settings::setPassword(const QString& password)
{
m_password = password;
}
void Settings::setServerName(const QString& serverName)
{
m_serverName = serverName;
}
QString Settings::login() const
{
return m_login;
}
QString Settings::password() const
{
return m_password;
}
QString Settings::serverName() const
{
return m_serverName;
}

36
client/settings.h Normal file
View file

@ -0,0 +1,36 @@
#ifndef SETTINGS_H
#define SETTINGS_H
#include <QObject>
#include <QString>
class QSettings;
class Settings : public QObject
{
Q_OBJECT
public:
explicit Settings(QObject* parent = nullptr);
void read();
void save();
void setLogin(const QString& login);
void setPassword(const QString& password);
void setServerName(const QString& serverName);
QString login() const;
QString password() const;
QString serverName() const;
bool haveAuthData() const;
protected:
QSettings* m_settings;
QString m_login;
QString m_password;
QString m_serverName;
};
#endif // SETTINGS_H

Binary file not shown.

View file

@ -5,191 +5,632 @@
<name>MainWindow</name> <name>MainWindow</name>
<message> <message>
<location filename="../ui/mainwindow.ui" line="294"/> <location filename="../ui/mainwindow.ui" line="294"/>
<source>Подключиться к уже <source>Connect to the already created VPN server</source>
созданному серверу VPN</source> <translation>Подключиться к уже созданному серверу VPN</translation>
<translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="323"/> <location filename="../ui/mainwindow.ui" line="325"/>
<source>Код для подключения</source> <source>Connection code</source>
<translation type="unfinished"></translation> <translation>Код для подключения</translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="349"/> <location filename="../ui/mainwindow.ui" line="351"/>
<location filename="../ui/mainwindow.ui" line="730"/> <location filename="../ui/mainwindow.ui" line="734"/>
<source>Подключение...</source> <source>Connecting...</source>
<translation type="unfinished"></translation> <translation>Подключение...</translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="421"/> <location filename="../ui/mainwindow.ui" line="423"/>
<location filename="../ui/mainwindow.ui" line="676"/> <location filename="../ui/mainwindow.ui" line="680"/>
<source>Подключиться</source> <source>Connect</source>
<translation type="unfinished"></translation> <translation>Подключиться</translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="458"/> <location filename="../ui/mainwindow.ui" line="460"/>
<source>Настроить собственный сервер</source> <source>Set up your own server</source>
<translation type="unfinished"></translation> <translation>Настроить собственный сервер</translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="496"/> <location filename="../ui/mainwindow.ui" line="498"/>
<source>Подключите ваш сервер, <source>Connect your server to use VPN</source>
чтобы использовать VPN</source> <translation>Подключите ваш сервер, чтобы использовать VPN</translation>
<translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="525"/> <location filename="../ui/mainwindow.ui" line="529"/>
<source>IP-адрес сервера</source> <source>Server IP address</source>
<translation type="unfinished"></translation> <translation>IP адрес сервера</translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="550"/> <location filename="../ui/mainwindow.ui" line="554"/>
<source>Логин для подключения по SSH</source> <source>Login to connect via SSH</source>
<translation type="unfinished"></translation> <translation>Логин для подключения по SSH</translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="575"/> <location filename="../ui/mainwindow.ui" line="579"/>
<source>Пароль</source> <source>Password</source>
<translation type="unfinished"></translation> <translation>Пароль</translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="596"/> <location filename="../ui/mainwindow.ui" line="708"/>
<source>51.83.180.158</source> <source>Where to get connection data </source>
<translation type="unfinished"></translation> <translation>Where to get connection data </translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="617"/> <location filename="../ui/mainwindow.ui" line="891"/>
<source>root</source> <location filename="../ui/mainwindow.ui" line="920"/>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="638"/>
<source>qazqazwsxwsx</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="704"/>
<source>Где взять данные для подключения </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="887"/>
<location filename="../ui/mainwindow.ui" line="916"/>
<source>0 Mbps</source> <source>0 Mbps</source>
<translation type="unfinished"></translation> <translation>0 Мбит/сек</translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="954"/> <location filename="../ui/mainwindow.ui" line="958"/>
<source>Add site</source> <source>Add site</source>
<translation>Добавить сайт</translation> <translation>Добавить сайт</translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="1024"/> <location filename="../ui/mainwindow.ui" line="1028"/>
<source>Connected</source> <source>Connected</source>
<translation>Подключено</translation> <translation>Подключено</translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="1067"/> <location filename="../ui/mainwindow.ui" line="1071"/>
<source>How to use VPN</source> <source>How to use VPN</source>
<translation>Как использовать VPN</translation> <translation>Как использовать VPN</translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="1086"/> <location filename="../ui/mainwindow.ui" line="1090"/>
<source>For all connections</source> <source>For all connections</source>
<translation>Для всех соединений</translation> <translation>Для всех соединений</translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="1102"/> <location filename="../ui/mainwindow.ui" line="1106"/>
<source>For selected sites</source> <source>For selected sites</source>
<translation>Для выбранных сайтов</translation> <translation>Для выбранных сайтов</translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="1199"/> <location filename="../ui/mainwindow.ui" line="1203"/>
<source>List of most popular prohibited sites</source> <source>List of the most popular prohibited sites</source>
<translation type="unfinished"></translation> <translation>Список самых популярных запрещенных сайтов</translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="1233"/> <location filename="../ui/mainwindow.ui" line="1294"/>
<source>Эти сайты будут открываться через VPN</source> <source>For example, rutor.org or 17.21.111.8</source>
<translation type="unfinished"></translation> <translation>Например, rutor.org или 17.21.111.8</translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="1290"/> <location filename="../ui/mainwindow.ui" line="1682"/>
<source>Например, rutor.org или 17.21.111.8</source> <source>Anyone who logs in with this code will have the same rights to use the VPN as you. To create a new code, change your login and / or password for connection in your server settings.</source>
<translation type="unfinished"></translation> <translation>Тот, кто зайдёт с этим кодом, будет иметь те же права на использование VPN, что и вы. Чтобы создать новый код смените логин и/или пароль для подлючения в настройках вашего сервера.</translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="1315"/> <location filename="../ui/mainwindow.ui" line="1237"/>
<source>These sites will open via VPN</source>
<translation>These sites will open via VPN</translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1341"/>
<source>Delete selected item</source>
<translation>Удалить выбранный элемент</translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1366"/>
<source>Hostname or IP address</source>
<translation>Имя хоста или IP адрес</translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1319"/>
<source>+</source> <source>+</source>
<translation>+</translation> <translation>+</translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="1337"/> <location filename="../ui/mainwindow.ui" line="1449"/>
<source>Удалить выбранный</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1362"/>
<source>Адрес сайта или ip-адрес</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1445"/>
<source>Server settings</source> <source>Server settings</source>
<translation>Настройки сервера</translation> <translation>Настройки сервера</translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="1494"/> <location filename="../ui/mainwindow.ui" line="1498"/>
<source>Share connection</source> <source>Share connection</source>
<translation>Поделиться подключением</translation> <translation>Поделиться подключением</translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="1572"/> <location filename="../ui/mainwindow.ui" line="1576"/>
<source>Connection string</source> <source>Connection string</source>
<translation>Строка подключения</translation> <translation>Строка подключения</translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="1613"/> <location filename="../ui/mainwindow.ui" line="1617"/>
<source>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <source>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;Consolas&apos;; font-size:22px; font-weight:600; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;Consolas&apos;; font-size:22px; font-weight:600; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:20pt;&quot;&gt;vpn:\\aosdiufhafafsuhgqejghuserhglaidhgauhgalgadg&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:20pt;&quot;&gt;vpn:\\aosdiufhafafsuhgqejghuserhglaidhgauhgalgadg&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="1651"/> <location filename="../ui/mainwindow.ui" line="1655"/>
<source>Copy</source> <source>Copy</source>
<translation>Копировать</translation> <translation>Копировать</translation>
</message> </message>
<message> <message>
<location filename="../ui/mainwindow.ui" line="1678"/> <location filename="../ui/mainwindow.cpp" line="92"/>
<source>Тот, кто зайдёт с этим кодом, будет иметь те же права на испольтование VPN, что и вы. Чтобы создать новый код смените логин и/или пароль для подлючения в настройках вашего сервера.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="78"/>
<source>Cannot open logs folder!</source> <source>Cannot open logs folder!</source>
<translation>Невозможно открыть папку с логами!</translation> <translation>Невозможно открыть папку с логами!</translation>
</message> </message>
<message>
<location filename="../ui/mainwindow.cpp" line="105"/>
<source>Please fill in all fields</source>
<translation>Пожалуйста, заполните все поля</translation>
</message>
</context> </context>
<context> <context>
<name>QObject</name> <name>QObject</name>
<message> <message>
<location filename="../main.cpp" line="31"/> <location filename="../main.cpp" line="31"/>
<source>Notify</source> <source>AmneziaVPN is already running.</source>
<translation>Уведомление</translation> <translation>Приложение AmneziaVPN уже запущено.</translation>
</message> </message>
<message> <message>
<location filename="../main.cpp" line="31"/> <location filename="../main.cpp" line="31"/>
<source>AmneziaVPN is already running.</source> <source>Notification</source>
<translation>Приложение AmneziaVPN уже запущено.</translation> <translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QSsh::Internal::SftpChannelPrivate</name>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="269"/>
<source>Server could not start SFTP subsystem.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="301"/>
<source>The SFTP server finished unexpectedly with exit code %1.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="311"/>
<source>The SFTP server crashed: %1.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="340"/>
<source>Unexpected packet of type %1.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="355"/>
<source>Protocol version mismatch: Expected %1, got %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="471"/>
<source>Unknown error.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="496"/>
<source>Created remote directory &quot;%1&quot;.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="499"/>
<source>Remote directory &quot;%1&quot; already exists.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="503"/>
<source>Error creating directory &quot;%1&quot;: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="527"/>
<source>Could not open local file &quot;%1&quot;: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="554"/>
<source>Remote directory could not be opened for reading.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="560"/>
<source>Failed to list remote directory contents.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="568"/>
<source>Failed to close remote directory.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="587"/>
<source>Failed to open remote file for reading.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="593"/>
<source>Failed to retrieve information on the remote file (&apos;stat&apos; failed).</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="599"/>
<source>Failed to read remote file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="610"/>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="679"/>
<source>Failed to close remote file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="639"/>
<source>Failed to open remote file for writing.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="657"/>
<source>Failed to write remote file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="810"/>
<source>Cannot append to remote file: Server does not support the file size attribute.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="830"/>
<source>SFTP channel closed unexpectedly.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="850"/>
<source>Server could not start session: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="939"/>
<source>Error reading local file: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QSsh::Internal::SshChannelManager</name>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshchannelmanager.cpp" line="182"/>
<source>Unexpected request success packet.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshchannelmanager.cpp" line="204"/>
<source>Unexpected request failure packet.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshchannelmanager.cpp" line="217"/>
<source>Invalid channel id %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QSsh::Internal::SshConnectionPrivate</name>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshconnection.cpp" line="343"/>
<source>SSH Protocol error: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshconnection.cpp" line="349"/>
<source>Botan library exception: %1</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="../3rd/QtSsh/src/ssh/sshconnection.cpp" line="372"/>
<source>Server identification string is %n characters long, but the maximum allowed length is 255.</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshconnection.cpp" line="385"/>
<source>Server identification string contains illegal NUL character.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshconnection.cpp" line="395"/>
<source>Server Identification string &quot;%1&quot; is invalid.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshconnection.cpp" line="402"/>
<source>Server protocol version is &quot;%1&quot;, but needs to be 2.0 or 1.99.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshconnection.cpp" line="410"/>
<source>Server identification string is invalid (missing carriage return).</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshconnection.cpp" line="416"/>
<source>Server reports protocol version 1.99, but sends data before the identification string, which is not allowed.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshconnection.cpp" line="464"/>
<location filename="../3rd/QtSsh/src/ssh/sshconnection.cpp" line="487"/>
<location filename="../3rd/QtSsh/src/ssh/sshconnection.cpp" line="501"/>
<location filename="../3rd/QtSsh/src/ssh/sshconnection.cpp" line="578"/>
<source>Unexpected packet of type %1.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshconnection.cpp" line="546"/>
<source>Password expired.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshconnection.cpp" line="612"/>
<source>Server rejected key.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshconnection.cpp" line="612"/>
<source>Server rejected password.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshconnection.cpp" line="627"/>
<source>The server sent an unexpected SSH packet of type SSH_MSG_UNIMPLEMENTED.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshconnection.cpp" line="694"/>
<source>Server closed connection: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshconnection.cpp" line="717"/>
<source>Connection closed unexpectedly.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshconnection.cpp" line="731"/>
<source>Timeout waiting for reply from server.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshconnection.cpp" line="824"/>
<source>No private key file given.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshconnection.cpp" line="828"/>
<source>Private key file error: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QSsh::Internal::SshRemoteProcessPrivate</name>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshremoteprocess.cpp" line="370"/>
<source>Process killed by signal</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshremoteprocess.cpp" line="376"/>
<source>Server sent invalid signal &quot;%1&quot;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QSsh::SftpFileSystemModel</name>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpfilesystemmodel.cpp" line="199"/>
<source>File Type</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpfilesystemmodel.cpp" line="201"/>
<source>File Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpfilesystemmodel.cpp" line="361"/>
<source>Error getting &quot;stat&quot; info about &quot;%1&quot;: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sftpfilesystemmodel.cpp" line="371"/>
<source>Error listing contents of directory &quot;%1&quot;: %2</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QSsh::Ssh</name>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshhostkeydatabase.cpp" line="59"/>
<source>Failed to open key file &quot;%1&quot; for reading: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshhostkeydatabase.cpp" line="89"/>
<source>Failed to open key file &quot;%1&quot; for writing: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeypasswordretriever.cpp" line="44"/>
<source>Password Required</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeypasswordretriever.cpp" line="45"/>
<source>Please enter the password for your private key.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QSsh::SshKeyCreationDialog</name>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.ui" line="23"/>
<source>SSH Key Configuration</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.ui" line="29"/>
<source>Options</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.ui" line="35"/>
<source>Key algorithm:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.ui" line="50"/>
<source>&amp;RSA</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.ui" line="66"/>
<source>&amp;DSA</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.ui" line="73"/>
<source>ECDSA</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.ui" line="101"/>
<source>Key &amp;size:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.ui" line="132"/>
<source>Private key file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.ui" line="148"/>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.cpp" line="49"/>
<source>Browse...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.ui" line="170"/>
<source>Public key file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.ui" line="211"/>
<source>&amp;Generate And Save Key Pair</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.ui" line="224"/>
<source>&amp;Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.cpp" line="47"/>
<source>Choose...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.cpp" line="108"/>
<source>Key Generation Failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.cpp" line="113"/>
<source>Choose Private Key File Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.cpp" line="129"/>
<source>Cannot Save Key File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.cpp" line="130"/>
<source>Failed to create directory: &quot;%1&quot;.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.cpp" line="137"/>
<source>Cannot Save Private Key File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.cpp" line="138"/>
<source>The private key file could not be saved: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.cpp" line="146"/>
<source>Cannot Save Public Key File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.cpp" line="147"/>
<source>The public key file could not be saved: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.cpp" line="158"/>
<source>File Exists</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.cpp" line="159"/>
<source>There already is a file of that name. Do you want to overwrite it?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SshConnection</name>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshcapabilities.cpp" line="119"/>
<source>Server and client capabilities don&apos;t match. Client list was: %1.
Server list was %2.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SshKeyGenerator</name>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeygenerator.cpp" line="87"/>
<source>Error generating key: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeygenerator.cpp" line="212"/>
<source>Password for Private Key</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeygenerator.cpp" line="213"/>
<source>It is recommended that you secure your private key
with a password, which you can enter below.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeygenerator.cpp" line="215"/>
<source>Encrypt Key File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../3rd/QtSsh/src/ssh/sshkeygenerator.cpp" line="216"/>
<source>Do Not Encrypt Key File</source>
<translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context> <context>
<name>VpnConnection</name> <name>VpnConnection</name>
<message> <message>
<location filename="../vpnconnection.cpp" line="49"/> <location filename="../vpnconnection.cpp" line="58"/>
<source>Mbps</source> <source>Mbps</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View file

@ -4,25 +4,32 @@
#include <QThread> #include <QThread>
#include "communicator.h" #include "communicator.h"
#include "core/openvpnconfigurator.h"
#include "core/servercontroller.h"
#include "debug.h" #include "debug.h"
#include "defines.h" #include "defines.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "settings.h"
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
#include "utils.h" #include "utils.h"
#include "vpnconnection.h" #include "vpnconnection.h"
#include <QStandardPaths>
MainWindow::MainWindow(QWidget *parent) : MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
ui(new Ui::MainWindow), ui(new Ui::MainWindow),
m_settings(new Settings),
m_vpnConnection(nullptr) m_vpnConnection(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
// Post initialization // Post initialization
ui->widget_tittlebar->hide(); ui->widget_tittlebar->hide();
ui->stackedWidget_main->setCurrentIndex(2);
if (m_settings->haveAuthData()) {
goToPage(Page::Vpn);
} else {
goToPage(Page::Initialization);
}
connect(ui->pushButton_blocked_list, SIGNAL(clicked(bool)), this, SLOT(onPushButtonBlockedListClicked(bool))); connect(ui->pushButton_blocked_list, SIGNAL(clicked(bool)), this, SLOT(onPushButtonBlockedListClicked(bool)));
connect(ui->pushButton_connect, SIGNAL(toggled(bool)), this, SLOT(onPushButtonConnectToggled(bool))); connect(ui->pushButton_connect, SIGNAL(toggled(bool)), this, SLOT(onPushButtonConnectToggled(bool)));
@ -30,6 +37,9 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ui->pushButton_back_from_sites, SIGNAL(clicked(bool)), this, SLOT(onPushButtonBackFromSitesClicked(bool))); connect(ui->pushButton_back_from_sites, SIGNAL(clicked(bool)), this, SLOT(onPushButtonBackFromSitesClicked(bool)));
connect(ui->pushButton_back_from_settings, SIGNAL(clicked(bool)), this, SLOT(onPushButtonBackFromSettingsClicked(bool))); connect(ui->pushButton_back_from_settings, SIGNAL(clicked(bool)), this, SLOT(onPushButtonBackFromSettingsClicked(bool)));
connect(ui->pushButton_new_server_setup, SIGNAL(clicked(bool)), this, SLOT(onPushButtonNewServerSetup(bool)));
connect(ui->pushButton_back_from_new_server, SIGNAL(clicked(bool)), this, SLOT(onPushButtonBackFromNewServerClicked(bool)));
connect(ui->pushButton_new_server_connect_with_new_data, SIGNAL(clicked(bool)), this, SLOT(onPushButtonNewServerConnectWithNewData(bool)));
setFixedSize(width(),height()); setFixedSize(width(),height());
@ -66,9 +76,9 @@ MainWindow::~MainWindow()
qDebug() << "Application closed"; qDebug() << "Application closed";
} }
void MainWindow::goToIndex(int index) void MainWindow::goToPage(Page page)
{ {
ui->stackedWidget_main->setCurrentIndex(index); ui->stackedWidget_main->setCurrentIndex(static_cast<int>(page));
} }
void MainWindow::keyPressEvent(QKeyEvent *event) void MainWindow::keyPressEvent(QKeyEvent *event)
@ -84,30 +94,60 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
} }
} }
void MainWindow::onPushButtonNewServerConnectWithNewData(bool clicked)
{
if (ui->lineEdit_new_server_ip->text().isEmpty() ||
ui->lineEdit_new_server_login->text().isEmpty() ||
ui->lineEdit_new_server_password->text().isEmpty() ) {
QMessageBox::warning(this, APPLICATION_NAME, tr("Please fill in all fields"));
return;
} else {
qDebug() << "Start connection with new data";
m_settings->setServerName(ui->lineEdit_new_server_ip->text());
m_settings->setLogin(ui->lineEdit_new_server_login->text());
m_settings->setPassword(ui->lineEdit_new_server_password->text());
m_settings->save();
if (requestOvpnConfig(m_settings->serverName(), m_settings->login(), m_settings->password())) {
goToPage(Page::Vpn);
}
}
}
void MainWindow::onBytesChanged(quint64 receivedData, quint64 sentData) void MainWindow::onBytesChanged(quint64 receivedData, quint64 sentData)
{ {
ui->label_speed_received->setText(VpnConnection::bytesToText(receivedData)); ui->label_speed_received->setText(VpnConnection::bytesToText(receivedData));
ui->label_speed_sent->setText(VpnConnection::bytesToText(sentData)); ui->label_speed_sent->setText(VpnConnection::bytesToText(sentData));
} }
void MainWindow::onPushButtonBackFromNewServerClicked(bool)
{
goToPage(Page::Initialization);
}
void MainWindow::onPushButtonNewServerSetup(bool)
{
goToPage(Page::NewServer);
}
void MainWindow::onPushButtonBackFromSettingsClicked(bool) void MainWindow::onPushButtonBackFromSettingsClicked(bool)
{ {
goToIndex(2); goToPage(Page::Vpn);
} }
void MainWindow::onPushButtonBackFromSitesClicked(bool) void MainWindow::onPushButtonBackFromSitesClicked(bool)
{ {
goToIndex(2); goToPage(Page::Vpn);
} }
void MainWindow::onPushButtonBlockedListClicked(bool) void MainWindow::onPushButtonBlockedListClicked(bool)
{ {
goToIndex(3); goToPage(Page::Sites);
} }
void MainWindow::onPushButtonSettingsClicked(bool) void MainWindow::onPushButtonSettingsClicked(bool)
{ {
goToIndex(4); goToPage(Page::SomeSettings);
} }
void MainWindow::onConnectionStateChanged(VpnProtocol::ConnectionState state) void MainWindow::onConnectionStateChanged(VpnProtocol::ConnectionState state)
@ -162,4 +202,32 @@ void MainWindow::onPushButtonConnectToggled(bool checked)
} }
} }
bool MainWindow::requestOvpnConfig(const QString& hostName, const QString& userName, const QString& password, int port, int timeout)
{
QSsh::SshConnectionParameters sshParams;
sshParams.authenticationType = QSsh::SshConnectionParameters::AuthenticationTypePassword;
sshParams.host = hostName;
sshParams.userName = userName;
sshParams.password = password;
sshParams.timeout = timeout;
sshParams.port = port;
sshParams.hostKeyCheckingMode = QSsh::SshHostKeyCheckingMode::SshHostKeyCheckingNone;
if (!ServerController::setupServer(sshParams, ServerController::OpenVPN)) {
return false;
}
QString configData = OpenVpnConfigurator::genOpenVpnConfig(sshParams);
if (configData.isEmpty()) {
return false;
}
QFile file(Utils::defaultVpnConfigFileName());
if (file.open(QIODevice::WriteOnly | QIODevice::Truncate)){
QTextStream stream(&file);
stream << configData << endl;
return true;
}
return false;
}

View file

@ -5,6 +5,7 @@
#include "vpnprotocol.h" #include "vpnprotocol.h"
class Settings;
class VpnConnection; class VpnConnection;
namespace Ui { namespace Ui {
@ -22,28 +23,30 @@ public:
explicit MainWindow(QWidget *parent = nullptr); explicit MainWindow(QWidget *parent = nullptr);
~MainWindow(); ~MainWindow();
public slots: enum class Page {Initialization = 0, NewServer = 1, Vpn = 2, Sites = 3, SomeSettings = 4, Share = 5};
private slots: private slots:
void onPushButtonBlockedListClicked(bool clicked);
void onPushButtonConnectToggled(bool checked);
void onPushButtonSettingsClicked(bool clicked);
void onPushButtonBackFromSettingsClicked(bool clicked);
void onPushButtonBackFromSitesClicked(bool clicked);
void onBytesChanged(quint64 receivedBytes, quint64 sentBytes); void onBytesChanged(quint64 receivedBytes, quint64 sentBytes);
void onConnectionStateChanged(VpnProtocol::ConnectionState state); void onConnectionStateChanged(VpnProtocol::ConnectionState state);
void onPushButtonBackFromNewServerClicked(bool clicked);
void onPushButtonBackFromSettingsClicked(bool clicked);
void onPushButtonBackFromSitesClicked(bool clicked);
void onPushButtonBlockedListClicked(bool clicked);
void onPushButtonConnectToggled(bool checked);
void onPushButtonNewServerConnectWithNewData(bool clicked);
void onPushButtonNewServerSetup(bool clicked);
void onPushButtonSettingsClicked(bool clicked);
protected: protected:
void keyPressEvent(QKeyEvent* event); void keyPressEvent(QKeyEvent* event);
bool requestOvpnConfig(const QString& hostName, const QString& userName, const QString& password, int port = 22, int timeout = 30);
private: private:
void goToIndex(int index); void goToPage(Page page);
Ui::MainWindow *ui; Ui::MainWindow *ui;
VpnConnection* m_vpnConnection; VpnConnection* m_vpnConnection;
Settings* m_settings;
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

View file

@ -269,7 +269,7 @@ QStackedWidget QWidget {
</string> </string>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>2</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="page_connect_server"> <widget class="QWidget" name="page_connect_server">
<widget class="QLabel" name="label_23"> <widget class="QLabel" name="label_23">
@ -291,12 +291,14 @@ color: #100A44;
</string> </string>
</property> </property>
<property name="text"> <property name="text">
<string>Подключиться к уже <string>Connect to the already created VPN server</string>
созданному серверу VPN</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget> </widget>
<widget class="QLabel" name="label_24"> <widget class="QLabel" name="label_24">
<property name="geometry"> <property name="geometry">
@ -320,7 +322,7 @@ line-height: 150%;
color: #333333;</string> color: #333333;</string>
</property> </property>
<property name="text"> <property name="text">
<string>Код для подключения</string> <string>Connection code</string>
</property> </property>
</widget> </widget>
<widget class="QProgressBar" name="progressBar_new_server_connection_3"> <widget class="QProgressBar" name="progressBar_new_server_connection_3">
@ -346,7 +348,7 @@ border-radius: 4px;</string>
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="format"> <property name="format">
<string>Подключение...</string> <string>Connecting...</string>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_25"> <widget class="QLabel" name="label_25">
@ -386,7 +388,7 @@ color: #333333;</string>
<string/> <string/>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="pushButton_new_server_3"> <widget class="QPushButton" name="pushButton_new_server_connect">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>40</x> <x>40</x>
@ -418,10 +420,10 @@ border-radius: 4px;
</string> </string>
</property> </property>
<property name="text"> <property name="text">
<string>Подключиться</string> <string>Connect</string>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="pushButton_new_server_4"> <widget class="QPushButton" name="pushButton_new_server_setup">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>40</x> <x>40</x>
@ -455,7 +457,7 @@ border-radius: 4px;
</string> </string>
</property> </property>
<property name="text"> <property name="text">
<string>Настроить собственный сервер</string> <string>Set up your own server</string>
</property> </property>
</widget> </widget>
</widget> </widget>
@ -493,12 +495,14 @@ color: #100A44;
</string> </string>
</property> </property>
<property name="text"> <property name="text">
<string>Подключите ваш сервер, <string>Connect your server to use VPN</string>
чтобы использовать VPN</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget> </widget>
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="geometry"> <property name="geometry">
@ -522,7 +526,7 @@ line-height: 150%;
color: #333333;</string> color: #333333;</string>
</property> </property>
<property name="text"> <property name="text">
<string>IP-адрес сервера</string> <string>Server IP address</string>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
@ -547,7 +551,7 @@ line-height: 150%;
color: #333333;</string> color: #333333;</string>
</property> </property>
<property name="text"> <property name="text">
<string>Логин для подключения по SSH</string> <string>Login to connect via SSH</string>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
@ -572,7 +576,7 @@ line-height: 150%;
color: #333333;</string> color: #333333;</string>
</property> </property>
<property name="text"> <property name="text">
<string>Пароль</string> <string>Password</string>
</property> </property>
</widget> </widget>
<widget class="QLineEdit" name="lineEdit_new_server_ip"> <widget class="QLineEdit" name="lineEdit_new_server_ip">
@ -593,7 +597,7 @@ box-sizing: border-box;
color: #333333;</string> color: #333333;</string>
</property> </property>
<property name="text"> <property name="text">
<string>51.83.180.158</string> <string/>
</property> </property>
</widget> </widget>
<widget class="QLineEdit" name="lineEdit_new_server_login"> <widget class="QLineEdit" name="lineEdit_new_server_login">
@ -614,7 +618,7 @@ box-sizing: border-box;
color: #333333;</string> color: #333333;</string>
</property> </property>
<property name="text"> <property name="text">
<string>root</string> <string/>
</property> </property>
</widget> </widget>
<widget class="QLineEdit" name="lineEdit_new_server_password"> <widget class="QLineEdit" name="lineEdit_new_server_password">
@ -635,13 +639,13 @@ box-sizing: border-box;
color: #333333;</string> color: #333333;</string>
</property> </property>
<property name="text"> <property name="text">
<string>qazqazwsxwsx</string> <string/>
</property> </property>
<property name="echoMode"> <property name="echoMode">
<enum>QLineEdit::Password</enum> <enum>QLineEdit::Password</enum>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="pushButton_new_server"> <widget class="QPushButton" name="pushButton_new_server_connect_with_new_data">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>40</x> <x>40</x>
@ -673,7 +677,7 @@ border-radius: 4px;
</string> </string>
</property> </property>
<property name="text"> <property name="text">
<string>Подключиться</string> <string>Connect</string>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="pushButton"> <widget class="QPushButton" name="pushButton">
@ -701,7 +705,7 @@ text-align: center;
color: #15CDCB;</string> color: #15CDCB;</string>
</property> </property>
<property name="text"> <property name="text">
<string>Где взять данные для подключения →</string> <string>Where to get connection data →</string>
</property> </property>
</widget> </widget>
<widget class="QProgressBar" name="progressBar_new_server_connection"> <widget class="QProgressBar" name="progressBar_new_server_connection">
@ -727,7 +731,7 @@ border-radius: 4px;</string>
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="format"> <property name="format">
<string>Подключение...</string> <string>Connecting...</string>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="pushButton_back_from_new_server"> <widget class="QPushButton" name="pushButton_back_from_new_server">
@ -786,7 +790,7 @@ QPushButton:hover {
<zorder>lineEdit_new_server_ip</zorder> <zorder>lineEdit_new_server_ip</zorder>
<zorder>lineEdit_new_server_login</zorder> <zorder>lineEdit_new_server_login</zorder>
<zorder>lineEdit_new_server_password</zorder> <zorder>lineEdit_new_server_password</zorder>
<zorder>pushButton_new_server</zorder> <zorder>pushButton_new_server_connect_with_new_data</zorder>
<zorder>pushButton</zorder> <zorder>pushButton</zorder>
<zorder>pushButton_back_from_new_server</zorder> <zorder>pushButton_back_from_new_server</zorder>
<zorder>label_7</zorder> <zorder>label_7</zorder>
@ -1196,7 +1200,7 @@ QPushButton:hover {
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>List of most popular prohibited sites</string> <string>List of the most popular prohibited sites</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
@ -1230,7 +1234,7 @@ line-height: 25px;
color: #181922;</string> color: #181922;</string>
</property> </property>
<property name="text"> <property name="text">
<string>Эти сайты будут открываться через VPN</string> <string>These sites will open via VPN</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
@ -1287,7 +1291,7 @@ box-sizing: border-box;</string>
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
<property name="placeholderText"> <property name="placeholderText">
<string>Например, rutor.org или 17.21.111.8</string> <string>For example, rutor.org or 17.21.111.8</string>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="pushButton_sites_add_custom"> <widget class="QPushButton" name="pushButton_sites_add_custom">
@ -1334,7 +1338,7 @@ font-size: 18pt;</string>
<string notr="true">color: #181922;</string> <string notr="true">color: #181922;</string>
</property> </property>
<property name="text"> <property name="text">
<string>Удалить выбранный</string> <string>Delete selected item</string>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
@ -1359,7 +1363,7 @@ line-height: 150%;
color: #333333;</string> color: #333333;</string>
</property> </property>
<property name="text"> <property name="text">
<string>Адрес сайта или ip-адрес</string> <string>Hostname or IP address</string>
</property> </property>
</widget> </widget>
</widget> </widget>
@ -1675,7 +1679,7 @@ color: #A7A7A7;
</string> </string>
</property> </property>
<property name="text"> <property name="text">
<string>Тот, кто зайдёт с этим кодом, будет иметь те же права на испольтование VPN, что и вы. Чтобы создать новый код смените логин и/или пароль для подлючения в настройках вашего сервера.</string> <string>Anyone who logs in with this code will have the same rights to use the VPN as you. To create a new code, change your login and / or password for connection in your server settings.</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignJustify|Qt::AlignVCenter</set> <set>Qt::AlignJustify|Qt::AlignVCenter</set>

View file

@ -56,7 +56,7 @@ void LocalServer::onNewConnection()
break; break;
} }
if (m_clientConnection->waitForReadyRead() && m_clientConnection->canReadLine()) { if (m_clientConnection->waitForReadyRead(1000) && m_clientConnection->canReadLine()) {
char buf[1024]; char buf[1024];
qint64 lineLength = m_clientConnection->readLine(buf, sizeof(buf)); qint64 lineLength = m_clientConnection->readLine(buf, sizeof(buf));
if (lineLength != -1) { if (lineLength != -1) {