Beispiel #1
0
int main(int argc,char **argv)
{
	QApplication app(argc,argv);
	QPtrList<int> list;
	
	for (int i=0;i<3;i++)
	{
		list.append(new int(i)); // 插入資料
	}

	list.first(); // 先跳到第一個元素
	for (int i=0;i<3;i++,list.next())
	{
		cout << *(list.current()) << endl;
	}

	list.first();
	list.next();
	list.remove();
	list.remove();
	list.remove();
	cout << *(list.current()) << endl;
	// 由這一個例子可以知道,刪掉一個成員後,指標會跑到下一個.但若刪掉後沒有下一個時,指標會跑到前一個

	return 0;
}
Beispiel #2
0
void Chaser::createContents(QPtrList <QString> &list)
{
  unsigned long functionId = 0;
  
  for (QString* s = list.next(); s != NULL; s = list.next())
    {
      if (*s == QString("Entry"))
	{
	  s = list.prev();
	  break;
	}
      else if (*s == QString("Function"))
	{
	  functionId = list.next()->toULong();
	  
	  Function* function = _app->doc()->searchFunction(functionId);
	  if (function != NULL)
	    {
	      addStep(function);
	    }
	  else
	    {
	      qDebug("Unable to find member for chaser <" + name() + ">");
	    }

	  functionId = 0;
	}
      else
	{
	  // Unknown keyword
	  list.next();
	}
    }
}
static PyObject *wpParty_getAttr(wpParty *self, char *name)
{
	cParty *party = self->party;

	if (!strcmp(name, "leader"))
	{
		return party->leader()->getPyObject();
	}
	else if (!strcmp(name, "members"))
	{
		QPtrList<cPlayer> members = party->members();
		PyObject *list = PyList_New(0);
		for (P_PLAYER member = members.first(); member; member = members.next())
			PyList_Append(list, member->getPyObject());
		return list;
	}
	else if (!strcmp(name, "canidates"))
	{
		QPtrList<cPlayer> canidates = party->canidates();
		PyObject *list = PyList_New(0);
		for (P_PLAYER canidate = canidates.first(); canidate; canidate = canidates.next())
			PyList_Append(list, canidate->getPyObject());
		return list;
	}
	else if (!strcmp(name, "lootingallowed"))
	{
		QPtrList<cPlayer> lootlist = party->lootingAllowed();
		PyObject *list = PyList_New(0);
		for (P_PLAYER member = lootlist.first(); member; member = lootlist.next())
			PyList_Append(list, member->getPyObject());
		return list;
	}

	return Py_FindMethod(wpPartyMethods, (PyObject*)self, name);
}
Beispiel #4
0
/**
 * Load settings from file
 */
void Settings::load()
{
	// Search for a file from user's home directory
	QString path = QString(getenv("HOME")) +
		QString("/") + QString(KQLCUserDir);

	QString fileName = path + QString("/") + QString(KConfigFile);
	QPtrList <QString> list;

	if (FileHandler::readFileToList(fileName, list) == true)
	{
		for (QString* s = list.first(); s != NULL; s = list.next())
		{
			if (*s == QString("Entry"))
			{
				if (*(list.next()) == QString("General"))
				{
					createContents(list);
				}
			}
		}
	}

	while (!list.isEmpty())
	{
		delete list.take(0);
	}
}
Beispiel #5
0
void VirtualConsole::createWidget(QPtrList <QString> &list)
{
    QString t;

    for (QString* s = list.next(); s != NULL; s = list.next())
    {
        if (*s == QString("Entry"))
        {
            s = list.prev();
            break;
        }
        else if (*s == QString("Frame"))
        {
            if (m_drawArea == NULL)
            {
                m_drawArea = new VCFrame(this);
                m_drawArea->init();
                m_drawArea->setBottomFrame(true);
                m_drawArea->setFrameStyle(QFrame::Panel | QFrame::Sunken);

                m_layout->addWidget(m_drawArea, 1);

                m_drawArea->createContents(list);

                m_drawArea->show();
            }
            else
            {
                VCFrame* w = new VCFrame(m_drawArea);
                w->init();
                w->createContents(list);
            }
        }
        else if (*s == QString("Label"))
        {
            VCLabel* w = new VCLabel(m_drawArea);
            w->init();
            w->createContents(list);
        }
        else if (*s == QString("Button"))
        {
            VCButton* w = new VCButton(m_drawArea);
            w->init();
            w->createContents(list);
        }
        else if (*s == QString("Slider"))
        {
            VCDockSlider* s = new VCDockSlider(m_drawArea);
            s->init();
            s->createContents(list);
        }
        else
        {
            // Unknown keyword, skip
            list.next();
        }
    }
}
void NPmxExport::inspectTuplet(NPlayable *elem, int staff_nr, int barnr_) {
	QPtrList<NPlayable> *tupletlist;
	badmeasure *bad;
	int len1, len2;
	NPlayable *elem2;
	bool len2set = false;

	tupletlist = elem->getTupletList();

	if ((int)(tupletlist->count()) != elem->getNumNotes()) {
		elem2 = tupletlist->first();
		len1 = len2 = elem2->getSubType();
		for (elem2 = tupletlist->next(); elem2; elem2 = tupletlist->next()) {
			if (elem2->getSubType() != len1) {
				if (len2set) {
					if (elem2->getSubType() != len2) {
						bad = new badmeasure(PMX_ERR_NOT_NUM_TUMPLET, staff_nr, barnr_, 0, 0);
						badlist_.append(bad);
					}
				}
				else {
					len2set = true;
					len2 = elem2->getSubType();
				}
			}
		}
		if (len2set) {
			if (len1 != 2*len2 && len2 != 2*len1) {
				bad = new badmeasure(PMX_ERR_NOT_NUM_TUMPLET, staff_nr, barnr_, 0, 0);
				badlist_.append(bad);
			}
			if (len1 < len2)  {
				tupletBase_ = len1;
			}
			else {
				tupletBase_ = len2;
			}
		}
		else {
			tupletBase_ = len1;
		}
						
	}
	else {
		tupletBase_ = tupletlist->getFirst()->getSubType();
	}
	if (tupletlist->getLast()->getType() == T_REST) {
		bad = new badmeasure(PMX_ERR_TUPLET_ENDS_REST, staff_nr, barnr_, 0, 0);
		badlist_.append(bad);
	}
}
Beispiel #7
0
/*
 * Create contents from list created by FileHandler
 */
void Settings::createContents(QPtrList <QString> &list)
{
	for (QString* s = list.next(); s != NULL; s = list.next())
	{
		if (*s == QString("Entry"))
		{
			s = list.prev();
			break;
		}
		else
		{
			set(*s, *(list.next()));
		}
	}
}
void
xQGanttBarViewPort::deleteSelectedItems()
{
#ifdef _DEBUG_
    printf("-> xQGanttBarViewPort::deleteSelectedItems()\n");
#endif

    QPtrList<KGanttItem> list;
    observeList(&list);

    getSelectedItems(_toplevelitem, list);

    for(KGanttItem *subitem = list.first();
            subitem != 0;
            subitem = list.next())
    {
#ifdef _DEBUG_
        printf(" : %s \n", subitem->getText().latin1());
#endif
        connect(subitem, SIGNAL(destroyed(KGanttItem *)),
                this, SLOT(itemDestroyed(KGanttItem *)));
    }

    list.remove(_toplevelitem);

    while(list.count() > 0)
    {
        KGanttItem *item = list.getFirst();
        delete item;
    }

#ifdef _DEBUG_
    printf("<- xQGanttBarViewPort::deleteSelectedItems()\n");
#endif
}
Beispiel #9
0
void
QueueManager::addItems( QListViewItem *after )
{
    /*
        HACK!!!!! We can know which items where dragged since they should still be selected
        I do this, because:
        - Dragging items from the playlist provides urls
        - Providing urls, requires iterating through the entire list in order to find which
          item was selected.  Possibly a very expensive task - worst case: O(n)
        - After a drag, those items are still selected in the playlist, so we can find out
          which PlaylistItems were dragged by selectedItems();
    */

    if( !after )
        after = m_listview->lastChild();

    QPtrList<QListViewItem> list = Playlist::instance()->selectedItems();

    for( QListViewItem *item = list.first(); item; item = list.next() )
    {
#define item static_cast<PlaylistItem*>(item)
        QValueList<PlaylistItem*> current = m_map.values();

        if( current.find( item ) == current.end() ) //avoid duplication
        {
            QString title = i18n("%1 - %2").arg( item->artist(), item->title() );

            after = new QueueItem( m_listview, after, title );
            m_map[ after ] = item;
        }
#undef item
    }

}
void CSSStyleDeclarationImpl::setProperty ( const DOMString &propertyString)
{
    DOMString ppPropertyString = preprocess(propertyString.string(),true);
    QPtrList<CSSProperty> *props = parseProperties(ppPropertyString.unicode(),
						ppPropertyString.unicode()+ppPropertyString.length());
    if(!props || !props->count())
	return;

    props->setAutoDelete(false);

    if(!m_lstValues) {
	m_lstValues = new QPtrList<CSSProperty>;
	m_lstValues->setAutoDelete( true );
    }

    CSSProperty *prop = props->first();
    while( prop ) {
	removeProperty(prop->m_id, false);
	m_lstValues->append(prop);
 	prop = props->next();
    }

    delete props;
    setChanged();
}
void TLFrameSequenceLayout::loadFrames( QPtrList<Layer> layers )
{
    number_of_frame_sequences = 0;
    max_used_frames = 0;
    delete current_frame_sequence;
    list_of_frame_sequences.clear();

    Layer *l_it;
    for ( l_it = layers.first(); l_it; l_it = layers.next() )
    {
	QPtrList<KeyFrame> keyframes = l_it -> keyFrames();
        number_of_frame_sequences++;

    	TLFrameSequence *new_frame_sequence = new TLFrameSequence( number_of_frame_sequences, viewport(), this );
	if ( l_it == layers.getFirst() )
	    current_frame_sequence = new_frame_sequence;
    	addChild( new_frame_sequence, 0, ( number_of_frame_sequences - 1 ) * new_frame_sequence -> height() );
    	connect( new_frame_sequence, SIGNAL( frameInserted() ), SLOT( slotUpdateMaxUsedFrames() ) );
    	connect( new_frame_sequence, SIGNAL( frameRemoved() ), SLOT( slotUpdateMaxUsedFrames() ) );
    	connect( new_frame_sequence, SIGNAL( keyframeRemoved( int ) ), SIGNAL( keyframeRemovedToES( int ) ) );
    	connect( new_frame_sequence, SIGNAL( motionTweenCreated( int ) ), SIGNAL( motionTweenCreatedToES( int ) ) );
    	connect( new_frame_sequence, SIGNAL( motionTweenRemoved( int ) ), SIGNAL( motionTweenRemovedToES( int ) ) );
	list_of_frame_sequences.append( new_frame_sequence );
    	last_frame_sequence = new_frame_sequence;
    	updateContentSize();

	new_frame_sequence -> loadFrames( keyframes );
    }
}
Beispiel #12
0
STDMETHODIMP QOleDataObject::EnumFormatEtc( DWORD dwDir, IEnumFORMATETC **ppenumFormatEtc )
{

    if ( dwDir == DATADIR_SET )
        return E_NOTIMPL;

    int count = 0;

    while ( m_dragObj->format( count ) )
        count++;

    int *formats = new int[ count ];
    for ( int i = 0; i < count; i++ ) {
        const char *mime = m_dragObj->format( i );
        QPtrList<QWindowsMime> all = QWindowsMime::all();
        for ( QWindowsMime * c = all.first(); c ; c = all.next() ) {
            int cf = c->cfFor( mime );
            if ( cf ) {
                formats[ i ] = cf;
                break;
            }
        }
    }

    qIEnumFORMATETC *pEnum = new qIEnumFORMATETC( formats, count );
    pEnum->AddRef();
    *ppenumFormatEtc = pEnum;

    delete[] formats;

    return ResultFromScode( S_OK );
}
Beispiel #13
0
void App::slotRefreshWindowMenu()
{
	QWidget* widget;
	int id = 0;

	QPtrList <QWidget> wl = workspace()->windowList();

	m_windowMenu->clear();
	m_windowMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/view_sidetree.png")),
				 "Cascade", this, SLOT(slotWindowCascade()),
				 0, ID_WINDOW_CASCADE);
	m_windowMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/view_left_right.png")),
				 "Tile", this, SLOT(slotWindowTile()),
				 0, ID_WINDOW_TILE);
	m_windowMenu->insertSeparator();

	for (widget = wl.first(); widget != NULL; widget = wl.next())
	{
		m_windowMenu->insertItem(widget->caption(), id);
		if (widget->isVisible() == true)
		{
			m_windowMenu->setItemChecked(id, true);
		}
		id++;
	}

	connect(m_windowMenu, SIGNAL(activated(int)),
		this, SLOT(slotWindowMenuCallback(int)));
}
Beispiel #14
0
STDMETHODIMP QOleDataObject::GetDataHere( FORMATETC *pformatetc, STGMEDIUM *pmedium )
{
    // is data is in our format?
    HRESULT hr = QueryGetData( pformatetc );
    if ( hr != S_OK )
        return hr;

    if ( pmedium->tymed != TYMED_HGLOBAL )
        return DV_E_TYMED;

    if ( !pmedium->hGlobal )
        return STG_E_MEDIUMFULL;

    HGLOBAL hGlobal = pmedium->hGlobal;
    uint size = GlobalSize( hGlobal );

    int cf = pformatetc->cfFormat;
    QPtrList<QWindowsMime> all = QWindowsMime::all();
    for ( QWindowsMime * c = all.first(); c ; c = all.next() ) {
        const char * mime = c->mimeFor( cf );
        if ( mime && m_dragObj->provides( mime ) ) {
            QByteArray ba = m_dragObj->encodedData( mime );
            if ( ba.size() > size )
                return STG_E_MEDIUMFULL;
            memcpy ( GlobalLock ( hGlobal ), ba.data(), ba.size() );
            GlobalUnlock ( hGlobal );
            return S_OK;
        }
    }
    return E_UNEXPECTED;
}
Beispiel #15
0
bool QDropEvent::provides( const char * mimeType ) const
{
#ifdef DEBUG_QDND_WIN
    qDebug( "QDropEvent::provides ( %s )", mimeType );
#endif

    if ( !pIDataObject )
        return false;

    FORMATETC fmtMemory = { 0,
                            NULL,
                            DVASPECT_CONTENT,
                            -1,
                            TYMED_HGLOBAL };

    /* Search all available mimes for mimeType and look if pIDataObject
       can give us data in this clipboard format */
    QPtrList<QWindowsMime> all = QWindowsMime::all();
    for ( QWindowsMime * c = all.first(); c ; c = all.next() ) {
        int cf = c->cfFor( mimeType );
        if ( c->canConvert( mimeType, cf ) ) {
            fmtMemory.cfFormat = cf;
            if ( pIDataObject->QueryGetData( &fmtMemory ) == S_OK ) {
                return true;
            }

        }
    }
    return false;
}
QPtrList<File>* Engine::files(FilterNode* filterRootNode)
{
    tracer->sinvoked(__func__) << "with filter:" << endl;
    if (filterRootNode) {
        filterRootNode->dump("");
    }

    // remove all files currently shown
    m_fileList2display->clear();

    // loop over all source directories
    QIntDictIterator<Folder> sourceDirIt(*m_sourceDirDict);
    for ( ; sourceDirIt.current(); ++sourceDirIt ) {
        Folder* sourceDir = sourceDirIt.current();

        // handle the files in this directory only if it is selected
        if (sourceDir->include()) {

            // loop over all files in the current sourcedirectory
            QPtrList<File>* fileList = sourceDir->files();
            for (File* file = fileList->first(); file; file = fileList->next()) {

                // append the file if it matches the filter
                if (filterRootNode->evaluate(file)) {
                    m_fileList2display->append(file);
                }
            }
        }
    }

    return m_fileList2display;
}
bool Engine::isTagTextValid(TagNode* parent, QString& text, bool ignoreExifTag) const
{
    // a maintag must not be named 'EXIF' (if ignoreExifTag is false)
    if (!ignoreExifTag && parent == 0 && text.upper() == "EXIF") {
        return false;
    }

    QPtrList<TagNode>* siblings = m_tagForest;

    if (parent) {
        siblings = parent->children();
    }

    if (siblings) {
        TagNode* sibling;
        for ( sibling = siblings->first(); sibling; sibling = siblings->next() ) {
            if (*sibling->text() == text) {
                // sibling with the same name already exists!
                return false;
            }
        }
    }

    // no sibling with the same name found
    return true;
}
void AccountSelector::initUI()
{
	kdDebug(14010) << k_funcinfo << endl;
	(new QVBoxLayout(this))->setAutoAdd(true);
	d->lv = new KListView(this);
	d->lv->setFullWidth(true);
	d->lv->addColumn(QString::fromLatin1(""));
	d->lv->header()->hide();

	if(d->proto != 0)
	{
		kdDebug(14010) << k_funcinfo << "creating list for a certain protocol" << endl;
		QDict<Kopete::Account> accounts = Kopete::AccountManager::self()->accounts(d->proto);
		QDictIterator<Kopete::Account> it(accounts);
		for(; Kopete::Account *account = it.current(); ++it)
		{
			new AccountListViewItem(d->lv, account);
		}
	}
	else
	{
		kdDebug(14010) << k_funcinfo << "creating list of all accounts" << endl;
		QPtrList<Kopete::Account> accounts = Kopete::AccountManager::self()->accounts();
		Kopete::Account *account = 0;
		for(account = accounts.first(); account; account = accounts.next())
		{
			new AccountListViewItem(d->lv, account);
		}
	}

	connect(d->lv, SIGNAL(selectionChanged(QListViewItem *)),
		this, SLOT(slotSelectionChanged(QListViewItem *)));
}
Beispiel #19
0
STDMETHODIMP QOleDataObject::GetData( FORMATETC *pformatetcIn, STGMEDIUM *pmedium )
{
    // is data is in our format?
    HRESULT hr = QueryGetData( pformatetcIn );
    if ( hr != S_OK )
        return hr;

    int cf = pformatetcIn->cfFormat;
    pmedium->tymed = TYMED_HGLOBAL;

    QPtrList<QWindowsMime> all = QWindowsMime::all();
    for ( QWindowsMime * c = all.first(); c ; c = all.next() ) {
        const char * mime = c->mimeFor( cf );
        if ( mime && m_dragObj->provides( mime ) ) {
            QByteArray ba = m_dragObj->encodedData( mime );

            ba = c->convertFromMime( ba, mime, cf );
            HGLOBAL hGlobal = GlobalAlloc ( GMEM_MOVEABLE | GMEM_SHARE, ba.size() );
            if ( !hGlobal )
                return E_OUTOFMEMORY;

            memcpy ( GlobalLock ( hGlobal ), ba.data(), ba.size() );
            GlobalUnlock ( hGlobal );
            pmedium->hGlobal = hGlobal;
            pmedium->pUnkForRelease = NULL;
            return S_OK;
        }
    }
    return E_UNEXPECTED;
}
Resource *ResourceSelectDialog::getResource(AddressBook *ab, QWidget *parent)
{
    QPtrList< Resource > resources = ab->resources();
    if(resources.count() == 1)
        return resources.first();

    Resource *found = 0;
    Resource *r = resources.first();
    while(r)
    {
        if(!r->readOnly())
        {
            if(found)
            {
                found = 0;
                break;
            }
            else
            {
                found = r;
            }
        }
        r = resources.next();
    }
    if(found)
        return found;

    ResourceSelectDialog dlg(ab, parent);
    if(dlg.exec() == KDialog::Accepted)
        return dlg.resource();
    else
        return 0;
}
Beispiel #21
0
STDMETHODIMP QOleDataObject::QueryGetData( FORMATETC *pformatetc )
{
#ifdef DEBUG_QDND_SRC
    qDebug( "QOleDataObject::QueryGetData( %p )", pformatetc );
#endif

    if ( !pformatetc ) {
        return E_INVALIDARG;
    }
    if ( pformatetc->lindex != -1 ) {
        return DV_E_LINDEX;
    }
    if ( pformatetc->dwAspect != DVASPECT_CONTENT ) {
        return DV_E_DVASPECT;
    }
    int tymed = pformatetc->tymed;
    /* Currently we only support HGLOBAL */
    if ( !( tymed & TYMED_HGLOBAL ) ) {
        return DV_E_TYMED;
    }

    int cf = pformatetc->cfFormat;
    QPtrList<QWindowsMime> all = QWindowsMime::all();
    for ( QWindowsMime * c = all.first(); c ; c = all.next() ) {
        const char * mime = c->mimeFor( cf );
        if ( mime && m_dragObj->provides( mime ) ) {
            return S_OK;
        }
    }
    return DV_E_FORMATETC;
}
Beispiel #22
0
void QDockArea::setFixedExtent( int d, QDockWindow *dw )
{
    QPtrList<QDockWindow> lst;
    QDockWindow *w;
    for ( w = dockWindows->first(); w; w = dockWindows->next() ) {
	if ( w->isHidden() )
	    continue;
	if ( orientation() == Horizontal ) {
	    if ( dw->y() != w->y() )
		continue;
	} else {
	    if ( dw->x() != w->x() )
		continue;
	}
	if ( orientation() == Horizontal )
	    d = QMAX( d, w->minimumHeight() );
	else
	    d = QMAX( d, w->minimumWidth() );
	if ( w->isResizeEnabled() )
	    lst.append( w );
    }
    for ( w = lst.first(); w; w = lst.next() ) {
	if ( orientation() == Horizontal )
	    w->setFixedExtentHeight( d );
	else
	    w->setFixedExtentWidth( d );
    }
}
/***********************************************************************************
 KMixToolbox contains several GUI relevant methods that are shared between the 
 KMix Main Program, and the KMix Applet.
 kmixctrl - as not non-GUI application - does NOT link to KMixToolBox.

 This means: Shared GUI stuff goes into the KMixToolBox class , non-GUI stuff goes
 into the MixerToolBox class.
 ***********************************************************************************/
void KMixToolBox::setIcons(QPtrList<QWidget> &mdws, bool on ) {
    for ( QWidget *qmdw=mdws.first(); qmdw!=0; qmdw=mdws.next() ) {
	if ( qmdw->inherits("MixDeviceWidget") ) { // -<- play safe here
	    static_cast<MixDeviceWidget*>(qmdw)->setIcons( on );
	}
    }
}
void KSSLD::cacheSaveToDisk() {
  KSSLCNode *node;

  for (node = certList.first(); node; node = certList.next()) {
    if (node->permanent || node->expires > QDateTime::currentDateTime()) {
      // First convert to a binary format and then write the kconfig entry
      // write the (CN, policy, cert) to KSimpleConfig
      cfg->setGroup(node->cert->getSubject());
      cfg->writeEntry("Certificate", node->cert->toString());
      cfg->writeEntry("Policy", node->policy);
      cfg->writeEntry("Expires", node->expires);
      cfg->writeEntry("Permanent", node->permanent);
      cfg->writeEntry("Hosts", node->hosts);
      // Also write the chain
      QStringList qsl;
      QPtrList<KSSLCertificate> cl = node->cert->chain().getChain();
      for (KSSLCertificate *c = cl.first(); c != 0; c = cl.next()) {
         //kdDebug() << "Certificate in chain: " <<  c->toString() << endl;
         qsl << c->toString();
      }
      cl.setAutoDelete(true);
      cfg->writeEntry("Chain", qsl);
    }
  }  

  cfg->sync();

  // insure proper permissions -- contains sensitive data
  QString cfgName(KGlobal::dirs()->findResource("config", "ksslpolicies"));
  if (!cfgName.isEmpty())
    ::chmod(QFile::encodeName(cfgName), 0600);
}
Beispiel #25
0
void QtCalculator::temp_stack_next(){

  CALCAMNT *number;

  if( temp_stack.current() == temp_stack.getLast()){
        KNotifyClient::beep();
        return;
  }

  number = temp_stack.next();

  if(number == NULL){
       KNotifyClient::beep();
    return;
  }
  else{
    //    printf("Number: %Lg\n",*number);
    last_input = RECALL;
    DISPLAY_AMOUNT = *number;
    UpdateDisplay();

  }


}
void QEventLoop::setSocketNotifierPending( QSocketNotifier *notifier )
{
    int sockfd = notifier->socket();
    int type = notifier->type();
    if ( sockfd < 0 || type < 0 || type > 2 || notifier == 0 ) {
#if defined(QT_CHECK_RANGE)
	qWarning( "QSocketNotifier: Internal error" );
#endif
	return;
    }

    QPtrList<QSockNot> *list = d->sn_vec[type].list;
    QSockNot *sn;
    if ( ! list )
	return;
    sn = list->first();
    while ( sn && !(sn->obj == notifier && sn->fd == sockfd) )
	sn = list->next();
    if ( ! sn ) { // not found
	return;
    }

    // We choose a random activation order to be more fair under high load.
    // If a constant order is used and a peer early in the list can
    // saturate the IO, it might grab our attention completely.
    // Also, if we're using a straight list, the callback routines may
    // delete other entries from the list before those other entries are
    // processed.
    if ( ! FD_ISSET( sn->fd, sn->queue ) ) {
	d->sn_pending_list.insert( (rand() & 0xff) %
				   (d->sn_pending_list.count()+1), sn );
	FD_SET( sn->fd, sn->queue );
    }
}
void RemoveTargetDialog::init()
{
	QPtrList <SubprojectItem> subprojectItems = m_widget->allSubprojectItems();

	TargetItem* titem = 0;

	for ( SubprojectItem* spitem = subprojectItems.first(); spitem; spitem = subprojectItems.next() )
	{
		if ( m_titem->name.isEmpty() )
			break;

		for ( titem = spitem->targets.first(); titem; titem = spitem->targets.next() )
		{
			if ( m_titem->name == titem->name )
				continue;

			if ( titem->primary == "LTLIBRARIES" || titem->primary == "PROGRAMS"
				|| titem->primary == "LIBRARIES"  || titem->primary == "JAVA" )
			{
				QString canonname = AutoProjectTool::canonicalize ( titem->name );

				if ( spitem->variables[canonname + "_LIBADD"].contains ( m_titem->name ) > 0 ||
					spitem->variables[canonname + "_LDADD"].contains ( m_titem->name ) > 0 )
				{
					dependencyListBox->insertItem ( SmallIcon ( "target_kdevelop" ), spitem->path + " (" + titem->name + ")" );

					dependentSubprojects.append ( spitem );
				}
			}
		}
	}

	if ( dependencyListBox->count() == 0 )
		dependencyListBox->insertItem ( i18n("no dependency", "<none>") );
}
Beispiel #28
0
void MainWindow::dockToolViewsIntoContainers(QPtrList<KDockWidget>& widgetsToReparent,KDockWidget *container) {
  for ( KDockWidget *dw = widgetsToReparent.first(); dw;
      dw=widgetsToReparent.next()){
    dw->manualDock(container,KDockWidget::DockCenter,20);
    dw->loseFormerBrotherDockWidget();
  }
}
Beispiel #29
0
static PyObject* wpParty_getAttr( wpParty* self, char* name )
{
	cParty* party = self->party;

	/*
		\rproperty party.leader A <object id="char">char</object> object for the leader of this party.
	*/
	if ( !strcmp( name, "leader" ) )
	{
		return party->leader()->getPyObject();
	}
	/*
		\rproperty party.members A list of <object id="char">char</object> objects for the members in this party.
	*/
	else if ( !strcmp( name, "members" ) )
	{
		QPtrList<cPlayer> members = party->members();
		PyObject* list = PyList_New( 0 );
		for ( P_PLAYER member = members.first(); member; member = members.next() )
			PyList_Append( list, member->getPyObject() );
		return list;
	}
	/*
		\rproperty party.canidates A list of <object id="char">char</object> objects for the canidates in this party.
	*/
	else if ( !strcmp( name, "canidates" ) )
	{
		QPtrList<cPlayer> canidates = party->canidates();
		PyObject* list = PyList_New( 0 );
		for ( P_PLAYER canidate = canidates.first(); canidate; canidate = canidates.next() )
			PyList_Append( list, canidate->getPyObject() );
		return list;
	}
	/*
		\rproperty party.lootingallowed A list of <object id="char">char</object> objects for the members of this party who allowed looting their corpse.
	*/
	else if ( !strcmp( name, "lootingallowed" ) )
	{
		QPtrList<cPlayer> lootlist = party->lootingAllowed();
		PyObject* list = PyList_New( 0 );
		for ( P_PLAYER member = lootlist.first(); member; member = lootlist.next() )
			PyList_Append( list, member->getPyObject() );
		return list;
	}

	return Py_FindMethod( wpPartyMethods, ( PyObject * ) self, name );
}
Beispiel #30
0
void
Win32MakefileGenerator::processPrlFiles()
{
    QDict<void> processed;
    QPtrList<MakefileDependDir> libdirs;
    libdirs.setAutoDelete(TRUE);
    {
	QStringList &libpaths = project->variables()["QMAKE_LIBDIR"];
	for(QStringList::Iterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) {
	    QString r = (*libpathit), l = r;
	    fixEnvVariables(l);
	    libdirs.append(new MakefileDependDir(r.replace("\"",""),
						 l.replace("\"","")));
	}
    }
    for(bool ret = FALSE; TRUE; ret = FALSE) {
	//read in any prl files included..
	QStringList l_out;
	QString where = "QMAKE_LIBS";
	if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
	    where = project->first("QMAKE_INTERNAL_PRL_LIBS");
	QStringList &l = project->variables()[where];
	for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
	    QString opt = (*it);
	    if(opt.startsWith("/")) {
		if(opt.startsWith("/LIBPATH:")) {
		    QString r = opt.mid(9), l = r;
		    fixEnvVariables(l);
		    libdirs.append(new MakefileDependDir(r.replace("\"",""),
							 l.replace("\"","")));
		}
	    } else {
		if(!processed[opt]) {
		    if(processPrlFile(opt)) {
			processed.insert(opt, (void*)1);
			ret = TRUE;
		    } else {
			for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) {
			    QString prl = mdd->local_dir + Option::dir_sep + opt;
			    if(processed[prl]) {
				break;
			    } else if(processPrlFile(prl)) {
				processed.insert(prl, (void*)1);
				ret = TRUE;
				break;
			    }
			}
		    }
		}
	    }
	    if(!opt.isEmpty())
		l_out.append(opt);
	}
	if(ret)
	    l = l_out;
	else
	    break;
    }
}