mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 12:34:19 +00:00
- Remember sorted column in peer list
This commit is contained in:
parent
8b78096366
commit
581efd0afd
@ -248,6 +248,18 @@ void PeerListWidget::loadSettings() {
|
||||
setColumnWidth(i, contentColsWidths.at(i).toInt());
|
||||
}
|
||||
}
|
||||
// Load sorted column
|
||||
QString sortedCol = settings.value(QString::fromUtf8("TorrentProperties/Peers/PeerListSortedCol"), QString()).toString();
|
||||
if(!sortedCol.isEmpty()) {
|
||||
Qt::SortOrder sortOrder;
|
||||
if(sortedCol.endsWith(QString::fromUtf8("d")))
|
||||
sortOrder = Qt::DescendingOrder;
|
||||
else
|
||||
sortOrder = Qt::AscendingOrder;
|
||||
sortedCol.chop(1);
|
||||
int index = sortedCol.toInt();
|
||||
sortByColumn(index, sortOrder);
|
||||
}
|
||||
}
|
||||
|
||||
void PeerListWidget::saveSettings() const {
|
||||
@ -257,6 +269,15 @@ void PeerListWidget::saveSettings() const {
|
||||
contentColsWidths.append(columnWidth(i));
|
||||
}
|
||||
settings.setValue(QString::fromUtf8("TorrentProperties/Peers/peersColsWidth"), contentColsWidths);
|
||||
// Save sorted column
|
||||
Qt::SortOrder sortOrder = header()->sortIndicatorOrder();
|
||||
QString sortOrderLetter;
|
||||
if(sortOrder == Qt::AscendingOrder)
|
||||
sortOrderLetter = QString::fromUtf8("a");
|
||||
else
|
||||
sortOrderLetter = QString::fromUtf8("d");
|
||||
int index = header()->sortIndicatorSection();
|
||||
settings.setValue(QString::fromUtf8("TorrentProperties/Peers/PeerListSortedCol"), misc::toQString(index)+sortOrderLetter);
|
||||
}
|
||||
|
||||
void PeerListWidget::loadPeers(const QTorrentHandle &h, bool force_hostname_resolution) {
|
||||
|
@ -1041,7 +1041,7 @@ void TransferListWidget::loadLastSortedColumn() {
|
||||
sortOrder = Qt::DescendingOrder;
|
||||
else
|
||||
sortOrder = Qt::AscendingOrder;
|
||||
sortedCol = sortedCol.left(sortedCol.size()-1);
|
||||
sortedCol.chop(1);
|
||||
int index = sortedCol.toInt();
|
||||
sortByColumn(index, sortOrder);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user