1 /***************************************************************************
2 positionedit.cpp - description
5 copyright : (C) 2008 by Marco Gittler
6 email : g.marco@freenet.de
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
18 #include "positionedit.h"
19 #include "kdenlivesettings.h"
26 PositionEdit::PositionEdit(const QString name, int pos, int min, int max, const Timecode tc, QWidget* parent) :
29 QVBoxLayout *l = new QVBoxLayout;
30 QLabel *lab = new QLabel(name);
33 QHBoxLayout *l2 = new QHBoxLayout;
34 m_display = new TimecodeDisplay(tc);
35 m_slider = new QSlider(Qt::Horizontal);
36 m_slider->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred));
37 m_display->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred));
38 l2->addWidget(m_display);
39 l2->addWidget(m_slider);
40 m_display->setRange(min, max);
41 m_slider->setRange(min, max);
42 connect(m_slider, SIGNAL(valueChanged(int)), m_display, SLOT(setValue(int)));
43 connect(m_slider, SIGNAL(valueChanged(int)), this, SIGNAL(parameterChanged()));
44 connect(m_display, SIGNAL(editingFinished()), this, SLOT(slotUpdatePosition()));
45 m_slider->setValue(pos);
50 PositionEdit::~PositionEdit()
52 m_display->blockSignals(true);
53 m_slider->blockSignals(true);
58 void PositionEdit::updateTimecodeFormat()
60 m_display->slotUpdateTimeCodeFormat();
63 int PositionEdit::getPosition() const
65 return m_slider->value();
68 void PositionEdit::setPosition(int pos)
70 m_slider->setValue(pos);
71 m_display->setValue(pos);
75 void PositionEdit::slotUpdatePosition()
77 m_slider->blockSignals(true);
78 m_slider->setValue(m_display->value());
79 m_slider->blockSignals(false);
80 emit parameterChanged();