LibEngsas
Signals | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
EMainWindow Class Reference

Base class for mainwindows. It provides several useful functions by default. More...

#include <emainwindow.h>

+ Inheritance diagram for EMainWindow:
+ Collaboration diagram for EMainWindow:

Signals

void doReloadSettings ()
 

Public Member Functions

 EMainWindow (QWidget *parent=0, Qt::WindowFlags flags=0)
 
virtual ~EMainWindow ()
 
void setWindowTitle (const QString &title)
 

Protected Slots

virtual void fileNew ()
 
virtual void fileOpen ()
 
virtual void fileOpen (QString absoluteFilePath)
 
virtual void fileSave ()
 
virtual void fileSaveAs ()
 
virtual void fileDoSave (QString file)
 Function called by fileSave() and fileSaveAs() to actually do save data. More...
 
virtual void filePrint ()
 
virtual void fileExit ()
 
virtual void editCut ()
 
virtual void editCopy ()
 
virtual void editPaste ()
 
virtual void editUndo ()
 
virtual void editRedo ()
 
virtual void editSetupWizard ()
 Implement this function to call showSetupWizard() properly. More...
 
virtual void editSettings ()
 Connect to the Settings action in Edit menu. More...
 
virtual void viewReload ()
 
void helpHelp ()
 Calls helpHelp(QString) with empty string to open standard help. More...
 
virtual void helpHelp (QString file)
 Starts the helpcenter and tries to load the given file. More...
 
virtual void helpDependencies ()
 Calls showDependencies() with a NULL-Pointer. More...
 
virtual void helpAbout ()
 Calls showAbout() with empty values, should therefore be implemented at your subclass. More...
 
virtual void reloadSettings ()
 Reload your settings here. More...
 
void enableActions (EngSaS::AvailableActions enabledActions)
 
void connectESlots (QObject *object)
 
void errorByPass (const QString &message)
 
void warningByPass (const QString &message)
 
void informationByPass (const QString &message)
 
void reloadEnableActionsByPass ()
 Forwards the reloading of enabled actions signal. More...
 
void addMenuByPass (QMenu *newMenu, const QString &parent, QString before=QString())
 
void addActionByPass (QAction *newAction, const QString &parent, QString before=QString())
 
void addToolBarByPass (QToolBar *newToolBar, Qt::ToolBarArea area=Qt::TopToolBarArea)
 
void addNewDockWidgetByPass (QDockWidget *widget, const Qt::DockWidgetArea &area)
 
void setCentralWidgetByPass (QWidget *centralWidget)
 
void showSettingsByPass ()
 
void showHelpByPass (const QString &page)
 
void showStatusWidgetByPass (QWidget *widget)
 
void reloadSettingsRequestByPass ()
 
void clearRecentlyUsed ()
 Clears the list of recently used files. More...
 

Protected Member Functions

void showSetupWizard (EngSaS::SetupWizardObjects objects, bool msgOnNotNeeded=false, QIcon logo=QIcon(), QString applicationName=QString())
 Uses ESetupWizard to guide the user through the setup process. More...
 
void showSettings (ESettingsModel *model)
 Uses ESettingsDialog to present the settings given in the model. More...
 
void showDependencies (EDependencyModel *model)
 Show the standard EDepenenciesDialog. More...
 
void showAbout (QPixmap logo, QString name, QString version, QUrl url, EAboutModel *model)
 Shows the standard EAboutDialog as about dialog. More...
 
void setupHelpCenter (EHelpCenterSetup setup)
 Call this function in your subclass to setup the EHelpCenter. More...
 
void closeEvent (QCloseEvent *event)
 
void restoreWindowState ()
 
void error (const QString &message)
 
void warning (const QString &message)
 
void information (const QString &message)
 
void reloadEnableActions ()
 Indicates, that a reload of the enabled actions is needed. More...
 
void addMenu (QMenu *newMenu, const QString &parent, QString before=QString())
 
void addAction (QAction *newAction, const QString &parent, QString before=QString())
 
void addToolBar (QToolBar *newToolBar, Qt::ToolBarArea area=Qt::TopToolBarArea)
 
void addNewDockWidget (QDockWidget *widget, const Qt::DockWidgetArea &area)
 
void setCentralWidget (QWidget *centralWidget)
 
void showSettings ()
 
void showHelp (const QString &page)
 
void showStatusWidget (QWidget *widget)
 
EWidgetgetCentralWidget ()
 
void controleMenuStati ()
 
void controleMenuStati (QMenu *menu)
 
void addToRecentlyUsed (QString absoluteFilePath)
 

Protected Attributes

QMenuBar * menubar
 
QStatusBar * statusbar
 
QMenu * fileMenu
 
QMenu * fileRecentlyUsedMenu
 
QMenu * editMenu
 
QMenu * viewMenu
 
QMenu * otherMenu
 
QMenu * helpMenu
 
EActionfileNewAction
 
EActionfileOpenAction
 
EActionfileSaveAction
 
EActionfileSaveAsAction
 
EActionfilePrintAction
 
EActionfileExitAction
 
EActioneditUndoAction
 
EActioneditRedoAction
 
EActioneditCutAction
 
EActioneditCopyAction
 
EActioneditPasteAction
 
EActioneditSetupWizardAction
 
EActioneditSettingsAction
 
EActionviewReloadAction
 
EActionhelpHelpAction
 
EActionhelpDependenciesAction
 
EActionhelpAboutAction
 
EHelpCenterhelpCenter
 
EHelpCenterSetup helpCenterSetup
 
QList< QAction * > recentlyUsedActions
 
QAction * recentylUsedSeperator
 
QSignalMapper * recentlyUsedMapper
 

Private Member Functions

QAction * findBefore (QObject *parent, QString name)
 
void setupUi ()
 Setups the UI Elements like menus, statusbar, ...) More...
 
void loadRecentlyUsed ()
 Adds the needed actions to fileRecentlyUsedMenu. More...
 

Detailed Description

Base class for mainwindows. It provides several useful functions by default.

Especially the handling of EWidget's is quite well. It also set's the QApplication::organizationName() to EngSaS and allows better standard conform window title handling. It also provides file opening (fileOpen()), file save (fileSave() and fileSaveAs())and recently used files functionalities.

You may subclass some of the protected slots, but if you use EWidget's, this shouldn't be needed, because all specials must be done in your EWidget's.

Note
It hides the QMenu others if it is empty
Todo:

Implement auto hide of QMenu, if childs are removed (e.g. via deleting the child somewhere else)

Save and restore size

See Also
EWidget

Constructor & Destructor Documentation

EMainWindow::EMainWindow ( QWidget *  parent = 0,
Qt::WindowFlags  flags = 0 
)

+ Here is the call graph for this function:

EMainWindow::~EMainWindow ( )
virtual

Member Function Documentation

void EMainWindow::addAction ( QAction *  newAction,
const QString &  parent,
QString  before = QString() 
)
protected

If no parent is given or the given parent can not be found, the action is added to the menu "Other", which is enabled if needed. With help of before, the action, which should be the one before newAction can be specified.

Note
Be aware, that the parent menu becomes the parent. Therfore you are responsible to delete the menu again, if your widget is deleted
See Also
EWidget::addAction()
EObject::addAction()

+ Here is the call graph for this function:

void EMainWindow::addActionByPass ( QAction *  newAction,
const QString &  parent,
QString  before = QString() 
)
inlineprotectedslot

these functions are wrappers to provide convenient API to EWidget and EObject. For example EObject::connectByPass() can be called with help of these slots. Calls addAction()

void EMainWindow::addMenu ( QMenu *  newMenu,
const QString &  parent,
QString  before = QString() 
)
protected

If parent can not be found, it is added to toplevel menu "Other". This menu is enabled if needed With help of before, the action, which should be the one before newAction can be specified (QMenu::menuAction()).

Todo:
Sort order (Especially in fileMenu insert before Exit). Maybe it should be possible to provide an "after" menu or action
Note
Be aware, that the parent menu becomes the parent. Therfore you are responsible to delete the menu again, if your widget is deleted
See Also
EWidget::addMenu()
EObject::addMenu()
Find out why QMenu::setParent() messes up the action relations and strip out the workaround

+ Here is the call graph for this function:

void EMainWindow::addMenuByPass ( QMenu *  newMenu,
const QString &  parent,
QString  before = QString() 
)
inlineprotectedslot

these functions are wrappers to provide convenient API to EWidget and EObject. For example EObject::connectByPass() can be called with help of these slots. Calls addMenu()

void EMainWindow::addNewDockWidget ( QDockWidget *  widget,
const Qt::DockWidgetArea &  area 
)
protected
void EMainWindow::addNewDockWidgetByPass ( QDockWidget *  widget,
const Qt::DockWidgetArea &  area 
)
inlineprotectedslot

these functions are wrappers to provide convenient API to EWidget and EObject. For example EObject::connectByPass() can be called with help of these slots. Calls addNewDockWidget()

void EMainWindow::addToolBar ( QToolBar *  newToolBar,
Qt::ToolBarArea  area = Qt::TopToolBarArea 
)
protected
void EMainWindow::addToolBarByPass ( QToolBar *  newToolBar,
Qt::ToolBarArea  area = Qt::TopToolBarArea 
)
inlineprotectedslot

these functions are wrappers to provide convenient API to EWidget and EObject. For example EObject::connectByPass() can be called with help of these slots. Calls addToolBar()

void EMainWindow::addToRecentlyUsed ( QString  absoluteFilePath)
protected

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void EMainWindow::clearRecentlyUsed ( )
protectedslot

Clears the list of recently used files.

+ Here is the caller graph for this function:

void EMainWindow::closeEvent ( QCloseEvent *  event)
protected

Stores the geomtry and state.

void EMainWindow::connectESlots ( QObject *  object)
protectedslot
See Also
EWidget::connectESlots()
EObject::connectESlots()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void EMainWindow::controleMenuStati ( )
protected

+ Here is the caller graph for this function:

void EMainWindow::controleMenuStati ( QMenu *  menu)
protected

+ Here is the call graph for this function:

void EMainWindow::doReloadSettings ( )
signal
void EMainWindow::editCopy ( )
protectedvirtualslot

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void EMainWindow::editCut ( )
protectedvirtualslot

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void EMainWindow::editPaste ( )
protectedvirtualslot

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void EMainWindow::editRedo ( )
protectedvirtualslot

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void EMainWindow::editSettings ( )
inlineprotectedvirtualslot

Connect to the Settings action in Edit menu.

Subclass this function, to create a ESettingsModel and call showSettings(ESettingsModel*) afterwards, to present the content to the user with help of the standard ESettingsDialog.

See Also
showSettings()

+ Here is the caller graph for this function:

virtual void EMainWindow::editSetupWizard ( )
inlineprotectedvirtualslot

Implement this function to call showSetupWizard() properly.

This slot is connected to the setup wizard action in edit menu. Normally you setup a list of ESetupWizardObjects in this function and call showSetupWizard() with this list and true as second argument, to inform the user, if the wizard is not needed.

ESetupWizardObjects objects;
// Add your objects here with objects << yourPointerToAnObject;
showSetupWizard(objects, true);
See Also
showSetupWizard()
ESetupWizard
ESetupWizardObject
ESetupWizardWidget

+ Here is the caller graph for this function:

void EMainWindow::editUndo ( )
protectedvirtualslot

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void EMainWindow::enableActions ( EngSaS::AvailableActions  enabledActions)
protectedslot

used to disable or enable default actions

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void EMainWindow::error ( const QString &  message)
protected
See Also
EWidget::error()
EObject::error()
warning()
information()

+ Here is the caller graph for this function:

void EMainWindow::errorByPass ( const QString &  message)
inlineprotectedslot

these functions are wrappers to provide convenient API to EWidget and EObject. For example EObject::connectByPass() can be called with help of these slots. Calls error().

void EMainWindow::fileDoSave ( QString  file)
protectedvirtualslot

Function called by fileSave() and fileSaveAs() to actually do save data.

This function just calls the EWidget::save() function from the current central widget, if it is an EWidget.

Note
The file is not opened or closed, because opening it with QIODevice::WriteOnly, truncates it and the EWidget has no chance to extract already present data.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void EMainWindow::fileExit ( )
protectedvirtualslot

+ Here is the caller graph for this function:

void EMainWindow::fileNew ( )
protectedvirtualslot

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void EMainWindow::fileOpen ( )
protectedvirtualslot

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void EMainWindow::fileOpen ( QString  absoluteFilePath)
protectedvirtualslot

+ Here is the call graph for this function:

void EMainWindow::filePrint ( )
protectedvirtualslot

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void EMainWindow::fileSave ( )
protectedvirtualslot

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void EMainWindow::fileSaveAs ( )
protectedvirtualslot

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QAction * EMainWindow::findBefore ( QObject *  parent,
QString  name 
)
private
Returns
The QAction or QAction related to QMenu, which has object name name and is child of parent

+ Here is the caller graph for this function:

EWidget * EMainWindow::getCentralWidget ( )
protected

tries to cast the central widget and returns a pointer the resulting object

+ Here is the caller graph for this function:

void EMainWindow::helpAbout ( )
protectedvirtualslot

Calls showAbout() with empty values, should therefore be implemented at your subclass.

Implement this function in your subclass to call showAbout() with proper values.

See Also
showAbout()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void EMainWindow::helpDependencies ( )
inlineprotectedvirtualslot

Calls showDependencies() with a NULL-Pointer.

Implement this function to call showDependencies() with your configured EDependencyModel.

+ Here is the caller graph for this function:

void EMainWindow::helpHelp ( )
protectedslot

Calls helpHelp(QString) with empty string to open standard help.

See Also
helpHelp(QString)

+ Here is the caller graph for this function:

void EMainWindow::helpHelp ( QString  file)
protectedvirtualslot

Starts the helpcenter and tries to load the given file.

This function is also called by the slot showHelp(QString).

See Also
showHelp(QString)
setupHelpCenter()

+ Here is the call graph for this function:

void EMainWindow::information ( const QString &  message)
protected
See Also
EWidget::information()
EObject::information()
error()
warning()

+ Here is the caller graph for this function:

void EMainWindow::informationByPass ( const QString &  message)
inlineprotectedslot

these functions are wrappers to provide convenient API to EWidget and EObject. For example EObject::connectByPass() can be called with help of these slots. Calls information()

void EMainWindow::loadRecentlyUsed ( )
private

Adds the needed actions to fileRecentlyUsedMenu.

+ Here is the caller graph for this function:

void EMainWindow::reloadEnableActions ( )
protected

Indicates, that a reload of the enabled actions is needed.

+ Here is the call graph for this function:

void EMainWindow::reloadEnableActionsByPass ( )
inlineprotectedslot

Forwards the reloading of enabled actions signal.

These functions are wrappers to provide convenient API to EWidget and EObject.

virtual void EMainWindow::reloadSettings ( )
inlineprotectedvirtualslot

Reload your settings here.

Please emit doReloadSettings() or call this base implementation to broadcast the reload event to all childs.

void EMainWindow::reloadSettingsRequestByPass ( )
inlineprotectedslot

these functions are wrappers to provide convenient API to EWidget and EObject. For example EObject::connectByPass() can be called with help of these slots.

void EMainWindow::restoreWindowState ( )
protected

Calls restoreGeometry() and restoreState(), therefore it should be called after all widgets are loaded. It uses objectName() to identify itself, so the objectname should be setted also before calling this function.

+ Here is the caller graph for this function:

void EMainWindow::setCentralWidget ( QWidget *  centralWidget)
protected
See Also
EWidget::setCentralWidget()
EObject::setCentralWidget()

+ Here is the call graph for this function:

void EMainWindow::setCentralWidgetByPass ( QWidget *  centralWidget)
inlineprotectedslot

these functions are wrappers to provide convenient API to EWidget and EObject. For example EObject::connectByPass() can be called with help of these slots. Calls setCentralWidget()

void EMainWindow::setupHelpCenter ( EHelpCenterSetup  setup)
protected

Call this function in your subclass to setup the EHelpCenter.

See Also
EHelpCenter
EHelpCenterSetup

+ Here is the caller graph for this function:

void EMainWindow::setupUi ( )
private

Setups the UI Elements like menus, statusbar, ...)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void EMainWindow::setWindowTitle ( const QString &  title)

+ Here is the caller graph for this function:

void EMainWindow::showAbout ( QPixmap  logo,
QString  name,
QString  version,
QUrl  url,
EAboutModel model 
)
protected

Shows the standard EAboutDialog as about dialog.

It adds the EABoutPersons from ELibrary also.

Note
Normally url should be relative to engsas.de. EAboutDialog::setApplicationUrl() made it absolute with the localized engsas url.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void EMainWindow::showDependencies ( EDependencyModel model)
protected

Show the standard EDepenenciesDialog.

See Also
helpDependencies()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void EMainWindow::showHelp ( const QString &  page)
protected
See Also
EWidget::showHelp()
EObject::showHelp()

+ Here is the call graph for this function:

void EMainWindow::showHelpByPass ( const QString &  page)
inlineprotectedslot

these functions are wrappers to provide convenient API to EWidget and EObject. For example EObject::connectByPass() can be called with help of these slots. Calls showHelp()

void EMainWindow::showSettings ( ESettingsModel model)
protected

Uses ESettingsDialog to present the settings given in the model.

It adds the settings widget from ELibrary also.

+ Here is the call graph for this function:

void EMainWindow::showSettings ( )
inlineprotected
See Also
EWidget::showSettings()
EObject::showSettings()

+ Here is the caller graph for this function:

void EMainWindow::showSettingsByPass ( )
inlineprotectedslot

these functions are wrappers to provide convenient API to EWidget and EObject. For example EObject::connectByPass() can be called with help of these slots. Calls showSettings()

void EMainWindow::showSetupWizard ( EngSaS::SetupWizardObjects  objects,
bool  msgOnNotNeeded = false,
QIcon  logo = QIcon(),
QString  applicationName = QString() 
)
protected

Uses ESetupWizard to guide the user through the setup process.

It shows the ESetupWizard containing objects, if needed. If not and msgOnNotNeeded is set to true, it popsup a message box with the information, that everything is correctly configured. With logo and applicationName, you can setup the logo and application name used inside the wizard. If nothing is set, the default of ESetupWizard is used (QApplication::windowIcon() and QApplication::applicationName()). To call this function with proper arguments, implement editSetupWizard().

See Also
ESetupWizard
editSetupWizard()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void EMainWindow::showStatusWidget ( QWidget *  widget)
protected
void EMainWindow::showStatusWidgetByPass ( QWidget *  widget)
inlineprotectedslot

these functions are wrappers to provide convenient API to EWidget and EObject. For example EObject::connectByPass() can be called with help of these slots.

void EMainWindow::viewReload ( )
protectedvirtualslot

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void EMainWindow::warning ( const QString &  message)
protected
void EMainWindow::warningByPass ( const QString &  message)
inlineprotectedslot

these functions are wrappers to provide convenient API to EWidget and EObject. For example EObject::connectByPass() can be called with help of these slots. Calls warning().

Member Data Documentation

EAction* EMainWindow::editCopyAction
protected
EAction* EMainWindow::editCutAction
protected
QMenu * EMainWindow::editMenu
protected
EAction* EMainWindow::editPasteAction
protected
EAction* EMainWindow::editRedoAction
protected
EAction* EMainWindow::editSettingsAction
protected
EAction* EMainWindow::editSetupWizardAction
protected
EAction* EMainWindow::editUndoAction
protected
EAction* EMainWindow::fileExitAction
protected
QMenu* EMainWindow::fileMenu
protected
EAction* EMainWindow::fileNewAction
protected
EAction* EMainWindow::fileOpenAction
protected
EAction* EMainWindow::filePrintAction
protected
QMenu * EMainWindow::fileRecentlyUsedMenu
protected
EAction* EMainWindow::fileSaveAction
protected
EAction* EMainWindow::fileSaveAsAction
protected
EAction* EMainWindow::helpAboutAction
protected
EHelpCenter* EMainWindow::helpCenter
protected
EHelpCenterSetup EMainWindow::helpCenterSetup
protected
EAction* EMainWindow::helpDependenciesAction
protected
EAction* EMainWindow::helpHelpAction
protected
QMenu * EMainWindow::helpMenu
protected
QMenuBar* EMainWindow::menubar
protected
QMenu* EMainWindow::otherMenu
protected
QList<QAction*> EMainWindow::recentlyUsedActions
protected
QSignalMapper* EMainWindow::recentlyUsedMapper
protected
QAction* EMainWindow::recentylUsedSeperator
protected
QStatusBar* EMainWindow::statusbar
protected
QMenu * EMainWindow::viewMenu
protected
EAction* EMainWindow::viewReloadAction
protected

The documentation for this class was generated from the following files: