svn path=/trunk/kdenlive/; revision=3890
13 files changed:
emit transitionItemSelected(NULL);
}
}
emit transitionItemSelected(NULL);
}
}
- if (groupCount > 0 && clipCount == transitionCount == 0)
+ if (groupCount > 0 && (clipCount == transitionCount == 0))
deleteSelected->setText(i18np("Delete selected group", "Delete selected groups", groupCount));
deleteSelected->setText(i18np("Delete selected group", "Delete selected groups", groupCount));
- else if (clipCount > 0 && groupCount == transitionCount == 0)
+ else if (clipCount > 0 && (groupCount == transitionCount == 0))
deleteSelected->setText(i18np("Delete selected clip", "Delete selected clips", clipCount));
deleteSelected->setText(i18np("Delete selected clip", "Delete selected clips", clipCount));
- else if (transitionCount > 0 && groupCount == clipCount == 0)
+ else if (transitionCount > 0 && (groupCount == clipCount == 0))
deleteSelected->setText(i18np("Delete selected transition", "Delete selected transitions", transitionCount));
else deleteSelected->setText(i18n("Delete selected items"));
m_commandStack->push(deleteSelected);
deleteSelected->setText(i18np("Delete selected transition", "Delete selected transitions", transitionCount));
else deleteSelected->setText(i18n("Delete selected items"));
m_commandStack->push(deleteSelected);
if (producer->is_blank() == false) {
int width = 45.0 * profile.dar();
if (width % 2 == 1) width++;
if (producer->is_blank() == false) {
int width = 45.0 * profile.dar();
if (width % 2 == 1) width++;
- pix = KThumb::getFrame(producer, 0, width, 45);
- item->setIcon(0, pix);
+ item->setIcon(0, QPixmap::fromImage(KThumb::getFrame(producer, 0, width, 45)));
int playTime = producer->get_playtime();
item->setText(1, Timecode::getStringTimecode(playTime, profile.fps()));
item->setData(1, Qt::UserRole, playTime);
int playTime = producer->get_playtime();
item->setText(1, Timecode::getStringTimecode(playTime, profile.fps()));
item->setData(1, Qt::UserRole, playTime);
if (createClipItem) {
emit addProjectClip(clip);
if (createClipItem) {
emit addProjectClip(clip);
- qApp->processEvents();
- m_render->getFileProperties(clip->toXML(), clip->getId(), true);
+ //qApp->processEvents();
const int theight = KdenliveSettings::trackheight();
if (frame != -1) {
const int theight = KdenliveSettings::trackheight();
if (frame != -1) {
- QPixmap pix = getFrame(m_producer, frame, twidth, theight);
+ QPixmap pix = QPixmap::fromImage(getFrame(m_producer, frame, twidth, theight));
emit thumbReady(frame, pix);
}
if (frame2 != -1) {
emit thumbReady(frame, pix);
}
if (frame2 != -1) {
- QPixmap pix = getFrame(m_producer, frame2, twidth, theight);
+ QPixmap pix = QPixmap::fromImage(getFrame(m_producer, frame2, twidth, theight));
emit thumbReady(frame2, pix);
}
}
QPixmap KThumb::extractImage(int frame, int width, int height)
{
emit thumbReady(frame2, pix);
}
}
QPixmap KThumb::extractImage(int frame, int width, int height)
{
- return getFrame(m_producer, frame, width, height);
+ return QPixmap::fromImage(getFrame(m_producer, frame, width, height));
Mlt::Producer *producer = new Mlt::Producer(profile, tmp);
delete[] tmp;
Mlt::Producer *producer = new Mlt::Producer(profile, tmp);
delete[] tmp;
- pix = getFrame(producer, frame, width, height);
+ pix = QPixmap::fromImage(getFrame(producer, frame, width, height));
delete producer;
return pix;
}
//static
delete producer;
return pix;
}
//static
-QPixmap KThumb::getFrame(Mlt::Producer *producer, int framepos, int width, int height)
+QImage KThumb::getFrame(Mlt::Producer *producer, int framepos, int width, int height)
- QPixmap p(width, height);
+ QImage p(width, height, QImage::Format_ARGB32);
if (producer == NULL) {
p.fill(Qt::red);
return p;
if (producer == NULL) {
p.fill(Qt::red);
return p;
//mlt_service_unlock(service.get_service());
if (!image.isNull()) {
//mlt_service_unlock(service.get_service());
if (!image.isNull()) {
- p = QPixmap::fromImage(image.rgbSwapped());
+ p = image.rgbSwapped();
void removeAudioThumb();
void getAudioThumbs(int channel, double frame, double frameLength, int arrayWidth);
static QPixmap getImage(KUrl url, int frame, int width, int height);
void removeAudioThumb();
void getAudioThumbs(int channel, double frame, double frameLength, int arrayWidth);
static QPixmap getImage(KUrl url, int frame, int width, int height);
- static QPixmap getFrame(Mlt::Producer *producer, int framepos, int width, int height);
+ static QImage getFrame(Mlt::Producer *producer, int framepos, int width, int height);
private slots:
void slotAudioThumbProgress(const int progress);
private slots:
void slotAudioThumbProgress(const int progress);
disconnect(m_activeTimeline->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
disconnect(m_activeTimeline, SIGNAL(zoneMoved(int, int)), this, SLOT(slotZoneMoved(int, int)));
disconnect(m_projectList, SIGNAL(loadingIsOver()), m_activeTimeline->projectView(), SLOT(slotUpdateAllThumbs()));
disconnect(m_activeTimeline->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
disconnect(m_activeTimeline, SIGNAL(zoneMoved(int, int)), this, SLOT(slotZoneMoved(int, int)));
disconnect(m_projectList, SIGNAL(loadingIsOver()), m_activeTimeline->projectView(), SLOT(slotUpdateAllThumbs()));
+ disconnect(m_projectList, SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
m_effectStack->clear();
}
//m_activeDocument->setRenderer(NULL);
m_effectStack->clear();
}
//m_activeDocument->setRenderer(NULL);
connect(trackView->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
connect(trackView, SIGNAL(zoneMoved(int, int)), this, SLOT(slotZoneMoved(int, int)));
connect(m_projectList, SIGNAL(loadingIsOver()), trackView->projectView(), SLOT(slotUpdateAllThumbs()));
connect(trackView->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
connect(trackView, SIGNAL(zoneMoved(int, int)), this, SLOT(slotZoneMoved(int, int)));
connect(m_projectList, SIGNAL(loadingIsOver()), trackView->projectView(), SLOT(slotUpdateAllThumbs()));
+ connect(m_projectList, SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
trackView->projectView()->setContextMenu(m_timelineContextMenu, m_timelineContextClipMenu, m_timelineContextTransitionMenu, m_clipTypeGroup);
m_activeTimeline = trackView;
if (m_renderWidget) {
trackView->projectView()->setContextMenu(m_timelineContextMenu, m_timelineContextClipMenu, m_timelineContextTransitionMenu, m_clipTypeGroup);
m_activeTimeline = trackView;
if (m_renderWidget) {
connect(this, SIGNAL(updateThumb()), m_previewTimer, SLOT(start()));
case IMAGE:
case TEXT:
connect(this, SIGNAL(updateThumb()), m_previewTimer, SLOT(start()));
case IMAGE:
case TEXT:
- p = KThumb::getFrame(m_producer, t.time().frames(m_fps), width, 100);
+ p = QPixmap::fromImage(KThumb::getFrame(m_producer, t.time().frames(m_fps), width, 100));
break;
case COLOR:
colour = colour.replace(0, 2, "#");
break;
case COLOR:
colour = colour.replace(0, 2, "#");
int pos = m_tc.getFrameCount(marker_position->text());
int width = 100.0 * m_dar;
if (width % 2 == 1) width++;
int pos = m_tc.getFrameCount(marker_position->text());
int width = 100.0 * m_dar;
if (width % 2 == 1) width++;
- QPixmap p = KThumb::getFrame(m_producer, pos, width, 100);
+ QPixmap p = QPixmap::fromImage(KThumb::getFrame(m_producer, pos, width, 100));
if (!p.isNull()) clip_thumb->setPixmap(p);
else kDebug() << "!!!!!!!!!!! ERROR CREATING THUMB";
}
if (!p.isNull()) clip_thumb->setPixmap(p);
else kDebug() << "!!!!!!!!!!! ERROR CREATING THUMB";
}
void Monitor::slotExtractCurrentFrame()
{
void Monitor::slotExtractCurrentFrame()
{
- QPixmap frame = render->extractFrame(render->seekFramePosition());
- QString outputFile = KFileDialog::getSaveFileName(KUrl(), "image/png");
- if (!outputFile.isEmpty()) {
- if (QFile::exists(outputFile) && KMessageBox::questionYesNo(this, i18n("File already exists.\nDo you want to overwrite it?")) == KMessageBox::No) return;
- frame.save(outputFile);
+ QImage frame = render->extractFrame(render->seekFramePosition());
+ KFileDialog *fs = new KFileDialog(KUrl(), "image/png",this);
+ fs->setOperationMode(KFileDialog::Saving);
+ fs->setMode(KFile::File);
+ fs->setConfirmOverwrite(true);
+ fs->setKeepLocation(true);
+ fs->exec();
+ QString path = fs->selectedFile();
+ delete fs;
+ if (!path.isEmpty()) {
+ frame.save(path);
void ProjectList::slotAddClip(DocClipBase *clip, bool getProperties)
{
void ProjectList::slotAddClip(DocClipBase *clip, bool getProperties)
{
+ m_listView->setEnabled(false);
- m_listView->setEnabled(false);
m_listView->blockSignals(true);
m_listView->blockSignals(true);
+ m_refreshed = false;
+ m_infoQueue.insert(clip->getId(), clip->toXML());
+ //m_render->getFileProperties(clip->toXML(), clip->getId(), true);
}
const QString parent = clip->getProperty("groupid");
kDebug() << "Adding clip with groupid: " << parent;
}
const QString parent = clip->getProperty("groupid");
kDebug() << "Adding clip with groupid: " << parent;
if (!annotation.isEmpty()) item->setText(2, annotation);
item->setText(3, QString::number(f.rating()));
}
if (!annotation.isEmpty()) item->setText(2, annotation);
item->setText(3, QString::number(f.rating()));
}
- if (getProperties) m_listView->blockSignals(false);
+ if (getProperties && m_listView->isEnabled()) m_listView->blockSignals(false);
+ if (getProperties && !m_queueTimer.isActive()) m_queueTimer.start();
}
void ProjectList::slotResetProjectList()
}
void ProjectList::slotResetProjectList()
void ProjectList::requestClipInfo(const QDomElement xml, const QString id)
{
void ProjectList::requestClipInfo(const QDomElement xml, const QString id)
{
m_infoQueue.insert(id, xml);
m_infoQueue.insert(id, xml);
- m_listView->setEnabled(false);
- if (!m_queueTimer.isActive()) m_queueTimer.start();
//if (m_infoQueue.count() == 1 || ) QTimer::singleShot(300, this, SLOT(slotProcessNextClipInQueue()));
}
//if (m_infoQueue.count() == 1 || ) QTimer::singleShot(300, this, SLOT(slotProcessNextClipInQueue()));
}
m_infoQueue.remove(j.key());
emit getFileProperties(dom, id, false);
}
m_infoQueue.remove(j.key());
emit getFileProperties(dom, id, false);
}
- if (!m_infoQueue.isEmpty()) m_queueTimer.start();
+
+ if (!m_infoQueue.isEmpty() && !m_queueTimer.isActive()) m_queueTimer.start();
}
void ProjectList::slotUpdateClip(const QString &id)
}
void ProjectList::slotUpdateClip(const QString &id)
}
}
item->setData(1, UsageRole, QString::number(item->numReferences()));
}
}
item->setData(1, UsageRole, QString::number(item->numReferences()));
+ //qApp->processEvents();
+ qApp->processEvents();
+ if (!m_queueTimer.isActive()) m_queueTimer.start();
- m_listView->blockSignals(false);
+ if (m_listView->isEnabled()) m_listView->blockSignals(false);
m_listView->setSortingEnabled(true);
if (m_infoQueue.isEmpty()) slotProcessNextThumbnail();
}
m_listView->setSortingEnabled(true);
if (m_infoQueue.isEmpty()) slotProcessNextThumbnail();
}
if (!m_refreshed && m_thumbnailQueue.isEmpty() && m_infoQueue.isEmpty()) {
m_refreshed = true;
emit loadingIsOver();
if (!m_refreshed && m_thumbnailQueue.isEmpty() && m_infoQueue.isEmpty()) {
m_refreshed = true;
emit loadingIsOver();
- } else QTimer::singleShot(300, this, SLOT(slotCheckForEmptyQueue()));
+ emit displayMessage(QString(), DefaultMessage);
+ m_listView->blockSignals(false);
+ m_listView->setEnabled(true);
+ } else if (!m_refreshed) QTimer::singleShot(300, this, SLOT(slotCheckForEmptyQueue()));
}
void ProjectList::reloadClipThumbnails()
}
void ProjectList::reloadClipThumbnails()
void ProjectList::slotProcessNextThumbnail()
{
if (m_thumbnailQueue.isEmpty() && m_infoQueue.isEmpty()) {
void ProjectList::slotProcessNextThumbnail()
{
if (m_thumbnailQueue.isEmpty() && m_infoQueue.isEmpty()) {
- m_listView->setEnabled(true);
slotCheckForEmptyQueue();
return;
}
slotCheckForEmptyQueue();
return;
}
return;
}
slotRefreshClipThumbnail(m_thumbnailQueue.takeFirst(), false);
return;
}
slotRefreshClipThumbnail(m_thumbnailQueue.takeFirst(), false);
+ if (m_thumbnailQueue.count() > 1) {
+ emit displayMessage(i18n("Loading clips (%1)", m_thumbnailQueue.count()), InformationMessage);
+ qApp->processEvents();
+ }
}
void ProjectList::slotRefreshClipThumbnail(const QString &clipId, bool update)
}
void ProjectList::slotRefreshClipThumbnail(const QString &clipId, bool update)
int height = 50;
int width = (int)(height * m_render->dar());
if (clip->clipType() == AUDIO) pix = KIcon("audio-x-generic").pixmap(QSize(width, height));
int height = 50;
int width = (int)(height * m_render->dar());
if (clip->clipType() == AUDIO) pix = KIcon("audio-x-generic").pixmap(QSize(width, height));
- else if (clip->clipType() == IMAGE) pix = KThumb::getFrame(item->referencedClip()->producer(), 0, width, height);
+ else if (clip->clipType() == IMAGE) pix = QPixmap::fromImage(KThumb::getFrame(item->referencedClip()->producer(), 0, width, height));
else pix = item->referencedClip()->thumbProducer()->extractImage(item->referencedClip()->getClipThumbFrame(), width, height);
if (!pix.isNull()) {
m_listView->blockSignals(true);
item->setIcon(0, pix);
else pix = item->referencedClip()->thumbProducer()->extractImage(item->referencedClip()->getClipThumbFrame(), width, height);
if (!pix.isNull()) {
m_listView->blockSignals(true);
item->setIcon(0, pix);
- m_listView->blockSignals(false);
+ if (m_listView->isEnabled()) m_listView->blockSignals(false);
m_doc->cachePixmap(item->getClipHash(), pix);
}
if (update) emit projectModified();
m_doc->cachePixmap(item->getClipHash(), pix);
}
if (update) emit projectModified();
emit receivedClipDuration(clipId);
delete producer;
}*/
emit receivedClipDuration(clipId);
delete producer;
}*/
- m_listView->blockSignals(false);
+ if (m_listView->isEnabled()) m_listView->blockSignals(false);
if (item->icon(0).isNull()) {
requestClipThumbnail(clipId);
}
if (item->icon(0).isNull()) {
requestClipThumbnail(clipId);
}
m_listView->blockSignals(true);
item->setIcon(0, pix);
m_doc->cachePixmap(item->getClipHash(), pix);
m_listView->blockSignals(true);
item->setIcon(0, pix);
m_doc->cachePixmap(item->getClipHash(), pix);
- m_listView->blockSignals(false);
+ if (m_listView->isEnabled()) m_listView->blockSignals(false);
void showClipProperties(DocClipBase *);
void projectModified();
void loadingIsOver();
void showClipProperties(DocClipBase *);
void projectModified();
void loadingIsOver();
+ void displayMessage(const QString, MessageType);
void clipNameChanged(const QString, const QString);
void refreshClip();
};
void clipNameChanged(const QString, const QString);
void refreshClip();
};
return m_mltProfile->height();
}
return m_mltProfile->height();
}
-QPixmap Render::extractFrame(int frame_position, int width, int height)
+QImage Render::extractFrame(int frame_position, int width, int height)
{
if (width == -1) {
width = renderWidth();
height = renderHeight();
} else if (width % 2 == 1) width++;
{
if (width == -1) {
width = renderWidth();
height = renderHeight();
} else if (width % 2 == 1) width++;
- QPixmap pix(width, height);
+ QImage pix(width, height, QImage::Format_RGB32);
pix.fill(Qt::black);
return pix;
}
pix.fill(Qt::black);
return pix;
}
void stop(const GenTime & startTime);
void setVolume(double volume);
void stop(const GenTime & startTime);
void setVolume(double volume);
- QPixmap extractFrame(int frame_position, int width = -1, int height = -1);
+ QImage extractFrame(int frame_position, int width = -1, int height = -1);
/** Wraps the VEML command of the same name. Tells the renderer to
play the current scene at the speed specified, relative to normal
playback. e.g. 1.0 is normal speed, 0.0 is paused, -1.0 means play
/** Wraps the VEML command of the same name. Tells the renderer to
play the current scene at the speed specified, relative to normal
playback. e.g. 1.0 is normal speed, 0.0 is paused, -1.0 means play
p.end();
m_frameImage->setPixmap(bg);
} else {
p.end();
m_frameImage->setPixmap(bg);
} else {
- m_frameImage->setPixmap(m_render->extractFrame((int) m_render->seekPosition().frames(m_render->fps()), m_frameWidth / 2, m_frameHeight / 2));
+ m_frameImage->setPixmap(QPixmap::fromImage(m_render->extractFrame((int) m_render->seekPosition().frames(m_render->fps()), m_frameWidth / 2, m_frameHeight / 2)));