| 297 | } // restoreLayout |
| 298 | |
| 299 | void |
| 300 | Gui::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 | |
| 338 | const QString & |
| 339 | Gui::getLastLoadProjectDirectory() const |
nothing calls this directly
no test coverage detected