mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-17 14:08:03 -06:00
Use enums instead of values when dealing with file priorities
This commit is contained in:
@@ -42,6 +42,7 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "propertieswidget.h"
|
#include "propertieswidget.h"
|
||||||
|
#include "torrentcontentmodelitem.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||||
@@ -109,16 +110,16 @@ public:
|
|||||||
QItemDelegate::drawBackground(painter, opt, index);
|
QItemDelegate::drawBackground(painter, opt, index);
|
||||||
QString text = "";
|
QString text = "";
|
||||||
switch(index.data().toInt()) {
|
switch(index.data().toInt()) {
|
||||||
case -1:
|
case prio::MIXED:
|
||||||
text = tr("Mixed", "Mixed (priorities");
|
text = tr("Mixed", "Mixed (priorities");
|
||||||
break;
|
break;
|
||||||
case 0:
|
case prio::IGNORED:
|
||||||
text = tr("Not downloaded");
|
text = tr("Not downloaded");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case prio::HIGH:
|
||||||
text = tr("High", "High (priority)");
|
text = tr("High", "High (priority)");
|
||||||
break;
|
break;
|
||||||
case 7:
|
case prio::MAXIMUM:
|
||||||
text = tr("Maximum", "Maximum (priority)");
|
text = tr("Maximum", "Maximum (priority)");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -139,10 +140,10 @@ public:
|
|||||||
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 2:
|
case prio::HIGH:
|
||||||
combobox->setCurrentIndex(1);
|
combobox->setCurrentIndex(1);
|
||||||
break;
|
break;
|
||||||
case 7:
|
case prio::MAXIMUM:
|
||||||
combobox->setCurrentIndex(2);
|
combobox->setCurrentIndex(2);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -177,13 +178,13 @@ public slots:
|
|||||||
qDebug("PropListDelegate: setModelData(%d)", value);
|
qDebug("PropListDelegate: setModelData(%d)", value);
|
||||||
switch(value) {
|
switch(value) {
|
||||||
case 1:
|
case 1:
|
||||||
model->setData(index, 2); // HIGH
|
model->setData(index, prio::HIGH);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
model->setData(index, 7); // MAX
|
model->setData(index, prio::MAXIMUM);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
model->setData(index, 1); // NORMAL
|
model->setData(index, prio::NORMAL);
|
||||||
}
|
}
|
||||||
emit filteredFilesChanged();
|
emit filteredFilesChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user