diff --git a/src/PropListDelegate.h b/src/PropListDelegate.h index 1def6ce28..ca165c134 100644 --- a/src/PropListDelegate.h +++ b/src/PropListDelegate.h @@ -43,7 +43,7 @@ #include "misc.h" // Defines for properties list columns -enum PropColumn {NAME, SIZE, PROGRESS, PRIORITY, INDEX}; +enum PropColumn {NAME, SIZE, PROGRESS, PRIORITY}; enum PropPriority {IGNORED=0, NORMAL=1, HIGH=2, MAXIMUM=7}; class PropListDelegate: public QItemDelegate { diff --git a/src/propertieswidget.cpp b/src/propertieswidget.cpp index b3111a62e..2c7f3f83f 100644 --- a/src/propertieswidget.cpp +++ b/src/propertieswidget.cpp @@ -65,7 +65,6 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, TransferListWidget *transfer // Set Properties list model PropListModel = new TorrentFilesModel(); filesList->setModel(PropListModel); - filesList->hideColumn(INDEX); PropDelegate = new PropListDelegate(0); filesList->setItemDelegate(PropDelegate); @@ -217,7 +216,7 @@ void PropertiesWidget::saveSettings() { QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); settings.setValue("TorrentProperties/Visible", state==VISIBLE); QVariantList contentColsWidths; - for(int i=0; icolumnCount()-1; ++i) { + for(int i=0; icolumnCount(); ++i) { contentColsWidths.append(filesList->columnWidth(i)); } settings.setValue(QString::fromUtf8("TorrentProperties/filesColsWidth"), contentColsWidths); diff --git a/src/torrentAddition.h b/src/torrentAddition.h index 91c5a57db..25a9b84ba 100644 --- a/src/torrentAddition.h +++ b/src/torrentAddition.h @@ -74,7 +74,6 @@ public: PropListModel = new TorrentFilesModel(); torrentContentList->setModel(PropListModel); torrentContentList->hideColumn(PROGRESS); - torrentContentList->hideColumn(INDEX); PropDelegate = new PropListDelegate(); torrentContentList->setItemDelegate(PropDelegate); connect(torrentContentList, SIGNAL(clicked(const QModelIndex&)), torrentContentList, SLOT(edit(const QModelIndex&))); @@ -85,8 +84,8 @@ public: connect(actionMaximum, SIGNAL(triggered()), this, SLOT(maximumSelection())); connect(collapseAllButton, SIGNAL(clicked()), torrentContentList, SLOT(collapseAll())); connect(expandAllButton, SIGNAL(clicked()), torrentContentList, SLOT(expandAll())); - // FIXME: Remember columns width - torrentContentList->header()->resizeSection(0, 200); + // Remember columns width + readSettings(); //torrentContentList->header()->setResizeMode(0, QHeaderView::Stretch); QString home = QDir::homePath(); if(home[home.length()-1] != QDir::separator()){ @@ -101,10 +100,33 @@ public: } ~torrentAdditionDialog() { + saveSettings(); delete PropDelegate; delete PropListModel; } + void readSettings() { + QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); + QVariantList contentColsWidths = settings.value(QString::fromUtf8("TorrentAdditionDlg/filesColsWidth"), QVariantList()).toList(); + if(contentColsWidths.empty()) { + torrentContentList->header()->resizeSection(0, 200); + } else { + for(int i=0; isetColumnWidth(i, contentColsWidths.at(i).toInt()); + } + } + } + + void saveSettings() { + QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); + QVariantList contentColsWidths; + // -1 because we hid PROGRESS column + for(int i=0; icolumnCount()-1; ++i) { + contentColsWidths.append(torrentContentList->columnWidth(i)); + } + settings.setValue(QString::fromUtf8("TorrentAdditionDlg/filesColsWidth"), contentColsWidths); + } + void showLoad(QString filePath, QString from_url=QString::null){ if(!QFile::exists(filePath)) { close();