Пример #1
0
void ZAddAppDlg::addApp(QString name, QString icon, int i)
{
	#ifdef FIX_LISTBOX
	ZListBoxItem* listitem = new ZListBoxItem( lbAppList, QString ( "%I%M" ) );
	#else
	ZSettingItem* listitem = new ZSettingItem( lbAppList, QString ( "%I%M" ) );	
	#endif
	listitem->appendSubItem ( 1, name , true );
	QPixmap pm;
	
	#ifndef NEW_PLATFORM
	if (icon.right(2)==".g")
	#else
	if ( (icon.right(2)==".g") || (icon.right(2)==".k") )
	#endif
	{
		RES_ICON_Reader res;
		pm = res.getIcon(icon);
	} else
	{
		if ( !QFile::exists(icon) )		
			icon = settings->getProgramDir() + QString ( "/img/run_app.png" );
		pm.load( icon );
	}
	imgSetMaxSize(&pm, 19);	
	listitem->setPixmap ( 0, pm );
	listitem->setReservedData ( i );
	lbAppList->insertItem ( listitem,-1,true );
}
Пример #2
0
void ZGui::CargarMenu1()
{
  QPixmap p1;
  QString line;
  QFile entrada("/ezxlocal/LinXtend/usr/bin/cron/user.txt");
  QTextStream stentrada(&entrada);
  if ( entrada.open(IO_ReadOnly | IO_Translate) )
  {
	while ( !stentrada.eof() )
	{
	  line = stentrada.readLine();
	  if ( line != "" )
	  {
		  ZListBoxItem* autoitem = new ZListBoxItem ( zllb1, QString ( "%I%M" ) );
		  p1=QPixmap(iconReader.getIcon("calen_schedule_tab", false));
		  QImage image; image = p1.convertToImage(); 
		  image = image.smoothScale(18, 17); p1.convertFromImage(image);
		  autoitem->setPixmap ( 0, p1 );
		  QString name = line;
		  int i = name.find("/",0); name.remove(0,i);
		  i= name.findRev("/"); if ( i!=name.length() ) name.remove(0,i+1);
		  autoitem->appendSubItem ( 1, name, false, NULL );
		  QString campos = line;
		  i = campos.findRev( QChar(' ') ); campos.remove(i,campos.length()-i);
		  autoitem->appendSubItem ( 1, campos, false, NULL );
		  zllb1->insertItem ( autoitem,-1,true );
      }
	}
  }

}
Пример #3
0
void ZFileOpenDialog::CargarBrowser(QString direccion)
{

  browser->clear();
  QDir dir ( direccion, "*" );
  sPath = direccion;
  dir.setMatchAllDirs ( true );
  dir.setFilter ( QDir::Dirs | QDir::Hidden );
  if ( !dir.isReadable() )
	return;
  QStringList entries = dir.entryList();
  entries.sort();
  QStringList::ConstIterator it = entries.begin();

  QPixmap pixmap;
  if ( (sPath != "") && (sPath != "/") && (sPath != "//") )
  {
	pixmap=QPixmap( iconReader2.getIcon("gen_back_to_arrw_thb", false) );
	if ( pixmap.height() > 19 ) { QImage image; image = pixmap.convertToImage(); 
	image = image.smoothScale( 19, 19 ); pixmap.convertFromImage(image); }  
	ZListBoxItem* Item;
	Item = new ZListBoxItem ( browser, QString ( "%I%M" ) );
	Item->setPixmap ( 0, pixmap ); Item->appendSubItem ( 1, "..", false, NULL );
	browser->insertItem ( Item,-1,true );
  }

  while ( it != entries.end() ) {
	if ( ( *it != "." ) && ( *it != ".." ) )
	{
		pixmap=QPixmap( iconReader2.getIcon("fm_folder_small", false) );
		if ( pixmap.height() > 19 ) { QImage image; image = pixmap.convertToImage(); 
		image = image.smoothScale( 19, 19 ); pixmap.convertFromImage(image); }  

		ZListBoxItem* Item;
		Item = new ZListBoxItem ( browser, QString ( "%I%M" ) );
	    
		Item->setPixmap ( 0, pixmap );
		Item->appendSubItem ( 1, *it, false, NULL );
		browser->insertItem ( Item,-1,true );
	}
	++it;
  }

	  dir.setFilter ( QDir::Files | QDir::Hidden );

	  entries = dir.entryList();
	  entries.sort();
	  it = entries.begin();
	  while ( it != entries.end() ) {

		pixmap=QPixmap( iconReader2.getIcon("msg_receipt_request_small", false) );
		if ( pixmap.height() > 19 ) { QImage image; image = pixmap.convertToImage(); 
		image = image.smoothScale( 19, 19 ); pixmap.convertFromImage(image); }  
		ZListBoxItem* Item;
		Item = new ZListBoxItem ( browser, QString ( "%I%M" ) );
		Item->setPixmap ( 0, pixmap );
		Item->appendSubItem ( 1, *it, false, NULL );
		browser->insertItem ( Item,-1,true ); 
		++it;
	  }
}
void MediaBrowser::setDir(QString pdir)
{   
	int fileCount = 0;
	int dirCount = 0;	
	
	mCurDir = pdir;

	listBox->clear();
	
	QDir dir(pdir);
    dir.setFilter(QDir::Dirs | QDir::Files | QDir::System); 
	#ifndef ZN5
	dir.setSorting(QDir::DirsFirst | QDir::Name | QDir::IgnoreCase);
	#endif
	
	dir.setMatchAllDirs (true);		
	dir.sorting();

	if ( !dir.isReadable() ) return;

	QStringList entries;
	QStringList::ConstIterator p;   
	entries = dir.entryList();	

	ZListBoxItem* pItem = NULL;
	QPixmap icon;	
	for (p=entries.begin(); p!=entries.end(); p++)
	{
        if ( *p == "." || *p == ".." ) continue;		
		icon = iconReader.getIcon( (QFileInfo(pdir+"/"+*p).isFile()) ? "fm_insert_file_small.bmp" : "fm_folder_small.bmp" );

		if ( !QFileInfo(pdir+"/"+*p).isFile() ) {
			pItem = new ZListBoxItem(listBox, QString("%I%M"));
			//#endif
			pItem->appendSubItem(1, *p);
			pItem->setPixmap(0, icon);
			dirCount++;	
			listBox->insertItem(pItem);					
		}	
		else {
		
			if(mType == TYPE_IMG)
			{
				if( getFileType( QString("%1/%2").arg(mCurDir).arg(*p) ) == TYPE_IMG ) 	{						
					//#ifdef SCREEN_V
					//pItem = new ZListBoxItem(this, QString("%I%M170%I"));
					//#else
					pItem = new ZListBoxItem(listBox, QString("%I%M"));
					//#endif
					pItem->appendSubItem(1, *p);
					pItem->setPixmap(0, icon);
					fileCount++;
					listBox->insertItem(pItem);			
				} else 	{
					continue;
				}
			}
			if(mType == TYPE_AUDIO)
			{
				if( getFileType( QString("%1/%2").arg(mCurDir).arg(*p) ) == TYPE_AUDIO ) 	{
					//#ifdef SCREEN_V
					//pItem = new ZListBoxItem(this, QString("%I%M170%I"));
					//#else
					pItem = new ZListBoxItem(listBox, QString("%I%M"));
					//#endif
					pItem->appendSubItem(1, *p);
					pItem->setPixmap(0, icon);
					fileCount++;
					listBox->insertItem(pItem);			
				} else 	{
					continue;
				}			
			}
		}	
	}
	printf(" ==== add top item ====\n");
	//#ifdef SCREEN_V
	//pItem = new ZListBoxItem(this, QString("%I%M100%M"));
	//#else	
	pItem = new ZListBoxItem(listBox, QString("%I%M140%M"));
	//#endif
	pItem->appendSubItem(1, pdir);
	pItem->appendSubItem(2, QString( "  %1 Dirs %2 Files").arg(dirCount).arg(fileCount) );	
	listBox->insertItem(pItem, 0);//, false);
}