mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-09 13:56:10 +00:00
81c3463816
The enforcing of the derivation path editing rules is done in a structured way by handling all the changes on the array of `Element` stored in d.elements and then recomposing the HTML string to be displayed after every change. Main limitation is the workaround in `onTextChanged` that regenerates the text in order to dismiss foreign characters introduced by pasting which I couldn't find a way to disable without disabling also the ability to copy content to clipboard. Highlights: - Implement DerivationPathInput control that intercepts the modifiable keyboard events in order to edit the visible TextEdit.text while respecting the requirements of the derivation path editing - Implement a JS Controller that handles the logic of the decomposing and recomposing the derivation path string - Add anew StatusQ with the TextEdit basic look and feel to be used in DerivationPathInput control without duplicating the style - Allow passing modifiable events that are not generating characters in order to allow copy to clipboard - Disable add account when control is in error state - Limit to maximum 5 elements in the derivation path Testing: - Integrate the control with StoryBook for a quick preview of the control - Add unit tests for the Controller basic functionality and regression for the main control Item - Removed forcing x64 architecture on apple arm64 hardware from the storybook build configuration Note: initially the implementation was suppose to be simple parse the derivation path string edit elements and format it. However, I could not find a quick way fix the circular dependency issue between editing the text and reformatting it. The solution was to use a one way from the structured data to the formatted string which complicates the implementation logic. Closes: #9890
109 lines
3.4 KiB
CMake
109 lines
3.4 KiB
CMake
cmake_minimum_required(VERSION 3.19)
|
|
project(Storybook)
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
set(CMAKE_AUTOUIC ON)
|
|
set(CMAKE_AUTOMOC ON)
|
|
set(CMAKE_AUTORCC ON)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
if (APPLE)
|
|
set(MACOS_VERSION_MIN_FLAGS -mmacosx-version-min=10.14)
|
|
endif()
|
|
|
|
find_package(
|
|
Qt5
|
|
COMPONENTS Core Quick QuickControls2 Test QuickTest Qml
|
|
REQUIRED)
|
|
|
|
include (../ui/StatusQ/StatusQSources.cmake)
|
|
|
|
file(GLOB_RECURSE CORE_QML_FILES
|
|
"../ui/StatusQ/*.qml" "../ui/app/*.qml" "../ui/imports/*.qml"
|
|
"../ui/StatusQ/*/qmldir" "../ui/app/*/qmldir" "../ui/imports/*/qmldir"
|
|
)
|
|
|
|
file(GLOB_RECURSE CORE_JS_FILES "../ui/StatusQ/*.js" "../ui/app/*.js")
|
|
|
|
file(GLOB_RECURSE STORYBOOK_QML_FILES "stubs/*.qml" "mocks/*.qml" "pages/*.qml"
|
|
"src/*.qml" "src/qmldir")
|
|
|
|
file(GLOB_RECURSE TEST_QML_FILES "qmlTests/*.qml")
|
|
|
|
set(PROJECT_LIB "${PROJECT_NAME}Lib")
|
|
|
|
add_library(${PROJECT_LIB}
|
|
cachecleaner.cpp cachecleaner.h
|
|
directorieswatcher.cpp directorieswatcher.h
|
|
figmadecoratormodel.cpp figmadecoratormodel.h
|
|
figmaio.cpp figmaio.h
|
|
figmalinks.cpp figmalinks.h
|
|
figmalinksmodel.cpp figmalinksmodel.h
|
|
figmalinkssource.cpp figmalinkssource.h
|
|
modelutils.cpp modelutils.h
|
|
sectionsdecoratormodel.cpp sectionsdecoratormodel.h
|
|
${STATUSQ_HEADERS} ${STATUSQ_SOURCES}
|
|
)
|
|
|
|
target_include_directories(${PROJECT_LIB} PUBLIC ${STATUSQ_DIR}/include)
|
|
|
|
add_executable(
|
|
${PROJECT_NAME}
|
|
main.cpp
|
|
main.qml PagesModel.qml
|
|
${CORE_QML_FILES}
|
|
${CORE_JS_FILES}
|
|
${STORYBOOK_QML_FILES}
|
|
figma.json
|
|
README.md
|
|
)
|
|
|
|
target_compile_definitions(${PROJECT_NAME}
|
|
PRIVATE QML_IMPORT_ROOT="${CMAKE_CURRENT_LIST_DIR}")
|
|
|
|
target_link_libraries(
|
|
${PROJECT_LIB} PUBLIC Qt5::Core Qt5::Quick Qt5::QuickControls2)
|
|
target_link_libraries(
|
|
${PROJECT_NAME} PRIVATE ${PROJECT_LIB} SortFilterProxyModel)
|
|
|
|
enable_testing()
|
|
|
|
add_executable(SectionsDecoratorModelTest tests/tst_SectionsDecoratorModel.cpp)
|
|
target_link_libraries(SectionsDecoratorModelTest PRIVATE Qt5::Test ${PROJECT_LIB})
|
|
add_test(NAME SectionsDecoratorModelTest COMMAND SectionsDecoratorModelTest)
|
|
|
|
add_executable(FigmaDecoratorModelTest tests/tst_FigmaDecoratorModel.cpp)
|
|
target_link_libraries(FigmaDecoratorModelTest PRIVATE Qt5::Test ${PROJECT_LIB})
|
|
add_test(NAME FigmaModelTest COMMAND FigmaModelTest)
|
|
|
|
add_executable(QmlTests
|
|
qmlTests/main.cpp
|
|
qmlTests/src/TextUtils.cpp qmlTests/src/TextUtils.h
|
|
${TEST_QML_FILES})
|
|
target_compile_definitions(QmlTests
|
|
PRIVATE QML_IMPORT_ROOT="${CMAKE_CURRENT_LIST_DIR}"
|
|
PRIVATE -DQUICK_TEST_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/qmlTests")
|
|
target_link_libraries(QmlTests PRIVATE Qt5::QuickTest Qt5::Qml ${PROJECT_LIB})
|
|
add_test(NAME QmlTests COMMAND QmlTests)
|
|
|
|
list(APPEND QML_DIRS "${CMAKE_SOURCE_DIR}/../ui/StatusQ/src")
|
|
list(APPEND QML_DIRS "${CMAKE_SOURCE_DIR}/../ui/app")
|
|
list(APPEND QML_DIRS "${CMAKE_SOURCE_DIR}/../ui/imports")
|
|
list(APPEND QML_DIRS "${CMAKE_SOURCE_DIR}/src")
|
|
list(APPEND QML_DIRS "${CMAKE_SOURCE_DIR}/pages")
|
|
list(APPEND QML_DIRS "${CMAKE_SOURCE_DIR}/stubs")
|
|
list(APPEND QML_DIRS "${CMAKE_SOURCE_DIR}/mocks")
|
|
set(QML_IMPORT_PATH "${QML_DIRS}" CACHE STRING "Qt Creator extra QML import paths" FORCE)
|
|
|
|
if (APPLE)
|
|
find_library(AppKit AppKit)
|
|
find_library(Foundation Foundation)
|
|
|
|
target_link_libraries(${PROJECT_LIB} PRIVATE ${AppKit} ${Foundation})
|
|
endif()
|
|
|
|
add_subdirectory(../vendor/SortFilterProxyModel ./SortFilterProxyModel)
|