本文整理汇总了C++中CGUIMessage类的典型用法代码示例。如果您正苦于以下问题:C++ CGUIMessage类的具体用法?C++ CGUIMessage怎么用?C++ CGUIMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CGUIMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
bool CGUIControl::OnMessage(CGUIMessage& message)
{
if ( message.GetControlId() == GetID() )
{
switch (message.GetMessage() )
{
case GUI_MSG_SETFOCUS:
// if control is disabled then move 2 the next control
if ( !CanFocus() )
{
CLog::Log(LOGERROR, "Control %u in window %u has been asked to focus, "
"but it can't",
GetID(), GetParentID());
return false;
}
SetFocus(true);
{
// inform our parent window that this has happened
CGUIMessage message(GUI_MSG_FOCUSED, GetParentID(), GetID());
if (m_parentControl)
m_parentControl->OnMessage(message);
}
return true;
break;
case GUI_MSG_LOSTFOCUS:
{
SetFocus(false);
// and tell our parent so it can unfocus
if (m_parentControl)
m_parentControl->OnMessage(message);
return true;
}
break;
case GUI_MSG_VISIBLE:
SetVisible(true, true);
return true;
break;
case GUI_MSG_HIDDEN:
SetVisible(false);
return true;
// Note that the skin <enable> tag will override these messages
case GUI_MSG_ENABLED:
SetEnabled(true);
return true;
case GUI_MSG_DISABLED:
SetEnabled(false);
return true;
case GUI_MSG_WINDOW_RESIZE:
// invalidate controls to get them to recalculate sizing information
SetInvalid();
return true;
}
}
return false;
}
示例2: OnMessage
bool CGUIControllerWindow::OnMessage(CGUIMessage& message)
{
switch (message.GetMessage())
{
case GUI_MSG_WINDOW_INIT:
{
//! @todo Process parameter
//std::string strParam = message.GetStringParam();
break;
}
case GUI_MSG_CLICKED:
{
int controlId = message.GetSenderId();
if (controlId == CONTROL_CLOSE_BUTTON)
{
Close();
return true;
}
else if (controlId == CONTROL_GET_MORE)
{
GetMoreControllers();
return true;
}
else if (controlId == CONTROL_RESET_BUTTON)
{
ResetController();
return true;
}
else if (controlId == CONTROL_HELP_BUTTON)
{
ShowHelp();
return true;
}
else if (CONTROL_CONTROLLER_BUTTONS_START <= controlId && controlId < CONTROL_CONTROLLER_BUTTONS_END)
{
OnControllerSelected(controlId - CONTROL_CONTROLLER_BUTTONS_START);
return true;
}
else if (CONTROL_FEATURE_BUTTONS_START <= controlId && controlId < CONTROL_FEATURE_BUTTONS_END)
{
OnFeatureSelected(controlId - CONTROL_FEATURE_BUTTONS_START);
return true;
}
break;
}
case GUI_MSG_FOCUSED:
{
int controlId = message.GetControlId();
if (CONTROL_CONTROLLER_BUTTONS_START <= controlId && controlId < CONTROL_CONTROLLER_BUTTONS_END)
{
OnControllerFocused(controlId - CONTROL_CONTROLLER_BUTTONS_START);
}
else if (CONTROL_FEATURE_BUTTONS_START <= controlId && controlId < CONTROL_FEATURE_BUTTONS_END)
{
OnFeatureFocused(controlId - CONTROL_FEATURE_BUTTONS_START);
}
break;
}
case GUI_MSG_SETFOCUS:
{
int controlId = message.GetControlId();
if (CONTROL_CONTROLLER_BUTTONS_START <= controlId && controlId < CONTROL_CONTROLLER_BUTTONS_END)
{
OnControllerFocused(controlId - CONTROL_CONTROLLER_BUTTONS_START);
}
else if (CONTROL_FEATURE_BUTTONS_START <= controlId && controlId < CONTROL_FEATURE_BUTTONS_END)
{
OnFeatureFocused(controlId - CONTROL_FEATURE_BUTTONS_START);
}
break;
}
case GUI_MSG_REFRESH_LIST:
{
int controlId = message.GetControlId();
if (controlId == CONTROL_CONTROLLER_LIST)
{
if (m_controllerList && m_controllerList->Refresh())
{
CGUIDialog::OnMessage(message);
return true;
}
}
break;
}
default:
break;
}
return CGUIDialog::OnMessage(message);
}
示例3: 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();
}
else if (iControl == CONTROL_CLEAR_BOOKMARKS)
{
ClearBookmarks();
}
else if (iControl == CONTROL_ADD_EPISODE_BOOKMARK)
{
AddEpisodeBookmark();
}
else if (m_viewControl.HasControl(iControl)) // list/thumb control
{
int iItem = m_viewControl.GetSelectedItem();
int iAction = message.GetParam1();
if (iAction == ACTION_DELETE_ITEM)
{
if( (unsigned)iItem < m_bookmarks.size() )
{
CVideoDatabase videoDatabase;
videoDatabase.Open();
videoDatabase.ClearBookMarkOfFile(g_application.CurrentFile(),m_bookmarks[iItem],m_bookmarks[iItem].type);
videoDatabase.Close();
CUtil::DeleteVideoDatabaseDirectoryCache();
}
Update();
}
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;
}
return CGUIDialog::OnMessage(message);
}
示例4: OnMessage
bool CGUIDialogAddonInfo::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_WINDOW_DEINIT:
{
if (m_jobid)
CJobManager::GetInstance().CancelJob(m_jobid);
}
break;
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
if (iControl == CONTROL_BTN_UPDATE)
{
OnUpdate();
return true;
}
if (iControl == CONTROL_BTN_INSTALL)
{
if (!m_localAddon)
{
OnInstall();
return true;
}
else
{
OnUninstall();
return true;
}
}
else if (iControl == CONTROL_BTN_SELECT)
{
OnLaunch();
return true;
}
else if (iControl == CONTROL_BTN_ENABLE)
{
OnEnable(!m_item->GetProperty("Addon.Enabled").asBoolean());
return true;
}
else if (iControl == CONTROL_BTN_SETTINGS)
{
OnSettings();
return true;
}
else if (iControl == CONTROL_BTN_CHANGELOG)
{
OnChangeLog();
return true;
}
else if (iControl == CONTROL_BTN_ROLLBACK)
{
OnRollback();
return true;
}
}
break;
default:
break;
}
return CGUIDialog::OnMessage(message);
}
示例5: switch
bool CGUIDialogMusicInfo::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_WINDOW_DEINIT:
{
CGUIMessage message(GUI_MSG_LABEL_RESET, GetID(), CONTROL_LIST);
OnMessage(message);
m_albumSongs->Clear();
}
break;
case GUI_MSG_WINDOW_INIT:
{
CGUIDialog::OnMessage(message);
m_bViewReview = true;
m_bRefresh = false;
Update();
return true;
}
break;
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
if (iControl == CONTROL_BTN_REFRESH)
{
m_bRefresh = true;
Close();
return true;
}
else if (iControl == CONTROL_BTN_GET_THUMB)
{
OnGetThumb();
}
else if (iControl == CONTROL_BTN_TRACKS)
{
m_bViewReview = !m_bViewReview;
Update();
}
else if (iControl == CONTROL_LIST)
{
int iAction = message.GetParam1();
if (m_bArtistInfo && (ACTION_SELECT_ITEM == iAction || ACTION_MOUSE_LEFT_CLICK == iAction))
{
CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), iControl);
g_windowManager.SendMessage(msg);
int iItem = msg.GetParam1();
if (iItem < 0 || iItem >= (int)m_albumSongs->Size())
break;
CFileItemPtr item = m_albumSongs->Get(iItem);
OnSearch(item.get());
return true;
}
}
else if (iControl == CONTROL_BTN_GET_FANART)
{
OnGetFanart();
}
}
break;
}
return CGUIDialog::OnMessage(message);
}
示例6: SendMessage
bool CGUIWindowManager::SendMessage(CGUIMessage& message)
{
bool handled = false;
// CLog::Log(LOGDEBUG,"SendMessage: mess=%d send=%d control=%d param1=%d", message.GetMessage(), message.GetSenderId(), message.GetControlId(), message.GetParam1());
// Send the message to all none window targets
for (int i = 0; i < (int) m_vecMsgTargets.size(); i++)
{
IMsgTargetCallback* pMsgTarget = m_vecMsgTargets[i];
if (pMsgTarget)
{
if (pMsgTarget->OnMessage( message )) handled = true;
}
}
// A GUI_MSG_NOTIFY_ALL is send to any active modal dialog
// and all windows whether they are active or not
if (message.GetMessage()==GUI_MSG_NOTIFY_ALL)
{
CSingleLock lock(g_graphicsContext);
for (rDialog it = m_activeDialogs.rbegin(); it != m_activeDialogs.rend(); ++it)
{
CGUIWindow *dialog = *it;
dialog->OnMessage(message);
}
for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); ++it)
{
CGUIWindow *pWindow = (*it).second;
pWindow->OnMessage(message);
}
return true;
}
// Normal messages are sent to:
// 1. All active modeless dialogs
// 2. The topmost dialog that accepts the message
// 3. The underlying window (only if it is the sender or receiver if a modal dialog is active)
bool hasModalDialog(false);
bool modalAcceptedMessage(false);
// don't use an iterator for this loop, as some messages mean that m_activeDialogs is altered,
// which will invalidate any iterator
CSingleLock lock(g_graphicsContext);
unsigned int topWindow = m_activeDialogs.size();
while (topWindow)
{
CGUIWindow* dialog = m_activeDialogs[--topWindow];
lock.Leave();
if (!modalAcceptedMessage && dialog->IsModalDialog())
{ // modal window
hasModalDialog = true;
if (!modalAcceptedMessage && dialog->OnMessage( message ))
{
modalAcceptedMessage = handled = true;
}
}
else if (!dialog->IsModalDialog())
{ // modeless
if (dialog->OnMessage( message ))
handled = true;
}
lock.Enter();
if (topWindow > m_activeDialogs.size())
topWindow = m_activeDialogs.size();
}
lock.Leave();
// now send to the underlying window
CGUIWindow* window = GetWindow(GetActiveWindow());
if (window)
{
if (hasModalDialog)
{
// only send the message to the underlying window if it's the recipient
// or sender (or we have no sender)
if (message.GetSenderId() == window->GetID() ||
message.GetControlId() == window->GetID() ||
message.GetSenderId() == 0 )
{
if (window->OnMessage(message)) handled = true;
}
}
else
{
if (window->OnMessage(message)) handled = true;
}
}
return handled;
}
示例7: 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()))
{
// find out whether this is the first or last control
if (IsFirstFocusableControl(control))
ScrollTo(0);
else if (IsLastFocusableControl(control))
ScrollTo(m_totalSize - Size());
else if (offset < m_scroller.GetValue())
ScrollTo(offset);
else if (offset + Size(control) > m_scroller.GetValue() + 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_scroller.GetValue() && offset + Size(control) <= m_scroller.GetValue() + 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_scroller.GetValue() && offset + Size(control) <= m_scroller.GetValue() + 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);
}
示例8: OnMessage
bool CGUIEditControl::OnMessage(CGUIMessage &message)
{
if (message.GetMessage() == GUI_MSG_SET_TYPE)
{
SetInputType((INPUT_TYPE)message.GetParam1(), (int)message.GetParam2());
return true;
}
else if (message.GetMessage() == GUI_MSG_ITEM_SELECTED)
{
message.SetLabel(GetLabel2());
return true;
}
else if (message.GetMessage() == GUI_MSG_SET_TEXT &&
((message.GetControlId() <= 0 && HasFocus()) || (message.GetControlId() == GetID())))
{
SetLabel2(message.GetLabel());
UpdateText();
}
else if (message.GetMessage() == GUI_MSG_INPUT_TEXT_EDIT && HasFocus())
{
g_charsetConverter.utf8ToW(message.GetLabel(), m_edit);
m_editOffset = message.GetParam1();
m_editLength = message.GetParam2();
UpdateText(false);
return true;
}
return CGUIButtonControl::OnMessage(message);
}
示例9: OnMessage
bool CGUIDialogPVRChannelsOSD::OnMessage(CGUIMessage& message)
{
switch (message.GetMessage())
{
case GUI_MSG_WINDOW_DEINIT:
{
if (m_group)
{
g_PVRManager.SetPlayingGroup(m_group);
SetLastSelectedItem(m_group->GroupID());
}
Clear();
}
break;
case GUI_MSG_WINDOW_INIT:
{
/* Close dialog immediately if now TV or radio channel is playing */
if (!g_PVRManager.IsPlaying())
{
Close();
return true;
}
m_group = GetPlayingGroup();
CGUIWindow::OnMessage(message);
Update(true);
return true;
}
break;
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
if (m_viewControl.HasControl(iControl)) // list/thumb control
{
int iItem = m_viewControl.GetSelectedItem();
int iAction = message.GetParam1();
if (iAction == ACTION_SELECT_ITEM || iAction == ACTION_MOUSE_LEFT_CLICK)
{
/* Switch to channel */
GotoChannel(iItem);
return true;
}
else if (iAction == ACTION_SHOW_INFO || iAction == ACTION_MOUSE_RIGHT_CLICK)
{
/* Show information Dialog */
ShowInfo(iItem);
return true;
}
}
}
break;
case GUI_MSG_MOVE:
{
int iAction = message.GetParam1();
if (iAction == ACTION_MOVE_RIGHT || iAction == ACTION_MOVE_LEFT)
{
CPVRChannelGroupPtr group = GetPlayingGroup();
CPVRChannelGroupPtr nextGroup = iAction == ACTION_MOVE_RIGHT ? group->GetNextGroup() : group->GetPreviousGroup();
g_PVRManager.SetPlayingGroup(nextGroup);
SetLastSelectedItem(group->GroupID());
Update();
return true;
}
}
break;
}
return CGUIDialog::OnMessage(message);
}
示例10: switch
bool CGUIWindow::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
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_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)
{
CGUIMessage msgLostFocus(GUI_MSG_LOSTFOCUS, GetID(), control->GetID(), message.GetControlId());
control->OnMessage(msgLostFocus);
}
// get the control to focus
CGUIControl* pFocusedControl = GetFirstFocusableControl(message.GetControlId());
if (!pFocusedControl) pFocusedControl = (CGUIControl *)GetControl(message.GetControlId());
// and focus it
if (pFocusedControl)
return pFocusedControl->OnMessage(message);
}
return true;
}
break;
case GUI_MSG_EXCLUSIVE_MOUSE:
{
m_exclusiveMouseControl = message.GetSenderId();
return true;
}
break;
//.........这里部分代码省略.........
示例11: switch
bool CGUIDialogSongInfo::OnMessage(CGUIMessage& message)
{
switch (message.GetMessage())
{
case GUI_MSG_WINDOW_DEINIT:
{
if (m_startUserrating != m_song->GetMusicInfoTag()->GetUserrating())
{
CMusicDatabase db;
if (db.Open())
{
m_needsUpdate = true;
db.SetSongUserrating(m_song->GetPath(), m_song->GetMusicInfoTag()->GetUserrating());
db.Close();
}
}
CGUIMessage msg(GUI_MSG_LABEL_RESET, GetID(), CONTROL_LIST);
OnMessage(msg);
break;
}
case GUI_MSG_WINDOW_INIT:
CGUIDialog::OnMessage(message);
Update();
m_cancelled = false;
break;
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
if (iControl == CONTROL_USERRATING)
{
OnSetUserrating();
}
else if (iControl == CONTROL_ALBUMINFO)
{
CGUIWindowMusicBase *window = (CGUIWindowMusicBase *)g_windowManager.GetWindow(WINDOW_MUSIC_NAV);
if (window)
{
CFileItem item(*m_song);
std::string path = StringUtils::Format("musicdb://albums/%li",m_albumId);
item.SetPath(path);
item.m_bIsFolder = true;
window->OnItemInfo(&item, true);
}
return true;
}
else if (iControl == CONTROL_BTN_GET_THUMB)
{
OnGetThumb();
return true;
}
else if (iControl == CONTROL_LIST)
{
int iAction = message.GetParam1();
if ((ACTION_SELECT_ITEM == iAction || ACTION_MOUSE_LEFT_CLICK == iAction))
{
CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), iControl);
g_windowManager.SendMessage(msg);
int iItem = msg.GetParam1();
if (iItem < 0 || iItem >= static_cast<int>(m_song->GetMusicInfoTag()->GetContributors().size()))
break;
int idArtist = m_song->GetMusicInfoTag()->GetContributors()[iItem].GetArtistId();
if (idArtist > 0)
{
CGUIWindowMusicBase *window = (CGUIWindowMusicBase *)g_windowManager.GetWindow(WINDOW_MUSIC_NAV);
if (window)
{
CFileItem item(*m_song);
std::string path = StringUtils::Format("musicdb://artists/%li", idArtist);
item.SetPath(path);
item.m_bIsFolder = true;
window->OnItemInfo(&item, true);
}
}
return true;
}
}
}
break;
}
return CGUIDialog::OnMessage(message);
}
示例12: OnClick
/*!
\brief Handle messages on window.
\param message GUI Message that can be reacted on.
\return if a message can't be processed, return \e false
On these messages this class reacts.\n
When retrieving...
- #GUI_MSG_WINDOW_DEINIT\n
...the last focused control is saved to m_iLastControl.
- #GUI_MSG_WINDOW_INIT\n
...the musicdatabase is opend and the music extensions and shares are set.
The last focused control is set.
- #GUI_MSG_CLICKED\n
... the base class reacts on the following controls:\n
Buttons:\n
- #CONTROL_BTNVIEWASICONS - switch between list, thumb and with large items
- #CONTROL_BTNSEARCH - Search for items\n
Other Controls:
- The container controls\n
Have the following actions in message them clicking on them.
- #ACTION_QUEUE_ITEM - add selected item to playlist
- #ACTION_SHOW_INFO - retrieve album info from the internet
- #ACTION_SELECT_ITEM - Item has been selected. Overwrite OnClick() to react on it
*/
bool CGUIWindowMusicBase::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_WINDOW_DEINIT:
{
if (m_thumbLoader.IsLoading())
m_thumbLoader.StopThread();
m_musicdatabase.Close();
}
break;
case GUI_MSG_WINDOW_INIT:
{
m_dlgProgress = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
m_musicdatabase.Open();
if (!CGUIMediaWindow::OnMessage(message))
return false;
return true;
}
break;
case GUI_MSG_DIRECTORY_SCANNED:
{
CFileItem directory(message.GetStringParam(), true);
// Only update thumb on a local drive
if (directory.IsHD())
{
std::string strParent;
URIUtils::GetParentPath(directory.GetPath(), strParent);
if (directory.GetPath() == m_vecItems->GetPath() || strParent == m_vecItems->GetPath())
Refresh();
}
}
break;
// update the display
case GUI_MSG_SCAN_FINISHED:
case GUI_MSG_REFRESH_THUMBS:
Refresh();
break;
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
if (iControl == CONTROL_BTNRIP)
{
OnRipCD();
}
else if (iControl == CONTROL_BTNPLAYLISTS)
{
if (!m_vecItems->IsPath("special://musicplaylists/"))
Update("special://musicplaylists/");
}
else if (iControl == CONTROL_BTNSCAN)
{
OnScan(-1);
}
else if (iControl == CONTROL_BTNREC)
{
if (g_application.m_pPlayer->IsPlayingAudio() )
{
if (g_application.m_pPlayer->CanRecord() )
{
bool bIsRecording = g_application.m_pPlayer->IsRecording();
g_application.m_pPlayer->Record(!bIsRecording);
UpdateButtons();
}
}
}
else if (m_viewControl.HasControl(iControl)) // list/thumb control
{
int iItem = m_viewControl.GetSelectedItem();
//.........这里部分代码省略.........
示例13: OnMessage
bool CGUIWindowVideoNav::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);
SetProperty("flattened", CSettings::Get().GetBool("myvideos.flatten"));
if (message.GetNumStringParams() && message.GetStringParam(0).Equals("Files") &&
CMediaSourceSettings::Get().GetSources("video")->empty())
{
message.SetStringParam("");
}
if (!CGUIWindowVideoBase::OnMessage(message))
return false;
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(PARTYMODECONTEXT_VIDEO))
{
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("playlistvideo://");
return true;
}
UpdateButtons();
}
if (iControl == CONTROL_BTNSEARCH)
{
OnSearch();
}
else if (iControl == CONTROL_BTNSHOWMODE)
{
CMediaSettings::Get().CycleWatchedMode(m_vecItems->GetContent());
CSettings::Get().Save();
OnFilterItems(GetProperty("filter").asString());
return true;
}
else if (iControl == CONTROL_BTNSHOWALL)
{
if (CMediaSettings::Get().GetWatchedMode(m_vecItems->GetContent()) == WatchedModeAll)
CMediaSettings::Get().SetWatchedMode(m_vecItems->GetContent(), WatchedModeUnwatched);
else
CMediaSettings::Get().SetWatchedMode(m_vecItems->GetContent(), WatchedModeAll);
CSettings::Get().Save();
OnFilterItems(GetProperty("filter").asString());
return true;
}
else if (iControl == CONTROL_UPDATE_LIBRARY)
{
if (!g_application.IsVideoScanning())
OnScan("");
else
g_application.StopVideoScan();
return true;
}
}
break;
// update the display
case GUI_MSG_SCAN_FINISHED:
case GUI_MSG_REFRESH_THUMBS:
Refresh();
break;
}
return CGUIWindowVideoBase::OnMessage(message);
}
示例14: switch
bool CGUIDialogMusicInfo::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_WINDOW_DEINIT:
{
CGUIMessage message(GUI_MSG_LABEL_RESET, GetID(), CONTROL_LIST);
OnMessage(message);
m_albumSongs->Clear();
}
break;
case GUI_MSG_WINDOW_INIT:
{
CGUIDialog::OnMessage(message);
m_bViewReview = true;
m_bRefresh = false;
RefreshThumb();
Update();
return true;
}
break;
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
if (iControl == CONTROL_BTN_REFRESH)
{
m_bRefresh = true;
Close();
return true;
}
else if (iControl == CONTROL_BTN_GET_THUMB)
{
OnGetThumb();
}
else if (iControl == CONTROL_BTN_TRACKS)
{
m_bViewReview = !m_bViewReview;
Update();
}
else if (iControl == CONTROL_LIST)
{
int iAction = message.GetParam1();
if (m_bArtistInfo && (ACTION_SELECT_ITEM == iAction || ACTION_MOUSE_LEFT_CLICK == iAction))
{
CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), iControl);
g_windowManager.SendMessage(msg);
int iItem = msg.GetParam1();
if (iItem < 0 || iItem >= (int)m_albumSongs->Size())
break;
CFileItemPtr item = m_albumSongs->Get(iItem);
OnSearch(item.get());
return true;
}
}
else if (iControl == CONTROL_BTN_LASTFM)
{
CStdString strArtist = m_album.strArtist;
CURL::Encode(strArtist);
CStdString strLink;
strLink.Format("lastfm://artist/%s/similarartists", strArtist.c_str());
CURL url(strLink);
CLastFmManager::GetInstance()->ChangeStation(url);
}
else if (iControl == CONTROL_BTN_GET_FANART)
{
OnGetFanart();
}
}
break;
}
return CGUIDialog::OnMessage(message);
}
示例15: switch
bool CGUIWindowFullScreen::OnMessage(CGUIMessage& message)
{
switch (message.GetMessage())
{
case GUI_MSG_WINDOW_INIT:
{
// check whether we've come back here from a window during which time we've actually
// stopped playing videos
if (message.GetParam1() == WINDOW_INVALID && !g_application.m_pPlayer->IsPlayingVideo())
{ // why are we here if nothing is playing???
g_windowManager.PreviousWindow();
return true;
}
g_infoManager.SetShowInfo(false);
g_infoManager.SetShowCodec(false);
m_bShowCurrentTime = false;
m_bGroupSelectShow = false;
g_infoManager.SetDisplayAfterSeek(0); // Make sure display after seek is off.
// switch resolution
g_graphicsContext.SetFullScreenVideo(true);
#ifdef HAS_VIDEO_PLAYBACK
// make sure renderer is uptospeed
g_renderManager.Update();
#endif
// now call the base class to load our windows
CGUIWindow::OnMessage(message);
m_bShowViewModeInfo = false;
return true;
}
case GUI_MSG_WINDOW_DEINIT:
{
CGUIDialog *pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_OSD_TELETEXT);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_SLIDER);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_OSD);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_FULLSCREEN_INFO);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_CHANNELS);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_GUIDE);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_DIRECTOR);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_CUTTER);
if (pDialog) pDialog->Close(true);
CGUIWindow::OnMessage(message);
CSettings::Get().Save();
CSingleLock lock (g_graphicsContext);
g_graphicsContext.SetFullScreenVideo(false);
lock.Leave();
#ifdef HAS_VIDEO_PLAYBACK
// make sure renderer is uptospeed
g_renderManager.Update();
#endif
return true;
}
case GUI_MSG_CLICKED:
{
unsigned int iControl = message.GetSenderId();
if (iControl == CONTROL_GROUP_CHOOSER && g_PVRManager.IsStarted())
{
// Get the currently selected label of the Select button
CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), iControl);
OnMessage(msg);
CStdString strLabel = msg.GetLabel();
CPVRChannelPtr playingChannel;
if (g_PVRManager.GetCurrentChannel(playingChannel))
{
CPVRChannelGroupPtr selectedGroup = g_PVRChannelGroups->Get(playingChannel->IsRadio())->GetByName(strLabel);
if (selectedGroup)
{
g_PVRManager.SetPlayingGroup(selectedGroup);
CLog::Log(LOGDEBUG, "%s - switched to group '%s'", __FUNCTION__, selectedGroup->GroupName().c_str());
if (!selectedGroup->IsGroupMember(*playingChannel))
{
CLog::Log(LOGDEBUG, "%s - channel '%s' is not a member of '%s', switching to channel 1 of the new group",
__FUNCTION__, playingChannel->ChannelName().c_str(), selectedGroup->GroupName().c_str());
CFileItemPtr switchChannel = selectedGroup->GetByChannelNumber(1);
if (switchChannel && switchChannel->HasPVRChannelInfoTag())
g_application.OnAction(CAction(ACTION_CHANNEL_SWITCH, (float) switchChannel->GetPVRChannelInfoTag()->ChannelNumber()));
else
{
CLog::Log(LOGERROR, "%s - cannot find channel '1' in group %s", __FUNCTION__, selectedGroup->GroupName().c_str());
CApplicationMessenger::Get().MediaStop(false);
}
}
}
//.........这里部分代码省略.........