mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-21 05:43:32 -07:00
serialize enum value as string instead of number
This commit is contained in:
parent
2bb45a9463
commit
fccbd816a9
4 changed files with 10 additions and 12 deletions
|
@ -5,6 +5,7 @@
|
||||||
* [#22989](https://github.com/qbittorrent/qBittorrent/pull/22989)
|
* [#22989](https://github.com/qbittorrent/qBittorrent/pull/22989)
|
||||||
* `sync/maindata` returns one new field: `share_limit_action`
|
* `sync/maindata` returns one new field: `share_limit_action`
|
||||||
* `torrents/setShareLimits` now requires a new `shareLimitAction` param that sets a torrent's shareLimitAction property
|
* `torrents/setShareLimits` now requires a new `shareLimitAction` param that sets a torrent's shareLimitAction property
|
||||||
|
* possible values `Default`, `Stop`, `Remove`, `RemoveWithContent` and `EnableSuperSeeding`
|
||||||
|
|
||||||
## 2.11.10
|
## 2.11.10
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ QVariantMap serialize(const BitTorrent::Torrent &torrent)
|
||||||
{KEY_TORRENT_POPULARITY, torrent.popularity()},
|
{KEY_TORRENT_POPULARITY, torrent.popularity()},
|
||||||
{KEY_TORRENT_SEEDING_TIME_LIMIT, torrent.seedingTimeLimit()},
|
{KEY_TORRENT_SEEDING_TIME_LIMIT, torrent.seedingTimeLimit()},
|
||||||
{KEY_TORRENT_INACTIVE_SEEDING_TIME_LIMIT, torrent.inactiveSeedingTimeLimit()},
|
{KEY_TORRENT_INACTIVE_SEEDING_TIME_LIMIT, torrent.inactiveSeedingTimeLimit()},
|
||||||
{KEY_TORRENT_SHARE_LIMIT_ACTION, static_cast<int>(torrent.shareLimitAction())},
|
{KEY_TORRENT_SHARE_LIMIT_ACTION, Utils::String::fromEnum(torrent.shareLimitAction())},
|
||||||
{KEY_TORRENT_LAST_SEEN_COMPLETE_TIME, Utils::DateTime::toSecsSinceEpoch(torrent.lastSeenComplete())},
|
{KEY_TORRENT_LAST_SEEN_COMPLETE_TIME, Utils::DateTime::toSecsSinceEpoch(torrent.lastSeenComplete())},
|
||||||
{KEY_TORRENT_AUTO_TORRENT_MANAGEMENT, torrent.isAutoTMMEnabled()},
|
{KEY_TORRENT_AUTO_TORRENT_MANAGEMENT, torrent.isAutoTMMEnabled()},
|
||||||
{KEY_TORRENT_TIME_ACTIVE, torrent.activeTime()},
|
{KEY_TORRENT_TIME_ACTIVE, torrent.activeTime()},
|
||||||
|
|
|
@ -1367,10 +1367,7 @@ void TorrentsController::setShareLimitsAction()
|
||||||
const qreal ratioLimit = params()[u"ratioLimit"_s].toDouble();
|
const qreal ratioLimit = params()[u"ratioLimit"_s].toDouble();
|
||||||
const qlonglong seedingTimeLimit = params()[u"seedingTimeLimit"_s].toLongLong();
|
const qlonglong seedingTimeLimit = params()[u"seedingTimeLimit"_s].toLongLong();
|
||||||
const qlonglong inactiveSeedingTimeLimit = params()[u"inactiveSeedingTimeLimit"_s].toLongLong();
|
const qlonglong inactiveSeedingTimeLimit = params()[u"inactiveSeedingTimeLimit"_s].toLongLong();
|
||||||
const int shareLimitActionParamValue = params()[u"shareLimitAction"_s].toInt();
|
const BitTorrent::ShareLimitAction shareLimitAction = Utils::String::toEnum(params()[u"shareLimitAction"_s], BitTorrent::ShareLimitAction::Default);
|
||||||
const BitTorrent::ShareLimitAction shareLimitAction = ((shareLimitActionParamValue >= 0) && (shareLimitActionParamValue <= 3))
|
|
||||||
? static_cast<BitTorrent::ShareLimitAction>(shareLimitActionParamValue)
|
|
||||||
: BitTorrent::ShareLimitAction::Default;
|
|
||||||
|
|
||||||
const QStringList hashes = params()[u"hashes"_s].split(u'|');
|
const QStringList hashes = params()[u"hashes"_s].split(u'|');
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
maxRatio: Number(origValues[3]),
|
maxRatio: Number(origValues[3]),
|
||||||
maxSeedingTime: Number(origValues[4]),
|
maxSeedingTime: Number(origValues[4]),
|
||||||
maxInactiveSeedingTime: Number(origValues[5]),
|
maxInactiveSeedingTime: Number(origValues[5]),
|
||||||
shareLimitAction: Number(origValues[6])
|
shareLimitAction: String(origValues[6])
|
||||||
};
|
};
|
||||||
|
|
||||||
// select default when orig values not passed. using double equals to compare string and int
|
// select default when orig values not passed. using double equals to compare string and int
|
||||||
|
@ -70,7 +70,7 @@
|
||||||
document.getElementById("inactiveMinutes").value = values.inactiveSeedingTimeLimit;
|
document.getElementById("inactiveMinutes").value = values.inactiveSeedingTimeLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
limitReachedActionsEl.value = values.shareLimitAction.toString();
|
limitReachedActionsEl.value = values.shareLimitAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
shareLimitChanged();
|
shareLimitChanged();
|
||||||
|
@ -195,11 +195,11 @@
|
||||||
<div style="margin-left: 40px; margin-bottom: 5px;">
|
<div style="margin-left: 40px; margin-bottom: 5px;">
|
||||||
<label id="actionListLabel" for="limitReachedActions">QBT_TR(Action when the limit is reached)QBT_TR[CONTEXT=UpDownRatioDialog]</label>
|
<label id="actionListLabel" for="limitReachedActions">QBT_TR(Action when the limit is reached)QBT_TR[CONTEXT=UpDownRatioDialog]</label>
|
||||||
<select id="limitReachedActions" aria-labelledby="actionListLabel">
|
<select id="limitReachedActions" aria-labelledby="actionListLabel">
|
||||||
<option value="-1">QBT_TR(Default)QBT_TR[CONTEXT=UpDownRatioDialog]</option>
|
<option value="Default">QBT_TR(Default)QBT_TR[CONTEXT=UpDownRatioDialog]</option>
|
||||||
<option value="0">QBT_TR(Stop torrent)QBT_TR[CONTEXT=UpDownRatioDialog]</option>
|
<option value="Stop">QBT_TR(Stop torrent)QBT_TR[CONTEXT=UpDownRatioDialog]</option>
|
||||||
<option value="1">QBT_TR(Remove torrent)QBT_TR[CONTEXT=UpDownRatioDialog]</option>
|
<option value="Remove">QBT_TR(Remove torrent)QBT_TR[CONTEXT=UpDownRatioDialog]</option>
|
||||||
<option value="3">QBT_TR(Remove torrent and its content)QBT_TR[CONTEXT=UpDownRatioDialog]</option>
|
<option value="RemoveWithContent">QBT_TR(Remove torrent and its content)QBT_TR[CONTEXT=UpDownRatioDialog]</option>
|
||||||
<option value="2">QBT_TR(Enable super seeding for torrent)QBT_TR[CONTEXT=UpDownRatioDialog]</option>
|
<option value="EnableSuperSeeding">QBT_TR(Enable super seeding for torrent)QBT_TR[CONTEXT=UpDownRatioDialog]</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div style="text-align: center; padding-top: 10px;">
|
<div style="text-align: center; padding-top: 10px;">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue