On Fri, May 22, 2009 at 9:44 PM, Geoffrey Hutchison firstname.lastname@example.org wrote:
I think the new MoleculeFile class is great and we should use it
throughout – particularly in MainWindow.
A few things on code review:
- We should have a mechanism to return QString for error messages.
For example, everything in mainwindow.cpp should be there – can’t
read the file, can’t load the file format, can’t recognize the file
Yes, the bool return value is too limited. I’ll get it in before the
- We should store the OBMol internally and return the
Avogadro::Molecule or OBMol depending on desire. For example,
mainwindow.cpp checks for 2D and does a cleanup.
- We should also add Save/Write capabilities. It’s not too bad – if
you’re currently editing molecule #10, you copy out everything in the
file up to that stream position to a new file. Then you write the new
molecule #10, then you copy everything starting at the streampos for
molecule #11. Then you move the new file to replace the old filename.
Yes, the function names also need to be a bit more consistent. We have:
Molecule* OpenbabelWrapper::openFile(filename, type, options) // added by Marcus
bool OpenbabelWrapper::saveFile(molecule, filename, type) // added by Marcus
bool OpenbabelWrapper::writeConformers(molecule, filename, type)
MoleculeFile* readFile(filename, type, options, wait)
openFile & readFile overlap but having a simple function which
directly returns the molecule is useful. Should we use read/write or
open/save? I prefer read/write and suggest the following:
- openFile -> readMolecule
- saveFile -> writeMolecule
- Add MoleculeFile::writeMolecule to do the “insert writing”
- Of course it’d be great to have a QListWidget in Avogadro –
letting the user flip between different molecules in the file. Seems
like that should be pretty quick to add now too.
Yes, you can get the list of titles as QSringList which can be
displayed directly in a QListWidget.
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
Avogadro-devel mailing list