Skip to content

Commit

Permalink
重构启动播放列表初始化的方法
Browse files Browse the repository at this point in the history
  • Loading branch information
lrisora committed Sep 15, 2023
1 parent 0847f05 commit c07b1d5
Show file tree
Hide file tree
Showing 8 changed files with 248 additions and 329 deletions.
3 changes: 1 addition & 2 deletions MusicPlayer2/FindDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,7 @@ void CFindDlg::OnAddToNewPalylistAndPlay()
wstring playlist_path;
if (_OnAddToNewPlaylist(playlist_path))
{
CPlayer::GetInstance().SetPlaylist(playlist_path, 0, 0, false, true);
CPlayer::GetInstance().SaveRecentPath();
CPlayer::GetInstance().SetPlaylist(playlist_path, 0, 0, true);
OnCancel();
}
}
Expand Down
3 changes: 1 addition & 2 deletions MusicPlayer2/MediaLibTabDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ void CMediaLibTabDlg::OnAddToNewPalylistAndPlay()
wstring playlist_path;
if (_OnAddToNewPlaylist(playlist_path))
{
CPlayer::GetInstance().SetPlaylist(playlist_path, 0, 0, false, true);
CPlayer::GetInstance().SaveRecentPath();
CPlayer::GetInstance().SetPlaylist(playlist_path, 0, 0, true);
OnCancel();
}
}
Expand Down
8 changes: 2 additions & 6 deletions MusicPlayer2/MusicPlayerDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2911,7 +2911,6 @@ afx_msg LRESULT CMusicPlayerDlg::OnPathSelected(WPARAM wParam, LPARAM lParam)
//ShowTime();
DrawInfo(true);
//m_findDlg.ClearFindResult(); //更换路径后清除查找结果
CPlayer::GetInstance().SaveRecentPath();
m_play_error_cnt = 0;
SetTimer(DELAY_TIMER_ID, 500, NULL); //在媒体库对话框中选择了一个文件夹播放后,500毫秒内不响应WM_LBUTTONUP消息
m_no_lbtnup = true;
Expand Down Expand Up @@ -3496,10 +3495,9 @@ BOOL CMusicPlayerDlg::OnCommand(WPARAM wParam, LPARAM lParam)
{
if (item.playlist_info != nullptr)
{
CPlayer::GetInstance().SetPlaylist(item.playlist_info->path, item.playlist_info->track, item.playlist_info->position, false, false);
CPlayer::GetInstance().SetPlaylist(item.playlist_info->path, item.playlist_info->track, item.playlist_info->position);
UpdatePlayPauseButton();
DrawInfo(true);
CPlayer::GetInstance().SaveRecentPath();
IniPlaylistPopupMenu();
m_play_error_cnt = 0;
}
Expand All @@ -3512,7 +3510,6 @@ BOOL CMusicPlayerDlg::OnCommand(WPARAM wParam, LPARAM lParam)
CPlayer::GetInstance().SetPath(*item.folder_info);
UpdatePlayPauseButton();
DrawInfo(true);
CPlayer::GetInstance().SaveRecentPath();
m_play_error_cnt = 0;
}
}
Expand Down Expand Up @@ -5420,14 +5417,13 @@ afx_msg LRESULT CMusicPlayerDlg::OnPlaylistSelected(WPARAM wParam, LPARAM lParam
}
}
// index大于等于0时即此次播放为从右侧列表指定歌曲,设置force为true以忽略continue_when_switch_playlist设置
CPlayer::GetInstance().SetPlaylist(pPathDlg->GetSelPlaylistPath(), track_played, position, false, continue_play, index >= 0);
CPlayer::GetInstance().SetPlaylist(pPathDlg->GetSelPlaylistPath(), track_played, position, continue_play, index >= 0);
}
UpdatePlayPauseButton();
//SetPorgressBarSize();
//ShowTime();
DrawInfo(true);
//m_findDlg.ClearFindResult(); //更换路径后清除查找结果
CPlayer::GetInstance().SaveRecentPath();
IniPlaylistPopupMenu();
m_play_error_cnt = 0;
SetTimer(DELAY_TIMER_ID, 500, NULL); //在媒体库对话框中选择了一个播放列表播放后,500毫秒内不响应WM_LBUTTONUP消息
Expand Down
Loading

0 comments on commit c07b1d5

Please sign in to comment.