1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-02-02 09:55:55 +00:00

Simplify code

This version saves an `if` conditional.
This commit is contained in:
Chocobo1 2022-01-03 12:12:23 +08:00 committed by sledgehammer999
parent 7e8a176751
commit bf9516d164

View File

@ -153,11 +153,10 @@ namespace
auto pathList = settings()->loadValue<QStringList>(settingsKey); auto pathList = settings()->loadValue<QStringList>(settingsKey);
const int selectedSavePathIndex = pathList.indexOf(path); const int selectedSavePathIndex = pathList.indexOf(path);
if (selectedSavePathIndex > 0) if (selectedSavePathIndex > -1)
pathList.removeAt(selectedSavePathIndex); pathList.move(selectedSavePathIndex, 0);
if (selectedSavePathIndex != 0) else
pathList.prepend(path); pathList.prepend(path);
settings()->storeValue(settingsKey, QStringList(pathList.mid(0, maxLength))); settings()->storeValue(settingsKey, QStringList(pathList.mid(0, maxLength)));
} }
} }