mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-27 03:39:39 +03:00
Allow to change priority for unselected files through the combobox like it is done via the context menu.
This commit is contained in:
parent
7ba66e692f
commit
2d37a39e43
1 changed files with 14 additions and 9 deletions
|
@ -154,14 +154,17 @@ void PropListDelegate::setEditorData(QWidget *editor, const QModelIndex &index)
|
||||||
QComboBox *combobox = static_cast<QComboBox*>(editor);
|
QComboBox *combobox = static_cast<QComboBox*>(editor);
|
||||||
// Set combobox index
|
// Set combobox index
|
||||||
switch(index.data().toInt()) {
|
switch(index.data().toInt()) {
|
||||||
case prio::HIGH:
|
case prio::IGNORED:
|
||||||
combobox->setCurrentIndex(1);
|
combobox->setCurrentIndex(0);
|
||||||
break;
|
break;
|
||||||
case prio::MAXIMUM:
|
case prio::HIGH:
|
||||||
combobox->setCurrentIndex(2);
|
combobox->setCurrentIndex(2);
|
||||||
break;
|
break;
|
||||||
|
case prio::MAXIMUM:
|
||||||
|
combobox->setCurrentIndex(3);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
combobox->setCurrentIndex(0);
|
combobox->setCurrentIndex(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,13 +179,12 @@ QWidget *PropListDelegate::createEditor(QWidget *parent, const QStyleOptionViewI
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index.data().toInt() <= 0) {
|
if (index.data().toInt() == prio::MIXED)
|
||||||
// IGNORED or MIXED
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
QComboBox* editor = new QComboBox(parent);
|
QComboBox* editor = new QComboBox(parent);
|
||||||
editor->setFocusPolicy(Qt::StrongFocus);
|
editor->setFocusPolicy(Qt::StrongFocus);
|
||||||
|
editor->addItem(tr("Do not download", "Do not download (priority)"));
|
||||||
editor->addItem(tr("Normal", "Normal (priority)"));
|
editor->addItem(tr("Normal", "Normal (priority)"));
|
||||||
editor->addItem(tr("High", "High (priority)"));
|
editor->addItem(tr("High", "High (priority)"));
|
||||||
editor->addItem(tr("Maximum", "Maximum (priority)"));
|
editor->addItem(tr("Maximum", "Maximum (priority)"));
|
||||||
|
@ -196,10 +198,13 @@ void PropListDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
|
||||||
qDebug("PropListDelegate: setModelData(%d)", value);
|
qDebug("PropListDelegate: setModelData(%d)", value);
|
||||||
|
|
||||||
switch(value) {
|
switch(value) {
|
||||||
case 1:
|
case 0:
|
||||||
model->setData(index, prio::HIGH); // HIGH
|
model->setData(index, prio::IGNORED); // IGNORED
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
model->setData(index, prio::HIGH); // HIGH
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
model->setData(index, prio::MAXIMUM); // MAX
|
model->setData(index, prio::MAXIMUM); // MAX
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue