From: Marco Gittler Date: Sun, 3 Aug 2008 10:21:58 +0000 (+0000) Subject: indent fixes and geometry param will be used in initeffects X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=3f6eb1223fe196f7a39979610e3af0e2a8047bd8;p=kdenlive indent fixes and geometry param will be used in initeffects svn path=/branches/KDE4/; revision=2356 --- diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index aa087fad..0f2fcdbf 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -1149,15 +1149,14 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event) { // resize start if (m_dragItem->type() == AVWIDGET) { bool success = m_document->renderer()->mltResizeClipStart(m_tracksList.count() - m_dragItem->track(), m_dragItem->endPos(), m_dragItem->startPos(), m_dragItemInfo.startPos, m_dragItem->cropStart(), m_dragItem->cropStart() + m_dragItem->endPos() - m_dragItem->startPos()); - if (success) { - updateClipFade((ClipItem *) m_dragItem); - ResizeClipCommand *command = new ResizeClipCommand(this, m_dragItemInfo, info, false); - m_commandStack->push(command); - } - else { - m_dragItem->resizeStart((int) m_dragItemInfo.startPos.frames(m_document->fps()), m_scale); - emit displayMessage(i18n("Error when resizing clip"), ErrorMessage); - } + if (success) { + updateClipFade((ClipItem *) m_dragItem); + ResizeClipCommand *command = new ResizeClipCommand(this, m_dragItemInfo, info, false); + m_commandStack->push(command); + } else { + m_dragItem->resizeStart((int) m_dragItemInfo.startPos.frames(m_document->fps()), m_scale); + emit displayMessage(i18n("Error when resizing clip"), ErrorMessage); + } } else if (m_dragItem->type() == TRANSITIONWIDGET) { MoveTransitionCommand *command = new MoveTransitionCommand(this, m_dragItemInfo, info, false); m_commandStack->push(command); @@ -1299,8 +1298,8 @@ void CustomTrackView::changeClipSpeed() { ItemInfo info = item->info(); int percent = QInputDialog::getInteger(this, i18n("Edit Clip Speed"), i18n("New speed (percents)"), 100, 1, 300); double speed = (double) percent / 100.0; - if (item->speed() != speed) - new ChangeSpeedCommand(this, info, item->speed(), speed, item->clipProducer(), true, changeSelected); + if (item->speed() != speed) + new ChangeSpeedCommand(this, info, item->speed(), speed, item->clipProducer(), true, changeSelected); } } m_commandStack->push(changeSelected); @@ -1463,10 +1462,9 @@ void CustomTrackView::resizeClip(const ItemInfo start, const ItemInfo end) { if (resizeClipStart) { bool success = m_document->renderer()->mltResizeClipStart(m_tracksList.count() - item->track(), item->endPos(), end.startPos, item->startPos(), item->cropStart() + end.startPos - start.startPos, item->cropStart() + end.startPos - start.startPos + item->endPos() - end.startPos); if (success) { - item->resizeStart((int) end.startPos.frames(m_document->fps()), m_scale); - updateClipFade(item); - } - else emit displayMessage(i18n("Error when resizing clip"), ErrorMessage); + item->resizeStart((int) end.startPos.frames(m_document->fps()), m_scale); + updateClipFade(item); + } else emit displayMessage(i18n("Error when resizing clip"), ErrorMessage); } else { m_document->renderer()->mltResizeClipEnd(m_tracksList.count() - item->track(), item->startPos(), item->cropStart(), item->cropStart() + end.endPos - item->startPos()); item->resizeEnd((int) end.endPos.frames(m_document->fps()), m_scale); diff --git a/src/initeffects.cpp b/src/initeffects.cpp index 96c7e647..b8468045 100644 --- a/src/initeffects.cpp +++ b/src/initeffects.cpp @@ -438,7 +438,7 @@ QDomDocument initEffects::createDescriptionFromMlt(Mlt::Repository* repository, if (QString(paramdesc.get("type")) == "boolean") params.setAttribute("type", "bool"); if (!QString(paramdesc.get("format")).isEmpty() && QString(paramdesc.get("type")) != "geometry") { - params.setAttribute("type", "complex"); + params.setAttribute("type", "geometry"); params.setAttribute("format", paramdesc.get("format")); } if (!QString(paramdesc.get("format")).isEmpty() && QString(paramdesc.get("type")) == "geometry") { diff --git a/src/kdenlivedoc.cpp b/src/kdenlivedoc.cpp index 6de60180..c18d8807 100644 --- a/src/kdenlivedoc.cpp +++ b/src/kdenlivedoc.cpp @@ -64,7 +64,7 @@ KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, MltVideoPro int pos = 0; for (int i = 0; i < maxprod; i++) { QDomNode m = prods.at(pos); - QString prodId = m.toElement().attribute("id"); + QString prodId = m.toElement().attribute("id"); if (prodId == "black" || prodId.startsWith("slowmotion")) pos++; else westley.removeChild(m); @@ -91,7 +91,7 @@ KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, MltVideoPro parent->slotGotProgressInfo(QString(), (int) m_documentLoadingProgress); qApp->processEvents(); } - QString prodId = e.attribute("id"); + QString prodId = e.attribute("id"); if (!e.isNull() && prodId != "black" && prodId.toInt() > 0) { addClip(e, e.attribute("id").toInt()); } diff --git a/src/kdenlivesettingsdialog.cpp b/src/kdenlivesettingsdialog.cpp index f644642a..c2b5736d 100644 --- a/src/kdenlivesettingsdialog.cpp +++ b/src/kdenlivesettingsdialog.cpp @@ -110,8 +110,7 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QWidget * parent): KConfigDialog( KdenliveSettingsDialog::~KdenliveSettingsDialog() {} -void KdenliveSettingsDialog::initDevices() -{ +void KdenliveSettingsDialog::initDevices() { // Fill audio drivers m_configSdl.kcfg_audio_driver->addItem(i18n("Automatic"), QString()); m_configSdl.kcfg_audio_driver->addItem(i18n("OSS"), "dsp"); @@ -121,12 +120,12 @@ void KdenliveSettingsDialog::initDevices() m_configSdl.kcfg_audio_driver->addItem(i18n("ARTS daemon"), "artsc"); /*if (!KdenliveSettings::audiodriver().isEmpty()) - for (uint i = 1;i < m_configDisplay.kcfg_audio_driver->count(); i++) { - if (m_configDisplay.kcfg_audio_driver->itemData(i).toString() == KdenliveSettings::audiodriver()) - m_configDisplay.kcfg_audio_driver->setCurrentIndex(i); - }*/ - - // Fill video drivers + for (uint i = 1;i < m_configDisplay.kcfg_audio_driver->count(); i++) { + if (m_configDisplay.kcfg_audio_driver->itemData(i).toString() == KdenliveSettings::audiodriver()) + m_configDisplay.kcfg_audio_driver->setCurrentIndex(i); + }*/ + + // Fill video drivers m_configSdl.kcfg_video_driver->addItem(i18n("Automatic"), QString()); m_configSdl.kcfg_video_driver->addItem(i18n("X11"), "x11"); m_configSdl.kcfg_video_driver->addItem(i18n("XFREE86 DGA 2.0"), "dga"); @@ -137,46 +136,44 @@ void KdenliveSettingsDialog::initDevices() m_configSdl.kcfg_video_driver->addItem(i18n("General graphics interface"), "ggi"); m_configSdl.kcfg_video_driver->addItem(i18n("Ascii art library"), "aalib"); - // Fill the list of audio playback devices + // Fill the list of audio playback devices m_configSdl.kcfg_audio_device->addItem(i18n("Default"), QString()); if (KStandardDirs::findExe("aplay") != QString::null) { - m_readProcess.setOutputChannelMode(KProcess::OnlyStdoutChannel); - m_readProcess.setProgram("aplay", QStringList() << "-l"); - connect(&m_readProcess, SIGNAL(readyReadStandardOutput()) ,this, SLOT(slotReadAudioDevices())); - m_readProcess.execute(5000); - } - else { - // If aplay is not installed on the system, parse the /proc/asound/pcm file - QFile file("/proc/asound/pcm"); - if ( file.open( QIODevice::ReadOnly ) ) { - QTextStream stream( &file ); - QString line; - while ( !stream.atEnd() ) { + m_readProcess.setOutputChannelMode(KProcess::OnlyStdoutChannel); + m_readProcess.setProgram("aplay", QStringList() << "-l"); + connect(&m_readProcess, SIGNAL(readyReadStandardOutput()) , this, SLOT(slotReadAudioDevices())); + m_readProcess.execute(5000); + } else { + // If aplay is not installed on the system, parse the /proc/asound/pcm file + QFile file("/proc/asound/pcm"); + if (file.open(QIODevice::ReadOnly)) { + QTextStream stream(&file); + QString line; + while (!stream.atEnd()) { line = stream.readLine(); - if (line.contains("playback")) { - QString deviceId = line.section(":", 0, 0); - m_configSdl.kcfg_audio_device->addItem(line.section(":", 1, 1), "plughw:" + QString::number(deviceId.section("-", 0, 0).toInt()) + "," + QString::number(deviceId.section("-", 1, 1).toInt())); - } - } + if (line.contains("playback")) { + QString deviceId = line.section(":", 0, 0); + m_configSdl.kcfg_audio_device->addItem(line.section(":", 1, 1), "plughw:" + QString::number(deviceId.section("-", 0, 0).toInt()) + "," + QString::number(deviceId.section("-", 1, 1).toInt())); + } + } file.close(); - } + } } } -void KdenliveSettingsDialog::slotReadAudioDevices() -{ +void KdenliveSettingsDialog::slotReadAudioDevices() { QString result = QString(m_readProcess.readAllStandardOutput()); - kDebug()<<"// / / / / / READING APLAY: "; - kDebug()<< result; + kDebug() << "// / / / / / READING APLAY: "; + kDebug() << result; QStringList lines = result.split('\n'); - foreach (QString data, lines) { - kDebug()<<"// READING LINE: "<addItem(data.section(":", -1), "plughw:" + card + "," + device); - } + foreach(QString data, lines) { + kDebug() << "// READING LINE: " << data; + if (data.simplified().startsWith("card")) { + QString card = data.section(":", 0, 0).section(" ", -1); + QString device = data.section(":", 1, 1).section(" ", -1); + m_configSdl.kcfg_audio_device->addItem(data.section(":", -1), "plughw:" + card + "," + device); + } } } @@ -293,20 +290,20 @@ void KdenliveSettingsDialog::updateSettings() { bool resetProfile = false; QString value = m_configSdl.kcfg_audio_device->itemData(m_configSdl.kcfg_audio_device->currentIndex()).toString(); if (value != KdenliveSettings::audiodevicename()) { - KdenliveSettings::setAudiodevicename(value); - resetProfile = true; + KdenliveSettings::setAudiodevicename(value); + resetProfile = true; } value = m_configSdl.kcfg_audio_driver->itemData(m_configSdl.kcfg_audio_driver->currentIndex()).toString(); if (value != KdenliveSettings::audiodrivername()) { - KdenliveSettings::setAudiodrivername(value); - resetProfile = true; + KdenliveSettings::setAudiodrivername(value); + resetProfile = true; } value = m_configSdl.kcfg_video_driver->itemData(m_configSdl.kcfg_video_driver->currentIndex()).toString(); if (value != KdenliveSettings::videodrivername()) { - KdenliveSettings::setVideodrivername(value); - resetProfile = true; + KdenliveSettings::setVideodrivername(value); + resetProfile = true; } KConfigDialog::updateSettings(); diff --git a/src/renderer.cpp b/src/renderer.cpp index df027a68..44ff8d23 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -82,28 +82,28 @@ Render::Render(const QString & rendererName, int winid, int extid, QWidget *pare m_mltConsumer->set("terminate_on_pause", 1); m_mltConsumer->set("rescale", "nearest"); m_mltConsumer->set("progressive", 1); - char *tmp; - - QString audioDevice = KdenliveSettings::audiodevicename(); - if (!audioDevice.isEmpty()) { - tmp = decodedString(audioDevice); - m_mltConsumer->set("audio_device", tmp); - delete[] tmp; - } - - QString videoDriver = KdenliveSettings::videodrivername(); - if (!videoDriver.isEmpty()) { - tmp = decodedString(videoDriver); - m_mltConsumer->set("video_driver", tmp); - delete[] tmp; - } - - QString audioDriver = KdenliveSettings::audiodrivername(); - if (!audioDriver.isEmpty()) { - tmp = decodedString(audioDriver); - m_mltConsumer->set("audio_driver", tmp); - delete[] tmp; - } + char *tmp; + + QString audioDevice = KdenliveSettings::audiodevicename(); + if (!audioDevice.isEmpty()) { + tmp = decodedString(audioDevice); + m_mltConsumer->set("audio_device", tmp); + delete[] tmp; + } + + QString videoDriver = KdenliveSettings::videodrivername(); + if (!videoDriver.isEmpty()) { + tmp = decodedString(videoDriver); + m_mltConsumer->set("video_driver", tmp); + delete[] tmp; + } + + QString audioDriver = KdenliveSettings::audiodrivername(); + if (!audioDriver.isEmpty()) { + tmp = decodedString(audioDriver); + m_mltConsumer->set("audio_driver", tmp); + delete[] tmp; + } m_mltConsumer->set("audio_buffer", 1024); m_mltConsumer->set("frequency", 48000); @@ -180,25 +180,25 @@ int Render::resetProfile(QString profile) { QString audioDevice = KdenliveSettings::audiodevicename(); if (!audioDevice.isEmpty()) { - tmp = decodedString(audioDevice); - m_mltConsumer->set("audio_device", tmp); - delete[] tmp; + tmp = decodedString(audioDevice); + m_mltConsumer->set("audio_device", tmp); + delete[] tmp; } QString videoDriver = KdenliveSettings::videodrivername(); if (!videoDriver.isEmpty()) { - tmp = decodedString(videoDriver); - m_mltConsumer->set("video_driver", tmp); - delete[] tmp; + tmp = decodedString(videoDriver); + m_mltConsumer->set("video_driver", tmp); + delete[] tmp; } QString audioDriver = KdenliveSettings::audiodrivername(); if (!audioDriver.isEmpty()) { - tmp = decodedString(audioDriver); - m_mltConsumer->set("audio_driver", tmp); - delete[] tmp; + tmp = decodedString(audioDriver); + m_mltConsumer->set("audio_driver", tmp); + delete[] tmp; } - + m_mltConsumer->set("progressive", 1); m_mltConsumer->set("audio_buffer", 1024); @@ -1320,7 +1320,7 @@ int Render::mltChangeClipSpeed(ItemInfo info, double speed, Mlt::Producer *prod) int newLength = 0; Mlt::Service service(m_mltProducer->parent().get_service()); if (service.type() != tractor_type) kWarning() << "// TRACTOR PROBLEM"; - kDebug()<<"Changing clip speed, set in and out: "<get_producer() == NULL) { - char *tmp = decodedString(url); - slowprod = new Mlt::Producer(*m_mltProfile, "framebuffer", tmp); - delete[] tmp; - QString producerid = "slowmotion:" + id + ":" + QString::number(speed); - tmp = decodedString(producerid); - slowprod->set("id", tmp); - delete[] tmp; - m_slowmotionProducers.insert(url, slowprod); - } - Mlt::Producer *cut = slowprod->cut(info.cropStart.frames(m_fps), (info.endPos - info.startPos).frames(m_fps) - 1); + Mlt::Producer *slowprod = m_slowmotionProducers.value(url); + if (!slowprod || slowprod->get_producer() == NULL) { + char *tmp = decodedString(url); + slowprod = new Mlt::Producer(*m_mltProfile, "framebuffer", tmp); + delete[] tmp; + QString producerid = "slowmotion:" + id + ":" + QString::number(speed); + tmp = decodedString(producerid); + slowprod->set("id", tmp); + delete[] tmp; + m_slowmotionProducers.insert(url, slowprod); + } + Mlt::Producer *cut = slowprod->cut(info.cropStart.frames(m_fps), (info.endPos - info.startPos).frames(m_fps) - 1); newLength = cut->get_length(); trackPlaylist.replace_with_blank(clipIndex); trackPlaylist.consolidate_blanks(0); @@ -1363,18 +1363,18 @@ int Render::mltChangeClipSpeed(ItemInfo info, double speed, Mlt::Producer *prod) QString url = clip.parent().get("resource"); url = url.section("?", 0, 0); url.append("?" + QString::number(speed)); - Mlt::Producer *slowprod = m_slowmotionProducers.value(url); - if (!slowprod || slowprod->get_producer() == NULL) { - char *tmp = decodedString(url); - slowprod = new Mlt::Producer(*m_mltProfile, "framebuffer", tmp); - delete[] tmp; - QString producerid = "slowmotion:" + id.section(":", 1, 1) + ":" + QString::number(speed); - tmp = decodedString(producerid); - slowprod->set("id", tmp); - delete[] tmp; - m_slowmotionProducers.insert(url, slowprod); - } - Mlt::Producer *cut = slowprod->cut(info.cropStart.frames(m_fps), (info.endPos - info.startPos).frames(m_fps) - 1); + Mlt::Producer *slowprod = m_slowmotionProducers.value(url); + if (!slowprod || slowprod->get_producer() == NULL) { + char *tmp = decodedString(url); + slowprod = new Mlt::Producer(*m_mltProfile, "framebuffer", tmp); + delete[] tmp; + QString producerid = "slowmotion:" + id.section(":", 1, 1) + ":" + QString::number(speed); + tmp = decodedString(producerid); + slowprod->set("id", tmp); + delete[] tmp; + m_slowmotionProducers.insert(url, slowprod); + } + Mlt::Producer *cut = slowprod->cut(info.cropStart.frames(m_fps), (info.endPos - info.startPos).frames(m_fps) - 1); newLength = cut->get_length(); trackPlaylist.replace_with_blank(clipIndex); trackPlaylist.consolidate_blanks(0); @@ -1721,14 +1721,14 @@ bool Render::mltResizeClipStart(int track, GenTime pos, GenTime moveEnd, GenTime Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service()); if (trackPlaylist.is_blank_at((int) pos.frames(m_fps) - 1)) { kDebug() << "//////// ERROR RSIZING BLANK CLIP!!!!!!!!!!!"; - return false; + return false; } int clipIndex = trackPlaylist.get_clip_index_at((int) pos.frames(m_fps) - 1); int previousStart = trackPlaylist.clip_start(clipIndex); //kDebug() << " ** RESIZING CLIP START:" << clipIndex << " on track:" << track << ", mid pos: " << pos.frames(25) << ", moving: " << moveFrame << ", in: " << in.frames(25) << ", out: " << out.frames(25); Mlt::Producer *clip = trackPlaylist.get_clip(clipIndex); if (clip == NULL) { - return false; + return false; } m_isBlocked = true; trackPlaylist.resize_clip(clipIndex, (int) in.frames(m_fps), (int) out.frames(m_fps)); diff --git a/src/renderer.h b/src/renderer.h index 4f0d8427..b85f9065 100644 --- a/src/renderer.h +++ b/src/renderer.h @@ -172,10 +172,10 @@ Q_OBJECT public: void mltResizeTransparency(int oldStart, int newStart, int newEnd, int track, int id); /** Change speed of a clip in playlist. To do this, we create a new "framebuffer" producer. - This new producer must have its "resource" param set to: video.mpg?0.6 where video.mpg is the path - to the clip and 0.6 is the speed in percents. The newly created producer will have it's - "id" parameter set to: "slowmotion:parentid:speed", where parentid is the id of the original clip - in the ClipManager list and speed is the current speed */ + This new producer must have its "resource" param set to: video.mpg?0.6 where video.mpg is the path + to the clip and 0.6 is the speed in percents. The newly created producer will have it's + "id" parameter set to: "slowmotion:parentid:speed", where parentid is the id of the original clip + in the ClipManager list and speed is the current speed */ int mltChangeClipSpeed(ItemInfo info, double speed, Mlt::Producer *prod); private: // Private attributes & methods diff --git a/src/titlewidget.cpp b/src/titlewidget.cpp index 293ad2cc..903dc8f0 100644 --- a/src/titlewidget.cpp +++ b/src/titlewidget.cpp @@ -630,7 +630,7 @@ QPixmap TitleWidget::renderedPixmap() { QPixmap pix(m_frameWidth, m_frameHeight); pix.fill(Qt::transparent); QPainter painter(&pix); - + //painter.setRenderHint( QPainter::Antialiasing ); m_scene->clearSelection(); QPen framepen = m_frameBorder->pen(); m_frameBorder->setPen(Qt::NoPen); diff --git a/src/trackview.cpp b/src/trackview.cpp index 3cdd33d4..13c383bd 100644 --- a/src/trackview.cpp +++ b/src/trackview.cpp @@ -334,14 +334,14 @@ int TrackView::slotAddProjectTrack(int ix, QDomElement xml, bool videotrack) { // Found a clip int in = elem.attribute("in").toInt(); QString idString = elem.attribute("producer"); - int id = idString.toInt(); - bool hasSpeedAttribute = false; - double speed; - if (idString.startsWith("slowmotion")) { - hasSpeedAttribute = true; - id = idString.section(":", 1, 1).toInt(); - speed = idString.section(":", 2, 2).toDouble(); - } + int id = idString.toInt(); + bool hasSpeedAttribute = false; + double speed; + if (idString.startsWith("slowmotion")) { + hasSpeedAttribute = true; + id = idString.section(":", 1, 1).toInt(); + speed = idString.section(":", 2, 2).toDouble(); + } DocClipBase *clip = m_doc->clipManager()->getClipById(id); if (clip != NULL) { int out = elem.attribute("out").toInt(); @@ -353,7 +353,7 @@ int TrackView::slotAddProjectTrack(int ix, QDomElement xml, bool videotrack) { clipinfo.track = ix; //kDebug() << "// INSERTING CLIP: " << in << "x" << out << ", track: " << ix << ", ID: " << id << ", SCALE: " << m_scale << ", FPS: " << m_doc->fps(); ClipItem *item = new ClipItem(clip, clipinfo, m_scale, m_doc->fps()); - if (hasSpeedAttribute) item->setSpeed(speed); + if (hasSpeedAttribute) item->setSpeed(speed); m_scene->addItem(item); clip->addReference(); position += (out - in + 1);