#include <QDir>
-SlideshowClip::SlideshowClip(QWidget * parent): QDialog(parent), m_count(0)
+SlideshowClip::SlideshowClip(Timecode tc, QWidget * parent) :
+ QDialog(parent),
+ m_count(0),
+ m_timecode(tc)
{
setFont(KGlobalSettings::toolBarFont());
setWindowTitle(i18n("Add Slideshow Clip"));
connect(m_view.slide_fade, SIGNAL(stateChanged(int)), this, SLOT(slotEnableLuma(int)));
connect(m_view.luma_fade, SIGNAL(stateChanged(int)), this, SLOT(slotEnableLumaFile(int)));
+ //WARNING: keep in sync with clipproperties.cpp
m_view.image_type->addItem("JPG (*.jpg)", "jpg");
m_view.image_type->addItem("JPEG (*.jpeg)", "jpeg");
m_view.image_type->addItem("PNG (*.png)", "png");
m_view.image_type->addItem("TGA (*.tga)", "tga");
m_view.image_type->addItem("TIFF (*.tiff)", "tiff");
m_view.image_type->addItem("Open EXR (*.exr)", "exr");
- m_view.clip_duration->setText(KdenliveSettings::image_duration());
- m_view.luma_duration->setText("00:00:00:24");
+
+ m_view.clip_duration->setInputMask(m_timecode.inputMask());
+ m_view.clip_duration->setText(m_timecode.reformatSeparators(KdenliveSettings::image_duration()));
+ m_view.luma_duration->setInputMask(m_timecode.inputMask());
+ m_view.luma_duration->setText(m_timecode.getTimecodeFromFrames(int(ceil(m_timecode.fps()))));
m_view.folder_url->setUrl(QDir::homePath());
+ m_view.clip_duration_format->addItem(i18n("hh:mm:ss::ff"));
+ m_view.clip_duration_format->addItem(i18n("Frames"));
+ connect(m_view.clip_duration_format, SIGNAL(activated(int)), this, SLOT(slotUpdateDurationFormat(int)));
+ m_view.clip_duration_frames->setHidden(true);
+ m_view.luma_duration_frames->setHidden(true);
// Check for Kdenlive installed luma files
QStringList filters;
foreach(const QString &folder, customLumas) {
QStringList filesnames = QDir(folder).entryList(filters, QDir::Files);
foreach(const QString &fname, filesnames) {
- m_view.luma_file->addItem(KIcon(folder + '/' + fname), fname, folder + '/' + fname);
+ QString filePath = KUrl(folder).path(KUrl::AddTrailingSlash) + fname;
+ m_view.luma_file->addItem(KIcon(filePath), fname, filePath);
}
}
QDir lumafolder(folder);
QStringList filesnames = lumafolder.entryList(filters, QDir::Files);
foreach(const QString &fname, filesnames) {
- m_view.luma_file->addItem(KIcon(folder + '/' + fname), fname, folder + '/' + fname);
+ QString filePath = KUrl(folder).path(KUrl::AddTrailingSlash) + fname;
+ m_view.luma_file->addItem(KIcon(filePath), fname, filePath);
}
- adjustSize();
+ //adjustSize();
}
void SlideshowClip::slotEnableLuma(int state)
bool enable = false;
if (state == Qt::Checked) enable = true;
m_view.luma_duration->setEnabled(enable);
+ m_view.luma_duration_frames->setEnabled(enable);
m_view.luma_fade->setEnabled(enable);
if (enable) {
m_view.luma_file->setEnabled(m_view.luma_fade->isChecked());
m_count = result.count();
if (m_count == 0) m_view.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
else m_view.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
- m_view.label_info->setText(i18n("%1 images found", m_count));
+ m_view.label_info->setText(i18np("1 image found", "%1 images found", m_count));
QListWidgetItem *item;
int i = 0;
KIcon unknownicon("unknown");
QString SlideshowClip::clipDuration() const
{
+ if (m_view.clip_duration_format->currentIndex() == 1) {
+ // we are in frames mode
+ return m_timecode.getTimecodeFromFrames(m_view.clip_duration_frames->value());
+ }
return m_view.clip_duration->text();
}
QString SlideshowClip::lumaDuration() const
{
+ if (m_view.clip_duration_format->currentIndex() == 1) {
+ // we are in frames mode
+ return m_timecode.getTimecodeFromFrames(m_view.luma_duration_frames->value());
+ }
return m_view.luma_duration->text();
}
return m_view.luma_file->itemData(m_view.luma_file->currentIndex()).toString();
}
+void SlideshowClip::slotUpdateDurationFormat(int ix)
+{
+ bool framesFormat = ix == 1;
+ if (framesFormat) {
+ // switching to frames count, update widget
+ m_view.clip_duration_frames->setValue(m_timecode.getFrameCount(m_view.clip_duration->text()));
+ m_view.luma_duration_frames->setValue(m_timecode.getFrameCount(m_view.luma_duration->text()));
+ } else {
+ // switching to timecode format
+ m_view.clip_duration->setInputMask(m_timecode.inputMask());
+ m_view.clip_duration->setText(m_timecode.getTimecodeFromFrames(m_view.clip_duration_frames->value()));
+ m_view.luma_duration->setInputMask(m_timecode.inputMask());
+ m_view.luma_duration->setText(m_timecode.getTimecodeFromFrames(m_view.luma_duration_frames->value()));
+ }
+ m_view.clip_duration_frames->setHidden(!framesFormat);
+ m_view.clip_duration->setHidden(framesFormat);
+ m_view.luma_duration_frames->setHidden(!framesFormat);
+ m_view.luma_duration->setHidden(framesFormat);
+}
+
#include "slideshowclip.moc"