예제 #1
0
void Sheet::removePart(Part* part, bool deletePart)
{
    Q_ASSERT( part && part->sheet() == this);
    int index = d->parts.indexOf(part);
    Q_ASSERT( index != -1 );
    removePart(index, deletePart);
}
예제 #2
0
ccePixelPart* CCEPixelNode::alloc(int partId, int len)
{
	removePart(partId);

	ccePixelPart* r = new ccePixelPart();
	r->hide = true;
	r->id = partId;
	r->len = len;
	r->next = NULL;
	r->pixels = new ccePixelInfo[len];

	ccePixelPart* p = m_pPixels;
	while(p!=NULL) {
		if(p->next==NULL) {
			p->next = r;
			return r;
		}
	}
	m_pPixels = r;
	return r;
}
예제 #3
0
파일: lhmail.cpp 프로젝트: Jmos/ftofsharing
LHMailBase* LHMail::attachSignature (LHMailSignature &signature)
{
        qDebug ("*** %s,%d : %s", __FILE__, __LINE__, "12346789");

	LHMailPart* mp = new LHMailPart (this);

        if (getPartCount () > 1) {
                QString partsText = getSendData (DataToSign);
                QString newBoundary = LHMime::getBoundaryString ();
                QString oldBoundary = header ().getParameter ("Content-Type", "boundary");
                partsText.replace (oldBoundary, newBoundary);

#               if 1
                qDebug ("*** %s,%d : %s", __FILE__, __LINE__, "***********************************************");
                qDebug()<<partsText;
                qDebug ("*** %s,%d : %s", __FILE__, __LINE__, "***********************************************");
#               endif

                removePart (NULL);
		LHMailPart* mpb = new LHMailPart (this);
		addPart(mpb);

		mpb->header ().setData ("Content-Type", "Multipart/Mixed");
		mpb->header ().setParameter ("Content-Type", "boundary", newBoundary);
                mpb->setBodySendData (partsText);
		mpb->setEncoding (encoding());
                
        }

        /**
         *  Aply this LHMail object to the signature object. The body of mail
         *  is essntial when signing.
         */
         
	if (attachPart (mp))
	{

                // if (getPartCount () == 2 && body.isEmpty ())
                if (getPartCount () != 2) {
                        // qFatal ("*** %s,%d : %s", __FILE__, __LINE__, "!2");
                        return NULL;
                }

                QString body = getPart (0)->getSendData ();
        
                signature.setBody (body);
                signature.load ();

#               if 1
                qDebug ("*** %s,%d : %s", __FILE__, __LINE__, "***********************************************");
                qDebug()<<body;
                qDebug ("*** %s,%d : %s", __FILE__, __LINE__, "***********************************************");
#               endif

		header ().setData ("Content-Type", "multipart/signed");
                header ().setParameter ("Content-Type", "micalg", "sha1");
                header ().setParameter ("Content-Type", "protocol", "application/x-pkcs7-signature");
                
	        mp->setSignature (signature.getData ());
                
		return mp;
	}
	
	//not here if success
	delete mp;
	return 0;
}
예제 #4
0
/**
 * Deletes a document part.
 * @param	pDoc	The document to remove
 */
void EditorManager::remove(KTextEditor::Document* pDoc)
{
	removePart(pDoc);
	delete pDoc;
}
예제 #5
0
파일: undo.cpp 프로젝트: faesong/oom
void Song::doRedo2()
{
    Undo& u = redoList->back();
    for (iUndoOp i = u.begin(); i != u.end(); ++i)
    {
        switch (i->type)
        {
        case UndoOp::AddTrack:
            insertTrack2(i->oTrack, i->trackno);
            // Added by T356.
            chainTrackParts(i->oTrack, true);

            updateFlags |= SC_TRACK_INSERTED;
            break;
        case UndoOp::DeleteTrack:
            removeTrack2(i->oTrack);
            updateFlags |= SC_TRACK_REMOVED;
            break;
        case UndoOp::ModifyTrack:
        {
            // Unchain the track parts, but don't touch the ref counts.
            unchainTrackParts(i->nTrack, false);

            //Track* track = i->nTrack->clone();
            Track* track = i->nTrack->clone(false);

            *(i->nTrack) = *(i->oTrack);

            // Prevent delete i->oTrack from crashing.
            switch (i->oTrack->type())
            {
            case Track::AUDIO_OUTPUT:
            {
                AudioOutput* ao = (AudioOutput*) i->oTrack;
                for (int ch = 0; ch < ao->channels(); ++ch)
                    ao->setJackPort(ch, 0);
            }
            break;
            case Track::AUDIO_INPUT:
            {
                AudioInput* ai = (AudioInput*) i->oTrack;
                for (int ch = 0; ch < ai->channels(); ++ch)
                    ai->setJackPort(ch, 0);
            }
            break;
            default:
                break;
            }
            if (!i->oTrack->isMidiTrack())
                ((AudioTrack*) i->oTrack)->clearEfxList();

            delete i->oTrack;
            i->oTrack = track;

            // Chain the track parts, but don't touch the ref counts.
            chainTrackParts(i->nTrack, false);

            // Connect and register ports.
            switch (i->nTrack->type())
            {
            case Track::AUDIO_OUTPUT:
            {
                AudioOutput* ao = (AudioOutput*) i->nTrack;
                ao->setName(ao->name());
            }
            break;
            case Track::AUDIO_INPUT:
            {
                AudioInput* ai = (AudioInput*) i->nTrack;
                ai->setName(ai->name());
            }
            break;
            default:
                break;
            }

            // Update solo states, since the user may have changed soloing on other tracks.
            updateSoloStates();

            updateFlags |= SC_TRACK_MODIFIED;
        }
        break;

        /*
        // Prevent delete i->oTrack from crashing.
        switch(i->oTrack->type())
        {
        	  case Track::AUDIO_OUTPUT:
        			  {
        			  AudioOutput* ao = (AudioOutput*)i->oTrack;
        			  for(int ch = 0; ch < ao->channels(); ++ch)
        				ao->setJackPort(ch, 0);
        			  }
        			break;
        	  case Track::AUDIO_INPUT:
        			  {
        			  AudioInput* ai = (AudioInput*)i->oTrack;
        			  for(int ch = 0; ch < ai->channels(); ++ch)
        				ai->setJackPort(ch, 0);
        			  }
        			break;
        	  default:
        			break;
        }
        if(!i->oTrack->isMidiTrack())
          ((AudioTrack*)i->oTrack)->clearEfxList();

        //delete i->oTrack;
        //i->oTrack = track;

        // Remove the track. removeTrack2 takes care of unchaining the old track.
        removeTrack2(i->oTrack);

        // Connect and register ports.
        switch(i->nTrack->type())
        {
          case Track::AUDIO_OUTPUT:
        	  {
        	  AudioOutput* ao = (AudioOutput*)i->nTrack;
        	  ao->setName(ao->name());
        	  }
        	break;
          case Track::AUDIO_INPUT:
        	  {
        	  AudioInput* ai = (AudioInput*)i->nTrack;
        	  ai->setName(ai->name());
        	  }
        	break;
          default:
        	break;
        }

        // Insert the new track.
        insertTrack2(i->nTrack, i->trackno);
        // Chain the new track parts. (removeTrack2, above, takes care of unchaining the old track).
        chainTrackParts(i->nTrack, true);

        // Update solo states, since the user may have changed soloing on other tracks.
        updateSoloStates();

        updateFlags |= SC_TRACK_MODIFIED;
        }
        break;
         */

        case UndoOp::SwapTrack:
        {
            Track* track = _tracks[i->a];
            _tracks[i->a] = _tracks[i->b];
            _tracks[i->b] = track;
            updateFlags |= SC_TRACK_MODIFIED;
        }
        break;
        case UndoOp::AddPart:
            addPart(i->oPart);
            updateFlags |= SC_PART_INSERTED;
            i->oPart->events()->incARef(1);
            //i->oPart->chainClone();
            chainClone(i->oPart);
            break;
        case UndoOp::DeletePart:
            removePart(i->oPart);
            updateFlags |= SC_PART_REMOVED;
            i->oPart->events()->incARef(-1);
            //i->oPart->unchainClone();
            unchainClone(i->oPart);
            break;
        case UndoOp::ModifyPart:
            if (i->doCtrls)
                removePortCtrlEvents(i->nPart, i->doClones);
            changePart(i->nPart, i->oPart);
            i->oPart->events()->incARef(1);
            i->nPart->events()->incARef(-1);
            //i->nPart->replaceClone(i->oPart);
            replaceClone(i->nPart, i->oPart);
            if (i->doCtrls)
                addPortCtrlEvents(i->oPart, i->doClones);
            updateFlags |= SC_PART_MODIFIED;
            break;
        case UndoOp::AddEvent:
            addEvent(i->nEvent, i->part);
            if (i->doCtrls)
                addPortCtrlEvents(i->nEvent, i->part, i->doClones);
            updateFlags |= SC_EVENT_INSERTED;
            break;
        case UndoOp::DeleteEvent:
            if (i->doCtrls)
                removePortCtrlEvents(i->nEvent, i->part, i->doClones);
            deleteEvent(i->nEvent, i->part);
            updateFlags |= SC_EVENT_REMOVED;
            break;
        case UndoOp::ModifyEvent:
            if (i->doCtrls)
                removePortCtrlEvents(i->nEvent, i->part, i->doClones);
            changeEvent(i->nEvent, i->oEvent, i->part);
            if (i->doCtrls)
                addPortCtrlEvents(i->oEvent, i->part, i->doClones);
            updateFlags |= SC_EVENT_MODIFIED;
            break;
        case UndoOp::AddTempo:
            //printf("doRedo2: UndoOp::AddTempo. adding tempo at: %d with tempo=%d\n", i->a, i->b);
            tempomap.addTempo(i->a, i->b);
            updateFlags |= SC_TEMPO;
            break;
        case UndoOp::DeleteTempo:
            //printf("doRedo2: UndoOp::DeleteTempo. deleting tempo at: %d with tempo=%d\n", i->a, i->b);
            tempomap.delTempo(i->a);
            updateFlags |= SC_TEMPO;
            break;
        case UndoOp::AddSig:
            ///sigmap.add(i->a, i->b, i->c);
            AL::sigmap.add(i->a, AL::TimeSignature(i->b, i->c));
            updateFlags |= SC_SIG;
            break;
        case UndoOp::DeleteSig:
            ///sigmap.del(i->a);
            AL::sigmap.del(i->a);
            updateFlags |= SC_SIG;
            break;
        case UndoOp::ModifyClip:
        case UndoOp::ModifyMarker:
            break;
        }
    }
}