Commit 1083dd76 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Correcting length displayed in tooltip

parent b7cfbcf1
......@@ -73,12 +73,18 @@ qint64 Clip::getLength() const
return m_length;
}
qint64 Clip::getLengthSecond() const
{
return m_lengthSeconds;
}
void Clip::computeLength()
{
float fps = m_parent->getFps();
unsigned int fps = m_parent->getFps();
if ( fps < 0.1f )
fps = FPS;
qint64 nbMs = (qint64)( ( m_end - m_begin ) * (float)m_parent->getLength() );
m_lengthSeconds = nbMs / 1000;
m_length = (nbMs / 1000) * fps;
}
......
......@@ -69,6 +69,11 @@ class Clip : public QObject
*/
qint64 getLength() const;
/**
\return Returns the clip length in seconds.
*/
qint64 getLengthSecond() const;
/**
\return Returns the Media that the clip was basep uppon.
......@@ -91,6 +96,7 @@ class Clip : public QObject
float m_begin;
float m_end;
qint64 m_length;
qint64 m_lengthSeconds;
QUuid m_uuid;
};
......
......@@ -58,7 +58,7 @@ void Library::removingMediaAsked( const QUuid& uuid )
void Library::metaDataComputed( Media* media )
{
Clip* clip = new Clip( media );
Clip* clip = new Clip( media, 0.5f, 1.0f );
m_clips[clip->getUuid()] = clip;
emit newClipLoaded( clip );
}
......
......@@ -44,7 +44,7 @@ ListViewMediaItem::ListViewMediaItem( Clip* clip, Media::FileType fType, QListWi
setIcon( QIcon( m_clip->getParent()->getSnapshot() ) );
QTime length;
length = length.addSecs( m_clip->getLength() / 1000 );
length = length.addSecs( m_clip->getLengthSecond() );
setToolTip( "Filename: " + m_clip->getParent()->getFileInfo()->fileName() + "\n" +
"Length: " + length.toString() );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment