Logo Search packages:      
Sourcecode: kdenlive version File versions

void Gui::KdenliveApp::slotProjectDeleteClips ( bool  confirm = true  )  [slot]

Remove clips from the project

Definition at line 3385 of file kdenlive.cpp.

References KdenliveDoc::activateSceneListGeneration(), addCommand(), Gui::TransitionDialog::belongsToClip(), Gui::MonitorManager::clearClip(), effectList(), KdenliveDoc::findClipNodeById(), getDocument(), m_doc, m_monitorManager, m_projectList, KdenliveDoc::referencedClips(), Gui::TransitionDialog::setTransition(), and slotStatusMsg().

Referenced by initActions().

                                                         {
      slotStatusMsg(i18n("Removing Clips"));
      
      DocClipRefList refClipList = m_projectList->currentSelection();
      if (refClipList.count() > 0) {
          if (confirm) {
            if (refClipList.count() > 1 || refClipList.first()->referencedClip()->numReferences() > 0)
                if (KMessageBox::warningContinueCancel(this, i18n("This will remove all clips on timeline that are currently using the selected clips. Are you sure you want to do this?")) != KMessageBox::Continue)
                {
                  slotStatusMsg(i18n("Ready."));
                  return;
                }
          }
          DocClipRef *refClip;

          // Create a macro command that will delete all clips from the timeline involving this avfile. Then, delete it.
          KMacroCommand *macroCommand = new KMacroCommand(i18n("Delete Clip"));

          for (refClip = refClipList.first(); refClip; refClip = refClipList.next()) {
            DocClipBase *clip = refClip->referencedClip();

            // NOTE - we clear the monitors of the clip here - this does _not_ go into the macro command.
            int id = clip->getId();
            m_monitorManager.clearClip(clip);

            DocClipRefList list = m_doc->referencedClips(clip);
            QPtrListIterator < DocClipRef > itt(list);

            while (itt.current()) {
                Command::KAddRefClipCommand * command = new Command::KAddRefClipCommand(effectList(), *m_doc, itt.current(), false);
                if (m_transitionPanel->belongsToClip(itt.current())) m_transitionPanel->setTransition(0);
                macroCommand->addCommand(command);
                ++itt;
            }

            // remove audio thumbnail and tmp files
            clip->removeTmpFile();

            DocumentBaseNode *node = m_doc->findClipNodeById(id);
            if (!node) kdDebug()<<"++++++  CANNOT FIND NODE: "<<id<<endl;
            macroCommand->addCommand(new Command::KAddClipCommand(*m_doc, node->name(), clip, node->parent(), false));
          }
          addCommand(macroCommand, true);
          if (confirm) getDocument()->activateSceneListGeneration(true);
      }
      else if (confirm) slotProjectDeleteFolder();
      slotStatusMsg(i18n("Ready."));
    }


Generated by  Doxygen 1.6.0   Back to index