bool CGUIWindowSystemInfo::OnMessage(CGUIMessage& message) { switch (message.GetMessage()) { case GUI_MSG_WINDOW_INIT: { CGUIWindow::OnMessage(message); SET_CONTROL_LABEL(52, CSysInfo::GetAppName() + " " + CSysInfo::GetVersion()); SET_CONTROL_LABEL(53, CSysInfo::GetBuildDate()); CONTROL_ENABLE_ON_CONDITION(CONTROL_BT_PVR, PVR::CPVRManager::GetInstance().IsStarted()); return true; } break; case GUI_MSG_WINDOW_DEINIT: { CGUIWindow::OnMessage(message); m_diskUsage.clear(); return true; } break; case GUI_MSG_FOCUSED: { CGUIWindow::OnMessage(message); int focusedControl = GetFocusedControlID(); if (m_section != focusedControl && focusedControl >= CONTROL_START && focusedControl <= CONTROL_END) { ResetLabels(); m_section = focusedControl; } return true; } break; } return CGUIWindow::OnMessage(message); }
bool CGUIWindowSystemInfo::OnMessage(CGUIMessage& message) { switch ( message.GetMessage() ) { case GUI_MSG_WINDOW_INIT: { CGUIWindow::OnMessage(message); SET_CONTROL_LABEL(52, CSysInfo::GetAppName() + " " + g_infoManager.GetLabel(SYSTEM_BUILD_VERSION).c_str() + " (Compiled: " + g_infoManager.GetLabel(SYSTEM_BUILD_DATE).c_str() +")"); CONTROL_ENABLE_ON_CONDITION(CONTROL_BT_PVR, PVR::CPVRManager::Get().IsStarted()); return true; } break; case GUI_MSG_WINDOW_DEINIT: { CGUIWindow::OnMessage(message); m_diskUsage.clear(); return true; } break; case GUI_MSG_FOCUSED: { CGUIWindow::OnMessage(message); int focusedControl = GetFocusedControlID(); if (m_section != focusedControl && focusedControl >= CONTROL_START && focusedControl <= CONTROL_END) { ResetLabels(); m_section = focusedControl; } return true; } break; } return CGUIWindow::OnMessage(message); }
bool CGUIWindowMusicPlaylistEditor::OnBack(int actionID) { if (actionID == ACTION_NAV_BACK && !m_viewControl.HasControl(GetFocusedControlID())) return CGUIWindow::OnBack(actionID); // base class goes up a folder, but none to go up return CGUIWindowMusicBase::OnBack(actionID); }
bool CGUIDialogSettingsBase::OnMessage(CGUIMessage &message) { switch (message.GetMessage()) { case GUI_MSG_WINDOW_INIT: { m_delayedSetting.reset(); if (message.GetParam1() != WINDOW_INVALID) { // coming to this window first time (ie not returning back from some other window) // so we reset our section and control states m_iCategory = 0; ResetControlStates(); } if (AllowResettingSettings()) { m_resetSetting = new CSettingAction(SETTINGS_RESET_SETTING_ID); m_resetSetting->SetLabel(10041); m_resetSetting->SetHelp(10045); m_resetSetting->SetControl(CreateControl("button")); } m_dummyCategory = new CSettingCategory(SETTINGS_EMPTY_CATEGORY_ID); m_dummyCategory->SetLabel(10046); m_dummyCategory->SetHelp(10047); break; } case GUI_MSG_WINDOW_DEINIT: { // cancel any delayed changes if (m_delayedSetting != NULL) { m_delayedTimer.Stop(); CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), m_delayedSetting->GetID()); OnMessage(message); } CGUIDialog::OnMessage(message); FreeControls(); return true; } case GUI_MSG_FOCUSED: { CGUIDialog::OnMessage(message); int focusedControl = GetFocusedControlID(); // cancel any delayed changes if (m_delayedSetting != NULL && m_delayedSetting->GetID() != focusedControl) { m_delayedTimer.Stop(); CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), m_delayedSetting->GetID(), 1); // param1 = 1 for "reset the control if it's invalid" g_windowManager.SendThreadMessage(message, GetID()); } // update the value of the previous setting (in case it was invalid) else if (m_iSetting >= CONTROL_SETTINGS_START_CONTROL && m_iSetting < (int)(CONTROL_SETTINGS_START_CONTROL + m_settingControls.size())) { BaseSettingControlPtr control = GetSettingControl(m_iSetting); if (control != NULL && control->GetSetting() != NULL && !control->IsValid()) { CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), m_iSetting, 1); // param1 = 1 for "reset the control if it's invalid" g_windowManager.SendThreadMessage(message, GetID()); } } CVariant description; // check if we have changed the category and need to create new setting controls if (focusedControl >= CONTROL_SETTINGS_START_BUTTONS && focusedControl < (int)(CONTROL_SETTINGS_START_BUTTONS + m_categories.size())) { int categoryIndex = focusedControl - CONTROL_SETTINGS_START_BUTTONS; const CSettingCategory* category = m_categories.at(categoryIndex); if (categoryIndex != m_iCategory) { if (!category->CanAccess()) { // unable to go to this category - focus the previous one SET_CONTROL_FOCUS(CONTROL_SETTINGS_START_BUTTONS + m_iCategory, 0); return false; } m_iCategory = categoryIndex; CreateSettings(); } description = category->GetHelp(); } else if (focusedControl >= CONTROL_SETTINGS_START_CONTROL && focusedControl < (int)(CONTROL_SETTINGS_START_CONTROL + m_settingControls.size())) { m_iSetting = focusedControl; CSetting *setting = GetSettingControl(focusedControl)->GetSetting(); if (setting != NULL) description = setting->GetHelp(); } // set the description of the currently focused category/setting if (description.isInteger() || (description.isString() && !description.empty())) SetDescription(description); return true; } case GUI_MSG_CLICKED: { int iControl = message.GetSenderId(); if (iControl == CONTROL_SETTINGS_OKAY_BUTTON) { OnOkay(); Close(); return true; } if (iControl == CONTROL_SETTINGS_CANCEL_BUTTON) { OnCancel(); Close(); return true; } BaseSettingControlPtr control = GetSettingControl(iControl); if (control != NULL) OnClick(control); break; } case GUI_MSG_UPDATE_ITEM: { if (m_delayedSetting != NULL && m_delayedSetting->GetID() == message.GetControlId()) { // first get the delayed setting and reset its member variable // to avoid handling the delayed setting twice in case the OnClick() // performed later causes the window to be deinitialized (e.g. when // changing the language) BaseSettingControlPtr delayedSetting = m_delayedSetting; m_delayedSetting.reset(); // if updating the setting fails and param1 has been specifically set // we need to call OnSettingChanged() to restore a valid value in the // setting control if (!delayedSetting->OnClick() && message.GetParam1() != 0) OnSettingChanged(delayedSetting->GetSetting()); return true; } if (message.GetControlId() >= CONTROL_SETTINGS_START_CONTROL && message.GetControlId() < (int)(CONTROL_SETTINGS_START_CONTROL + m_settingControls.size())) { BaseSettingControlPtr settingControl = GetSettingControl(message.GetControlId()); if (settingControl.get() != NULL && settingControl->GetSetting() != NULL) { settingControl->Update(); return true; } } break; } case GUI_MSG_UPDATE: { if (IsActive() && HasID(message.GetSenderId())) { int focusedControl = GetFocusedControlID(); CreateSettings(); SET_CONTROL_FOCUS(focusedControl, 0); } break; } default: break; } return CGUIDialog::OnMessage(message); }