diff options
Diffstat (limited to 'src/main')
| -rw-r--r-- | src/main/main.cpp | 28 | ||||
| -rw-r--r-- | src/main/oshelper.cpp | 11 |
2 files changed, 17 insertions, 22 deletions
diff --git a/src/main/main.cpp b/src/main/main.cpp index b0404165..90bd5106 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -38,6 +38,9 @@ #include <QScreen> #include <QRegExp> #include <QThread> + +#include <version.h> + #include "clipboardAdapter.h" #include "filter.h" #include "oscursor.h" @@ -255,6 +258,8 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw QCommandLineOption disableCheckUpdatesOption("disable-check-updates", "Disable automatic check for updates."); parser.addOption(disableCheckUpdatesOption); + QCommandLineOption socksProxyOption("socks5-proxy", "Enable socks5 proxy. Used for remote node connection (advanced mode), updates downloading and fetching price sources.", "address:port"); + parser.addOption(socksProxyOption); QCommandLineOption testQmlOption("test-qml"); testQmlOption.setFlags(QCommandLineOption::HiddenFromHelp); parser.addOption(logPathOption); @@ -360,6 +365,9 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw // registering types for QML qmlRegisterType<clipboardAdapter>("moneroComponents.Clipboard", 1, 0, "Clipboard"); qmlRegisterType<Downloader>("moneroComponents.Downloader", 1, 0, "Downloader"); + qmlRegisterType<Network>("moneroComponents.Network", 1, 0, "Network"); + qmlRegisterType<WalletKeysFilesModel>("moneroComponents.WalletKeysFilesModel", 1, 0, "WalletKeysFilesModel"); + qmlRegisterType<WalletManager>("moneroComponents.WalletManager", 1, 0, "WalletManager"); // Temporary Qt.labs.settings replacement qmlRegisterType<MoneroSettings>("moneroComponents.Settings", 1, 0, "MoneroSettings"); @@ -373,15 +381,9 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw qmlRegisterUncreatableType<UnsignedTransaction>("moneroComponents.UnsignedTransaction", 1, 0, "UnsignedTransaction", "UnsignedTransaction can't be instantiated directly"); - qmlRegisterUncreatableType<WalletManager>("moneroComponents.WalletManager", 1, 0, "WalletManager", - "WalletManager can't be instantiated directly"); - qmlRegisterUncreatableType<TranslationManager>("moneroComponents.TranslationManager", 1, 0, "TranslationManager", "TranslationManager can't be instantiated directly"); - qmlRegisterUncreatableType<WalletKeysFilesModel>("moneroComponents.walletKeysFilesModel", 1, 0, "WalletKeysFilesModel", - "walletKeysFilesModel can't be instantiated directly"); - qmlRegisterUncreatableType<TransactionHistoryModel>("moneroComponents.TransactionHistoryModel", 1, 0, "TransactionHistoryModel", "TransactionHistoryModel can't be instantiated directly"); @@ -440,10 +442,6 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw engine.rootContext()->setContextProperty("moneroAccountsDir", moneroAccountsDir); - WalletManager *walletManager = WalletManager::instance(); - - engine.rootContext()->setContextProperty("walletManager", walletManager); - engine.rootContext()->setContextProperty("translationManager", TranslationManager::instance()); engine.addImageProvider(QLatin1String("qrcode"), new QRCodeImageProvider()); @@ -481,11 +479,6 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw engine.rootContext()->setContextProperty("desktopFolder", desktopFolder); #endif - // Wallet .keys files model (wizard -> open wallet) - WalletKeysFilesModel walletKeysFilesModel; - engine.rootContext()->setContextProperty("walletKeysFilesModel", &walletKeysFilesModel); - engine.rootContext()->setContextProperty("walletKeysFilesModelProxy", &walletKeysFilesModel.proxyModel()); - // Get default account name QString accountName = qgetenv("USER"); // mac/linux if (accountName.isEmpty()) @@ -498,6 +491,8 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw engine.rootContext()->setContextProperty("applicationDirectory", QApplication::applicationDirPath()); engine.rootContext()->setContextProperty("idealThreadCount", QThread::idealThreadCount()); engine.rootContext()->setContextProperty("disableCheckUpdatesFlag", parser.isSet(disableCheckUpdatesOption)); + engine.rootContext()->setContextProperty("socksProxyFlag", parser.value(socksProxyOption)); + engine.rootContext()->setContextProperty("socksProxyFlagSet", parser.isSet(socksProxyOption)); bool builtWithScanner = false; #ifdef WITH_SCANNER @@ -505,8 +500,7 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw #endif engine.rootContext()->setContextProperty("builtWithScanner", builtWithScanner); - Network network; - engine.rootContext()->setContextProperty("Network", &network); + engine.rootContext()->setContextProperty("moneroVersion", MONERO_VERSION_FULL); // Load main window (context properties needs to be defined obove this line) engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); diff --git a/src/main/oshelper.cpp b/src/main/oshelper.cpp index c4923f35..9b24262e 100644 --- a/src/main/oshelper.cpp +++ b/src/main/oshelper.cpp @@ -41,7 +41,7 @@ #include "qt/macoshelper.h" #endif #ifdef Q_OS_WIN -#include <Shlobj.h> +#include <shlobj.h> #include <windows.h> #endif #if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) @@ -92,22 +92,23 @@ QString OSHelper::downloadLocation() const bool OSHelper::openContainingFolder(const QString &filePath) const { + QString canonicalFilePath = QFileInfo(filePath).canonicalFilePath(); #if defined(Q_OS_WIN) - if (openFolderAndSelectItem(QDir::toNativeSeparators(filePath))) + if (openFolderAndSelectItem(QDir::toNativeSeparators(canonicalFilePath))) { return true; } #elif defined(Q_OS_MAC) - if (MacOSHelper::openFolderAndSelectItem(QUrl::fromLocalFile(filePath))) + if (MacOSHelper::openFolderAndSelectItem(QUrl::fromLocalFile(canonicalFilePath))) { return true; } #endif - QUrl url = QUrl::fromLocalFile(QFileInfo(filePath).absolutePath()); + QUrl url = QUrl::fromLocalFile(canonicalFilePath); if (!url.isValid()) { - qWarning() << "Malformed file path" << filePath << url.errorString(); + qWarning() << "Malformed file path" << canonicalFilePath << url.errorString(); return false; } return QDesktopServices::openUrl(url); |
