src/gui.cpp

changeset 497
c51941e590b6
parent 493
16766ac1bbd9
child 498
791c831c8020
equal deleted inserted replaced
496:d6cbf21af8fb 497:c51941e590b6
651 // ============================================================================= 651 // =============================================================================
652 // ----------------------------------------------------------------------------- 652 // -----------------------------------------------------------------------------
653 void ForgeWindow::slot_editObject (QListWidgetItem* listitem) 653 void ForgeWindow::slot_editObject (QListWidgetItem* listitem)
654 { LDObject* obj = null; 654 { LDObject* obj = null;
655 655
656 for (LDObject * it : LDFile::current()->objects()) 656 for (LDObject* it : LDFile::current()->objects())
657 { if (it->qObjListEntry == listitem) 657 { if (it->qObjListEntry == listitem)
658 { obj = it; 658 { obj = it;
659 break; 659 break;
660 } 660 }
661 } 661 }
692 // ============================================================================= 692 // =============================================================================
693 // ----------------------------------------------------------------------------- 693 // -----------------------------------------------------------------------------
694 void ForgeWindow::save (LDFile* f, bool saveAs) 694 void ForgeWindow::save (LDFile* f, bool saveAs)
695 { str path = f->name(); 695 { str path = f->name();
696 696
697 if (path.length() == 0 || saveAs) 697 if (saveAs || path.isEmpty())
698 { path = QFileDialog::getSaveFileName (g_win, tr ("Save As"), 698 { path = QFileDialog::getSaveFileName (g_win, tr ("Save As"),
699 LDFile::current()->name(), tr ("LDraw files (*.dat *.ldr)")); 699 LDFile::current()->name(), tr ("LDraw files (*.dat *.ldr)"));
700 700
701 if (path.length() == 0) 701 if (path.isEmpty())
702 { // User didn't give a file name. This happens if the user cancelled 702 { // User didn't give a file name, abort.
703 // saving in the save file dialog. Abort.
704 return; 703 return;
705 } 704 }
706 } 705 }
707 706
708 if (f->save (path)) 707 if (f->save (path))

mercurial