1 /***************************************************************************
2 * Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
23 #include "markerdialog.h"
25 MarkerDialog::MarkerDialog(DocClipBase *clip, CommentedTime t, Timecode tc, QWidget * parent): QDialog(parent), m_tc(tc), m_clip(clip), m_marker(t) {
26 setFont(KGlobalSettings::toolBarFont());
29 m_view.marker_position->setText(tc.getTimecode(t.time(), tc.fps()));
30 m_view.marker_comment->setText(t.comment());
31 connect(m_view.position_up, SIGNAL(clicked()), this, SLOT(slotTimeUp()));
32 connect(m_view.position_down, SIGNAL(clicked()), this, SLOT(slotTimeDown()));
33 m_view.marker_comment->selectAll();
34 m_view.marker_comment->setFocus();
39 void MarkerDialog::slotTimeUp() {
40 int duration = m_tc.getFrameCount(m_view.marker_position->text(), m_fps);
41 if (duration >= m_clip->duration().frames(m_fps)) return;
43 m_view.marker_position->setText(m_tc.getTimecode(GenTime(duration, m_fps), m_fps));
46 void MarkerDialog::slotTimeDown() {
47 int duration = m_tc.getFrameCount(m_view.marker_position->text(), m_fps);
48 if (duration <= 0) return;
50 m_view.marker_position->setText(m_tc.getTimecode(GenTime(duration, m_fps), m_fps));
53 CommentedTime MarkerDialog::newMarker() {
54 return CommentedTime(GenTime(m_tc.getFrameCount(m_view.marker_position->text(), m_fps), m_fps), m_view.marker_comment->text());
57 #include "markerdialog.moc"