| 92 | } |
| 93 | |
| 94 | void |
| 95 | BackgroundTasksDialog::setController(Suscan::MultitaskController *controller) |
| 96 | { |
| 97 | ButtonDelegate *delegate = new ButtonDelegate(this, "&Cancel"); |
| 98 | |
| 99 | this->controller = controller; |
| 100 | this->model = new MultitaskControllerModel(this, controller); |
| 101 | this->proxy = new QSortFilterProxyModel(this); |
| 102 | this->proxy->setSourceModel(this->model); |
| 103 | |
| 104 | // Until we figure out what the heck is wrong with the proxy model |
| 105 | // we stay with the unsortable model |
| 106 | this->ui->tableView->setModel(this->model); |
| 107 | this->ui->tableView->setSortingEnabled(false); |
| 108 | |
| 109 | this->ui->tableView->setItemDelegateForColumn( |
| 110 | 4, |
| 111 | new ProgressBarDelegate(this)); |
| 112 | |
| 113 | this->ui->tableView->setItemDelegateForColumn( |
| 114 | 5, |
| 115 | delegate); |
| 116 | |
| 117 | connect( |
| 118 | this->model, |
| 119 | SIGNAL(taskError(QString, QString)), |
| 120 | this, |
| 121 | SLOT(onError(QString, QString))); |
| 122 | |
| 123 | |
| 124 | connect( |
| 125 | this->model, |
| 126 | SIGNAL(layoutChanged(void)), |
| 127 | this, |
| 128 | SLOT(onLayoutChanged(void))); |
| 129 | |
| 130 | connect( |
| 131 | this->model, |
| 132 | SIGNAL( |
| 133 | dataChanged( |
| 134 | const QModelIndex &, |
| 135 | const QModelIndex &, |
| 136 | const QVector<int> &)), |
| 137 | this, |
| 138 | SLOT(onLayoutChanged(void))); |
| 139 | |
| 140 | connect( |
| 141 | delegate, |
| 142 | SIGNAL(clicked(QModelIndex)), |
| 143 | this, |
| 144 | SLOT(onCancelClicked(QModelIndex))); |
| 145 | } |
| 146 | |
| 147 | /////////////////////////////////// Slots ////////////////////////////////////// |
| 148 | void |