From: Till Theato Date: Sun, 14 Nov 2010 19:59:49 +0000 (+0000) Subject: Some smaller cleanups related to project loading X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=c5441a5258aec688ea99fc034974f71cf1009629;p=kdenlive Some smaller cleanups related to project loading svn path=/trunk/kdenlive/; revision=5097 --- diff --git a/src/kthumb.cpp b/src/kthumb.cpp index f72bd221..3986e3e5 100644 --- a/src/kthumb.cpp +++ b/src/kthumb.cpp @@ -383,12 +383,20 @@ void KThumb::getAudioThumbs(int channel, double frame, double frameLength, int a slotAudioThumbOver(); return; } + kDebug() << "reading audio thumbs from file"; + + int h1 = arrayWidth * m_channels; + int h2 = (int) frame * h1; + int h3; for (int z = (int) frame; z < (int)(frame + frameLength); z++) { + h2 += h1; + h3 = 0; for (int c = 0; c < m_channels; c++) { + h3 += arrayWidth; QByteArray m_array(arrayWidth, '\x00'); for (int i = 0; i < arrayWidth; i++) - m_array[i] = channelarray[z*arrayWidth*m_channels + c*arrayWidth + i]; + m_array[i] = channelarray[h2 + h3 + i]; storeIn[z][c] = m_array; } } diff --git a/src/projectlist.cpp b/src/projectlist.cpp index b674b1f9..b66803a9 100644 --- a/src/projectlist.cpp +++ b/src/projectlist.cpp @@ -1446,7 +1446,8 @@ void ProjectList::slotRefreshClipThumbnail(QTreeWidgetItem *it, bool update) } if (update) emit projectModified(); - QTimer::singleShot(30, this, SLOT(slotProcessNextThumbnail())); + + slotProcessNextThumbnail(); } } @@ -1462,7 +1463,6 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsDropEnabled); toReload = clipId; } - //Q_ASSERT_X(item->referencedClip(), "void ProjectList::slotReplyGetFileProperties", QString("Item with groupName %1 does not have a clip associated").arg(item->groupName()).toLatin1()); item->referencedClip()->setProducer(producer, replace); item->referencedClip()->askForAudioThumbs(); if (!replace && item->data(0, Qt::DecorationRole).isNull()) @@ -1470,7 +1470,6 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce if (!toReload.isEmpty()) item->slotSetToolTip(); - //emit receivedClipDuration(clipId); if (m_listView->isEnabled() && replace) { // update clip in clip monitor emit clipSelected(NULL); @@ -1489,7 +1488,6 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce requestClipThumbnail(clipId); }*/ } else kDebug() << "//////// COULD NOT FIND CLIP TO UPDATE PRPS..."; - int max = m_doc->clipManager()->clipsCount(); if (item && m_infoQueue.isEmpty() && m_thumbnailQueue.isEmpty()) { m_listView->setCurrentItem(item); bool updatedProfile = false; @@ -1502,12 +1500,14 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce } if (updatedProfile == false) emit clipSelected(item->referencedClip()); } else { + int max = m_doc->clipManager()->clipsCount(); emit displayMessage(i18n("Loading clips"), (int)(100 *(max - m_infoQueue.count()) / max)); } if (!toReload.isEmpty()) emit clipNeedsReload(toReload, true); - // small delay so that the app can display the progress info - QTimer::singleShot(30, this, SLOT(slotProcessNextClipInQueue())); + + qApp->processEvents(); + slotProcessNextClipInQueue(); } bool ProjectList::adjustProjectProfileToItem(ProjectItem *item) diff --git a/src/renderer.cpp b/src/renderer.cpp index 7c63b479..d48e8c94 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -517,14 +517,17 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int { KUrl url = KUrl(xml.attribute("resource", QString())); Mlt::Producer *producer = NULL; + CLIPTYPE type = (CLIPTYPE)xml.attribute("type").toInt(); + //kDebug() << "PROFILE WIDT: "<< xml.attribute("mlt_service") << ": "<< m_mltProfile->width() << "\n...................\n\n"; /*if (xml.attribute("type").toInt() == TEXT && !QFile::exists(url.path())) { emit replyGetFileProperties(clipId, producer, QMap < QString, QString >(), QMap < QString, QString >(), replaceProducer); return; }*/ - if (xml.attribute("type").toInt() == COLOR) { + + if (type == COLOR) { producer = new Mlt::Producer(*m_mltProfile, 0, ("colour:" + xml.attribute("colour")).toUtf8().constData()); - } else if (xml.attribute("type").toInt() == TEXT) { + } else if (type == TEXT) { producer = new Mlt::Producer(*m_mltProfile, 0, ("kdenlivetitle:" + xml.attribute("resource")).toUtf8().constData()); if (producer && producer->is_valid() && xml.hasAttribute("xmldata")) producer->set("xmldata", xml.attribute("xmldata").toUtf8().constData()); @@ -598,8 +601,7 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int } // setup length here as otherwise default length (currently 15000 frames in MLT) will be taken even if outpoint is larger - if (xml.attribute("type").toInt() == COLOR || xml.attribute("type").toInt() == TEXT - || xml.attribute("type").toInt() == IMAGE || xml.attribute("type").toInt() == SLIDESHOW) + if (type == COLOR || type == TEXT || type == IMAGE || type == SLIDESHOW) producer->set("length", xml.attribute("out").toInt() - xml.attribute("in").toInt() + 1); if (xml.hasAttribute("out")) @@ -628,7 +630,7 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int Mlt::Frame *frame = producer->get_frame(); - if (xml.attribute("type").toInt() == SLIDESHOW) { + if (type == SLIDESHOW) { int ttl = xml.hasAttribute("ttl") ? xml.attribute("ttl").toInt() : 0; if (ttl) producer->set("ttl", ttl); if (!xml.attribute("animation").isEmpty()) {