Logo Search packages:      
Sourcecode: kdenlive version File versions

void Gui::KdenliveApp::slotSyncTimeLineWithDocument (  )  [slot]

Syncrhonise the display of the timeline with that of the document.

At least one track within the project have been added or removed.

The timeline needs to be updated to show these changes.

Definition at line 4345 of file kdenlive.cpp.

References Gui::KTimeLine::clearTrackList(), getDocument(), Gui::KTimeLine::insertTrack(), and Gui::KTimeLine::trackList().

Referenced by initView(), and updateConfiguration().

                                                   {
      unsigned int index = 0;

      QPtrListIterator < DocTrackBase >
          trackItt(getDocument()->trackList());

      // Store the state of each track to restore it when rebuilding the tracks
      QPtrListIterator < KTrackPanel >
          panelList(m_timeline->trackList());
      uint tracksCount = trackItt.count() * 2;  // double because of keyframe tracks
      bool collapsedState[tracksCount];

      uint i = 0;

      while (i < tracksCount) {
          if (panelList.current())
            collapsedState[i] =
                panelList.current()->isTrackCollapsed();
          else
            collapsedState[i] = false;
          i++;
          ++panelList;
      }

      m_timeline->clearTrackList();


      while (trackItt.current()) {
          disconnect(trackItt.current(), SIGNAL(redrawSection(int, GenTime, GenTime)), m_timeline,
          SLOT(drawPartialTrack(int, GenTime, GenTime)));
          disconnect(trackItt.current(), SIGNAL(clipLayoutChanged(int)),
            m_timeline, SLOT(drawCurrentTrack(int)));
          disconnect(trackItt.current(), SIGNAL(clipSelectionChanged()),
            m_timeline, SLOT(drawTrackViewBackBuffer()));

          if (trackItt.current()->clipType() == "Video") {
            m_timeline->insertTrack(index, new KMMTrackVideoPanel(this,
                  m_timeline, getDocument(),
                  (dynamic_cast <
                      DocTrackVideo * >(trackItt.current())),
                  collapsedState[index]));
            ++index;

            m_timeline->insertTrack(index,
                new KMMTrackKeyFramePanel(m_timeline, getDocument(),
                  (*trackItt), collapsedState[index], KEYFRAMETRACK));
            ++index;
          } else if (trackItt.current()->clipType() == "Sound") {
            m_timeline->insertTrack(index, new KMMTrackSoundPanel(this,
                  m_timeline, getDocument(),
                  (dynamic_cast <
                      DocTrackSound * >(trackItt.current())),
                  collapsedState[index]));
            ++index;
            m_timeline->insertTrack(index,
                new KMMTrackKeyFramePanel(m_timeline, getDocument(),
                  (*trackItt), collapsedState[index], KEYFRAMETRACK));
            ++index;
          } else {
            kdWarning() << "Sync failed" << endl;
          }
          connect(trackItt.current(), SIGNAL(redrawSection(int, GenTime, GenTime)), m_timeline,
          SLOT(drawPartialTrack(int, GenTime, GenTime)));
            connect(trackItt.current(), SIGNAL(clipLayoutChanged(int)),
                    m_timeline, SLOT(drawCurrentTrack(int)));
            connect(trackItt.current(), SIGNAL(clipSelectionChanged()),
                    m_timeline, SLOT(drawTrackViewBackBuffer()));

          ++trackItt;
      }
      //m_timeline->resizeTracks();
    }


Generated by  Doxygen 1.6.0   Back to index