General improvements and bug fixes
This commit is contained in:
parent
07974a7e34
commit
187fa0080a
10 changed files with 762 additions and 144 deletions
|
@ -2,7 +2,7 @@ QT += widgets core gui network xml
|
|||
|
||||
TARGET = AmneziaVPN
|
||||
TEMPLATE = app
|
||||
#CONFIG += console
|
||||
CONFIG += console
|
||||
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
|
@ -21,6 +21,7 @@ HEADERS += \
|
|||
message.h \
|
||||
openvpnprotocol.h \
|
||||
runguard.h \
|
||||
settings.h \
|
||||
ui/Controls/SlidingStackedWidget.h \
|
||||
ui/mainwindow.h \
|
||||
utils.h \
|
||||
|
@ -39,6 +40,7 @@ SOURCES += \
|
|||
message.cpp \
|
||||
openvpnprotocol.cpp \
|
||||
runguard.cpp \
|
||||
settings.cpp \
|
||||
ui/Controls/SlidingStackedWidget.cpp \
|
||||
ui/mainwindow.cpp \
|
||||
utils.cpp \
|
||||
|
|
|
@ -26,9 +26,9 @@ int main(int argc, char *argv[])
|
|||
QApplication app(argc, argv);
|
||||
loadTranslator();
|
||||
|
||||
if (! RunGuard::instance().tryToRun()) {
|
||||
if (!RunGuard::instance().tryToRun()) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
64
client/settings.cpp
Normal file
64
client/settings.cpp
Normal 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
36
client/settings.h
Normal 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.
|
@ -5,191 +5,632 @@
|
|||
<name>MainWindow</name>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="294"/>
|
||||
<source>Подключиться к уже
|
||||
созданному серверу VPN</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<source>Connect to the already created VPN server</source>
|
||||
<translation>Подключиться к уже созданному серверу VPN</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="323"/>
|
||||
<source>Код для подключения</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="../ui/mainwindow.ui" line="325"/>
|
||||
<source>Connection code</source>
|
||||
<translation>Код для подключения</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="349"/>
|
||||
<location filename="../ui/mainwindow.ui" line="730"/>
|
||||
<source>Подключение...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="../ui/mainwindow.ui" line="351"/>
|
||||
<location filename="../ui/mainwindow.ui" line="734"/>
|
||||
<source>Connecting...</source>
|
||||
<translation>Подключение...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="421"/>
|
||||
<location filename="../ui/mainwindow.ui" line="676"/>
|
||||
<source>Подключиться</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="../ui/mainwindow.ui" line="423"/>
|
||||
<location filename="../ui/mainwindow.ui" line="680"/>
|
||||
<source>Connect</source>
|
||||
<translation>Подключиться</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="458"/>
|
||||
<source>Настроить собственный сервер</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="../ui/mainwindow.ui" line="460"/>
|
||||
<source>Set up your own server</source>
|
||||
<translation>Настроить собственный сервер</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="496"/>
|
||||
<source>Подключите ваш сервер,
|
||||
чтобы использовать VPN</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="../ui/mainwindow.ui" line="498"/>
|
||||
<source>Connect your server to use VPN</source>
|
||||
<translation>Подключите ваш сервер, чтобы использовать VPN</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="525"/>
|
||||
<source>IP-адрес сервера</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="../ui/mainwindow.ui" line="529"/>
|
||||
<source>Server IP address</source>
|
||||
<translation>IP адрес сервера</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="550"/>
|
||||
<source>Логин для подключения по SSH</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="../ui/mainwindow.ui" line="554"/>
|
||||
<source>Login to connect via SSH</source>
|
||||
<translation>Логин для подключения по SSH</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="575"/>
|
||||
<source>Пароль</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="../ui/mainwindow.ui" line="579"/>
|
||||
<source>Password</source>
|
||||
<translation>Пароль</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="596"/>
|
||||
<source>51.83.180.158</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="../ui/mainwindow.ui" line="708"/>
|
||||
<source>Where to get connection data →</source>
|
||||
<translation>Where to get connection data →</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="617"/>
|
||||
<source>root</source>
|
||||
<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"/>
|
||||
<location filename="../ui/mainwindow.ui" line="891"/>
|
||||
<location filename="../ui/mainwindow.ui" line="920"/>
|
||||
<source>0 Mbps</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>0 Мбит/сек</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="954"/>
|
||||
<location filename="../ui/mainwindow.ui" line="958"/>
|
||||
<source>Add site</source>
|
||||
<translation>Добавить сайт</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="1024"/>
|
||||
<location filename="../ui/mainwindow.ui" line="1028"/>
|
||||
<source>Connected</source>
|
||||
<translation>Подключено</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="1067"/>
|
||||
<location filename="../ui/mainwindow.ui" line="1071"/>
|
||||
<source>How to use VPN</source>
|
||||
<translation>Как использовать VPN</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="1086"/>
|
||||
<location filename="../ui/mainwindow.ui" line="1090"/>
|
||||
<source>For all connections</source>
|
||||
<translation>Для всех соединений</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="1102"/>
|
||||
<location filename="../ui/mainwindow.ui" line="1106"/>
|
||||
<source>For selected sites</source>
|
||||
<translation>Для выбранных сайтов</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="1199"/>
|
||||
<source>List of most popular prohibited sites</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="../ui/mainwindow.ui" line="1203"/>
|
||||
<source>List of the most popular prohibited sites</source>
|
||||
<translation>Список самых популярных запрещенных сайтов</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="1233"/>
|
||||
<source>Эти сайты будут открываться через VPN</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="../ui/mainwindow.ui" line="1294"/>
|
||||
<source>For example, rutor.org or 17.21.111.8</source>
|
||||
<translation>Например, rutor.org или 17.21.111.8</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="1290"/>
|
||||
<source>Например, rutor.org или 17.21.111.8</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<location filename="../ui/mainwindow.ui" line="1682"/>
|
||||
<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>Тот, кто зайдёт с этим кодом, будет иметь те же права на использование VPN, что и вы. Чтобы создать новый код смените логин и/или пароль для подлючения в настройках вашего сервера.</translation>
|
||||
</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>
|
||||
<translation>+</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="1337"/>
|
||||
<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"/>
|
||||
<location filename="../ui/mainwindow.ui" line="1449"/>
|
||||
<source>Server settings</source>
|
||||
<translation>Настройки сервера</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="1494"/>
|
||||
<location filename="../ui/mainwindow.ui" line="1498"/>
|
||||
<source>Share connection</source>
|
||||
<translation>Поделиться подключением</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="1572"/>
|
||||
<location filename="../ui/mainwindow.ui" line="1576"/>
|
||||
<source>Connection string</source>
|
||||
<translation>Строка подключения</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="1613"/>
|
||||
<location filename="../ui/mainwindow.ui" line="1617"/>
|
||||
<source><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Consolas'; font-size:22px; font-weight:600; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:20pt;">vpn:\\aosdiufhafafsuhgqejghuserhglaidhgauhgalgadg</span></p></body></html></source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="1651"/>
|
||||
<location filename="../ui/mainwindow.ui" line="1655"/>
|
||||
<source>Copy</source>
|
||||
<translation>Копировать</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.ui" line="1678"/>
|
||||
<source>Тот, кто зайдёт с этим кодом, будет иметь те же права на испольтование VPN, что и вы. Чтобы создать новый код смените логин и/или пароль для подлючения в настройках вашего сервера.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.cpp" line="78"/>
|
||||
<location filename="../ui/mainwindow.cpp" line="92"/>
|
||||
<source>Cannot open logs folder!</source>
|
||||
<translation>Невозможно открыть папку с логами!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/mainwindow.cpp" line="105"/>
|
||||
<source>Please fill in all fields</source>
|
||||
<translation>Пожалуйста, заполните все поля</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="../main.cpp" line="31"/>
|
||||
<source>Notify</source>
|
||||
<translation>Уведомление</translation>
|
||||
<source>AmneziaVPN is already running.</source>
|
||||
<translation>Приложение AmneziaVPN уже запущено.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../main.cpp" line="31"/>
|
||||
<source>AmneziaVPN is already running.</source>
|
||||
<translation>Приложение AmneziaVPN уже запущено.</translation>
|
||||
<source>Notification</source>
|
||||
<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 "%1".</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="499"/>
|
||||
<source>Remote directory "%1" already exists.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="503"/>
|
||||
<source>Error creating directory "%1": %2</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/QtSsh/src/ssh/sftpchannel.cpp" line="527"/>
|
||||
<source>Could not open local file "%1": %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 ('stat' 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 "%1" is invalid.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/QtSsh/src/ssh/sshconnection.cpp" line="402"/>
|
||||
<source>Server protocol version is "%1", 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 "%1"</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 "stat" info about "%1": %2</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/QtSsh/src/ssh/sftpfilesystemmodel.cpp" line="371"/>
|
||||
<source>Error listing contents of directory "%1": %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 "%1" 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 "%1" 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>&RSA</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.ui" line="66"/>
|
||||
<source>&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 &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>&Generate And Save Key Pair</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../3rd/QtSsh/src/ssh/sshkeycreationdialog.ui" line="224"/>
|
||||
<source>&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: "%1".</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'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>
|
||||
</context>
|
||||
<context>
|
||||
<name>VpnConnection</name>
|
||||
<message>
|
||||
<location filename="../vpnconnection.cpp" line="49"/>
|
||||
<location filename="../vpnconnection.cpp" line="58"/>
|
||||
<source>Mbps</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -4,25 +4,32 @@
|
|||
#include <QThread>
|
||||
|
||||
#include "communicator.h"
|
||||
#include "core/openvpnconfigurator.h"
|
||||
#include "core/servercontroller.h"
|
||||
#include "debug.h"
|
||||
#include "defines.h"
|
||||
#include "mainwindow.h"
|
||||
#include "settings.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include "utils.h"
|
||||
#include "vpnconnection.h"
|
||||
|
||||
#include <QStandardPaths>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow),
|
||||
m_settings(new Settings),
|
||||
m_vpnConnection(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// Post initialization
|
||||
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_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_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());
|
||||
|
||||
|
@ -66,9 +76,9 @@ MainWindow::~MainWindow()
|
|||
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)
|
||||
|
@ -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)
|
||||
{
|
||||
ui->label_speed_received->setText(VpnConnection::bytesToText(receivedData));
|
||||
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)
|
||||
{
|
||||
goToIndex(2);
|
||||
goToPage(Page::Vpn);
|
||||
}
|
||||
|
||||
void MainWindow::onPushButtonBackFromSitesClicked(bool)
|
||||
{
|
||||
goToIndex(2);
|
||||
goToPage(Page::Vpn);
|
||||
}
|
||||
|
||||
void MainWindow::onPushButtonBlockedListClicked(bool)
|
||||
{
|
||||
goToIndex(3);
|
||||
goToPage(Page::Sites);
|
||||
}
|
||||
|
||||
void MainWindow::onPushButtonSettingsClicked(bool)
|
||||
{
|
||||
goToIndex(4);
|
||||
goToPage(Page::SomeSettings);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "vpnprotocol.h"
|
||||
|
||||
class Settings;
|
||||
class VpnConnection;
|
||||
|
||||
namespace Ui {
|
||||
|
@ -22,28 +23,30 @@ public:
|
|||
explicit MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
public slots:
|
||||
|
||||
enum class Page {Initialization = 0, NewServer = 1, Vpn = 2, Sites = 3, SomeSettings = 4, Share = 5};
|
||||
|
||||
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 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:
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
bool requestOvpnConfig(const QString& hostName, const QString& userName, const QString& password, int port = 22, int timeout = 30);
|
||||
|
||||
private:
|
||||
void goToIndex(int index);
|
||||
void goToPage(Page page);
|
||||
|
||||
Ui::MainWindow *ui;
|
||||
VpnConnection* m_vpnConnection;
|
||||
Settings* m_settings;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
|
@ -269,7 +269,7 @@ QStackedWidget QWidget {
|
|||
</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_connect_server">
|
||||
<widget class="QLabel" name="label_23">
|
||||
|
@ -291,12 +291,14 @@ color: #100A44;
|
|||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Подключиться к уже
|
||||
созданному серверу VPN</string>
|
||||
<string>Connect to the already created VPN server</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_24">
|
||||
<property name="geometry">
|
||||
|
@ -320,7 +322,7 @@ line-height: 150%;
|
|||
color: #333333;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Код для подключения</string>
|
||||
<string>Connection code</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QProgressBar" name="progressBar_new_server_connection_3">
|
||||
|
@ -346,7 +348,7 @@ border-radius: 4px;</string>
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string>Подключение...</string>
|
||||
<string>Connecting...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_25">
|
||||
|
@ -386,7 +388,7 @@ color: #333333;</string>
|
|||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_new_server_3">
|
||||
<widget class="QPushButton" name="pushButton_new_server_connect">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
|
@ -418,10 +420,10 @@ border-radius: 4px;
|
|||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Подключиться</string>
|
||||
<string>Connect</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_new_server_4">
|
||||
<widget class="QPushButton" name="pushButton_new_server_setup">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
|
@ -455,7 +457,7 @@ border-radius: 4px;
|
|||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Настроить собственный сервер</string>
|
||||
<string>Set up your own server</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -493,12 +495,14 @@ color: #100A44;
|
|||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Подключите ваш сервер,
|
||||
чтобы использовать VPN</string>
|
||||
<string>Connect your server to use VPN</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="geometry">
|
||||
|
@ -522,7 +526,7 @@ line-height: 150%;
|
|||
color: #333333;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>IP-адрес сервера</string>
|
||||
<string>Server IP address</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_5">
|
||||
|
@ -547,7 +551,7 @@ line-height: 150%;
|
|||
color: #333333;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Логин для подключения по SSH</string>
|
||||
<string>Login to connect via SSH</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_6">
|
||||
|
@ -572,7 +576,7 @@ line-height: 150%;
|
|||
color: #333333;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Пароль</string>
|
||||
<string>Password</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_new_server_ip">
|
||||
|
@ -593,7 +597,7 @@ box-sizing: border-box;
|
|||
color: #333333;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>51.83.180.158</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_new_server_login">
|
||||
|
@ -614,7 +618,7 @@ box-sizing: border-box;
|
|||
color: #333333;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>root</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_new_server_password">
|
||||
|
@ -635,13 +639,13 @@ box-sizing: border-box;
|
|||
color: #333333;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>qazqazwsxwsx</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_new_server">
|
||||
<widget class="QPushButton" name="pushButton_new_server_connect_with_new_data">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
|
@ -673,7 +677,7 @@ border-radius: 4px;
|
|||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Подключиться</string>
|
||||
<string>Connect</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
|
@ -701,7 +705,7 @@ text-align: center;
|
|||
color: #15CDCB;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Где взять данные для подключения →</string>
|
||||
<string>Where to get connection data →</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QProgressBar" name="progressBar_new_server_connection">
|
||||
|
@ -727,7 +731,7 @@ border-radius: 4px;</string>
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string>Подключение...</string>
|
||||
<string>Connecting...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<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_login</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_back_from_new_server</zorder>
|
||||
<zorder>label_7</zorder>
|
||||
|
@ -1196,7 +1200,7 @@ QPushButton:hover {
|
|||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>List of most popular prohibited sites</string>
|
||||
<string>List of the most popular prohibited sites</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
|
@ -1230,7 +1234,7 @@ line-height: 25px;
|
|||
color: #181922;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Эти сайты будут открываться через VPN</string>
|
||||
<string>These sites will open via VPN</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
|
@ -1287,7 +1291,7 @@ box-sizing: border-box;</string>
|
|||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Например, rutor.org или 17.21.111.8</string>
|
||||
<string>For example, rutor.org or 17.21.111.8</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_sites_add_custom">
|
||||
|
@ -1334,7 +1338,7 @@ font-size: 18pt;</string>
|
|||
<string notr="true">color: #181922;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Удалить выбранный</string>
|
||||
<string>Delete selected item</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
|
@ -1359,7 +1363,7 @@ line-height: 150%;
|
|||
color: #333333;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Адрес сайта или ip-адрес</string>
|
||||
<string>Hostname or IP address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -1675,7 +1679,7 @@ color: #A7A7A7;
|
|||
</string>
|
||||
</property>
|
||||
<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 name="alignment">
|
||||
<set>Qt::AlignJustify|Qt::AlignVCenter</set>
|
||||
|
|
|
@ -56,7 +56,7 @@ void LocalServer::onNewConnection()
|
|||
break;
|
||||
}
|
||||
|
||||
if (m_clientConnection->waitForReadyRead() && m_clientConnection->canReadLine()) {
|
||||
if (m_clientConnection->waitForReadyRead(1000) && m_clientConnection->canReadLine()) {
|
||||
char buf[1024];
|
||||
qint64 lineLength = m_clientConnection->readLine(buf, sizeof(buf));
|
||||
if (lineLength != -1) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue