mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
- Remember sorted column in peer list
This commit is contained in:
parent
8b78096366
commit
581efd0afd
2 changed files with 22 additions and 1 deletions
|
@ -248,6 +248,18 @@ void PeerListWidget::loadSettings() {
|
||||||
setColumnWidth(i, contentColsWidths.at(i).toInt());
|
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 {
|
void PeerListWidget::saveSettings() const {
|
||||||
|
@ -257,6 +269,15 @@ void PeerListWidget::saveSettings() const {
|
||||||
contentColsWidths.append(columnWidth(i));
|
contentColsWidths.append(columnWidth(i));
|
||||||
}
|
}
|
||||||
settings.setValue(QString::fromUtf8("TorrentProperties/Peers/peersColsWidth"), contentColsWidths);
|
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) {
|
void PeerListWidget::loadPeers(const QTorrentHandle &h, bool force_hostname_resolution) {
|
||||||
|
|
|
@ -1041,7 +1041,7 @@ void TransferListWidget::loadLastSortedColumn() {
|
||||||
sortOrder = Qt::DescendingOrder;
|
sortOrder = Qt::DescendingOrder;
|
||||||
else
|
else
|
||||||
sortOrder = Qt::AscendingOrder;
|
sortOrder = Qt::AscendingOrder;
|
||||||
sortedCol = sortedCol.left(sortedCol.size()-1);
|
sortedCol.chop(1);
|
||||||
int index = sortedCol.toInt();
|
int index = sortedCol.toInt();
|
||||||
sortByColumn(index, sortOrder);
|
sortByColumn(index, sortOrder);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue