Cleanup code
This commit is contained in:
parent
aed688224b
commit
aae1da3aa8
10 changed files with 3 additions and 37 deletions
|
@ -14,7 +14,7 @@
|
|||
#include "configurators/vpn_configurator.h"
|
||||
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||
#define AMNEZIA_BASE_CLASS QGuiApplication
|
||||
#define AMNEZIA_BASE_CLASS QApplication
|
||||
#else
|
||||
#define AMNEZIA_BASE_CLASS SingleApplication
|
||||
#define QAPPLICATION_CLASS QApplication
|
||||
|
|
|
@ -13,8 +13,6 @@ SecureQSettings::SecureQSettings(const QString &organization, const QString &app
|
|||
m_settings(organization, application, parent),
|
||||
encryptedKeys({"Servers/serversList"})
|
||||
{
|
||||
qDebug() << "SecureQSettings::SecureQSettings CTOR";
|
||||
|
||||
bool encrypted = m_settings.value("Conf/encrypted").toBool();
|
||||
|
||||
// convert settings to encrypted for if updated to >= 2.1.0
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#include "settings.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include "containers/containers_defs.h"
|
||||
|
||||
const char Settings::cloudFlareNs1[] = "1.1.1.1";
|
||||
|
@ -13,8 +12,6 @@ Settings::Settings(QObject* parent) :
|
|||
QObject(parent),
|
||||
m_settings(ORGANIZATION_NAME, APPLICATION_NAME, this)
|
||||
{
|
||||
qDebug() << "Settings::Settings()" << this;
|
||||
// qDebug() << "Settings::Settings()" << m_settings.fileName();
|
||||
// Import old settings
|
||||
if (serversCount() == 0) {
|
||||
QString user = m_settings.value("Server/userName").toString();
|
||||
|
@ -181,7 +178,6 @@ void Settings::clearLastConnectionConfig(int serverIndex, DockerContainer contai
|
|||
QJsonObject c = protocolConfig(serverIndex, container, proto);
|
||||
c.remove(config_key::last_config);
|
||||
setProtocolConfig(serverIndex, container, proto, c);
|
||||
qDebug() << "Settings::clearLastConnectionConfig for" << serverIndex << container << proto;
|
||||
}
|
||||
|
||||
bool Settings::haveAuthData(int serverIndex) const
|
||||
|
|
|
@ -238,8 +238,6 @@ void ShareConnectionLogic::onPushButtonShareIkev2GenerateClicked()
|
|||
DockerContainer container = uiLogic()->selectedDockerContainer;
|
||||
ServerCredentials credentials = m_settings->serverCredentials(serverIndex);
|
||||
|
||||
//const QJsonObject &containerConfig = m_settings->containerConfig(serverIndex, container);
|
||||
|
||||
Ikev2Configurator::ConnectionData connData = m_configurator->ikev2Configurator->prepareIkev2Config(credentials, container);
|
||||
|
||||
QString cfg = m_configurator->ikev2Configurator->genIkev2Config(connData);
|
||||
|
|
|
@ -49,8 +49,6 @@ void StartPageLogic::onUpdatePage()
|
|||
|
||||
void StartPageLogic::onPushButtonConnect()
|
||||
{
|
||||
// uiLogic()->goToPage(Page::NewServer);
|
||||
// return;
|
||||
if (pushButtonConnectKeyChecked()){
|
||||
if (lineEditIpText().isEmpty() ||
|
||||
lineEditLoginText().isEmpty() ||
|
||||
|
@ -67,7 +65,6 @@ void StartPageLogic::onPushButtonConnect()
|
|||
return;
|
||||
}
|
||||
}
|
||||
qDebug() << "UiLogic::onPushButtonConnect checking new server";
|
||||
|
||||
ServerCredentials serverCredentials;
|
||||
serverCredentials.hostName = lineEditIpText();
|
||||
|
@ -152,13 +149,6 @@ bool StartPageLogic::importConnection(const QJsonObject &profile)
|
|||
credentials.userName = profile.value(config_key::userName).toString();
|
||||
credentials.password = profile.value(config_key::password).toString();
|
||||
|
||||
// qDebug() << QString("Added server %3@%1:%2").
|
||||
// arg(credentials.hostName).
|
||||
// arg(credentials.port).
|
||||
// arg(credentials.userName);
|
||||
|
||||
//qDebug() << QString("Password") << credentials.password;
|
||||
|
||||
if (credentials.isValid() || profile.contains(config_key::containers)) {
|
||||
m_settings->addServer(profile);
|
||||
m_settings->setDefaultServer(m_settings->serversCount() - 1);
|
||||
|
@ -208,7 +198,6 @@ bool StartPageLogic::importConnectionFromCode(QString code)
|
|||
|
||||
bool StartPageLogic::importConnectionFromQr(const QByteArray &data)
|
||||
{
|
||||
qDebug() << "StartPageLogic::importConnectionFromQr" << data;
|
||||
QJsonObject dataObj = QJsonDocument::fromJson(data).object();
|
||||
if (!dataObj.isEmpty()) {
|
||||
return importConnection(dataObj);
|
||||
|
|
|
@ -47,7 +47,6 @@ QJsonObject ShadowSocksLogic::getProtocolConfigFromPage(QJsonObject oldConfig)
|
|||
void ShadowSocksLogic::onPushButtonSaveClicked()
|
||||
{
|
||||
QJsonObject protocolConfig = m_settings->protocolConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer, Proto::ShadowSocks);
|
||||
//protocolConfig = getShadowSocksConfigFromPage(protocolConfig);
|
||||
|
||||
QJsonObject containerConfig = m_settings->containerConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer);
|
||||
QJsonObject newContainerConfig = containerConfig;
|
||||
|
|
|
@ -75,7 +75,6 @@ void SystemTrayNotificationHandler::onTrayActivated(QSystemTrayIcon::ActivationR
|
|||
|
||||
void SystemTrayNotificationHandler::setTrayState(VpnProtocol::VpnConnectionState state)
|
||||
{
|
||||
qDebug() << "SystemTrayNotificationHandler::setTrayState" << state;
|
||||
QString resourcesPath = ":/images/tray/%1";
|
||||
|
||||
switch (state) {
|
||||
|
|
|
@ -147,14 +147,12 @@ void UiLogic::initalizeUiLogic()
|
|||
}
|
||||
});
|
||||
if (!AndroidController::instance()->initialize()) {
|
||||
qDebug() << QString("Init failed") ;
|
||||
qCritical() << QString("Init failed") ;
|
||||
emit VpnProtocol::Error;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
qDebug() << "UiLogic::initalizeUiLogic()";
|
||||
|
||||
m_notificationHandler = NotificationHandler::create(qmlRoot());
|
||||
|
||||
connect(m_vpnConnection, &VpnConnection::connectionStateChanged, m_notificationHandler, &NotificationHandler::setConnectionState);
|
||||
|
@ -235,7 +233,6 @@ void UiLogic::keyPressEvent(Qt::Key key)
|
|||
#endif
|
||||
case Qt::Key_C:
|
||||
qDebug().noquote() << "Def server" << m_settings->defaultServerIndex() << m_settings->defaultContainerName(m_settings->defaultServerIndex());
|
||||
//qDebug().noquote() << QJsonDocument(m_settings->containerConfig(m_settings->defaultServerIndex(), m_settings->defaultContainer(m_settings->defaultServerIndex()))).toJson();
|
||||
qDebug().noquote() << QJsonDocument(m_settings->defaultServer()).toJson();
|
||||
break;
|
||||
case Qt::Key_A:
|
||||
|
@ -578,7 +575,7 @@ PageProtocolLogicBase *UiLogic::protocolLogic(Proto p)
|
|||
PageProtocolLogicBase *logic = m_protocolLogicMap.value(p);
|
||||
if (logic) return logic;
|
||||
else {
|
||||
qDebug() << "UiLogic::protocolLogic Warning: logic missing for" << p;
|
||||
qCritical() << "UiLogic::protocolLogic Warning: logic missing for" << p;
|
||||
return new PageProtocolLogicBase(this);
|
||||
}
|
||||
}
|
||||
|
@ -623,13 +620,11 @@ void UiLogic::saveTextFile(const QString& desc, const QString& suggestedName, QS
|
|||
QUrl::fromLocalFile(docDir), "*" + ext);
|
||||
#endif
|
||||
|
||||
qDebug() << "UiLogic::saveTextFile" << fileName;
|
||||
if (fileName.isEmpty()) return;
|
||||
|
||||
#ifdef AMNEZIA_DESKTOP
|
||||
QFile save(fileName.toLocalFile());
|
||||
#else
|
||||
qDebug() << "UiLogic::saveTextFile" << QQmlFile::urlToLocalFileOrQrc(fileName);
|
||||
QFile save(QQmlFile::urlToLocalFileOrQrc(fileName));
|
||||
#endif
|
||||
|
||||
|
@ -672,7 +667,6 @@ void UiLogic::shareTempFile(const QString &suggestedName, QString ext, const QSt
|
|||
if (!fileName.endsWith(ext)) fileName.append(ext);
|
||||
|
||||
QFile::remove(fileName);
|
||||
qDebug() << "UiLogic::shareTempFile" << fileName;
|
||||
|
||||
QFile save(fileName);
|
||||
save.open(QIODevice::WriteOnly);
|
||||
|
|
|
@ -121,7 +121,6 @@ QString Utils::getIPAddress(const QString& host)
|
|||
|
||||
QList<QHostAddress> adresses = QHostInfo::fromName(host).addresses();
|
||||
if (!adresses.isEmpty()) {
|
||||
qDebug() << "Resolved address for" << host << adresses.first().toString();
|
||||
return adresses.first().toString();
|
||||
}
|
||||
qDebug() << "Unable to resolve address for " << host;
|
||||
|
|
|
@ -219,11 +219,8 @@ QString VpnConnection::createVpnConfigurationForProto(int serverIndex,
|
|||
if (lastVpnConfig.contains(proto)) {
|
||||
configData = lastVpnConfig.value(proto);
|
||||
configData = m_configurator->processConfigWithLocalSettings(serverIndex, container, proto, configData);
|
||||
|
||||
qDebug() << "VpnConnection::createVpnConfiguration: using saved config for" << ProtocolProps::protoToString(proto);
|
||||
}
|
||||
else {
|
||||
qDebug() << "VpnConnection::createVpnConfiguration: gen new config for" << ProtocolProps::protoToString(proto);
|
||||
configData = m_configurator->genVpnProtocolConfig(credentials,
|
||||
container, containerConfig, proto, &e);
|
||||
|
||||
|
@ -363,8 +360,6 @@ QString VpnConnection::bytesPerSecToText(quint64 bytes)
|
|||
|
||||
void VpnConnection::disconnectFromVpn()
|
||||
{
|
||||
// qDebug() << "Disconnect from VPN 1";
|
||||
|
||||
#ifdef AMNEZIA_DESKTOP
|
||||
if (IpcClient::Interface()) {
|
||||
IpcClient::Interface()->flushDns();
|
||||
|
@ -385,7 +380,6 @@ void VpnConnection::disconnectFromVpn()
|
|||
return;
|
||||
}
|
||||
m_vpnProtocol.data()->stop();
|
||||
// qDebug() << "Disconnect from VPN 2";
|
||||
}
|
||||
|
||||
VpnProtocol::VpnConnectionState VpnConnection::connectionState()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue