AvogadroApp
Loading...
Searching...
No Matches
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)
 
void exportGraphics (QString fileName)
 
bool exportFile (const QString &fileName, bool async=true)
 
std::string exportString (const std::string &format)
 
bool addScript (const QString &fileName)
 

Signals

void moleculeChanged (QtGui::Molecule *molecue)
 

Public Member Functions

 MainWindow (const QStringList &fileNames, bool disableSettings=false)
 
QtGui::Molecule * molecule ()
 
void writeSettings ()
 
void readSettings ()
 
void setTranslationList (const QStringList &list, const QStringList &codes)
 
bool handleCommand (const QString &command, const QVariantMap &options)
 

Protected Slots

void setLocale (const QString &locale)
 
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 setDisabledDisplayTypes (QStringList displayTypes)
 
void undoEdit ()
 
void redoEdit ()
 
void activeMoleculeEdited ()
 
void refreshDisplayTypes ()
 

Protected Member Functions

void closeEvent (QCloseEvent *event)
 
void dragEnterEvent (QDragEnterEvent *event)
 
void dropEvent (QDropEvent *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.

◆ exportFile [1/2]

bool exportFile ( const QString &  fileName,
bool  async = true 
)
slot

Export a file, using the full selection of formats capable of writing. The format will be guessed based on the filename extension. If async is true (default), the file is saved 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.

◆ exportString

std::string exportString ( const std::string &  format)
slot

Export a file, using the full selection of formats capable of writing. Will use format to determine the file format to use.

Returns
String-representation of the exported file, or an empty string if the export failed.

◆ addScript

bool addScript ( const QString &  fileName)
slot

Move fileName as a plugin script (i.e. put it in the correct dir)

◆ 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.

◆ setTranslationList()

void setTranslationList ( const QStringList &  list,
const QStringList &  codes 
)

Set the list of possible translations

◆ handleCommand()

bool handleCommand ( const QString &  command,
const QVariantMap &  options 
)

Handle script commands

Parameters
commandThe command to execute
optionsThe options to the command
Returns
True if the command was handled, false otherwise

◆ moleculeChanged

void moleculeChanged ( QtGui::Molecule *  molecue)
signal

Emitted when the active molecule in the application has changed.

◆ setLocale

void setLocale ( const QString &  locale)
protectedslot

Set the preferred locale

◆ 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 saved 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 saved 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 [2/2]

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 saved 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 saved 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