Warning, /plasma/kdeplasma-addons/applets/comic/package/contents/ui/ComicCentralView.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * SPDX-FileCopyrightText: 2012 Reza Fatahilah Shah <rshah0385@kireihana.com>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 import QtQuick 2.1
0008 import org.kde.plasma.core as PlasmaCore
0009 import org.kde.kirigami 2.20 as Kirigami
0010 import org.kde.plasma.components 3.0 as PlasmaComponents3
0011 import org.kde.kquickcontrolsaddons 2.0
0012 import org.kde.plasma.plasmoid
0013 
0014 Item {
0015     id: root
0016 
0017     width: Kirigami.Units.gridUnit
0018     height: Kirigami.Units.gridUnit
0019 
0020     property variant comicData
0021 
0022     PlasmaComponents3.ToolButton {
0023         id: arrowLeft
0024 
0025         anchors {
0026             left: root.left
0027             verticalCenter: root.verticalCenter
0028         }
0029 
0030         icon.name: "go-previous"
0031         visible: (!Plasmoid.arrowsOnHover && (comicData.prev !== undefined))
0032 
0033         onClicked: {
0034             Plasmoid.updateComic(comicData.prev);
0035         }
0036     }
0037 
0038     MouseArea {
0039         id: comicImageArea
0040 
0041         anchors {
0042             left: arrowLeft.visible ? arrowLeft.right : root.left
0043             right: arrowRight.visible ? arrowRight.left : root.right
0044             leftMargin: arrowLeft.visible ? 4 : 0
0045             rightMargin: arrowRight.visible ? 4 : 0
0046             top: root.top
0047             bottom: root.bottom
0048         }
0049 
0050         hoverEnabled: true
0051         preventStealing: false
0052         acceptedButtons: Qt.LeftButton | Qt.MiddleButton
0053 
0054         onClicked: {
0055             if (mouse.button == Qt.MiddleButton && Plasmoid.middleClick) {
0056                 fullDialog.toggleVisibility();
0057             }
0058         }
0059 
0060         PlasmaCore.ToolTipArea {
0061             id: tooltip
0062             anchors.fill: comicImageArea
0063             subText: Plasmoid.comicData.additionalText
0064             active: subText
0065         }
0066 
0067         ImageWidget {
0068             id: comicImage
0069 
0070             anchors.fill: parent
0071 
0072             image: Plasmoid.comicData.image
0073             actualSize: Plasmoid.showActualSize
0074             isLeftToRight: Plasmoid.comicData.isLeftToRight
0075             isTopToBottom: Plasmoid.comicData.isTopToBottom
0076         }
0077 
0078         ButtonBar {
0079             id: buttonBar
0080 
0081             anchors {
0082                 horizontalCenter: parent.horizontalCenter
0083                 bottom: parent.bottom
0084                 bottomMargin: 10
0085             }
0086 
0087             visible: Plasmoid.arrowsOnHover && comicImageArea.containsMouse
0088             opacity: 0
0089 
0090             onPrevClicked: {
0091                 Plasmoid.updateComic(comicData.prev);
0092             }
0093 
0094             onNextClicked: {
0095                 Plasmoid.updateComic(comicData.next);
0096             }
0097 
0098             onZoomClicked: {
0099                 fullDialog.toggleVisibility();
0100             }
0101 
0102             states: State {
0103                 name: "show"; when: (Plasmoid.arrowsOnHover && comicImageArea.containsMouse)
0104                 PropertyChanges { target: buttonBar; opacity: 1; }
0105             }
0106 
0107             transitions: Transition {
0108                 from: ""; to: "show"; reversible: true
0109                 NumberAnimation { properties: "opacity"; duration: Kirigami.Units.longDuration; easing.type: Easing.InOutQuad }
0110             }
0111         }
0112     }
0113 
0114     PlasmaComponents3.ToolButton {
0115         id: arrowRight
0116 
0117         anchors {
0118             right: root.right
0119             verticalCenter: root.verticalCenter
0120         }
0121 
0122         icon.name: "go-next"
0123         visible: (!Plasmoid.arrowsOnHover && (comicData.next !== undefined))
0124 
0125         onClicked: {
0126             Plasmoid.updateComic(comicData.next);
0127         }
0128     }
0129 
0130     FullViewWidget {
0131         id: fullDialog
0132 
0133         image: Plasmoid.comicData.image
0134     }
0135 }