Merge branch 'playlist-filter' of github.com:derivator/Vocaluxe into develop
This commit is contained in:
commit
5c6267d397
9 files changed
+34
-9
No files matched your search
@@ -149,6 +149,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_ScreenSongOptions.Sorting.SearchString = String.Empty;
|
||||
_ScreenSongOptions.Sorting.SearchActive = false;
|
||||
_ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.NoDuets;
|
||||
_ScreenSongOptions.Sorting.FilterPlaylistID = -1;
|
||||
|
||||
GameData = new SData {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 12, NumJokers = 5, RefillJokers = true, CurrentRoundNr = 1, ProfileIDs = new List<int>(), CatSongIndices = null, Results = null};
|
||||
}
|
||||
|
||||
@@ -777,9 +777,9 @@ namespace Vocaluxe.Base
|
||||
CSongs.ResetPartySongSung(catIndex);
|
||||
}
|
||||
|
||||
public void SortSongs(ESongSorting sorting, EOffOn tabs, EOffOn ignoreArticles, String searchString, EDuetOptions duetOptions)
|
||||
public void SortSongs(ESongSorting sorting, EOffOn tabs, EOffOn ignoreArticles, String searchString, EDuetOptions duetOptions, int playlistID)
|
||||
{
|
||||
CSongs.Sort(sorting, tabs, ignoreArticles, searchString, duetOptions);
|
||||
CSongs.Sort(sorting, tabs, ignoreArticles, searchString, duetOptions, playlistID);
|
||||
}
|
||||
|
||||
public void NextCategory()
|
||||
@@ -1009,5 +1009,10 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
return CPlaylists.GetSong(playlistID, songIndex);
|
||||
}
|
||||
|
||||
public bool ContainsSong(int playlistID, int songID)
|
||||
{
|
||||
return CPlaylists.ContainsSong(playlistID, songID);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -204,6 +204,12 @@ namespace Vocaluxe.Base
|
||||
return pl.Songs[songIndex];
|
||||
}
|
||||
|
||||
public static bool ContainsSong(int playlistID, int songID)
|
||||
{
|
||||
CPlaylistFile pl = Get(playlistID);
|
||||
return pl != null && pl.Songs.Find((x) => x.SongID == songID) != null;
|
||||
}
|
||||
|
||||
#region private methods
|
||||
private static void _SortByName()
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
private String _SearchString = String.Empty;
|
||||
private EDuetOptions _DuetOptions = EDuetOptions.All;
|
||||
private int _PlaylistID = -1;
|
||||
|
||||
public List<CSong> FilteredSongs
|
||||
{
|
||||
@@ -67,10 +68,16 @@ namespace Vocaluxe.Base
|
||||
|
||||
public void SetOptions(String searchString, EDuetOptions duetOptions)
|
||||
{
|
||||
if (searchString != _SearchString || duetOptions != _DuetOptions)
|
||||
SetOptions(searchString, duetOptions, -1);
|
||||
}
|
||||
|
||||
public void SetOptions(String searchString, EDuetOptions duetOptions, int playlistID)
|
||||
{
|
||||
if (searchString != _SearchString || duetOptions != _DuetOptions || playlistID != _PlaylistID)
|
||||
{
|
||||
_SearchString = searchString;
|
||||
_DuetOptions = duetOptions;
|
||||
_PlaylistID = playlistID;
|
||||
_SetChanged();
|
||||
}
|
||||
}
|
||||
@@ -88,6 +95,9 @@ namespace Vocaluxe.Base
|
||||
|
||||
foreach (CSong song in CSongs.Songs)
|
||||
{
|
||||
if (_PlaylistID != -1 && !CBase.Playlist.ContainsSong(_PlaylistID, song.ID))
|
||||
continue;
|
||||
|
||||
if ((song.IsDuet && _DuetOptions != EDuetOptions.NoDuets) || (!song.IsDuet && _DuetOptions != EDuetOptions.Duets))
|
||||
{
|
||||
if (searchStrings == null)
|
||||
|
||||
@@ -324,9 +324,9 @@ namespace Vocaluxe.Base
|
||||
_CategoriesForRandom.Clear();
|
||||
}
|
||||
|
||||
public static void Sort(ESongSorting sorting, EOffOn tabs, EOffOn ignoreArticles, String searchString, EDuetOptions duetOptions)
|
||||
public static void Sort(ESongSorting sorting, EOffOn tabs, EOffOn ignoreArticles, String searchString, EDuetOptions duetOptions, int playlistID)
|
||||
{
|
||||
Filter.SetOptions(searchString, duetOptions);
|
||||
Filter.SetOptions(searchString, duetOptions, playlistID);
|
||||
Sorter.SetOptions(sorting, ignoreArticles);
|
||||
Categorizer.Tabs = tabs;
|
||||
}
|
||||
|
||||
@@ -643,7 +643,7 @@ namespace Vocaluxe.Screens
|
||||
_SelectedCategoryIndex = -2;
|
||||
|
||||
_Sso = CParty.GetSongSelectionOptions();
|
||||
CSongs.Sort(_Sso.Sorting.SongSorting, _Sso.Sorting.Tabs, _Sso.Sorting.IgnoreArticles, _Sso.Sorting.SearchString, _Sso.Sorting.DuetOptions);
|
||||
CSongs.Sort(_Sso.Sorting.SongSorting, _Sso.Sorting.Tabs, _Sso.Sorting.IgnoreArticles, _Sso.Sorting.SearchString, _Sso.Sorting.DuetOptions, _Sso.Sorting.FilterPlaylistID);
|
||||
_SearchActive = _Sso.Sorting.SearchActive;
|
||||
_SearchText = _Sso.Sorting.SearchString;
|
||||
|
||||
@@ -774,7 +774,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
if (_Sso.Selection.PartyMode)
|
||||
{
|
||||
CSongs.Sort(_Sso.Sorting.SongSorting, _Sso.Sorting.Tabs, _Sso.Sorting.IgnoreArticles, _Sso.Sorting.SearchString, _Sso.Sorting.DuetOptions);
|
||||
CSongs.Sort(_Sso.Sorting.SongSorting, _Sso.Sorting.Tabs, _Sso.Sorting.IgnoreArticles, _Sso.Sorting.SearchString, _Sso.Sorting.DuetOptions, _Sso.Sorting.FilterPlaylistID);
|
||||
_SearchActive = _Sso.Sorting.SearchActive;
|
||||
_SearchText = _Sso.Sorting.SearchString;
|
||||
|
||||
@@ -1134,7 +1134,7 @@ namespace Vocaluxe.Screens
|
||||
refresh = true;
|
||||
}
|
||||
|
||||
CSongs.Sort(_Sso.Sorting.SongSorting, _Sso.Sorting.Tabs, _Sso.Sorting.IgnoreArticles, newFilterString, _Sso.Sorting.DuetOptions);
|
||||
CSongs.Sort(_Sso.Sorting.SongSorting, _Sso.Sorting.Tabs, _Sso.Sorting.IgnoreArticles, newFilterString, _Sso.Sorting.DuetOptions, _Sso.Sorting.FilterPlaylistID);
|
||||
|
||||
if (songID == -1 || CSongs.NumSongsVisible <= songIndex || CSongs.GetVisibleSongByIndex(songIndex).ID != songID)
|
||||
refresh = true;
|
||||
|
||||
@@ -250,7 +250,7 @@ namespace VocaluxeLib
|
||||
void AddPartySongSung(int songID);
|
||||
void ResetSongSung(int catIndex = -1);
|
||||
|
||||
void SortSongs(ESongSorting sorting, EOffOn tabs, EOffOn ignoreArticles, String searchString, EDuetOptions duetOptions);
|
||||
void SortSongs(ESongSorting sorting, EOffOn tabs, EOffOn ignoreArticles, String searchString, EDuetOptions duetOptions, int playlistID);
|
||||
|
||||
void NextCategory();
|
||||
void PrevCategory();
|
||||
@@ -324,6 +324,7 @@ namespace VocaluxeLib
|
||||
|
||||
int GetSongCount(int playlistID);
|
||||
CPlaylistSong GetSong(int playlistID, int songIndex);
|
||||
bool ContainsSong(int playlistID, int songIndex);
|
||||
}
|
||||
|
||||
public interface IPreviewPlayer
|
||||
|
||||
@@ -67,6 +67,7 @@ namespace VocaluxeLib.PartyModes
|
||||
_ScreenSongOptions.Sorting.SearchString = String.Empty;
|
||||
_ScreenSongOptions.Sorting.SearchActive = false;
|
||||
_ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.All;
|
||||
_ScreenSongOptions.Sorting.FilterPlaylistID = -1;
|
||||
}
|
||||
|
||||
public override bool Init()
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace VocaluxeLib.PartyModes
|
||||
public EOffOn IgnoreArticles;
|
||||
public string SearchString;
|
||||
public bool SearchActive;
|
||||
public int FilterPlaylistID; //show only songs that are in this playlist, -1 for all songs
|
||||
public EDuetOptions DuetOptions;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user