protected void selectionChanged() { Vector<SearchRecord> selectedRecords = getSelectedRecords(); boolean containsPlayable = false; for (SearchRecord searchRecord : selectedRecords) { if (!searchRecord.isExternalItem()) { containsPlayable = true; break; } } removeAction(playAction); removeAction(separator1); removeAction(mergeAction); removeAction(separator2); removeAction(removeAction); boolean added = false; if (containsPlayable) { addAction(playAction); added = true; } if (selectedRecords.size() > 1) { if (added) addAction(separator1); addAction(mergeAction); } if (selectedRecords.size() > 0) { if (added) addAction(separator2); addAction(removeAction); } }
protected void hideRecords() { if (QMessageBox.question( this, Translations.get("dialog_hide_recommended_title"), Translations.get("dialog_hide_recommended_text"), QMessageBox.StandardButton.Yes, QMessageBox.StandardButton.No) != QMessageBox.StandardButton.Yes.value()) { return; } Vector<SearchRecord> selectedSearchRecords = getSelectedRecords(); for (SearchRecord searchRecord : selectedSearchRecords) { searchRecord.setDisabled(true); searchRecord.update(); } }
@Override public boolean matches(SearchRecord searchRecord) { if (searchRecord instanceof ArtistRecord) { if (excludeArtistIds.containsKey(searchRecord.getUniqueId())) return false; if (artistIds.containsKey(searchRecord.getUniqueId())) return true; if (artistSearchParameters != null) for (ArtistSearchParameters params : artistSearchParameters) if (params.matches(searchRecord) > 0.0f) return true; return false; } else if (searchRecord instanceof LabelRecord) { if (excludeLabelIds.containsKey(searchRecord.getUniqueId())) return false; if (labelIds.containsKey(searchRecord.getUniqueId())) return true; if (labelSearchParameters != null) for (LabelSearchParameters params : labelSearchParameters) if (params.matches(searchRecord) > 0.0f) return true; return false; } else if (searchRecord instanceof ReleaseRecord) { if (excludeReleaseIds.containsKey(searchRecord.getUniqueId())) return false; if (releaseIds.containsKey(searchRecord.getUniqueId())) return true; if (releaseSearchParameters != null) for (ReleaseSearchParameters params : releaseSearchParameters) if (params.matches(searchRecord) > 0.0f) return true; boolean include = false; ReleaseRecord releaseRecord = (ReleaseRecord) searchRecord; if (releaseRecord.getArtistIds() != null) { for (int artistId : releaseRecord.getArtistIds()) { if (excludeArtistIds.containsKey(artistId)) return false; if (artistIds.containsKey(artistId)) include = true; } } if (releaseRecord.getLabelIds() != null) { for (int labelId : releaseRecord.getLabelIds()) { if (excludeLabelIds.containsKey(labelId)) return false; if (labelIds.containsKey(labelId)) include = true; } } return include; } else if (searchRecord instanceof SongRecord) { if (excludeSongIds.containsKey(searchRecord.getUniqueId())) return false; if (songIds.containsKey(searchRecord.getUniqueId())) return true; if (songSearchParameters != null) for (SongSearchParameters params : songSearchParameters) if (params.matches(searchRecord) > 0.0f) return true; boolean include = false; SongRecord songRecord = (SongRecord) searchRecord; if (songRecord.getArtistIds() != null) { for (int artistId : songRecord.getArtistIds()) { if (excludeArtistIds.containsKey(artistId)) return false; if (artistIds.containsKey(artistId)) include = true; } } if (songRecord.getLabelIds() != null) { for (int labelId : songRecord.getLabelIds()) { if (excludeLabelIds.containsKey(labelId)) return false; if (labelIds.containsKey(labelId)) include = true; } } if (songRecord.getReleaseIds() != null) { for (int releaseId : songRecord.getReleaseIds()) { if (excludeReleaseIds.containsKey(releaseId)) return false; if (releaseIds.containsKey(releaseId)) include = true; } } return include; } return false; }