mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 12:09:57 +00:00
refactor platform dependant code
This commit is contained in:
parent
60cefb3820
commit
e1359ace86
1 changed files with 24 additions and 20 deletions
42
main.cpp
42
main.cpp
|
@ -65,6 +65,11 @@
|
|||
#include "QrCodeScanner.h"
|
||||
#endif
|
||||
|
||||
bool isIOS = false;
|
||||
bool isAndroid = false;
|
||||
bool isWindows = false;
|
||||
bool isDesktop = false;
|
||||
|
||||
void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
||||
{
|
||||
// Send all message types to logger
|
||||
|
@ -73,6 +78,19 @@ void messageHandler(QtMsgType type, const QMessageLogContext &context, const QSt
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// platform dependant settings
|
||||
#if ! defined(Q_OS_ANDROID) && ! defined(Q_OS_IOS)
|
||||
bool isDesktop = true;
|
||||
#elif defined(Q_OS_ANDROID)
|
||||
bool isAndroid = true;
|
||||
#elif defined(Q_OS_IOS)
|
||||
bool isIOS = true;
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
bool isWindows = true;
|
||||
#endif
|
||||
|
||||
|
||||
Monero::Utils::onStartup();
|
||||
// // Enable high DPI scaling on windows & linux
|
||||
//#if !defined(Q_OS_ANDROID) && QT_VERSION >= 0x050600
|
||||
|
@ -92,8 +110,8 @@ int main(int argc, char *argv[])
|
|||
app.setOrganizationDomain("getmonero.org");
|
||||
app.setOrganizationName("monero-project");
|
||||
|
||||
#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
|
||||
app.setWindowIcon(QIcon(":/images/appicon.ico"));
|
||||
#if defined(Q_OS_LINUX)
|
||||
if (isDesktop) app.setWindowIcon(QIcon(":/images/appicon.ico"));
|
||||
#endif
|
||||
|
||||
filter *eventFilter = new filter;
|
||||
|
@ -169,7 +187,6 @@ int main(int argc, char *argv[])
|
|||
engine.rootContext()->setContextProperty("translationManager", TranslationManager::instance());
|
||||
|
||||
engine.addImageProvider(QLatin1String("qrcode"), new QRCodeImageProvider());
|
||||
const QStringList arguments = QCoreApplication::arguments();
|
||||
|
||||
engine.rootContext()->setContextProperty("mainApp", &app);
|
||||
|
||||
|
@ -177,6 +194,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Exclude daemon manager from IOS
|
||||
#ifndef Q_OS_IOS
|
||||
const QStringList arguments = QCoreApplication::arguments();
|
||||
DaemonManager * daemonManager = DaemonManager::instance(&arguments);
|
||||
engine.rootContext()->setContextProperty("daemonManager", daemonManager);
|
||||
#endif
|
||||
|
@ -186,25 +204,11 @@ int main(int argc, char *argv[])
|
|||
// to save the wallet file (.keys, .bin), they have to be user-accessible for
|
||||
// backups - I reckon we save that in My Documents\Monero Accounts\ on
|
||||
// Windows, ~/Monero Accounts/ on nix / osx
|
||||
bool isWindows = false;
|
||||
bool isIOS = false;
|
||||
bool isMac = false;
|
||||
bool isAndroid = false;
|
||||
#ifdef Q_OS_WIN
|
||||
isWindows = true;
|
||||
#if defined (Q_OS_WIN) || defined(Q_OS_IOS)
|
||||
QStringList moneroAccountsRootDir = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation);
|
||||
#elif defined(Q_OS_IOS)
|
||||
isIOS = true;
|
||||
QStringList moneroAccountsRootDir = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation);
|
||||
#elif defined(Q_OS_UNIX)
|
||||
#else
|
||||
QStringList moneroAccountsRootDir = QStandardPaths::standardLocations(QStandardPaths::HomeLocation);
|
||||
#endif
|
||||
#ifdef Q_OS_MAC
|
||||
isMac = true;
|
||||
#endif
|
||||
#ifdef Q_OS_ANDROID
|
||||
isAndroid = true;
|
||||
#endif
|
||||
|
||||
engine.rootContext()->setContextProperty("isWindows", isWindows);
|
||||
engine.rootContext()->setContextProperty("isIOS", isIOS);
|
||||
|
|
Loading…
Reference in a new issue