comparison main/main.cpp @ 145:dfaf4f9330b5

* minor usability fixes
author Chris Cannam
date Fri, 18 May 2007 16:47:38 +0000
parents c3114dffdff4
children 33280c031d19
comparison
equal deleted inserted replaced
144:56c00f977cac 145:dfaf4f9330b5
276 // complete. As a lazy hack, apply it explicitly from here 276 // complete. As a lazy hack, apply it explicitly from here
277 gui.preferenceChanged("Property Box Layout"); 277 gui.preferenceChanged("Property Box Layout");
278 278
279 bool haveSession = false; 279 bool haveSession = false;
280 bool haveMainModel = false; 280 bool haveMainModel = false;
281 bool havePriorCommandLineModel = false;
281 282
282 for (QStringList::iterator i = args.begin(); i != args.end(); ++i) { 283 for (QStringList::iterator i = args.begin(); i != args.end(); ++i) {
283 284
284 MainWindow::FileOpenStatus status = MainWindow::FileOpenFailed; 285 MainWindow::FileOpenStatus status = MainWindow::FileOpenFailed;
285 286
306 } 307 }
307 } 308 }
308 if (status != MainWindow::FileOpenSucceeded) { 309 if (status != MainWindow::FileOpenSucceeded) {
309 if (!haveMainModel) { 310 if (!haveMainModel) {
310 status = gui.openSomeFile(path, MainWindow::ReplaceMainModel); 311 status = gui.openSomeFile(path, MainWindow::ReplaceMainModel);
311 if (status == MainWindow::FileOpenSucceeded) haveMainModel = true; 312 if (status == MainWindow::FileOpenSucceeded) {
313 haveMainModel = true;
314 }
312 } else { 315 } else {
313 status = gui.openSomeFile(path, MainWindow::CreateAdditionalModel); 316 if (haveSession && !havePriorCommandLineModel) {
317 status = gui.openSomeFile(path, MainWindow::AskUser);
318 if (status == MainWindow::FileOpenSucceeded) {
319 havePriorCommandLineModel = true;
320 }
321 } else {
322 status = gui.openSomeFile(path, MainWindow::CreateAdditionalModel);
323 }
314 } 324 }
315 } 325 }
316 if (status == MainWindow::FileOpenFailed) { 326 if (status == MainWindow::FileOpenFailed) {
317 QMessageBox::critical 327 QMessageBox::critical
318 (&gui, QMessageBox::tr("Failed to open file"), 328 (&gui, QMessageBox::tr("Failed to open file"),