Logo Search packages:      
Sourcecode: kdenlive version File versions

void Gui::KdenliveApp::requestDocumentClose ( KURL  new_url = NULL  )  [protected]

Do some stuff required before attempting to close the current project

Definition at line 2319 of file kdenlive.cpp.

References Gui::KTimeLine::clearGuides(), initDocument(), m_commandHistory, m_monitorManager, Gui::MonitorManager::resetMonitors(), and Gui::EffectStackDialog::slotSetEffectStack().

Referenced by openDocumentFile(), and slotFileNew().

    {
    m_timeline->clearGuides();
    m_commandHistory->clear();
    // Check if new file is an NTSC or PAL doc and set environnement variables accordingly
    if (!new_url.isEmpty()) {
      QFile myFile(new_url.path());
      if (myFile.open(IO_ReadOnly)) {
            bool foundFormat = false;
            QDomDocument doc;
            doc.setContent(&myFile, false);
            QDomElement documentElement = doc.documentElement();
            while (!documentElement.isNull() && documentElement.tagName() != "kdenlivedoc") {
                  documentElement = documentElement.firstChild().toElement();
                  kdWarning() <<
                  "KdenliveDoc::loadFromXML() document element has unknown tagName : "
                  << documentElement.tagName() << endl;
            }
            double version = documentElement.attribute("version", "0").toDouble();
            kdDebug()<<"// DOCUMENT: "<<new_url.path()<<", version: "<<version<<endl;
            QDomNode n = documentElement.firstChild();

            while (!n.isNull()) {
                  QDomElement e = n.toElement();
                  if (!e.isNull()) {
                      if (e.tagName() == "properties") {
                        QString vFormat;
                        if (version < 0.6) {
                            // convert video format from old project files
                            int format = e.attribute("projectvideoformat","0").toInt();
                            switch (format) {
                              case 1:
                                  vFormat = "dv_ntsc";
                                  break;
                              case 2:
                                  vFormat = "dv_pal_wide";
                                  break;
                              case 3:
                                  vFormat = "dv_ntsc_wide";
                                  break;
                              default:
                                  vFormat = "dv_pal";
                                  break;
                            }
                        }
                        else vFormat = e.attribute("projectvideoformat","dv_pal");
                        setProjectFormat(vFormat);
                        foundFormat = true;
                        break;
                      }
                  }
                  n = n.nextSibling();
            }
            if (!foundFormat) {
                  setProjectFormat("dv_pal");
            }
            myFile.close();
      }
      else {
            setProjectFormat("dv_pal");
      }
    }

    if (m_effectStackDialog) m_effectStackDialog->slotSetEffectStack(0);
    m_monitorManager.resetMonitors();
    initDocument(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks());
    refreshVirtualZone();
    }


Generated by  Doxygen 1.6.0   Back to index