| 373 | } |
| 374 | |
| 375 | void |
| 376 | ScriptEditor::onLoadScriptClicked() |
| 377 | { |
| 378 | std::vector<std::string> filters; |
| 379 | |
| 380 | filters.push_back("py"); |
| 381 | SequenceFileDialog dialog(this, filters, false, SequenceFileDialog::eFileDialogModeOpen, getGui()->getLastLoadProjectDirectory().toStdString(), |
| 382 | getGui(), false); |
| 383 | |
| 384 | if ( dialog.exec() ) { |
| 385 | QDir currentDir = dialog.currentDirectory(); |
| 386 | getGui()->updateLastOpenedProjectPath( currentDir.absolutePath() ); |
| 387 | QString fileName( QString::fromUtf8( dialog.selectedFiles().c_str() ) ); |
| 388 | QFile file(fileName); |
| 389 | if ( file.open(QIODevice::ReadOnly) ) { |
| 390 | QTextStream ts(&file); |
| 391 | QString content = ts.readAll(); |
| 392 | _imp->inputEdit->setPlainText(content); |
| 393 | } else { |
| 394 | Dialogs::errorDialog( tr("Operation failed").toStdString(), tr("Failure to open the file").toStdString() ); |
| 395 | } |
| 396 | } |
| 397 | } |
| 398 | |
| 399 | void |
| 400 | ScriptEditor::onSaveScriptClicked() |
nothing calls this directly
no test coverage detected