1 /***************************************************************************
2 geomeytrval.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"
23 PositionEdit::PositionEdit(const QString name, int pos, int min, int max, const Timecode tc, QWidget* parent) :
28 m_ui.label->setText(name);
29 m_ui.horizontalSlider->setRange(min, max);
30 connect(m_ui.horizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateTimecode()));
31 connect(m_ui.krestrictedline, SIGNAL(editingFinished()), this, SLOT(slotUpdatePosition()));
32 m_ui.horizontalSlider->setValue(pos);
33 m_ui.krestrictedline->setText(m_tc.getTimecodeFromFrames(pos));
36 int PositionEdit::getPosition() const
38 return m_ui.horizontalSlider->value();
41 void PositionEdit::setPosition(int pos)
43 m_ui.horizontalSlider->setValue(pos);
44 m_ui.krestrictedline->setText(m_tc.getTimecodeFromFrames(pos));
47 void PositionEdit::slotUpdateTimecode()
49 m_ui.krestrictedline->setText(m_tc.getTimecodeFromFrames(m_ui.horizontalSlider->value()));
50 emit parameterChanged();
53 void PositionEdit::slotUpdatePosition()
55 m_ui.horizontalSlider->blockSignals(true);
56 int pos = m_tc.getFrameCount(m_ui.krestrictedline->text());
57 m_ui.horizontalSlider->setValue(pos);
58 if (pos != m_ui.horizontalSlider->value()) {
60 m_ui.krestrictedline->setText(m_tc.getTimecodeFromFrames(m_ui.horizontalSlider->value()));
62 m_ui.horizontalSlider->blockSignals(false);
63 emit parameterChanged();