コード例 #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 MediaBrowser::slotOK()
{
	int index = -1;
	index = listBox->currentItem();
	if( index == -1  || index == 0 ) {
		isCancel = true;
		reject();
	}

	QString sName = QString::null;
	QString sPath  = QString::null;
	
	ZListBoxItem *pItem = (ZListBoxItem *)listBox->item(index);
	sName = pItem->getSubItemText(1, 0);  

	if(mCurDir == "/")  
		sPath = mCurDir + sName;
    else 
		sPath = mCurDir + "/" + sName;	

	if( QFileInfo(sPath).isDir() ) 	{
		return;
	} else {   
		mSelectedFile = sPath;
	}	
	isCancel = false;
	reject();	
}
コード例 #3
0
void MediaBrowser::obj_click(int index)
{
	if( index == 0 )  {
		cdBack();
		return;
	}

	QString sName = QString::null;
	QString sPath  = QString::null;
	
	ZListBoxItem *pItem = (ZListBoxItem *)listBox->item(index);

    sName = pItem->getSubItemText(1, 0);  

	if(mCurDir == "/")  
		sPath = mCurDir + sName;
    else 
		sPath = mCurDir + "/" + sName;	

	if( QFileInfo(sPath).isDir() ) 	{
		mCurDir = sPath;
		setDir(mCurDir);
	} else {   
		cout<<"click file  "<<sPath<<endl;
		
		AM_LauncherClient::openDocument(sPath);			
	}	
}
コード例 #4
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 );
      }
	}
  }

}
コード例 #5
0
void ZIconSelect::brClicked()
{

  int index = browser->currentItem();
  if (index == -1) {return;}
  ZListBoxItem* listitem = browser->item ( index );
  QString app = listitem->getSubItemText ( 1, 0, true );  

  basePath = app;
  MyBaseDlg::accept();


}
コード例 #6
0
void ZAddAppDlg::accept()
{
	toLog("ZAddAppDlg: OK: Add app");
	
	int n = lbAppList->currentItem();
	
	if (n == -1) 
	{
		return;
	}
	
	#ifdef FIX_LISTBOX
	ZListBoxItem* listitem = lbAppList->item ( n );
	#else
	ZSettingItem* listitem = (ZSettingItem*)lbAppList->item ( n ); 
	#endif
	int id = listitem->getReservedData();
	
	ZConfig cfg(APP_CONF_NAME);
	
	for (int i=0;i<20;i++)
	{
		QString name = cfg.readEntry(QString("App"), QString("name"+QString::number(i)), "");
		if (name == "")
		{
			AppRegistry it = mapApp[id];
			cfg.writeEntry("App", "name"+QString::number(i), it.name() );
			cfg.writeEntry("App", "run"+QString::number(i), it.id() );
			cfg.writeEntry("App", "icon"+QString::number(i), it.icon() );
			break;
		}
	}
	 
	cfg.flush();
	
	toLog("ZAddAppDlg: OK:  End");
	
	MyBaseDlg::accept();
}
コード例 #7
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;
	  }
}
コード例 #8
0
//************************************************************************************************
//************************************** class ZIconSelect ***********************************
//************************************************************************************************
ZIconSelect::ZIconSelect()
  :MyBaseDlg()
{
  QString ProgDir = QString ( qApp->argv() [0] ) ;
  int i = ProgDir.findRev ( "/" );
  ProgDir.remove ( i+1, ProgDir.length() - i );

  setMainWidgetTitle ( "Z6 Manager" );

  QString val; 
  ZConfig readlang("/ezxlocal/download/appwrite/setup/ezx_system.cfg", true);
  Idioma = "ezxlocal/download/mystuff/.system/LinXtend/usr/languages/" + readlang.readEntry(QString("SYS_SYSTEM_SET"), QString("LanguageType"), "en-us");
  if ( ! QFileInfo(Idioma).isFile() ) Idioma = "/ezxlocal/download/mystuff/.system/LinXtend/usr/languages/en-us";

  ZConfig lang(Idioma, false);

  this->setMainWidgetTitle(lang.readEntry(QString("LANGUAGE"), "SELECTICON", ""));
  
  QWidget *myWidget = new QWidget ( this );
  QVBoxLayout *myVBoxLayout = new QVBoxLayout ( myWidget, 0 );

  browser = new ZListBox ( QString ( "%I%M" ), this, 0);
  browser->setFixedWidth ( 240 );
  QPixmap p1;

  ZListBoxItem* Item = new ZListBoxItem ( browser, QString ( "%I%M" ) );
  Item->appendSubItem ( 1, QString ( ".." ), false, NULL );
  browser->insertItem ( Item, 0,true );
  int ItemSize = browser->itemHeight(0)-2 ; if ( ItemSize>20 ) ItemSize=20;
  browser->clear();

	RES_ICON_Reader iconReader;
	QStringList nombres, iconos;
	nombres.clear();
	nombres += "alarm_clock_std"; nombres += "bluetooth_std"; nombres += "browser_setup_std"; nombres += "browser_std";
	nombres += "calculator_std"; nombres += "calen_std"; nombres += "camera_std"; nombres += "certificate_mgr_std";
	nombres += "connections_std"; nombres += "ctact_std"; nombres += "dialing_service_std"; nombres += "dwnld_mgr_std";
	nombres += "email_std"; nombres += "fem_std"; nombres += "fixed_dial_std"; nombres += "fm_std";
	nombres += "games_std"; nombres += "go_to_url_std"; nombres += "help_std"; nombres += "location_std";
	nombres += "media_finder_std"; nombres += "media_player_std"; nombres += "java_std"; nombres += "im_std";
	nombres += "im_yahoo_std"; nombres += "images_std"; nombres += "fonts_std"; nombres += "lan_std";
	nombres += "moto_source_std"; nombres += "motosync_std"; nombres += "mp_radio_std";
	nombres += "msg_std"; nombres += "multimedia_std"; nombres += "music_library_std"; nombres += "music_std";
	nombres += "netwk_std"; nombres += "notepad_std"; nombres += "office_tools_std"; nombres += "pfile_std";
	nombres += "phone_setting_std"; nombres += "pictureflow_std"; nombres += "recnt_call_std"; nombres += "refresh_std";
	nombres += "screen_std"; nombres += "security_std"; nombres += "service_dial_std"; nombres += "settings_std";
	nombres += "sim_apps_std"; nombres += "stored_page_std"; nombres += "task_list_std"; nombres += "themes_std";
	nombres += "tweaks_std"; nombres += "utility_std"; nombres += "vid_camera_std";
	nombres += "video_std"; nombres += "voice_rec_std"; nombres += "web_access_std"; nombres += "web_history_std";
	nombres += "web_session_std"; nombres += "web_shortcuts_std"; nombres += "world_clock_std";
	nombres += "z6manager_std"; nombres += "z6tweaker_std";

	for ( int j=0 ; j < nombres.count(); ++j )
	{
		ZListBoxItem* listitem1 = new ZListBoxItem ( browser, QString ( "%I%M" ) );
		QString icono = nombres[j];
		p1=QPixmap(iconReader.getIcon(icono, false));
		if ( p1.height() > 19 ) { QImage image; image = p1.convertToImage(); 
		image = image.smoothScale(19, 19); p1.convertFromImage(image); }     
		listitem1->setPixmap ( 0, p1 );
		listitem1->appendSubItem ( 1, nombres[j], false, 0 );
		browser->insertItem ( listitem1,-1,true );
	}	


  connect(browser, SIGNAL(returnPressed(ZListBoxItem *)), SLOT(brClicked()));

  myVBoxLayout->addWidget ( browser, 1 );
  setContentWidget ( browser );

  ZSoftKey *softKey = new ZSoftKey ( "CST_2A", this, this );

  QString IDval = lang.readEntry(QString("COMMON"), QString("MENU_SELECT"), "");
  softKey->setText ( ZSoftKey::LEFT, IDval, ( ZSoftKey::TEXT_PRIORITY ) 0 );
  IDval = lang.readEntry(QString("COMMON"), QString("MENU_CANCEL"), "");
  softKey->setText ( ZSoftKey::RIGHT, IDval, ( ZSoftKey::TEXT_PRIORITY ) 0 );
  softKey->setClickedSlot ( ZSoftKey::RIGHT, this, SLOT ( reject() ) );
  softKey->setClickedSlot ( ZSoftKey::LEFT, this, SLOT ( brClicked() ) );
  setCSTWidget ( softKey );

}
コード例 #9
0
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);
}