AvogadroApp
Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | List of all members
MainWindow Class Reference

#include <mainwindow.h>

Inheritance diagram for MainWindow:

Public Slots

void setMolecule (Avogadro::QtGui::Molecule *molecule)
 
void markMoleculeDirty ()
 
void markMoleculeClean ()
 
void updateWindowTitle ()
 
bool openFile (const QString &fileName, Io::FileFormat *reader=nullptr)
 

Signals

void moleculeChanged (QtGui::Molecule *molecue)
 

Public Member Functions

 MainWindow (const QStringList &fileNames, bool disableSettings=false)
 
QtGui::Molecule * molecule ()
 
void writeSettings ()
 
void readSettings ()
 

Protected Slots

void moleculeReady (int number)
 
void newMolecule ()
 
void openFile ()
 
void importFile ()
 
void openRecentFile ()
 
void updateRecentFiles ()
 
bool saveFile (bool async=true)
 
bool saveFileAs (bool async=true)
 
bool exportFile (bool async=true)
 
bool saveFileAs (const QString &fileName, Io::FileFormat *writer, bool async=true)
 
void setActiveTool (QString toolName)
 
void setActiveDisplayTypes (QStringList displayTypes)
 
void undoEdit ()
 
void redoEdit ()
 
void activeMoleculeEdited ()
 

Protected Member Functions

void closeEvent (QCloseEvent *event)
 

Detailed Description

Author
Marcus D. Hanwell

The MainWindow class for the Avogadro application. Takes care of initializing the application and overall layout.

Member Function Documentation

◆ markMoleculeDirty

void markMoleculeDirty ( )
slot

Update internal state to reflect that the molecule has been modified.

◆ markMoleculeClean

void markMoleculeClean ( )
slot

Update internal state to reflect that the molecule is not modified.

◆ updateWindowTitle

void updateWindowTitle ( )
slot

Update the main window title.

◆ openFile [1/2]

bool openFile ( const QString &  fileName,
Io::FileFormat *  reader = nullptr 
)
slot

Use the FileFormat reader to load fileName. This method takes ownership of reader and will delete it before returning.

◆ writeSettings()

void writeSettings ( )

Write out all application settings, normally done as part of the application close event.

◆ readSettings()

void readSettings ( )

Read in all settings, and initialize our application based on the stored settings.

◆ moleculeChanged

void moleculeChanged ( QtGui::Molecule *  molecue)
signal

Emitted when the active molecule in the application has changed.

◆ moleculeReady

void moleculeReady ( int  number)
protectedslot

Slot provided for extensions to indicate a molecule is ready to be read in. This slot will then pass a molecule to the extension for the data to be read in to.

◆ newMolecule

void newMolecule ( )
protectedslot

Create a new molecule and make it the active molecule.

◆ openFile [2/2]

void openFile ( )
protectedslot

Prompt for a file location, and attempt to open the specified file using our native readers.

◆ importFile

void importFile ( )
protectedslot

Import a file, using the full selection of formats capable of reading.

◆ openRecentFile

void openRecentFile ( )
protectedslot

Open file in the recent files list.

◆ updateRecentFiles

void updateRecentFiles ( )
protectedslot

Update the list of recent files.

◆ saveFile

bool saveFile ( bool  async = true)
protectedslot

Save the current molecule to its current fileName. If it is not a standard format, offer to export and warn about possible data loss. If async is true (default), the file is loaded asynchronously.

Returns
If async is true, this function returns true if a suitable writer was found (not if the write was successful). If async is false, the return value indicates whether or not the file was written successfully.

◆ saveFileAs [1/2]

bool saveFileAs ( bool  async = true)
protectedslot

Prompt for a file location, and attempt to save the active molecule to the specified location. If async is true (default), the file is loaded asynchronously.

Returns
If async is true, this function returns true if a suitable writer was found (not if the write was successful). If async is false, the return value indicates whether or not the file was written successfully.

◆ exportFile

bool exportFile ( bool  async = true)
protectedslot

Export a file, using the full selection of formats capable of writing. If async is true (default), the file is loaded asynchronously.

Returns
If async is true, this function returns true if a suitable writer was found (not if the write was successful). If async is false, the return value indicates whether or not the file was written successfully.

◆ saveFileAs [2/2]

bool saveFileAs ( const QString &  fileName,
Io::FileFormat *  writer,
bool  async = true 
)
protectedslot

If specified, use the FileFormat writer to save the file. This method takes ownership of writer and will delete it before returning. If async is true (default), the file is loaded asynchronously.

Returns
If async is true, this function returns true if the write begins successfully (not if the writer completes). If async is false, the return value indicates whether or not the file was written successfully.

◆ setActiveTool

void setActiveTool ( QString  toolName)
protectedslot

Set the active tool for the currently active widget by name.

Parameters
toolNameName of the tool to select.

◆ setActiveDisplayTypes

void setActiveDisplayTypes ( QStringList  displayTypes)
protectedslot

Set the active display types, and cause the scene to be updated.

Parameters
displayTypesA list of