Compare commits

..

25 Commits

Author SHA1 Message Date
luigi1111
8248a299c8 Merge pull request #1680
921ba8b Windows Installer: Update for Beryllium Bullet 0.13.0.4 (rbrunner7)
2018-10-22 17:10:09 -05:00
luigi1111
9f8e6a994c Merge pull request #1693
1650273 Fix daemon host/port setting to allow tab switching (sectioneight)
2018-10-22 17:08:43 -05:00
Aiden Scandella
16502739b9 Fix daemon host/port setting to allow tab switching
Previously, these were multiline editing (for some reason I'm not sure,
perhaps you can have multiple remote nodes?)

I tried various workarounds, but the simplest was to change them to
simply LineEdit (like username/password) and now my bug is fixed.
2018-10-22 08:52:31 -07:00
René Brunner
921ba8b241 Windows Installer: Update for Beryllium Bullet 0.13.0.4 2018-10-18 20:15:38 +02:00
luigi1111
749faf8f84 Merge pull request #1674
cbee139 fixed: networkStatus overlaps menu, padding (xiphon)
2018-10-16 16:04:50 -05:00
luigi1111
420d515635 Merge pull request #1673
b653ba0 tracking: query blockchain height only once during update (xiphon)
cd5110c tracking: don't fetch redundant txes (xiphon)
2018-10-16 16:01:34 -05:00
luigi1111
9331686290 Merge pull request #1671
2ca48fb Bumping submodule to 0.13.0.4 (skftn)
2018-10-16 16:00:34 -05:00
luigi1111
a19886b333 Merge pull request #1668
669e0f4 Linking libhidapi for Linux; updating README (skftn)
2018-10-16 15:59:43 -05:00
xiphon
cbee139d57 fixed: networkStatus overlaps menu, padding 2018-10-16 23:58:34 +03:00
xiphon
cd5110cfbe tracking: don't fetch redundant txes 2018-10-16 23:56:09 +03:00
xiphon
b653ba0a1c tracking: query blockchain height only once during update 2018-10-16 23:56:09 +03:00
Sander Ferdinand
2ca48fb6bc Bumping submodule to 0.13.0.4 2018-10-16 22:43:47 +02:00
Sander Ferdinand
669e0f4425 Linking libhidapi for Linux; updating README 2018-10-16 22:22:55 +02:00
luigi1111
15d8ef7622 Merge pull request #1655
279f6cf bump monero CLI version to 0.13.0.3 (skftn)
2018-10-15 12:22:45 -05:00
Sander Ferdinand
279f6cf189 bump monero CLI version to 0.13.0.3 2018-10-15 17:24:03 +02:00
luigi1111
b59de2fb0e Merge pull request #1651
09c0aac Linking hidapi for OSX builds (skftn)
2018-10-14 14:52:02 -05:00
Sander Ferdinand
09c0aac7ab Linking hidapi for OSX builds 2018-10-14 21:47:58 +02:00
luigi1111
72b71e6a4f Merge pull request #1650
ba8d291 Link to libhidapi rather than pcsclite (bjacquin)
2018-10-14 14:44:41 -05:00
luigi1111
7fa55b49fe Merge pull request #1649
f17c407 Add border to generated QR codes (glv2)
2018-10-14 14:43:15 -05:00
Bertrand Jacquin
ba8d2913be Link to libhidapi rather than pcsclite 2018-10-14 16:36:22 +02:00
Guillaume LE VAILLANT
f17c407100 Add border to generated QR codes 2018-10-14 16:31:45 +02:00
luigi1111
7a3855700e Merge pull request #1646
d6ef609 Linking crypto32 and libhidapi for Windows builds (skftn)
2018-10-13 13:43:36 -05:00
luigi1111
ca7c0e0c55 Merge pull request #1640
3f3fd67 Updating outdated icu files (BigslimVdub)
2018-10-13 13:42:44 -05:00
Sander Ferdinand
d6ef609236 Linking crypto32 and libhidapi for Windows builds 2018-10-13 19:45:27 +02:00
BigslimVdub
3f3fd67f14 Updating outdated icu files 2018-10-12 18:08:14 +02:00
583 changed files with 356444 additions and 254790 deletions

View File

@@ -1 +0,0 @@
*

View File

@@ -1,36 +0,0 @@
name: Build
run-name: Build Docker Image
on: [push, pull_request]
jobs:
# Build image and push to container registry
docker-build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: satackey/action-docker-layer-caching@v0.0.11
if: "!startsWith(github.ref, 'refs/tags/v')"
continue-on-error: true
with:
key: docker-linux-static-{hash}
restore-keys: |
docker-linux-static-
- name: install dependencies
run: sudo apt -y install xvfb libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xkb1 libxcb-shape0 libxkbcommon-x11-0
- name: prepare build environment
run: docker build --tag monero:build-env-linux --build-arg THREADS=3 --file Dockerfile.linux .
- name: build
run: docker run --rm -v /home/runner/work/monero-gui/monero-gui:/monero-gui -w /monero-gui monero:build-env-linux sh -c 'make release-static -j3'
- name: sha256sum
run: shasum -a256 /home/runner/work/monero-gui/monero-gui/build/release/bin/monero-wallet-gui
- name: test qml
run: xvfb-run -a /home/runner/work/monero-gui/monero-gui/build/release/bin/monero-wallet-gui --test-qml
- uses: actions/upload-artifact@v2
with:
name: ${{ github.job }}
path: |
/home/runner/work/monero-gui/monero-gui/build/release/bin/monero-wallet-gui
/home/runner/work/monero-gui/monero-gui/build/release/bin/monerod

23
.gitignore vendored
View File

@@ -11,26 +11,3 @@ moc_*
*.xcodeproj *.xcodeproj
monero-wallet-gui_plugin_import.cpp monero-wallet-gui_plugin_import.cpp
monero-wallet-gui_qml_plugin_import.cpp monero-wallet-gui_qml_plugin_import.cpp
*.qmlc
*.jsc
qml_qmlcache.qrc
### Vim ###
# Swap
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Session
Session.vim
# Temporary
.netrwhist
*~
*.autosave
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~

3
.gitmodules vendored
View File

@@ -2,6 +2,3 @@
path = monero path = monero
url = https://github.com/monero-project/monero url = https://github.com/monero-project/monero
ignore = all ignore = all
[submodule "external/quirc"]
path = external/quirc
url = https://github.com/dlbeer/quirc/

View File

@@ -1,449 +0,0 @@
cmake_minimum_required(VERSION 3.12)
project(monero-gui)
message(STATUS "Initiating compile using CMake ${CMAKE_VERSION}")
set(VERSION_MAJOR "18")
set(VERSION_MINOR "3")
set(VERSION_REVISION "3")
set(VERSION "0.${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}")
option(STATIC "Link libraries statically, requires static Qt")
option(USE_DEVICE_TREZOR "Trezor support compilation" ON)
option(WITH_SCANNER "Enable webcam QR scanner" OFF)
option(WITH_DESKTOP_ENTRY "Ask to install desktop entry on first startup" ON)
option(WITH_UPDATER "Regularly check for new updates" ON)
option(DEV_MODE "Checkout latest monero master on build" OFF)
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_SOURCE_DIR}/cmake")
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckLinkerFlag)
set(BUILD_GUI_DEPS ON)
set(BUILD_64 ON CACHE BOOL "Build 64-bit binaries")
if(NOT MANUAL_SUBMODULES)
find_package(Git)
if(GIT_FOUND)
if(NOT DEV_MODE)
function (check_submodule relative_path)
execute_process(COMMAND git rev-parse "HEAD" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${relative_path} OUTPUT_VARIABLE localHead)
execute_process(COMMAND git rev-parse "HEAD:${relative_path}" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE checkedHead)
string(COMPARE EQUAL "${localHead}" "${checkedHead}" upToDate)
if (upToDate)
message(STATUS "Submodule '${relative_path}' is up-to-date")
else()
message(FATAL_ERROR "Submodule '${relative_path}' is not using the checked head. Please update all submodules with\ngit submodule update --init --force --recursive\nor run cmake with -DMANUAL_SUBMODULES=1,\n or if you want to build from latest master run cmake with -DDEV_MODE=ON,\n or run make devmode")
endif()
endfunction ()
message(STATUS "Checking submodules")
check_submodule(monero)
else()
execute_process(COMMAND ${GIT_EXECUTABLE} fetch WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/monero RESULT_VARIABLE GIT_FETCH_RESULT)
execute_process(COMMAND ${GIT_EXECUTABLE} checkout -f origin/master WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/monero RESULT_VARIABLE GIT_CHECKOUT_MASTER_RESULT)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule sync --recursive WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/monero RESULT_VARIABLE GIT_SUBMODULE_SYNC_RESULT)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --force --recursive WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/monero RESULT_VARIABLE GIT_SUBMODULE_UPDATE_RESULT)
if(NOT GIT_FETCH_RESULT EQUAL "0" OR NOT GIT_CHECKOUT_MASTER_RESULT EQUAL "0" OR NOT GIT_SUBMODULE_SYNC_RESULT EQUAL "0" OR NOT GIT_SUBMODULE_UPDATE_RESULT EQUAL "0")
message(FATAL_ERROR "Updating git submodule to master (-DDEV_MODE=ON) failed")
endif()
endif()
endif()
endif()
add_subdirectory(monero)
add_subdirectory(external)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
get_directory_property(ARCH_WIDTH DIRECTORY "monero" DEFINITION ARCH_WIDTH)
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DQT_NO_DEBUG)
endif()
if(STATIC)
message(STATUS "Initiating static build")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a" ${CMAKE_FIND_LIBRARY_SUFFIXES})
add_definitions(-DMONERO_GUI_STATIC)
endif()
include(CMakePackageConfigHelpers)
include_directories(${EASYLOGGING_INCLUDE})
link_directories(${EASYLOGGING_LIBRARY_DIRS})
include(VersionGui)
message(STATUS "${CMAKE_MODULE_PATH}")
if(WITH_SCANNER)
add_definitions(-DWITH_SCANNER)
endif()
if(WITH_DESKTOP_ENTRY)
add_definitions(-DWITH_DESKTOP_ENTRY)
endif()
if(WITH_UPDATER)
add_definitions(-DWITH_UPDATER)
endif()
# Sodium
find_library(SODIUM_LIBRARY sodium)
message(STATUS "libsodium: libraries at ${SODIUM_LIBRARY}")
if(UNIX AND NOT APPLE AND NOT ANDROID)
set(CMAKE_SKIP_RPATH ON)
set(CMAKE_FIND_LIBRARY_SUFFIXES_PREV ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES ".so")
find_package(X11 REQUIRED)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_PREV})
message(STATUS "X11_FOUND = ${X11_FOUND}")
message(STATUS "X11_INCLUDE_DIR = ${X11_INCLUDE_DIR}")
message(STATUS "X11_LIBRARIES = ${X11_LIBRARIES}")
include_directories(${X11_INCLUDE_DIR})
link_directories(${X11_LIBRARIES})
if(STATIC)
find_library(XCB_LIBRARY xcb)
message(STATUS "Found xcb library: ${XCB_LIBRARY}")
endif()
endif()
set(QT5_LIBRARIES
Qt5Core
Qt5Quick
Qt5Gui
Qt5Qml
Qt5Svg
Qt5Xml
)
if(WITH_SCANNER)
list(APPEND QT5_LIBRARIES Qt5Multimedia)
endif()
if(APPLE)
list(APPEND QT5_LIBRARIES Qt5MacExtras)
endif()
if(UNIX)
if(NOT CMAKE_PREFIX_PATH AND DEFINED ENV{CMAKE_PREFIX_PATH})
message(STATUS "Using CMAKE_PREFIX_PATH environment variable: '$ENV{CMAKE_PREFIX_PATH}'")
set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH})
endif()
if(APPLE AND NOT CMAKE_PREFIX_PATH)
execute_process(COMMAND brew --prefix qt5 OUTPUT_VARIABLE QT5_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
list(APPEND CMAKE_PREFIX_PATH ${QT5_DIR})
endif()
endif()
find_package(PkgConfig REQUIRED)
# TODO: drop this once we switch to Qt 5.14+
pkg_check_modules(Qt5QmlModels_PKG_CONFIG QUIET Qt5QmlModels)
if(Qt5QmlModels_PKG_CONFIG_FOUND)
list(APPEND QT5_LIBRARIES Qt5QmlModels)
endif()
# TODO: drop this once we switch to Qt 5.12+
find_package(Qt5XmlPatterns QUIET)
if(Qt5XmlPatterns_FOUND)
list(APPEND QT5_LIBRARIES Qt5XmlPatterns)
endif()
foreach(QT5_MODULE ${QT5_LIBRARIES})
find_package(${QT5_MODULE} REQUIRED)
include_directories(${${QT5_MODULE}_INCLUDE_DIRS})
endforeach()
if(NOT (CMAKE_CROSSCOMPILING AND ANDROID))
pkg_check_modules(QT5_PKG_CONFIG REQUIRED ${QT5_LIBRARIES})
else()
set(QT5_LIBRARIES_ABI)
foreach(QT5_MODULE ${QT5_LIBRARIES})
list(APPEND QT5_LIBRARIES_ABI "${QT5_MODULE}_${CMAKE_ANDROID_ARCH_ABI}")
endforeach()
pkg_check_modules(QT5_PKG_CONFIG REQUIRED ${QT5_LIBRARIES_ABI})
endif()
get_target_property(QMAKE_IMPORTED_LOCATION Qt5::qmake IMPORTED_LOCATION)
get_filename_component(QT_INSTALL_PREFIX "${QMAKE_IMPORTED_LOCATION}/../.." ABSOLUTE)
if(APPLE AND NOT STATIC)
set(CMAKE_BUILD_RPATH "${QT_INSTALL_PREFIX}/lib")
endif()
if(QT5_PKG_CONFIG_FOUND)
set(QT5_PKG_CONFIG "QT5_PKG_CONFIG")
if(STATIC)
set(QT5_PKG_CONFIG "${QT5_PKG_CONFIG}_STATIC")
endif()
if(UNIX AND CMAKE_PREFIX_PATH)
if(APPLE)
list(JOIN ${QT5_PKG_CONFIG}_LDFLAGS_OTHER " " ${QT5_PKG_CONFIG}_LDFLAGS_OTHER)
endif()
# temporal workaround for https://bugreports.qt.io/browse/QTBUG-80922
STRING(REPLACE "${QT5_PKG_CONFIG_Qt5Core_PREFIX}" "${QT_INSTALL_PREFIX}" ${QT5_PKG_CONFIG}_LDFLAGS_OTHER "${${QT5_PKG_CONFIG}_LDFLAGS_OTHER}")
STRING(REPLACE "${QT5_PKG_CONFIG_Qt5Core_PREFIX}" "${QT_INSTALL_PREFIX}" ${QT5_PKG_CONFIG}_LIBRARIES "${${QT5_PKG_CONFIG}_LIBRARIES}")
STRING(REPLACE "${QT5_PKG_CONFIG_Qt5Core_PREFIX}" "${QT_INSTALL_PREFIX}" ${QT5_PKG_CONFIG}_INCLUDE_DIRS "${${QT5_PKG_CONFIG}_INCLUDE_DIRS}")
STRING(REPLACE "${QT5_PKG_CONFIG_Qt5Core_PREFIX}" "${QT_INSTALL_PREFIX}" ${QT5_PKG_CONFIG}_LIBRARY_DIRS "${${QT5_PKG_CONFIG}_LIBRARY_DIRS}")
endif()
set(QT5_LIBRARIES ${${QT5_PKG_CONFIG}_LIBRARIES} ${${QT5_PKG_CONFIG}_LDFLAGS_OTHER})
include_directories(${${QT5_PKG_CONFIG}_INCLUDE_DIRS})
link_directories(${${QT5_PKG_CONFIG}_LIBRARY_DIRS})
endif()
list(APPEND QT5_LIBRARIES
${Qt5Gui_PLUGINS}
${Qt5Svg_PLUGINS}
${Qt5Qml_PLUGINS}
${Qt5Network_PLUGINS}
)
if(STATIC)
set(QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/Qt/labs/folderlistmodel)
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/Qt/labs/settings)
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/Qt/labs/platform)
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtGraphicalEffects)
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtGraphicalEffects/private)
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtMultimedia)
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQml)
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQml/Models.2)
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQuick.2)
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQuick/Controls)
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQuick/Controls.2)
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQuick/Dialogs)
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQuick/Dialogs/Private)
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQuick/Layouts)
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQuick/PrivateWidgets)
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQuick/Templates.2)
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQuick/Window.2)
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtQuick/XmlListModel)
set(QT5_EXTRA_LIBRARIES_LIST
qtquicktemplates2plugin
Qt5QuickTemplates2
qtquickcontrols2plugin
Qt5QuickControls2
dialogplugin
dialogsprivateplugin
qmlfolderlistmodelplugin
qmlsettingsplugin
qtlabsplatformplugin
qmlxmllistmodelplugin
qquicklayoutsplugin
modelsplugin
)
if(WITH_SCANNER)
list(APPEND QT5_EXTRA_LIBRARIES_LIST
declarative_multimedia
Qt5MultimediaQuick
)
endif()
list(APPEND QT5_EXTRA_LIBRARIES_LIST
qtgraphicaleffectsplugin
qtgraphicaleffectsprivate
qtquick2plugin
qtquickcontrolsplugin
widgetsplugin
windowplugin
)
if(NOT ${Qt5Core_VERSION} VERSION_LESS 5.14)
list(APPEND QT5_EXTRA_LIBRARIES_LIST qmlplugin)
endif()
set(QT5_EXTRA_LIBRARIES)
foreach(LIBRARY ${QT5_EXTRA_LIBRARIES_LIST})
find_library(${LIBRARY}_LIBRARY ${LIBRARY} PATHS ${QT5_EXTRA_PATHS} REQUIRED)
list(APPEND QT5_EXTRA_LIBRARIES ${${LIBRARY}_LIBRARY})
endforeach()
if(MINGW)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
list(APPEND QT5_EXTRA_LIBRARIES D3D11 Dwrite D2d1)
endif()
endif()
set(QT5_LIBRARIES
${QT5_EXTRA_LIBRARIES}
${QT5_LIBRARIES}
)
set(QT5_INTEGRATION_LIBRARIES_LIST
Qt5EventDispatcherSupport
Qt5PacketProtocol
Qt5ThemeSupport
Qt5FontDatabaseSupport
)
if(UNIX AND NOT APPLE)
list(APPEND QT5_INTEGRATION_LIBRARIES_LIST
Qt5XcbQpa
Qt5ServiceSupport
Qt5GlxSupport
)
elseif(MINGW)
list(APPEND QT5_INTEGRATION_LIBRARIES_LIST qtfreetype)
endif()
foreach(LIBRARY ${QT5_INTEGRATION_LIBRARIES_LIST})
find_library(${LIBRARY}_LIBRARY ${LIBRARY} PATHS ${QT5_EXTRA_PATHS} REQUIRED)
list(APPEND QT5_LIBRARIES ${${LIBRARY}_LIBRARY})
endforeach()
if(UNIX AND NOT APPLE)
pkg_check_modules(X11XCB_XCBGLX REQUIRED x11-xcb xcb-glx)
list(APPEND QT5_LIBRARIES ${X11XCB_XCBGLX_LIBRARIES})
pkg_check_modules(FONTCONFIG REQUIRED fontconfig)
list(APPEND QT5_LIBRARIES ${FONTCONFIG_STATIC_LIBRARIES})
endif()
endif()
if(ANDROID)
set(QT5_EXTRA_LIBRARIES_LIST
GLESv2
log
z
jnigraphics
android
EGL
Qt5VirtualKeyboard_${CMAKE_ANDROID_ARCH_ABI}
c++_shared
)
foreach(LIBRARY ${QT5_EXTRA_LIBRARIES_LIST})
find_library(${LIBRARY}_LIBRARY ${LIBRARY} PATHS "${ANDROID_TOOLCHAIN_ROOT}/sysroot/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/${ANDROID_PLATFORM_LEVEL}" REQUIRED)
list(APPEND QT5_LIBRARIES ${${LIBRARY}_LIBRARY})
endforeach()
endif()
if(MINGW)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wa,-mbig-obj")
set(EXTRA_LIBRARIES mswsock;ws2_32;iphlpapi;crypt32;bcrypt)
if(DEPENDS)
set(ICU_LIBRARIES icuio icui18n icuuc icudata icutu iconv)
else()
set(ICU_LIBRARIES icuio icuin icuuc icudt icutu iconv)
endif()
elseif(APPLE)
set(EXTRA_LIBRARIES "-framework AppKit")
elseif(OPENBSD OR ANDROID)
set(EXTRA_LIBRARIES "")
elseif(FREEBSD)
set(EXTRA_LIBRARIES execinfo)
elseif(DRAGONFLY)
find_library(COMPAT compat)
set(EXTRA_LIBRARIES execinfo ${COMPAT})
elseif(CMAKE_SYSTEM_NAME MATCHES "(SunOS|Solaris)")
set(EXTRA_LIBRARIES socket nsl resolv)
elseif(NOT MSVC AND NOT DEPENDS)
find_library(RT rt)
set(EXTRA_LIBRARIES ${RT})
endif()
list(APPEND EXTRA_LIBRARIES ${CMAKE_DL_LIBS})
if(APPLE)
cmake_policy(SET CMP0042 NEW)
endif()
if (APPLE AND NOT IOS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default -std=c++11")
endif()
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default -DGTEST_HAS_TR1_TUPLE=0")
endif()
# warnings
add_c_flag_if_supported(-Wformat C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-Wformat CXX_SECURITY_FLAGS)
add_c_flag_if_supported(-Wformat-security C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-Wformat-security CXX_SECURITY_FLAGS)
# -fstack-protector
if (NOT OPENBSD AND NOT (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 9.1)))
add_c_flag_if_supported(-fstack-protector C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-fstack-protector CXX_SECURITY_FLAGS)
add_c_flag_if_supported(-fstack-protector-strong C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-fstack-protector-strong CXX_SECURITY_FLAGS)
endif()
# New in GCC 8.2
if (NOT OPENBSD AND NOT (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 9.1)))
add_c_flag_if_supported(-fcf-protection=full C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-fcf-protection=full CXX_SECURITY_FLAGS)
endif()
if (NOT WIN32 AND NOT OPENBSD AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
add_c_flag_if_supported(-fstack-clash-protection C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-fstack-clash-protection CXX_SECURITY_FLAGS)
endif()
# Removed in GCC 9.1 (or before ?), but still accepted, so spams the output
if (NOT (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.1))
add_c_flag_if_supported(-mmitigate-rop C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-mmitigate-rop CXX_SECURITY_FLAGS)
endif()
# linker
if (APPLE)
add_linker_flag_if_supported(-Wl,-bind_at_load LD_SECURITY_FLAGS)
add_linker_flag_if_supported(-Wl,-dead_strip LD_SECURITY_FLAGS)
add_linker_flag_if_supported(-Wl,-dead_strip_dylibs LD_SECURITY_FLAGS)
endif()
if (NOT APPLE AND NOT (WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "GNU"))
# Windows binaries die on startup with PIE when compiled with GCC
add_linker_flag_if_supported(-pie LD_SECURITY_FLAGS)
endif()
add_linker_flag_if_supported(-Wl,-z,relro LD_SECURITY_FLAGS)
add_linker_flag_if_supported(-Wl,-z,now LD_SECURITY_FLAGS)
add_linker_flag_if_supported(-Wl,-z,noexecstack noexecstack_SUPPORTED)
if (noexecstack_SUPPORTED)
set(LD_SECURITY_FLAGS "${LD_SECURITY_FLAGS} -Wl,-z,noexecstack")
endif()
add_linker_flag_if_supported(-Wl,-z,noexecheap noexecheap_SUPPORTED)
if (noexecheap_SUPPORTED)
set(LD_SECURITY_FLAGS "${LD_SECURITY_FLAGS} -Wl,-z,noexecheap")
endif()
# some windows linker bits
if (WIN32)
add_linker_flag_if_supported(-Wl,--dynamicbase LD_SECURITY_FLAGS)
add_linker_flag_if_supported(-Wl,--nxcompat LD_SECURITY_FLAGS)
add_linker_flag_if_supported(-Wl,--high-entropy-va LD_SECURITY_FLAGS)
endif()
if(STATIC)
add_linker_flag_if_supported(-static-libgcc STATIC_FLAGS)
add_linker_flag_if_supported(-static-libstdc++ STATIC_FLAGS)
if(MINGW)
add_linker_flag_if_supported(-static STATIC_FLAGS)
endif()
endif()
# With GCC 6.1.1 the compiled binary malfunctions due to aliasing. Until that
# is fixed in the code (Issue #847), force compiler to be conservative.
add_c_flag_if_supported(-fno-strict-aliasing C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-fno-strict-aliasing CXX_SECURITY_FLAGS)
add_c_flag_if_supported(-fPIC C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-fPIC CXX_SECURITY_FLAGS)
message(STATUS "Using C security hardening flags: ${C_SECURITY_FLAGS}")
message(STATUS "Using C++ security hardening flags: ${CXX_SECURITY_FLAGS}")
message(STATUS "Using linker security hardening flags: ${LD_SECURITY_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 ${C_SECURITY_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${CXX_SECURITY_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LD_SECURITY_FLAGS} ${STATIC_FLAGS}")
add_subdirectory(translations)
add_subdirectory(src)

View File

@@ -1,75 +0,0 @@
# macOS:
Use macOS 10.12 - 10.13 for better backwards compability.
1. `HOMEBREW_OPTFLAGS="-march=core2" HOMEBREW_OPTIMIZATION_LEVEL="O0" brew install boost zmq libpgm miniupnpc libsodium expat libunwind-headers protobuf libgcrypt hidapi`
2. Get the latest LTS from here: https://www.qt.io/offline-installers and install
3. `git clone --recursive -b v0.X.Y.Z --depth 1 https://github.com/monero-project/monero-gui`
4. Compile `monero-wallet-gui.app`
```bash
mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=Release -D ARCH=default -D CMAKE_PREFIX_PATH=~/Qt5.12.8/5.12.8/clang_64 ..
make
make deploy
```
5. Replace the `monerod` binary inside `monero-wallet-gui.app/Contents/MacOS/` with one built using deterministic builds / gitian.
## Codesigning and notarizing
1. Save the following text as `entitlements.plist`
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.disable-executable-page-protection</key>
<true/>
</dict>
</plist>
```
2. `codesign --deep --force --verify --verbose --options runtime --timestamp --entitlements entitlements.plist --sign 'XXXXXXXXXX' monero-wallet-gui.app`
You can check if this step worked by using `codesign -dvvv monero-wallet-gui.app`
3. `hdiutil create -fs HFS+ -srcfolder monero-gui-v0.X.Y.Z -volname monero-wallet-gui monero-gui-mac-x64-v0.X.Y.Z.dmg`
4. `xcrun altool -t osx --file monero-gui-mac-x64-v0.X.Y.Z.dmg --primary-bundle-id org.monero-project.monero-wallet-gui.dmg --notarize-app --username email@address.org`
5. `xcrun altool --notarization-info aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeee -u email@address.org`
6. `xcrun stapler staple -v monero-gui-mac-x64-v0.X.Y.Z.dmg`
## Compile Qt for Apple Silicon
Qt does not offer pre-built binaries for Apple Silicon, they have to be manually compiled.
```bash
git clone https://github.com/qt/qt5.git
cd qt5
git checkout v5.15.9-lts-lgpl
./init-repository
mkdir build
cd build
../configure -prefix /path/to/qt-build-dir/ -opensource -confirm-license -release -nomake examples -nomake tests -no-rpath -skip qtwebengine -skip qt3d -skip qtandroidextras -skip qtcanvas3d -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtlocation -skip qtnetworkauth -skip qtpurchasing -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qttools -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebsockets -skip qtwebview -skip qtwinextras -skip qtx11extras -skip gamepad -skip serialbus -skip location -skip webengine
make
make install
cd ../qttools/src/linguist/lrelease
../../../../build/qtbase/bin/qmake
make
make install
cd ../../../../qttools/src/macdeployqt/macdeployqt/
../../../../build/qtbase/bin/qmake
make
make install
```
For compilation with Xcode 15 the following patch has to be applied: https://raw.githubusercontent.com/Homebrew/formula-patches/086e8cf/qt5/qt5-qmake-xcode15.patch
The `CMAKE_PREFIX_PATH` has to be set to `/path/to/qt-build-dir/` during monero-gui compilation.

View File

@@ -1,241 +0,0 @@
FROM debian:buster
ARG THREADS=1
ARG ANDROID_NDK_REVISION=21e
ARG ANDROID_NDK_HASH=c3ebc83c96a4d7f539bd72c241b2be9dcd29bda9
ARG ANDROID_SDK_REVISION=7302050_latest
ARG ANDROID_SDK_HASH=7a00faadc0864f78edd8f4908a629a46d622375cbe2e5814e82934aebecdb622
ARG QT_VERSION=v5.15.7-lts-lgpl
WORKDIR /opt/android
ENV WORKDIR=/opt/android
ENV ANDROID_NATIVE_API_LEVEL=30
ENV ANDROID_API=android-${ANDROID_NATIVE_API_LEVEL}
ENV ANDROID_CLANG=aarch64-linux-android${ANDROID_NATIVE_API_LEVEL}-clang
ENV ANDROID_CLANGPP=aarch64-linux-android${ANDROID_NATIVE_API_LEVEL}-clang++
ENV ANDROID_NDK_ROOT=${WORKDIR}/android-ndk-r${ANDROID_NDK_REVISION}
ENV ANDROID_SDK_ROOT=${WORKDIR}/cmdline-tools
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
ENV PATH=${JAVA_HOME}/bin:${PATH}
ENV PREFIX=${WORKDIR}/prefix
ENV TOOLCHAIN_DIR=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64
RUN apt-get update \
&& apt-get install -y ant automake build-essential ca-certificates-java file gettext git libc6 libncurses5 \
libssl-dev libstdc++6 libtinfo5 libtool libz1 openjdk-11-jdk-headless openjdk-11-jre-headless pkg-config python3 \
unzip wget
RUN PACKAGE_NAME=commandlinetools-linux-${ANDROID_SDK_REVISION}.zip \
&& wget -q https://dl.google.com/android/repository/${PACKAGE_NAME} \
&& echo "${ANDROID_SDK_HASH} ${PACKAGE_NAME}" | sha256sum -c \
&& unzip -q ${PACKAGE_NAME} \
&& rm -f ${PACKAGE_NAME}
RUN PACKAGE_NAME=android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip \
&& wget -q https://dl.google.com/android/repository/${PACKAGE_NAME} \
&& echo "${ANDROID_NDK_HASH} ${PACKAGE_NAME}" | sha1sum -c \
&& unzip -q ${PACKAGE_NAME} \
&& rm -f ${PACKAGE_NAME}
RUN echo y | ${ANDROID_SDK_ROOT}/bin/sdkmanager --sdk_root=${ANDROID_SDK_ROOT} "build-tools;28.0.3" "platforms;${ANDROID_API}" "tools" > /dev/null
ENV HOST_PATH=${PATH}
ENV PATH=${TOOLCHAIN_DIR}/aarch64-linux-android/bin:${TOOLCHAIN_DIR}/bin:${PATH}
ARG ZLIB_VERSION=1.3.1
ARG ZLIB_HASH=9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23
RUN wget -q https://github.com/madler/zlib/releases/download/v${ZLIB_VERSION}/zlib-${ZLIB_VERSION}.tar.gz \
&& echo "${ZLIB_HASH} zlib-${ZLIB_VERSION}.tar.gz" | sha256sum -c \
&& tar -xzf zlib-${ZLIB_VERSION}.tar.gz \
&& rm zlib-${ZLIB_VERSION}.tar.gz \
&& cd zlib-${ZLIB_VERSION} \
&& CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --prefix=${PREFIX} --static \
&& make -j${THREADS} \
&& make -j${THREADS} install \
&& rm -rf $(pwd)
RUN git clone git://code.qt.io/qt/qt5.git -b ${QT_VERSION} --depth 1 \
&& cd qt5 \
&& perl init-repository --module-subset=default,-qtwebengine \
&& PATH=${HOST_PATH} ./configure -v -developer-build -release \
-xplatform android-clang \
-android-ndk-platform ${ANDROID_API} \
-android-ndk ${ANDROID_NDK_ROOT} \
-android-sdk ${ANDROID_SDK_ROOT} \
-android-ndk-host linux-x86_64 \
-no-dbus \
-opengl es2 \
-no-use-gold-linker \
-no-sql-mysql \
-opensource -confirm-license \
-android-arch arm64-v8a \
-prefix ${PREFIX} \
-nomake tools -nomake tests -nomake examples \
-skip qtwebengine \
-skip qtserialport \
-skip qtconnectivity \
-skip qttranslations \
-skip qtpurchasing \
-skip qtgamepad -skip qtscript -skip qtdoc \
-no-warnings-are-errors \
&& PATH=${HOST_PATH} make -j${THREADS} \
&& PATH=${HOST_PATH} make -j${THREADS} install \
&& cd qttools/src/linguist/lrelease \
&& ../../../../qtbase/bin/qmake \
&& PATH=${HOST_PATH} make -j${THREADS} install \
&& cd ../../../.. \
&& rm -rf $(pwd)
ARG ICONV_VERSION=1.16
ARG ICONV_HASH=e6a1b1b589654277ee790cce3734f07876ac4ccfaecbee8afa0b649cf529cc04
RUN wget -q http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${ICONV_VERSION}.tar.gz \
&& echo "${ICONV_HASH} libiconv-${ICONV_VERSION}.tar.gz" | sha256sum -c \
&& tar -xzf libiconv-${ICONV_VERSION}.tar.gz \
&& rm -f libiconv-${ICONV_VERSION}.tar.gz \
&& cd libiconv-${ICONV_VERSION} \
&& CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --build=x86_64-linux-gnu --host=aarch64 --prefix=${PREFIX} --disable-rpath \
&& make -j${THREADS} \
&& make -j${THREADS} install
ARG BOOST_VERSION=1_74_0
ARG BOOST_VERSION_DOT=1.74.0
ARG BOOST_HASH=83bfc1507731a0906e387fc28b7ef5417d591429e51e788417fe9ff025e116b1
RUN wget -q https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 \
&& echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \
&& tar -xf boost_${BOOST_VERSION}.tar.bz2 \
&& rm -f boost_${BOOST_VERSION}.tar.bz2 \
&& cd boost_${BOOST_VERSION} \
&& PATH=${HOST_PATH} ./bootstrap.sh --prefix=${PREFIX} \
&& PATH=${TOOLCHAIN_DIR}/bin:${HOST_PATH} ./b2 --build-type=minimal link=static runtime-link=static \
--with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization \
--with-system --with-thread --with-locale --build-dir=android --stagedir=android toolset=clang threading=multi \
threadapi=pthread target-os=android -sICONV_PATH=${PREFIX} \
cflags='--target=aarch64-linux-android' \
cxxflags='--target=aarch64-linux-android' \
linkflags='--target=aarch64-linux-android --sysroot=${ANDROID_NDK_ROOT}/platforms/${ANDROID_API}/arch-arm64 ${ANDROID_NDK_ROOT}/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so -nostdlib++' \
install -j${THREADS} \
&& rm -rf $(pwd)
ARG OPENSSL_VERSION=1.1.1u
ARG OPENSSL_HASH=e2f8d84b523eecd06c7be7626830370300fbcc15386bf5142d72758f6963ebc6
RUN wget -q https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz \
&& echo "${OPENSSL_HASH} openssl-${OPENSSL_VERSION}.tar.gz" | sha256sum -c \
&& tar -xzf openssl-${OPENSSL_VERSION}.tar.gz \
&& rm openssl-${OPENSSL_VERSION}.tar.gz \
&& cd openssl-${OPENSSL_VERSION} \
&& ANDROID_NDK_HOME=${ANDROID_NDK_ROOT} ./Configure CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} \
android-arm64 no-shared --static \
--with-zlib-include=${PREFIX}/include --with-zlib-lib=${PREFIX}/lib \
--prefix=${PREFIX} --openssldir=${PREFIX} \
&& sed -i 's/CNF_EX_LIBS=-ldl -pthread//g;s/BIN_CFLAGS=-pie $(CNF_CFLAGS) $(CFLAGS)//g' Makefile \
&& ANDROID_NDK_HOME=${ANDROID_NDK_ROOT} make -j${THREADS} \
&& make -j${THREADS} install \
&& rm -rf $(pwd)
ARG EXPAT_VERSION=2.4.1
ARG EXPAT_HASH=2f9b6a580b94577b150a7d5617ad4643a4301a6616ff459307df3e225bcfbf40
RUN wget https://github.com/libexpat/libexpat/releases/download/R_2_4_1/expat-${EXPAT_VERSION}.tar.bz2 && \
echo "${EXPAT_HASH} expat-${EXPAT_VERSION}.tar.bz2" | sha256sum -c && \
tar -xf expat-${EXPAT_VERSION}.tar.bz2 && \
rm expat-${EXPAT_VERSION}.tar.bz2 && \
cd expat-${EXPAT_VERSION} && \
CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --enable-static --disable-shared --prefix=${PREFIX} --host=aarch64-linux-android && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
ARG UNBOUND_VERSION=1.16.2
ARG UNBOUND_HASH=2e32f283820c24c51ca1dd8afecfdb747c7385a137abe865c99db4b257403581
RUN wget https://www.nlnetlabs.nl/downloads/unbound/unbound-${UNBOUND_VERSION}.tar.gz && \
echo "${UNBOUND_HASH} unbound-${UNBOUND_VERSION}.tar.gz" | sha256sum -c && \
tar -xzf unbound-${UNBOUND_VERSION}.tar.gz && \
rm unbound-${UNBOUND_VERSION}.tar.gz && \
cd unbound-${UNBOUND_VERSION} && \
CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --disable-shared --enable-static --without-pyunbound --with-libexpat=${PREFIX} --with-ssl=${PREFIX} --with-libevent=no --without-pythonmodule --disable-flto --with-pthreads --with-libunbound-only --host=aarch64-linux-android --with-pic --prefix=${PREFIX} && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
ARG ZMQ_VERSION=v4.3.4
ARG ZMQ_HASH=4097855ddaaa65ed7b5e8cb86d143842a594eebd
RUN git clone https://github.com/zeromq/libzmq.git -b ${ZMQ_VERSION} --depth 1 \
&& cd libzmq \
&& git checkout ${ZMQ_HASH} \
&& ./autogen.sh \
&& CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --prefix=${PREFIX} --host=aarch64-linux-android \
--enable-static --disable-shared \
&& make -j${THREADS} \
&& make -j${THREADS} install \
&& rm -rf $(pwd)
ARG SODIUM_VERSION=1.0.18
ARG SODIUM_HASH=4f5e89fa84ce1d178a6765b8b46f2b6f91216677
RUN set -ex \
&& git clone https://github.com/jedisct1/libsodium.git -b ${SODIUM_VERSION} --depth 1 \
&& cd libsodium \
&& test `git rev-parse HEAD` = ${SODIUM_HASH} || exit 1 \
&& ./autogen.sh \
&& CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --prefix=${PREFIX} --host=aarch64-linux-android --enable-static --disable-shared \
&& make -j${THREADS} install \
&& rm -rf $(pwd)
RUN git clone -b libgpg-error-1.41 --depth 1 git://git.gnupg.org/libgpg-error.git \
&& cd libgpg-error \
&& git reset --hard 98032624ae89a67ee6fe3b1db5d95032e681d163 \
&& ./autogen.sh \
&& CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --host=aarch64-linux-android --prefix=${PREFIX} --disable-rpath --disable-shared --enable-static --disable-doc --disable-tests \
&& PATH=${TOOLCHAIN_DIR}/bin:${HOST_PATH} make -j${THREADS} \
&& make -j${THREADS} install \
&& rm -rf $(pwd)
RUN git clone -b libgcrypt-1.10.1 --depth 1 git://git.gnupg.org/libgcrypt.git \
&& cd libgcrypt \
&& git reset --hard ae0e567820c37f9640440b3cff77d7c185aa6742 \
&& ./autogen.sh \
&& CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --host=aarch64-linux-android --prefix=${PREFIX} --with-gpg-error-prefix=${PREFIX} --disable-shared --enable-static --disable-doc --disable-tests \
&& PATH=${TOOLCHAIN_DIR}/bin:${HOST_PATH} make -j${THREADS} \
&& make -j${THREADS} install \
&& rm -rf $(pwd)
RUN git clone -b v3.24.2 --depth 1 https://github.com/Kitware/CMake \
&& cd CMake \
&& git reset --hard 31f835410efeea50acd43512eb9e5646a26ea177 \
&& PATH=${HOST_PATH} ./bootstrap \
&& PATH=${HOST_PATH} make -j${THREADS} \
&& PATH=${HOST_PATH} make -j${THREADS} install \
&& rm -rf $(pwd)
RUN GRADLE_VERSION=5.6.4 \
&& GRADLE_HASH=1f3067073041bc44554d0efe5d402a33bc3d3c93cc39ab684f308586d732a80d \
&& wget -q https\://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip \
&& echo "${GRADLE_HASH} gradle-${GRADLE_VERSION}-bin.zip" | sha256sum -c \
&& GRADLE_LOCAL_PATH=gradle/wrapper/dists/gradle-${GRADLE_VERSION}-bin/bxirm19lnfz6nurbatndyydux \
&& mkdir -p ${GRADLE_LOCAL_PATH} \
&& mv gradle-${GRADLE_VERSION}-bin.zip ${GRADLE_LOCAL_PATH}
ENV GRADLE_USER_HOME=${WORKDIR}/gradle
CMD set -ex \
&& cd /monero-gui \
&& mkdir -p build/Android/release \
&& cd build/Android/release \
&& cmake \
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake" \
-DCMAKE_PREFIX_PATH="${PREFIX}" \
-DCMAKE_FIND_ROOT_PATH="${PREFIX}" \
-DCMAKE_BUILD_TYPE=Release \
-DARCH="armv8-a" \
-DANDROID_NATIVE_API_LEVEL=${ANDROID_NATIVE_API_LEVEL} \
-DANDROID_ABI="arm64-v8a" \
-DANDROID_TOOLCHAIN=clang \
-DBoost_USE_STATIC_RUNTIME=ON \
-DLRELEASE_PATH="${PREFIX}/bin" \
-DQT_ANDROID_APPLICATION_BINARY="monero-wallet-gui" \
-DANDROID_SDK="${ANDROID_SDK_ROOT}" \
-DWITH_SCANNER=ON \
-DWITH_DESKTOP_ENTRY=OFF \
../../.. \
&& PATH=${HOST_PATH} make generate_translations_header \
&& make -j${THREADS} -C src \
&& make -j${THREADS} apk

View File

@@ -1,287 +0,0 @@
FROM ubuntu:16.04
ARG THREADS=1
ARG QT_VERSION=v5.15.13-lts-lgpl
ENV CFLAGS="-fPIC"
ENV CPPFLAGS="-fPIC"
ENV CXXFLAGS="-fPIC"
ENV SOURCE_DATE_EPOCH=1397818193
RUN apt update && \
apt install -y automake autopoint bison gettext git gperf libgl1-mesa-dev libglib2.0-dev \
libpng12-dev libpthread-stubs0-dev libsodium-dev libtool-bin libudev-dev libusb-1.0-0-dev mesa-common-dev \
pkg-config python wget xutils-dev
RUN git clone -b xorgproto-2020.1 --depth 1 https://gitlab.freedesktop.org/xorg/proto/xorgproto && \
cd xorgproto && \
git reset --hard c62e8203402cafafa5ba0357b6d1c019156c9f36 && \
./autogen.sh && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
RUN git clone -b 1.12 --depth 1 https://gitlab.freedesktop.org/xorg/proto/xcbproto && \
cd xcbproto && \
git reset --hard 6398e42131eedddde0d98759067dde933191f049 && \
./autogen.sh && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
RUN git clone -b libXau-1.0.9 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxau && \
cd libxau && \
git reset --hard d9443b2c57b512cfb250b35707378654d86c7dea && \
./autogen.sh --enable-shared --disable-static && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
RUN git clone -b 1.12 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb && \
cd libxcb && \
git reset --hard d34785a34f28fa6a00f8ce00d87e3132ff0f6467 && \
./autogen.sh --enable-shared --disable-static && \
make -j$THREADS && \
make -j$THREADS install && \
make -j$THREADS clean && \
rm /usr/local/lib/libxcb-xinerama.so && \
./autogen.sh --disable-shared --enable-static && \
make -j$THREADS && \
cp src/.libs/libxcb-xinerama.a /usr/local/lib/ && \
rm -rf $(pwd)
RUN git clone -b 0.4.0 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb-util && \
cd libxcb-util && \
git reset --hard acf790d7752f36e450d476ad79807d4012ec863b && \
git submodule init && \
git clone --depth 1 https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \
git -C m4 reset --hard c617eee22ae5c285e79e81ec39ce96862fd3262f && \
./autogen.sh --enable-shared --disable-static && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
RUN git clone -b 0.4.0 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb-image && \
cd libxcb-image && \
git reset --hard d882052fb2ce439c6483fce944ba8f16f7294639 && \
git submodule init && \
git clone --depth 1 https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \
git -C m4 reset --hard c617eee22ae5c285e79e81ec39ce96862fd3262f && \
./autogen.sh --enable-shared --disable-static && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
RUN git clone -b 0.4.0 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb-keysyms && \
cd libxcb-keysyms && \
git reset --hard 0e51ee5570a6a80bdf98770b975dfe8a57f4eeb1 && \
git submodule init && \
git clone --depth 1 https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \
git -C m4 reset --hard c617eee22ae5c285e79e81ec39ce96862fd3262f && \
./autogen.sh --enable-shared --disable-static && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
RUN git clone -b 0.3.9 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb-render-util && \
cd libxcb-render-util && \
git reset --hard 0317caf63de532fd7a0493ed6afa871a67253747 && \
git submodule init && \
git clone --depth 1 https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \
git -C m4 reset --hard c617eee22ae5c285e79e81ec39ce96862fd3262f && \
./autogen.sh --enable-shared --disable-static && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
RUN git clone -b 0.4.1 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb-wm && \
cd libxcb-wm && \
git reset --hard 24eb17df2e1245885e72c9d4bbb0a0f69f0700f2 && \
git submodule init && \
git clone --depth 1 https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \
git -C m4 reset --hard c617eee22ae5c285e79e81ec39ce96862fd3262f && \
./autogen.sh --enable-shared --disable-static && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
RUN git clone -b xkbcommon-0.5.0 --depth 1 https://github.com/xkbcommon/libxkbcommon && \
cd libxkbcommon && \
git reset --hard c43c3c866eb9d52cd8f61e75cbef1c30d07f3a28 && \
./autogen.sh --prefix=/usr --enable-shared --disable-static --enable-x11 --disable-docs && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
RUN git clone -b v1.3 --depth 1 https://github.com/madler/zlib && \
cd zlib && \
git reset --hard 09155eaa2f9270dc4ed1fa13e2b4b2613e6e4851 && \
./configure --static && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
RUN git clone -b VER-2-10-2 --depth 1 https://git.savannah.gnu.org/git/freetype/freetype2.git && \
cd freetype2 && \
git reset --hard 132f19b779828b194b3fede187cee719785db4d8 && \
./autogen.sh && \
./configure --disable-shared --enable-static --with-zlib=no && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
RUN wget https://github.com/libexpat/libexpat/releases/download/R_2_4_8/expat-2.4.8.tar.bz2 && \
echo "a247a7f6bbb21cf2ca81ea4cbb916bfb9717ca523631675f99b3d4a5678dcd16 expat-2.4.8.tar.bz2" | sha256sum -c && \
tar -xf expat-2.4.8.tar.bz2 && \
rm expat-2.4.8.tar.bz2 && \
cd expat-2.4.8 && \
./configure --enable-static --disable-shared --prefix=/usr && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
RUN git clone -b 2.13.92 --depth 1 https://gitlab.freedesktop.org/fontconfig/fontconfig && \
cd fontconfig && \
git reset --hard b1df1101a643ae16cdfa1d83b939de2497b1bf27 && \
./autogen.sh --disable-shared --enable-static --sysconfdir=/etc --localstatedir=/var && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
RUN git clone -b release-64-2 --depth 1 https://github.com/unicode-org/icu && \
cd icu/icu4c/source && \
git reset --hard e2d85306162d3a0691b070b4f0a73e4012433444 && \
./configure --disable-shared --enable-static --disable-tests --disable-samples && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
RUN wget https://boostorg.jfrog.io/artifactory/main/release/1.80.0/source/boost_1_80_0.tar.gz && \
echo "4b2136f98bdd1f5857f1c3dea9ac2018effe65286cf251534b6ae20cc45e1847 boost_1_80_0.tar.gz" | sha256sum -c && \
tar -xzf boost_1_80_0.tar.gz && \
rm boost_1_80_0.tar.gz && \
cd boost_1_80_0 && \
./bootstrap.sh && \
./b2 --with-atomic --with-system --with-filesystem --with-thread --with-date_time --with-chrono --with-regex --with-serialization --with-program_options --with-locale variant=release link=static runtime-link=static cflags="${CFLAGS}" cxxflags="${CXXFLAGS}" install -a --prefix=/usr && \
rm -rf $(pwd)
RUN wget https://www.openssl.org/source/openssl-1.1.1u.tar.gz && \
echo "e2f8d84b523eecd06c7be7626830370300fbcc15386bf5142d72758f6963ebc6 openssl-1.1.1u.tar.gz" | sha256sum -c && \
tar -xzf openssl-1.1.1u.tar.gz && \
rm openssl-1.1.1u.tar.gz && \
cd openssl-1.1.1u && \
./config no-shared no-zlib-dynamic --prefix=/usr --openssldir=/usr && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
RUN wget https://www.nlnetlabs.nl/downloads/unbound/unbound-1.16.2.tar.gz && \
echo "2e32f283820c24c51ca1dd8afecfdb747c7385a137abe865c99db4b257403581 unbound-1.16.2.tar.gz" | sha256sum -c && \
tar -xzf unbound-1.16.2.tar.gz && \
rm unbound-1.16.2.tar.gz && \
cd unbound-1.16.2 && \
./configure --disable-shared --enable-static --without-pyunbound --with-libexpat=/usr --with-ssl=/usr --with-libevent=no --without-pythonmodule --disable-flto --with-pthreads --with-libunbound-only --with-pic && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
RUN rm /usr/lib/x86_64-linux-gnu/libX11.a && \
rm /usr/lib/x86_64-linux-gnu/libXext.a && \
rm /usr/lib/x86_64-linux-gnu/libX11-xcb.a && \
git clone git://code.qt.io/qt/qt5.git -b ${QT_VERSION} --depth 1 && \
cd qt5 && \
git clone git://code.qt.io/qt/qtbase.git -b ${QT_VERSION} --depth 1 && \
git clone git://code.qt.io/qt/qtdeclarative.git -b ${QT_VERSION} --depth 1 && \
git clone git://code.qt.io/qt/qtgraphicaleffects.git -b ${QT_VERSION} --depth 1 && \
git clone git://code.qt.io/qt/qtimageformats.git -b ${QT_VERSION} --depth 1 && \
git clone git://code.qt.io/qt/qtmultimedia.git -b ${QT_VERSION} --depth 1 && \
git clone git://code.qt.io/qt/qtquickcontrols.git -b ${QT_VERSION} --depth 1 && \
git clone git://code.qt.io/qt/qtquickcontrols2.git -b ${QT_VERSION} --depth 1 && \
git clone git://code.qt.io/qt/qtsvg.git -b ${QT_VERSION} --depth 1 && \
git clone git://code.qt.io/qt/qttools.git -b ${QT_VERSION} --depth 1 && \
git clone git://code.qt.io/qt/qttranslations.git -b ${QT_VERSION} --depth 1 && \
git clone git://code.qt.io/qt/qtx11extras.git -b ${QT_VERSION} --depth 1 && \
git clone git://code.qt.io/qt/qtxmlpatterns.git -b ${QT_VERSION} --depth 1 && \
sed -ri s/\(Libs:.*\)/\\1\ -lexpat/ /usr/local/lib/pkgconfig/fontconfig.pc && \
sed -ri s/\(Libs:.*\)/\\1\ -lz/ /usr/local/lib/pkgconfig/freetype2.pc && \
sed -ri s/\(Libs:.*\)/\\1\ -lXau/ /usr/local/lib/pkgconfig/xcb.pc && \
sed -i s/\\/usr\\/X11R6\\/lib64/\\/usr\\/local\\/lib/ qtbase/mkspecs/linux-g++-64/qmake.conf && \
./configure --prefix=/usr -platform linux-g++-64 -opensource -confirm-license -release -static -no-avx \
-opengl desktop -qpa xcb -xcb -xcb-xlib -feature-xlib -system-freetype -fontconfig -glib \
-no-dbus -no-feature-qml-worker-script -no-linuxfb -no-openssl -no-sql-sqlite -no-kms -no-use-gold-linker \
-qt-harfbuzz -qt-libjpeg -qt-libpng -qt-pcre -qt-zlib \
-skip qt3d -skip qtandroidextras -skip qtcanvas3d -skip qtcharts -skip qtconnectivity -skip qtdatavis3d \
-skip qtdoc -skip qtgamepad -skip qtlocation -skip qtmacextras -skip qtnetworkauth -skip qtpurchasing \
-skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qttools \
-skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview \
-skip qtwinextras -skip qtx11extras -skip gamepad -skip serialbus -skip location -skip webengine \
-nomake examples -nomake tests -nomake tools && \
make -j$THREADS && \
make -j$THREADS install && \
cd qttools/src/linguist/lrelease && \
../../../../qtbase/bin/qmake && \
make -j$THREADS && \
make -j$THREADS install && \
cd ../../../.. && \
rm -rf $(pwd)
RUN git clone -b v1.0.26 --depth 1 https://github.com/libusb/libusb && \
cd libusb && \
git reset --hard 4239bc3a50014b8e6a5a2a59df1fff3b7469543b && \
./autogen.sh --disable-shared --enable-static && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
RUN git clone -b hidapi-0.13.1 --depth 1 https://github.com/libusb/hidapi && \
cd hidapi && \
git reset --hard 4ebce6b5059b086d05ca7e091ce04a5fd08ac3ac && \
./bootstrap && \
./configure --disable-shared --enable-static && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
RUN git clone -b v4.3.4 --depth 1 https://github.com/zeromq/libzmq && \
cd libzmq && \
git reset --hard 4097855ddaaa65ed7b5e8cb86d143842a594eebd && \
./autogen.sh && \
./configure --disable-shared --enable-static --disable-libunwind --with-libsodium && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
RUN git clone -b libgpg-error-1.45 --depth 1 git://git.gnupg.org/libgpg-error.git && \
cd libgpg-error && \
git reset --hard dbac537e5e865fb6f3aa8596d213aa8c47a9dea1 && \
./autogen.sh && \
./configure --disable-shared --enable-static --disable-doc --disable-tests && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
RUN git clone -b libgcrypt-1.10.1 --depth 1 git://git.gnupg.org/libgcrypt.git && \
cd libgcrypt && \
git reset --hard ae0e567820c37f9640440b3cff77d7c185aa6742 && \
./autogen.sh && \
./configure --disable-shared --enable-static --disable-doc && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
RUN git clone -b v21.5 --depth 1 https://github.com/protocolbuffers/protobuf && \
cd protobuf && \
git reset --hard ab840345966d0fa8e7100d771c92a73bfbadd25c && \
./autogen.sh && \
./configure --enable-static --disable-shared && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)
RUN git clone -b v3.24.0 --depth 1 https://github.com/Kitware/CMake && \
cd CMake && \
git reset --hard 4be24f031a4829db75b85062cc67125035d8831e && \
./bootstrap && \
make -j$THREADS && \
make -j$THREADS install && \
rm -rf $(pwd)

View File

@@ -1,82 +0,0 @@
FROM ubuntu:20.04
ARG THREADS=1
ARG QT_VERSION=v5.15.13-lts-lgpl
ENV SOURCE_DATE_EPOCH=1397818193
RUN apt update && \
DEBIAN_FRONTEND=noninteractive apt install -y build-essential cmake g++-mingw-w64 gettext git libtool pkg-config \
python && \
rm -rf /var/lib/apt/lists/*
RUN update-alternatives --set x86_64-w64-mingw32-g++ $(which x86_64-w64-mingw32-g++-posix) && \
update-alternatives --set x86_64-w64-mingw32-gcc $(which x86_64-w64-mingw32-gcc-posix)
RUN git clone -b v0.18.2.0 --depth 1 https://github.com/monero-project/monero && \
cd monero && \
git reset --hard 99be9a044f3854f339548e2d99c539c18d7b1b01 && \
cp -a contrib/depends / && \
cd .. && \
rm -rf monero
RUN make -j$THREADS -C /depends HOST=x86_64-w64-mingw32 NO_QT=1
RUN git clone git://code.qt.io/qt/qt5.git -b ${QT_VERSION} --depth 1 && \
cd qt5 && \
git clone git://code.qt.io/qt/qtbase.git -b ${QT_VERSION} --depth 1 && \
git clone git://code.qt.io/qt/qtdeclarative.git -b ${QT_VERSION} --depth 1 && \
git clone git://code.qt.io/qt/qtgraphicaleffects.git -b ${QT_VERSION} --depth 1 && \
git clone git://code.qt.io/qt/qtimageformats.git -b ${QT_VERSION} --depth 1 && \
git clone git://code.qt.io/qt/qtmultimedia.git -b ${QT_VERSION} --depth 1 && \
git clone git://code.qt.io/qt/qtquickcontrols.git -b ${QT_VERSION} --depth 1 && \
git clone git://code.qt.io/qt/qtquickcontrols2.git -b ${QT_VERSION} --depth 1 && \
git clone git://code.qt.io/qt/qtsvg.git -b ${QT_VERSION} --depth 1 && \
git clone git://code.qt.io/qt/qttools.git -b ${QT_VERSION} --depth 1 && \
git clone git://code.qt.io/qt/qttranslations.git -b ${QT_VERSION} --depth 1 && \
git clone git://code.qt.io/qt/qtxmlpatterns.git -b ${QT_VERSION} --depth 1 && \
./configure --prefix=/depends/x86_64-w64-mingw32 -xplatform win32-g++ \
-device-option CROSS_COMPILE=/usr/bin/x86_64-w64-mingw32- \
-I $(pwd)/qtbase/src/3rdparty/angle/include \
-opensource -confirm-license -release -static -static-runtime -opengl dynamic -no-angle \
-no-avx -no-openssl -no-sql-sqlite \
-no-feature-qml-worker-script -no-openssl -no-sql-sqlite \
-qt-freetype -qt-harfbuzz -qt-libjpeg -qt-libpng -qt-pcre -qt-zlib \
-skip gamepad -skip location -skip qt3d -skip qtactiveqt -skip qtandroidextras \
-skip qtcanvas3d -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtdoc \
-skip qtgamepad -skip qtlocation -skip qtmacextras -skip qtnetworkauth -skip qtpurchasing \
-skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport \
-skip qtspeech -skip qttools -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel \
-skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtwinextras -skip qtx11extras \
-skip serialbus -skip webengine \
-nomake examples -nomake tests -nomake tools && \
make -j$THREADS && \
make -j$THREADS install && \
cd qttools/src/linguist/lrelease && \
../../../../qtbase/bin/qmake && \
make -j$THREADS && \
make -j$THREADS install && \
cd ../../../.. && \
rm -rf $(pwd)
RUN git clone -b libgpg-error-1.38 --depth 1 git://git.gnupg.org/libgpg-error.git && \
cd libgpg-error && \
git reset --hard 71d278824c5fe61865f7927a2ed1aa3115f9e439 && \
./autogen.sh && \
./configure --disable-shared --enable-static --disable-doc --disable-tests \
--host=x86_64-w64-mingw32 --prefix=/depends/x86_64-w64-mingw32 && \
make -j$THREADS && \
make -j$THREADS install && \
cd .. && \
rm -rf libgpg-error
RUN git clone -b libgcrypt-1.8.5 --depth 1 git://git.gnupg.org/libgcrypt.git && \
cd libgcrypt && \
git reset --hard 56606331bc2a80536db9fc11ad53695126007298 && \
./autogen.sh && \
./configure --disable-shared --enable-static --disable-doc \
--host=x86_64-w64-mingw32 --prefix=/depends/x86_64-w64-mingw32 \
--with-gpg-error-prefix=/depends/x86_64-w64-mingw32 && \
make -j$THREADS && \
make -j$THREADS install && \
cd .. && \
rm -rf libgcrypt

View File

@@ -1,4 +1,4 @@
Copyright (c) 2014-2024, The Monero Project Copyright (c) 2014-2018, The Monero Project
All rights reserved. All rights reserved.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,72 +26,69 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.2
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import moneroComponents.Wallet 1.0 import moneroComponents.Wallet 1.0
import moneroComponents.NetworkType 1.0 import moneroComponents.NetworkType 1.0
import moneroComponents.Clipboard 1.0 import "components"
import FontAwesome 1.0
import "components" as MoneroComponents
import "components/effects/" as MoneroEffects
Rectangle { Rectangle {
id: panel id: panel
property int currentAccountIndex property alias unlockedBalanceText: unlockedBalanceText.text
property alias currentAccountLabel: accountLabel.text property alias unlockedBalanceVisible: unlockedBalanceText.visible
property string balanceString: "?.??" property alias unlockedBalanceLabelVisible: unlockedBalanceLabel.visible
property string balanceUnlockedString: "?.??" property alias balanceLabelText: balanceLabel.text
property string balanceFiatString: "?.??" property alias balanceText: balanceText.text
property string minutesToUnlock: ""
property bool isSyncing: false
property alias networkStatus : networkStatus property alias networkStatus : networkStatus
property alias progressBar : progressBar property alias progressBar : progressBar
property alias daemonProgressBar : daemonProgressBar property alias daemonProgressBar : daemonProgressBar
property alias minutesToUnlockTxt: unlockedBalanceLabel.text
property int titleBarHeight: 50 property int titleBarHeight: 50
property string copyValue: ""
Clipboard { id: clipboard }
signal dashboardClicked()
signal historyClicked() signal historyClicked()
signal transferClicked() signal transferClicked()
signal receiveClicked() signal receiveClicked()
signal advancedClicked() signal txkeyClicked()
signal sharedringdbClicked()
signal settingsClicked() signal settingsClicked()
signal addressBookClicked() signal addressBookClicked()
signal accountClicked() signal miningClicked()
signal signClicked()
signal keysClicked()
function selectItem(pos) { function selectItem(pos) {
menuColumn.previousButton.checked = false menuColumn.previousButton.checked = false
if(pos === "History") menuColumn.previousButton = historyButton if(pos === "Dashboard") menuColumn.previousButton = dashboardButton
else if(pos === "History") menuColumn.previousButton = historyButton
else if(pos === "Transfer") menuColumn.previousButton = transferButton else if(pos === "Transfer") menuColumn.previousButton = transferButton
else if(pos === "Receive") menuColumn.previousButton = receiveButton else if(pos === "Receive") menuColumn.previousButton = receiveButton
else if(pos === "AddressBook") menuColumn.previousButton = addressBookButton else if(pos === "AddressBook") menuColumn.previousButton = addressBookButton
else if(pos === "Mining") menuColumn.previousButton = miningButton
else if(pos === "TxKey") menuColumn.previousButton = txkeyButton
else if(pos === "SharedRingDB") menuColumn.previousButton = sharedringdbButton
else if(pos === "Sign") menuColumn.previousButton = signButton
else if(pos === "Settings") menuColumn.previousButton = settingsButton else if(pos === "Settings") menuColumn.previousButton = settingsButton
else if(pos === "Advanced") menuColumn.previousButton = advancedButton else if(pos === "Advanced") menuColumn.previousButton = advancedButton
else if(pos === "Account") menuColumn.previousButton = accountButton else if(pos === "Keys") menuColumn.previousButton = keysButton
menuColumn.previousButton.checked = true menuColumn.previousButton.checked = true
} }
width: 300 width: (isMobile)? appWindow.width : 300
color: "transparent" color: "transparent"
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.top: parent.top anchors.top: parent.top
MoneroEffects.GradientBackground { Image {
anchors.fill: parent anchors.left: parent.left
fallBackColor: MoneroComponents.Style.middlePanelBackgroundColor anchors.right: parent.right
initialStartColor: MoneroComponents.Style.leftPanelBackgroundGradientStart anchors.top: parent.top
initialStopColor: MoneroComponents.Style.leftPanelBackgroundGradientStop height: panel.height
blackColorStart: MoneroComponents.Style._b_leftPanelBackgroundGradientStart source: "images/leftPanelBg.jpg"
blackColorStop: MoneroComponents.Style._b_leftPanelBackgroundGradientStop z: 1
whiteColorStart: MoneroComponents.Style._w_leftPanelBackgroundGradientStart
whiteColorStop: MoneroComponents.Style._w_leftPanelBackgroundGradientStop
posStart: 0.6
start: Qt.point(0, 0)
end: Qt.point(height, width)
} }
// card with monero logo // card with monero logo
@@ -99,43 +96,30 @@ Rectangle {
visible: true visible: true
z: 2 z: 2
id: column1 id: column1
height: 175 height: 210
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: (persistentSettings.customDecorations)? 50 : 0 anchors.topMargin: (persistentSettings.customDecorations)? 50 : 0
Item { RowLayout {
visible: true
Item { Item {
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 20 anchors.topMargin: 20
anchors.leftMargin: 20 anchors.leftMargin: 20
height: 490 anchors.verticalCenter: parent.verticalCenter
width: 260 height: 490 * scaleRatio
width: 260 * scaleRatio
Image { Image {
id: card width: 260; height: 170
visible: !isOpenGL || MoneroComponents.Style.blackTheme
width: 260
height: 135
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
source: MoneroComponents.Style.blackTheme ? "qrc:///images/card-background-black" + (currentAccountIndex % MoneroComponents.Style.accountColors.length) + ".png" : "qrc:///images/card-background-white.png" source: "images/card-background.png"
} }
DropShadow { Text {
visible: isOpenGL && !MoneroComponents.Style.blackTheme
anchors.fill: card
horizontalOffset: 3
verticalOffset: 3
radius: 10.0
samples: 15
color: "#3B000000"
source: card
cached: true
}
MoneroComponents.TextPlain {
id: testnetLabel id: testnetLabel
visible: persistentSettings.nettype != NetworkType.MAINNET visible: persistentSettings.nettype != NetworkType.MAINNET
text: (persistentSettings.nettype == NetworkType.TESTNET ? qsTr("Testnet") : qsTr("Stagenet")) + translationManager.emptyString text: (persistentSettings.nettype == NetworkType.TESTNET ? qsTr("Testnet") : qsTr("Stagenet")) + translationManager.emptyString
@@ -146,10 +130,9 @@ Rectangle {
font.bold: true font.bold: true
font.pixelSize: 12 font.pixelSize: 12
color: "#f33434" color: "#f33434"
themeTransition: false
} }
MoneroComponents.TextPlain { Text {
id: viewOnlyLabel id: viewOnlyLabel
visible: viewOnly visible: viewOnly
text: qsTr("View Only") + translationManager.emptyString text: qsTr("View Only") + translationManager.emptyString
@@ -160,7 +143,6 @@ Rectangle {
font.pixelSize: 12 font.pixelSize: 12
font.bold: true font.bold: true
color: "#ff9323" color: "#ff9323"
themeTransition: false
} }
} }
@@ -169,154 +151,91 @@ Rectangle {
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 20 anchors.topMargin: 20
anchors.leftMargin: 20 anchors.leftMargin: 20
height: 490 anchors.verticalCenter: parent.verticalCenter
width: 50 height: 490 * scaleRatio
width: 50 * scaleRatio
MoneroComponents.Label { Text {
fontSize: 12 visible: !isMobile
id: accountIndex id: balanceText
text: qsTr("Account") + translationManager.emptyString + " #" + currentAccountIndex
color: MoneroComponents.Style.blackTheme ? "white" : "black"
anchors.left: parent.left
anchors.leftMargin: 60
anchors.top: parent.top
anchors.topMargin: 23
themeTransition: false
MouseArea{
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: appWindow.showPageRequest("Account")
}
}
MoneroComponents.Label {
fontSize: 16
id: accountLabel
textWidth: 170
color: MoneroComponents.Style.blackTheme ? "white" : "black"
anchors.left: parent.left
anchors.leftMargin: 60
anchors.top: parent.top
anchors.topMargin: 36
themeTransition: false
elide: Text.ElideRight
MouseArea {
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: appWindow.showPageRequest("Account")
}
}
MoneroComponents.Label {
fontSize: 16
visible: isSyncing
text: qsTr("Syncing...") + translationManager.emptyString
color: MoneroComponents.Style.blackTheme ? "white" : "black"
anchors.left: parent.left
anchors.leftMargin: 20
anchors.bottom: currencyLabel.top
anchors.bottomMargin: 15
themeTransition: false
}
MoneroComponents.TextPlain {
id: currencyLabel
font.pixelSize: 16
text: {
if (persistentSettings.fiatPriceEnabled && persistentSettings.fiatPriceToggle) {
return appWindow.fiatApiCurrencySymbol();
} else {
return "XMR"
}
}
color: MoneroComponents.Style.blackTheme ? "white" : "black"
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 20 anchors.leftMargin: 20
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 100 anchors.topMargin: 76
themeTransition: false font.family: "Arial"
color: "#FFFFFF"
MouseArea { text: "N/A"
hoverEnabled: true // dynamically adjust text size
anchors.fill: parent
visible: persistentSettings.fiatPriceEnabled
cursorShape: Qt.PointingHandCursor
onClicked: persistentSettings.fiatPriceToggle = !persistentSettings.fiatPriceToggle
}
}
MoneroComponents.TextPlain {
id: balancePart1
themeTransition: false
anchors.left: parent.left
anchors.leftMargin: 58
anchors.baseline: currencyLabel.baseline
color: MoneroComponents.Style.blackTheme ? "white" : "black"
Binding on color {
when: balancePart1MouseArea.containsMouse || balancePart2MouseArea.containsMouse
value: MoneroComponents.Style.orange
}
text: {
if (persistentSettings.fiatPriceEnabled && persistentSettings.fiatPriceToggle) {
return balanceFiatString.split('.')[0] + "."
} else {
return balanceString.split('.')[0] + "."
}
}
font.pixelSize: { font.pixelSize: {
var defaultSize = 29; var digits = text.split('.')[0].length
var digits = (balancePart1.text.length - 1) var defaultSize = 22;
if (digits > 2 && !(persistentSettings.fiatPriceEnabled && persistentSettings.fiatPriceToggle)) { if(digits > 2) {
return defaultSize - 1.1 * digits return defaultSize - 1.1*digits
} else {
return defaultSize
} }
} return defaultSize;
MouseArea {
id: balancePart1MouseArea
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
console.log("Copied to clipboard");
clipboard.setText(balancePart1.text + balancePart2.text);
appWindow.showStatusMessage(qsTr("Copied to clipboard"),3)
}
}
}
MoneroComponents.TextPlain {
id: balancePart2
themeTransition: false
anchors.left: balancePart1.right
anchors.leftMargin: 2
anchors.baseline: currencyLabel.baseline
color: balancePart1.color
text: {
if (persistentSettings.fiatPriceEnabled && persistentSettings.fiatPriceToggle) {
return balanceFiatString.split('.')[1]
} else {
return balanceString.split('.')[1]
}
}
font.pixelSize: 16
MouseArea {
id: balancePart2MouseArea
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: balancePart1MouseArea.clicked(mouse)
} }
} }
Text {
id: unlockedBalanceText
visible: true
anchors.left: parent.left
anchors.leftMargin: 20
anchors.top: parent.top
anchors.topMargin: 126
font.family: "Arial"
color: "#FFFFFF"
text: "N/A"
// dynamically adjust text size
font.pixelSize: {
var digits = text.split('.')[0].length
var defaultSize = 20;
if(digits > 3) {
return defaultSize - 0.6*digits
}
return defaultSize;
}
}
Label {
id: unlockedBalanceLabel
visible: true
text: qsTr("Unlocked balance") + translationManager.emptyString
anchors.left: parent.left
anchors.leftMargin: 20
anchors.top: parent.top
anchors.topMargin: 110
}
Label {
visible: !isMobile
id: balanceLabel
text: qsTr("Balance") + translationManager.emptyString
fontSize: 14
anchors.left: parent.left
anchors.leftMargin: 20
anchors.top: parent.top
anchors.topMargin: 60
}
Item { //separator Item { //separator
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
height: 1 height: 1
} }
/* Disable twitter/news panel
Image {
anchors.left: parent.left
anchors.verticalCenter: logo.verticalCenter
anchors.leftMargin: 19
source: appWindow.rightPanelExpanded ? "images/expandRightPanel.png" :
"images/collapseRightPanel.png"
}
MouseArea {
anchors.fill: parent
onClicked: appWindow.rightPanelExpanded = !appWindow.rightPanelExpanded
}
*/
} }
} }
} }
@@ -327,19 +246,20 @@ Rectangle {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.top: column1.bottom anchors.top: (isMobile)? parent.top : column1.bottom
color: "transparent" color: "transparent"
Flickable { Flickable {
id:flicker id:flicker
contentHeight: menuColumn.height contentHeight: menuColumn.height
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: progressBar.visible ? progressBar.top : networkStatus.top anchors.bottom: networkStatus.top
width: parent.width width: parent.width
boundsBehavior: isMac ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
clip: true clip: true
Column { Column {
id: menuColumn id: menuColumn
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@@ -347,42 +267,51 @@ Rectangle {
clip: true clip: true
property var previousButton: transferButton property var previousButton: transferButton
// top border // ------------- Dashboard tab ---------------
MoneroComponents.MenuButtonDivider {
/*
MenuButton {
id: dashboardButton
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.leftMargin: 20 text: qsTr("Dashboard") + translationManager.emptyString
} symbol: qsTr("D") + translationManager.emptyString
dotColor: "#FFE00A"
// ------------- Account tab --------------- checked: true
MoneroComponents.MenuButton {
id: accountButton
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Account") + translationManager.emptyString
symbol: (isMac ? "⌃" : qsTr("Ctrl+")) + "T" + translationManager.emptyString
onClicked: { onClicked: {
parent.previousButton.checked = false parent.previousButton.checked = false
parent.previousButton = accountButton parent.previousButton = dashboardButton
panel.accountClicked() panel.dashboardClicked()
} }
} }
MoneroComponents.MenuButtonDivider {
visible: accountButton.present Rectangle {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.leftMargin: 20 anchors.leftMargin: 16
color: dashboardButton.checked || transferButton.checked ? "#1C1C1C" : "#313131"
height: 1
}
*/
// top border
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 16
color: "#313131"
height: 1
} }
// ------------- Transfer tab --------------- // ------------- Transfer tab ---------------
MoneroComponents.MenuButton { MenuButton {
id: transferButton id: transferButton
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
text: qsTr("Send") + translationManager.emptyString text: qsTr("Send") + translationManager.emptyString
symbol: (isMac ? "⌃" : qsTr("Ctrl+")) + "S" + translationManager.emptyString symbol: qsTr("S") + translationManager.emptyString
dotColor: "#FF6C3C"
onClicked: { onClicked: {
parent.previousButton.checked = false parent.previousButton.checked = false
parent.previousButton = transferButton parent.previousButton = transferButton
@@ -390,21 +319,24 @@ Rectangle {
} }
} }
MoneroComponents.MenuButtonDivider { Rectangle {
visible: transferButton.present visible: transferButton.present
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.leftMargin: 20 anchors.leftMargin: 16
color: "#313131"
height: 1
} }
// ------------- AddressBook tab --------------- // ------------- AddressBook tab ---------------
MoneroComponents.MenuButton { MenuButton {
id: addressBookButton id: addressBookButton
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
text: qsTr("Address book") + translationManager.emptyString text: qsTr("Address book") + translationManager.emptyString
symbol: (isMac ? "⌃" : qsTr("Ctrl+")) + "B" + translationManager.emptyString symbol: qsTr("B") + translationManager.emptyString
dotColor: "#FF4F41"
under: transferButton under: transferButton
onClicked: { onClicked: {
parent.previousButton.checked = false parent.previousButton.checked = false
@@ -413,97 +345,224 @@ Rectangle {
} }
} }
MoneroComponents.MenuButtonDivider { Rectangle {
visible: addressBookButton.present visible: addressBookButton.present
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.leftMargin: 20 anchors.leftMargin: 16
color: "#313131"
height: 1
} }
// ------------- Receive tab --------------- // ------------- Receive tab ---------------
MoneroComponents.MenuButton { MenuButton {
id: receiveButton id: receiveButton
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
text: qsTr("Receive") + translationManager.emptyString text: qsTr("Receive") + translationManager.emptyString
symbol: (isMac ? "⌃" : qsTr("Ctrl+")) + "R" + translationManager.emptyString symbol: qsTr("R") + translationManager.emptyString
dotColor: "#AAFFBB"
onClicked: { onClicked: {
parent.previousButton.checked = false parent.previousButton.checked = false
parent.previousButton = receiveButton parent.previousButton = receiveButton
panel.receiveClicked() panel.receiveClicked()
} }
} }
Rectangle {
MoneroComponents.MenuButtonDivider {
visible: receiveButton.present visible: receiveButton.present
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.leftMargin: 20 anchors.leftMargin: 16
color: "#313131"
height: 1
} }
// ------------- History tab --------------- // ------------- History tab ---------------
MoneroComponents.MenuButton { MenuButton {
id: historyButton id: historyButton
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
text: qsTr("Transactions") + translationManager.emptyString text: qsTr("History") + translationManager.emptyString
symbol: (isMac ? "⌃" : qsTr("Ctrl+")) + "H" + translationManager.emptyString symbol: qsTr("H") + translationManager.emptyString
dotColor: "#6B0072"
onClicked: { onClicked: {
parent.previousButton.checked = false parent.previousButton.checked = false
parent.previousButton = historyButton parent.previousButton = historyButton
panel.historyClicked() panel.historyClicked()
} }
} }
Rectangle {
MoneroComponents.MenuButtonDivider {
visible: historyButton.present visible: historyButton.present
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.leftMargin: 20 anchors.leftMargin: 16
color: "#313131"
height: 1
} }
// ------------- Advanced tab --------------- // ------------- Advanced tab ---------------
MoneroComponents.MenuButton { MenuButton {
id: advancedButton id: advancedButton
visible: appWindow.walletMode >= 2
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
text: qsTr("Advanced") + translationManager.emptyString text: qsTr("Advanced") + translationManager.emptyString
symbol: (isMac ? "⌃" : qsTr("Ctrl+")) + "D" + translationManager.emptyString symbol: qsTr("D") + translationManager.emptyString
dotColor: "#FFD781"
onClicked: { onClicked: {
parent.previousButton.checked = false parent.previousButton.checked = false
parent.previousButton = advancedButton parent.previousButton = advancedButton
panel.advancedClicked() }
}
Rectangle {
visible: advancedButton.present
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 16
color: "#313131"
height: 1
}
// ------------- Mining tab ---------------
MenuButton {
id: miningButton
visible: !isAndroid && !isIOS
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Mining") + translationManager.emptyString
symbol: qsTr("M") + translationManager.emptyString
dotColor: "#FFD781"
under: advancedButton
onClicked: {
parent.previousButton.checked = false
parent.previousButton = miningButton
panel.miningClicked()
} }
} }
MoneroComponents.MenuButtonDivider { Rectangle {
visible: advancedButton.present && appWindow.walletMode >= 2 visible: miningButton.present
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.leftMargin: 20 anchors.leftMargin: 16
color: miningButton.checked || settingsButton.checked ? "#1C1C1C" : "#313131"
height: 1
}
// ------------- TxKey tab ---------------
MenuButton {
id: txkeyButton
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Prove/check") + translationManager.emptyString
symbol: qsTr("K") + translationManager.emptyString
dotColor: "#FFD781"
under: advancedButton
onClicked: {
parent.previousButton.checked = false
parent.previousButton = txkeyButton
panel.txkeyClicked()
}
}
Rectangle {
visible: txkeyButton.present
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 16
color: "#313131"
height: 1
}
// ------------- Shared RingDB tab ---------------
MenuButton {
id: sharedringdbButton
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Shared RingDB") + translationManager.emptyString
symbol: qsTr("G") + translationManager.emptyString
dotColor: "#FFD781"
under: advancedButton
onClicked: {
parent.previousButton.checked = false
parent.previousButton = sharedringdbButton
panel.sharedringdbClicked()
}
}
Rectangle {
visible: sharedringdbButton.present
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 16
color: "#313131"
height: 1
} }
// ------------- Sign/verify tab ---------------
MenuButton {
id: signButton
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Sign/verify") + translationManager.emptyString
symbol: qsTr("I") + translationManager.emptyString
dotColor: "#FFD781"
under: advancedButton
onClicked: {
parent.previousButton.checked = false
parent.previousButton = signButton
panel.signClicked()
}
}
Rectangle {
visible: signButton.present
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 16
color: "#313131"
height: 1
}
// ------------- Settings tab --------------- // ------------- Settings tab ---------------
MoneroComponents.MenuButton { MenuButton {
id: settingsButton id: settingsButton
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
text: qsTr("Settings") + translationManager.emptyString text: qsTr("Settings") + translationManager.emptyString
symbol: (isMac ? "⌃" : qsTr("Ctrl+")) + "E" + translationManager.emptyString symbol: qsTr("E") + translationManager.emptyString
dotColor: "#36B25C"
onClicked: { onClicked: {
parent.previousButton.checked = false parent.previousButton.checked = false
parent.previousButton = settingsButton parent.previousButton = settingsButton
panel.settingsClicked() panel.settingsClicked()
} }
} }
Rectangle {
MoneroComponents.MenuButtonDivider {
visible: settingsButton.present visible: settingsButton.present
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.leftMargin: 20 anchors.leftMargin: 16
color: "#313131"
height: 1
}
// ------------- Sign/verify tab ---------------
MenuButton {
id: keysButton
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Seed & Keys") + translationManager.emptyString
symbol: qsTr("Y") + translationManager.emptyString
dotColor: "#FFD781"
under: settingsButton
onClicked: {
parent.previousButton.checked = false
parent.previousButton = keysButton
panel.keysClicked()
}
}
Rectangle {
visible: settingsButton.present
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 16
color: "#313131"
height: 1
} }
} // Column } // Column
@@ -516,41 +575,51 @@ Rectangle {
anchors.right: parent.right anchors.right: parent.right
anchors.leftMargin: 0 anchors.leftMargin: 0
anchors.rightMargin: 0 anchors.rightMargin: 0
anchors.bottom: progressBar.visible ? progressBar.top : networkStatus.top anchors.bottom: networkStatus.top;
height: 10 height: 10 * scaleRatio
color: "transparent" color: "transparent"
} }
MoneroComponents.ProgressBar { NetworkStatusItem {
id: networkStatus
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 0
anchors.rightMargin: 0
anchors.bottom: (progressBar.visible)? progressBar.top : parent.bottom;
connected: Wallet.ConnectionStatus_Disconnected
height: 48 * scaleRatio
}
ProgressBar {
id: progressBar id: progressBar
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: daemonProgressBar.top anchors.bottom: daemonProgressBar.top
height: 48 height: 48 * scaleRatio
syncType: qsTr("Wallet") + translationManager.emptyString syncType: qsTr("Wallet")
visible: !appWindow.disconnected visible: networkStatus.connected
} }
MoneroComponents.ProgressBar { ProgressBar {
id: daemonProgressBar id: daemonProgressBar
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: networkStatus.top
syncType: qsTr("Daemon") + translationManager.emptyString
visible: !appWindow.disconnected
height: 62
}
MoneroComponents.NetworkStatusItem {
id: networkStatus
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 5
anchors.rightMargin: 0
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: 5 syncType: qsTr("Daemon")
connected: Wallet.ConnectionStatus_Disconnected visible: networkStatus.connected
height: 48 height: 62 * scaleRatio
} }
} } // menuRect
// indicate disabled state
// Desaturate {
// anchors.fill: parent
// source: parent
// desaturation: panel.enabled ? 0.0 : 1.0
// }
} }

49
Logger.cpp Normal file
View File

@@ -0,0 +1,49 @@
#include <QCoreApplication>
#include <QStandardPaths>
#include <QFileInfo>
#include <QString>
#include "Logger.h"
#include "wallet/api/wallet2_api.h"
// default log path by OS (should be writable)
static const QString default_name = "monero-wallet-gui.log";
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
static const QString osPath = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation).at(0);
#elif defined(Q_OS_WIN)
static const QString osPath = QCoreApplication::applicationDirPath();
#elif defined(Q_OS_MAC)
static const QString osPath = QStandardPaths::standardLocations(QStandardPaths::HomeLocation).at(0) + "/Library/Logs";
#else // linux + bsd
static const QString osPath = QStandardPaths::standardLocations(QStandardPaths::HomeLocation).at(0);
#endif
// return the absolute path of the logfile
const QString getLogPath(const QString logPath)
{
const QFileInfo fi(logPath);
if(!logPath.isEmpty() && !fi.isDir())
return fi.absoluteFilePath();
else
return osPath + "/" + default_name;
}
// 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;
}
}

8
Logger.h Normal file
View File

@@ -0,0 +1,8 @@
#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

14
MainApp.cpp Normal file
View File

@@ -0,0 +1,14 @@
#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;
}
return false;
}

18
MainApp.h Normal file
View File

@@ -0,0 +1,18 @@
#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

View File

@@ -1,70 +0,0 @@
ANDROID_STANDALONE_TOOLCHAIN_PATH ?= /usr/local/toolchain
MANUAL_SUBMODULES ?= OFF
dotgit=$(shell ls -d .git/config)
ifeq ($(dotgit), .git/config)
ifeq ($(shell git --version > /dev/null 2>&1 ; echo $$?), 0)
git = yes
else
$(warning git command not found)
endif
endif
builddir := build
topdir := ../..
ifeq ($(USE_SINGLE_BUILDDIR), OFF)
os := $(shell echo `uname | sed -e 's|[:/\\ \(\)]|_|g'`)
builddir := $(builddir)/$(os)
topdir := $(topdir)/..
ifdef git
branch := $(shell git branch | grep '\* ' | cut -f2- -d' '| sed -e 's|[:/\\ \(\)]|_|g')
builddir := $(builddir)/$(branch)
topdir := $(topdir)/..
endif
deldirs := $(builddir)
else
deldirs := $(builddir)/debug $(builddir)/release $(builddir)/fuzz
endif
default:
mkdir -p build && cd build && cmake -D DEV_MODE=$(or ${DEV_MODE},OFF) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release .. && $(MAKE)
debug:
mkdir -p build && cd build && cmake -D DEV_MODE=$(or ${DEV_MODE},ON) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -D CMAKE_BUILD_TYPE=Debug .. && $(MAKE) VERBOSE=1
depends:
mkdir -p build/$(target)/release
cd build/$(target)/release && cmake -D STATIC=ON -D DEV_MODE=$(or ${DEV_MODE},OFF) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -D BUILD_TAG=$(tag) -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=$(root)/$(target)/share/toolchain.cmake ../../.. && $(MAKE)
devmode:
mkdir -p build && cd build && cmake -D DEV_MODE=$(or ${DEV_MODE},ON) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release .. && $(MAKE)
clean:
mkdir -p build && cd build && rm -rf *
scanner:
mkdir -p build && cd build && cmake -D DEV_MODE=$(or ${DEV_MODE},ON) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -D WITH_SCANNER=ON -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release .. && $(MAKE)
release:
mkdir -p $(builddir)/release && cd $(builddir)/release && cmake -D DEV_MODE=$(or ${DEV_MODE},OFF) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -D CMAKE_BUILD_TYPE=Release $(topdir) && $(MAKE)
release-linux-armv8:
mkdir -p $(builddir)/release && cd $(builddir)/release && cmake -D DEV_MODE=$(or ${DEV_MODE},OFF) -D ARCH="armv8-a" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="linux-armv8" $(topdir) && $(MAKE)
release-linux-ppc64le:
mkdir -p $(builddir)/release && cd $(builddir)/release && cmake -D DEV_MODE=$(or ${DEV_MODE},OFF) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -D ARCH="ppc64le" -D CMAKE_BUILD_TYPE=Release $(topdir) && $(MAKE)
release-static:
mkdir -p $(builddir)/release && cd $(builddir)/release && cmake -D STATIC=ON -D DEV_MODE=$(or ${DEV_MODE},OFF) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release $(topdir) && $(MAKE)
debug-static-win64:
mkdir -p $(builddir)/debug && cd $(builddir)/debug && cmake -D STATIC=ON -G "MSYS Makefiles" -D DEV_MODE=$(or ${DEV_MODE},ON) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Debug -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=$(shell cd ${MINGW_PREFIX}/.. && pwd -W) -D MINGW=ON $(topdir) && $(MAKE)
debug-static-mac64:
mkdir -p $(builddir)/debug
cd $(builddir)/debug && cmake -D STATIC=ON -D DEV_MODE=$(or ${DEV_MODE},ON) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Debug -D BUILD_TAG="mac-x64" $(topdir) && $(MAKE)
release-static-win64:
mkdir -p $(builddir)/release && cd $(builddir)/release && cmake -D STATIC=ON -G "MSYS Makefiles" -D DEV_MODE=$(or ${DEV_MODE},OFF) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=$(shell cd ${MINGW_PREFIX}/.. && pwd -W) -D MINGW=ON $(topdir) && $(MAKE)
release-win64:
mkdir -p $(builddir)/release && cd $(builddir)/release && cmake -D STATIC=OFF -G "MSYS Makefiles" -D DEV_MODE=$(or ${DEV_MODE},OFF) -DMANUAL_SUBMODULES=${MANUAL_SUBMODULES} -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=$(shell cd ${MINGW_PREFIX}/.. && pwd -W) -D MINGW=ON $(topdir) && $(MAKE)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -28,8 +28,9 @@
import QtQml 2.0 import QtQml 2.0
import QtQuick 2.9 import QtQuick 2.2
import QtQuick.Controls 2.0 // QtQuick.Controls 2.0 isn't stable enough yet. Needs more testing.
//import QtQuick.Controls 2.0
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
@@ -37,57 +38,46 @@ import moneroComponents.Wallet 1.0
import "./pages" import "./pages"
import "./pages/settings" import "./pages/settings"
import "./pages/merchant"
import "./components" as MoneroComponents
import "./components/effects/" as MoneroEffects
Rectangle { Rectangle {
id: root id: root
property Item currentView property Item currentView
property Item previousView property Item previousView
property int minHeight: (appWindow.height > 800) ? appWindow.height : 800 property bool basicMode : isMobile
property string balanceLabelText: qsTr("Balance") + translationManager.emptyString
property string balanceText
property string unlockedBalanceLabelText: qsTr("Unlocked Balance") + translationManager.emptyString
property string unlockedBalanceText
property int minHeight: (appWindow.height > 800) ? appWindow.height : 800 * scaleRatio
property alias contentHeight: mainFlickable.contentHeight property alias contentHeight: mainFlickable.contentHeight
property alias flickable: mainFlickable property alias flickable: mainFlickable
// property int headerHeight: header.height
property Transfer transferView: Transfer { property Transfer transferView: Transfer { }
onPaymentClicked: root.paymentClicked(recipients, paymentId, mixinCount, priority, description)
onSweepUnmixableClicked: root.sweepUnmixableClicked()
}
property Receive receiveView: Receive { } property Receive receiveView: Receive { }
property Merchant merchantView: Merchant { } property TxKey txkeyView: TxKey { }
property SharedRingDB sharedringdbView: SharedRingDB { }
property History historyView: History { } property History historyView: History { }
property Advanced advancedView: Advanced { } property Sign signView: Sign { }
property Settings settingsView: Settings { } property Settings settingsView: Settings { }
property Mining miningView: Mining { }
property AddressBook addressBookView: AddressBook { } property AddressBook addressBookView: AddressBook { }
property Keys keysView: Keys { } property Keys keysView: Keys { }
property Account accountView: Account { }
signal paymentClicked(var recipients, string paymentId, int mixinCount, int priority, string description)
signal paymentClicked(string address, string paymentId, string amount, int mixinCount, int priority, string description)
signal sweepUnmixableClicked() signal sweepUnmixableClicked()
signal generatePaymentIdInvoked() signal generatePaymentIdInvoked()
signal getProofClicked(string txid, string address, string message, string amount); signal getProofClicked(string txid, string address, string message);
signal checkProofClicked(string txid, string address, string message, string signature); signal checkProofClicked(string txid, string address, string message, string signature);
Rectangle { Image {
// grey background on merchantView anchors.left: parent.left
visible: currentView === merchantView anchors.right: parent.right
color: MoneroComponents.Style.moneroGrey anchors.top: parent.top
anchors.fill: parent anchors.bottom: parent.bottom
} source: "../images/middlePanelBg.jpg"
MoneroEffects.GradientBackground {
visible: currentView !== merchantView
anchors.fill: parent
fallBackColor: MoneroComponents.Style.middlePanelBackgroundColor
initialStartColor: MoneroComponents.Style.middlePanelBackgroundGradientStart
initialStopColor: MoneroComponents.Style.middlePanelBackgroundGradientStop
blackColorStart: MoneroComponents.Style._b_middlePanelBackgroundGradientStart
blackColorStop: MoneroComponents.Style._b_middlePanelBackgroundGradientStop
whiteColorStart: MoneroComponents.Style._w_middlePanelBackgroundGradientStart
whiteColorStop: MoneroComponents.Style._w_middlePanelBackgroundGradientStop
start: Qt.point(0, 0)
end: Qt.point(height, width)
} }
onCurrentViewChanged: { onCurrentViewChanged: {
@@ -116,63 +106,74 @@ Rectangle {
transferView.sendTo(address, paymentId, description); transferView.sendTo(address, paymentId, description);
} }
// open Transactions page with search term in search field
function searchInHistory(searchTerm){
root.state = "History";
historyView.searchInHistory(searchTerm);
}
states: [ states: [
State { State {
name: "Dashboard"
PropertyChanges { }
}, State {
name: "History" name: "History"
PropertyChanges { target: root; currentView: historyView } PropertyChanges { target: root; currentView: historyView }
PropertyChanges { target: mainFlickable; contentHeight: historyView.contentHeight + 80} PropertyChanges { target: historyView; model: appWindow.currentWallet ? appWindow.currentWallet.historyModel : null }
PropertyChanges { target: mainFlickable; contentHeight: historyView.tableHeight + 220 * scaleRatio }
}, State { }, State {
name: "Transfer" name: "Transfer"
PropertyChanges { target: root; currentView: transferView } PropertyChanges { target: root; currentView: transferView }
PropertyChanges { target: mainFlickable; contentHeight: transferView.transferHeight1 + transferView.transferHeight2 + 80 } PropertyChanges { target: mainFlickable; contentHeight: 1000 * scaleRatio }
}, State { }, State {
name: "Receive" name: "Receive"
PropertyChanges { target: root; currentView: receiveView } PropertyChanges { target: root; currentView: receiveView }
PropertyChanges { target: mainFlickable; contentHeight: receiveView.receiveHeight + 80 } PropertyChanges { target: mainFlickable; contentHeight: receiveView.receiveHeight + 100 }
}, State { }, State {
name: "Merchant" name: "TxKey"
PropertyChanges { target: root; currentView: merchantView } PropertyChanges { target: root; currentView: txkeyView }
PropertyChanges { target: mainFlickable; contentHeight: merchantView.merchantHeight + 80 } PropertyChanges { target: mainFlickable; contentHeight: 1200 * scaleRatio }
}, State {
name: "SharedRingDB"
PropertyChanges { target: root; currentView: sharedringdbView }
PropertyChanges { target: mainFlickable; contentHeight: sharedringdbView.panelHeight + 100 }
}, State { }, State {
name: "AddressBook" name: "AddressBook"
PropertyChanges { target: root; currentView: addressBookView } PropertyChanges { target: root; currentView: addressBookView }
PropertyChanges { target: mainFlickable; contentHeight: addressBookView.addressbookHeight + 80 } PropertyChanges { target: mainFlickable; contentHeight: minHeight }
}, State { }, State {
name: "Advanced" name: "Sign"
PropertyChanges { target: root; currentView: advancedView } PropertyChanges { target: root; currentView: signView }
PropertyChanges { target: mainFlickable; contentHeight: advancedView.panelHeight } PropertyChanges { target: mainFlickable; contentHeight: 1200 * scaleRatio }
}, State { }, State {
name: "Settings" name: "Settings"
PropertyChanges { target: root; currentView: settingsView } PropertyChanges { target: root; currentView: settingsView }
PropertyChanges { target: mainFlickable; contentHeight: settingsView.settingsHeight } PropertyChanges { target: mainFlickable; contentHeight: settingsView.settingsHeight }
}, State {
name: "Mining"
PropertyChanges { target: root; currentView: miningView }
PropertyChanges { target: mainFlickable; contentHeight: minHeight }
}, State { }, State {
name: "Keys" name: "Keys"
PropertyChanges { target: root; currentView: keysView } PropertyChanges { target: root; currentView: keysView }
PropertyChanges { target: mainFlickable; contentHeight: keysView.keysHeight + 80} PropertyChanges { target: mainFlickable; contentHeight: minHeight + 200 * scaleRatio }
}, State {
name: "Account"
PropertyChanges { target: root; currentView: accountView }
PropertyChanges { target: mainFlickable; contentHeight: accountView.accountHeight + 80 }
} }
] ]
// color stripe at the top
Row {
id: styledRow
height: 4
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
Rectangle { height: 4; width: parent.width / 5; color: "#FFE00A" }
Rectangle { height: 4; width: parent.width / 5; color: "#6B0072" }
Rectangle { height: 4; width: parent.width / 5; color: "#FF6C3C" }
Rectangle { height: 4; width: parent.width / 5; color: "#FFD781" }
Rectangle { height: 4; width: parent.width / 5; color: "#FF4F41" }
}
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent
anchors.margins: { anchors.margins: 18
if(currentView === merchantView || currentView === historyView)
return 0;
return 20;
}
anchors.topMargin: appWindow.persistentSettings.customDecorations ? 50 : 0 anchors.topMargin: appWindow.persistentSettings.customDecorations ? 50 : 0
anchors.bottomMargin: 0
spacing: 0 spacing: 0
Flickable { Flickable {
@@ -180,23 +181,15 @@ Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
clip: true clip: true
boundsBehavior: isMac ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
ScrollBar.vertical: ScrollBar {
parent: root
anchors.left: parent.right
anchors.leftMargin: -14 // 10 margin + 4 scrollbar width
anchors.top: parent.top
anchors.topMargin: persistentSettings.customDecorations ? 60 : 10
anchors.bottom: parent.bottom
anchors.bottomMargin: persistentSettings.customDecorations ? 15 : 10
onActiveChanged: if (!active && !isMac) active = true
}
onFlickingChanged: { onFlickingChanged: {
releaseFocus(); releaseFocus();
} }
// Disabled scrollbars, gives crash on startup on windows
// ScrollIndicator.vertical: ScrollIndicator { }
// ScrollBar.vertical: ScrollBar { } // uncomment to test
// Views container // Views container
StackView { StackView {
id: stackView id: stackView
@@ -231,27 +224,24 @@ Rectangle {
// border // border
Rectangle { Rectangle {
id: borderLeft anchors.top: styledRow.bottom
visible: middlePanel.state !== "Merchant"
anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.left: parent.left anchors.left: parent.left
width: 1 width: 1
color: MoneroComponents.Style.appWindowBorderColor color: "#313131"
}
MoneroEffects.ColorTransition { /* connect "payment" click */
targetObj: parent Connections {
blackColor: MoneroComponents.Style._b_appWindowBorderColor ignoreUnknownSignals: false
whiteColor: MoneroComponents.Style._w_appWindowBorderColor target: transferView
onPaymentClicked : {
console.log("MiddlePanel: paymentClicked")
paymentClicked(address, paymentId, amount, mixinCount, priority, description)
}
onSweepUnmixableClicked : {
console.log("MiddlePanel: sweepUnmixableClicked")
sweepUnmixableClicked()
} }
} }
// border shadow
Image {
source: "qrc:///images/middlePanelShadow.png"
width: 12
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: borderLeft.right
}
} }

280
README.md
View File

@@ -1,32 +1,14 @@
# Monero GUI # Monero GUI
Copyright (c) 2014-2024, The Monero Project Copyright (c) 2014-2018, The Monero Project
## Table of Contents
* [Development resources](#development-resources)
* [Vulnerability response](#vulnerability-response)
* [Introduction](#introduction)
* [About this project](#about-this-project)
* [Supporting the project](#supporting-the-project)
* [License](#license)
* [Translations](#translations)
* [Installing the Monero GUI from a package](#installing-the-monero-gui-from-a-package)
* [Compiling the Monero GUI from source](#compiling-the-monero-gui-from-source)
+ [Building Reproducible Windows static binaries with Docker (any OS)](#building-reproducible-windows-static-binaries-with-docker-any-os)
+ [Building Reproducible Linux static binaries with Docker (any OS)](#building-reproducible-linux-static-binaries-with-docker-any-os)
+ [Building Android APK with Docker (any OS) *Experimental*](#building-android-apk-with-docker-any-os-experimental)
+ [Building on Linux](#building-on-linux)
+ [Building on OS X](#building-on-os-x)
+ [Building on Windows](#building-on-windows)
## Development resources ## Development resources
- Web: [getmonero.org](https://getmonero.org) - Web: [getmonero.org](https://getmonero.org)
- Forum: [forum.getmonero.org](https://forum.getmonero.org)
- Mail: [dev@getmonero.org](mailto:dev@getmonero.org) - Mail: [dev@getmonero.org](mailto:dev@getmonero.org)
- Github: [https://github.com/monero-project/monero-gui](https://github.com/monero-project/monero-gui) - Github: [https://github.com/monero-project/monero-gui](https://github.com/monero-project/monero-gui)
- IRC: [#monero-gui on Libera](irc://irc.libera.chat/#monero-gui) - IRC: [#monero-dev on Freenode](irc://chat.freenode.net/#monero-dev)
- Translation platform (Weblate): [translate.getmonero.org](https://translate.getmonero.org)
- UI Design: [Monero-GUI on Figma](https://www.figma.com/file/DplJ2DDQfIKiuRvolHX2hN/Monero-GUI)
## Vulnerability response ## Vulnerability response
@@ -53,17 +35,19 @@ As with many development projects, the repository on Github is considered to be
Monero is a 100% community-sponsored endeavor. If you want to join our efforts, the easiest thing you can do is support the project financially. Both Monero and Bitcoin donations can be made to **donate.getmonero.org** if using a client that supports the [OpenAlias](https://openalias.org) standard. Monero is a 100% community-sponsored endeavor. If you want to join our efforts, the easiest thing you can do is support the project financially. Both Monero and Bitcoin donations can be made to **donate.getmonero.org** if using a client that supports the [OpenAlias](https://openalias.org) standard.
The Monero donation address is: `888tNkZrPN6JsEgekjMnABU4TBzc2Dt29EPAvkRxbANsAnjyPbb3iQ1YBRk1UXcdRsiKc9dhwMVgN5S9cQUiyoogDavup3H` (viewkey: `f359631075708155cc3d92a32b75a7d02a5dcf27756707b47a2b31b21c389501`) The Monero donation address is: `44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A` (viewkey: `f359631075708155cc3d92a32b75a7d02a5dcf27756707b47a2b31b21c389501`)
The Bitcoin donation address is: `1KTexdemPdxSBcG55heUuTjDRYqbC5ZL8H` The Bitcoin donation address is: `1KTexdemPdxSBcG55heUuTjDRYqbC5ZL8H`
GUI development funding and/or some supporting services are also graciously provided by [sponsors](https://www.getmonero.org/community/sponsorships/): GUI development funding and/or some supporting services are also graciously provided by sponsors:
[<img width="150" src="https://www.getmonero.org/img/sponsors/tarilabs.png"/>](https://tarilabs.com/) [<img width="80" src="https://static.getmonero.org/images/sponsors/mymonero.png"/>](https://mymonero.com)
[<img width="150" src="https://www.getmonero.org/img/sponsors/globee.png"/>](https://globee.com/) [<img width="150" src="https://static.getmonero.org/images/sponsors/kitware.png?1"/>](http://kitware.com)
[<img width="150" src="https://www.getmonero.org/img/sponsors/symas.png"/>](https://symas.com/) [<img width="100" src="https://static.getmonero.org/images/sponsors/dome9.png"/>](http://dome9.com)
[<img width="150" src="https://www.getmonero.org/img/sponsors/forked_logo.png"/>](http://www.forked.net/) [<img width="150" src="https://static.getmonero.org/images/sponsors/araxis.png"/>](http://araxis.com)
[<img width="150" src="https://www.getmonero.org/img/sponsors/macstadium.png"/>](https://www.macstadium.com/) [<img width="150" src="https://static.getmonero.org/images/sponsors/jetbrains.png"/>](http://www.jetbrains.com/)
[<img width="150" src="https://static.getmonero.org/images/sponsors/navicat.png"/>](http://www.navicat.com/)
[<img width="150" src="https://static.getmonero.org/images/sponsors/symas.png"/>](http://www.symas.com/)
There are also several mining pools that kindly donate a portion of their fees, [a list of them can be found on our Bitcointalk post](https://bitcointalk.org/index.php?topic=583449.0). There are also several mining pools that kindly donate a portion of their fees, [a list of them can be found on our Bitcointalk post](https://bitcointalk.org/index.php?topic=583449.0).
@@ -71,136 +55,19 @@ There are also several mining pools that kindly donate a portion of their fees,
See [LICENSE](LICENSE). See [LICENSE](LICENSE).
## Translations
Do you speak a second language and would like to help translate the Monero GUI? Check out Weblate, our localization platform, at [translate.getmonero.org](https://translate.getmonero.org/). Choose the language and suggest a translation for a string or review an existing one. The Localization Workgroup made [a guide with step-by-step instructions](https://github.com/monero-ecosystem/monero-translations/blob/master/weblate.md) for Weblate.
If you need help/support or any info you can contact the localization workgroup on the IRC channel #monero-translations (relayed on [Matrix](https://matrix.to/#/!BKMbQLMDzHKzmtrBfg:matrix.org?via=monero.social&via=matrix.org&via=libera.chat)) or by email at translate[at]getmonero[dot]org. For more info about the Localization workgroup: [github.com/monero-ecosystem/monero-translations](https://github.com/monero-ecosystem/monero-translations)
Status of the translations:
<a href="https://translate.getmonero.org/engage/monero/?utm_source=widget">
<img src="https://translate.getmonero.org/widgets/monero/-/gui-wallet/horizontal-auto.svg" alt="Translation status" />
</a>
## Installing the Monero GUI from a package ## Installing the Monero GUI from a package
Packages are available for Packages are available for
* Arch Linux: [monero-gui](https://archlinux.org/packages/extra/x86_64/monero-gui/)
* NixOS: `nix-shell -p monero-gui` * Arch Linux via AUR: [monero-wallet-qt](https://aur.archlinux.org/packages/monero-wallet-qt/)
* Flatpak: [Monero GUI](https://flathub.org/apps/details/org.getmonero.Monero) * Void Linux: xbps-install -S monero-core
* GuixSD: `guix package -i monero-gui` * GuixSD: guix package -i monero-core
* macOS (homebrew): `brew install --cask monero-wallet`
Packaging for your favorite distribution would be a welcome contribution! Packaging for your favorite distribution would be a welcome contribution!
## Compiling the Monero GUI from source ## Compiling the Monero GUI from source
*Note*: Qt 5.9.7 is the minimum version required to build the GUI. ### On Linux:
*Note*: Official GUI releases use monero-wallet-gui from this process alongside the supporting binaries (monerod, etc) from the [CLI deterministic builds](https://github.com/monero-project/monero/blob/master/contrib/gitian/README.md).
### Building Reproducible Windows static binaries with Docker (any OS)
1. Install Docker [https://docs.docker.com/engine/install/](https://docs.docker.com/engine/install/)
2. Clone the repository
```
git clone --branch master --recursive https://github.com/monero-project/monero-gui.git
```
\* `master` - replace with the desired version tag (e.g. `v0.18.3.3`) to build the release binaries.
3. Prepare build environment
```
cd monero-gui
docker build --tag monero:build-env-windows --build-arg THREADS=4 --file Dockerfile.windows .
```
\* `4` - number of CPU threads to use
4. Build
```
docker run --rm -it -v <MONERO_GUI_DIR_FULL_PATH>:/monero-gui -w /monero-gui monero:build-env-windows sh -c 'make depends root=/depends target=x86_64-w64-mingw32 tag=win-x64 -j4'
```
\* `<MONERO_GUI_DIR_FULL_PATH>` - absolute path to `monero-gui` directory
\* `4` - number of CPU threads to use
5. Monero GUI Windows static binaries will be placed in `monero-gui/build/x86_64-w64-mingw32/release/bin` directory
### Building Reproducible Linux static binaries with Docker (any OS)
1. Install Docker [https://docs.docker.com/engine/install/](https://docs.docker.com/engine/install/)
2. Clone the repository
```
git clone --branch master --recursive https://github.com/monero-project/monero-gui.git
```
\* `master` - replace with the desired version tag (e.g. `v0.18.3.3`) to build the release binaries.
3. Prepare build environment
```
cd monero-gui
docker build --tag monero:build-env-linux --build-arg THREADS=4 --file Dockerfile.linux .
```
\* `4` - number of CPU threads to use
4. Build
```
docker run --rm -it -v <MONERO_GUI_DIR_FULL_PATH>:/monero-gui -w /monero-gui monero:build-env-linux sh -c 'make release-static -j4'
```
\* `<MONERO_GUI_DIR_FULL_PATH>` - absolute path to `monero-gui` directory
\* `4` - number of CPU threads to use
5. Monero GUI Linux static binaries will be placed in `monero-gui/build/release/bin` directory
6. (*Optional*) Compare `monero-wallet-gui` SHA-256 hash to the one obtained from a trusted source
```
docker run --rm -it -v <MONERO_GUI_DIR_FULL_PATH>:/monero-gui -w /monero-gui monero:build-env-linux sh -c 'shasum -a 256 /monero-gui/build/release/bin/monero-wallet-gui'
```
\* `<MONERO_GUI_DIR_FULL_PATH>` - absolute path to `monero-gui` directory
### Building Android APK with Docker (any OS) *Experimental*
- Minimum Android 9 Pie (API 28)
- ARMv8-A 64-bit CPU
1. Install Docker [https://docs.docker.com/engine/install/](https://docs.docker.com/engine/install/)
2. Clone the repository
```
git clone --recursive https://github.com/monero-project/monero-gui.git
```
3. Prepare build environment
```
cd monero-gui
docker build --tag monero:build-env-android --build-arg THREADS=4 --file Dockerfile.android .
```
\* `4` - number of CPU threads to use
4. Build
```
docker run --rm -it -v <MONERO_GUI_DIR_FULL_PATH>:/monero-gui -e THREADS=4 monero:build-env-android
```
\* `<MONERO_GUI_DIR_FULL_PATH>` - absolute path to `monero-gui` directory
\* `4` - number of CPU threads to use
5. Monero GUI APK will be placed in `monero-gui/build/Android/release/android-build` directory
6. Deploy
* Using ADB (Android debugger bridge)
- [Enable adb debugging on your device](https://developer.android.com/studio/command-line/adb.html#Enabling)
* Connect your device with USB and install Monero GUI APK with adb:
```
adb install build/Android/release/android-build/monero-gui.apk
```
* Troubleshooting:
```
adb devices -l
adb logcat
```
* If using adb inside docker, make sure you did
```
docker run -v /dev/bus/usb:/dev/bus/usb --privileged
```
* Using a web server
```
mkdir /usr/tmp
cp build/Android/release/android-build/monero-gui.apk /usr/tmp
docker run -d -v /usr/tmp:/usr/share/nginx/html:ro -p 8080:80 nginx
```
Now it should be accessible through a web browser at
```
http://<your.local.ip>:8080/QtApp-debug.apk
```
### Building on Linux
(Tested on Ubuntu 17.10 x64, Ubuntu 18.04 x64 and Gentoo x64) (Tested on Ubuntu 17.10 x64, Ubuntu 18.04 x64 and Gentoo x64)
@@ -208,65 +75,51 @@ Packaging for your favorite distribution would be a welcome contribution!
- For Debian distributions (Debian, Ubuntu, Mint, Tails...) - For Debian distributions (Debian, Ubuntu, Mint, Tails...)
`sudo apt install build-essential cmake miniupnpc libunbound-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev libzmq3-dev libsodium-dev libhidapi-dev libnorm-dev libusb-1.0-0-dev libpgm-dev libprotobuf-dev protobuf-compiler libgcrypt20-dev libboost-chrono-dev libboost-date-time-dev libboost-filesystem-dev libboost-locale-dev libboost-program-options-dev libboost-regex-dev libboost-serialization-dev libboost-system-dev libboost-thread-dev` `sudo apt install build-essential cmake libboost-all-dev miniupnpc libunbound-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev libzmq3-dev libsodium-dev libhidapi-dev`
- For Gentoo - For Gentoo
`sudo emerge app-arch/xz-utils app-doc/doxygen dev-cpp/gtest dev-libs/boost dev-libs/expat dev-libs/openssl dev-util/cmake media-gfx/graphviz net-dns/unbound net-libs/miniupnpc net-libs/zeromq sys-libs/libunwind dev-libs/libsodium dev-libs/hidapi dev-libs/libgcrypt` `sudo emerge app-arch/xz-utils app-doc/doxygen dev-cpp/gtest dev-libs/boost dev-libs/expat dev-libs/openssl dev-util/cmake media-gfx/graphviz net-dns/unbound net-libs/ldns net-libs/miniupnpc net-libs/zeromq sys-libs/libunwind dev-libs/libsodium dev-libs/hidapi`
- For Fedora
`sudo dnf install make automake cmake gcc-c++ boost-devel miniupnpc-devel graphviz doxygen unbound-devel libunwind-devel pkgconfig openssl-devel libcurl-devel hidapi-devel libusb-devel zeromq-devel libgcrypt-devel`
2. Install Qt: 2. Install Qt:
*Note*: The Qt 5.9.7 or newer requirement makes **some** distributions (mostly based on Debian, like Ubuntu 16.x or Linux Mint 18.x) obsolete due to their repositories containing an older Qt version. *Note*: Qt 5.7 is the minimum version required to build the GUI. This makes **some** distributions (mostly based on debian, like Ubuntu 16.x or Linux Mint 18.x) obsolete. You can still build the GUI if you install an [official Qt release](https://wiki.qt.io/Install_Qt_5_on_Ubuntu), but this is not officially supported.
The recommended way is to install 5.9.7 from the [official Qt installer](https://www.qt.io/download-qt-installer) or [compiling it yourself](https://wiki.qt.io/Install_Qt_5_on_Ubuntu). This ensures you have the correct version. Higher versions *can* work but as it differs from our production build target, slight differences may occur. - For Ubuntu 17.10+
The following instructions will fetch Qt from your distribution's repositories instead. Take note of what version it installs. Your mileage may vary. `sudo apt install qtbase5-dev qt5-default qtdeclarative5-dev qml-module-qtquick-controls qml-module-qtquick-controls2 qml-module-qtquick-dialogs qml-module-qtquick-xmllistmodel qml-module-qt-labs-settings qml-module-qt-labs-folderlistmodel qttools5-dev-tools`
- For Debian distributions (Debian, Ubuntu, Mint, Tails...)
`sudo apt install qtbase5-dev qtdeclarative5-dev qml-module-qtqml-models2 qml-module-qtquick-controls qml-module-qtquick-controls2 qml-module-qtquick-dialogs qml-module-qtquick-xmllistmodel qml-module-qt-labs-settings qml-module-qt-labs-platform qml-module-qt-labs-folderlistmodel qttools5-dev-tools qml-module-qtquick-templates2 libqt5svg5-dev`
- For Gentoo - For Gentoo
The *qml* USE flag must be enabled.
`sudo emerge dev-qt/qtcore:5 dev-qt/qtdeclarative:5 dev-qt/qtquickcontrols:5 dev-qt/qtquickcontrols2:5 dev-qt/qtgraphicaleffects:5` `sudo emerge dev-qt/qtcore:5 dev-qt/qtdeclarative:5 dev-qt/qtquickcontrols:5 dev-qt/qtquickcontrols2:5 dev-qt/qtgraphicaleffects:5`
- Optional : To build the flag `WITH_SCANNER` - Optional : To build the flag `WITH_SCANNER`
- For Debian distributions (Debian, Ubuntu, Mint, Tails...) - For Ubuntu
`sudo apt install qtmultimedia5-dev qml-module-qtmultimedia` `sudo apt install qtmultimedia5-dev qml-module-qtmultimedia libzbar-dev`
- For Gentoo - For Gentoo
`emerge dev-qt/qtmultimedia:5` The *qml* USE flag must be enabled.
`emerge dev-qt/qtmultimedia:5 media-gfx/zbar`
3. Clone repository 3. Clone repository
``` `git clone https://github.com/monero-project/monero-gui.git`
git clone --recursive https://github.com/monero-project/monero-gui.git
cd monero-gui
```
4. Build 4. Build
``` ```
make release -j4 cd monero-gui
QT_SELECT=5 ./build.sh
``` ```
\* `4` - number of CPU threads to use
\* Add `CMAKE_PREFIX_PATH` environment variable to set a custom Qt install directory, e.g. `CMAKE_PREFIX_PATH=$HOME/Qt/5.9.7/gcc_64 make release -j4`
The executable can be found in the build/release/bin folder. The executable can be found in the build/release/bin folder.
### Building on OS X ### On OS X:
1. Install Xcode from AppStore 1. Install Xcode from AppStore
@@ -274,32 +127,60 @@ The executable can be found in the build/release/bin folder.
3. Install [monero](https://github.com/monero-project/monero) dependencies: 3. Install [monero](https://github.com/monero-project/monero) dependencies:
`brew install cmake pkg-config openssl boost unbound hidapi zmq libpgm libsodium miniupnpc expat libunwind-headers protobuf libgcrypt` `brew install boost --c++11`
`brew install openssl` - to install openssl headers
`brew install pkgconfig`
`brew install cmake`
`brew install zeromq`
*Note*: If cmake can not find zmq.hpp file on OS X, installing `zmq.hpp` from https://github.com/zeromq/cppzmq to `/usr/local/include` should fix that error.
4. Install Qt: 4. Install Qt:
`brew install qt5` (or download QT 5.9.7+ from [qt.io](https://www.qt.io/download-open-source/)) `brew install qt5` (or download QT 5.8+ from [qt.io](https://www.qt.io/download-open-source/))
5. Grab an up-to-date copy of the monero-gui repository If you have an older version of Qt installed via homebrew, you can force it to use 5.x like so:
``` `brew link --force --overwrite qt5`
git clone --recursive https://github.com/monero-project/monero-gui.git
cd monero-gui
```
6. Start the build 5. Add the Qt bin directory to your path
``` Example: `export PATH=$PATH:$HOME/Qt/5.8/clang_64/bin`
make release -j4
``` This is the directory where Qt 5.x is installed on **your** system
\* `4` - number of CPU threads to use
\* Add `CMAKE_PREFIX_PATH` environment variable to set a custom Qt install directory, e.g. `CMAKE_PREFIX_PATH=$HOME/Qt/5.9.7/clang_64 make release -j4` 6. Grab an up-to-date copy of the monero-gui repository
`git clone https://github.com/monero-project/monero-gui.git`
7. Go into the repository
`cd monero-gui`
8. Start the build
`./build.sh`
The executable can be found in the `build/release/bin` folder. The executable can be found in the `build/release/bin` folder.
For building an application bundle see `DEPLOY.md`. **Note:** Workaround for "ERROR: Xcode not set up properly"
### Building on Windows Edit `$HOME/Qt/5.8/clang_64/mkspecs/features/mac/default_pre.prf`
replace
`isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null")))`
with
`isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")))`
More info: http://stackoverflow.com/a/35098040/1683164
### On Windows:
The Monero GUI on Windows is 64 bits only; 32-bit Windows GUI builds are not officially supported anymore. The Monero GUI on Windows is 64 bits only; 32-bit Windows GUI builds are not officially supported anymore.
@@ -310,7 +191,7 @@ The Monero GUI on Windows is 64 bits only; 32-bit Windows GUI builds are not off
3. Install MSYS2 packages for Monero dependencies; the needed 64-bit packages have `x86_64` in their names 3. Install MSYS2 packages for Monero dependencies; the needed 64-bit packages have `x86_64` in their names
``` ```
pacman -S mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi mingw-w64-x86_64-protobuf-c mingw-w64-x86_64-libusb mingw-w64-x86_64-libgcrypt mingw-w64-x86_64-unbound mingw-w64-x86_64-pcre pacman -S mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi
``` ```
You find more details about those dependencies in the [Monero documentation](https://github.com/monero-project/monero). Note that that there is no more need to compile Boost from source; like everything else, you can install it now with a MSYS2 package. You find more details about those dependencies in the [Monero documentation](https://github.com/monero-project/monero). Note that that there is no more need to compile Boost from source; like everything else, you can install it now with a MSYS2 package.
@@ -332,17 +213,16 @@ The Monero GUI on Windows is 64 bits only; 32-bit Windows GUI builds are not off
6. Clone repository 6. Clone repository
``` ```
git clone --recursive https://github.com/monero-project/monero-gui.git git clone https://github.com/monero-project/monero-gui.git
cd monero-gui
``` ```
7. Build 7. Build
``` ```
make release-win64 -j4 cd monero-gui
cd build/release ./build.sh
cd build
make deploy make deploy
``` ```
\* `4` - number of CPU threads to use
The executable can be found in the `.\bin` directory. The executable can be found in the `.\release\bin` directory.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2021-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,12 +26,16 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QtGraphicalEffects 1.0
QtObject { import "tabs"
property bool active: false import "components"
property string text
property bool visible: true
signal selected() Rectangle {
id: root
width: 330
color: "#FFFFFF"
} }

View File

@@ -1,31 +1,3 @@
// Copyright (c) 2014-2024, 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 "TranslationManager.h"
#include <QApplication> #include <QApplication>

29
TranslationManager.h Normal file
View File

@@ -0,0 +1,29 @@
#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

53
android/README.md Normal file
View File

@@ -0,0 +1,53 @@
Copyright (c) 2014-2018, The Monero Project
## Current status : ALPHA
- Minimum Android 5.0 (api level 21)
- Modal dialogs can appear in background giving the feeling that the application is frozen (Work around : turn screen off/on or switch to another app and back)
## Build using Docker
# Base environnement
cd monero/utils/build_scripts
docker build -f android32.Dockerfile -t monero-android .
cd ..
# Build GUI
cd android/docker
docker build -t monero-gui-android .
docker create -it --name monero-gui-android monero-gui-android bash
# Get the apk
docker cp monero-gui-android:/opt/android/monero-gui/build/release/bin/bin/QtApp-debug.apk .
## Deployment
- Using ADB (Android debugger bridge) :
First, see section [Enable adb debugging on your device](https://developer.android.com/studio/command-line/adb.html#Enabling)
The only place where we are allowed to play is `/data/local/tmp`. So :
adb push /opt/android/monero-gui/build/release/bin/bin/QtApp-debug.apk /data/local/tmp
adb shell pm install -r /data/local/tmp/QtApp-debug.apk
- Troubleshooting:
adb devices -l
adb logcat
if using adb inside docker, make sure you did "docker run -v /dev/bus/usb:/dev/bus/usb --privileged"
- Using a web server
mkdir /usr/tmp
cp QtApp-debug.apk /usr/tmp
docker run -d -v /usr/tmp:/usr/share/nginx/html:ro -p 8080:80 nginx
Now it should be accessible through a web browser at
http://<your.local.ip>:8080/QtApp-debug.apk

107
android/docker/Dockerfile Normal file
View File

@@ -0,0 +1,107 @@
FROM monero-android
#INSTALL JAVA
RUN echo "deb http://ftp.fr.debian.org/debian/ jessie-backports main contrib non-free" >> /etc/apt/sources.list
RUN dpkg --add-architecture i386 \
&& apt-get update \
&& apt-get install -y libc6:i386 libncurses5:i386 libstdc++6:i386 libz1:i386 \
&& apt-get install -y -t jessie-backports ca-certificates-java openjdk-8-jdk-headless openjdk-8-jre-headless ant
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
ENV PATH $JAVA_HOME/bin:$PATH
#Get Qt
ENV QT_VERSION 5.8
RUN git clone git://code.qt.io/qt/qt5.git -b ${QT_VERSION} \
&& cd qt5 \
&& perl init-repository
## Note: Need to use libc++ but Qt does not provide mkspec for libc++.
## Their support of it is quite recent and they claim they don't use it by default
## [only because it produces bigger binary objects](https://bugreports.qt.io/browse/QTBUG-50724).
#Create new mkspec for clang + libc++
RUN cp -r qt5/qtbase/mkspecs/android-clang qt5/qtbase/mkspecs/android-clang-libc \
&& cd qt5/qtbase/mkspecs/android-clang-libc \
&& sed -i '16i ANDROID_SOURCES_CXX_STL_LIBDIR = $$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/$$ANDROID_TARGET_ARCH' qmake.conf \
&& sed -i '17i ANDROID_SOURCES_CXX_STL_INCDIR = $$NDK_ROOT/sources/cxx-stl/llvm-libc++/include' qmake.conf \
&& echo "QMAKE_LIBS_PRIVATE = -lc++_shared -llog -lz -lm -ldl -lc -lgcc " >> qmake.conf \
&& echo "QMAKE_CFLAGS -= -mfpu=vfp " >> qmake.conf \
&& echo "QMAKE_CXXFLAGS -= -mfpu=vfp " >> qmake.conf \
&& echo "QMAKE_CFLAGS += -mfpu=vfp4 " >> qmake.conf \
&& echo "QMAKE_CXXFLAGS += -mfpu=vfp4 " >> qmake.conf
ENV ANDROID_API android-21
#ANDROID SDK TOOLS
RUN echo y | $ANDROID_SDK_ROOT/tools/android update sdk --no-ui --all --filter platform-tools
RUN echo y | $ANDROID_SDK_ROOT/tools/android update sdk --no-ui --all --filter ${ANDROID_API}
RUN echo y | $ANDROID_SDK_ROOT/tools/android update sdk --no-ui --all --filter build-tools-25.0.1
ENV CLEAN_PATH $JAVA_HOME/bin:/usr/cmake-3.6.3-Linux-x86_64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
#build Qt
RUN cd qt5 && PATH=${CLEAN_PATH} ./configure -developer-build -release \
-xplatform android-clang-libc \
-android-ndk-platform ${ANDROID_API} \
-android-ndk $ANDROID_NDK_ROOT \
-android-sdk $ANDROID_SDK_ROOT \
-opensource -confirm-license \
-prefix ${WORKDIR}/Qt-${QT_VERSION} \
-nomake tests -nomake examples \
-skip qtserialport \
-skip qtconnectivity \
-skip qttranslations \
-skip qtgamepad -skip qtscript -skip qtdoc
# build Qt tools : gnustl_shared.so is hard-coded in androiddeployqt
# replace it with libc++_shared.so
COPY androiddeployqt.patch qt5/qttools/androiddeployqt.patch
RUN cd qt5/qttools \
&& git apply androiddeployqt.patch \
&& cd .. \
&& PATH=${CLEAN_PATH} make -j4 \
&& PATH=${CLEAN_PATH} make install
# Get iconv and ZBar
ENV ICONV_VERSION 1.14
RUN git clone https://github.com/ZBar/ZBar.git \
&& curl -s -O http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${ICONV_VERSION}.tar.gz \
&& tar -xzf libiconv-${ICONV_VERSION}.tar.gz \
&& cd libiconv-${ICONV_VERSION} \
&& CC=arm-linux-androideabi-clang CXX=arm-linux-androideabi-clang++ ./configure --build=x86_64-linux-gnu --host=arm-eabi --prefix=${WORKDIR}/libiconv --disable-rpath
ENV PATH $ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:${WORKDIR}/Qt-${QT_VERSION}/bin:$PATH
#Build libiconv.a and libzbarjni.a
COPY android.mk.patch ZBar/android.mk.patch
RUN cd ZBar \
&& git apply android.mk.patch \
&& echo \
"APP_ABI := armeabi-v7a \n\
APP_STL := c++_shared \n\
TARGET_PLATFORM := ${ANDROID_API} \n\
TARGET_ARCH_ABI := armeabi-v7a \n\
APP_CFLAGS += -target armv7-none-linux-androideabi -fexceptions -fstack-protector-strong -fno-limit-debug-info -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove -fno-omit-frame-pointer -fno-stack-protector\n"\
>> android/jni/Application.mk \
&& cd android \
&& android update project --path . -t "${ANDROID_API}" \
&& CC=arm-linux-androideabi-clang CXX=arm-linux-androideabi-clang++ ant -Dndk.dir=${ANDROID_NDK_ROOT} -Diconv.src=${WORKDIR}/libiconv-${ICONV_VERSION} zbar-clean zbar-ndk-build
RUN cp openssl/lib* ${ANDROID_NDK_ROOT}/platforms/${ANDROID_API}/arch-arm/usr/lib
RUN cp boost_${BOOST_VERSION}/android32/lib/lib* ${ANDROID_NDK_ROOT}/platforms/${ANDROID_API}/arch-arm/usr/lib
RUN cp ZBar/android/obj/local/armeabi-v7a/lib* ${ANDROID_NDK_ROOT}/platforms/${ANDROID_API}/arch-arm/usr/lib
RUN git clone https://github.com/monero-project/monero-gui.git \
&& cd monero-gui \
&& git submodule update \
&& CC=arm-linux-androideabi-clang CXX=arm-linux-androideabi-clang++ BOOST_ROOT=/opt/android/boost_1_62_0 \
BOOST_LIBRARYDIR=${WORKDIR}/boost_${BOOST_VERSION}/android32/lib/ \
OPENSSL_ROOT_DIR=${WORKDIR}/openssl/ \
CMAKE_INCLUDE_PATH=${WORKDIR}/cppzmq/ \
CMAKE_LIBRARY_PATH=${WORKDIR}/zeromq4-1/.libs \
CXXFLAGS="-I ${WORKDIR}/zeromq4-1/include/" \
./build.sh release-android \
&& cd build \
&& make deploy

View File

@@ -0,0 +1,61 @@
diff --git a/android/jni/Android.mk b/android/jni/Android.mk
index e442b07..158afd5 100644
--- a/android/jni/Android.mk
+++ b/android/jni/Android.mk
@@ -12,14 +12,18 @@ LOCAL_PATH := $(ICONV_SRC)
LOCAL_MODULE := libiconv
+LOCAL_ARM_MODE := arm
+LOCAL_CPP_FEATURES := exceptions rtti features
LOCAL_CFLAGS := \
-Wno-multichar \
-D_ANDROID \
- -DLIBDIR="c" \
+ -DLIBDIR="\".\"" \
-DBUILDING_LIBICONV \
-DBUILDING_LIBCHARSET \
-DIN_LIBRARY
+LOCAL_CFLAGS += -fno-stack-protector
+
LOCAL_SRC_FILES := \
lib/iconv.c \
libcharset/lib/localcharset.c \
@@ -30,13 +34,14 @@ LOCAL_C_INCLUDES := \
$(ICONV_SRC)/libcharset \
$(ICONV_SRC)/libcharset/include
-include $(BUILD_SHARED_LIBRARY)
+include $(BUILD_STATIC_LIBRARY)
LOCAL_LDLIBS := -llog -lcharset
# libzbarjni
include $(CLEAR_VARS)
+
LOCAL_PATH := $(MY_LOCAL_PATH)
LOCAL_MODULE := zbarjni
LOCAL_SRC_FILES := ../../java/zbarjni.c \
@@ -71,6 +76,17 @@ LOCAL_C_INCLUDES := ../include \
../zbar \
$(ICONV_SRC)/include
-LOCAL_SHARED_LIBRARIES := libiconv
+LOCAL_STATIC_LIBRARIES := libiconv
+LOCAL_ARM_MODE := arm
+LOCAL_CPP_FEATURES := exceptions rtti features
+
+LOCAL_CFLAGS := \
+ -Wno-multichar \
+ -D_ANDROID \
+ -DLIBDIR="\".\"" \
+ -DBUILDING_LIBICONV \
+ -DBUILDING_LIBCHARSET \
+ -DIN_LIBRARY
+
-include $(BUILD_SHARED_LIBRARY)
\ No newline at end of file
+include $(BUILD_STATIC_LIBRARY)

View File

@@ -0,0 +1,62 @@
diff --git a/src/androiddeployqt/main.cpp b/src/androiddeployqt/main.cpp
index 8a8e591..71d693e 100644
--- a/src/androiddeployqt/main.cpp
+++ b/src/androiddeployqt/main.cpp
@@ -1122,7 +1122,7 @@ bool updateLibsXml(const Options &options)
QString libsPath = QLatin1String("libs/") + options.architecture + QLatin1Char('/');
- QString qtLibs = QLatin1String("<item>gnustl_shared</item>\n");
+ QString qtLibs = QLatin1String("<item>c++_shared</item>\n");
QString bundledInLibs;
QString bundledInAssets;
foreach (Options::BundledFile bundledFile, options.bundledFiles) {
@@ -2519,6 +2519,39 @@ bool installApk(const Options &options)
return true;
}
+bool copyStl(Options *options)
+{
+ if (options->deploymentMechanism == Options::Debug && !options->installApk)
+ return true;
+
+ if (options->verbose)
+ fprintf(stdout, "Copying LIBC++ STL library\n");
+
+ QString filePath = options->ndkPath
+ + QLatin1String("/sources/cxx-stl/llvm-libc++")
+ + QLatin1String("/libs/")
+ + options->architecture
+ + QLatin1String("/libc++_shared.so");
+ if (!QFile::exists(filePath)) {
+ fprintf(stderr, "LIBC STL library does not exist at %s\n", qPrintable(filePath));
+ return false;
+ }
+
+ QString destinationDirectory =
+ options->deploymentMechanism == Options::Debug
+ ? options->temporaryDirectoryName + QLatin1String("/lib")
+ : options->outputDirectory + QLatin1String("/libs/") + options->architecture;
+
+ if (!copyFileIfNewer(filePath, destinationDirectory
+ + QLatin1String("/libc++_shared.so"), options->verbose)) {
+ return false;
+ }
+
+ if (options->deploymentMechanism == Options::Debug && !deployToLocalTmp(options, QLatin1String("/lib/libc++_shared.so")))
+ return false;
+
+ return true;
+}
bool copyGnuStl(Options *options)
{
if (options->deploymentMechanism == Options::Debug && !options->installApk)
@@ -2870,7 +2903,7 @@ int main(int argc, char *argv[])
if (Q_UNLIKELY(options.timing))
fprintf(stdout, "[TIMING] %d ms: Read dependencies\n", options.timer.elapsed());
- if (options.deploymentMechanism != Options::Ministro && !copyGnuStl(&options))
+ if (options.deploymentMechanism != Options::Ministro && !copyStl(&options))
return CannotCopyGnuStl;
if (Q_UNLIKELY(options.timing))

122
build.sh Executable file
View File

@@ -0,0 +1,122 @@
#!/bin/bash
BUILD_TYPE=$1
source ./utils.sh
platform=$(get_platform)
# default build type
if [ -z $BUILD_TYPE ]; then
BUILD_TYPE=release
fi
# Return 0 if the command exists, 1 if it does not.
exists() {
command -v "$1" &>/dev/null
}
# Return the first value in $@ that's a runnable command.
find_command() {
for arg in "$@"; do
if exists "$arg"; then
echo "$arg"
return 0
fi
done
return 1
}
if [ "$BUILD_TYPE" == "release" ]; then
echo "Building release"
CONFIG="CONFIG+=release";
BIN_PATH=release/bin
elif [ "$BUILD_TYPE" == "release-static" ]; then
echo "Building release-static"
if [ "$platform" != "darwin" ]; then
CONFIG="CONFIG+=release static";
else
# OS X: build static libwallet but dynamic Qt.
echo "OS X: Building Qt project without static flag"
CONFIG="CONFIG+=release";
fi
BIN_PATH=release/bin
elif [ "$BUILD_TYPE" == "release-android" ]; then
echo "Building release for ANDROID"
CONFIG="CONFIG+=release static WITH_SCANNER DISABLE_PASS_STRENGTH_METER";
ANDROID=true
BIN_PATH=release/bin
DISABLE_PASS_STRENGTH_METER=true
elif [ "$BUILD_TYPE" == "debug-android" ]; then
echo "Building debug for ANDROID : ultra INSECURE !!"
CONFIG="CONFIG+=debug qml_debug WITH_SCANNER DISABLE_PASS_STRENGTH_METER";
ANDROID=true
BIN_PATH=debug/bin
DISABLE_PASS_STRENGTH_METER=true
elif [ "$BUILD_TYPE" == "debug" ]; then
echo "Building debug"
CONFIG="CONFIG+=debug"
BIN_PATH=debug/bin
else
echo "Valid build types are release, release-static, release-android, debug-android and debug"
exit 1;
fi
source ./utils.sh
pushd $(pwd)
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
MONERO_DIR=monero
MONEROD_EXEC=monerod
MAKE='make'
if [[ $platform == *bsd* ]]; then
MAKE='gmake'
fi
# build libwallet
./get_libwallet_api.sh $BUILD_TYPE
# build zxcvbn
if [ "$DISABLE_PASS_STRENGTH_METER" != true ]; then
$MAKE -C src/zxcvbn-c || exit
fi
if [ ! -d build ]; then mkdir build; fi
# Platform indepenent settings
if [ "$ANDROID" != true ] && ([ "$platform" == "linux32" ] || [ "$platform" == "linux64" ]); then
exists lsb_release && distro="$(lsb_release -is)"
if [ "$distro" = "Ubuntu" ] || [ "$distro" = "Fedora" ] || test -f /etc/fedora-release; then
CONFIG="$CONFIG libunwind_off"
fi
fi
if [ "$platform" == "darwin" ]; then
BIN_PATH=$BIN_PATH/monero-wallet-gui.app/Contents/MacOS/
elif [ "$platform" == "mingw64" ] || [ "$platform" == "mingw32" ]; then
MONEROD_EXEC=monerod.exe
fi
# force version update
get_tag
echo "var GUI_VERSION = \"$TAGNAME\"" > version.js
pushd "$MONERO_DIR"
get_tag
popd
echo "var GUI_MONERO_VERSION = \"$TAGNAME\"" >> version.js
cd build
if ! QMAKE=$(find_command qmake qmake-qt5); then
echo "Failed to find suitable qmake command."
exit 1
fi
$QMAKE ../monero-wallet-gui.pro "$CONFIG" || exit
$MAKE || exit
# Copy monerod to bin folder
if [ "$platform" != "mingw32" ] && [ "$ANDROID" != true ]; then
cp ../$MONERO_DIR/bin/$MONEROD_EXEC $BIN_PATH
fi
# make deploy
popd

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -38,7 +38,3 @@ void clipboardAdapter::setText(const QString &text) {
m_pClipboard->setText(text, QClipboard::Clipboard); m_pClipboard->setText(text, QClipboard::Clipboard);
m_pClipboard->setText(text, QClipboard::Selection); m_pClipboard->setText(text, QClipboard::Selection);
} }
QString clipboardAdapter::text() const {
return m_pClipboard->text();
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -39,7 +39,6 @@ class clipboardAdapter : public QObject
public: public:
explicit clipboardAdapter(QObject *parent = 0); explicit clipboardAdapter(QObject *parent = 0);
Q_INVOKABLE void setText(const QString &text); Q_INVOKABLE void setText(const QString &text);
Q_INVOKABLE QString text() const;
private: private:
QClipboard *m_pClipboard; QClipboard *m_pClipboard;

View File

@@ -1,50 +0,0 @@
# Copyright (c) 2014-2024, 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.
if (NOT CMAKE_HOST_WIN32)
set (CMAKE_SYSTEM_NAME Windows)
endif()
set (GCC_PREFIX i686-w64-mingw32)
set (CMAKE_C_COMPILER ${GCC_PREFIX}-gcc)
set (CMAKE_CXX_COMPILER ${GCC_PREFIX}-g++)
set (CMAKE_AR ar CACHE FILEPATH "" FORCE)
set (CMAKE_NM nm CACHE FILEPATH "" FORCE)
set (CMAKE_LINKER ld CACHE FILEPATH "" FORCE)
#set (CMAKE_RANLIB ${GCC_PREFIX}-gcc-ranlib CACHE FILEPATH "" FORCE)
set (CMAKE_RC_COMPILER windres)
set (CMAKE_FIND_ROOT_PATH "${MSYS2_FOLDER}/mingw32")
# Ensure cmake doesn't find things in the wrong places
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # Find programs on host
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) # Find libs in target
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # Find includes in target
set (MINGW_FLAG "-m32")
set (USE_LTO_DEFAULT false)

View File

@@ -1,50 +0,0 @@
# Copyright (c) 2014-2024, 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.
if (NOT CMAKE_HOST_WIN32)
set (CMAKE_SYSTEM_NAME Windows)
endif()
set (GCC_PREFIX x86_64-w64-mingw32)
set (CMAKE_C_COMPILER ${GCC_PREFIX}-gcc)
set (CMAKE_CXX_COMPILER ${GCC_PREFIX}-g++)
set (CMAKE_AR ar CACHE FILEPATH "" FORCE)
set (CMAKE_NM nm CACHE FILEPATH "" FORCE)
set (CMAKE_LINKER ld CACHE FILEPATH "" FORCE)
#set (CMAKE_RANLIB ${GCC_PREFIX}-gcc-ranlib CACHE FILEPATH "" FORCE)
set (CMAKE_RC_COMPILER windres)
set (CMAKE_FIND_ROOT_PATH "${MSYS2_FOLDER}/mingw64")
# Ensure cmake doesn't find things in the wrong places
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # Find programs on host
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) # Find libs in target
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # Find includes in target
set (MINGW_FLAG "-m64")
set (USE_LTO_DEFAULT false)

View File

@@ -1,14 +0,0 @@
#ifdef __CLASSIC_C__
int main()
{
int ac;
char* av[];
#else
int main(int ac, char* av[])
{
#endif
if (ac > 1000) {
return *av[0];
}
return 0;
}

View File

@@ -1,47 +0,0 @@
include(CheckCCompilerFlag)
macro(CHECK_LINKER_FLAG flag VARIABLE)
if(NOT DEFINED "${VARIABLE}")
if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${flag} linker flag")
endif()
set(_cle_source ${CMAKE_SOURCE_DIR}/cmake/CheckLinkerFlag.c)
set(saved_CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
set(CMAKE_C_FLAGS "${flag}")
try_compile(${VARIABLE}
${CMAKE_BINARY_DIR}
${_cle_source}
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${flag}
CMAKE_FLAGS
OUTPUT_VARIABLE OUTPUT)
unset(_cle_source)
set(CMAKE_C_FLAGS ${saved_CMAKE_C_FLAGS})
unset(saved_CMAKE_C_FLAGS)
if ("${OUTPUT}" MATCHES "warning.*ignored")
set(${VARIABLE} 0)
endif()
if(${VARIABLE})
if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${flag} linker flag - found")
endif()
set(${VARIABLE} 1 CACHE INTERNAL "Have linker flag ${flag}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the ${flag} linker flag is supported "
"passed with the following output:\n"
"${OUTPUT}\n\n")
else()
if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${flag} linker flag - not found")
endif()
set(${VARIABLE} "" CACHE INTERNAL "Have linker flag ${flag}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the ${flag} linker flag is supported "
"failed with the following output:\n"
"${OUTPUT}\n\n")
endif()
endif()
endmacro()

View File

@@ -1,113 +0,0 @@
if(APPLE OR (WIN32 AND NOT STATIC))
add_custom_target(deploy)
get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
if(APPLE AND NOT IOS)
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_qt_bin_dir}")
add_custom_command(TARGET deploy
POST_BUILD
COMMAND "${MACDEPLOYQT_EXECUTABLE}" "$<TARGET_FILE_DIR:monero-wallet-gui>/../.." -always-overwrite -qmldir="${CMAKE_SOURCE_DIR}"
COMMENT "Running macdeployqt..."
)
# workaround for a Qt bug that requires manually adding libqsvg.dylib to bundle
find_file(_qt_svg_dylib "libqsvg.dylib" PATHS "${CMAKE_PREFIX_PATH}/plugins/imageformats" NO_DEFAULT_PATH)
if(_qt_svg_dylib)
add_custom_command(TARGET deploy
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${_qt_svg_dylib} $<TARGET_FILE_DIR:monero-wallet-gui>/../PlugIns/imageformats/
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtGui.framework/Versions/5/QtGui" "@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui" $<TARGET_FILE_DIR:monero-wallet-gui>/../PlugIns/imageformats/libqsvg.dylib
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtWidgets.framework/Versions/5/QtWidgets" "@executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets" $<TARGET_FILE_DIR:monero-wallet-gui>/../PlugIns/imageformats/libqsvg.dylib
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtSvg.framework/Versions/5/QtSvg" "@executable_path/../Frameworks/QtSvg.framework/Versions/5/QtSvg" $<TARGET_FILE_DIR:monero-wallet-gui>/../PlugIns/imageformats/libqsvg.dylib
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtCore.framework/Versions/5/QtCore" "@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore" $<TARGET_FILE_DIR:monero-wallet-gui>/../PlugIns/imageformats/libqsvg.dylib
COMMENT "Copying libqsvg.dylib, running install_name_tool"
)
endif()
# libbost_filesyste-mt.dylib has a dependency on libboost_atomic-mt.dylib, maydeployqt does not copy it by itself
find_package(Boost COMPONENTS atomic)
get_target_property(BOOST_ATOMIC_LIB_PATH Boost::atomic LOCATION)
if(EXISTS ${BOOST_ATOMIC_LIB_PATH})
add_custom_command(TARGET deploy
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${BOOST_ATOMIC_LIB_PATH}" "$<TARGET_FILE_DIR:monero-wallet-gui>/../Frameworks/"
COMMENT "Copying libboost_atomic-mt.dylib"
)
endif()
# Apple Silicon requires all binaries to be codesigned
find_program(CODESIGN_EXECUTABLE NAMES codesign)
if(CODESIGN_EXECUTABLE)
add_custom_command(TARGET deploy
POST_BUILD
COMMAND "${CODESIGN_EXECUTABLE}" --force --deep --sign - "$<TARGET_FILE_DIR:monero-wallet-gui>/../.."
COMMENT "Running codesign..."
)
endif()
elseif(WIN32)
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${_qt_bin_dir}")
add_custom_command(TARGET monero-wallet-gui POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E env PATH="${_qt_bin_dir}" "${WINDEPLOYQT_EXECUTABLE}" "$<TARGET_FILE:monero-wallet-gui>" -no-translations -qmldir="${CMAKE_SOURCE_DIR}"
COMMENT "Running windeployqt..."
)
set(WIN_DEPLOY_DLLS
libboost_chrono-mt.dll
libboost_filesystem-mt.dll
libboost_locale-mt.dll
libboost_program_options-mt.dll
libboost_regex-mt.dll
libboost_serialization-mt.dll
libboost_thread-mt.dll
libprotobuf.dll
libbrotlicommon.dll
libbrotlidec.dll
libusb-1.0.dll
zlib1.dll
libzstd.dll
libwinpthread-1.dll
libtiff-6.dll
libstdc++-6.dll
libpng16-16.dll
libpcre16-0.dll
libpcre-1.dll
libmng-2.dll
liblzma-5.dll
liblcms2-2.dll
libjpeg-8.dll
libintl-8.dll
libiconv-2.dll
libharfbuzz-0.dll
libgraphite2.dll
libglib-2.0-0.dll
libfreetype-6.dll
libbz2-1.dll
libpcre2-16-0.dll
libhidapi-0.dll
libdouble-conversion.dll
libgcrypt-20.dll
libgpg-error-0.dll
libsodium-26.dll
libzmq.dll
#platform files
libgcc_s_seh-1.dll
#openssl files
libssl-3-x64.dll
libcrypto-3-x64.dll
#icu
libicudt74.dll
libicuin74.dll
libicuio74.dll
libicutu74.dll
libicuuc74.dll
)
list(TRANSFORM WIN_DEPLOY_DLLS PREPEND "$ENV{MSYSTEM_PREFIX}/bin/")
add_custom_command(TARGET deploy
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${WIN_DEPLOY_DLLS} "$<TARGET_FILE_DIR:monero-wallet-gui>"
COMMENT "Copying DLLs to target folder"
)
endif()
endif()

View File

@@ -1,47 +0,0 @@
# Copyright (c) 2014-2024, 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.
function (write_static_version_header tag)
set(VERSION_TAG_GUI "${tag}" CACHE STRING "The tag portion of the Monero GUI software version" FORCE)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/version.js.in" "${CMAKE_CURRENT_SOURCE_DIR}/version.js")
endfunction ()
find_package(Git QUIET)
if ("$Format:$" STREQUAL "")
# We're in a tarball; use hard-coded variables.
write_static_version_header("release")
elseif (GIT_FOUND OR Git_FOUND)
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
get_version_tag_from_git("${GIT_EXECUTABLE}")
write_static_version_header(${VERSIONTAG})
else()
message(STATUS "WARNING: Git was not found!")
write_static_version_header("unknown")
endif ()
add_custom_target(genversiongui ALL
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/version.js")

View File

@@ -0,0 +1,171 @@
// 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.
import QtQuick 2.0
import moneroComponents.Clipboard 1.0
ListView {
id: listView
clip: true
boundsBehavior: ListView.StopAtBounds
footer: Rectangle {
height: 127
width: listView.width
color: "transparent"
Text {
anchors.centerIn: parent
font.family: "Arial"
font.pixelSize: 14
color: "#808080"
text: qsTr("No more results") + translationManager.emptyString
}
}
property var previousItem
delegate: Rectangle {
id: delegate
height: 64
width: listView.width
color: "transparent"
z: listView.count - index
function collapseDropdown() { dropdown.expanded = false }
Text {
id: descriptionText
anchors.left: parent.left
anchors.top: parent.top
anchors.topMargin: 12
width: text.length ? (descriptionArea.containsMouse ? 139 : 139) : 0
font.family: "Arial"
font.bold: true
font.pixelSize: 19
color: "#ffffff"
elide: Text.ElideRight
text: description
MouseArea {
id: descriptionArea
anchors.fill: parent
hoverEnabled: true
}
}
TextEdit {
id: addressText
selectByMouse: true
anchors.bottom: descriptionText.bottom
anchors.left: descriptionText.right
anchors.right: dropdown.left
anchors.leftMargin: description.length > 0 ? 12 : 0
anchors.rightMargin: 40
font.family: "Arial"
font.pixelSize: 16
color: "#ffffff"
text: address
readOnly: true
}
Text {
id: paymentLabel
anchors.left: parent.left
anchors.bottom: parent.bottom
anchors.bottomMargin: 12
width: 139
font.family: "Arial"
font.pixelSize: 12
color: "#ffffff"
text: qsTr("Payment ID:") + translationManager.emptyString
}
TextEdit {
selectByMouse: true;
anchors.bottom: paymentLabel.bottom
anchors.left: paymentLabel.right
anchors.leftMargin: 12
anchors.rightMargin: 12
anchors.right: dropdown.left
readOnly: true
font.family: "Arial"
font.pixelSize: 13
color: "#545454"
text: paymentId
}
ListModel {
id: dropModel
ListElement { name: "<b>Copy address to clipboard</b>"; icon: "../images/dropdownCopy.png" }
ListElement { name: "<b>Send to this address</b>"; icon: "../images/dropdownSend.png" }
// ListElement { name: "<b>Find similar transactions</b>"; icon: "../images/dropdownSearch.png" }
ListElement { name: "<b>Remove from address book</b>"; icon: "../images/dropdownDel.png" }
}
Clipboard { id: clipboard }
TableDropdown {
id: dropdown
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.rightMargin: 5
dataModel: dropModel
z: 1
onExpandedChanged: {
if(expanded) {
listView.previousItem = delegate
listView.currentIndex = index
}
}
onOptionClicked: {
// Ensure tooltip is closed
appWindow.toolTip.visible = false;
if(option === 0) {
clipboard.setText(address)
appWindow.showStatusMessage(qsTr("Address copied to clipboard"),3)
}
else if(option === 1){
console.log("Sending to: ", address +" "+ paymentId);
middlePanel.sendTo(address, paymentId, description);
leftPanel.selectItem(middlePanel.state)
} else if(option === 2){
console.log("Delete: ", rowId);
currentWallet.addressBookModel.deleteRow(rowId);
}
}
}
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
height: 1
color: "#404040"
}
}
}

View File

@@ -1,68 +0,0 @@
import QtQuick 2.9
import QtQuick.Layouts 1.1
import "../components" as MoneroComponents
RowLayout {
id: advancedOptionsItem
property alias title: title.text
property alias tooltip: title.tooltip
property alias button1: button1
property alias button2: button2
property alias button3: button3
RowLayout {
id: titlecolumn
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
Layout.preferredWidth: 195
Layout.maximumWidth: 195
Layout.leftMargin: 10
MoneroComponents.Label {
id: title
fontSize: 14
tooltipIconVisible: true
}
Rectangle {
id: separator
Layout.fillWidth: true
height: 10
color: "transparent"
}
}
ColumnLayout {
Layout.fillWidth: false
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
spacing: 4
RowLayout {
Layout.fillWidth: false
spacing: 12
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
StandardButton {
id: button1
small: true
primary: false
visible: button1.text
}
StandardButton {
id: button2
small: true
primary: false
visible: button2.text
}
StandardButton {
id: button3
small: true
primary: false
visible: button3.text
}
}
}
}

View File

@@ -1,47 +0,0 @@
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
###
#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/defines.h.cmake
# ${CMAKE_CURRENT_BINARY_DIR}/defines.h)
file(GLOB_RECURSE UI_FILES *.ui)
file(GLOB_RECURSE CODE_FILES *.cpp)
qt5_wrap_ui(UI_HEADERS ${UI_FILES})
#qt5_add_resources(RESOURCE_FILES ../resources/resources.qrc)
# Windows application icon
if (WIN32)
set(WINDOWS_RES_FILE ${CMAKE_CURRENT_BINARY_DIR}/resources.obj)
if (MSVC)
add_custom_command(OUTPUT ${WINDOWS_RES_FILE}
COMMAND rc.exe /fo ${WINDOWS_RES_FILE} resources.rc
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/win
)
else()
add_custom_command(OUTPUT ${WINDOWS_RES_FILE}
COMMAND windres.exe resources.rc ${WINDOWS_RES_FILE}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/win
)
endif()
endif()
add_executable(${CMAKE_PROJECT_NAME} WIN32
${UI_HEADERS}
${CODE_FILES}
${RESOURCE_FILES}
${WINDOWS_RES_FILE}
)
target_link_libraries(${CMAKE_PROJECT_NAME}
Qt5::Widgets
)
if (UNIX)
install(TARGETS ${CMAKE_PROJECT_NAME}
RUNTIME DESTINATION bin)
elseif (WIN32)
install(TARGETS ${CMAKE_PROJECT_NAME}
DESTINATION .)
endif()

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,109 +26,84 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.0
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import FontAwesome 1.0
import "." as MoneroComponents import "../components" as MoneroComponents
import "effects/" as MoneroEffects
Item { RowLayout {
id: checkBox id: checkBox
property alias text: label.text property alias text: label.text
property string checkedIcon: "qrc:///images/check-white.svg" property string checkedIcon: "../images/checkedIcon-black.png"
property string uncheckedIcon property string uncheckedIcon
property bool fontAwesomeIcons: false
property int imgWidth: 13
property int imgHeight: 13
property bool toggleOnClick: true
property bool checked: false property bool checked: false
property alias background: backgroundRect.color property alias background: backgroundRect.color
property bool border: true property int fontSize: 14 * scaleRatio
property int fontSize: 14
property alias fontColor: label.color property alias fontColor: label.color
property bool iconOnTheLeft: true
property alias tooltipIconVisible: label.tooltipIconVisible
property alias tooltip: label.tooltip
signal clicked() signal clicked()
height: 25 * scaleRatio
height: 25
width: checkBoxLayout.width
opacity: enabled ? 1 : 0.7
Keys.onEnterPressed: toggle()
Keys.onReturnPressed: Keys.onEnterPressed(event)
Keys.onSpacePressed: Keys.onEnterPressed(event)
function toggle(){ function toggle(){
if (checkBox.toggleOnClick) { checkBox.checked = !checkBox.checked
checkBox.checked = !checkBox.checked
}
checkBox.clicked() checkBox.clicked()
} }
RowLayout { RowLayout {
id: checkBoxLayout Layout.fillWidth: true
layoutDirection: iconOnTheLeft ? Qt.LeftToRight : Qt.RightToLeft Rectangle {
spacing: 10 anchors.left: parent.left
width: 25 * scaleRatio
height: checkBox.height - 1
radius: 3
y: 0
color: "transparent"
border.color:
if(checkBox.checked){
return MoneroComponents.Style.inputBorderColorActive;
} else {
return MoneroComponents.Style.inputBorderColorInActive;
}
}
Item { Rectangle {
id: checkMark id: backgroundRect
height: checkBox.height anchors.left: parent.left
width: checkBox.height width: 25 * scaleRatio
height: checkBox.height - 1
y: 1
color: "transparent"
Rectangle { Image {
id: backgroundRect anchors.centerIn: parent
visible: checkBox.border source: checkBox.checkedIcon
anchors.fill: parent visible: checkBox.checked
radius: 3
color: checkBox.enabled ? "transparent" : MoneroComponents.Style.inputBoxBackgroundDisabled
border.color:
if (checkBox.activeFocus) {
return MoneroComponents.Style.inputBorderColorActive;
} else {
return MoneroComponents.Style.inputBorderColorInActive;
}
} }
MoneroEffects.ImageMask { MouseArea {
id: img anchors.fill: parent
visible: checkBox.checked || checkBox.uncheckedIcon != "" cursorShape: Qt.PointingHandCursor
anchors.centerIn: parent onClicked: {
width: checkBox.imgWidth toggle()
height: checkBox.imgHeight
color: MoneroComponents.Style.defaultFontColor
fontAwesomeFallbackIcon: checkBox.fontAwesomeIcons ? getIcon() : FontAwesome.plus
fontAwesomeFallbackSize: 14
image: checkBox.fontAwesomeIcons ? "" : getIcon()
function getIcon() {
if (checkBox.checked || checkBox.uncheckedIcon == "")
return checkBox.checkedIcon;
return checkBox.uncheckedIcon;
} }
} }
} }
MoneroComponents.TextPlain { Text {
id: label id: label
font.family: MoneroComponents.Style.fontRegular.name font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: checkBox.fontSize font.pixelSize: checkBox.fontSize
color: MoneroComponents.Style.defaultFontColor color: MoneroComponents.Style.defaultFontColor
textFormat: Text.RichText wrapMode: Text.Wrap
wrapMode: Text.NoWrap Layout.fillWidth: true
visible: text != "" anchors.left: backgroundRect.right
} anchors.leftMargin: !isMobile ? 10 : 8
} MouseArea {
anchors.fill: parent
MouseArea { cursorShape: Qt.PointingHandCursor
anchors.fill: parent onClicked: {
hoverEnabled: true toggle()
cursorShape: Qt.PointingHandCursor }
onEntered: !label.tooltipIconVisible && label.tooltip ? label.tooltipPopup.open() : "" }
onExited: !label.tooltipIconVisible && label.tooltip ? label.tooltipPopup.close() : ""
onClicked: {
toggle()
} }
} }
} }

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2015, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,24 +26,24 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.0
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import FontAwesome 1.0
import "." 1.0 import "." 1.0
import "." as MoneroComponents
import "effects/" as MoneroEffects
RowLayout { RowLayout {
id: checkBox id: checkBox
property alias text: label.text property alias text: label.text
property string checkedIcon: "../images/checkedIcon-black.png"
property string uncheckedIcon
property bool checked: false property bool checked: false
property int fontSize: 14 property string background: "backgroundRect.color"
property int fontSize: 14 * scaleRatio
property alias fontColor: label.color property alias fontColor: label.color
property int textMargin: 8 property int textMargin: 8 * scaleRatio
property bool darkDropIndicator: false
signal clicked() signal clicked()
height: 25 height: 25 * scaleRatio
function toggle(){ function toggle(){
checkBox.checked = !checkBox.checked checkBox.checked = !checkBox.checked
@@ -57,8 +57,9 @@ RowLayout {
height: label.height height: label.height
width: (label.width + indicatorRect.width + checkBox.textMargin) width: (label.width + indicatorRect.width + checkBox.textMargin)
color: "transparent" color: "transparent"
anchors.left: parent.left
MoneroComponents.TextPlain { Text {
id: label id: label
font.family: Style.fontLight.name font.family: Style.fontLight.name
font.pixelSize: checkBox.fontSize font.pixelSize: checkBox.fontSize
@@ -75,29 +76,23 @@ RowLayout {
anchors.left: label.right anchors.left: label.right
anchors.leftMargin: textMargin anchors.leftMargin: textMargin
color: "transparent" color: "transparent"
rotation: checkBox.checked ? 180 : 0 rotation: checkBox.checked ? 180 * scaleRatio : 0
MoneroEffects.ImageMask { Image {
id: indicatorImage id: indicatorImage
anchors.centerIn: parent anchors.centerIn: parent
width: 12 source: "../images/whiteDropIndicator.png"
height: 8 visible: !darkDropIndicator
image: "qrc:///images/whiteDropIndicator.png" }
color: MoneroComponents.Style.defaultFontColor ColorOverlay {
opacity: MoneroComponents.Style.blackTheme ? 1 : 0.75 anchors.fill: indicatorImage
fontAwesomeFallbackIcon: FontAwesome.arrowDown source: indicatorImage
fontAwesomeFallbackSize: 14 color: "#FF000000"
visible: darkDropIndicator
MoneroEffects.ColorTransition {
targetObj: indicatorImage
blackColor: "white"
whiteColor: "black"
duration: 500
}
} }
} }
MouseArea { MouseArea{
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
@@ -106,5 +101,7 @@ RowLayout {
} }
} }
} }
} }
} }

View File

@@ -1,78 +0,0 @@
import QtQuick 2.9
import QtQuick.Controls 2.2
import FontAwesome 1.0
import "../components" as MoneroComponents
MouseArea {
signal cut()
signal copy()
signal paste()
signal remove()
signal selectAll()
id: root
acceptedButtons: Qt.RightButton
anchors.fill: parent
onClicked: {
if (mouse.button === Qt.RightButton) {
root.parent.persistentSelection = true;
contextMenu.open()
root.parent.cursorVisible = true;
}
}
Menu {
id: contextMenu
background: Rectangle {
border.color: MoneroComponents.Style.buttonBackgroundColorDisabledHover
border.width: 1
radius: 2
color: MoneroComponents.Style.blackTheme ? MoneroComponents.Style.buttonBackgroundColorDisabled : "#E5E5E5"
}
padding: 1
width: 110
x: root.mouseX
y: root.mouseY
onClosed: {
if (!root.parent.activeFocus) {
root.parent.cursorVisible = false;
}
root.parent.persistentSelection = false;
root.parent.forceActiveFocus()
}
MoneroComponents.ContextMenuItem {
enabled: root.parent.selectedText != "" && !root.parent.readOnly
onTriggered: root.cut()
text: qsTr("Cut") + translationManager.emptyString
}
MoneroComponents.ContextMenuItem {
enabled: root.parent.selectedText != ""
onTriggered: root.copy()
text: qsTr("Copy") + translationManager.emptyString
}
MoneroComponents.ContextMenuItem {
enabled: root.parent.canPaste === true
onTriggered: root.paste()
text: qsTr("Paste") + translationManager.emptyString
}
MoneroComponents.ContextMenuItem {
enabled: root.parent.selectedText != "" && !root.parent.readOnly
onTriggered: root.remove()
text: qsTr("Delete") + translationManager.emptyString
}
MoneroComponents.ContextMenuItem {
enabled: root.parent.text != ""
onTriggered: root.selectAll()
text: qsTr("Select All") + translationManager.emptyString
}
}
}

View File

@@ -1,62 +0,0 @@
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.1
import FontAwesome 1.0
import "../components" as MoneroComponents
MenuItem {
id: menuItem
property bool glyphIconSolid: true
property alias glyphIcon: glyphIcon.text
background: Rectangle {
color: MoneroComponents.Style.buttonBackgroundColorDisabledHover
opacity: 0
MouseArea {
id: mouse
anchors.fill: parent
hoverEnabled: true
onEntered: {
parent.opacity = 1;
}
onExited: {
parent.opacity = 0;
}
onClicked: {
if (menuItem.enabled) {
menuItem.triggered();
parent.opacity = 0;
}
}
}
}
contentItem: RowLayout {
anchors.fill: parent
anchors.leftMargin: 20
anchors.rightMargin: 10
opacity: menuItem.enabled ? 1 : 0.4
spacing: 8
Text {
id: glyphIcon
color: MoneroComponents.Style.buttonTextColor
font.family: glyphIconSolid ? FontAwesome.fontFamilySolid : FontAwesome.fontFamily
font.pixelSize: 14
font.styleName: glyphIconSolid ? "Solid" : "Regular"
}
Text {
color: MoneroComponents.Style.blackTheme ? MoneroComponents.Style.buttonTextColor : MoneroComponents.Style.defaultFontColor
font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 14
Layout.fillWidth: true
text: menuItem.text
}
}
}

View File

@@ -0,0 +1,216 @@
// 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.
import QtQuick 2.0
import QtQuick.Controls 2.0
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.1
import QtQuick.Controls.Styles 1.4
import QtQuick.Window 2.2
import "../components" as MoneroComponents
import "../js/Windows.js" as Windows
import "../js/Utils.js" as Utils
Window {
id: root
modality: Qt.ApplicationModal
color: "black"
flags: Windows.flags
property alias text: dialogContent.text
property alias content: root.text
property alias textArea: dialogContent
property var icon
// same signals as Dialog has
signal accepted()
signal rejected()
onClosing: {
inactiveOverlay.visible = false;
}
function open() {
inactiveOverlay.visible = true;
show();
}
// TODO: implement without hardcoding sizes
width: 480
height: 280
// background gradient
Image {
anchors.fill: parent
source: "../images/middlePanelBg.jpg"
}
// Make window draggable
MouseArea {
anchors.fill: parent
property point lastMousePos: Qt.point(0, 0)
onPressed: { lastMousePos = Qt.point(mouseX, mouseY); }
onMouseXChanged: root.x += (mouseX - lastMousePos.x)
onMouseYChanged: root.y += (mouseY - lastMousePos.y)
}
ColumnLayout {
id: mainLayout
anchors.fill: parent
anchors.topMargin: 20 * scaleRatio
anchors.margins: 35 * scaleRatio
spacing: 20 * scaleRatio
RowLayout {
id: content
Layout.fillWidth: true
Layout.fillHeight: true
Flickable {
id: flickable
anchors.fill: parent
TextArea.flickable: TextArea {
id : dialogContent
textFormat: TextEdit.RichText
selectByMouse: true
selectByKeyboard: true
anchors.fill: parent
font.family: "Ariel"
font.pixelSize: 14 * scaleRatio
color: MoneroComponents.Style.defaultFontColor
selectionColor: MoneroComponents.Style.dimmedFontColor
wrapMode: TextEdit.Wrap
readOnly: true
background: Rectangle {
color: "transparent"
anchors.fill: parent
border.color: Qt.rgba(255, 255, 255, 0.25);
border.width: 1
radius: 4
}
function logCommand(msg){
msg = log_color(msg, "lime");
textArea.append(msg);
}
function logMessage(msg){
msg = msg.trim();
var color = "white";
if(msg.toLowerCase().indexOf('error') >= 0){
color = "red";
} else if (msg.toLowerCase().indexOf('warning') >= 0){
color = "yellow";
}
// format multi-lines
if(msg.split("\n").length >= 2){
msg = msg.split("\n").join('<br>');
}
log(msg, color);
}
function log_color(msg, color){
return "<span style='color: " + color + ";' >" + msg + "</span>";
}
function log(msg, color){
var timestamp = Utils.formatDate(new Date(), {
weekday: undefined,
month: "numeric",
timeZoneName: undefined
});
var _timestamp = log_color("[" + timestamp + "]", "#FFFFFF");
var _msg = log_color(msg, color);
textArea.append(_timestamp + " " + _msg);
// scroll to bottom
//if(flickable.contentHeight > content.height){
// flickable.contentY = flickable.contentHeight + 20;
//}
}
}
ScrollBar.vertical: ScrollBar {
// TODO: scrollbar always visible is buggy.
// QT 5.9 introduces `policy: ScrollBar.AlwaysOn`
contentItem.opacity: 1
anchors.top: flickable.top
anchors.left: flickable.right
anchors.leftMargin: 10 * scaleRatio
anchors.bottom: flickable.bottom
}
}
}
RowLayout {
Layout.fillWidth: true
MoneroComponents.LineEdit {
id: sendCommandText
Layout.fillWidth: true
placeholderText: qsTr("command + enter (e.g help)") + translationManager.emptyString
onAccepted: {
if(text.length > 0) {
textArea.logCommand(">>> " + text)
daemonManager.sendCommand(text, currentWallet.nettype);
}
text = ""
}
}
}
}
// window borders
Rectangle {
anchors.bottom: parent.bottom
anchors.top: parent.top
anchors.left: parent.left
width:1
color: "#2F2F2F"
z: 2
}
Rectangle {
anchors.bottom: parent.bottom
anchors.top: parent.top
anchors.right: parent.right
width:1
color: "#2F2F2F"
z: 2
}
Rectangle {
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
height:1
color: "#2F2F2F"
z: 2
}
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,13 +26,12 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.0
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
import QtQuick.Window 2.0 import QtQuick.Window 2.0
import moneroComponents.Wallet 1.0
import "../components" as MoneroComponents import "../components" as MoneroComponents
@@ -53,7 +52,6 @@ Window {
// TODO: implement without hardcoding sizes // TODO: implement without hardcoding sizes
width: 480 width: 480
height: 200 height: 200
color: MoneroComponents.Style.middlePanelBackgroundColor
// Make window draggable // Make window draggable
MouseArea { MouseArea {
@@ -80,10 +78,6 @@ Window {
running: false; running: false;
repeat: true repeat: true
onTriggered: { onTriggered: {
if (currentWallet.connected() == Wallet.ConnectionStatus_Connected) {
running = false;
root.close();
}
countDown--; countDown--;
if(countDown < 0){ if(countDown < 0){
running = false; running = false;
@@ -95,14 +89,12 @@ Window {
} }
} }
MoneroComponents.TextPlain { Text {
text: qsTr("Starting local node in %1 seconds").arg(countDown) + translationManager.emptyString; text: qsTr("Starting local node in %1 seconds").arg(countDown);
font.pixelSize: 18 font.pixelSize: 18
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
themeTransition: false
color: MoneroComponents.Style.defaultFontColor
} }
} }
@@ -116,7 +108,7 @@ Window {
id: okButton id: okButton
visible:false visible:false
fontSize: 14 fontSize: 14
text: qsTr("Start daemon (%1)").arg(countDown) + translationManager.emptyString text: qsTr("Start daemon (%1)").arg(countDown)
KeyNavigation.tab: cancelButton KeyNavigation.tab: cancelButton
onClicked: { onClicked: {
timer.stop(); timer.stop();
@@ -129,7 +121,7 @@ Window {
MoneroComponents.StandardButton { MoneroComponents.StandardButton {
id: cancelButton id: cancelButton
fontSize: 14 fontSize: 14
text: qsTr("Use custom settings") + translationManager.emptyString text: qsTr("Use custom settings")
onClicked: { onClicked: {
timer.stop(); timer.stop();

View File

@@ -0,0 +1,252 @@
// 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.
import QtQuick 2.0
import moneroComponents.Clipboard 1.0
ListView {
id: listView
clip: true
boundsBehavior: ListView.StopAtBounds
footer: Rectangle {
height: 127
width: listView.width
color: "#FFFFFF"
Text {
anchors.centerIn: parent
font.family: "Arial"
font.pixelSize: 14
color: "#545454"
text: qsTr("No more results") + translationManager.emptyString
}
}
property var previousItem
delegate: Rectangle {
id: delegate
height: 90
width: listView.width
color: index % 2 ? "#F8F8F8" : "#FFFFFF"
z: listView.count - index
function collapseDropdown() { dropdown.expanded = false }
Row {
id: row1
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.topMargin: 14
Rectangle {
id: dot
width: 14
height: width
radius: width / 2
color: out ? "#FF4F41" : "#36B05B"
}
Item { //separator
width: 12
height: 14
}
Text {
id: descriptionText
width: text.length ? (descriptionArea.containsMouse ? parent.width - x - 12 : 120) : 0
anchors.verticalCenter: dot.verticalCenter
font.family: "Arial"
font.bold: true
font.pixelSize: 19
color: "#444444"
elide: Text.ElideRight
text: description
MouseArea {
id: descriptionArea
anchors.fill: parent
hoverEnabled: true
}
}
Item { //separator
width: descriptionText.width ? 12 : 0
height: 14
visible: !descriptionArea.containsMouse
}
Text {
id: addressText
anchors.verticalCenter: dot.verticalCenter
width: parent.width - x - 12
elide: Text.ElideRight
font.family: "Arial"
font.pixelSize: 14
color: "#545454"
text: address
visible: !descriptionArea.containsMouse
}
}
Row {
anchors.left: parent.left
anchors.top: row1.bottom
anchors.topMargin: 8
spacing: 12
Item { //separator
width: 14
height: 14
}
Column {
anchors.top: parent.top
width: 215
Text {
anchors.left: parent.left
font.family: "Arial"
font.pixelSize: 12
color: "#545454"
text: qsTr("Date") + translationManager.emptyString
}
Row {
anchors.left: parent.left
anchors.right: parent.right
spacing: 33
Text {
font.family: "Arial"
font.pixelSize: 18
color: "#000000"
text: date
}
Text {
font.family: "Arial"
font.pixelSize: 18
color: "#000000"
text: time
}
}
}
Column {
anchors.top: parent.top
width: 148
Text {
anchors.left: parent.left
font.family: "Arial"
font.pixelSize: 12
color: "#545454"
text: qsTr("Balance") + translationManager.emptyString
}
Text {
font.family: "Arial"
font.pixelSize: 18
color: "#000000"
text: balance
}
}
Column {
anchors.top: parent.top
width: 148
Text {
anchors.left: parent.left
font.family: "Arial"
font.pixelSize: 12
color: "#545454"
text: qsTr("Amount") + translationManager.emptyString
}
Row {
spacing: 2
Text {
anchors.bottom: parent.bottom
anchors.bottomMargin: 3
font.family: "Arial"
font.pixelSize: 16
color: out ? "#FF4F41" : "#36B05B"
text: out ? "↓" : "↑"
}
Text {
anchors.bottom: parent.bottom
font.family: "Arial"
font.pixelSize: 18
color: out ? "#FF4F41" : "#36B05B"
text: amount
}
}
}
}
ListModel {
id: dropModel
ListElement { name: "<b>Copy address to clipboard</b>"; icon: "../images/dropdownCopy.png" }
ListElement { name: "<b>Add to address book</b>"; icon: "../images/dropdownAdd.png" }
ListElement { name: "<b>Send to this address</b>"; icon: "../images/dropdownSend.png" }
ListElement { name: "<b>Find similar transactions</b>"; icon: "../images/dropdownSearch.png" }
}
Clipboard { id: clipboard }
TableDropdown {
id: dropdown
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.bottomMargin: 11
anchors.rightMargin: 5
dataModel: dropModel
z: 1
onExpandedChanged: {
if(expanded) {
listView.previousItem = delegate
listView.currentIndex = index
}
}
onOptionClicked: {
if(option === 0)
clipboard.setText(address)
}
}
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
height: 1
color: "#DBDBDB"
}
}
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,23 +26,18 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.2
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
import QtQuick.Controls 2.2 as QtQuickControls2
import QtQuick.Layouts 1.2
import QtGraphicalEffects 1.0
import QtQuick.Controls.Styles 1.2 import QtQuick.Controls.Styles 1.2
import FontAwesome 1.0
import "." as MoneroComponents import "../components" as MoneroComponents
import "effects/" as MoneroEffects
Item { Item {
id: datePicker id: datePicker
readonly property alias expanded: popup.visible property bool expanded: false
property date currentDate property date currentDate
property bool showCurrentDate: true property bool showCurrentDate: true
property color backgroundColor : MoneroComponents.Style.appWindowBorderColor property color backgroundColor : "#404040"
property color errorColor : "red" property color errorColor : "red"
property bool error: false property bool error: false
property alias inputLabel: inputLabel property alias inputLabel: inputLabel
@@ -53,13 +48,26 @@ Item {
onExpandedChanged: if(expanded) appWindow.currentItem = datePicker onExpandedChanged: if(expanded) appWindow.currentItem = datePicker
function hide() { datePicker.expanded = false }
function containsPoint(px, py) {
if(px < 0)
return false
if(px > width)
return false
if(py < 0)
return false
if(py > height + calendarRect.height)
return false
return true
}
Rectangle { Rectangle {
id: inputLabelRect id: inputLabelRect
color: "transparent" color: "transparent"
height: 22 height: 22
width: parent.width width: parent.width
MoneroComponents.TextPlain { Text {
id: inputLabel id: inputLabel
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 2 anchors.topMargin: 2
@@ -69,7 +77,6 @@ Item {
font.bold: false font.bold: false
textFormat: Text.RichText textFormat: Text.RichText
color: MoneroComponents.Style.defaultFontColor color: MoneroComponents.Style.defaultFontColor
themeTransition: false
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
@@ -82,7 +89,7 @@ Item {
Item { Item {
id: head id: head
anchors.top: inputLabelRect.bottom anchors.top: inputLabelRect.bottom
anchors.topMargin: 6 anchors.topMargin: 6 * scaleRatio
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
height: 28 height: 28
@@ -92,21 +99,52 @@ Item {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
height: parent.height - 1 height: parent.height - 1
anchors.leftMargin: 0 anchors.leftMargin: datePicker.expanded ? 1 : 0
anchors.rightMargin: 0 anchors.rightMargin: datePicker.expanded ? 1 : 0
radius: 4 radius: 4
y: 1 y: 1
color: datePicker.backgroundColor color: datePicker.backgroundColor
} }
RowLayout { Item {
id: buttonItem
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.margins: 4
width: height
Image {
id: button
anchors.centerIn: parent
source: "../images/whiteDropIndicator.png"
rotation: datePicker.expanded ? 180 : 0
}
MouseArea {
anchors.fill: parent
onClicked: datePicker.expanded = !datePicker.expanded
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
}
}
Rectangle {
id: separator
anchors.verticalCenter: parent.verticalCenter
anchors.right: buttonItem.left
anchors.rightMargin: 4
height: 16
width: 1
color: "#808080"
visible: datePicker.expanded
}
Row {
id: dateInput id: dateInput
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 2 anchors.leftMargin: 10
anchors.right: parent.right
property string headerFontColor: MoneroComponents.Style.blackTheme ? "#e6e6e6" : "#333333"
spacing: 0
function setDate(date) { function setDate(date) {
var day = date.getDate() var day = date.getDate()
@@ -118,7 +156,7 @@ Item {
Connections { Connections {
target: datePicker target: datePicker
function onCurrentDateChanged() { onCurrentDateChanged: {
dateInput.setDate(datePicker.currentDate) dateInput.setDate(datePicker.currentDate)
} }
} }
@@ -126,14 +164,12 @@ Item {
TextInput { TextInput {
id: dayInput id: dayInput
readOnly: true readOnly: true
Layout.preferredWidth: childrenRect.width + 40 width: 22
font.family: MoneroComponents.Style.fontRegular.name font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 14 font.pixelSize: 14
color: datePicker.error ? errorColor : parent.headerFontColor color: datePicker.error ? errorColor : MoneroComponents.Style.defaultFontColor
selectionColor: MoneroComponents.Style.dimmedFontColor
selectByMouse: true
horizontalAlignment: TextInput.AlignHCenter
maximumLength: 2 maximumLength: 2
horizontalAlignment: TextInput.AlignHCenter
validator: IntValidator{bottom: 01; top: 31;} validator: IntValidator{bottom: 01; top: 31;}
KeyNavigation.tab: monthInput KeyNavigation.tab: monthInput
@@ -151,25 +187,22 @@ Item {
} }
} }
MoneroComponents.TextPlain { Text {
font.family: MoneroComponents.Style.fontRegular.name font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 14 font.pixelSize: 14
color: datePicker.error ? errorColor : MoneroComponents.Style.defaultFontColor color: datePicker.error ? errorColor : MoneroComponents.Style.defaultFontColor
text: "-" text: "-"
themeTransition: false
} }
TextInput { TextInput {
id: monthInput id: monthInput
readOnly: true readOnly: true
Layout.preferredWidth: childrenRect.width + 40 width: 22
font.family: MoneroComponents.Style.fontRegular.name font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 14 font.pixelSize: 14
color: datePicker.error ? errorColor : parent.headerFontColor color: datePicker.error ? errorColor : MoneroComponents.Style.defaultFontColor
selectionColor: MoneroComponents.Style.dimmedFontColor
selectByMouse: true
horizontalAlignment: TextInput.AlignHCenter
maximumLength: 2 maximumLength: 2
horizontalAlignment: TextInput.AlignHCenter
validator: IntValidator{bottom: 01; top: 12;} validator: IntValidator{bottom: 01; top: 12;}
KeyNavigation.tab: yearInput KeyNavigation.tab: yearInput
text: { text: {
@@ -186,27 +219,23 @@ Item {
} }
} }
MoneroComponents.TextPlain { Text {
font.family: MoneroComponents.Style.fontRegular.name font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 14 font.pixelSize: 14
color: datePicker.error ? errorColor : MoneroComponents.Style.defaultFontColor color: datePicker.error ? errorColor : MoneroComponents.Style.defaultFontColor
text: "-" text: "-"
themeTransition: false
} }
TextInput { TextInput {
id: yearInput id: yearInput
Layout.preferredWidth: childrenRect.width + 60 width: 44
font.family: MoneroComponents.Style.fontRegular.name font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 14 font.pixelSize: 14
color: datePicker.error ? errorColor : parent.headerFontColor color: datePicker.error ? errorColor : MoneroComponents.Style.defaultFontColor
selectionColor: MoneroComponents.Style.dimmedFontColor
selectByMouse: true
horizontalAlignment: TextInput.AlignHCenter
maximumLength: 4 maximumLength: 4
horizontalAlignment: TextInput.AlignHCenter
validator: IntValidator{bottom: 1000; top: 9999;} validator: IntValidator{bottom: 1000; top: 9999;}
text: if(datePicker.showCurrentDate) datePicker.currentDate.getFullYear() text: if(datePicker.showCurrentDate) datePicker.currentDate.getFullYear()
onFocusChanged: { onFocusChanged: {
if(focus === false) { if(focus === false) {
var d = new Date() var d = new Date()
@@ -216,246 +245,151 @@ Item {
} }
} }
} }
Rectangle {
Layout.preferredHeight: parent.height
Layout.fillWidth: true
color: "transparent"
MoneroEffects.ImageMask {
id: button
anchors.right: parent.right
anchors.rightMargin: 10
anchors.verticalCenter: parent.verticalCenter
image: "qrc:///images/whiteDropIndicator.png"
height: 8
width: 12
fontAwesomeFallbackIcon: FontAwesome.arrowDown
fontAwesomeFallbackSize: 14
color: MoneroComponents.Style.defaultFontColor
rotation: datePicker.expanded ? 180 : 0
}
MouseArea {
anchors.fill: parent
onClicked: datePicker.expanded ? popup.close() : popup.open()
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
}
}
} }
} }
QtQuickControls2.Popup { Rectangle {
id: popup id: calendarRect
padding: 0 anchors.left: parent.left
closePolicy: QtQuickControls2.Popup.CloseOnEscape | QtQuickControls2.Popup.CloseOnPressOutsideParent anchors.right: parent.right
onOpened: { anchors.top: head.bottom
calendar.visibleMonth = currentDate.getMonth(); color: "#FFFFFF"
calendar.visibleYear = currentDate.getFullYear(); border.width: 1
border.color: "#DBDBDB"
height: datePicker.expanded ? calendar.height + 2 : 0
clip: true
//radius: 4
Behavior on height {
NumberAnimation { duration: 100; easing.type: Easing.InQuad }
} }
Rectangle { Rectangle {
id: calendarRect anchors.left: parent.left
width: head.width anchors.right: parent.right
x: head.x anchors.leftMargin: 1
y: head.y + head.height - 2 anchors.rightMargin: 1
anchors.top: parent.top
color: "#FFFFFF"
height: 1
}
color: MoneroComponents.Style.middlePanelBackgroundColor Calendar {
border.width: 1 id: calendar
border.color: MoneroComponents.Style.appWindowBorderColor anchors.left: parent.left
height: datePicker.expanded ? calendar.height + 2 : 0 anchors.right: parent.right
clip: true anchors.top: parent.top
anchors.margins: 1
height: 180
frameVisible: false
Behavior on height { style: CalendarStyle {
NumberAnimation { duration: 150; easing.type: Easing.InQuad } gridVisible: false
} background: Rectangle { color: "transparent" }
dayDelegate: Item {
z: parent.z + 1
implicitHeight: implicitWidth
implicitWidth: calendar.width / 7
MouseArea { Rectangle {
anchors.fill: parent anchors.fill: parent
scrollGestureEnabled: false radius: parent.implicitHeight / 2
onWheel: { color: dayArea.pressed && styleData.visibleMonth ? "#FF6C3B" : "transparent"
if (wheel.angleDelta.y > 0) return calendar.showPreviousMonth(); }
if (wheel.angleDelta.y < 0) return calendar.showNextMonth();
}
}
Rectangle { Text {
anchors.left: parent.left anchors.centerIn: parent
anchors.right: parent.right font.family: "Arial"
anchors.leftMargin: 1 font.pixelSize: 12
anchors.rightMargin: 1 font.bold: dayArea.pressed
anchors.top: parent.top text: styleData.date.getDate()
color: MoneroComponents.Style.appWindowBorderColor color: {
height: 1 if(!styleData.visibleMonth) return "#DBDBDB"
} if(dayArea.pressed) return "#FFFFFF"
if(styleData.today) return "#FF6C3B"
Calendar { return "#4A4848"
id: calendar
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: 1
anchors.bottomMargin: 10
height: 220
frameVisible: false
style: CalendarStyle {
gridVisible: false
background: Rectangle { color: MoneroComponents.Style.middlePanelBackgroundColor }
dayDelegate: Item {
z: parent.z + 1
implicitHeight: implicitWidth
implicitWidth: calendar.width / 7
Rectangle {
id: dayRect
anchors.fill: parent
radius: parent.implicitHeight / 2
} }
}
MoneroComponents.TextPlain { MouseArea {
id: dayText id: dayArea
anchors.fill: parent
onClicked: {
if(styleData.visibleMonth) {
currentDate = styleData.date
datePicker.expanded = false
} else {
var date = styleData.date
if(date.getMonth() > calendar.visibleMonth)
calendar.showNextMonth()
else calendar.showPreviousMonth()
}
dateChanged();
}
}
}
dayOfWeekDelegate: Item {
implicitHeight: 20
implicitWidth: calendar.width / 7
Text {
anchors.centerIn: parent
elide: Text.ElideRight
font.family: "Arial"
font.pixelSize: 9
color: "#535353"
text: {
var locale = Qt.locale()
return locale.dayName(styleData.dayOfWeek, Locale.ShortFormat)
}
}
}
navigationBar: Rectangle {
implicitWidth: calendar.width
implicitHeight: 30
Text {
anchors.centerIn: parent
font.family: "Arial"
font.pixelSize: 12
color: "#4A4646"
text: styleData.title
}
Item {
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
width: height
Image {
anchors.centerIn: parent anchors.centerIn: parent
font.family: MoneroComponents.Style.fontMonoRegular.name source: "../images/prevMonth.png"
font.pixelSize: {
if(!styleData.visibleMonth) return 12
return 14
}
font.bold: {
if(dayArea.pressed || styleData.visibleMonth) return true;
return false;
}
text: styleData.date.getDate()
themeTransition: false
color: {
if (currentDate.toDateString() === styleData.date.toDateString()) {
if (dayArea.containsMouse) {
dayRect.color = MoneroComponents.Style.buttonBackgroundColorHover;
} else {
dayRect.color = MoneroComponents.Style.buttonBackgroundColor;
}
} else {
if (dayArea.containsMouse) {
dayRect.color = MoneroComponents.Style.blackTheme ? "#20FFFFFF" : "#10000000"
} else {
dayRect.color = "transparent";
}
}
if(!styleData.valid) return "transparent"
if(styleData.date.toDateString() === (new Date()).toDateString()) return "#FFFF00"
if(!styleData.visibleMonth) return MoneroComponents.Style.lightGreyFontColor
if(dayArea.pressed) return MoneroComponents.Style.defaultFontColor
return MoneroComponents.Style.defaultFontColor
}
} }
MouseArea { MouseArea {
id: dayArea
anchors.fill: parent anchors.fill: parent
visible: styleData.valid onClicked: calendar.showPreviousMonth()
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
if(styleData.visibleMonth) {
currentDate = styleData.date
popup.close()
} else {
var date = styleData.date
if(date.getMonth() > calendar.visibleMonth)
calendar.showNextMonth()
else calendar.showPreviousMonth()
}
datePicker.dateChanged();
}
} }
} }
dayOfWeekDelegate: Item { Item {
implicitHeight: 20 anchors.right: parent.right
implicitWidth: calendar.width / 7 anchors.top: parent.top
anchors.bottom: parent.bottom
width: height
MoneroComponents.TextPlain { Image {
anchors.centerIn: parent anchors.centerIn: parent
elide: Text.ElideRight source: "../images/nextMonth.png"
font.family: MoneroComponents.Style.fontMonoRegular.name
font.pixelSize: 12
color: MoneroComponents.Style.lightGreyFontColor
themeTransition: false
text: {
var locale = Qt.locale()
return locale.dayName(styleData.dayOfWeek, Locale.ShortFormat)
}
}
}
navigationBar: Rectangle {
color: MoneroComponents.Style.middlePanelBackgroundColor
implicitWidth: calendar.width
implicitHeight: 30
MoneroComponents.TextPlain {
anchors.centerIn: parent
font.family: MoneroComponents.Style.fontMonoRegular.name
font.pixelSize: 14
color: MoneroComponents.Style.dimmedFontColor
themeTransition: false
text: styleData.title
} }
MouseArea {
Item { anchors.fill: parent
anchors.left: parent.left onClicked: calendar.showNextMonth()
anchors.leftMargin: 4
anchors.top: parent.top
anchors.bottom: parent.bottom
width: height
MoneroEffects.ImageMask {
id: prevMonthIcon
anchors.centerIn: parent
image: "qrc:///images/prevMonth.png"
height: 8
width: 12
fontAwesomeFallbackIcon: FontAwesome.arrowLeft
fontAwesomeFallbackSize: 14
color: MoneroComponents.Style.defaultFontColor
}
MouseArea {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
onClicked: calendar.showPreviousMonth()
}
}
Item {
anchors.right: parent.right
anchors.rightMargin: 4
anchors.top: parent.top
anchors.bottom: parent.bottom
width: height
MoneroEffects.ImageMask {
id: nextMonthIcon
anchors.centerIn: parent
image: "qrc:///images/prevMonth.png"
height: 8
width: 12
rotation: 180
fontAwesomeFallbackIcon: FontAwesome.arrowLeft
fontAwesomeFallbackSize: 14
color: MoneroComponents.Style.defaultFontColor
}
MouseArea {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
onClicked: calendar.showNextMonth()
}
} }
} }
} }

View File

@@ -1,104 +0,0 @@
// Copyright (c) 2014-2024, 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.
import QtQuick 2.9
import "." as MoneroComponents
Item {
id: root
property var onAcceptedCallback
property var onWalletEntryCallback
property var onRejectedCallback
function open(canEnterOnDevice_) {
var canEnterOnDevice = canEnterOnDevice_ !== null ? canEnterOnDevice_ : canEnterOnDevice
root.visible = true;
if (canEnterOnDevice) {
entryChooserDialog.okText = qsTr("Hardware wallet")
entryChooserDialog.cancelText = qsTr("Computer")
entryChooserDialog.open()
} else {
openPassphraseDialog()
}
}
function openPassphraseDialog() {
root.visible = true
passphraseDialog.openPassphraseDialog()
}
function close() {
root.visible = false;
if (entryChooserDialog.visible)
entryChooserDialog.close()
if (passphraseDialog.visible)
passphraseDialog.close()
}
StandardDialog {
id: entryChooserDialog
title: qsTr("Hardware wallet passphrase") + translationManager.emptyString
text: qsTr("Please select where you want to enter passphrase.\nIt is recommended to enter passphrase on the hardware wallet for better security.") + translationManager.emptyString
onAccepted: {
if (onWalletEntryCallback){
onWalletEntryCallback()
}
}
onRejected: {
openPassphraseDialog()
}
onCloseCallback: {
root.close()
}
}
PasswordDialog {
id: passphraseDialog
anchors.fill: parent
passphraseDialogMode: true
onAcceptedPassphrase: {
if (onAcceptedCallback)
onAcceptedCallback(passphraseDialog.password);
}
onRejectedPassphrase: {
if (onRejectedCallback)
onRejectedCallback();
}
onCloseCallback: {
root.close()
}
}
}

484
components/HistoryTable.qml Normal file
View File

@@ -0,0 +1,484 @@
// 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.
import QtQuick 2.0
import moneroComponents.Clipboard 1.0
import moneroComponents.AddressBookModel 1.0
import "../components" as MoneroComponents
import "../js/TxUtils.js" as TxUtils
ListView {
id: listView
clip: true
boundsBehavior: ListView.StopAtBounds
property var previousItem
property int rowSpacing: 12
property var addressBookModel: null
function buildTxDetailsString(tx_id, paymentId, tx_key,tx_note, destinations, rings) {
var trStart = '<tr><td width="85" style="padding-top:5px"><b>',
trMiddle = '</b></td><td style="padding-left:10px;padding-top:5px;">',
trEnd = "</td></tr>";
return '<table border="0">'
+ (tx_id ? trStart + qsTr("Tx ID:") + trMiddle + tx_id + trEnd : "")
+ (paymentId ? trStart + qsTr("Payment ID:") + trMiddle + paymentId + trEnd : "")
+ (tx_key ? trStart + qsTr("Tx key:") + trMiddle + tx_key + trEnd : "")
+ (tx_note ? trStart + qsTr("Tx note:") + trMiddle + tx_note + trEnd : "")
+ (destinations ? trStart + qsTr("Destinations:") + trMiddle + destinations + trEnd : "")
+ (rings ? trStart + qsTr("Rings:") + trMiddle + rings + trEnd : "")
+ "</table>"
+ translationManager.emptyString;
}
function lookupPaymentID(paymentId) {
if (!addressBookModel)
return ""
var idx = addressBookModel.lookupPaymentID(paymentId)
if (idx < 0)
return ""
idx = addressBookModel.index(idx, 0)
return addressBookModel.data(idx, AddressBookModel.AddressBookDescriptionRole)
}
footer: Rectangle {
height: 127 * scaleRatio
width: listView.width
color: "transparent"
Text {
anchors.centerIn: parent
font.family: "Arial"
font.pixelSize: 14
color: "#545454"
text: qsTr("No more results") + translationManager.emptyString
}
}
delegate: Rectangle {
id: delegate
property bool collapsed: index ? false : true
height: collapsed ? 180 * scaleRatio : 70 * scaleRatio
width: listView.width
color: "transparent"
function collapse(){
delegate.height = 180 * scaleRatio;
}
// borders
Rectangle{
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
width: 1
color: "#404040"
}
Rectangle{
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
width: collapsed ? 2 : 1
color: collapsed ? "#BBBBBB" : "#404040"
}
Rectangle{
anchors.right: parent.right
anchors.bottom: parent.top
anchors.left: parent.left
height: 1
color: "#404040"
}
Rectangle{
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.left: parent.left
height: 1
color: "#404040"
}
Rectangle {
id: row1
anchors.left: parent.left
anchors.leftMargin: 20 * scaleRatio
anchors.right: parent.right
anchors.rightMargin: 20 * scaleRatio
anchors.top: parent.top
anchors.topMargin: 15 * scaleRatio
height: 40 * scaleRatio
color: "transparent"
Image {
id: arrowImage
source: isOut ? "../images/downArrow.png" : "../images/upArrow-green.png"
height: 18 * scaleRatio
width: 12 * scaleRatio
anchors.top: parent.top
anchors.topMargin: 12 * scaleRatio
}
Text {
id: txrxLabel
anchors.left: arrowImage.right
anchors.leftMargin: 18 * scaleRatio
font.family: MoneroComponents.Style.fontLight.name
font.pixelSize: 14 * scaleRatio
text: isOut ? "Sent" : "Received"
color: "#808080"
}
Text {
id: amountLabel
anchors.left: arrowImage.right
anchors.leftMargin: 18 * scaleRatio
anchors.top: txrxLabel.bottom
anchors.topMargin: 0 * scaleRatio
font.family: MoneroComponents.Style.fontBold.name
font.pixelSize: 18 * scaleRatio
font.bold: true
text: {
var _amount = amount;
if(_amount === 0){
// *sometimes* amount is 0, while the 'destinations string'
// has the correct amount, so we try to fetch it from that instead.
_amount = TxUtils.destinationsToAmount(destinations);
_amount = (_amount *1);
}
return _amount + " XMR";
}
color: isOut ? "white" : "#2eb358"
}
Rectangle {
anchors.right: parent.right
width: 300 * scaleRatio
height: parent.height
color: "transparent"
Text {
id: dateLabel
anchors.left: parent.left
font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 14 * scaleRatio
text: date
color: "#808080"
}
Text {
id: timeLabel
anchors.left: dateLabel.right
anchors.leftMargin: 7 * scaleRatio
anchors.top: parent.top
anchors.topMargin: 3 * scaleRatio
font.pixelSize: 12 * scaleRatio
text: time
color: "#808080"
}
Text {
id: toLabel
property string address: ""
color: "#BBBBBB"
anchors.left: parent.left
anchors.top: dateLabel.bottom
anchors.topMargin: 0
font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 16 * scaleRatio
text: {
if(isOut){
address = TxUtils.destinationsToAddress(destinations);
if(address){
var truncated = TxUtils.addressTruncate(address);
return "To " + truncated;
} else {
return "Unknown recipient";
}
}
return "";
}
MouseArea{
visible: parent.address !== undefined
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onEntered: {
toLabel.color = "white";
}
onExited: {
toLabel.color = "#BBBBBB";
}
onClicked: {
if(parent.address){
console.log("Address copied to clipboard");
clipboard.setText(parent.address);
appWindow.showStatusMessage(qsTr("Address copied to clipboard"),3)
}
}
}
}
Rectangle {
height: 24 * scaleRatio
width: 24 * scaleRatio
color: "transparent"
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
Image {
id: dropdownImage
height: 8 * scaleRatio
width: 12 * scaleRatio
source: "../images/whiteDropIndicator.png"
rotation: delegate.collapsed ? 180 : 0
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}
MouseArea{
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
delegate.collapsed = !delegate.collapsed;
}
}
}
}
}
Rectangle {
id: row2
anchors.left: parent.left
anchors.leftMargin: 20 * scaleRatio
anchors.right: parent.right
anchors.rightMargin: 20 * scaleRatio
anchors.top: row1.bottom
anchors.topMargin: 15 * scaleRatio
height: 40 * scaleRatio
color: "transparent"
visible: delegate.collapsed
// left column
MoneroComponents.HistoryTableInnerColumn{
anchors.left: parent.left
anchors.leftMargin: 30 * scaleRatio
labelHeader: "Transaction ID"
labelValue: hash.substring(0, 18) + "..."
copyValue: hash
}
// right column
MoneroComponents.HistoryTableInnerColumn{
anchors.right: parent.right
anchors.rightMargin: 100 * scaleRatio
width: 200 * scaleRatio
height: parent.height
color: "transparent"
labelHeader: qsTr("Fee")
labelValue: {
if(!isOut && !fee){
return "-";
} else if(isOut && fee){
return fee + " XMR";
} else {
return "Unknown"
}
}
copyValue: {
if(isOut && fee){ return fee }
else { return "" }
}
}
}
Rectangle {
id: row3
anchors.left: parent.left
anchors.leftMargin: 20 * scaleRatio
anchors.right: parent.right
anchors.rightMargin: 20 * scaleRatio
anchors.top: row2.bottom
anchors.topMargin: 15 * scaleRatio
height: 40 * scaleRatio
color: "transparent"
visible: delegate.collapsed
// left column
MoneroComponents.HistoryTableInnerColumn{
anchors.left: parent.left
anchors.leftMargin: 30 * scaleRatio
labelHeader: qsTr("Blockheight")
labelValue: {
if (!isPending)
if(confirmations < confirmationsRequired)
return blockHeight + " " + qsTr("(%1/%2 confirmations)").arg(confirmations).arg(confirmationsRequired);
else
return blockHeight;
if (!isOut)
return qsTr("UNCONFIRMED") + translationManager.emptyString
if (isFailed)
return qsTr("FAILED") + translationManager.emptyString
return qsTr("PENDING") + translationManager.emptyString
}
copyValue: labelValue
}
// right column
MoneroComponents.HistoryTableInnerColumn {
visible: currentWallet.getUserNote(hash)
anchors.right: parent.right
anchors.rightMargin: 80 * scaleRatio
width: 220 * scaleRatio
height: parent.height
color: "transparent"
labelHeader: qsTr("Description")
labelValue: {
var note = currentWallet.getUserNote(hash);
if(note){
if(note.length > 28) {
return note.substring(0, 28) + "...";
} else {
return note;
}
} else {
return "";
}
}
copyValue: {
return currentWallet.getUserNote(hash);
}
}
Rectangle {
id: proofButton
visible: isOut
color: "#404040"
height: 24 * scaleRatio
width: 24 * scaleRatio
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.bottomMargin: 36
radius: 20 * scaleRatio
MouseArea {
id: proofButtonMouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
var address = TxUtils.destinationsToAddress(destinations);
if(address === undefined){
console.log('getProof: Error fetching address')
return;
}
var checked = (TxUtils.checkTxID(hash) && TxUtils.checkAddress(address, appWindow.persistentSettings.nettype));
if(!checked){
console.log('getProof: Error checking TxId and/or address');
}
console.log("getProof: Generate clicked: txid " + hash + ", address " + address);
root.getProofClicked(hash, address, '');
}
onEntered: {
proofButton.color = "#656565";
}
onExited: {
proofButton.color = "#404040";
}
}
Text {
color: MoneroComponents.Style.defaultFontColor
text: "P"
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: 14 * scaleRatio
}
}
Rectangle {
id: detailsButton
color: "#404040"
height: 24 * scaleRatio
width: 24 * scaleRatio
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.bottomMargin: 6
radius: 20 * scaleRatio
MouseArea {
id: detailsButtonMouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
var tx_key = currentWallet.getTxKey(hash)
var tx_note = currentWallet.getUserNote(hash)
var rings = currentWallet.getRings(hash)
if (rings)
rings = rings.replace(/\|/g, '\n')
informationPopup.title = "Transaction details";
informationPopup.content = buildTxDetailsString(hash,paymentId,tx_key,tx_note,destinations, rings);
informationPopup.onCloseCallback = null
informationPopup.open();
}
onEntered: {
detailsButton.color = "#656565";
}
onExited: {
detailsButton.color = "#404040";
}
}
Text {
color: MoneroComponents.Style.defaultFontColor
text: "?"
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: 14 * scaleRatio
}
}
}
}
Clipboard { id: clipboard }
}

View File

@@ -0,0 +1,91 @@
// Copyright (c) 2014-2015, 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.
import QtQuick 2.0
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.2
import moneroComponents.Clipboard 1.0
import moneroComponents.PendingTransaction 1.0
import moneroComponents.Wallet 1.0
import "../components" as MoneroComponents
Rectangle{
Clipboard { id: clipboard }
width: label1.width > label2.width ? label1.width : label2.width
height: label1.height + label2.height
color: "transparent"
property string copyValue: ""
property alias labelHeader: label1.text
property alias labelValue: label2.text
Text {
id: label1
anchors.left: parent.left
font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 14 * scaleRatio
text: labelHeader
color: MoneroComponents.Style.dimmedFontColor
}
Text {
id: label2
anchors.left: parent.left
anchors.top: label1.bottom
font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 14 * scaleRatio
text: labelValue
color: MoneroComponents.Style.dimmedFontColor
}
// hover effect / copy value
MouseArea {
visible: copyValue !== ""
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onEntered: {
label1.color = MoneroComponents.Style.defaultFontColor;
label2.color = MoneroComponents.Style.defaultFontColor;
}
onExited: {
label1.color = MoneroComponents.Style.dimmedFontColor
label2.color = MoneroComponents.Style.dimmedFontColor;
}
onClicked: {
if(copyValue){
console.log("Copied to clipboard");
clipboard.setText(copyValue);
appWindow.showStatusMessage(qsTr("Copied to clipboard"),3)
}
}
}
}

View File

@@ -0,0 +1,222 @@
// 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.
import QtQuick 2.0
import QtQuick.Layouts 1.1
import moneroComponents.Clipboard 1.0
import moneroComponents.AddressBookModel 1.0
import "../components" as MoneroComponents
ListView {
id: listView
clip: true
boundsBehavior: ListView.StopAtBounds
property var previousItem
property var addressBookModel: null
function buildTxDetailsString(tx_id, paymentId, tx_key,tx_note, destinations, rings) {
var trStart = '<tr><td width="85" style="padding-top:5px"><b>',
trMiddle = '</b></td><td style="padding-left:10px;padding-top:5px;">',
trEnd = "</td></tr>";
return '<table border="0">'
+ (tx_id ? trStart + qsTr("Tx ID:") + trMiddle + tx_id + trEnd : "")
+ (paymentId ? trStart + qsTr("Payment ID:") + trMiddle + paymentId + trEnd : "")
+ (tx_key ? trStart + qsTr("Tx key:") + trMiddle + tx_key + trEnd : "")
+ (tx_note ? trStart + qsTr("Tx note:") + trMiddle + tx_note + trEnd : "")
+ (destinations ? trStart + qsTr("Destinations:") + trMiddle + destinations + trEnd : "")
+ (rings ? trStart + qsTr("Rings:") + trMiddle + rings + trEnd : "")
+ "</table>"
+ translationManager.emptyString;
}
function lookupPaymentID(paymentId) {
if (!addressBookModel)
return ""
var idx = addressBookModel.lookupPaymentID(paymentId)
if (idx < 0)
return ""
idx = addressBookModel.index(idx, 0)
return addressBookModel.data(idx, AddressBookModel.AddressBookDescriptionRole)
}
footer: Rectangle {
height: 127 * scaleRatio
width: listView.width
color: "transparent"
Text {
anchors.centerIn: parent
font.family: "Arial"
font.pixelSize: 14 * scaleRatio
color: "#545454"
text: qsTr("No more results") + translationManager.emptyString
}
}
delegate: Rectangle {
id: delegate
height: tableContent.height + 20 * scaleRatio
width: listView.width
color: "transparent"
Layout.leftMargin: 10 * scaleRatio
z: listView.count - index
function collapseDropdown() { dropdown.expanded = false }
Rectangle{
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
width: 1
color: "#404040"
}
Rectangle{
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.top: parent.top
width: 1
color: "#404040"
}
Rectangle{
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.left: parent.left
height: 1
color: "#404040"
}
MouseArea {
anchors.fill: parent
onClicked: {
var tx_key = currentWallet.getTxKey(hash)
var tx_note = currentWallet.getUserNote(hash)
var rings = currentWallet.getRings(hash)
if (rings)
rings = rings.replace(/\|/g, '\n')
informationPopup.title = "Transaction details";
informationPopup.text = buildTxDetailsString(hash,paymentId,tx_key,tx_note,destinations, rings);
informationPopup.open();
informationPopup.onCloseCallback = null
}
}
Rectangle {
anchors.right: parent.right
anchors.rightMargin: 15 * scaleRatio
anchors.top: parent.top
anchors.topMargin: parent.height/2 - this.height/2
width: 30 * scaleRatio; height: 30 * scaleRatio
radius: 25
color: "#404040"
Image {
width: 20 * scaleRatio
height: 20 * scaleRatio
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
source: "qrc:///images/nextPage.png"
}
}
ColumnLayout {
id: tableContent
// Date
RowLayout {
Layout.topMargin: 20 * scaleRatio
Layout.leftMargin: 10 * scaleRatio
Text {
font.family: MoneroComponents.Style.fontMedium.name
font.pixelSize: 14 * scaleRatio
color: MoneroComponents.Style.defaultFontColor
text: date
}
Text {
font.family: Style.fontRegular.name
font.pixelSize: 14 * scaleRatio
color: MoneroComponents.Style.dimmedFontColor
text: time
}
// Show confirmations
Text {
visible: confirmations < confirmationsRequired || isPending
Layout.leftMargin: 5 * scaleRatio
font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 14 * scaleRatio
color: (confirmations < confirmationsRequired)? "#FF6C3C" : "#545454"
text: {
if (!isPending)
if(confirmations < confirmationsRequired)
return qsTr("(%1/%2 confirmations)").arg(confirmations).arg(confirmationsRequired)
if (!isOut)
return qsTr("UNCONFIRMED") + translationManager.emptyString
if (isFailed)
return qsTr("FAILED") + translationManager.emptyString
return qsTr("PENDING") + translationManager.emptyString
}
}
}
// Amount & confirmations
RowLayout {
Layout.leftMargin: 10 * scaleRatio
spacing: 2
Text {
font.family: "Arial"
font.pixelSize: 14 * scaleRatio
color: isOut ? MoneroComponents.Style.defaultFontColor : "#2eb358"
text: isOut ? "↓" : "↑"
}
Text {
id: amountText
font.family: "Arial"
font.pixelSize: 18 * scaleRatio
color: isOut ? MoneroComponents.Style.defaultFontColor : "#2eb358"
text: displayAmount
}
}
}
}
ListModel {
id: dropModel
ListElement { name: "<b>Copy address to clipboard</b>"; icon: "../images/dropdownCopy.png" }
ListElement { name: "<b>Add to address book</b>"; icon: "../images/dropdownAdd.png" }
ListElement { name: "<b>Send to this address</b>"; icon: "../images/dropdownSend.png" }
ListElement { name: "<b>Find similar transactions</b>"; icon: "../images/dropdownSearch.png" }
}
Clipboard { id: clipboard }
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,42 +26,49 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9
import "../components" as MoneroComponents
import "../components/effects" as MoneroEffects
MoneroEffects.ImageMask { import QtQuick 2.0
id: button
z: 666 Item {
color: MoneroComponents.Style.defaultFontColor property alias image : buttonImage
image: "" property alias imageSource : buttonImage.source
property alias tooltip: tooltip.text
signal clicked(var mouse) signal clicked(var mouse)
MoneroComponents.Tooltip {
id: tooltip id: button
anchors.fill: parent width: parent.height
tooltipLeft: true height: parent.height
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
Image {
id: buttonImage
source: ""
x : (parent.width - width) / 2
y : (parent.height - height) /2
z: 100
} }
MouseArea { MouseArea {
id: buttonArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onEntered: { onPressed: {
tooltip.text ? tooltip.tooltipPopup.open() : "" buttonImage.x = buttonImage.x + 2
button.width = button.width + 2 buttonImage.y = buttonImage.y + 2
button.height = button.height + 2 }
onReleased: {
buttonImage.x = buttonImage.x - 2
buttonImage.y = buttonImage.y - 2
} }
onExited: { onClicked: {
tooltip.text ? tooltip.tooltipPopup.close() : "" parent.clicked(mouse)
button.width = button.width - 2
button.height = button.height - 2
} }
onClicked: button.clicked(mouse)
} }
} }

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2015, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,33 +26,22 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.0
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtGraphicalEffects 1.0
import FontAwesome 1.0 import "../components" as MoneroComponents
import "." as MoneroComponents
import "./effects/" as MoneroEffects
Item { Item {
id: inlineButton id: inlineButton
height: rect.height * scaleRatio
property bool small: false property string shadowPressedColor: "#B32D00"
property string textColor: MoneroComponents.Style.inlineButtonTextColor property string shadowReleasedColor: "#FF4304"
property string pressedColor: "#FF4304"
property string releasedColor: "#FF6C3C"
property string icon: ""
property string textColor: "#FFFFFF"
property int fontSize: 12 * scaleRatio
property alias text: inlineText.text property alias text: inlineText.text
property alias fontPixelSize: inlineText.font.pixelSize
property alias fontFamily: inlineText.font.family
property alias fontStyleName: inlineText.font.styleName
property bool isFontAwesomeIcon: fontFamily == FontAwesome.fontFamily || fontFamily == FontAwesome.fontFamilySolid
property alias buttonColor: rect.color
property alias tooltip: tooltip.text
property alias tooltipLeft: tooltip.tooltipLeft
property alias tooltipBottom: tooltip.tooltipBottom
height: isFontAwesomeIcon ? 30 : 24
width: isFontAwesomeIcon ? height : inlineText.width + 16
signal clicked() signal clicked()
function doClick() { function doClick() {
@@ -63,31 +52,23 @@ Item {
Rectangle{ Rectangle{
id: rect id: rect
anchors.fill: parent color: MoneroComponents.Style.buttonBackgroundColorDisabled
color: buttonArea.containsMouse ? MoneroComponents.Style.buttonInlineBackgroundColorHover : MoneroComponents.Style.buttonInlineBackgroundColor border.color: "black"
height: 28 * scaleRatio
width: inlineText.width + 22 * scaleRatio
radius: 4 radius: 4
border.width: parent.focus && parent.enabled ? 1 : 0
MoneroComponents.TextPlain { anchors.top: parent.top
anchors.right: parent.right
Text {
id: inlineText id: inlineText
font.family: MoneroComponents.Style.fontBold.name font.family: MoneroComponents.Style.fontBold.name
font.bold: true font.bold: true
font.pixelSize: inlineButton.isFontAwesomeIcon ? 22 : inlineButton.small ? 14 : 16 font.pixelSize: 16 * scaleRatio
color: inlineButton.textColor color: "black"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
themeTransition: false
MoneroEffects.ColorTransition {
targetObj: inlineText
blackColor: MoneroComponents.Style._b_inlineButtonTextColor
whiteColor: MoneroComponents.Style._w_inlineButtonTextColor
}
}
MoneroComponents.Tooltip {
id: tooltip
anchors.fill: parent
} }
MouseArea { MouseArea {
@@ -95,33 +76,18 @@ Item {
cursorShape: rect.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor cursorShape: rect.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
hoverEnabled: true hoverEnabled: true
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: doClick()
tooltip.text ? tooltip.tooltipPopup.close() : ""
doClick()
}
onEntered: { onEntered: {
tooltip.text ? tooltip.tooltipPopup.open() : "" rect.color = "#707070";
rect.opacity = 0.8;
} }
onExited: { onExited: {
tooltip.text ? tooltip.tooltipPopup.close() : "" rect.opacity = 1.0;
rect.color = "#808080";
} }
} }
} }
DropShadow {
visible: !MoneroComponents.Style.blackTheme
anchors.fill: rect
horizontalOffset: 2
verticalOffset: 2
radius: 7.0
samples: 10
color: "#1B000000"
cached: true
source: rect
}
Keys.enabled: inlineButton.visible
Keys.onSpacePressed: doClick() Keys.onSpacePressed: doClick()
Keys.onEnterPressed: Keys.onReturnPressed(event)
Keys.onReturnPressed: doClick() Keys.onReturnPressed: doClick()
} }

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -27,37 +27,21 @@
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import QtQuick 2.9 import QtQuick 2.7
import "../components" as MoneroComponents import "../components" as MoneroComponents
TextField { TextField {
id: textField
font.family: MoneroComponents.Style.fontRegular.name font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 18 font.pixelSize: 18 * scaleRatio
font.bold: true font.bold: true
horizontalAlignment: TextInput.AlignLeft horizontalAlignment: TextInput.AlignLeft
selectByMouse: true selectByMouse: true
color: MoneroComponents.Style.defaultFontColor color: MoneroComponents.Style.defaultFontColor
selectionColor: MoneroComponents.Style.textSelectionColor selectionColor: MoneroComponents.Style.dimmedFontColor
selectedTextColor: MoneroComponents.Style.textSelectedColor selectedTextColor: MoneroComponents.Style.defaultFontColor
background: Rectangle { background: Rectangle {
color: "transparent" color: "transparent"
} }
MoneroComponents.ContextMenu {
cursorShape: Qt.IBeamCursor
onCut: textField.cut();
onCopy: textField.copy();
onPaste: {
var previoustextFieldLength = textField.length
var previousCursorPosition = textField.cursorPosition;
textField.paste();
textField.forceActiveFocus()
textField.cursorPosition = previousCursorPosition + (textField.length - previoustextFieldLength);
}
onRemove: textField.remove(selectionStart, selectionEnd);
onSelectAll: textField.selectAll();
}
} }

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,7 +26,7 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.7
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
@@ -45,19 +45,22 @@ Item {
signal accepted() signal accepted()
signal rejected() signal rejected()
function open(prepopulate) { function open() {
inactiveOverlay.visible = true
leftPanel.enabled = false leftPanel.enabled = false
middlePanel.enabled = false middlePanel.enabled = false
titleBar.state = "essentials" titleBar.enabled = false
show()
root.visible = true; root.visible = true;
input.focus = true; input.focus = true;
input.text = prepopulate ? prepopulate : ""; input.text = "";
} }
function close() { function close() {
inactiveOverlay.visible = false
leftPanel.enabled = true leftPanel.enabled = true
middlePanel.enabled = true middlePanel.enabled = true
titleBar.state = "default" titleBar.enabled = true
root.visible = false; root.visible = false;
} }
@@ -72,44 +75,44 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.maximumWidth: 400 Layout.maximumWidth: 400 * scaleRatio
Label { Label {
id: label id: label
anchors.left: parent.left
Layout.fillWidth: true Layout.fillWidth: true
font.pixelSize: 16 font.pixelSize: 16 * scaleRatio
font.family: MoneroComponents.Style.fontLight.name font.family: MoneroComponents.Style.fontLight.name
color: MoneroComponents.Style.defaultFontColor color: MoneroComponents.Style.defaultFontColor
} }
MoneroComponents.Input { TextField {
id : input id : input
focus: true focus: true
Layout.topMargin: 6 Layout.topMargin: 6
Layout.fillWidth: true Layout.fillWidth: true
anchors.left: parent.left
horizontalAlignment: TextInput.AlignLeft horizontalAlignment: TextInput.AlignLeft
verticalAlignment: TextInput.AlignVCenter verticalAlignment: TextInput.AlignVCenter
font.family: MoneroComponents.Style.fontLight.name font.family: MoneroComponents.Style.fontLight.name
font.pixelSize: 24 font.pixelSize: 24 * scaleRatio
KeyNavigation.tab: okButton KeyNavigation.tab: okButton
bottomPadding: 10 bottomPadding: 10
leftPadding: 10 leftPadding: 10
topPadding: 10 topPadding: 10
color: MoneroComponents.Style.defaultFontColor color: MoneroComponents.Style.defaultFontColor
selectionColor: MoneroComponents.Style.textSelectionColor selectionColor: MoneroComponents.Style.dimmedFontColor
selectedTextColor: MoneroComponents.Style.textSelectedColor selectedTextColor: MoneroComponents.Style.defaultFontColor
background: Rectangle { background: Rectangle {
radius: 2 radius: 2
border.color: MoneroComponents.Style.inputBorderColorActive border.color: Qt.rgba(255, 255, 255, 0.35)
border.width: 1 border.width: 1
color: MoneroComponents.Style.blackTheme ? "black" : "#A9FFFFFF" color: "black"
} }
Keys.enabled: root.visible
Keys.onEnterPressed: Keys.onReturnPressed(event)
Keys.onReturnPressed: { Keys.onReturnPressed: {
root.close() root.close()
root.accepted() root.accepted()
@@ -123,13 +126,12 @@ Item {
// Ok/Cancel buttons // Ok/Cancel buttons
RowLayout { RowLayout {
id: buttons id: buttons
spacing: 16 spacing: 16 * scaleRatio
Layout.topMargin: 16 Layout.topMargin: 16
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
MoneroComponents.StandardButton { MoneroComponents.StandardButton {
id: cancelButton id: cancelButton
primary: false
small: true small: true
width: 120 width: 120
fontSize: 14 fontSize: 14
@@ -145,7 +147,7 @@ Item {
small: true small: true
width: 120 width: 120
fontSize: 14 fontSize: 14
text: qsTr("Ok") + translationManager.emptyString text: qsTr("Ok")
KeyNavigation.tab: cancelButton KeyNavigation.tab: cancelButton
onClicked: { onClicked: {
root.close() root.close()

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2015, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -27,13 +27,13 @@
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import QtQuick 2.9 import QtQuick 2.7
import "../js/TxUtils.js" as TxUtils import "../js/TxUtils.js" as TxUtils
import "../components" as MoneroComponents import "../components" as MoneroComponents
TextArea { TextArea {
property int fontSize: 18 property int fontSize: 18 * scaleRatio
property bool fontBold: false property bool fontBold: false
property string fontColor: MoneroComponents.Style.defaultFontColor property string fontColor: MoneroComponents.Style.defaultFontColor
@@ -48,39 +48,17 @@ TextArea {
font.bold: fontBold font.bold: fontBold
horizontalAlignment: TextInput.AlignLeft horizontalAlignment: TextInput.AlignLeft
selectByMouse: mouseSelection selectByMouse: mouseSelection
selectionColor: MoneroComponents.Style.textSelectionColor selectionColor: MoneroComponents.Style.dimmedFontColor
selectedTextColor: MoneroComponents.Style.textSelectedColor selectedTextColor: MoneroComponents.Style.defaultFontColor
property int minimumHeight: 100
height: contentHeight > minimumHeight ? contentHeight : minimumHeight
onTextChanged: { onTextChanged: {
if(addressValidation){ if(addressValidation){
// js replacement for `RegExpValidator { regExp: /[0-9A-Fa-f]{95}/g }` // js replacement for `RegExpValidator { regExp: /[0-9A-Fa-f]{95}/g }`
if (textArea.text.startsWith("monero:")) { textArea.text = textArea.text.replace(/[^a-z0-9.@]/gi,'');
error = false; var address_ok = TxUtils.checkAddress(textArea.text, appWindow.persistentSettings.nettype);
return;
}
textArea.text = textArea.text.replace(/[^a-z0-9.@\-]/gi,'');
var address_ok = TxUtils.checkAddress(textArea.text, appWindow.persistentSettings.nettype) || TxUtils.isValidOpenAliasAddress(textArea.text);
if(!address_ok) error = true; if(!address_ok) error = true;
else error = false; else error = false;
TextArea.cursorPosition = textArea.text.length; TextArea.cursorPosition = textArea.text.length;
} }
} }
MoneroComponents.ContextMenu {
cursorShape: Qt.IBeamCursor
onCut: textArea.cut();
onCopy: textArea.copy();
onPaste: {
var previoustextFieldLength = textArea.length
var previousCursorPosition = textArea.cursorPosition;
textArea.paste();
textArea.forceActiveFocus()
textArea.cursorPosition = previousCursorPosition + (textArea.length - previoustextFieldLength);
}
onRemove: textArea.remove(selectionStart, selectionEnd);
onSelectAll: textArea.selectAll();
}
} }

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,7 +26,7 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.5
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import "../components" as MoneroComponents import "../components" as MoneroComponents
@@ -34,31 +34,25 @@ import "../components" as MoneroComponents
Item { Item {
id: item id: item
property alias text: label.text property alias text: label.text
property alias tooltip: label.tooltip
property alias tooltipIconVisible: label.tooltipIconVisible
property alias color: label.color property alias color: label.color
property alias labelMouseArea: labelMouseArea property alias textFormat: label.textFormat
property int textFormat: Text.PlainText
property string tipText: "" property string tipText: ""
property int fontSize: 16 property int fontSize: 16 * scaleRatio
property bool fontBold: false property bool fontBold: false
property string fontColor: MoneroComponents.Style.defaultFontColor property string fontColor: MoneroComponents.Style.defaultFontColor
property string fontFamily: "" property string fontFamily: ""
property alias wrapMode: label.wrapMode property alias wrapMode: label.wrapMode
property alias horizontalAlignment: label.horizontalAlignment property alias horizontalAlignment: label.horizontalAlignment
property alias elide: label.elide property alias hoveredLink: label.hoveredLink
property alias textWidth: label.width
property alias styleName: label.font.styleName
property alias themeTransition: label.themeTransition
signal linkActivated() signal linkActivated()
height: label.height height: label.height * scaleRatio
width: label.width width: label.width * scaleRatio
Layout.topMargin: 10 Layout.topMargin: 10 * scaleRatio
MoneroComponents.TextPlain { Text {
id: label id: label
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: 2 anchors.bottomMargin: 2 * scaleRatio
anchors.left: parent.left anchors.left: parent.left
font.family: { font.family: {
if(fontFamily){ if(fontFamily){
@@ -71,15 +65,5 @@ Item {
font.bold: fontBold font.bold: fontBold
color: fontColor color: fontColor
onLinkActivated: item.linkActivated() onLinkActivated: item.linkActivated()
textFormat: parent.textFormat
MouseArea {
id: labelMouseArea
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.NoButton
cursorShape: parent.hoveredLink || (tooltip && !tooltipIconVisible) ? Qt.PointingHandCursor : Qt.ArrowCursor
onEntered: tooltip && !tooltipIconVisible ? parent.tooltipPopup.open() : undefined
onExited: tooltip && !tooltipIconVisible ? parent.tooltipPopup.close() : undefined
}
} }
} }

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2015, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,7 +26,7 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.0
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import "../components" as MoneroComponents import "../components" as MoneroComponents
@@ -37,14 +37,14 @@ Rectangle {
property alias text: labelButtonText.text property alias text: labelButtonText.text
id: labelButton id: labelButton
color: MoneroComponents.Style.buttonBackgroundColorDisabled color: "#808080"
radius: 3 radius: 3
height: 20 height: 20
width: labelButtonText.width + 14 width: labelButtonText.width + 14
anchors.right: copyButton.left anchors.right: copyButton.left
anchors.rightMargin: 6 anchors.rightMargin: 6
MoneroComponents.TextPlain { Text {
id: labelButtonText id: labelButtonText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
@@ -52,7 +52,7 @@ Rectangle {
font.pixelSize: 12 font.pixelSize: 12
font.bold: true font.bold: true
text: "" text: ""
color: MoneroComponents.Style.inlineButtonTextColor color: "black"
} }
MouseArea { MouseArea {
@@ -61,11 +61,11 @@ Rectangle {
hoverEnabled: true hoverEnabled: true
onClicked: labelButton.clicked() onClicked: labelButton.clicked()
onEntered: { onEntered: {
labelButton.color = MoneroComponents.Style.buttonBackgroundColorDisabledHover; labelButton.color = "#707070";
labelButtonText.opacity = 0.8; labelButtonText.opacity = 0.8;
} }
onExited: { onExited: {
labelButton.color = MoneroComponents.Style.buttonBackgroundColorDisabled; labelButton.color = "#808080";
labelButtonText.opacity = 1.0; labelButtonText.opacity = 1.0;
} }
} }

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2015, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,15 +26,13 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.0
import "../components" as MoneroComponents import "../components" as MoneroComponents
import "../components/effects/" as MoneroEffects
Label { Label {
id: item id: item
fontSize: 18 fontSize: 18 * scaleRatio
tooltipIconVisible: true
Rectangle { Rectangle {
anchors.top: item.bottom anchors.top: item.bottom
@@ -42,12 +40,13 @@ Label {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
height: 2 height: 2
color: MoneroComponents.Style.appWindowBorderColor color: MoneroComponents.Style.dividerColor
opacity: MoneroComponents.Style.dividerOpacity
}
MoneroEffects.ColorTransition { MouseArea {
targetObj: parent anchors.fill: parent
blackColor: MoneroComponents.Style._b_appWindowBorderColor acceptedButtons: Qt.NoButton
whiteColor: MoneroComponents.Style._w_appWindowBorderColor cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
}
} }
} }

View File

@@ -1,201 +0,0 @@
// Copyright (c) 2014-2024, 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.
import "../components" as MoneroComponents
import QtQuick 2.9
import QtQuick.XmlListModel 2.0
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.0
Drawer {
id: sideBar
width: 240
height: parent.height - (persistentSettings.customDecorations ? 50 : 0)
y: titleBar.height
background: Rectangle {
color: MoneroComponents.Style.blackTheme ? "#0d0d0d" : "white"
width: parent.width
}
Rectangle {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
color: "red"
ListView {
id: languagesListView
clip: true
Layout.fillHeight: true
Layout.fillWidth: true
boundsBehavior: Flickable.StopAtBounds
width: sideBar.width
height: sideBar.height
focus: true
model: langModel
Keys.onUpPressed: currentIndex !== 0 ? currentIndex = currentIndex - 1 : ""
Keys.onBacktabPressed: currentIndex !== 0 ? currentIndex = currentIndex - 1 : ""
Keys.onDownPressed: currentIndex + 1 !== count ? currentIndex = currentIndex + 1 : ""
Keys.onTabPressed: currentIndex + 1 !== count ? currentIndex = currentIndex + 1 : ""
delegate: Rectangle {
id: item
color: index == languagesListView.currentIndex ? MoneroComponents.Style.titleBarButtonHoverColor : "transparent"
width: sideBar.width
height: 32
Accessible.role: Accessible.ListItem
Accessible.name: display_name
Keys.onEnterPressed: setSelectedItemAsLanguage();
Keys.onReturnPressed: setSelectedItemAsLanguage();
Keys.onSpacePressed: setSelectedItemAsLanguage();
function setSelectedItemAsLanguage() {
var locale_spl = locale.split("_");
// reload active translations
console.log(locale_spl[0]);
translationManager.setLanguage(locale_spl[0]);
// set wizard language settings
persistentSettings.locale = locale;
persistentSettings.language = display_name;
persistentSettings.language_wallet = wallet_language;
appWindow.showStatusMessage(qsTr("Language changed."), 3);
appWindow.toggleLanguageView();
}
Rectangle {
id: selectedIndicator
anchors.left: parent.left
anchors.leftMargin: 0
height: parent.height
width: 2
color: index == languagesListView.currentIndex ? MoneroComponents.Style.buttonBackgroundColor : "transparent"
}
Rectangle {
id: flagRect
height: 24
width: 24
anchors.left: selectedIndicator.right
anchors.leftMargin: 4
anchors.verticalCenter: parent.verticalCenter
color: "transparent"
Image {
anchors.fill: parent
source: flag
}
}
MoneroComponents.TextPlain {
anchors.left: parent.left
anchors.leftMargin: 32
font.bold: languagesListView.currentIndex == index ? true : false
font.pixelSize: 14
color: MoneroComponents.Style.defaultFontColor
text: display_name
anchors.verticalCenter: parent.verticalCenter
}
Rectangle {
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
color: MoneroComponents.Style.dividerColor
opacity: MoneroComponents.Style.dividerOpacity
height: 1
}
// button gradient while checked
Image {
anchors.fill: parent
source: "qrc:///images/menuButtonGradient.png"
opacity: 0.65
visible: true
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: setSelectedItemAsLanguage();
hoverEnabled: true
onEntered: {
// item.color = "#26FFFFFF"
parent.opacity = 1
}
onExited: {
// item.color = "transparent"
parent.opacity = 0.65
}
}
}
}
ScrollBar.vertical: ScrollBar {
onActiveChanged: if (!active && !isMac) active = true
}
}
}
//Flags model
XmlListModel {
id: langModel
source: "/lang/languages.xml"
query: "/languages/language"
XmlRole { name: "display_name"; query: "@display_name/string()" }
XmlRole { name: "locale"; query: "@locale/string()" }
XmlRole { name: "wallet_language"; query: "@wallet_language/string()" }
XmlRole { name: "flag"; query: "@flag/string()" }
// TODO: XmlListModel is read only, we should store current language somewhere else
// and set current language accordingly
XmlRole { name: "isCurrent"; query: "@enabled/string()" }
onStatusChanged: {
if(status === XmlListModel.Ready){
console.log("languages available: ",count);
}
}
}
function selectCurrentLanguage() {
for (var i = 0; i < langModel.count; ++i) {
if (langModel.get(i).display_name === persistentSettings.language) {
languagesListView.currentIndex = i;
}
}
}
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,95 +26,63 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import FontAwesome 1.0 import QtQuick 2.0
import QtQuick 2.9
import QtGraphicalEffects 1.0
import QtQuick.Layouts 1.1
import "../components" as MoneroComponents import "../components" as MoneroComponents
ColumnLayout { Item {
id: item id: item
Layout.fillWidth: true
default property alias content: inlineButtons.children
property alias input: input
property bool inputHasFocus: input.activeFocus
property bool tabNavigationEnabled: true
property alias text: input.text property alias text: input.text
property int inputPaddingLeft: 10
property int inputPaddingRight: 10
property int inputPaddingTop: 10
property int inputPaddingBottom: 10
property int inputRadius: 4
property bool password: false
property bool passwordHidden: true
property var passwordLinked: null
property alias placeholderText: placeholderLabel.text property alias placeholderText: placeholderLabel.text
property bool placeholderCenter: false property bool placeholderCenter: false
property string placeholderFontFamily: MoneroComponents.Style.fontRegular.name property string placeholderFontFamily: MoneroComponents.Style.fontRegular.name
property bool placeholderFontBold: false property bool placeholderFontBold: false
property int placeholderFontSize: 18 property int placeholderFontSize: 18 * scaleRatio
property string placeholderColor: MoneroComponents.Style.defaultFontColor property string placeholderColor: MoneroComponents.Style.defaultFontColor
property real placeholderOpacity: 0.35 property real placeholderOpacity: 0.35
property real placeholderLeftMargin: {
if (placeholderCenter) {
return undefined;
} else {
return inputPaddingLeft;
}
}
property alias acceptableInput: input.acceptableInput
property alias validator: input.validator property alias validator: input.validator
property alias readOnly : input.readOnly property alias readOnly : input.readOnly
property alias cursorPosition: input.cursorPosition property alias cursorPosition: input.cursorPosition
property alias echoMode: input.echoMode
property alias inlineButton: inlineButtonId
property alias inlineButtonText: inlineButtonId.text
property alias inlineIcon: inlineIcon.visible
property bool copyButton: false property bool copyButton: false
property bool pasteButton: false
property alias copyButtonText: copyButtonId.text
property alias copyButtonEnabled: copyButtonId.enabled
property bool borderDisabled: false property bool borderDisabled: false
property string borderColor: { property string borderColor: {
if ((error && input.text !== "") || (errorWhenEmpty && input.text == "")) { if(input.activeFocus){
return MoneroComponents.Style.inputBorderColorInvalid;
} else if (input.activeFocus) {
return MoneroComponents.Style.inputBorderColorActive; return MoneroComponents.Style.inputBorderColorActive;
} else { } else {
return MoneroComponents.Style.inputBorderColorInActive; return MoneroComponents.Style.inputBorderColorInActive;
} }
} }
property string fontFamily: MoneroComponents.Style.fontRegular.name property int fontSize: 18 * scaleRatio
property int fontSize: 18
property bool fontBold: false property bool fontBold: false
property alias fontColor: input.color property alias fontColor: input.color
property bool error: false property bool error: false
property bool errorWhenEmpty: false
property alias labelText: inputLabel.text property alias labelText: inputLabel.text
property alias labelColor: inputLabel.color property alias labelColor: inputLabel.color
property alias labelTextFormat: inputLabel.textFormat property alias labelTextFormat: inputLabel.textFormat
property string backgroundColor: "transparent" property string backgroundColor: "transparent"
property string tipText: "" property string tipText: ""
property int labelFontSize: 16 property int labelFontSize: 16 * scaleRatio
property bool labelFontBold: false property bool labelFontBold: false
property alias labelWrapMode: inputLabel.wrapMode property alias labelWrapMode: inputLabel.wrapMode
property alias labelHorizontalAlignment: inputLabel.horizontalAlignment property alias labelHorizontalAlignment: inputLabel.horizontalAlignment
property bool showingHeader: inputLabel.text !== "" || copyButton property bool showingHeader: inputLabel.text !== "" || copyButton
property int inputHeight: 39 property int inputHeight: 42 * scaleRatio
signal labelLinkActivated(); // input label, rich text <a> signal signal labelLinkActivated(); // input label, rich text <a> signal
signal editingFinished(); signal editingFinished();
signal accepted(); signal accepted();
signal textUpdated(); signal textUpdated();
signal backtabPressed();
signal tabPressed();
onActiveFocusChanged: activeFocus && input.forceActiveFocus() height: showingHeader ? (inputLabel.height + inputItem.height + 2) * scaleRatio : 42 * scaleRatio
onTextUpdated: { onTextUpdated: {
// check to remove placeholder text when there is content // check to remove placeholder text when there is content
if(item.isEmpty()){ if(item.isEmpty()){
@@ -134,148 +102,65 @@ ColumnLayout {
} }
} }
function isPasswordHidden() { Text {
if (password) { id: inputLabel
return passwordHidden; anchors.top: parent.top
} anchors.left: parent.left
if (passwordLinked) { anchors.topMargin: 2 * scaleRatio
return passwordLinked.passwordHidden; font.family: MoneroComponents.Style.fontLight.name
} font.pixelSize: labelFontSize
return false; font.bold: labelFontBold
} textFormat: Text.RichText
color: MoneroComponents.Style.defaultFontColor
onLinkActivated: item.labelLinkActivated()
function reset() { MouseArea {
text = ""; anchors.fill: parent
if (!passwordLinked) { acceptedButtons: Qt.NoButton
passwordHidden = true; cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
} }
} }
function passwordToggle() { MoneroComponents.LabelButton {
if (passwordLinked) { id: copyButtonId
passwordLinked.passwordHidden = !passwordLinked.passwordHidden; text: qsTr("Copy")
} else { anchors.right: parent.right
passwordHidden = !passwordHidden; onClicked: {
if (input.text.length > 0) {
console.log("Copied to clipboard");
clipboard.setText(input.text);
appWindow.showStatusMessage(qsTr("Copied to clipboard"), 3);
}
} }
visible: copyButton && input.text !== ""
} }
spacing: 0 Item{
Rectangle { id: inputItem
id: inputLabelRect height: inputHeight * scaleRatio
color: "transparent" anchors.top: showingHeader ? inputLabel.bottom : parent.top
Layout.fillWidth: true anchors.topMargin: showingHeader ? 12 * scaleRatio : 2 * scaleRatio
height: (inputLabel.height + 10) width: parent.width
visible: showingHeader ? true : false clip: true
MoneroComponents.TextPlain { Text {
id: inputLabel
anchors.top: parent.top
anchors.left: parent.left
font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: labelFontSize
font.bold: labelFontBold
textFormat: Text.RichText
color: MoneroComponents.Style.defaultFontColor
onLinkActivated: item.labelLinkActivated()
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.NoButton
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
}
}
RowLayout {
anchors.right: parent.right
spacing: 16
MoneroComponents.LabelButton {
id: copyButtonId
text: qsTr("Copy") + translationManager.emptyString
onClicked: {
if (input.text.length > 0) {
console.log("Copied to clipboard");
clipboard.setText(input.text);
appWindow.showStatusMessage(qsTr("Copied to clipboard"), 3);
}
}
visible: copyButton && input.text !== ""
}
MoneroComponents.LabelButton {
id: pasteButtonId
onClicked: {
input.clear();
input.paste();
}
text: qsTr("Paste") + translationManager.emptyString
visible: pasteButton
}
}
}
MoneroComponents.Input {
id: input
Keys.onBacktabPressed: {
item.backtabPressed();
if (item.KeyNavigation.backtab) {
item.KeyNavigation.backtab.forceActiveFocus()
}
}
Keys.onTabPressed: {
item.tabPressed();
if (item.KeyNavigation.tab) {
item.KeyNavigation.tab.forceActiveFocus()
}
}
Layout.fillWidth: true
Layout.preferredHeight: inputHeight
leftPadding: item.inputPaddingLeft
rightPadding: (inlineButtons.width > 0 ? inlineButtons.width + inlineButtons.spacing : 0) + inputPaddingRight + (password || passwordLinked ? 45 : 0)
topPadding: item.inputPaddingTop
bottomPadding: item.inputPaddingBottom
font.family: item.fontFamily
font.pixelSize: item.fontSize
font.bold: item.fontBold
onEditingFinished: item.editingFinished()
onAccepted: item.accepted();
onTextChanged: item.textUpdated()
echoMode: isPasswordHidden() ? TextInput.Password : TextInput.Normal
MoneroComponents.Label {
visible: password || passwordLinked
fontSize: 20
text: isPasswordHidden() ? FontAwesome.eye : FontAwesome.eyeSlash
opacity: eyeMouseArea.containsMouse ? 0.9 : 0.7
fontFamily: FontAwesome.fontFamily
anchors.right: parent.right
anchors.rightMargin: 15
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: 1
MouseArea {
id: eyeMouseArea
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
onClicked: passwordToggle()
}
}
MoneroComponents.TextPlain {
id: placeholderLabel id: placeholderLabel
visible: input.text ? false : true visible: input.text ? false : true
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: placeholderCenter ? parent.horizontalCenter : undefined anchors.horizontalCenter: placeholderCenter ? parent.horizontalCenter : undefined
anchors.left: placeholderCenter ? undefined : parent.left anchors.left: placeholderCenter ? undefined : parent.left
anchors.leftMargin: placeholderLeftMargin anchors.leftMargin: {
if(placeholderCenter){
return undefined;
}
else if(inlineIcon.visible){ return 50 * scaleRatio; }
else { return 10 * scaleRatio; }
}
opacity: item.placeholderOpacity opacity: item.placeholderOpacity
color: item.placeholderColor color: item.placeholderColor
font.family: item.placeholderFontFamily font.family: item.placeholderFontFamily
font.pixelSize: placeholderFontSize font.pixelSize: placeholderFontSize * scaleRatio
font.bold: item.placeholderFontBold font.bold: item.placeholderFontBold
text: "" text: ""
z: 3 z: 3
@@ -283,8 +168,8 @@ ColumnLayout {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
anchors.topMargin: 1 anchors.topMargin: 1 * scaleRatio
color: item.enabled ? "transparent" : MoneroComponents.Style.inputBoxBackgroundDisabled color: "transparent"
} }
Rectangle { Rectangle {
@@ -293,15 +178,41 @@ ColumnLayout {
anchors.fill: parent anchors.fill: parent
border.width: borderDisabled ? 0 : 1 border.width: borderDisabled ? 0 : 1
border.color: borderColor border.color: borderColor
radius: item.inputRadius radius: 4
} }
RowLayout { Image {
id: inlineButtons id: inlineIcon
anchors.verticalCenter: parent.verticalCenter width: 26 * scaleRatio
height: 26 * scaleRatio
anchors.top: parent.top
anchors.topMargin: 8 * scaleRatio
anchors.left: parent.left
anchors.leftMargin: 12 * scaleRatio
source: "../images/moneroIcon-28x28.png"
visible: false
}
MoneroComponents.Input {
id: input
anchors.fill: parent
anchors.leftMargin: inlineIcon.visible ? 44 * scaleRatio : 0
font.pixelSize: item.fontSize
font.bold: item.fontBold
onEditingFinished: item.editingFinished()
onAccepted: item.accepted();
onTextChanged: item.textUpdated()
topPadding: 10 * scaleRatio
bottomPadding: 10 * scaleRatio
}
MoneroComponents.InlineButton {
id: inlineButtonId
visible: item.inlineButtonText ? true : false
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: inputPaddingRight anchors.rightMargin: 8 * scaleRatio
spacing: 4 anchors.top: parent.top
anchors.topMargin: 6 * scaleRatio
} }
} }
} }

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2015, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,7 +26,7 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.0
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import "../components" as MoneroComponents import "../components" as MoneroComponents
@@ -35,24 +35,17 @@ ColumnLayout {
id: item id: item
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: childrenRect.height
default property alias content: inlineButtons.children
property alias text: input.text property alias text: input.text
property alias labelText: inputLabel.text property alias labelText: inputLabel.text
property alias labelButtonText: labelButton.text property alias labelButtonText: labelButton.text
property alias placeholderText: placeholderLabel.text property alias placeholderText: placeholderLabel.text
property int inputPaddingLeft: 10
property int inputPaddingRight: 10
property int inputPaddingTop: 10
property int inputPaddingBottom: 10
property int inputRadius: 4
property bool placeholderCenter: false property bool placeholderCenter: false
property string placeholderFontFamily: MoneroComponents.Style.fontRegular.name property string placeholderFontFamily: MoneroComponents.Style.fontRegular.name
property bool placeholderFontBold: false property bool placeholderFontBold: false
property int placeholderFontSize: 18 property int placeholderFontSize: 18 * scaleRatio
property string placeholderColor: MoneroComponents.Style.defaultFontColor property string placeholderColor: MoneroComponents.Style.defaultFontColor
property real placeholderOpacity: 0.35 property real placeholderOpacity: 0.35
@@ -67,24 +60,21 @@ ColumnLayout {
} }
} }
property alias error: input.error property bool error: false
property alias cursorPosition: input.cursorPosition
property string labelFontColor: MoneroComponents.Style.defaultFontColor property string labelFontColor: MoneroComponents.Style.defaultFontColor
property bool labelFontBold: false property bool labelFontBold: false
property int labelFontSize: 16 property int labelFontSize: 16 * scaleRatio
property bool labelButtonVisible: false property bool labelButtonVisible: false
property string fontColor: MoneroComponents.Style.defaultFontColor property string fontColor: "white"
property string fontFamily: MoneroComponents.Style.fontRegular.name
property bool fontBold: false property bool fontBold: false
property int fontSize: 16 property int fontSize: 16 * scaleRatio
property bool mouseSelection: true property bool mouseSelection: true
property alias readOnly: input.readOnly property alias readOnly: input.readOnly
property bool copyButton: false property bool copyButton: false
property bool pasteButton: false property bool showingHeader: true
property bool showingHeader: labelText != "" || copyButton || pasteButton
property var wrapMode: Text.NoWrap property var wrapMode: Text.NoWrap
property alias addressValidation: input.addressValidation property alias addressValidation: input.addressValidation
property string backgroundColor: "" // mock property string backgroundColor: "" // mock
@@ -92,20 +82,16 @@ ColumnLayout {
signal labelButtonClicked(); signal labelButtonClicked();
signal inputLabelLinkActivated(); signal inputLabelLinkActivated();
signal editingFinished(); signal editingFinished();
signal returnPressed();
signal enterPressed();
onActiveFocusChanged: activeFocus && input.forceActiveFocus()
spacing: 0 spacing: 0
Rectangle { Rectangle {
id: inputLabelRect id: inputLabelRect
color: "transparent" color: "transparent"
Layout.fillWidth: true Layout.fillWidth: true
height: (inputLabel.height + 10) height: (inputLabel.height + 10) * scaleRatio
visible: showingHeader ? true : false visible: showingHeader ? true : false
MoneroComponents.TextPlain { Text {
id: inputLabel id: inputLabel
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
@@ -123,38 +109,25 @@ ColumnLayout {
} }
} }
RowLayout { MoneroComponents.LabelButton {
anchors.right: parent.right id: labelButton
spacing: 16 onClicked: labelButtonClicked()
visible: labelButtonVisible
}
MoneroComponents.LabelButton { MoneroComponents.LabelButton {
id: labelButton id: copyButtonId
onClicked: labelButtonClicked() visible: copyButton && input.text !== ""
visible: labelButtonVisible text: qsTr("Copy")
} anchors.right: labelButton.visible ? inputLabel.right : parent.right
anchors.rightMargin: labelButton.visible? 4 : 0
MoneroComponents.LabelButton { onClicked: {
id: copyButtonId if (input.text.length > 0) {
visible: copyButton && input.text !== "" console.log("Copied to clipboard");
text: qsTr("Copy") + translationManager.emptyString clipboard.setText(input.text);
onClicked: { appWindow.showStatusMessage(qsTr("Copied to clipboard"), 3);
if (input.text.length > 0) {
console.log("Copied to clipboard");
clipboard.setText(input.text);
appWindow.showStatusMessage(qsTr("Copied to clipboard"), 3);
}
} }
} }
MoneroComponents.LabelButton {
id: pasteButtonId
onClicked: {
input.clear();
input.paste();
}
text: qsTr("Paste") + translationManager.emptyString
visible: pasteButton
}
} }
} }
@@ -162,32 +135,24 @@ ColumnLayout {
id: input id: input
readOnly: false readOnly: false
addressValidation: false addressValidation: false
KeyNavigation.backtab: item.KeyNavigation.backtab anchors.top: item.showingHeader ? inputLabelRect.bottom : item.top
KeyNavigation.priority: KeyNavigation.BeforeItem
KeyNavigation.tab: item.KeyNavigation.tab
Layout.fillWidth: true Layout.fillWidth: true
topPadding: item.showingHeader ? 10 * scaleRatio : 0
leftPadding: item.inputPaddingLeft bottomPadding: 10 * scaleRatio
rightPadding: (inlineButtons.width > 0 ? inlineButtons.width + inlineButtons.spacing : 0) + inputPaddingRight
topPadding: item.inputPaddingTop
bottomPadding: item.inputPaddingBottom
wrapMode: item.wrapMode wrapMode: item.wrapMode
font.family: item.fontFamily
fontSize: item.fontSize fontSize: item.fontSize
fontBold: item.fontBold fontBold: item.fontBold
fontColor: item.fontColor fontColor: item.fontColor
mouseSelection: item.mouseSelection mouseSelection: item.mouseSelection
onEditingFinished: item.editingFinished() onEditingFinished: item.editingFinished()
Keys.onReturnPressed: item.returnPressed() error: item.error
Keys.onEnterPressed: item.enterPressed()
MoneroComponents.TextPlain { Text {
id: placeholderLabel id: placeholderLabel
visible: input.text ? false : true visible: input.text ? false : true
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 10 anchors.leftMargin: 10 * scaleRatio
opacity: item.placeholderOpacity opacity: item.placeholderOpacity
color: item.placeholderColor color: item.placeholderColor
font.family: item.placeholderFontFamily font.family: item.placeholderFontFamily
@@ -201,17 +166,9 @@ ColumnLayout {
color: "transparent" color: "transparent"
border.width: 1 border.width: 1
border.color: item.borderColor border.color: item.borderColor
radius: item.inputRadius radius: 4
anchors.fill: parent anchors.fill: parent
visible: !item.borderDisabled visible: !item.borderDisabled
} }
RowLayout {
id: inlineButtons
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: inputPaddingRight
spacing: 4
}
} }
} }

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,16 +26,15 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.5
import QtGraphicalEffects 1.0
import "../components" as MoneroComponents import "../components" as MoneroComponents
import "effects/" as MoneroEffects
Rectangle { Rectangle {
id: button id: button
property alias text: label.text property alias text: label.text
property bool checked: false property bool checked: false
property alias dotColor: dot.color
property alias symbol: symbolText.text property alias symbol: symbolText.text
property int numSelectedChildren: 0 property int numSelectedChildren: 0
property var under: null property var under: null
@@ -47,11 +46,12 @@ Rectangle {
clicked(); clicked();
} }
function getOffset() { function getOffset() {
var offset = 0 var offset = 0
var item = button var item = button
while (item.under) { while (item.under) {
offset += 20 offset += 20 * scaleRatio
item = item.under item = item.under
} }
return offset return offset
@@ -59,78 +59,77 @@ Rectangle {
color: "transparent" color: "transparent"
property bool present: !under || under.checked || checked || under.numSelectedChildren > 0 property bool present: !under || under.checked || checked || under.numSelectedChildren > 0
height: present ? ((appWindow.height >= 800) ? 44 : 38 ) : 0 height: present ? ((appWindow.height >= 800) ? 44 * scaleRatio : 38 * scaleRatio ) : 0
LinearGradient { // button gradient while checked
visible: isOpenGL && (button.checked || buttonArea.containsMouse) Image {
height: parent.height height: parent.height
width: 260 width: 260
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: -20 anchors.rightMargin: -20
anchors.leftMargin: parent.getOffset() anchors.leftMargin: parent.getOffset()
start: Qt.point(width, 0) source: "../images/menuButtonGradient.png"
end: Qt.point(0, 0) visible: button.checked
gradient: Gradient {
GradientStop { position: 0.0; color: MoneroComponents.Style.menuButtonGradientStart }
GradientStop { position: 1.0; color: MoneroComponents.Style.menuButtonGradientStop }
}
opacity: button.checked ? 1 : 0.3
}
// fallback hover effect when opengl is not available
Rectangle {
visible: !isOpenGL && (button.checked || buttonArea.containsMouse)
anchors.fill: parent
color: MoneroComponents.Style.menuButtonFallbackBackgroundColor
opacity: button.checked ? 1 : 0.3
} }
// button decorations that are subject to leftMargin offsets // button decorations that are subject to leftMargin offsets
Rectangle { Rectangle {
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 20 anchors.leftMargin: parent.getOffset() + 20 * scaleRatio
height: parent.height height: parent.height
width: 2 width: button.checked ? 20: 10
color: button.checked ? MoneroComponents.Style.accountColors[currentAccountIndex % MoneroComponents.Style.accountColors.length] : "transparent" color: "#00000000"
// dot if unchecked
Rectangle {
id: dot
anchors.centerIn: parent
width: button.checked ? 20 * scaleRatio : 8 * scaleRatio
height: button.checked ? 20 * scaleRatio : 8 * scaleRatio
radius: button.checked ? 20 * scaleRatio : 4 * scaleRatio
color: button.dotColor
// arrow if checked
Image {
anchors.centerIn: parent
anchors.left: parent.left
source: "../images/arrow-right-medium-white.png"
visible: button.checked
}
}
// button text // button text
MoneroComponents.TextPlain { Text {
id: label id: label
color: MoneroComponents.Style.menuButtonTextColor
themeTransitionBlackColor: MoneroComponents.Style._b_menuButtonTextColor
themeTransitionWhiteColor: MoneroComponents.Style._w_menuButtonTextColor
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.right anchors.left: parent.right
anchors.leftMargin: button.getOffset() + 8 anchors.leftMargin: 8 * scaleRatio
font.family: MoneroComponents.Style.fontMedium.name
font.bold: true font.bold: true
font.pixelSize: 14 font.pixelSize: 16 * scaleRatio
color: "#FFFFFF"
} }
} }
// menu button right arrow // menu button right arrow
MoneroEffects.ImageMask { Image {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: parent.getOffset()
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 20 anchors.rightMargin: 20 * scaleRatio
height: 14 anchors.leftMargin: parent.getOffset()
width: 8 source: "../images/right.png"
image: MoneroComponents.Style.menuButtonImageRightSource opacity: button.checked ? 1.0 : 0.4
color: button.checked ? MoneroComponents.Style.menuButtonImageRightColorActive : MoneroComponents.Style.menuButtonImageRightColor
opacity: button.checked ? 0.8 : 0.25
} }
MoneroComponents.TextPlain { Text {
id: symbolText id: symbolText
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 44 anchors.rightMargin: 44 * scaleRatio
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
font.pixelSize: 12 font.pixelSize: 12 * scaleRatio
font.bold: true font.bold: true
color: MoneroComponents.Style.menuButtonTextColor color: button.checked || buttonArea.containsMouse ? "#FFFFFF" : dot.color
visible: appWindow.ctrlPressed visible: appWindow.ctrlPressed
themeTransition: false
} }
MouseArea { MouseArea {

View File

@@ -1,15 +0,0 @@
import QtQuick 2.9
import "." as MoneroComponents
import "effects/" as MoneroEffects
Rectangle {
color: MoneroComponents.Style.appWindowBorderColor
height: 1
MoneroEffects.ColorTransition {
targetObj: parent
blackColor: MoneroComponents.Style._b_appWindowBorderColor
whiteColor: MoneroComponents.Style._w_appWindowBorderColor
}
}

118
components/MobileHeader.qml Normal file
View File

@@ -0,0 +1,118 @@
import QtQuick 2.2
import QtGraphicalEffects 1.0
import QtQuick.Layouts 1.1
import moneroComponents.Wallet 1.0
import "../components" as MoneroComponents
// BasicPanel header
Rectangle {
id: header
anchors.leftMargin: 1
anchors.rightMargin: 1
Layout.fillWidth: true
Layout.preferredHeight: 64 * scaleRatio
color: "#FFFFFF"
Image {
id: logo
visible: appWindow.width > 460 * scaleRatio
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: -5
anchors.left: parent.left
anchors.leftMargin: 50 * scaleRatio
source: "../images/moneroLogo2.png"
}
Image {
id: icon
visible: !logo.visible
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 40 * scaleRatio
source: "../images/moneroIcon.png"
}
Grid {
anchors.verticalCenter: parent.verticalCenter
anchors.top: parent.top
anchors.right: parent.right
anchors.topMargin: 10 * scaleRatio
width: 256 * scaleRatio
columns: 3
Text {
id: balanceLabel
width: 116 * scaleRatio
height: 20 * scaleRatio
font.family: "Arial"
font.pixelSize: 12 * scaleRatio
font.letterSpacing: -1
elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignBottom
color: "#535353"
text: leftPanel.balanceLabelText + ":"
}
Text {
id: balanceText
width: 110 * scaleRatio
height: 20 * scaleRatio
font.family: "Arial"
font.pixelSize: 18 * scaleRatio
font.letterSpacing: -1
elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignBottom
color: "#000000"
text: leftPanel.balanceText
}
Item {
height: 20 * scaleRatio
width: 20 * scaleRatio
Image {
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
source: "../images/lockIcon.png"
}
}
Text {
width: 116 * scaleRatio
height: 20 * scaleRatio
font.family: "Arial"
font.pixelSize: 12 * scaleRatio
font.letterSpacing: -1
elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignBottom
color: "#535353"
text: qsTr("Unlocked Balance:")
}
Text {
id: availableBalanceText
width: 110 * scaleRatio
height: 20 * scaleRatio
font.family: "Arial"
font.pixelSize: 14 * scaleRatio
font.letterSpacing: -1
elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignBottom
color: "#000000"
text: leftPanel.unlockedBalanceText
}
}
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
height: 1
color: "#DBDBDB"
}
}

View File

@@ -1,217 +0,0 @@
// Copyright (c) 2014-2024, 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.
import QtQuick 2.9
import QtQuick.Layouts 1.1
import "." as MoneroComponents
Rectangle {
default property list<MoneroComponents.NavbarItem> items
property alias currentIndex: repeater.currentIndex
property alias previousIndex: repeater.previousIndex
color: "transparent"
height: grid.height
width: grid.width
GridLayout {
id: grid
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
columnSpacing: 0
property string fontColorActive: MoneroComponents.Style.blackTheme ? "white" : "white"
property string fontColorInActive: MoneroComponents.Style.blackTheme ? "white" : MoneroComponents.Style.dimmedFontColor
property int fontSize: 15
property bool fontBold: true
property var fontFamily: MoneroComponents.Style.fontRegular.name
property string borderColor: MoneroComponents.Style.blackTheme ? "#808080" : "#B9B9B9"
property int textMargin: {
// left-right margins for a given cell
if(appWindow.width < 890){
return 32;
} else {
return 64;
}
}
Rectangle {
// navbar left side border
id: navBarLeft
Layout.preferredWidth: 2
Layout.preferredHeight: 32
color: "transparent"
Rectangle {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
width: 1
height: parent.height - 2
color: grid.borderColor
}
ColumnLayout {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right
width: 1
spacing: 0
Rectangle {
Layout.preferredHeight: 1
Layout.preferredWidth: 1
color: grid.borderColor
}
Rectangle {
Layout.fillHeight: true
width: 1
color: items.length > 0 && items[0].active ? grid.borderColor : "transparent";
}
Rectangle {
color: grid.borderColor
Layout.preferredHeight: 1
Layout.preferredWidth: 1
}
}
}
Repeater {
id: repeater
model: items.length
property int currentIndex: 0
property int previousIndex: 0
RowLayout {
spacing: 0
Rectangle {
Layout.preferredWidth: 1
Layout.preferredHeight: 32
color: grid.borderColor
visible: index > 0 && items[index - 1].visible
}
ColumnLayout {
Layout.minimumWidth: 72
Layout.preferredHeight: 32
Layout.fillWidth: true
spacing: 0
visible: items[index].visible
Rectangle {
color: grid.borderColor
Layout.preferredHeight: 1
Layout.fillWidth: true
}
Rectangle {
Layout.minimumHeight: 30
Layout.fillWidth: true
color: items[index].active ? grid.borderColor : "transparent"
implicitHeight: children[0].implicitHeight
implicitWidth: children[0].implicitWidth
MoneroComponents.TextPlain {
anchors.centerIn: parent
font.family: grid.fontFamily
font.pixelSize: grid.fontSize
font.bold: grid.fontBold
leftPadding: grid.textMargin / 2
rightPadding: grid.textMargin / 2
text: items[index].text
color: items[index].active ? grid.fontColorActive : grid.fontColorInActive
themeTransition: false
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
repeater.previousIndex = repeater.currentIndex;
repeater.currentIndex = index;
items[index].selected()
}
}
}
Rectangle {
color: grid.borderColor
Layout.preferredHeight: 1
Layout.fillWidth: true
}
}
}
}
Rectangle {
// navbar right side border
id: navBarRight
Layout.preferredWidth: 2
Layout.preferredHeight: 32
color: "transparent"
rotation: 180
Rectangle {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
width: 1
height: parent.height - 2
color: grid.borderColor
}
ColumnLayout {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right
width: 1
spacing: 0
Rectangle {
Layout.preferredHeight: 1
Layout.preferredWidth: 1
color: grid.borderColor
}
Rectangle {
Layout.fillHeight: true
width: 1
color: items.length > 0 && items[items.length - 1].active ? grid.borderColor : "transparent"
}
Rectangle {
color: grid.borderColor
Layout.preferredHeight: 1
Layout.preferredWidth: 1
}
}
}
}
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,10 +26,9 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.0
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import FontAwesome 1.0
import moneroComponents.Wallet 1.0 import moneroComponents.Wallet 1.0
import "../components" as MoneroComponents import "../components" as MoneroComponents
@@ -39,176 +38,82 @@ Rectangle {
property var connected: Wallet.ConnectionStatus_Disconnected property var connected: Wallet.ConnectionStatus_Disconnected
function getConnectionStatusString(status) { function getConnectionStatusString(status) {
switch (appWindow.daemonStartStopInProgress) if (status == Wallet.ConnectionStatus_Connected) {
{ if(!appWindow.daemonSynced)
case 1: return qsTr("Synchronizing")
return qsTr("Starting the node"); if(appWindow.remoteNodeConnected)
case 2: return qsTr("Remote node")
return qsTr("Stopping the node"); return qsTr("Connected")
default:
break;
}
switch (status) {
case Wallet.ConnectionStatus_Connected:
if (!appWindow.daemonSynced)
return qsTr("Synchronizing");
if (persistentSettings.useRemoteNode && persistentSettings.allowRemoteNodeMining && appWindow.isMining)
return qsTr("Remote node") + " + " + qsTr("Mining");
if (persistentSettings.useRemoteNode)
return qsTr("Remote node");
return appWindow.isMining ? qsTr("Connected") + " + " + qsTr("Mining"): qsTr("Connected");
case Wallet.ConnectionStatus_WrongVersion:
return qsTr("Wrong version");
case Wallet.ConnectionStatus_Disconnected:
if (appWindow.walletMode <= 1) {
return qsTr("Searching node") + translationManager.emptyString;
}
return qsTr("Disconnected");
case Wallet.ConnectionStatus_Connecting:
return qsTr("Connecting");
default:
return qsTr("Invalid connection status");
} }
if (status == Wallet.ConnectionStatus_WrongVersion)
return qsTr("Wrong version")
if (status == Wallet.ConnectionStatus_Disconnected)
return qsTr("Disconnected")
return qsTr("Invalid connection status")
} }
RowLayout { RowLayout {
Layout.preferredHeight: 40 Layout.preferredHeight: 40 * scaleRatio
Item { Item {
id: iconItem id: iconItem
width: 40 anchors.top: parent.top
height: 40 width: 40 * scaleRatio
height: 40 * scaleRatio
opacity: { opacity: {
if(item.connected == Wallet.ConnectionStatus_Connected){ if(item.connected == Wallet.ConnectionStatus_Connected){
return 1 return 1
} else { } else {
MoneroComponents.Style.blackTheme ? 0.5 : 0.3 return 0.5
} }
} }
Image { Image {
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: !appWindow.isMining ? 6 : 4 anchors.topMargin: 6
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: !appWindow.isMining ? 11 : 0 anchors.rightMargin: 11
source: { source: {
if(appWindow.isMining) { if(item.connected == Wallet.ConnectionStatus_Connected){
return "qrc:///images/miningxmr.png" return "../images/lightning.png"
} else if(item.connected == Wallet.ConnectionStatus_Connected || !MoneroComponents.Style.blackTheme) {
return "qrc:///images/lightning.png"
} else { } else {
return "qrc:///images/lightning-white.png" return "../images/lightning-white.png"
}
}
MouseArea {
anchors.fill: parent
visible: appWindow.walletMode >= 2
cursorShape: Qt.PointingHandCursor
onClicked: {
if(!appWindow.isMining) {
middlePanel.settingsView.settingsStateViewState = "Node";
appWindow.showPageRequest("Settings");
} else {
appWindow.showPageRequest("Mining")
}
} }
} }
} }
} }
Item { Item {
height: 40 anchors.top: parent.top
width: 260 anchors.left: iconItem.right
height: 40 * scaleRatio
width: 260 * scaleRatio
MoneroComponents.TextPlain { Text {
id: statusText id: statusText
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 0 anchors.topMargin: 0
font.family: MoneroComponents.Style.fontMedium.name font.family: MoneroComponents.Style.fontMedium.name
font.bold: true font.bold: true
font.pixelSize: 13 font.pixelSize: 13 * scaleRatio
color: MoneroComponents.Style.blackTheme ? MoneroComponents.Style.dimmedFontColor : MoneroComponents.Style.defaultFontColor color: "white"
opacity: MoneroComponents.Style.blackTheme ? 0.65 : 0.75 opacity: 0.5
text: qsTr("Network status") + translationManager.emptyString text: qsTr("Network status") + translationManager.emptyString
themeTransition: false
} }
MoneroComponents.TextPlain { Text {
id: statusTextVal id: statusTextVal
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 14 anchors.topMargin: 14
font.family: MoneroComponents.Style.fontMedium.name font.family: MoneroComponents.Style.fontMedium.name
font.pixelSize: 20 font.pixelSize: 20 * scaleRatio
color: MoneroComponents.Style.defaultFontColor color: "white"
text: getConnectionStatusString(item.connected) + translationManager.emptyString text: getConnectionStatusString(item.connected) + translationManager.emptyString
opacity: MoneroComponents.Style.blackTheme ? 1.0 : 0.7
themeTransition: false
MouseArea {
anchors.fill: parent
visible: appWindow.walletMode >= 2
cursorShape: Qt.PointingHandCursor
onClicked: {
if(!appWindow.isMining) {
middlePanel.settingsView.settingsStateViewState = "Node";
appWindow.showPageRequest("Settings");
} else {
appWindow.showPageRequest("Mining")
}
}
}
}
MoneroComponents.TextPlain {
anchors.left: statusTextVal.right
anchors.leftMargin: 16
anchors.verticalCenter: parent.verticalCenter
color: refreshMouseArea.containsMouse ? MoneroComponents.Style.defaultFontColor : MoneroComponents.Style.dimmedFontColor
font.family: FontAwesome.fontFamilySolid
font.pixelSize: 24
font.styleName: "Solid"
opacity: 0.85
text: FontAwesome.random
themeTransition: false
tooltip: qsTr("Switch to another public remote node") + translationManager.emptyString;
visible: (
!appWindow.disconnected &&
!persistentSettings.useRemoteNode &&
(persistentSettings.bootstrapNodeAddress == "auto" || persistentSettings.walletMode < 2)
)
MouseArea {
id: refreshMouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
visible: true
onEntered: parent.tooltipPopup.open()
onExited: parent.tooltipPopup.close()
onClicked: {
const callback = function(result) {
refreshMouseArea.visible = true;
if (result) {
appWindow.showStatusMessage(qsTr("Successfully switched to another public node"), 3);
appWindow.currentWallet.refreshHeightAsync();
} else {
appWindow.showStatusMessage(qsTr("Failed to switch public node"), 3);
}
};
daemonManager.sendCommandAsync(
["set_bootstrap_daemon", "auto"],
appWindow.currentWallet.nettype,
persistentSettings.blockchainDataDir,
callback);
refreshMouseArea.visible = false;
appWindow.showStatusMessage(qsTr("Switching to another public node"), 3);
}
}
} }
} }
} }
} }

View File

@@ -0,0 +1,248 @@
// Copyright (c) 2017, 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.
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.1
import QtQuick.Controls.Styles 1.4
import QtQuick.Window 2.0
import "../components" as MoneroComponents
Item {
id: root
visible: false
z: parent.z + 2
property alias password: passwordInput1.text
// same signals as Dialog has
signal accepted()
signal rejected()
signal closeCallback()
function open() {
inactiveOverlay.visible = true
leftPanel.enabled = false
middlePanel.enabled = false
titleBar.enabled = false
show();
root.visible = true;
passwordInput1.text = "";
passwordInput2.text = "";
passwordInput1.focus = true
}
function close() {
inactiveOverlay.visible = false
leftPanel.enabled = true
middlePanel.enabled = true
titleBar.enabled = true
root.visible = false;
closeCallback();
}
// TODO: implement without hardcoding sizes
width: 480
height: 360
// Make window draggable
MouseArea {
anchors.fill: parent
property point lastMousePos: Qt.point(0, 0)
onPressed: { lastMousePos = Qt.point(mouseX, mouseY); }
onMouseXChanged: root.x += (mouseX - lastMousePos.x)
onMouseYChanged: root.y += (mouseY - lastMousePos.y)
}
ColumnLayout {
z: inactiveOverlay.z + 1
id: mainLayout
spacing: 10
anchors { fill: parent; margins: 35 * scaleRatio }
ColumnLayout {
id: column
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
Layout.maximumWidth: 400 * scaleRatio
Label {
text: qsTr("Please enter new password")
anchors.left: parent.left
Layout.fillWidth: true
font.pixelSize: 16 * scaleRatio
font.family: MoneroComponents.Style.fontLight.name
color: MoneroComponents.Style.defaultFontColor
}
TextField {
id : passwordInput1
Layout.topMargin: 6
Layout.fillWidth: true
anchors.left: parent.left
horizontalAlignment: TextInput.AlignLeft
verticalAlignment: TextInput.AlignVCenter
font.family: MoneroComponents.Style.fontLight.name
font.pixelSize: 24 * scaleRatio
echoMode: TextInput.Password
bottomPadding: 10
leftPadding: 10
topPadding: 10
color: MoneroComponents.Style.defaultFontColor
KeyNavigation.tab: passwordInput2
background: Rectangle {
radius: 2
border.color: Qt.rgba(255, 255, 255, 0.35)
border.width: 1
color: "black"
Image {
width: 12
height: 16
source: "../images/lockIcon.png"
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: 20
}
}
Keys.onEscapePressed: {
root.close()
root.rejected()
}
}
// padding
Rectangle {
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
height: 10
opacity: 0
color: "black"
}
Label {
text: qsTr("Please confirm new password")
anchors.left: parent.left
Layout.fillWidth: true
font.pixelSize: 16 * scaleRatio
font.family: MoneroComponents.Style.fontLight.name
color: MoneroComponents.Style.defaultFontColor
}
TextField {
id : passwordInput2
Layout.topMargin: 6
Layout.fillWidth: true
anchors.left: parent.left
horizontalAlignment: TextInput.AlignLeft
verticalAlignment: TextInput.AlignVCenter
font.family: MoneroComponents.Style.fontLight.name
font.pixelSize: 24 * scaleRatio
echoMode: TextInput.Password
KeyNavigation.tab: okButton
bottomPadding: 10
leftPadding: 10
topPadding: 10
color: MoneroComponents.Style.defaultFontColor
background: Rectangle {
radius: 2
border.color: Qt.rgba(255, 255, 255, 0.35)
border.width: 1
color: "black"
Image {
width: 12
height: 16
source: "../images/lockIcon.png"
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: 20
}
}
Keys.onReturnPressed: {
if (passwordInput1.text === passwordInput2.text) {
root.close()
root.accepted()
}
}
Keys.onEscapePressed: {
root.close()
root.rejected()
}
}
// padding
Rectangle {
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
height: 10
opacity: 0
color: "black"
}
// Ok/Cancel buttons
RowLayout {
id: buttons
spacing: 16 * scaleRatio
Layout.topMargin: 16
Layout.alignment: Qt.AlignRight
MoneroComponents.StandardButton {
id: cancelButton
text: qsTr("Cancel") + translationManager.emptyString
KeyNavigation.tab: passwordInput1
onClicked: {
root.close()
root.rejected()
}
}
MoneroComponents.StandardButton {
id: okButton
text: qsTr("Continue")
KeyNavigation.tab: cancelButton
enabled: passwordInput1.text === passwordInput2.text
onClicked: {
root.close()
root.accepted()
}
}
}
}
}
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2020-2024, The Monero Project // Copyright (c) 2017-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,42 +26,58 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.0
import QtQuick.Layouts 1.3 import QtQuick.Controls 1.4
import moneroComponents.Wallet 1.0
import FontAwesome 1.0
import "../components" as MoneroComponents
Item { Item {
implicitHeight: layout.height id: item
implicitWidth: layout.width property string message: ""
property bool active: false
height: 120
width: 240
property int margin: 15
x: parent.width - width - margin
y: parent.height - height * scale.yScale - margin * scale.yScale
RowLayout { Rectangle {
id: layout color: "#FF6C3C"
opacity: mouseArea.containsMouse ? 1 : 0.85 border.color: "black"
spacing: 10 anchors.fill: parent
MoneroComponents.Label { TextArea {
Layout.bottomMargin: 5 id:versionText
fontColor: MoneroComponents.Style.defaultFontColor readOnly: true
fontFamily: FontAwesome.fontFamilySolid backgroundVisible: false
fontSize: 26 textFormat: TextEdit.AutoText
styleName: "Solid" anchors.fill: parent
text: FontAwesome.language font.family: "Arial"
} font.pixelSize: 12
textMargin: 20
MoneroComponents.TextPlain { textColor: "white"
font.pixelSize: 14 text: item.message
text: persistentSettings.language
} }
} }
MouseArea { transform: Scale {
id: mouseArea id: scale
anchors.fill: parent yScale: item.active ? 1 : 0
cursorShape: Qt.PointingHandCursor
hoverEnabled: true Behavior on yScale {
onClicked: appWindow.toggleLanguageView() NumberAnimation { duration: 500; easing.type: Easing.InOutCubic }
}
}
Timer {
id: hider
interval: 12000; running: false; repeat: false
onTriggered: { item.active = false }
}
function show(message) {
item.visible = true
item.message = message
item.active = true
hider.running = true
} }
} }

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,280 +26,150 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.7
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
import QtQuick.Window 2.0 import QtQuick.Window 2.0
import FontAwesome 1.0
import "." as MoneroComponents import "../components" as MoneroComponents
import "effects/" as MoneroEffects
import "../js/Utils.js" as Utils
Item { Item {
id: root id: root
visible: false visible: false
z: parent.z + 2
property alias password: passwordInput1.text property alias password: passwordInput.text
property string walletName property string walletName
property var okButtonText
property string okButtonIcon
property string errorText
property bool passwordDialogMode
property bool passphraseDialogMode
property bool newPasswordDialogMode
// same signals as Dialog has // same signals as Dialog has
signal accepted() signal accepted()
signal acceptedNewPassword()
signal acceptedPassphrase()
signal rejected() signal rejected()
signal rejectedNewPassword()
signal rejectedPassphrase()
signal closeCallback() signal closeCallback()
function _openInit(walletName, errorText) { function open(walletName) {
capsLockTextLabel.visible = oshelper.isCapsLock(); inactiveOverlay.visible = true // draw appwindow inactive
passwordInput1.reset();
passwordInput2.reset();
if(!appWindow.currentWallet || appWindow.active)
passwordInput1.input.forceActiveFocus();
root.walletName = walletName ? walletName : "" root.walletName = walletName ? walletName : ""
errorTextLabel.text = errorText ? errorText : "";
leftPanel.enabled = false leftPanel.enabled = false
middlePanel.enabled = false middlePanel.enabled = false
wizard.enabled = false titleBar.enabled = false
titleBar.state = "essentials" show()
root.visible = true; root.visible = true;
appWindow.hideBalanceForced = true; passwordInput.forceActiveFocus();
appWindow.updateBalance(); passwordInput.text = ""
}
function open(walletName, errorText, okButtonText, okButtonIcon) {
passwordDialogMode = true;
passphraseDialogMode = false;
newPasswordDialogMode = false;
root.okButtonText = okButtonText;
root.okButtonIcon = okButtonIcon ? okButtonIcon : "";
_openInit(walletName, errorText);
}
function openPassphraseDialog() {
passwordDialogMode = false;
passphraseDialogMode = true;
newPasswordDialogMode = false;
_openInit("", "");
}
function openNewPasswordDialog() {
passwordDialogMode = false;
passphraseDialogMode = false;
newPasswordDialogMode = true;
_openInit("", "");
}
function showError(errorText) {
open(root.walletName, errorText);
} }
function close() { function close() {
inactiveOverlay.visible = false
leftPanel.enabled = true leftPanel.enabled = true
middlePanel.enabled = true middlePanel.enabled = true
wizard.enabled = true titleBar.enabled = true
if (rootItem.state == "wizard") {
titleBar.state = "essentials"
} else {
titleBar.state = "default"
}
root.visible = false; root.visible = false;
appWindow.hideBalanceForced = false;
appWindow.updateBalance();
closeCallback(); closeCallback();
} }
function onOk() {
if (!passwordDialogMode && passwordInput1.text !== passwordInput2.text) {
return;
}
root.close()
if (passwordDialogMode) {
root.accepted()
} else if (newPasswordDialogMode) {
root.acceptedNewPassword()
} else if (passphraseDialogMode) {
root.acceptedPassphrase()
}
}
function onCancel() {
root.close()
if (passwordDialogMode) {
root.rejected()
} else if (newPasswordDialogMode) {
root.rejectedNewPassword()
} else if (passphraseDialogMode) {
root.rejectedPassphrase()
}
}
ColumnLayout { ColumnLayout {
z: inactiveOverlay.z + 1
id: mainLayout id: mainLayout
spacing: 10 spacing: 10
anchors { fill: parent; margins: 35 } anchors { fill: parent; margins: 35 * scaleRatio }
ColumnLayout { ColumnLayout {
id: column id: column
Layout.fillWidth: true Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.maximumWidth: 400 Layout.maximumWidth: 400 * scaleRatio
Label { Label {
text: { text: root.walletName.length > 0 ? qsTr("Please enter wallet password for: ") + root.walletName : qsTr("Please enter wallet password")
if (newPasswordDialogMode) { anchors.left: parent.left
return qsTr("Please enter new wallet password") + translationManager.emptyString;
} else {
var device = passwordDialogMode ? qsTr("wallet password") : qsTr("wallet device passphrase");
return (root.walletName.length > 0 ? qsTr("Please enter %1 for: ").arg(device) + root.walletName : qsTr("Please enter %1").arg(device)) + translationManager.emptyString;
}
}
Layout.fillWidth: true Layout.fillWidth: true
font.pixelSize: 16 font.pixelSize: 16 * scaleRatio
font.family: MoneroComponents.Style.fontLight.name font.family: MoneroComponents.Style.fontLight.name
color: MoneroComponents.Style.defaultFontColor color: MoneroComponents.Style.defaultFontColor
} }
Label { TextField {
text: qsTr("Warning: passphrase entry on host is a security risk as it can be captured by malware. It is advised to prefer device-based passphrase entry.") + translationManager.emptyString id : passwordInput
visible: passphraseDialogMode
Layout.fillWidth: true
wrapMode: Text.Wrap
font.pixelSize: 14
font.family: MoneroComponents.Style.fontLight.name
color: MoneroComponents.Style.warningColor
}
Label {
id: errorTextLabel
visible: root.errorText || text !== ""
color: MoneroComponents.Style.errorColor
font.pixelSize: 16
font.family: MoneroComponents.Style.fontLight.name
Layout.fillWidth: true
wrapMode: Text.Wrap
}
Label {
id: capsLockTextLabel
visible: false
color: MoneroComponents.Style.errorColor
font.pixelSize: 16
font.family: MoneroComponents.Style.fontLight.name
Layout.fillWidth: true
wrapMode: Text.Wrap
text: qsTr("CAPSLOCKS IS ON.") + translationManager.emptyString;
}
MoneroComponents.LineEdit {
id: passwordInput1
password: true
Layout.topMargin: 6 Layout.topMargin: 6
Layout.fillWidth: true Layout.fillWidth: true
KeyNavigation.tab: { anchors.left: parent.left
if (passwordDialogMode) { horizontalAlignment: TextInput.AlignLeft
return okButton verticalAlignment: TextInput.AlignVCenter
} else {
return passwordInput2
}
}
onTextChanged: capsLockTextLabel.visible = oshelper.isCapsLock();
Keys.enabled: root.visible
Keys.onEnterPressed: root.onOk()
Keys.onReturnPressed: root.onOk()
Keys.onEscapePressed: root.onCancel()
}
// padding
Rectangle {
visible: !passwordDialogMode
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
height: 10
opacity: 0
color: "black"
}
Label {
visible: !passwordDialogMode
text: newPasswordDialogMode ? qsTr("Please confirm new password") : qsTr("Please confirm wallet device passphrase") + translationManager.emptyString
Layout.fillWidth: true
font.pixelSize: 16
font.family: MoneroComponents.Style.fontLight.name font.family: MoneroComponents.Style.fontLight.name
font.pixelSize: 24 * scaleRatio
color: MoneroComponents.Style.defaultFontColor echoMode: TextInput.Password
}
MoneroComponents.LineEdit {
id: passwordInput2
passwordLinked: passwordInput1
visible: !passwordDialogMode
Layout.topMargin: 6
Layout.fillWidth: true
KeyNavigation.tab: okButton KeyNavigation.tab: okButton
onTextChanged: capsLockTextLabel.visible = oshelper.isCapsLock(); bottomPadding: 10
leftPadding: 10
topPadding: 10
color: MoneroComponents.Style.defaultFontColor
selectionColor: MoneroComponents.Style.dimmedFontColor
selectedTextColor: MoneroComponents.Style.defaultFontColor
background: Rectangle {
radius: 2
border.color: Qt.rgba(255, 255, 255, 0.35)
border.width: 1
color: "black"
Image {
width: 12
height: 16
source: "../images/lockIcon.png"
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: 20
}
}
Keys.enabled: root.visible Keys.enabled: root.visible
Keys.onEnterPressed: root.onOk() Keys.onReturnPressed: {
Keys.onReturnPressed: root.onOk() root.close()
Keys.onEscapePressed: root.onCancel() root.accepted()
}
// padding }
Rectangle { Keys.onEscapePressed: {
visible: !passwordDialogMode root.close()
Layout.fillWidth: true root.rejected()
Layout.alignment: Qt.AlignHCenter
height: 10 }
opacity: 0
color: "black"
} }
// Ok/Cancel buttons // Ok/Cancel buttons
RowLayout { RowLayout {
id: buttons id: buttons
spacing: 16 spacing: 16 * scaleRatio
Layout.topMargin: 16 Layout.topMargin: 16
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
MoneroComponents.StandardButton { MoneroComponents.StandardButton {
id: cancelButton id: cancelButton
primary: false
small: true small: true
text: qsTr("Cancel") + translationManager.emptyString text: qsTr("Cancel") + translationManager.emptyString
KeyNavigation.tab: passwordInput1 KeyNavigation.tab: passwordInput
onClicked: onCancel() onClicked: {
root.close()
root.rejected()
}
} }
MoneroComponents.StandardButton { MoneroComponents.StandardButton {
id: okButton id: okButton
fontAwesomeIcon: true
rightIcon: okButtonIcon
small: true small: true
text: okButtonText ? okButtonText : qsTr("Ok") + translationManager.emptyString text: qsTr("Continue")
KeyNavigation.tab: cancelButton KeyNavigation.tab: cancelButton
enabled: (passwordDialogMode == true) ? true : passwordInput1.text === passwordInput2.text onClicked: {
onClicked: onOk() root.close()
root.accepted()
}
} }
} }
} }
} }
} }

153
components/PrivacyLevel.qml Normal file
View File

@@ -0,0 +1,153 @@
// 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.
// @TODO: Remove component after wizard redesign
import QtQuick 2.0
Item {
id: item
property int fillLevel: 0
height: 70
clip: true
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
height: 24
//radius: 4
color: "#DBDBDB"
}
Rectangle {
id: bar
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.topMargin: 1
height: 24
//radius: 4
color: "#FFFFFF"
Rectangle {
id: fillRect
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.margins: 4
//radius: 2
width: row.x
color: "#FF6C3C"
Timer {
interval: 500
running: true
repeat: false
onTriggered: fillRect.loaded = true
}
property bool loaded: false
Behavior on width {
enabled: fillRect.loaded
NumberAnimation { duration: 100; easing.type: Easing.InQuad }
}
}
MouseArea {
anchors.fill: parent
function positionBar() {
var xDiff = 999999
var index = -1
for(var i = 0; i < 14; ++i) {
var tmp = Math.abs(row.positions[i].currentX + row.x - mouseX)
if(tmp < xDiff) {
xDiff = tmp
index = i
}
}
if(index !== -1) {
fillRect.width = Qt.binding(function(){ return row.positions[index].currentX + row.x })
item.fillLevel = index
}
}
onClicked: positionBar()
onMouseXChanged: positionBar()
}
}
Row {
id: row
anchors.right: bar.right
anchors.rightMargin: 8
anchors.top: bar.bottom
anchors.topMargin: -1
property var positions: new Array()
Row {
id: row2
spacing: bar.width / 14
Repeater {
model: 4
delegate: TickDelegate {
id: delegateItem2
currentX: x + row2.x
currentIndex: index
mainTick: currentIndex === 0
Component.onCompleted: {
row.positions[currentIndex] = delegateItem2
}
}
}
}
Row {
id: row1
spacing: bar.width / 14
Repeater {
model: 10
delegate: TickDelegate {
id: delegateItem1
currentX: x + row1.x
currentIndex: index + 4
mainTick: currentIndex === 13
Component.onCompleted: {
row.positions[currentIndex] = delegateItem1
}
}
}
}
}
}

View File

@@ -0,0 +1,193 @@
// 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.
// @TODO: Remove component after wizard redesign
import QtQuick 2.0
Item {
id: item
property alias interactive: mouseArea.enabled
property alias background: bar.color
property int fillLevel: 0
height: 40
clip: true
onFillLevelChanged: {
if (!interactive) {
//print("fillLevel: " + fillLevel)
fillRect.width = row.positions[fillLevel].currentX + row.x
}
}
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
height: 24
//radius: 4
color: "#DBDBDB"
}
Rectangle {
id: bar
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.topMargin: 1
height: 24
//radius: 4
color: "#FFFFFF"
Rectangle {
id: fillRect
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.margins: 4
//radius: 2
width: row.x
color: "#FF6C3C"
Timer {
interval: 500
running: true
repeat: false
onTriggered: fillRect.loaded = true
}
property bool loaded: false
Behavior on width {
enabled: fillRect.loaded
NumberAnimation { duration: 100; easing.type: Easing.InQuad }
}
}
Text {
anchors.verticalCenter: parent.verticalCenter
font.family: "Arial"
font.pixelSize: 15
color: "#000000"
x: row.x + (row.positions[0] !== undefined ? row.positions[0].currentX - 3 : 0) - width
text: qsTr("Low") + translationManager.emptyString
}
Text {
anchors.verticalCenter: parent.verticalCenter
font.family: "Arial"
font.pixelSize: 15
color: "#000000"
x: row.x + (row.positions[4] !== undefined ? row.positions[4].currentX - 3 : 0) - width
text: qsTr("Medium") + translationManager.emptyString
}
Text {
anchors.verticalCenter: parent.verticalCenter
font.family: "Arial"
font.pixelSize: 15
color: "#000000"
x: row.x + (row.positions[13] !== undefined ? row.positions[13].currentX - 3 : 0) - width
text: qsTr("High") + translationManager.emptyString
}
MouseArea {
id: mouseArea
anchors.fill: parent
function positionBar() {
var xDiff = 999999
var index = -1
for(var i = 0; i < 14; ++i) {
var tmp = Math.abs(row.positions[i].currentX + row.x - mouseX)
if(tmp < xDiff) {
xDiff = tmp
index = i
}
}
if(index !== -1) {
fillRect.width = Qt.binding(function(){ return row.positions[index].currentX + row.x })
item.fillLevel = index
print ("fillLevel: " + item.fillLevel)
}
}
onClicked: positionBar()
onMouseXChanged: positionBar()
}
}
Row {
id: row
anchors.right: bar.right
anchors.rightMargin: 8
anchors.top: bar.bottom
anchors.topMargin: 5
property var positions: []
Row {
id: row2
spacing: ((bar.width - 8) / 2.23) / 4
Repeater {
model: 4
delegate: Rectangle {
id: delegateItem2
property int currentX: x + row2.x
height: 8
width: 1
color: "#DBDBDB"
Component.onCompleted: {
row.positions[index] = delegateItem2
}
}
}
}
Row {
id: row1
spacing: ((bar.width - 8) / 2.23) / 10
Repeater {
model: 10
delegate: Rectangle {
id: delegateItem1
property int currentX: x + row1.x
height: index === 4 ? 8 : 4
width: 1
color: "#DBDBDB"
Component.onCompleted: {
row.positions[index + 4] = delegateItem1
}
}
}
}
}
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,26 +26,22 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.0
import QtQuick.Window 2.1 import QtQuick.Window 2.1
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import "../components" as MoneroComponents
Rectangle { Rectangle {
id: root id: root
color: MoneroComponents.Style.blackTheme ? "black" : "white" color: "white"
visible: false visible: false
radius: 10 z:11
border.color: MoneroComponents.Style.blackTheme ? Qt.rgba(255, 255, 255, 0.25) : Qt.rgba(0, 0, 0, 0.25)
border.width: 1
z: 11
property alias messageText: messageTitle.text property alias messageText: messageTitle.text
property alias heightProgressText : heightProgress.text
width: 100 width: 200 * scaleRatio
height: 50 height: 100 * scaleRatio
opacity: 0.7
function show() { function show() {
root.visible = true; root.visible = true;
@@ -58,55 +54,38 @@ Rectangle {
ColumnLayout { ColumnLayout {
id: rootLayout id: rootLayout
anchors.centerIn: parent anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: 30 anchors.leftMargin: 30 * scaleRatio
anchors.rightMargin: 30 anchors.rightMargin: 30 * scaleRatio
spacing: 21 BusyIndicator {
running: parent.visible
Item {
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
Layout.preferredHeight: 80
Image {
id: imgLogo
width: 60
height: 60
anchors.centerIn: parent
source: "qrc:///images/monero-vector.svg"
mipmap: true
}
BusyIndicator {
running: parent.visible
anchors.centerIn: imgLogo
style: BusyIndicatorStyle {
indicator: Image {
visible: control.running
source: "qrc:///images/busy-indicator.png"
RotationAnimator on rotation {
running: control.running
loops: Animation.Infinite
duration: 1000
from: 0
to: 360
}
}
}
}
} }
Text {
MoneroComponents.TextPlain {
id: messageTitle id: messageTitle
text: qsTr("Please wait...") + translationManager.emptyString text: "Please wait..."
font.pixelSize: 24 font {
pixelSize: 22 * scaleRatio
}
horizontalAlignment: Text.AlignHCenter
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
Layout.fillWidth: true
}
Text {
id: heightProgress
font {
pixelSize: 18 * scaleRatio
}
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
Layout.fillWidth: true Layout.fillWidth: true
themeTransition: false
color: MoneroComponents.Style.defaultFontColor
} }
} }
} }

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,7 +26,7 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.0
import moneroComponents.Wallet 1.0 import moneroComponents.Wallet 1.0
import "../components" as MoneroComponents import "../components" as MoneroComponents
@@ -42,75 +42,57 @@ Rectangle {
function updateProgress(currentBlock,targetBlock, blocksToSync, statusTxt){ function updateProgress(currentBlock,targetBlock, blocksToSync, statusTxt){
if(targetBlock > 0) { if(targetBlock > 0) {
var remaining = (currentBlock < targetBlock) ? targetBlock - currentBlock : 0 var remaining = (currentBlock < targetBlock) ? targetBlock - currentBlock : 0
var progressLevel = (blocksToSync > 0 ) ? (100*(blocksToSync - remaining)/blocksToSync).toFixed(0) : 100 var progressLevel = (blocksToSync > 0 && blocksToSync != remaining) ? (100*(blocksToSync - remaining)/blocksToSync).toFixed(0) : (100*(currentBlock / targetBlock)).toFixed(0)
fillLevel = progressLevel fillLevel = progressLevel
if(typeof statusTxt != "undefined" && statusTxt != "") { if(typeof statusTxt != "undefined" && statusTxt != "") {
progressText.text = statusTxt; progressText.text = statusTxt;
progressTextValue.text = "";
} else { } else {
progressText.text = syncText; progressText.text = syncText + remaining.toFixed(0);
progressTextValue.text = remaining.toFixed(0);
} }
} }
} }
Item { Item {
anchors.top: item.top anchors.top: item.top
anchors.topMargin: 10 anchors.topMargin: 10 * scaleRatio
anchors.leftMargin: 15 anchors.leftMargin: 15 * scaleRatio
anchors.rightMargin: 15 anchors.rightMargin: 15 * scaleRatio
anchors.fill: parent anchors.fill: parent
MoneroComponents.TextPlain { Text {
id: progressText id: progressText
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 6 anchors.topMargin: 6
font.family: MoneroComponents.Style.fontMedium.name font.family: MoneroComponents.Style.fontMedium.name
font.pixelSize: 13 font.pixelSize: 13 * scaleRatio
font.bold: MoneroComponents.Style.progressBarProgressTextBold font.bold: true
color: MoneroComponents.Style.defaultFontColor color: "white"
text: qsTr("Synchronizing %1").arg(syncType) + translationManager.emptyString text: qsTr("Synchronizing %1").arg(syncType) + translationManager.emptyString
height: 18 height: 18 * scaleRatio
} }
MoneroComponents.TextPlain { Text {
id: progressTextValue id: progressTextValue
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 6 anchors.topMargin: 6
anchors.right: parent.right anchors.right: parent.right
font.family: MoneroComponents.Style.fontMedium.name font.family: MoneroComponents.Style.fontMedium.name
font.pixelSize: 13 font.pixelSize: 13 * scaleRatio
font.bold: MoneroComponents.Style.progressBarProgressTextBold font.bold: true
color: MoneroComponents.Style.defaultFontColor color: "white"
height:18 height:18 * scaleRatio
} }
Rectangle { Rectangle {
id: bar id: bar
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: progressText.bottom anchors.top: progressText.bottom
anchors.topMargin: 4 anchors.topMargin: 4
height: 8 height: 8 * scaleRatio
radius: 8 radius: 8 * scaleRatio
color: MoneroComponents.Style.progressBarBackgroundColor color: "#333333" // progressbar bg
states: [
State {
name: "black";
when: MoneroComponents.Style.blackTheme
PropertyChanges { target: bar; color: MoneroComponents.Style._b_progressBarBackgroundColor}
}, State {
name: "white";
when: !MoneroComponents.Style.blackTheme
PropertyChanges { target: bar; color: MoneroComponents.Style._w_progressBarBackgroundColor}
}
]
transitions: Transition {
enabled: appWindow.themeTransition
ColorAnimation { properties: "color"; easing.type: Easing.InOutQuad; duration: 300 }
}
Rectangle { Rectangle {
id: fillRect id: fillRect
@@ -118,9 +100,10 @@ Rectangle {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.left: parent.left anchors.left: parent.left
height: bar.height height: bar.height
property int maxWidth: bar.width property int maxWidth: bar.width * scaleRatio
width: (maxWidth * fillLevel) / 100 width: (maxWidth * fillLevel) / 100
radius: 8 radius: 8
// could change color based on progressbar status; if(item.fillLevel < 99 )
color: "#FA6800" color: "#FA6800"
} }
@@ -128,9 +111,12 @@ Rectangle {
color:"#333" color:"#333"
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 8 anchors.leftMargin: 8 * scaleRatio
} }
} }
} }
} }

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,7 +26,7 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.0
import QtMultimedia 5.4 import QtMultimedia 5.4
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
import moneroComponents.QRCodeScanner 1.0 import moneroComponents.QRCodeScanner 1.0
@@ -53,7 +53,6 @@ Rectangle {
script: { script: {
root.visible = true root.visible = true
camera.captureMode = Camera.CaptureStillImage camera.captureMode = Camera.CaptureStillImage
camera.cameraState = Camera.ActiveState
camera.start() camera.start()
finder.enabled = true finder.enabled = true
} }
@@ -66,7 +65,6 @@ Rectangle {
camera.stop() camera.stop()
root.visible = false root.visible = false
finder.enabled = false finder.enabled = false
camera.cameraState = Camera.UnloadedState
} }
} }
} }
@@ -76,7 +74,6 @@ Rectangle {
id: camera id: camera
objectName: "qrCameraQML" objectName: "qrCameraQML"
captureMode: Camera.CaptureStillImage captureMode: Camera.CaptureStillImage
cameraState: Camera.UnloadedState
focus { focus {
focusMode: Camera.FocusContinuous focusMode: Camera.FocusContinuous
@@ -86,17 +83,9 @@ Rectangle {
id : finder id : finder
objectName: "QrFinder" objectName: "QrFinder"
onDecoded : { onDecoded : {
const parsed = walletManager.parse_uri_to_object(data); root.qrcode_decoded(address, payment_id, amount, tx_description, recipient_name, extra_parameters)
if (!parsed.error) { root.state = "Stopped"
root.qrcode_decoded(parsed.address, parsed.payment_id, parsed.amount, parsed.tx_description, parsed.recipient_name, parsed.extra_parameters); }
root.state = "Stopped";
} else if (walletManager.addressValid(data, appWindow.persistentSettings.nettype)) {
root.qrcode_decoded(data, "", "", "", "", null);
root.state = "Stopped";
} else {
onNotifyError(parsed.error);
}
}
onNotifyError : { onNotifyError : {
if( warning ) if( warning )
messageDialog.icon = StandardIcon.Critical messageDialog.icon = StandardIcon.Critical

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,23 +26,22 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.0
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import "../components" as MoneroComponents import "../components" as MoneroComponents
Item { RowLayout {
id: radioButton id: radioButton
property alias text: label.text property alias text: label.text
property bool checked: false property bool checked: false
property int fontSize: 14 property int fontSize: 14 * scaleRatio
property alias fontColor: label.color property alias fontColor: label.color
signal clicked() signal clicked()
height: 26 height: 26 * scaleRatio
width: layout.width
// legacy properties // legacy properties
property var checkedColor: MoneroComponents.Style.blackTheme ? "white" : "#666666" property var checkedColor: "white"
property var borderColor: checked ? MoneroComponents.Style.inputBorderColorActive : MoneroComponents.Style.inputBorderColorInActive property var borderColor: checked ? Qt.rgba(1, 1, 1, 0.35) : Qt.rgba(1, 1, 1, 0.25)
function toggle(){ function toggle(){
radioButton.checked = !radioButton.checked radioButton.checked = !radioButton.checked
@@ -50,14 +49,15 @@ Item {
} }
RowLayout { RowLayout {
id: layout Layout.fillWidth: true
Rectangle { Rectangle {
id: button id: button
anchors.left: parent.left
y: 0
color: "transparent" color: "transparent"
border.color: borderColor border.color: borderColor
height: radioButton.height
width: radioButton.height width: radioButton.height
height: radioButton.height
radius: radioButton.height radius: radioButton.height
Rectangle { Rectangle {
@@ -65,28 +65,37 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
color: checkedColor color: checkedColor
width: 10 width: 10 * scaleRatio
height: 10 height: 10 * scaleRatio
radius: 10 radius: 10
opacity: 0.8 opacity: 0.8
} }
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
toggle()
}
}
} }
MoneroComponents.TextPlain { Text {
id: label id: label
Layout.leftMargin: 10 anchors.left: button.right
anchors.leftMargin: !isMobile ? 10 : 8
color: MoneroComponents.Style.defaultFontColor color: MoneroComponents.Style.defaultFontColor
font.family: MoneroComponents.Style.fontRegular.name font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: radioButton.fontSize font.pixelSize: radioButton.fontSize
wrapMode: Text.Wrap wrapMode: Text.Wrap
}
}
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
toggle() toggle()
}
}
} }
} }
} }

View File

@@ -1,170 +0,0 @@
// Copyright (c) 2021-2024, 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.
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.1
import "." as MoneroComponents
MoneroComponents.Dialog {
id: root
title: (editMode ? qsTr("Edit remote node") : qsTr("Add remote node")) + translationManager.emptyString
property var callbackOnSuccess: null
property bool editMode: false
property bool success: false
onActiveFocusChanged: activeFocus && remoteNodeAddress.forceActiveFocus()
function onOk() {
root.success = true;
root.close();
}
function onCancel() { root.close(); }
function add(callbackOnSuccess) {
root.editMode = false;
root.callbackOnSuccess = callbackOnSuccess;
open();
}
function edit(remoteNode, callbackOnSuccess) {
const hostPort = remoteNode.address.match(/^(.*?)(?:\:?(\d*))$/);
if (hostPort) {
remoteNodeAddress.daemonAddrText = hostPort[1];
remoteNodeAddress.daemonPortText = hostPort[2];
}
daemonUsername.text = remoteNode.username;
daemonPassword.text = remoteNode.password;
setTrustedDaemonCheckBox.checked = remoteNode.trusted;
root.callbackOnSuccess = callbackOnSuccess;
root.editMode = true;
open();
}
onClosed: {
if (root.success && callbackOnSuccess) {
callbackOnSuccess({
address: remoteNodeAddress.getAddress(),
username: daemonUsername.text,
password: daemonPassword.text,
trusted: setTrustedDaemonCheckBox.checked,
});
}
remoteNodeAddress.daemonAddrText = "";
remoteNodeAddress.daemonPortText = "";
daemonUsername.text = "";
daemonPassword.text = "";
setTrustedDaemonCheckBox.checked = false;
root.success = false;
}
MoneroComponents.RemoteNodeEdit {
id: remoteNodeAddress
Layout.fillWidth: true
placeholderFontSize: 15
daemonAddrLabelText: qsTr("Address") + translationManager.emptyString
daemonPortLabelText: qsTr("Port") + translationManager.emptyString
Keys.enabled: root.visible
Keys.onEnterPressed: root.onOk()
Keys.onReturnPressed: root.onOk()
Keys.onEscapePressed: root.onCancel()
}
RowLayout {
Layout.fillWidth: true
spacing: 32
MoneroComponents.LineEdit {
id: daemonUsername
Layout.fillWidth: true
Layout.minimumWidth: 220
labelText: qsTr("Daemon username") + translationManager.emptyString
placeholderText: qsTr("(optional)") + translationManager.emptyString
placeholderFontSize: 15
labelFontSize: 14
fontSize: 15
}
MoneroComponents.LineEdit {
id: daemonPassword
Layout.fillWidth: true
Layout.minimumWidth: 220
labelText: qsTr("Daemon password") + translationManager.emptyString
placeholderText: qsTr("Password") + translationManager.emptyString
password: true
placeholderFontSize: 15
labelFontSize: 14
fontSize: 15
Keys.enabled: root.visible
Keys.onEnterPressed: root.onOk()
Keys.onReturnPressed: root.onOk()
Keys.onEscapePressed: root.onCancel()
}
}
MoneroComponents.CheckBox {
id: setTrustedDaemonCheckBox
activeFocusOnTab: true
text: qsTr("Mark as Trusted Daemon") + translationManager.emptyString
}
RowLayout {
Layout.alignment: Qt.AlignRight
spacing: parent.spacing
MoneroComponents.StandardButton {
activeFocusOnTab: true
fontBold: false
primary: false
text: qsTr("Cancel") + translationManager.emptyString
onClicked: root.close()
}
MoneroComponents.StandardButton {
activeFocusOnTab: true
fontBold: false
enabled: remoteNodeAddress.getAddress() != ""
text: qsTr("Ok") + translationManager.emptyString
onClicked: {
root.success = true;
root.close();
}
}
}
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -28,14 +28,13 @@
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2 import QtQuick.Controls.Styles 1.2
import QtQuick 2.9 import QtQuick 2.2
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import "../js/Utils.js" as Utils
import "../components" as MoneroComponents import "../components" as MoneroComponents
GridLayout { GridLayout {
columns: 2 columns: (isMobile) ? 1 : 2
columnSpacing: 32 columnSpacing: 32
id: root id: root
property alias daemonAddrText: daemonAddr.text property alias daemonAddrText: daemonAddr.text
@@ -43,48 +42,30 @@ GridLayout {
property alias daemonAddrLabelText: daemonAddr.labelText property alias daemonAddrLabelText: daemonAddr.labelText
property alias daemonPortLabelText: daemonPort.labelText property alias daemonPortLabelText: daemonPort.labelText
property string initialAddress: ""
property var initialHostPort: initialAddress.match(/^(.*?)(?:\:?(\d*))$/)
// TODO: LEGACY; remove these placeHolder variables when // TODO: LEGACY; remove these placeHolder variables when
// the wizards get redesigned to the black-theme // the wizards get redesigned to the black-theme
property string placeholderFontFamily: MoneroComponents.Style.fontRegular.name property string placeholderFontFamily: MoneroComponents.Style.fontRegular.name
property bool placeholderFontBold: false property bool placeholderFontBold: false
property int placeholderFontSize: 15 property int placeholderFontSize: 18 * scaleRatio
property string placeholderColor: MoneroComponents.Style.defaultFontColor property string placeholderColor: MoneroComponents.Style.defaultFontColor
property real placeholderOpacity: 0.35 property real placeholderOpacity: 0.35
property int labelFontSize: 14
property string lineEditBackgroundColor: "transparent" property string lineEditBorderColor: Qt.rgba(0, 0, 0, 0.15)
property string lineEditFontColor: MoneroComponents.Style.defaultFontColor property string lineEditBackgroundColor: "white"
property bool lineEditFontBold: false property string lineEditFontColor: "black"
property int lineEditFontSize: 15 property int lineEditFontSize: 18 * scaleRatio
property int labelFontSize: 16 * scaleRatio
// Author: David M. Syzdek https://github.com/syzdek https://gist.github.com/syzdek/6086792 property bool lineEditFontBold: true
readonly property var ipv6Regex: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe08:(:[0-9a-fA-F]{1,4}){2,2}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/
signal editingFinished() signal editingFinished()
signal textChanged()
onActiveFocusChanged: activeFocus && daemonAddr.forceActiveFocus()
function isValid() {
return daemonAddr.text.trim().length > 0 && daemonPort.acceptableInput
}
function getAddress() { function getAddress() {
if (!isValid()) { return daemonAddr.text.trim() + ":" + daemonPort.text.trim()
return "";
}
var addr = daemonAddr.text.trim();
var port = daemonPort.text.trim();
return addr + ":" + port;
} }
MoneroComponents.LineEdit { LineEdit {
id: daemonAddr id: daemonAddr
Layout.preferredWidth: root.width/3 Layout.fillWidth: true
placeholderText: qsTr("Remote Node Hostname / IP") + translationManager.emptyString placeholderText: qsTr("Remote Node Hostname / IP") + translationManager.emptyString
placeholderFontFamily: root.placeholderFontFamily placeholderFontFamily: root.placeholderFontFamily
placeholderFontBold: root.placeholderFontBold placeholderFontBold: root.placeholderFontBold
@@ -92,21 +73,17 @@ GridLayout {
placeholderColor: root.placeholderColor placeholderColor: root.placeholderColor
placeholderOpacity: root.placeholderOpacity placeholderOpacity: root.placeholderOpacity
labelFontSize: root.labelFontSize labelFontSize: root.labelFontSize
borderColor: lineEditBorderColor
backgroundColor: lineEditBackgroundColor backgroundColor: lineEditBackgroundColor
fontColor: lineEditFontColor fontColor: lineEditFontColor
fontBold: lineEditFontBold fontBold: lineEditFontBold
fontSize: lineEditFontSize fontSize: lineEditFontSize
onEditingFinished: { onEditingFinished: root.editingFinished()
text = text.replace(ipv6Regex, "[$1]");
root.editingFinished();
}
onTextChanged: root.textChanged()
text: initialHostPort[1]
} }
MoneroComponents.LineEdit { LineEdit {
id: daemonPort id: daemonPort
Layout.preferredWidth: root.width/3 Layout.fillWidth: true
placeholderText: qsTr("Port") + translationManager.emptyString placeholderText: qsTr("Port") + translationManager.emptyString
placeholderFontFamily: root.placeholderFontFamily placeholderFontFamily: root.placeholderFontFamily
placeholderFontBold: root.placeholderFontBold placeholderFontBold: root.placeholderFontBold
@@ -114,14 +91,12 @@ GridLayout {
placeholderColor: root.placeholderColor placeholderColor: root.placeholderColor
placeholderOpacity: root.placeholderOpacity placeholderOpacity: root.placeholderOpacity
labelFontSize: root.labelFontSize labelFontSize: root.labelFontSize
borderColor: lineEditBorderColor
backgroundColor: lineEditBackgroundColor backgroundColor: lineEditBackgroundColor
fontColor: lineEditFontColor fontColor: lineEditFontColor
fontBold: lineEditFontBold fontBold: lineEditFontBold
fontSize: lineEditFontSize fontSize: lineEditFontSize
validator: IntValidator{bottom: 1; top: 65535;}
onEditingFinished: root.editingFinished() onEditingFinished: root.editingFinished()
onTextChanged: root.textChanged()
text: initialHostPort[2]
} }
} }

View File

@@ -1,167 +0,0 @@
// Copyright (c) 2021-2024, 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.
import QtQuick 2.9
import QtQuick.Layouts 1.1
import FontAwesome 1.0
import "." as MoneroComponents
import "effects/" as MoneroEffects
ColumnLayout {
id: remoteNodeList
spacing: 20
MoneroComponents.CheckBox {
border: false
checkedIcon: FontAwesome.minusCircle
uncheckedIcon: FontAwesome.plusCircle
fontAwesomeIcons: true
fontSize: 16
iconOnTheLeft: true
text: qsTr("Add remote node") + translationManager.emptyString
toggleOnClick: false
onClicked: remoteNodeDialog.add(remoteNodesModel.append)
}
ColumnLayout {
spacing: 0
Repeater {
model: remoteNodesModel
Rectangle {
height: 30
Layout.fillWidth: true
color: itemMouseArea.containsMouse || trustedDaemonCheckMark.labelMouseArea.containsMouse || index === remoteNodesModel.selected ? MoneroComponents.Style.titleBarButtonHoverColor : "transparent"
Rectangle {
visible: index === remoteNodesModel.selected
Layout.fillHeight: true
anchors.top: parent.top
anchors.bottom: parent.bottom
color: "darkgrey"
width: 2
}
Rectangle {
color: MoneroComponents.Style.appWindowBorderColor
anchors.right: parent.right
anchors.left: parent.left
anchors.top: parent.top
height: 1
visible: index > 0
MoneroEffects.ColorTransition {
targetObj: parent
blackColor: MoneroComponents.Style._b_appWindowBorderColor
whiteColor: MoneroComponents.Style._w_appWindowBorderColor
}
}
Rectangle {
anchors.fill: parent
anchors.rightMargin: 80
color: "transparent"
property var trusted: remoteNodesModel.get(index) ? remoteNodesModel.get(index).trusted : false
MoneroComponents.TextPlain {
id: addressText
width: parent.width - trustedDaemonCheckMark.width
color: index === remoteNodesModel.selected ? MoneroComponents.Style.defaultFontColor : MoneroComponents.Style.dimmedFontColor
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 6
font.pixelSize: 16
text: address
themeTransition: false
elide: Text.ElideMiddle
}
MoneroComponents.Label {
id: trustedDaemonCheckMark
anchors.left: addressText.right
anchors.leftMargin: 3
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: 2
z: itemMouseArea.z + 1
fontSize: 16
fontFamily: FontAwesome.fontFamilySolid
fontColor: index === remoteNodesModel.selected ? MoneroComponents.Style.defaultFontColor : MoneroComponents.Style.dimmedFontColor
styleName: "Solid"
visible: trusted
text: FontAwesome.shieldAlt
tooltip: qsTr("Trusted daemon") + translationManager.emptyString
themeTransition: false
}
MouseArea {
id: itemMouseArea
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
hoverEnabled: true
onClicked: remoteNodesModel.applyRemoteNode(index)
}
}
RowLayout {
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
height: 30
spacing: 2
MoneroComponents.InlineButton {
buttonColor: "transparent"
fontFamily: FontAwesome.fontFamily
fontPixelSize: 18
text: FontAwesome.edit
tooltip: qsTr("Edit remote node") + translationManager.emptyString
tooltipLeft: true
onClicked: remoteNodeDialog.edit(remoteNodesModel.get(index), function (remoteNode) {
remoteNodesModel.set(index, remoteNode)
if (index === remoteNodesModel.selected) {
remoteNodesModel.applyRemoteNode(index)
}
})
}
MoneroComponents.InlineButton {
buttonColor: "transparent"
fontFamily: FontAwesome.fontFamily
text: FontAwesome.times
visible: remoteNodesModel.count > 1
tooltip: qsTr("Remove remote node") + translationManager.emptyString
tooltipLeft: true
onClicked: remoteNodesModel.removeSelectNextIfNeeded(index)
}
}
}
}
}
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,43 +26,59 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef OSHELPER_H import QtQuick 2.0
#define OSHELPER_H
#include <QList> Item {
#include <QObject> id: scrollItem
#include <QString> property var flickable
/** width: 15
* @brief The OSHelper class - exports to QML some OS-related functions z: 1
*/
class OSHelper : public QObject
{
Q_OBJECT
Q_PROPERTY(bool installed READ installed CONSTANT);
public: function flickableContentYChanged() {
explicit OSHelper(QObject *parent = 0); if(flickable === undefined)
return
Q_INVOKABLE void createDesktopEntry() const; var t = flickable.height - scroll.height
Q_INVOKABLE QString downloadLocation() const; scroll.y = (flickable.contentY / (flickable.contentHeight - flickable.height)) * t
Q_INVOKABLE QList<QString> grabQrCodesFromScreen() const; }
Q_INVOKABLE bool openFile(const QString &filePath) const;
Q_INVOKABLE bool openContainingFolder(const QString &filePath) const;
Q_INVOKABLE QString openSaveFileDialog(const QString &title, const QString &folder, const QString &filename) const;
Q_INVOKABLE QString temporaryFilename() const;
Q_INVOKABLE QString temporaryPath() const;
Q_INVOKABLE bool removeTemporaryWallet(const QString &walletName) const;
Q_INVOKABLE bool isCapsLock() const;
Q_INVOKABLE quint8 getNetworkTypeFromFile(const QString &keysPath) const;
Q_INVOKABLE void openSeedTemplate() const;
static std::pair<quint8, QString> getNetworkTypeAndAddressFromFile(const QString &wallet); MouseArea {
private: id: scrollArea
bool installed() const; anchors.fill: parent
hoverEnabled: true
}
signals: Rectangle {
id: scroll
public slots: width: 4
}; height: {
var t = (flickable.height * flickable.height) / flickable.contentHeight
return t < 20 ? 20 : t
}
y: 0; x: 0
color: "#DBDBDB"
opacity: flickable.moving || handleArea.pressed || scrollArea.containsMouse ? 0.5 : 0
visible: flickable.contentHeight > flickable.height
#endif // OSHELPER_H Behavior on opacity {
NumberAnimation { duration: 200; easing.type: Easing.InQuad }
}
MouseArea {
id: handleArea
anchors.fill: parent
drag.target: scroll
drag.axis: Drag.YAxis
drag.minimumY: 0
drag.maximumY: flickable.height - height
propagateComposedEvents: true
onPositionChanged: {
if(!pressed) return
var dy = scroll.y / (flickable.height - scroll.height)
flickable.contentY = (flickable.contentHeight - flickable.height) * dy
}
}
}
}

229
components/SearchInput.qml Normal file
View File

@@ -0,0 +1,229 @@
// 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.
import QtQuick 2.0
import "../components" as MoneroComponents
Item {
id: item
signal searchClicked(string text, int option)
height: 50
Rectangle {
anchors.fill: parent
color: "#DBDBDB"
//radius: 4
}
Rectangle {
anchors.fill: parent
anchors.topMargin: 1
color: "#FFFFFF"
//radius: 4
Item {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
width: 45
Image {
anchors.centerIn: parent
source: "../images/magnifier.png"
}
}
Input {
id: input
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: dropdown.left
anchors.leftMargin: 45
font.pixelSize: 18
verticalAlignment: TextInput.AlignVCenter
placeholderText: qsTr("Search by...") + translationManager.emptyString
}
Item {
id: dropdown
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: button.left
width: 154
function hide() { droplist.height = 0 }
function containsPoint(px, py) {
if(px < 0)
return false
if(px > width)
return false
if(py < 0)
return false
if(py > height + droplist.height)
return false
return true
}
Row {
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
Text {
id: dropText
width: 114 - 12
anchors.verticalCenter: parent.verticalCenter
font.family: "Arial"
font.pixelSize: 12
font.bold: true
color: "#4A4747"
text: "NAME"
}
Image {
anchors.verticalCenter: parent.verticalCenter
source: "../images/hseparator.png"
}
Item {
height: dropdown.height
width: 38
Image {
id: dropIndicator
anchors.centerIn: parent
source: "../images/dropIndicator.png"
rotation: droplist.height === 0 ? 0 : 180
}
}
}
MouseArea {
anchors.fill: parent
onClicked: {
if(droplist.height === 0) {
appWindow.currentItem = dropdown
droplist.height = dropcolumn.height + 2
} else {
droplist.height = 0
}
}
}
}
Rectangle {
id: droplist
property int currentOption: 0
width: 154
height: 0
clip: true
x: dropdown.x
y: dropdown.height
border.width: 1
border.color: "#DBDBDB"
color: "#FFFFFF"
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.leftMargin: 1
anchors.rightMargin: 1
height: 1
color: "#FFFFFF"
}
Behavior on height {
NumberAnimation { duration: 100; easing.type: Easing.InQuad }
}
ListModel {
id: dropdownModel
ListElement { name: "NAME" }
ListElement { name: "DESCRIPTION" }
ListElement { name: "ADDRESS" }
}
Column {
id: dropcolumn
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: 1
Repeater {
model: dropdownModel
delegate: Rectangle {
property bool isCurrent: name === dropText.text
anchors.left: parent.left
anchors.right: parent.right
height: 30
color: delegateArea.pressed || isCurrent ? "#4A4646" : "#FFFFFF"
Text {
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.right: parent.right
elide: Text.ElideRight
anchors.leftMargin: 12
anchors.rightMargin: 12
font.family: "Arial"
font.bold: true
font.pixelSize: 12
color: delegateArea.pressed || parent.isCurrent ? "#FFFFFF" : "#4A4646"
text: name
}
MouseArea {
id: delegateArea
anchors.fill: parent
onClicked: {
droplist.currentOption = index
droplist.height = 0
dropText.text = name
}
}
}
}
}
}
MoneroComponents.StandardButton {
id: button
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.margins: 6
width: 80
text: qsTr("SEARCH")
onClicked: item.searchClicked(input.text, droplist.currentOption)
}
}
}

View File

@@ -1,131 +0,0 @@
import QtQuick 2.9
import QtQuick.Layouts 1.1
import FontAwesome 1.0
import "../components" as MoneroComponents
ColumnLayout {
id: settingsListItem
property alias iconText: iconLabel.text
property alias symbol: symbolText.text
property alias description: area.text
property alias title: header.text
property bool isLast: false
property bool enabled: true
signal clicked()
Layout.fillWidth: true
spacing: 0
Rectangle {
id: root
Layout.fillWidth: true
Layout.minimumHeight: 75
Layout.preferredHeight: rect.height + 15
color: "transparent"
Rectangle {
id: divider
anchors.topMargin: 0
anchors.left: parent.left
anchors.right: parent.right
height: 1
color: MoneroComponents.Style.dividerColor
opacity: MoneroComponents.Style.dividerOpacity
}
Rectangle {
id: rect
width: parent.width
height: header.height + area.contentHeight
color: "transparent";
opacity: settingsListItem.enabled ? 1 : 0.25
anchors.left: parent.left
anchors.bottomMargin: 4
anchors.topMargin: 4
anchors.verticalCenter: parent.verticalCenter
Rectangle {
id: icon
color: "transparent"
height: 32
width: 32
anchors.left: parent.left
anchors.leftMargin: 16
anchors.verticalCenter: parent.verticalCenter
MoneroComponents.Label {
id: iconLabel
fontSize: 32
fontFamily: FontAwesome.fontFamilySolid
anchors.centerIn: parent
fontColor: MoneroComponents.Style.defaultFontColor
styleName: "Solid"
}
}
MoneroComponents.TextPlain {
id: header
anchors.left: icon.right
anchors.leftMargin: 16
anchors.top: parent.top
color: MoneroComponents.Style.defaultFontColor
opacity: MoneroComponents.Style.blackTheme ? 1.0 : 0.8
font.bold: true
font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 16
}
Text {
id: area
anchors.top: header.bottom
anchors.topMargin: 4
anchors.left: icon.right
anchors.leftMargin: 16
color: MoneroComponents.Style.dimmedFontColor
font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 15
horizontalAlignment: TextInput.AlignLeft
wrapMode: Text.WordWrap;
leftPadding: 0
topPadding: 0
width: parent.width - (icon.width + icon.anchors.leftMargin + anchors.leftMargin)
}
}
Rectangle {
id: bottomDivider
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
height: 1
color: MoneroComponents.Style.dividerColor
opacity: MoneroComponents.Style.dividerOpacity
visible: settingsListItem.isLast
}
MouseArea {
visible: settingsListItem.enabled
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
hoverEnabled: true
onEntered: root.color = MoneroComponents.Style.titleBarButtonHoverColor
onExited: root.color = "transparent"
onClicked: {
settingsListItem.clicked()
}
}
MoneroComponents.TextPlain {
id: symbolText
anchors.right: parent.right
anchors.rightMargin: 44
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: 12
font.bold: true
color: MoneroComponents.Style.menuButtonTextColor
visible: appWindow.ctrlPressed
themeTransition: false
}
}
}

View File

@@ -1,68 +0,0 @@
import QtQuick 2.9
import QtQuick.Controls 2.0 as QtQuickControls
import QtQuick.Layouts 1.1
import "../components" as MoneroComponents
ColumnLayout {
property alias from: slider.from
property alias stepSize: slider.stepSize
property alias to: slider.to
property alias value: slider.value
property alias text: label.text
signal moved()
spacing: 0
MoneroComponents.TextPlain {
id: label
color: MoneroComponents.Style.defaultFontColor
font.pixelSize: 14
font.family: MoneroComponents.Style.fontRegular.name
}
QtQuickControls.Slider {
id: slider
leftPadding: 0
snapMode: QtQuickControls.Slider.SnapAlways
background: Rectangle {
x: parent.leftPadding
y: parent.topPadding + parent.availableHeight / 2 - height / 2
implicitWidth: 200
implicitHeight: 4
width: parent.availableWidth
height: implicitHeight
radius: 2
color: MoneroComponents.Style.progressBarBackgroundColor
Rectangle {
width: parent.visualPosition * parent.width
height: parent.height
color: MoneroComponents.Style.green
radius: 2
}
}
handle: Rectangle {
x: parent.leftPadding + parent.visualPosition * (parent.availableWidth - width)
y: parent.topPadding + parent.availableHeight / 2 - height / 2
implicitWidth: 18
implicitHeight: 18
radius: 8
color: parent.pressed ? "#f0f0f0" : "#f6f6f6"
border.color: MoneroComponents.Style.grey
}
onMoved: parent.moved()
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.NoButton
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
}
}
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,167 +26,118 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.0
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import FontAwesome 1.0
import "../components" as MoneroComponents import "../components" as MoneroComponents
Item { Item {
id: button id: button
property bool fontAwesomeIcon: false
property bool primary: true
property string rightIcon: "" property string rightIcon: ""
property string rightIconInactive: "" property string rightIconInactive: ""
property color textColor: primary ? MoneroComponents.Style.buttonTextColor : MoneroComponents.Style.buttonSecondaryTextColor; property string icon: ""
property string textColor: button.enabled? MoneroComponents.Style.buttonTextColor: MoneroComponents.Style.buttonTextColorDisabled
property string textAlign: rightIcon !== "" ? "left" : "center"
property bool small: false property bool small: false
property alias text: label.text property alias text: label.text
property alias fontBold: label.font.bold
property int fontSize: { property int fontSize: {
if(small) return 13.5; if(small) return 14 * scaleRatio;
else return 16; else return 16 * scaleRatio;
} }
property alias label: label
property alias tooltip: tooltip.text
property alias tooltipLeft: tooltip.tooltipLeft
property alias tooltipPopup: tooltip.tooltipPopup
signal clicked() signal clicked()
height: small ? 30 : 36 // Dynamic height/width
width: buttonLayout.width + 22 Layout.minimumWidth: {
implicitHeight: height var _padding = 22;
implicitWidth: width if(button.rightIcon !== ""){
_padding += 60;
}
function doClick(){ var _width = label.contentWidth + _padding;
if(_width <= 50) {
return 60;
}
return _width;
}
height: small ? 30 * scaleRatio : 36 * scaleRatio
function doClick() {
// Android workaround
releaseFocus(); releaseFocus();
clicked(); clicked();
} }
Rectangle { Rectangle {
id: buttonRect anchors.left: parent.left
anchors.fill: parent anchors.right: parent.right
height: parent.height - 1
radius: 3 radius: 3
border.width: parent.focus && parent.enabled ? 1 : 0 color: parent.enabled ? MoneroComponents.Style.buttonBackgroundColor : MoneroComponents.Style.buttonBackgroundColorDisabled
opacity: 1 border.width: parent.focus ? 1 : 0
state: button.enabled ? "active" : "disabled" MouseArea {
Component.onCompleted: state = state anchors.fill: parent
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
states: [ propagateComposedEvents: true
State {
name: "hover" // possibly do some hover effects here
when: button.enabled && (buttonArea.containsMouse || button.focus) onEntered: {
PropertyChanges { // if(button.enabled) parent.color = Style.buttonBackgroundColorHover;
target: buttonRect // else parent.color = Style.buttonBackgroundColorDisabledHover;
color: primary }
? MoneroComponents.Style.buttonBackgroundColorHover onExited: {
: MoneroComponents.Style.buttonSecondaryBackgroundColorHover // if(button.enabled) parent.color = Style.buttonBackgroundColor;
} // else parent.color = Style.buttonBackgroundColorDisabled;
},
State {
name: "active"
when: button.enabled
PropertyChanges {
target: buttonRect
color: primary
? MoneroComponents.Style.buttonBackgroundColor
: MoneroComponents.Style.buttonSecondaryBackgroundColor
}
},
State {
name: "disabled"
when: !button.enabled
PropertyChanges {
target: buttonRect
opacity: 0.5
color: primary
? MoneroComponents.Style.buttonBackgroundColor
: MoneroComponents.Style.buttonSecondaryBackgroundColor
}
PropertyChanges {
target: label
opacity: 0.5
}
} }
]
transitions: Transition {
enabled: appWindow.themeTransition
ColorAnimation { duration: 100 }
} }
} }
RowLayout { Text {
id: buttonLayout id: label
height: button.height anchors.verticalCenter: parent.verticalCenter
spacing: 11 anchors.left: parent.left
anchors.right: parent.right
horizontalAlignment: textAlign === "center" ? Text.AlignHCenter : Text.AlignLeft
anchors.leftMargin: textAlign === "center" ? 0 : 11
font.family: MoneroComponents.Style.fontBold.name
font.bold: true
font.pixelSize: buttonArea.pressed ? button.fontSize - 1 : button.fontSize
color: parent.textColor
visible: parent.icon === ""
}
Image {
anchors.centerIn: parent anchors.centerIn: parent
visible: parent.icon !== ""
MoneroComponents.TextPlain { source: parent.icon
id: label
font.family: MoneroComponents.Style.fontBold.name
font.bold: button.primary ? true : false
font.pixelSize: button.fontSize
color: !buttonArea.pressed ? button.textColor : "transparent"
visible: text !== ""
themeTransition: false
MoneroComponents.TextPlain {
anchors.centerIn: parent
color: button.textColor
font.bold: label.font.bold
font.family: label.font.family
font.pixelSize: label.font.pixelSize - 1
text: label.text
opacity: buttonArea.pressed ? 1 : 0
themeTransition: false
}
}
Image {
visible: !fontAwesomeIcon && button.rightIcon !== ""
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
width: button.small ? 16 : 20
height: button.small ? 16 : 20
opacity: buttonRect.opacity
source: {
if (fontAwesomeIcon) return "";
if(button.rightIconInactive !== "" && !button.enabled) {
return button.rightIconInactive;
}
return button.rightIcon;
}
}
Text {
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
color: MoneroComponents.Style.defaultFontColor
font.family: FontAwesome.fontFamilySolid
font.pixelSize: button.small ? 16 : 20
font.styleName: "Solid"
text: button.rightIcon
visible: fontAwesomeIcon && button.rightIcon !== ""
}
} }
MoneroComponents.Tooltip { Image {
id: tooltip visible: parent.rightIcon !== ""
anchors.fill: parent anchors.right: parent.right
anchors.rightMargin: 11 * scaleRatio
anchors.verticalCenter: parent.verticalCenter
width: parent.small ? 16 * scaleRatio : 20 * scaleRatio
height: parent.small ? 16 * scaleRatio : 20 * scaleRatio
source: {
if(parent.rightIconInactive !== "" && !parent.enabled){
return parent.rightIconInactive;
}
return parent.rightIcon;
}
} }
MouseArea { MouseArea {
id: buttonArea id: buttonArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true
onClicked: doClick() onClicked: doClick()
onEntered: tooltip.text ? tooltip.tooltipPopup.open() : ""
onExited: tooltip.text ? tooltip.tooltipPopup.close() : ""
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
} }
Keys.enabled: button.visible
Keys.onSpacePressed: doClick() Keys.onSpacePressed: doClick()
Keys.onEnterPressed: Keys.onReturnPressed(event)
Keys.onReturnPressed: doClick() Keys.onReturnPressed: doClick()
} }

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,7 +26,7 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.0
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
@@ -34,7 +34,6 @@ import QtQuick.Controls.Styles 1.4
import QtQuick.Window 2.0 import QtQuick.Window 2.0
import "../components" as MoneroComponents import "../components" as MoneroComponents
import "effects/" as MoneroEffects
Rectangle { Rectangle {
id: root id: root
@@ -48,7 +47,6 @@ Rectangle {
property alias textArea: dialogContent property alias textArea: dialogContent
property alias okText: okButton.text property alias okText: okButton.text
property alias cancelText: cancelButton.text property alias cancelText: cancelButton.text
property alias closeVisible: closeButton.visible
property var icon property var icon
@@ -57,18 +55,12 @@ Rectangle {
signal rejected() signal rejected()
signal closeCallback(); signal closeCallback();
// background Image {
MoneroEffects.GradientBackground { anchors.left: parent.left
anchors.fill: parent anchors.right: parent.right
fallBackColor: MoneroComponents.Style.middlePanelBackgroundColor anchors.top: parent.top
initialStartColor: MoneroComponents.Style.middlePanelBackgroundGradientStart anchors.bottom: parent.bottom
initialStopColor: MoneroComponents.Style.middlePanelBackgroundGradientStop source: "../images/middlePanelBg.jpg"
blackColorStart: MoneroComponents.Style._b_middlePanelBackgroundGradientStart
blackColorStop: MoneroComponents.Style._b_middlePanelBackgroundGradientStop
whiteColorStart: MoneroComponents.Style._w_middlePanelBackgroundGradientStart
whiteColorStop: MoneroComponents.Style._w_middlePanelBackgroundGradientStop
start: Qt.point(0, 0)
end: Qt.point(height, width)
} }
// Make window draggable // Make window draggable
@@ -82,82 +74,70 @@ Rectangle {
function open() { function open() {
// Center // Center
root.x = parent.width/2 - root.width/2 if(!isMobile) {
root.y = 100 root.x = parent.width/2 - root.width/2
root.y = 100
}
show()
root.z = 11 root.z = 11
root.visible = true; root.visible = true;
} }
function close() { function close() {
root.visible = false; root.visible = false;
// reset button text
okButton.text = qsTr("OK")
cancelButton.text = qsTr("Cancel")
closeCallback(); closeCallback();
} }
// TODO: implement without hardcoding sizes // TODO: implement without hardcoding sizes
width: 520 width: isMobile ? screenWidth : 520
height: 380 height: isMobile ? screenHeight : 380
ColumnLayout { ColumnLayout {
id: mainLayout id: mainLayout
spacing: 10 spacing: 10
anchors.fill: parent anchors { fill: parent; margins: 15 }
anchors.margins: 20
RowLayout { RowLayout {
id: column id: column
Layout.topMargin: 14 //anchors {fill: parent; margins: 16 }
Layout.fillWidth: true Layout.topMargin: 14 * scaleRatio
Layout.alignment: Qt.AlignHCenter
MoneroComponents.Label { MoneroComponents.Label {
id: dialogTitle id: dialogTitle
fontSize: 18 horizontalAlignment: Text.AlignHCenter
fontSize: 18 * scaleRatio
fontFamily: "Arial" fontFamily: "Arial"
color: MoneroComponents.Style.defaultFontColor color: MoneroComponents.Style.defaultFontColor
} }
} }
Item { RowLayout {
Layout.fillHeight: true TextArea {
Layout.fillWidth: true id : dialogContent
Layout.preferredHeight: 240 Layout.fillWidth: true
Layout.fillHeight: true
renderType: Text.QtRendering
font.family: MoneroComponents.Style.fontLight.name
textFormat: TextEdit.AutoText
readOnly: true
font.pixelSize: 14 * scaleRatio
selectByMouse: false
wrapMode: TextEdit.Wrap
color: MoneroComponents.Style.defaultFontColor
Flickable { MouseArea {
id: flickable anchors.fill: parent
anchors.fill: parent onClicked: {
ScrollBar.vertical: ScrollBar { appWindow.showStatusMessage(qsTr("Double tap to copy"),3)
onActiveChanged: if (!active && !isMac) active = true }
} onDoubleClicked: {
boundsBehavior: isMac ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds parent.selectAll()
parent.copy()
TextArea.flickable: TextArea { parent.deselect()
id: dialogContent console.log("copied to clipboard");
Layout.fillWidth: true appWindow.showStatusMessage(qsTr("Content copied to clipboard"),3)
Layout.fillHeight: true
renderType: Text.QtRendering
font.family: MoneroComponents.Style.fontLight.name
textFormat: TextEdit.AutoText
readOnly: true
font.pixelSize: 14
selectByMouse: false
wrapMode: TextEdit.Wrap
color: MoneroComponents.Style.defaultFontColor
MouseArea {
anchors.fill: parent
onClicked: {
appWindow.showStatusMessage(qsTr("Double tap to copy"),3)
}
onDoubleClicked: {
parent.selectAll()
parent.copy()
parent.deselect()
console.log("copied to clipboard");
appWindow.showStatusMessage(qsTr("Content copied to clipboard"),3)
}
} }
} }
} }
@@ -171,7 +151,6 @@ Rectangle {
MoneroComponents.StandardButton { MoneroComponents.StandardButton {
id: cancelButton id: cancelButton
primary: false
text: qsTr("Cancel") + translationManager.emptyString text: qsTr("Cancel") + translationManager.emptyString
onClicked: { onClicked: {
root.close() root.close()
@@ -181,46 +160,17 @@ Rectangle {
MoneroComponents.StandardButton { MoneroComponents.StandardButton {
id: okButton id: okButton
text: qsTr("OK") + translationManager.emptyString text: qsTr("OK")
KeyNavigation.tab: cancelButton KeyNavigation.tab: cancelButton
onClicked: { onClicked: {
root.close() root.close()
root.accepted() root.accepted()
} }
} }
} }
} }
// close icon
Rectangle {
id: closeButton
anchors.top: parent.top
anchors.right: parent.right
width: 48
height: 48
color: "transparent"
MoneroEffects.ImageMask {
anchors.centerIn: parent
width: 16
height: 16
image: MoneroComponents.Style.titleBarCloseSource
color: MoneroComponents.Style.defaultFontColor
opacity: 0.75
}
MouseArea {
anchors.fill: parent
onClicked: {
root.close()
root.rejected()
}
cursorShape: Qt.PointingHandCursor
onEntered: closeButton.color = "#262626";
onExited: closeButton.color = "transparent";
}
}
// window borders // window borders
Rectangle{ Rectangle{
width: 1 width: 1

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,90 +26,78 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.0
import QtQuick.Controls 2.2
import QtGraphicalEffects 1.0
import FontAwesome 1.0
import QtQuick.Layouts 1.1
import "../components" as MoneroComponents import "../components" as MoneroComponents
import "../components/effects/" as MoneroEffects
ColumnLayout { Item {
id: dropdown id: dropdown
Layout.fillWidth: true
property int itemTopMargin: 0 property int itemTopMargin: 0
property alias dataModel: repeater.model property alias dataModel: repeater.model
property string shadowPressedColor property string shadowPressedColor
property string shadowReleasedColor property string shadowReleasedColor
property string pressedColor: MoneroComponents.Style.appWindowBorderColor property string pressedColor
property string releasedColor: MoneroComponents.Style.titleBarButtonHoverColor property string releasedColor
property string textColor: MoneroComponents.Style.defaultFontColor property string textColor: "#FFFFFF"
property alias currentIndex: columnid.currentIndex property alias currentIndex: column.currentIndex
readonly property alias expanded: popup.visible property bool expanded: false
property alias labelText: dropdownLabel.text property int dropdownHeight: 42
property alias labelColor: dropdownLabel.color property int fontHeaderSize: 16 * scaleRatio
property alias labelTextFormat: dropdownLabel.textFormat property int fontItemSize: 14 * scaleRatio
property alias labelWrapMode: dropdownLabel.wrapMode
property alias labelHorizontalAlignment: dropdownLabel.horizontalAlignment
property bool showingHeader: dropdownLabel.text !== ""
property int labelFontSize: 14
property bool labelFontBold: false
property int dropdownHeight: 39
property int fontSize: 14
property int fontItemSize: 14
property string colorBorder: MoneroComponents.Style.inputBorderColorInActive property string colorBorder: MoneroComponents.Style.inputBorderColorInActive
property string colorHeaderBackground: "transparent" property string colorHeaderBackground: "transparent"
property bool headerBorder: true property bool headerBorder: true
property bool headerFontBold: false property bool headerFontBold: false
height: dropdownHeight
signal changed(); signal changed();
onExpandedChanged: if(expanded) appWindow.currentItem = dropdown onExpandedChanged: if(expanded) appWindow.currentItem = dropdown
function hide() { dropdown.expanded = false }
spacing: 0 function containsPoint(px, py) {
Rectangle { if(px < 0)
id: dropdownLabelRect return false
color: "transparent" if(px > width)
Layout.fillWidth: true return false
height: (dropdownLabel.height + 10) if(py < 0)
visible: showingHeader ? true : false return false
if(py > height + droplist.height)
MoneroComponents.TextPlain { return false
id: dropdownLabel return true
anchors.top: parent.top
anchors.left: parent.left
font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: labelFontSize
font.bold: labelFontBold
textFormat: Text.RichText
color: MoneroComponents.Style.defaultFontColor
}
} }
Rectangle { // Workaroud for suspected memory leak in 5.8 causing malloc crash on app exit
id: head function update() {
color: dropArea.containsMouse ? MoneroComponents.Style.titleBarButtonHoverColor : "transparent" firstColText.text = column.currentIndex < repeater.model.rowCount() ? qsTr(repeater.model.get(column.currentIndex).column1) + translationManager.emptyString : ""
border.width: dropdown.headerBorder ? 1 : 0 }
border.color: dropdown.colorBorder
radius: 4
Layout.fillWidth: true
Layout.preferredHeight: dropdownHeight
MoneroComponents.TextPlain { Item {
id: head
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.topMargin: parent.itemTopMargin
height: dropdown.dropdownHeight
Rectangle {
color: dropdown.colorHeaderBackground
border.width: dropdown.headerBorder ? 1 : 0
border.color: dropdown.colorBorder
radius: 4
anchors.fill: parent
}
Text {
id: firstColText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 10 anchors.leftMargin: 12 * scaleRatio
anchors.right: dropIndicator.left
anchors.rightMargin: 12
width: droplist.width
elide: Text.ElideRight elide: Text.ElideRight
font.family: MoneroComponents.Style.fontRegular.name font.family: MoneroComponents.Style.fontRegular.name
font.bold: dropdown.headerFontBold font.bold: dropdown.headerFontBold
font.pixelSize: dropdown.fontSize font.pixelSize: dropdown.fontHeaderSize
color: dropdown.textColor color: "#FFFFFF"
text: columnid.currentIndex < repeater.model.count ? qsTr(repeater.model.get(columnid.currentIndex).column1) + translationManager.emptyString : ""
} }
Item { Item {
@@ -117,108 +105,131 @@ ColumnLayout {
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 12 width: 32 * scaleRatio
width: dropdownIcon.width
MoneroEffects.ImageMask { Image {
id: dropdownIcon
anchors.centerIn: parent anchors.centerIn: parent
image: "qrc:///images/whiteDropIndicator.png" source: "../images/whiteDropIndicator.png"
height: 8 rotation: dropdown.expanded ? 180 * scaleRatio : 0
width: 12
fontAwesomeFallbackIcon: FontAwesome.arrowDown
fontAwesomeFallbackSize: 14
color: MoneroComponents.Style.defaultFontColor
} }
} }
MouseArea { MouseArea {
id: dropArea id: dropArea
anchors.fill: parent anchors.fill: parent
onClicked: dropdown.expanded ? popup.close() : popup.open() onClicked: dropdown.expanded = !dropdown.expanded
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.ArrowCursor cursorShape: Qt.PointingHandCursor
} }
} }
Popup { Rectangle {
id: popup id: droplist
padding: 0 anchors.left: parent.left
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent anchors.right: parent.right
anchors.top: head.bottom
clip: true
height: dropdown.expanded ? column.height : 0
color: dropdown.pressedColor
//radius: 4
Rectangle { Rectangle {
id: droplist
anchors.left: parent.left anchors.left: parent.left
width: dropdown.width anchors.top: parent.top
y: head.y + head.height width: 3 * scaleRatio; height: 3 * scaleRatio
clip: true
height: dropdown.expanded ? columnid.height : 0
color: dropdown.pressedColor color: dropdown.pressedColor
}
Behavior on height { Rectangle {
NumberAnimation { duration: 100; easing.type: Easing.InQuad } anchors.right: parent.right
} anchors.top: parent.top
width: 3 * scaleRatio; height: 3 * scaleRatio
color: dropdown.pressedColor
}
Column { Behavior on height {
id: columnid NumberAnimation { duration: 100; easing.type: Easing.InQuad }
anchors.left: parent.left }
anchors.right: parent.right
anchors.top: parent.top
property int currentIndex: 0
Repeater { Column {
id: repeater id: column
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
property int currentIndex: 0
// Workaround for translations in listElements. All translated strings needs to be listed in this file. Repeater {
property string stringAutomatic: qsTr("Automatic") + translationManager.emptyString id: repeater
property string stringSlow: qsTr("Slow (x0.2 fee)") + translationManager.emptyString
property string stringNormal: qsTr("Normal (x1 fee)") + translationManager.emptyString
property string stringFast: qsTr("Fast (x5 fee)") + translationManager.emptyString
property string stringFastest: qsTr("Fastest (x200 fee)") + translationManager.emptyString
delegate: Rectangle { // Workaround for translations in listElements. All translated strings needs to be listed in this file.
property string stringLow: qsTr("Low (x1 fee)") + translationManager.emptyString
property string stringMedium: qsTr("Medium (x20 fee)") + translationManager.emptyString
property string stringHigh: qsTr("High (x166 fee)") + translationManager.emptyString
property string stringSlow: qsTr("Slow (x0.25 fee)") + translationManager.emptyString
property string stringDefault: qsTr("Default (x1 fee)") + translationManager.emptyString
property string stringFast: qsTr("Fast (x5 fee)") + translationManager.emptyString
property string stringFastest: qsTr("Fastest (x41.5 fee)") + translationManager.emptyString
property string stringAll: qsTr("All") + translationManager.emptyString
property string stringSent: qsTr("Sent") + translationManager.emptyString
property string stringReceived: qsTr("Received") + translationManager.emptyString
delegate: Rectangle {
anchors.left: parent.left
anchors.right: parent.right
height: (dropdown.dropdownHeight * 0.75) * scaleRatio
//radius: index === repeater.count - 1 ? 4 : 0
color: itemArea.containsMouse || index === column.currentIndex || itemArea.containsMouse ? dropdown.releasedColor : dropdown.pressedColor
Text {
id: col1Text
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
anchors.right: col2Text.left
anchors.leftMargin: 12 * scaleRatio
anchors.rightMargin: 0
font.family: MoneroComponents.Style.fontRegular.name
font.bold: true
font.pixelSize: fontItemSize
color: itemArea.containsMouse || index === column.currentIndex || itemArea.containsMouse ? "#FA6800" : "#FFFFFF"
text: qsTr(column1) + translationManager.emptyString
}
Text {
id: col2Text
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
height: (dropdown.dropdownHeight * 0.75) anchors.rightMargin: 45 * scaleRatio
//radius: index === repeater.count - 1 ? 4 : 0 font.family: MoneroComponents.Style.fontRegular.name
color: itemArea.containsMouse || index === columnid.currentIndex || itemArea.containsMouse ? dropdown.releasedColor : dropdown.pressedColor font.pixelSize: 14 * scaleRatio
color: "#FFFFFF"
text: ""
}
MoneroComponents.TextPlain { Rectangle {
id: col1Text anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter anchors.top: parent.top
anchors.left: parent.left width: 3 * scaleRatio; height: 3 * scaleRatio
anchors.right: col2Text.left color: parent.color
anchors.leftMargin: 12 }
anchors.rightMargin: 0
font.family: MoneroComponents.Style.fontRegular.name
font.bold: false
font.pixelSize: fontItemSize
color: itemArea.containsMouse || index === columnid.currentIndex || itemArea.containsMouse ? "#FA6800" : "#FFFFFF"
text: qsTr(column1) + translationManager.emptyString
}
MoneroComponents.TextPlain { Rectangle {
id: col2Text anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter anchors.top: parent.top
anchors.right: parent.right width: 3 * scaleRatio; height: 3 * scaleRatio
anchors.rightMargin: 45 color: parent.color
font.family: MoneroComponents.Style.fontRegular.name }
font.pixelSize: 14
color: "#FFFFFF"
text: ""
}
MouseArea { MouseArea {
id: itemArea id: itemArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.ArrowCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
popup.close() dropdown.expanded = false
columnid.currentIndex = index column.currentIndex = index
changed(); changed();
} dropdown.update()
} }
} }
} }

View File

@@ -3,207 +3,29 @@ pragma Singleton
import QtQuick 2.5 import QtQuick 2.5
QtObject { QtObject {
property bool blackTheme: true
property QtObject fontMedium: FontLoader { id: _fontMedium; source: "qrc:/fonts/Roboto-Medium.ttf"; } property QtObject fontMedium: FontLoader { id: _fontMedium; source: "qrc:/fonts/Roboto-Medium.ttf"; }
property QtObject fontBold: FontLoader { id: _fontBold; source: "qrc:/fonts/Roboto-Bold.ttf"; } property QtObject fontBold: FontLoader { id: _fontBold; source: "qrc:/fonts/Roboto-Bold.ttf"; }
property QtObject fontLight: FontLoader { id: _fontLight; source: "qrc:/fonts/Roboto-Light.ttf"; } property QtObject fontLight: FontLoader { id: _fontLight; source: "qrc:/fonts/Roboto-Light.ttf"; }
property QtObject fontRegular: FontLoader { id: _fontRegular; source: "qrc:/fonts/Roboto-Regular.ttf"; } property QtObject fontRegular: FontLoader { id: _fontRegular; source: "qrc:/fonts/Roboto-Regular.ttf"; }
property QtObject fontMonoMedium: FontLoader { id: _fontMonoMedium; source: "qrc:/fonts/RobotoMono-Medium.ttf"; }
property QtObject fontMonoBold: FontLoader { id: _fontMonoBold; source: "qrc:/fonts/RobotoMono-Bold.ttf"; }
property QtObject fontMonoLight: FontLoader { id: _fontMonoLight; source: "qrc:/fonts/RobotoMono-Light.ttf"; }
property QtObject fontMonoRegular: FontLoader { id: _fontMonoRegular; source: "qrc:/fonts/RobotoMono-Regular.ttf"; }
property string grey: "#404040" property string grey: "#404040"
property string orange: "#FF6C3C"
property string white: "#FFFFFF"
property string green: "#2EB358"
property string moneroGrey: "#4C4C4C"
property string warningColor: "orange"
property string defaultFontColor: blackTheme ? _b_defaultFontColor : _w_defaultFontColor property string defaultFontColor: "white"
property string dimmedFontColor: blackTheme ? _b_dimmedFontColor : _w_dimmedFontColor property string dimmedFontColor: "#BBBBBB"
property string lightGreyFontColor: blackTheme ? _b_lightGreyFontColor : _w_lightGreyFontColor property string inputBoxBackground: "black"
property string errorColor: blackTheme ? _b_errorColor : _w_errorColor property string inputBoxBackgroundError: "#FFDDDD"
property string textSelectionColor: blackTheme ? _b_textSelectionColor : _w_textSelectionColor property string inputBoxColor: "white"
property string textSelectedColor: blackTheme ? _b_textSelectedColor : _w_textSelectedColor property string legacy_placeholderFontColor: "#BABABA"
property string inputBorderColorActive: Qt.rgba(255, 255, 255, 0.38)
property string inputBorderColorInActive: Qt.rgba(255, 255, 255, 0.32)
property string inputBorderColorInvalid: Qt.rgba(255, 0, 0, 0.40)
property string inputBoxBackground: blackTheme ? _b_inputBoxBackground : _w_inputBoxBackground property string buttonBackgroundColor: "#FA6800"
property string inputBoxBackgroundDisabled: blackTheme ? _b_inputBoxBackgroundDisabled : _w_inputBoxBackgroundDisabled property string buttonBackgroundColorHover: "#E65E00"
property string inputBoxBackgroundError: blackTheme ? _b_inputBoxBackgroundError : _w_inputBoxBackgroundError property string buttonBackgroundColorDisabled: "#707070"
property string inputBoxColor: blackTheme ? _b_inputBoxColor : _w_inputBoxColor property string buttonBackgroundColorDisabledHover: "#808080"
property string legacy_placeholderFontColor: blackTheme ? _b_legacy_placeholderFontColor : _w_legacy_placeholderFontColor property string buttonTextColor: "white"
property string inputBorderColorActive: blackTheme ? _b_inputBorderColorActive : _w_inputBorderColorActive property string buttonTextColorDisabled: "black"
property string inputBorderColorInActive: blackTheme ? _b_inputBorderColorInActive : _w_inputBorderColorInActive property string dividerColor: "white"
property string inputBorderColorInvalid: blackTheme ? _b_inputBorderColorInvalid : _w_inputBorderColorInvalid property real dividerOpacity: 0.20
property string buttonBackgroundColor: blackTheme ? _b_buttonBackgroundColor : _w_buttonBackgroundColor
property string buttonBackgroundColorHover: blackTheme ? _b_buttonBackgroundColorHover : _w_buttonBackgroundColorHover
property string buttonBackgroundColorDisabled: blackTheme ? _b_buttonBackgroundColorDisabled : _w_buttonBackgroundColorDisabled
property string buttonBackgroundColorDisabledHover: blackTheme ? _b_buttonBackgroundColorDisabledHover : _w_buttonBackgroundColorDisabledHover
property string buttonInlineBackgroundColor: blackTheme ? _b_buttonInlineBackgroundColor : _w_buttonInlineBackgroundColor
property string buttonInlineBackgroundColorHover: blackTheme ? _b_buttonInlineBackgroundColorHover : _w_buttonInlineBackgroundColorHover
property string buttonTextColor: blackTheme ? _b_buttonTextColor : _w_buttonTextColor
property string buttonTextColorDisabled: blackTheme ? _b_buttonTextColorDisabled : _w_buttonTextColorDisabled
property string buttonSecondaryBackgroundColor: blackTheme ? _b_buttonSecondaryBackgroundColor : _w_buttonSecondaryBackgroundColor
property string buttonSecondaryBackgroundColorHover: blackTheme ? _b_buttonSecondaryBackgroundColorHover : _w_buttonSecondaryBackgroundColorHover
property string buttonSecondaryTextColor: blackTheme ? _b_buttonSecondaryTextColor : _w_buttonSecondaryTextColor
property string dividerColor: blackTheme ? _b_dividerColor : _w_dividerColor
property real dividerOpacity: blackTheme ? _b_dividerOpacity : _w_dividerOpacity
property string titleBarBackgroundGradientStart: blackTheme ? _b_titleBarBackgroundGradientStart : _w_titleBarBackgroundGradientStart
property string titleBarBackgroundGradientStop: blackTheme ? _b_titleBarBackgroundGradientStop : _w_titleBarBackgroundGradientStop
property string titleBarBackgroundBorderColor: blackTheme ? _b_titleBarBackgroundBorderColor : _w_titleBarBackgroundBorderColor
property string titleBarLogoSource: blackTheme ? _b_titleBarLogoSource : _w_titleBarLogoSource
property string titleBarMinimizeSource: blackTheme ? _b_titleBarMinimizeSource : _w_titleBarMinimizeSource
property string titleBarFullscreenSource: blackTheme ? _b_titleBarFullscreenSource : _w_titleBarFullscreenSource
property string titleBarCloseSource: blackTheme ? _b_titleBarCloseSource : _w_titleBarCloseSource
property string titleBarButtonHoverColor: blackTheme ? _b_titleBarButtonHoverColor : _w_titleBarButtonHoverColor
property string wizardBackgroundGradientStart: blackTheme ? _b_wizardBackgroundGradientStart : _w_wizardBackgroundGradientStart
property string middlePanelBackgroundGradientStart: blackTheme ? _b_middlePanelBackgroundGradientStart : _w_middlePanelBackgroundGradientStart
property string middlePanelBackgroundGradientStop: blackTheme ? _b_middlePanelBackgroundGradientStop : _w_middlePanelBackgroundGradientStop
property string middlePanelBackgroundColor: blackTheme ? _b_middlePanelBackgroundColor : _w_middlePanelBackgroundColor
property string menuButtonFallbackBackgroundColor: blackTheme ? _b_menuButtonFallbackBackgroundColor : _w_menuButtonFallbackBackgroundColor
property string menuButtonGradientStart: blackTheme ? _b_menuButtonGradientStart : _w_menuButtonGradientStart
property string menuButtonGradientStop: blackTheme ? _b_menuButtonGradientStop : _w_menuButtonGradientStop
property string menuButtonTextColor: blackTheme ? _b_menuButtonTextColor : _w_menuButtonTextColor
property string menuButtonImageRightColorActive: blackTheme ? _b_menuButtonImageRightColorActive : _w_menuButtonImageRightColorActive
property string menuButtonImageRightColor: blackTheme ? _b_menuButtonImageRightColor : _w_menuButtonImageRightColor
property string menuButtonImageRightSource: blackTheme ? _b_menuButtonImageRightSource : _w_menuButtonImageRightSource
property string menuButtonImageDotArrowSource: blackTheme ? _b_menuButtonImageDotArrowSource : _w_menuButtonImageDotArrowSource
property string inlineButtonTextColor: blackTheme ? _b_inlineButtonTextColor : _w_inlineButtonTextColor
property string inlineButtonBorderColor: blackTheme ? _b_inlineButtonBorderColor : _w_inlineButtonBorderColor
property string appWindowBackgroundColor: blackTheme ? _b_appWindowBackgroundColor : _w_appWindowBackgroundColor
property string appWindowBorderColor: blackTheme ? _b_appWindowBorderColor : _w_appWindowBorderColor
property bool progressBarProgressTextBold: blackTheme ? _b_progressBarProgressTextBold : _w_progressBarProgressTextBold
property string progressBarBackgroundColor: blackTheme ? _b_progressBarBackgroundColor : _w_progressBarBackgroundColor
property string leftPanelBackgroundGradientStart: blackTheme ? _b_leftPanelBackgroundGradientStart : _w_leftPanelBackgroundGradientStart
property string leftPanelBackgroundGradientStop: blackTheme ? _b_leftPanelBackgroundGradientStop : _w_leftPanelBackgroundGradientStop
property string historyHeaderTextColor: blackTheme ? _b_historyHeaderTextColor : _w_historyHeaderTextColor
property var accountColors: blackTheme ? _b_accountColors : _w_accountColors
property string _b_defaultFontColor: "white"
property string _b_dimmedFontColor: "#BBBBBB"
property string _b_lightGreyFontColor: "#DFDFDF"
property string _b_errorColor: "#FA6800"
property string _b_textSelectionColor: "#BBBBBB"
property string _b_textSelectedColor: "white"
property string _b_inputBoxBackground: "black"
property string _b_inputBoxBackgroundDisabled: Qt.rgba(255, 255, 255, 0.10)
property string _b_inputBoxBackgroundError: "#FFDDDD"
property string _b_inputBoxColor: "white"
property string _b_legacy_placeholderFontColor: "#BABABA"
property string _b_inputBorderColorActive: Qt.rgba(255, 255, 255, 0.38)
property string _b_inputBorderColorInActive: Qt.rgba(255, 255, 255, 0.32)
property string _b_inputBorderColorInvalid: Qt.rgba(255, 0, 0, 0.40)
property string _b_buttonBackgroundColor: "#FA6800"
property string _b_buttonBackgroundColorHover: "#E65E00"
property string _b_buttonBackgroundColorDisabled: "#707070"
property string _b_buttonBackgroundColorDisabledHover: "#808080"
property string _b_buttonInlineBackgroundColor: "#707070"
property string _b_buttonInlineBackgroundColorHover: "#808080"
property string _b_buttonTextColor: "white"
property string _b_buttonTextColorDisabled: "black"
property string _b_buttonSecondaryBackgroundColor: "#707070"
property string _b_buttonSecondaryBackgroundColorHover: "#808080"
property string _b_buttonSecondaryTextColor: "white"
property string _b_dividerColor: "white"
property real _b_dividerOpacity: 0.20
property string _b_titleBarBackgroundGradientStart: "#262626";
property string _b_titleBarBackgroundGradientStop: "#191919"
property string _b_titleBarBackgroundBorderColor: "#2f2f2f"
property string _b_titleBarLogoSource: "qrc:///images/titlebarLogo.png"
property string _b_titleBarMinimizeSource: "qrc:///images/minimize.svg"
property string _b_titleBarFullscreenSource: "qrc:///images/fullscreen.svg"
property string _b_titleBarCloseSource: "qrc:///images/close.svg"
property string _b_titleBarButtonHoverColor: "#10FFFFFF"
property string _b_wizardBackgroundGradientStart: "#1e1e1e"
property string _b_middlePanelBackgroundGradientStart: "#232323"
property string _b_middlePanelBackgroundGradientStop: "#101010"
property string _b_middlePanelBackgroundColor: "#181818"
property string _b_menuButtonFallbackBackgroundColor: "#09FFFFFF"
property string _b_menuButtonGradientStart: "#11FFFFFF"
property string _b_menuButtonGradientStop: "#00000000"
property string _b_menuButtonTextColor: "white"
property string _b_menuButtonImageRightColorActive: "white"
property string _b_menuButtonImageRightColor: "white"
property string _b_menuButtonImageRightSource: "qrc:///images/right.svg"
property string _b_menuButtonImageDotArrowSource: "qrc:///images/arrow-right-medium-white.png"
property string _b_inlineButtonTextColor: "white"
property string _b_inlineButtonBorderColor: "black"
property string _b_appWindowBackgroundColor: "white"
property string _b_appWindowBorderColor: "#313131"
property bool _b_progressBarProgressTextBold: true
property string _b_progressBarBackgroundColor: "#24FFFFFF"
property string _b_leftPanelBackgroundGradientStart: "#222222"
property string _b_leftPanelBackgroundGradientStop: "#1a1a1a"
property string _b_historyHeaderTextColor: "#C0C0C0"
property var _b_accountColors: ["#6E513C", "#842129", "#458421", "#742184", "#291DBE", "#846F21", "#217F84", "#696969"]
property string _w_defaultFontColor: "black"
property string _w_dimmedFontColor: "#3f3f3f"
property string _w_lightGreyFontColor: "#515151"
property string _w_errorColor: "#FA6800"
property string _w_textSelectionColor: "#BBBBBB"
property string _w_textSelectedColor: "black"
property string _w_inputBoxBackground: "white"
property string _w_inputBoxBackgroundDisabled: Qt.rgba(0, 0, 0, 0.20)
property string _w_inputBoxBackgroundError: "#FFDDDD"
property string _w_inputBoxColor: "black"
property string _w_legacy_placeholderFontColor: "#BABABA"
property string _w_inputBorderColorActive: Qt.rgba(0, 0, 0, 0.30)
property string _w_inputBorderColorInActive: Qt.rgba(0, 0, 0, 0.16)
property string _w_inputBorderColorInvalid: Qt.rgba(255, 0, 0, 0.50)
property string _w_buttonBackgroundColor: "#FA6800"
property string _w_buttonBackgroundColorHover: "#E65E00"
property string _w_buttonBackgroundColorDisabled: "#bbbbbb"
property string _w_buttonBackgroundColorDisabledHover: "#D1D1D1"
property string _w_buttonInlineBackgroundColor: "#d9d9d9"
property string _w_buttonInlineBackgroundColorHover: "#C8C8C8"
property string _w_buttonTextColor: "white"
property string _w_buttonTextColorDisabled: "black"
property string _w_buttonSecondaryBackgroundColor: "#d9d9d9"
property string _w_buttonSecondaryBackgroundColorHover: "#C8C8C8"
property string _w_buttonSecondaryTextColor: "#4d4d4d"
property string _w_dividerColor: "black"
property real _w_dividerOpacity: 0.20
property string _w_titleBarBackgroundGradientStart: "#fcfcfc"
property string _w_titleBarBackgroundGradientStop: "#FBFBFB"
property string _w_titleBarBackgroundBorderColor: "#DEDEDE"
property string _w_titleBarLogoSource: "qrc:///images/themes/white/titlebarLogo.png"
property string _w_titleBarMinimizeSource: "qrc:///images/themes/white/minimize.svg"
property string _w_titleBarFullscreenSource: "qrc:///images/themes/white/fullscreen.svg"
property string _w_titleBarCloseSource: "qrc:///images/themes/white/close.svg"
property string _w_titleBarButtonHoverColor: "#11000000"
property string _w_wizardBackgroundGradientStart: "white"
property string _w_middlePanelBackgroundGradientStart: "white"
property string _w_middlePanelBackgroundGradientStop: "#ededed"
property string _w_middlePanelBackgroundColor: "#f5f5f5"
property string _w_menuButtonFallbackBackgroundColor: "#09000000"
property string _w_menuButtonGradientStart: "#08000000"
property string _w_menuButtonGradientStop: "#10FFFFFF"
property string _w_menuButtonTextColor: "#787878"
property string _w_menuButtonImageRightSource: "qrc:///images/right.svg"
property string _w_menuButtonImageRightColorActive: "#FA6800"
property string _w_menuButtonImageRightColor: "#808080"
property string _w_menuButtonImageDotArrowSource: "qrc:///images/arrow-right-medium-white.png"
property string _w_inlineButtonTextColor: "#4d4d4d"
property string _w_inlineButtonBorderColor: "transparent"
property string _w_appWindowBackgroundColor: "black"
property string _w_appWindowBorderColor: "#dedede"
property bool _w_progressBarProgressTextBold: false
property string _w_progressBarBackgroundColor: "#24000000"
property string _w_leftPanelBackgroundGradientStart: "white"
property string _w_leftPanelBackgroundGradientStop: "#f5f5f5"
property string _w_historyHeaderTextColor: "#515151"
property var _w_accountColors: ["#6E513C", "#6E513C", "#842129", "#458421", "#742184", "#291DBE", "#846F21", "#217F84", "#696969"]
} }

View File

@@ -1,181 +0,0 @@
// Copyright (c) 2014-2024, 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.
import QtQuick 2.9
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.1
import moneroComponents.Clipboard 1.0
import "../components" as MoneroComponents
Rectangle {
id: root
x: parent.width/2 - root.width/2
y: parent.height/2 - root.height/2
// TODO: implement without hardcoding sizes
width: 580
height: 400
color: MoneroComponents.Style.blackTheme ? "black" : "white"
visible: false
radius: 10
border.color: MoneroComponents.Style.blackTheme ? Qt.rgba(255, 255, 255, 0.25) : Qt.rgba(0, 0, 0, 0.25)
border.width: 1
Keys.enabled: true
Keys.onEscapePressed: {
root.close()
root.rejected()
}
KeyNavigation.tab: doneButton
Clipboard { id: clipboard }
property var transactionID;
// same signals as Dialog has
signal accepted()
signal rejected()
function open(txid) {
root.transactionID = txid;
root.visible = true;
}
function close() {
root.visible = false;
}
ColumnLayout {
spacing: 10
anchors.fill: parent
anchors.margins: 25
ColumnLayout{
Layout.topMargin: 10
Layout.leftMargin: 0
Layout.fillWidth: true
Layout.alignment: Qt.AlignCenter
MoneroComponents.Label {
fontSize: 18
fontFamily: "Arial"
horizontalAlignment: Text.AlignHCenter
text: {
if (appWindow.viewOnly){
return qsTr("Transaction file successfully saved!") + translationManager.emptyString;
} else {
return qsTr("Transaction successfully sent!") + translationManager.emptyString;
}
}
}
}
Image {
id: successImage
Layout.alignment: Qt.AlignCenter
width: 140
height: 140
source: "qrc:///images/success.png"
SequentialAnimation{
running: successImage.visible
ScaleAnimator { target: successImage; from: 0.4; to: 1.3; duration: 125}
ScaleAnimator { target: successImage; from: 1.3; to: 1; duration: 80}
}
}
MoneroComponents.LineEditMulti {
visible: !appWindow.viewOnly
Layout.leftMargin: 25
Layout.rightMargin: 25
borderDisabled: true
readOnly: true
copyButton: true
wrapMode: Text.Wrap
labelText: qsTr("Transaction ID:") + translationManager.emptyString
text: root.transactionID ? root.transactionID : "";
fontSize: 16
}
MoneroComponents.LineEditMulti {
visible: appWindow.viewOnly
Layout.leftMargin: 25
borderDisabled: true
readOnly: true
wrapMode: Text.Wrap
labelText: qsTr("Transaction file location:") + translationManager.emptyString
text: walletManager.urlToLocalPath(saveTxDialog.fileUrl)
fontSize: 16
}
// view progress / open folder / done buttons
RowLayout {
id: buttons
spacing: 70
Layout.alignment: Qt.AlignBottom | Qt.AlignHCenter
Layout.fillWidth: true
Layout.preferredHeight: 50
MoneroComponents.StandardButton {
id: viewProgressButton
visible: !appWindow.viewOnly
text: qsTr("View progress") + translationManager.emptyString;
width: 200
primary: false
KeyNavigation.tab: doneButton
onClicked: {
doSearchInHistory(root.transactionID);
root.close()
root.rejected()
}
}
MoneroComponents.StandardButton {
id: openFolderButton
visible: appWindow.viewOnly
text: qsTr("Open folder") + translationManager.emptyString;
width: 200
KeyNavigation.tab: doneButton
onClicked: {
oshelper.openContainingFolder(walletManager.urlToLocalPath(saveTxDialog.fileUrl))
}
}
MoneroComponents.StandardButton {
id: doneButton
text: qsTr("Done") + translationManager.emptyString;
width: 200
focus: root.visible
KeyNavigation.tab: appWindow.viewOnly ? openFolderButton : viewProgressButton
onClicked: {
root.close()
root.accepted()
}
}
}
}
}

View File

@@ -0,0 +1,237 @@
// 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.
import QtQuick 2.0
Item {
id: dropdown
property bool expanded: false
property alias dataModel: repeater.model
signal collapsed()
signal optionClicked(int option)
width: 72
height: 37
onExpandedChanged: if(expanded) appWindow.currentItem = dropdown
function hide() { dropdown.expanded = false }
function containsPoint(px, py) {
if(px < 0)
return false
if(px > width)
return false
if(py < 0)
return false
if(py > height + dropArea.height)
return false
return true
}
Item {
id: head
anchors.fill: parent
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
height: parent.height - 1
y: dropdown.expanded || dropArea.height > 0 ? 0 : 1
//radius: 3
color: dropdown.expanded || dropArea.height > 0 ? "#888888" : "#DBDBDB"
}
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
height: parent.height - 1
y: dropdown.expanded || dropArea.height > 0 ? 1 : 0
//radius: 3
color: dropdown.expanded || dropArea.height > 0 ? "#DBDBDB" : "#F0EEEE"
}
Rectangle {
anchors.left: parent.left
anchors.bottom: parent.bottom
height: 3
width: 3
color: "#DBDBDB"
visible: dropdown.expanded || dropArea.height > 0
}
Rectangle {
anchors.right: parent.right
anchors.bottom: parent.bottom
height: 3
width: 3
color: "#DBDBDB"
visible: dropdown.expanded || dropArea.height > 0
}
Image {
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 10
source: "../images/tableOptions.png"
}
Rectangle {
anchors.centerIn: parent
anchors.horizontalCenterOffset: 1
height: 23
width: 1
color: dropdown.expanded || dropArea.height > 0 ? "#FFFFFF" : "#DBDBDB"
}
Image {
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: 10
source: "../images/dropIndicator.png"
}
}
Timer {
id: timer
interval: 50
repeat: true
running: false
onTriggered: {
if(((appWindow.toolTip.visible && !appWindow.toolTip.containsMouse) || !appWindow.toolTip.visible) && !mouseArea.containsMouse) {
appWindow.toolTip.visible = false
dropdown.expanded = false
currentIndex = -1
timer.stop()
}
}
}
MouseArea {
id: mouseArea
anchors.left: head.left
anchors.right: head.right
anchors.top: head.top
height: head.height + dropArea.height
hoverEnabled: true
onEntered: dropdown.expanded = true
property int currentIndex: -1
onMouseYChanged: {
if(mouseY > head.height) {
var posY = parseInt((mouseY - head.height) / 30)
currentIndex = posY
} else {
currentIndex = -1
}
}
onClicked: {
optionClicked(currentIndex)
}
onExited: timer.start()
preventStealing: true
z: 1
Item {
id: dropArea
anchors.left: parent.left
anchors.right: parent.right
y: head.height
height: dropdown.expanded ? column.height : 0
onHeightChanged: if(height === 0) dropdown.collapsed()
clip: true
Behavior on height {
NumberAnimation { duration: 100; easing.type: Easing.InQuad }
}
Column {
id: column
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
Repeater {
id: repeater
// Workaround for translations in listElements. All translated strings needs to be listed in this file.
property string stringCopy: qsTr("<b>Copy address to clipboard</b>") + translationManager.emptyString
property string stringSend: qsTr("<b>Send to this address</b>") + translationManager.emptyString
property string stringFind: qsTr("<b>Find similar transactions</b>") + translationManager.emptyString
property string stringRemove: qsTr("<b>Remove from address book</b>") + translationManager.emptyString
delegate: Rectangle {
id: delegate
property bool containsMouse: index === mouseArea.currentIndex
anchors.left: parent.left
anchors.right: parent.right
height: 30
color: containsMouse ? "#F0EEEE" : "#DBDBDB"
//radius: index === repeater.count - 1 ? 5 : 0
Rectangle {
anchors.left: parent.left
anchors.top: parent.top
width: 5
height: 5
color: delegate.color
}
Rectangle {
anchors.right: parent.right
anchors.top: parent.top
width: 5
height: 5
color: delegate.color
}
Image {
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 10
source: icon
}
onContainsMouseChanged: {
if(containsMouse) {
var pos = rootItem.mapFromItem(delegate, 30, -25)
appWindow.toolTip.text = qsTr(name) + translationManager.emptyString
appWindow.toolTip.x = pos.x - appWindow.toolTip.width
// if(appWindow.toolTip.height > 30)
// pos.y -= appWindow.toolTip.height - 30
appWindow.toolTip.y = pos.y
appWindow.toolTip.visible = true
appWindow.toolTip.z = 3
}
}
}
}
}
}
}
}

202
components/TableHeader.qml Normal file
View File

@@ -0,0 +1,202 @@
// 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.
import QtQuick 2.0
Rectangle {
id: header
signal sortRequest(bool desc, int column)
property alias dataModel: columnsRepeater.model
property int activeSortColumn: -1
property int offset: 0
height: 31
color: "transparent"
Rectangle{
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
width: 1
color: "#808080"
}
Rectangle{
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
width: 1
color: "#808080"
}
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
height: 1
color: "#808080"
}
Row {
id: row
anchors.horizontalCenter: parent.horizontalCenter
Rectangle {
height: 31
width: 1
color: "#808080"
}
Repeater {
id: columnsRepeater
// Workaround for translations in listElements. All translated strings needs to be listed in this file.
property string stringPaymentID: qsTr("Payment ID") + translationManager.emptyString
property string stringDate: qsTr("Date") + translationManager.emptyString
property string stringBlockHeight: qsTr("Block height") + translationManager.emptyString
property string stringAmount: qsTr("Amount") + translationManager.emptyString
delegate: Rectangle {
id: delegate
property bool desc: false
color: "transparent"
height: 31
width: columnWidth
Text {
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: -2
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 13
anchors.rightMargin: 13
elide: Text.ElideRight
font.family: "Arial"
font.pixelSize: 14
color: {
if(delegateArea.pressed)
return "#FF4304"
return index === header.activeSortColumn || delegateArea.containsMouse ? "white" : "#808080"
}
text: qsTr(columnName) + translationManager.emptyString
}
MouseArea {
id: delegateArea
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
delegate.desc = !delegate.desc
header.activeSortColumn = index
header.sortRequest(delegate.desc, index)
}
}
Row {
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.rightMargin: 9
Item {
width: 14
anchors.top: parent.top
anchors.bottom: parent.bottom
Image {
anchors.centerIn: parent
anchors.verticalCenterOffset: -2
source: {
if(descArea.pressed)
return "../images/descSortIndicatorPressed.png"
return index === header.activeSortColumn || descArea.containsMouse ? "../images/descSortIndicatorActived.png" :
"../images/descSortIndicator.png"
}
}
MouseArea {
id: descArea
hoverEnabled: true
anchors.fill: parent
onClicked: {
delegate.desc = true
header.activeSortColumn = index
header.sortRequest(delegate.desc, index)
}
}
}
Item {
width: 14
anchors.top: parent.top
anchors.bottom: parent.bottom
Image {
anchors.centerIn: parent
anchors.verticalCenterOffset: -3
source: {
if(ascArea.pressed)
return "../images/ascSortIndicatorPressed.png"
return index === header.activeSortColumn || ascArea.containsMouse ? "../images/ascSortIndicatorActived.png" :
"../images/ascSortIndicator.png"
}
}
MouseArea {
id: ascArea
hoverEnabled: true
anchors.fill: parent
onClicked: {
delegate.desc = false
header.activeSortColumn = index
header.sortRequest(delegate.desc, index)
}
}
}
}
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
height: 1
color: "transparent"
}
Rectangle {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right
width: 1
color: "#808080"
}
}
}
}
}

View File

@@ -1,11 +1,11 @@
import QtQuick 2.9 import QtQuick 2.0
import "../components" as MoneroComponents import "../components" as MoneroComponents
TextEdit { TextEdit {
color: MoneroComponents.Style.defaultFontColor color: MoneroComponents.Style.defaultFontColor
font.family: MoneroComponents.Style.fontRegular.name font.family: MoneroComponents.Style.fontRegular.name
selectionColor: MoneroComponents.Style.textSelectionColor selectionColor: MoneroComponents.Style.dimmedFontColor
wrapMode: Text.Wrap wrapMode: Text.Wrap
readOnly: true readOnly: true
selectByMouse: true selectByMouse: true

View File

@@ -1,46 +0,0 @@
import QtQuick 2.9
import "." as MoneroComponents
import "effects/" as MoneroEffects
Text {
// When using this component, please note that if you use a color different
// than `defaultFontColor`, you are required to also define `themeTransitionXColor`.
// If you do not set these the component will receive the wrong color after a transition.
// If you do not want to set these, use `themeTransition: false`.
id: root
property bool themeTransition: true
property string themeTransitionBlackColor: ""
property string themeTransitionWhiteColor: ""
property alias tooltip: tooltip.text
property alias tooltipLeft: tooltip.tooltipLeft
property alias tooltipIconVisible: tooltip.tooltipIconVisible
property alias tooltipPopup: tooltip.tooltipPopup
font.family: MoneroComponents.Style.fontMedium.name
font.bold: false
font.pixelSize: 14
textFormat: Text.PlainText
Rectangle {
width: root.contentWidth
height: root.height
anchors.left: parent.left
anchors.top: parent.top
color: root.focus ? MoneroComponents.Style.titleBarButtonHoverColor : "transparent"
}
MoneroEffects.ColorTransition {
enabled: root.themeTransition
themeTransition: root.themeTransition
targetObj: root
duration: 750
blackColor: root.themeTransitionBlackColor !== "" ? root.themeTransitionBlackColor : MoneroComponents.Style._b_defaultFontColor
whiteColor: root.themeTransitionWhiteColor !== "" ? root.themeTransitionWhiteColor : MoneroComponents.Style._w_defaultFontColor
}
MoneroComponents.Tooltip {
id: tooltip
anchors.top: parent.top
anchors.left: tooltipIconVisible ? parent.right : parent.left
}
}

View File

@@ -1,48 +0,0 @@
import QtQuick 2.9
import QtQuick.Controls 2.0
import "." as MoneroComponents
TextArea {
id: textArea
property bool themeTransition: true
property string colorWhiteTheme: ""
property string colorBlackTheme: ""
color: MoneroComponents.Style.defaultFontColor
font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 14
selectByMouse: false
wrapMode: Text.WordWrap;
textMargin: 0
leftPadding: 0
topPadding: 0
readOnly: true
textFormat: TextEdit.PlainText
states: [
State {
name: "black";
when: textArea.themeTransition && MoneroComponents.Style.blackTheme
PropertyChanges {
target: textArea
color: {
return textArea.colorBlackTheme ? textArea.colorBlackTheme : MoneroComponents.Style._b_defaultFontColor
}
}
}, State {
name: "white";
when: textArea.themeTransition && !MoneroComponents.Style.blackTheme
PropertyChanges {
target: textArea
color: {
return textArea.colorWhiteTheme ? textArea.colorWhiteTheme : MoneroComponents.Style._w_defaultFontColor
}
}
}
]
transitions: Transition {
enabled: appWindow.themeTransition
ColorAnimation { properties: "color"; easing.type: Easing.InOutQuad; duration: 750 }
}
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2021-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,41 +26,47 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.0
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.1
import "." as MoneroComponents import "../components" as MoneroComponents
Popup { Item {
id: dialog id: delegateItem
width: 1
height: 48
property bool mainTick: false
property int currentIndex
property int currentX
default property alias content: mainLayout.children Image {
property alias title: header.text anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
background: Rectangle { visible: parent.mainTick
border.color: MoneroComponents.Style.blackTheme ? Qt.rgba(255, 255, 255, 0.25) : Qt.rgba(0, 0, 0, 0.25) source: "../images/privacyTick.png"
border.width: 1
color: MoneroComponents.Style.blackTheme ? "black" : "white"
radius: 10
}
closePolicy: Popup.CloseOnEscape
focus: true
padding: 20
x: (appWindow.width - width) / 2
y: (appWindow.height - height) / 2
ColumnLayout {
id: mainLayout
spacing: dialog.padding
Text { Text {
id: header anchors.right: parent.right
color: MoneroComponents.Style.defaultFontColor anchors.rightMargin: 12
anchors.bottom: parent.bottom
anchors.bottomMargin: 2
font.family: "Arial"
font.bold: true font.bold: true
font.family: MoneroComponents.Style.fontRegular.name font.pixelSize: 12 * scaleRatio
font.pixelSize: 18 color: MoneroComponents.Style.defaultFontColor
visible: text != "" text: {
if(currentIndex === 0) return qsTr("Default") + translationManager.emptyString
if(currentIndex === 13) return qsTr("High") + translationManager.emptyString
return ""
}
} }
} }
Rectangle {
anchors.top: parent.top
anchors.topMargin: 14
width: 1
color: "#DBDBDB"
height: 8
visible: !parent.mainTick
}
} }

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,11 +26,9 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.2
import QtQuick.Window 2.1 import QtQuick.Window 2.1
import "../components" as MoneroComponents
Window { Window {
property alias text: content.text property alias text: content.text
property alias containsMouse: tipArea.containsMouse property alias containsMouse: tipArea.containsMouse
@@ -57,10 +55,10 @@ Window {
anchors.top: parent.bottom anchors.top: parent.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 5 anchors.leftMargin: 5
source: "qrc:///images/tip.png" source: "../images/tip.png"
} }
MoneroComponents.TextPlain { Text {
id: content id: content
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
y: 6 y: 6

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2024, The Monero Project // Copyright (c) 2014-2018, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -26,416 +26,219 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9 import QtQuick 2.5
import QtQuick.Window 2.0 import QtQuick.Window 2.0
import QtGraphicalEffects 1.0 import QtQuick.Layouts 1.1
import QtQuick.Layouts 1.2
import FontAwesome 1.0
import "." as MoneroComponents
import "effects/" as MoneroEffects
Rectangle { Rectangle {
id: root id: titleBar
property int mouseX: 0
property bool customDecorations: persistentSettings.customDecorations
property bool showMinimizeButton: true
property bool showMaximizeButton: true
property bool showCloseButton: true
property string walletName: ""
height: { height: {
if(!persistentSettings.customDecorations) return 0; if(!customDecorations || isMobile){
return 50; return 0;
} }
if(small) return 38 * scaleRatio;
else return 50 * scaleRatio;
}
y: -height
z: 1 z: 1
color: "transparent"
property string title
property int mouseX: 0
property bool containsMouse: false
property alias basicButtonVisible: goToBasicVersionButton.visible
property bool customDecorations: persistentSettings.customDecorations
property bool showWhatIsButton: true
property bool showMinimizeButton: false
property bool showMaximizeButton: false
property bool showCloseButton: true
property bool showMoneroLogo: false
property bool small: false
signal closeClicked signal closeClicked
signal maximizeClicked signal maximizeClicked
signal minimizeClicked signal minimizeClicked
signal languageClicked signal goToBasicVersion(bool yes)
signal closeWalletClicked
signal lockWalletClicked
state: "default" Item {
states: [ // Background gradient
State { width: parent.width
name: "default"; height: parent.height
PropertyChanges { target: btnCloseWallet; visible: true} z: parent.z + 1
PropertyChanges { target: btnLockWallet; visible: true}
PropertyChanges { target: btnLanguageToggle; visible: true} Image {
}, State { anchors.fill: parent
// show only theme switcher and window controls height: titleBar.height
name: "essentials"; width: titleBar.width
PropertyChanges { target: btnCloseWallet; visible: false} source: "../images/titlebarGradient.jpg"
PropertyChanges { target: btnLockWallet; visible: false}
PropertyChanges { target: btnLanguageToggle; visible: false}
} }
]
MoneroEffects.GradientBackground {
anchors.fill: parent
duration: 300
fallBackColor: MoneroComponents.Style.middlePanelBackgroundColor
initialStartColor: MoneroComponents.Style.titleBarBackgroundGradientStart
initialStopColor: MoneroComponents.Style.titleBarBackgroundGradientStop
blackColorStart: MoneroComponents.Style._b_titleBarBackgroundGradientStart
blackColorStop: MoneroComponents.Style._b_titleBarBackgroundGradientStop
whiteColorStart: MoneroComponents.Style._w_titleBarBackgroundGradientStart
whiteColorStop: MoneroComponents.Style._w_titleBarBackgroundGradientStop
start: Qt.point(width, 0)
end: Qt.point(0, 0)
} }
RowLayout { Item {
id: titlebarlogo
width: 125
height: parent.height
anchors.centerIn: parent
visible: customDecorations && showMoneroLogo
z: parent.z + 1
Image {
anchors.left: parent.left
anchors.top: parent.top
anchors.topMargin: 11
width: 125
height: 28
source: "../images/titlebarLogo.png"
}
}
Label {
id: titleLabel
visible: !showMoneroLogo && customDecorations && titleBar.title !== ''
anchors.centerIn: parent
fontSize: 18
text: titleBar.title
z: parent.z + 1
}
// collapse left panel
Rectangle {
id: goToBasicVersionButton
property bool containsMouse: titleBar.mouseX >= x && titleBar.mouseX <= x + width
property bool checked: false
anchors.top: parent.top
anchors.left: parent.left
color: "transparent"
height: titleBar.height
width: height
visible: isMobile
z: parent.z + 2
Image {
width: 14
height: 14
anchors.centerIn: parent
source: "../images/expand.png"
}
MouseArea {
id: basicMouseArea
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onEntered: goToBasicVersionButton.color = "#262626";
onExited: goToBasicVersionButton.color = "transparent";
onClicked: {
releaseFocus()
parent.checked = !parent.checked
titleBar.goToBasicVersion(leftPanel.visible)
}
}
}
Row {
id: row
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
visible: parent.customDecorations
z: parent.z + 2 z: parent.z + 2
spacing: 0
anchors.fill: parent
// lock wallet
Rectangle { Rectangle {
id: btnLockWallet id: minimizeButton
visible: showMinimizeButton
anchors.top: parent.top
anchors.bottom: parent.bottom
width: 42
color: "transparent" color: "transparent"
Layout.preferredWidth: parent.height
Layout.preferredHeight: parent.height
Text {
text: FontAwesome.lock
font.family: FontAwesome.fontFamilySolid
font.pixelSize: 16
color: MoneroComponents.Style.defaultFontColor
font.styleName: "Solid"
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
opacity: 0.75
}
MoneroComponents.Tooltip {
id: btnLockWalletTooltip
anchors.fill: parent
text: qsTr("Lock this wallet") + translationManager.emptyString
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onEntered: {
parent.color = MoneroComponents.Style.titleBarButtonHoverColor
btnLockWalletTooltip.tooltipPopup.open()
}
onExited: {
parent.color = "transparent"
btnLockWalletTooltip.tooltipPopup.close()
}
onClicked: root.lockWalletClicked(leftPanel.visible)
}
}
// collapse sidebar
Rectangle {
id: btnCloseWallet
color: "transparent"
Layout.preferredWidth: parent.height
Layout.preferredHeight: parent.height
Text {
text: FontAwesome.signOutAlt
font.family: FontAwesome.fontFamilySolid
font.pixelSize: 16
color: MoneroComponents.Style.defaultFontColor
font.styleName: "Solid"
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
opacity: 0.75
}
MoneroComponents.Tooltip {
id: btnCloseWalletTooltip
anchors.fill: parent
text: qsTr("Close this wallet and return to main menu") + translationManager.emptyString
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onEntered: {
parent.color = MoneroComponents.Style.titleBarButtonHoverColor
btnCloseWalletTooltip.tooltipPopup.open()
}
onExited: {
parent.color = "transparent"
btnCloseWalletTooltip.tooltipPopup.close()
}
onClicked: root.closeWalletClicked(leftPanel.visible)
}
}
// language selection
Rectangle {
id: btnLanguageToggle
color: "transparent"
Layout.preferredWidth: parent.height
Layout.preferredHeight: parent.height
Text {
text: FontAwesome.globe
font.family: FontAwesome.fontFamilySolid
font.pixelSize: 16
color: MoneroComponents.Style.defaultFontColor
font.styleName: "Solid"
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
opacity: 0.75
}
MoneroComponents.Tooltip {
id: btnLanguageToggleTooltip
anchors.fill: parent
text: qsTr("Change language") + translationManager.emptyString
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onEntered: {
parent.color = MoneroComponents.Style.titleBarButtonHoverColor
btnLanguageToggleTooltip.tooltipPopup.open()
}
onExited: {
parent.color = "transparent"
btnLanguageToggleTooltip.tooltipPopup.close()
}
onClicked: root.languageClicked()
}
}
// switch theme
Rectangle {
color: "transparent"
Layout.preferredWidth: parent.height
Layout.preferredHeight: parent.height
Text {
text: FontAwesome.moonO
font.family: MoneroComponents.Style.blackTheme ? FontAwesome.fontFamilySolid : FontAwesome.fontFamily
font.styleName: MoneroComponents.Style.blackTheme ? "Solid" : "Regular"
font.pixelSize: 15
color: MoneroComponents.Style.defaultFontColor
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
opacity: 0.75
}
MoneroComponents.Tooltip {
id: btnSwitchThemeTooltip
anchors.fill: parent
text: MoneroComponents.Style.blackTheme ? qsTr("Switch to light theme") : qsTr("Switch to dark theme") + translationManager.emptyString
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onEntered: {
parent.color = MoneroComponents.Style.titleBarButtonHoverColor
btnSwitchThemeTooltip.tooltipPopup.open()
}
onExited: {
parent.color = "transparent"
btnSwitchThemeTooltip.tooltipPopup.close()
}
onClicked: {
MoneroComponents.Style.blackTheme = !MoneroComponents.Style.blackTheme;
}
}
}
Item {
// make dummy space when hiding buttons when titlebar
// state is 'essentials' in order for the
// monero logo to still be centered
Layout.preferredWidth: parent.height * 2 // amount of buttons we hide
Layout.preferredHeight: parent.height
visible: root.state == "essentials"
}
// monero logo
Item {
visible: walletName.length === 0
Layout.fillWidth: true
Layout.preferredHeight: parent.height
Image { Image {
id: imgLogo anchors.centerIn: parent
width: 125 source: "../images/minimize.png"
height: 28
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
source: MoneroComponents.Style.titleBarLogoSource
visible: {
if(!isOpenGL) return true;
if(!MoneroComponents.Style.blackTheme) return true;
return false;
}
}
Colorize {
visible: isOpenGL && MoneroComponents.Style.blackTheme
anchors.fill: imgLogo
source: imgLogo
saturation: 0.0
}
}
Item {
visible: walletName.length > 0
Layout.fillWidth: true
Layout.preferredHeight: parent.height
MoneroComponents.TextPlain {
font.pixelSize: 20
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
width: parent.width
height: parent.height
elide: Text.ElideRight
text: walletName
}
}
// minimize
Rectangle {
color: "transparent"
visible: root.showMinimizeButton
Layout.preferredWidth: parent.height
Layout.preferredHeight: parent.height
MoneroEffects.ImageMask {
anchors.bottom: parent.bottom
anchors.bottomMargin: 18
anchors.horizontalCenter: parent.horizontalCenter
height: 3
width: 15
image: MoneroComponents.Style.titleBarMinimizeSource
color: MoneroComponents.Style.defaultFontColor
fontAwesomeFallbackIcon: FontAwesome.minus
fontAwesomeFallbackSize: 18
fontAwesomeFallbackOpacity: MoneroComponents.Style.blackTheme ? 0.8 : 0.6
opacity: 0.75
} }
MouseArea { MouseArea {
id: minimizeArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onEntered: parent.color = MoneroComponents.Style.titleBarButtonHoverColor onEntered: minimizeButton.color = "#262626";
onExited: parent.color = "transparent" onExited: minimizeButton.color = "transparent";
onClicked: root.minimizeClicked(); onClicked: minimizeClicked();
} }
} }
// maximize
Rectangle { Rectangle {
id: test id: maximizeButton
visible: root.showMaximizeButton visible: showMaximizeButton
color: "transparent" anchors.top: parent.top
Layout.preferredWidth: parent.height anchors.bottom: parent.bottom
Layout.preferredHeight: parent.height width: 42
color: "transparent";
Image { Image {
anchors.verticalCenter: parent.verticalCenter anchors.centerIn: parent
anchors.horizontalCenter: parent.horizontalCenter
source: MoneroComponents.Style.titleBarFullscreenSource
sourceSize.width: 16
sourceSize.height: 16
smooth: true
mipmap: true
opacity: 0.75
rotation: appWindow.visibility === Window.FullScreen ? 180 : 0
}
MouseArea {
id: buttonArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onEntered: parent.color = MoneroComponents.Style.titleBarButtonHoverColor
onExited: parent.color = "transparent"
onClicked: root.maximizeClicked();
}
}
// close
Rectangle {
visible: root.showCloseButton
color: "transparent"
Layout.preferredWidth: parent.height
Layout.preferredHeight: parent.height
MoneroEffects.ImageMask {
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
height: 16 height: 16
width: 16 width: 16
image: MoneroComponents.Style.titleBarCloseSource source: appWindow.visibility === Window.FullScreen ? "../images/backToWindowIcon.png" :
color: MoneroComponents.Style.defaultFontColor "../images/fullscreen.png"
fontAwesomeFallbackIcon: FontAwesome.times }
fontAwesomeFallbackSize: 21
fontAwesomeFallbackOpacity: MoneroComponents.Style.blackTheme ? 0.8 : 0.6 MouseArea {
opacity: 0.75 id: maximizeArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onEntered: maximizeButton.color = "#262626";
onExited: maximizeButton.color = "transparent";
onClicked: maximizeClicked();
}
}
Rectangle {
id: closeButton
visible: showCloseButton
anchors.top: parent.top
anchors.bottom: parent.bottom
width: 42
color: containsMouse ? "#E04343" : "#00000000"
Image {
anchors.centerIn: parent
width: 16
height: 16
source: "../images/close.png"
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: closeClicked();
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onEntered: parent.color = MoneroComponents.Style.titleBarButtonHoverColor onEntered: closeButton.color = "#262626";
onExited: parent.color = "transparent" onExited: closeButton.color = "transparent";
onClicked: root.closeClicked();
} }
} }
} }
// window borders
Rectangle {
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
height: 1
color: "#2F2F2F"
z: parent.z + 1
}
Rectangle { Rectangle {
z: parent.z + 3 anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
height: MoneroComponents.Style.blackTheme ? 1 : 1 anchors.left: parent.left
color: MoneroComponents.Style.titleBarBackgroundBorderColor visible: titleBar.small
height: 1
MoneroEffects.ColorTransition { color: "#2F2F2F"
targetObj: parent z: parent.z + 1
blackColor: MoneroComponents.Style._b_titleBarBackgroundBorderColor
whiteColor: MoneroComponents.Style._w_titleBarBackgroundBorderColor
}
}
MouseArea {
enabled: persistentSettings.customDecorations
property var previousPosition
anchors.fill: parent
propagateComposedEvents: true
onPressed: previousPosition = globalCursor.getPosition()
onDoubleClicked: root.maximizeClicked()
onPositionChanged: {
if (pressedButtons == Qt.LeftButton) {
var pos = globalCursor.getPosition()
var dx = pos.x - previousPosition.x
var dy = pos.y - previousPosition.y
appWindow.x += dx
appWindow.y += dy
previousPosition = pos
}
}
} }
} }

View File

@@ -1,112 +0,0 @@
// Copyright (c) 2021-2024, 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.
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.1
import FontAwesome 1.0
import "." as MoneroComponents
Rectangle {
property alias text: tooltip.text
property alias tooltipPopup: popup
property bool tooltipIconVisible: false
property bool tooltipLeft: false
property bool tooltipBottom: tooltipIconVisible ? false : true
color: "transparent"
height: tooltipIconVisible ? icon.height : parent.height
width: tooltipIconVisible ? icon.width : parent.width
visible: text != ""
Text {
id: icon
visible: tooltipIconVisible
color: MoneroComponents.Style.defaultFontColor
font.family: FontAwesome.fontFamily
font.pixelSize: 10
font.styleName: "Regular"
leftPadding: 5
rightPadding: 5
text: FontAwesome.questionCircle
opacity: mouseArea.containsMouse ? 0.7 : 1
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.WhatsThisCursor
onEntered: popup.open()
onExited: popup.close()
}
}
ToolTip {
id: popup
height: tooltip.height + 20
background: Rectangle {
border.color: MoneroComponents.Style.buttonInlineBackgroundColor
border.width: 1
color: MoneroComponents.Style.titleBarBackgroundGradientStart
radius: 4
}
closePolicy: Popup.NoAutoClose
padding: 10
x: tooltipLeft
? (tooltipIconVisible ? icon.x - icon.width : parent.x - tooltip.width - 20 + parent.width/2)
: (tooltipIconVisible ? icon.x + icon.width : parent.x + parent.width/2)
y: tooltipBottom
? (tooltipIconVisible ? icon.y + height : parent.y + parent.height + 2)
: (tooltipIconVisible ? icon.y - height : parent.y - tooltip.height - 20)
enter: Transition {
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; duration: 150 }
}
exit: Transition {
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duration: 150 }
}
delay: 200
RowLayout {
Layout.maximumWidth: 370
Text {
id: tooltip
width: contentWidth
Layout.maximumWidth: 370
color: MoneroComponents.Style.defaultFontColor
font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 12
textFormat: Text.RichText
wrapMode: Text.WordWrap
}
}
}
}

View File

@@ -1,441 +0,0 @@
// Copyright (c) 2014-2024, 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.
import QtQuick 2.9
import QtQuick.Controls 1.4 as QtQuickControls1
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.1
import "../components" as MoneroComponents
import FontAwesome 1.0
Rectangle {
id: root
property int margins: 25
x: parent.width/2 - root.width/2
y: parent.height/2 - root.height/2
// TODO: implement without hardcoding sizes
width: 590
height: layout.height + layout.anchors.margins * 2
color: MoneroComponents.Style.blackTheme ? "black" : "white"
visible: false
radius: 10
border.color: MoneroComponents.Style.blackTheme ? Qt.rgba(255, 255, 255, 0.25) : Qt.rgba(0, 0, 0, 0.25)
border.width: 1
Keys.enabled: true
Keys.onEscapePressed: {
root.close()
root.clearFields()
root.rejected()
}
KeyNavigation.tab: confirmButton
property var recipients: []
property var transactionAmount: ""
property var transactionDescription: ""
property var transactionFee: ""
property var transactionPriority: ""
property bool sweepUnmixable: false
property alias errorText: errorText
property alias confirmButton: confirmButton
property alias backButton: backButton
property alias bottomText: bottomText
property alias bottomTextAnimation: bottomTextAnimation
state: "default"
states: [
State {
// waiting for user action, show tx details + back and confirm buttons
name: "default";
when: errorText.text == "" && bottomText.text == ""
PropertyChanges { target: errorText; visible: false }
PropertyChanges { target: txAmountText; visible: root.transactionAmount !== "(all)" || (root.transactionAmount === "(all)" && currentWallet.isHwBacked() === true) }
PropertyChanges { target: txAmountBusyIndicator; visible: !txAmountText.visible }
PropertyChanges { target: txFiatAmountText; visible: txAmountText.visible && persistentSettings.fiatPriceEnabled && root.transactionAmount !== "(all)" }
PropertyChanges { target: txDetails; visible: true }
PropertyChanges { target: bottom; visible: true }
PropertyChanges { target: bottomMessage; visible: false }
PropertyChanges { target: buttons; visible: true }
PropertyChanges { target: backButton; visible: true; primary: false }
PropertyChanges { target: confirmButton; visible: true; focus: true }
}, State {
// error message being displayed, show only back button
name: "error";
when: errorText.text !== ""
PropertyChanges { target: dialogTitle; text: "Error" }
PropertyChanges { target: errorText; visible: true }
PropertyChanges { target: txAmountText; visible: false }
PropertyChanges { target: txAmountBusyIndicator; visible: false }
PropertyChanges { target: txFiatAmountText; visible: false }
PropertyChanges { target: txDetails; visible: false }
PropertyChanges { target: bottom; visible: true }
PropertyChanges { target: bottomMessage; visible: false }
PropertyChanges { target: buttons; visible: true }
PropertyChanges { target: backButton; visible: true; primary: true; focus: true }
PropertyChanges { target: confirmButton; visible: false }
}, State {
// creating or sending transaction, show tx details and don't show any button
name: "bottomText";
when: errorText.text == "" && bottomText.text !== ""
PropertyChanges { target: errorText; visible: false }
PropertyChanges { target: txAmountText; visible: root.transactionAmount !== "(all)" || (root.transactionAmount === "(all)" && currentWallet.isHwBacked() === true) }
PropertyChanges { target: txAmountBusyIndicator; visible: !txAmountText.visible }
PropertyChanges { target: txFiatAmountText; visible: txAmountText.visible && persistentSettings.fiatPriceEnabled && root.transactionAmount !== "(all)" }
PropertyChanges { target: txDetails; visible: true }
PropertyChanges { target: bottom; visible: true }
PropertyChanges { target: bottomMessage; visible: true }
PropertyChanges { target: buttons; visible: false }
}
]
// same signals as Dialog has
signal accepted()
signal rejected()
function open() {
root.visible = true;
//clean previous error message
errorText.text = "";
}
function close() {
root.visible = false;
}
function clearFields() {
root.recipients = [];
root.transactionAmount = "";
root.transactionDescription = "";
root.transactionFee = "";
root.transactionPriority = "";
root.sweepUnmixable = false;
}
function showFiatConversion(valueXMR) {
const fiatFee = fiatApiConvertToFiat(valueXMR);
return "%1 %2".arg(fiatFee < 0.01 ? "&lt;0.01" : "~" + fiatFee).arg(fiatApiCurrencySymbol());
}
ColumnLayout {
id: layout
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: parent.margins
spacing: 10
RowLayout {
Layout.topMargin: 10
Layout.fillWidth: true
MoneroComponents.Label {
id: dialogTitle
Layout.fillWidth: true
fontSize: 18
fontFamily: "Arial"
horizontalAlignment: Text.AlignHCenter
text: {
if (appWindow.viewOnly) {
return qsTr("Create transaction file") + translationManager.emptyString;
} else if (root.sweepUnmixable) {
return qsTr("Sweep unmixable outputs") + translationManager.emptyString;
} else {
return qsTr("Confirm send") + translationManager.emptyString;
}
}
}
}
Text {
id: errorText
Layout.fillWidth: true
Layout.fillHeight: true
color: MoneroComponents.Style.defaultFontColor
wrapMode: Text.Wrap
font.pixelSize: 15
}
ColumnLayout {
spacing: 0
Layout.fillWidth: true
Layout.preferredHeight: 71
QtQuickControls1.BusyIndicator {
id: txAmountBusyIndicator
Layout.fillHeight: true
Layout.fillWidth: true
running: root.transactionAmount == "(all)"
}
Text {
id: txAmountText
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
font.pixelSize: root.transactionAmount == "(all)" && currentWallet.isHwBacked() === true ? 32 : 42
color: MoneroComponents.Style.defaultFontColor
text: {
if (root.transactionAmount == "(all)" && currentWallet.isHwBacked() === true) {
return qsTr("All unlocked balance") + translationManager.emptyString;
} else {
return root.transactionAmount + " XMR " + translationManager.emptyString;
}
}
}
Text {
id: txFiatAmountText
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 20
color: MoneroComponents.Style.buttonSecondaryTextColor
text: showFiatConversion(transactionAmount) + translationManager.emptyString
}
}
GridLayout {
columns: 2
id: txDetails
Layout.fillWidth: true
columnSpacing: 15
rowSpacing: 16
Text {
color: MoneroComponents.Style.dimmedFontColor
text: qsTr("From") + ":" + translationManager.emptyString
font.pixelSize: 15
}
ColumnLayout {
Layout.fillWidth: true
spacing: 16
Text {
Layout.fillWidth: true
font.pixelSize: 15
color: MoneroComponents.Style.defaultFontColor
text: {
if (currentWallet) {
var walletTitle = function() {
if (currentWallet.isLedger()) {
return "Ledger";
} else if (currentWallet.isTrezor()) {
return "Trezor";
} else {
return qsTr("My wallet");
}
}
var walletName = appWindow.walletName;
if (appWindow.currentWallet.numSubaddressAccounts() > 1) {
var currentSubaddressAccount = currentWallet.currentSubaddressAccount;
var currentAccountLabel = currentWallet.getSubaddressLabel(currentWallet.currentSubaddressAccount, 0);
return walletTitle() + " (" + walletName + ")" + "<br>" + qsTr("Account #") + currentSubaddressAccount + (currentAccountLabel !== "" ? " (" + currentAccountLabel + ")" : "") + translationManager.emptyString;
} else {
return walletTitle() + " (" + walletName + ")" + translationManager.emptyString;
}
} else {
return "";
}
}
}
}
Text {
font.pixelSize: 15
color: MoneroComponents.Style.dimmedFontColor
text: qsTr("To") + ":" + translationManager.emptyString
}
Flickable {
id: flickable
property int linesInMultipleRecipientsMode: 7
Layout.fillWidth: true
Layout.preferredHeight: recipients.length > 1
? linesInMultipleRecipientsMode * (recipientsArea.contentHeight / recipientsArea.lineCount)
: recipientsArea.contentHeight
boundsBehavior: isMac ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
clip: true
TextArea.flickable: TextArea {
id : recipientsArea
color: MoneroComponents.Style.defaultFontColor
font.family: MoneroComponents.Style.fontMonoRegular.name
font.pixelSize: 14
topPadding: 0
bottomPadding: 0
leftPadding: 0
textMargin: 0
readOnly: true
selectByKeyboard: true
selectByMouse: true
selectionColor: MoneroComponents.Style.textSelectionColor
textFormat: TextEdit.RichText
wrapMode: TextEdit.Wrap
text: {
return recipients.map(function (recipient, index) {
var addressBookName = null;
if (currentWallet) {
addressBookName = currentWallet.addressBook.getDescription(recipient.address);
}
var title;
if (addressBookName) {
title = FontAwesome.addressBook + " " + addressBookName;
} else {
title = qsTr("Monero address") + translationManager.emptyString;
}
if (recipients.length > 1) {
title = "%1. %2 - %3 XMR".arg(index + 1).arg(title).arg(recipient.amount);
if (persistentSettings.fiatPriceEnabled) {
title += " (%1)".arg(showFiatConversion(recipient.amount));
}
}
const spacedaddress = recipient.address.match(/.{1,4}/g).join(' ');
return title + "<br>" + spacedaddress;
}).join("<br><br>");
}
}
ScrollBar.vertical: ScrollBar {
policy: recipientsArea.contentHeight > flickable.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
}
}
Text {
color: MoneroComponents.Style.dimmedFontColor
text: qsTr("Fee") + ":" + translationManager.emptyString
font.pixelSize: 15
}
RowLayout {
Layout.fillWidth: true
spacing: 16
Text {
property bool maliciousTxFee: parseFloat(root.transactionFee) > 0.01
color: maliciousTxFee ? "red" : MoneroComponents.Style.defaultFontColor
font.pixelSize: maliciousTxFee ? 20 : 15
text: {
if (currentWallet) {
if (!root.transactionFee) {
if (currentWallet.isHwBacked() === true) {
return qsTr("See on device") + translationManager.emptyString;
} else {
return qsTr("Calculating fee") + "..." + translationManager.emptyString;
}
} else {
return root.transactionFee + " XMR" + (maliciousTxFee ? " (HIGH FEE)" : "")
}
} else {
return "";
}
}
}
Text {
Layout.fillWidth: true
Layout.leftMargin: 8
color: MoneroComponents.Style.buttonSecondaryTextColor
visible: persistentSettings.fiatPriceEnabled && root.transactionFee
font.pixelSize: 15
text: showFiatConversion(root.transactionFee)
}
}
}
ColumnLayout {
id: bottom
Layout.alignment: Qt.AlignBottom | Qt.AlignHCenter
Layout.fillWidth: true
RowLayout {
id: bottomMessage
Layout.fillWidth: true
Layout.preferredHeight: 50
QtQuickControls1.BusyIndicator {
visible: !bottomTextAnimation.running
running: !bottomTextAnimation.running
scale: .5
}
Text {
id: bottomText
color: MoneroComponents.Style.defaultFontColor
text: ""
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
font.pixelSize: 17
opacity: 1
SequentialAnimation{
id:bottomTextAnimation
running: false
loops: Animation.Infinite
alwaysRunToEnd: true
NumberAnimation { target: bottomText; property: "opacity"; to: 0; duration: 500}
NumberAnimation { target: bottomText; property: "opacity"; to: 1; duration: 500}
}
}
}
RowLayout {
id: buttons
spacing: 70
Layout.fillWidth: true
Layout.preferredHeight: 50
MoneroComponents.StandardButton {
id: backButton
text: qsTr("Back") + translationManager.emptyString;
width: 200
primary: false
KeyNavigation.tab: confirmButton
onClicked: {
root.close()
root.clearFields()
root.rejected()
}
}
MoneroComponents.StandardButton {
id: confirmButton
text: qsTr("Confirm") + translationManager.emptyString;
rightIcon: "qrc:///images/rightArrow.png"
width: 200
KeyNavigation.tab: backButton
onClicked: {
root.close()
root.accepted()
}
}
}
}
}
}

View File

@@ -1,204 +0,0 @@
// Copyright (c) 2020-2024, 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.
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.1
import moneroComponents.Downloader 1.0
import "../components" as MoneroComponents
Popup {
id: updateDialog
property bool active: false
property bool allowed: true
property string error: ""
property string filename: ""
property string hash: ""
property double progress: url && downloader.total > 0 ? downloader.loaded * 100 / downloader.total : 0
property string url: ""
property bool valid: false
property string version: ""
background: Rectangle {
border.color: MoneroComponents.Style.appWindowBorderColor
border.width: 1
color: MoneroComponents.Style.middlePanelBackgroundColor
}
closePolicy: Popup.NoAutoClose
padding: 20
visible: active && allowed
function show(version, url, hash) {
updateDialog.error = "";
updateDialog.hash = hash;
updateDialog.url = url;
updateDialog.valid = false;
updateDialog.version = version;
updateDialog.active = true;
}
ColumnLayout {
id: mainLayout
spacing: updateDialog.padding
Text {
color: MoneroComponents.Style.defaultFontColor
font.bold: true
font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 18
text: qsTr("New Monero version v%1 is available.").arg(updateDialog.version)
}
Text {
id: errorText
color: "red"
font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 18
text: updateDialog.error
visible: text
}
Text {
id: statusText
color: updateDialog.valid ? MoneroComponents.Style.green : MoneroComponents.Style.defaultFontColor
font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 18
visible: !errorText.visible
text: {
if (!updateDialog.url) {
return qsTr("Please visit getmonero.org for details") + translationManager.emptyString;
}
if (downloader.active) {
return "%1 (%2%)"
.arg(qsTr("Downloading"))
.arg(updateDialog.progress.toFixed(1))
+ translationManager.emptyString;
}
if (updateDialog.valid) {
return qsTr("Update downloaded, signature verified") + translationManager.emptyString;
}
return qsTr("Do you want to download and verify new version?") + translationManager.emptyString;
}
}
Rectangle {
id: progressBar
color: MoneroComponents.Style.lightGreyFontColor
height: 3
Layout.fillWidth: true
visible: updateDialog.valid || downloader.active
Rectangle {
color: MoneroComponents.Style.buttonBackgroundColor
height: parent.height
width: parent.width * updateDialog.progress / 100
}
}
RowLayout {
Layout.alignment: Qt.AlignRight
spacing: parent.spacing
MoneroComponents.StandardButton {
id: cancelButton
fontBold: false
primary: !updateDialog.url
text: {
if (!updateDialog.url) {
return qsTr("Ok") + translationManager.emptyString;
}
if (updateDialog.valid || downloader.active || errorText.visible) {
return qsTr("Cancel") + translationManager.emptyString;
}
return qsTr("Download later") + translationManager.emptyString;
}
onClicked: {
downloader.cancel();
updateDialog.active = false;
}
}
MoneroComponents.StandardButton {
id: downloadButton
KeyNavigation.tab: cancelButton
fontBold: false
text: (updateDialog.error ? qsTr("Retry") : qsTr("Download")) + translationManager.emptyString
visible: updateDialog.url && !updateDialog.valid && !downloader.active
onClicked: {
updateDialog.error = "";
updateDialog.filename = updateDialog.url.replace(/^.*\//, '');
const downloadingStarted = downloader.get(updateDialog.url, updateDialog.hash, function(error) {
if (error) {
console.error("Download failed", error);
updateDialog.error = qsTr("Download failed") + translationManager.emptyString;
} else {
updateDialog.valid = true;
}
});
if (!downloadingStarted) {
updateDialog.error = qsTr("Failed to start download") + translationManager.emptyString;
}
}
}
MoneroComponents.StandardButton {
id: saveButton
KeyNavigation.tab: cancelButton
fontBold: false
onClicked: {
const fullPath = oshelper.openSaveFileDialog(
qsTr("Save as") + translationManager.emptyString,
oshelper.downloadLocation(),
updateDialog.filename);
if (!fullPath) {
return;
}
if (downloader.saveToFile(fullPath)) {
cancelButton.clicked();
oshelper.openContainingFolder(fullPath);
} else {
updateDialog.error = qsTr("Save operation failed") + translationManager.emptyString;
}
}
text: qsTr("Save to file") + translationManager.emptyString
visible: updateDialog.valid
}
}
}
Downloader {
id: downloader
proxyAddress: persistentSettings.getProxyAddress()
}
}

View File

@@ -1,4 +1,4 @@
import QtQuick 2.9 import QtQuick 2.7
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
@@ -7,13 +7,12 @@ import "." as MoneroComponents
Rectangle { Rectangle {
id: root id: root
property alias text: content.text property alias text: content.text
property alias textColor: content.color property int fontSize: 15 * scaleRatio
property int fontSize: 15
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: warningLayout.height Layout.preferredHeight: warningLayout.height
color: MoneroComponents.Style.titleBarButtonHoverColor color: "#09FFFFFF"
radius: 4 radius: 4
border.color: MoneroComponents.Style.inputBorderColorInActive border.color: MoneroComponents.Style.inputBorderColorInActive
border.width: 1 border.width: 1
@@ -30,32 +29,34 @@ Rectangle {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
Layout.preferredHeight: 33 Layout.preferredHeight: 33
Layout.preferredWidth: 33 Layout.preferredWidth: 33
Layout.rightMargin: 12 Layout.rightMargin: 14
Layout.leftMargin: 18 Layout.leftMargin: 14
Layout.topMargin: 12 Layout.topMargin: 12
Layout.bottomMargin: 12 Layout.bottomMargin: 12
source: "qrc:///images/warning.png" source: "../images/warning.png"
} }
Text { TextArea {
id: content id: content
Layout.fillWidth: true Layout.fillWidth: true
color: MoneroComponents.Style.defaultFontColor color: MoneroComponents.Style.defaultFontColor
font.family: MoneroComponents.Style.fontRegular.name font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: root.fontSize font.pixelSize: root.fontSize
horizontalAlignment: TextInput.AlignLeft horizontalAlignment: TextInput.AlignLeft
selectByMouse: false
textFormat: Text.RichText textFormat: Text.RichText
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
leftPadding: 4 textMargin: 0
rightPadding: 18 leftPadding: 0
topPadding: 10 topPadding: 6
bottomPadding: 10 readOnly: true
onLinkActivated: root.linkActivated(); onLinkActivated: root.linkActivated();
// @TODO: Legacy. Remove after Qt 5.8.
// https://stackoverflow.com/questions/41990013
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.NoButton enabled: false
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
} }
} }
} }

View File

@@ -1,58 +0,0 @@
// Copyright (c) 2014-2024, 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.
import QtQuick 2.9
import QtGraphicalEffects 1.0
import "../" as MoneroComponents
Item {
id: root
property var targetObj
property string blackColor: ""
property string whiteColor: ""
property int duration: 300
property bool themeTransition: true
states: [
State {
name: "black";
when: MoneroComponents.Style.blackTheme && root.themeTransition
PropertyChanges { target: root.targetObj; color: root.blackColor}
}, State {
name: "white";
when: !MoneroComponents.Style.blackTheme && root.themeTransition
PropertyChanges { target: root.targetObj; color: root.whiteColor}
}
]
transitions: Transition {
enabled: appWindow.themeTransition
ColorAnimation { properties: "color"; easing.type: Easing.InOutQuad; duration: root.duration }
}
}

View File

@@ -1,107 +0,0 @@
// Copyright (c) 2014-2024, 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.
import QtQuick 2.9
import QtGraphicalEffects 1.0
import "../" as MoneroComponents
Item {
id: root
property string fallBackColor: ""
property string blackColorStart: ""
property string blackColorStop: ""
property string whiteColorStart: ""
property string whiteColorStop: ""
property string initialStartColor: ""
property string initialStopColor: ""
property double posStart: 0.1
property double posStop: 1.0
property int duration: 300
property variant start
property variant end
anchors.fill: parent
// background software renderer
Rectangle {
visible: !isOpenGL
anchors.fill: parent
color: root.fallBackColor
}
// background opengl
LinearGradient {
visible: isOpenGL
anchors.fill: parent
start: root.start
end: root.end
gradient: Gradient {
GradientStop {
id: gradientStart
position: root.posStart
color: root.initialStartColor
}
GradientStop {
id: gradientStop
position: root.posStop
color: root.initialStopColor
}
}
states: [
State {
name: "black";
when: isOpenGL && MoneroComponents.Style.blackTheme
PropertyChanges {
target: gradientStart
color: root.blackColorStart
}
PropertyChanges {
target: gradientStop
color: root.blackColorStop
}
}, State {
name: "white";
when: isOpenGL && !MoneroComponents.Style.blackTheme
PropertyChanges {
target: gradientStart
color: root.whiteColorStart
}
PropertyChanges {
target: gradientStop
color: root.whiteColorStop
}
}
]
transitions: Transition {
enabled: appWindow.themeTransition
ColorAnimation { properties: "color"; easing.type: Easing.InOutQuad; duration: root.duration }
}
}
}

Some files were not shown because too many files have changed in this diff Show More