Hello,some time ago I wrote an extension that requires the user to input a filename. I’m writing another extension with the same requirement.
As a fast but ugly solution, I copied the following code from |libavogadro/src/extensions/quantuminput/gaussianinputdialog.cpp| (lines 240-255)
|// Fragment copied from InputDialog // Try to set default save path for dialog using the next sequence: // 1) directory of current file (if any); // 2) directory where previous deck was saved; // 3) $HOME QFileInfo defaultFile(m_molecule->fileName()); QString defaultPath = defaultFile.canonicalPath(); if(m_savePath == "") { if (defaultPath.isEmpty()) defaultPath = QDir::homePath(); } else { defaultPath = m_savePath; } QString defaultFileName = defaultPath + '/' + defaultFile.baseName() + "." + ext; QString fileName = QFileDialog::getSaveFileName(this, tr("Save Input Deck"), defaultFileName, fileType + " (*." + ext + ")"); |
As the initial comment states, even these lines are copied from somewhere else (|libavogadro/src/extensions/quantuminput/inputdialog.cpp|).
I’d like to contribute with a pull request on github. I could write a function |askForFileName| that my two extensions, |gaussianinputdialog| and |abinitinputdialog| would use.
Any suggestion is welcome. Let me know if this makes sense. Regards, Davide
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________ Avogadro-devel mailing list Avogadro-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/avogadro-devel