X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmainwindow.cpp;h=3ab21390f99072625473ba67d38983ac1355e68d;hb=2a59df8d657168035e1bb5c8dd7bca728fd7d06f;hp=89039b27dd7f3ea0b4235754cb7d3f9ea42dee35;hpb=a5b0bcb8bb9674224ac6476d52c19d9b4f1ded92;p=kdenlive diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 89039b27..3ab21390 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -40,27 +40,27 @@ #include "renderwidget.h" #include "renderer.h" #include "audiosignal.h" -#ifndef NO_JOGSHUTTLE +#ifdef USE_JOGSHUTTLE #include "jogshuttle.h" #include "jogaction.h" #include "jogshuttleconfig.h" -#endif /* NO_JOGSHUTTLE */ +#endif #include "clipproperties.h" #include "wizard.h" -#include "editclipcommand.h" +#include "commands/editclipcommand.h" #include "titlewidget.h" #include "markerdialog.h" #include "clipitem.h" #include "interfaces.h" -#include "kdenlive-config.h" +#include "config-kdenlive.h" #include "cliptranscode.h" #include "ui_templateclip_ui.h" #include "colorscopes/vectorscope.h" #include "colorscopes/waveform.h" #include "colorscopes/rgbparade.h" #include "colorscopes/histogram.h" -#include "audiospectrum.h" -#include "spectrogram.h" +#include "audioscopes/audiospectrum.h" +#include "audioscopes/spectrogram.h" #include "archivewidget.h" #include "databackup/backupwidget.h" @@ -99,7 +99,7 @@ #include #include #define KNS3 KNS -#endif /* KDE_IS_VERSION(4,3,80) */ +#endif #include #include #include @@ -113,6 +113,7 @@ #include #include +#include // Uncomment for deeper debugging //#define DEBUG_MAINW @@ -143,10 +144,10 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & m_activeTimeline(NULL), m_recMonitor(NULL), m_renderWidget(NULL), -#ifndef NO_JOGSHUTTLE +#ifdef USE_JOGSHUTTLE m_jogProcess(NULL), m_jogShuttle(NULL), -#endif /* NO_JOGSHUTTLE */ +#endif m_findActivated(false), m_stopmotion(NULL) { @@ -156,6 +157,15 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & // Init locale QLocale systemLocale = QLocale(); + setlocale(LC_NUMERIC, NULL); + char *separator = localeconv()->decimal_point; + if (separator != systemLocale.decimalPoint()) { + kDebug()<<"------\n!!! system locale is not similar to Qt's locale... be prepared for bugs!!!\n------"; + // HACK: There is a locale conflict, so set locale to at least have correct decimal point + if (strncmp(separator, ".", 1) == 0) systemLocale = QLocale::c(); + else if (strncmp(separator, ",", 1) == 0) systemLocale = QLocale("fr_FR.UTF-8"); + } + systemLocale.setNumberOptions(QLocale::OmitGroupSeparator); QLocale::setDefault(systemLocale); @@ -211,14 +221,14 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & m_clipMonitorDock->setWidget(m_clipMonitor); // Connect the project list - connect(m_projectList, SIGNAL(clipSelected(DocClipBase *, QPoint)), m_clipMonitor, SLOT(slotSetClipProducer(DocClipBase *, QPoint))); + connect(m_projectList, SIGNAL(clipSelected(DocClipBase *, QPoint, bool)), m_clipMonitor, SLOT(slotSetClipProducer(DocClipBase *, QPoint, bool))); connect(m_projectList, SIGNAL(raiseClipMonitor()), m_clipMonitor, SLOT(activateMonitor())); connect(m_projectList, SIGNAL(loadingIsOver()), this, SLOT(slotElapsedTime())); connect(m_projectList, SIGNAL(displayMessage(const QString&, int)), this, SLOT(slotGotProgressInfo(const QString&, int))); connect(m_projectList, SIGNAL(updateRenderStatus()), this, SLOT(slotCheckRenderStatus())); connect(m_projectList, SIGNAL(clipNeedsReload(const QString&)),this, SLOT(slotUpdateClip(const QString &))); connect(m_projectList, SIGNAL(updateProfile(const QString &)), this, SLOT(slotUpdateProjectProfile(const QString &))); - connect(m_projectList, SIGNAL(refreshClip(const QString &, bool)), m_monitorManager, SLOT(slotRefreshCurrentMonitor())); + connect(m_projectList, SIGNAL(refreshClip(const QString &, bool)), m_monitorManager, SLOT(slotRefreshCurrentMonitor(const QString &))); connect(m_projectList, SIGNAL(findInTimeline(const QString&)), this, SLOT(slotClipInTimeline(const QString&))); connect(m_clipMonitor, SIGNAL(zoneUpdated(QPoint)), m_projectList, SLOT(slotUpdateClipCut(QPoint))); @@ -235,7 +245,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & connect(m_recMonitor, SIGNAL(addProjectClip(KUrl)), this, SLOT(slotAddProjectClip(KUrl))); connect(m_recMonitor, SIGNAL(addProjectClipList(KUrl::List)), this, SLOT(slotAddProjectClipList(KUrl::List))); connect(m_recMonitor, SIGNAL(showConfigDialog(int, int)), this, SLOT(slotPreferences(int, int))); -#endif +#endif /* ! Q_WS_MAC */ m_monitorManager->initMonitors(m_clipMonitor, m_projectMonitor, m_recMonitor); m_notesDock = new QDockWidget(i18n("Project Notes"), this); @@ -475,15 +485,19 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & loadPlugins(); loadTranscoders(); + loadStabilize(); m_projectMonitor->setupMenu(static_cast(factory()->container("monitor_go", this)), m_playZone, m_loopZone, NULL, m_loopClip); m_clipMonitor->setupMenu(static_cast(factory()->container("monitor_go", this)), m_playZone, m_loopZone, static_cast(factory()->container("marker_menu", this))); QMenu *clipInTimeline = static_cast(factory()->container("clip_in_timeline", this)); clipInTimeline->setIcon(KIcon("go-jump")); - m_projectList->setupGeneratorMenu(static_cast(factory()->container("generators", this)), - static_cast(factory()->container("transcoders", this)), - clipInTimeline); + QHash menus; + menus.insert("addMenu",static_cast(factory()->container("generators", this))); + menus.insert("transcodeMenu",static_cast(factory()->container("transcoders", this))); + menus.insert("stabilizeMenu",static_cast(factory()->container("stabilize", this))); + menus.insert("inTimelineMenu",clipInTimeline); + m_projectList->setupGeneratorMenu(menus); // build themes menus QMenu *themesMenu = static_cast(factory()->container("themes_menu", this)); @@ -615,9 +629,9 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & m_projectList->slotAddClip(urls); } -#ifndef NO_JOGSHUTTLE +#ifdef USE_JOGSHUTTLE activateShuttleDevice(); -#endif /* NO_JOGSHUTTLE */ +#endif m_projectListDock->raise(); actionCollection()->addAssociatedWidget(m_clipMonitor->container()); @@ -829,7 +843,7 @@ void MainWindow::slotReloadEffects() m_effectList->reloadEffectList(m_effectsMenu, m_effectActions); } -#ifndef NO_JOGSHUTTLE +#ifdef USE_JOGSHUTTLE void MainWindow::activateShuttleDevice() { delete m_jogShuttle; @@ -847,7 +861,7 @@ void MainWindow::activateShuttleDevice() connect(m_jogShuttle, SIGNAL(forward(double)), m_monitorManager, SLOT(slotForward(double))); connect(m_jogShuttle, SIGNAL(action(const QString&)), this, SLOT(slotDoAction(const QString&))); } -#endif /* NO_JOGSHUTTLE */ +#endif /* USE_JOGSHUTTLE */ void MainWindow::slotDoAction(const QString& action_name) { @@ -2260,7 +2274,7 @@ void MainWindow::slotEditProjectSettings() if (w->exec() == QDialog::Accepted) { QString profile = w->selectedProfile(); m_activeDocument->setProjectFolder(w->selectedFolder()); -#ifndef Q_WS_MAC +#ifndef Q_WS_MAC m_recMonitor->slotUpdateCaptureFolder(m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash)); #endif if (m_renderWidget) m_renderWidget->setDocumentPath(m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash)); @@ -2351,7 +2365,9 @@ void MainWindow::slotRenderProject() { if (!m_renderWidget) { QString projectfolder = m_activeDocument ? m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash) : KdenliveSettings::defaultprojectfolder(); - m_renderWidget = new RenderWidget(projectfolder, m_projectList->useProxy(), this); + MltVideoProfile profile; + if (m_activeDocument) profile = m_activeDocument->mltProfile(); + m_renderWidget = new RenderWidget(projectfolder, m_projectList->useProxy(), profile, this); connect(m_renderWidget, SIGNAL(shutdown()), this, SLOT(slotShutdown())); connect(m_renderWidget, SIGNAL(selectedRenderProfile(QMap )), this, SLOT(slotSetDocumentRenderProfile(QMap ))); connect(m_renderWidget, SIGNAL(prepareRenderingData(bool, bool, const QString&)), this, SLOT(slotPrepareRendering(bool, bool, const QString&))); @@ -2466,7 +2482,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) //cha disconnect(m_activeTimeline->projectView(), SIGNAL(transitionItemSelected(Transition*, int, QPoint, bool)), m_projectMonitor, SLOT(slotSetSelectedClip(Transition*))); disconnect(m_activeTimeline->projectView(), SIGNAL(playMonitor()), m_projectMonitor, SLOT(slotPlay())); disconnect(m_activeTimeline->projectView(), SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType))); - disconnect(m_activeTimeline->projectView(), SIGNAL(showClipFrame(DocClipBase *, QPoint, const int)), m_clipMonitor, SLOT(slotSetClipProducer(DocClipBase *, QPoint, const int))); + disconnect(m_activeTimeline->projectView(), SIGNAL(showClipFrame(DocClipBase *, QPoint, bool, const int)), m_clipMonitor, SLOT(slotSetClipProducer(DocClipBase *, QPoint, bool, const int))); disconnect(m_activeTimeline, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor())); disconnect(m_activeTimeline, SIGNAL(insertTrack(int)), this, SLOT(slotInsertTrack(int))); disconnect(m_activeTimeline, SIGNAL(deleteTrack(int)), this, SLOT(slotDeleteTrack(int))); @@ -2542,7 +2558,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) //cha connect(trackView, SIGNAL(setZoom(int)), this, SLOT(slotSetZoom(int))); connect(trackView->projectView(), SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType))); - connect(trackView->projectView(), SIGNAL(showClipFrame(DocClipBase *, QPoint, const int)), m_clipMonitor, SLOT(slotSetClipProducer(DocClipBase *, QPoint, const int))); + connect(trackView->projectView(), SIGNAL(showClipFrame(DocClipBase *, QPoint, bool, const int)), m_clipMonitor, SLOT(slotSetClipProducer(DocClipBase *, QPoint, bool, const int))); connect(trackView->projectView(), SIGNAL(playMonitor()), m_projectMonitor, SLOT(slotPlay())); connect(trackView->projectView(), SIGNAL(clipItemSelected(ClipItem*, int, bool)), m_projectMonitor, SLOT(slotSetSelectedClip(ClipItem*))); @@ -2589,7 +2605,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) //cha m_activeDocument = doc; m_activeTimeline->updateProjectFps(); m_activeDocument->checkProjectClips(); -#ifndef Q_WS_MAC +#ifndef Q_WS_MAC m_recMonitor->slotUpdateCaptureFolder(m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash)); #endif //Update the mouse position display so it will display in DF/NDF format by default based on the project setting. @@ -2656,7 +2672,7 @@ void MainWindow::slotPreferences(int page, int option) void MainWindow::slotUpdateCaptureFolder() { -#ifndef Q_WS_MAC +#ifndef Q_WS_MAC if (m_activeDocument) m_recMonitor->slotUpdateCaptureFolder(m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash)); else m_recMonitor->slotUpdateCaptureFolder(KdenliveSettings::defaultprojectfolder()); #endif @@ -2679,9 +2695,10 @@ void MainWindow::updateConfiguration() // Update list of transcoding profiles loadTranscoders(); -#ifndef NO_JOGSHUTTLE + loadStabilize(); +#ifdef USE_JOGSHUTTLE activateShuttleDevice(); -#endif /* NO_JOGSHUTTLE */ +#endif } @@ -3187,7 +3204,7 @@ void MainWindow::slotShowClipProperties(DocClipBase *clip) else newprops.insert("templatetext", description); //newprops.insert("xmldata", m_projectList->generateTemplateXml(newtemplate, description).toString()); if (!newprops.isEmpty()) { - EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newprops, true); + EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->currentProperties(newprops), newprops, true); m_activeDocument->commandStack()->push(command); } } @@ -3202,7 +3219,7 @@ void MainWindow::slotShowClipProperties(DocClipBase *clip) if (dia_ui->exec() == QDialog::Accepted) { QMap newprops; newprops.insert("xmldata", dia_ui->xml().toString()); - if (dia_ui->outPoint() != clip->duration().frames(m_activeDocument->fps()) - 1) { + if (dia_ui->outPoint() != clip->duration().frames(m_activeDocument->fps())) { // duration changed, we need to update duration newprops.insert("out", QString::number(dia_ui->outPoint())); int currentLength = QString(clip->producerProperty("length")).toInt(); @@ -3217,7 +3234,7 @@ void MainWindow::slotShowClipProperties(DocClipBase *clip) dia_ui->saveTitle(path); } else newprops.insert("resource", QString()); } - EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newprops, true); + EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->currentProperties(newprops), newprops, true); m_activeDocument->commandStack()->push(command); //m_activeTimeline->projectView()->slotUpdateClip(clip->getId()); m_activeDocument->setModified(true); @@ -3265,9 +3282,9 @@ void MainWindow::slotShowClipProperties(QList cliplist, QMapclipType() == IMAGE) - new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newImageProps, true, command); + new EditClipCommand(m_projectList, clip->getId(), clip->currentProperties(newImageProps), newImageProps, true, command); else - new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newProps, true, command); + new EditClipCommand(m_projectList, clip->getId(), clip->currentProperties(newProps), newProps, true, command); } m_activeDocument->commandStack()->push(command); for (int i = 0; i < cliplist.count(); i++) @@ -3685,7 +3702,7 @@ int MainWindow::getNewStuff(const QString &configFile) if (entry->status() == KNS::Entry::Installed) kDebug() << "// Installed files: " << entry->installedFiles(); } -#endif /* KDE_IS_VERSION(4,3,80) */ +#endif return entries.size(); } @@ -3773,6 +3790,25 @@ void MainWindow::slotMaximizeCurrent(bool) kDebug() << "CURRENT WIDGET: " << par->objectName(); } +void MainWindow::loadStabilize() +{ + QMenu* stabMenu= static_cast(factory()->container("stabilize", this)); + stabMenu->clear(); + Mlt::Profile profile; + if (Mlt::Factory::filter(profile,(char*)"videostab")){ + QAction *action=stabMenu->addAction("Videostab (vstab)"); + action->setData("videostab"); + connect(action,SIGNAL(triggered()), this, SLOT(slotStabilize())); + } + if (Mlt::Factory::filter(profile,(char*)"videostab2")){ + QAction *action=stabMenu->addAction("Videostab (transcode)"); + action->setData("videostab2"); + connect(action,SIGNAL(triggered()), this, SLOT(slotStabilize())); + } + + +} + void MainWindow::loadTranscoders() { QMenu *transMenu = static_cast(factory()->container("transcoders", this)); @@ -3794,6 +3830,18 @@ void MainWindow::loadTranscoders() } } +void MainWindow::slotStabilize(KUrl::List urls) +{ + QString condition; + if (urls.isEmpty()) { + QAction *action = qobject_cast(sender()); + if (action){ + QString filtername=action->data().toString(); + urls = m_projectList->getConditionalUrls(condition); + } + } +} + void MainWindow::slotTranscode(KUrl::List urls) { QString params;