🎉 adding a downloaded video from youtube
This commit is contained in:
parent
2a71b8d750
commit
41e22ca133
2 changed files with 18 additions and 3 deletions
|
@ -49,7 +49,7 @@ Kirigami.OverlaySheet {
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: centerItem
|
id: centerItem
|
||||||
Layout.preferredHeight: Kirigami.Units.gridUnit * 25
|
Layout.preferredHeight: Kirigami.Units.gridUnit * 30
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
visible: true
|
visible: true
|
||||||
|
@ -119,7 +119,11 @@ Kirigami.OverlaySheet {
|
||||||
Controls.Button {
|
Controls.Button {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
text: "Ok"
|
text: "Ok"
|
||||||
onClicked: { clear(); root.close();}
|
onClicked: {
|
||||||
|
videoProxyModel.videoModel.newItem(ytdl.file);
|
||||||
|
clear();
|
||||||
|
root.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@ mod ytdl {
|
||||||
loaded: bool,
|
loaded: bool,
|
||||||
#[qproperty]
|
#[qproperty]
|
||||||
loading: bool,
|
loading: bool,
|
||||||
|
#[qproperty]
|
||||||
|
file: QUrl,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl qobject::Ytdl {
|
impl qobject::Ytdl {
|
||||||
|
@ -54,13 +56,22 @@ mod ytdl {
|
||||||
let output = ytdl.into_single_video().unwrap();
|
let output = ytdl.into_single_video().unwrap();
|
||||||
println!("{:?}", output.title);
|
println!("{:?}", output.title);
|
||||||
println!("{:?}", output.thumbnail);
|
println!("{:?}", output.thumbnail);
|
||||||
|
println!("{:?}", output.url);
|
||||||
let title = QString::from(&output.title);
|
let title = QString::from(&output.title);
|
||||||
let thumbnail = QUrl::from(&output.thumbnail.unwrap());
|
let thumbnail = QUrl::from(&output.thumbnail.unwrap_or_default());
|
||||||
|
let mut file = String::from(output_dirs);
|
||||||
|
file.push_str("/");
|
||||||
|
file.push_str(&output.title);
|
||||||
|
file.push_str(".");
|
||||||
|
file.push_str(&output.ext.unwrap_or_default());
|
||||||
|
println!("{:?}", file);
|
||||||
|
|
||||||
thread.queue(move |mut qobject_ytdl| {
|
thread.queue(move |mut qobject_ytdl| {
|
||||||
qobject_ytdl.as_mut().set_loaded(true);
|
qobject_ytdl.as_mut().set_loaded(true);
|
||||||
qobject_ytdl.as_mut().set_loading(false);
|
qobject_ytdl.as_mut().set_loading(false);
|
||||||
qobject_ytdl.as_mut().set_title(title);
|
qobject_ytdl.as_mut().set_title(title);
|
||||||
qobject_ytdl.as_mut().set_thumbnail(thumbnail);
|
qobject_ytdl.as_mut().set_thumbnail(thumbnail);
|
||||||
|
qobject_ytdl.as_mut().set_file(QUrl::from(&file));
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
true
|
true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue