plugins: allow hinticons for plugins

Default is <plugin>_hint.png; an entry 'hinticon=another_name' in
<plugin>.cfg overrides this; use icon in plugindir first; if not found
use icon in one of the other wellknown neutrino icon directories.


Origin commit data
------------------
Branch: ni/coolstream
Commit: ebbed374af
Author: vanhofen <vanhofen@gmx.de>
Date: 2014-10-06 (Mon, 06 Oct 2014)

Origin message was:
------------------
- plugins: allow hinticons for plugins

Default is <plugin>_hint.png; an entry 'hinticon=another_name' in
<plugin>.cfg overrides this; use icon in plugindir first; if not found
use icon in one of the other wellknown neutrino icon directories.


------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2014-10-06 22:04:13 +02:00
committed by [CST] Focus
parent 3578fc3d86
commit 65aa4db37b
3 changed files with 15 additions and 1 deletions

View File

@@ -122,6 +122,7 @@ void CPlugins::scanDir(const char *dir)
fname += '/';
new_plugin.cfgfile = fname.append(new_plugin.filename);
new_plugin.cfgfile.append(".cfg");
new_plugin.plugindir = dir;
bool plugin_ok = parseCfg(&new_plugin);
if (plugin_ok)
{
@@ -209,6 +210,7 @@ bool CPlugins::parseCfg(plugin *plugin_data)
plugin_data->hide = false;
plugin_data->type = CPlugins::P_TYPE_DISABLED;
plugin_data->integration = CPlugins::I_TYPE_DISABLED;
plugin_data->hinticon = plugin_data->filename + "_hint";
for (int i = 0; i < linecount; i++)
{
@@ -239,6 +241,10 @@ bool CPlugins::parseCfg(plugin *plugin_data)
{
plugin_data->depend = parm;
}
else if (cmd == "hinticon")
{
plugin_data->hinticon = parm;
}
else if (cmd == "type")
{
plugin_data->type = getPluginType(atoi(parm));
@@ -288,6 +294,10 @@ bool CPlugins::parseCfg(plugin *plugin_data)
inFile.close();
std::string _hintIcon = plugin_data->plugindir + "/" + plugin_data->hinticon + ".png";
if (access(_hintIcon.c_str(), F_OK) == 0)
plugin_data->hinticon = _hintIcon;
overrideType(plugin_data, g_settings.plugins_disabled, P_TYPE_DISABLED) ||
overrideType(plugin_data, g_settings.plugins_game, P_TYPE_GAME) ||
overrideType(plugin_data, g_settings.plugins_tool, P_TYPE_TOOL) ||