本文整理汇总了C++中CGUIDialogMusicScan类的典型用法代码示例。如果您正苦于以下问题:C++ CGUIDialogMusicScan类的具体用法?C++ CGUIDialogMusicScan怎么用?C++ CGUIDialogMusicScan使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CGUIDialogMusicScan类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
bool CGUIWindowMusicBase::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
{
CFileItemPtr item;
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
item = m_vecItems->Get(itemNumber);
switch (button)
{
case CONTEXT_BUTTON_QUEUE_ITEM:
OnQueueItem(itemNumber);
return true;
case CONTEXT_BUTTON_INFO:
OnInfo(itemNumber);
return true;
case CONTEXT_BUTTON_SONG_INFO:
{
ShowSongInfo(item.get());
return true;
}
case CONTEXT_BUTTON_EDIT:
{
CStdString playlist = item->IsPlayList() ? item->GetPath() : m_vecItems->GetPath(); // save path as activatewindow will destroy our items
g_windowManager.ActivateWindow(WINDOW_MUSIC_PLAYLIST_EDITOR, playlist);
// need to update
m_vecItems->RemoveDiscCache(GetID());
return true;
}
case CONTEXT_BUTTON_EDIT_SMART_PLAYLIST:
{
CStdString playlist = item->IsSmartPlayList() ? item->GetPath() : m_vecItems->GetPath(); // save path as activatewindow will destroy our items
if (CGUIDialogSmartPlaylistEditor::EditPlaylist(playlist, "music"))
{ // need to update
m_vecItems->RemoveDiscCache(GetID());
Update(m_vecItems->GetPath());
}
return true;
}
case CONTEXT_BUTTON_PLAY_ITEM:
PlayItem(itemNumber);
return true;
case CONTEXT_BUTTON_PLAY_WITH:
{
VECPLAYERCORES vecCores; // base class?
CPlayerCoreFactory::GetPlayers(*item, vecCores);
g_application.m_eForcedNextPlayer = CPlayerCoreFactory::SelectPlayerDialog(vecCores);
if( g_application.m_eForcedNextPlayer != EPC_NONE )
OnClick(itemNumber);
return true;
}
case CONTEXT_BUTTON_PLAY_PARTYMODE:
g_partyModeManager.Enable(PARTYMODECONTEXT_MUSIC, item->GetPath());
return true;
case CONTEXT_BUTTON_STOP_SCANNING:
{
CGUIDialogMusicScan *scanner = (CGUIDialogMusicScan *)g_windowManager.GetWindow(WINDOW_DIALOG_MUSIC_SCAN);
if (scanner)
scanner->StopScanning();
return true;
}
case CONTEXT_BUTTON_NOW_PLAYING:
g_windowManager.ActivateWindow(WINDOW_MUSIC_PLAYLIST);
return true;
case CONTEXT_BUTTON_GOTO_ROOT:
Update("");
return true;
case CONTEXT_BUTTON_SETTINGS:
g_windowManager.ActivateWindow(WINDOW_SETTINGS_MYMUSIC);
return true;
case CONTEXT_BUTTON_LASTFM_UNBAN_ITEM:
if (CLastFmManager::GetInstance()->Unban(*item->GetMusicInfoTag()))
{
g_directoryCache.ClearDirectory(m_vecItems->GetPath());
m_vecItems->RemoveDiscCache(GetID());
Update(m_vecItems->GetPath());
}
return true;
case CONTEXT_BUTTON_LASTFM_UNLOVE_ITEM:
if (CLastFmManager::GetInstance()->Unlove(*item->GetMusicInfoTag()))
{
g_directoryCache.ClearDirectory(m_vecItems->GetPath());
m_vecItems->RemoveDiscCache(GetID());
Update(m_vecItems->GetPath());
}
return true;
default:
break;
}
return CGUIMediaWindow::OnContextButton(itemNumber, button);
//.........这里部分代码省略.........
示例2: Update
void CGUIWindowMusicBase::ShowArtistInfo(const CArtist& artist, const CStdString& path, bool bRefresh, bool bShowInfo)
{
bool saveDb = artist.idArtist != -1;
if (!g_settings.GetCurrentProfile().canWriteDatabases() && !g_passwordManager.bMasterUser)
saveDb = false;
// check cache
CArtist artistInfo;
if (!bRefresh && m_musicdatabase.GetArtistInfo(artist.idArtist, artistInfo))
{
if (!bShowInfo)
return;
CGUIDialogMusicInfo *pDlgArtistInfo = (CGUIDialogMusicInfo*)g_windowManager.GetWindow(WINDOW_DIALOG_MUSIC_INFO);
if (pDlgArtistInfo)
{
pDlgArtistInfo->SetArtist(artistInfo, path);
if (bShowInfo)
pDlgArtistInfo->DoModal();
else
pDlgArtistInfo->RefreshThumb(); // downloads the thumb if we don't already have one
if (!pDlgArtistInfo->NeedRefresh())
{
if (pDlgArtistInfo->HasUpdatedThumb())
Update(m_vecItems->GetPath());
return;
}
bRefresh = true;
m_musicdatabase.DeleteArtistInfo(artistInfo.idArtist);
}
}
// If we are scanning for music info in the background,
// other writing access to the database is prohibited.
CGUIDialogMusicScan* dlgMusicScan = (CGUIDialogMusicScan*)g_windowManager.GetWindow(WINDOW_DIALOG_MUSIC_SCAN);
if (dlgMusicScan->IsDialogRunning())
{
CGUIDialogOK::ShowAndGetInput(189, 14057, 0, 0);
return;
}
CMusicArtistInfo info;
if (FindArtistInfo(artist.strArtist, info, bShowInfo ? (bRefresh ? SELECTION_FORCED : SELECTION_ALLOWED) : SELECTION_AUTO))
{
// download the album info
if ( info.Loaded() )
{
if (saveDb)
{
// save to database
m_musicdatabase.SetArtistInfo(artist.idArtist, info.GetArtist());
}
if (m_dlgProgress && bShowInfo)
m_dlgProgress->Close();
// ok, show album info
CGUIDialogMusicInfo *pDlgArtistInfo = (CGUIDialogMusicInfo*)g_windowManager.GetWindow(WINDOW_DIALOG_MUSIC_INFO);
if (pDlgArtistInfo)
{
pDlgArtistInfo->SetArtist(info.GetArtist(), path);
if (bShowInfo)
pDlgArtistInfo->DoModal();
else
pDlgArtistInfo->RefreshThumb(); // downloads the thumb if we don't already have one
CArtist artistInfo = info.GetArtist();
artistInfo.idArtist = artist.idArtist;
/*
if (pDlgAlbumInfo->HasUpdatedThumb())
UpdateThumb(artistInfo, path);
*/
// just update for now
Update(m_vecItems->GetPath());
if (pDlgArtistInfo->NeedRefresh())
{
m_musicdatabase.DeleteArtistInfo(artistInfo.idArtist);
ShowArtistInfo(artist, path, true, bShowInfo);
return;
}
}
}
else
{
// failed 2 download album info
CGUIDialogOK::ShowAndGetInput(21889, 0, 20199, 0);
}
}
if (m_dlgProgress && bShowInfo)
m_dlgProgress->Close();
}
示例3: UpdateThumb
void CGUIWindowMusicBase::ShowAlbumInfo(const CAlbum& album, const CStdString& path, bool bRefresh, bool bShowInfo)
{
bool saveDb = album.idAlbum != -1;
if (!g_settings.GetCurrentProfile().canWriteDatabases() && !g_passwordManager.bMasterUser)
saveDb = false;
// check cache
CAlbum albumInfo;
if (!bRefresh && m_musicdatabase.GetAlbumInfo(album.idAlbum, albumInfo, &albumInfo.songs))
{
if (!bShowInfo)
return;
CGUIDialogMusicInfo *pDlgAlbumInfo = (CGUIDialogMusicInfo*)g_windowManager.GetWindow(WINDOW_DIALOG_MUSIC_INFO);
if (pDlgAlbumInfo)
{
pDlgAlbumInfo->SetAlbum(albumInfo, path);
if (bShowInfo)
pDlgAlbumInfo->DoModal();
else
pDlgAlbumInfo->RefreshThumb(); // downloads the thumb if we don't already have one
if (!pDlgAlbumInfo->NeedRefresh())
{
if (pDlgAlbumInfo->HasUpdatedThumb())
UpdateThumb(albumInfo, path);
return;
}
bRefresh = true;
m_musicdatabase.DeleteAlbumInfo(albumInfo.idAlbum);
}
}
// If we are scanning for music info in the background,
// other writing access to the database is prohibited.
CGUIDialogMusicScan* dlgMusicScan = (CGUIDialogMusicScan*)g_windowManager.GetWindow(WINDOW_DIALOG_MUSIC_SCAN);
if (dlgMusicScan->IsDialogRunning())
{
CGUIDialogOK::ShowAndGetInput(189, 14057, 0, 0);
return;
}
CMusicAlbumInfo info;
if (FindAlbumInfo(album.strAlbum, StringUtils::Join(album.artist, g_advancedSettings.m_musicItemSeparator), info, bShowInfo ? (bRefresh ? SELECTION_FORCED : SELECTION_ALLOWED) : SELECTION_AUTO))
{
// download the album info
if ( info.Loaded() )
{
// set album title from musicinfotag, not the one we got from allmusic.com
info.SetTitle(album.strAlbum);
if (saveDb)
{
// save to database
m_musicdatabase.SetAlbumInfo(album.idAlbum, info.GetAlbum(), info.GetSongs());
}
if (m_dlgProgress && bShowInfo)
m_dlgProgress->Close();
UpdateThumb(album, path);
// ok, show album info
CGUIDialogMusicInfo *pDlgAlbumInfo = (CGUIDialogMusicInfo*)g_windowManager.GetWindow(WINDOW_DIALOG_MUSIC_INFO);
if (pDlgAlbumInfo)
{
pDlgAlbumInfo->SetAlbum(info.GetAlbum(), path);
if (bShowInfo)
pDlgAlbumInfo->DoModal();
else
pDlgAlbumInfo->RefreshThumb(); // downloads the thumb if we don't already have one
CAlbum albumInfo = info.GetAlbum();
albumInfo.idAlbum = album.idAlbum;
if (pDlgAlbumInfo->HasUpdatedThumb())
UpdateThumb(albumInfo, path);
if (pDlgAlbumInfo->NeedRefresh())
{
m_musicdatabase.DeleteAlbumInfo(albumInfo.idAlbum);
ShowAlbumInfo(album, path, true, bShowInfo);
return;
}
}
}
else
{
// failed 2 download album info
CGUIDialogOK::ShowAndGetInput(185, 0, 500, 0);
}
}
if (m_dlgProgress && bShowInfo)
m_dlgProgress->Close();
}
示例4: if
//.........这里部分代码省略.........
if (!m_item.HasVideoInfoTag() || m_item.GetVideoInfoTag()->m_resumePoint.timeInSeconds != m_bookmark.timeInSeconds)
{
if (m_bookmark.timeInSeconds <= 0.0f)
videodatabase.ClearBookMarksOfFile(progressTrackingFile, CBookmark::RESUME);
else
videodatabase.AddBookMarkToFile(progressTrackingFile, m_bookmark, CBookmark::RESUME);
if (m_item.HasVideoInfoTag())
m_item.GetVideoInfoTag()->m_resumePoint = m_bookmark;
// PVR: Set/clear recording's resume bookmark on the backend (if supported)
if (m_item.HasPVRRecordingInfoTag())
{
PVR::CPVRRecordingPtr recording = m_item.GetPVRRecordingInfoTag();
recording->SetLastPlayedPosition(m_bookmark.timeInSeconds <= 0.0f ? 0 : (int)m_bookmark.timeInSeconds);
recording->m_resumePoint = m_bookmark;
}
// UPnP announce resume point changes to clients
// however not if playcount is modified as that already announces
if (m_item.IsVideoDb() && !m_updatePlayCount)
{
CVariant data;
data["id"] = m_item.GetVideoInfoTag()->m_iDbId;
data["type"] = m_item.GetVideoInfoTag()->m_type;
ANNOUNCEMENT::CAnnouncementManager::Get().Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnUpdate", data);
}
updateListing = true;
}
}
if (m_videoSettings != CMediaSettings::Get().GetDefaultVideoSettings())
{
videodatabase.SetVideoSettings(progressTrackingFile, m_videoSettings);
}
if (m_item.HasVideoInfoTag() && m_item.GetVideoInfoTag()->HasStreamDetails())
{
CFileItem dbItem(m_item);
// Check whether the item's db streamdetails need updating
if (!videodatabase.GetStreamDetails(dbItem) || dbItem.GetVideoInfoTag()->m_streamDetails != m_item.GetVideoInfoTag()->m_streamDetails)
{
videodatabase.SetStreamDetailsForFile(m_item.GetVideoInfoTag()->m_streamDetails, progressTrackingFile);
updateListing = true;
}
}
// in order to properly update the the list, we need to update the stack item which is held in g_application.m_stackFileItemToUpdate
if (m_item.HasProperty("stackFileItemToUpdate"))
{
m_item = m_item_discstack; // as of now, the item is replaced by the discstack item
videodatabase.GetResumePoint(*m_item.GetVideoInfoTag());
}
videodatabase.Close();
if (updateListing)
{
CUtil::DeleteVideoDatabaseDirectoryCache();
CFileItemPtr msgItem(new CFileItem(m_item));
if (m_item.HasProperty("original_listitem_url"))
msgItem->SetPath(m_item.GetProperty("original_listitem_url").asString());
CGUIMessage message(GUI_MSG_NOTIFY_ALL, g_windowManager.GetActiveWindow(), 0, GUI_MSG_UPDATE_ITEM, 1, msgItem); // 1 to update the listing as well
g_windowManager.SendThreadMessage(message);
}
}
}
if (m_item.IsAudio())
{
std::string redactPath = CURL::GetRedacted(progressTrackingFile);
CLog::Log(LOGDEBUG, "%s - Saving file state for audio item %s", __FUNCTION__, redactPath.c_str());
if (m_updatePlayCount)
{
#if 0
// Can't write to the musicdatabase while scanning for music info
CGUIDialogMusicScan *dialog = (CGUIDialogMusicScan *)g_windowManager.GetWindow(WINDOW_DIALOG_MUSIC_SCAN);
if (dialog && !dialog->IsDialogRunning())
#endif
{
CMusicDatabase musicdatabase;
if (!musicdatabase.Open())
{
CLog::Log(LOGWARNING, "%s - Unable to open music database. Can not save file state!", __FUNCTION__);
}
else
{
// consider this item as played
CLog::Log(LOGDEBUG, "%s - Marking audio item %s as listened", __FUNCTION__, redactPath.c_str());
musicdatabase.IncrementPlayCount(m_item);
musicdatabase.Close();
}
}
}
}
}
return true;
}
示例5: switch
bool CGUIWindowMusicNav::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
{
CFileItemPtr item;
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
item = m_vecItems->Get(itemNumber);
switch (button)
{
case CONTEXT_BUTTON_INFO:
{
if (!item->IsVideoDb())
return CGUIWindowMusicBase::OnContextButton(itemNumber,button);
if (item->m_strPath.Left(14).Equals("videodb://3/4/"))
{
long idArtist = m_musicdatabase.GetArtistByName(item->GetLabel());
if (idArtist == -1)
return false;
item->m_strPath.Format("musicdb://2/%ld/", m_musicdatabase.GetArtistByName(item->GetLabel()));
CGUIWindowMusicBase::OnContextButton(itemNumber,button);
Update(m_vecItems->m_strPath);
m_viewControl.SetSelectedItem(itemNumber);
return true;
}
CGUIWindowVideoNav* pWindow = (CGUIWindowVideoNav*)m_gWindowManager.GetWindow(WINDOW_VIDEO_NAV);
if (pWindow)
{
SScraperInfo info;
pWindow->OnInfo(item.get(),info);
Update(m_vecItems->m_strPath);
}
return true;
}
case CONTEXT_BUTTON_INFO_ALL:
OnInfoAll(itemNumber);
return true;
case CONTEXT_BUTTON_SET_ARTIST_THUMB:
case CONTEXT_BUTTON_SET_PLUGIN_THUMB:
SetThumb(itemNumber, button);
return true;
case CONTEXT_BUTTON_UPDATE_LIBRARY:
{
CGUIDialogMusicScan *scanner = (CGUIDialogMusicScan *)m_gWindowManager.GetWindow(WINDOW_DIALOG_MUSIC_SCAN);
if (scanner)
scanner->StartScanning("");
return true;
}
case CONTEXT_BUTTON_SET_DEFAULT:
g_settings.m_defaultMusicLibSource = GetQuickpathName(item->m_strPath);
g_settings.Save();
return true;
case CONTEXT_BUTTON_CLEAR_DEFAULT:
g_settings.m_defaultMusicLibSource.Empty();
g_settings.Save();
return true;
case CONTEXT_BUTTON_GO_TO_ARTIST:
{
CStdString strPath;
CVideoDatabase database;
database.Open();
strPath.Format("videodb://3/4/%ld/",database.GetMatchingMusicVideo(item->GetMusicInfoTag()->GetArtist()));
m_gWindowManager.ActivateWindow(WINDOW_VIDEO_NAV,strPath);
return true;
}
case CONTEXT_BUTTON_PLAY_OTHER:
{
CVideoDatabase database;
database.Open();
CVideoInfoTag details;
database.GetMusicVideoInfo("",details,database.GetMatchingMusicVideo(item->GetMusicInfoTag()->GetArtist(),item->GetMusicInfoTag()->GetAlbum(),item->GetMusicInfoTag()->GetTitle()));
g_application.getApplicationMessenger().PlayFile(CFileItem(details));
return true;
}
case CONTEXT_BUTTON_MARK_WATCHED:
CGUIWindowVideoBase::MarkWatched(item);
CUtil::DeleteVideoDatabaseDirectoryCache();
Update(m_vecItems->m_strPath);
return true;
case CONTEXT_BUTTON_MARK_UNWATCHED:
CGUIWindowVideoBase::MarkUnWatched(item);
CUtil::DeleteVideoDatabaseDirectoryCache();
Update(m_vecItems->m_strPath);
return true;
case CONTEXT_BUTTON_RENAME:
CGUIWindowVideoBase::UpdateVideoTitle(item.get());
CUtil::DeleteVideoDatabaseDirectoryCache();
Update(m_vecItems->m_strPath);
return true;
case CONTEXT_BUTTON_DELETE:
CGUIWindowVideoNav::DeleteItem(item.get());
//.........这里部分代码省略.........
示例6: GetContextButtons
void CGUIWindowMusicNav::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CGUIWindowMusicBase::GetContextButtons(itemNumber, buttons);
CGUIDialogMusicScan *musicScan = (CGUIDialogMusicScan *)m_gWindowManager.GetWindow(WINDOW_DIALOG_MUSIC_SCAN);
CFileItemPtr item;
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
item = m_vecItems->Get(itemNumber);
if (item && (item->GetExtraInfo().Find("lastfm") < 0))
{
// are we in the playlists location?
bool inPlaylists = m_vecItems->m_strPath.Equals(CUtil::MusicPlaylistsLocation()) ||
m_vecItems->m_strPath.Equals("special://musicplaylists/");
CMusicDatabaseDirectory dir;
SScraperInfo info;
m_musicdatabase.GetScraperForPath(item->m_strPath,info);
// enable music info button on an album or on a song.
if (item->IsAudio() && !item->IsPlayList() && !item->IsSmartPlayList() &&
!item->IsLastFM() && !item->IsShoutCast())
{
buttons.Add(CONTEXT_BUTTON_SONG_INFO, 658);
}
else if (item->IsVideoDb())
{
if (!item->m_bIsFolder) // music video
buttons.Add(CONTEXT_BUTTON_INFO, 20393);
if (item->m_strPath.Left(14).Equals("videodb://3/4/") &&
item->m_strPath.size() > 14 && item->m_bIsFolder)
{
long idArtist = m_musicdatabase.GetArtistByName(m_vecItems->Get(itemNumber)->GetLabel());
if (idArtist > - 1)
buttons.Add(CONTEXT_BUTTON_INFO,21891);
}
}
else if (!inPlaylists && (dir.HasAlbumInfo(item->m_strPath)||
dir.IsArtistDir(item->m_strPath) ) &&
!dir.IsAllItem(item->m_strPath) && !item->IsParentFolder() &&
!item->IsLastFM() && !item->IsShoutCast() &&
!item->m_strPath.Left(14).Equals("musicsearch://"))
{
if (dir.IsArtistDir(item->m_strPath))
buttons.Add(CONTEXT_BUTTON_INFO, 21891);
else
buttons.Add(CONTEXT_BUTTON_INFO, 13351);
}
// enable query all albums button only in album view
if (dir.HasAlbumInfo(item->m_strPath) && !dir.IsAllItem(item->m_strPath) &&
item->m_bIsFolder && !item->IsVideoDb() && !item->IsParentFolder() &&
!item->IsLastFM() && !item->IsShoutCast() &&
!item->m_strPath.Left(14).Equals("musicsearch://"))
{
buttons.Add(CONTEXT_BUTTON_INFO_ALL, 20059);
}
// enable query all artist button only in album view
if (dir.IsArtistDir(item->m_strPath) && !dir.IsAllItem(item->m_strPath) &&
item->m_bIsFolder && !item->IsVideoDb() && !info.strContent.IsEmpty())
{
buttons.Add(CONTEXT_BUTTON_INFO_ALL, 21884);
}
// turn off set artist image if not at artist listing.
if (dir.IsArtistDir(item->m_strPath) && !dir.IsAllItem(item->m_strPath) ||
(item->m_strPath.Left(14).Equals("videodb://3/4/") &&
item->m_strPath.size() > 14 && item->m_bIsFolder))
{
buttons.Add(CONTEXT_BUTTON_SET_ARTIST_THUMB, 13359);
}
if (m_vecItems->m_strPath.Equals("plugin://music/"))
buttons.Add(CONTEXT_BUTTON_SET_PLUGIN_THUMB, 1044);
//Set default or clear default
NODE_TYPE nodetype = dir.GetDirectoryType(item->m_strPath);
if (!item->IsParentFolder() && !inPlaylists &&
(nodetype == NODE_TYPE_ROOT ||
nodetype == NODE_TYPE_OVERVIEW ||
nodetype == NODE_TYPE_TOP100))
{
if (!item->m_strPath.Equals(g_settings.m_defaultMusicLibSource))
buttons.Add(CONTEXT_BUTTON_SET_DEFAULT, 13335); // set default
if (strcmp(g_settings.m_defaultMusicLibSource, ""))
buttons.Add(CONTEXT_BUTTON_CLEAR_DEFAULT, 13403); // clear default
}
NODE_TYPE childtype = dir.GetDirectoryChildType(item->m_strPath);
if (childtype == NODE_TYPE_ALBUM || childtype == NODE_TYPE_ARTIST ||
nodetype == NODE_TYPE_GENRE || nodetype == NODE_TYPE_ALBUM)
{
// we allow the user to set content for
// 1. general artist and album nodes
// 2. specific per genre
// 3. specific per artist
// 4. specific per album
buttons.Add(CONTEXT_BUTTON_SET_CONTENT,20195);
}
if (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetArtist().size() > 0)
{
CVideoDatabase database;
//.........这里部分代码省略.........
示例7: if
void CGUIWindowMusicSongs::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CFileItemPtr item;
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
item = m_vecItems->Get(itemNumber);
if (item)
{
// are we in the playlists location?
bool inPlaylists = m_vecItems->m_strPath.Equals(CUtil::MusicPlaylistsLocation()) ||
m_vecItems->m_strPath.Equals("special://musicplaylists/");
if (m_vecItems->IsVirtualDirectoryRoot())
{
// get the usual music shares, and anything for all media windows
CMediaSource *share = CGUIDialogContextMenu::GetShare("music", item.get());
CGUIDialogContextMenu::GetContextButtons("music", share, buttons);
// enable Rip CD an audio disc
if (CDetectDVDMedia::IsDiscInDrive() && item->IsCDDA())
{
// those cds can also include Audio Tracks: CDExtra and MixedMode!
CCdInfo *pCdInfo = CDetectDVDMedia::GetCdInfo();
if (pCdInfo->IsAudio(1) || pCdInfo->IsCDExtra(1) || pCdInfo->IsMixedMode(1))
buttons.Add(CONTEXT_BUTTON_RIP_CD, 600);
}
CGUIMediaWindow::GetContextButtons(itemNumber, buttons);
}
else
{
CGUIWindowMusicBase::GetContextButtons(itemNumber, buttons);
if (!item->IsPlayList())
{
if (item->IsAudio() && !item->IsLastFM() && !item->IsShoutCast())
buttons.Add(CONTEXT_BUTTON_SONG_INFO, 658); // Song Info
else if (!item->IsParentFolder() && !item->IsLastFM() && !item->IsShoutCast() &&
!item->m_strPath.Left(3).Equals("new") && item->m_bIsFolder)
{
#if 0
if (m_musicdatabase.GetAlbumIdByPath(item->m_strPath) > -1)
#endif
buttons.Add(CONTEXT_BUTTON_INFO, 13351); // Album Info
}
}
// enable Rip CD Audio or Track button if we have an audio disc
if (CDetectDVDMedia::IsDiscInDrive() && m_vecItems->IsCDDA())
{
// those cds can also include Audio Tracks: CDExtra and MixedMode!
CCdInfo *pCdInfo = CDetectDVDMedia::GetCdInfo();
if (pCdInfo->IsAudio(1) || pCdInfo->IsCDExtra(1) || pCdInfo->IsMixedMode(1))
buttons.Add(CONTEXT_BUTTON_RIP_TRACK, 610);
}
// enable CDDB lookup if the current dir is CDDA
if (CDetectDVDMedia::IsDiscInDrive() && m_vecItems->IsCDDA() &&
(g_settings.m_vecProfiles[g_settings.m_iLastLoadedProfileIndex].canWriteDatabases() || g_passwordManager.bMasterUser))
{
buttons.Add(CONTEXT_BUTTON_CDDB, 16002);
}
if (!item->IsParentFolder() && !item->IsReadOnly())
{
// either we're at the playlist location or its been explicitly allowed
if (inPlaylists || g_guiSettings.GetBool("filelists.allowfiledeletion"))
{
buttons.Add(CONTEXT_BUTTON_DELETE, 117);
buttons.Add(CONTEXT_BUTTON_RENAME, 118);
}
}
}
// Add the scan button(s)
CGUIDialogMusicScan *pScanDlg = (CGUIDialogMusicScan *)m_gWindowManager.GetWindow(WINDOW_DIALOG_MUSIC_SCAN);
if (g_guiSettings.GetBool("musiclibrary.enabled") && pScanDlg)
{
if (pScanDlg->IsScanning())
buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353); // Stop Scanning
else if (!inPlaylists && !m_vecItems->IsInternetStream() &&
!item->IsLastFM() && !item->IsShoutCast() &&
!item->m_strPath.Equals("add") && !item->IsParentFolder() &&
(g_settings.m_vecProfiles[g_settings.m_iLastLoadedProfileIndex].canWriteDatabases() || g_passwordManager.bMasterUser))
{
buttons.Add(CONTEXT_BUTTON_SCAN, 13352);
}
}
}
if (!m_vecItems->IsVirtualDirectoryRoot())
buttons.Add(CONTEXT_BUTTON_SWITCH_MEDIA, 523);
CGUIWindowMusicBase::GetNonContextButtons(buttons);
}
示例8: CONTROL_ENABLE
void CGUIWindowMusicSongs::UpdateButtons()
{
CGUIWindowMusicBase::UpdateButtons();
bool bIsPlaying = g_application.IsPlayingAudio();
bool bCanRecord = false;
bool bIsRecording = false;
if (bIsPlaying)
{
bCanRecord = g_application.m_pPlayer->CanRecord();
bIsRecording = g_application.m_pPlayer->IsRecording();
}
// Update Record button
if (bIsPlaying && bCanRecord)
{
CONTROL_ENABLE(CONTROL_BTNREC);
if (bIsRecording)
{
SET_CONTROL_LABEL(CONTROL_BTNREC, 265); //Stop Recording
}
else
{
SET_CONTROL_LABEL(CONTROL_BTNREC, 264); //Record
}
}
else
{
SET_CONTROL_LABEL(CONTROL_BTNREC, 264); //Record
CONTROL_DISABLE(CONTROL_BTNREC);
}
// Update CDDA Rip button
CCdInfo *pCdInfo = CDetectDVDMedia::GetCdInfo();
if (CDetectDVDMedia::IsDiscInDrive() && pCdInfo && pCdInfo->IsAudio(1))
{
CONTROL_ENABLE(CONTROL_BTNRIP);
}
else
{
CONTROL_DISABLE(CONTROL_BTNRIP);
}
// Disable scan button if shoutcast
if (m_vecItems->IsVirtualDirectoryRoot() || m_vecItems->IsShoutCast() ||
m_vecItems->IsLastFM() || m_vecItems->IsMusicDb())
{
CONTROL_DISABLE(CONTROL_BTNSCAN);
}
else
{
CONTROL_ENABLE(CONTROL_BTNSCAN);
}
static int iOldLeftControl=-1;
if (m_vecItems->IsShoutCast() || m_vecItems->IsLastFM())
{
CONTROL_DISABLE(CONTROL_BTNVIEWASICONS);
CGUIControl* pControl = (CGUIControl*)GetControl(CONTROL_LIST);
if (pControl)
if (pControl->GetControlIdLeft() == CONTROL_BTNVIEWASICONS)
{
iOldLeftControl = pControl->GetControlIdLeft();
pControl->SetNavigation(pControl->GetControlIdUp(),pControl->GetControlIdDown(),
CONTROL_BTNSORTBY,pControl->GetControlIdRight());
}
}
else
{
CONTROL_ENABLE(CONTROL_BTNVIEWASICONS);
if (iOldLeftControl != -1)
{
CGUIControl* pControl = (CGUIControl*)GetControl(CONTROL_LIST);
if (pControl)
pControl->SetNavigation(pControl->GetControlIdUp(),pControl->GetControlIdDown(),
CONTROL_BTNVIEWASICONS,pControl->GetControlIdRight());
}
}
CGUIDialogMusicScan *musicScan = (CGUIDialogMusicScan *)m_gWindowManager.GetWindow(WINDOW_DIALOG_MUSIC_SCAN);
if (musicScan && musicScan->IsScanning())
{
SET_CONTROL_LABEL(CONTROL_BTNSCAN, 14056); // Stop Scan
}
else
{
SET_CONTROL_LABEL(CONTROL_BTNSCAN, 102); // Scan
}
// Update object count label
CStdString items;
items.Format("%i %s", m_vecItems->GetObjectCount(), g_localizeStrings.Get(127).c_str());
SET_CONTROL_LABEL(CONTROL_LABELFILES, items);
}