+ QString caption("Mussa Save Motifs");
+ QString filter("Motif list(*.txt *.mtl)");
+ QString path = QFileDialog::getSaveFileName(this,
+ caption,
+ default_dir->absolutePath(),
+ filter);
+ // user hit cancel?
+ if (path.isNull())
+ return;
+ // try to load safely
+ try {
+ fs::path converted_path(path.toStdString(), fs::native);
+ if (fs::extension(converted_path).size() == 0) {
+ // no extension, so add one
+ fs::path base_path = converted_path.branch_path();
+ fs::path filename(converted_path.leaf() + ".mtl", fs::native);
+ converted_path = base_path / filename;
+ }
+ analysis->save_motifs(converted_path);
+ default_dir->setPath(converted_path.branch_path().native_directory_string().c_str());
+ } catch (std::exception e) {
+ QString msg("Unable to save ");
+ msg += path;
+ msg += "\n";
+ msg += e.what();
+ QMessageBox::warning(this, caption, msg);
+ }}