qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
27.13k stars 3.9k forks source link

"Option to Hide Individual Status Filters" #18082

Open Bhaalspawn opened 1 year ago

Bhaalspawn commented 1 year ago

Suggestion

Now that we have right click on status filters can you add "hide filter"? I don't really need all those filters.

Use case

No response

Extra info/examples/attachments

No response

sledgehammer999 commented 1 year ago

You can click on the filter title and it will collapse.

Bhaalspawn commented 1 year ago

You can click on the filter title and it will collapse.

it's not what i'm asking i want to see Active torrents, All torrents and maybe downloading.....i don't need many of those filters

Pentaphon commented 1 year ago

@sledgehammer999 he wants to view SOME but not all the status filters. He would like the option to hide the status filters he doesn't want but keep the ones he does like. I think this issue should be titled "Option to Hide Individual Status Filters"

barisunsalhn commented 1 year ago

@sledgehammer999 could you assign me?

barisunsalhn commented 1 year ago

@sledgehammer999 hi, currently we have 3 action items in statusfilterwidget ( one of resume, pause, and remove torrents can be selected) . I added 4th action item as hide. Where should I add recover hidden? As 5th action?

thalieht commented 1 year ago

Wouldn't it be better to have a list of the statuses as checkable items in a context menu somewhere? e.g. Right click on STATUS (which i'd prefer) or maybe a submenu on "All" or on all the statuses' context menu.

barisunsalhn commented 1 year ago

Ok, I will try to imolement "right click on status"

Bhaalspawn commented 1 year ago

Wouldn't it be better to have a list of the statuses as checkable items in a context menu somewhere? e.g. Right click on STATUS (which i'd prefer) or maybe a submenu on "All" or on all the statuses' context menu.

this is what i mean context menu on single status is good to hide but it's a problem if i want that status back. context menu on "STATUS" would be great. like when we click on any point of the header to choose which columns we want to see

barisunsalhn commented 1 year ago

Is this style ok(I will replace one label with an image)? Since statusLabel's toggled signal is already taken(see below), I had to define new vertical layout and put a new button.

 connect(statusLabel, &QCheckBox::toggled, statusFilters, &StatusFilterWidget::toggleFilter);
    connect(statusLabel, &QCheckBox::toggled, pref, &Preferences::setStatusFilterState);

Screenshot 2022-12-19 20:13:16

Bhaalspawn commented 1 year ago

what is "One"?

barisunsalhn commented 1 year ago

Push button's label is currently one.

barisunsalhn commented 1 year ago

should I use this example?

Bhaalspawn commented 1 year ago

should I use this example?

i don't know what push button is, and it seems you are on Linux the example seems to have some "separate" settings that is also a good solution

barisunsalhn commented 1 year ago

Hmm, I guess I will use the same structure of status. Let me illustrate: Top line will consist of two expandable sections: ∆ status | settings ∆ Whenever user hits one of them, it expands. ∆ status | eettings ▽ □ cancelled ▣ downloading ...(goes on)

Bhaalspawn commented 1 year ago

sorry i still don't understand,i'm just and user, not developer. i don''t see any settings. settings are in the menu (tool-settings)

are you suggesting to ADD "settings" like we now have STATUS LABELS and TRACKERS? that would be the worst solution i think

maybe qbittorrent is different in linux

barisunsalhn commented 1 year ago

Yeah, I am suggesting to add hideable settings menu. No they are same in both linux and windows, since qt provides unified interface.

barisunsalhn commented 1 year ago

Ok, I will go back to thalieth's second recommendation.

xavier2k6 commented 1 year ago

@lapaz17 Could the "select/de-select filters" option be added in the View menu bar like Log instead of the current context menu?

Does the Filters sidebar or qBittorrent itself have to be closed/re-opened for the selection/de-selection to take effect??

Status Filters->

xavier2k6 commented 1 year ago

A Queued filter could be added here too now if they are to become optional??

Bhaalspawn commented 1 year ago

i think right click on status is the best. so nothing is added here and there

submenu on all no, it will change the alignment

adding something in the view menu could be good and more complete. i mean if there is "select/de-select filters", in the future you can also add the chance to select which group to show or hide (show status, hide trackers, etc)

thalieht commented 1 year ago

Since statusLabel's toggled signal is already taken(see below), I had to define new vertical layout and put a new button.

Toggled is for left click IIRC so for right click something like:

--- a/src/gui/transferlistfilterswidget.cpp
+++ b/src/gui/transferlistfilterswidget.cpp
@@ -832,6 +832,8 @@ TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferLi
     statusLabel->setChecked(pref->getStatusFilterState());
     statusLabel->setFont(font);
     frameLayout->addWidget(statusLabel);
+    statusLabel->setContextMenuPolicy(Qt::CustomContextMenu);
+    connect(statusLabel, &QWidget::customContextMenuRequested, this, &TransferListFiltersWidget::showStatusFilterContextMenu);

     auto *statusFilters = new StatusFilterWidget(this, transferList);
     frameLayout->addWidget(statusFilters);
barisunsalhn commented 1 year ago

@thalieht Thanks for help, I missed that solution somehow :(

barisunsalhn commented 1 year ago

@xavier2k6 I think thalieht ended the confusion, so I am not going to try your suggestions. But thanks for your input.

barisunsalhn commented 1 year ago

hi, I just finished everything except lint. Here is the latest version, anything you want to add? Screenshot from 2022-12-21 07-29-04

thalieht commented 1 year ago

updateGeometry() when checking/unchecking an item to avoid that empty space?

barisunsalhn commented 1 year ago

Ok

barisunsalhn commented 1 year ago

@thalieht updateGeometry does not work for hidden qlistwidgetitems, you can try it yourself on my branch I' ve tried many things (spent 7 hours)apart from your recommendation inside my new handler:

void TransferListFiltersWidget::updateStatus(int state)
{
     Preferences *const pref = Preferences::instance();
    QList<Qt::CheckState> individualStatusFilter = pref->getIndividualStatusFilterState();
    auto checkBox = static_cast<QCheckBox*>(sender());
    QList<QListWidgetItem*> items = m_statusFilters->findItems(tr(checkBox->text().toStdString().c_str()), Qt::MatchContains);
    if(state == Qt::Unchecked)
        items.first()->setHidden(true);  
    else
        items.first()->setHidden(false);

    individualStatusFilter[m_statusFilters->row(items.first())] = (static_cast<Qt::CheckState>(state));
    pref->setIndividualStatusFilterState(individualStatusFilter);
    qDebug() << 1;

}

I do not want to use take item, because it will break existing code (out of range errors...)

thalieht commented 1 year ago

Sorry about that, for some reason i thought you'd remove the items instead of hide them. I don't know what else to do. If that;s all that remains maybe the devs will suggest something when you open the PR. Maybe reimplement BaseFilterWidget::sizeHint() for TransferListFiltersWidget and do something with the count() part in it. No idea if that will work. I may as well mention this now before you open the PR because you'll be required to fix them anyway: please read https://github.com/qbittorrent/qBittorrent/blob/master/CODING_GUIDELINES.md. I see some extra spaces and broken indentation here and there.

barisunsalhn commented 1 year ago

Tanks for suggestions. As I mentioned 3 message above, I am aware of linting issues, I will fix after handling resize.

stalkerok commented 5 months ago

Closure? (There is hiding of zero status filters)