mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Remove unused code from the side panel filters.
This commit is contained in:
parent
96d7bfb4ad
commit
1bb968f9fd
@ -35,7 +35,7 @@
|
|||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QDragMoveEvent>
|
#include <QResizeEvent>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
@ -79,9 +79,6 @@ QSize FiltersBase::minimumSizeHint() const
|
|||||||
LabelFiltersList::LabelFiltersList(QWidget *parent)
|
LabelFiltersList::LabelFiltersList(QWidget *parent)
|
||||||
: FiltersBase(parent)
|
: FiltersBase(parent)
|
||||||
{
|
{
|
||||||
itemHover = 0;
|
|
||||||
// Accept drop
|
|
||||||
setAcceptDrops(true);
|
|
||||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,66 +114,8 @@ int LabelFiltersList::rowFromLabel(QString label) const
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LabelFiltersList::dragMoveEvent(QDragMoveEvent *event)
|
|
||||||
{
|
|
||||||
if (itemAt(event->pos()) && row(itemAt(event->pos())) > 0) {
|
|
||||||
if (itemHover) {
|
|
||||||
if (itemHover != itemAt(event->pos())) {
|
|
||||||
setItemHover(false);
|
|
||||||
itemHover = itemAt(event->pos());
|
|
||||||
setItemHover(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
itemHover = itemAt(event->pos());
|
|
||||||
setItemHover(true);
|
|
||||||
}
|
|
||||||
event->acceptProposedAction();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (itemHover)
|
|
||||||
setItemHover(false);
|
|
||||||
event->ignore();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LabelFiltersList::dropEvent(QDropEvent *event)
|
|
||||||
{
|
|
||||||
qDebug("Drop Event in labels list");
|
|
||||||
if (itemAt(event->pos()))
|
|
||||||
emit torrentDropped(row(itemAt(event->pos())));
|
|
||||||
event->ignore();
|
|
||||||
setItemHover(false);
|
|
||||||
// Select current item again
|
|
||||||
currentItem()->setSelected(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LabelFiltersList::dragLeaveEvent(QDragLeaveEvent*)
|
|
||||||
{
|
|
||||||
if (itemHover)
|
|
||||||
setItemHover(false);
|
|
||||||
// Select current item again
|
|
||||||
currentItem()->setSelected(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LabelFiltersList::setItemHover(bool hover)
|
|
||||||
{
|
|
||||||
Q_ASSERT(itemHover);
|
|
||||||
if (hover) {
|
|
||||||
itemHover->setData(Qt::DecorationRole, IconProvider::instance()->getIcon("folder-documents.png"));
|
|
||||||
itemHover->setSelected(true);
|
|
||||||
//setCurrentItem(itemHover);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
itemHover->setData(Qt::DecorationRole, IconProvider::instance()->getIcon("inode-directory.png"));
|
|
||||||
//itemHover->setSelected(false);
|
|
||||||
itemHover = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StatusFiltersWidget::StatusFiltersWidget(QWidget *parent)
|
StatusFiltersWidget::StatusFiltersWidget(QWidget *parent)
|
||||||
: FiltersBase(parent)
|
: FiltersBase(parent)
|
||||||
, m_shown(false)
|
|
||||||
{
|
{
|
||||||
setUniformItemSizes(true);
|
setUniformItemSizes(true);
|
||||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
@ -460,7 +399,6 @@ TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferLi
|
|||||||
connect(transferList->getSourceModel(), SIGNAL(modelRefreshed()), SLOT(updateTorrentNumbers()));
|
connect(transferList->getSourceModel(), SIGNAL(modelRefreshed()), SLOT(updateTorrentNumbers()));
|
||||||
connect(transferList->getSourceModel(), SIGNAL(torrentAdded(TorrentModelItem*)), SLOT(handleNewTorrent(TorrentModelItem*)));
|
connect(transferList->getSourceModel(), SIGNAL(torrentAdded(TorrentModelItem*)), SLOT(handleNewTorrent(TorrentModelItem*)));
|
||||||
connect(labelFilters, SIGNAL(currentRowChanged(int)), this, SLOT(applyLabelFilter(int)));
|
connect(labelFilters, SIGNAL(currentRowChanged(int)), this, SLOT(applyLabelFilter(int)));
|
||||||
connect(labelFilters, SIGNAL(torrentDropped(int)), this, SLOT(torrentDropped(int)));
|
|
||||||
connect(trackerFilters, SIGNAL(currentRowChanged(int)), this, SLOT(applyTrackerFilter(int)));
|
connect(trackerFilters, SIGNAL(currentRowChanged(int)), this, SLOT(applyTrackerFilter(int)));
|
||||||
connect(transferList->getSourceModel(), SIGNAL(torrentAboutToBeRemoved(TorrentModelItem*)), SLOT(torrentAboutToBeDeleted(TorrentModelItem*)));
|
connect(transferList->getSourceModel(), SIGNAL(torrentAboutToBeRemoved(TorrentModelItem*)), SLOT(torrentAboutToBeDeleted(TorrentModelItem*)));
|
||||||
connect(transferList->getSourceModel(), SIGNAL(torrentChangedLabel(TorrentModelItem*,QString,QString)), SLOT(torrentChangedLabel(TorrentModelItem*, QString, QString)));
|
connect(transferList->getSourceModel(), SIGNAL(torrentChangedLabel(TorrentModelItem*,QString,QString)), SLOT(torrentChangedLabel(TorrentModelItem*, QString, QString)));
|
||||||
@ -543,15 +481,6 @@ void TransferListFiltersWidget::updateTorrentNumbers()
|
|||||||
statusFilters->item(TorrentFilter::INACTIVE)->setData(Qt::DisplayRole, QVariant(tr("Inactive") + " (" + QString::number(report.nb_inactive) + ")"));
|
statusFilters->item(TorrentFilter::INACTIVE)->setData(Qt::DisplayRole, QVariant(tr("Inactive") + " (" + QString::number(report.nb_inactive) + ")"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferListFiltersWidget::torrentDropped(int row)
|
|
||||||
{
|
|
||||||
Q_ASSERT(row > 0);
|
|
||||||
if (row == 1)
|
|
||||||
transferList->setSelectionLabel("");
|
|
||||||
else
|
|
||||||
transferList->setSelectionLabel(labelFilters->labelFromRow(row));
|
|
||||||
}
|
|
||||||
|
|
||||||
void TransferListFiltersWidget::addLabel(QString& label)
|
void TransferListFiltersWidget::addLabel(QString& label)
|
||||||
{
|
{
|
||||||
label = fsutils::toValidFileSystemName(label.trimmed());
|
label = fsutils::toValidFileSystemName(label.trimmed());
|
||||||
|
@ -61,9 +61,6 @@ class LabelFiltersList: public FiltersBase
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
|
||||||
QListWidgetItem * itemHover;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LabelFiltersList(QWidget *parent);
|
LabelFiltersList(QWidget *parent);
|
||||||
|
|
||||||
@ -72,15 +69,6 @@ public:
|
|||||||
|
|
||||||
QString labelFromRow(int row) const;
|
QString labelFromRow(int row) const;
|
||||||
int rowFromLabel(QString label) const;
|
int rowFromLabel(QString label) const;
|
||||||
|
|
||||||
signals:
|
|
||||||
void torrentDropped(int label_row);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void dragMoveEvent(QDragMoveEvent *event);
|
|
||||||
void dropEvent(QDropEvent *event);
|
|
||||||
void dragLeaveEvent(QDragLeaveEvent*);
|
|
||||||
void setItemHover(bool hover);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class StatusFiltersWidget: public FiltersBase
|
class StatusFiltersWidget: public FiltersBase
|
||||||
@ -89,9 +77,6 @@ class StatusFiltersWidget: public FiltersBase
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
StatusFiltersWidget(QWidget *parent);
|
StatusFiltersWidget(QWidget *parent);
|
||||||
|
|
||||||
private:
|
|
||||||
bool m_shown;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class TrackerFiltersList: public FiltersBase
|
class TrackerFiltersList: public FiltersBase
|
||||||
@ -159,7 +144,6 @@ protected:
|
|||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void updateTorrentNumbers();
|
void updateTorrentNumbers();
|
||||||
void torrentDropped(int row);
|
|
||||||
void addLabel(QString& label);
|
void addLabel(QString& label);
|
||||||
void showLabelMenu(QPoint);
|
void showLabelMenu(QPoint);
|
||||||
void showTrackerMenu(QPoint);
|
void showTrackerMenu(QPoint);
|
||||||
|
Loading…
Reference in New Issue
Block a user