mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Pass context object to properly disconnect when this is deleted
This commit is contained in:
parent
12cae4d0ba
commit
d5a6a46bc5
1 changed files with 10 additions and 8 deletions
|
@ -921,6 +921,7 @@ MediaUpload::MediaUpload(std::unique_ptr<QIODevice> source_,
|
|||
});
|
||||
connect(mediaPlayer,
|
||||
qOverload<const QString &, const QVariant &>(&QMediaPlayer::metaDataChanged),
|
||||
this,
|
||||
[this, mediaPlayer](QString t, QVariant) {
|
||||
nhlog::ui()->debug("Got metadata {}", t.toStdString());
|
||||
|
||||
|
@ -937,14 +938,15 @@ MediaUpload::MediaUpload(std::unique_ptr<QIODevice> source_,
|
|||
}
|
||||
}
|
||||
});
|
||||
connect(mediaPlayer, &QMediaPlayer::durationChanged, [this, mediaPlayer](qint64 duration) {
|
||||
if (duration > 0) {
|
||||
this->duration_ = mediaPlayer->duration();
|
||||
if (mimeClass_ == u"audio")
|
||||
mediaPlayer->stop();
|
||||
}
|
||||
nhlog::ui()->debug("Duration changed {}", duration);
|
||||
});
|
||||
connect(
|
||||
mediaPlayer, &QMediaPlayer::durationChanged, this, [this, mediaPlayer](qint64 duration) {
|
||||
if (duration > 0) {
|
||||
this->duration_ = mediaPlayer->duration();
|
||||
if (mimeClass_ == u"audio")
|
||||
mediaPlayer->stop();
|
||||
}
|
||||
nhlog::ui()->debug("Duration changed {}", duration);
|
||||
});
|
||||
|
||||
auto originalFile = qobject_cast<QFile *>(source.get());
|
||||
|
||||
|
|
Loading…
Reference in a new issue