m_path(NULL),
m_fixedMode(false),
m_frameSize(frame_size),
- m_startPoint(startPoint)
+ m_startPoint(startPoint),
+ m_timePos(t)
{
setupUi(this);
+ m_timePos.setSizePolicy(QSizePolicy::Maximum, QSizePolicy::MinimumExpanding);
+ toolbarlayout->addWidget(&m_timePos);
+ toolbarlayout->insertStretch(-1);
+
QVBoxLayout* vbox = new QVBoxLayout(widget);
m_sceneview = new QGraphicsView(this);
m_sceneview->setBackgroundBrush(QBrush(Qt::black));
connect(buttonAdd , SIGNAL(clicked()) , this , SLOT(slotAddFrame()));
connect(m_scene, SIGNAL(actionFinished()), this, SLOT(slotUpdateTransitionProperties()));
connect(m_scene, SIGNAL(doubleClickEvent()), this, SLOT(slotGeometry()));
- connect(pos_up, SIGNAL(clicked()), this, SLOT(slotPosUp()));
- connect(pos_down, SIGNAL(clicked()), this, SLOT(slotPosDown()));
buttonhcenter->setIcon(KIcon("kdenlive-align-hor"));
buttonhcenter->setToolTip(i18n("Align item horizontally"));
void Geometryval::slotTransparencyChanged(int transp)
{
- int pos;
- if (KdenliveSettings::frametimecode()) pos = timePos->text().toInt();
- else pos = m_timecode.getFrameCount(timePos->text());
+ int pos = m_timePos.value();
Mlt::GeometryItem item;
int error = m_geom->fetch(&item, pos);
if (error || item.key() == false) {
void Geometryval::updateTimecodeFormat()
{
- timePos->setInputMask("");
- if (KdenliveSettings::frametimecode()) {
- int frames = m_timecode.getFrameCount(timePos->text());
- QIntValidator *valid = new QIntValidator(this);
- valid->setBottom(0);
- timePos->setValidator(valid);
- timePos->setText(QString::number(frames));
- } else {
- int pos = timePos->text().toInt();
- timePos->setValidator(m_timecode.validator());
- timePos->setText(m_timecode.getTimecodeFromFrames(pos));
- }
-}
-
-void Geometryval::slotPosUp()
-{
- int pos;
- if (KdenliveSettings::frametimecode()) pos = timePos->text().toInt();
- else pos = m_timecode.getFrameCount(timePos->text());
- pos ++;
- if (pos > m_helper->frameLength) pos = m_helper->frameLength;
- if (KdenliveSettings::frametimecode()) {
- timePos->setText(QString::number(pos));
- } else timePos->setText(m_timecode.getTimecodeFromFrames(pos));
- slotPositionChanged();
-}
-
-void Geometryval::slotPosDown()
-{
- int pos;
- if (KdenliveSettings::frametimecode()) pos = timePos->text().toInt();
- else pos = m_timecode.getFrameCount(timePos->text());
- pos --;
- if (pos < 0) pos = 0;
- if (KdenliveSettings::frametimecode()) {
- timePos->setText(QString::number(pos));
- } else timePos->setText(m_timecode.getTimecodeFromFrames(pos));
- slotPositionChanged();
+ m_timePos.slotPrepareTimeCodeFormat(m_timecode);
}
void Geometryval::slotPositionChanged(int pos, bool seek)
{
if (pos == -1) {
- if (KdenliveSettings::frametimecode()) pos = timePos->text().toInt();
- else pos = m_timecode.getFrameCount(timePos->text());
+ pos = m_timePos.value();
}
if (seek && KdenliveSettings::transitionfollowcursor()) emit seekToPos(pos + m_startPoint);
- if (KdenliveSettings::frametimecode()) {
- timePos->setText(QString::number(pos));
- } else timePos->setText(m_timecode.getTimecodeFromFrames(pos));
-
+ m_timePos.setValue(pos);
//spinPos->setValue(pos);
m_helper->setValue(pos);
Mlt::GeometryItem item;
{
// check there is more than one keyframe
Mlt::GeometryItem item;
- int frame;
- if (KdenliveSettings::frametimecode()) frame = timePos->text().toInt();
- else frame = m_timecode.getFrameCount(timePos->text());
+ int frame = m_timePos.value();
if (pos == -1) pos = frame;
int error = m_geom->next_key(&item, pos + 1);
void Geometryval::slotAddFrame(int pos)
{
- int frame;
- if (KdenliveSettings::frametimecode()) frame = timePos->text().toInt();
- else frame = m_timecode.getFrameCount(timePos->text());
+ int frame = m_timePos.value();
if (pos == -1) pos = frame;
Mlt::GeometryItem item;
item.frame(pos);
// Go to end
pos = m_helper->frameLength;
} else pos = item.frame();
-
- if (KdenliveSettings::frametimecode()) {
- timePos->setText(QString::number(pos));
- } else timePos->setText(m_timecode.getTimecodeFromFrames(pos));
+ m_timePos.setValue(pos);
slotPositionChanged();
}
kDebug() << "// SEEK TO NEXT KFR: " << error;
if (error) return;
int pos = item.frame();
- if (KdenliveSettings::frametimecode()) {
- timePos->setText(QString::number(pos));
- } else timePos->setText(m_timecode.getTimecodeFromFrames(pos));
+ m_timePos.setValue(pos);
slotPositionChanged();
}
spinTransp->setMaximum(500);
label_pos->setHidden(true);
m_helper->setHidden(true);
- timePos->setHidden(true);
+ m_timePos.setHidden(true);
}
if (par.attribute("opacity") == "false") {
label_opacity->setHidden(true);
slotPositionChanged(0, false);
slotUpdateGeometry();
if (!m_fixedMode) {
- connect(timePos, SIGNAL(editingFinished()), this , SLOT(slotPositionChanged()));
+ m_timePos.setMaximum(maxFrame - minFrame - 1);
+ connect(&m_timePos, SIGNAL(editingFinished()), this , SLOT(slotPositionChanged()));
}
connect(spinTransp, SIGNAL(valueChanged(int)), this , SLOT(slotTransparencyChanged(int)));
}
void Geometryval::slotUpdateTransitionProperties()
{
- int pos;
- if (KdenliveSettings::frametimecode()) pos = timePos->text().toInt();
- else pos = m_timecode.getFrameCount(timePos->text());
+ int pos = m_timePos.value();
Mlt::GeometryItem item;
int error = m_geom->next_key(&item, pos);
if (error || item.frame() != pos) {
bool Geometryval::keyframeSelected()
{
Mlt::GeometryItem item;
- int pos;
- if (KdenliveSettings::frametimecode()) pos = timePos->text().toInt();
- else pos = m_timecode.getFrameCount(timePos->text());
+ int pos = m_timePos.value();
if (m_geom->fetch(&item, pos) || item.key() == false) return false;
return true;
}