read imported file configuration
This commit is contained in:
parent
1800c1ff12
commit
9ed16b81e8
5 changed files with 126 additions and 3 deletions
|
@ -300,7 +300,9 @@ ios {
|
|||
platforms/ios/bigint.h \
|
||||
platforms/ios/bigintipv6addr.h \
|
||||
platforms/ios/ipaddress.h \
|
||||
platforms/ios/ipaddressrange.h
|
||||
platforms/ios/ipaddressrange.h \
|
||||
platforms/ios/QtAppDelegate.h \
|
||||
platforms/ios/QtAppDelegate-C-Interface.h
|
||||
|
||||
SOURCES -= \
|
||||
platforms/ios/QRCodeReader.cpp
|
||||
|
@ -312,7 +314,8 @@ ios {
|
|||
platforms/ios/iosglue.mm \
|
||||
platforms/ios/ipaddress.cpp \
|
||||
platforms/ios/ipaddressrange.cpp \
|
||||
platforms/ios/QRCodeReader.mm
|
||||
platforms/ios/QRCodeReader.mm \
|
||||
platforms/ios/QtAppDelegate.mm
|
||||
|
||||
Q_ENABLE_BITCODE.value = NO
|
||||
Q_ENABLE_BITCODE.name = ENABLE_BITCODE
|
||||
|
|
|
@ -57,6 +57,10 @@
|
|||
#include "native.h"
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_IOS)
|
||||
#include "QtAppDelegate-C-Interface.h"
|
||||
#endif
|
||||
|
||||
static void loadTranslator()
|
||||
{
|
||||
QTranslator* translator = new QTranslator;
|
||||
|
@ -88,7 +92,6 @@ int main(int argc, char *argv[])
|
|||
QApplication app(argc, argv);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
AllowSetForegroundWindow(0);
|
||||
#endif
|
||||
|
@ -97,6 +100,10 @@ int main(int argc, char *argv[])
|
|||
NativeHelpers::registerApplicationInstance(&app);
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_IOS)
|
||||
QtAppDelegateInitialize();
|
||||
#endif
|
||||
|
||||
loadTranslator();
|
||||
|
||||
QFontDatabase::addApplicationFont(":/fonts/Lato-Black.ttf");
|
||||
|
@ -203,6 +210,10 @@ int main(int argc, char *argv[])
|
|||
engine->rootContext()->setContextProperty("VpnLogic", uiLogic->vpnLogic());
|
||||
engine->rootContext()->setContextProperty("WizardLogic", uiLogic->wizardLogic());
|
||||
|
||||
#if defined(Q_OS_IOS)
|
||||
setStartPageLogic(uiLogic->startPageLogic());
|
||||
#endif
|
||||
|
||||
engine->load(url);
|
||||
|
||||
QObject::connect(&app, &QCoreApplication::aboutToQuit, uiLogic, [&engine, uiLogic](){
|
||||
|
|
9
client/platforms/ios/QtAppDelegate-C-Interface.h
Normal file
9
client/platforms/ios/QtAppDelegate-C-Interface.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
#ifndef QTAPPDELEGATECINTERFACE_H
|
||||
#define QTAPPDELEGATECINTERFACE_H
|
||||
|
||||
#include "ui/pages_logic/StartPageLogic.h"
|
||||
|
||||
void QtAppDelegateInitialize();
|
||||
void setStartPageLogic(StartPageLogic*);
|
||||
|
||||
#endif // QTAPPDELEGATECINTERFACE_H
|
9
client/platforms/ios/QtAppDelegate.h
Normal file
9
client/platforms/ios/QtAppDelegate.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
#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
|
91
client/platforms/ios/QtAppDelegate.mm
Normal file
91
client/platforms/ios/QtAppDelegate.mm
Normal file
|
@ -0,0 +1,91 @@
|
|||
#import "QtAppDelegate.h"
|
||||
|
||||
#include <QFile>
|
||||
|
||||
@implementation QtAppDelegate
|
||||
|
||||
+(QtAppDelegate *)sharedQtAppDelegate {
|
||||
static dispatch_once_t pred;
|
||||
static QtAppDelegate *shared = nil;
|
||||
dispatch_once(&pred, ^{
|
||||
shared = [[super alloc] init];
|
||||
});
|
||||
return shared;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
[application setMinimumBackgroundFetchInterval: UIApplicationBackgroundFetchIntervalMinimum];
|
||||
// Override point for customization after application launch.
|
||||
NSLog(@"Did this launch option happen");
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)applicationWillResignActive:(UIApplication *)application
|
||||
{
|
||||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
||||
}
|
||||
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application
|
||||
{
|
||||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
NSLog(@"In the background");
|
||||
}
|
||||
|
||||
- (void)applicationWillEnterForeground:(UIApplication *)application
|
||||
{
|
||||
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
|
||||
NSLog(@"In the foreground");
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application
|
||||
{
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(UIApplication *)application
|
||||
{
|
||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||||
}
|
||||
|
||||
-(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
|
||||
// We will add content here soon.
|
||||
NSLog(@"In the completionHandler");
|
||||
}
|
||||
|
||||
- (BOOL)application:(UIApplication *)app
|
||||
openURL:(NSURL *)url
|
||||
options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {
|
||||
|
||||
NSLog(@"Application openURL: %@", url);
|
||||
if (url.fileURL) {
|
||||
QString filePath(url.path.UTF8String);
|
||||
qDebug() << "filePath:" << filePath;
|
||||
if (filePath.isEmpty()) return NO;
|
||||
|
||||
QFile file(filePath);
|
||||
bool isOpenFile = file.open(QIODevice::ReadOnly);
|
||||
qDebug() << "isOpenFile:" << isOpenFile;
|
||||
QByteArray data = file.readAll();
|
||||
|
||||
[QtAppDelegate sharedQtAppDelegate].startPageLogic->importConnectionFromCode(QString(data));
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
void QtAppDelegateInitialize()
|
||||
{
|
||||
[[UIApplication sharedApplication] setDelegate: [QtAppDelegate sharedQtAppDelegate]];
|
||||
NSLog(@"Created a new AppDelegate");
|
||||
}
|
||||
|
||||
void setStartPageLogic(StartPageLogic* startPage) {
|
||||
[QtAppDelegate sharedQtAppDelegate].startPageLogic = startPage;
|
||||
}
|
||||
|
||||
@end
|
Loading…
Add table
Add a link
Reference in a new issue