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 (saveAs || path.isEmpty()) |
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 (f->name().isEmpty()) ? f->name() : f->defaultName(), tr ("LDraw files (*.dat *.ldr)")); |
700 |
700 |
701 if (path.isEmpty()) |
701 if (path.isEmpty()) |
702 { // User didn't give a file name, abort. |
702 { // User didn't give a file name, abort. |
703 return; |
703 return; |
704 } |
704 } |
753 { return confirm (ForgeWindow::tr ("Confirm"), msg); |
753 { return confirm (ForgeWindow::tr ("Confirm"), msg); |
754 } |
754 } |
755 |
755 |
756 bool confirm (str title, str msg) |
756 bool confirm (str title, str msg) |
757 { return QMessageBox::question (g_win, title, msg, |
757 { return QMessageBox::question (g_win, title, msg, |
758 (QMessageBox::Yes | QMessageBox::No), QMessageBox::No) == QMessageBox::Yes; |
758 (QMessageBox::Yes | QMessageBox::No), QMessageBox::No) == QMessageBox::Yes; |
759 } |
759 } |
760 |
760 |
761 // ============================================================================= |
761 // ============================================================================= |
762 void critical (str msg) |
762 void critical (str msg) |
763 { QMessageBox::critical (g_win, ForgeWindow::tr ("Error"), msg, |
763 { QMessageBox::critical (g_win, ForgeWindow::tr ("Error"), msg, |
764 (QMessageBox::Close), QMessageBox::Close); |
764 (QMessageBox::Close), QMessageBox::Close); |
765 } |
765 } |
766 |
766 |
767 // ============================================================================= |
767 // ============================================================================= |
768 QIcon makeColorIcon (LDColor* colinfo, const int size) |
768 QIcon makeColorIcon (LDColor* colinfo, const int size) |
769 { // Create an image object and link a painter to it. |
769 { // Create an image object and link a painter to it. |