diff --git a/main.cpp b/main.cpp index 83e48546..63740cbf 100644 --- a/main.cpp +++ b/main.cpp @@ -47,13 +47,17 @@ #include "TransactionHistory.h" #include "model/TransactionHistoryModel.h" #include "model/TransactionHistorySortFilterModel.h" -#include "daemon/DaemonManager.h" #include "AddressBook.h" #include "model/AddressBookModel.h" +// IOS exclusions +#ifndef Q_OS_IOS +#include "daemon/DaemonManager.h" +#endif int main(int argc, char *argv[]) { + QApplication app(argc, argv); qDebug() << "app startd"; @@ -96,10 +100,10 @@ int main(int argc, char *argv[]) qmlRegisterUncreatableType("moneroComponents.TransactionInfo", 1, 0, "TransactionInfo", "TransactionHistory can't be instantiated directly"); - +#ifndef Q_OS_IOS qmlRegisterUncreatableType("moneroComponents.DaemonManager", 1, 0, "DaemonManager", "DaemonManager can't be instantiated directly"); - +#endif qmlRegisterUncreatableType("moneroComponents.AddressBookModel", 1, 0, "AddressBookModel", "AddressBookModel can't be instantiated directly"); @@ -125,9 +129,13 @@ int main(int argc, char *argv[]) engine.addImageProvider(QLatin1String("qrcode"), new QRCodeImageProvider()); const QStringList arguments = QCoreApplication::arguments(); + +// Exclude daemon manager from IOS +#ifndef Q_OS_IOS DaemonManager * daemonManager = DaemonManager::instance(&arguments); QObject::connect(&app, SIGNAL(aboutToQuit()), daemonManager, SLOT(closing())); engine.rootContext()->setContextProperty("daemonManager", daemonManager); +#endif // export to QML monero accounts root directory // wizard is talking about where @@ -135,13 +143,18 @@ int main(int argc, char *argv[]) // backups - I reckon we save that in My Documents\Monero Accounts\ on // Windows, ~/Monero Accounts/ on nix / osx bool isWindows = false; + bool isIOS = false; #ifdef Q_OS_WIN isWindows = true; QStringList moneroAccountsRootDir = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation); +#elif defined(Q_OS_IOS) + isIOS = true; + QStringList moneroAccountsRootDir = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation); #elif defined(Q_OS_UNIX) QStringList moneroAccountsRootDir = QStandardPaths::standardLocations(QStandardPaths::HomeLocation); #endif engine.rootContext()->setContextProperty("isWindows", isWindows); + engine.rootContext()->setContextProperty("isIOS", isIOS); if (!moneroAccountsRootDir.empty()) { QString moneroAccountsDir = moneroAccountsRootDir.at(0) + "/Monero/wallets"; @@ -160,6 +173,8 @@ int main(int argc, char *argv[]) engine.rootContext()->setContextProperty("defaultAccountName", accountName); engine.rootContext()->setContextProperty("applicationDirectory", QApplication::applicationDirPath()); + + // Load main window (context properties needs to be defined obove this line) engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); QObject *rootObject = engine.rootObjects().first(); @@ -168,8 +183,6 @@ int main(int argc, char *argv[]) QObject::connect(eventFilter, SIGNAL(mousePressed(QVariant,QVariant,QVariant)), rootObject, SLOT(mousePressed(QVariant,QVariant,QVariant))); QObject::connect(eventFilter, SIGNAL(mouseReleased(QVariant,QVariant,QVariant)), rootObject, SLOT(mouseReleased(QVariant,QVariant,QVariant))); - //WalletManager::instance()->setLogLevel(WalletManager::LogLevel_Max); - bool builtWithScanner = false; #ifdef WITH_SCANNER builtWithScanner = true; diff --git a/monero-wallet-gui.pro b/monero-wallet-gui.pro index 3066a296..902a99b3 100644 --- a/monero-wallet-gui.pro +++ b/monero-wallet-gui.pro @@ -34,7 +34,6 @@ HEADERS += \ src/QR-Code-generator/BitBuffer.hpp \ src/QR-Code-generator/QrCode.hpp \ src/QR-Code-generator/QrSegment.hpp \ - src/daemon/DaemonManager.h \ src/model/AddressBookModel.h \ src/libwalletqt/AddressBook.h \ src/zxcvbn-c/zxcvbn.h \ @@ -58,13 +57,17 @@ SOURCES += main.cpp \ src/QR-Code-generator/BitBuffer.cpp \ src/QR-Code-generator/QrCode.cpp \ src/QR-Code-generator/QrSegment.cpp \ - src/daemon/DaemonManager.cpp \ src/model/AddressBookModel.cpp \ src/libwalletqt/AddressBook.cpp \ src/zxcvbn-c/zxcvbn.c \ src/libwalletqt/UnsignedTransaction.cpp \ src/QR-Code-scanner/QrCodeScanner.cpp +!ios { + HEADERS += src/daemon/DaemonManager.h + SOURCES += src/daemon/DaemonManager.cpp +} + lupdate_only { SOURCES = *.qml \ components/*.qml \ @@ -73,10 +76,49 @@ SOURCES = *.qml \ wizard/*js } + +ios:armv7 { + message("target is armv7") + LIBS += \ + -L$$PWD/ofxiOSBoost/build/libs/boost/lib/armv7 \ +} +ios:arm64 { + message("target is arm64") + LIBS += \ + -L$$PWD/ofxiOSBoost/build/libs/boost/lib/arm64 \ +} +!ios { LIBS += -L$$WALLET_ROOT/lib \ -lwallet_merged \ - $$WALLET_ROOT/build/release/contrib/epee/src/libepee.a \ + -lepee \ -lunbound +} + +ios { + message("Host is IOS") + + QMAKE_LFLAGS += -v + QMAKE_IOS_DEVICE_ARCHS = arm64 + CONFIG += arm64 + LIBS += -L$$WALLET_ROOT/lib-ios \ + -lwallet_merged \ + -lepee \ + -lunbound + + LIBS+= \ + -L$$PWD/OpenSSL-for-iPhone/lib \ + -lboost_serialization \ + -lboost_thread \ + -lboost_system \ + -lboost_date_time \ + -lboost_filesystem \ + -lboost_regex \ + -lboost_chrono \ + -lboost_program_options \ + -lssl \ + -lcrypto \ + -ldl +} CONFIG(WITH_SCANNER) { if( greaterThan(QT_MINOR_VERSION, 5) ) { @@ -95,6 +137,7 @@ CONFIG(WITH_SCANNER) { } } + # currently we only support x86 build as qt.io only provides prebuilt qt for x86 mingw win32 { @@ -153,7 +196,7 @@ win32 { linux { CONFIG(static) { message("using static libraries") - LIBS+= -Wl,-Bstatic + LIBS+= -Wl,-Bstatic } LIBS+= \ -lboost_serialization \ @@ -242,32 +285,36 @@ macx { } +!ios { + isEmpty(QMAKE_LUPDATE) { + win32:LANGUPD = $$[QT_INSTALL_BINS]\lupdate.exe + else:LANGUPD = $$[QT_INSTALL_BINS]/lupdate + } -isEmpty(QMAKE_LUPDATE) { - win32:LANGUPD = $$[QT_INSTALL_BINS]\lupdate.exe - else:LANGUPD = $$[QT_INSTALL_BINS]/lupdate + isEmpty(QMAKE_LRELEASE) { + win32:LANGREL = $$[QT_INSTALL_BINS]\lrelease.exe + else:LANGREL = $$[QT_INSTALL_BINS]/lrelease + } + + langupd.command = \ + $$LANGUPD $$LANGUPD_OPTIONS $$shell_path($$_PRO_FILE) -ts $$_PRO_FILE_PWD/$$TRANSLATIONS + + + + langrel.depends = langupd + langrel.input = TRANSLATIONS + langrel.output = $$TRANSLATION_TARGET_DIR/${QMAKE_FILE_BASE}.qm + langrel.commands = \ + $$LANGREL $$LANGREL_OPTIONS ${QMAKE_FILE_IN} -qm $$TRANSLATION_TARGET_DIR/${QMAKE_FILE_BASE}.qm + langrel.CONFIG += no_link + + QMAKE_EXTRA_TARGETS += langupd deploy deploy_win + QMAKE_EXTRA_COMPILERS += langrel } -isEmpty(QMAKE_LRELEASE) { - win32:LANGREL = $$[QT_INSTALL_BINS]\lrelease.exe - else:LANGREL = $$[QT_INSTALL_BINS]/lrelease -} - -langupd.command = \ - $$LANGUPD $$LANGUPD_OPTIONS $$shell_path($$_PRO_FILE) -ts $$_PRO_FILE_PWD/$$TRANSLATIONS -langrel.depends = langupd -langrel.input = TRANSLATIONS -langrel.output = $$TRANSLATION_TARGET_DIR/${QMAKE_FILE_BASE}.qm -langrel.commands = \ - $$LANGREL $$LANGREL_OPTIONS ${QMAKE_FILE_IN} -qm $$TRANSLATION_TARGET_DIR/${QMAKE_FILE_BASE}.qm -langrel.CONFIG += no_link - -QMAKE_EXTRA_TARGETS += langupd deploy deploy_win -QMAKE_EXTRA_COMPILERS += langrel - # Update: no issues with the "slow link process" anymore,