]> git.sesse.net Git - kdenlive/blob - src/markerdialog.cpp
volume effect now works fine with keyframes
[kdenlive] / src / markerdialog.cpp
1 /***************************************************************************
2  *   Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *                                                                         *
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.                                   *
8  *                                                                         *
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.                          *
13  *                                                                         *
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  ***************************************************************************/
19
20
21 #include <KDebug>
22
23 #include "markerdialog.h"
24
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());
27     m_fps = m_tc.fps();
28     m_view.setupUi(this);
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();
35     adjustSize();
36 }
37
38
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;
42     duration ++;
43     m_view.marker_position->setText(m_tc.getTimecode(GenTime(duration, m_fps), m_fps));
44 }
45
46 void MarkerDialog::slotTimeDown() {
47     int duration = m_tc.getFrameCount(m_view.marker_position->text(), m_fps);
48     if (duration <= 0) return;
49     duration --;
50     m_view.marker_position->setText(m_tc.getTimecode(GenTime(duration, m_fps), m_fps));
51 }
52
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());
55 }
56
57 #include "markerdialog.moc"
58
59