- Save files list column width

This commit is contained in:
Christophe Dumez 2009-11-09 19:30:13 +00:00
parent f9da85ecfe
commit 998b161696
4 changed files with 46 additions and 10 deletions

View file

@ -116,8 +116,7 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, TransferListWidget *transfer
}
PropertiesWidget::~PropertiesWidget() {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
settings.setValue("TorrentProperties/Visible", state==VISIBLE);
saveSettings();
delete refreshTimer;
if(progressBarUpdater)
delete progressBarUpdater;
@ -218,6 +217,28 @@ void PropertiesWidget::loadTorrentInfos(QTorrentHandle &_h) {
loadDynamicData();
}
void PropertiesWidget::readSettings() {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QVariantList contentColsWidths = settings.value(QString::fromUtf8("TorrentProperties/filesColsWidth"), QVariantList()).toList();
if(contentColsWidths.empty()) {
filesList->header()->resizeSection(0, filesList->width()/2.);
} else {
for(int i=0; i<contentColsWidths.size(); ++i) {
filesList->setColumnWidth(i, contentColsWidths.at(i).toInt());
}
}
}
void PropertiesWidget::saveSettings() {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
settings.setValue("TorrentProperties/Visible", state==VISIBLE);
QVariantList contentColsWidths;
for(int i=0; i<PropListModel->columnCount()-1; ++i) {
contentColsWidths.append(filesList->columnWidth(i));
}
settings.setValue(QString::fromUtf8("TorrentProperties/filesColsWidth"), contentColsWidths);
}
void PropertiesWidget::loadDynamicData() {
if(!h.is_valid()) return;
try {