Skip to content

Commit

Permalink
Merge pull request #525 from Kicer86/color_picker
Browse files Browse the repository at this point in the history
Switch to Color Picker dialog from Qt 6.4
  • Loading branch information
Kicer86 committed Jan 20, 2024
2 parents 716127e + 241c8d5 commit 9f37399
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 99 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/windows-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Setup ccache
uses: Chocobo1/setup-ccache-action@v1
with:
windows_compile_environment: msvc #
windows_compile_environment: msvc

- name: Run vcpkg
uses: lukka/run-vcpkg@v11.4
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
[submodule "src/updater/github_api"]
path = src/third_party/cpp_restapi
url = https://github.com/Kicer86/github_api.git
[submodule "src/gui/desktop/quick_items/external/qml-colorpicker"]
path = src/gui/desktop/quick_items/external/qml-colorpicker
url = https://github.com/rshest/qml-colorpicker.git
[submodule "vcpkg"]
path = vcpkg
url = https://github.com/microsoft/vcpkg.git
Expand Down
2 changes: 1 addition & 1 deletion docs/build.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ git clone --recursive https://github.com/Kicer86/photobroom.git
Required tools and libraries:
- cmake - version 3.18 or later
- python**
- Qt6 - version 6.2 or higher*
- Qt6 - version 6.4 or higher*
- exiv2*
- dlib*
- magic_enum*
Expand Down
19 changes: 5 additions & 14 deletions src/gui/desktop/QmlItems/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

find_package(Qt6 6.2 REQUIRED COMPONENTS
find_package(Qt6 6.4 REQUIRED COMPONENTS
Quick
)

Expand All @@ -20,10 +20,6 @@ file(GLOB_RECURSE
*.qml
)

if(${Qt6Quick_VERSION} EQUAL "6.3.0")
list(APPEND EXTRA_QML_OPTIONS NO_CACHEGEN) # disable qmlsc due to a bug https://bugreports.qt.io/browse/QTBUG-99042
endif()

if(${Qt6Quick_VERSION} VERSION_GREATER "6.4.2") # // TODO: >= 6.4 should probably be enought, but there are issues with this on ubuntu on CI. Probably caused by some missing packages. To be figured out later
list(APPEND EXTRA_QML_OPTIONS ENABLE_TYPE_COMPILER) # compile qml files
endif()
Expand All @@ -35,18 +31,13 @@ qt6_add_qml_module(qml_items
SOURCES ${CPP_SOURCES}
STATIC
RESOURCE_PREFIX /photo_broom
${EXTRA_QML_OPTIONS}
${EXTRA_QML_OPTIONS} # compile qml files
)

target_link_libraries(qml_items
PUBLIC
Qt::Quick
PRIVATE
Qt::QmlPrivate
Qt::QuickPrivate
)

if(${Qt6Quick_VERSION} VERSION_GREATER_EQUAL "6.4")
target_link_libraries(qml_items
PRIVATE
Qt::QmlPrivate
Qt::QuickPrivate
)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import QtQuick

/*
* Item displays a provided busy indicator until `embeddedItem` (needs to be `Image` based) is ready to be shown
* TODO: Requires https://bugreports.qt.io/browse/QTBUG-95117 to be fixed before being qmltced
*/

Item {
Expand Down
7 changes: 1 addition & 6 deletions src/gui/desktop/quick_items/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

find_package(Qt6 6.2 REQUIRED COMPONENTS
find_package(Qt6 6.4 REQUIRED COMPONENTS
Multimedia
Quick
Quick3D
Expand Down Expand Up @@ -36,18 +36,13 @@ set_source_files_properties(Components/Constants.qml PROPERTIES
QT_QML_SINGLETON_TYPE TRUE
)

if(${Qt6Quick_VERSION} EQUAL "6.3.0")
set(EXTRA_QML_OPTIONS NO_CACHEGEN) # disable qmlsc due to a bug https://bugreports.qt.io/browse/QTBUG-99042
endif()

qt6_add_qml_module(quick_items
URI "quick_items"
VERSION 1.0
SOURCES ${QUICK_ITEMS_CPP_SOURCES}
QML_FILES ${QML_SOURCES}
STATIC
RESOURCE_PREFIX /photo_broom
${EXTRA_QML_OPTIONS}
)

target_link_libraries(quick_items
Expand Down
4 changes: 2 additions & 2 deletions src/gui/desktop/quick_items/Components/ColorComboBox.qml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick
import QtQuick.Controls
import "internal" as Internal

/*
Expand Down
2 changes: 2 additions & 0 deletions src/gui/desktop/quick_items/Components/MediaPreviewItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import QtQuick
import QtMultimedia
import QtQuick.Controls
import quick_items
import QmlItems

import photo_broom.singletons

Expand Down Expand Up @@ -62,5 +63,6 @@ Item {
Loader { sourceComponent: ctrl.mode === MediaViewCtrl.Error? staticImage: undefined; anchors.fill: parent }

// TODO: use AnimatedImage for all kinds of non-static media files when https://bugreports.qt.io/browse/QTBUG-30524 is fixed
// TODO: check https://doc-snapshots.qt.io/qt6-dev/qml-qtquick-frameanimation.html if it solves above problem
}

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

import QtQuick
import QtQuick.Controls
import QtQuick.Dialogs
import photo_broom.utils
import photo_broom.enums
import QmlItems
import quick_items
import "../../Components" as Components
import "../../external/qml-colorpicker/colorpicker" as Colorpicker

Item {
id: editor
Expand Down Expand Up @@ -80,51 +80,13 @@ Item {
Component {
id: categoryEditor

Item {
id: editorRect
ColorDialog {

Popup {
id: popup
visible: true
modality: Qt.ApplicationModal

parent: Overlay.overlay
x: width > editorRect.width? _pos.x - (width - editorRect.width) : _pos.x
y: _pos.y + editorRect.height
modal: true
focus: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside

property point _pos: mapToItem(Overlay.overlay, editorRect.x, editorRect.y)
property bool _accepted: false

Column {
anchors.fill: parent

Colorpicker.Colorpicker {
id: picker

enableAlphaChannel: false
enableDetails: false
paletteMode: true
}

RoundButton {
height: 17
text: qsTr("Apply")
radius: 3

onClicked: {
popup._accepted = true;
editor.accepted(picker.colorValue);
}
}
}

Component.onCompleted: popup.open()
onClosed: {
if (!_accepted)
editor.rejected();
}
}
onAccepted: editor.accepted(selectedColor)
onRejected: editor.rejected()
}
}

Expand Down
1 change: 0 additions & 1 deletion src/gui/desktop/quick_items/external/qml-colorpicker
Submodule qml-colorpicker deleted from 5967b3
13 changes: 0 additions & 13 deletions tr/photo_broom_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -891,14 +891,6 @@ Error code: %1</source>
<translation>Photos taken at similar time</translation>
</message>
</context>
<context>
<name>TagValueEditor</name>
<message>
<location filename="../src/gui/desktop/quick_items/Views/ViewsComponents/TagValueEditor.qml" line="112"/>
<source>Apply</source>
<translation>Apply</translation>
</message>
</context>
<context>
<name>TagsModel</name>
<message>
Expand Down Expand Up @@ -1041,10 +1033,5 @@ Error code: %1</source>
<source>threads count</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/gui/desktop/quick_items/external/qml-colorpicker/test/main.qml" line="11"/>
<source>Hello Colorpicker</source>
<translation>Hello Colorpicker</translation>
</message>
</context>
</TS>
13 changes: 0 additions & 13 deletions tr/photo_broom_pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -923,14 +923,6 @@ Kod błędu: %1</translation>
<translation>Zdjęcia wykonane w podobnym czasie</translation>
</message>
</context>
<context>
<name>TagValueEditor</name>
<message>
<location filename="../src/gui/desktop/quick_items/Views/ViewsComponents/TagValueEditor.qml" line="+112"/>
<source>Apply</source>
<translation>Zastosuj</translation>
</message>
</context>
<context>
<name>TagsModel</name>
<message>
Expand Down Expand Up @@ -1073,10 +1065,5 @@ Kod błędu: %1</translation>
<source>threads count</source>
<translation>liczba wątków</translation>
</message>
<message>
<location filename="../src/gui/desktop/quick_items/external/qml-colorpicker/test/main.qml" line="+11"/>
<source>Hello Colorpicker</source>
<translation>Hello Colorpicker</translation>
</message>
</context>
</TS>

0 comments on commit 9f37399

Please sign in to comment.