#include <KStandardDirs>
#include <KDebug>
+#include <KFileItem>
#include "kdenlivesettings.h"
#include "clipproperties.h"
#include "kthumb.h"
-ClipProperties::ClipProperties(DocClipBase *clip, QWidget * parent): QDialog(parent) {
+ClipProperties::ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidget * parent): QDialog(parent), m_tc(tc), m_clip(clip), m_fps(fps) {
m_view.setupUi(this);
- m_clip = clip;
-
- m_view.clip_path->setText(m_clip->fileURL().path());
+ KUrl url = m_clip->fileURL();
+ m_view.clip_path->setText(url.path());
m_view.clip_description->setText(m_clip->description());
QMap <QString, QString> props = m_clip->properties();
- if (props.contains("frame_size"))
- m_view.clip_size->setText(props["frame_size"]);
- if (props.contains("videocodec"))
- m_view.clip_vcodec->setText(props["videocodec"]);
+
if (props.contains("audiocodec"))
m_view.clip_acodec->setText(props["audiocodec"]);
- if (props.contains("fps"))
- m_view.clip_fps->setText(props["fps"]);
if (props.contains("frequency"))
m_view.clip_frequency->setText(props["frequency"]);
if (props.contains("channels"))
m_view.clip_channels->setText(props["channels"]);
- if (props.contains("aspect_ratio"))
- m_view.clip_ratio->setText(props["aspect_ratio"]);
- QPixmap pix = m_clip->thumbProducer()->getImage(m_clip->fileURL(), 240, 180);
- m_view.clip_thumb->setPixmap(pix);
+
CLIPTYPE t = m_clip->clipType();
- if (t == IMAGE || t == VIDEO) m_view.tabWidget->removeTab(1);
+ if (t != AUDIO) {
+ if (props.contains("frame_size"))
+ m_view.clip_size->setText(props["frame_size"]);
+ if (props.contains("videocodec"))
+ m_view.clip_vcodec->setText(props["videocodec"]);
+ if (props.contains("fps"))
+ m_view.clip_fps->setText(props["fps"]);
+ if (props.contains("aspect_ratio"))
+ m_view.clip_ratio->setText(props["aspect_ratio"]);
+
+ QPixmap pix = m_clip->thumbProducer()->getImage(url, 240, 180);
+ m_view.clip_thumb->setPixmap(pix);
+ if (t == IMAGE || t == VIDEO) m_view.tabWidget->removeTab(1);
+ } else {
+ m_view.tabWidget->removeTab(0);
+ m_view.clip_thumb->setHidden(true);
+ }
+ if (t != IMAGE && t != COLOR) m_view.clip_duration->setReadOnly(true);
+
+ KFileItem f(KFileItem::Unknown, KFileItem::Unknown, url, true);
+ m_view.clip_filesize->setText(KIO::convertSize(f.size()));
+ m_view.clip_duration->setText(tc.getTimecode(m_clip->duration(), m_fps));
}
#include "clipproperties.moc"
#include "definitions.h"
#include "docclipbase.h"
+#include "timecode.h"
#include "ui_clipproperties_ui.h"
class ClipProperties : public QDialog {
Q_OBJECT
public:
- ClipProperties(DocClipBase *clip, QWidget * parent = 0);
+ ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidget * parent = 0);
private slots:
private:
Ui::ClipProperties_UI m_view;
DocClipBase *m_clip;
-
+ Timecode m_tc;
+ double m_fps;
};
int out = xml.attribute("out").toInt();
if (out != 0) setDuration(GenTime(out, 25));
if (m_name.isEmpty()) m_name = url.fileName();
+
if (!url.isEmpty()) {
m_thumbProd = new KThumb(clipManager, url);
- connect(m_thumbProd, SIGNAL(audioThumbReady(QMap <int, QMap <int, QByteArray> >)), this , SLOT(updateAudioThumbnail(QMap <int, QMap <int, QByteArray> >)));
- connect(this, SIGNAL(getAudioThumbs()), this , SLOT(slotGetAudioThumbs()));
-
- }
- kDebug() << "type is video" << (m_clipType == AV) << " " << m_clipType;
-
- if (m_clipType == AV || m_clipType == AUDIO || m_clipType == UNKNOWN) {
- m_audioTimer = new QTimer(this);
- connect(m_audioTimer, SIGNAL(timeout()), this, SLOT(slotGetAudioThumbs()));
+ if (m_clipType == AV || m_clipType == AUDIO) slotCreateAudioTimer();
}
+ //kDebug() << "type is video" << (m_clipType == AV) << " " << m_clipType;
}
if (m_thumbProd) delete m_thumbProd;
}
+void DocClipBase::slotCreateAudioTimer() {
+ connect(m_thumbProd, SIGNAL(audioThumbReady(QMap <int, QMap <int, QByteArray> >)), this , SLOT(updateAudioThumbnail(QMap <int, QMap <int, QByteArray> >)));
+ connect(this, SIGNAL(getAudioThumbs()), this , SLOT(slotGetAudioThumbs()));
+ m_audioTimer = new QTimer(this);
+ connect(m_audioTimer, SIGNAL(timeout()), this, SLOT(slotGetAudioThumbs()));
+}
+
void DocClipBase::slotRequestAudioThumbs() {
emit getAudioThumbs();
}
void DocClipBase::setClipType(CLIPTYPE type) {
m_clipType = type;
+ if (m_audioTimer == NULL && (m_clipType == AV || m_clipType == AUDIO))
+ slotCreateAudioTimer();
}
KUrl DocClipBase::fileURL() const {
uint m_id;
uint m_projectThumbFrame;
void setAudioThumbCreated(bool isDone);
-
+ /** Holds clip infos like fps, size,... */
QMap <QString, QString> m_properties;
+ /** Create connections for audio thumbnails */
+ void slotCreateAudioTimer();
public slots:
void updateAudioThumbnail(QMap<int, QMap<int, QByteArray> > data);
}
void MainWindow::slotShowClipProperties(DocClipBase *clip) {
- ClipProperties dia(clip);
+ ClipProperties dia(clip, m_activeDocument->timecode(), m_activeDocument->fps(), this);
dia.exec();
}
<rect>
<x>0</x>
<y>0</y>
- <width>284</width>
- <height>439</height>
+ <width>310</width>
+ <height>459</height>
</rect>
</property>
<property name="windowTitle" >
- <string>Dialog</string>
+ <string>Clip Properties</string>
</property>
<layout class="QGridLayout" name="gridLayout_2" >
- <item row="1" column="0" >
+ <item row="0" column="0" colspan="4" >
+ <widget class="QLabel" name="clip_thumb" >
+ <property name="text" >
+ <string>Image preview</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="4" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<string>Path</string>
</property>
</widget>
</item>
- <item row="2" column="0" >
+ <item row="2" column="0" colspan="4" >
<widget class="KLineEdit" name="clip_path" >
<property name="readOnly" >
<bool>true</bool>
</property>
</widget>
</item>
- <item row="3" column="0" >
+ <item row="3" column="0" colspan="4" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Description</string>
</property>
</widget>
</item>
- <item row="4" column="0" >
+ <item row="4" column="0" colspan="4" >
<widget class="KLineEdit" name="clip_description" />
</item>
<item row="5" column="0" >
+ <widget class="QLabel" name="clip_filesize_2" >
+ <property name="text" >
+ <string>Duration</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1" >
+ <widget class="KRestrictedLine" name="clip_duration" >
+ <property name="inputMask" >
+ <string>99:99:99:99; </string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="2" >
+ <widget class="QLabel" name="clip_filesize_3" >
+ <property name="text" >
+ <string>Size:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="3" >
<widget class="QLabel" name="clip_filesize" >
<property name="text" >
- <string>File size:</string>
+ <string>File size</string>
</property>
</widget>
</item>
- <item row="6" column="0" >
+ <item row="6" column="0" colspan="4" >
<widget class="QTabWidget" name="tabWidget" >
<property name="currentIndex" >
<number>0</number>
<rect>
<x>0</x>
<y>0</y>
- <width>264</width>
- <height>187</height>
+ <width>290</width>
+ <height>171</height>
</rect>
</property>
<attribute name="title" >
</property>
</widget>
</item>
- <item row="0" column="2" >
+ <item row="0" column="1" >
<widget class="KLineEdit" name="clip_vcodec" >
<property name="readOnly" >
<bool>true</bool>
</property>
</widget>
</item>
- <item row="1" column="0" colspan="2" >
+ <item row="1" column="0" >
<widget class="QLabel" name="label_6" >
<property name="text" >
<string>Frame size</string>
</property>
</widget>
</item>
- <item row="1" column="2" >
+ <item row="1" column="1" >
<widget class="KLineEdit" name="clip_size" >
<property name="readOnly" >
<bool>true</bool>
</property>
</widget>
</item>
- <item row="2" column="0" colspan="2" >
+ <item row="2" column="0" >
<widget class="QLabel" name="label_7" >
<property name="text" >
<string>Frame rate</string>
</property>
</widget>
</item>
- <item row="2" column="2" >
+ <item row="2" column="1" >
<widget class="KLineEdit" name="clip_fps" >
<property name="readOnly" >
<bool>true</bool>
</property>
</widget>
</item>
- <item row="3" column="0" colspan="2" >
+ <item row="3" column="0" >
<widget class="QLabel" name="label_12" >
<property name="text" >
<string>Aspect ratio</string>
</property>
</widget>
</item>
- <item row="3" column="2" >
+ <item row="3" column="1" >
<widget class="KLineEdit" name="clip_ratio" >
<property name="readOnly" >
<bool>true</bool>
</property>
</widget>
</item>
- <item row="4" column="1" colspan="2" >
+ <item row="4" column="1" >
<spacer name="verticalSpacer_2" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
<property name="sizeHint" stdset="0" >
<size>
<width>77</width>
- <height>68</height>
+ <height>52</height>
</size>
</property>
</spacer>
<rect>
<x>0</x>
<y>0</y>
- <width>264</width>
- <height>187</height>
+ <width>263</width>
+ <height>171</height>
</rect>
</property>
<attribute name="title" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
- <height>35</height>
+ <height>19</height>
</size>
</property>
</spacer>
</widget>
</widget>
</item>
- <item row="7" column="0" >
+ <item row="7" column="1" colspan="2" >
+ <spacer name="verticalSpacer_4" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>20</width>
+ <height>17</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="8" column="0" colspan="4" >
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
- <item row="0" column="0" >
- <widget class="QLabel" name="clip_thumb" >
- <property name="text" >
- <string>Image preview</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
</layout>
</widget>
<customwidgets>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
+ <customwidget>
+ <class>KRestrictedLine</class>
+ <extends>KLineEdit</extends>
+ <header>krestrictedline.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections>