void MMSSwitcher::onSelectItem(MMSWidget *widget) { if (!widget) widget = this->menu->getSelectedItem(); // no menu item given if (!widget) return; // set the static menu if (this->menu_static) this->menu_static->setSelected(menu->getSelected()); MMSPluginData *data = (MMSPluginData*)widget->getBinData(); // return if current plugin is selected plugin if(this->curr_plugin == data->getId()) return; // hide all previews /*for (map<int, plugin_data_t *>::iterator i = this->plugins.begin(); i != this->plugins.end(); i++) { vector<MMSChildWindow *> *wins = &(i->second->previewWins); for (unsigned int j = 0; j < wins->size(); j++) { MMSChildWindow *cw = wins->at(j); cw->hide(); cw->waitUntilHidden(); } } */ // set current plugin this->curr_plugin = data->getId(); // tell the switcher thread to invoke show preview this->switcherThread->invokeShowPreview(); }
void MMSSwitcher::onReturn(MMSWidget *widget) { try { // get the selected item widget = this->menu->getSelectedItem(); // get access to the plugin data MMSPluginData *data = (MMSPluginData*)widget->getBinData(); // invoke show if(data->getType()->getName() == "OSD_PLUGIN") { MMSOSDPluginHandler *handler = this->pluginmanager->getOSDPluginHandler(data->getId()); handler->invokeShow(NULL); } else if(data->getType()->getName() == "CENTRAL_PLUGIN") { MMSCentralPluginHandler *handler = this->pluginmanager->getCentralPluginHandler(data->getId()); handler->invokeShow(NULL); } } catch(MMSError &error) { DEBUGMSG("Switcher", "Abort due to: " + error.getMessage()); } }
bool MMSSwitcher::switchToPluginEx(int toplugin) { if (toplugin >= 0) { try { MMSPluginData *data = &this->plugins[toplugin]->plugindata; if(!data) { DEBUGMSG("Switcher", "Plugin with ID = %d not found", toplugin); return false; } if(data->getType()->getName() == "OSD_PLUGIN") { MMSOSDPluginHandler *handler = this->pluginmanager->getOSDPluginHandler(data->getId()); handler->invokeShow(NULL); } else if(data->getType()->getName() == "CENTRAL_PLUGIN") { MMSCentralPluginHandler *handler = this->pluginmanager->getCentralPluginHandler(data->getId()); handler->invokeShow(NULL); } return true; } catch(MMSError &error) { DEBUGMSG("Switcher", "Abort due to: " + error.getMessage()); } } return false; }