#include "kthumb.h"
#include "projectlistview.h"
#include "timecodedisplay.h"
+#include "profilesdialog.h"
#include "editclipcommand.h"
#include "editclipcutcommand.h"
#include "editfoldercommand.h"
#include <QInputDialog>
ProjectList::ProjectList(QWidget *parent) :
- QWidget(parent),
- m_render(NULL),
- m_fps(-1),
- m_commandStack(NULL),
- m_editAction(NULL),
- m_deleteAction(NULL),
- m_openAction(NULL),
- m_reloadAction(NULL),
- m_transcodeAction(NULL),
- m_doc(NULL),
- m_refreshed(false),
- m_infoQueue(),
- m_thumbnailQueue()
+ QWidget(parent),
+ m_render(NULL),
+ m_fps(-1),
+ m_commandStack(NULL),
+ m_editAction(NULL),
+ m_deleteAction(NULL),
+ m_openAction(NULL),
+ m_reloadAction(NULL),
+ m_transcodeAction(NULL),
+ m_doc(NULL),
+ m_refreshed(false),
+ m_infoQueue(),
+ m_thumbnailQueue()
{
m_listView = new ProjectListView(this);;
if (data.count() > 2) {
condition = data.at(2);
if (condition.startsWith("vcodec"))
- transcodeActions.at(i)->setEnabled(clip->referencedClip()->hasVideoCodec(condition.section("=", 1, 1)));
+ transcodeActions.at(i)->setEnabled(clip->referencedClip()->hasVideoCodec(condition.section('=', 1, 1)));
else if (condition.startsWith("acodec"))
- transcodeActions.at(i)->setEnabled(clip->referencedClip()->hasVideoCodec(condition.section("=", 1, 1)));
+ transcodeActions.at(i)->setEnabled(clip->referencedClip()->hasVideoCodec(condition.section('=', 1, 1)));
}
}
<< "image/gif" << "image/jpeg" << "image/png" << "image/x-tga" << "image/x-bmp" << "image/svg+xml" << "image/tiff" << "image/x-xcf" << "image/x-xcf-gimp" << "image/x-vnd.adobe.photoshop" << "image/x-pcx" << "image/x-exr";
QString allExtensions;
- foreach(const QString& mimeType, mimeTypes) {
+ foreach(const QString & mimeType, mimeTypes) {
KMimeType::Ptr mime(KMimeType::mimeType(mimeType));
if (mime) {
allExtensions.append(mime->patterns().join(" "));
KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
if (item.mimetype().startsWith("image")) {
int count = 0;
- // import as sequence if we found at least 5 images in the sequence
+ // import as sequence if we found more than one image in the sequence
QString pattern = SlideshowClip::selectedPath(url.path(), false, QString(), &count);
if (count > 1) {
delete d;
list << givenList.at(i);
}
- foreach(const KUrl &file, list) {
+ foreach(const KUrl & file, list) {
// Check there is no folder here
KMimeType::Ptr type = KMimeType::findByUrl(file);
if (type->is("inode/directory")) {
if (item->parent()) {
if (item->parent()->type() == PROJECTFOLDERTYPE)
static_cast <FolderProjectItem *>(item->parent())->switchIcon();
+ } else if (KdenliveSettings::checkfirstprojectclip() && m_listView->topLevelItemCount() == 1) {
+ // this is the first clip loaded in project, check if we want to adjust project settings to the clip
+ int width = properties.value("frame_size").section('x', 0, 0).toInt();
+ int height = properties.value("frame_size").section('x', -1).toInt();
+ double fps = properties.value("fps").toDouble();
+ int renderWidth = -1;
+ int renderHeight = -1;
+ double renderFps = -1;
+ if (item->clipType() == IMAGE) {
+ renderWidth = m_doc->renderer()->renderWidth();
+ renderHeight = m_doc->height();
+ } else if (item->clipType() == AV || item->clipType() == VIDEO) {
+ renderWidth = m_doc->width();
+ renderHeight = m_doc->height();
+ renderFps = m_doc->fps();
+ }
+ if ((renderWidth > 0 && width != renderWidth) || (renderHeight > 0 && height != renderHeight) || (renderFps > 0 && qAbs(fps - renderFps) > 0.5)) {
+ QString suggestedProfile = ProfilesDialog::getPathFromProperties(width, height, fps, item->clipType() == IMAGE);
+ if (!suggestedProfile.isEmpty()) {
+ QString description = ProfilesDialog::getSettingsFromFile(suggestedProfile).value("description");
+ if (KMessageBox::questionYesNo(this, i18n("Your clip does not match current project's profile.\nDo you want to adjust the profile (clip size: %1, fps: %2)?\nSuggested profile is %3", properties.value("frame_size"), fps, description)) == KMessageBox::Yes) {
+ //Change project profile
+ emit updateProfile(suggestedProfile);
+ }
+ } else KMessageBox::information(this, i18n("Your clip does not match current project's profile.\nNo existing profile found to match the clip's properties.\nClip size: %1\nFps: %2\n", properties.value("frame_size"), fps));
+ }
}
emit clipSelected(item->referencedClip());
} else {
continue;
DocClipBase *clip = item->referencedClip();
if (!condition.isEmpty()) {
- if (condition.startsWith("vcodec") && !clip->hasVideoCodec(condition.section("=", 1, 1)))
+ if (condition.startsWith("vcodec") && !clip->hasVideoCodec(condition.section('=', 1, 1)))
continue;
- else if (condition.startsWith("acodec") && !clip->hasAudioCodec(condition.section("=", 1, 1)))
+ else if (condition.startsWith("acodec") && !clip->hasAudioCodec(condition.section('=', 1, 1)))
continue;
}
result.append(item->clipUrl());