1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-14 16:57:55 +00:00

- Remember tracker list column width on restart

This commit is contained in:
Christophe Dumez 2009-11-19 12:27:52 +00:00
parent 1b82dd315b
commit 81412584e1

View File

@ -35,6 +35,7 @@
#include <QTreeWidgetItem> #include <QTreeWidgetItem>
#include <QStringList> #include <QStringList>
#include <QMenu> #include <QMenu>
#include <QSettings>
#include <QHash> #include <QHash>
#include <QAction> #include <QAction>
#include "propertieswidget.h" #include "propertieswidget.h"
@ -67,10 +68,11 @@ public:
header << tr("Status"); header << tr("Status");
header << tr("Message"); header << tr("Message");
setHeaderItem(new QTreeWidgetItem(header)); setHeaderItem(new QTreeWidgetItem(header));
loadSettings();
} }
~TrackerList() { ~TrackerList() {
saveSettings();
} }
public slots: public slots:
@ -191,6 +193,27 @@ public slots:
} }
} }
void loadSettings() {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QVariantList contentColsWidths = settings.value(QString::fromUtf8("TorrentProperties/Trackers/trackersColsWidth"), QVariantList()).toList();
if(!contentColsWidths.empty()) {
for(int i=0; i<contentColsWidths.size(); ++i) {
setColumnWidth(i, contentColsWidths.at(i).toInt());
}
} else {
setColumnWidth(0, 300);
}
}
void saveSettings() const {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QVariantList contentColsWidths;
for(int i=0; i<columnCount(); ++i) {
contentColsWidths.append(columnWidth(i));
}
settings.setValue(QString::fromUtf8("TorrentProperties/Trackers/trackersColsWidth"), contentColsWidths);
}
}; };
#endif // TRACKERLIST_H #endif // TRACKERLIST_H