|
|
@ -4,10 +4,17 @@ |
|
|
|
#include <QListWidget> |
|
|
|
#include <QListWidget> |
|
|
|
#include <QListWidgetItem> |
|
|
|
#include <QListWidgetItem> |
|
|
|
#include <QIcon> |
|
|
|
#include <QIcon> |
|
|
|
|
|
|
|
#include <QSettings> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "TransferListWidget.h" |
|
|
|
|
|
|
|
|
|
|
|
class TransferListFiltersWidget: public QListWidget { |
|
|
|
class TransferListFiltersWidget: public QListWidget { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
|
|
|
TransferListWidget *transferList; |
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
TransferListFiltersWidget(QWidget *parent): QListWidget(parent) { |
|
|
|
TransferListFiltersWidget(QWidget *parent, TransferListWidget *transferList): QListWidget(parent), transferList(transferList) { |
|
|
|
// Add filters
|
|
|
|
// Add filters
|
|
|
|
QListWidgetItem *all = new QListWidgetItem(this); |
|
|
|
QListWidgetItem *all = new QListWidgetItem(this); |
|
|
|
all->setData(Qt::DisplayRole, tr("All")); |
|
|
|
all->setData(Qt::DisplayRole, tr("All")); |
|
|
@ -24,7 +31,26 @@ public: |
|
|
|
QListWidgetItem *inactive = new QListWidgetItem(this); |
|
|
|
QListWidgetItem *inactive = new QListWidgetItem(this); |
|
|
|
inactive->setData(Qt::DisplayRole, tr("Inactive")); |
|
|
|
inactive->setData(Qt::DisplayRole, tr("Inactive")); |
|
|
|
inactive->setData(Qt::DecorationRole, QIcon(":/Icons/oxygen/draw-rectangle.png")); |
|
|
|
inactive->setData(Qt::DecorationRole, QIcon(":/Icons/oxygen/draw-rectangle.png")); |
|
|
|
|
|
|
|
// Load settings
|
|
|
|
|
|
|
|
loadSettings(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
~TransferListFiltersWidget() { |
|
|
|
|
|
|
|
saveSettings(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void saveSettings() const { |
|
|
|
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); |
|
|
|
|
|
|
|
settings.beginGroup(QString::fromUtf8("TransferListFilters")); |
|
|
|
|
|
|
|
settings.setValue("selectedFilterIndex", QVariant(currentRow())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void loadSettings() { |
|
|
|
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); |
|
|
|
|
|
|
|
settings.beginGroup(QString::fromUtf8("TransferListFilters")); |
|
|
|
|
|
|
|
setCurrentRow(settings.value("selectedFilterIndex", 0).toInt()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
#endif // TRANSFERLISTFILTERSWIDGET_H
|
|
|
|
#endif // TRANSFERLISTFILTERSWIDGET_H
|
|
|
|