Skip to content

Commit

Permalink
媒体库右键菜单增加“分级”
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongyang219 committed Aug 6, 2024
1 parent ee5aa23 commit 1213346
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions MusicPlayer2/MediaLibTabDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,17 @@ BOOL CMediaLibTabDlg::OnCommand(WPARAM wParam, LPARAM lParam)
CMusicPlayerCmdHelper cmd_helper;
cmd_helper.OnAddToPlaylistCommand(getSelectedItems, command);

//响应右键菜单中的分级
if ((command >= ID_RATING_1 && command <= ID_RATING_5) || command == ID_RATING_NONE) //如果命令是歌曲分级(应确保分级命令的ID是连续的)
{
std::vector<SongInfo> songs_selected;
GetSongsSelected(songs_selected);
for (const auto& song : songs_selected)
{
cmd_helper.OnRating(song, command);
}
}

return CTabDlg::OnCommand(wParam, lParam);
}

Expand Down
3 changes: 3 additions & 0 deletions MusicPlayer2/MenuMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,7 @@ void MenuMgr::CreateMenu(MenuBase& menu)
menu.AppendSeparator();
menu.AppendSubMenu(AddToPlaylistMenu, IconMgr::IconType::IT_Add);
menu.AppendItem(EX_ID(ID_ADD_TO_NEW_PLAYLIST_AND_PLAY), IconMgr::IconType::IT_Play_In_Playlist);
menu.AppendSubMenu(RateMenu, IconMgr::IconType::IT_Star);
menu.AppendSeparator();
menu.AppendItem(EX_ID(ID_EXPLORE_ONLINE), IconMgr::IconType::IT_Online);
menu.AppendItem(EX_ID(ID_FORMAT_CONVERT), IconMgr::IconType::IT_Convert);
Expand All @@ -836,6 +837,7 @@ void MenuMgr::CreateMenu(MenuBase& menu)
menu.AppendSeparator();
menu.AppendSubMenu(AddToPlaylistMenu, IconMgr::IconType::IT_Add);
menu.AppendItem(EX_ID(ID_ADD_TO_NEW_PLAYLIST_AND_PLAY), IconMgr::IconType::IT_Play_In_Playlist);
menu.AppendSubMenu(RateMenu, IconMgr::IconType::IT_Star);
menu.AppendSeparator();
menu.AppendItem(EX_ID(ID_EXPLORE_ONLINE), IconMgr::IconType::IT_Online);
menu.AppendItem(EX_ID(ID_FORMAT_CONVERT), IconMgr::IconType::IT_Convert);
Expand Down Expand Up @@ -885,6 +887,7 @@ void MenuMgr::CreateMenu(MenuBase& menu)
menu.AppendItem(EX_ID(ID_PLAY_AS_NEXT), IconMgr::IconType::IT_Play_As_Next);
menu.AppendItem(EX_ID(ID_PLAY_ITEM_IN_FOLDER_MODE), IconMgr::IconType::IT_Play_In_Folder);
menu.AppendSubMenu(AddToPlaylistMenu, IconMgr::IconType::IT_Add);
menu.AppendSubMenu(RateMenu, IconMgr::IconType::IT_Star);
menu.AppendSeparator();
menu.AppendItem(EX_ID(ID_EXPLORE_ONLINE), IconMgr::IconType::IT_Online);
menu.AppendItem(EX_ID(ID_FORMAT_CONVERT), IconMgr::IconType::IT_Convert);
Expand Down
5 changes: 5 additions & 0 deletions MusicPlayer2/UIWindowCmdHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,11 @@ bool CUIWindowCmdHelper::OnSongListCommand(const SongInfo& song_info, DWORD comm
vector<SongInfo> songs{ song_info };
helper.DeleteSongsFromDisk(songs);
}
//分级
else if ((command >= ID_RATING_1 && command <= ID_RATING_5) || command == ID_RATING_NONE) //如果命令是歌曲分级(应确保分级命令的ID是连续的)
{
helper.OnRating(song_info, command);
}
//添加到播放列表
else
{
Expand Down
1 change: 1 addition & 0 deletions MusicPlayer2/language/English.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1441,6 +1441,7 @@ ID_PLAY_AS_NEXT = "Play &Next"
ID_PLAY_ITEM_IN_FOLDER_MODE = "Play in &Folder Mode"
ADD_TO_PLAYLIST = "Add to Playlis&t"
ID_ADD_TO_NEW_PLAYLIST_AND_PLAY = "Add to &New Playlist And Play..."
RATE = "&Rate"
ID_EXPLORE_ONLINE = "View &Online"
ID_FORMAT_CONVERT = "Format Con&vert..."
ID_EXPLORE_TRACK = "Open File &Location"
Expand Down
1 change: 1 addition & 0 deletions MusicPlayer2/language/Simplified_Chinese.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1441,6 +1441,7 @@ ID_PLAY_AS_NEXT = "下一首播放(&N)"
ID_PLAY_ITEM_IN_FOLDER_MODE = "在文件夹模式中播放(&D)"
ADD_TO_PLAYLIST = "添加到播放列表(&T)"
ID_ADD_TO_NEW_PLAYLIST_AND_PLAY = "添加到新播放列表并播放(&N)..."
RATE = "分级(&A)"
ID_EXPLORE_ONLINE = "在线查看(&O)"
ID_FORMAT_CONVERT = "转换格式(&F)..."
ID_EXPLORE_TRACK = "打开文件位置(&B)"
Expand Down

0 comments on commit 1213346

Please sign in to comment.