Merge branch 'feature/new-gui' of github.com:amnezia-vpn/amnezia-client into feature/new-gui
This commit is contained in:
commit
7fc4ea0c68
12 changed files with 35 additions and 29 deletions
|
|
@ -21,7 +21,6 @@
|
||||||
#include "protocols/qml_register_protocols.h"
|
#include "protocols/qml_register_protocols.h"
|
||||||
|
|
||||||
#if defined(Q_OS_IOS)
|
#if defined(Q_OS_IOS)
|
||||||
#include "platforms/ios/QtAppDelegate-C-Interface.h"
|
|
||||||
#include "platforms/ios/ios_controller.h"
|
#include "platforms/ios/ios_controller.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -112,6 +111,10 @@ void AmneziaApplication::init()
|
||||||
|
|
||||||
#ifdef Q_OS_IOS
|
#ifdef Q_OS_IOS
|
||||||
IosController::Instance()->initialize();
|
IosController::Instance()->initialize();
|
||||||
|
connect(IosController::Instance(), &IosController::importConfigFromOutside, m_importController.get(),
|
||||||
|
&ImportController::extractConfigFromData);
|
||||||
|
connect(IosController::Instance(), &IosController::importConfigFromOutside, m_pageController.get(),
|
||||||
|
&PageController::goToPageViewConfig);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_notificationHandler.reset(NotificationHandler::create(nullptr));
|
m_notificationHandler.reset(NotificationHandler::create(nullptr));
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,8 @@ void FileUtilites::saveFile(QString fileName, const QString &data)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_IOS
|
#ifdef Q_OS_IOS
|
||||||
QFile file(fileName);
|
QUrl fileUrl = QDir::tempPath() + "/" + fileName;
|
||||||
|
QFile file(fileUrl.toString());
|
||||||
#else
|
#else
|
||||||
QUrl fileUrl = QUrl(fileName);
|
QUrl fileUrl = QUrl(fileName);
|
||||||
QFile file(fileUrl.toLocalFile());
|
QFile file(fileUrl.toLocalFile());
|
||||||
|
|
@ -35,22 +36,15 @@ void FileUtilites::saveFile(QString fileName, const QString &data)
|
||||||
file.write(data.toUtf8());
|
file.write(data.toUtf8());
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
#ifdef Q_OS_IOS
|
|
||||||
QStringList filesToSend;
|
|
||||||
filesToSend.append(fileName);
|
|
||||||
MobileUtils::shareText(filesToSend);
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Q_OS_IOS
|
#ifdef Q_OS_IOS
|
||||||
QStringList filesToSend;
|
QStringList filesToSend;
|
||||||
filesToSend.append(fileUrl.toString());
|
filesToSend.append(fileUrl.toString());
|
||||||
MobileUtils::shareText(filesToSend);
|
MobileUtils::shareText(filesToSend);
|
||||||
return;
|
return;
|
||||||
#endif
|
#else
|
||||||
|
|
||||||
QFileInfo fi(fileUrl.toLocalFile());
|
QFileInfo fi(fileUrl.toLocalFile());
|
||||||
QDesktopServices::openUrl(fi.absoluteDir().absolutePath());
|
QDesktopServices::openUrl(fi.absoluteDir().absolutePath());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FileUtilites::getFileName(QString fileName)
|
QString FileUtilites::getFileName(QString fileName)
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
#ifndef QTAPPDELEGATECINTERFACE_H
|
#ifndef QTAPPDELEGATECINTERFACE_H
|
||||||
#define QTAPPDELEGATECINTERFACE_H
|
#define QTAPPDELEGATECINTERFACE_H
|
||||||
|
|
||||||
#include "ui/pages_logic/StartPageLogic.h"
|
|
||||||
|
|
||||||
void QtAppDelegateInitialize();
|
void QtAppDelegateInitialize();
|
||||||
void setStartPageLogic(StartPageLogic*);
|
|
||||||
|
|
||||||
#endif // QTAPPDELEGATECINTERFACE_H
|
#endif // QTAPPDELEGATECINTERFACE_H
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,4 @@
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#import "QtAppDelegate-C-Interface.h"
|
|
||||||
|
|
||||||
#include "ui/pages_logic/StartPageLogic.h"
|
|
||||||
|
|
||||||
@interface QtAppDelegate : UIResponder <UIApplicationDelegate>
|
@interface QtAppDelegate : UIResponder <UIApplicationDelegate>
|
||||||
+(QtAppDelegate *)sharedQtAppDelegate;
|
|
||||||
@property (nonatomic) StartPageLogic* startPageLogic;
|
|
||||||
@end
|
@end
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#import "QtAppDelegate.h"
|
#import "QtAppDelegate.h"
|
||||||
|
#import "ios_controller.h"
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
|
|
@ -79,7 +80,7 @@
|
||||||
bool isOpenFile = file.open(QIODevice::ReadOnly);
|
bool isOpenFile = file.open(QIODevice::ReadOnly);
|
||||||
QByteArray data = file.readAll();
|
QByteArray data = file.readAll();
|
||||||
|
|
||||||
[QtAppDelegate sharedQtAppDelegate].startPageLogic->importAnyFile(QString(data));
|
IosController::Instance()->importConfigFromOutside(QString(data));
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
return NO;
|
return NO;
|
||||||
|
|
@ -92,8 +93,4 @@ void QtAppDelegateInitialize()
|
||||||
NSLog(@"Created a new AppDelegate");
|
NSLog(@"Created a new AppDelegate");
|
||||||
}
|
}
|
||||||
|
|
||||||
void setStartPageLogic(StartPageLogic* startPage) {
|
|
||||||
[QtAppDelegate sharedQtAppDelegate].startPageLogic = startPage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ public:
|
||||||
signals:
|
signals:
|
||||||
void connectionStateChanged(Vpn::ConnectionState state);
|
void connectionStateChanged(Vpn::ConnectionState state);
|
||||||
void bytesChanged(quint64 receivedBytes, quint64 sentBytes);
|
void bytesChanged(quint64 receivedBytes, quint64 sentBytes);
|
||||||
|
void importConfigFromOutside(const QString);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ void ImportController::extractConfigFromFile(const QString &fileName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportController::extractConfigFromData(QString &data)
|
void ImportController::extractConfigFromData(QString data)
|
||||||
{
|
{
|
||||||
auto configFormat = checkConfigFormat(data);
|
auto configFormat = checkConfigFormat(data);
|
||||||
if (configFormat == ConfigTypes::OpenVpn) {
|
if (configFormat == ConfigTypes::OpenVpn) {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void importConfig();
|
void importConfig();
|
||||||
void extractConfigFromFile(const QString &fileName);
|
void extractConfigFromFile(const QString &fileName);
|
||||||
void extractConfigFromData(QString &data);
|
void extractConfigFromData(QString data);
|
||||||
void extractConfigFromCode(QString code);
|
void extractConfigFromCode(QString code);
|
||||||
bool extractConfigFromQr(const QByteArray &data);
|
bool extractConfigFromQr(const QByteArray &data);
|
||||||
QString getConfig();
|
QString getConfig();
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
#ifndef OSXUTIL_H
|
#ifndef OSXUTIL_H
|
||||||
#define OSXUTIL_H
|
#define OSXUTIL_H
|
||||||
|
|
||||||
|
#ifndef Q_OS_IOS
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
void setDockIconVisible(bool visible);
|
void setDockIconVisible(bool visible);
|
||||||
void fixWidget(QWidget *widget);
|
void fixWidget(QWidget *widget);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,13 @@ DrawerType {
|
||||||
text: qsTr("Share")
|
text: qsTr("Share")
|
||||||
imageSource: "qrc:/images/controls/share-2.svg"
|
imageSource: "qrc:/images/controls/share-2.svg"
|
||||||
|
|
||||||
onClicked: fileDialog.open()
|
onClicked: {
|
||||||
|
if (Qt.platform.os === "ios") {
|
||||||
|
ExportController.saveFile("amnezia_config.vpn")
|
||||||
|
} else {
|
||||||
|
fileDialog.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FileDialog {
|
FileDialog {
|
||||||
id: fileDialog
|
id: fileDialog
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,13 @@ PageType {
|
||||||
|
|
||||||
image: "qrc:/images/controls/save.svg"
|
image: "qrc:/images/controls/save.svg"
|
||||||
|
|
||||||
onClicked: fileDialog.open()
|
onClicked: {
|
||||||
|
if (Qt.platform.os === "ios") {
|
||||||
|
SettingsController.exportLogsFile("AmneziaVPN.log")
|
||||||
|
} else {
|
||||||
|
fileDialog.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FileDialog {
|
FileDialog {
|
||||||
id: fileDialog
|
id: fileDialog
|
||||||
|
|
|
||||||
|
|
@ -302,8 +302,12 @@ PageType {
|
||||||
text: qsTr("Save site list")
|
text: qsTr("Save site list")
|
||||||
|
|
||||||
clickedFunction: function() {
|
clickedFunction: function() {
|
||||||
|
if (Qt.platform.os === "ios") {
|
||||||
|
ExportController.saveFile("amezia_tunnel.json")
|
||||||
|
} else {
|
||||||
saveFileDialog.open()
|
saveFileDialog.open()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FileDialog {
|
FileDialog {
|
||||||
id: saveFileDialog
|
id: saveFileDialog
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue