void mgrui::buildMgrList()
{
	mgrListBox->clear();
	
	ZConfig cfg(appdir+"/settings.ini");
	
	int i, tNum;
    tNum = cfg.readNumEntry("LIST", "Items", 1);
	QPixmap pm;
	
	ZSettingItem *pItem = NULL;
	
	for(i=1;i<=tNum;i++)
	{
		printf("==== build item %d =====\n", i);
		pItem = new ZSettingItem(mgrListBox, QString("%I%M") );
		pItem->appendSubItem(1, sctr( cfg.readEntry( "LIST", "Option"+QString::number(i), "") ), false, SETTINGITEM_REGION_A );
		pItem->appendSubItem(1, sctr( cfg.readEntry( "LIST", "Option"+QString::number(i)+"b", "") ), false, SETTINGITEM_REGION_B );
		//pItem->setPixmap(0, pm);		
		//icon = appdir+cfg.readEntry( "LIST", "Icon"+QString::number(i)+"b", "");
		pm = QPixmap(appdir+cfg.readEntry( "LIST", "Icon"+QString::number(i), "") );
		QImage img = pm.convertToImage();
		img = img.smoothScale(48, 48);
		pm.convertFromImage(img);
		pItem->setPixmap(0, pm);	
		
		mgrListBox->insertItem(pItem);
	}
}
void mgrui::append2_skin_ui(ZListBox *target, QList<struct skinObj> objList)
{
	struct skinObj *obj = objList.first();
	ZSettingItem *pItem = NULL;
	QPixmap pm;
	while(obj != NULL)
	{	
		pItem = new ZSettingItem(target);//, QString("%I%M") );
		pItem->appendSubItem(1, obj->skinName, SETTINGITEM_REGION_A );
		if(obj->isInPH == true)
			pItem->appendSubItem(1, obj->skinAuthor+ctr(",Phone,")+obj->skinDir,false, SETTINGITEM_REGION_B );
		else
			pItem->appendSubItem(1, obj->skinAuthor+ctr(",MMCA2,")+obj->skinDir, false, SETTINGITEM_REGION_B );
	
		if( QFile::exists( obj->skinWall ) )
			pm = QPixmap( obj->skinWall );
		else
			pm = QPixmap( QString("%1/img/skin.png").arg(appdir) );
			
		QImage img = pm.convertToImage();
		img = img.smoothScale(48, 48);
		pm.convertFromImage(img);
		pItem->setPixmap(0, pm);	
		
		target->insertItem(pItem);
		
		obj = objList.next();
	}
}
Example #3
0
void ZFonts::fillFontsByDir(QString sDir)
{
	QStringList slFonts;
	slFonts.clear();
	QDir dir( sDir );
	dir.setFilter( QDir::Files );
	dir.setNameFilter("*.ttf;*.TTF");
	slFonts = dir.entryList();
	
	QString * path;
	QPixmap pm( ProgDir + "/fonts.png");
	for ( QStringList::Iterator it = slFonts.begin(); it != slFonts.end(); ++it ) 
	{
		ZSettingItem* item = new ZSettingItem(lbFonts, "%I%M");
		item->setPixmap( 0, pm  );
		item->appendSubItem( 1, QString::fromUtf8(*it) );
		path = new QString(sDir+"/"+(*it));
		item->setReservedData( (int)path );
		lbFonts->insertItem( item );      
	}
}