Browse Source

- Remember tracker list column width on restart

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
81412584e1
  1. 25
      src/trackerlist.h

25
src/trackerlist.h

@ -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

Loading…
Cancel
Save