MCPcopy Create free account
hub / github.com/OpenOrienteering/mapper / exportTo

Method exportTo

src/gui/map/map_editor.cpp:600–636  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

598
599
600bool MapEditorController::exportTo(const QString& path, const FileFormat& format)
601{
602 if (!map || editing_in_progress)
603 return false;
604
605 auto exporter = format.makeExporter(path, map, main_view);
606 if (!exporter)
607 {
608 auto message =
609 tr("Cannot export the map as\n"
610 "\"%1\"\n"
611 "because saving as %2 (.%3) is not supported.").
612 arg(path,
613 format.description(),
614 format.fileExtensions().join(QLatin1String(", ")) );
615 QMessageBox::warning(nullptr, tr("Error"), message);
616 return false;
617 }
618
619 if (!exporter->doExport())
620 {
621 auto message = tr("Cannot save file\n%1:\n%2")
622 .arg(path, exporter->warnings().back());
623 QMessageBox::warning(nullptr, tr("Error"), message);
624 return false;
625 }
626
627 if (!exporter->warnings().empty())
628 {
629 MainWindow::showMessageBox(nullptr,
630 tr("Warning"),
631 tr("The map export generated warnings."),
632 exporter->warnings() );
633 }
634
635 return true;
636}
637
638
639bool MapEditorController::loadFrom(const QString& path, const FileFormat& format, QWidget* dialog_parent)

Callers 1

autosaveMethod · 0.45

Calls 5

QLatin1StringClass · 0.85
backMethod · 0.80
makeExporterMethod · 0.45
doExportMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected