本文整理汇总了C++中CAddonDll::Name方法的典型用法代码示例。如果您正苦于以下问题:C++ CAddonDll::Name方法的具体用法?C++ CAddonDll::Name怎么用?C++ CAddonDll::Name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAddonDll
的用法示例。
在下文中一共展示了CAddonDll::Name方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set_focus_id
//@{
bool Interface_GUIWindow::set_focus_id(void* kodiBase, void* handle, int control_id)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
CGUIAddonWindow* pAddonWindow = static_cast<CGUIAddonWindow*>(handle);
if (!addon || !pAddonWindow)
{
CLog::Log(
LOGERROR,
"Interface_GUIWindow::%s - invalid handler data (kodiBase='%p', handle='%p') on addon '%s'",
__FUNCTION__, kodiBase, handle, addon ? addon->ID().c_str() : "unknown");
return false;
}
if (!pAddonWindow->GetControl(control_id))
{
CLog::Log(LOGERROR, "Interface_GUIWindow - %s: %s - Control does not exist in window",
__FUNCTION__, addon->Name().c_str());
return false;
}
Interface_GUIGeneral::lock();
CGUIMessage msg(GUI_MSG_SETFOCUS, pAddonWindow->m_windowId, control_id);
pAddonWindow->OnMessage(msg);
Interface_GUIGeneral::unlock();
return true;
}
示例2: get_region
char* Interface_General::get_region(void* kodiBase, const char* id)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
if (addon == nullptr || id == nullptr)
{
CLog::Log(LOGERROR, "Interface_General::%s - invalid data (addon='%p', id='%p')", __FUNCTION__, addon, id);
return nullptr;
}
std::string result;
if (strcmpi(id, "datelong") == 0)
{
result = g_langInfo.GetDateFormat(true);
StringUtils::Replace(result, "DDDD", "%A");
StringUtils::Replace(result, "MMMM", "%B");
StringUtils::Replace(result, "D", "%d");
StringUtils::Replace(result, "YYYY", "%Y");
}
else if (strcmpi(id, "dateshort") == 0)
{
result = g_langInfo.GetDateFormat(false);
StringUtils::Replace(result, "MM", "%m");
StringUtils::Replace(result, "DD", "%d");
#ifdef TARGET_WINDOWS
StringUtils::Replace(result, "M", "%#m");
StringUtils::Replace(result, "D", "%#d");
#else
StringUtils::Replace(result, "M", "%-m");
StringUtils::Replace(result, "D", "%-d");
#endif
StringUtils::Replace(result, "YYYY", "%Y");
}
else if (strcmpi(id, "tempunit") == 0)
result = g_langInfo.GetTemperatureUnitString();
else if (strcmpi(id, "speedunit") == 0)
result = g_langInfo.GetSpeedUnitString();
else if (strcmpi(id, "time") == 0)
{
result = g_langInfo.GetTimeFormat();
StringUtils::Replace(result, "H", "%H");
StringUtils::Replace(result, "h", "%I");
StringUtils::Replace(result, "mm", "%M");
StringUtils::Replace(result, "ss", "%S");
StringUtils::Replace(result, "xx", "%p");
}
else if (strcmpi(id, "meridiem") == 0)
result = StringUtils::Format("%s/%s",
g_langInfo.GetMeridiemSymbol(MeridiemSymbolAM).c_str(),
g_langInfo.GetMeridiemSymbol(MeridiemSymbolPM).c_str());
else
{
CLog::Log(LOGERROR, "Interface_General::%s - add-on '%s' requests invalid id '%s'",
__FUNCTION__, addon->Name().c_str(), id);
return nullptr;
}
char* buffer = strdup(result.c_str());
return buffer;
}
示例3: get_addon_info
char* Interface_General::get_addon_info(void* kodiBase, const char* id)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
if (addon == nullptr || id == nullptr)
{
CLog::Log(LOGERROR, "Interface_General::%s - invalid data (addon='%p', id='%p')", __FUNCTION__, addon, id);
return nullptr;
}
std::string str;
if (strcmpi(id, "author") == 0)
str = addon->Author();
else if (strcmpi(id, "changelog") == 0)
str = addon->ChangeLog();
else if (strcmpi(id, "description") == 0)
str = addon->Description();
else if (strcmpi(id, "disclaimer") == 0)
str = addon->Disclaimer();
else if (strcmpi(id, "fanart") == 0)
str = addon->FanArt();
else if (strcmpi(id, "icon") == 0)
str = addon->Icon();
else if (strcmpi(id, "id") == 0)
str = addon->ID();
else if (strcmpi(id, "name") == 0)
str = addon->Name();
else if (strcmpi(id, "path") == 0)
str = addon->Path();
else if (strcmpi(id, "profile") == 0)
str = addon->Profile();
else if (strcmpi(id, "summary") == 0)
str = addon->Summary();
else if (strcmpi(id, "type") == 0)
str = ADDON::CAddonInfo::TranslateType(addon->Type());
else if (strcmpi(id, "version") == 0)
str = addon->Version().asString();
else
{
CLog::Log(LOGERROR, "Interface_General::%s - add-on '%s' requests invalid id '%s'",
__FUNCTION__, addon->Name().c_str(), id);
return nullptr;
}
char* buffer = strdup(str.c_str());
return buffer;
}
示例4: queue_notification
bool Interface_General::queue_notification(void* kodiBase, int type, const char* header,
const char* message, const char* imageFile,
unsigned int displayTime, bool withSound,
unsigned int messageTime)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
if (addon == nullptr || message == nullptr)
{
CLog::Log(LOGERROR, "Interface_General::%s - invalid data (addon='%p', message='%p')", __FUNCTION__, addon, message);
return false;
}
std::string usedHeader;
if (header && strlen(header) > 0)
usedHeader = header;
else
usedHeader = addon->Name();
QueueMsg qtype = static_cast<QueueMsg>(type);
if (qtype != QUEUE_OWN_STYLE)
{
CGUIDialogKaiToast::eMessageType usedType;
switch (qtype)
{
case QUEUE_WARNING:
usedType = CGUIDialogKaiToast::Warning;
withSound = true;
CLog::Log(LOGDEBUG, "Interface_General::%s - %s - Warning Message: '%s'", __FUNCTION__, addon->Name().c_str(), message);
break;
case QUEUE_ERROR:
usedType = CGUIDialogKaiToast::Error;
withSound = true;
CLog::Log(LOGDEBUG, "Interface_General::%s - %s - Error Message : '%s'", __FUNCTION__, addon->Name().c_str(), message);
break;
case QUEUE_INFO:
default:
usedType = CGUIDialogKaiToast::Info;
withSound = false;
CLog::Log(LOGDEBUG, "Interface_General::%s - %s - Info Message : '%s'", __FUNCTION__, addon->Name().c_str(), message);
break;
}
if (imageFile && strlen(imageFile) > 0)
{
CLog::Log(LOGERROR, "Interface_General::%s - To use given image file '%s' must be type value set to 'QUEUE_OWN_STYLE'", __FUNCTION__, imageFile);
}
CGUIDialogKaiToast::QueueNotification(usedType, usedHeader, message, 3000, withSound);
}
else
{
CGUIDialogKaiToast::QueueNotification(imageFile, usedHeader, message, displayTime, withSound, messageTime);
}
return true;
}
示例5: addon_log_msg
void CAddonDll::addon_log_msg(void* kodiBase, const int addonLogLevel, const char* strMessage)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
if (addon == nullptr)
{
CLog::Log(LOGERROR, "addon_log_msg(...) called with empty kodi instance pointer");
return;
}
int logLevel = LOGNONE;
switch (addonLogLevel)
{
case ADDON_LOG_FATAL:
logLevel = LOGFATAL;
break;
case ADDON_LOG_SEVERE:
logLevel = LOGSEVERE;
break;
case ADDON_LOG_ERROR:
logLevel = LOGERROR;
break;
case ADDON_LOG_WARNING:
logLevel = LOGWARNING;
break;
case ADDON_LOG_NOTICE:
logLevel = LOGNOTICE;
break;
case ADDON_LOG_INFO:
logLevel = LOGINFO;
break;
case ADDON_LOG_DEBUG:
logLevel = LOGDEBUG;
break;
default:
break;
}
CLog::Log(logLevel, "AddOnLog: %s: %s", addon->Name().c_str(), strMessage);
}
示例6: get_focus_id
int Interface_GUIWindow::get_focus_id(void* kodiBase, void* handle)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
CGUIAddonWindow* pAddonWindow = static_cast<CGUIAddonWindow*>(handle);
if (!addon || !pAddonWindow)
{
CLog::Log(
LOGERROR,
"Interface_GUIWindow::%s - invalid handler data (kodiBase='%p', handle='%p') on addon '%s'",
__FUNCTION__, kodiBase, handle, addon ? addon->ID().c_str() : "unknown");
return -1;
}
Interface_GUIGeneral::lock();
int control_id = pAddonWindow->GetFocusedControlID();
Interface_GUIGeneral::unlock();
if (control_id == -1)
CLog::Log(LOGERROR, "Interface_GUIWindow - %s: %s - No control in this window has focus",
__FUNCTION__, addon->Name().c_str());
return control_id;
}
示例7: get_list_item
void* Interface_GUIWindow::get_list_item(void* kodiBase, void* handle, int list_position)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
CGUIAddonWindow* pAddonWindow = static_cast<CGUIAddonWindow*>(handle);
if (!addon || !pAddonWindow)
{
CLog::Log(LOGERROR, "Interface_GUIWindow::%s - invalid handler data (kodiBase='%p', handle='%p') on addon '%s'",
__FUNCTION__, addon, handle, addon ? addon->ID().c_str() : "unknown");
return nullptr;
}
Interface_GUIGeneral::lock();
CFileItemPtr* pItem(pAddonWindow->GetListItem(list_position));
if (pItem == nullptr || pItem->get() == nullptr)
{
CLog::Log(LOGERROR, "ADDON::Interface_GUIWindow - %s: %s - Index out of range", __FUNCTION__, addon->Name().c_str());
if (pItem)
{
delete pItem;
pItem = nullptr;
}
}
Interface_GUIGeneral::unlock();
return pItem;
}
示例8: create
//@{
void* Interface_GUIWindow::create(void* kodiBase, const char* xml_filename,
const char* default_skin, bool as_dialog, bool is_media)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
if (!addon || !xml_filename || !default_skin)
{
CLog::Log(LOGERROR, "Interface_GUIWindow::%s - invalid handler data (xml_filename='%p', default_skin='%p') on addon '%s'",
__FUNCTION__, xml_filename, default_skin, addon ? addon->ID().c_str() : "unknown");
return nullptr;
}
if (as_dialog && is_media)
{
CLog::Log(LOGWARNING, "Interface_GUIWindow::%s: %s/%s - addon tries to create dialog as media window who not allowed, contact Developer '%s' of this addon",
__FUNCTION__, CAddonInfo::TranslateType(addon->Type()).c_str(), addon->Name().c_str(), addon->Author().c_str());
}
RESOLUTION_INFO res;
std::string strSkinPath = g_SkinInfo->GetSkinPath(xml_filename, &res);
if (!XFILE::CFile::Exists(strSkinPath))
{
std::string str("none");
ADDON::CAddonInfo addonInfo(str, ADDON::ADDON_SKIN);
// Check for the matching folder for the skin in the fallback skins folder
std::string fallbackPath = URIUtils::AddFileToFolder(addon->Path(), "resources", "skins");
std::string basePath = URIUtils::AddFileToFolder(fallbackPath, g_SkinInfo->ID());
strSkinPath = g_SkinInfo->GetSkinPath(xml_filename, &res, basePath);
// Check for the matching folder for the skin in the fallback skins folder (if it exists)
if (XFILE::CFile::Exists(basePath))
{
addonInfo.SetPath(basePath);
ADDON::CSkinInfo skinInfo(addonInfo, res);
skinInfo.Start();
strSkinPath = skinInfo.GetSkinPath(xml_filename, &res);
}
if (!XFILE::CFile::Exists(strSkinPath))
{
// Finally fallback to the DefaultSkin as it didn't exist in either the Kodi Skin folder or the fallback skin folder
addonInfo.SetPath(URIUtils::AddFileToFolder(fallbackPath, default_skin));
ADDON::CSkinInfo skinInfo(addonInfo, res);
skinInfo.Start();
strSkinPath = skinInfo.GetSkinPath(xml_filename, &res);
if (!XFILE::CFile::Exists(strSkinPath))
{
CLog::Log(LOGERROR, "Interface_GUIWindow::%s: %s/%s - XML File '%s' for Window is missing, contact Developer '%s' of this addon",
__FUNCTION__, CAddonInfo::TranslateType(addon->Type()).c_str(), addon->Name().c_str(), strSkinPath.c_str(), addon->Author().c_str());
return nullptr;
}
}
}
int id = GetNextAvailableWindowId();
if (id < 0)
return nullptr;
CGUIWindow *window;
if (!as_dialog)
window = new CGUIAddonWindow(id, strSkinPath, addon, is_media);
else
window = new CGUIAddonWindowDialog(id, strSkinPath, addon);
Interface_GUIGeneral::lock();
g_windowManager.Add(window);
Interface_GUIGeneral::unlock();
if (!dynamic_cast<CGUIWindow*>(g_windowManager.GetWindow(id)))
{
CLog::Log(LOGERROR, "Interface_GUIWindow::%s - Requested window id '%i' does not exist for addon '%s'",
__FUNCTION__, id, addon->ID().c_str());
delete window;
return nullptr;
}
window->SetCoordsRes(res);
return window;
}
示例9: get_setting_string
bool CAddonDll::get_setting_string(void* kodiBase, const char* id, char** value)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
if (addon == nullptr || id == nullptr || value == nullptr)
{
CLog::Log(LOGERROR, "kodi::General::%s - invalid data (addon='%p', id='%p', value='%p')",
__FUNCTION__, kodiBase, static_cast<const void*>(id), static_cast<void*>(value));
return false;
}
if (!addon->ReloadSettings())
{
CLog::Log(LOGERROR, "kodi::General::%s - could't get settings for add-on '%s'", __FUNCTION__, addon->Name().c_str());
return false;
}
auto setting = addon->GetSettings()->GetSetting(id);
if (setting == nullptr)
{
CLog::Log(LOGERROR, "kodi::General::%s - can't find setting '%s' in '%s'", __FUNCTION__, id, addon->Name().c_str());
return false;
}
if (setting->GetType() != SettingType::String)
{
CLog::Log(LOGERROR, "kodi::General::%s - setting '%s' is not a string in '%s'", __FUNCTION__, id, addon->Name().c_str());
return false;
}
*value = strdup(std::static_pointer_cast<CSettingString>(setting)->GetValue().c_str());
return true;
}