various: update Qt code deprecated in 5.15
- Replaces QLinkedList with std::list as recommended by Qt docs. - Replaces QWheelEvent::delta() with QWheelEvent::angleDelta(). This should also benefit trackpad behavior.
This commit is contained in:
@@ -188,7 +188,7 @@ public:
|
||||
}
|
||||
|
||||
~Arena() {
|
||||
QLinkedList<Element*> copy = lent_elements_;
|
||||
std::list<Element*> copy = lent_elements_;
|
||||
foreach (Element* e, copy) {
|
||||
e->release();
|
||||
}
|
||||
@@ -211,7 +211,7 @@ public:
|
||||
|
||||
ElementPtr e = std::make_shared<Element>(this,
|
||||
reinterpret_cast<T*>(data_ + i * element_sz_));
|
||||
lent_elements_.append(e.get());
|
||||
lent_elements_.push_back(e.get());
|
||||
return e;
|
||||
}
|
||||
}
|
||||
@@ -230,9 +230,9 @@ public:
|
||||
|
||||
available_.replace(index, true);
|
||||
|
||||
lent_elements_.removeOne(e);
|
||||
lent_elements_.remove(e);
|
||||
|
||||
if (lent_elements_.isEmpty()) {
|
||||
if (lent_elements_.empty()) {
|
||||
locker.unlock();
|
||||
parent_->ArenaIsEmpty(this);
|
||||
}
|
||||
@@ -281,7 +281,7 @@ public:
|
||||
|
||||
size_t element_sz_;
|
||||
|
||||
QLinkedList<Element*> lent_elements_;
|
||||
std::list<Element*> lent_elements_;
|
||||
|
||||
};
|
||||
|
||||
@@ -301,7 +301,7 @@ public:
|
||||
}
|
||||
|
||||
// All arenas were empty, we'll need to create a new one
|
||||
if (arenas_.isEmpty()) {
|
||||
if (arenas_.empty()) {
|
||||
qDebug() << "No arenas, creating new...";
|
||||
} else {
|
||||
qDebug() << "All arenas are full, creating new...";
|
||||
@@ -326,7 +326,7 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
arenas_.append(a);
|
||||
arenas_.push_back(a);
|
||||
return a->Get();
|
||||
}
|
||||
|
||||
@@ -340,7 +340,7 @@ public:
|
||||
|
||||
if (!a->GetUsageCount()) {
|
||||
qDebug() << "Removing an empty arena";
|
||||
arenas_.removeOne(a);
|
||||
arenas_.remove(a);
|
||||
delete a;
|
||||
}
|
||||
}
|
||||
@@ -358,7 +358,7 @@ protected:
|
||||
private:
|
||||
int element_count_;
|
||||
|
||||
QLinkedList<Arena*> arenas_;
|
||||
std::list<Arena*> arenas_;
|
||||
|
||||
QMutex lock_;
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ RenderTicketPtr RenderBackend::RenderFrame(const rational &time)
|
||||
RenderTicketPtr ticket = std::make_shared<RenderTicket>(RenderTicket::kTypeVideo,
|
||||
TimeRange(time, time));
|
||||
|
||||
render_queue_.append(ticket);
|
||||
render_queue_.push_back(ticket);
|
||||
|
||||
RunNextJob();
|
||||
|
||||
@@ -156,7 +156,7 @@ RenderTicketPtr RenderBackend::RenderAudio(const TimeRange &r)
|
||||
RenderTicketPtr ticket = std::make_shared<RenderTicket>(RenderTicket::kTypeAudio,
|
||||
r);
|
||||
|
||||
render_queue_.append(ticket);
|
||||
render_queue_.push_back(ticket);
|
||||
|
||||
RunNextJob();
|
||||
|
||||
@@ -237,7 +237,7 @@ void RenderBackend::Close()
|
||||
void RenderBackend::RunNextJob()
|
||||
{
|
||||
// If queue is empty, nothing to be done
|
||||
if (render_queue_.isEmpty()) {
|
||||
if (render_queue_.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -295,7 +295,8 @@ void RenderBackend::RunNextJob()
|
||||
worker->SetVideoDownloadMatrix(video_download_matrix_);
|
||||
worker->SetCopyMap(©_map_);
|
||||
|
||||
RenderTicketPtr ticket = render_queue_.takeFirst();
|
||||
RenderTicketPtr ticket = render_queue_.front();
|
||||
render_queue_.pop_front();
|
||||
|
||||
switch (ticket->GetType()) {
|
||||
case RenderTicket::kTypeVideo:
|
||||
@@ -316,7 +317,7 @@ void RenderBackend::RunNextJob()
|
||||
break;
|
||||
}
|
||||
|
||||
if (render_queue_.isEmpty()) {
|
||||
if (render_queue_.empty()) {
|
||||
// No more jobs, can exit here
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ private:
|
||||
|
||||
QThreadPool pool_;
|
||||
|
||||
QLinkedList<RenderTicketPtr> render_queue_;
|
||||
std::list<RenderTicketPtr> render_queue_;
|
||||
|
||||
struct WorkerData {
|
||||
RenderWorker* worker;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#ifndef RENDERTICKET_H
|
||||
#define RENDERTICKET_H
|
||||
|
||||
#include <QMutex>
|
||||
#include <QWaitCondition>
|
||||
|
||||
#include "codec/frame.h"
|
||||
|
||||
Vendored
+1
-1
@@ -62,7 +62,7 @@ QFuture<void> CacheTask::DownloadFrame(FramePtr frame, const QByteArray &hash)
|
||||
return QtConcurrent::run(&download_threads_, FrameHashCache::SaveCacheFrame, hash, frame);
|
||||
}
|
||||
|
||||
void CacheTask::FrameDownloaded(const QByteArray &hash, const QLinkedList<rational> ×)
|
||||
void CacheTask::FrameDownloaded(const QByteArray &hash, const std::list<rational> ×)
|
||||
{
|
||||
foreach (const rational& t, times) {
|
||||
viewer()->video_frame_cache()->SetHash(t, hash);
|
||||
|
||||
Vendored
+1
-1
@@ -42,7 +42,7 @@ public slots:
|
||||
protected:
|
||||
virtual QFuture<void> DownloadFrame(FramePtr frame, const QByteArray &hash) override;
|
||||
|
||||
virtual void FrameDownloaded(const QByteArray& hash, const QLinkedList<rational>& times) override;
|
||||
virtual void FrameDownloaded(const QByteArray& hash, const std::list<rational>& times) override;
|
||||
|
||||
virtual void AudioDownloaded(const TimeRange& range, SampleBufferPtr samples) override;
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ QFuture<void> ExportTask::DownloadFrame(FramePtr frame, const QByteArray &hash)
|
||||
return QtConcurrent::run(FrameColorConvert, color_processor_, frame);
|
||||
}
|
||||
|
||||
void ExportTask::FrameDownloaded(const QByteArray &hash, const QLinkedList<rational> ×)
|
||||
void ExportTask::FrameDownloaded(const QByteArray &hash, const std::list<rational> ×)
|
||||
{
|
||||
FramePtr f = rendered_frame_.value(hash);
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public slots:
|
||||
protected:
|
||||
virtual QFuture<void> DownloadFrame(FramePtr frame, const QByteArray &hash) override;
|
||||
|
||||
virtual void FrameDownloaded(const QByteArray& hash, const QLinkedList<rational>& times) override;
|
||||
virtual void FrameDownloaded(const QByteArray& hash, const std::list<rational>& times) override;
|
||||
|
||||
virtual void AudioDownloaded(const TimeRange& range, SampleBufferPtr samples) override;
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ protected:
|
||||
|
||||
virtual QFuture<void> DownloadFrame(FramePtr frame, const QByteArray &hash) = 0;
|
||||
|
||||
virtual void FrameDownloaded(const QByteArray& hash, const QLinkedList<rational>& times) = 0;
|
||||
virtual void FrameDownloaded(const QByteArray& hash, const std::list<rational>& times) = 0;
|
||||
|
||||
virtual void AudioDownloaded(const TimeRange& range, SampleBufferPtr samples) = 0;
|
||||
|
||||
|
||||
@@ -102,8 +102,8 @@ void TaskManager::AddTask(Task* t)
|
||||
|
||||
void TaskManager::CancelTask(Task *t)
|
||||
{
|
||||
if (failed_tasks_.contains(t)) {
|
||||
failed_tasks_.removeOne(t);
|
||||
if (std::find(failed_tasks_.begin(), failed_tasks_.end(), t) != failed_tasks_.end()) {
|
||||
failed_tasks_.remove(t);
|
||||
emit TaskRemoved(t);
|
||||
t->deleteLater();
|
||||
} else {
|
||||
@@ -125,7 +125,7 @@ void TaskManager::TaskFinished()
|
||||
} else {
|
||||
// Task failed, keep it so the user can see the error message
|
||||
emit TaskFailed(t);
|
||||
failed_tasks_.append(t);
|
||||
failed_tasks_.push_back(t);
|
||||
}
|
||||
|
||||
watcher->deleteLater();
|
||||
|
||||
@@ -119,7 +119,7 @@ private:
|
||||
/**
|
||||
* @brief Internal list of failed tasks
|
||||
*/
|
||||
QLinkedList<Task*> failed_tasks_;
|
||||
std::list<Task*> failed_tasks_;
|
||||
|
||||
/**
|
||||
* @brief Task thread pool
|
||||
|
||||
@@ -32,14 +32,14 @@ struct ViewerPlaybackFrame {
|
||||
FramePtr frame;
|
||||
};
|
||||
|
||||
class ViewerQueue : public QLinkedList<ViewerPlaybackFrame> {
|
||||
class ViewerQueue : public std::list<ViewerPlaybackFrame> {
|
||||
public:
|
||||
ViewerQueue() = default;
|
||||
|
||||
void AppendTimewise(const ViewerPlaybackFrame& f, int playback_speed)
|
||||
{
|
||||
if (this->isEmpty() || (this->last().timestamp < f.timestamp) == (playback_speed > 0)) {
|
||||
this->append(f);
|
||||
if (this->empty() || (this->back().timestamp < f.timestamp) == (playback_speed > 0)) {
|
||||
this->push_back(f);
|
||||
} else {
|
||||
for (iterator i=this->begin(); i!=this->end(); i++) {
|
||||
if ((i->timestamp > f.timestamp) == (playback_speed > 0)) {
|
||||
|
||||
Reference in New Issue
Block a user