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