Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the torrent grouping feature based on names #7986

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/tribler/gui/widgets/search_results_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def __init__(self, original_query, **kwargs):
self.remote_results_received = False
self.postponed_remote_results = []
self.highlight_remote_results = True
self.group_by_name = True
self.sort_by_rank = True
self.original_search_results = []

Expand Down
5 changes: 0 additions & 5 deletions src/tribler/gui/widgets/tablecontentdelegate.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,6 @@ def draw_title_and_tags(self, painter: QPainter, option: QStyleOptionViewItem, i
debug = False # change to True to see the search rank of items and to highlight remote items
item_name = data_item["name"]

group = data_item.get("group")
if group:
has_remote_items = any(group_item.get('remote') for group_item in group.values())
item_name += f" (+ {len(group)} similar{' *' if debug and has_remote_items else ''})"

if debug:
rank = data_item.get("rank")
if rank is not None:
Expand Down
21 changes: 5 additions & 16 deletions src/tribler/gui/widgets/tablecontentmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ def __init__(self, parent=None):
self.saved_scroll_state = None
self.qt_object_destroyed = False

self.group_by_name = False
self.sort_by_rank = False
self.text_filter = ''

Expand Down Expand Up @@ -204,7 +203,6 @@ def extract_unique_new_items(self, items: List, on_top: bool, remote: bool) -> T
# Only add unique items to the table model and reverse mapping from unique ids to rows is built.
insert_index = 0 if on_top else len(self.data_items)
unique_new_items = []
name_mapping = {item['name']: item for item in self.data_items} if self.group_by_name else {}
now = time.time()
for item in items:
if remote:
Expand All @@ -218,21 +216,12 @@ def extract_unique_new_items(self, items: List, on_top: bool, remote: bool) -> T
item_uid = get_item_uid(item)
if item_uid not in self.item_uid_map:

prev_item = name_mapping.get(item['name'])
if self.group_by_name and prev_item is not None and not on_top and prev_item['type'] == REGULAR_TORRENT:
group = prev_item.setdefault('group', {})
if item_uid not in group:
group[item_uid] = item
else:
self.item_uid_map[item_uid] = insert_index
if 'infohash' in item:
self.item_uid_map[item['infohash']] = insert_index
unique_new_items.append(item)

if self.group_by_name and item['type'] == REGULAR_TORRENT and prev_item is None:
name_mapping[item['name']] = item
self.item_uid_map[item_uid] = insert_index
if 'infohash' in item:
self.item_uid_map[item['infohash']] = insert_index
unique_new_items.append(item)

insert_index += 1
insert_index += 1
return unique_new_items, insert_index

def add_items(self, new_items, on_top=False, remote=False):
Expand Down
Loading