Warning, /multimedia/haruna/src/qml/Haruna/Components/InputPopup.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2022 George Florea Bănuș <georgefb899@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 import QtQuick 0008 import QtQuick.Controls 0009 import QtQuick.Layouts 0010 0011 Popup { 0012 id: root 0013 0014 signal urlOpened(string url) 0015 property string lastUrl: "" 0016 property string buttonText: "" 0017 0018 modal: true 0019 0020 onOpened: { 0021 openUrlTextField.forceActiveFocus(Qt.MouseFocusReason) 0022 openUrlTextField.selectAll() 0023 } 0024 0025 RowLayout { 0026 anchors.fill: parent 0027 0028 Label { 0029 text: i18nc("@info", "Neither <a href=\"https://github.com/yt-dlp/yt-dlp\">yt-dlp</a> nor <a href=\"https://github.com/ytdl-org/youtube-dl\">youtube-dl</a> was found.") 0030 visible: !app.hasYoutubeDl() 0031 onLinkActivated: Qt.openUrlExternally(link) 0032 } 0033 0034 TextField { 0035 id: openUrlTextField 0036 0037 text: root.lastUrl 0038 visible: app.hasYoutubeDl() 0039 Layout.preferredWidth: 400 0040 Layout.fillWidth: true 0041 0042 Keys.onPressed: function(event) { 0043 switch(event.key) { 0044 case Qt.Key_Enter: 0045 case Qt.Key_Return: 0046 openUrlButton.clicked() 0047 return; 0048 case Qt.Key_Escape: 0049 openUrlPopup.close() 0050 return; 0051 } 0052 } 0053 } 0054 0055 Button { 0056 id: openUrlButton 0057 0058 visible: app.hasYoutubeDl() 0059 text: root.buttonText 0060 0061 onClicked: { 0062 root.urlOpened(openUrlTextField.text) 0063 root.close() 0064 openUrlTextField.clear() 0065 } 0066 } 0067 } 0068 }