MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / exportLayout

Method exportLayout

Gui/Gui10.cpp:299–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

297} // restoreLayout
298
299void
300Gui::exportLayout()
301{
302 std::vector<std::string> filters;
303
304 filters.push_back(NATRON_LAYOUT_FILE_EXT);
305 SequenceFileDialog dialog( this, filters, false, SequenceFileDialog::eFileDialogModeSave, _imp->_lastSaveProjectOpenedDir.toStdString(), this, false );
306 if ( dialog.exec() ) {
307 std::string filename = dialog.filesToSave();
308 QString filenameCpy( QString::fromUtf8( filename.c_str() ) );
309 QString ext = QtCompat::removeFileExtension(filenameCpy);
310 if ( ext != QString::fromUtf8(NATRON_LAYOUT_FILE_EXT) ) {
311 filename.append("." NATRON_LAYOUT_FILE_EXT);
312 }
313
314
315 FStreamsSupport::ofstream ofile;
316 FStreamsSupport::open(&ofile, filename);
317 if (!ofile) {
318 Dialogs::errorDialog( tr("Error").toStdString()
319 , tr("Failed to open file ").toStdString() + filename, false );
320
321 return;
322 }
323
324 try {
325 boost::archive::xml_oarchive oArchive(ofile);
326 GuiLayoutSerialization s;
327 s.initialize(this);
328 oArchive << boost::serialization::make_nvp("Layout", s);
329 }catch (...) {
330 Dialogs::errorDialog( tr("Error").toStdString()
331 , tr("Failed to save the layout").toStdString(), false );
332
333 return;
334 }
335 }
336}
337
338const QString &
339Gui::getLastLoadProjectDirectory() const

Callers

nothing calls this directly

Calls 8

removeFileExtensionFunction · 0.85
openFunction · 0.85
toStdStringMethod · 0.80
filesToSaveMethod · 0.80
appendMethod · 0.80
push_backMethod · 0.45
execMethod · 0.45
initializeMethod · 0.45

Tested by

no test coverage detected