Auto start
Auto connect Dns settings ui fixes
This commit is contained in:
parent
ad643bf76e
commit
c63990f720
14 changed files with 801 additions and 99 deletions
|
@ -24,6 +24,7 @@ HEADERS += \
|
|||
settings.h \
|
||||
ui/Controls/SlidingStackedWidget.h \
|
||||
ui/mainwindow.h \
|
||||
ui/qautostart.h \
|
||||
utils.h \
|
||||
vpnconnection.h \
|
||||
protocols/vpnprotocol.h \
|
||||
|
@ -41,6 +42,7 @@ SOURCES += \
|
|||
settings.cpp \
|
||||
ui/Controls/SlidingStackedWidget.cpp \
|
||||
ui/mainwindow.cpp \
|
||||
ui/qautostart.cpp \
|
||||
utils.cpp \
|
||||
vpnconnection.cpp \
|
||||
protocols/vpnprotocol.cpp \
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 342 B After Width: | Height: | Size: 344 B |
BIN
client/images/reload.png
Normal file
BIN
client/images/reload.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 690 B |
|
@ -4,7 +4,6 @@
|
|||
#include <QRegularExpression>
|
||||
#include <QTcpSocket>
|
||||
|
||||
//#include "communicator.h"
|
||||
#include "debug.h"
|
||||
#include "openvpnprotocol.h"
|
||||
#include "utils.h"
|
||||
|
@ -189,7 +188,6 @@ ErrorCode OpenVpnProtocol::start()
|
|||
|
||||
m_openVpnProcess->start();
|
||||
|
||||
//m_communicator->sendMessage(Message(Message::State::StartRequest, args));
|
||||
//startTimeoutTimer();
|
||||
|
||||
return ErrorCode::NoError;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "shadowsocksvpnprotocol.h"
|
||||
#include "core/servercontroller.h"
|
||||
|
||||
//#include "communicator.h"
|
||||
#include "debug.h"
|
||||
#include "utils.h"
|
||||
|
||||
|
|
|
@ -40,5 +40,6 @@
|
|||
<file>server_scripts/setup_shadowsocks_server.sh</file>
|
||||
<file>server_scripts/template_shadowsocks.ovpn</file>
|
||||
<file>server_scripts/setup_firewall.sh</file>
|
||||
<file>images/reload.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -34,6 +34,9 @@ public:
|
|||
void setServerCredentials(const ServerCredentials &credentials);
|
||||
bool haveAuthData() const;
|
||||
|
||||
bool isAutoConnect() const { return m_settings.value("Conf/autoConnect", QString()).toBool(); }
|
||||
void setAutoConnect(bool enabled) { m_settings.setValue("Conf/autoConnect", enabled); }
|
||||
|
||||
bool customRouting() const { return m_settings.value("Conf/customRouting", false).toBool(); }
|
||||
void setCustomRouting(bool customRouting) { m_settings.setValue("Conf/customRouting", customRouting); }
|
||||
|
||||
|
|
|
@ -11,11 +11,10 @@
|
|||
#include <QThread>
|
||||
#include <QTimer>
|
||||
|
||||
//#include "communicator.h"
|
||||
|
||||
#include "core/errorstrings.h"
|
||||
#include "core/openvpnconfigurator.h"
|
||||
#include "core/servercontroller.h"
|
||||
#include "ui/qautostart.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "defines.h"
|
||||
|
@ -74,7 +73,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
updateSettings();
|
||||
|
||||
//ui->pushButton_general_settings_exit->hide();
|
||||
//ui->pushButton_share_connection->hide();
|
||||
|
||||
setFixedSize(width(),height());
|
||||
|
||||
|
@ -90,7 +88,20 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
|
||||
onConnectionStateChanged(VpnProtocol::ConnectionState::Disconnected);
|
||||
|
||||
if (m_settings.isAutoConnect() && m_settings.haveAuthData()) {
|
||||
QTimer::singleShot(1000, this, [this](){
|
||||
ui->pushButton_connect->setEnabled(false);
|
||||
onConnect();
|
||||
});
|
||||
}
|
||||
|
||||
qDebug().noquote() << QString("Default config: %1").arg(Utils::defaultVpnConfigFileName());
|
||||
|
||||
m_ipAddressValidator.setRegExp(QRegExp("^((25[0-5]|(2[0-4]|1[0-9]|[1-9]|)[0-9])(\\.(?!$)|$)){4}$"));
|
||||
|
||||
ui->lineEdit_new_server_ip->setValidator(&m_ipAddressValidator);
|
||||
ui->lineEdit_network_settings_dns1->setValidator(&m_ipAddressValidator);
|
||||
ui->lineEdit_network_settings_dns2->setValidator(&m_ipAddressValidator);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
@ -146,6 +157,8 @@ QWidget *MainWindow::getPageWidget(MainWindow::Page page)
|
|||
case(Page::NewServer): return ui->page_new_server;
|
||||
case(Page::Vpn): return ui->page_vpn;
|
||||
case(Page::GeneralSettings): return ui->page_general_settings;
|
||||
case(Page::AppSettings): return ui->page_app_settings;
|
||||
case(Page::NetworkSettings): return ui->page_network_settings;
|
||||
case(Page::ServerSettings): return ui->page_server_settings;
|
||||
case(Page::ShareConnection): return ui->page_share_connection;
|
||||
case(Page::Sites): return ui->page_sites;
|
||||
|
@ -525,6 +538,8 @@ void MainWindow::setupUiConnections()
|
|||
|
||||
connect(ui->pushButton_vpn_add_site, &QPushButton::clicked, this, [this](){ goToPage(Page::Sites); });
|
||||
connect(ui->pushButton_settings, &QPushButton::clicked, this, [this](){ goToPage(Page::GeneralSettings); });
|
||||
connect(ui->pushButton_app_settings, &QPushButton::clicked, this, [this](){ goToPage(Page::AppSettings); });
|
||||
connect(ui->pushButton_network_settings, &QPushButton::clicked, this, [this](){ goToPage(Page::NetworkSettings); });
|
||||
connect(ui->pushButton_server_settings, &QPushButton::clicked, this, [this](){ goToPage(Page::ServerSettings); });
|
||||
connect(ui->pushButton_share_connection, &QPushButton::clicked, this, [this](){
|
||||
goToPage(Page::ShareConnection);
|
||||
|
@ -535,7 +550,7 @@ void MainWindow::setupUiConnections()
|
|||
QGuiApplication::clipboard()->setText(ui->textEdit_sharing_code->toPlainText());
|
||||
ui->pushButton_copy_sharing_code->setText(tr("Copied"));
|
||||
|
||||
QTimer::singleShot(3000, [this]() {
|
||||
QTimer::singleShot(3000, this, [this]() {
|
||||
ui->pushButton_copy_sharing_code->setText(tr("Copy"));
|
||||
});
|
||||
});
|
||||
|
@ -544,6 +559,8 @@ void MainWindow::setupUiConnections()
|
|||
connect(ui->pushButton_back_from_sites, &QPushButton::clicked, this, [this](){ goToPage(Page::Vpn); });
|
||||
connect(ui->pushButton_back_from_settings, &QPushButton::clicked, this, [this](){ goToPage(Page::Vpn); });
|
||||
connect(ui->pushButton_back_from_new_server, &QPushButton::clicked, this, [this](){ goToPage(Page::Start); });
|
||||
connect(ui->pushButton_back_from_app_settings, &QPushButton::clicked, this, [this](){ goToPage(Page::GeneralSettings); });
|
||||
connect(ui->pushButton_back_from_network_settings, &QPushButton::clicked, this, [this](){ goToPage(Page::GeneralSettings); });
|
||||
connect(ui->pushButton_back_from_server_settings, &QPushButton::clicked, this, [this](){ goToPage(Page::GeneralSettings); });
|
||||
connect(ui->pushButton_back_from_share, &QPushButton::clicked, this, [this](){ goToPage(Page::GeneralSettings); });
|
||||
|
||||
|
@ -555,6 +572,38 @@ void MainWindow::setupUiConnections()
|
|||
connect(ui->radioButton_mode_selected_sites, &QRadioButton::toggled, this, [this](bool toggled) {
|
||||
m_settings.setCustomRouting(toggled);
|
||||
});
|
||||
|
||||
connect(ui->checkBox_autostart, &QCheckBox::stateChanged, this, [this](int state){
|
||||
if (state == Qt::Unchecked) {
|
||||
ui->checkBox_autoconnect->setChecked(false);
|
||||
}
|
||||
Autostart::setAutostart(state == Qt::Checked);
|
||||
});
|
||||
|
||||
connect(ui->checkBox_autoconnect, &QCheckBox::stateChanged, this, [this](int state){
|
||||
m_settings.setAutoConnect(state == Qt::Checked);
|
||||
});
|
||||
|
||||
connect(ui->pushButton_network_settings_resetdns1, &QPushButton::clicked, this, [this](){
|
||||
m_settings.setPrimaryDns(m_settings.cloudFlareNs1());
|
||||
updateSettings();
|
||||
});
|
||||
connect(ui->pushButton_network_settings_resetdns2, &QPushButton::clicked, this, [this](){
|
||||
m_settings.setPrimaryDns(m_settings.cloudFlareNs2());
|
||||
updateSettings();
|
||||
});
|
||||
|
||||
connect(ui->lineEdit_network_settings_dns1, &QLineEdit::textEdited, this, [this](const QString &newText){
|
||||
if (m_ipAddressValidator.regExp().exactMatch(newText)) {
|
||||
m_settings.setPrimaryDns(newText);
|
||||
}
|
||||
});
|
||||
connect(ui->lineEdit_network_settings_dns2, &QLineEdit::textEdited, this, [this](const QString &newText){
|
||||
if (m_ipAddressValidator.regExp().exactMatch(newText)) {
|
||||
m_settings.setSecondaryDns(newText);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::setTrayState(VpnProtocol::ConnectionState state)
|
||||
|
@ -723,6 +772,12 @@ void MainWindow::updateSettings()
|
|||
customSitesModel->setStringList(m_settings.customSites());
|
||||
ui->radioButton_mode_selected_sites->setChecked(m_settings.customRouting());
|
||||
ui->pushButton_vpn_add_site->setEnabled(m_settings.customRouting());
|
||||
|
||||
ui->checkBox_autostart->setChecked(Autostart::isAutostart());
|
||||
ui->checkBox_autoconnect->setChecked(m_settings.isAutoConnect());
|
||||
|
||||
ui->lineEdit_network_settings_dns1->setText(m_settings.primaryDns());
|
||||
ui->lineEdit_network_settings_dns2->setText(m_settings.secondaryDns());
|
||||
}
|
||||
|
||||
void MainWindow::updateShareCode()
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <QMainWindow>
|
||||
#include <QProgressBar>
|
||||
#include <QPushButton>
|
||||
#include <QRegExpValidator>
|
||||
#include <QStringListModel>
|
||||
#include <QSystemTrayIcon>
|
||||
|
||||
|
@ -35,7 +36,7 @@ public:
|
|||
explicit MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
enum Page {Start, NewServer, Vpn, GeneralSettings, ServerSettings, ShareConnection, Sites};
|
||||
enum Page {Start, NewServer, Vpn, GeneralSettings, AppSettings, NetworkSettings, ServerSettings, ShareConnection, Sites};
|
||||
Q_ENUM(Page)
|
||||
|
||||
private slots:
|
||||
|
@ -90,6 +91,7 @@ private:
|
|||
QMenu* m_menu;
|
||||
|
||||
QStringListModel *customSitesModel = nullptr;
|
||||
QRegExpValidator m_ipAddressValidator;
|
||||
|
||||
bool canMove = false;
|
||||
QPoint offset;
|
||||
|
|
|
@ -60,31 +60,26 @@ QLineEdit:disabled {
|
|||
|
||||
|
||||
QCheckBox {
|
||||
color: rgb(200, 200, 200);
|
||||
color: #181922;
|
||||
|
||||
font: 63 11pt "Open Sans";
|
||||
/*font: 11pt "JMH Cthulhumbus";*/
|
||||
background: transparent;
|
||||
|
||||
|
||||
}
|
||||
|
||||
QCheckBox::indicator {
|
||||
min-height: 20px;
|
||||
min-width: 20px;
|
||||
|
||||
border-image: url(:/images/controls/checkbox_unchecked.png) 0 0 0 0 stretch stretch;
|
||||
border-image: url(:/images/controls/check_off.png) 0 0 0 0 stretch stretch;
|
||||
}
|
||||
|
||||
QCheckBox::indicator:unchecked {
|
||||
border-image: url(:/images/controls/checkbox_unchecked.png) 0 0 0 0 stretch stretch;
|
||||
}
|
||||
QCheckBox::indicator:unchecked:hover {
|
||||
border-image: url(:/images/controls/checkbox_hover.png);
|
||||
border-image: url(:/images/controls/check_off.png) 0 0 0 0 stretch stretch;
|
||||
}
|
||||
|
||||
QCheckBox::indicator:checked {
|
||||
border-image: url(:/images/controls/checkbox_checked.png);
|
||||
border-image: url(:/images/controls/check_on.png);
|
||||
|
||||
}
|
||||
|
||||
|
@ -259,7 +254,7 @@ QPushButton:hover {
|
|||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_start">
|
||||
<widget class="QLabel" name="label_23">
|
||||
|
@ -383,6 +378,10 @@ line-height: 21px;
|
|||
background: #100A44;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background: #211966;
|
||||
}
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
@ -634,7 +633,9 @@ line-height: 21px;
|
|||
background: #100A44;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</string>
|
||||
QPushButton:hover {
|
||||
background: #211966;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Connect</string>
|
||||
|
@ -952,6 +953,10 @@ line-height: 21px;
|
|||
|
||||
QPushButton:!enabled {
|
||||
background: #484952;
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background: #282932;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
@ -1119,9 +1124,9 @@ color: #181922;
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>300</y>
|
||||
<y>290</y>
|
||||
<width>381</width>
|
||||
<height>51</height>
|
||||
<height>61</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
@ -1243,10 +1248,10 @@ QPushButton:hover {
|
|||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>19</x>
|
||||
<x>20</x>
|
||||
<y>50</y>
|
||||
<width>341</width>
|
||||
<height>41</height>
|
||||
<width>340</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
|
@ -1255,11 +1260,8 @@ font-style: normal;
|
|||
font-weight: bold;
|
||||
font-size: 20px;
|
||||
line-height: 25px;
|
||||
|
||||
/* or 125% */
|
||||
|
||||
/* black */
|
||||
color: #181922;</string>
|
||||
color: #100A44;
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>These sites will be opened using VPN</string>
|
||||
|
@ -1338,10 +1340,15 @@ border: 1px solid #A7A7A7;
|
|||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background: #100A44;
|
||||
<string notr="true">QPushButton {
|
||||
background: #100A44;
|
||||
border-radius: 4px;
|
||||
font-size: 24px;
|
||||
color: white</string>
|
||||
color: white
|
||||
}
|
||||
QPushButton:hover {
|
||||
background: #211966;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>+</string>
|
||||
|
@ -1434,7 +1441,7 @@ QPushButton:hover {
|
|||
<x>10</x>
|
||||
<y>40</y>
|
||||
<width>360</width>
|
||||
<height>1</height>
|
||||
<height>10</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
|
@ -1448,7 +1455,7 @@ QPushButton:hover {
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>60</y>
|
||||
<y>180</y>
|
||||
<width>330</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
|
@ -1456,6 +1463,9 @@ QPushButton:hover {
|
|||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reinstall server, clear server</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-family: Lato;
|
||||
font-style: normal;
|
||||
|
@ -1474,16 +1484,16 @@ background-repeat: no-repeat;
|
|||
background-position: left center;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Server settings</string>
|
||||
<string>Server management</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>110</y>
|
||||
<y>160</y>
|
||||
<width>360</width>
|
||||
<height>1</height>
|
||||
<height>10</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
|
@ -1500,7 +1510,7 @@ background-repeat: no-repeat;
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>130</y>
|
||||
<y>240</y>
|
||||
<width>330</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
|
@ -1533,9 +1543,9 @@ background-repeat: no-repeat;
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>180</y>
|
||||
<y>220</y>
|
||||
<width>360</width>
|
||||
<height>1</height>
|
||||
<height>10</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
|
@ -1551,7 +1561,7 @@ background-repeat: no-repeat;
|
|||
<x>10</x>
|
||||
<y>620</y>
|
||||
<width>360</width>
|
||||
<height>1</height>
|
||||
<height>10</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
|
@ -1568,7 +1578,7 @@ background-repeat: no-repeat;
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>570</y>
|
||||
<y>580</y>
|
||||
<width>330</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
|
@ -1600,9 +1610,9 @@ background-repeat: no-repeat;
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>550</y>
|
||||
<y>560</y>
|
||||
<width>360</width>
|
||||
<height>1</height>
|
||||
<height>10</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
|
@ -1612,6 +1622,463 @@ background-repeat: no-repeat;
|
|||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_app_settings">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>60</y>
|
||||
<width>330</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Auto start, Auto connect</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
font-size: 20px;
|
||||
line-height: 25px;
|
||||
Text-align:left;
|
||||
padding-left: 30px;
|
||||
|
||||
|
||||
/* black */
|
||||
color: #100A44;
|
||||
|
||||
background-image: url(:/images/settings.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: left center;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>App settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>280</y>
|
||||
<width>360</width>
|
||||
<height>10</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">image: url(:/images/line.png);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_21">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>100</y>
|
||||
<width>360</width>
|
||||
<height>10</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">image: url(:/images/line.png);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_network_settings">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>120</y>
|
||||
<width>330</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Dns, Kill Switch</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
font-size: 20px;
|
||||
line-height: 25px;
|
||||
Text-align:left;
|
||||
padding-left: 30px;
|
||||
|
||||
|
||||
/* black */
|
||||
color: #100A44;
|
||||
|
||||
background-image: url(:/images/settings.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: left center;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Network settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_app_settings">
|
||||
<widget class="QPushButton" name="pushButton_back_from_app_settings">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>26</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
image: url(:/images/arrow_right.png);
|
||||
image-position: left;
|
||||
text-align: left;
|
||||
/*font: 17pt "Ancient";*/
|
||||
|
||||
padding: 1px;
|
||||
image: url(:/images/arrow_left.png);
|
||||
}
|
||||
QPushButton:hover {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>590</y>
|
||||
<width>150</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">image: url(:/images/AmneziaVPN.png);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_autostart">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>100</y>
|
||||
<width>211</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Auto start</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_27">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>50</y>
|
||||
<width>340</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
font-size: 20px;
|
||||
line-height: 25px;
|
||||
color: #100A44;
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Application Settings</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_autoconnect">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>140</y>
|
||||
<width>211</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Auto connect</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_check_for_updates">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>220</y>
|
||||
<width>321</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
color:rgb(212, 212, 212);
|
||||
border-radius: 4px;
|
||||
|
||||
font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-size: 16px;
|
||||
line-height: 21px;
|
||||
|
||||
background: #100A44;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background: #211966;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Check for updates</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_network_settings">
|
||||
<widget class="QPushButton" name="pushButton_back_from_network_settings">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>26</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
image: url(:/images/arrow_right.png);
|
||||
image-position: left;
|
||||
text-align: left;
|
||||
/*font: 17pt "Ancient";*/
|
||||
|
||||
padding: 1px;
|
||||
image: url(:/images/arrow_left.png);
|
||||
}
|
||||
QPushButton:hover {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_26">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>600</y>
|
||||
<width>150</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">image: url(:/images/AmneziaVPN.png);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_network_settings_dns1">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>120</y>
|
||||
<width>271</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background: #F4F4F4;
|
||||
|
||||
/* grey */
|
||||
border: 1px solid #A7A7A7;
|
||||
color: #333333;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>50</y>
|
||||
<width>340</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
font-size: 20px;
|
||||
line-height: 25px;
|
||||
color: #100A44;
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>DNS Servers</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_network_settings_dns2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>200</y>
|
||||
<width>271</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background: #F4F4F4;
|
||||
|
||||
/* grey */
|
||||
border: 1px solid #A7A7A7;
|
||||
color: #333333;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_network_settings_resetdns1">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>320</x>
|
||||
<y>130</y>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reset to default value</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
image: url(:/images/reload.png);
|
||||
padding:1px;
|
||||
}
|
||||
QPushButton:hover {
|
||||
padding:0px;
|
||||
}
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_network_settings_resetdns2">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>320</x>
|
||||
<y>210</y>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reset to default value</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
image: url(:/images/reload.png);
|
||||
padding:1px;
|
||||
}
|
||||
QPushButton:hover {
|
||||
padding:0px;
|
||||
}
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_new_server_wait_info_2">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>95</y>
|
||||
<width>291</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Primary DNS server</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_new_server_wait_info_3">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>175</y>
|
||||
<width>291</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Secondray DNS server</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_server_settings">
|
||||
<widget class="QLabel" name="label_server_settings_wait_info">
|
||||
|
@ -1633,31 +2100,6 @@ background-repeat: no-repeat;
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>100</y>
|
||||
<width>171</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-size: 16px;
|
||||
line-height: 150%;
|
||||
|
||||
/* or 24px */
|
||||
|
||||
/* text */
|
||||
color: #333333;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>You connected to</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_server_settings_reinstall">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
|
@ -1684,7 +2126,9 @@ line-height: 21px;
|
|||
background: #100A44;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</string>
|
||||
QPushButton:hover {
|
||||
background: #211966;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reinstall Amnezia server</string>
|
||||
|
@ -1725,17 +2169,17 @@ QPushButton:hover {
|
|||
<widget class="QLabel" name="label_16">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<x>20</x>
|
||||
<y>40</y>
|
||||
<width>361</width>
|
||||
<height>71</height>
|
||||
<width>340</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
font-size: 24px;
|
||||
font-size: 20px;
|
||||
line-height: 25px;
|
||||
color: #100A44;
|
||||
</string>
|
||||
|
@ -1836,7 +2280,9 @@ line-height: 21px;
|
|||
background: #100A44;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</string>
|
||||
QPushButton:hover {
|
||||
background: #211966;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear server from Amnezia software</string>
|
||||
|
@ -1868,7 +2314,9 @@ line-height: 21px;
|
|||
background: #100A44;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</string>
|
||||
QPushButton:hover {
|
||||
background: #211966;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Forget this server</string>
|
||||
|
@ -1877,9 +2325,9 @@ border-radius: 4px;
|
|||
<widget class="QLabel" name="label_server_settings_server">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>130</y>
|
||||
<width>321</width>
|
||||
<x>20</x>
|
||||
<y>80</y>
|
||||
<width>341</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -1893,9 +2341,11 @@ color: #333333;</string>
|
|||
<property name="text">
|
||||
<string>root@yourserver.org</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<zorder>label_server_settings_wait_info</zorder>
|
||||
<zorder>label_13</zorder>
|
||||
<zorder>pushButton_back_from_server_settings</zorder>
|
||||
<zorder>label_16</zorder>
|
||||
<zorder>progressBar_server_settings_reinstall</zorder>
|
||||
|
@ -1949,8 +2399,8 @@ QPushButton:hover {
|
|||
<rect>
|
||||
<x>20</x>
|
||||
<y>40</y>
|
||||
<width>341</width>
|
||||
<height>41</height>
|
||||
<width>340</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
|
@ -1959,17 +2409,14 @@ font-style: normal;
|
|||
font-weight: bold;
|
||||
font-size: 20px;
|
||||
line-height: 25px;
|
||||
|
||||
/* or 125% */
|
||||
|
||||
/* black */
|
||||
color: #181922;</string>
|
||||
color: #100A44;
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Connection string</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
|
@ -2049,7 +2496,9 @@ font-size: 16px;
|
|||
line-height: 21px;
|
||||
|
||||
}
|
||||
</string>
|
||||
QPushButton:hover {
|
||||
background: #282932;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Copy</string>
|
||||
|
@ -2065,21 +2514,18 @@ line-height: 21px;
|
|||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">
|
||||
|
||||
font-family: Lato;
|
||||
<string notr="true">font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-size: 16px;
|
||||
line-height: 150%;
|
||||
/* or 24px */
|
||||
|
||||
/* grey */
|
||||
color: #A7A7A7;
|
||||
color: #181922;
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<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>
|
||||
<string>Anyone who logs in with this code will have the same rights to use the VPN as you. This code includes your server credentials!
|
||||
Provide this code only to TRUSTED users.</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignJustify|Qt::AlignVCenter</set>
|
||||
|
|
154
client/ui/qautostart.cpp
Normal file
154
client/ui/qautostart.cpp
Normal file
|
@ -0,0 +1,154 @@
|
|||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (C) 2016 Mostafa Sedaghat Joo (mostafa.sedaghat@gmail.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#include "qautostart.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QTextStream>
|
||||
#include <QFileInfo>
|
||||
#include <QSettings>
|
||||
#include <QProcess>
|
||||
#include <QString>
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
|
||||
#if defined (Q_OS_WIN)
|
||||
#define REG_KEY "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run"
|
||||
|
||||
bool Autostart::isAutostart() {
|
||||
QSettings settings(REG_KEY, QSettings::NativeFormat);
|
||||
|
||||
if (settings.value(appName()).isNull()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Autostart::setAutostart(bool autostart) {
|
||||
QSettings settings(REG_KEY, QSettings::NativeFormat);
|
||||
|
||||
if (autostart) {
|
||||
settings.setValue(appName() , appPath().replace('/','\\'));
|
||||
} else {
|
||||
settings.remove(appName());
|
||||
}
|
||||
}
|
||||
|
||||
QString Autostart::appPath() {
|
||||
return QCoreApplication::applicationFilePath() + " --autostart";
|
||||
}
|
||||
|
||||
#elif defined (Q_OS_MAC)
|
||||
|
||||
bool Autostart::isAutostart() {
|
||||
QProcess process;
|
||||
process.start("osascript", {
|
||||
"-e tell application \"System Events\" to get the path of every login item"
|
||||
});
|
||||
process.waitForFinished(3000);
|
||||
const auto output = QString::fromLocal8Bit(process.readAllStandardOutput());
|
||||
return output.contains(appPath());
|
||||
}
|
||||
|
||||
void Autostart::setAutostart(bool autostart) {
|
||||
// Remove any existing login entry for this app first, in case there was one
|
||||
// from a previous installation, that may be under a different launch path.
|
||||
{
|
||||
QProcess::execute("osascript", {
|
||||
"-e tell application \"System Events\" to delete every login item whose name is \"" + appName() + "\""
|
||||
});
|
||||
}
|
||||
|
||||
// Now install the login item, if needed.
|
||||
if ( autostart )
|
||||
{
|
||||
QProcess::execute("osascript", {
|
||||
"-e tell application \"System Events\" to make login item at end with properties {path:\"" + appPath() + "\", hidden:true, name: \"" + appName() + "\"}"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
QString Autostart::appPath() {
|
||||
QDir appDir = QDir(QCoreApplication::applicationDirPath());
|
||||
appDir.cdUp();
|
||||
appDir.cdUp();
|
||||
QString absolutePath = appDir.absolutePath();
|
||||
|
||||
return absolutePath;
|
||||
}
|
||||
|
||||
#elif defined (Q_OS_LINUX)
|
||||
bool Autostart::isAutostart() {
|
||||
QFileInfo check_file(QDir::homePath() + "/.config/autostart/" + appName() +".desktop");
|
||||
|
||||
if (check_file.exists() && check_file.isFile()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Autostart::setAutostart(bool autostart) {
|
||||
QString path = QDir::homePath() + "/.config/autostart/";
|
||||
QString name = appName() +".desktop";
|
||||
QFile file(path+name);
|
||||
|
||||
file.remove();
|
||||
|
||||
if(autostart) {
|
||||
QDir dir(path);
|
||||
if(!dir.exists()) {
|
||||
dir.mkpath(path);
|
||||
}
|
||||
|
||||
if (file.open(QIODevice::ReadWrite)) {
|
||||
QTextStream stream(&file);
|
||||
stream << "[Desktop Entry]" << endl;
|
||||
stream << "Exec=" << appPath() << endl;
|
||||
stream << "Type=Application" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString Autostart::appPath() {
|
||||
return QCoreApplication::applicationFilePath() + " --autostart";
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
bool Autostart::isAutostart() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void Autostart::setAutostart(bool autostart) {
|
||||
Q_UNUSED(autostart);
|
||||
}
|
||||
|
||||
QString Autostart::appPath() {
|
||||
return QString();
|
||||
}
|
||||
#endif
|
||||
|
||||
QString Autostart::appName() {
|
||||
return QCoreApplication::applicationName();
|
||||
}
|
39
client/ui/qautostart.h
Normal file
39
client/ui/qautostart.h
Normal file
|
@ -0,0 +1,39 @@
|
|||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (C) 2016 Mostafa Sedaghat Joo (mostafa.sedaghat@gmail.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#ifndef AUTOSTART_H
|
||||
#define AUTOSTART_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
class Autostart
|
||||
{
|
||||
public:
|
||||
static bool isAutostart();
|
||||
static void setAutostart(bool autostart);
|
||||
|
||||
protected:
|
||||
static QString appPath();
|
||||
static QString appName();
|
||||
};
|
||||
|
||||
#endif // AUTOSTART_H
|
|
@ -49,7 +49,7 @@ void VpnConnection::onConnectionStateChanged(VpnProtocol::ConnectionState state)
|
|||
IpcClient::Interface()->routeAddList(m_vpnProtocol->vpnGateway(), black_custom);
|
||||
}
|
||||
}
|
||||
else if (state == VpnProtocol::ConnectionState::Error || state == VpnProtocol::ConnectionState::Disconnected) {
|
||||
else if (state == VpnProtocol::ConnectionState::Error) {
|
||||
IpcClient::Interface()->flushDns();
|
||||
|
||||
if (m_settings.customRouting()) {
|
||||
|
@ -162,8 +162,11 @@ void VpnConnection::disconnectFromVpn()
|
|||
{
|
||||
qDebug() << "Disconnect from VPN";
|
||||
|
||||
// m_vpnProtocol->communicator()->sendMessage(Message(Message::State::ClearSavedRoutesRequest, QStringList()));
|
||||
// m_vpnProtocol->communicator()->sendMessage(Message(Message::State::FlushDnsRequest, QStringList()));
|
||||
IpcClient::Interface()->flushDns();
|
||||
|
||||
if (m_settings.customRouting()) {
|
||||
IpcClient::Interface()->clearSavedRoutes();
|
||||
}
|
||||
|
||||
if (!m_vpnProtocol.data()) {
|
||||
return;
|
||||
|
|
|
@ -1 +1 @@
|
|||
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\VsDevCmd.bat"
|
||||
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue