fixed search handling
This commit is contained in:
1 parent
e8179fc41b
commit
3b77b4dfde
5 files changed
+41
-31
No files matched your search
@@ -152,7 +152,7 @@ namespace Vocaluxe.PartyModes
|
|||||||
_ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" };
|
_ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" };
|
||||||
|
|
||||||
_ScreenSongOptions.Sorting.SearchString = String.Empty;
|
_ScreenSongOptions.Sorting.SearchString = String.Empty;
|
||||||
_ScreenSongOptions.Sorting.SearchStringVisible = false;
|
_ScreenSongOptions.Sorting.SearchActive = false;
|
||||||
_ScreenSongOptions.Sorting.ShowDuetSongs = false;
|
_ScreenSongOptions.Sorting.ShowDuetSongs = false;
|
||||||
|
|
||||||
_Stage = EStage.NotStarted;
|
_Stage = EStage.NotStarted;
|
||||||
@@ -398,7 +398,7 @@ namespace Vocaluxe.PartyModes
|
|||||||
public override void SetSearchString(string SearchString, bool Visible)
|
public override void SetSearchString(string SearchString, bool Visible)
|
||||||
{
|
{
|
||||||
_ScreenSongOptions.Sorting.SearchString = SearchString;
|
_ScreenSongOptions.Sorting.SearchString = SearchString;
|
||||||
_ScreenSongOptions.Sorting.SearchStringVisible = Visible;
|
_ScreenSongOptions.Sorting.SearchActive = Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetMaxPlayer()
|
public override int GetMaxPlayer()
|
||||||
|
|||||||
+10
-2
@@ -62,7 +62,7 @@ namespace Vocaluxe.Base
|
|||||||
get { return _SearchFilter; }
|
get { return _SearchFilter; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value.Length > 0)
|
if (value != String.Empty)
|
||||||
{
|
{
|
||||||
_Sort(_SongSorting, EOffOn.TR_CONFIG_OFF, _IgnoreArticles, value, false, _ShowDuetSongs);
|
_Sort(_SongSorting, EOffOn.TR_CONFIG_OFF, _IgnoreArticles, value, false, _ShowDuetSongs);
|
||||||
}
|
}
|
||||||
@@ -406,7 +406,15 @@ namespace Vocaluxe.Base
|
|||||||
_SongList.Add(song);
|
_SongList.Add(song);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (song.Title.ToUpper().Contains(_SearchFilter.ToUpper()) || song.Artist.ToUpper().Contains(_SearchFilter.ToUpper()))
|
string search = song.Title.ToUpper() + " " + song.Artist.ToUpper() + " " + song.FolderName.ToUpper() + " " + song.FileName.ToUpper();
|
||||||
|
string[] searchStrings = _SearchFilter.ToUpper().Split(new char[]{' '});
|
||||||
|
bool contains = searchStrings != null;
|
||||||
|
|
||||||
|
foreach (string str in searchStrings)
|
||||||
|
{
|
||||||
|
contains &= search.Contains(str);
|
||||||
|
}
|
||||||
|
if (contains)
|
||||||
_SongList.Add(song);
|
_SongList.Add(song);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -659,7 +659,7 @@ namespace Vocaluxe.Screens
|
|||||||
|
|
||||||
_sso = CParty.GetSongSelectionOptions();
|
_sso = CParty.GetSongSelectionOptions();
|
||||||
CSongs.Sort(_sso.Sorting.SongSorting, _sso.Sorting.Tabs, _sso.Sorting.IgnoreArticles, _sso.Sorting.SearchString, _sso.Sorting.ShowDuetSongs);
|
CSongs.Sort(_sso.Sorting.SongSorting, _sso.Sorting.Tabs, _sso.Sorting.IgnoreArticles, _sso.Sorting.SearchString, _sso.Sorting.ShowDuetSongs);
|
||||||
_SearchActive = _sso.Sorting.SearchStringVisible;
|
_SearchActive = _sso.Sorting.SearchActive;
|
||||||
_SearchText = _sso.Sorting.SearchString;
|
_SearchText = _sso.Sorting.SearchString;
|
||||||
|
|
||||||
CGame.EnterNormalGame();
|
CGame.EnterNormalGame();
|
||||||
@@ -744,8 +744,6 @@ namespace Vocaluxe.Screens
|
|||||||
base.OnClose();
|
base.OnClose();
|
||||||
CBackgroundMusic.Disabled = false;
|
CBackgroundMusic.Disabled = false;
|
||||||
SongMenus[htSongMenus(SongMenu)].OnHide();
|
SongMenus[htSongMenus(SongMenu)].OnHide();
|
||||||
|
|
||||||
CParty.SetSearchString(_SearchText, _SearchActive);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ApplyVolume()
|
public override void ApplyVolume()
|
||||||
@@ -794,7 +792,7 @@ namespace Vocaluxe.Screens
|
|||||||
if (_sso.Selection.PartyMode)
|
if (_sso.Selection.PartyMode)
|
||||||
{
|
{
|
||||||
CSongs.Sort(_sso.Sorting.SongSorting, _sso.Sorting.Tabs, _sso.Sorting.IgnoreArticles, _sso.Sorting.SearchString, _sso.Sorting.ShowDuetSongs);
|
CSongs.Sort(_sso.Sorting.SongSorting, _sso.Sorting.Tabs, _sso.Sorting.IgnoreArticles, _sso.Sorting.SearchString, _sso.Sorting.ShowDuetSongs);
|
||||||
_SearchActive = _sso.Sorting.SearchStringVisible;
|
_SearchActive = _sso.Sorting.SearchActive;
|
||||||
_SearchText = _sso.Sorting.SearchString;
|
_SearchText = _sso.Sorting.SearchString;
|
||||||
|
|
||||||
ClosePlaylist();
|
ClosePlaylist();
|
||||||
@@ -1078,31 +1076,31 @@ namespace Vocaluxe.Screens
|
|||||||
|
|
||||||
private void ApplyNewSearchFilter(string NewFilterString)
|
private void ApplyNewSearchFilter(string NewFilterString)
|
||||||
{
|
{
|
||||||
int song = SongMenus[htSongMenus(SongMenu)].GetSelectedSong();
|
CParty.SetSearchString(NewFilterString, _SearchActive);
|
||||||
int id = -1;
|
_sso = CParty.GetSongSelectionOptions();
|
||||||
if (song > -1 && song < CSongs.NumVisibleSongs)
|
|
||||||
{
|
bool refresh = false;
|
||||||
id = CSongs.VisibleSongs[song].ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
_SearchText = NewFilterString;
|
_SearchText = NewFilterString;
|
||||||
CSongs.SearchFilter = _SearchText;
|
|
||||||
|
|
||||||
if (NewFilterString != String.Empty)
|
int SongIndex = SongMenus[htSongMenus(SongMenu)].GetSelectedSong();
|
||||||
CSongs.Category = 0;
|
int SongID = -1;
|
||||||
else
|
if (SongIndex != -1 && CSongs.NumVisibleSongs > 0 && CSongs.NumVisibleSongs > SongIndex)
|
||||||
CSongs.Category = -1;
|
|
||||||
|
|
||||||
if (id > -1)
|
|
||||||
{
|
{
|
||||||
if (CSongs.NumVisibleSongs > 0)
|
SongID = CSongs.VisibleSongs[SongIndex].ID;
|
||||||
{
|
|
||||||
if (id != CSongs.VisibleSongs[0].ID)
|
|
||||||
SongMenus[htSongMenus(SongMenu)].OnHide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CSongs.NumVisibleSongs == 0)
|
if (NewFilterString == String.Empty && _sso.Sorting.Tabs == EOffOn.TR_CONFIG_ON)
|
||||||
|
{
|
||||||
|
CSongs.Category = -1;
|
||||||
|
refresh = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
CSongs.Sort(_sso.Sorting.SongSorting, _sso.Sorting.Tabs, _sso.Sorting.IgnoreArticles, NewFilterString, _sso.Sorting.ShowDuetSongs);
|
||||||
|
|
||||||
|
if (SongID == -1 || CSongs.NumVisibleSongs == 0 || CSongs.NumVisibleSongs <= SongIndex || CSongs.VisibleSongs[SongIndex].ID != SongID)
|
||||||
|
refresh = true;
|
||||||
|
|
||||||
|
if (refresh)
|
||||||
SongMenus[htSongMenus(SongMenu)].OnHide();
|
SongMenus[htSongMenus(SongMenu)].OnHide();
|
||||||
|
|
||||||
SongMenus[htSongMenus(SongMenu)].OnShow();
|
SongMenus[htSongMenus(SongMenu)].OnShow();
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace Vocaluxe.PartyModes
|
|||||||
_ScreenSongOptions.Selection.SongIndex = -1;
|
_ScreenSongOptions.Selection.SongIndex = -1;
|
||||||
|
|
||||||
_ScreenSongOptions.Sorting.SearchString = String.Empty;
|
_ScreenSongOptions.Sorting.SearchString = String.Empty;
|
||||||
_ScreenSongOptions.Sorting.SearchStringVisible = false;
|
_ScreenSongOptions.Sorting.SearchActive = false;
|
||||||
_ScreenSongOptions.Sorting.ShowDuetSongs = true;
|
_ScreenSongOptions.Sorting.ShowDuetSongs = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,6 +27,10 @@ namespace Vocaluxe.PartyModes
|
|||||||
{
|
{
|
||||||
_ScreenSongOptions.Sorting.SongSorting = _Base.Config.GetSongSorting();
|
_ScreenSongOptions.Sorting.SongSorting = _Base.Config.GetSongSorting();
|
||||||
_ScreenSongOptions.Sorting.Tabs = _Base.Config.GetTabs();
|
_ScreenSongOptions.Sorting.Tabs = _Base.Config.GetTabs();
|
||||||
|
|
||||||
|
if (_ScreenSongOptions.Sorting.SearchActive)
|
||||||
|
_ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_OFF;
|
||||||
|
|
||||||
_ScreenSongOptions.Sorting.IgnoreArticles = _Base.Config.GetIgnoreArticles();
|
_ScreenSongOptions.Sorting.IgnoreArticles = _Base.Config.GetIgnoreArticles();
|
||||||
|
|
||||||
return _ScreenSongOptions;
|
return _ScreenSongOptions;
|
||||||
@@ -35,7 +39,7 @@ namespace Vocaluxe.PartyModes
|
|||||||
public override void SetSearchString(string SearchString, bool Visible)
|
public override void SetSearchString(string SearchString, bool Visible)
|
||||||
{
|
{
|
||||||
_ScreenSongOptions.Sorting.SearchString = SearchString;
|
_ScreenSongOptions.Sorting.SearchString = SearchString;
|
||||||
_ScreenSongOptions.Sorting.SearchStringVisible = Visible;
|
_ScreenSongOptions.Sorting.SearchActive = Visible;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,7 @@ namespace Vocaluxe.PartyModes
|
|||||||
public EOffOn Tabs;
|
public EOffOn Tabs;
|
||||||
public EOffOn IgnoreArticles;
|
public EOffOn IgnoreArticles;
|
||||||
public string SearchString;
|
public string SearchString;
|
||||||
public bool SearchStringVisible;
|
public bool SearchActive;
|
||||||
public bool ShowDuetSongs;
|
public bool ShowDuetSongs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user