From f1ca4f40afb1c490fd7bd2a1ee35a2392fd2681c Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sat, 4 Dec 2010 09:59:21 +0000 Subject: [PATCH] Code clean up --- src/torrentadditiondlg.cpp | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/src/torrentadditiondlg.cpp b/src/torrentadditiondlg.cpp index 6d96786d6..e0c542d3b 100644 --- a/src/torrentadditiondlg.cpp +++ b/src/torrentadditiondlg.cpp @@ -119,33 +119,15 @@ torrentAdditionDialog::~torrentAdditionDialog() { void torrentAdditionDialog::readSettings() { QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); - // Restore size and position - resize(settings.value(QString::fromUtf8("TorrentAdditionDlg/size"), size()).toSize()); - move(settings.value(QString::fromUtf8("TorrentAdditionDlg/pos"), misc::screenCenter(this)).toPoint()); - // Restore column width - const QList contentColsWidths = misc::intListfromStringList(settings.value(QString::fromUtf8("TorrentAdditionDlg/filesColsWidth")).toStringList()); - if(contentColsWidths.empty()) { - torrentContentList->header()->resizeSection(0, 200); - } else { - for(int i=0; isetColumnWidth(i, contentColsWidths.at(i)); - } - } + restoreGeometry(settings.value("TorrentAdditionDlg/dimensions").toByteArray()); + torrentContentList->header()->resizeSection(0, 200); //Default + torrentContentList->header()->restoreState(settings.value("TorrentAdditionDlg/contentHeaderState").toByteArray()); } void torrentAdditionDialog::saveSettings() { QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); - if(!is_magnet && t.get() && t->is_valid() && t->num_files() > 1) { - QStringList contentColsWidths; - // -1 because we hid PROGRESS column - for(int i=0; icolumnCount()-1; ++i) { - contentColsWidths << QString::number(torrentContentList->columnWidth(i)); - } - settings.setValue(QString::fromUtf8("TorrentAdditionDlg/filesColsWidth"), contentColsWidths); - } - settings.setValue("TorrentAdditionDlg/size", size()+QSize(0, hidden_height)); - qDebug("pos: (%d, %d)", pos().x(), pos().y()); - settings.setValue("TorrentAdditionDlg/pos", pos()); + settings.setValue("TorrentAdditionDlg/dimensions", saveGeometry()); + settings.setValue("TorrentAdditionDlg/contentHeaderState", torrentContentList->header()->saveState()); } void torrentAdditionDialog::renameTorrentNameInModel(QString file_path) {