本文整理汇总了C++中CGUIDialogKaiToast类的典型用法代码示例。如果您正苦于以下问题:C++ CGUIDialogKaiToast类的具体用法?C++ CGUIDialogKaiToast怎么用?C++ CGUIDialogKaiToast使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CGUIDialogKaiToast类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPostInstall
void CAddonInstallJob::OnPostInstall(bool reloadAddon)
{
if (m_addon->Type() < ADDON_VIZ_LIBRARY && g_settings.m_bAddonNotifications)
{
CGUIDialogKaiToast::QueueNotification(m_addon->Icon(),
m_addon->Name(),
g_localizeStrings.Get(m_update ? 24065 : 24064),
TOAST_DISPLAY_TIME,false,
TOAST_DISPLAY_TIME);
}
if (m_addon->Type() == ADDON_SKIN)
{
if (reloadAddon || (!m_update && CGUIDialogYesNo::ShowAndGetInput(m_addon->Name(),
g_localizeStrings.Get(24099),"","")))
{
g_guiSettings.SetString("lookandfeel.skin",m_addon->ID().c_str());
CGUIDialogKaiToast *toast = (CGUIDialogKaiToast *)g_windowManager.GetWindow(WINDOW_DIALOG_KAI_TOAST);
if (toast)
{
toast->ResetTimer();
toast->Close(true);
}
g_application.getApplicationMessenger().ExecBuiltIn("ReloadSkin");
}
}
}
示例2: gc
void CPythonInvoker::onError()
{
CPyThreadState releaseGil;
CSingleLock gc(g_graphicsContext);
CGUIDialogKaiToast *pDlgToast = (CGUIDialogKaiToast*)g_windowManager.GetWindow(WINDOW_DIALOG_KAI_TOAST);
if (pDlgToast != NULL)
{
CStdString desc;
CStdString script;
if (m_addon.get() != NULL)
script = m_addon->Name();
else
{
CStdString path;
URIUtils::Split(m_sourceFile.c_str(), path, script);
if (script.Equals("default.py"))
{
CStdString path2;
URIUtils::RemoveSlashAtEnd(path);
URIUtils::Split(path, path2, script);
}
}
desc = StringUtils::Format(g_localizeStrings.Get(2100).c_str(), script.c_str());
pDlgToast->QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(257), desc);
}
}
示例3: OnPostInstall
void CAddonInstallJob::OnPostInstall(bool reloadAddon)
{
if (m_addon->Type() < ADDON_VIZ_LIBRARY && CSettings::Get().GetBool("general.addonnotifications"))
{
CGUIDialogKaiToast::QueueNotification(m_addon->Icon(),
m_addon->Name(),
g_localizeStrings.Get(m_update ? 24065 : 24064),
TOAST_DISPLAY_TIME,false,
TOAST_DISPLAY_TIME);
}
if (m_addon->Type() == ADDON_SKIN)
{
if (reloadAddon || (!m_update && CGUIDialogYesNo::ShowAndGetInput(m_addon->Name(),
g_localizeStrings.Get(24099),"","")))
{
CGUIDialogKaiToast *toast = (CGUIDialogKaiToast *)g_windowManager.GetWindow(WINDOW_DIALOG_KAI_TOAST);
if (toast)
{
toast->ResetTimer();
toast->Close(true);
}
if (CSettings::Get().GetString("lookandfeel.skin") == m_addon->ID())
CApplicationMessenger::Get().ExecBuiltIn("ReloadSkin", true);
else
CSettings::Get().SetString("lookandfeel.skin",m_addon->ID().c_str());
}
}
if (m_addon->Type() == ADDON_SERVICE)
{
CAddonMgr::Get().DisableAddon(m_addon->ID(),!reloadAddon); //return it into state it was before OnPreInstall()
if (reloadAddon) // reload/start it if it was running
{
// regrab from manager to have the correct path set
AddonPtr addon;
CAddonMgr::Get().GetAddon(m_addon->ID(), addon);
boost::shared_ptr<CService> service = boost::dynamic_pointer_cast<CService>(addon);
if (service)
service->Start();
}
}
if (m_addon->Type() == ADDON_REPOSITORY)
{
VECADDONS addons;
addons.push_back(m_addon);
CJobManager::GetInstance().AddJob(new CRepositoryUpdateJob(addons), &CAddonInstaller::Get());
}
if (m_addon->Type() == ADDON_PVRDLL)
{
// (re)start the pvr manager
PVR::CPVRManager::Get().Start(true);
}
}
示例4: gc
void CPythonInvoker::onError()
{
CPyThreadState releaseGil;
CSingleLock gc(g_graphicsContext);
CGUIDialogKaiToast *pDlgToast = (CGUIDialogKaiToast*)g_windowManager.GetWindow(WINDOW_DIALOG_KAI_TOAST);
if (pDlgToast != NULL)
{
std::string message;
if (m_addon && !m_addon->Name().empty())
message = StringUtils::Format(g_localizeStrings.Get(2102).c_str(), m_addon->Name().c_str());
else if (m_sourceFile == CSpecialProtocol::TranslatePath("special://profile/autoexec.py"))
message = StringUtils::Format(g_localizeStrings.Get(2102).c_str(), "autoexec.py");
else
message = g_localizeStrings.Get(2103);
pDlgToast->QueueNotification(CGUIDialogKaiToast::Error, message, g_localizeStrings.Get(2104));
}
}
示例5: OnPostInstall
void CLanguageResource::OnPostInstall(bool update, bool modal)
{
if (IsInUse() ||
(!update && !modal && CGUIDialogYesNo::ShowAndGetInput(Name(), 24132)))
{
CGUIDialogKaiToast *toast = (CGUIDialogKaiToast *)g_windowManager.GetWindow(WINDOW_DIALOG_KAI_TOAST);
if (toast)
{
toast->ResetTimer();
toast->Close(true);
}
if (IsInUse())
g_langInfo.SetLanguage(ID());
else
CSettings::Get().SetString(LANGUAGE_SETTING, ID());
}
}
示例6: gc
void CPythonInvoker::onError(const std::string &exceptionType /* = "" */, const std::string &exceptionValue /* = "" */, const std::string &exceptionTraceback /* = "" */)
{
CPyThreadState releaseGil;
CSingleLock gc(CServiceBroker::GetWinSystem()->GetGfxContext());
CGUIDialogKaiToast *pDlgToast = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogKaiToast>(WINDOW_DIALOG_KAI_TOAST);
if (pDlgToast != NULL)
{
std::string message;
if (m_addon && !m_addon->Name().empty())
message = StringUtils::Format(g_localizeStrings.Get(2102).c_str(), m_addon->Name().c_str());
else if (m_sourceFile == CSpecialProtocol::TranslatePath("special://profile/autoexec.py"))
message = StringUtils::Format(g_localizeStrings.Get(2102).c_str(), "autoexec.py");
else
message = g_localizeStrings.Get(2103);
pDlgToast->QueueNotification(CGUIDialogKaiToast::Error, message, g_localizeStrings.Get(2104));
}
}
示例7: OnPostInstall
void CLanguageResource::OnPostInstall(bool update, bool modal)
{
if (IsInUse() ||
(!update && !modal &&
(HELPERS::ShowYesNoDialogText(CVariant{Name()}, CVariant{24132}) == DialogResponse::YES)))
{
CGUIDialogKaiToast *toast = (CGUIDialogKaiToast *)g_windowManager.GetWindow(WINDOW_DIALOG_KAI_TOAST);
if (toast)
{
toast->ResetTimer();
toast->Close(true);
}
if (IsInUse())
g_langInfo.SetLanguage(ID());
else
CServiceBroker::GetSettings().SetString(CSettings::SETTING_LOCALE_LANGUAGE, ID());
}
}
示例8: PyEval_AcquireLock
//.........这里部分代码省略.........
}
else
CLog::Log(LOGERROR, "%s not found!", m_source);
}
else
{
//run script
PyRun_String(m_source, m_Py_file_input, moduleDict, moduleDict);
}
}
catch (const XbmcCommons::Exception& e)
{
e.LogThrowMessage();
}
catch (...)
{
CLog::Log(LOGERROR, "failure in %s", m_source);
}
}
if (!PyErr_Occurred())
CLog::Log(LOGINFO, "Scriptresult: Success");
else if (PyErr_ExceptionMatches(PyExc_SystemExit))
CLog::Log(LOGINFO, "Scriptresult: Aborted");
else
{
PythonBindings::PythonToCppException e;
e.LogThrowMessage();
{
CPyThreadState releaseGil;
CSingleLock gc(g_graphicsContext);
CGUIDialogKaiToast *pDlgToast = (CGUIDialogKaiToast*)g_windowManager.GetWindow(WINDOW_DIALOG_KAI_TOAST);
if (pDlgToast)
{
CStdString desc;
CStdString path;
CStdString script;
URIUtils::Split(m_source, path, script);
if (script.Equals("default.py"))
{
CStdString path2;
URIUtils::RemoveSlashAtEnd(path);
URIUtils::Split(path, path2, script);
}
desc.Format(g_localizeStrings.Get(2100), script);
pDlgToast->QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(257), desc);
}
}
}
PyObject *m = PyImport_AddModule((char*)"xbmc");
if(!m || PyObject_SetAttrString(m, (char*)"abortRequested", PyBool_FromLong(1)))
CLog::Log(LOGERROR, "Scriptresult: failed to set abortRequested");
// make sure all sub threads have finished
for(PyThreadState* s = state->interp->tstate_head, *old = NULL; s;)
{
if(s == state)
{
s = s->next;
continue;
}
if(old != s)
示例9: QueueNotification
void CGUIDialogKaiToast::QueueNotification(const CStdString& aImageFile, const CStdString& aCaption, const CStdString& aDescription, unsigned int displayTime /*= TOAST_DISPLAY_TIME*/, bool withSound /*= true*/, unsigned int messageTime /*= TOAST_MESSAGE_TIME*/)
{
CGUIDialogKaiToast *toast = (CGUIDialogKaiToast *)g_windowManager.GetWindow(WINDOW_DIALOG_KAI_TOAST);
if (toast)
toast->AddToQueue(aImageFile, aCaption, aDescription, displayTime, withSound, messageTime);
}
示例10: strcpy
//.........这里部分代码省略.........
setState(InvokerStateFailed);
CLog::Log(LOGERROR, "CPythonInvoker(%d, %s): failure in script", GetId(), m_source);
failed = true;
}
}
bool systemExitThrown = false;
if (!failed && !PyErr_Occurred())
{
CLog::Log(LOGINFO, "CPythonInvoker(%d, %s): script successfully run", GetId(), m_source);
setState(InvokerStateDone);
}
else if (PyErr_ExceptionMatches(PyExc_SystemExit))
{
systemExitThrown = true;
CLog::Log(LOGINFO, "CPythonInvoker(%d, %s): script aborted", GetId(), m_source);
setState(InvokerStateFailed);
}
else
{
setState(InvokerStateFailed);
// if it failed with an exception we already logged the details
if (!failed)
{
PythonBindings::PythonToCppException e;
e.LogThrowMessage();
}
{
CPyThreadState releaseGil;
CSingleLock gc(g_graphicsContext);
CGUIDialogKaiToast *pDlgToast = (CGUIDialogKaiToast*)g_windowManager.GetWindow(WINDOW_DIALOG_KAI_TOAST);
if (pDlgToast != NULL)
{
CStdString desc;
CStdString script;
if (m_addon.get() != NULL)
script = m_addon->Name();
else
{
CStdString path;
URIUtils::Split(m_source, path, script);
if (script.Equals("default.py"))
{
CStdString path2;
URIUtils::RemoveSlashAtEnd(path);
URIUtils::Split(path, path2, script);
}
}
desc.Format(g_localizeStrings.Get(2100), script);
pDlgToast->QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(257), desc);
}
}
}
// no need to do anything else because the script has already stopped
if (failed)
return true;
PyObject *m = PyImport_AddModule((char*)"xbmc");
if (m == NULL || PyObject_SetAttrString(m, (char*)"abortRequested", PyBool_FromLong(1)))
CLog::Log(LOGERROR, "CPythonInvoker(%d, %s): failed to set abortRequested", GetId(), m_source);
示例11: PyEval_AcquireLock
//.........这里部分代码省略.........
if (exc_type != NULL && (pystring = PyObject_Str(exc_type)) != NULL && (PyString_Check(pystring)))
{
PyObject *tracebackModule;
CLog::Log(LOGINFO, "-->Python script returned the following error<--");
CLog::Log(LOGERROR, "Error Type: %s", PyString_AsString(PyObject_Str(exc_type)));
if (PyObject_Str(exc_value))
CLog::Log(LOGERROR, "Error Contents: %s", PyString_AsString(PyObject_Str(exc_value)));
tracebackModule = PyImport_ImportModule((char*)"traceback");
if (tracebackModule != NULL)
{
PyObject *tbList, *emptyString, *strRetval;
tbList = PyObject_CallMethod(tracebackModule, (char*)"format_exception", (char*)"OOO", exc_type, exc_value == NULL ? Py_None : exc_value, exc_traceback == NULL ? Py_None : exc_traceback);
emptyString = PyString_FromString("");
strRetval = PyObject_CallMethod(emptyString, (char*)"join", (char*)"O", tbList);
CLog::Log(LOGERROR, "%s", PyString_AsString(strRetval));
Py_DECREF(tbList);
Py_DECREF(emptyString);
Py_DECREF(strRetval);
Py_DECREF(tracebackModule);
}
CLog::Log(LOGINFO, "-->End of Python script error report<--");
}
else
{
pystring = NULL;
CLog::Log(LOGINFO, "<unknown exception type>");
}
CGUIDialogKaiToast *pDlgToast = (CGUIDialogKaiToast*)g_windowManager.GetWindow(WINDOW_DIALOG_KAI_TOAST);
if (pDlgToast)
{
CStdString desc;
CStdString path;
CStdString script;
URIUtils::Split(m_source, path, script);
if (script.Equals("default.py"))
{
CStdString path2;
URIUtils::RemoveSlashAtEnd(path);
URIUtils::Split(path, path2, script);
}
desc.Format(g_localizeStrings.Get(2100), script);
pDlgToast->QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(257), desc);
}
}
Py_XDECREF(exc_type);
Py_XDECREF(exc_value); // caller owns all 3
Py_XDECREF(exc_traceback); // already NULL'd out
Py_XDECREF(pystring);
}
PyObject *m = PyImport_AddModule((char*)"xbmc");
if(!m || PyObject_SetAttrString(m, (char*)"abortRequested", PyBool_FromLong(1)))
CLog::Log(LOGERROR, "Scriptresult: failed to set abortRequested");
// make sure all sub threads have finished
for(PyThreadState* s = state->interp->tstate_head, *old = NULL; s;)
{
if(s == state)