Warning, /plasma/discover/discover/qml/CarouselOverlayMaximizedView.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *   SPDX-FileCopyrightText: 2023 ivan tkachenko <me@ratijas.tk>
0003  *
0004  *   SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 import QtQuick
0008 import QtQuick.Templates as T
0009 import org.kde.kirigami as Kirigami
0010 import org.kde.discover
0011 
0012 CarouselAbstractMaximizedView {
0013     id: root
0014 
0015     mode: CarouselMaximizedViewController.Mode.Overlay
0016 
0017     function close(animated: bool) {
0018         if (animated) {
0019             popup.close();
0020         } else {
0021             destroy();
0022         }
0023     }
0024 
0025     // This is a completely custom Popup for full-scene overlay content. Thus
0026     // we don't need any styling bits like padding, background or a modal
0027     // overlay.
0028     readonly property T.Popup popup: T.Popup {
0029         id: popup
0030 
0031         Kirigami.OverlayZStacking.layer: Kirigami.OverlayZStacking.FullScreen
0032         z: Kirigami.OverlayZStacking.z
0033 
0034         implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
0035                                 contentWidth + leftPadding + rightPadding)
0036         implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
0037                                  contentHeight + topPadding + bottomPadding)
0038 
0039         visible: true // show as soon as it is created, destroy immediately after it is closed.
0040         focus: true
0041         modal: true
0042         dim: false // dim component is pointless for a popup that takes up the whole window.
0043         clip: false // there is no point in clipping overlay that fills whole window at all times.
0044         closePolicy: T.Popup.CloseOnEscape
0045         parent: root.transientParent?.T.Overlay.overlay ?? null
0046         x: 0
0047         y: 0
0048         width: parent?.width ?? 0
0049         height: parent?.height ?? 0
0050 
0051         // Default margins of -1 mean that popup positioner won't even try to
0052         // push the popup within the bounds of the enclosing window. But we
0053         // don't care, because we expect it to always fill up exactly the
0054         // whole window.
0055         margins: -1
0056         // All buttons and controls should touch the edge of the enclosing
0057         // window. They are expected to bring their own padding.
0058         padding: 0
0059 
0060         contentItem: CarouselMaximizedViewContent {
0061             focus: true
0062             host: root
0063         }
0064 
0065         background: Rectangle {
0066             color: root.backgroundColor
0067         }
0068 
0069         T.Overlay.modal: Item { }
0070 
0071         onClosed: {
0072             root.destroy();
0073         }
0074     }
0075 }