int eDVBServiceController::checkCA(ePtrList<CA> &list, const ePtrList<Descriptor> &descriptors, int sid)
{
	int found=0;
	for (ePtrList<Descriptor>::const_iterator i(descriptors);
		i != descriptors.end(); ++i)
	{
		if (i->Tag()==9)	// CADescriptor
		{
			found++;
			CADescriptor *ca=(CADescriptor*)*i;

#if 0
// this is old unneeded code for camd call..
// now we do this in eDVBCAHandler..
			Decoder::addCADescriptor((__u8*)(ca->data));
#endif

			int avail=0;
			{
				singleLock s(availCALock);
				if (availableCASystems.find(ca->CA_system_ID) != availableCASystems.end())
					avail++;
			}

			usedCASystems.insert(ca->CA_system_ID);

			if (avail)
			{
				for (ePtrList<CA>::iterator a = list.begin();
					a != list.end(); a++)
				{
					if (a->casysid==ca->CA_system_ID)
					{
						avail=0;
						break;
					}
				}
				if (avail)
				{
					CA *n=new CA;
					n->ecmpid=ca->CA_PID;
					n->casysid=ca->CA_system_ID;
					n->emmpid=-1;
					list.push_back(n);
				}
			}
		}
	}
	return found;
}
Exemple #2
0
void eHelpWindow::init_eHelpWindow(ePtrList<eAction> &parseActionHelpList, int helpID)
{
	int xpos=60, ypos=0, labelheight, imgheight;

	scrollbar = CreateSkinnedProgress("scrollbar",0,100);

	visible = new eWidget(this);
	visible->setName("visible");

	BuildSkin("eHelpWindow");

	scrollbox = new eWidget(visible);
	scrollbox->move(ePoint(0, 0));
	scrollbox->resize(eSize(visible->width(), visible->height()*8));

	const std::set<eString> &styles=eActionMapList::getInstance()->getCurrentStyles();

	lastEntry=0;
	entryBeg[lastEntry++]=0;
	int pageend=visible->height();

	for ( ePtrList<eAction>::iterator it( parseActionHelpList.begin() ); it != parseActionHelpList.end() ; it++ )
	{
		std::map< eString, keylist >::iterator b;
		
		for (std::set<eString>::const_iterator si(styles.begin()); si != styles.end(); ++si)
		{
			b=it->keys.find(*si);
			if (b == it->keys.end())
				continue;

			keylist &keys = b->second;
			for ( keylist::iterator i( keys.begin() ); i != keys.end() ; i++ )
			{
				imgheight=0;
				if ( strstr( i->producer->getDescription(), eSystemInfo::getInstance()->getHelpStr() ) )
				{
					if (i->picture)
					{
						gPixmap *image=eSkin::getActive()->queryImage(i->picture);

						if (image)
						{
							label = new eLabel(scrollbox);
							label->setFlags(eLabel::flagVCenter);
							label->move(ePoint(0, ypos));
							label->resize(eSize(xpos,image->y));
							label->setBlitFlags(BF_ALPHATEST);
							label->setPixmap(image);
							label->setPixmapPosition(ePoint((xpos-10)/2-image->x/2, 0));
						}
					}

					label = new eLabel(scrollbox);
					label->setFlags(eLabel::flagVCenter);
					label->setFlags(RS_WRAP);
					label->move(ePoint(xpos, ypos));
					label->resize(eSize(visible->width()-xpos-20, 200));
							// since they are inited before language is set,
							// call gettext again.
					label->setText(gettext(it->getDescription()));
					labelheight=label->getExtend().height();
					label->resize(eSize(visible->width()-xpos-20, labelheight));

					ypos+=(labelheight>imgheight?labelheight:imgheight)+20;
					if ( ypos-20 > pageend )
					{
						pageend=ypos-(labelheight>imgheight?labelheight:imgheight)-20;
						entryBeg[lastEntry++]=pageend;
						pageend+=visible->height();
					}
					break;  // add only once :)
				}
			}
		}
	}

	if (helpID)
	{
		eString helptext=loadHelpText(helpID);

		label = new eLabel(scrollbox);
		label->setFlags(eLabel::flagVCenter);
		label->setFlags(RS_WRAP);
		label->move(ePoint(0, ypos));
		label->resize(eSize(visible->width(), 200));
		label->setText(helptext);
		labelheight = label->getExtend().height();
		label->resize(eSize(visible->width(), labelheight));
		int tmp = ypos+labelheight;
		while ( tmp > pageend )
		{
			entryBeg[lastEntry++]=ypos;
			ypos+=visible->height();
			pageend=ypos;
		}
	}

	--lastEntry;
	cur = 0;
	doscroll=ypos>visible->height();

	if (!doscroll)
		scrollbar->hide();
	else
	  updateScrollbar();
	  
	addActionMap(&i_helpwindowActions->map);
}