Logo Search packages:      
Sourcecode: kdenlive version File versions

Gui::KdenliveApp::KdenliveApp ( bool  newDoc,
QWidget *  parent = 0,
const char *  name = 0 
)

construtor of KdenliveApp, calls all init functions to create the application.

Definition at line 132 of file kdenlive.cpp.

References config, initActions(), initDocument(), initEffects::initializeEffects(), initStatusBar(), initView(), m_commandHistory, m_doc, m_effectList, m_projectFormat, m_selectedFile, openLastFile(), readOptions(), KdenliveDoc::setProjectName(), and slotAddTransition().

                       :KDockMainWindow(parent, name), m_monitorManager(this),
    m_workspaceMonitor(NULL), m_clipMonitor(NULL), m_captureMonitor(NULL), m_exportWidget(NULL), m_renderManager(NULL), m_doc(NULL), m_selectedFile(NULL), m_copiedClip(NULL), m_projectList(NULL), m_effectStackDialog(NULL), m_effectListDialog(NULL), m_projectFormat("dv_pal"), m_timelinePopupMenu(NULL), m_rulerPopupMenu(NULL), m_exportDvd(NULL), m_transitionPanel(NULL), m_resizeFunction(NULL), m_moveFunction(NULL), m_rollFunction(NULL), m_markerFunction(NULL),m_newLumaDialog(NULL), m_externalMonitor(0) {

      parseProfiles();
      config = kapp->config();
      config->setGroup("General Options");
      if (!config->readBoolEntry("FirstRun")) {
          // This is the first run of Kdenlive, ask user some basic things
          firstRun_UI *dia = new firstRun_UI(this);

          dia->video_format->insertStringList(videoProjectFormats());
          dia->exec();
          KdenliveSettings::setDefaultprojectformat(projectFormatFromName(dia->video_format->currentText()));
          if (dia->openlast->isChecked()) {
            KdenliveSettings::setOpenlast(true);
            KdenliveSettings::setOpenblank(false);
            KdenliveSettings::setAlwaysask(false);
          }
          else if (dia->openblank->isChecked()) {
            KdenliveSettings::setOpenlast(false);
            KdenliveSettings::setOpenblank(true);
            KdenliveSettings::setAlwaysask(false);
          }
          else {
            KdenliveSettings::setOpenlast(false);
            KdenliveSettings::setOpenblank(false);
            KdenliveSettings::setAlwaysask(true);
          }
          delete dia;
          config->setGroup("General Options");
          config->writeEntry("FirstRun", true);
      }
      config->setGroup("KNewStuff");
      QString str = config->readEntry("ProvidersUrl");
      if (str.isEmpty()) {
          config->writeEntry("ProvidersUrl", "http://download.kde.org/khotnewstuff/kdenlive-providers.xml");
          config->sync();
      }

      initStatusBar();

      int audioTracks = KdenliveSettings::audiotracks();
      int videoTracks = KdenliveSettings::videotracks();
      QString newProjectName;
      KdenliveSettings::setMultitrackview(false);

      if (!KdenliveSettings::openlast() && !KdenliveSettings::openblank() && !newDoc) {
            slotNewProject(&newProjectName, &m_selectedFile, &videoTracks, &audioTracks, false, true);
      }
      else if (KdenliveSettings::openblank() && !newDoc) {
            slotNewProject(&newProjectName, &m_selectedFile, &videoTracks, &audioTracks, true, true);
      }

        QPixmap pixmap(locate("appdata", "graphics/kdenlive-splash.png"));

        if (KdenliveSettings::showsplash()) {
            splash = new KdenliveSplash(pixmap);
            splash->show();
            QTimer::singleShot(10*1000, this, SLOT(slotSplashTimeout()));
        }

      if (KdenliveSettings::useexternalmonitor()) createExternalMonitor();

      // renderer options
      m_renderManager = new KRenderManager(this);

      // call inits to invoke all other construction parts
      m_commandHistory = new KCommandHistory(actionCollection(), true);
      initActions();

      m_effectList.setAutoDelete(true);

      initEffects::initializeEffects( &m_effectList );

      // init transitions & effects menu
      transitionsMenu = ((QPopupMenu *) factory()->container("add_transition_menu", this));
      transitionsMenu->insertItem(i18n("Crossfade"));
      transitionsMenu->insertItem(i18n("Push"));
      transitionsMenu->insertItem(i18n("Pip"));
      transitionsMenu->insertItem(i18n("Wipe"));
      connect(transitionsMenu, SIGNAL(activated(int)), this, SLOT(slotAddTransition(int)));

      audioEffectsMenu = ((QPopupMenu *) factory()->container("audio_effect", this));
      videoEffectsMenu = ((QPopupMenu *) factory()->container("video_effect", this));
      removeEffectsMenu = ((QPopupMenu *) factory()->container("remove_effect", this));
      QPtrListIterator < EffectDesc > itt(m_effectList);
      QStringList videoEffectsList;
      QStringList audioEffectsList;
      while (itt.current()) {
          if (itt.current()->type() == VIDEOEFFECT) {
            videoEffectsList.append(itt.current()->name());
          }
          else audioEffectsList.append(itt.current()->name()); 
          ++itt;
      }
      videoEffectsList.sort();
      audioEffectsList.sort();
      for (QStringList::Iterator it = videoEffectsList.begin(); it != videoEffectsList.end(); ++it)
      videoEffectsMenu->insertItem( *it );
      for (QStringList::Iterator it = audioEffectsList.begin(); it != audioEffectsList.end(); ++it)
      audioEffectsMenu->insertItem( *it );

      connect(audioEffectsMenu, SIGNAL(activated(int)), this, SLOT(slotAddAudioEffect(int)));
      connect(videoEffectsMenu, SIGNAL(activated(int)), this, SLOT(slotAddVideoEffect(int)));
      connect(removeEffectsMenu, SIGNAL(activated(int)), this, SLOT(slotRemoveEffect(int)));
      initWidgets();
      initDocument(videoTracks, audioTracks);
      readOptions();
      // disable actions at startup
      //  filePrint->setEnabled(false);
      editCut->setEnabled(true);
      editCopy->setEnabled(true);
      editPaste->setEnabled(false);
      fileSave->setEnabled(false);
      fileSaveAs->setEnabled(true);

      m_autoSaveTimer = new QTimer(this);
      connect(m_autoSaveTimer, SIGNAL(timeout()), this, SLOT(slotAutoSave()));
      if (KdenliveSettings::autosave())
          m_autoSaveTimer->start(KdenliveSettings::autosavetime() * 60000, false);
      // Reopen last project if user asked it
      if (KdenliveSettings::openlast()) openLastFile();
        else if (!m_selectedFile.isEmpty()) openSelectedFile();
      else if (!newDoc || KdenliveSettings::openblank()) {
          initView();
          setCaption(newProjectName + ".kdenlive" + " - " + projectFormatName(m_projectFormat), false);
          m_doc->setProjectName( newProjectName + ".kdenlive");
          m_dockProjectList->makeDockVisible();
          initMonitors();
      }
      if (KdenliveSettings::showsplash()) QTimer::singleShot(500, this, SLOT(slotSplashTimeout()));
      connect(manager(), SIGNAL(change()), this, SLOT(slotUpdateLayoutState()));
      setAutoSaveSettings();
    }


Generated by  Doxygen 1.6.0   Back to index