mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-21 05:39:11 -04:00
Use macro for priority values instead of constants.
This commit is contained in:
parent
c5c406bb98
commit
8072d245f3
3 changed files with 15 additions and 10 deletions
|
@ -198,13 +198,13 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
||||||
case COLUMN_PRIORITY:
|
case COLUMN_PRIORITY:
|
||||||
{
|
{
|
||||||
double dblValue = index.data().toDouble();
|
double dblValue = index.data().toDouble();
|
||||||
if (dblValue == 0.0)
|
if (dblValue == PRIORITY_NULL)
|
||||||
temp = "";
|
temp = "";
|
||||||
else if (dblValue == 0.1)
|
else if (dblValue == PRIORITY_FASTER)
|
||||||
temp = tr("Faster");
|
temp = tr("Faster");
|
||||||
else if (dblValue == 0.2)
|
else if (dblValue == PRIORITY_AVERAGE)
|
||||||
temp = tr("Average");
|
temp = tr("Average");
|
||||||
else if (dblValue == 0.3)
|
else if (dblValue == PRIORITY_SLOWER)
|
||||||
temp = tr("Slower");
|
temp = tr("Slower");
|
||||||
else
|
else
|
||||||
temp = QString::number((uint32_t)dblValue);
|
temp = QString::number((uint32_t)dblValue);
|
||||||
|
|
|
@ -42,6 +42,11 @@
|
||||||
#define COLUMN_PATH 12
|
#define COLUMN_PATH 12
|
||||||
#define COLUMN_COUNT 13
|
#define COLUMN_COUNT 13
|
||||||
|
|
||||||
|
#define PRIORITY_NULL 0.0
|
||||||
|
#define PRIORITY_FASTER 0.1
|
||||||
|
#define PRIORITY_AVERAGE 0.2
|
||||||
|
#define PRIORITY_SLOWER 0.3
|
||||||
|
|
||||||
|
|
||||||
#define MAX_CHAR_TMP 128
|
#define MAX_CHAR_TMP 128
|
||||||
|
|
||||||
|
|
|
@ -885,7 +885,7 @@ int TransfersDialog::addDLItem(int row, const FileInfo &fileInfo)
|
||||||
default: status = tr("Unknown"); break;
|
default: status = tr("Unknown"); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
double priority = 0;
|
double priority = PRIORITY_NULL;
|
||||||
|
|
||||||
if (fileInfo.downloadStatus == FT_STATE_QUEUED) {
|
if (fileInfo.downloadStatus == FT_STATE_QUEUED) {
|
||||||
priority = fileInfo.queue_position;
|
priority = fileInfo.queue_position;
|
||||||
|
@ -893,10 +893,10 @@ int TransfersDialog::addDLItem(int row, const FileInfo &fileInfo)
|
||||||
priority = 0;
|
priority = 0;
|
||||||
} else {
|
} else {
|
||||||
switch (fileInfo.priority) {
|
switch (fileInfo.priority) {
|
||||||
case SPEED_LOW: priority = 0.3; break;
|
case SPEED_LOW: priority = PRIORITY_SLOWER; break;
|
||||||
case SPEED_NORMAL: priority = 0.2; break;
|
case SPEED_NORMAL: priority = PRIORITY_AVERAGE; break;
|
||||||
case SPEED_HIGH: priority = 0.1; break;
|
case SPEED_HIGH: priority = PRIORITY_FASTER; break;
|
||||||
default: priority = 0.2; break;
|
default: priority = PRIORITY_AVERAGE; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1082,7 +1082,7 @@ int TransfersDialog::addPeerToDLItem(QStandardItem *dlItem, const RsPeerId& peer
|
||||||
iProgress->setData(QVariant::fromValue(peerInfo), Qt::UserRole);
|
iProgress->setData(QVariant::fromValue(peerInfo), Qt::UserRole);
|
||||||
iSource->setData(QVariant(QString()), Qt::DisplayRole);
|
iSource->setData(QVariant(QString()), Qt::DisplayRole);
|
||||||
|
|
||||||
iPriority->setData(QVariant((double)0.0), Qt::DisplayRole); // blank field for priority
|
iPriority->setData(QVariant((double)PRIORITY_NULL), Qt::DisplayRole); // blank field for priority
|
||||||
iRemaining->setData(QVariant(QString()), Qt::DisplayRole);
|
iRemaining->setData(QVariant(QString()), Qt::DisplayRole);
|
||||||
iDownloadTime->setData(QVariant(QString()), Qt::DisplayRole);
|
iDownloadTime->setData(QVariant(QString()), Qt::DisplayRole);
|
||||||
iID->setData(QVariant() , Qt::DisplayRole);
|
iID->setData(QVariant() , Qt::DisplayRole);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue