cache: reimplemented auto-caching

Implemented a smarter auto-cache that's context sensitive. Caching will
automatically pause when playback begins or values are being changed and resume
when inactive.
This commit is contained in:
itsmattkc
2020-05-24 15:20:35 +10:00
parent a26a3cbf21
commit 89ae6e026f
19 changed files with 180 additions and 14 deletions
+1
View File
@@ -47,6 +47,7 @@ void TaskView::AddTask(Task *t)
{
// Create TaskViewItem (UI representation of a Task) and connect it
TaskViewItem* item = new TaskViewItem(t);
connect(item, &TaskViewItem::TaskCancelled, this, &TaskView::TaskCancelled);
items_.insert(t, item);
layout_->insertWidget(layout_->count()-1, item);
}
+3
View File
@@ -42,6 +42,9 @@ class TaskView : public QScrollArea
public:
TaskView(QWidget* parent);
signals:
void TaskCancelled(Task* t);
public slots:
/**
* @brief Creates a TaskViewItem, connects it to a Task, and adds it to this widget
+3 -2
View File
@@ -61,12 +61,13 @@ TaskViewItem::TaskViewItem(Task* task, QWidget *parent) :
// Connect to the task
connect(task_, &Task::ProgressChanged, this, &TaskViewItem::UpdateProgress);
connect(cancel_btn_, &QPushButton::clicked, task_, &Task::Cancel, Qt::DirectConnection);
connect(cancel_btn_, &QPushButton::clicked, this, [this] { emit TaskCancelled(task_); });
}
void TaskViewItem::Failed()
{
task_status_lbl_->setText(task_->GetError());
task_status_lbl_->setStyleSheet("color: red");
task_status_lbl_->setText(tr("Error: %1").arg(task_->GetError()));
}
void TaskViewItem::UpdateProgress(double d)
+3
View File
@@ -47,6 +47,9 @@ public:
void Failed();
signals:
void TaskCancelled(Task* t);
private:
QLabel* task_name_lbl_;
QProgressBar* progress_bar_;