Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numerous Qt fixes, qml refactoring, translation escape fixes #1012

Open
wants to merge 57 commits into
base: qml
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
4528e44
.gitignore: Add vscode related files
iamsergio Feb 3, 2025
fb55183
Introduce qmlcomponents/ImPopup.qml
iamsergio Feb 3, 2025
d04dbc4
UseSavedSettingsPopup: Fix warnings about unqualified accesses
iamsergio Feb 3, 2025
75218ca
Merge pull request #9 from iamsergio/popups
iamsergio Feb 4, 2025
dbb8d89
Split OptionsPopup.qml into multiple files
iamsergio Feb 4, 2025
0216d5d
ci: Add a .qmllint.ini file
iamsergio Feb 4, 2025
b48531b
Make each option tab inherit from OptionsTabBase.qml
iamsergio Feb 4, 2025
449a232
Fix undefined behaviour regarding layouting
iamsergio Feb 4, 2025
fe93fda
Make options popup modal
iamsergio Feb 5, 2025
263540c
Remove unused imports and make the warning fatal
iamsergio Feb 4, 2025
5d1e494
Fix 2 unqualified access in OptionsPopup
iamsergio Feb 5, 2025
839e205
Merge pull request #11 from iamsergio/layoutwarnings
iamsergio Feb 5, 2025
d45d0be
Merge pull request #12 from iamsergio/options
iamsergio Feb 5, 2025
fb10bca
Use qt_add_qml_module
iamsergio Feb 5, 2025
67e5337
Register our C++ types
iamsergio Feb 5, 2025
1a65536
Add a Style singleton
iamsergio Feb 5, 2025
c845ffe
Split main.qml into multiple files
iamsergio Feb 6, 2025
77cf642
Make the 3 main popups inherit a common base
iamsergio Feb 6, 2025
39a1207
fix unqualified usage of hostname field
iamsergio Feb 6, 2025
2f0ec8b
Share code between the main popup list views
iamsergio Feb 6, 2025
81aab86
Fix qmllint warnings
iamsergio Feb 6, 2025
1613373
Fix vscode (or other qmlls clients)
iamsergio Feb 6, 2025
1dcc8e7
fix DnD errors and warnings
iamsergio Feb 6, 2025
0e1a21f
Fix remaining qmllint warnings
iamsergio Feb 7, 2025
1d16bb9
update src/.gitignore
iamsergio Feb 7, 2025
fa88766
qmllint: Bump all lints to fatal
iamsergio Feb 7, 2025
0c8889b
Merge pull request #14 from iamsergio/module
iamsergio Feb 13, 2025
a7e055d
Merge pull request #15 from iamsergio/style
iamsergio Feb 13, 2025
f321198
Merge pull request #16 from iamsergio/mainqml
iamsergio Feb 13, 2025
60c066a
Merge pull request #17 from iamsergio/lints
iamsergio Feb 13, 2025
ff7d186
Fix OptionsPopup not honouring Esc key
iamsergio Feb 13, 2025
b26acf4
Merge pull request #18 from iamsergio/esc
iamsergio Feb 13, 2025
2fd287f
clazy: Fix -Wclazy-range-loop-detach
iamsergio Feb 14, 2025
0574fb5
clazy: Fix clazy-use-static-qregularexpression
iamsergio Feb 14, 2025
3891b96
clazy: Fix -Wclazy-detaching-temporary
iamsergio Feb 14, 2025
5e5c8e7
clazy: Silence -Wclazy-lambda-in-connect
iamsergio Feb 14, 2025
f30cdad
clazy: fix -Wclazy-container-antipattern
iamsergio Feb 14, 2025
7929afa
clazy: Fix -Wclazy-no-module-include
iamsergio Feb 14, 2025
464b1b7
Merge pull request #19 from iamsergio/clazy
iamsergio Feb 15, 2025
53aa65d
Add an ImCloseButton
iamsergio Feb 17, 2025
bef7cc4
Move hardcoded colors to Style.qml
iamsergio Feb 17, 2025
bdbd8f3
Move the hardware list model to C++
iamsergio Feb 17, 2025
ff73b47
Remove unused hwselected property
iamsergio Feb 19, 2025
0f7a03c
Fix TODO about property type 'int' not being enough
iamsergio Feb 19, 2025
d5f7b6b
Move the OSPopup.qml model to C++
iamsergio Feb 19, 2025
debff9f
Don't allow HwPopup/OSPopup to edit properties from main.qml
iamsergio Feb 19, 2025
dbea8c2
Remove unneeded filterItems JS function
iamsergio Feb 19, 2025
b5b62c0
Make ImageWritter::getDriveList() invocable from QML
iamsergio Feb 20, 2025
96cab70
Don't access internal main.qml timers from OSPopup.qml
iamsergio Feb 20, 2025
f12096f
Translate the "(Recommended)" OS string
iamsergio Feb 21, 2025
3b72fad
cmake: Add an rpi-imager_lupdate target
iamsergio Feb 21, 2025
64a2b55
Refresh .ts files
iamsergio Feb 21, 2025
30ef2f1
Remove dummy comment leftover
iamsergio Feb 25, 2025
bc5192b
Merge remote-tracking branch 'origin/qml' into rpi-main
Feb 25, 2025
4a31bfe
cmake: Disallow homebrew on macOS
tdewey-rpi Feb 26, 2025
7fc6d24
build: Add nghttp2 via FetchContent
tdewey-rpi Feb 26, 2025
609e2fd
cmake: macos: Fixup unsigned builds
tdewey-rpi Feb 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
src/build/*
src/build/**
.vscode
compile_commands.json
src/.cache/clangd
obj-**
debian/rpi-imager/**
debian/.debhelper**
Expand Down
48 changes: 48 additions & 0 deletions .qmllint.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[General]
AdditionalQmlImportPaths=
DisableDefaultImports=false
MaxWarnings=0
OverwriteImportTypes=
ResourcePath=

[Warnings]
AccessSingletonViaObject=warning
Anchors=warning
AttachedPropertyReuse=warning
AttachedPropertyType=warning
BadSignalHandler=warning
BadSignalHandlerParameters=warning
CompilerWarnings=disable
ControlsAttachedPropertyReuse=warning
ControlsNativeCustomize=warning
Deprecated=warning
DuplicatePropertyBinding=warning
DuplicatedName=warning
ImportFailure=warning
IncompatibleType=warning
InheritanceCycle=warning
InvalidLintDirective=warning
LayoutsPositioning=warning
LintPluginWarnings=warning
MissingProperty=warning
MissingType=warning
MultilineStrings=warning
NonListProperty=warning
PrefixedImportType=warning
PropertyAlias=warning
PropertyAliasCycles=warning
PropertyChangesParsed=warning
ReadOnlyProperty=warning
RequiredProperty=warning
RestrictedType=warning
TopLevelComponent=warning
TypeError=warning
UncreatableType=warning
UnexpectedVarType=warning
UnknownProperty=warning
UnqualifiedAccess=warning
UnresolvedType=warning
UnusedImports=warning
UseProperFunction=warning
VarUsedBeforeDeclaration=warning
WithStatement=warning
4 changes: 3 additions & 1 deletion src/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

dependencies/libarchive-3.4.2/build/pkgconfig/libarchive.pc
CMakeLists.txt.user
/build-*
.qmlls.ini

7 changes: 7 additions & 0 deletions src/.zed/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Folder-specific settings
//
// For a full list of overridable settings, and general information on folder-specific settings,
// see the documentation: https://zed.dev/docs/configuring-zed#settings-files
{
"format_on_save": "off"
}
90 changes: 86 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,16 @@ if (APPLE)
set(IMAGER_SIGNING_IDENTITY "" CACHE STRING "The Developer Identity to use for signing.")
set(IMAGER_NOTARIZE_APP OFF CACHE BOOL "Perform notarization of the Imager .dmg as part of the build")
set(IMAGER_NOTARIZE_KEYCHAIN_PROFILE "" CACHE STRING "The name of the Keychain item containing your notarization credentials")
endif(APPLE)

## Preferentially build the bundled code. Full vendoring is to follow in a later version.
# Per CMake Bug 21918, if you do not use the following block, CMake will automatically include homebrew libraries.
# This is undesirable, as on macOS/Apple Silicon, you may find newer versions of Qt will pull in new dependencies
# - breaking your x86_64 build prematurely. Regardless, this is desirable behaviour to make the build more predictable.
set(CMAKE_IGNORE_PATH)
foreach(_prefix /sw /opt/local /usr/local /opt/homebrew)
list(APPEND CMAKE_IGNORE_PATH ${_prefix}/bin ${_prefix}/include ${_prefix}/lib)
list(APPEND CMAKE_SYSTEM_IGNORE_PATH ${_prefix}/bin ${_prefix}/include ${_prefix}/lib)
endforeach()
endif(APPLE)

# Bundled code will occasionally use identical options - eg, BUILD_TESTING.
set(BUILD_TESTING OFF)
Expand Down Expand Up @@ -81,6 +88,20 @@ set(Zstd_LIBRARIES libzstd_static)
set(ZSTD_LIBRARIES libzstd_static)
set(ZSTD_LIBRARY libzstd_static)

# Remote nghttp2
include(FetchContent)
FetchContent_Declare(nghttp2
GIT_REPOSITORY https://github.com/nghttp2/nghttp2.git
GIT_TAG v1.64.0
)
set(BUILD_EXAMPLES OFF)
set(ENABLE_LIB_ONLY ON)
set(ENABLE_FAILMALLOC OFF)
FetchContent_MakeAvailable(nghttp2)
unset(ENABLE_LIB_ONLY)
unset(ENABLE_FAILMALLOC)
unset(BUILD_EXAMPLES)

# Bundled zlib
set(ZLIB_BUILD_EXAMPLES OFF)
set(SKIP_INSTALL_ALL ON)
Expand Down Expand Up @@ -171,7 +192,10 @@ set(CURL_INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR}/dependencies/curl-8.11.0/include
# Adding headers explicity so they are displayed in Qt Creator
set(HEADERS config.h imagewriter.h networkaccessmanagerfactory.h nan.h drivelistitem.h drivelistmodel.h drivelistmodelpollthread.h driveformatthread.h powersaveblocker.h cli.h
devicewrapper.h devicewrapperblockcacheentry.h devicewrapperpartition.h devicewrapperstructs.h devicewrapperfatpartition.h wlancredentials.h
downloadthread.h downloadextractthread.h localfileextractthread.h downloadstatstelemetry.h dependencies/mountutils/src/mountutils.hpp dependencies/sha256crypt/sha256crypt.h)
downloadthread.h downloadextractthread.h localfileextractthread.h downloadstatstelemetry.h dependencies/mountutils/src/mountutils.hpp dependencies/sha256crypt/sha256crypt.h
hwlistmodel.h
oslistmodel.h
)

# Add dependencies
if (APPLE)
Expand Down Expand Up @@ -243,7 +267,7 @@ if( IS_BIG_ENDIAN )
message( FATAL_ERROR "We currently only support 'little endian' CPU architectures" )
endif( IS_BIG_ENDIAN )

set(SOURCES ${PLATFORM_SOURCES} "main.cpp" "imagewriter.cpp" "networkaccessmanagerfactory.cpp"
set(SOURCES ${PLATFORM_SOURCES} "main.cpp" "networkaccessmanagerfactory.cpp"
"drivelistitem.cpp" "drivelistmodel.cpp" "drivelistmodelpollthread.cpp" "downloadthread.cpp" "downloadextractthread.cpp"
"devicewrapper.cpp" "devicewrapperblockcacheentry.cpp" "devicewrapperpartition.cpp" "devicewrapperfatpartition.cpp"
"driveformatthread.cpp" "localfileextractthread.cpp" "powersaveblocker.cpp" "downloadstatstelemetry.cpp" "qml.qrc" "dependencies/sha256crypt/sha256crypt.c" "cli.cpp")
Expand Down Expand Up @@ -284,6 +308,9 @@ qt_add_translation(QM_FILES ${TRANSLATIONS})
configure_file(i18n/translations.qrc "${CMAKE_CURRENT_BINARY_DIR}" COPYONLY)
set(SOURCES ${SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc ${QM_FILES})

# Create an rpi-imager_lupdate target
qt_add_lupdate(TS_FILES ${TRANSLATIONS} SOURCE_TARGETS ${PROJECT_NAME})

if (WIN32)
# Adding WIN32 prevents a console window being opened on Windows
add_executable(${PROJECT_NAME} WIN32 ${SOURCES} ${HEADERS} ${DEPENDENCIES})
Expand All @@ -307,6 +334,58 @@ else()
add_definitions(-DCHECK_VERSION_DEFAULT=false)
endif()

qt_policy(SET QTP0001 NEW)

if (QT_KNOWN_POLICY_QTP0004)
qt_policy(SET QTP0004 NEW)
endif()

set(QT_QML_GENERATE_QMLLS_INI ON)

set(IMAGER_QML_FILES
main.qml
MsgPopup.qml
OptionsGeneralTab.qml
OptionsMiscTab.qml
OptionsPopup.qml
OptionsServicesTab.qml
OptionsTabBase.qml
Style.qml
UseSavedSettingsPopup.qml
qmlcomponents/ImButton.qml
qmlcomponents/ImButtonRed.qml
qmlcomponents/ImCheckBox.qml
qmlcomponents/ImCloseButton.qml
qmlcomponents/ImPopup.qml
qmlcomponents/ImRadioButton.qml
MainPopupBase.qml
HwPopup.qml
OSPopup.qml
DstPopup.qml
MainPopupListViewBase.qml
)

set_source_files_properties(Style.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE)

# C++ types exposed to QML
set(IMAGER_QML_CPP_TYPES
imagewriter.cpp
hwlistmodel.cpp
oslistmodel.cpp
)

qt_add_qml_module(${PROJECT_NAME}
URI RpiImager
VERSION 1.0
QML_FILES ${IMAGER_QML_FILES}
SOURCES ${IMAGER_QML_CPP_TYPES}
NO_CACHEGEN
OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/RpiImager
DEPENDENCIES QtQuick
NO_PLUGIN
RESOURCE_PREFIX "/" # Puts the stuff into qrc:/RpiImager/
)

# Because dependencies are typically not available by default on Windows, build bundled code
if (WIN32)
# Target Windows 10, in line with Qt requirements
Expand Down Expand Up @@ -469,6 +548,9 @@ elseif(APPLE)
endif(IMAGER_SIGNING_IDENTITY)
else()
# Unsigned application
add_custom_command(TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND mv "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app" "${CMAKE_BINARY_DIR}/Raspberry\ Pi\ Imager.app")
add_custom_command(TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND "${MACDEPLOYQT_EXECUTABLE}" "${CMAKE_BINARY_DIR}/Raspberry\ Pi\ Imager.app" -qmldir="${CMAKE_CURRENT_SOURCE_DIR}" -always-overwrite -no-strip -dmg)
Expand Down
Loading