Merge branch 'dev' into qt_migration
This commit is contained in:
commit
442e7eb015
127 changed files with 5657 additions and 1619 deletions
|
|
@ -1,6 +1,9 @@
|
|||
#include "StartPageLogic.h"
|
||||
#include "ViewConfigLogic.h"
|
||||
|
||||
#include "core/errorstrings.h"
|
||||
#include "configurators/ssh_configurator.h"
|
||||
#include "configurators/vpn_configurator.h"
|
||||
#include "../uilogic.h"
|
||||
#include "utilities.h"
|
||||
|
||||
|
|
@ -8,6 +11,7 @@
|
|||
#include <QStandardPaths>
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include <QtAndroid>
|
||||
#include "platforms/android/android_controller.h"
|
||||
#endif
|
||||
|
||||
|
|
@ -16,18 +20,20 @@ StartPageLogic::StartPageLogic(UiLogic *logic, QObject *parent):
|
|||
m_pushButtonConnectEnabled{true},
|
||||
m_pushButtonConnectText{tr("Connect")},
|
||||
m_pushButtonConnectKeyChecked{false},
|
||||
m_lineEditStartExistingCodeText{},
|
||||
m_textEditSshKeyText{},
|
||||
m_lineEditIpText{},
|
||||
m_lineEditPasswordText{},
|
||||
m_lineEditLoginText{},
|
||||
m_labelWaitInfoVisible{true},
|
||||
m_labelWaitInfoText{},
|
||||
m_pushButtonBackFromStartVisible{true},
|
||||
m_pushButtonConnectVisible{true},
|
||||
m_ipAddressPortRegex{Utils::ipAddressPortRegExp()}
|
||||
{
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
// Set security screen for Android app
|
||||
QtAndroid::runOnAndroidThread([]() {
|
||||
QAndroidJniObject window = QtAndroid::androidActivity().callObjectMethod("getWindow", "()Landroid/view/Window;");
|
||||
if (window.isValid()){
|
||||
const int FLAG_SECURE = 8192;
|
||||
window.callMethod<void>("addFlags", "(I)V", FLAG_SECURE);
|
||||
}
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
void StartPageLogic::onUpdatePage()
|
||||
|
|
@ -41,7 +47,6 @@ void StartPageLogic::onUpdatePage()
|
|||
|
||||
set_labelWaitInfoVisible(false);
|
||||
set_labelWaitInfoText("");
|
||||
set_pushButtonConnectVisible(true);
|
||||
|
||||
set_pushButtonConnectKeyChecked(false);
|
||||
|
||||
|
|
@ -50,8 +55,6 @@ void StartPageLogic::onUpdatePage()
|
|||
|
||||
void StartPageLogic::onPushButtonConnect()
|
||||
{
|
||||
// uiLogic()->goToPage(Page::NewServer);
|
||||
// return;
|
||||
if (pushButtonConnectKeyChecked()){
|
||||
if (lineEditIpText().isEmpty() ||
|
||||
lineEditLoginText().isEmpty() ||
|
||||
|
|
@ -68,7 +71,6 @@ void StartPageLogic::onPushButtonConnect()
|
|||
return;
|
||||
}
|
||||
}
|
||||
qDebug() << "UiLogic::onPushButtonConnect checking new server";
|
||||
|
||||
ServerCredentials serverCredentials;
|
||||
serverCredentials.hostName = lineEditIpText();
|
||||
|
|
@ -85,7 +87,7 @@ void StartPageLogic::onPushButtonConnect()
|
|||
}
|
||||
|
||||
if (key.contains("OPENSSH") && key.contains("BEGIN") && key.contains("PRIVATE KEY")) {
|
||||
key = SshConfigurator::convertOpenSShKey(key);
|
||||
key = m_configurator->sshConfigurator->convertOpenSShKey(key);
|
||||
}
|
||||
|
||||
serverCredentials.password = key;
|
||||
|
|
@ -99,7 +101,7 @@ void StartPageLogic::onPushButtonConnect()
|
|||
|
||||
ErrorCode e = ErrorCode::NoError;
|
||||
#ifdef Q_DEBUG
|
||||
//QString output = ServerController::checkSshConnection(serverCredentials, &e);
|
||||
//QString output = m_serverController->checkSshConnection(serverCredentials, &e);
|
||||
#else
|
||||
QString output;
|
||||
#endif
|
||||
|
|
@ -153,19 +155,10 @@ 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);
|
||||
|
||||
emit uiLogic()->goToPage(Page::Vpn);
|
||||
emit uiLogic()->setStartPage(Page::Vpn);
|
||||
// check config
|
||||
uiLogic()->pageLogic<ViewConfigLogic>()->set_configJson(profile);
|
||||
emit uiLogic()->goToPage(Page::ViewConfig);
|
||||
}
|
||||
else {
|
||||
qDebug() << "Failed to import profile";
|
||||
|
|
@ -174,8 +167,8 @@ bool StartPageLogic::importConnection(const QJsonObject &profile)
|
|||
}
|
||||
|
||||
if (!profile.contains(config_key::containers)) {
|
||||
uiLogic()->selectedServerIndex = m_settings.defaultServerIndex();
|
||||
uiLogic()->selectedDockerContainer = m_settings.defaultContainer(uiLogic()->selectedServerIndex);
|
||||
uiLogic()->selectedServerIndex = m_settings->defaultServerIndex();
|
||||
uiLogic()->selectedDockerContainer = m_settings->defaultContainer(uiLogic()->selectedServerIndex);
|
||||
uiLogic()->onUpdateAllPages();
|
||||
|
||||
emit uiLogic()->goToPage(Page::ServerContainers);
|
||||
|
|
@ -209,7 +202,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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue