本文整理汇总了C++中CGUIMessage::GetParam1方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIMessage::GetParam1方法的具体用法?C++ CGUIMessage::GetParam1怎么用?C++ CGUIMessage::GetParam1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIMessage
的用法示例。
在下文中一共展示了CGUIMessage::GetParam1方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnMessage
bool CGUIDialogVideoBookmarks::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_WINDOW_DEINIT:
{
CUtil::DeleteVideoDatabaseDirectoryCache();
Clear();
}
break;
case GUI_MSG_WINDOW_INIT:
{
CGUIWindow::OnMessage(message);
Update();
return true;
}
break;
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
if (iControl == CONTROL_ADD_BOOKMARK)
{
AddBookmark();
Update();
}
else if (iControl == CONTROL_CLEAR_BOOKMARKS)
{
ClearBookmarks();
}
else if (iControl == CONTROL_ADD_EPISODE_BOOKMARK)
{
AddEpisodeBookmark();
Update();
}
else if (m_viewControl.HasControl(iControl)) // list/thumb control
{
int iItem = m_viewControl.GetSelectedItem();
int iAction = message.GetParam1();
if (iAction == ACTION_DELETE_ITEM)
{
Delete(iItem);
}
else if (iAction == ACTION_SELECT_ITEM || iAction == ACTION_MOUSE_LEFT_CLICK)
{
GotoBookmark(iItem);
}
}
}
break;
case GUI_MSG_SETFOCUS:
{
if (m_viewControl.HasControl(message.GetControlId()) && m_viewControl.GetCurrentControl() != message.GetControlId())
{
m_viewControl.SetFocused();
return true;
}
}
break;
case GUI_MSG_REFRESH_LIST:
{
OnRefreshList();
}
break;
}
return CGUIDialog::OnMessage(message);
}
示例2: OnMessage
//.........这里部分代码省略.........
{
m_movingFrom = -1;
}
break;
case GUI_MSG_WINDOW_INIT:
{
m_vecItems->SetPath("playlistvideo://");
if (!CGUIWindowVideoBase::OnMessage(message))
return false;
if (m_vecItems->Size() <= 0)
{
m_iLastControl = CONTROL_BTNVIEWASICONS;
SET_CONTROL_FOCUS(m_iLastControl, 0);
}
if (g_application.IsPlayingVideo() && g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_VIDEO)
{
int iSong = g_playlistPlayer.GetCurrentSong();
if (iSong >= 0 && iSong <= (int)m_vecItems->Size())
m_viewControl.SetSelectedItem(iSong);
}
return true;
}
break;
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
if (iControl == CONTROL_BTNSHUFFLE)
{
if (!g_partyModeManager.IsEnabled())
{
g_playlistPlayer.SetShuffle(PLAYLIST_VIDEO, !(g_playlistPlayer.IsShuffled(PLAYLIST_VIDEO)));
g_settings.m_bMyVideoPlaylistShuffle = g_playlistPlayer.IsShuffled(PLAYLIST_VIDEO);
g_settings.Save();
UpdateButtons();
Refresh();
}
}
else if (iControl == CONTROL_BTNSAVE)
{
SavePlayList();
}
else if (iControl == CONTROL_BTNCLEAR)
{
ClearPlayList();
}
else if (iControl == CONTROL_BTNPLAY)
{
g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_VIDEO);
g_playlistPlayer.Reset();
g_playlistPlayer.Play(m_viewControl.GetSelectedItem());
UpdateButtons();
}
else if (iControl == CONTROL_BTNNEXT)
{
g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_VIDEO);
g_playlistPlayer.PlayNext();
}
else if (iControl == CONTROL_BTNPREVIOUS)
{
g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_VIDEO);
g_playlistPlayer.PlayPrevious();
}
else if (iControl == CONTROL_BTNREPEAT)
{
// increment repeat state
PLAYLIST::REPEAT_STATE state = g_playlistPlayer.GetRepeat(PLAYLIST_VIDEO);
if (state == PLAYLIST::REPEAT_NONE)
g_playlistPlayer.SetRepeat(PLAYLIST_VIDEO, PLAYLIST::REPEAT_ALL);
else if (state == PLAYLIST::REPEAT_ALL)
g_playlistPlayer.SetRepeat(PLAYLIST_VIDEO, PLAYLIST::REPEAT_ONE);
else
g_playlistPlayer.SetRepeat(PLAYLIST_VIDEO, PLAYLIST::REPEAT_NONE);
// save settings
g_settings.m_bMyVideoPlaylistRepeat = g_playlistPlayer.GetRepeat(PLAYLIST_VIDEO) == PLAYLIST::REPEAT_ALL;
g_settings.Save();
UpdateButtons();
}
else if (m_viewControl.HasControl(iControl)) // list/thumb control
{
int iAction = message.GetParam1();
int iItem = m_viewControl.GetSelectedItem();
if (iAction == ACTION_DELETE_ITEM || iAction == ACTION_MOUSE_MIDDLE_CLICK)
{
RemovePlayListItem(iItem);
MarkPlaying();
}
}
}
break;
}
return CGUIWindowVideoBase::OnMessage(message);
}
示例3: OnMessage
//.........这里部分代码省略.........
// updatebuttons is called in here
if (!CGUIWindowMusicBase::OnMessage(message))
return false;
if (m_vecItems->Size() <= 0)
{
m_iLastControl = CONTROL_BTNVIEWASICONS;
SET_CONTROL_FOCUS(m_iLastControl, 0);
}
if (g_application.IsPlayingAudio() && g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_MUSIC)
{
int iSong = g_playlistPlayer.GetCurrentSong();
if (iSong >= 0 && iSong <= m_vecItems->Size())
m_viewControl.SetSelectedItem(iSong);
}
return true;
}
break;
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
if (iControl == CONTROL_BTNSHUFFLE)
{
if (!g_partyModeManager.IsEnabled())
{
g_playlistPlayer.SetShuffle(PLAYLIST_MUSIC, !(g_playlistPlayer.IsShuffled(PLAYLIST_MUSIC)));
g_settings.m_bMyMusicPlaylistShuffle = g_playlistPlayer.IsShuffled(PLAYLIST_MUSIC);
g_settings.Save();
UpdateButtons();
Update(m_vecItems->GetPath());
}
}
else if (iControl == CONTROL_BTNSAVE)
{
if (m_musicInfoLoader.IsLoading()) // needed since we destroy m_vecitems to save memory
m_musicInfoLoader.StopThread();
SavePlayList();
}
else if (iControl == CONTROL_BTNCLEAR)
{
if (m_musicInfoLoader.IsLoading())
m_musicInfoLoader.StopThread();
ClearPlayList();
}
else if (iControl == CONTROL_BTNPLAY)
{
m_guiState->SetPlaylistDirectory("playlistmusic://");
g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_MUSIC);
g_playlistPlayer.Reset();
g_playlistPlayer.Play(m_viewControl.GetSelectedItem());
UpdateButtons();
}
else if (iControl == CONTROL_BTNNEXT)
{
g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_MUSIC);
g_playlistPlayer.PlayNext();
}
else if (iControl == CONTROL_BTNPREVIOUS)
{
g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_MUSIC);
g_playlistPlayer.PlayPrevious();
}
else if (iControl == CONTROL_BTNREPEAT)
{
// increment repeat state
PLAYLIST::REPEAT_STATE state = g_playlistPlayer.GetRepeat(PLAYLIST_MUSIC);
if (state == PLAYLIST::REPEAT_NONE)
g_playlistPlayer.SetRepeat(PLAYLIST_MUSIC, PLAYLIST::REPEAT_ALL);
else if (state == PLAYLIST::REPEAT_ALL)
g_playlistPlayer.SetRepeat(PLAYLIST_MUSIC, PLAYLIST::REPEAT_ONE);
else
g_playlistPlayer.SetRepeat(PLAYLIST_MUSIC, PLAYLIST::REPEAT_NONE);
// save settings
g_settings.m_bMyMusicPlaylistRepeat = g_playlistPlayer.GetRepeat(PLAYLIST_MUSIC) == PLAYLIST::REPEAT_ALL;
g_settings.Save();
UpdateButtons();
}
else if (m_viewControl.HasControl(iControl))
{
int iAction = message.GetParam1();
int iItem = m_viewControl.GetSelectedItem();
if (iAction == ACTION_DELETE_ITEM || iAction == ACTION_MOUSE_MIDDLE_CLICK)
{
RemovePlayListItem(iItem);
MarkPlaying();
}
}
}
break;
}
return CGUIWindowMusicBase::OnMessage(message);
}
示例4: OnMessage
bool CGUIWindowAddonBrowser::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_WINDOW_DEINIT:
{
if (m_thumbLoader.IsLoading())
m_thumbLoader.StopThread();
}
break;
case GUI_MSG_WINDOW_INIT:
{
m_rootDir.AllowNonLocalSources(false);
// is this the first time the window is opened?
if (m_vecItems->GetPath() == "?" && message.GetStringParam().empty())
m_vecItems->SetPath("");
SetProperties();
}
break;
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
if (iControl == CONTROL_FOREIGNFILTER)
{
CSettings::GetInstance().ToggleBool(CSettings::SETTING_GENERAL_ADDONFOREIGNFILTER);
CSettings::GetInstance().Save();
Refresh();
return true;
}
else if (iControl == CONTROL_BROKENFILTER)
{
CSettings::GetInstance().ToggleBool(CSettings::SETTING_GENERAL_ADDONBROKENFILTER);
CSettings::GetInstance().Save();
Refresh();
return true;
}
else if (iControl == CONTROL_CHECK_FOR_UPDATES)
{
CRepositoryUpdater::GetInstance().CheckForUpdates(true);
return true;
}
else if (iControl == CONTROL_SETTINGS)
{
g_windowManager.ActivateWindow(WINDOW_SETTINGS_SYSTEM, "addons");
return true;
}
else if (m_viewControl.HasControl(iControl)) // list/thumb control
{
// get selected item
int iItem = m_viewControl.GetSelectedItem();
int iAction = message.GetParam1();
// iItem is checked for validity inside these routines
if (iAction == ACTION_SHOW_INFO)
{
if (!m_vecItems->Get(iItem)->GetProperty("Addon.ID").empty())
return CGUIDialogAddonInfo::ShowForItem((*m_vecItems)[iItem]);
return false;
}
}
}
break;
case GUI_MSG_NOTIFY_ALL:
{
if (message.GetParam1() == GUI_MSG_UPDATE_ITEM && IsActive() && message.GetNumStringParams() == 1)
{ // update this item
for (int i = 0; i < m_vecItems->Size(); ++i)
{
CFileItemPtr item = m_vecItems->Get(i);
if (item->GetProperty("Addon.ID") == message.GetStringParam())
{
UpdateStatus(item);
FormatAndSort(*m_vecItems);
return true;
}
}
}
else if (message.GetParam1() == GUI_MSG_UPDATE && IsActive())
SetProperties();
}
break;
default:
break;
}
return CGUIMediaWindow::OnMessage(message);
}
示例5: OnMessage
bool CGUIWindow::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_WINDOW_LOAD:
{
Initialize();
return true;
}
break;
case GUI_MSG_WINDOW_INIT:
{
CLog::Log(LOGDEBUG, "------ Window Init (%s) ------", GetProperty("xmlfile").c_str());
if (m_dynamicResourceAlloc || !m_bAllocated) AllocResources();
OnInitWindow();
return true;
}
break;
case GUI_MSG_WINDOW_DEINIT:
{
CLog::Log(LOGDEBUG, "------ Window Deinit (%s) ------", GetProperty("xmlfile").c_str());
OnDeinitWindow(message.GetParam1());
// now free the window
if (m_dynamicResourceAlloc) FreeResources();
return true;
}
break;
case GUI_MSG_CLICKED:
{
// a specific control was clicked
CLICK_EVENT clickEvent = m_mapClickEvents[ message.GetSenderId() ];
// determine if there are any handlers for this event
if (clickEvent.HasAHandler())
{
// fire the message to all handlers
clickEvent.Fire(message);
}
break;
}
case GUI_MSG_UNFOCUS_ALL:
{
//unfocus the current focused control in this window
CGUIControl *control = GetFocusedControl();
if(control)
{
//tell focused control that it has lost the focus
CGUIMessage msgLostFocus(GUI_MSG_LOSTFOCUS, GetID(), control->GetID(), control->GetID());
control->OnMessage(msgLostFocus);
CLog::Log(LOGDEBUG, "Unfocus WindowID: %i, ControlID: %i",GetID(), control->GetID());
}
return true;
}
case GUI_MSG_SELCHANGED:
{
// a selection within a specific control has changed
SELECTED_EVENT selectedEvent = m_mapSelectedEvents[ message.GetSenderId() ];
// determine if there are any handlers for this event
if (selectedEvent.HasAHandler())
{
// fire the message to all handlers
selectedEvent.Fire(message);
}
break;
}
case GUI_MSG_FOCUSED:
{ // a control has been focused
if (HasID(message.GetSenderId()))
{
m_focusedControl = message.GetControlId();
return true;
}
break;
}
case GUI_MSG_LOSTFOCUS:
{
// nothing to do at the window level when we lose focus
return true;
}
case GUI_MSG_MOVE:
{
if (HasID(message.GetSenderId()))
return OnMove(message.GetControlId(), message.GetParam1());
break;
}
case GUI_MSG_SETFOCUS:
{
// CLog::Log(LOGDEBUG,"set focus to control:%i window:%i (%i)\n", message.GetControlId(),message.GetSenderId(), GetID());
if ( message.GetControlId() )
{
// first unfocus the current control
CGUIControl *control = GetFocusedControl();
if (control)
{
//.........这里部分代码省略.........
示例6: OnMessage
bool CGUIWindowMusicPlaylistEditor::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_WINDOW_DEINIT:
if (m_thumbLoader.IsLoading())
m_thumbLoader.StopThread();
if (m_playlistThumbLoader.IsLoading())
m_playlistThumbLoader.StopThread();
CGUIWindowMusicBase::OnMessage(message);
return true;
case GUI_MSG_WINDOW_INIT:
{
if (m_vecItems->m_strPath == "?")
m_vecItems->m_strPath.Empty();
CGUIWindowMusicBase::OnMessage(message);
if (message.GetNumStringParams())
LoadPlaylist(message.GetStringParam());
return true;
}
break;
case GUI_MSG_NOTIFY_ALL:
{
if (message.GetParam1()==GUI_MSG_REMOVED_MEDIA)
DeleteRemoveableMediaDirectoryCache();
}
break;
case GUI_MSG_CLICKED:
{
int control = message.GetSenderId();
if (control == CONTROL_PLAYLIST)
{
int item = GetCurrentPlaylistItem();
int action = message.GetParam1();
if (action == ACTION_CONTEXT_MENU || action == ACTION_MOUSE_RIGHT_CLICK)
OnPlaylistContext();
else if (action == ACTION_QUEUE_ITEM || action == ACTION_DELETE_ITEM || action == ACTION_MOUSE_MIDDLE_CLICK)
OnDeletePlaylistItem(item);
else if (action == ACTION_MOVE_ITEM_UP)
OnMovePlaylistItem(item, -1);
else if (action == ACTION_MOVE_ITEM_DOWN)
OnMovePlaylistItem(item, 1);
return true;
}
else if (control == CONTROL_LOAD_PLAYLIST)
{ // load a playlist
OnLoadPlaylist();
return true;
}
else if (control == CONTROL_SAVE_PLAYLIST)
{ // save the playlist
OnSavePlaylist();
return true;
}
else if (control == CONTROL_CLEAR_PLAYLIST)
{ // clear the playlist
ClearPlaylist();
return true;
}
}
break;
}
return CGUIWindowMusicBase::OnMessage(message);
}
示例7: OnMessage
bool CGUISpinControl::OnMessage(CGUIMessage& message)
{
if (CGUIControl::OnMessage(message) )
return true;
if (message.GetControlId() == GetID() )
{
switch (message.GetMessage())
{
case GUI_MSG_ITEM_SELECT:
if (SPIN_CONTROL_TYPE_PAGE == m_iType)
{
m_currentItem = message.GetParam1();
return true;
}
SetValue( message.GetParam1());
if (message.GetParam2() == SPIN_BUTTON_DOWN || message.GetParam2() == SPIN_BUTTON_UP)
m_iSelect = message.GetParam2();
return true;
break;
case GUI_MSG_LABEL_RESET:
if (SPIN_CONTROL_TYPE_PAGE == m_iType)
{
m_itemsPerPage = message.GetParam1();
m_numItems = message.GetParam2();
return true;
}
{
Clear();
return true;
}
break;
case GUI_MSG_SHOWRANGE:
if (message.GetParam1() )
m_bShowRange = true;
else
m_bShowRange = false;
break;
case GUI_MSG_SET_LABELS:
if (message.GetPointer())
{
const vector< pair<string, int> > *labels = (const vector< pair<string, int> > *)message.GetPointer();
Clear();
for (vector< pair<string, int> >::const_iterator i = labels->begin(); i != labels->end(); ++i)
AddLabel(i->first, i->second);
SetValue( message.GetParam1());
}
break;
case GUI_MSG_LABEL_ADD:
{
AddLabel(message.GetLabel(), message.GetParam1());
return true;
}
break;
case GUI_MSG_ITEM_SELECTED:
{
message.SetParam1( GetValue() );
message.SetParam2(m_iSelect);
if (m_iType == SPIN_CONTROL_TYPE_TEXT)
{
if ( m_iValue >= 0 && m_iValue < (int)m_vecLabels.size() )
message.SetLabel( m_vecLabels[m_iValue]);
}
return true;
}
case GUI_MSG_PAGE_UP:
if (CanMoveUp())
MoveUp();
return true;
case GUI_MSG_PAGE_DOWN:
if (CanMoveDown())
MoveDown();
return true;
case GUI_MSG_MOVE_OFFSET:
{
int count = (int)message.GetParam1();
while (count < 0)
{
MoveUp();
count++;
}
while (count > 0)
{
MoveDown();
count--;
}
return true;
}
}
}
return false;
//.........这里部分代码省略.........
示例8: OnMessage
//.........这里部分代码省略.........
// base class has opened the database, do our check
DisplayEmptyDatabaseMessage(m_musicdatabase.GetSongsCount() <= 0);
if (m_bDisplayEmptyDatabaseMessage)
{
// no library - make sure we focus on a known control, and default to the root.
SET_CONTROL_FOCUS(CONTROL_BTNTYPE, 0);
m_vecItems->m_strPath = "";
SetHistoryForPath("");
Update("");
}
return true;
}
break;
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
if (iControl == CONTROL_BTNPARTYMODE)
{
if (g_partyModeManager.IsEnabled())
g_partyModeManager.Disable();
else
{
if (!g_partyModeManager.Enable())
{
SET_CONTROL_SELECTED(GetID(),CONTROL_BTNPARTYMODE,false);
return false;
}
// Playlist directory is the root of the playlist window
if (m_guiState.get()) m_guiState->SetPlaylistDirectory("playlistmusic://");
return true;
}
UpdateButtons();
}
else if (iControl == CONTROL_BTNMANUALINFO)
{
OnManualAlbumInfo();
return true;
}
else if (iControl == CONTROL_BTN_FILTER)
{
if (m_filter.IsEmpty())
CGUIDialogKeyboard::ShowAndGetFilter(m_filter, false);
else
{
m_filter.Empty();
OnFilterItems();
}
return true;
}
else if (iControl == CONTROL_BTNSEARCH)
{
OnSearch();
return true;
}
}
break;
case GUI_MSG_PLAYBACK_STOPPED:
case GUI_MSG_PLAYBACK_ENDED:
case GUI_MSG_PLAYLISTPLAYER_STOPPED:
case GUI_MSG_PLAYBACK_STARTED:
{
SET_CONTROL_SELECTED(GetID(),CONTROL_BTNPARTYMODE, g_partyModeManager.IsEnabled());
}
break;
case GUI_MSG_NOTIFY_ALL:
{
if (message.GetParam1() == GUI_MSG_FILTER_ITEMS && IsActive())
{
if (message.GetParam2() == 1) // append
m_filter += message.GetStringParam();
else if (message.GetParam2() == 2)
{ // delete
if (m_filter.size())
m_filter = m_filter.Left(m_filter.size() - 1);
}
else
m_filter = message.GetStringParam();
OnFilterItems();
return true;
}
if (message.GetParam1() == GUI_MSG_SEARCH_UPDATE && IsActive())
{
m_search = message.GetStringParam();
CUtil::URLEncode(m_search);
if (!m_search.IsEmpty())
{
CStdString path = "musicsearch://" + m_search + "/";
m_history.ClearPathHistory();
Update(path);
}
}
}
}
return CGUIWindowMusicBase::OnMessage(message);
}
示例9: OnMessage
bool CGUIDialogSelect::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_WINDOW_DEINIT:
{
CGUIDialog::OnMessage(message);
m_viewControl.Clear();
m_bButtonEnabled = false;
m_useDetails = false;
m_multiSelection = false;
// construct selected items list
m_selectedItems->Clear();
m_iSelected = -1;
for (int i = 0 ; i < m_vecList->Size() ; i++)
{
CFileItemPtr item = m_vecList->Get(i);
if (item->IsSelected())
{
m_selectedItems->Add(item);
if (m_iSelected == -1)
m_iSelected = i;
}
}
m_vecList->Clear();
m_buttonString = -1;
SET_CONTROL_LABEL(CONTROL_BUTTON, "");
return true;
}
break;
case GUI_MSG_WINDOW_INIT:
{
m_bButtonPressed = false;
m_bConfirmed = false;
CGUIDialog::OnMessage(message);
return true;
}
break;
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
if (m_viewControl.HasControl(CONTROL_LIST))
{
int iAction = message.GetParam1();
if (ACTION_SELECT_ITEM == iAction || ACTION_MOUSE_LEFT_CLICK == iAction)
{
int iSelected = m_viewControl.GetSelectedItem();
if(iSelected >= 0 && iSelected < (int)m_vecList->Size())
{
CFileItemPtr item(m_vecList->Get(iSelected));
if (m_multiSelection)
item->Select(!item->IsSelected());
else
{
for (int i = 0 ; i < m_vecList->Size() ; i++)
m_vecList->Get(i)->Select(false);
item->Select(true);
m_bConfirmed = true;
Close();
}
}
}
}
if (CONTROL_BUTTON == iControl)
{
m_iSelected = -1;
m_bButtonPressed = true;
if (m_multiSelection)
m_bConfirmed = true;
Close();
}
}
break;
case GUI_MSG_SETFOCUS:
{
// make sure the additional button is focused in case the list is empty
// (otherwise it is impossible to navigate to the additional button)
if (m_vecList->IsEmpty() && m_bButtonEnabled &&
m_viewControl.HasControl(message.GetControlId()))
{
SET_CONTROL_FOCUS(CONTROL_BUTTON, 0);
return true;
}
if (m_viewControl.HasControl(message.GetControlId()) && m_viewControl.GetCurrentControl() != message.GetControlId())
{
m_viewControl.SetFocused();
return true;
}
}
break;
}
return CGUIDialog::OnMessage(message);
//.........这里部分代码省略.........
示例10: OnMessage
bool CGUIWindowSlideShow::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_WINDOW_INIT:
{
m_Resolution = (RESOLUTION) CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt(CSettings::SETTING_PICTURES_DISPLAYRESOLUTION);
//FIXME: Use GUI resolution for now
if (false /*m_Resolution != CDisplaySettings::GetInstance().GetCurrentResolution() && m_Resolution != INVALID && m_Resolution!=AUTORES*/)
CServiceBroker::GetWinSystem()->GetGfxContext().SetVideoResolution(m_Resolution, false);
else
m_Resolution = CServiceBroker::GetWinSystem()->GetGfxContext().GetVideoResolution();
CGUIDialog::OnMessage(message);
// turn off slideshow if we only have 1 image
if (m_slides.size() <= 1)
m_bSlideShow = false;
return true;
}
break;
case GUI_MSG_SHOW_PICTURE:
{
std::string strFile = message.GetStringParam();
Reset();
CFileItem item(strFile, false);
Add(&item);
RunSlideShow("", false, false, true, "", false);
}
break;
case GUI_MSG_START_SLIDESHOW:
{
std::string strFolder = message.GetStringParam();
unsigned int iParams = message.GetParam1();
std::string beginSlidePath = message.GetStringParam(1);
//decode params
bool bRecursive = false;
bool bRandom = false;
bool bNotRandom = false;
bool bPause = false;
if (iParams > 0)
{
if ((iParams & 1) == 1)
bRecursive = true;
if ((iParams & 2) == 2)
bRandom = true;
if ((iParams & 4) == 4)
bNotRandom = true;
if ((iParams & 8) == 8)
bPause = true;
}
RunSlideShow(strFolder, bRecursive, bRandom, bNotRandom, beginSlidePath, !bPause);
}
break;
case GUI_MSG_PLAYLISTPLAYER_STOPPED:
{
}
break;
case GUI_MSG_PLAYBACK_STOPPED:
{
if (m_bPlayingVideo)
{
m_bPlayingVideo = false;
m_iVideoSlide = -1;
if (m_bSlideShow)
m_bPause = true;
}
}
break;
case GUI_MSG_PLAYBACK_ENDED:
{
if (m_bPlayingVideo)
{
m_bPlayingVideo = false;
m_iVideoSlide = -1;
if (m_bSlideShow)
{
m_bPause = false;
if (m_iCurrentSlide == m_iNextSlide)
break;
m_Image[m_iCurrentPic].Close();
m_iCurrentPic = 1 - m_iCurrentPic;
m_iCurrentSlide = m_iNextSlide;
m_iNextSlide = GetNextSlide();
AnnouncePlayerPlay(m_slides.at(m_iCurrentSlide));
m_iZoomFactor = 1;
m_fZoom = 1.0f;
m_fRotate = 0.0f;
}
}
}
break;
}
//.........这里部分代码省略.........
示例11: OnMessage
bool CGUIWindowMusicNav::OnMessage(CGUIMessage& message)
{
switch (message.GetMessage())
{
case GUI_MSG_WINDOW_RESET:
m_vecItems->SetPath("?");
break;
case GUI_MSG_WINDOW_DEINIT:
if (m_thumbLoader.IsLoading())
m_thumbLoader.StopThread();
break;
case GUI_MSG_WINDOW_INIT:
{
/* We don't want to show Autosourced items (ie removable pendrives, memorycards) in Library mode */
m_rootDir.AllowNonLocalSources(false);
// is this the first time the window is opened?
if (m_vecItems->GetPath() == "?" && message.GetStringParam().IsEmpty())
message.SetStringParam(g_settings.m_defaultMusicLibSource);
DisplayEmptyDatabaseMessage(false); // reset message state
if (!CGUIWindowMusicBase::OnMessage(message))
return false;
// base class has opened the database, do our check
DisplayEmptyDatabaseMessage(m_musicdatabase.GetSongsCount() <= 0);
if (m_bDisplayEmptyDatabaseMessage)
{
// no library - make sure we focus on a known control, and default to the root.
SET_CONTROL_FOCUS(CONTROL_BTNTYPE, 0);
m_vecItems->SetPath("");
SetHistoryForPath("");
Update("");
}
return true;
}
break;
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
if (iControl == CONTROL_BTNPARTYMODE)
{
if (g_partyModeManager.IsEnabled())
g_partyModeManager.Disable();
else
{
if (!g_partyModeManager.Enable())
{
SET_CONTROL_SELECTED(GetID(),CONTROL_BTNPARTYMODE,false);
return false;
}
// Playlist directory is the root of the playlist window
if (m_guiState.get()) m_guiState->SetPlaylistDirectory("playlistmusic://");
return true;
}
UpdateButtons();
}
else if (iControl == CONTROL_BTNMANUALINFO)
{
OnManualAlbumInfo();
return true;
}
else if (iControl == CONTROL_SEARCH)
{
if (m_searchWithEdit)
{
// search updated - reset timer
m_searchTimer.StartZero();
// grab our search string
CGUIMessage selected(GUI_MSG_ITEM_SELECTED, GetID(), CONTROL_SEARCH);
OnMessage(selected);
SetProperty("search", selected.GetLabel());
return true;
}
CStdString search(GetProperty("search").asString());
CGUIKeyboardFactory::ShowAndGetFilter(search, true);
SetProperty("search", search);
return true;
}
}
break;
case GUI_MSG_PLAYBACK_STOPPED:
case GUI_MSG_PLAYBACK_ENDED:
case GUI_MSG_PLAYLISTPLAYER_STOPPED:
case GUI_MSG_PLAYBACK_STARTED:
{
SET_CONTROL_SELECTED(GetID(),CONTROL_BTNPARTYMODE, g_partyModeManager.IsEnabled());
}
break;
case GUI_MSG_NOTIFY_ALL:
{
if (message.GetParam1() == GUI_MSG_SEARCH_UPDATE && IsActive())
{
// search updated - reset timer
//.........这里部分代码省略.........
示例12: OnMessage
bool CGUIDialogSmartPlaylistEditor::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
int iAction = message.GetParam1();
if (iControl == CONTROL_RULE_LIST && (iAction == ACTION_SELECT_ITEM || iAction == ACTION_MOUSE_LEFT_CLICK))
OnRuleList(GetSelectedItem());
else if (iControl == CONTROL_RULE_ADD)
OnRuleAdd();
else if (iControl == CONTROL_RULE_EDIT)
OnRuleList(GetSelectedItem());
else if (iControl == CONTROL_RULE_REMOVE)
OnRuleRemove(GetSelectedItem());
else if (iControl == CONTROL_NAME)
OnEditChanged(iControl, m_playlist.m_playlistName);
else if (iControl == CONTROL_OK)
OnOK();
else if (iControl == CONTROL_CANCEL)
OnCancel();
else if (iControl == CONTROL_MATCH)
OnMatch();
else if (iControl == CONTROL_LIMIT)
OnLimit();
else if (iControl == CONTROL_ORDER_FIELD)
OnOrder();
else if (iControl == CONTROL_ORDER_DIRECTION)
OnOrderDirection();
else if (iControl == CONTROL_TYPE)
OnType();
else if (iControl == CONTROL_GROUP_BY)
OnGroupBy();
else if (iControl == CONTROL_GROUP_MIXED)
OnGroupMixed();
else
return CGUIDialog::OnMessage(message);
return true;
}
break;
case GUI_MSG_FOCUSED:
if (message.GetControlId() == CONTROL_RULE_REMOVE ||
message.GetControlId() == CONTROL_RULE_EDIT)
HighlightItem(GetSelectedItem());
else
{
if (message.GetControlId() == CONTROL_RULE_LIST)
UpdateRuleControlButtons();
HighlightItem(-1);
}
break;
case GUI_MSG_WINDOW_INIT:
{
const std::string& startupList = message.GetStringParam(0);
if (!startupList.empty())
{
int party = 0;
if (URIUtils::PathEquals(startupList, CProfilesManager::Get().GetUserDataItem("PartyMode.xsp")))
party = 1;
else if (URIUtils::PathEquals(startupList, CProfilesManager::Get().GetUserDataItem("PartyMode-Video.xsp")))
party = 2;
if ((party && !XFILE::CFile::Exists(startupList)) ||
m_playlist.Load(startupList))
{
m_path = startupList;
if (party == 1)
m_mode = "partymusic";
else if (party == 2)
m_mode = "partyvideo";
else
{
PLAYLIST_TYPE type = ConvertType(m_playlist.GetType());
if (type == TYPE_SONGS || type == TYPE_ALBUMS || type == TYPE_ARTISTS)
m_mode = "music";
else
m_mode = "video";
}
}
else
return false;
}
}
break;
}
return CGUIDialog::OnMessage(message);
}
示例13: OnMessage
bool CGUIControlGroupList::OnMessage(CGUIMessage& message)
{
switch (message.GetMessage() )
{
case GUI_MSG_FOCUSED:
{ // a control has been focused
// scroll if we need to and update our page control
ValidateOffset();
float offset = 0;
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
{
CGUIControl *control = *it;
if (!control->IsVisible())
continue;
if (control->HasID(message.GetControlId()))
{
if (offset < m_offset)
ScrollTo(offset);
else if (offset + Size(control) > m_offset + Size())
ScrollTo(offset + Size(control) - Size());
break;
}
offset += Size(control) + m_itemGap;
}
}
break;
case GUI_MSG_SETFOCUS:
{
// we've been asked to focus. We focus the last control if it's on this page,
// else we'll focus the first focusable control from our offset (after verifying it)
ValidateOffset();
// now check the focusControl's offset
float offset = 0;
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
{
CGUIControl *control = *it;
if (!control->IsVisible())
continue;
if (control->HasID(m_focusedControl))
{
if (offset >= m_offset && offset + Size(control) <= m_offset + Size())
return CGUIControlGroup::OnMessage(message);
break;
}
offset += Size(control) + m_itemGap;
}
// find the first control on this page
offset = 0;
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
{
CGUIControl *control = *it;
if (!control->IsVisible())
continue;
if (control->CanFocus() && offset >= m_offset && offset + Size(control) <= m_offset + Size())
{
m_focusedControl = control->GetID();
break;
}
offset += Size(control) + m_itemGap;
}
}
break;
case GUI_MSG_PAGE_CHANGE:
{
if (message.GetSenderId() == m_pageControl)
{ // it's from our page control
ScrollTo((float)message.GetParam1());
return true;
}
}
break;
}
return CGUIControlGroup::OnMessage(message);
}
示例14: OnMessage
bool CGUIWindowPVRGuide::OnMessage(CGUIMessage& message)
{
if (!IsValidMessage(message))
return false;
bool bReturn = false;
switch (message.GetMessage())
{
case GUI_MSG_CLICKED:
{
if (message.GetSenderId() == m_viewControl.GetCurrentControl())
{
int iItem = m_viewControl.GetSelectedItem();
if (iItem >= 0 && iItem < m_vecItems->Size())
{
CFileItemPtr pItem = m_vecItems->Get(iItem);
/* process actions */
switch (message.GetParam1())
{
case ACTION_SELECT_ITEM:
case ACTION_MOUSE_LEFT_CLICK:
switch(CSettings::GetInstance().GetInt(CSettings::SETTING_EPG_SELECTACTION))
{
case EPG_SELECT_ACTION_CONTEXT_MENU:
OnPopupMenu(iItem);
bReturn = true;
break;
case EPG_SELECT_ACTION_SWITCH:
ActionPlayEpg(pItem.get(), false);
bReturn = true;
break;
case EPG_SELECT_ACTION_PLAY_RECORDING:
ActionPlayEpg(pItem.get(), true);
bReturn = true;
break;
case EPG_SELECT_ACTION_INFO:
ShowEPGInfo(pItem.get());
bReturn = true;
break;
case EPG_SELECT_ACTION_RECORD:
ActionRecord(pItem.get());
bReturn = true;
break;
}
break;
case ACTION_SHOW_INFO:
ShowEPGInfo(pItem.get());
bReturn = true;
break;
case ACTION_PLAY:
ActionPlayEpg(pItem.get(), true);
bReturn = true;
break;
case ACTION_RECORD:
ActionRecord(pItem.get());
bReturn = true;
break;
case ACTION_CONTEXT_MENU:
case ACTION_MOUSE_RIGHT_CLICK:
OnPopupMenu(iItem);
bReturn = true;
break;
}
}
}
else if (message.GetSenderId() == CONTROL_BTNVIEWASICONS)
{
// let's set the view mode first before update
CGUIWindowPVRBase::OnMessage(message);
Refresh(true);
bReturn = true;
}
break;
}
case GUI_MSG_CHANGE_VIEW_MODE:
{
// let's set the view mode first before update
CGUIWindowPVRBase::OnMessage(message);
m_nextUpdateTimeout.SetExpired();
Refresh(true);
bReturn = true;
break;
}
case GUI_MSG_REFRESH_LIST:
switch(message.GetParam1())
{
case ObservableMessageChannelGroup:
case ObservableMessageEpg:
case ObservableMessageEpgContainer:
{
m_bUpdateRequired = true;
// do not allow more than MAX_UPDATE_FREQUENCY updates
if (IsActive() && m_nextUpdateTimeout.IsTimePast())
{
Refresh(true);
m_nextUpdateTimeout.Set(MAX_UPDATE_FREQUENCY);
}
bReturn = true;
break;
}
//.........这里部分代码省略.........
示例15: OnMessage
bool CGUIWindowPictures::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_WINDOW_DEINIT:
{
if (m_thumbLoader.IsLoading())
m_thumbLoader.StopThread();
}
break;
case GUI_MSG_WINDOW_INIT:
{
// is this the first time accessing this window?
if (m_vecItems->GetPath() == "?" && message.GetStringParam().empty())
message.SetStringParam(CMediaSourceSettings::GetInstance().GetDefaultSource("pictures"));
m_dlgProgress = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
if (!CGUIMediaWindow::OnMessage(message))
return false;
return true;
}
break;
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
if (iControl == CONTROL_BTNSLIDESHOW) // Slide Show
{
OnSlideShow();
}
else if (iControl == CONTROL_BTNSLIDESHOW_RECURSIVE) // Recursive Slide Show
{
OnSlideShowRecursive();
}
else if (iControl == CONTROL_SHUFFLE)
{
CSettings::GetInstance().ToggleBool(CSettings::SETTING_SLIDESHOW_SHUFFLE);
CSettings::GetInstance().Save();
}
else if (m_viewControl.HasControl(iControl)) // list/thumb control
{
int iItem = m_viewControl.GetSelectedItem();
int iAction = message.GetParam1();
// iItem is checked for validity inside these routines
if (iAction == ACTION_DELETE_ITEM)
{
// is delete allowed?
if (CSettings::GetInstance().GetBool(CSettings::SETTING_FILELISTS_ALLOWFILEDELETION))
OnDeleteItem(iItem);
else
return false;
}
else if (iAction == ACTION_PLAYER_PLAY)
{
ShowPicture(iItem, true);
return true;
}
else if (iAction == ACTION_SHOW_INFO)
{
OnItemInfo(iItem);
return true;
}
}
}
break;
}
return CGUIMediaWindow::OnMessage(message);
}