Browse Source

- Remember sorted column in peer list

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
581efd0afd
  1. 21
      src/peerlistwidget.cpp
  2. 2
      src/transferlistwidget.cpp

21
src/peerlistwidget.cpp

@ -248,6 +248,18 @@ void PeerListWidget::loadSettings() { @@ -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 { @@ -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) {

2
src/transferlistwidget.cpp

@ -1041,7 +1041,7 @@ void TransferListWidget::loadLastSortedColumn() { @@ -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…
Cancel
Save