diff main/main.cpp @ 197:c08c312b2399

* Make RemoteFile far more pervasive, and use it for local files as well so that we can handle both transparently. Make it shallow copy with reference counting, so it can be used by value without having to worry about the cache file lifetime. Use RemoteFile for MainWindow file-open functions, etc
author Chris Cannam
date Thu, 18 Oct 2007 15:31:20 +0000
parents 77cd75905998
children 1871581e4da9
line wrap: on
line diff
--- a/main/main.cpp	Thu Oct 18 10:15:07 2007 +0000
+++ b/main/main.cpp	Thu Oct 18 15:31:20 2007 +0000
@@ -300,17 +300,11 @@
         if (i == args.begin()) continue;
         if (i->startsWith('-')) continue;
 
-        if (i->startsWith("http:") || i->startsWith("ftp:")) {
-            std::cerr << "opening URL: \"" << i->toStdString() << "\"..." << std::endl;
-            status = gui.openURL(*i);
-            continue;
-        }
-
         QString path = *i;
 
         if (path.endsWith("sv")) {
             if (!haveSession) {
-                status = gui.openSessionFile(path);
+                status = gui.openSession(path);
                 if (status == MainWindow::FileOpenSucceeded) {
                     haveSession = true;
                     haveMainModel = true;
@@ -322,25 +316,25 @@
         }
         if (status != MainWindow::FileOpenSucceeded) {
             if (!haveMainModel) {
-                status = gui.openSomeFile(path, MainWindow::ReplaceMainModel);
+                status = gui.open(path, MainWindow::ReplaceMainModel);
                 if (status == MainWindow::FileOpenSucceeded) {
                     haveMainModel = true;
                 }
             } else {
                 if (haveSession && !havePriorCommandLineModel) {
-                    status = gui.openSomeFile(path, MainWindow::AskUser);
+                    status = gui.open(path, MainWindow::AskUser);
                     if (status == MainWindow::FileOpenSucceeded) {
                         havePriorCommandLineModel = true;
                     }
                 } else {
-                    status = gui.openSomeFile(path, MainWindow::CreateAdditionalModel);
+                    status = gui.open(path, MainWindow::CreateAdditionalModel);
                 }
             }
         }
         if (status == MainWindow::FileOpenFailed) {
 	    QMessageBox::critical
                 (&gui, QMessageBox::tr("Failed to open file"),
-                 QMessageBox::tr("File \"%1\" could not be opened").arg(path));
+                 QMessageBox::tr("File or URL \"%1\" could not be opened").arg(path));
         }
     }