]> git.sesse.net Git - kdenlive/commitdiff
Fix issue 254: starting up with project supplied on CLI should not result in 'Untitle...
authorMads Bondo Dydensborg <mads@dydensborg.dk>
Sat, 25 Oct 2008 20:22:07 +0000 (20:22 +0000)
committerMads Bondo Dydensborg <mads@dydensborg.dk>
Sat, 25 Oct 2008 20:22:07 +0000 (20:22 +0000)
svn path=/branches/KDE4/; revision=2563

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

index 25e1d43e27a741ccc63655366c7d5faf380fcd7c..0b93c0722218f258595e32472bc021394fe30e61 100644 (file)
@@ -64,11 +64,12 @@ int main(int argc, char *argv[]) {
         KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); //new
 
         QString mltPath = args->getOption("mlt-path");
-        MainWindow* window = new MainWindow(mltPath);
-        window->show();
-        if (args->count()) { //new
-            window->openFile(args->url(0)); //new
+        KUrl url;
+        if (args->count()) {
+            url = args->url(0);
         }
+        MainWindow* window = new MainWindow(mltPath, url);
+        window->show();
 
         args->clear();
     }
index 40b1a73a054ae911e6c6a293725e4b3b325bd63f..d214cd2f10d6b4dc6a78a148286519ad8c0526fc 100644 (file)
@@ -98,7 +98,7 @@ EffectsList MainWindow::audioEffects;
 EffectsList MainWindow::customEffects;
 EffectsList MainWindow::transitions;
 
-MainWindow::MainWindow(const QString &MltPath, QWidget *parent)
+MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, QWidget *parent)
         : KXmlGuiWindow(parent),
         m_activeDocument(NULL), m_activeTimeline(NULL), m_renderWidget(NULL),
 #ifndef NO_JOGSHUTTLE
@@ -321,17 +321,17 @@ MainWindow::MainWindow(const QString &MltPath, QWidget *parent)
     m_monitorManager->initMonitors(m_clipMonitor, m_projectMonitor);
     slotConnectMonitors();
 
-    if (KdenliveSettings::openlastproject()) {
-        openLastFile();
+    // Open or create a file.  Command line argument passed in Url has
+    // precedence, then "openlastproject", then just a plain empty file.
+    // If opening Url fails, openlastproject will _not_ be used.
+    if (!Url.isEmpty()) {
+        openFile(Url);
     } else {
-        /*QList<KAutoSaveFile *> staleFiles = KAutoSaveFile::allStaleFiles();
-        if (!staleFiles.isEmpty()) {
-            if (KMessageBox::questionYesNo(this, i18n("Auto-saved files exist. Do you want to recover them now?"), i18n("File Recovery"), KGuiItem(i18n("Recover")), KGuiItem(i18n("Don't recover"))) == KMessageBox::Yes) {
-         recoverFiles(staleFiles);
-            }
-            else newFile();
+        if (KdenliveSettings::openlastproject()) {
+            openLastFile();
         }
-        else*/
+    }
+    if (m_timelineArea->count() == 0) {
         newFile(false);
     }
 
index dad33684f8d98bd7ebe2fb1dad64241489c49dc7..f629ce8d007562389b7109dbdf0cb0b101836284 100644 (file)
@@ -63,7 +63,15 @@ class MainWindow : public KXmlGuiWindow {
     Q_OBJECT
 
 public:
-    MainWindow(const QString &MltPath = QString(), QWidget *parent = 0);
+    /** Constructor
+     * \param MltPath path to MLT environment
+     * \param Url Url to open
+     * \param parent Std. widget parent
+     *
+     * The constructor inits the main window. If Url is present, it will be opened.
+     * If Url is not present, and openLastproject is set, last project will be set
+     * If no file is open after trying this, a default "newfile" will be created. */
+    MainWindow(const QString &MltPath = QString(), const KUrl & Url = KUrl(), QWidget *parent = 0);
     void parseProfiles(const QString &mltPath = QString());
 
     static EffectsList videoEffects;