diff --git a/CMakeLists.txt b/CMakeLists.txt index a7eecc8..a0dc01b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,7 +116,7 @@ endif() message("Target architecture ${CLICK_ARCH} and link https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux${TARGET_ARCH}" ) -file (DOWNLOAD https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux${TARGET_ARCH} ${BUILD_DIR}/bin/yt-dlp_linux SHOW_PROGRESS) +#file (DOWNLOAD https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux${TARGET_ARCH} ${BUILD_DIR}/bin/yt-dlp_linux SHOW_PROGRESS) install(FILES ${BUILD_DIR}/bin/yt-dlp_linux TYPE BIN PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ) add_subdirectory(po) diff --git a/main.cpp b/main.cpp index be13fdd..3291d47 100644 --- a/main.cpp +++ b/main.cpp @@ -36,7 +36,7 @@ int main(int argc, char *argv[]) qDebug() << "Starting app from main.cpp"; view->engine()->rootContext()->setContextProperty("downloadManager", dm); - view->setSource(QUrl("qrc:/Main.qml")); + view->setSource(QUrl("qrc:/MainPage.qml")); view->setResizeMode(QQuickView::SizeRootObjectToView); view->show(); diff --git a/po/raven.downloader.shohag.pot b/po/raven.downloader.shohag.pot index f6e9899..ac336e5 100644 --- a/po/raven.downloader.shohag.pot +++ b/po/raven.downloader.shohag.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: raven.downloader.shohag\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-06-28 09:42+0000\n" +"POT-Creation-Date: 2023-07-04 06:56+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,10 +17,14 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: ../qml/Components/CustomBottomEdge.qml:24 ../qml/Main.qml:367 +#: ../qml/Components/CustomBottomEdge.qml:24 ../qml/MainPage.qml:388 msgid "Swipe for Settings" msgstr "" +#: ../qml/Components/ExportPage.qml:35 ../qml/ExportPage.qml:37 +msgid "Install/Save with" +msgstr "" + #: ../qml/Components/MediaItem.qml:54 msgid "select audio" msgstr "" @@ -41,11 +45,7 @@ msgstr "" msgid "Please refresh download link." msgstr "" -#: ../qml/Components/MediaItem.qml:193 -msgid "unknown" -msgstr "" - -#: ../qml/Components/MediaItem.qml:234 +#: ../qml/Components/MediaItem.qml:206 msgid "Download" msgstr "" @@ -53,63 +53,63 @@ msgstr "" msgid "OK" msgstr "" -#: ../qml/Main.qml:163 +#: ../qml/MainPage.qml:170 msgid "Error Occurred!" msgstr "" -#: ../qml/Main.qml:164 +#: ../qml/MainPage.qml:171 msgid "An unknown error occured." msgstr "" -#: ../qml/Main.qml:171 +#: ../qml/MainPage.qml:178 msgid "Invalid Playlist URL!" msgstr "" -#: ../qml/Main.qml:172 +#: ../qml/MainPage.qml:179 msgid "Please provide a link with valid list argument." msgstr "" -#: ../qml/Main.qml:179 +#: ../qml/MainPage.qml:195 msgid "Download Complete!" msgstr "" -#: ../qml/Main.qml:180 +#: ../qml/MainPage.qml:196 msgid " video(s) from \"" msgstr "" -#: ../qml/Main.qml:187 +#: ../qml/MainPage.qml:203 msgid "Invalid URL!" msgstr "" -#: ../qml/Main.qml:188 +#: ../qml/MainPage.qml:204 msgid "Please provide a valid video link." msgstr "" -#: ../qml/Main.qml:248 +#: ../qml/MainPage.qml:264 msgid "Put YouTube video or playlist URL here" msgstr "" -#: ../qml/Main.qml:253 +#: ../qml/MainPage.qml:269 msgid "Select download type" msgstr "" -#: ../qml/Main.qml:255 +#: ../qml/MainPage.qml:271 msgid "playlist" msgstr "" -#: ../qml/Main.qml:255 +#: ../qml/MainPage.qml:271 msgid "single video" msgstr "" -#: ../qml/Main.qml:260 +#: ../qml/MainPage.qml:276 msgid "Submit" msgstr "" -#: ../qml/Main.qml:278 +#: ../qml/MainPage.qml:299 msgid " Downloaded Files" msgstr "" -#: ../qml/Main.qml:354 +#: ../qml/MainPage.qml:375 msgid "No Downloads!" msgstr "" diff --git a/qml/Components/MediaItem.qml b/qml/Components/MediaItem.qml index ddabfaf..9556618 100644 --- a/qml/Components/MediaItem.qml +++ b/qml/Components/MediaItem.qml @@ -121,7 +121,7 @@ LayoutsCustom { Image { id: thumbnailContainer - Layout.preferredWidth: units.gu(10) + Layout.preferredWidth: units.gu(15) layer.enabled: true layer.effect: OpacityMask { @@ -146,7 +146,7 @@ LayoutsCustom { source: "qrc:///assets/placeholder-video.png" Layout.rowSpan: 3 Layout.fillHeight: true - Layout.minimumWidth: units.gu(20) + Layout.minimumWidth: units.gu(15) Layout.maximumWidth: units.gu(25) } @@ -176,28 +176,10 @@ LayoutsCustom { RowLayout { Layout.fillWidth: true -// InfoButton { -// id: durationButton -// Layout.fillWidth: true -// buttonID: 0 -// text: duration ? duration : i18n.tr("unknown") -// } - - Button { - id: sizeButton - iconName: "media-flash-symbolic" - Layout.preferredWidth: units.gu(10) - Layout.minimumWidth: units.gu(10) - Layout.fillWidth: true - color: LomiriColors.lightGrey - text: sizeModel && (resolutionPopup.text !== comboHeading[2]) ? sizeModel[resolutionPopup.index] + audioSizes[audioPopup.index] + "MiB" : i18n.tr("unknown") - enabled: sizeModel ? true : false - } - CustomComboPopup { id: audioPopup Layout.fillWidth: true - Layout.minimumWidth: units.gu(10) + Layout.minimumWidth: units.gu(8) heading: comboHeading[0] enabled: downloadUnavailable ? false : true multipleModel: true @@ -206,20 +188,10 @@ LayoutsCustom { dropdownModel3: audioBitrate } -// CustomComboPopup { -// id: languagePopup -// Layout.fillWidth: true -// Layout.minimumWidth: units.gu(10) -// visible: langs.length != 0 -// heading: comboHeading[1] -// enabled: downloadUnavailable ? false : true -// dropdownModel: langs -// } - CustomComboPopup { id: resolutionPopup Layout.fillWidth: true - Layout.minimumWidth: units.gu(10) + Layout.minimumWidth: units.gu(8) heading: comboHeading[2] enabled: downloadUnavailable ? false : true multipleModel: true diff --git a/qml/ExportPage.qml b/qml/ExportPage.qml new file mode 100644 index 0000000..e0911d4 --- /dev/null +++ b/qml/ExportPage.qml @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2022 Abdullah AL Shohag + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 3. + * + * raven.downloader is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import QtQuick 2.4 +import QtQuick.Layouts 1.3 +import Lomiri.Components 1.3 +import Lomiri.Content 1.3 +import Lomiri.Components.Popups 1.3 + +Page { + id: picker + property var activeTransfer + + property string url + property var handler + property var contentType + + property var popupObject: null + + signal cancel() + signal imported(string fileUrl) + + header: PageHeader { + title: i18n.tr("Install/Save with") + contents: RowLayout { + anchors.fill: parent + Rectangle { + id: backButtonContainer + height: units.gu(5) + width: units.gu(5) + radius: units.gu(1) + Icon { + id: backButtonIcon + Layout.fillWidth: true + anchors.centerIn: parent + width: units.gu(3) + height: units.gu(3) + name: 'back' + color: "red" + keyColor: "blue" + } + + + MouseArea { + anchors.fill: parent + onClicked: { + PopupUtils.close(popupObject) + console.log("Back pressed") + } + + onPressed: backButtonContainer.color = "lightgrey" + onReleased: backButtonContainer.color = "white" + } + } + + Label { + anchors.centerIn: parent + text: header.title + textSize: Label.Large + } + } + } + + ContentPeerPicker { + anchors { fill: parent; topMargin: picker.header.height } + visible: parent.visible + showTitle: false + contentType: ContentType.All + handler: ContentHandler.Destination + + onPeerSelected: { + //peer.selectionType = ContentTransfer.Single + picker.activeTransfer = peer.request() + picker.activeTransfer.stateChanged.connect(function() { + if (picker.activeTransfer.state === ContentTransfer.InProgress) { + console.log("In progress"); + //picker.activeTransfer.items = picker.activeTransfer.items[0].url = url; + picker.activeTransfer.items = [ resultComponent.createObject(parent, {"url": url}) ]; + picker.activeTransfer.state = ContentTransfer.Charged; + pageStack.pop() + + } + + }) + } + + + onCancelPressed: { + pageStack.pop() + } + } + + ContentTransferHint { + id: transferHint + anchors.fill: parent + activeTransfer: picker.activeTransfer + } + Component { + id: resultComponent + ContentItem {} + } +} diff --git a/qml/Main.qml b/qml/MainPage.qml similarity index 94% rename from qml/Main.qml rename to qml/MainPage.qml index 9a09e6f..1ebd9f8 100644 --- a/qml/Main.qml +++ b/qml/MainPage.qml @@ -40,6 +40,7 @@ MainView { property string entry property bool isPlaylist property int count : 0 + property var pObj : null theme: ThemeSettings { id: appTheme @@ -142,6 +143,12 @@ MainView { PopupUtils.open(finishedPopup); } + onDownloadFinished: { + pObj = PopupUtils.open(exportPage, root, { + popupObject: pObj + }); + } + onDownloadProgress: downloadItemsModel.setProperty(deformIndex(indexID), "vVideoProgress", value/100); onInvalidPlaylistUrl: PopupUtils.open(invalidPlayListURLWarning); @@ -173,6 +180,15 @@ MainView { } } + Component { + id: exportPage + ExportPage { + id: exportPageComponent + contentType: ContentType.All + handler: ContentHandler.Source + } + } + Component { id: finishedPopup WarningDialog { @@ -258,7 +274,12 @@ MainView { Button { id: submitButton text: i18n.tr("Submit") - onClicked: urlHandler(urlContainer.text, donwloadType.index) + onClicked: { + pObj = PopupUtils.open(exportPage, root, { + popupObject: pObj + }); + //urlHandler(urlContainer.text, donwloadType.index) + } } } } diff --git a/qml/qml.qrc b/qml/qml.qrc index 65cd4ac..56c0191 100644 --- a/qml/qml.qrc +++ b/qml/qml.qrc @@ -1,6 +1,8 @@ - Main.qml + MainPage.qml + ExportPage.qml + SettingsPage.qml Components/MediaItem.qml Components/CustomComboPopup.qml Components/CustomProgressBar.qml @@ -8,6 +10,5 @@ Components/WarningDialog.qml Components/CustomBottomEdge.qml Components/LomiriButton.qml - SettingsPage.qml diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 5c7b26d..7184c20 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -226,8 +226,10 @@ void DownloadManager::actionDownload(QString url, QJsonObject data) downloader->setWorkingDirectory(this->downloadPath); downloader->start("bin/yt-dlp_linux", arguments); - connect(downloader, &QProcess::readyReadStandardOutput, this, [this, downloader, indexID] {downloadProgressSlot(downloader, indexID);} ); qDebug() << "Arguments:" << arguments; + + connect(downloader, &QProcess::readyReadStandardOutput, this, [this, downloader, indexID] {downloadProgressSlot(downloader, indexID);} ); + connect(downloader, &QProcess::readyReadStandardOutput, this, [this, downloader] {emit downloadFinished();} ); } void DownloadManager::stopProcess() diff --git a/src/downloadmanager.h b/src/downloadmanager.h index b79dab7..1fbe254 100644 --- a/src/downloadmanager.h +++ b/src/downloadmanager.h @@ -21,9 +21,9 @@ #include #include #include - #include -#include + +#include "mediaformat.h" class DownloadManager : public QObject { @@ -59,6 +59,7 @@ public slots: void invalidPlaylistUrl(); void finished(QString playlistTitle, qint64 entries); void downloadProgress(QString value, qint64 indexID); + void downloadFinished(); void listModelDataLoaded(); void generalMessage(QString message);