Warning, /graphics/koko/src/qml/imagedelegate/BaseImageDelegate.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: (C) 2015 Vishesh Handa <vhanda@kde.org> 0003 * SPDX-FileCopyrightText: (C) 2017 Atul Sharma <atulsharma406@gmail.com> 0004 * SPDX-FileCopyrightText: (C) 2017 Marco Martin <mart@kde.org> 0005 * SPDX-FileCopyrightText: (C) 2021 Noah Davis <noahadvs@gmail.com> 0006 * SPDX-FileCopyrightText: (C) 2021 Mikel Johnson <mikel5764@gmail.com> 0007 * SPDX-FileCopyrightText: (C) 2021 Arjen Hiemstra <ahiemstra@heimr.nl> 0008 * 0009 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0010 */ 0011 0012 import QtQuick 2.15 0013 import QtQml 2.15 0014 import QtMultimedia 5.15 0015 import org.kde.kirigami 2.15 as Kirigami 0016 import org.kde.koko 0.1 0017 import org.kde.koko.image 0.1 0018 0019 import ".." 0020 0021 ZoomArea { 0022 id: root 0023 0024 required property url source 0025 0026 required property bool loaded 0027 required property bool loading 0028 0029 required property real sourceWidth 0030 required property real sourceHeight 0031 0032 required property bool isCurrent 0033 0034 implicitContentWidth: sourceWidth 0035 implicitContentHeight: sourceHeight 0036 0037 /* Using very small min sizes and very large max sizes since there don't seem 0038 * to be many good reasons to use more limited ranges. 0039 * 0040 * The best tools are simple, but allow users to do complex things without 0041 * needing to add more complexity. 0042 * Maybe an artist wants to view the pixels of an image up close to see the 0043 * exact colors better or shrink an image to see the average colors. 0044 * We could require the artist to use something like ImageMagick to do that, 0045 * or we could let them use their favorite image viewer and a color picker to 0046 * do the same job without having to learn ImageMagick. 0047 * 0048 * 8 was picked as the minimum size unless the source size is smaller. 0049 * It's a fairly arbitrary number. Maybe it could be 1, but that's really 0050 * really difficult to see and sometimes the single pixel is impossible to see. 0051 * 0052 * Media source size times 100 was picked for the max size because that 0053 * allows Koko to show roughly 19x10 pixels at once when full screen on a 0054 * 1920x1080 screen at max zoom. An arbitrary number, but it should be fine. 0055 * QQuickImage is very good at handling large sizes, so unlike Gwenview, 0056 * performance isn't much of a concern when picking the max size. 0057 */ 0058 minimumZoomSize: 8 0059 maximumZoomFactor: 100 0060 0061 Timer { 0062 id: doubleClickTimer 0063 interval: Qt.styleHints.mouseDoubleClickInterval + 1 0064 onTriggered: applicationWindow().controlsVisible = !applicationWindow().controlsVisible 0065 } 0066 onClicked: if (mouse.button === Qt.LeftButton) { 0067 if (applicationWindow().contextDrawer) { 0068 applicationWindow().contextDrawer.drawerOpen = false 0069 } 0070 doubleClickTimer.restart() 0071 } 0072 onDoubleClicked: if (mouse.button === Qt.LeftButton) { 0073 doubleClickTimer.stop() 0074 } 0075 0076 onIsCurrentChanged: { 0077 root.contentWidth = Qt.binding(() => root.defaultContentRect.width) 0078 root.contentHeight = Qt.binding(() => root.defaultContentRect.height) 0079 } 0080 }