コード例 #1
0
ファイル: kde_start_impl.cpp プロジェクト: Gruppe12Et/Rars
static void FillComboWithDir( QComboBox * combo, const char * sDirectory, const char * ext )
{
  // Look in the current directory
  QDir dir(sDirectory);
  if( !dir.exists() )
  {
    fprintf( stderr, "Warning: Directory not found (%s).\n", sDirectory );
    fprintf( stderr, "Action: Run rars from his home directory\n" );
    return;
  }
  dir.setFilter( QDir::Files | QDir::NoSymLinks );
  const QFileInfoList * fileinfolist = dir.entryInfoList();
  QFileInfoListIterator it (*fileinfolist);
  QFileInfo *fi;
  while( (fi=it.current()) )
  {
    if( strcmp( fi->extension(), ext )==0 )
    {
       combo->insertItem( fi->fileName() );
    }
    ++it;
  }
}
コード例 #2
0
ファイル: UnitCfg.cpp プロジェクト: jiajw0426/easyscada
UnitCfg::UnitCfg  (QWidget * parent,
const char *name):Inherited (parent, name), pTimer (new QTimer (this)),fNew(0)
{
	setCaption (tr ("Unit Configuration"));
	connect (GetConfigureDb (),
	SIGNAL (TransactionDone (QObject *, const QString &, int, QObject*)), this,
	SLOT (QueryResponse (QObject *, const QString &, int, QObject*)));	// connect to the databas
	GetConfigureDb()->DoExec(this,"select NAME from UNITS order by NAME asc;",tList);
	ButtonState (false);
	connect (pTimer, SIGNAL (timeout ()), this, SLOT (DoSelChange ()));	// wire up the item selection timer
	//
	// Fill the unit type list
	QDir d (QSDRIVER_DIR, "*" DLL_EXT, QDir::Name, QDir::Files);	// get the directory listing
	// 
	if (d.count ())
	{
		const QFileInfoList *pD = d.entryInfoList ();
		QFileInfoListIterator it (*pD);
		QFileInfo *fi;
		//
		while ((fi = it.current ()))
		{
			UnitType->insertItem (fi->baseName ());
			++it;
		};
	};
	//
	Comment->setMaxLength(MAX_LENGHT_OF_STRING);
	//set the tab order
	// 
	QWidget *pL[] = 
	{
		Name, Comment, UnitType, Enabled, ApplyButton, NewButton,
		DeleteButton,0
	};
	SetTabOrder (this, pL);
}