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 ***************************************************************************/
21 #include "clipproperties.h"
22 #include "kdenlivesettings.h"
24 #include "markerdialog.h"
25 #include "profilesdialog.h"
27 #include <KStandardDirs>
30 #include <kdeversion.h>
35 #if KDE_IS_VERSION(4,6,0)
36 #include <Nepomuk/Variant>
37 #include <Nepomuk/Resource>
38 #include <Nepomuk/ResourceManager>
39 #include <Nepomuk/Vocabulary/NIE>
46 static const int VIDEOTAB = 0;
47 static const int AUDIOTAB = 1;
48 static const int COLORTAB = 2;
49 static const int SLIDETAB = 3;
50 static const int IMAGETAB = 4;
51 static const int MARKERTAB = 5;
52 static const int METATAB = 6;
53 static const int ADVANCEDTAB = 7;
56 ClipProperties::ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidget * parent) :
62 m_clipNeedsRefresh(false),
63 m_clipNeedsReLoad(false)
65 setAttribute(Qt::WA_DeleteOnClose, true);
66 setFont(KGlobalSettings::toolBarFont());
69 // force transparency is only for group properties, so hide it
70 m_view.clip_force_transparency->setHidden(true);
71 m_view.clip_transparency->setHidden(true);
73 KUrl url = m_clip->fileURL();
74 m_view.clip_path->setText(url.path());
75 m_view.clip_description->setText(m_clip->description());
76 connect(m_view.clip_description, SIGNAL(textChanged(QString)), this, SLOT(slotModified()));
78 QMap <QString, QString> props = m_clip->properties();
79 m_view.clip_force_out->setHidden(true);
80 m_view.clip_out->setHidden(true);
82 // New display aspect ratio support
83 if (props.contains("force_aspect_num") && props.value("force_aspect_num").toInt() > 0 &&
84 props.contains("force_aspect_den") && props.value("force_aspect_den").toInt() > 0) {
85 m_view.clip_force_ar->setChecked(true);
86 m_view.clip_ar_num->setEnabled(true);
87 m_view.clip_ar_den->setEnabled(true);
88 m_view.clip_ar_num->setValue(props.value("force_aspect_num").toInt());
89 m_view.clip_ar_den->setValue(props.value("force_aspect_den").toInt());
91 // Legacy support for pixel aspect ratio
92 else if (props.contains("force_aspect_ratio") && props.value("force_aspect_ratio").toDouble() > 0) {
93 m_view.clip_force_ar->setChecked(true);
94 m_view.clip_ar_num->setEnabled(true);
95 m_view.clip_ar_den->setEnabled(true);
96 if (props.contains("frame_size")) {
97 int width = props.value("force_aspect_ratio").toDouble() * props.value("frame_size").section('x', 0, 0).toInt();
98 int height = props.value("frame_size").section('x', 1, 1).toInt();
99 if (width > 0 && height > 0) {
100 if ((width / height * 100) == 133) {
104 else if (int(width / height * 100) == 177) {
108 m_view.clip_ar_num->setValue(width);
109 m_view.clip_ar_den->setValue(height);
113 connect(m_view.clip_force_ar, SIGNAL(toggled(bool)), this, SLOT(slotModified()));
114 connect(m_view.clip_ar_num, SIGNAL(valueChanged(int)), this, SLOT(slotModified()));
115 connect(m_view.clip_ar_den, SIGNAL(valueChanged(int)), this, SLOT(slotModified()));
117 if (props.contains("force_fps") && props.value("force_fps").toDouble() > 0) {
118 m_view.clip_force_framerate->setChecked(true);
119 m_view.clip_framerate->setEnabled(true);
120 m_view.clip_framerate->setValue(props.value("force_fps").toDouble());
122 connect(m_view.clip_force_framerate, SIGNAL(toggled(bool)), this, SLOT(slotModified()));
123 connect(m_view.clip_framerate, SIGNAL(valueChanged(double)), this, SLOT(slotModified()));
125 if (props.contains("force_progressive")) {
126 m_view.clip_force_progressive->setChecked(true);
127 m_view.clip_progressive->setEnabled(true);
128 m_view.clip_progressive->setValue(props.value("force_progressive").toInt());
130 connect(m_view.clip_force_progressive, SIGNAL(toggled(bool)), this, SLOT(slotModified()));
131 connect(m_view.clip_progressive, SIGNAL(valueChanged(int)), this, SLOT(slotModified()));
133 m_view.clip_fieldorder->addItem(i18n("Bottom first"), 0);
134 m_view.clip_fieldorder->addItem(i18n("Top first"), 1);
135 if (props.contains("force_tff")) {
136 m_view.clip_force_fieldorder->setChecked(true);
137 m_view.clip_fieldorder->setEnabled(true);
138 m_view.clip_fieldorder->setCurrentIndex(props.value("force_tff").toInt());
140 connect(m_view.clip_force_fieldorder, SIGNAL(toggled(bool)), this, SLOT(slotModified()));
141 connect(m_view.clip_fieldorder, SIGNAL(currentIndexChanged(int)), this, SLOT(slotModified()));
143 if (props.contains("threads") && props.value("threads").toInt() != 1) {
144 m_view.clip_force_threads->setChecked(true);
145 m_view.clip_threads->setEnabled(true);
146 m_view.clip_threads->setValue(props.value("threads").toInt());
148 connect(m_view.clip_force_threads, SIGNAL(toggled(bool)), this, SLOT(slotModified()));
149 connect(m_view.clip_threads, SIGNAL(valueChanged(int)), this, SLOT(slotModified()));
151 if (props.contains("video_index") && props.value("video_index").toInt() != 0) {
152 m_view.clip_force_vindex->setChecked(true);
153 m_view.clip_vindex->setEnabled(true);
154 m_view.clip_vindex->setValue(props.value("video_index").toInt());
156 connect(m_view.clip_force_vindex, SIGNAL(toggled(bool)), this, SLOT(slotModified()));
157 connect(m_view.clip_vindex, SIGNAL(valueChanged(int)), this, SLOT(slotModified()));
159 if (props.contains("audio_index") && props.value("audio_index").toInt() != 0) {
160 m_view.clip_force_aindex->setChecked(true);
161 m_view.clip_aindex->setEnabled(true);
162 m_view.clip_aindex->setValue(props.value("audio_index").toInt());
164 connect(m_view.clip_force_aindex, SIGNAL(toggled(bool)), this, SLOT(slotModified()));
165 connect(m_view.clip_aindex, SIGNAL(valueChanged(int)), this, SLOT(slotModified()));
167 if (props.contains("audio_max")) {
168 m_view.clip_aindex->setMaximum(props.value("audio_max").toInt());
171 if (props.contains("video_max")) {
172 m_view.clip_vindex->setMaximum(props.value("video_max").toInt());
175 m_view.clip_colorspace->addItem(ProfilesDialog::getColorspaceDescription(601), 601);
176 m_view.clip_colorspace->addItem(ProfilesDialog::getColorspaceDescription(709), 709);
177 m_view.clip_colorspace->addItem(ProfilesDialog::getColorspaceDescription(240), 240);
178 if (props.contains("force_colorspace")) {
179 m_view.clip_force_colorspace->setChecked(true);
180 m_view.clip_colorspace->setEnabled(true);
181 m_view.clip_colorspace->setCurrentIndex(m_view.clip_colorspace->findData(props.value("force_colorspace").toInt()));
182 } else if (props.contains("colorspace")) {
183 m_view.clip_colorspace->setCurrentIndex(m_view.clip_colorspace->findData(props.value("colorspace").toInt()));
185 connect(m_view.clip_force_colorspace, SIGNAL(toggled(bool)), this, SLOT(slotModified()));
186 connect(m_view.clip_colorspace, SIGNAL(currentIndexChanged(int)), this, SLOT(slotModified()));
188 if (props.contains("full_luma")) {
189 m_view.clip_full_luma->setChecked(true);
191 connect(m_view.clip_full_luma, SIGNAL(toggled(bool)), this, SLOT(slotModified()));
193 // Check for Metadata
194 QMap<QString, QString> meta = m_clip->metadata();
195 QMap<QString, QString>::const_iterator i = meta.constBegin();
196 while (i != meta.constEnd()) {
197 QTreeWidgetItem *metaitem = new QTreeWidgetItem(m_view.metadata_list);
198 metaitem->setText(0, i.key()); //i18n(i.key().section('.', 2, 3).toUtf8().data()));
199 metaitem->setText(1, i.value());
203 connect(m_view.clip_force_ar, SIGNAL(toggled(bool)), m_view.clip_ar_num, SLOT(setEnabled(bool)));
204 connect(m_view.clip_force_ar, SIGNAL(toggled(bool)), m_view.clip_ar_den, SLOT(setEnabled(bool)));
205 connect(m_view.clip_force_framerate, SIGNAL(toggled(bool)), m_view.clip_framerate, SLOT(setEnabled(bool)));
206 connect(m_view.clip_force_progressive, SIGNAL(toggled(bool)), m_view.clip_progressive, SLOT(setEnabled(bool)));
207 connect(m_view.clip_force_fieldorder, SIGNAL(toggled(bool)), m_view.clip_fieldorder, SLOT(setEnabled(bool)));
208 connect(m_view.clip_force_threads, SIGNAL(toggled(bool)), m_view.clip_threads, SLOT(setEnabled(bool)));
209 connect(m_view.clip_force_vindex, SIGNAL(toggled(bool)), m_view.clip_vindex, SLOT(setEnabled(bool)));
210 connect(m_view.clip_force_aindex, SIGNAL(toggled(bool)), m_view.clip_aindex, SLOT(setEnabled(bool)));
211 connect(m_view.clip_force_colorspace, SIGNAL(toggled(bool)), m_view.clip_colorspace, SLOT(setEnabled(bool)));
213 if (props.contains("audiocodec"))
214 new QTreeWidgetItem(m_view.clip_aproperties, QStringList() << i18n("Audio codec") << props.value("audiocodec"));
216 if (props.contains("channels"))
217 new QTreeWidgetItem(m_view.clip_aproperties, QStringList() << i18n("Channels") << props.value("channels"));
219 if (props.contains("frequency"))
220 new QTreeWidgetItem(m_view.clip_aproperties, QStringList() << i18n("Frequency") << props.value("frequency"));
223 CLIPTYPE t = m_clip->clipType();
225 if (props.contains("proxy") && props.value("proxy") != "-") {
226 KFileItem f(KFileItem::Unknown, KFileItem::Unknown, KUrl(props.value("proxy")), true);
227 QFrame* line = new QFrame();
228 line->setFrameShape(QFrame::HLine);
229 line->setFrameShadow(QFrame::Sunken);
230 m_proxyContainer = new QFrame();
231 m_proxyContainer->setFrameShape(QFrame::NoFrame);
232 QHBoxLayout *l = new QHBoxLayout;
233 l->addWidget(new QLabel(i18n("Proxy clip: %1", KIO::convertSize(f.size()))));
235 QPushButton *pb = new QPushButton(i18n("Delete proxy"));
237 connect(pb, SIGNAL(clicked()), this, SLOT(slotDeleteProxy()));
238 m_proxyContainer->setLayout(l);
240 m_view.tab_image->layout()->addWidget(line);
241 m_view.tab_image->layout()->addWidget(m_proxyContainer);
243 else if (t == AUDIO) {
244 m_view.tab_audio->layout()->addWidget(line);
245 m_view.tab_audio->layout()->addWidget(m_proxyContainer);
248 m_view.tab_video->layout()->addWidget(line);
249 m_view.tab_video->layout()->addWidget(m_proxyContainer);
253 if (t != AUDIO && t != AV) {
254 m_view.clip_force_aindex->setEnabled(false);
257 if (t != VIDEO && t != AV) {
258 m_view.clip_force_vindex->setEnabled(false);
262 m_view.tabWidget->setTabText(VIDEOTAB, i18n("Playlist"));
265 m_view.tabWidget->removeTab(SLIDETAB);
266 m_view.tabWidget->removeTab(COLORTAB);
267 m_view.tabWidget->removeTab(AUDIOTAB);
268 m_view.tabWidget->removeTab(VIDEOTAB);
269 if (props.contains("frame_size"))
270 m_view.image_size->setText(props.value("frame_size"));
271 if (props.contains("transparency"))
272 m_view.image_transparency->setChecked(props.value("transparency").toInt());
273 connect(m_view.image_transparency, SIGNAL(toggled(bool)), this, SLOT(slotModified()));
274 int width = 180.0 * KdenliveSettings::project_display_ratio();
275 if (width % 2 == 1) width++;
276 m_view.clip_thumb->setPixmap(QPixmap(url.path()).scaled(QSize(width, 180), Qt::KeepAspectRatio));
277 } else if (t == COLOR) {
278 m_view.clip_path->setEnabled(false);
279 m_view.tabWidget->removeTab(METATAB);
280 m_view.tabWidget->removeTab(IMAGETAB);
281 m_view.tabWidget->removeTab(SLIDETAB);
282 m_view.tabWidget->removeTab(AUDIOTAB);
283 m_view.tabWidget->removeTab(VIDEOTAB);
284 m_view.clip_thumb->setHidden(true);
285 m_view.clip_color->setColor(QColor('#' + props.value("colour").right(8).left(6)));
286 connect(m_view.clip_color, SIGNAL(changed(QColor)), this, SLOT(slotModified()));
287 } else if (t == SLIDESHOW) {
288 if (url.fileName().startsWith(".all.")) {
289 // the image sequence is defined by mimetype
290 m_view.clip_path->setText(url.directory());
292 // the image sequence is defined by pattern
293 m_view.slide_type_label->setHidden(true);
294 m_view.image_type->setHidden(true);
295 m_view.clip_path->setText(url.path());
298 m_view.tabWidget->removeTab(METATAB);
299 m_view.tabWidget->removeTab(IMAGETAB);
300 m_view.tabWidget->removeTab(COLORTAB);
301 m_view.tabWidget->removeTab(AUDIOTAB);
302 m_view.tabWidget->removeTab(VIDEOTAB);
304 //WARNING: Keep in sync with slideshowclip.cpp
305 m_view.image_type->addItem("JPG (*.jpg)", "jpg");
306 m_view.image_type->addItem("JPEG (*.jpeg)", "jpeg");
307 m_view.image_type->addItem("PNG (*.png)", "png");
308 m_view.image_type->addItem("BMP (*.bmp)", "bmp");
309 m_view.image_type->addItem("GIF (*.gif)", "gif");
310 m_view.image_type->addItem("TGA (*.tga)", "tga");
311 m_view.image_type->addItem("TIF (*.tif)", "tif");
312 m_view.image_type->addItem("TIFF (*.tiff)", "tiff");
313 m_view.image_type->addItem("Open EXR (*.exr)", "exr");
314 m_view.animation->addItem(i18n("None"), QString());
315 m_view.animation->addItem(i18n("Pan"), "Pan");
316 m_view.animation->addItem(i18n("Pan, low-pass"), "Pan, low-pass");
317 m_view.animation->addItem(i18n("Pan and zoom"), "Pan and zoom");
318 m_view.animation->addItem(i18n("Pan and zoom, low-pass"), "Pan and zoom, low-pass");
319 m_view.animation->addItem(i18n("Zoom"), "Zoom");
320 m_view.animation->addItem(i18n("Zoom, low-pass"), "Zoom, low-pass");
322 m_view.slide_loop->setChecked(props.value("loop").toInt());
323 m_view.slide_crop->setChecked(props.value("crop").toInt());
324 m_view.slide_fade->setChecked(props.value("fade").toInt());
325 m_view.luma_softness->setValue(props.value("softness").toInt());
326 if (!props.value("animation").isEmpty())
327 m_view.animation->setCurrentItem(props.value("animation"));
329 m_view.animation->setCurrentIndex(0);
330 QString path = props.value("resource");
331 QString ext = path.section('.', -1);
332 for (int i = 0; i < m_view.image_type->count(); i++) {
333 if (m_view.image_type->itemData(i).toString() == ext) {
334 m_view.image_type->setCurrentIndex(i);
338 m_view.slide_duration->setText(tc.getTimecodeFromFrames(props.value("ttl").toInt()));
340 m_view.slide_duration_format->addItem(i18n("hh:mm:ss:ff"));
341 m_view.slide_duration_format->addItem(i18n("Frames"));
342 connect(m_view.slide_duration_format, SIGNAL(activated(int)), this, SLOT(slotUpdateDurationFormat(int)));
343 m_view.slide_duration_frames->setHidden(true);
344 m_view.luma_duration_frames->setHidden(true);
348 m_view.luma_duration->setText(tc.getTimecodeFromFrames(props.value("luma_duration").toInt()));
349 QString lumaFile = props.value("luma_file");
351 // Check for Kdenlive installed luma files
353 filters << "*.pgm" << "*.png";
355 QStringList customLumas = KGlobal::dirs()->findDirs("appdata", "lumas");
356 foreach(const QString & folder, customLumas) {
357 QStringList filesnames = QDir(folder).entryList(filters, QDir::Files);
358 foreach(const QString & fname, filesnames) {
359 QString filePath = KUrl(folder).path(KUrl::AddTrailingSlash) + fname;
360 m_view.luma_file->addItem(KIcon(filePath), fname, filePath);
364 // Check for MLT lumas
365 QString profilePath = KdenliveSettings::mltpath();
366 QString folder = profilePath.section('/', 0, -3);
367 folder.append("/lumas/PAL"); // TODO: cleanup the PAL / NTSC mess in luma files
368 QDir lumafolder(folder);
369 QStringList filesnames = lumafolder.entryList(filters, QDir::Files);
370 foreach(const QString & fname, filesnames) {
371 QString filePath = KUrl(folder).path(KUrl::AddTrailingSlash) + fname;
372 m_view.luma_file->addItem(KIcon(filePath), fname, filePath);
375 if (!lumaFile.isEmpty()) {
376 m_view.slide_luma->setChecked(true);
377 m_view.luma_file->setCurrentIndex(m_view.luma_file->findData(lumaFile));
378 } else m_view.luma_file->setEnabled(false);
379 slotEnableLuma(m_view.slide_fade->checkState());
380 slotEnableLumaFile(m_view.slide_luma->checkState());
382 connect(m_view.slide_fade, SIGNAL(toggled(bool)), this, SLOT(slotModified()));
383 connect(m_view.slide_luma, SIGNAL(toggled(bool)), this, SLOT(slotModified()));
384 connect(m_view.slide_loop, SIGNAL(toggled(bool)), this, SLOT(slotModified()));
385 connect(m_view.slide_crop, SIGNAL(toggled(bool)), this, SLOT(slotModified()));
386 connect(m_view.slide_duration, SIGNAL(textChanged(QString)), this, SLOT(slotModified()));
387 connect(m_view.slide_duration_frames, SIGNAL(valueChanged(int)), this, SLOT(slotModified()));
388 connect(m_view.luma_duration, SIGNAL(textChanged(QString)), this, SLOT(slotModified()));
389 connect(m_view.luma_softness, SIGNAL(valueChanged(int)), this, SLOT(slotModified()));
390 connect(m_view.luma_file, SIGNAL(currentIndexChanged(int)), this, SLOT(slotModified()));
391 connect(m_view.animation, SIGNAL(currentIndexChanged(int)), this, SLOT(slotModified()));
394 connect(m_view.slide_fade, SIGNAL(stateChanged(int)), this, SLOT(slotEnableLuma(int)));
395 connect(m_view.slide_luma, SIGNAL(stateChanged(int)), this, SLOT(slotEnableLumaFile(int)));
396 connect(m_view.image_type, SIGNAL(currentIndexChanged(int)), this, SLOT(parseFolder()));
398 } else if (t != AUDIO) {
399 m_view.tabWidget->removeTab(IMAGETAB);
400 m_view.tabWidget->removeTab(SLIDETAB);
401 m_view.tabWidget->removeTab(COLORTAB);
403 PropertiesViewDelegate *del1 = new PropertiesViewDelegate(this);
404 PropertiesViewDelegate *del2 = new PropertiesViewDelegate(this);
405 m_view.clip_vproperties->setItemDelegate(del1);
406 m_view.clip_aproperties->setItemDelegate(del2);
407 m_view.clip_aproperties->setStyleSheet(QString("QTreeWidget { background-color: transparent;}"));
408 m_view.clip_vproperties->setStyleSheet(QString("QTreeWidget { background-color: transparent;}"));
410 if (props.contains("videocodec"))
411 new QTreeWidgetItem(m_view.clip_vproperties, QStringList() << i18n("Video codec") << props.value("videocodec"));
413 if (props.contains("frame_size"))
414 new QTreeWidgetItem(m_view.clip_vproperties, QStringList() << i18n("Frame size") << props.value("frame_size"));
416 if (props.contains("fps")) {
417 new QTreeWidgetItem(m_view.clip_vproperties, QStringList() << i18n("Frame rate") << props.value("fps"));
418 if (!m_view.clip_framerate->isEnabled()) m_view.clip_framerate->setValue(props.value("fps").toDouble());
421 if (props.contains("progressive")) {
422 int scanning = props.value("progressive").toInt();
423 QString txt = scanning == 1 ? i18n("Progressive") : i18n("Interlaced");
424 new QTreeWidgetItem(m_view.clip_vproperties, QStringList() << i18n("Scanning") << txt);
427 if (props.contains("aspect_ratio"))
428 new QTreeWidgetItem(m_view.clip_vproperties, QStringList() << i18n("Pixel aspect ratio") << props.value("aspect_ratio"));
430 if (props.contains("pix_fmt"))
431 new QTreeWidgetItem(m_view.clip_vproperties, QStringList() << i18n("Pixel format") << props.value("pix_fmt"));
433 if (props.contains("colorspace"))
434 new QTreeWidgetItem(m_view.clip_vproperties, QStringList() << i18n("Colorspace") << ProfilesDialog::getColorspaceDescription(props.value("colorspace").toInt()));
437 int width = 180.0 * KdenliveSettings::project_display_ratio();
438 if (width % 2 == 1) width++;
439 QPixmap pix = m_clip->thumbProducer()->getImage(url, m_clip->getClipThumbFrame(), width, 180);
440 m_view.clip_thumb->setPixmap(pix);
441 if (t == IMAGE || t == VIDEO || t == PLAYLIST) m_view.tabWidget->removeTab(AUDIOTAB);
443 m_view.tabWidget->removeTab(IMAGETAB);
444 m_view.tabWidget->removeTab(SLIDETAB);
445 m_view.tabWidget->removeTab(COLORTAB);
446 m_view.tabWidget->removeTab(VIDEOTAB);
447 m_view.clip_thumb->setHidden(true);
450 if (t != SLIDESHOW && t != COLOR) {
451 KFileItem f(KFileItem::Unknown, KFileItem::Unknown, url, true);
452 m_view.clip_filesize->setText(KIO::convertSize(f.size()));
454 m_view.clip_filesize->setHidden(true);
455 m_view.label_size->setHidden(true);
457 m_view.clip_duration->setInputMask(tc.mask());
458 m_view.clip_duration->setText(tc.getTimecode(m_clip->duration()));
459 if (t != IMAGE && t != COLOR && t != TEXT) m_view.clip_duration->setReadOnly(true);
461 connect(m_view.clip_duration, SIGNAL(editingFinished()), this, SLOT(slotCheckMaxLength()));
462 connect(m_view.clip_duration, SIGNAL(textChanged(QString)), this, SLOT(slotModified()));
466 m_view.marker_new->setIcon(KIcon("document-new"));
467 m_view.marker_new->setToolTip(i18n("Add marker"));
468 m_view.marker_edit->setIcon(KIcon("document-properties"));
469 m_view.marker_edit->setToolTip(i18n("Edit marker"));
470 m_view.marker_delete->setIcon(KIcon("trash-empty"));
471 m_view.marker_delete->setToolTip(i18n("Delete marker"));
472 m_view.marker_save->setIcon(KIcon("document-save-as"));
473 m_view.marker_save->setToolTip(i18n("Save markers"));
474 m_view.marker_load->setIcon(KIcon("document-open"));
475 m_view.marker_load->setToolTip(i18n("Load markers"));
477 // Check for Nepomuk metadata
479 #if KDE_IS_VERSION(4,6,0)
480 if (!url.isEmpty()) {
481 Nepomuk::ResourceManager::instance()->init();
482 Nepomuk::Resource res( url.path() );
483 // Check if file has a license
484 if (res.hasProperty(Nepomuk::Vocabulary::NIE::license())) {
485 QString ltype = res.property(Nepomuk::Vocabulary::NIE::licenseType()).toString();
486 m_view.clip_license->setText(i18n("License: %1", res.property(Nepomuk::Vocabulary::NIE::license()).toString()));
487 if (ltype.startsWith("http")) {
488 m_view.clip_license->setUrl(ltype);
489 connect(m_view.clip_license, SIGNAL(leftClickedUrl(const QString &)), this, SLOT(slotOpenUrl(const QString &)));
492 else m_view.clip_license->setHidden(true);
494 else m_view.clip_license->setHidden(true);
496 m_view.clip_license->setHidden(true);
499 m_view.clip_license->setHidden(true);
502 slotFillMarkersList(m_clip);
503 connect(m_view.marker_new, SIGNAL(clicked()), this, SLOT(slotAddMarker()));
504 connect(m_view.marker_edit, SIGNAL(clicked()), this, SLOT(slotEditMarker()));
505 connect(m_view.marker_delete, SIGNAL(clicked()), this, SLOT(slotDeleteMarker()));
506 connect(m_view.marker_save, SIGNAL(clicked()), this, SLOT(slotSaveMarkers()));
507 connect(m_view.marker_load, SIGNAL(clicked()), this, SLOT(slotLoadMarkers()));
508 connect(m_view.markers_list, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slotEditMarker()));
510 connect(this, SIGNAL(accepted()), this, SLOT(slotApplyProperties()));
511 connect(m_view.buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(slotApplyProperties()));
512 m_view.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
517 // Used for multiple clips editing
518 ClipProperties::ClipProperties(QList <DocClipBase *>cliplist, Timecode tc, QMap <QString, QString> commonproperties, QWidget * parent) :
524 m_clipNeedsRefresh(false),
525 m_clipNeedsReLoad(false)
527 setFont(KGlobalSettings::toolBarFont());
528 m_view.setupUi(this);
529 QString title = windowTitle();
530 title.append(' ' + i18np("(%1 clip)", "(%1 clips)", cliplist.count()));
531 setWindowTitle(title);
532 QMap <QString, QString> props = cliplist.at(0)->properties();
533 m_old_props = commonproperties;
535 if (commonproperties.contains("force_aspect_num") && !commonproperties.value("force_aspect_num").isEmpty() && commonproperties.value("force_aspect_den").toInt() > 0) {
536 m_view.clip_force_ar->setChecked(true);
537 m_view.clip_ar_num->setEnabled(true);
538 m_view.clip_ar_den->setEnabled(true);
539 m_view.clip_ar_num->setValue(commonproperties.value("force_aspect_num").toInt());
540 m_view.clip_ar_den->setValue(commonproperties.value("force_aspect_den").toInt());
543 if (commonproperties.contains("force_fps") && !commonproperties.value("force_fps").isEmpty() && commonproperties.value("force_fps").toDouble() > 0) {
544 m_view.clip_force_framerate->setChecked(true);
545 m_view.clip_framerate->setEnabled(true);
546 m_view.clip_framerate->setValue(commonproperties.value("force_fps").toDouble());
549 if (commonproperties.contains("force_progressive") && !commonproperties.value("force_progressive").isEmpty()) {
550 m_view.clip_force_progressive->setChecked(true);
551 m_view.clip_progressive->setEnabled(true);
552 m_view.clip_progressive->setValue(commonproperties.value("force_progressive").toInt());
555 if (commonproperties.contains("force_tff") && !commonproperties.value("force_tff").isEmpty()) {
556 m_view.clip_force_fieldorder->setChecked(true);
557 m_view.clip_fieldorder->setEnabled(true);
558 m_view.clip_fieldorder->setCurrentIndex(commonproperties.value("force_tff").toInt());
561 if (commonproperties.contains("threads") && !commonproperties.value("threads").isEmpty() && commonproperties.value("threads").toInt() != 1) {
562 m_view.clip_force_threads->setChecked(true);
563 m_view.clip_threads->setEnabled(true);
564 m_view.clip_threads->setValue(commonproperties.value("threads").toInt());
567 if (commonproperties.contains("video_index") && !commonproperties.value("video_index").isEmpty() && commonproperties.value("video_index").toInt() != 0) {
568 m_view.clip_force_vindex->setChecked(true);
569 m_view.clip_vindex->setEnabled(true);
570 m_view.clip_vindex->setValue(commonproperties.value("video_index").toInt());
573 if (commonproperties.contains("audio_index") && !commonproperties.value("audio_index").isEmpty() && commonproperties.value("audio_index").toInt() != 0) {
574 m_view.clip_force_aindex->setChecked(true);
575 m_view.clip_aindex->setEnabled(true);
576 m_view.clip_aindex->setValue(commonproperties.value("audio_index").toInt());
579 if (props.contains("audio_max")) {
580 m_view.clip_aindex->setMaximum(props.value("audio_max").toInt());
583 if (props.contains("video_max")) {
584 m_view.clip_vindex->setMaximum(props.value("video_max").toInt());
587 m_view.clip_colorspace->addItem(ProfilesDialog::getColorspaceDescription(601), 601);
588 m_view.clip_colorspace->addItem(ProfilesDialog::getColorspaceDescription(709), 709);
589 m_view.clip_colorspace->addItem(ProfilesDialog::getColorspaceDescription(240), 240);
591 if (commonproperties.contains("force_colorspace") && !commonproperties.value("force_colorspace").isEmpty() && commonproperties.value("force_colorspace").toInt() != 0) {
592 m_view.clip_force_colorspace->setChecked(true);
593 m_view.clip_colorspace->setEnabled(true);
594 m_view.clip_colorspace->setCurrentIndex(m_view.clip_colorspace->findData(commonproperties.value("force_colorspace").toInt()));
597 if (commonproperties.contains("full_luma") && !commonproperties.value("full_luma").isEmpty()) {
598 m_view.clip_full_luma->setChecked(true);
601 if (commonproperties.contains("transparency")) {
602 // image transparency checkbox
603 int transparency = commonproperties.value("transparency").toInt();
604 if (transparency == 0) {
605 m_view.clip_force_transparency->setChecked(true);
607 else if (transparency == 1) {
608 m_view.clip_force_transparency->setChecked(true);
609 m_view.clip_transparency->setCurrentIndex(1);
613 m_view.clip_force_transparency->setHidden(true);
614 m_view.clip_transparency->setHidden(true);
618 connect(m_view.clip_force_transparency, SIGNAL(toggled(bool)), m_view.clip_transparency, SLOT(setEnabled(bool)));
619 connect(m_view.clip_force_ar, SIGNAL(toggled(bool)), m_view.clip_ar_num, SLOT(setEnabled(bool)));
620 connect(m_view.clip_force_ar, SIGNAL(toggled(bool)), m_view.clip_ar_den, SLOT(setEnabled(bool)));
621 connect(m_view.clip_force_progressive, SIGNAL(toggled(bool)), m_view.clip_progressive, SLOT(setEnabled(bool)));
622 connect(m_view.clip_force_threads, SIGNAL(toggled(bool)), m_view.clip_threads, SLOT(setEnabled(bool)));
623 connect(m_view.clip_force_vindex, SIGNAL(toggled(bool)), m_view.clip_vindex, SLOT(setEnabled(bool)));
624 connect(m_view.clip_force_aindex, SIGNAL(toggled(bool)), m_view.clip_aindex, SLOT(setEnabled(bool)));
625 connect(m_view.clip_force_out, SIGNAL(toggled(bool)), m_view.clip_out, SLOT(setEnabled(bool)));
626 connect(m_view.clip_force_colorspace, SIGNAL(toggled(bool)), m_view.clip_colorspace, SLOT(setEnabled(bool)));
628 m_view.tabWidget->removeTab(METATAB);
629 m_view.tabWidget->removeTab(MARKERTAB);
630 m_view.tabWidget->removeTab(IMAGETAB);
631 m_view.tabWidget->removeTab(SLIDETAB);
632 m_view.tabWidget->removeTab(COLORTAB);
633 m_view.tabWidget->removeTab(AUDIOTAB);
634 m_view.tabWidget->removeTab(VIDEOTAB);
636 m_view.clip_path->setHidden(true);
637 m_view.label_path->setHidden(true);
638 m_view.label_description->setHidden(true);
639 m_view.label_size->setHidden(true);
640 m_view.clip_filesize->setHidden(true);
641 m_view.clip_filesize->setHidden(true);
642 m_view.clip_path->setHidden(true);
643 m_view.clip_description->setHidden(true);
644 m_view.clip_thumb->setHidden(true);
645 m_view.label_duration->setHidden(true);
646 m_view.clip_duration->setHidden(true);
648 if (commonproperties.contains("out")) {
649 if (commonproperties.value("out").toInt() > 0) {
650 m_view.clip_force_out->setChecked(true);
651 m_view.clip_out->setText(m_tc.getTimecodeFromFrames(commonproperties.value("out").toInt()));
652 } else m_view.clip_out->setText(KdenliveSettings::image_duration());
654 m_view.clip_force_out->setHidden(true);
655 m_view.clip_out->setHidden(true);
659 ClipProperties::~ClipProperties()
661 QAbstractItemDelegate *del1 = m_view.clip_vproperties->itemDelegate();
662 if (del1) delete del1;
663 QAbstractItemDelegate *del2 = m_view.clip_aproperties->itemDelegate();
664 if (del2) delete del2;
667 void ClipProperties::slotApplyProperties()
669 if (m_clip != NULL) {
670 QMap <QString, QString> props = properties();
671 emit applyNewClipProperties(m_clip->getId(), m_clip->currentProperties(props), props, needsTimelineRefresh(), needsTimelineReload());
673 m_view.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
676 void ClipProperties::disableClipId(const QString &id)
678 if (m_clip && m_view.buttonBox->button(QDialogButtonBox::Ok)->isEnabled()) {
679 if (m_clip->getId() == id) {
680 // clip was removed from project, close this properties dialog
686 void ClipProperties::slotModified()
688 m_view.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(true);
692 void ClipProperties::slotEnableLuma(int state)
695 if (state == Qt::Checked) enable = true;
696 m_view.luma_duration->setEnabled(enable);
697 m_view.luma_duration_frames->setEnabled(enable);
698 m_view.slide_luma->setEnabled(enable);
700 m_view.luma_file->setEnabled(m_view.slide_luma->isChecked());
701 } else m_view.luma_file->setEnabled(false);
702 m_view.label_softness->setEnabled(m_view.slide_luma->isChecked() && enable);
703 m_view.luma_softness->setEnabled(m_view.label_softness->isEnabled());
706 void ClipProperties::slotEnableLumaFile(int state)
709 if (state == Qt::Checked) enable = true;
710 m_view.luma_file->setEnabled(enable);
711 m_view.luma_softness->setEnabled(enable);
712 m_view.label_softness->setEnabled(enable);
715 void ClipProperties::slotFillMarkersList(DocClipBase *clip)
717 if (m_clip != clip) return;
718 m_view.markers_list->clear();
719 QList < CommentedTime > marks = m_clip->commentedSnapMarkers();
720 for (int count = 0; count < marks.count(); ++count) {
721 QString time = m_tc.getTimecode(marks[count].time());
722 QStringList itemtext;
723 itemtext << time << marks[count].comment();
724 (void) new QTreeWidgetItem(m_view.markers_list, itemtext);
728 void ClipProperties::slotAddMarker()
730 CommentedTime marker(GenTime(), i18n("Marker"));
731 QPointer<MarkerDialog> d = new MarkerDialog(m_clip, marker,
732 m_tc, i18n("Add Marker"), this);
733 if (d->exec() == QDialog::Accepted) {
734 emit addMarker(m_clip->getId(), d->newMarker().time(), d->newMarker().comment());
739 void ClipProperties::slotSaveMarkers()
741 emit saveMarkers(m_clip->getId());
744 void ClipProperties::slotLoadMarkers()
746 emit loadMarkers(m_clip->getId());
749 void ClipProperties::slotEditMarker()
751 QList < CommentedTime > marks = m_clip->commentedSnapMarkers();
752 int pos = m_view.markers_list->currentIndex().row();
753 if (pos < 0 || pos > marks.count() - 1) return;
754 MarkerDialog d(m_clip, marks.at(pos), m_tc, i18n("Edit Marker"), this);
755 if (d.exec() == QDialog::Accepted) {
756 emit addMarker(m_clip->getId(), d.newMarker().time(), d.newMarker().comment());
760 void ClipProperties::slotDeleteMarker()
762 QList < CommentedTime > marks = m_clip->commentedSnapMarkers();
763 int pos = m_view.markers_list->currentIndex().row();
764 if (pos < 0 || pos > marks.count() - 1) return;
765 emit addMarker(m_clip->getId(), marks.at(pos).time(), QString());
768 const QString &ClipProperties::clipId() const
770 return m_clip->getId();
774 QMap <QString, QString> ClipProperties::properties()
776 QMap <QString, QString> props;
778 CLIPTYPE t = UNKNOWN;
779 if (m_clip != NULL) {
780 t = m_clip->clipType();
781 m_old_props = m_clip->properties();
784 int aspectNumerator = m_view.clip_ar_num->value();
785 int aspectDenominator = m_view.clip_ar_den->value();
786 if (m_view.clip_force_ar->isChecked()) {
787 if (aspectNumerator != m_old_props.value("force_aspect_num").toInt() ||
788 aspectDenominator != m_old_props.value("force_aspect_den").toInt()) {
789 props["force_aspect_num"] = QString::number(aspectNumerator);
790 props["force_aspect_den"] = QString::number(aspectDenominator);
791 props["force_aspect_ratio"].clear();
792 m_clipNeedsRefresh = true;
795 if (m_old_props.contains("force_aspect_num") && !m_old_props.value("force_aspect_num").isEmpty()) {
796 props["force_aspect_num"].clear();
797 m_clipNeedsRefresh = true;
799 if (m_old_props.contains("force_aspect_den") && !m_old_props.value("force_aspect_den").isEmpty()) {
800 props["force_aspect_den"].clear();
801 m_clipNeedsRefresh = true;
805 double fps = m_view.clip_framerate->value();
806 if (m_view.clip_force_framerate->isChecked()) {
807 if (fps != m_old_props.value("force_fps").toDouble()) {
808 props["force_fps"] = locale.toString(fps);
809 m_clipNeedsRefresh = true;
811 } else if (m_old_props.contains("force_fps") && !m_old_props.value("force_fps").isEmpty()) {
812 props["force_fps"].clear();
813 m_clipNeedsRefresh = true;
816 int progressive = m_view.clip_progressive->value();
817 if (m_view.clip_force_progressive->isChecked()) {
818 if (progressive != m_old_props.value("force_progressive").toInt()) {
819 props["force_progressive"] = QString::number(progressive);
821 } else if (m_old_props.contains("force_progressive") && !m_old_props.value("force_progressive").isEmpty()) {
822 props["force_progressive"].clear();
825 int fieldOrder = m_view.clip_fieldorder->currentIndex();
826 if (m_view.clip_force_fieldorder->isChecked()) {
827 if (fieldOrder != m_old_props.value("force_tff").toInt()) {
828 props["force_tff"] = QString::number(fieldOrder);
830 } else if (m_old_props.contains("force_tff") && !m_old_props.value("force_tff").isEmpty()) {
831 props["force_tff"].clear();
834 int threads = m_view.clip_threads->value();
835 if (m_view.clip_force_threads->isChecked()) {
836 if (threads != m_old_props.value("threads").toInt()) {
837 props["threads"] = QString::number(threads);
839 } else if (m_old_props.contains("threads") && !m_old_props.value("threads").isEmpty()) {
840 props["threads"].clear();
843 int vindex = m_view.clip_vindex->value();
844 if (m_view.clip_force_vindex->isChecked()) {
845 if (vindex != m_old_props.value("video_index").toInt()) {
846 props["video_index"] = QString::number(vindex);
848 } else if (m_old_props.contains("video_index") && !m_old_props.value("video_index").isEmpty()) {
849 props["video_index"].clear();
852 int aindex = m_view.clip_aindex->value();
853 if (m_view.clip_force_aindex->isChecked()) {
854 if (aindex != m_old_props.value("audio_index").toInt()) {
855 props["audio_index"] = QString::number(aindex);
857 } else if (m_old_props.contains("audio_index") && !m_old_props.value("audio_index").isEmpty()) {
858 props["audio_index"].clear();
861 int colorspace = m_view.clip_colorspace->itemData(m_view.clip_colorspace->currentIndex()).toInt();
862 if (m_view.clip_force_colorspace->isChecked()) {
863 if (colorspace != m_old_props.value("force_colorspace").toInt()) {
864 props["force_colorspace"] = QString::number(colorspace);
865 m_clipNeedsRefresh = true;
867 } else if (m_old_props.contains("force_colorspace") && !m_old_props.value("force_colorspace").isEmpty()) {
868 props["force_colorspace"].clear();
869 m_clipNeedsRefresh = true;
872 if (m_view.clip_full_luma->isChecked()) {
873 props["full_luma"] = QString::number(1);
874 m_clipNeedsRefresh = true;
875 } else if (m_old_props.contains("full_luma") && !m_old_props.value("full_luma").isEmpty()) {
876 props["full_luma"].clear();
877 m_clipNeedsRefresh = true;
880 if (m_view.clip_force_transparency->isChecked()) {
881 QString transp = QString::number(m_view.clip_transparency->currentIndex());
882 if (transp != m_old_props.value("transparency")) props["transparency"] = transp;
885 // If we adjust several clips, return now
886 if (m_clip == NULL) {
887 if (m_view.clip_out->isEnabled()) {
888 int duration = m_tc.getFrameCount(m_view.clip_out->text());
889 if (duration != m_old_props.value("out").toInt()) {
890 props["out"] = QString::number(duration - 1);
896 if (m_old_props.value("description") != m_view.clip_description->text())
897 props["description"] = m_view.clip_description->text();
900 QString new_color = m_view.clip_color->color().name();
901 if (new_color != QString('#' + m_old_props.value("colour").right(8).left(6))) {
902 m_clipNeedsRefresh = true;
903 props["colour"] = "0x" + new_color.right(6) + "ff";
905 int duration = m_tc.getFrameCount(m_view.clip_duration->text());
906 if (duration != m_clip->duration().frames(m_fps)) {
907 props["out"] = QString::number(duration - 1);
909 } else if (t == IMAGE) {
910 if ((int) m_view.image_transparency->isChecked() != m_old_props.value("transparency").toInt()) {
911 props["transparency"] = QString::number((int)m_view.image_transparency->isChecked());
912 //m_clipNeedsRefresh = true;
914 int duration = m_tc.getFrameCount(m_view.clip_duration->text());
915 if (duration != m_clip->duration().frames(m_fps)) {
916 props["out"] = QString::number(duration - 1);
918 } else if (t == SLIDESHOW) {
919 QString value = QString::number((int) m_view.slide_loop->isChecked());
920 if (m_old_props.value("loop") != value) props["loop"] = value;
921 value = QString::number((int) m_view.slide_crop->isChecked());
922 if (m_old_props.value("crop") != value) props["crop"] = value;
923 value = QString::number((int) m_view.slide_fade->isChecked());
924 if (m_old_props.value("fade") != value) props["fade"] = value;
925 value = QString::number((int) m_view.luma_softness->value());
926 if (m_old_props.value("softness") != value) props["softness"] = value;
928 bool isMime = !(m_view.clip_path->text().contains('%'));
930 QString extension = "/.all." + m_view.image_type->itemData(m_view.image_type->currentIndex()).toString();
931 QString new_path = m_view.clip_path->text() + extension;
932 if (new_path != m_old_props.value("resource")) {
933 m_clipNeedsReLoad = true;
934 props["resource"] = new_path;
935 kDebug() << "//// SLIDE EDIT, NEW:" << new_path << ", OLD; " << m_old_props.value("resource");
939 if (m_view.slide_duration_format->currentIndex() == 1) {
940 // we are in frames mode
941 duration = m_view.slide_duration_frames->value();
942 } else duration = m_tc.getFrameCount(m_view.slide_duration->text());
943 if (duration != m_old_props.value("ttl").toInt()) {
944 m_clipNeedsRefresh = true;
945 props["ttl"] = QString::number(duration);
946 props["length"] = QString::number(duration * m_count);
949 if (duration * m_count - 1 != m_old_props.value("out").toInt()) {
950 m_clipNeedsRefresh = true;
951 props["out"] = QString::number(duration * m_count - 1);
953 if (m_view.slide_fade->isChecked()) {
955 if (m_view.slide_duration_format->currentIndex() == 1) {
956 // we are in frames mode
957 luma_duration = m_view.luma_duration_frames->value();
958 } else luma_duration = m_tc.getFrameCount(m_view.luma_duration->text());
959 if (luma_duration != m_old_props.value("luma_duration").toInt()) {
960 m_clipNeedsRefresh = true;
961 props["luma_duration"] = QString::number(luma_duration);
964 if (m_view.slide_luma->isChecked())
965 lumaFile = m_view.luma_file->itemData(m_view.luma_file->currentIndex()).toString();
966 if (lumaFile != m_old_props.value("luma_file")) {
967 m_clipNeedsRefresh = true;
968 props["luma_file"] = lumaFile;
971 if (!m_old_props.value("luma_file").isEmpty()) {
972 props["luma_file"].clear();
976 QString animation = m_view.animation->itemData(m_view.animation->currentIndex()).toString();
977 if (animation != m_old_props.value("animation")) {
978 if (animation.isEmpty()) {
979 props["animation"].clear();
981 props["animation"] = animation;
983 m_clipNeedsRefresh = true;
989 bool ClipProperties::needsTimelineRefresh() const
991 return m_clipNeedsRefresh;
994 bool ClipProperties::needsTimelineReload() const
996 return m_clipNeedsReLoad;
1000 void ClipProperties::parseFolder()
1002 QString path = m_view.clip_path->text();
1003 bool isMime = !(path.contains('%'));
1004 if (!isMime) path = KUrl(path).directory();
1007 QStringList filters;
1011 // TODO: improve jpeg image detection with extension like jpeg, requires change in MLT image producers
1012 filters << "*." + m_view.image_type->itemData(m_view.image_type->currentIndex()).toString();
1013 extension = "/.all." + m_view.image_type->itemData(m_view.image_type->currentIndex()).toString();
1014 dir.setNameFilters(filters);
1017 QStringList result = dir.entryList(QDir::Files);
1021 QString filter = KUrl(m_view.clip_path->text()).fileName();
1022 QString ext = filter.section('.', -1);
1023 filter = filter.section('%', 0, -2);
1024 QString regexp = '^' + filter + "\\d+\\." + ext + '$';
1026 QStringList entries;
1027 foreach(const QString & path, result) {
1028 if (rx.exactMatch(path)) entries << path;
1033 m_count = result.count();
1034 m_view.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(m_count > 0);
1036 // no images, do not accept that
1037 m_view.slide_info->setText(i18n("No image found"));
1038 m_view.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
1041 m_view.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
1042 m_view.slide_info->setText(i18np("1 image found", "%1 images found", m_count));
1043 QDomElement xml = m_clip->toXML();
1044 xml.setAttribute("resource", m_view.clip_path->text() + extension);
1045 int width = 180.0 * KdenliveSettings::project_display_ratio();
1046 if (width % 2 == 1) width++;
1047 QString filePath = m_view.clip_path->text();
1048 if (isMime) filePath.append(extension);
1049 QPixmap pix = m_clip->thumbProducer()->getImage(KUrl(filePath), 1, width, 180);
1050 QMap <QString, QString> props = m_clip->properties();
1051 m_view.clip_duration->setText(m_tc.getTimecodeFromFrames(props.value("ttl").toInt() * m_count));
1052 m_view.clip_thumb->setPixmap(pix);
1055 void ClipProperties::slotCheckMaxLength()
1057 if (m_clip->maxDuration() == GenTime()) return;
1058 int duration = m_tc.getFrameCount(m_view.clip_duration->text());
1059 if (duration > m_clip->maxDuration().frames(m_fps)) {
1060 m_view.clip_duration->setText(m_tc.getTimecode(m_clip->maxDuration()));
1064 void ClipProperties::slotUpdateDurationFormat(int ix)
1066 bool framesFormat = ix == 1;
1068 // switching to frames count, update widget
1069 m_view.slide_duration_frames->setValue(m_tc.getFrameCount(m_view.slide_duration->text()));
1070 m_view.luma_duration_frames->setValue(m_tc.getFrameCount(m_view.luma_duration->text()));
1071 m_view.slide_duration->setHidden(true);
1072 m_view.luma_duration->setHidden(true);
1073 m_view.slide_duration_frames->setHidden(false);
1074 m_view.luma_duration_frames->setHidden(false);
1076 // switching to timecode format
1077 m_view.slide_duration->setText(m_tc.getTimecodeFromFrames(m_view.slide_duration_frames->value()));
1078 m_view.luma_duration->setText(m_tc.getTimecodeFromFrames(m_view.luma_duration_frames->value()));
1079 m_view.slide_duration_frames->setHidden(true);
1080 m_view.luma_duration_frames->setHidden(true);
1081 m_view.slide_duration->setHidden(false);
1082 m_view.luma_duration->setHidden(false);
1086 void ClipProperties::slotDeleteProxy()
1088 QString proxy = m_clip->getProperty("proxy");
1089 if (proxy.isEmpty()) return;
1090 emit deleteProxy(proxy);
1091 if (m_proxyContainer) delete m_proxyContainer;
1094 void ClipProperties::slotOpenUrl(const QString &url)
1096 new KRun(KUrl(url), this);
1099 #include "clipproperties.moc"