1
mirror of https://github.com/monero-project/monero-gui synced 2024-12-23 02:52:58 +01:00

IOS specific settings

This commit is contained in:
Jaquee 2017-01-29 19:51:20 +01:00
parent c6dc9a20e7
commit 78302be193
No known key found for this signature in database
GPG Key ID: 384E52B09F45DC39

View File

@ -47,13 +47,17 @@
#include "TransactionHistory.h" #include "TransactionHistory.h"
#include "model/TransactionHistoryModel.h" #include "model/TransactionHistoryModel.h"
#include "model/TransactionHistorySortFilterModel.h" #include "model/TransactionHistorySortFilterModel.h"
#include "daemon/DaemonManager.h"
#include "AddressBook.h" #include "AddressBook.h"
#include "model/AddressBookModel.h" #include "model/AddressBookModel.h"
// IOS exclusions
#ifndef Q_OS_IOS
#include "daemon/DaemonManager.h"
#endif
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication app(argc, argv); QApplication app(argc, argv);
qDebug() << "app startd"; qDebug() << "app startd";
@ -96,10 +100,10 @@ int main(int argc, char *argv[])
qmlRegisterUncreatableType<TransactionInfo>("moneroComponents.TransactionInfo", 1, 0, "TransactionInfo", qmlRegisterUncreatableType<TransactionInfo>("moneroComponents.TransactionInfo", 1, 0, "TransactionInfo",
"TransactionHistory can't be instantiated directly"); "TransactionHistory can't be instantiated directly");
#ifndef Q_OS_IOS
qmlRegisterUncreatableType<DaemonManager>("moneroComponents.DaemonManager", 1, 0, "DaemonManager", qmlRegisterUncreatableType<DaemonManager>("moneroComponents.DaemonManager", 1, 0, "DaemonManager",
"DaemonManager can't be instantiated directly"); "DaemonManager can't be instantiated directly");
#endif
qmlRegisterUncreatableType<AddressBookModel>("moneroComponents.AddressBookModel", 1, 0, "AddressBookModel", qmlRegisterUncreatableType<AddressBookModel>("moneroComponents.AddressBookModel", 1, 0, "AddressBookModel",
"AddressBookModel can't be instantiated directly"); "AddressBookModel can't be instantiated directly");
@ -125,9 +129,13 @@ int main(int argc, char *argv[])
engine.addImageProvider(QLatin1String("qrcode"), new QRCodeImageProvider()); engine.addImageProvider(QLatin1String("qrcode"), new QRCodeImageProvider());
const QStringList arguments = QCoreApplication::arguments(); const QStringList arguments = QCoreApplication::arguments();
// Exclude daemon manager from IOS
#ifndef Q_OS_IOS
DaemonManager * daemonManager = DaemonManager::instance(&arguments); DaemonManager * daemonManager = DaemonManager::instance(&arguments);
QObject::connect(&app, SIGNAL(aboutToQuit()), daemonManager, SLOT(closing())); QObject::connect(&app, SIGNAL(aboutToQuit()), daemonManager, SLOT(closing()));
engine.rootContext()->setContextProperty("daemonManager", daemonManager); engine.rootContext()->setContextProperty("daemonManager", daemonManager);
#endif
// export to QML monero accounts root directory // export to QML monero accounts root directory
// wizard is talking about where // 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 // backups - I reckon we save that in My Documents\Monero Accounts\ on
// Windows, ~/Monero Accounts/ on nix / osx // Windows, ~/Monero Accounts/ on nix / osx
bool isWindows = false; bool isWindows = false;
bool isIOS = false;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
isWindows = true; isWindows = true;
QStringList moneroAccountsRootDir = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation); QStringList moneroAccountsRootDir = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation);
#elif defined(Q_OS_IOS)
isIOS = true;
QStringList moneroAccountsRootDir = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation);
#elif defined(Q_OS_UNIX) #elif defined(Q_OS_UNIX)
QStringList moneroAccountsRootDir = QStandardPaths::standardLocations(QStandardPaths::HomeLocation); QStringList moneroAccountsRootDir = QStandardPaths::standardLocations(QStandardPaths::HomeLocation);
#endif #endif
engine.rootContext()->setContextProperty("isWindows", isWindows); engine.rootContext()->setContextProperty("isWindows", isWindows);
engine.rootContext()->setContextProperty("isIOS", isIOS);
if (!moneroAccountsRootDir.empty()) { if (!moneroAccountsRootDir.empty()) {
QString moneroAccountsDir = moneroAccountsRootDir.at(0) + "/Monero/wallets"; 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("defaultAccountName", accountName);
engine.rootContext()->setContextProperty("applicationDirectory", QApplication::applicationDirPath()); 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"))); engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
QObject *rootObject = engine.rootObjects().first(); 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(mousePressed(QVariant,QVariant,QVariant)), rootObject, SLOT(mousePressed(QVariant,QVariant,QVariant)));
QObject::connect(eventFilter, SIGNAL(mouseReleased(QVariant,QVariant,QVariant)), rootObject, SLOT(mouseReleased(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; bool builtWithScanner = false;
#ifdef WITH_SCANNER #ifdef WITH_SCANNER
builtWithScanner = true; builtWithScanner = true;