m_loadLayout = new KSelectAction(i18n("Load Layout"), actionCollection());
for (int i = 1; i < 5; i++) {
KAction *load = new KAction(KIcon(), i18n("Layout %1", i), this);
- load->setData("_" + QString::number(i));
+ load->setData('_' + QString::number(i));
layoutActions->addAction("load_layout" + QString::number(i), load);
m_loadLayout->addAction(load);
KAction *save = new KAction(KIcon(), i18n("Save As Layout %1", i), this);
- save->setData("_" + QString::number(i));
+ save->setData('_' + QString::number(i));
layoutActions->addAction("save_layout" + QString::number(i), save);
}
// Required to enable user to add the load layout action to toolbar
if (!clipsToLoad.isEmpty() && m_activeDocument) {
QStringList list = clipsToLoad.split(',');
QList <QUrl> urls;
- foreach(QString path, list) {
+ foreach(const QString &path, list) {
kDebug() << QDir::current().absoluteFilePath(path);
urls << QUrl::fromLocalFile(QDir::current().absoluteFilePath(path));
}
connect(m_projectList, SIGNAL(showClipProperties(QList <DocClipBase *>, QMap<QString, QString>)), this, SLOT(slotShowClipProperties(QList <DocClipBase *>, QMap<QString, QString>)));
connect(m_projectMonitor->render, SIGNAL(replyGetImage(const QString &, const QString &, int, int)), m_projectList, SLOT(slotReplyGetImage(const QString &, const QString &, int, int)));
connect(m_projectMonitor->render, SIGNAL(replyGetImage(const QString &, const QImage &)), m_projectList, SLOT(slotReplyGetImage(const QString &, const QImage &)));
+
+ kDebug()<<" - - - - - -\n CONNECTED REPLY";
connect(m_projectMonitor->render, SIGNAL(replyGetFileProperties(const QString &, Mlt::Producer*, const stringMap &, const stringMap &, bool)), m_projectList, SLOT(slotReplyGetFileProperties(const QString &, Mlt::Producer*, const stringMap &, const stringMap &, bool)));
connect(m_projectMonitor->render, SIGNAL(removeInvalidClip(const QString &, bool)), m_projectList, SLOT(slotRemoveInvalidClip(const QString &, bool)));
foreach(const QString & key, entries) {
if (key.endsWith(QString("_%1").arg(i))) {
// Found previously saved layout
- QString layoutName = key.section("_", 0, -2);
+ QString layoutName = key.section('_', 0, -2);
for (int j = 0; j < loadActions.count(); j++) {
- if (loadActions.at(j)->data().toString().endsWith("_" + QString::number(i))) {
+ if (loadActions.at(j)->data().toString().endsWith('_' + QString::number(i))) {
loadActions[j]->setText(layoutName);
loadActions[j]->setData(key);
break;
}
}
for (int j = 0; j < saveActions.count(); j++) {
- if (saveActions.at(j)->data().toString().endsWith("_" + QString::number(i))) {
+ if (saveActions.at(j)->data().toString().endsWith('_' + QString::number(i))) {
saveActions[j]->setText(i18n("Save as %1", layoutName));
saveActions[j]->setData(key);
break;
layouts.deleteEntry(originallayoutName);
QByteArray st = saveState();
- layoutName.append("_" + QString::number(layoutId));
+ layoutName.append('_' + QString::number(layoutId));
layouts.writeEntry(layoutName, st.toBase64());
loadLayouts();
}
}
}
-
+ if (KdenliveSettings::ffmpegpath().isEmpty() || KdenliveSettings::ffplaypath().isEmpty()) upgrade = true;
if (!initialGroup.exists() || upgrade) {
// this is our first run, show Wizard
- Wizard *w = new Wizard(upgrade, this);
+ QPointer<Wizard> w = new Wizard(upgrade, this);
if (w->exec() == QDialog::Accepted && w->isOk()) {
w->adjustSettings();
initialGroup.writeEntry("version", version);
delete w;
} else {
+ delete w;
::exit(1);
}
}
void MainWindow::slotRunWizard()
{
- Wizard *w = new Wizard(false, this);
+ QPointer<Wizard> w = new Wizard(false, this);
if (w->exec() == QDialog::Accepted && w->isOk()) {
w->adjustSettings();
}
if (!closeCurrentDocument())
return;
} else {
- ProjectSettings *w = new ProjectSettings(NULL, QMap <QString, QString> (), QStringList(), projectTracks.x(), projectTracks.y(), KdenliveSettings::defaultprojectfolder(), false, true, this);
- if (w->exec() != QDialog::Accepted)
+ QPointer<ProjectSettings> w = new ProjectSettings(NULL, QMap <QString, QString> (), QStringList(), projectTracks.x(), projectTracks.y(), KdenliveSettings::defaultprojectfolder(), false, true, this);
+ if (w->exec() != QDialog::Accepted) {
+ delete w;
return;
+ }
if (!KdenliveSettings::activatetabs())
- if (!closeCurrentDocument())
+ if (!closeCurrentDocument()) {
+ delete w;
return;
+ }
if (KdenliveSettings::videothumbnails() != w->enableVideoThumbs())
slotSwitchVideoThumbs();
if (KdenliveSettings::audiothumbnails() != w->enableAudioThumbs())
if (mime.data()->is("application/x-compressed-tar")) {
// Opening a compressed project file, we need to process it
kDebug()<<"Opening archive, processing";
- ArchiveWidget *ar = new ArchiveWidget(url);
+ QPointer<ArchiveWidget> ar = new ArchiveWidget(url);
if (ar->exec() == QDialog::Accepted) openFile(KUrl(ar->extractedProjectFile()));
delete ar;
return;
if (KdenliveSettings::rendererpath().isEmpty()) {
// Cannot find the MLT melt renderer, ask for location
- KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(QString(), i18n("Cannot find the melt program required for rendering (part of MLT)"), this);
+ QPointer<KUrlRequesterDialog> getUrl = new KUrlRequesterDialog(QString(), i18n("Cannot find the melt program required for rendering (part of MLT)"), this);
if (getUrl->exec() == QDialog::Rejected) {
+ delete getUrl;
::exit(0);
}
KUrl rendererPath = getUrl->selectedUrl();
}
if (profilesList.isEmpty()) {
// Cannot find the MLT profiles, ask for location
- KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(KdenliveSettings::mltpath(), i18n("Cannot find your MLT profiles, please give the path"), this);
+ QPointer<KUrlRequesterDialog> getUrl = new KUrlRequesterDialog(KdenliveSettings::mltpath(), i18n("Cannot find your MLT profiles, please give the path"), this);
getUrl->fileDialog()->setMode(KFile::Directory);
if (getUrl->exec() == QDialog::Rejected) {
+ delete getUrl;
::exit(0);
}
KUrl mltPath = getUrl->selectedUrl();
void MainWindow::slotEditProjectSettings()
{
QPoint p = m_activeDocument->getTracksCount();
- ProjectSettings *w = new ProjectSettings(m_projectList, m_activeDocument->metadata(), m_activeTimeline->projectView()->extractTransitionsLumas(), p.x(), p.y(), m_activeDocument->projectFolder().path(), true, !m_activeDocument->isModified(), this);
+ QPointer<ProjectSettings> w = new ProjectSettings(m_projectList, m_activeDocument->metadata(), m_activeTimeline->projectView()->extractTransitionsLumas(), p.x(), p.y(), m_activeDocument->projectFolder().path(), true, !m_activeDocument->isModified(), this);
connect(w, SIGNAL(disableProxies()), this, SLOT(slotDisableProxies()));
if (w->exec() == QDialog::Accepted) {
connect(m_projectList, SIGNAL(projectModified()), doc, SLOT(setModified()));
connect(m_projectList, SIGNAL(clipNameChanged(const QString, const QString)), trackView->projectView(), SLOT(clipNameChanged(const QString, const QString)));
- //connect(trackView, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor()));
connect(trackView, SIGNAL(configTrack(int)), this, SLOT(slotConfigTrack(int)));
connect(trackView, SIGNAL(updateTracksInfo()), this, SLOT(slotUpdateTrackInfo()));
connect(trackView, SIGNAL(mousePosition(int)), this, SLOT(slotUpdateMousePosition(int)));
connect(m_effectStack, SIGNAL(changeEffectState(ClipItem*, int, QList <int>, bool)), trackView->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, QList <int>, bool)));
connect(m_effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, QList <int>, int)), trackView->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, QList <int>, int)));
connect(m_effectStack, SIGNAL(refreshEffectStack(ClipItem*)), trackView->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
- connect(m_effectStack, SIGNAL(seekTimeline(int)), trackView->projectView() , SLOT(setCursorPos(int)));
+ connect(m_effectStack, SIGNAL(seekTimeline(int)), trackView->projectView() , SLOT(seekCursorPos(int)));
connect(m_effectStack, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
connect(m_effectStack, SIGNAL(displayMessage(const QString&, int)), this, SLOT(slotGotProgressInfo(const QString&, int)));
// Transition config signals
connect(m_transitionConfig, SIGNAL(transitionUpdated(Transition *, QDomElement)), trackView->projectView() , SLOT(slotTransitionUpdated(Transition *, QDomElement)));
- connect(m_transitionConfig, SIGNAL(seekTimeline(int)), trackView->projectView() , SLOT(setCursorPos(int)));
+ connect(m_transitionConfig, SIGNAL(seekTimeline(int)), trackView->projectView() , SLOT(seekCursorPos(int)));
connect(trackView->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(slotActivateMonitor()));
connect(trackView, SIGNAL(zoneMoved(int, int)), this, SLOT(slotZoneMoved(int, int)));
}
QString id = clip->getId();
CommentedTime marker(pos, i18n("Marker"));
- MarkerDialog d(clip, marker, m_activeDocument->timecode(), i18n("Add Marker"), this);
- if (d.exec() == QDialog::Accepted)
- m_activeTimeline->projectView()->slotAddClipMarker(id, d.newMarker().time(), d.newMarker().comment());
+ QPointer<MarkerDialog> d = new MarkerDialog(clip, marker,
+ m_activeDocument->timecode(), i18n("Add Marker"), this);
+ if (d->exec() == QDialog::Accepted)
+ m_activeTimeline->projectView()->slotAddClipMarker(id, d->newMarker().time(), d->newMarker().comment());
+ delete d;
}
void MainWindow::slotDeleteClipMarker()
}
CommentedTime marker(pos, oldcomment);
- MarkerDialog d(clip, marker, m_activeDocument->timecode(), i18n("Edit Marker"), this);
- if (d.exec() == QDialog::Accepted) {
- m_activeTimeline->projectView()->slotAddClipMarker(id, d.newMarker().time(), d.newMarker().comment());
- if (d.newMarker().time() != pos) {
+ QPointer<MarkerDialog> d = new MarkerDialog(clip, marker,
+ m_activeDocument->timecode(), i18n("Edit Marker"), this);
+ if (d->exec() == QDialog::Accepted) {
+ m_activeTimeline->projectView()->slotAddClipMarker(id, d->newMarker().time(), d->newMarker().comment());
+ if (d->newMarker().time() != pos) {
// remove old marker
m_activeTimeline->projectView()->slotAddClipMarker(id, pos, QString());
}
}
+ delete d;
}
void MainWindow::slotAddMarkerGuideQuickly()
m_activeTimeline->projectView()->editItemDuration();
}
-void MainWindow::slotAddProjectClip(KUrl url, const QString &comment)
+void MainWindow::slotAddProjectClip(KUrl url, stringMap data)
{
- if (m_activeDocument)
- m_activeDocument->slotAddClipFile(url, QString(), QString(), comment);
+ if (m_activeDocument) {
+ m_activeDocument->slotAddClipFile(url, data);
+ }
}
void MainWindow::slotAddProjectClipList(KUrl::List urls)
{
if (m_activeDocument)
- m_activeDocument->slotAddClipList(urls, QString());
+ m_activeDocument->slotAddClipList(urls);
}
void MainWindow::slotAddTransition(QAction *result)
return;
}
QString path = clip->getProperty("resource");
- TitleWidget *dia_ui = new TitleWidget(KUrl(), m_activeDocument->timecode(), titlepath, m_projectMonitor->render, this);
+ QPointer<TitleWidget> dia_ui = new TitleWidget(KUrl(), m_activeDocument->timecode(), titlepath, m_projectMonitor->render, this);
QDomDocument doc;
doc.setContent(clip->getProperty("xmldata"));
dia_ui->setXml(doc);
void MainWindow::slotShowClipProperties(QList <DocClipBase *> cliplist, QMap<QString, QString> commonproperties)
{
- ClipProperties dia(cliplist, m_activeDocument->timecode(), commonproperties, this);
- if (dia.exec() == QDialog::Accepted) {
+ QPointer<ClipProperties> dia = new ClipProperties(cliplist,
+ m_activeDocument->timecode(), commonproperties, this);
+ if (dia->exec() == QDialog::Accepted) {
QUndoCommand *command = new QUndoCommand();
command->setText(i18n("Edit clips"));
- QMap <QString, QString> newImageProps = dia.properties();
+ QMap <QString, QString> newImageProps = dia->properties();
// Transparency setting applies only for images
QMap <QString, QString> newProps = newImageProps;
newProps.remove("transparency");
}
m_activeDocument->commandStack()->push(command);
for (int i = 0; i < cliplist.count(); i++)
- m_activeTimeline->projectView()->slotUpdateClip(cliplist.at(i)->getId(), dia.needsTimelineReload());
+ m_activeTimeline->projectView()->slotUpdateClip(cliplist.at(i)->getId(), dia->needsTimelineReload());
}
+ delete dia;
}
void MainWindow::customEvent(QEvent* e)
QString tmppath = m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash);
if (baseClip == NULL) tmppath.append("untitled.mlt");
else {
- tmppath.append((baseClip->name().isEmpty() ? baseClip->fileURL().fileName() : baseClip->name()) + "-" + QString::number(zone.x()).rightJustified(4, '0') + ".mlt");
+ tmppath.append((baseClip->name().isEmpty() ? baseClip->fileURL().fileName() : baseClip->name()) + '-' + QString::number(zone.x()).rightJustified(4, '0') + ".mlt");
}
path = KUrl(tmppath);
}
{
KNS3::Entry::List entries;
#if KDE_IS_VERSION(4,3,80)
- KNS3::DownloadDialog dialog(configFile);
- dialog.exec();
- entries = dialog.changedEntries();
+ QPointer<KNS3::DownloadDialog> dialog = new KNS3::DownloadDialog(configFile);
+ dialog->exec();
+ if (dialog) entries = dialog->changedEntries();
foreach(const KNS3::Entry & entry, entries) {
if (entry.status() == KNS3::Entry::Installed)
kDebug() << "// Installed files: " << entry.installedFiles();
}
+ delete dialog;
#else
KNS::Engine engine(0);
if (engine.init(configFile))
// We must stop the monitors since we create a new on in the dvd wizard
m_clipMonitor->stop();
m_projectMonitor->stop();
- DvdWizard w(url, profile, this);
- w.exec();
+ QPointer<DvdWizard> w = new DvdWizard(url, profile, this);
+ w->exec();
m_projectMonitor->start();
+ delete w;
}
void MainWindow::slotShowTimeline(bool show)
QMapIterator<QString, QString> i(profiles);
while (i.hasNext()) {
i.next();
- QStringList data = i.value().split(";");
+ QStringList data = i.value().split(';');
QAction *a;
// separate audio transcoding in a separate menu
if (data.count() > 2 && data.at(2) == "audio") {
QDomElement e = producers.item(n).toElement();
producerResource = EffectsList::property(e, "resource");
if (producerResource.isEmpty()) continue;
- if (!producerResource.startsWith("/")) {
- producerResource.prepend(root + "/");
+ if (!producerResource.startsWith('/')) {
+ producerResource.prepend(root + '/');
}
if (producerResource.contains('?')) {
// slowmotion producer
- suffix = "?" + producerResource.section('?', 1);
+ suffix = '?' + producerResource.section('?', 1);
producerResource = producerResource.section('?', 0, 0);
}
else suffix.clear();
projectId = m_activeDocument->getDocumentProperty("documentid");
}
- BackupWidget *dia = new BackupWidget(projectFile, projectFolder, projectId, this);
+ QPointer<BackupWidget> dia = new BackupWidget(projectFile, projectFolder, projectId, this);
if (dia->exec() == QDialog::Accepted) {
QString requestedBackup = dia->selectedFile();
m_activeDocument->backupLastSavedVersion(projectFile.path());
if (m_activeDocument) currentFolder = m_activeDocument->projectFolder().path();
else currentFolder = KdenliveSettings::defaultprojectfolder();
ResourceWidget *d = new ResourceWidget(currentFolder);
- connect(d, SIGNAL(addClip(KUrl, const QString &)), this, SLOT(slotAddProjectClip(KUrl, const QString &)));
+ connect(d, SIGNAL(addClip(KUrl,stringMap)), this, SLOT(slotAddProjectClip(KUrl,stringMap)));
d->show();
}