1 /***************************************************************************
2 * Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
22 #include <KStandardDirs>
26 #include "kdenlivesettings.h"
27 #include "clipproperties.h"
30 ClipProperties::ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidget * parent): QDialog(parent), m_tc(tc), m_clip(clip), m_fps(fps) {
31 setFont(KGlobalSettings::toolBarFont());
33 KUrl url = m_clip->fileURL();
34 m_view.clip_path->setText(url.path());
35 m_view.clip_description->setText(m_clip->description());
36 QMap <QString, QString> props = m_clip->properties();
38 if (props.contains("audiocodec"))
39 m_view.clip_acodec->setText(props["audiocodec"]);
40 if (props.contains("frequency"))
41 m_view.clip_frequency->setText(props["frequency"]);
42 if (props.contains("channels"))
43 m_view.clip_channels->setText(props["channels"]);
45 CLIPTYPE t = m_clip->clipType();
47 if (props.contains("frame_size"))
48 m_view.clip_size->setText(props["frame_size"]);
49 if (props.contains("videocodec"))
50 m_view.clip_vcodec->setText(props["videocodec"]);
51 if (props.contains("fps"))
52 m_view.clip_fps->setText(props["fps"]);
53 if (props.contains("aspect_ratio"))
54 m_view.clip_ratio->setText(props["aspect_ratio"]);
56 QPixmap pix = m_clip->thumbProducer()->getImage(url, 240, 180);
57 m_view.clip_thumb->setPixmap(pix);
58 if (t == IMAGE || t == VIDEO) m_view.tabWidget->removeTab(1);
60 m_view.tabWidget->removeTab(0);
61 m_view.clip_thumb->setHidden(true);
63 if (t != IMAGE && t != COLOR) m_view.clip_duration->setReadOnly(true);
65 KFileItem f(KFileItem::Unknown, KFileItem::Unknown, url, true);
66 m_view.clip_filesize->setText(KIO::convertSize(f.size()));
67 m_view.clip_duration->setText(tc.getTimecode(m_clip->duration(), m_fps));
71 int ClipProperties::clipId() {
72 return m_clip->getId();
75 QMap <QString, QString> ClipProperties::properties() {
76 QMap <QString, QString> props;
77 props["description"] = m_view.clip_description->text();
81 #include "clipproperties.moc"