mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-21 08:09:35 +08:00
Change "remove empty labels" to "remove unused labels".
This commit is contained in:
parent
ea111c664f
commit
d046b7a532
@ -297,11 +297,11 @@ void TransferListFiltersWidget::showLabelMenu(QPoint) {
|
|||||||
QMenu labelMenu(labelFilters);
|
QMenu labelMenu(labelFilters);
|
||||||
QAction *addAct = labelMenu.addAction(IconProvider::instance()->getIcon("list-add"), tr("Add label..."));
|
QAction *addAct = labelMenu.addAction(IconProvider::instance()->getIcon("list-add"), tr("Add label..."));
|
||||||
QAction *removeAct = 0;
|
QAction *removeAct = 0;
|
||||||
QAction *removeEmptyAct = 0;
|
QAction *removeUnusedAct = 0;
|
||||||
if (!labelFilters->selectedItems().empty() && labelFilters->row(labelFilters->selectedItems().first()) > 1)
|
if (!labelFilters->selectedItems().empty() && labelFilters->row(labelFilters->selectedItems().first()) > 1)
|
||||||
removeAct = labelMenu.addAction(IconProvider::instance()->getIcon("list-remove"), tr("Remove label"));
|
removeAct = labelMenu.addAction(IconProvider::instance()->getIcon("list-remove"), tr("Remove label"));
|
||||||
else
|
else
|
||||||
removeEmptyAct = labelMenu.addAction(IconProvider::instance()->getIcon("list-remove"), tr("Remove empty labels"));
|
removeUnusedAct = labelMenu.addAction(IconProvider::instance()->getIcon("list-remove"), tr("Remove unused labels"));
|
||||||
labelMenu.addSeparator();
|
labelMenu.addSeparator();
|
||||||
QAction *startAct = labelMenu.addAction(IconProvider::instance()->getIcon("media-playback-start"), tr("Resume torrents"));
|
QAction *startAct = labelMenu.addAction(IconProvider::instance()->getIcon("media-playback-start"), tr("Resume torrents"));
|
||||||
QAction *pauseAct = labelMenu.addAction(IconProvider::instance()->getIcon("media-playback-pause"), tr("Pause torrents"));
|
QAction *pauseAct = labelMenu.addAction(IconProvider::instance()->getIcon("media-playback-pause"), tr("Pause torrents"));
|
||||||
@ -313,8 +313,8 @@ void TransferListFiltersWidget::showLabelMenu(QPoint) {
|
|||||||
removeSelectedLabel();
|
removeSelectedLabel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (act == removeEmptyAct) {
|
if (act == removeUnusedAct) {
|
||||||
removeEmptyLabels();
|
removeUnusedLabels();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (act == deleteTorrentsAct) {
|
if (act == deleteTorrentsAct) {
|
||||||
@ -367,14 +367,14 @@ void TransferListFiltersWidget::removeSelectedLabel() {
|
|||||||
Preferences::instance()->removeTorrentLabel(label);
|
Preferences::instance()->removeTorrentLabel(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferListFiltersWidget::removeEmptyLabels() {
|
void TransferListFiltersWidget::removeUnusedLabels() {
|
||||||
QStringList emptyLabels;
|
QStringList unusedLabels;
|
||||||
QHash<QString, int>::const_iterator i;
|
QHash<QString, int>::const_iterator i;
|
||||||
for (i = customLabels.begin(); i != customLabels.end(); ++i) {
|
for (i = customLabels.begin(); i != customLabels.end(); ++i) {
|
||||||
if (i.value() == 0)
|
if (i.value() == 0)
|
||||||
emptyLabels << i.key();
|
unusedLabels << i.key();
|
||||||
}
|
}
|
||||||
foreach (const QString &label, emptyLabels) {
|
foreach (const QString &label, unusedLabels) {
|
||||||
customLabels.remove(label);
|
customLabels.remove(label);
|
||||||
delete labelFilters->takeItem(labelFilters->rowFromLabel(label));
|
delete labelFilters->takeItem(labelFilters->rowFromLabel(label));
|
||||||
Preferences::instance()->removeTorrentLabel(label);
|
Preferences::instance()->removeTorrentLabel(label);
|
||||||
|
@ -108,7 +108,7 @@ protected slots:
|
|||||||
void addLabel(QString& label);
|
void addLabel(QString& label);
|
||||||
void showLabelMenu(QPoint);
|
void showLabelMenu(QPoint);
|
||||||
void removeSelectedLabel();
|
void removeSelectedLabel();
|
||||||
void removeEmptyLabels();
|
void removeUnusedLabels();
|
||||||
void applyLabelFilter(int row);
|
void applyLabelFilter(int row);
|
||||||
void torrentChangedLabel(TorrentModelItem *torrentItem, QString old_label, QString new_label);
|
void torrentChangedLabel(TorrentModelItem *torrentItem, QString old_label, QString new_label);
|
||||||
void handleNewTorrent(TorrentModelItem* torrentItem);
|
void handleNewTorrent(TorrentModelItem* torrentItem);
|
||||||
|
Loading…
Reference in New Issue
Block a user