From 2d37a39e43f2be74c6584c453b4eb89599414f32 Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Sun, 25 Dec 2016 01:12:05 +0200 Subject: [PATCH] Allow to change priority for unselected files through the combobox like it is done via the context menu. --- src/gui/properties/proplistdelegate.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/gui/properties/proplistdelegate.cpp b/src/gui/properties/proplistdelegate.cpp index 6a33a6b6d..50e342717 100644 --- a/src/gui/properties/proplistdelegate.cpp +++ b/src/gui/properties/proplistdelegate.cpp @@ -154,14 +154,17 @@ void PropListDelegate::setEditorData(QWidget *editor, const QModelIndex &index) QComboBox *combobox = static_cast(editor); // Set combobox index switch(index.data().toInt()) { - case prio::HIGH: - combobox->setCurrentIndex(1); + case prio::IGNORED: + combobox->setCurrentIndex(0); break; - case prio::MAXIMUM: + case prio::HIGH: combobox->setCurrentIndex(2); break; + case prio::MAXIMUM: + combobox->setCurrentIndex(3); + break; default: - combobox->setCurrentIndex(0); + combobox->setCurrentIndex(1); break; } } @@ -176,13 +179,12 @@ QWidget *PropListDelegate::createEditor(QWidget *parent, const QStyleOptionViewI return 0; } - if (index.data().toInt() <= 0) { - // IGNORED or MIXED + if (index.data().toInt() == prio::MIXED) return 0; - } QComboBox* editor = new QComboBox(parent); editor->setFocusPolicy(Qt::StrongFocus); + editor->addItem(tr("Do not download", "Do not download (priority)")); editor->addItem(tr("Normal", "Normal (priority)")); editor->addItem(tr("High", "High (priority)")); editor->addItem(tr("Maximum", "Maximum (priority)")); @@ -196,10 +198,13 @@ void PropListDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, qDebug("PropListDelegate: setModelData(%d)", value); switch(value) { - case 1: - model->setData(index, prio::HIGH); // HIGH + case 0: + model->setData(index, prio::IGNORED); // IGNORED break; case 2: + model->setData(index, prio::HIGH); // HIGH + break; + case 3: model->setData(index, prio::MAXIMUM); // MAX break; default: