bool CGUIDialogSubtitles::SetService(const std::string &service) { if (service != m_currentService) { m_currentService = service; CLog::Log(LOGDEBUG, "New Service [%s] ", m_currentService.c_str()); CFileItemPtr currentService = GetService(); // highlight this item in the skin for (int i = 0; i < m_serviceItems->Size(); i++) { CFileItemPtr pItem = m_serviceItems->Get(i); pItem->Select(pItem == currentService); } SET_CONTROL_LABEL(CONTROL_NAMELABEL, currentService->GetLabel()); CGUIImage* image = (CGUIImage*)GetControl(CONTROL_NAMELOGO); if (image) { std::string icon = URIUtils::AddFileToFolder(currentService->GetProperty("Addon.Path").asString(), "logo.png"); image->SetFileName(icon); } if (g_application.m_pPlayer->GetSubtitleCount() == 0) SET_CONTROL_HIDDEN(CONTROL_SUBSEXIST); else SET_CONTROL_VISIBLE(CONTROL_SUBSEXIST); return true; } return false; }
void CGUIDialogKaiToast::OnWindowLoaded() { CGUIDialog::OnWindowLoaded(); CGUIImage *image = (CGUIImage *)GetControl(POPUP_ICON); if (image) m_defaultIcon = image->GetFileName(); }
void CGUIDialogBoxeeManualResolveMovie::OnDeinitWindow(int nextWindowID) { CGUIDialog::OnDeinitWindow(nextWindowID); CGUIImage* pImage = (CGUIImage*)GetControl(MOVIE_COVER); pImage->FreeResources(); }
void CGUIDialogProfileSettings::SetupPage() { CGUIDialogSettings::SetupPage(); SET_CONTROL_LABEL(1000,m_strName); SET_CONTROL_LABEL(1001,m_strDirectory); CGUIImage *pImage = (CGUIImage*)GetControl(2); if (pImage) pImage->SetFileName(!m_strThumb.IsEmpty() ? m_strThumb : m_strDefaultImage); }
bool CGUIDialogKaiToast::DoWork() { CSingleLock lock(m_critical); if (m_notifications.size() > 0 && CTimeUtils::GetFrameTime() - m_timer > m_toastMessageTime) { Notification toast = m_notifications.front(); m_notifications.pop(); lock.Leave(); m_toastDisplayTime = toast.displayTime; m_toastMessageTime = toast.messageTime; CSingleLock lock2(g_graphicsContext); if(!Initialize()) return false; SET_CONTROL_LABEL(POPUP_CAPTION_TEXT, toast.caption); SET_CONTROL_LABEL(POPUP_NOTIFICATION_BUTTON, toast.description); CGUIImage *image = (CGUIImage *)GetControl(POPUP_ICON); if (image) { CStdString strTypeImage = toast.imagefile; if (strTypeImage.IsEmpty()) { CGUIImage *typeImage = NULL; if (toast.eType == Info) typeImage = (CGUIImage *)GetControl(POPUP_ICON_INFO); else if (toast.eType == Warning) typeImage = (CGUIImage *)GetControl(POPUP_ICON_WARNING); else if (toast.eType == Error) typeImage = (CGUIImage *)GetControl(POPUP_ICON_ERROR); else typeImage = image; strTypeImage = typeImage->GetFileName(); } image->SetFileName(strTypeImage); } // Play the window specific init sound for each notification queued SetSound(toast.withSound); ResetTimer(); return true; } return false; }
void Interface_GUIControlImage::set_filename(void* kodiBase, void* handle, const char* filename, bool use_cache) { CAddonDll* addon = static_cast<CAddonDll*>(kodiBase); CGUIImage* control = static_cast<CGUIImage*>(handle); if (!addon || !control || !filename) { CLog::Log(LOGERROR, "Interface_GUIControlImage::%s - invalid handler data (kodiBase='%p', handle='%p', filename='%p') on addon '%s'", __FUNCTION__, addon, control, filename, addon ? addon->ID().c_str() : "unknown"); return; } control->SetFileName(filename, false, use_cache); }
void Interface_GUIControlImage::set_color_diffuse(void* kodiBase, void* handle, uint32_t colorDiffuse) { CAddonDll* addon = static_cast<CAddonDll*>(kodiBase); CGUIImage* control = static_cast<CGUIImage*>(handle); if (!addon || !control) { CLog::Log(LOGERROR, "Interface_GUIControlImage::%s - invalid handler data (kodiBase='%p', handle='%p') on addon '%s'", __FUNCTION__, addon, control, addon ? addon->ID().c_str() : "unknown"); return; } control->SetColorDiffuse(CGUIInfoColor(colorDiffuse)); }
void Interface_GUIControlImage::set_visible(void* kodiBase, void* handle, bool visible) { CAddonDll* addon = static_cast<CAddonDll*>(kodiBase); CGUIImage* control = static_cast<CGUIImage*>(handle); if (!addon || !control) { CLog::Log(LOGERROR, "Interface_GUIControlImage::%s - invalid handler data (kodiBase='%p', handle='%p') " "on addon '%s'", __FUNCTION__, kodiBase, handle, addon ? addon->ID().c_str() : "unknown"); return; } control->SetVisible(visible); }
void CGUIDialogKaiToast::AddToQueue(eMessageType eType, const CStdString& aCaption, const CStdString& aDescription, unsigned int displayTime /*= TOAST_DISPLAY_TIME*/, bool withSound /*= true*/, unsigned int messageTime /*= TOAST_MESSAGE_TIME*/) { CGUIImage *image = NULL; if (eType == Info) image = (CGUIImage *)GetControl(POPUP_ICON_INFO); else if (eType == Warning) image = (CGUIImage *)GetControl(POPUP_ICON_WARNING); else if (eType == Error) image = (CGUIImage *)GetControl(POPUP_ICON_ERROR); CStdString strImage; if (image) strImage = image->GetFileName(); AddToQueue(strImage, aCaption, aDescription, displayTime, withSound, messageTime); }
//#ifdef PRE_SKIN_VERSION_9_10_COMPATIBILITY void CGUIListItemLayout::CreateListControlLayouts(float width, float height, bool focused, const CLabelInfo &labelInfo, const CLabelInfo &labelInfo2, const CTextureInfo &texture, const CTextureInfo &textureFocus, float texHeight, float iconWidth, float iconHeight, int nofocusCondition, int focusCondition) { m_width = width; m_height = height; m_focused = focused; CGUIImage *tex = new CGUIImage(0, 0, 0, 0, width, texHeight, texture); tex->SetVisibleCondition(nofocusCondition, false); m_group.AddControl(tex); if (focused) { CGUIImage *tex = new CGUIImage(0, 0, 0, 0, width, texHeight, textureFocus); tex->SetVisibleCondition(focusCondition, false); m_group.AddControl(tex); } CGUIImage *image = new CGUIImage(0, 0, 8, 0, iconWidth, texHeight, CTextureInfo("")); image->SetInfo(CGUIInfoLabel("$INFO[ListItem.Icon]")); image->SetAspectRatio(CAspectRatio::AR_KEEP); m_group.AddControl(image); float x = iconWidth + labelInfo.offsetX + 10; CGUIListLabel *label = new CGUIListLabel(0, 0, x, labelInfo.offsetY, width - x - 18, height, labelInfo, CGUIInfoLabel("$INFO[ListItem.Label]"), false); m_group.AddControl(label); x = labelInfo2.offsetX ? labelInfo2.offsetX : m_width - 16; label = new CGUIListLabel(0, 0, x, labelInfo2.offsetY, x - iconWidth - 20, height, labelInfo2, CGUIInfoLabel("$INFO[ListItem.Label2]"), false); m_group.AddControl(label); }
//#ifdef GUILIB_PYTHON_COMPATIBILITY void CGUIListItemLayout::CreateListControlLayouts(float width, float height, bool focused, const CLabelInfo &labelInfo, const CLabelInfo &labelInfo2, const CTextureInfo &texture, const CTextureInfo &textureFocus, float texHeight, float iconWidth, float iconHeight, const std::string &nofocusCondition, const std::string &focusCondition) { m_width = width; m_height = height; m_focused = focused; m_isPlaying.Parse("listitem.isplaying", 0); CGUIImage *tex = new CGUIImage(0, 0, 0, 0, width, texHeight, texture); tex->SetVisibleCondition(nofocusCondition); m_group.AddControl(tex); if (focused) { CGUIImage *tex = new CGUIImage(0, 0, 0, 0, width, texHeight, textureFocus); tex->SetVisibleCondition(focusCondition); m_group.AddControl(tex); } CGUIImage *image = new CGUIImage(0, 0, 8, 0, iconWidth, texHeight, CTextureInfo("")); image->SetInfo(CGUIInfoLabel("$INFO[ListItem.Icon]", "", m_group.GetParentID())); image->SetAspectRatio(CAspectRatio::AR_KEEP); m_group.AddControl(image); float x = iconWidth + labelInfo.offsetX + 10; CGUIListLabel *label = new CGUIListLabel(0, 0, x, labelInfo.offsetY, width - x - 18, height, labelInfo, CGUIInfoLabel("$INFO[ListItem.Label]", "", m_group.GetParentID()), CGUIControl::FOCUS); m_group.AddControl(label); x = labelInfo2.offsetX ? labelInfo2.offsetX : m_width - 16; label = new CGUIListLabel(0, 0, x, labelInfo2.offsetY, x - iconWidth - 20, height, labelInfo2, CGUIInfoLabel("$INFO[ListItem.Label2]", "", m_group.GetParentID()), CGUIControl::FOCUS); m_group.AddControl(label); }
bool CGUIDialogKaiToast::DoWork() { CSingleLock lock(m_critical); if (m_notifications.size() > 0 && CTimeUtils::GetFrameTime() - m_timer > m_toastMessageTime) { Notification toast = m_notifications.front(); m_notifications.pop(); lock.Leave(); m_toastDisplayTime = toast.displayTime; m_toastMessageTime = toast.messageTime; CSingleLock lock2(g_graphicsContext); if(!Initialize()) return false; SET_CONTROL_LABEL(POPUP_CAPTION_TEXT, toast.caption); SET_CONTROL_LABEL(POPUP_NOTIFICATION_BUTTON, toast.description); CGUIImage *image = (CGUIImage *)GetControl(POPUP_ICON); if (image) { if (!toast.imagefile.IsEmpty()) image->SetFileName(toast.imagefile); else image->SetFileName(m_defaultIcon); } // Play the window specific init sound for each notification queued SetSound(toast.withSound); ResetTimer(); return true; } return false; }
void CGUIWindowWeather::UpdateButtons() { CONTROL_ENABLE(CONTROL_BTNREFRESH); SET_CONTROL_LABEL(CONTROL_BTNREFRESH, 184); //Refresh SET_CONTROL_LABEL(WEATHER_LABEL_LOCATION, g_weatherManager.GetLocation(m_iCurWeather)); SET_CONTROL_LABEL(CONTROL_LABELUPDATED, g_weatherManager.GetLastUpdateTime()); SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_COND, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_COND)); SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_TEMP, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_TEMP) + g_langInfo.GetTempUnitString()); SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_FEEL, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_FEEL) + g_langInfo.GetTempUnitString()); SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_UVID, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_UVID)); SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_WIND, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_WIND)); SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_DEWP, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_DEWP) + g_langInfo.GetTempUnitString()); SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_HUMI, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_HUMI)); CGUIImage *pImage = (CGUIImage *)GetControl(WEATHER_IMAGE_CURRENT_ICON); if (pImage) pImage->SetFileName(g_weatherManager.GetInfo(WEATHER_IMAGE_CURRENT_ICON)); //static labels SET_CONTROL_LABEL(CONTROL_STATICTEMP, 401); //Temperature SET_CONTROL_LABEL(CONTROL_STATICFEEL, 402); //Feels Like SET_CONTROL_LABEL(CONTROL_STATICUVID, 403); //UV Index SET_CONTROL_LABEL(CONTROL_STATICWIND, 404); //Wind SET_CONTROL_LABEL(CONTROL_STATICDEWP, 405); //Dew Point SET_CONTROL_LABEL(CONTROL_STATICHUMI, 406); //Humidity for (int i = 0; i < NUM_DAYS; i++) { SET_CONTROL_LABEL(CONTROL_LABELD0DAY + (i*10), g_weatherManager.GetForecast(i).m_day); SET_CONTROL_LABEL(CONTROL_LABELD0HI + (i*10), g_weatherManager.GetForecast(i).m_high + g_langInfo.GetTempUnitString()); SET_CONTROL_LABEL(CONTROL_LABELD0LOW + (i*10), g_weatherManager.GetForecast(i).m_low + g_langInfo.GetTempUnitString()); SET_CONTROL_LABEL(CONTROL_LABELD0GEN + (i*10), g_weatherManager.GetForecast(i).m_overview); pImage = (CGUIImage *)GetControl(CONTROL_IMAGED0IMG + (i * 10)); if (pImage) pImage->SetFileName(g_weatherManager.GetForecast(i).m_icon); } }
void CSplash::Show() { g_graphicsContext.Lock(); g_graphicsContext.Clear(); g_graphicsContext.Flip(); #ifndef _WIN32 g_graphicsContext.Clear(); g_graphicsContext.Flip(); g_graphicsContext.Clear(); g_graphicsContext.Flip(); #endif float w = g_graphicsContext.GetWidth(); float h = g_graphicsContext.GetHeight(); if(g_graphicsContext.GetRenderLowresGraphics()) { RESOLUTION res = g_graphicsContext.GetGraphicsResolution(); w = g_settings.m_ResInfo[res].iWidth; h = g_settings.m_ResInfo[res].iHeight; } CGUIImage* image = new CGUIImage(0, 0, 0, 0, w, h, m_ImageName); image->SetAspectRatio(CAspectRatio::AR_KEEP); image->AllocResources(); //render splash image g_Windowing.BeginRender(); image->Render(); image->FreeResources(); delete image; //show it on screen g_Windowing.EndRender(); g_graphicsContext.Flip(); g_graphicsContext.Unlock(); }
void CGUIWindowVideoInfo::Update() { CStdString strTmp; strTmp = m_movieItem->GetVideoInfoTag()->m_strTitle; strTmp.Trim(); SetLabel(CONTROL_TITLE, strTmp); strTmp = m_movieItem->GetVideoInfoTag()->m_strDirector; strTmp.Trim(); SetLabel(CONTROL_DIRECTOR, strTmp); strTmp = m_movieItem->GetVideoInfoTag()->m_strStudio; strTmp.Trim(); SetLabel(CONTROL_STUDIO, strTmp); strTmp = m_movieItem->GetVideoInfoTag()->m_strWritingCredits; strTmp.Trim(); SetLabel(CONTROL_CREDITS, strTmp); strTmp = m_movieItem->GetVideoInfoTag()->m_strGenre; strTmp.Trim(); SetLabel(CONTROL_GENRE, strTmp); strTmp = m_movieItem->GetVideoInfoTag()->m_strTagLine; strTmp.Trim(); SetLabel(CONTROL_TAGLINE, strTmp); strTmp = m_movieItem->GetVideoInfoTag()->m_strPlotOutline; strTmp.Trim(); SetLabel(CONTROL_PLOTOUTLINE, strTmp); strTmp = m_movieItem->GetVideoInfoTag()->m_strTrailer; strTmp.Trim(); SetLabel(CONTROL_TRAILER, strTmp); strTmp = m_movieItem->GetVideoInfoTag()->m_strMPAARating; strTmp.Trim(); SetLabel(CONTROL_MPAARATING, strTmp); CStdString strTop250; if (m_movieItem->GetVideoInfoTag()->m_iTop250) strTop250.Format("%i", m_movieItem->GetVideoInfoTag()->m_iTop250); SetLabel(CONTROL_TOP250, strTop250); CStdString strYear; if (m_movieItem->GetVideoInfoTag()->m_iYear) strYear.Format("%i", m_movieItem->GetVideoInfoTag()->m_iYear); else strYear = g_infoManager.GetItemLabel(m_movieItem.get(),LISTITEM_PREMIERED); SetLabel(CONTROL_YEAR, strYear); CStdString strRating_And_Votes; if (m_movieItem->GetVideoInfoTag()->m_fRating != 0.0f) // only non-zero ratings are of interest strRating_And_Votes.Format("%03.1f (%s %s)", m_movieItem->GetVideoInfoTag()->m_fRating, m_movieItem->GetVideoInfoTag()->m_strVotes, g_localizeStrings.Get(20350)); SetLabel(CONTROL_RATING_AND_VOTES, strRating_And_Votes); strTmp = m_movieItem->GetVideoInfoTag()->m_strRuntime; strTmp.Trim(); SetLabel(CONTROL_RUNTIME, strTmp); // setup plot text area strTmp = m_movieItem->GetVideoInfoTag()->m_strPlot; if (!(!m_movieItem->GetVideoInfoTag()->m_strShowTitle.IsEmpty() && m_movieItem->GetVideoInfoTag()->m_iSeason == 0)) // dont apply to tvshows if (m_movieItem->GetVideoInfoTag()->m_playCount == 0 && g_guiSettings.GetBool("videolibrary.hideplots")) strTmp = g_localizeStrings.Get(20370); strTmp.Trim(); SetLabel(CONTROL_TEXTAREA, strTmp); CGUIMessage msg(GUI_MSG_LABEL_BIND, GetID(), CONTROL_LIST, 0, 0, m_castList); OnMessage(msg); if (m_bViewReview) { if (!m_movieItem->GetVideoInfoTag()->m_strArtist.IsEmpty()) { SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 133); } else { SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 206); } SET_CONTROL_HIDDEN(CONTROL_LIST); SET_CONTROL_VISIBLE(CONTROL_TEXTAREA); } else { SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 207); SET_CONTROL_HIDDEN(CONTROL_TEXTAREA); SET_CONTROL_VISIBLE(CONTROL_LIST); } // Check for resumability CGUIWindowVideoFiles *window = (CGUIWindowVideoFiles *)m_gWindowManager.GetWindow(WINDOW_VIDEO_FILES); if (window && window->GetResumeItemOffset(m_movieItem.get()) > 0) CONTROL_ENABLE(CONTROL_BTN_RESUME); else CONTROL_DISABLE(CONTROL_BTN_RESUME); CONTROL_ENABLE(CONTROL_BTN_PLAY); // update the thumbnail const CGUIControl* pControl = GetControl(CONTROL_IMAGE); if (pControl) { CGUIImage* pImageControl = (CGUIImage*)pControl; pImageControl->FreeResources(); pImageControl->SetFileName(m_movieItem->GetThumbnailImage()); } // tell our GUI to completely reload all controls (as some of them // are likely to have had this image in use so will need refreshing) if (m_hasUpdatedThumb) { CGUIMessage reload(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_REFRESH_THUMBS); g_graphicsContext.SendMessage(reload); } }
void CGUIWindowMusicInfo::Update() { if (m_bArtistInfo) { SetLabel(CONTROL_ARTIST, m_artist.strArtist ); SetLabel(CONTROL_GENRE, m_artist.strGenre); SetLabel(CONTROL_MOODS, m_artist.strMoods); SetLabel(CONTROL_STYLES, m_artist.strStyles ); if (m_bViewReview) { SET_CONTROL_VISIBLE(CONTROL_TEXTAREA); SET_CONTROL_HIDDEN(CONTROL_LIST); SetLabel(CONTROL_TEXTAREA, m_artist.strBiography); SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 21888); } else { SET_CONTROL_VISIBLE(CONTROL_LIST); if (GetControl(CONTROL_LIST)) { SET_CONTROL_HIDDEN(CONTROL_TEXTAREA); CGUIMessage message(GUI_MSG_LABEL_BIND, GetID(), CONTROL_LIST, 0, 0, m_albumSongs); OnMessage(message); } else CLog::Log(LOGERROR, "Out of date skin - needs list with id %i", CONTROL_LIST); SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 21887); } } else { SetLabel(CONTROL_ALBUM, m_album.strAlbum ); SetLabel(CONTROL_ARTIST, m_album.strArtist ); CStdString date; date.Format("%d", m_album.iYear); SetLabel(CONTROL_DATE, date ); CStdString strRating; if (m_album.iRating > 0) strRating.Format("%i/9", m_album.iRating); SetLabel(CONTROL_RATING, strRating ); SetLabel(CONTROL_GENRE, m_album.strGenre); SetLabel(CONTROL_MOODS, m_album.strMoods); SetLabel(CONTROL_STYLES, m_album.strStyles ); if (m_bViewReview) { SET_CONTROL_VISIBLE(CONTROL_TEXTAREA); SET_CONTROL_HIDDEN(CONTROL_LIST); SetLabel(CONTROL_TEXTAREA, m_album.strReview); SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 182); } else { SET_CONTROL_VISIBLE(CONTROL_LIST); if (GetControl(CONTROL_LIST)) { SET_CONTROL_HIDDEN(CONTROL_TEXTAREA); CGUIMessage message(GUI_MSG_LABEL_BIND, GetID(), CONTROL_LIST, 0, 0, m_albumSongs); OnMessage(message); } else CLog::Log(LOGERROR, "Out of date skin - needs list with id %i", CONTROL_LIST); SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 183); } } // update the thumbnail const CGUIControl* pControl = GetControl(CONTROL_IMAGE); if (pControl) { CGUIImage* pImageControl = (CGUIImage*)pControl; pImageControl->FreeResources(); pImageControl->SetFileName(m_albumItem->GetThumbnailImage()); } // disable the GetThumb button if the user isn't allowed it CONTROL_ENABLE_ON_CONDITION(CONTROL_BTN_GET_THUMB, g_settings.m_vecProfiles[g_settings.m_iLastLoadedProfileIndex].canWriteDatabases() || g_passwordManager.bMasterUser); if (!m_album.strArtist.IsEmpty() && CLastFmManager::GetInstance()->IsLastFmEnabled()) { SET_CONTROL_VISIBLE(CONTROL_BTN_LASTFM); } else { SET_CONTROL_HIDDEN(CONTROL_BTN_LASTFM); } }
void CGUIDialogMusicInfo::Update() { if (m_bArtistInfo) { CONTROL_ENABLE(CONTROL_BTN_GET_FANART); SetLabel(CONTROL_TEXTAREA, m_artist.strBiography); CGUIMessage message(GUI_MSG_LABEL_BIND, GetID(), CONTROL_LIST, 0, 0, m_albumSongs); OnMessage(message); if (GetControl(CONTROL_BTN_TRACKS)) // if no CONTROL_BTN_TRACKS found - allow skinner full visibility control over CONTROL_TEXTAREA and CONTROL_LIST { if (m_bViewReview) { SET_CONTROL_VISIBLE(CONTROL_TEXTAREA); SET_CONTROL_HIDDEN(CONTROL_LIST); SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 21888); } else { SET_CONTROL_VISIBLE(CONTROL_LIST); SET_CONTROL_HIDDEN(CONTROL_TEXTAREA); SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 21887); } } } else { CONTROL_DISABLE(CONTROL_BTN_GET_FANART); SetLabel(CONTROL_TEXTAREA, m_album.strReview); CGUIMessage message(GUI_MSG_LABEL_BIND, GetID(), CONTROL_LIST, 0, 0, m_albumSongs); OnMessage(message); if (GetControl(CONTROL_BTN_TRACKS)) // if no CONTROL_BTN_TRACKS found - allow skinner full visibility control over CONTROL_TEXTAREA and CONTROL_LIST { if (m_bViewReview) { SET_CONTROL_VISIBLE(CONTROL_TEXTAREA); SET_CONTROL_HIDDEN(CONTROL_LIST); SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 182); } else { SET_CONTROL_VISIBLE(CONTROL_LIST); SET_CONTROL_HIDDEN(CONTROL_TEXTAREA); SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 183); } } } // update the thumbnail const CGUIControl* pControl = GetControl(CONTROL_IMAGE); if (pControl) { CGUIImage* pImageControl = (CGUIImage*)pControl; pImageControl->FreeResources(); pImageControl->SetFileName(m_albumItem->GetThumbnailImage()); } // disable the GetThumb button if the user isn't allowed it CONTROL_ENABLE_ON_CONDITION(CONTROL_BTN_GET_THUMB, g_settings.GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser); if (!m_album.artist.empty() && CLastFmManager::GetInstance()->IsLastFmEnabled()) { SET_CONTROL_VISIBLE(CONTROL_BTN_LASTFM); } else { SET_CONTROL_HIDDEN(CONTROL_BTN_LASTFM); } }
void CGUIDialogPluginSettings::CreateControls() { CGUISpinControlEx *pOriginalSpin = (CGUISpinControlEx*)GetControl(CONTROL_DEFAULT_SPIN); CGUIRadioButtonControl *pOriginalRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_DEFAULT_RADIOBUTTON); CGUIButtonControl *pOriginalButton = (CGUIButtonControl *)GetControl(CONTROL_DEFAULT_BUTTON); CGUIImage *pOriginalImage = (CGUIImage *)GetControl(CONTROL_DEFAULT_SEPARATOR); CGUILabelControl *pOriginalLabel = (CGUILabelControl *)GetControl(CONTROL_DEFAULT_LABEL_SEPARATOR); if (!pOriginalSpin || !pOriginalRadioButton || !pOriginalButton || !pOriginalImage) return; pOriginalSpin->SetVisible(false); pOriginalRadioButton->SetVisible(false); pOriginalButton->SetVisible(false); pOriginalImage->SetVisible(false); if (pOriginalLabel) pOriginalLabel->SetVisible(false); // clear the category group CGUIControlGroupList *group = (CGUIControlGroupList *)GetControl(CONTROL_AREA); if (!group) return; // set our dialog heading SET_CONTROL_LABEL(CONTROL_HEADING_LABEL, m_strHeading); // Create our base path, used for type "fileenum" settings CStdString basepath = "Q:\\plugins\\"; CUtil::AddFileToFolder(basepath, m_url.GetHostName(), basepath); CUtil::AddFileToFolder(basepath, m_url.GetFileName(), basepath); CGUIControl* pControl = NULL; int controlId = CONTROL_START_CONTROL; TiXmlElement *setting = m_settings.GetPluginRoot()->FirstChildElement("setting"); while (setting) { const char *type = setting->Attribute("type"); const char *option = setting->Attribute("option"); const char *id = setting->Attribute("id"); CStdString values; if (setting->Attribute("values")) values = setting->Attribute("values"); CStdString lvalues; if (setting->Attribute("lvalues")) lvalues = setting->Attribute("lvalues"); CStdString entries; if (setting->Attribute("entries")) entries = setting->Attribute("entries"); CStdString label; if (setting->Attribute("label") && atoi(setting->Attribute("label")) > 0) label.Format("$LOCALIZE[%s]", setting->Attribute("label")); else label = setting->Attribute("label"); if (type) { if (strcmpi(type, "text") == 0 || strcmpi(type, "ipaddress") == 0 || strcmpi(type, "integer") == 0 || strcmpi(type, "video") == 0 || strcmpi(type, "music") == 0 || strcmpi(type, "pictures") == 0 || strcmpi(type, "folder") == 0 || strcmpi(type, "programs") == 0 || strcmpi(type, "files") == 0 || strcmpi(type, "action") == 0) { pControl = new CGUIButtonControl(*pOriginalButton); if (!pControl) return; ((CGUIButtonControl *)pControl)->SettingsCategorySetTextAlign(XBFONT_CENTER_Y); ((CGUIButtonControl *)pControl)->SetLabel(label); if (id) ((CGUIButtonControl *)pControl)->SetLabel2(m_settings.Get(id)); if (option && strcmpi(option, "hidden") == 0) ((CGUIButtonControl *)pControl)->SetHidden(true); } else if (strcmpi(type, "bool") == 0) { pControl = new CGUIRadioButtonControl(*pOriginalRadioButton); if (!pControl) return; ((CGUIRadioButtonControl *)pControl)->SetLabel(label); ((CGUIRadioButtonControl *)pControl)->SetSelected(m_settings.Get(id) == "true"); } else if (strcmpi(type, "enum") == 0 || strcmpi(type, "labelenum") == 0) { vector<CStdString> valuesVec; vector<CStdString> entryVec; pControl = new CGUISpinControlEx(*pOriginalSpin); if (!pControl) return; ((CGUISpinControlEx *)pControl)->SetText(label); if (!lvalues.IsEmpty()) CUtil::Tokenize(lvalues, valuesVec, "|"); else CUtil::Tokenize(values, valuesVec, "|"); if (!entries.IsEmpty()) CUtil::Tokenize(entries, entryVec, "|"); for (unsigned int i = 0; i < valuesVec.size(); i++) { int iAdd = i; if (entryVec.size() > i) iAdd = atoi(entryVec[i]); if (!lvalues.IsEmpty()) { CStdString replace = g_localizeStringsTemp.Get(atoi(valuesVec[i])); if (replace.IsEmpty()) replace = g_localizeStrings.Get(atoi(valuesVec[i])); ((CGUISpinControlEx *)pControl)->AddLabel(replace, iAdd); } else ((CGUISpinControlEx *)pControl)->AddLabel(valuesVec[i], iAdd); } if (strcmpi(type, "labelenum") == 0) { // need to run through all our settings and find the one that matches ((CGUISpinControlEx*) pControl)->SetValueFromLabel(m_settings.Get(id)); } else ((CGUISpinControlEx*) pControl)->SetValue(atoi(m_settings.Get(id))); } else if (strcmpi(type, "fileenum") == 0) { pControl = new CGUISpinControlEx(*pOriginalSpin); if (!pControl) return; ((CGUISpinControlEx *)pControl)->SetText(label); //find Folders... CFileItemList items; CStdString enumpath; CUtil::AddFileToFolder(basepath, values, enumpath); CStdString mask; if (setting->Attribute("mask")) mask = setting->Attribute("mask"); if (!mask.IsEmpty()) CDirectory::GetDirectory(enumpath, items, mask); else CDirectory::GetDirectory(enumpath, items); int iItem = 0; for (int i = 0; i < items.Size(); ++i) { CFileItemPtr pItem = items[i]; if ((mask.Equals("/") && pItem->m_bIsFolder) || !pItem->m_bIsFolder) { ((CGUISpinControlEx *)pControl)->AddLabel(pItem->GetLabel(), iItem); if (pItem->GetLabel().Equals(m_settings.Get(id))) ((CGUISpinControlEx *)pControl)->SetValue(iItem); iItem++; } } } else if (strcmpi(type, "lsep") == 0 && pOriginalLabel) { pControl = new CGUILabelControl(*pOriginalLabel); if (pControl) ((CGUILabelControl *)pControl)->SetLabel(label); } else if ((strcmpi(type, "sep") == 0 || strcmpi(type, "lsep") == 0) && pOriginalImage) pControl = new CGUIImage(*pOriginalImage); } if (pControl) { pControl->SetWidth(group->GetWidth()); pControl->SetVisible(true); pControl->SetID(controlId); pControl->AllocResources(); group->AddControl(pControl); pControl = NULL; } setting = setting->NextSiblingElement("setting"); controlId++; } EnableControls(); }
void CGUIDialogVideoInfo::Update() { // setup plot text area CStdString strTmp = m_movieItem->GetVideoInfoTag()->m_strPlot; if (!(!m_movieItem->GetVideoInfoTag()->m_strShowTitle.IsEmpty() && m_movieItem->GetVideoInfoTag()->m_iSeason == 0)) // dont apply to tvshows if (m_movieItem->GetVideoInfoTag()->m_playCount == 0 && !g_guiSettings.GetBool("videolibrary.showunwatchedplots")) strTmp = g_localizeStrings.Get(20370); strTmp.Trim(); SetLabel(CONTROL_TEXTAREA, strTmp); CGUIMessage msg(GUI_MSG_LABEL_BIND, GetID(), CONTROL_LIST, 0, 0, m_castList); OnMessage(msg); if (GetControl(CONTROL_BTN_TRACKS)) // if no CONTROL_BTN_TRACKS found - allow skinner full visibility control over CONTROL_TEXTAREA and CONTROL_LIST { if (m_bViewReview) { if (!m_movieItem->GetVideoInfoTag()->m_strArtist.IsEmpty()) { SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 133); } else { SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 206); } SET_CONTROL_HIDDEN(CONTROL_LIST); SET_CONTROL_VISIBLE(CONTROL_TEXTAREA); } else { SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 207); SET_CONTROL_HIDDEN(CONTROL_TEXTAREA); SET_CONTROL_VISIBLE(CONTROL_LIST); } } // Check for resumability if (CGUIWindowVideoBase::GetResumeItemOffset(m_movieItem.get()) > 0) CONTROL_ENABLE(CONTROL_BTN_RESUME); else CONTROL_DISABLE(CONTROL_BTN_RESUME); CONTROL_ENABLE(CONTROL_BTN_PLAY); // update the thumbnail const CGUIControl* pControl = GetControl(CONTROL_IMAGE); if (pControl) { CGUIImage* pImageControl = (CGUIImage*)pControl; pImageControl->FreeResources(); pImageControl->SetFileName(m_movieItem->GetThumbnailImage()); } // tell our GUI to completely reload all controls (as some of them // are likely to have had this image in use so will need refreshing) if (m_hasUpdatedThumb) { CGUIMessage reload(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_REFRESH_THUMBS); g_windowManager.SendMessage(reload); } }
void CSplash::Process() { D3DGAMMARAMP newRamp; D3DGAMMARAMP oldRamp; g_graphicsContext.Lock(); g_graphicsContext.Get3DDevice()->Clear(0, NULL, D3DCLEAR_TARGET, 0, 0, 0); g_graphicsContext.SetCameraPosition(CPoint(0, 0)); float w = g_graphicsContext.GetWidth(); float h = g_graphicsContext.GetHeight(); CGUIImage* image = new CGUIImage(0, 0, 0, 0, w, h, m_ImageName); CGUIImage* image2 = new CGUIImage(0, 0, 0, 0, w, h, m_ImageName2); image->SetAspectRatio(CAspectRatio::AR_STRETCH); image2->SetAspectRatio(CAspectRatio::AR_STRETCH); image->AllocResources(); image2->AllocResources(); // Store the old gamma ramp g_graphicsContext.Get3DDevice()->GetGammaRamp(&oldRamp); float fade = 0.5f; for (int i = 0; i < 256; i++) { newRamp.red[i] = (int)((float)oldRamp.red[i] * fade); newRamp.green[i] = (int)((float)oldRamp.red[i] * fade); newRamp.blue[i] = (int)((float)oldRamp.red[i] * fade); } g_graphicsContext.Get3DDevice()->SetGammaRamp(GAMMA_RAMP_FLAG, &newRamp); //render splash image #ifndef HAS_XBOX_D3D g_graphicsContext.Get3DDevice()->BeginScene(); #endif image->Render(); image2->Render(); image->FreeResources(); image2->FreeResources(); delete image; delete image2; //show it on screen #ifdef HAS_XBOX_D3D g_graphicsContext.Get3DDevice()->BlockUntilVerticalBlank(); #else g_graphicsContext.Get3DDevice()->EndScene(); #endif g_graphicsContext.Get3DDevice()->Present( NULL, NULL, NULL, NULL ); g_graphicsContext.Unlock(); //fade in and wait untill the thread is stopped while (!m_bStop) { if (fade <= 1.f) { for (int i = 0; i < 256; i++) { newRamp.red[i] = (int)((float)oldRamp.red[i] * fade); newRamp.green[i] = (int)((float)oldRamp.green[i] * fade); newRamp.blue[i] = (int)((float)oldRamp.blue[i] * fade); } g_graphicsContext.Lock(); Sleep(3); g_graphicsContext.Get3DDevice()->SetGammaRamp(GAMMA_RAMP_FLAG, &newRamp); g_graphicsContext.Unlock(); fade += 0.01f; } else { Sleep(10); } } g_graphicsContext.Lock(); // fade out for (float fadeout = fade - 0.01f; fadeout >= 0.f; fadeout -= 0.01f) { for (int i = 0; i < 256; i++) { newRamp.red[i] = (int)((float)oldRamp.red[i] * fadeout); newRamp.green[i] = (int)((float)oldRamp.green[i] * fadeout); newRamp.blue[i] = (int)((float)oldRamp.blue[i] * fadeout); } Sleep(3); g_graphicsContext.Get3DDevice()->SetGammaRamp(GAMMA_RAMP_FLAG, &newRamp); } //restore original gamma ramp g_graphicsContext.Get3DDevice()->Clear(0, NULL, D3DCLEAR_TARGET, 0, 0, 0); g_graphicsContext.Get3DDevice()->SetGammaRamp(0, &oldRamp); g_graphicsContext.Get3DDevice()->Present( NULL, NULL, NULL, NULL ); g_graphicsContext.Unlock(); }
void CGUIDialogAddonSettings::CreateControls() { FreeControls(); CGUISpinControlEx *pOriginalSpin = dynamic_cast<CGUISpinControlEx*>(GetControl(CONTROL_DEFAULT_SPIN)); CGUIRadioButtonControl *pOriginalRadioButton = dynamic_cast<CGUIRadioButtonControl *>(GetControl(CONTROL_DEFAULT_RADIOBUTTON)); CGUIButtonControl *pOriginalButton = dynamic_cast<CGUIButtonControl *>(GetControl(CONTROL_DEFAULT_BUTTON)); CGUIImage *pOriginalImage = dynamic_cast<CGUIImage *>(GetControl(CONTROL_DEFAULT_SEPARATOR)); CGUILabelControl *pOriginalLabel = dynamic_cast<CGUILabelControl *>(GetControl(CONTROL_DEFAULT_LABEL_SEPARATOR)); CGUISettingsSliderControl *pOriginalSlider = dynamic_cast<CGUISettingsSliderControl *>(GetControl(CONTROL_DEFAULT_SLIDER)); if (!m_addon || !pOriginalSpin || !pOriginalRadioButton || !pOriginalButton || !pOriginalImage || !pOriginalLabel || !pOriginalSlider) return; pOriginalSpin->SetVisible(false); pOriginalRadioButton->SetVisible(false); pOriginalButton->SetVisible(false); pOriginalImage->SetVisible(false); pOriginalLabel->SetVisible(false); pOriginalSlider->SetVisible(false); CGUIControlGroupList *group = dynamic_cast<CGUIControlGroupList *>(GetControl(CONTROL_SETTINGS_AREA)); if (!group) return; // set our dialog heading SET_CONTROL_LABEL(CONTROL_HEADING_LABEL, m_strHeading); CGUIControl* pControl = NULL; int controlId = CONTROL_START_SETTING; const TiXmlElement *setting = GetFirstSetting(); while (setting) { const std::string type = XMLUtils::GetAttribute(setting, "type"); const std::string id = XMLUtils::GetAttribute(setting, "id"); const std::string values = XMLUtils::GetAttribute(setting, "values"); const std::string lvalues = XMLUtils::GetAttribute(setting, "lvalues"); const std::string entries = XMLUtils::GetAttribute(setting, "entries"); const std::string defaultVal = XMLUtils::GetAttribute(setting, "default"); const std::string subsetting = XMLUtils::GetAttribute(setting, "subsetting"); const std::string label = GetString(setting->Attribute("label"), subsetting == "true"); bool bSort = XMLUtils::GetAttribute(setting, "sort") == "yes"; if (!type.empty()) { bool isAddonSetting = false; if (type == "text" || type == "ipaddress" || type == "number" || type == "video" || type == "audio" || type == "image" || type == "folder" || type == "executable" || type == "file" || type == "action" || type == "date" || type == "time" || type == "select" || (isAddonSetting = type == "addon")) { pControl = new CGUIButtonControl(*pOriginalButton); if (!pControl) return; ((CGUIButtonControl *)pControl)->SetLabel(label); if (!id.empty()) { std::string value = m_settings[id]; m_buttonValues[id] = value; // get any option to test for hidden const std::string option = XMLUtils::GetAttribute(setting, "option"); if (option == "urlencoded") value = CURL::Decode(value); else if (option == "hidden") { std::string hiddenText; hiddenText.append(value.size(), L'*'); ((CGUIButtonControl *)pControl)->SetLabel2(hiddenText); } else { if (isAddonSetting) ((CGUIButtonControl *)pControl)->SetLabel2(GetAddonNames(value)); else if (type == "select" && !lvalues.empty()) { vector<string> valuesVec = StringUtils::Split(lvalues, '|'); int selected = atoi(value.c_str()); if (selected >= 0 && selected < (int)valuesVec.size()) { std::string label = m_addon->GetString(atoi(valuesVec[selected].c_str())); if (label.empty()) label = g_localizeStrings.Get(atoi(valuesVec[selected].c_str())); ((CGUIButtonControl *)pControl)->SetLabel2(label); } } else ((CGUIButtonControl *)pControl)->SetLabel2(value); } } else ((CGUIButtonControl *)pControl)->SetLabel2(defaultVal); } else if (type == "bool" && !id.empty()) { pControl = new CGUIRadioButtonControl(*pOriginalRadioButton); if (!pControl) return; ((CGUIRadioButtonControl *)pControl)->SetLabel(label); ((CGUIRadioButtonControl *)pControl)->SetSelected(m_settings[id] == "true"); } else if ((type == "enum" || type == "labelenum") && !id.empty()) { vector<std::string> valuesVec; vector<std::string> entryVec; pControl = new CGUISpinControlEx(*pOriginalSpin); if (!pControl) return; ((CGUISpinControlEx *)pControl)->SetText(label); if (!lvalues.empty()) StringUtils::Tokenize(lvalues, valuesVec, "|"); else if (values == "$HOURS") { for (unsigned int i = 0; i < 24; i++) { CDateTime time(2000, 1, 1, i, 0, 0); valuesVec.push_back(g_infoManager.LocalizeTime(time, TIME_FORMAT_HH_MM_XX)); } } else StringUtils::Tokenize(values, valuesVec, "|"); if (!entries.empty()) StringUtils::Tokenize(entries, entryVec, "|"); if(bSort && type == "labelenum") std::sort(valuesVec.begin(), valuesVec.end(), sortstringbyname()); for (unsigned int i = 0; i < valuesVec.size(); i++) { int iAdd = i; if (entryVec.size() > i) iAdd = atoi(entryVec[i].c_str()); if (!lvalues.empty()) { std::string replace = m_addon->GetString(atoi(valuesVec[i].c_str())); if (replace.empty()) replace = g_localizeStrings.Get(atoi(valuesVec[i].c_str())); ((CGUISpinControlEx *)pControl)->AddLabel(replace, iAdd); } else ((CGUISpinControlEx *)pControl)->AddLabel(valuesVec[i], iAdd); } if (type == "labelenum") { // need to run through all our settings and find the one that matches ((CGUISpinControlEx*) pControl)->SetValueFromLabel(m_settings[id]); } else ((CGUISpinControlEx*) pControl)->SetValue(atoi(m_settings[id].c_str())); } else if (type == "fileenum" && !id.empty()) { pControl = new CGUISpinControlEx(*pOriginalSpin); if (!pControl) return; ((CGUISpinControlEx *)pControl)->SetText(label); ((CGUISpinControlEx *)pControl)->SetFloatValue(1.0f); vector<std::string> items = GetFileEnumValues(values, XMLUtils::GetAttribute(setting, "mask"), XMLUtils::GetAttribute(setting, "option")); for (unsigned int i = 0; i < items.size(); ++i) { ((CGUISpinControlEx *)pControl)->AddLabel(items[i], i); if (StringUtils::EqualsNoCase(items[i], m_settings[id])) ((CGUISpinControlEx *)pControl)->SetValue(i); } } // Sample: <setting id="mysettingname" type="rangeofnum" label="30000" rangestart="0" rangeend="100" elements="11" valueformat="30001" default="0" /> // in strings.xml: <string id="30001">%2.0f mp</string> // creates 11 piece, text formated number labels from 0 to 100 else if (type == "rangeofnum" && !id.empty()) { pControl = new CGUISpinControlEx(*pOriginalSpin); if (!pControl) return; ((CGUISpinControlEx *)pControl)->SetText(label); ((CGUISpinControlEx *)pControl)->SetFloatValue(1.0f); double rangestart = 0, rangeend = 1; setting->Attribute("rangestart", &rangestart); setting->Attribute("rangeend", &rangeend); int elements = 2; setting->Attribute("elements", &elements); std::string valueformat; if (setting->Attribute("valueformat")) valueformat = m_addon->GetString(atoi(setting->Attribute("valueformat"))); for (int i = 0; i < elements; i++) { std::string valuestring; if (elements < 2) valuestring = StringUtils::Format(valueformat.c_str(), rangestart); else valuestring = StringUtils::Format(valueformat.c_str(), rangestart+(rangeend-rangestart)/(elements-1)*i); ((CGUISpinControlEx *)pControl)->AddLabel(valuestring, i); } ((CGUISpinControlEx *)pControl)->SetValue(atoi(m_settings[id].c_str())); } // Sample: <setting id="mysettingname" type="slider" label="30000" range="5,5,60" option="int" default="5"/> // to make ints from 5-60 with 5 steps else if (type == "slider" && !id.empty()) { pControl = new CGUISettingsSliderControl(*pOriginalSlider); if (!pControl) return; ((CGUISettingsSliderControl *)pControl)->SetText(label); float fMin = 0.0f; float fMax = 100.0f; float fInc = 1.0f; vector<std::string> range = StringUtils::Split(XMLUtils::GetAttribute(setting, "range"), ','); if (range.size() > 1) { fMin = (float)atof(range[0].c_str()); if (range.size() > 2) { fMax = (float)atof(range[2].c_str()); fInc = (float)atof(range[1].c_str()); } else fMax = (float)atof(range[1].c_str()); } std::string option = XMLUtils::GetAttribute(setting, "option"); int iType=0; if (option.empty() || StringUtils::EqualsNoCase(option, "float")) iType = SLIDER_CONTROL_TYPE_FLOAT; else if (StringUtils::EqualsNoCase(option, "int")) iType = SLIDER_CONTROL_TYPE_INT; else if (StringUtils::EqualsNoCase(option, "percent")) iType = SLIDER_CONTROL_TYPE_PERCENTAGE; ((CGUISettingsSliderControl *)pControl)->SetType(iType); ((CGUISettingsSliderControl *)pControl)->SetFloatRange(fMin, fMax); ((CGUISettingsSliderControl *)pControl)->SetFloatInterval(fInc); ((CGUISettingsSliderControl *)pControl)->SetFloatValue((float)atof(m_settings[id].c_str())); } else if (type == "lsep") { pControl = new CGUILabelControl(*pOriginalLabel); if (pControl) ((CGUILabelControl *)pControl)->SetLabel(label); } else if (type == "sep") pControl = new CGUIImage(*pOriginalImage); } if (pControl) { pControl->SetWidth(group->GetWidth()); pControl->SetVisible(true); pControl->SetID(controlId); pControl->AllocResources(); group->AddControl(pControl); pControl = NULL; } setting = setting->NextSiblingElement("setting"); controlId++; } EnableControls(); }
void CGUIWindowVideoInfo::Update() { CStdString strTmp; strTmp = m_movieItem->GetVideoInfoTag()->m_strTitle; strTmp.Trim(); SetLabel(CONTROL_TITLE, strTmp); strTmp = m_movieItem->GetVideoInfoTag()->m_strDirector; strTmp.Trim(); SetLabel(CONTROL_DIRECTOR, strTmp); strTmp = m_movieItem->GetVideoInfoTag()->m_strStudio; strTmp.Trim(); SetLabel(CONTROL_STUDIO, strTmp); strTmp = m_movieItem->GetVideoInfoTag()->m_strWritingCredits; strTmp.Trim(); SetLabel(CONTROL_CREDITS, strTmp); strTmp = m_movieItem->GetVideoInfoTag()->m_strGenre; strTmp.Trim(); SetLabel(CONTROL_GENRE, strTmp); strTmp = m_movieItem->GetVideoInfoTag()->m_strTagLine; strTmp.Trim(); SetLabel(CONTROL_TAGLINE, strTmp); strTmp = m_movieItem->GetVideoInfoTag()->m_strPlotOutline; strTmp.Trim(); SetLabel(CONTROL_PLOTOUTLINE, strTmp); strTmp = m_movieItem->GetVideoInfoTag()->m_strTrailer; strTmp.Trim(); SetLabel(CONTROL_TRAILER, strTmp); strTmp = m_movieItem->GetVideoInfoTag()->m_strMPAARating; strTmp.Trim(); SetLabel(CONTROL_MPAARATING, strTmp); CStdString strTop250; if (m_movieItem->GetVideoInfoTag()->m_iTop250) strTop250.Format("%i", m_movieItem->GetVideoInfoTag()->m_iTop250); SetLabel(CONTROL_TOP250, strTop250); CStdString strYear; if (m_movieItem->GetVideoInfoTag()->m_iYear) strYear.Format("%i", m_movieItem->GetVideoInfoTag()->m_iYear); else strYear = g_infoManager.GetItemLabel(m_movieItem,LISTITEM_PREMIERED); SetLabel(CONTROL_YEAR, strYear); CStdString strRating_And_Votes; if (m_movieItem->GetVideoInfoTag()->m_fRating != 0.0f) // only non-zero ratings are of interest strRating_And_Votes.Format("%03.1f (%s %s)", m_movieItem->GetVideoInfoTag()->m_fRating, m_movieItem->GetVideoInfoTag()->m_strVotes, g_localizeStrings.Get(20350)); SetLabel(CONTROL_RATING_AND_VOTES, strRating_And_Votes); strTmp = m_movieItem->GetVideoInfoTag()->m_strRuntime; strTmp.Trim(); SetLabel(CONTROL_RUNTIME, strTmp); // setup plot text area strTmp = m_movieItem->GetVideoInfoTag()->m_strPlot; if (!(!m_movieItem->GetVideoInfoTag()->m_strShowTitle.IsEmpty() && m_movieItem->GetVideoInfoTag()->m_iSeason == 0)) // dont apply to tvshows if (m_movieItem->GetVideoInfoTag()->m_playCount == 0 && g_guiSettings.GetBool("videolibrary.hideplots")) strTmp = g_localizeStrings.Get(20370); strTmp.Trim(); SetLabel(CONTROL_TEXTAREA, strTmp); // setup cast list + determine type ClearCastList(); if (!m_movieItem->GetVideoInfoTag()->m_strArtist.IsEmpty()) { // music video CStdStringArray artists; StringUtils::SplitString(m_movieItem->GetVideoInfoTag()->m_strArtist, g_advancedSettings.m_videoItemSeparator, artists); for (std::vector<CStdString>::const_iterator it = artists.begin(); it != artists.end(); ++it) { CFileItem *item = new CFileItem(*it); if (CFile::Exists(item->GetCachedArtistThumb())) item->SetThumbnailImage(item->GetCachedArtistThumb()); item->SetIconImage("DefaultArtist.png"); m_castList->Add(item); } m_castList->SetContent("musicvideos"); } else { // movie/show/episode for (CVideoInfoTag::iCast it = m_movieItem->GetVideoInfoTag()->m_cast.begin(); it != m_movieItem->GetVideoInfoTag()->m_cast.end(); ++it) { CStdString character; if (it->strRole.IsEmpty()) character = it->strName; else character.Format("%s %s %s", it->strName.c_str(), g_localizeStrings.Get(20347).c_str(), it->strRole.c_str()); CFileItem *item = new CFileItem(it->strName); if (CFile::Exists(item->GetCachedActorThumb())) item->SetThumbnailImage(item->GetCachedActorThumb()); item->SetIconImage("DefaultActor.png"); item->SetLabel(character); m_castList->Add(item); } // determine type: if (m_movieItem->m_bIsFolder) m_castList->SetContent("tvshows"); else if (m_movieItem->GetVideoInfoTag()->m_iSeason > -1) m_castList->SetContent("episodes"); else m_castList->SetContent("movies"); } CGUIMessage msg(GUI_MSG_LABEL_BIND, GetID(), CONTROL_LIST, 0, 0, m_castList); OnMessage(msg); if (m_bViewReview) { if (!m_movieItem->GetVideoInfoTag()->m_strArtist.IsEmpty()) { SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 133); } else { SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 206); } SET_CONTROL_HIDDEN(CONTROL_LIST); SET_CONTROL_VISIBLE(CONTROL_TEXTAREA); } else { SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 207); SET_CONTROL_HIDDEN(CONTROL_TEXTAREA); SET_CONTROL_VISIBLE(CONTROL_LIST); } // Check for resumability CGUIWindowVideoFiles *window = (CGUIWindowVideoFiles *)m_gWindowManager.GetWindow(WINDOW_VIDEO_FILES); if (window && window->GetResumeItemOffset(m_movieItem) > 0) { CONTROL_ENABLE(CONTROL_BTN_RESUME); } else { CONTROL_DISABLE(CONTROL_BTN_RESUME); } if (m_movieItem->GetVideoInfoTag()->m_strEpisodeGuide.IsEmpty()) // disable the play button for tv show info { CONTROL_ENABLE(CONTROL_BTN_PLAY) } else { CONTROL_DISABLE(CONTROL_BTN_PLAY) } // update the thumbnail const CGUIControl* pControl = GetControl(CONTROL_IMAGE); if (pControl) { CGUIImage* pImageControl = (CGUIImage*)pControl; pImageControl->FreeResources(); pImageControl->SetFileName(m_movieItem->GetThumbnailImage()); } }
void CGUIDialogProfileSettings::OnSettingChanged(SettingInfo &setting) { // check and update anything that needs it if (setting.id == 1) { if (CGUIKeyboardFactory::ShowAndGetInput(m_strName,g_localizeStrings.Get(20093),false)) { m_bNeedSave = true; SET_CONTROL_LABEL(1000,m_strName); } } if (setting.id == 2) { CStdString strThumb; VECSOURCES shares; g_mediaManager.GetLocalDrives(shares); CFileItemList items; if (!m_strThumb.IsEmpty()) { CFileItemPtr item(new CFileItem("thumb://Current", false)); item->SetArt("thumb", m_strThumb); item->SetLabel(g_localizeStrings.Get(20016)); items.Add(item); } CFileItemPtr item(new CFileItem("thumb://None", false)); item->SetArt("thumb", m_strDefaultImage); item->SetLabel(g_localizeStrings.Get(20018)); items.Add(item); if (CGUIDialogFileBrowser::ShowAndGetImage(items,shares,g_localizeStrings.Get(1030),strThumb) && !strThumb.Equals("thumb://Current")) { m_bNeedSave = true; m_strThumb = strThumb.Equals("thumb://None") ? "" : strThumb; CGUIImage *pImage = (CGUIImage*)GetControl(2); if (pImage) { pImage->SetFileName(""); pImage->SetInvalid(); pImage->SetFileName(!m_strThumb.IsEmpty() ? m_strThumb : m_strDefaultImage); } } } if (setting.id == 3) { if (OnProfilePath(m_strDirectory, m_bIsDefault)) { m_bNeedSave = true; SET_CONTROL_LABEL(1001,m_strDirectory); } } if (setting.id == 4) { if (m_bShowDetails) { if (CProfilesManager::Get().GetMasterProfile().getLockMode() == LOCK_MODE_EVERYONE && !m_bIsDefault) { if (CGUIDialogYesNo::ShowAndGetInput(20066,20118,20119,20022)) g_passwordManager.SetMasterLockMode(false); if (CProfilesManager::Get().GetMasterProfile().getLockMode() == LOCK_MODE_EVERYONE) return; } if (CGUIDialogLockSettings::ShowAndGetLock(m_locks, m_bIsDefault ? 12360 : 20068, CProfilesManager::Get().GetMasterProfile().getLockMode() == LOCK_MODE_EVERYONE || m_bIsDefault)) m_bNeedSave = true; } else { if (CGUIDialogLockSettings::ShowAndGetLock(m_locks, m_bIsDefault ? 12360 : 20068, false, false)) m_bNeedSave = true; } } if (setting.id > 4) m_bNeedSave = true; }
void CGUIDialogProfileSettings::OnWindowLoaded() { CGUIDialogSettings::OnWindowLoaded(); CGUIImage *pImage = (CGUIImage*)GetControl(2); m_strDefaultImage = pImage ? pImage->GetFileName() : ""; }