Various fixes
This commit is contained in:
parent
64e5e02744
commit
ba85b56e9f
5 changed files with 46 additions and 72 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <Utils.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
@ -74,6 +75,14 @@ bool Debug::openLogsFolder()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Debug::openServiceLogsFolder()
|
||||||
|
{
|
||||||
|
QString path = Utils::systemLogPath();
|
||||||
|
path = "file:///" + path;
|
||||||
|
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
QString Debug::appLogFileNamePath()
|
QString Debug::appLogFileNamePath()
|
||||||
{
|
{
|
||||||
return m_file.fileName();
|
return m_file.fileName();
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ class Debug
|
||||||
public:
|
public:
|
||||||
static bool init();
|
static bool init();
|
||||||
static bool openLogsFolder();
|
static bool openLogsFolder();
|
||||||
|
static bool openServiceLogsFolder();
|
||||||
static QString appLogFileNamePath();
|
static QString appLogFileNamePath();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -1,37 +1,3 @@
|
||||||
//#include <QApplication>
|
|
||||||
//#include <QClipboard>
|
|
||||||
//#include <QDebug>
|
|
||||||
//#include <QDesktopServices>
|
|
||||||
//#include <QFileDialog>
|
|
||||||
//#include <QHBoxLayout>
|
|
||||||
//#include <QHostInfo>
|
|
||||||
//#include <QItemSelectionModel>
|
|
||||||
//#include <QJsonDocument>
|
|
||||||
//#include <QJsonObject>
|
|
||||||
//#include <QKeyEvent>
|
|
||||||
//#include <QMenu>
|
|
||||||
//#include <QMessageBox>
|
|
||||||
//#include <QMetaEnum>
|
|
||||||
//#include <QSysInfo>
|
|
||||||
//#include <QThread>
|
|
||||||
//#include <QTimer>
|
|
||||||
//#include <QRegularExpression>
|
|
||||||
//#include <QSaveFile>
|
|
||||||
|
|
||||||
//#include "configurators/cloak_configurator.h"
|
|
||||||
//#include "configurators/vpn_configurator.h"
|
|
||||||
//#include "configurators/openvpn_configurator.h"
|
|
||||||
//#include "configurators/shadowsocks_configurator.h"
|
|
||||||
//#include "configurators/ssh_configurator.h"
|
|
||||||
|
|
||||||
//#include "core/servercontroller.h"
|
|
||||||
//#include "core/server_defs.h"
|
|
||||||
//#include "core/errorstrings.h"
|
|
||||||
|
|
||||||
//#include "containers/containers_defs.h"
|
|
||||||
//#include "protocols/shadowsocksvpnprotocol.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include "VpnLogic.h"
|
#include "VpnLogic.h"
|
||||||
|
|
||||||
#include "core/errorstrings.h"
|
#include "core/errorstrings.h"
|
||||||
|
|
@ -52,7 +18,6 @@ VpnLogic::VpnLogic(UiLogic *logic, QObject *parent):
|
||||||
m_labelSpeedReceivedText{tr("0 Mbps")},
|
m_labelSpeedReceivedText{tr("0 Mbps")},
|
||||||
m_labelSpeedSentText{tr("0 Mbps")},
|
m_labelSpeedSentText{tr("0 Mbps")},
|
||||||
m_labelStateText{},
|
m_labelStateText{},
|
||||||
m_pushButtonConnectEnabled{false},
|
|
||||||
m_widgetVpnModeEnabled{false}
|
m_widgetVpnModeEnabled{false}
|
||||||
{
|
{
|
||||||
connect(uiLogic()->m_vpnConnection, &VpnConnection::bytesChanged, this, &VpnLogic::onBytesChanged);
|
connect(uiLogic()->m_vpnConnection, &VpnConnection::bytesChanged, this, &VpnLogic::onBytesChanged);
|
||||||
|
|
@ -107,10 +72,10 @@ void VpnLogic::onBytesChanged(quint64 receivedData, quint64 sentData)
|
||||||
|
|
||||||
void VpnLogic::onConnectionStateChanged(VpnProtocol::ConnectionState state)
|
void VpnLogic::onConnectionStateChanged(VpnProtocol::ConnectionState state)
|
||||||
{
|
{
|
||||||
qDebug() << "UiLogic::onConnectionStateChanged" << VpnProtocol::textConnectionState(state);
|
qDebug() << "VpnLogic::onConnectionStateChanged" << VpnProtocol::textConnectionState(state);
|
||||||
|
|
||||||
bool pushButtonConnectEnabled = false;
|
bool pbConnectEnabled = false;
|
||||||
bool radioButtonsModeEnabled = false;
|
bool rbModeEnabled = false;
|
||||||
set_labelStateText(VpnProtocol::textConnectionState(state));
|
set_labelStateText(VpnProtocol::textConnectionState(state));
|
||||||
|
|
||||||
uiLogic()->setTrayState(state);
|
uiLogic()->setTrayState(state);
|
||||||
|
|
@ -119,41 +84,41 @@ void VpnLogic::onConnectionStateChanged(VpnProtocol::ConnectionState state)
|
||||||
case VpnProtocol::Disconnected:
|
case VpnProtocol::Disconnected:
|
||||||
onBytesChanged(0,0);
|
onBytesChanged(0,0);
|
||||||
set_pushButtonConnectChecked(false);
|
set_pushButtonConnectChecked(false);
|
||||||
pushButtonConnectEnabled = true;
|
pbConnectEnabled = true;
|
||||||
radioButtonsModeEnabled = true;
|
rbModeEnabled = true;
|
||||||
break;
|
break;
|
||||||
case VpnProtocol::Preparing:
|
case VpnProtocol::Preparing:
|
||||||
pushButtonConnectEnabled = false;
|
pbConnectEnabled = false;
|
||||||
radioButtonsModeEnabled = false;
|
rbModeEnabled = false;
|
||||||
break;
|
break;
|
||||||
case VpnProtocol::Connecting:
|
case VpnProtocol::Connecting:
|
||||||
pushButtonConnectEnabled = false;
|
pbConnectEnabled = false;
|
||||||
radioButtonsModeEnabled = false;
|
rbModeEnabled = false;
|
||||||
break;
|
break;
|
||||||
case VpnProtocol::Connected:
|
case VpnProtocol::Connected:
|
||||||
pushButtonConnectEnabled = true;
|
pbConnectEnabled = true;
|
||||||
radioButtonsModeEnabled = false;
|
rbModeEnabled = false;
|
||||||
break;
|
break;
|
||||||
case VpnProtocol::Disconnecting:
|
case VpnProtocol::Disconnecting:
|
||||||
pushButtonConnectEnabled = false;
|
pbConnectEnabled = false;
|
||||||
radioButtonsModeEnabled = false;
|
rbModeEnabled = false;
|
||||||
break;
|
break;
|
||||||
case VpnProtocol::Reconnecting:
|
case VpnProtocol::Reconnecting:
|
||||||
pushButtonConnectEnabled = true;
|
pbConnectEnabled = true;
|
||||||
radioButtonsModeEnabled = false;
|
rbModeEnabled = false;
|
||||||
break;
|
break;
|
||||||
case VpnProtocol::Error:
|
case VpnProtocol::Error:
|
||||||
set_pushButtonConnectEnabled(false);
|
set_pushButtonConnectEnabled(false);
|
||||||
pushButtonConnectEnabled = true;
|
pbConnectEnabled = true;
|
||||||
radioButtonsModeEnabled = true;
|
rbModeEnabled = true;
|
||||||
break;
|
break;
|
||||||
case VpnProtocol::Unknown:
|
case VpnProtocol::Unknown:
|
||||||
pushButtonConnectEnabled = true;
|
pbConnectEnabled = true;
|
||||||
radioButtonsModeEnabled = true;
|
rbModeEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_pushButtonConnectEnabled(pushButtonConnectEnabled);
|
set_pushButtonConnectEnabled(pbConnectEnabled);
|
||||||
set_widgetVpnModeEnabled(radioButtonsModeEnabled);
|
set_widgetVpnModeEnabled(rbModeEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VpnLogic::onVpnProtocolError(ErrorCode errorCode)
|
void VpnLogic::onVpnProtocolError(ErrorCode errorCode)
|
||||||
|
|
@ -197,11 +162,12 @@ void VpnLogic::onConnectWorker(int serverIndex, const ServerCredentials &credent
|
||||||
{
|
{
|
||||||
set_labelErrorText("");
|
set_labelErrorText("");
|
||||||
set_pushButtonConnectChecked(true);
|
set_pushButtonConnectChecked(true);
|
||||||
|
set_pushButtonConnectEnabled(false);
|
||||||
|
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
|
|
||||||
ErrorCode errorCode = uiLogic()->m_vpnConnection->connectToVpn(
|
ErrorCode errorCode = uiLogic()->m_vpnConnection->connectToVpn(
|
||||||
serverIndex, credentials, container, containerConfig
|
serverIndex, credentials, container, containerConfig);
|
||||||
);
|
|
||||||
|
|
||||||
if (errorCode) {
|
if (errorCode) {
|
||||||
//ui->pushButton_connect->setChecked(false);
|
//ui->pushButton_connect->setChecked(false);
|
||||||
|
|
@ -210,7 +176,6 @@ void VpnLogic::onConnectWorker(int serverIndex, const ServerCredentials &credent
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_pushButtonConnectEnabled(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VpnLogic::onDisconnect()
|
void VpnLogic::onDisconnect()
|
||||||
|
|
|
||||||
|
|
@ -294,10 +294,9 @@ void UiLogic::showOnStartup()
|
||||||
void UiLogic::keyPressEvent(Qt::Key key)
|
void UiLogic::keyPressEvent(Qt::Key key)
|
||||||
{
|
{
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case Qt::Key_L:
|
case Qt::Key_L: Debug::openLogsFolder();
|
||||||
if (!Debug::openLogsFolder()) {
|
break;
|
||||||
//QMessageBox::warning(this, APPLICATION_NAME, tr("Cannot open logs folder!"));
|
case Qt::Key_K: Debug::openServiceLogsFolder();
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
case Qt::Key_Q:
|
case Qt::Key_Q:
|
||||||
|
|
|
||||||
|
|
@ -19,17 +19,17 @@ IpcServerProcess::IpcServerProcess(QObject *parent) :
|
||||||
qDebug() << "IpcServerProcess errorOccurred " << error;
|
qDebug() << "IpcServerProcess errorOccurred " << error;
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_process.data(), &QProcess::readyReadStandardError, this, [this](){
|
// connect(m_process.data(), &QProcess::readyReadStandardError, this, [this](){
|
||||||
qDebug() << "IpcServerProcess StandardError " << m_process->readAllStandardError();
|
// qDebug() << "IpcServerProcess StandardError " << m_process->readAllStandardError();
|
||||||
|
|
||||||
});
|
// });
|
||||||
connect(m_process.data(), &QProcess::readyReadStandardOutput, this, [this](){
|
// connect(m_process.data(), &QProcess::readyReadStandardOutput, this, [this](){
|
||||||
qDebug() << "IpcServerProcess StandardOutput " << m_process->readAllStandardOutput();
|
// qDebug() << "IpcServerProcess StandardOutput " << m_process->readAllStandardOutput();
|
||||||
});
|
// });
|
||||||
|
|
||||||
connect(m_process.data(), &QProcess::readyRead, this, [this](){
|
// connect(m_process.data(), &QProcess::readyRead, this, [this](){
|
||||||
qDebug() << "IpcServerProcess StandardOutput " << m_process->readAll();
|
// qDebug() << "IpcServerProcess StandardOutput " << m_process->readAll();
|
||||||
});
|
// });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue