aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2019-12-09 07:52:41 -0600
committerluigi1111 <luigi1111w@gmail.com>2019-12-09 07:52:41 -0600
commit1cee81b99604b1a7fa6683f18141709e3a1056ba (patch)
tree0b08f24675130be921b6899c89f3e0afec1e19c3 /src
parentf03ea0461c3a9ae897e44af64ac6caf2cc92b9c9 (diff)
parent97a9ac9bf8214207e2d0f6aa8b60a19797ee174e (diff)
downloadmonzero-gui-1cee81b99604b1a7fa6683f18141709e3a1056ba.tar.gz
monzero-gui-1cee81b99604b1a7fa6683f18141709e3a1056ba.tar.xz
monzero-gui-1cee81b99604b1a7fa6683f18141709e3a1056ba.zip
Merge pull request #2404
8dd2a20 e04db92 d06ae80 c83c74d 1723d04 52182ef 97a9ac9 2d23917 91aff7c (TheCharlatan)
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt159
-rw-r--r--src/QR-Code-generator/CMakeLists.txt4
-rw-r--r--src/QR-Code-scanner/CMakeLists.txt4
-rw-r--r--src/TranslationManager.cpp101
-rw-r--r--src/TranslationManager.h57
-rw-r--r--src/daemon/CMakeLists.txt4
-rw-r--r--src/libwalletqt/CMakeLists.txt4
-rw-r--r--src/main/Logger.cpp100
-rw-r--r--src/main/Logger.h36
-rw-r--r--src/main/MainApp.cpp43
-rw-r--r--src/main/MainApp.h46
-rw-r--r--src/main/clipboardAdapter.cpp44
-rw-r--r--src/main/clipboardAdapter.h48
-rw-r--r--src/main/filter.cpp152
-rw-r--r--src/main/filter.h55
-rw-r--r--src/main/main.cpp483
-rw-r--r--src/main/oscursor.cpp38
-rw-r--r--src/main/oscursor.h53
-rw-r--r--src/main/oshelper.cpp99
-rw-r--r--src/main/oshelper.h52
-rw-r--r--src/main/qml.qrc255
-rw-r--r--src/model/CMakeLists.txt4
-rw-r--r--src/version.js.in3
-rw-r--r--src/zxcvbn-c/CMakeLists.txt4
24 files changed, 1848 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 00000000..9c66a15c
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,159 @@
+add_subdirectory(QR-Code-generator)
+add_subdirectory(QR-Code-scanner)
+add_subdirectory(daemon)
+add_subdirectory(libwalletqt)
+add_subdirectory(model)
+add_subdirectory(zxcvbn-c)
+
+qt5_add_resources(QML_QRC ../qml.qrc)
+
+# Compile source files (.h/.cpp)
+file(GLOB SOURCE_FILES
+ "*.h"
+ "*.cpp"
+ "main/*.h"
+ "main/*.cpp"
+ "libwalletqt/WalletManager.cpp"
+ "libwalletqt/Wallet.cpp"
+ "libwalletqt/PendingTransaction.cpp"
+ "libwalletqt/TransactionHistory.cpp"
+ "libwalletqt/TransactionInfo.cpp"
+ "libwalletqt/QRCodeImageProvider.cpp" QR
+ "QR-Code-generator/BitBuffer.cpp"
+ "QR-Code-generator/QrCode.cpp"
+ "QR-Code-generator/QrSegment.cpp"
+ "libwalletqt/AddressBook.cpp"
+ "libwalletqt/Subaddress.cpp"
+ "libwalletqt/SubaddressAccount.cpp"
+ "libwalletqt/UnsignedTransaction.cpp"
+ "libwalletqt/WalletManager.h"
+ "libwalletqt/Wallet.h"
+ "libwalletqt/PendingTransaction.h"
+ "libwalletqt/TransactionHistory.h"
+ "libwalletqt/TransactionInfo.h"
+ "libwalletqt/QRCodeImageProvider.h"
+ "QR-Code-generator/BitBuffer.h"
+ "QR-Code-generator/QrCode.h"
+ "QR-Code-generator/QrSegment.h"
+ "libwalletqt/Transfer.h"
+ "libwalletqt/AddressBook.h"
+ "libwalletqt/Subaddress.h"
+ "libwalletqt/SubaddressAccount.h"
+ "libwalletqt/UnsignedTransaction.h"
+ "daemon/*.h"
+ "daemon/*.cpp"
+ "model/*.h"
+ "model/*.cpp"
+ "qt/*.h"
+ "qt/*.cpp"
+)
+
+if(ENABLE_PASS_STRENGTH_METER)
+ file(GLOB PASS_STRENGTH_FILES
+ "zxcvbn-c/zxcvbn.h"
+ "zxcvbn-c/zxcvbn.c"
+ )
+endif()
+
+if(WITH_SCANNER)
+ file(GLOB QR_CODE_FILES
+ "QR-Code-generator/*.h"
+ "QR-Code-generator/*.cpp"
+ "QR-Code-scanner/*.h"
+ "QR-Code-scanner/*.cpp"
+ )
+endif()
+
+message(STATUS ${QML_QRC})
+
+set(EXECUTABLE_FLAG)
+if(MINGW)
+ set(EXECUTABLE_FLAG WIN32)
+endif()
+
+add_executable(monero-gui ${EXECUTABLE_FLAG} main/main.cpp
+ ${SOURCE_FILES}
+ ${PASS_STRENGTH_FILES}
+ ${QR_CODE_FILES}
+ ${QML_QRC}
+)
+set_property(TARGET monero-gui PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
+
+# OpenGL
+target_include_directories(monero-gui PUBLIC ${OPENGL_INCLUDE_DIR})
+message(STATUS "OpenGL: include dir at ${OPENGL_INCLUDE_DIR}")
+message(STATUS "OpenGL: libraries at ${OPENGL_LIBRARIES}")
+
+target_include_directories(monero-gui PUBLIC ${Qt5Gui_PRIVATE_INCLUDE_DIRS})
+
+file(GLOB_RECURSE SRC_SOURCES *.cpp)
+file(GLOB_RECURSE SRC_HEADERS *.h)
+
+target_include_directories(monero-gui PUBLIC
+ ${CMAKE_SOURCE_DIR}/monero/include
+ ${CMAKE_SOURCE_DIR}/monero/src
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/daemon
+ ${CMAKE_CURRENT_SOURCE_DIR}/libwalletqt
+ ${CMAKE_CURRENT_SOURCE_DIR}/model
+ ${CMAKE_CURRENT_SOURCE_DIR}/QR-Code-generator
+ ${CMAKE_CURRENT_SOURCE_DIR}/QR-Code-scanner
+ ${CMAKE_CURRENT_SOURCE_DIR}/zxcvbn-c
+ ${LibUSB_INCLUDE_DIRS}
+ ${HIDAPI_INCLUDE_DIRS}
+ ${X11_INCLUDE_DIR}
+ ${Boost_INCLUDE_DIRS}
+ ${OPENSSL_INCLUDE_DIR}
+ ${ZBAR_INCLUDE_DIR}
+)
+
+target_compile_definitions(monero-gui
+ PUBLIC
+ ${Qt5Widgets_DEFINITIONS}
+ ${Qt5Qml_DEFINITIONS}
+)
+
+set(CMAKE_CXX_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
+set(CMAKE_CXX_FLAGS "-std=c++0x")
+
+if(X11_FOUND)
+ target_link_libraries(monero-gui ${X11_LIBRARIES} pthread dl Xt xcb X11)
+endif()
+
+if(DEVICE_TREZOR_READY)
+ target_link_libraries(monero-gui ${TREZOR_DEP_LIBS})
+endif()
+
+target_link_libraries(monero-gui
+ ${CMAKE_BINARY_DIR}/lib/libwallet_merged.a
+ ${LMDB_LIBRARY}
+ ${CMAKE_BINARY_DIR}/monero/contrib/epee/src/libepee.a
+ ${CMAKE_BINARY_DIR}/monero/external/unbound/libunbound.a
+ ${SODIUM_LIBRARY}
+ ${CMAKE_BINARY_DIR}/monero/external/easylogging++/libeasylogging.a
+ ${CMAKE_BINARY_DIR}/monero/src/blockchain_db/libblockchain_db.a
+ ${CMAKE_BINARY_DIR}/monero/external/randomx/librandomx.a
+ ${CMAKE_BINARY_DIR}/monero/src/hardforks/libhardforks.a
+ ${Boost_LIBRARIES}
+ ${OPENSSL_LIBRARIES}
+ ${CMAKE_DL_LIBS}
+ ${LibUSB_LIBRARIES}
+ ${HIDAPI_LIBRARIES}
+ ${QT5_LIBRARIES}
+ ${EXTRA_LIBRARIES}
+ ${ICU_LIBRARIES}
+)
+
+if(WITH_SCANNER)
+ target_link_libraries(monero-gui
+ ${ZBAR_LIBRARIES}
+ jpeg
+ v4l2
+ v4lconvert
+ rt
+ )
+endif()
+
+install(TARGETS monero-gui
+ DESTINATION ${CMAKE_INSTALL_PREFIX}
+)
diff --git a/src/QR-Code-generator/CMakeLists.txt b/src/QR-Code-generator/CMakeLists.txt
new file mode 100644
index 00000000..9ca31c61
--- /dev/null
+++ b/src/QR-Code-generator/CMakeLists.txt
@@ -0,0 +1,4 @@
+file(GLOB_RECURSE SRC_SOURCES *.cpp)
+file(GLOB_RECURSE SRC_HEADERS *.h)
+
+
diff --git a/src/QR-Code-scanner/CMakeLists.txt b/src/QR-Code-scanner/CMakeLists.txt
new file mode 100644
index 00000000..9ca31c61
--- /dev/null
+++ b/src/QR-Code-scanner/CMakeLists.txt
@@ -0,0 +1,4 @@
+file(GLOB_RECURSE SRC_SOURCES *.cpp)
+file(GLOB_RECURSE SRC_HEADERS *.h)
+
+
diff --git a/src/TranslationManager.cpp b/src/TranslationManager.cpp
new file mode 100644
index 00000000..377ed158
--- /dev/null
+++ b/src/TranslationManager.cpp
@@ -0,0 +1,101 @@
+// Copyright (c) 2014-2019, The Monero Project
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "TranslationManager.h"
+
+#include <QApplication>
+#include <QTranslator>
+#include <QDir>
+#include <QDebug>
+#include <QFileInfo>
+
+
+TranslationManager * TranslationManager::m_instance = nullptr;
+
+
+TranslationManager::TranslationManager(QObject *parent) : QObject(parent)
+{
+ m_translator = new QTranslator(this);
+}
+
+bool TranslationManager::setLanguage(const QString &language)
+{
+ qDebug() << __FUNCTION__ << " " << language;
+ // if language is "en", remove translator
+ if (language.toLower() == "en") {
+ qApp->removeTranslator(m_translator);
+ emit languageChanged();
+ return true;
+ }
+
+ QString dir = qApp->applicationDirPath() + "/translations";
+ QString filename = "monero-core_" + language;
+
+ qDebug("%s: loading translation file '%s' from '%s'",
+ __FUNCTION__, qPrintable(filename), qPrintable(dir));
+
+ if (m_translator->load(filename, dir)) {
+ qDebug("%s: translation for language '%s' loaded successfully",
+ __FUNCTION__, qPrintable(language));
+ // TODO: apply locale?
+ qApp->installTranslator(m_translator);
+ emit languageChanged();
+ return true;
+ }
+
+ qDebug("%s: couldn't load translation file '%s' from '%s'",
+ __FUNCTION__, qPrintable(filename), qPrintable(dir));
+ qDebug("%s: loading embedded translation file '%s'",
+ __FUNCTION__, qPrintable(filename));
+
+ if (m_translator->load(filename, ":")) {
+ qDebug("%s: embedded translation for language '%s' loaded successfully",
+ __FUNCTION__, qPrintable(language));
+ qApp->installTranslator(m_translator);
+ emit languageChanged();
+ return true;
+ }
+
+ qCritical("%s: error loading translation for language '%s'",
+ __FUNCTION__, qPrintable(language));
+ return false;
+}
+
+TranslationManager *TranslationManager::instance()
+{
+ if (!m_instance) {
+ m_instance = new TranslationManager();
+ }
+ return m_instance;
+}
+
+QString TranslationManager::emptyString()
+{
+ return "";
+}
+
diff --git a/src/TranslationManager.h b/src/TranslationManager.h
new file mode 100644
index 00000000..d1c155b5
--- /dev/null
+++ b/src/TranslationManager.h
@@ -0,0 +1,57 @@
+// Copyright (c) 2014-2019, The Monero Project
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef TRANSLATIONMANAGER_H
+#define TRANSLATIONMANAGER_H
+
+#include <QObject>
+
+class QTranslator;
+class TranslationManager : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString emptyString READ emptyString NOTIFY languageChanged)
+public:
+ Q_INVOKABLE bool setLanguage(const QString &language);
+ static TranslationManager *instance();
+
+ QString emptyString();
+
+signals:
+ void languageChanged();
+
+private:
+ explicit TranslationManager(QObject *parent = 0);
+
+private:
+ static TranslationManager * m_instance;
+ QTranslator * m_translator;
+
+};
+
+#endif // TRANSLATIONMANAGER_H
diff --git a/src/daemon/CMakeLists.txt b/src/daemon/CMakeLists.txt
new file mode 100644
index 00000000..9ca31c61
--- /dev/null
+++ b/src/daemon/CMakeLists.txt
@@ -0,0 +1,4 @@
+file(GLOB_RECURSE SRC_SOURCES *.cpp)
+file(GLOB_RECURSE SRC_HEADERS *.h)
+
+
diff --git a/src/libwalletqt/CMakeLists.txt b/src/libwalletqt/CMakeLists.txt
new file mode 100644
index 00000000..9ca31c61
--- /dev/null
+++ b/src/libwalletqt/CMakeLists.txt
@@ -0,0 +1,4 @@
+file(GLOB_RECURSE SRC_SOURCES *.cpp)
+file(GLOB_RECURSE SRC_HEADERS *.h)
+
+
diff --git a/src/main/Logger.cpp b/src/main/Logger.cpp
new file mode 100644
index 00000000..0d15b4e3
--- /dev/null
+++ b/src/main/Logger.cpp
@@ -0,0 +1,100 @@
+// Copyright (c) 2014-2019, The Monero Project
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include <QCoreApplication>
+#include <QStandardPaths>
+#include <QFileInfo>
+#include <QString>
+#include <QDir>
+#include <QDebug>
+
+#include "Logger.h"
+#include "qt/TailsOS.h"
+#include "wallet/api/wallet2_api.h"
+
+// default log path by OS (should be writable)
+static const QString defaultLogName = "monero-wallet-gui.log";
+#if defined(Q_OS_IOS)
+ //AppDataLocation = "<APPROOT>/Library/Application Support"
+ static const QString osPath = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation).at(0);
+ static const QString appFolder = "monero-wallet-gui";
+#elif defined(Q_OS_WIN)
+ //AppDataLocation = "C:/Users/<USER>/AppData/Roaming/<APPNAME>"
+ static const QString osPath = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation).at(0);
+ static const QString appFolder = "monero-wallet-gui";
+#elif defined(Q_OS_ANDROID)
+ //AppDataLocation = "<USER>/<APPNAME>/files"
+ static const QString osPath = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation).at(1);
+ static const QString appFolder = "";
+#elif defined(Q_OS_MAC)
+ //HomeLocation = "~"
+ static const QString osPath = QStandardPaths::standardLocations(QStandardPaths::HomeLocation).at(0);
+ static const QString appFolder = "Library/Logs";
+#else // linux + bsd
+ //HomeLocation = "~"
+ static const QString osPath = QStandardPaths::standardLocations(QStandardPaths::HomeLocation).at(0);
+ static const QString appFolder = ".bitmonero";
+#endif
+
+
+// return the absolute path of the logfile and ensure path folder exists
+const QString getLogPath(const QString logPath)
+{
+ const QFileInfo fi(logPath);
+
+ if(TailsOS::detect() && TailsOS::usePersistence)
+ return QDir::homePath() + "/Persistent/Monero/logs/" + defaultLogName;
+
+ if(!logPath.isEmpty() && !fi.isDir())
+ return fi.absoluteFilePath();
+ else {
+ QDir appDir(osPath + "/" + appFolder);
+ if(!appDir.exists())
+ if(!appDir.mkpath("."))
+ qWarning() << "Logger: Cannot create log directory " + appDir.path();
+ return appDir.path() + "/" + defaultLogName;
+ }
+}
+
+
+// custom messageHandler that foward all messages to easylogging
+void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &message)
+{
+ (void) context; // context isn't used in release builds
+ const std::string cat = "frontend"; // category displayed in the log
+ const std::string msg = message.toStdString();
+ switch(type)
+ {
+ case QtDebugMsg: Monero::Wallet::debug(cat, msg); break;
+ case QtInfoMsg: Monero::Wallet::info(cat, msg); break;
+ case QtWarningMsg: Monero::Wallet::warning(cat, msg); break;
+ case QtCriticalMsg: Monero::Wallet::error(cat, msg); break;
+ case QtFatalMsg: Monero::Wallet::error(cat, msg); break;
+ }
+}
+
diff --git a/src/main/Logger.h b/src/main/Logger.h
new file mode 100644
index 00000000..7674a437
--- /dev/null
+++ b/src/main/Logger.h
@@ -0,0 +1,36 @@
+// Copyright (c) 2014-2019, The Monero Project
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef LOGGER_H
+#define LOGGER_H
+
+const QString getLogPath(const QString logPath);
+void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &message);
+
+#endif // LOGGER_H
+
diff --git a/src/main/MainApp.cpp b/src/main/MainApp.cpp
new file mode 100644
index 00000000..b1c418ce
--- /dev/null
+++ b/src/main/MainApp.cpp
@@ -0,0 +1,43 @@
+// Copyright (c) 2014-2019, The Monero Project
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "MainApp.h"
+#include <QCloseEvent>
+
+bool MainApp::event (QEvent *event)
+{
+ // Catch application exit event and signal to qml app to handle exit
+ if(event->type() == QEvent::Close) {
+ event->ignore();
+ emit closing();
+ return true;
+ }
+
+ // Pass unhandled events to base class
+ return QApplication::event(event);
+}
diff --git a/src/main/MainApp.h b/src/main/MainApp.h
new file mode 100644
index 00000000..ec8b7045
--- /dev/null
+++ b/src/main/MainApp.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2014-2019, The Monero Project
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef MAINAPP_H
+#define MAINAPP_H
+#include <QApplication>
+
+class MainApp : public QApplication
+{
+ Q_OBJECT
+public:
+ MainApp(int &argc, char** argv) : QApplication(argc, argv) {};
+private:
+ bool event(QEvent *e);
+signals:
+ void closing();
+};
+
+#endif // MAINAPP_H
+
+
diff --git a/src/main/clipboardAdapter.cpp b/src/main/clipboardAdapter.cpp
new file mode 100644
index 00000000..b558936a
--- /dev/null
+++ b/src/main/clipboardAdapter.cpp
@@ -0,0 +1,44 @@
+// Copyright (c) 2014-2018, The Monero Project
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "clipboardAdapter.h"
+
+clipboardAdapter::clipboardAdapter(QObject *parent) :
+ QObject(parent)
+{
+ m_pClipboard = QGuiApplication::clipboard();
+}
+
+void clipboardAdapter::setText(const QString &text) {
+ m_pClipboard->setText(text, QClipboard::Clipboard);
+ m_pClipboard->setText(text, QClipboard::Selection);
+}
+
+QString clipboardAdapter::text() const {
+ return m_pClipboard->text();
+}
diff --git a/src/main/clipboardAdapter.h b/src/main/clipboardAdapter.h
new file mode 100644
index 00000000..0ce168cf
--- /dev/null
+++ b/src/main/clipboardAdapter.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2014-2019, The Monero Project
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef CLIPBOARDADAPTER_H
+#define CLIPBOARDADAPTER_H
+
+#include <QGuiApplication>
+#include <QClipboard>
+#include <QObject>
+
+class clipboardAdapter : public QObject
+{
+ Q_OBJECT
+public:
+ explicit clipboardAdapter(QObject *parent = 0);
+ Q_INVOKABLE void setText(const QString &text);
+ Q_INVOKABLE QString text() const;
+
+private:
+ QClipboard *m_pClipboard;
+};
+
+#endif // CLIPBOARDADAPTER_H
diff --git a/src/main/filter.cpp b/src/main/filter.cpp
new file mode 100644
index 00000000..581d0750
--- /dev/null
+++ b/src/main/filter.cpp
@@ -0,0 +1,152 @@
+// Copyright (c) 2014-2018, The Monero Project
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "filter.h"
+#include <QtGlobal>
+#include <QKeyEvent>
+#include <QDebug>
+
+#ifdef QT_DEBUG
+ #include "private/qabstractanimation_p.h"
+#endif
+
+filter::filter(QObject *parent) :
+ QObject(parent)
+{
+ m_tabPressed = false;
+ m_backtabPressed = false;
+}
+
+bool filter::eventFilter(QObject *obj, QEvent *ev) {
+ // macOS sends fileopen signal for incoming uri handlers
+ if (ev->type() == QEvent::FileOpen) {
+ QFileOpenEvent *openEvent = static_cast<QFileOpenEvent *>(ev);
+ QUrl scheme = openEvent->url();
+ emit uriHandler(scheme);
+ }
+
+ if(ev->type() == QEvent::KeyPress || ev->type() == QEvent::MouseButtonRelease){
+ emit userActivity();
+ }
+
+ switch(ev->type()) {
+ case QEvent::KeyPress: {
+ QKeyEvent *ke = static_cast<QKeyEvent*>(ev);
+ if(ke->key() == Qt::Key_Backtab) {
+ if(m_backtabPressed)
+ break;
+ else m_backtabPressed = true;
+ }
+
+ if(ke->key() == Qt::Key_Tab) {
+ if(m_tabPressed)
+ break;
+ else m_tabPressed = true;
+ }
+
+ QString sks;
+ if(ke->key() == Qt::Key_Control) {
+ sks = "Ctrl";
+#ifdef Q_OS_MAC
+ } else if(ke->key() == Qt::Key_Meta) {
+ sks = "Ctrl";
+#endif
+ } else {
+ QKeySequence ks(ke->modifiers() + ke->key());
+ sks = ks.toString();
+ }
+#ifndef Q_OS_MAC
+ if(sks.contains("Alt+Tab") || sks.contains("Alt+Backtab"))
+ break;
+#else
+ sks.replace("Meta", "Ctrl");
+#endif
+ emit sequencePressed(QVariant::fromValue<QObject*>(obj), sks);
+ } break;
+ case QEvent::KeyRelease: {
+ QKeyEvent *ke = static_cast<QKeyEvent*>(ev);
+
+#ifdef QT_DEBUG
+ if(ke->key() == Qt::Key_F9){
+ QUnifiedTimer::instance()->setSlowModeEnabled(true);
+ QUnifiedTimer::instance()->setSlowdownFactor(10);
+ qDebug() << "Slow animations enabled";
+ }
+
+ if(ke->key() == Qt::Key_F10){
+ QUnifiedTimer::instance()->setSlowModeEnabled(false);
+ QUnifiedTimer::instance()->setSlowdownFactor(1);
+
+ qDebug() << "Slow animations disabled";
+ }
+#endif
+
+ if(ke->key() == Qt::Key_Backtab)
+ m_backtabPressed = false;
+
+ if(ke->key() == Qt::Key_Tab)
+ m_tabPressed = false;
+
+ QString sks;
+#ifdef Q_OS_ANDROID
+ if(ke->key() == Qt::Key_Back) {
+ qDebug() << "Android back hit";
+ sks = "android_back";
+ }
+#endif
+ if(ke->key() == Qt::Key_Control) {
+ sks = "Ctrl";
+#ifdef Q_OS_MAC
+ } else if(ke->key() == Qt::Key_Meta) {
+ sks = "Ctrl";
+#endif
+ } else {
+ QKeySequence ks(ke->modifiers() + ke->key());
+ sks = ks.toString();
+ }
+#ifndef Q_OS_MAC
+ if(sks.contains("Alt+Tab") || sks.contains("Alt+Backtab"))
+ break;
+#else
+ sks.replace("Meta", "Ctrl");
+#endif
+ emit sequenceReleased(QVariant::fromValue<QObject*>(obj), sks);
+ } break;
+ case QEvent::MouseButtonPress: {
+ QMouseEvent *me = static_cast<QMouseEvent*>(ev);
+ emit mousePressed(QVariant::fromValue<QObject*>(obj), me->x(), me->y());
+ } break;
+ case QEvent::MouseButtonRelease: {
+ QMouseEvent *me = static_cast<QMouseEvent*>(ev);
+ emit mouseReleased(QVariant::fromValue<QObject*>(obj), me->x(), me->y());
+ } break;
+ default: break;
+ }
+
+ return QObject::eventFilter(obj, ev);
+}
diff --git a/src/main/filter.h b/src/main/filter.h
new file mode 100644
index 00000000..24b278ec
--- /dev/null
+++ b/src/main/filter.h
@@ -0,0 +1,55 @@
+// Copyright (c) 2014-2019, The Monero Project
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef FILTER_H
+#define FILTER_H
+
+#include <QObject>
+
+class filter : public QObject
+{
+ Q_OBJECT
+private:
+ bool m_tabPressed;
+ bool m_backtabPressed;
+public:
+ explicit filter(QObject *parent = 0);
+
+protected:
+ bool eventFilter(QObject *obj, QEvent *ev);
+
+signals:
+ void sequencePressed(const QVariant &o, const QVariant &seq);
+ void sequenceReleased(const QVariant &o, const QVariant &seq);
+ void mousePressed(const QVariant &o, const QVariant &x, const QVariant &y);
+ void mouseReleased(const QVariant &o, const QVariant &x, const QVariant &y);
+ void userActivity();
+ void uriHandler(const QUrl &url);
+};
+
+#endif // FILTER_H
diff --git a/src/main/main.cpp b/src/main/main.cpp
new file mode 100644
index 00000000..3a9eb014
--- /dev/null
+++ b/src/main/main.cpp
@@ -0,0 +1,483 @@
+// Copyright (c) 2014-2018, The Monero Project
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include <QApplication>
+#include <QQmlApplicationEngine>
+#include <QtQml>
+#include <QStandardPaths>
+#include <QNetworkAccessManager>
+#include <QIcon>
+#include <QDebug>
+#include <QDesktopServices>
+#include <QObject>
+#include <QDesktopWidget>
+#include <QScreen>
+#include <QRegExp>
+#include <QThread>
+#include "clipboardAdapter.h"
+#include "filter.h"
+#include "oscursor.h"
+#include "oshelper.h"
+#include "WalletManager.h"
+#include "Wallet.h"
+#include "QRCodeImageProvider.h"
+#include "PendingTransaction.h"
+#include "UnsignedTransaction.h"
+#include "TranslationManager.h"
+#include "TransactionInfo.h"
+#include "TransactionHistory.h"
+#include "model/TransactionHistoryModel.h"
+#include "model/TransactionHistorySortFilterModel.h"
+#include "AddressBook.h"
+#include "model/AddressBookModel.h"
+#include "Subaddress.h"
+#include "model/SubaddressModel.h"
+#include "SubaddressAccount.h"
+#include "model/SubaddressAccountModel.h"
+#include "wallet/api/wallet2_api.h"
+#include "Logger.h"
+#include "MainApp.h"
+#include "qt/ipc.h"
+#include "qt/utils.h"
+#include "qt/TailsOS.h"
+#include "qt/KeysFiles.h"
+#include "qt/MoneroSettings.h"
+#include "qt/prices.h"
+
+// IOS exclusions
+#ifndef Q_OS_IOS
+#include "daemon/DaemonManager.h"
+#endif
+
+#ifdef WITH_SCANNER
+#include "QR-Code-scanner/QrCodeScanner.h"
+#endif
+
+#include <QtPlugin>
+#if defined(Q_OS_OSX)
+ Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin);
+#elif defined(Q_OS_WIN)
+ Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
+#elif defined(Q_OS_LINUX)
+ Q_IMPORT_PLUGIN(QXcbIntegrationPlugin);
+#endif
+Q_IMPORT_PLUGIN(QSvgIconPlugin)
+Q_IMPORT_PLUGIN(QGifPlugin)
+Q_IMPORT_PLUGIN(QICNSPlugin)
+Q_IMPORT_PLUGIN(QICOPlugin)
+Q_IMPORT_PLUGIN(QJp2Plugin)
+Q_IMPORT_PLUGIN(QJpegPlugin)
+Q_IMPORT_PLUGIN(QMngPlugin)
+Q_IMPORT_PLUGIN(QSvgPlugin)
+Q_IMPORT_PLUGIN(QTgaPlugin)
+Q_IMPORT_PLUGIN(QTiffPlugin)
+Q_IMPORT_PLUGIN(QWbmpPlugin)
+Q_IMPORT_PLUGIN(QWebpPlugin)
+Q_IMPORT_PLUGIN(QQmlDebuggerServiceFactory)
+Q_IMPORT_PLUGIN(QQmlInspectorServiceFactory)
+Q_IMPORT_PLUGIN(QLocalClientConnectionFactory)
+Q_IMPORT_PLUGIN(QDebugMessageServiceFactory)
+Q_IMPORT_PLUGIN(QQmlNativeDebugConnectorFactory)
+Q_IMPORT_PLUGIN(QQmlNativeDebugServiceFactory)
+Q_IMPORT_PLUGIN(QQmlProfilerServiceFactory)
+Q_IMPORT_PLUGIN(QQuickProfilerAdapterFactory)
+Q_IMPORT_PLUGIN(QQmlDebugServerFactory)
+Q_IMPORT_PLUGIN(QTcpServerConnectionFactory)
+Q_IMPORT_PLUGIN(QGenericEnginePlugin)
+
+Q_IMPORT_PLUGIN(QtQuick2Plugin)
+Q_IMPORT_PLUGIN(QtQuickLayoutsPlugin)
+Q_IMPORT_PLUGIN(QtGraphicalEffectsPlugin)
+Q_IMPORT_PLUGIN(QtGraphicalEffectsPrivatePlugin)
+Q_IMPORT_PLUGIN(QtQuick2WindowPlugin)
+Q_IMPORT_PLUGIN(QtQuickControls1Plugin)
+Q_IMPORT_PLUGIN(QtQuick2DialogsPlugin)
+Q_IMPORT_PLUGIN(QmlFolderListModelPlugin)
+Q_IMPORT_PLUGIN(QmlSettingsPlugin)
+Q_IMPORT_PLUGIN(QtQuick2DialogsPrivatePlugin)
+Q_IMPORT_PLUGIN(QtQuick2PrivateWidgetsPlugin)
+Q_IMPORT_PLUGIN(QtQuickControls2Plugin)
+Q_IMPORT_PLUGIN(QtQuickTemplates2Plugin)
+Q_IMPORT_PLUGIN(QmlXmlListModelPlugin)
+Q_IMPORT_PLUGIN(QMultimediaDeclarativeModule)
+
+bool isIOS = false;
+bool isAndroid = false;
+bool isWindows = false;
+bool isMac = false;
+bool isLinux = false;
+bool isTails = false;
+bool isDesktop = false;
+bool isOpenGL = true;
+
+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_LINUX)
+ bool isLinux = 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;
+#elif defined(Q_OS_LINUX)
+ bool isLinux = true;
+ bool isTails = TailsOS::detect();
+#elif defined(Q_OS_MAC)
+ bool isMac = true;
+#endif
+
+ // detect low graphics mode (start-low-graphics-mode.bat)
+ if(qgetenv("QMLSCENE_DEVICE") == "softwarecontext")
+ isOpenGL = false;
+
+ // disable "QApplication: invalid style override passed" warning
+ if (isDesktop) putenv((char*)"QT_STYLE_OVERRIDE=fusion");
+#ifdef Q_OS_LINUX
+ // force platform xcb
+ if (isDesktop) putenv((char*)"QT_QPA_PLATFORM=xcb");
+#endif
+
+// // Enable high DPI scaling on windows & linux
+//#if !defined(Q_OS_ANDROID) && QT_VERSION >= 0x050600
+// QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+// qDebug() << "High DPI auto scaling - enabled";
+//#endif
+
+ // Turn off colors in monerod log output.
+ qputenv("TERM", "goaway");
+
+ MainApp app(argc, argv);
+
+ app.setApplicationName("monero-core");
+ app.setOrganizationDomain("getmonero.org");
+ app.setOrganizationName("monero-project");
+
+ // Ask to enable Tails OS persistence mode, it affects:
+ // - Log file location
+ // - QML Settings file location (monero-core.conf)
+ // - Default wallets path
+ // Target directory is: ~/Persistent/Monero
+ if (isTails) {
+ if (!TailsOS::detectDataPersistence())
+ TailsOS::showDataPersistenceDisabledWarning();
+ else
+ TailsOS::askPersistence();
+ }
+
+ QString moneroAccountsDir;
+ #if defined(Q_OS_WIN) || defined(Q_OS_IOS)
+ QStringList moneroAccountsRootDir = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation);
+ #else
+ QStringList moneroAccountsRootDir = QStandardPaths::standardLocations(QStandardPaths::HomeLocation);
+ #endif
+
+ if(isTails && TailsOS::usePersistence){
+ moneroAccountsDir = QDir::homePath() + "/Persistent/Monero/wallets";
+ } else if (!moneroAccountsRootDir.empty()) {
+ moneroAccountsDir = moneroAccountsRootDir.at(0) + "/Monero/wallets";
+ } else {
+ qCritical() << "Error: accounts root directory could not be set";
+ return 1;
+ }
+
+#if defined(Q_OS_LINUX)
+ if (isDesktop) app.setWindowIcon(QIcon(":/images/appicon.ico"));
+#endif
+
+ filter *eventFilter = new filter;
+ app.installEventFilter(eventFilter);
+
+ QCommandLineParser parser;
+ QCommandLineOption logPathOption(QStringList() << "l" << "log-file",
+ QCoreApplication::translate("main", "Log to specified file"),
+ QCoreApplication::translate("main", "file"));
+
+ QCommandLineOption testQmlOption("test-qml");
+ testQmlOption.setFlags(QCommandLineOption::HiddenFromHelp);
+ parser.addOption(logPathOption);
+ parser.addOption(testQmlOption);
+ parser.addHelpOption();
+ parser.process(app);
+
+ Monero::Utils::onStartup();
+
+ // Log settings
+ const QString logPath = getLogPath(parser.value(logPathOption));
+ Monero::Wallet::init(argv[0], "monero-wallet-gui", logPath.toStdString().c_str(), true);
+ qInstallMessageHandler(messageHandler);
+
+ // loglevel is configured in main.qml. Anything lower than
+ // qWarning is not shown here unless MONERO_LOG_LEVEL env var is set
+ bool logLevelOk;
+ int logLevel = qEnvironmentVariableIntValue("MONERO_LOG_LEVEL", &logLevelOk);
+ if (logLevelOk && logLevel >= 0 && logLevel <= Monero::WalletManagerFactory::LogLevel_Max){
+ Monero::WalletManagerFactory::setLogLevel(logLevel);
+ }
+ qWarning().noquote() << "app startd" << "(log: " + logPath + ")";
+
+ // Desktop entry
+#ifdef Q_OS_LINUX
+ registerXdgMime(app);
+#endif
+
+ IPC *ipc = new IPC(&app);
+ QStringList posArgs = parser.positionalArguments();
+
+ for(int i = 0; i != posArgs.count(); i++){
+ QString arg = QString(posArgs.at(i));
+ if(arg.isEmpty() || arg.length() >= 512) continue;
+ if(arg.contains(reURI)){
+ if(!ipc->saveCommand(arg)){
+ return 0;
+ }
+ }
+ }
+
+ // start listening
+ QTimer::singleShot(0, ipc, SLOT(bind()));
+
+ // screen settings
+ // Mobile is designed on 128dpi
+ qreal ref_dpi = 128;
+ QRect geo = QApplication::desktop()->availableGeometry();
+ QRect rect = QGuiApplication::primaryScreen()->geometry();
+ qreal dpi = QGuiApplication::primaryScreen()->logicalDotsPerInch();
+ qreal physicalDpi = QGuiApplication::primaryScreen()->physicalDotsPerInch();
+ qreal calculated_ratio = physicalDpi/ref_dpi;
+
+ QString GUI_VERSION = "-";
+ QFile f(":/version.js");
+ if(!f.open(QFile::ReadOnly)) {
+ qWarning() << "Could not read qrc:///version.js";
+ } else {
+ QByteArray contents = f.readAll();
+ f.close();
+
+ QRegularExpression re("var GUI_VERSION = \"(.*)\"");
+ QRegularExpressionMatch version_match = re.match(contents);
+ if (version_match.hasMatch()) {
+ GUI_VERSION = version_match.captured(1); // "v0.13.0.3"
+ }
+ }
+
+ qWarning().nospace().noquote() << "Qt:" << QT_VERSION_STR << " GUI:" << GUI_VERSION
+ << " | screen: " << rect.width() << "x" << rect.height()
+ << " - dpi: " << dpi << " - ratio:" << calculated_ratio;
+
+ // registering types for QML
+ qmlRegisterType<clipboardAdapter>("moneroComponents.Clipboard", 1, 0, "Clipboard");
+
+ // Temporary Qt.labs.settings replacement
+ qmlRegisterType<MoneroSettings>("moneroComponents.Settings", 1, 0, "MoneroSettings");
+
+ qmlRegisterUncreatableType<Wallet>("moneroComponents.Wallet", 1, 0, "Wallet", "Wallet can't be instantiated directly");
+
+
+ qmlRegisterUncreatableType<PendingTransaction>("moneroComponents.PendingTransaction", 1, 0, "PendingTransaction",
+ "PendingTransaction can't be instantiated directly");
+
+ 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");
+
+ qmlRegisterUncreatableType<TransactionHistorySortFilterModel>("moneroComponents.TransactionHistorySortFilterModel", 1, 0, "TransactionHistorySortFilterModel",
+ "TransactionHistorySortFilterModel can't be instantiated directly");
+
+ qmlRegisterUncreatableType<TransactionHistory>("moneroComponents.TransactionHistory", 1, 0, "TransactionHistory",
+ "TransactionHistory can't be instantiated directly");
+
+ qmlRegisterUncreatableType<TransactionInfo>("moneroComponents.TransactionInfo", 1, 0, "TransactionInfo",
+ "TransactionHistory can't be instantiated directly");
+#ifndef Q_OS_IOS
+ qmlRegisterUncreatableType<DaemonManager>("moneroComponents.DaemonManager", 1, 0, "DaemonManager",
+ "DaemonManager can't be instantiated directly");
+#endif
+ qmlRegisterUncreatableType<AddressBookModel>("moneroComponents.AddressBookModel", 1, 0, "AddressBookModel",
+ "AddressBookModel can't be instantiated directly");
+
+ qmlRegisterUncreatableType<AddressBook>("moneroComponents.AddressBook", 1, 0, "AddressBook",
+ "AddressBook can't be instantiated directly");
+
+ qmlRegisterUncreatableType<SubaddressModel>("moneroComponents.SubaddressModel", 1, 0, "SubaddressModel",
+ "SubaddressModel can't be instantiated directly");
+
+ qmlRegisterUncreatableType<Subaddress>("moneroComponents.Subaddress", 1, 0, "Subaddress",
+ "Subaddress can't be instantiated directly");
+
+ qmlRegisterUncreatableType<SubaddressAccountModel>("moneroComponents.SubaddressAccountModel", 1, 0, "SubaddressAccountModel",
+ "SubaddressAccountModel can't be instantiated directly");
+
+ qmlRegisterUncreatableType<SubaddressAccount>("moneroComponents.SubaddressAccount", 1, 0, "SubaddressAccount",
+ "SubaddressAccount can't be instantiated directly");
+
+ qRegisterMetaType<PendingTransaction::Priority>();
+ qRegisterMetaType<TransactionInfo::Direction>();
+ qRegisterMetaType<TransactionHistoryModel::TransactionInfoRole>();
+
+ qRegisterMetaType<NetworkType::Type>();
+ qmlRegisterType<NetworkType>("moneroComponents.NetworkType", 1, 0, "NetworkType");
+
+#ifdef WITH_SCANNER
+ qmlRegisterType<QrCodeScanner>("moneroComponents.QRCodeScanner", 1, 0, "QRCodeScanner");
+#endif
+
+ QQmlApplicationEngine engine;
+
+ OSCursor cursor;
+ engine.rootContext()->setContextProperty("globalCursor", &cursor);
+ OSHelper osHelper;
+ engine.rootContext()->setContextProperty("oshelper", &osHelper);
+
+ engine.addImportPath(":/fonts");
+
+ 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());
+
+ engine.rootContext()->setContextProperty("mainApp", &app);
+
+ engine.rootContext()->setContextProperty("IPC", ipc);
+
+ engine.rootContext()->setContextProperty("qtRuntimeVersion", qVersion());
+
+ engine.rootContext()->setContextProperty("walletLogPath", logPath);
+
+ engine.rootContext()->setContextProperty("tailsUsePersistence", TailsOS::usePersistence);
+
+// Exclude daemon manager from IOS
+#ifndef Q_OS_IOS
+ const QStringList arguments = (QStringList) QCoreApplication::arguments().at(0);
+ DaemonManager * daemonManager = DaemonManager::instance(&arguments);
+ engine.rootContext()->setContextProperty("daemonManager", daemonManager);
+#endif
+
+ engine.rootContext()->setContextProperty("isWindows", isWindows);
+ engine.rootContext()->setContextProperty("isMac", isMac);
+ engine.rootContext()->setContextProperty("isLinux", isLinux);
+ engine.rootContext()->setContextProperty("isIOS", isIOS);
+ engine.rootContext()->setContextProperty("isAndroid", isAndroid);
+ engine.rootContext()->setContextProperty("isOpenGL", isOpenGL);
+ engine.rootContext()->setContextProperty("isTails", isTails);
+
+ engine.rootContext()->setContextProperty("screenWidth", geo.width());
+ engine.rootContext()->setContextProperty("screenHeight", geo.height());
+
+#ifndef Q_OS_IOS
+ const QString desktopFolder = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
+ if (!desktopFolder.isEmpty())
+ engine.rootContext()->setContextProperty("desktopFolder", desktopFolder);
+#endif
+
+ // Wallet .keys files model (wizard -> open wallet)
+ WalletKeysFilesModel walletKeysFilesModel(walletManager);
+ engine.rootContext()->setContextProperty("walletKeysFilesModel", &walletKeysFilesModel);
+ engine.rootContext()->setContextProperty("walletKeysFilesModelProxy", &walletKeysFilesModel.proxyModel());
+
+ // Get default account name
+ QString accountName = qgetenv("USER"); // mac/linux
+ if (accountName.isEmpty())
+ accountName = qgetenv("USERNAME"); // Windows
+ if (accountName.isEmpty())
+ accountName = "My monero Account";
+
+ engine.rootContext()->setContextProperty("defaultAccountName", accountName);
+ engine.rootContext()->setContextProperty("homePath", QDir::homePath());
+ engine.rootContext()->setContextProperty("applicationDirectory", QApplication::applicationDirPath());
+ engine.rootContext()->setContextProperty("idealThreadCount", QThread::idealThreadCount());
+
+ bool builtWithScanner = false;
+#ifdef WITH_SCANNER
+ builtWithScanner = true;
+#endif
+ engine.rootContext()->setContextProperty("builtWithScanner", builtWithScanner);
+
+ QNetworkAccessManager *manager = new QNetworkAccessManager();
+ Prices prices(manager);
+ engine.rootContext()->setContextProperty("Prices", &prices);
+
+ // Load main window (context properties needs to be defined obove this line)
+ engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
+ if (engine.rootObjects().isEmpty())
+ {
+ qCritical() << "Error: no root objects";
+ return 1;
+ }
+ QObject *rootObject = engine.rootObjects().first();
+ if (!rootObject)
+ {
+ qCritical() << "Error: no root objects";
+ return 1;
+ }
+
+ // QML loaded successfully.
+ if (parser.isSet(testQmlOption))
+ return 0;
+
+#ifdef WITH_SCANNER
+ QObject *qmlCamera = rootObject->findChild<QObject*>("qrCameraQML");
+ if (qmlCamera)
+ {
+ qWarning() << "QrCodeScanner : object found";
+ QCamera *camera_ = qvariant_cast<QCamera*>(qmlCamera->property("mediaObject"));
+ QObject *qmlFinder = rootObject->findChild<QObject*>("QrFinder");
+ qobject_cast<QrCodeScanner*>(qmlFinder)->setSource(camera_);
+ }
+ else
+ qCritical() << "QrCodeScanner : something went wrong !";
+#endif
+
+ QObject::connect(eventFilter, SIGNAL(sequencePressed(QVariant,QVariant)), rootObject, SLOT(sequencePressed(QVariant,QVariant)));
+ QObject::connect(eventFilter, SIGNAL(sequenceReleased(QVariant,QVariant)), rootObject, SLOT(sequenceReleased(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(userActivity()), rootObject, SLOT(userActivity()));
+ QObject::connect(eventFilter, SIGNAL(uriHandler(QUrl)), ipc, SLOT(parseCommand(QUrl)));
+ return app.exec();
+}
diff --git a/src/main/oscursor.cpp b/src/main/oscursor.cpp
new file mode 100644
index 00000000..f5ee3c74
--- /dev/null
+++ b/src/main/oscursor.cpp
@@ -0,0 +1,38 @@
+// Copyright (c) 2014-2019, The Monero Project
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "oscursor.h"
+#include <QCursor>
+OSCursor::OSCursor(QObject *parent)
+ : QObject(parent)
+{
+}
+QPoint OSCursor::getPosition() const
+{
+ return QCursor::pos();
+}
diff --git a/src/main/oscursor.h b/src/main/oscursor.h
new file mode 100644
index 00000000..cb84e6fb
--- /dev/null
+++ b/src/main/oscursor.h
@@ -0,0 +1,53 @@
+// Copyright (c) 2014-2019, The Monero Project
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef OSCURSOR_H
+#define OSCURSOR_H
+
+
+#include <QObject>
+#include <QString>
+#include <QPoint>
+class OSCursor : public QObject
+{
+ Q_OBJECT
+ //QObject();
+public:
+ //QObject(QObject* aParent);
+ //OSCursor();
+ explicit OSCursor(QObject *parent = 0);
+ Q_INVOKABLE QPoint getPosition() const;
+};
+
+//OSCursor::OSCursor() : QObject(NULL){
+
+//}
+
+
+//Q_DECLARE_METATYPE(OSCursor)
+#endif // OSCURSOR_H
diff --git a/src/main/oshelper.cpp b/src/main/oshelper.cpp
new file mode 100644
index 00000000..c1326c0f
--- /dev/null
+++ b/src/main/oshelper.cpp
@@ -0,0 +1,99 @@
+// Copyright (c) 2014-2019, The Monero Project
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "oshelper.h"
+#include <QTemporaryFile>
+#include <QDir>
+#include <QDebug>
+#include <QString>
+#ifdef Q_OS_MAC
+#include "qt/macoshelper.h"
+#endif
+#ifdef Q_OS_WIN32
+#include <windows.h>
+#endif
+#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
+#include <X11/XKBlib.h>
+#undef KeyPress
+#undef KeyRelease
+#undef FocusIn
+#undef FocusOut
+// #undef those Xlib #defines that conflict with QEvent::Type enum
+#endif
+
+OSHelper::OSHelper(QObject *parent) : QObject(parent)
+{
+
+}
+
+QString OSHelper::temporaryFilename() const
+{
+ QString tempFileName;
+ {
+ QTemporaryFile f;
+ f.open();
+ tempFileName = f.fileName();
+ }
+ return tempFileName;
+}
+
+bool OSHelper::removeTemporaryWallet(const QString &fileName) const
+{
+ // Temporary files should be deleted automatically by default, in case they wouldn't, we delete them manually as well
+ bool cache_deleted = QFile::remove(fileName);
+ bool address_deleted = QFile::remove(fileName + ".address.txt");
+ bool keys_deleted = QFile::remove(fileName +".keys");
+
+ return cache_deleted && address_deleted && keys_deleted;
+}
+
+// https://stackoverflow.com/a/3006934
+bool OSHelper::isCapsLock() const
+{
+ // platform dependent method of determining if CAPS LOCK is on
+#if defined(Q_OS_WIN32) // MS Windows version
+ return GetKeyState(VK_CAPITAL) == 1;
+#elif defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) // X11 version
+ Display * d = XOpenDisplay((char*)0);
+ bool caps_state = false;
+ if (d) {
+ unsigned n;
+ XkbGetIndicatorState(d, XkbUseCoreKbd, &n);
+ caps_state = (n & 0x01) == 1;
+ }
+ return caps_state;
+#elif defined(Q_OS_MAC)
+ return MacOSHelper::isCapsLock();
+#endif
+ return false;
+}
+
+QString OSHelper::temporaryPath() const
+{
+ return QDir::tempPath();
+}
diff --git a/src/main/oshelper.h b/src/main/oshelper.h
new file mode 100644
index 00000000..4d378a9d
--- /dev/null
+++ b/src/main/oshelper.h
@@ -0,0 +1,52 @@
+// Copyright (c) 2014-2019, The Monero Project
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef OSHELPER_H
+#define OSHELPER_H
+
+#include <QObject>
+/**
+ * @brief The OSHelper class - exports to QML some OS-related functions
+ */
+class OSHelper : public QObject
+{
+ Q_OBJECT
+public:
+ explicit OSHelper(QObject *parent = 0);
+
+ Q_INVOKABLE QString temporaryFilename() const;
+ Q_INVOKABLE QString temporaryPath() const;
+ Q_INVOKABLE bool removeTemporaryWallet(const QString &walletName) const;
+ Q_INVOKABLE bool isCapsLock() const;
+
+signals:
+
+public slots:
+};
+
+#endif // OSHELPER_H
diff --git a/src/main/qml.qrc b/src/main/qml.qrc
new file mode 100644
index 00000000..77179f88
--- /dev/null
+++ b/src/main/qml.qrc
@@ -0,0 +1,255 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>LeftPanel.qml</file>
+ <file>MiddlePanel.qml</file>
+ <file>images/download-white.png</file>
+ <file>images/download-white@2x.png</file>
+ <file>images/external-link-white.png</file>
+ <file>images/external-link-white@2x.png</file>
+ <file>images/minus-white.png</file>
+ <file>images/minus-white@2x.png</file>
+ <file>images/plus-white.png</file>
+ <file>images/plus-white@2x.png</file>
+ <file>components/Label.qml</file>
+ <file>images/whatIsIcon.png</file>
+ <file>images/whatIsIcon@2x.png</file>
+ <file>images/lockIcon.png</file>
+ <file>components/MenuButton.qml</file>
+ <file>pages/Account.qml</file>
+ <file>pages/Transfer.qml</file>
+ <file>pages/History.qml</file>
+ <file>pages/AddressBook.qml</file>
+ <file>pages/Mining.qml</file>
+ <file>components/NetworkStatusItem.qml</file>
+ <file>components/Input.qml</file>
+ <file>components/StandardButton.qml</file>
+ <file>components/LineEdit.qml</file>
+ <file>components/TipItem.qml</file>
+ <file>images/tip.png</file>
+ <file>components/Scroll.qml</file>
+ <file>components/MenuButtonDivider.qml</file>
+ <file>images/moneroIcon.png</file>
+ <file>components/StandardDropdown.qml</file>
+ <file>images/whiteDropIndicator.png</file>
+ <file>images/whiteDropIndicator@2x.png</file>
+ <file>components/CheckBox.qml</file>
+ <file>images/uncheckedIcon.png</file>
+ <file>images/uncheckedIcon@2x.png</file>
+ <file>components/DatePicker.qml</file>
+ <file>images/prevMonth.png</file>
+ <file>images/prevMonth@2x.png</file>
+ <file>components/TitleBar.qml</file>
+ <file>images/moneroLogo2.png</file>
+ <file>images/resize.png</file>
+ <file>images/resize@2x.png</file>
+ <file>images/resizeHovered.png</file>
+ <file>images/resizeHovered@2x.png</file>
+ <file>images/nextPage.png</file>
+ <file>images/nextPage@2x.png</file>
+ <file>lang/languages.xml</file>
+ <file>lang/flags/bd.png</file>
+ <file>lang/flags/bg.png</file>
+ <file>lang/flags/br.png</file>
+ <file>lang/flags/catalonia.png</file>
+ <file>lang/flags/cn.png</file>
+ <file>lang/flags/hr.png</file>
+ <file>lang/flags/hu.png</file>
+ <file>lang/flags/cz.png</file>
+ <file>lang/flags/dk.png</file>
+ <file>lang/flags/eg.png</file>
+ <file>lang/flags/esperanto.png</file>
+ <file>lang/flags/fi.png</file>
+ <file>lang/flags/fr.png</file>
+ <file>lang/flags/de.png</file>
+ <file>lang/flags/in.png</file>
+ <file>lang/flags/id.png</file>
+ <file>lang/flags/il.png</file>
+ <file>lang/flags/ir.png</file>
+ <file>lang/flags/irl.png</file>
+ <file>lang/flags/it.png</file>
+ <file>lang/flags/jp.png</file>
+ <file>lang/flags/ku.png</file>
+ <file>lang/flags/lt.png</file>
+ <file>lang/flags/nl.png</file>
+ <file>lang/flags/pk.png</file>
+ <file>lang/flags/ps.png</file>
+ <file>lang/flags/pl.png</file>
+ <file>lang/flags/pt.png</file>
+ <file>lang/flags/ro.png</file>
+ <file>lang/flags/ru.png</file>
+ <file>lang/flags/rs.png</file>
+ <file>lang/flags/sk.png</file>
+ <file>lang/flags/si.png</file>
+ <file>lang/flags/za.png</file>
+ <file>lang/flags/kr.png</file>
+ <file>lang/flags/es.png</file>
+ <file>lang/flags/se.png</file>
+ <file>lang/flags/tw.png</file>
+ <file>lang/flags/tr.png</file>
+ <file>lang/flags/ua.png</file>
+ <file>lang/flags/gb.png</file>
+ <file>lang/flags/us.png</file>
+ <file>lang/flags/pirate.png</file>
+ <file>pages/Receive.qml</file>
+ <file>pages/TxKey.qml</file>
+ <file>pages/SharedRingDB.qml</file>
+ <file>components/effects/ImageMask.qml</file>
+ <file>components/IconButton.qml</file>
+ <file>components/PasswordDialog.qml</file>
+ <file>components/InputDialog.qml</file>
+ <file>components/ProcessingSplash.qml</file>
+ <file>components/ProgressBar.qml</file>
+ <file>components/StandardDialog.qml</file>
+ <file>pages/Sign.qml</file>
+ <file>components/DaemonManagerDialog.qml</file>
+ <file>version.js</file>
+ <file>components/DaemonConsole.qml</file>
+ <file>components/QRCodeScanner.qml</file>
+ <file>components/Notifier.qml</file>
+ <file>components/TextBlock.qml</file>
+ <file>components/RemoteNodeEdit.qml</file>
+ <file>pages/Keys.qml</file>
+ <file>images/appicon.ico</file>
+ <file>images/card-background.png</file>
+ <file>images/card-background@2x.png</file>
+ <file>images/moneroLogo_white.png</file>
+ <file>images/question.png</file>
+ <file>images/question@2x.png</file>
+ <file>images/titlebarLogo.png</file>
+ <file>images/titlebarLogo@2x.png</file>
+ <file>pages/merchant/MerchantTitlebar.qml</file>
+ <file>images/menuButtonGradient.png</file>
+ <file>fonts/Roboto-Medium.ttf</file>
+ <file>fonts/Roboto-Regular.ttf</file>
+ <file>fonts/Roboto-Light.ttf</file>
+ <file>fonts/Roboto-Bold.ttf</file>
+ <file>fonts/RobotoMono-Medium.ttf</file>
+ <file>fonts/RobotoMono-Regular.ttf</file>
+ <file>fonts/RobotoMono-Light.ttf</file>
+ <file>fonts/RobotoMono-Bold.ttf</file>
+ <file>components/Style.qml</file>
+ <file>components/qmldir</file>
+ <file>components/InlineButton.qml</file>
+ <file>images/lightning.png</file>
+ <file>images/lightning@2x.png</file>
+ <file>images/logout.png</file>
+ <file>images/logout@2x.png</file>
+ <file>images/moneroIcon-28x28.png</file>
+ <file>images/moneroIcon-28x28@2x.png</file>
+ <file>images/lightning-white.png</file>
+ <file>images/lightning-white@2x.png</file>
+ <file>components/InputMulti.qml</file>
+ <file>components/LineEditMulti.qml</file>
+ <file>components/LabelButton.qml</file>
+ <file>components/LabelSubheader.qml</file>
+ <file>images/arrow-right-medium-white.png</file>
+ <file>images/arrow-right-medium-white@2x.png</file>
+ <file>images/rightArrow.png</file>
+ <file>images/rightArrow@2x.png</file>
+ <file>images/historyBorderRadius.png</file>
+ <file>components/CheckBox2.qml</file>
+ <file>components/TextPlain.qml</file>
+ <file>components/TextPlainArea.qml</file>
+ <file>js/TxUtils.js</file>
+ <file>images/warning.png</file>
+ <file>images/warning@2x.png</file>
+ <file>images/rightArrowInactive.png</file>
+ <file>images/rightArrowInactive@2x.png</file>
+ <file>js/Windows.js</file>
+ <file>js/Utils.js</file>
+ <file>components/RadioButton.qml</file>
+ <file>pages/settings/Settings.qml</file>
+ <file>pages/settings/SettingsWallet.qml</file>
+ <file>pages/settings/SettingsNode.qml</file>
+ <file>pages/settings/SettingsLog.qml</file>
+ <file>pages/settings/SettingsLayout.qml</file>
+ <file>pages/settings/SettingsInfo.qml</file>
+ <file>pages/settings/Navbar.qml</file>
+ <file>components/WarningBox.qml</file>
+ <file>images/miningxmr.png</file>
+ <file>images/miningxmr@2x.png</file>
+ <file>images/plus-in-circle-medium-white.png</file>
+ <file>images/plus-in-circle-medium-white@2x.png</file>
+ <file>pages/merchant/Merchant.qml</file>
+ <file>pages/merchant/MerchantCheckbox.qml</file>
+ <file>pages/merchant/MerchantTrackingList.qml</file>
+ <file>images/merchant/arrow_right.png</file>
+ <file>images/merchant/bg.png</file>
+ <file>images/merchant/input_box.png</file>
+ <file>fonts/FontAwesome/fa-brands-400.ttf</file>
+ <file>fonts/FontAwesome/fa-regular-400.ttf</file>
+ <file>fonts/FontAwesome/fa-solid-900.ttf</file>
+ <file>fonts/FontAwesome/FontAwesome.qml</file>
+ <file>fonts/FontAwesome/Object.qml</file>
+ <file>fonts/FontAwesome/qmldir</file>
+ <file>wizard/WizardAskPassword.qml</file>
+ <file>wizard/WizardController.qml</file>
+ <file>wizard/WizardCreateWallet1.qml</file>
+ <file>wizard/WizardCreateWallet2.qml</file>
+ <file>wizard/WizardCreateWallet3.qml</file>
+ <file>wizard/WizardCreateWallet4.qml</file>
+ <file>wizard/WizardCreateDevice1.qml</file>
+ <file>wizard/WizardDaemonSettings.qml</file>
+ <file>wizard/WizardHeader.qml</file>
+ <file>wizard/WizardHome.qml</file>
+ <file>wizard/WizardLanguage.qml</file>
+ <file>wizard/WizardLang.qml</file>
+ <file>wizard/WizardNav.qml</file>
+ <file>wizard/WizardWalletInput.qml</file>
+ <file>wizard/WizardRestoreWallet1.qml</file>
+ <file>wizard/WizardRestoreWallet2.qml</file>
+ <file>wizard/WizardRestoreWallet3.qml</file>
+ <file>wizard/WizardRestoreWallet4.qml</file>
+ <file>wizard/WizardSummary.qml</file>
+ <file>wizard/WizardSummaryItem.qml</file>
+ <file>wizard/WizardModeSelection.qml</file>
+ <file>wizard/WizardModeRemoteNodeWarning.qml</file>
+ <file>wizard/WizardModeBootstrap.qml</file>
+ <file>wizard/WizardMenuItem.qml</file>
+ <file>js/Wizard.js</file>
+ <file>components/LanguageSidebar.qml</file>
+ <file>images/world-flags-globe.png</file>
+ <file>images/langFlagGrey.png</file>
+ <file>images/restore-wallet-from-hardware@2x.png</file>
+ <file>images/restore-wallet-from-hardware.png</file>
+ <file>images/open-wallet-from-file@2x.png</file>
+ <file>images/open-wallet-from-file.png</file>
+ <file>images/restore-wallet@2x.png</file>
+ <file>images/restore-wallet.png</file>
+ <file>images/create-wallet@2x.png</file>
+ <file>images/create-wallet.png</file>
+ <file>images/remote-node.png</file>
+ <file>images/remote-node@2x.png</file>
+ <file>images/local-node.png</file>
+ <file>images/local-node@2x.png</file>
+ <file>images/local-node-full.png</file>
+ <file>images/local-node-full@2x.png</file>
+ <file>wizard/WizardNavProgressDot.qml</file>
+ <file>wizard/WizardOpenWallet1.qml</file>
+ <file>images/arrow-right-in-circle.png</file>
+ <file>images/arrow-right-in-circle@2x.png</file>
+ <file>images/themes/white/leftPanelBg.jpg</file>
+ <file>images/themes/white/middlePanelBg.jpg</file>
+ <file>images/right.svg</file>
+ <file>images/middlePanelShadow.png</file>
+ <file>images/themes/white/titlebarLogo@2x.png</file>
+ <file>images/themes/white/titlebarLogo.png</file>
+ <file>images/sidebar.svg</file>
+ <file>images/fullscreen.svg</file>
+ <file>images/close.svg</file>
+ <file>images/minimize.svg</file>
+ <file>images/themes/white/close.svg</file>
+ <file>images/themes/white/fullscreen.svg</file>
+ <file>images/themes/white/minimize.svg</file>
+ <file>images/themes/white/question.svg</file>
+ <file>images/themes/white/expand.svg</file>
+ <file>components/effects/ColorTransition.qml</file>
+ <file>components/effects/GradientBackground.qml</file>
+ <file>images/check-white.svg</file>
+ <file>images/copy.svg</file>
+ <file>images/edit.svg</file>
+ <file>images/arrow-right-in-circle-outline-medium-white.svg</file>
+ <file>images/tails-grey.png</file>
+ </qresource>
+</RCC>
diff --git a/src/model/CMakeLists.txt b/src/model/CMakeLists.txt
new file mode 100644
index 00000000..9ca31c61
--- /dev/null
+++ b/src/model/CMakeLists.txt
@@ -0,0 +1,4 @@
+file(GLOB_RECURSE SRC_SOURCES *.cpp)
+file(GLOB_RECURSE SRC_HEADERS *.h)
+
+
diff --git a/src/version.js.in b/src/version.js.in
new file mode 100644
index 00000000..cbce82db
--- /dev/null
+++ b/src/version.js.in
@@ -0,0 +1,3 @@
+var GUI_VERSION = "@VERSIONTAG@"
+var GUI_MONERO_VERSION = "@VERSIONTAG@"
+
diff --git a/src/zxcvbn-c/CMakeLists.txt b/src/zxcvbn-c/CMakeLists.txt
new file mode 100644
index 00000000..9ca31c61
--- /dev/null
+++ b/src/zxcvbn-c/CMakeLists.txt
@@ -0,0 +1,4 @@
+file(GLOB_RECURSE SRC_SOURCES *.cpp)
+file(GLOB_RECURSE SRC_HEADERS *.h)
+
+