mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-28 05:27:15 +03:00
- Remember visual indexes of columns in transfer lists
This commit is contained in:
parent
8ad987a672
commit
7f2639fcbd
2 changed files with 44 additions and 0 deletions
|
@ -182,6 +182,23 @@ bool FinishedTorrents::loadColWidthFinishedList(){
|
|||
finishedList->header()->resizeSection(i, width_list.at(i).toInt());
|
||||
}
|
||||
loadLastSortedColumn();
|
||||
QVariantList visualIndexes = settings.value(QString::fromUtf8("FinishedListVisualIndexes"), QVariantList()).toList();
|
||||
if(visualIndexes.size() != finishedListModel->columnCount()-1) {
|
||||
qDebug("Corrupted values for download list columns sizes");
|
||||
return false;
|
||||
}
|
||||
bool change = false;
|
||||
do {
|
||||
change = false;
|
||||
for(int i=0;i<visualIndexes.size(); ++i) {
|
||||
int new_visual_index = visualIndexes.at(finishedList->header()->logicalIndex(i)).toInt();
|
||||
if(i != new_visual_index) {
|
||||
qDebug("Moving column from %d to %d", finishedList->header()->logicalIndex(i), new_visual_index);
|
||||
finishedList->header()->moveSection(i, new_visual_index);
|
||||
change = true;
|
||||
}
|
||||
}
|
||||
}while(change);
|
||||
qDebug("Finished list columns width loaded");
|
||||
return true;
|
||||
}
|
||||
|
@ -229,6 +246,11 @@ void FinishedTorrents::saveColWidthFinishedList() const{
|
|||
}
|
||||
}
|
||||
settings.setValue("FinishedListColsWidth", new_width_list.join(" "));
|
||||
QVariantList visualIndexes;
|
||||
for(int i=0; i<nbColumns; ++i) {
|
||||
visualIndexes.append(finishedList->header()->visualIndex(i));
|
||||
}
|
||||
settings.setValue(QString::fromUtf8("FinishedListVisualIndexes"), visualIndexes);
|
||||
qDebug("Finished list columns width saved");
|
||||
}
|
||||
|
||||
|
|
|
@ -738,6 +738,11 @@ void DownloadingTorrents::saveColWidthDLList() const{
|
|||
}
|
||||
}
|
||||
settings.setValue(QString::fromUtf8("DownloadListColsWidth"), new_width_list.join(QString::fromUtf8(" ")));
|
||||
QVariantList visualIndexes;
|
||||
for(int i=0; i<nbColumns; ++i) {
|
||||
visualIndexes.append(downloadList->header()->visualIndex(i));
|
||||
}
|
||||
settings.setValue(QString::fromUtf8("DownloadListVisualIndexes"), visualIndexes);
|
||||
qDebug("Download list columns width saved");
|
||||
}
|
||||
|
||||
|
@ -758,6 +763,23 @@ bool DownloadingTorrents::loadColWidthDLList() {
|
|||
for(unsigned int i=0; i<listSize; ++i) {
|
||||
downloadList->header()->resizeSection(i, width_list.at(i).toInt());
|
||||
}
|
||||
QVariantList visualIndexes = settings.value(QString::fromUtf8("DownloadListVisualIndexes"), QVariantList()).toList();
|
||||
if(visualIndexes.size() != DLListModel->columnCount()-1) {
|
||||
qDebug("Corrupted values for download list columns sizes");
|
||||
return false;
|
||||
}
|
||||
bool change = false;
|
||||
do {
|
||||
change = false;
|
||||
for(int i=0;i<visualIndexes.size(); ++i) {
|
||||
int new_visual_index = visualIndexes.at(downloadList->header()->logicalIndex(i)).toInt();
|
||||
if(i != new_visual_index) {
|
||||
qDebug("Moving column from %d to %d", downloadList->header()->logicalIndex(i), new_visual_index);
|
||||
downloadList->header()->moveSection(i, new_visual_index);
|
||||
change = true;
|
||||
}
|
||||
}
|
||||
}while(change);
|
||||
qDebug("Download list columns width loaded");
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue