Correctly update timecode format in properties panel when required

This commit is contained in:
Jean-Baptiste Mardelle
2015-02-08 23:57:56 +01:00
parent 21879b8cab
commit e23a2086dd
5 changed files with 20 additions and 2 deletions

View File

@@ -1057,6 +1057,7 @@ void Bin::showClipProperties(ProjectClip *clip)
m_propertiesPanel->setLayout(lay);
}
ClipPropertiesController *panel = clip->buildProperties(m_propertiesPanel);
connect(this, SIGNAL(refreshTimeCode()), panel, SLOT(slotRefreshTimeCode()));
connect(panel, SIGNAL(updateClipProperties(const QString &, QMap<QString, QString>, QMap<QString, QString>)), this, SLOT(slotEditClipCommand(const QString &, QMap<QString, QString>, QMap<QString, QString>)));
lay->addWidget(panel);
}
@@ -1693,3 +1694,7 @@ void Bin::slotOpenClip()
}
}
void Bin::updateTimecodeFormat()
{
emit refreshTimeCode();
}

View File

@@ -392,7 +392,8 @@ public:
void renameSubClip(const QString &id, const QString &newName, const QString oldName, int in, int out);
/** @brief Returns current project's timecode. */
Timecode projectTimecode() const;
/** @brief Trigger timecode format refresh where needed. */
void updateTimecodeFormat();
private slots:
void slotAddClip();
@@ -513,6 +514,8 @@ signals:
void gotFilterJobResults(QString,int,int,stringMap,stringMap);
/** @brief The clip was changed and thumbnail needs a refresh. */
void clipNeedsReload(const QString &,bool);
/** @brief Trigger timecode format refresh where needed. */
void refreshTimeCode();
};
#endif

View File

@@ -2908,6 +2908,7 @@ void MainWindow::slotUpdateTimecodeFormat(int ix)
m_projectMonitor->updateTimecodeFormat();
m_transitionConfig->updateTimecodeFormat();
m_effectStack->updateTimecodeFormat();
pCore->bin()->updateTimecodeFormat();
//pCore->projectManager()->currentTrackView()->projectView()->clearSelection();
pCore->projectManager()->currentTrackView()->updateRuler();
slotUpdateMousePosition(pCore->projectManager()->currentTrackView()->projectView()->getMousePos());

View File

@@ -39,6 +39,7 @@ ClipPropertiesController::ClipPropertiesController(Timecode tc, const QString &i
{
if (type == Color || type == Image) {
QVBoxLayout *vbox = new QVBoxLayout;
// Edit duration widget
m_originalProperties.insert("out", m_properties.get("out"));
m_originalProperties.insert("length", m_properties.get("length"));
QLabel *lab = new QLabel(i18n("Duration"), this);
@@ -47,8 +48,10 @@ ClipPropertiesController::ClipPropertiesController(Timecode tc, const QString &i
timePos->setValue(m_properties.get_int("out") + 1);
vbox->addWidget(timePos);
connect(timePos, SIGNAL(timeCodeEditingFinished(int)), this, SLOT(slotDurationChanged(int)));
connect(this, SIGNAL(updateTimeCodeFormat()), timePos, SLOT(slotUpdateTimeCodeFormat()));
connect(this, SIGNAL(modified(int)), timePos, SLOT(setValue(int)));
if (type == Color) {
// Edit color widget
m_originalProperties.insert("resource", m_properties.get("resource"));
mlt_color color = m_properties.get_color("resource");
ChooseColorWidget *choosecolor = new ChooseColorWidget(i18n("Color"), QColor::fromRgb(color.r, color.g, color.b).name(), false, this);
@@ -66,6 +69,11 @@ ClipPropertiesController::~ClipPropertiesController()
{
}
void ClipPropertiesController::slotRefreshTimeCode()
{
emit updateTimeCodeFormat();
}
void ClipPropertiesController::slotReloadProperties()
{
if (m_type == Color) {
@@ -88,7 +96,6 @@ void ClipPropertiesController::slotColorModified(QColor newcolor)
void ClipPropertiesController::slotDurationChanged(int duration)
{
qDebug()<<"NEW DUR: "<<duration;
QMap <QString, QString> properties;
properties.insert("length", QString::number(duration));
properties.insert("out", QString::number(duration - 1));

View File

@@ -54,6 +54,7 @@ public:
public slots:
void slotReloadProperties();
void slotRefreshTimeCode();
private slots:
void slotColorModified(QColor newcolor);
@@ -69,6 +70,7 @@ signals:
void updateClipProperties(const QString &,QMap <QString, QString>, QMap <QString, QString>);
void modified(QColor);
void modified(int);
void updateTimeCodeFormat();
};
#endif