bool CGUIWindowSettingsScreenCalibration::OnAction(const CAction &action) { switch (action.GetID()) { case ACTION_CALIBRATE_SWAP_ARROWS: { NextControl(); return true; } break; case ACTION_CALIBRATE_RESET: { CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); pDialog->SetHeading(20325); CStdString strText; strText.Format(g_localizeStrings.Get(20326).c_str(), g_settings.m_ResInfo[m_Res[m_iCurRes]].strMode.c_str()); pDialog->SetLine(0, strText); pDialog->SetLine(1, 20327); pDialog->SetChoice(0, 222); pDialog->SetChoice(1, 186); pDialog->DoModal(); if (pDialog->IsConfirmed()) { g_graphicsContext.ResetScreenParameters(m_Res[m_iCurRes]); ResetControls(); } return true; } break; case ACTION_CHANGE_RESOLUTION: // choose the next resolution in our list { m_iCurRes = (m_iCurRes+1) % m_Res.size(); g_graphicsContext.SetVideoResolution(m_Res[m_iCurRes]); ResetControls(); return true; } break; } return CGUIWindow::OnAction(action); // base class to handle basic movement etc. }
void CAddonStatusHandler::Process() { CSingleLock lock(m_critSection); std::string heading = StringUtils::Format("%s: %s", TranslateType(m_addon->Type(), true).c_str(), m_addon->Name().c_str()); /* Request to restart the AddOn and data structures need updated */ if (m_status == ADDON_STATUS_NEED_RESTART) { CGUIDialogOK* pDialog = (CGUIDialogOK*)g_windowManager.GetWindow(WINDOW_DIALOG_OK); if (!pDialog) return; pDialog->SetHeading(CVariant{heading}); pDialog->SetLine(1, CVariant{24074}); pDialog->Open(); CAddonMgr::GetInstance().GetCallbackForType(m_addon->Type())->RequestRestart(m_addon, true); } /* Some required settings are missing/invalid */ else if ((m_status == ADDON_STATUS_NEED_SETTINGS) || (m_status == ADDON_STATUS_NEED_SAVEDSETTINGS)) { CGUIDialogYesNo* pDialogYesNo = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialogYesNo) return; pDialogYesNo->SetHeading(CVariant{heading}); pDialogYesNo->SetLine(1, CVariant{24070}); pDialogYesNo->SetLine(2, CVariant{24072}); pDialogYesNo->SetLine(3, CVariant{m_message}); pDialogYesNo->Open(); if (!pDialogYesNo->IsConfirmed()) return; if (!m_addon->HasSettings()) return; if (CGUIDialogAddonSettings::ShowAndGetInput(m_addon)) { //! @todo Doesn't dialogaddonsettings save these automatically? It should do this. m_addon->SaveSettings(); CAddonMgr::GetInstance().GetCallbackForType(m_addon->Type())->RequestRestart(m_addon, true); } } }
bool CSettings::DeleteProfile(unsigned int index) { const CProfile *profile = GetProfile(index); if (!profile) return false; CGUIDialogYesNo* dlgYesNo = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (dlgYesNo) { CStdString message; CStdString str = g_localizeStrings.Get(13201); message.Format(str.c_str(), profile->getName()); dlgYesNo->SetHeading(13200); dlgYesNo->SetLine(0, message); dlgYesNo->SetLine(1, ""); dlgYesNo->SetLine(2, ""); dlgYesNo->DoModal(); if (dlgYesNo->IsConfirmed()) { //delete profile CStdString strDirectory = profile->getDirectory(); m_vecProfiles.erase(m_vecProfiles.begin()+index); if (index == m_currentProfile) { LoadProfile(0); Save(); } CFileItemPtr item = CFileItemPtr(new CFileItem(URIUtils::AddFileToFolder(GetUserDataFolder(), strDirectory))); item->SetPath(URIUtils::AddFileToFolder(GetUserDataFolder(), strDirectory + "/")); item->m_bIsFolder = true; item->Select(true); CFileUtils::DeleteItem(item); } else return false; } SaveProfiles( PROFILES_FILE ); return true; }
bool CGUIWindowPVRRecordings::ActionDeleteRecording(CFileItem *item) { bool bReturn = false; if ((!item->IsPVRRecording() && !item->m_bIsFolder) || item->IsParentFolder()) return bReturn; /* show a confirmation dialog */ CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return bReturn; int iLine0 = item->m_bIsFolder ? 19113 : item->GetPVRRecordingInfoTag()->IsDeleted() ? 19294 : 19112; pDialog->SetHeading(CVariant{122}); // Confirm delete pDialog->SetLine(0, CVariant{iLine0}); // Delete all recordings in this folder? / Delete this recording permanently? / Delete this recording? pDialog->SetLine(1, CVariant{""}); pDialog->SetLine(2, CVariant{item->GetLabel()}); pDialog->SetChoice(1, CVariant{117}); // Delete /* prompt for the user's confirmation */ pDialog->Open(); if (!pDialog->IsConfirmed()) return bReturn; /* delete the recording */ if (g_PVRRecordings->Delete(*item)) { g_PVRManager.TriggerRecordingsUpdate(); bReturn = true; /* remove the item from the list immediately, otherwise the item count further down may be wrong */ m_vecItems->Remove(item); /* go to the parent folder if we're in a subdirectory and just deleted the last item */ CPVRRecordingsPath path(m_vecItems->GetPath()); if (path.IsValid() && !path.IsRecordingsRoot() && m_vecItems->GetObjectCount() == 0) GoParentFolder(); } return bReturn; }
bool CGUIWindowPVRCommon::ActionRecord(CFileItem *item) { bool bReturn = false; CEpgInfoTag *epgTag = item->GetEPGInfoTag(); if (!epgTag) return bReturn; const CPVRChannel *channel = epgTag->ChannelTag(); if (!channel || channel->ChannelNumber() > 0) return bReturn; if (epgTag->Timer() == NULL) { /* create a confirmation dialog */ CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*) g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return bReturn; pDialog->SetHeading(264); pDialog->SetLine(0, ""); pDialog->SetLine(1, epgTag->Title()); pDialog->SetLine(2, ""); pDialog->DoModal(); /* prompt for the user's confirmation */ if (!pDialog->IsConfirmed()) return bReturn; CPVRTimerInfoTag *newtimer = CPVRTimerInfoTag::CreateFromEpg(*epgTag); CFileItem *item = new CFileItem(*newtimer); bReturn = g_PVRTimers->AddTimer(*item); } else { CGUIDialogOK::ShowAndGetInput(19033,19034,0,0); bReturn = true; } return bReturn; }
bool CGUIWindowPVRBase::StartRecordFile(const CFileItem &item) { if (!item.HasEPGInfoTag()) return false; const CEpgInfoTag *tag = item.GetEPGInfoTag(); CPVRChannelPtr channel; if (tag) channel = tag->ChannelTag(); if (!channel || !g_PVRManager.CheckParentalLock(*channel)) return false; CFileItemPtr timer = g_PVRTimers->GetTimerForEpgTag(&item); if (timer && timer->HasPVRTimerInfoTag()) { CGUIDialogOK::ShowAndGetInput(19033,19034,0,0); return false; } // ask for confirmation before starting a timer CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return false; pDialog->SetHeading(264); pDialog->SetLine(0, tag->PVRChannelName()); pDialog->SetLine(1, ""); pDialog->SetLine(2, tag->Title()); pDialog->DoModal(); if (!pDialog->IsConfirmed()) return false; CPVRTimerInfoTag *newTimer = CPVRTimerInfoTag::CreateFromEpg(*tag); bool bReturn(false); if (newTimer) { bReturn = g_PVRTimers->AddTimer(*newTimer); delete newTimer; } return bReturn; }
bool CGUIDialogYesNo::ShowAndGetInput(CVariant heading, CVariant line0, CVariant line1, CVariant line2, bool &bCanceled, CVariant noLabel, CVariant yesLabel, unsigned int autoCloseTime) { CGUIDialogYesNo *dialog = (CGUIDialogYesNo *)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!dialog) return false; dialog->SetHeading(heading); dialog->SetLine(0, line0); dialog->SetLine(1, line1); dialog->SetLine(2, line2); if (autoCloseTime) dialog->SetAutoClose(autoCloseTime); dialog->SetChoice(0, !noLabel.empty() ? noLabel : 106); dialog->SetChoice(1, !yesLabel.empty() ? yesLabel : 107); dialog->m_bCanceled = false; dialog->Open(); bCanceled = dialog->m_bCanceled; return (dialog->IsConfirmed()) ? true : false; }
bool CGUIWindowPVRRecordings::OnContextButtonDeleteAll(CFileItem *item, CONTEXT_BUTTON button) { bool bReturn = false; if (button != CONTEXT_BUTTON_DELETE_ALL || !item->IsDeletedPVRRecording()) return bReturn; /* show a confirmation dialog */ CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return bReturn; pDialog->SetHeading(CVariant{19292}); // Delete all permanently pDialog->SetLine(0, CVariant{19293}); // Delete all recordings permanently? pDialog->SetLine(1, CVariant{""}); pDialog->SetLine(2, CVariant{""}); pDialog->SetChoice(1, CVariant{117}); // Delete /* prompt for the user's confirmation */ pDialog->Open(); if (!pDialog->IsConfirmed()) return bReturn; /* undelete the recording */ if (g_PVRRecordings->DeleteAllRecordingsFromTrash()) { g_PVRManager.TriggerRecordingsUpdate(); bReturn = true; /* remove the item from the list immediately, otherwise the item count further down may be wrong */ m_vecItems->Clear(); /* go to the parent folder if we're in a subdirectory and just deleted the last item */ CPVRRecordingsPath path(m_vecItems->GetPath()); if (path.IsValid() && !path.IsRecordingsRoot() && m_vecItems->GetObjectCount() == 0) GoParentFolder(); } return bReturn; }
bool CGUIDialogYesNo::ShowAndGetInput(const CStdString& heading, const CStdString& line0, const CStdString& line1, const CStdString& line2, bool& bCanceled, const CStdString& noLabel, const CStdString& yesLabel) { CGUIDialogYesNo *dialog = (CGUIDialogYesNo *)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!dialog) return false; dialog->SetHeading(heading); dialog->SetLine(0, line0); dialog->SetLine(1, line1); dialog->SetLine(2, line2); dialog->m_bCanceled = false; if (!noLabel.IsEmpty()) dialog->SetChoice(0,noLabel); else dialog->SetChoice(0,106); if (!yesLabel.IsEmpty()) dialog->SetChoice(1,yesLabel); else dialog->SetChoice(1,107); dialog->DoModal(); bCanceled = dialog->m_bCanceled; return (dialog->IsConfirmed()) ? true : false; }
bool CGUIDialogPVRGuideInfo::ActionStartTimer(const CEpgInfoTag *tag) { bool bReturn = false; if (!tag) return false; CPVRChannelPtr channel = tag->ChannelTag(); if (!channel || !g_PVRManager.CheckParentalLock(*channel)) return false; // prompt user for confirmation of channel record CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (pDialog) { pDialog->SetHeading(264); pDialog->SetLine(0, ""); pDialog->SetLine(1, tag->Title()); pDialog->SetLine(2, ""); pDialog->DoModal(); if (pDialog->IsConfirmed()) { Close(); CPVRTimerInfoTag *newTimer = CPVRTimerInfoTag::CreateFromEpg(*tag); if (newTimer) { bReturn = CPVRTimers::AddTimer(*newTimer); delete newTimer; } else { bReturn = false; } } } return bReturn; }
bool CGUIWindowPVRCommon::StartRecordFile(CFileItem *item) { bool bReturn = false; if (!item->HasEPGInfoTag()) return bReturn; CPVREpgInfoTag *tag = (CPVREpgInfoTag *) item->GetEPGInfoTag(); if (!tag || !tag->ChannelTag() || tag->ChannelTag()->ChannelNumber() <= 0) return bReturn; CPVRTimerInfoTag *timer = CPVRManager::GetTimers()->GetMatch(item); if (timer) { CGUIDialogOK::ShowAndGetInput(19033,19034,0,0); return bReturn; } CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return bReturn; pDialog->SetHeading(264); pDialog->SetLine(0, tag->ChannelTag()->ChannelName()); pDialog->SetLine(1, ""); pDialog->SetLine(2, tag->Title()); pDialog->DoModal(); if (!pDialog->IsConfirmed()) return bReturn; CPVRTimerInfoTag *newtimer = CPVRTimerInfoTag::CreateFromEpg(*tag); CFileItem *newTimerItem = new CFileItem(*newtimer); if (CPVRManager::GetTimers()->AddTimer(*newTimerItem)) { CPVRManager::GetTimers()->Update(); bReturn = true; } return bReturn; }
bool CGUIWindowPVRRecordings::ActionDeleteRecording(CFileItem *item) { bool bReturn = false; if (!item->IsPVRRecording() && !item->m_bIsFolder) return bReturn; /* show a confirmation dialog */ CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return bReturn; pDialog->SetHeading(122); // Confirm delete pDialog->SetLine(0, item->m_bIsFolder ? 19113 : 19112); // Are you sure? pDialog->SetLine(1, ""); pDialog->SetLine(2, item->GetLabel()); pDialog->SetChoice(1, 117); // Delete /* prompt for the user's confirmation */ pDialog->DoModal(); if (!pDialog->IsConfirmed()) return bReturn; /* delete the recording */ if (g_PVRRecordings->Delete(*item)) { g_PVRManager.TriggerRecordingsUpdate(); bReturn = true; /* remove the item from the list immediately, otherwise the item count further down may be wrong */ m_vecItems->Remove(item); /* go to the parent folder if we're in a subdirectory and just deleted the last item */ if (m_vecItems->GetPath() != "pvr://recordings/" && m_vecItems->GetObjectCount() == 0) GoParentFolder(); } return bReturn; }
bool CGUIDialogYesNo::ShowAndGetInput(int heading, int line0, int line1, int line2, int iNoLabel, int iYesLabel, bool& bCanceled, unsigned int autoCloseTime) { CGUIDialogYesNo *dialog = (CGUIDialogYesNo *)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!dialog) return false; dialog->SetHeading(heading); dialog->SetLine(0, line0); dialog->SetLine(1, line1); dialog->SetLine(2, line2); if (autoCloseTime) dialog->SetAutoClose(autoCloseTime); if (iNoLabel != -1) dialog->SetChoice(0,iNoLabel); else dialog->SetChoice(0,106); if (iYesLabel != -1) dialog->SetChoice(1,iYesLabel); else dialog->SetChoice(1,107); dialog->m_bCanceled = false; dialog->DoModal(); bCanceled = dialog->m_bCanceled; return (dialog->IsConfirmed()) ? true : false; }
bool CGUIWindowPVRCommon::ActionDeleteTimer(CFileItem *item) { /* check if the timer tag is valid */ CPVRTimerInfoTag *timerTag = item->GetPVRTimerInfoTag(); if (!timerTag || timerTag->m_iClientIndex < 0) return false; /* show a confirmation dialog */ CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return false; pDialog->SetHeading(122); pDialog->SetLine(0, 19040); pDialog->SetLine(1, ""); pDialog->SetLine(2, timerTag->m_strTitle); pDialog->DoModal(); /* prompt for the user's confirmation */ if (!pDialog->IsConfirmed()) return false; /* delete the timer */ return g_PVRTimers->DeleteTimer(*item); }
bool Dialog::yesno(const String& heading, const String& line1, const String& line2, const String& line3, const String& nolabel, const String& yeslabel, int autoclose) throw (WindowException) { DelayedCallGuard dcguard(languageHook); const int window = WINDOW_DIALOG_YES_NO; CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(window); if (pDialog == NULL) throw WindowException("Error: Window is NULL, this is not possible :-)"); // get lines, last 4 lines are optional. if (!heading.empty()) pDialog->SetHeading(heading); if (!line1.empty()) pDialog->SetLine(0, line1); if (!line2.empty()) pDialog->SetLine(1, line2); if (!line3.empty()) pDialog->SetLine(2, line3); if (!nolabel.empty()) pDialog->SetChoice(0,nolabel); if (!yeslabel.empty()) pDialog->SetChoice(1,yeslabel); if (autoclose > 0) pDialog->SetAutoClose(autoclose); //send message and wait for user input XBMCWaitForThreadMessage(TMSG_DIALOG_DOMODAL, window, ACTIVE_WINDOW); return pDialog->IsConfirmed(); }
bool CGUIDialogPVRGuideInfo::ActionCancelTimer(const CPVRTimerInfoTag *tag) { bool bReturn = false; // prompt user for confirmation of timer deletion CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (pDialog) { pDialog->SetHeading(265); pDialog->SetLine(0, ""); pDialog->SetLine(1, tag->m_strTitle); pDialog->SetLine(2, ""); pDialog->DoModal(); if (pDialog->IsConfirmed()) { Close(); bReturn = CPVRTimers::DeleteTimer(*tag); } } return bReturn; }
bool CRarManager::CacheRarredFile(CStdString& strPathInCache, const CStdString& strRarPath, const CStdString& strPathInRar, BYTE bOptions, const CStdString& strDir, const int64_t iSize) { #ifdef HAS_FILESYSTEM_RAR CSingleLock lock(m_CritSection); //If file is listed in the cache, then use listed copy or cleanup before overwriting. bool bOverwrite = (bOptions & EXFILE_OVERWRITE) != 0; map<CStdString, pair<ArchiveList_struct*,vector<CFileInfo> > >::iterator j = m_ExFiles.find( strRarPath ); CFileInfo* pFile=NULL; if( j != m_ExFiles.end() ) { pFile = GetFileInRar(strRarPath,strPathInRar); if (pFile) { if (pFile->m_bIsCanceled()) return false; if( CFile::Exists( pFile->m_strCachedPath) ) { if( !bOverwrite ) { strPathInCache = pFile->m_strCachedPath; pFile->m_iUsed++; return true; } CFile::Delete(pFile->m_strCachedPath); pFile->m_iUsed++; } } } int iRes = 0; if (iSize > EXTRACTION_WARN_SIZE) { CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (pDialog) { pDialog->SetHeading(120); pDialog->SetLine(0, 645); pDialog->SetLine(1, URIUtils::GetFileName(strPathInRar)); pDialog->SetLine(2, ""); pDialog->DoModal(); if (!pDialog->IsConfirmed()) iRes = 2; // pretend to be canceled } } if (CheckFreeSpace(strDir) < iSize && iRes != 2) { ClearCache(); if (CheckFreeSpace(strDir) < iSize) { CFileItemList items; CDirectory::GetDirectory(g_advancedSettings.m_cachePath,items); items.Sort(SortBySize, SortOrderDescending); while (items.Size() && CheckFreeSpace(strDir) < iSize) { if (!items[0]->m_bIsFolder) if (!CFile::Delete(items[0]->GetPath())) break; items.Remove(0); } if (!items.Size()) return false; } } CStdString strPath = strPathInRar; #ifndef TARGET_POSIX StringUtils::Replace(strPath, '/', '\\'); #endif //g_charsetConverter.unknownToUTF8(strPath); CStdString strCachedPath = URIUtils::AddFileToFolder(strDir + "rarfolder%04d", URIUtils::GetFileName(strPathInRar)); strCachedPath = CUtil::GetNextPathname(strCachedPath, 9999); if (strCachedPath.empty()) { CLog::Log(LOGWARNING, "Could not cache file %s", (strRarPath + strPathInRar).c_str()); return false; } strCachedPath = CUtil::MakeLegalPath(strCachedPath); int64_t iOffset = -1; if (iRes != 2) { if (pFile) { if (pFile->m_iOffset != -1) iOffset = pFile->m_iOffset; } if (iOffset == -1 && j != m_ExFiles.end()) // grab from list { for( ArchiveList_struct* pIterator = j->second.first; pIterator ; pIterator ? pIterator = pIterator->next : NULL) { CStdString strName; /* convert to utf8 */ if( pIterator->item.NameW && wcslen(pIterator->item.NameW) > 0) g_charsetConverter.wToUTF8(pIterator->item.NameW, strName); else g_charsetConverter.unknownToUTF8(pIterator->item.Name, strName); if (strName.Equals(strPath)) { iOffset = pIterator->item.iOffset; break; } } } bool bShowProgress=false; if (iSize > 1024*1024 || iSize == -2) // 1MB bShowProgress=true; CStdString strDir2 = URIUtils::GetDirectory(strCachedPath); URIUtils::RemoveSlashAtEnd(strDir2); if (!CDirectory::Exists(strDir2)) CDirectory::Create(strDir2); iRes = urarlib_get(const_cast<char*>(strRarPath.c_str()), const_cast<char*>(strDir2.c_str()), const_cast<char*>(strPath.c_str()),NULL,&iOffset,bShowProgress); } if (iRes == 0) { CLog::Log(LOGERROR,"failed to extract file: %s",strPathInRar.c_str()); return false; } if(!pFile) { CFileInfo fileInfo; fileInfo.m_strPathInRar = strPathInRar; if (j == m_ExFiles.end()) { ArchiveList_struct* pArchiveList; if(ListArchive(strRarPath,pArchiveList)) { m_ExFiles.insert(make_pair(strRarPath,make_pair(pArchiveList,vector<CFileInfo>()))); j = m_ExFiles.find(strRarPath); } else return false; } j->second.second.push_back(fileInfo); pFile = &(j->second.second[j->second.second.size()-1]); pFile->m_iUsed = 1; } pFile->m_strCachedPath = strCachedPath; pFile->m_bAutoDel = (bOptions & EXFILE_AUTODELETE) != 0; pFile->m_iOffset = iOffset; strPathInCache = pFile->m_strCachedPath; if (iRes == 2) //canceled { pFile->watch.StartZero(); CFile::Delete(pFile->m_strCachedPath); return false; } #endif return true; }
void CGUIWindowVideoNav::OnDeleteItem(CFileItemPtr pItem) { if (m_vecItems->IsParentFolder()) return; if (!m_vecItems->IsVideoDb() && !pItem->IsVideoDb()) { if (!pItem->IsPath("newsmartplaylist://video") && !pItem->IsPath("special://videoplaylists/") && !pItem->IsPath("sources://video/") && !URIUtils::IsProtocol(pItem->GetPath(), "newtag")) CGUIWindowVideoBase::OnDeleteItem(pItem); } else if (StringUtils::StartsWithNoCase(pItem->GetPath(), "videodb://movies/sets/") && pItem->GetPath().size() > 22 && pItem->m_bIsFolder) { CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); pDialog->SetHeading(CVariant{432}); std::string strLabel = StringUtils::Format(g_localizeStrings.Get(433).c_str(),pItem->GetLabel().c_str()); pDialog->SetLine(1, CVariant{std::move(strLabel)}); pDialog->SetLine(2, CVariant{""}); pDialog->Open(); if (pDialog->IsConfirmed()) { CFileItemList items; CDirectory::GetDirectory(pItem->GetPath(),items,"",DIR_FLAG_NO_FILE_DIRS); for (int i=0;i<items.Size();++i) OnDeleteItem(items[i]); CVideoDatabaseDirectory dir; CQueryParams params; dir.GetQueryParams(pItem->GetPath(),params); m_database.DeleteSet(params.GetSetId()); } } else if (m_vecItems->GetContent() == "tags" && pItem->m_bIsFolder) { CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); pDialog->SetHeading(CVariant{432}); pDialog->SetLine(1, CVariant{ StringUtils::Format(g_localizeStrings.Get(433).c_str(), pItem->GetLabel().c_str()) }); pDialog->SetLine(2, CVariant{""}); pDialog->Open(); if (pDialog->IsConfirmed()) { CVideoDatabaseDirectory dir; CQueryParams params; dir.GetQueryParams(pItem->GetPath(), params); m_database.DeleteTag(params.GetTagId(), (VIDEODB_CONTENT_TYPE)params.GetContentType()); } } else if (m_vecItems->IsPath(CUtil::VideoPlaylistsLocation()) || m_vecItems->IsPath("special://videoplaylists/")) { pItem->m_bIsFolder = false; CFileUtils::DeleteItem(pItem); } else { if (!CGUIDialogVideoInfo::DeleteVideoItem(pItem)) return; } int itemNumber = m_viewControl.GetSelectedItem(); int select = itemNumber >= m_vecItems->Size()-1 ? itemNumber-1 : itemNumber; m_viewControl.SetSelectedItem(select); CUtil::DeleteVideoDatabaseDirectoryCache(); }
bool CGUIWindowPVRBase::PlayFile(CFileItem *item, bool bPlayMinimized /* = false */, bool bCheckResume /* = true */) { if (item->m_bIsFolder) { return false; } CPVRChannelPtr channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : CPVRChannelPtr(); if (item->GetPath() == g_application.CurrentFile() || (channel && channel->HasRecording() && channel->GetRecording()->GetPath() == g_application.CurrentFile())) { CGUIMessage msg(GUI_MSG_FULLSCREEN, 0, GetID()); g_windowManager.SendMessage(msg); return true; } CMediaSettings::GetInstance().SetVideoStartWindowed(bPlayMinimized); if (item->HasPVRRecordingInfoTag()) { return PlayRecording(item, bPlayMinimized, bCheckResume); } else { bool bSwitchSuccessful(false); CPVRChannelPtr channel(item->GetPVRChannelInfoTag()); if (channel && g_PVRManager.CheckParentalLock(channel)) { CPVRRecordingPtr recording = channel->GetRecording(); if (recording) { CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*) g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (pDialog) { pDialog->SetHeading(CVariant{19687}); // Play recording pDialog->SetLine(0, CVariant{""}); pDialog->SetLine(1, CVariant{12021}); // Start from beginning pDialog->SetLine(2, CVariant{recording->m_strTitle}); pDialog->Open(); if (pDialog->IsConfirmed()) { CFileItem recordingItem(recording); return PlayRecording(&recordingItem, CSettings::GetInstance().GetBool(CSettings::SETTING_PVRPLAYBACK_PLAYMINIMIZED), bCheckResume); } } } /* try a fast switch */ if ((g_PVRManager.IsPlayingTV() || g_PVRManager.IsPlayingRadio()) && (channel->IsRadio() == g_PVRManager.IsPlayingRadio())) { if (channel->StreamURL().empty()) bSwitchSuccessful = g_application.m_pPlayer->SwitchChannel(channel); } if (!bSwitchSuccessful) { CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_PLAY, 0, 0, static_cast<void*>(new CFileItem(*item))); return true; } } if (!bSwitchSuccessful) { std::string channelName = g_localizeStrings.Get(19029); // Channel if (channel) channelName = channel->ChannelName(); std::string msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), channelName.c_str()); // CHANNELNAME could not be played. Check the log for details. CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(19166), // PVR information msg); return false; } } return true; }
void CAddonStatusHandler::Process() { CSingleLock lock(m_critSection); std::string heading = StringUtils::Format("%s: %s", TranslateType(m_addon->Type(), true).c_str(), m_addon->Name().c_str()); /* AddOn lost connection to his backend (for ones that use Network) */ if (m_status == ADDON_STATUS_LOST_CONNECTION) { if (m_addon->Type() == ADDON_PVRDLL) { if (!CSettings::Get().GetBool("pvrmanager.hideconnectionlostwarning")) CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, m_addon->Name().c_str(), g_localizeStrings.Get(36030)); // connection lost // TODO handle disconnects after the add-on's been initialised } else { CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return; pDialog->SetHeading(heading); pDialog->SetLine(1, 24070); pDialog->SetLine(2, 24073); //send message and wait for user input ThreadMessage tMsg = {TMSG_DIALOG_DOMODAL, WINDOW_DIALOG_YES_NO, g_windowManager.GetActiveWindow()}; CApplicationMessenger::Get().SendMessage(tMsg, true); if (pDialog->IsConfirmed()) CAddonMgr::Get().GetCallbackForType(m_addon->Type())->RequestRestart(m_addon, false); } } /* Request to restart the AddOn and data structures need updated */ else if (m_status == ADDON_STATUS_NEED_RESTART) { CGUIDialogOK* pDialog = (CGUIDialogOK*)g_windowManager.GetWindow(WINDOW_DIALOG_OK); if (!pDialog) return; pDialog->SetHeading(heading); pDialog->SetLine(1, 24074); //send message and wait for user input ThreadMessage tMsg = {TMSG_DIALOG_DOMODAL, WINDOW_DIALOG_OK, g_windowManager.GetActiveWindow()}; CApplicationMessenger::Get().SendMessage(tMsg, true); CAddonMgr::Get().GetCallbackForType(m_addon->Type())->RequestRestart(m_addon, true); } /* Some required settings are missing/invalid */ else if ((m_status == ADDON_STATUS_NEED_SETTINGS) || (m_status == ADDON_STATUS_NEED_SAVEDSETTINGS)) { CGUIDialogYesNo* pDialogYesNo = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialogYesNo) return; pDialogYesNo->SetHeading(heading); pDialogYesNo->SetLine(1, 24070); pDialogYesNo->SetLine(2, 24072); pDialogYesNo->SetLine(3, m_message); //send message and wait for user input ThreadMessage tMsg = {TMSG_DIALOG_DOMODAL, WINDOW_DIALOG_YES_NO, g_windowManager.GetActiveWindow()}; CApplicationMessenger::Get().SendMessage(tMsg, true); if (!pDialogYesNo->IsConfirmed()) return; if (!m_addon->HasSettings()) return; if (CGUIDialogAddonSettings::ShowAndGetInput(m_addon)) { //todo doesn't dialogaddonsettings save these automatically? should do m_addon->SaveSettings(); CAddonMgr::Get().GetCallbackForType(m_addon->Type())->RequestRestart(m_addon, true); } } /* A unknown event has occurred */ else if (m_status == ADDON_STATUS_UNKNOWN) { CGUIDialogOK* pDialog = (CGUIDialogOK*)g_windowManager.GetWindow(WINDOW_DIALOG_OK); if (!pDialog) return; pDialog->SetHeading(heading); pDialog->SetLine(1, 24070); pDialog->SetLine(2, 24071); pDialog->SetLine(3, m_message); //send message and wait for user input ThreadMessage tMsg = {TMSG_DIALOG_DOMODAL, WINDOW_DIALOG_OK, g_windowManager.GetActiveWindow()}; CApplicationMessenger::Get().SendMessage(tMsg, true); } }
void CGUIWindowBoxeeWizardResolution::OnInitWindow() { CGUIWindow::OnInitWindow(); delete m_xrandr; m_xrandr = new CXRandR(); if (!m_wizardCompletedOnce) { CONTROL_DISABLE(CONTROL_NEXT); } if (m_afterResolutionChange) { CGUIListContainer *pList = (CGUIListContainer *)GetControl(CONTROL_SD_HD); if (pList) pList->SetSingleSelectedItem(); ShowResolutionsList(IsResolutionHD(m_newResolution), &m_newResolution); CStdString origHz; origHz.Format("%.2f", m_originalResolution.hz); CStdString newHz; newHz.Format("%.2f", m_newResolution.hz); if (m_newResolution.name != m_originalResolution.name || origHz != newHz) { CGUIDialogYesNo *pDlgYesNo = (CGUIDialogYesNo*)m_gWindowManager.GetWindow(WINDOW_DIALOG_YES_NO); pDlgYesNo->SetHeading("Resolution Change"); pDlgYesNo->SetLine(0, "Do you want to keep this resolution"); pDlgYesNo->SetLine(1, "(will revert automatically in 6 seconds)"); pDlgYesNo->SetLine(2, ""); pDlgYesNo->SetLine(3, ""); pDlgYesNo->SetChoice(0, "Revert"); pDlgYesNo->SetChoice(1, "Keep"); pDlgYesNo->SetDefaultChoice(0); pDlgYesNo->SetAutoClose(6000); pDlgYesNo->DoModal(); if (!pDlgYesNo->IsConfirmed()) { m_afterResolutionChange = false; // Set the requested resolution g_graphicsContext.SetVideoResolution(m_originalResolutionId, TRUE); // Reload the fonts to they will scale correctly g_fontManager.ReloadTTFFonts(); // Close the dialog and restart it so it will re-set the size of the labels to // fit for the new resolutions Close(); m_gWindowManager.ActivateWindow(WINDOW_BOXEE_WIZARD_RESOLUTION); } else { int xbmcResolutionId = GetXBMCResolutionId(); if (xbmcResolutionId != -1) { g_guiSettings.SetInt("videoscreen.resolution", xbmcResolutionId); g_guiSettings.SetInt("videoplayer.displayresolution", xbmcResolutionId); g_guiSettings.SetInt("pictures.displayresolution", xbmcResolutionId); g_settings.Save(); delete m_xrandr; m_xrandr = new CXRandR(); } m_wizardCompletedOnce = true; CONTROL_ENABLE(CONTROL_NEXT); SET_CONTROL_FOCUS(CONTROL_NEXT, 0); } } else { m_wizardCompletedOnce = true; CONTROL_ENABLE(CONTROL_NEXT); SET_CONTROL_FOCUS(CONTROL_NEXT, 0); } } else if (m_resolutionChangedOnce || m_wizardCompletedOnce) { XOutput output = GetCurrentOutput(); XMode currentResolution = m_xrandr->GetCurrentMode(output.name); ShowResolutionsList(IsResolutionHD(currentResolution), ¤tResolution); } else { XOutput output = GetCurrentOutput(); XMode currentResolution = m_xrandr->GetCurrentMode(output.name); CGUIMessage msg(GUI_MSG_ITEM_SELECT, GetID(), CONTROL_SD_HD, IsResolutionHD(currentResolution) ? VALUE_HD : VALUE_SD); OnMessage(msg); } }
bool CGUIWindowVideoNav::DeleteItem(CFileItem* pItem, bool bUnavailable /* = false */) { if (!pItem->HasVideoInfoTag() || !CanDelete(pItem->m_strPath)) return false; VIDEODB_CONTENT_TYPE iType=VIDEODB_CONTENT_MOVIES; if (pItem->HasVideoInfoTag() && !pItem->GetVideoInfoTag()->m_strShowTitle.IsEmpty()) iType = VIDEODB_CONTENT_TVSHOWS; if (pItem->HasVideoInfoTag() && pItem->GetVideoInfoTag()->m_iSeason > -1 && !pItem->m_bIsFolder) iType = VIDEODB_CONTENT_EPISODES; if (pItem->HasVideoInfoTag() && !pItem->GetVideoInfoTag()->m_strArtist.IsEmpty()) iType = VIDEODB_CONTENT_MUSICVIDEOS; // dont allow update while scanning CGUIDialogVideoScan* pDialogScan = (CGUIDialogVideoScan*)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_SCAN); if (pDialogScan && pDialogScan->IsScanning()) { CGUIDialogOK::ShowAndGetInput(257, 0, 14057, 0); return false; } CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return false; if (iType == VIDEODB_CONTENT_MOVIES) pDialog->SetHeading(432); if (iType == VIDEODB_CONTENT_EPISODES) pDialog->SetHeading(20362); if (iType == VIDEODB_CONTENT_TVSHOWS) pDialog->SetHeading(20363); if (iType == VIDEODB_CONTENT_MUSICVIDEOS) pDialog->SetHeading(20392); if(bUnavailable) { pDialog->SetLine(0, g_localizeStrings.Get(662)); pDialog->SetLine(1, g_localizeStrings.Get(663)); pDialog->SetLine(2, "");; pDialog->DoModal(); } else { CStdString strLine; strLine.Format(g_localizeStrings.Get(433),pItem->GetLabel()); pDialog->SetLine(0, strLine); pDialog->SetLine(1, ""); pDialog->SetLine(2, "");; pDialog->DoModal(); } if (!pDialog->IsConfirmed()) return false; CStdString path; CVideoDatabase database; database.Open(); database.GetFilePathById(pItem->GetVideoInfoTag()->m_iDbId, path, iType); if (path.IsEmpty()) return false; if (iType == VIDEODB_CONTENT_MOVIES) database.DeleteMovie(path); if (iType == VIDEODB_CONTENT_EPISODES) database.DeleteEpisode(path, pItem->GetVideoInfoTag()->m_iDbId); if (iType == VIDEODB_CONTENT_TVSHOWS) database.DeleteTvShow(path); if (iType == VIDEODB_CONTENT_MUSICVIDEOS) database.DeleteMusicVideo(path); if (iType == VIDEODB_CONTENT_TVSHOWS) database.SetPathHash(path,""); else { CStdString strDirectory; CUtil::GetDirectory(path,strDirectory); database.SetPathHash(strDirectory,""); } return true; }
bool CGUIDialogPVRChannelManager::OnMessage(CGUIMessage& message) { unsigned int iControl = 0; unsigned int iMessage = message.GetMessage(); switch (iMessage) { case GUI_MSG_WINDOW_DEINIT: { Clear(); } break; case GUI_MSG_WINDOW_INIT: { CGUIWindow::OnMessage(message); m_iSelected = 0; m_bIsRadio = false; m_bMovingMode = false; m_bContainsChanges = false; SetProperty("IsRadio", ""); Update(); SetData(m_iSelected); return true; } break; case GUI_MSG_CLICKED: { iControl = message.GetSenderId(); if (iControl == CONTROL_LIST_CHANNELS) { if (!m_bMovingMode) { int iAction = message.GetParam1(); int iItem = m_viewControl.GetSelectedItem(); /* Check file item is in list range and get his pointer */ if (iItem < 0 || iItem >= (int)m_channelItems->Size()) return true; /* Process actions */ if (iAction == ACTION_SELECT_ITEM || iAction == ACTION_CONTEXT_MENU || iAction == ACTION_MOUSE_RIGHT_CLICK) { /* Show Contextmenu */ OnPopupMenu(iItem); } } else { CFileItemPtr pItem = m_channelItems->Get(m_iSelected); if (pItem) { pItem->SetProperty("Changed", true); pItem->Select(false); m_bMovingMode = false; m_bContainsChanges = true; return true; } else return false; } } else if (iControl == BUTTON_OK) { SaveList(); Close(); return true; } else if (iControl == BUTTON_APPLY) { SaveList(); return true; } else if (iControl == BUTTON_CANCEL) { Close(); return true; } else if (iControl == BUTTON_RADIO_TV) { if (m_bContainsChanges) { // prompt user for confirmation of channel record CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return true; pDialog->SetHeading(20052); pDialog->SetLine(0, ""); pDialog->SetLine(1, 19212); pDialog->SetLine(2, 20103); pDialog->DoModal(); if (pDialog->IsConfirmed()) SaveList(); } m_iSelected = 0; m_bMovingMode = false; m_bContainsChanges = false; m_bIsRadio = !m_bIsRadio; SetProperty("IsRadio", m_bIsRadio ? "true" : ""); Update(); SetData(m_iSelected); return true; } else if (iControl == RADIOBUTTON_ACTIVE) { CGUIRadioButtonControl *pRadioButton = (CGUIRadioButtonControl *)GetControl(RADIOBUTTON_ACTIVE); if (pRadioButton) { CFileItemPtr pItem = m_channelItems->Get(m_iSelected); if (pItem) { pItem->SetProperty("Changed", true); pItem->SetProperty("ActiveChannel", pRadioButton->IsSelected()); m_bContainsChanges = true; Renumber(); } } } else if (iControl == EDIT_NAME) { CGUIEditControl *pEdit = (CGUIEditControl *)GetControl(EDIT_NAME); if (pEdit) { CFileItemPtr pItem = m_channelItems->Get(m_iSelected); if (pItem) { pItem->SetProperty("Changed", true); pItem->SetProperty("Name", pEdit->GetLabel2()); m_bContainsChanges = true; } } } else if (iControl == BUTTON_CHANNEL_LOGO) { CFileItemPtr pItem = m_channelItems->Get(m_iSelected); if (!pItem) return false; if (g_settings.GetCurrentProfile().canWriteSources() && !g_passwordManager.IsProfileLockUnlocked()) return false; else if (!g_passwordManager.IsMasterLockUnlocked(true)) return false; // setup our thumb list CFileItemList items; // add the current thumb, if available if (!pItem->GetProperty("Icon").IsEmpty()) { CFileItemPtr current(new CFileItem("thumb://Current", false)); current->SetThumbnailImage(pItem->GetPVRChannelInfoTag()->IconPath()); current->SetLabel(g_localizeStrings.Get(20016)); items.Add(current); } else if (pItem->HasThumbnail()) { // already have a thumb that the share doesn't know about - must be a local one, so we mayaswell reuse it. CFileItemPtr current(new CFileItem("thumb://Current", false)); current->SetThumbnailImage(pItem->GetThumbnailImage()); current->SetLabel(g_localizeStrings.Get(20016)); items.Add(current); } // and add a "no thumb" entry as well CFileItemPtr nothumb(new CFileItem("thumb://None", false)); nothumb->SetIconImage(pItem->GetIconImage()); nothumb->SetLabel(g_localizeStrings.Get(20018)); items.Add(nothumb); CStdString strThumb; VECSOURCES shares; if (g_guiSettings.GetString("pvrmenu.iconpath") != "") { CMediaSource share1; share1.strPath = g_guiSettings.GetString("pvrmenu.iconpath"); share1.strName = g_localizeStrings.Get(19018); shares.push_back(share1); } g_mediaManager.GetLocalDrives(shares); if (!CGUIDialogFileBrowser::ShowAndGetImage(items, shares, g_localizeStrings.Get(1030), strThumb)) return false; if (strThumb == "thumb://Current") return true; if (strThumb == "thumb://None") strThumb = ""; pItem->SetProperty("Icon", strThumb); pItem->SetProperty("Changed", true); m_bContainsChanges = true; return true; } else if (iControl == RADIOBUTTON_USEEPG) { CGUIRadioButtonControl *pRadioButton = (CGUIRadioButtonControl *)GetControl(RADIOBUTTON_USEEPG); if (pRadioButton) { CFileItemPtr pItem = m_channelItems->Get(m_iSelected); if (pItem) { pItem->SetProperty("Changed", true); pItem->SetProperty("UseEPG", pRadioButton->IsSelected()); m_bContainsChanges = true; } } } else if (iControl == SPIN_EPGSOURCE_SELECTION) { /// TODO: Add EPG scraper support return true; CGUISpinControlEx *pSpin = (CGUISpinControlEx *)GetControl(SPIN_EPGSOURCE_SELECTION); if (pSpin) { CFileItemPtr pItem = m_channelItems->Get(m_iSelected); if (pItem) { pItem->SetProperty("EPGSource", (int)0); pItem->SetProperty("Changed", true); m_bContainsChanges = true; return true; } } } else if (iControl == BUTTON_GROUP_MANAGER) { /* Load group manager dialog */ CGUIDialogPVRGroupManager* pDlgInfo = (CGUIDialogPVRGroupManager*)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_GROUP_MANAGER); if (!pDlgInfo) return false; pDlgInfo->SetRadio(m_bIsRadio); /* Open dialog window */ pDlgInfo->DoModal(); return true; } else if (iControl == BUTTON_EDIT_CHANNEL) { CFileItemPtr pItem = m_channelItems->Get(m_iSelected); if (!pItem) return false; if (pItem->GetPropertyBOOL("Virtual")) { CStdString strURL = pItem->GetProperty("StreamURL"); if (CGUIDialogKeyboard::ShowAndGetInput(strURL, g_localizeStrings.Get(19214), false)) pItem->SetProperty("StreamURL", strURL); return true; } CGUIDialogOK::ShowAndGetInput(19033,19038,0,0); return true; } else if (iControl == BUTTON_DELETE_CHANNEL) { CFileItemPtr pItem = m_channelItems->Get(m_iSelected); if (!pItem) return false; // prompt user for confirmation of channel record CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return true; pDialog->SetHeading(19211); pDialog->SetLine(0, ""); pDialog->SetLine(1, 750); pDialog->SetLine(2, ""); pDialog->DoModal(); if (pDialog->IsConfirmed()) { if (pItem->GetPropertyBOOL("Virtual")) { CPVRDatabase *database = CPVRManager::Get()->GetTVDatabase(); database->Open(); database->Delete(*pItem->GetPVRChannelInfoTag()); database->Close(); m_channelItems->Remove(m_iSelected); m_viewControl.SetItems(*m_channelItems); Renumber(); return true; } CGUIDialogOK::ShowAndGetInput(19033,19038,0,0); } return true; } else if (iControl == BUTTON_NEW_CHANNEL) { std::vector<long> clients; CGUIDialogSelect* pDlgSelect = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT); if (!pDlgSelect) return false; pDlgSelect->SetHeading(19213); // Select Client pDlgSelect->Add(g_localizeStrings.Get(19209)); clients.push_back(XBMC_VIRTUAL_CLIENTID); std::map<long, CStdString> clientMap; if (CPVRManager::GetClients()->GetClients(&clientMap) > 0) { std::map<long,CStdString>::iterator itr; for (itr = clientMap.begin() ; itr != clientMap.end(); itr++) { clients.push_back((*itr).first); pDlgSelect->Add(clientMap[(*itr).first]); } } pDlgSelect->DoModal(); int selection = pDlgSelect->GetSelectedLabel(); if (selection >= 0 && selection <= (int) clients.size()) { int clientID = clients[selection]; if (clientID == XBMC_VIRTUAL_CLIENTID) { CStdString strURL = ""; if (CGUIDialogKeyboard::ShowAndGetInput(strURL, g_localizeStrings.Get(19214), false)) { if (!strURL.IsEmpty()) { CPVRChannel newchannel(m_bIsRadio); newchannel.SetChannelName(g_localizeStrings.Get(19204)); newchannel.SetEPGEnabled(false); newchannel.SetVirtual(true); newchannel.SetStreamURL(strURL); newchannel.SetClientID(XBMC_VIRTUAL_CLIENTID); CPVRDatabase *database = CPVRManager::Get()->GetTVDatabase(); database->Open(); database->Persist(newchannel); database->Close(); CFileItemPtr channel(new CFileItem(newchannel)); if (channel) { channel->SetProperty("ActiveChannel", true); channel->SetProperty("Name", g_localizeStrings.Get(19204)); channel->SetProperty("UseEPG", false); channel->SetProperty("Icon", newchannel.IconPath()); channel->SetProperty("EPGSource", (int)0); channel->SetProperty("ClientName", g_localizeStrings.Get(19209)); m_channelItems->AddFront(channel, m_iSelected); m_viewControl.SetItems(*m_channelItems); Renumber(); } } } } else { CGUIDialogOK::ShowAndGetInput(19033,19038,0,0); } } return true; } } break; } return CGUIDialog::OnMessage(message); }
bool CGUIDialogPVRGuideInfo::OnMessage(CGUIMessage& message) { switch (message.GetMessage()) { case GUI_MSG_WINDOW_INIT: { CGUIDialog::OnMessage(message); Update(); break; } case GUI_MSG_CLICKED: { int iControl = message.GetSenderId(); if (iControl == CONTROL_BTN_OK) { Close(); return true; } else if (iControl == CONTROL_BTN_RECORD) { if (((CPVREpgInfoTag *)m_progItem->GetEPGInfoTag())->ChannelTag()->ChannelNumber() > 0) { if (((CPVREpgInfoTag *) m_progItem->GetEPGInfoTag())->Timer() == NULL) { // prompt user for confirmation of channel record CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (pDialog) { pDialog->SetHeading(264); pDialog->SetLine(0, ""); pDialog->SetLine(1, m_progItem->GetEPGInfoTag()->Title()); pDialog->SetLine(2, ""); pDialog->DoModal(); if (pDialog->IsConfirmed()) { CPVREpgInfoTag *tag = (CPVREpgInfoTag *) m_progItem->GetEPGInfoTag(); CPVRTimerInfoTag *newtimer = CPVRTimerInfoTag::CreateFromEpg(*tag); CFileItem *item = new CFileItem(*newtimer); CPVRTimers::AddTimer(*item); } } } else { CGUIDialogOK::ShowAndGetInput(19033,19067,0,0); } } Close(); return true; } else if (iControl == CONTROL_BTN_SWITCH) { Close(); if (!g_application.PlayFile(CFileItem(*((CPVREpgInfoTag *)m_progItem->GetEPGInfoTag())->ChannelTag()))) { CGUIDialogOK::ShowAndGetInput(19033,0,19035,0); return false; } return true; } } } return CGUIDialog::OnMessage(message); }
bool CGUIDialogBoxeeCtx::OnMessage(CGUIMessage &message) { switch (message.GetMessage()) { case GUI_MSG_ITEM_LOADED: { // New data received from the item loader, update existing item CFileItemPtr pItem ((CFileItem *)message.GetPointer()); message.SetPointer(NULL); if (pItem) { m_item = *pItem; CGUIMessage msg(GUI_MSG_LABEL_RESET, GetID(), INFO_HIDDEN_LIST, 0); OnMessage(msg); CGUIMessage winmsg(GUI_MSG_LABEL_ADD, GetID(), INFO_HIDDEN_LIST, 0, 0, pItem); OnMessage(winmsg); CGUIMessage ref1(GUI_MSG_REFRESH_THUMBS, GetID(), IMG1); OnMessage(ref1); CGUIMessage ref2(GUI_MSG_REFRESH_THUMBS, GetID(), IMG2); OnMessage(ref2); CGUIMessage ref3(GUI_MSG_REFRESH_THUMBS, GetID(), IMG3); OnMessage(ref3); CGUIMessage ref4(GUI_MSG_REFRESH_THUMBS, GetID(), IMG4); OnMessage(ref4); } return true; } case GUI_MSG_CLICKED: { unsigned int iControl = message.GetSenderId(); if (iControl == BTN_MORE_INFO) { OnMoreInfo(); return true; } else if (iControl == BTN_RATE) { bool bLike; if (CGUIDialogBoxeeRate::ShowAndGetInput(bLike)) { BoxeeUtils::Rate(&m_item, bLike); g_application.m_guiDialogKaiToast.QueueNotification(CGUIDialogKaiToast::ICON_STAR, "", g_localizeStrings.Get(51034), 5000 , KAI_YELLOW_COLOR, KAI_GREY_COLOR); } } else if (iControl == BTN_SHARE) { CGUIDialogBoxeeShare *pShare = (CGUIDialogBoxeeShare *)g_windowManager.GetWindow(WINDOW_DIALOG_BOXEE_SHARE); if (pShare) { pShare->SetItem(&m_item); pShare->DoModal(); } else { CLog::Log(LOGERROR,"CGUIDialogBoxeeCtx::OnMessage - GUI_MSG_CLICKED - BTN_SHARE - FAILED to get WINDOW_DIALOG_BOXEE_SHARE (share)"); } } else if (iControl == BTN_PRESET) { if (m_item.GetPropertyBOOL("IsPreset")) { CGUIDialogYesNo* dlgYesNo = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (dlgYesNo) { dlgYesNo->SetHeading(51020); dlgYesNo->SetLine(0, 51021); dlgYesNo->SetLine(1, m_item.GetLabel() + "?"); dlgYesNo->SetLine(2, ""); dlgYesNo->DoModal(); if (dlgYesNo->IsConfirmed()) { g_settings.DeleteSource(GetItemShareType(), m_item.GetProperty("ShareName"), m_item.m_strPath); CGUIWindow *pWindow = g_windowManager.GetWindow(g_windowManager.GetActiveWindow()); if (pWindow) { CGUIMessage msg(GUI_MSG_REFRESH_APPS, 0, 0); pWindow->OnMessage(msg); } } } } else { CMediaSource newShare; newShare.strPath = m_item.m_strPath; newShare.strName = m_item.GetLabel(); if (m_item.HasProperty("OriginalThumb") && !m_item.GetProperty("OriginalThumb").IsEmpty()) newShare.m_strThumbnailImage = m_item.GetProperty("OriginalThumb"); else newShare.m_strThumbnailImage = m_item.GetThumbnailImage(); newShare.vecPaths.push_back(m_item.m_strPath); g_settings.AddShare(GetItemShareType(), newShare); } Close(); return true; } else if (iControl == BTN_QUALITY) { return HandleQualityList(); } } break; case GUI_MSG_WINDOW_DEINIT: case GUI_MSG_VISUALISATION_UNLOADING: { } break; case GUI_MSG_VISUALISATION_LOADED: { } } return CGUIDialog::OnMessage(message); }
void CAddonStatusHandler::Process() { CSingleLock lock(m_critSection); CStdString heading; heading.Format("%s: %s", TranslateType(m_addon->Type(), true).c_str(), m_addon->Name().c_str()); /* AddOn lost connection to his backend (for ones that use Network) */ if (m_status == ADDON_STATUS_LOST_CONNECTION && m_addon->Type() != ADDON_PVRDLL) // TODO display a proper message for pvr addons, but don't popup a dialog that requires user action { CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialog) return; pDialog->SetHeading(heading); pDialog->SetLine(1, 24070); pDialog->SetLine(2, 24073); //send message and wait for user input ThreadMessage tMsg = {TMSG_DIALOG_DOMODAL, WINDOW_DIALOG_YES_NO, g_windowManager.GetActiveWindow()}; g_application.getApplicationMessenger().SendMessage(tMsg, true); if (pDialog->IsConfirmed()) CAddonMgr::Get().GetCallbackForType(m_addon->Type())->RequestRestart(m_addon, false); } /* Request to restart the AddOn and data structures need updated */ else if (m_status == ADDON_STATUS_NEED_RESTART) { CGUIDialogOK* pDialog = (CGUIDialogOK*)g_windowManager.GetWindow(WINDOW_DIALOG_OK); if (!pDialog) return; pDialog->SetHeading(heading); pDialog->SetLine(1, 24074); //send message and wait for user input ThreadMessage tMsg = {TMSG_DIALOG_DOMODAL, WINDOW_DIALOG_OK, g_windowManager.GetActiveWindow()}; g_application.getApplicationMessenger().SendMessage(tMsg, true); CAddonMgr::Get().GetCallbackForType(m_addon->Type())->RequestRestart(m_addon, true); } /* Some required settings are missing/invalid */ else if ((m_status == ADDON_STATUS_NEED_SETTINGS) || (m_status == ADDON_STATUS_NEED_SAVEDSETTINGS)) { CGUIDialogYesNo* pDialogYesNo = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (!pDialogYesNo) return; pDialogYesNo->SetHeading(heading); pDialogYesNo->SetLine(1, 24070); pDialogYesNo->SetLine(2, 24072); pDialogYesNo->SetLine(3, m_message); //send message and wait for user input ThreadMessage tMsg = {TMSG_DIALOG_DOMODAL, WINDOW_DIALOG_YES_NO, g_windowManager.GetActiveWindow()}; g_application.getApplicationMessenger().SendMessage(tMsg, true); if (!pDialogYesNo->IsConfirmed()) return; if (!m_addon->HasSettings()) return; if (CGUIDialogAddonSettings::ShowAndGetInput(m_addon)) { //todo doesn't dialogaddonsettings save these automatically? should do m_addon->SaveSettings(); CAddonMgr::Get().GetCallbackForType(m_addon->Type())->RequestRestart(m_addon, true); } } /* A unknown event has occurred */ else if (m_status == ADDON_STATUS_UNKNOWN) { //CAddonMgr::Get().DisableAddon(m_addon->ID()); CGUIDialogOK* pDialog = (CGUIDialogOK*)g_windowManager.GetWindow(WINDOW_DIALOG_OK); if (!pDialog) return; pDialog->SetHeading(heading); pDialog->SetLine(1, 24070); pDialog->SetLine(2, 24071); pDialog->SetLine(3, m_message); //send message and wait for user input ThreadMessage tMsg = {TMSG_DIALOG_DOMODAL, WINDOW_DIALOG_OK, g_windowManager.GetActiveWindow()}; g_application.getApplicationMessenger().SendMessage(tMsg, true); } }