Skip to content

Commit

Permalink
Fix enabling/disabling of mic playlist
Browse files Browse the repository at this point in the history
  • Loading branch information
kickbits committed Apr 7, 2024
1 parent 8bf4070 commit 0b624bf
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 18 deletions.
28 changes: 22 additions & 6 deletions Tuniac1/TuniacApp/MicPlaylist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include "stdafx.h"
#include "micplaylist.h"
#include "resource.h"


CMicPlaylist::CMicPlaylist(char cMicInput) :
Expand All @@ -49,24 +50,39 @@ CMicPlaylist::~CMicPlaylist(void)
bool CMicPlaylist::IsEnabled(void)
{
return m_IsEnabled;

}

void CMicPlaylist::SetEnabled(bool bEnabled)
{
m_IsEnabled = bEnabled;
if (bEnabled)
{
GetMicInfo();
}
else
{

GetMicInfo();
if(GetPlaylistID() == tuniacApp.m_SourceSelectorWindow->GetVisiblePlaylist()->GetPlaylistID())
tuniacApp.m_SourceSelectorWindow->ShowPlaylistAtIndex(0);

if (!bEnabled)
{
if (GetPlaylistID() == tuniacApp.m_PlaylistManager.GetActivePlaylistID())
{
tuniacApp.m_SourceSelectorWindow->ShowPlaylistAtIndex(0);
tuniacApp.m_PlaylistManager.SetActivePlaylistByIndex(0);
tuniacApp.m_PlaylistManager.m_LibraryPlaylist.RebuildPlaylist();
tuniacApp.m_PlaylistManager.m_LibraryPlaylist.ApplyFilter();
SendMessage(tuniacApp.getMainWindow(), WM_COMMAND, MAKELONG(ID_PLAYBACK_NEXT, 0), 0);
}
while (m_TrackList.GetCount())
{
CMediaLibraryPlaylistEntry* tt = (CMediaLibraryPlaylistEntry*)m_TrackList[0];

m_TrackList.RemoveAt(0);

delete tt;
}

}
m_IsEnabled = bEnabled;

tuniacApp.m_SourceSelectorWindow->UpdateList();
PostMessage(tuniacApp.getMainWindow(), WM_APP, NOTIFY_PLAYLISTSCHANGED, 0);
}
Expand Down
4 changes: 3 additions & 1 deletion Tuniac1/TuniacApp/PlaylistSourceView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,8 @@ bool CPlaylistSourceView::ShowSourceView(bool bShow)
}
else
{
KillTimer(m_PlaylistSourceWnd, DELAYEDAPPLYFILTER_TIMERID);
m_pPlaylist = NULL;
ShowWindow(m_PlaylistSourceWnd, SW_HIDE);
return false;
}
Expand Down Expand Up @@ -2009,7 +2011,7 @@ LRESULT CALLBACK CPlaylistSourceView::WndProc(HWND hDlg, UINT message, WPARAM
{
if(wParam == DELAYEDAPPLYFILTER_TIMERID)
{
KillTimer(hDlg, DELAYEDPLAY_TIMERID);
KillTimer(hDlg, DELAYEDAPPLYFILTER_TIMERID);

TCHAR tBuffer[256];
GetDlgItemText(hDlg, IDC_PLAYLIST_FILTER, tBuffer, 256);
Expand Down
25 changes: 14 additions & 11 deletions Tuniac1/TuniacApp/SourceSelectorWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -722,19 +722,22 @@ LRESULT CALLBACK CSourceSelectorWindow::WndProc(HWND hDlg, UINT message, WPARA
if(iPos == -1)
break;

if(IDNO == MessageBox(tuniacApp.getMainWindow(), TEXT("Are you sure you wish to delete the selected playlist(s)?"), TEXT("Confirm"), MB_YESNO | MB_ICONINFORMATION))
break;

IndexArray m_DeleteArray;
while(iPos != -1)
{
//not ML playlist
if(iPos != 0)
m_DeleteArray.AddTail((unsigned long &)iPos);
IPlaylist* t = tuniacApp.m_PlaylistManager.GetPlaylistByIndex(iPos);
if (t->GetPlaylistType() != PLAYLIST_TYPE_MEDIALIBRARY && t->GetPlaylistType() != PLAYLIST_TYPE_MIC && t->GetPlaylistType() != PLAYLIST_TYPE_CD)
m_DeleteArray.AddTail((unsigned long&)iPos);

iPos = ListView_GetNextItem(hSourceViewWnd, iPos, LVNI_SELECTED);
}

if (m_DeleteArray.GetCount())
{
if (IDNO == MessageBox(tuniacApp.getMainWindow(), TEXT("Are you sure you wish to delete the selected playlist(s)?"), TEXT("Confirm"), MB_YESNO | MB_ICONINFORMATION))
break;
}

for(unsigned long i = m_DeleteArray.GetCount(); i > 0; i--)
{
if(tuniacApp.m_PlaylistManager.GetActivePlaylist() == tuniacApp.m_PlaylistManager.GetPlaylistByIndex(m_DeleteArray[i - 1]))
Expand Down Expand Up @@ -1345,11 +1348,11 @@ bool CSourceSelectorWindow::ShowPlaylistAtIndex(unsigned long ulIndex)
break;

case PLAYLIST_TYPE_MIC:
{
m_MicSourceView->SetPlaylistSource(ulIndex);
m_pVisibleView = m_MicSourceView;
}
break;
{
m_MicSourceView->SetPlaylistSource(ulIndex);
m_pVisibleView = m_MicSourceView;
}
break;

case PLAYLIST_TYPE_CD:
{
Expand Down

0 comments on commit 0b624bf

Please sign in to comment.