]> git.sesse.net Git - kdenlive/commitdiff
Allow importing of clips into project from command line:
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 16 Sep 2010 16:08:17 +0000 (16:08 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 16 Sep 2010 16:08:17 +0000 (16:08 +0000)
http://kdenlive.org/mantis/view.php?id=1812

svn path=/trunk/kdenlive/; revision=4901

src/main.cpp
src/mainwindow.cpp
src/mainwindow.h

index a225c4ef5b1c1fada4b380894db3842e843a3238..7b53e653b2a69c14b044e7b91e595b999bc13fb4 100644 (file)
@@ -54,6 +54,7 @@ int main(int argc, char *argv[])
     KCmdLineOptions options;
     options.add("mlt-path <path>", ki18n("Set the path for MLT environment"));
     options.add("+[file]", ki18n("Document to open")); //new
+    options.add("i <clips>", ki18n("Comma separated list of clips to add")); //new
     KCmdLineArgs::addCmdLineOptions(options); //new
 
     KApplication app;
@@ -74,13 +75,13 @@ int main(int argc, char *argv[])
         }
     } else {
         KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); //new
-
+       QString clipsToLoad = args->getOption("i");
         QString mltPath = args->getOption("mlt-path");
         KUrl url;
         if (args->count()) {
             url = args->url(0);
         }
-        window = new MainWindow(mltPath, url);
+        window = new MainWindow(mltPath, url, clipsToLoad);
         window->show();
 
         args->clear();
index 053d177ebfde85e7a844026295a49b8f5c766cb0..f544335aa4f266228365104e3da8056777f2ada0 100644 (file)
@@ -120,7 +120,7 @@ EffectsList MainWindow::audioEffects;
 EffectsList MainWindow::customEffects;
 EffectsList MainWindow::transitions;
 
-MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, QWidget *parent) :
+MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & clipsToLoad, QWidget *parent) :
         KXmlGuiWindow(parent),
         m_activeDocument(NULL),
         m_activeTimeline(NULL),
@@ -469,6 +469,16 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, QWidget *parent
         newFile(false);
     }
 
+    if (!clipsToLoad.isEmpty() && m_activeDocument) {
+        QStringList list = clipsToLoad.split(',');
+        QList <QUrl> urls;
+        foreach(QString path, list) {
+            kDebug() << QDir::current().absoluteFilePath(path);
+            urls << QUrl::fromLocalFile(QDir::current().absoluteFilePath(path));
+        }
+        m_projectList->slotAddClip(urls);
+    }
+
 #ifndef NO_JOGSHUTTLE
     activateShuttleDevice();
 #endif /* NO_JOGSHUTTLE */
index eee703f25e9303540700c2090436a78eb29561b0..9d8b5b48bbb098599ca8a2ed78a3636a34d4169a 100644 (file)
@@ -78,12 +78,13 @@ public:
     /** @brief Initialises the main window.
      * @param MltPath (optional) path to MLT environment
      * @param Url (optional) file to open
+     * @param clipsToLoad (optional) a comma separated list of clips to import in project
      *
      * If Url is present, it will be opened, otherwhise, if openlastproject is
      * set, latest project will be opened. If no file is open after trying this,
      * a default new file will be created. */
     explicit MainWindow(const QString &MltPath = QString(),
-                        const KUrl &Url = KUrl(), QWidget *parent = 0);
+                        const KUrl &Url = KUrl(), const QString & clipsToLoad = QString(), QWidget *parent = 0);
     virtual ~MainWindow();
 
     /** @brief Locates the MLT environment.