Skip to content

Commit

Permalink
added export page
Browse files Browse the repository at this point in the history
  • Loading branch information
HackerShohag committed Jul 4, 2023
1 parent 33838bd commit 26b825e
Show file tree
Hide file tree
Showing 9 changed files with 174 additions and 62 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
44 changes: 22 additions & 22 deletions po/raven.downloader.shohag.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand All @@ -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 ""
Expand All @@ -41,75 +45,71 @@ 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 ""

#: ../qml/Components/WarningDialog.qml:27
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 ""

Expand Down
36 changes: 4 additions & 32 deletions qml/Components/MediaItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ LayoutsCustom {

Image {
id: thumbnailContainer
Layout.preferredWidth: units.gu(10)
Layout.preferredWidth: units.gu(15)

layer.enabled: true
layer.effect: OpacityMask {
Expand All @@ -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)
}

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
115 changes: 115 additions & 0 deletions qml/ExportPage.qml
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

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 {}
}
}
23 changes: 22 additions & 1 deletion qml/Main.qml → qml/MainPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ MainView {
property string entry
property bool isPlaylist
property int count : 0
property var pObj : null

theme: ThemeSettings {
id: appTheme
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -173,6 +180,15 @@ MainView {
}
}

Component {
id: exportPage
ExportPage {
id: exportPageComponent
contentType: ContentType.All
handler: ContentHandler.Source
}
}

Component {
id: finishedPopup
WarningDialog {
Expand Down Expand Up @@ -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)
}
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions qml/qml.qrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<RCC>
<qresource prefix="/">
<file>Main.qml</file>
<file>MainPage.qml</file>
<file>ExportPage.qml</file>
<file>SettingsPage.qml</file>
<file>Components/MediaItem.qml</file>
<file>Components/CustomComboPopup.qml</file>
<file>Components/CustomProgressBar.qml</file>
<file>Components/LayoutsCustom.qml</file>
<file>Components/WarningDialog.qml</file>
<file>Components/CustomBottomEdge.qml</file>
<file>Components/LomiriButton.qml</file>
<file>SettingsPage.qml</file>
</qresource>
</RCC>
Loading

0 comments on commit 26b825e

Please sign in to comment.