BUGFIX: Fix column hiding/showing in transfer list

This commit is contained in:
Christophe Dumez
2011-03-13 17:53:51 +00:00
parent f9064d8b00
commit 49fd36aa2c
3 changed files with 24 additions and 16 deletions

View File

@@ -1,5 +1,8 @@
* Sn Mar 13 2011 - Christophe Dumez <chris@qbittorrent.org> - v2.6.8 * Sun Mar 13 2011 - Christophe Dumez <chris@qbittorrent.org> - v2.6.9
- BUFIX: Fix compilation with libtorrent v0.14.x - BUGFIX: Fix column hiding/showing in transfer list
* Sun Mar 13 2011 - Christophe Dumez <chris@qbittorrent.org> - v2.6.8
- BUGFIX: Fix compilation with libtorrent v0.14.x
- BUGFIX: Fix issues when writing on NTFS (Linux, Mac) - BUGFIX: Fix issues when writing on NTFS (Linux, Mac)
- BUGFIX: Fix root folder being cut off if the torrent comes from a scanned folder (Christian Kandeler) - BUGFIX: Fix root folder being cut off if the torrent comes from a scanned folder (Christian Kandeler)
- BUGFIX: Improve folder removal behavior - BUGFIX: Improve folder removal behavior

View File

@@ -66,7 +66,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *main_window,
QTreeView(parent), BTSession(_BTSession), main_window(main_window) { QTreeView(parent), BTSession(_BTSession), main_window(main_window) {
// Load settings // Load settings
loadSettings(); bool column_loaded = loadSettings();
// Create and apply delegate // Create and apply delegate
listDelegate = new TransferListDelegate(this); listDelegate = new TransferListDelegate(this);
@@ -106,15 +106,17 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *main_window,
setDragDropMode(QAbstractItemView::DragOnly); setDragDropMode(QAbstractItemView::DragOnly);
// Default hidden columns // Default hidden columns
setColumnHidden(TorrentModelItem::TR_PRIORITY, true); if(!column_loaded) {
setColumnHidden(TorrentModelItem::TR_ADD_DATE, true); setColumnHidden(TorrentModelItem::TR_PRIORITY, true);
setColumnHidden(TorrentModelItem::TR_SEED_DATE, true); setColumnHidden(TorrentModelItem::TR_ADD_DATE, true);
setColumnHidden(TorrentModelItem::TR_UPLIMIT, true); setColumnHidden(TorrentModelItem::TR_SEED_DATE, true);
setColumnHidden(TorrentModelItem::TR_DLLIMIT, true); setColumnHidden(TorrentModelItem::TR_UPLIMIT, true);
setColumnHidden(TorrentModelItem::TR_TRACKER, true); setColumnHidden(TorrentModelItem::TR_DLLIMIT, true);
setColumnHidden(TorrentModelItem::TR_AMOUNT_DOWNLOADED, true); setColumnHidden(TorrentModelItem::TR_TRACKER, true);
setColumnHidden(TorrentModelItem::TR_AMOUNT_LEFT, true); setColumnHidden(TorrentModelItem::TR_AMOUNT_DOWNLOADED, true);
setColumnHidden(TorrentModelItem::TR_TIME_ELAPSED, true); setColumnHidden(TorrentModelItem::TR_AMOUNT_LEFT, true);
setColumnHidden(TorrentModelItem::TR_TIME_ELAPSED, true);
}
setContextMenuPolicy(Qt::CustomContextMenu); setContextMenuPolicy(Qt::CustomContextMenu);
@@ -873,10 +875,13 @@ void TransferListWidget::saveSettings()
settings.setValue("TransferList/HeaderState", header()->saveState()); settings.setValue("TransferList/HeaderState", header()->saveState());
} }
void TransferListWidget::loadSettings() bool TransferListWidget::loadSettings()
{ {
QIniSettings settings("qBittorrent", "qBittorrent"); QIniSettings settings("qBittorrent", "qBittorrent");
header()->resizeSection(0, 200); // Default bool ok = header()->restoreState(settings.value("TransferList/HeaderState").toByteArray());
header()->restoreState(settings.value("TransferList/HeaderState").toByteArray()); if(!ok) {
header()->resizeSection(0, 200); // Default
}
return ok;
} }

View File

@@ -88,7 +88,7 @@ protected:
QModelIndex mapFromSource(const QModelIndex &index) const; QModelIndex mapFromSource(const QModelIndex &index) const;
QStringList getCustomLabels() const; QStringList getCustomLabels() const;
void saveSettings(); void saveSettings();
void loadSettings(); bool loadSettings();
QStringList getSelectedTorrentsHashes() const; QStringList getSelectedTorrentsHashes() const;
protected slots: protected slots: