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:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -47,6 +47,9 @@ public:
|
||||
|
||||
void Failed();
|
||||
|
||||
signals:
|
||||
void TaskCancelled(Task* t);
|
||||
|
||||
private:
|
||||
QLabel* task_name_lbl_;
|
||||
QProgressBar* progress_bar_;
|
||||
|
||||
Reference in New Issue
Block a user