Virtual initialize() method added to application classes in order to enable customization of base app behavior in derived classes.
Example: access from modules auto-loaded by CAM_Application to standard GUI actions created by STD_Application.
It is no longer necessary to redefine start() method, redefining initialize() is a prefereed way to customize application start-up.
}
/*!
- \brief Start an application.
+ \brief Initializes an application.
Load all modules, if "auto loading" flag has been set to \c true.
\sa CAM_Application()
*/
-void CAM_Application::start()
+void CAM_Application::initialize()
{
+ STD_Application::initialize();
+
if ( myAutoLoad )
loadModules();
-
- STD_Application::start();
}
/*!
CAM_Application( const bool = true );
virtual ~CAM_Application();
- virtual void start();
-
CAM_Module* activeModule() const;
CAM_Module* module( const QString& ) const;
virtual void createEmptyStudy();
protected:
+ virtual void initialize();
virtual SUIT_Study* createNewStudy();
virtual void updateCommandsStatus();
return QString( "StdApplication" );
}
-/*!Start STD_Application*/
-void STD_Application::start()
+/*!Prepare STD_Application*/
+void STD_Application::initialize()
{
+ SUIT_Application::initialize();
+
createActions();
updateDesktopTitle();
setEditEnabled( myEditEnabled );
loadPreferences();
+}
+/*!Start STD_Application*/
+void STD_Application::start()
+{
+ // san: Need this simple implementation, as some applications
+ // call STD_Application::start() explicitly
+ // so we need to provide at least some implementation at this level
+ // to avoid link errors
SUIT_Application::start();
}
enum { CloseCancel, CloseSave, CloseDiscard };
protected:
+ virtual void initialize();
virtual void createActions();
virtual void updateCommandsStatus();
*/
void SUIT_Application::start()
{
+ initialize();
+
if ( desktop() )
desktop()->show();
}
+/*!
+ Prepares the contents of the application's main widget, does nothing by default.
+*/
+void SUIT_Application::initialize()
+{
+}
+
/*!
Opens document into active Study. If Study is empty - creates it.
\param theFileName - name of document file
//! Creates a new Study instance. Must be redefined in new application according to its Study type.
virtual SUIT_Study* createNewStudy();
virtual void setActiveStudy( SUIT_Study* );
+
+ //! Prepares the contents of the application's main widget, does nothing by default.
+ virtual void initialize();
/** @name Create tool functions*/ //@{
int createTool( const QString& );