Scanframe Modular Application 0.1.0
|
Base/Interface class for application modules. More...
#include <AppModuleInterface.h>
Classes | |
struct | Parameters |
Structure for passing parameters to derived classes loaded and created at run-time. More... | |
Public Types | |
enum | InitializeStage { Uninitialize = 0 , Initialize , Finalize } |
enum | MenuType { Settings , View , Tools } |
typedef QMap< QString, AppModuleInterface * > | Map |
typedef QList< QDockWidget * > | DockWidgetList |
Type definition for containing dock widgets. | |
typedef TClosure< MultiDocInterface *, const QString &, AppModuleInterface * > | OpenFileClosure |
Type definition for the callback closure. | |
Public Member Functions | |
AppModuleInterface (const Parameters &) | |
Constructor for passing general structure for derived classes. | |
~AppModuleInterface () override | |
Virtual destructor for derived classes. | |
virtual void | initialize (InitializeStage stage)=0 |
Called when al modules are loaded or when a module added. | |
virtual QString | getName () const =0 |
Gets the description of this instance. | |
virtual QString | getDescription () const =0 |
Gets the description of this instance. | |
virtual QString | getLibraryFilename () const =0 |
Gets the library filename. | |
virtual QString | getSvgIconResource () const |
Gets svg icon resource name and can be overridden to change the default. | |
virtual void | addPropertyPages (PropertySheetDialog *sheet)=0 |
Adds module property pages to the passed sheet. | |
virtual void | addMenuItems (MenuType menuType, QMenu *menu) |
Adds menu items for the passed type of menu. | |
virtual DockWidgetList | createDockingWidgets (QWidget *parent) |
Creates docking widgets having the passed parent. | |
virtual void | addToolBars (QMainWindow *mainWindow) |
Adds toolbars to the passed main window. | |
bool | hasFileTypes () const |
void | addFileType (const QString &name, const QString &suffix) |
Adds a file type handled by this instance. | |
void | addFileType (const QString &mime) |
Adds a file type handled by this instance. | |
void | addFileType (const QMimeType &mime) |
Adds a file type using the passed QMimeType instance. | |
QString | getFileTypeFilters () const |
Gets the filter string for a file dialog. | |
MultiDocInterface * | createChild (QWidget *parent) const |
Calls createChild() and assigns this creating instance for reference. | |
QSettings * | getSettings () const |
Gets the settings class passed on creation. | |
MultiDocInterface * | openFile (const QString &filename, AppModuleInterface *ami=nullptr) const |
Makes the application open a file. | |
virtual void | documentActivated (MultiDocInterface *iface, bool yn) const |
Called from main window when a document is activated or deactivated. | |
Static Public Member Functions | |
static void | instantiate (QSettings *settings, QObject *parent) |
Creates instances of all available/loaded interface implementations. | |
static size_t | initializeInstances (InitializeStage stage) |
Initializes all uninitialized instances or visa versa. | |
static void | addAllPropertyPages (PropertySheetDialog *sheet) |
Adds property pages from all modules to the passed sheet. | |
static void | addAllMenuItems (MenuType menuType, QMenu *menu) |
Adds items from all modules to this menu. | |
static const Map & | getMap () |
Gets the named module map. | |
static DockWidgetList | createAllDockingWidgets (QWidget *parent) |
Creates all docking widgets of the loaded modules by calling createDockingWidgets(). | |
static void | addAllToolBars (QMainWindow *mainWindow) |
Creates all toolbars of the loaded modules by calling addToolBars(). | |
static AppModuleInterface * | findByFile (const QString &filename) |
Find the instance handling the file using the file suffix. | |
static QString | getFileTypeFilters (bool all_files) |
Gets the filter string for the open file dialog. | |
static AppModuleInterface * | selectDialog (const QString &title, QSettings *settings, QWidget *parent=nullptr) |
Determined if this module handles this mime type. | |
static QAbstractItemModel * | getListModel (bool file_only, QObject *parent) |
Gets a list model from the available instances. | |
Static Public Attributes | |
static OpenFileClosure | callbackOpenFile |
Holds a callback to open a file in the application. | |
Protected Member Functions | |
virtual MultiDocInterface * | createWidget (QWidget *parent) const |
Creates child of the passed parent (i.e. QMdiArea). | |
Base/Interface class for application modules.
This class should provide functionality for loading libraries dynamically and creating implementations
typedef QList<QDockWidget*> sf::AppModuleInterface::DockWidgetList |
Type definition for containing dock widgets.
typedef QMap<QString, AppModuleInterface*> sf::AppModuleInterface::Map |
Map type for the application modules to their names.
typedef TClosure<MultiDocInterface*, const QString&, AppModuleInterface*> sf::AppModuleInterface::OpenFileClosure |
Type definition for the callback closure.
|
explicit |
Constructor for passing general structure for derived classes.
|
override |
Virtual destructor for derived classes.
|
static |
Adds items from all modules to this menu.
menuType | Type of menu items to add. |
menu | Menu to add the actions/menus to. |
|
static |
Adds property pages from all modules to the passed sheet.
|
static |
Creates all toolbars of the loaded modules by calling addToolBars().
void sf::AppModuleInterface::addFileType | ( | const QMimeType & | mime | ) |
Adds a file type using the passed QMimeType instance.
mime | Mime as a string like 'text/plain'. |
void sf::AppModuleInterface::addFileType | ( | const QString & | mime | ) |
Adds a file type handled by this instance.
mime | Mime as a string like 'text/plain'. |
void sf::AppModuleInterface::addFileType | ( | const QString & | name, |
const QString & | suffix | ||
) |
Adds a file type handled by this instance.
name | Name of this file type. |
suffix | File suffix like 'txt' |
|
virtual |
Adds menu items for the passed type of menu.
Reimplemented in sf::ProjectAppModule.
|
pure virtual |
Adds module property pages to the passed sheet.
Implemented in sf::CodeEditorAppModule, sf::TextEditorAppModule, sf::LayoutEditorAppModule, sf::ProjectAppModule, sf::ScriptAppModule, sf::ServiceAppModule, and sf::UnitConversionAppModule.
|
virtual |
Adds toolbars to the passed main window.
Reimplemented in sf::ProjectAppModule.
|
static |
Creates all docking widgets of the loaded modules by calling createDockingWidgets().
MultiDocInterface * sf::AppModuleInterface::createChild | ( | QWidget * | parent | ) | const |
Calls createChild() and assigns this creating instance for reference.
parent | Parent and owner of the new child. |
|
virtual |
Creates docking widgets having the passed parent.
Reimplemented in sf::LayoutEditorAppModule.
|
protectedvirtual |
Creates child of the passed parent (i.e. QMdiArea).
parent | Parent widget of the returned object. |
Reimplemented in sf::CodeEditorAppModule, sf::TextEditorAppModule, sf::LayoutEditorAppModule, and sf::ScriptAppModule.
|
virtual |
Called from main window when a document is activated or deactivated.
iface | MDI interface which can be dynamically cast to the actual document. |
yn |
Reimplemented in sf::LayoutEditorAppModule.
|
static |
Find the instance handling the file using the file suffix.
|
pure virtual |
Gets the description of this instance.
Implemented in sf::CodeEditorAppModule, sf::TextEditorAppModule, sf::LayoutEditorAppModule, sf::ProjectAppModule, sf::ScriptAppModule, sf::ServiceAppModule, and sf::UnitConversionAppModule.
QString sf::AppModuleInterface::getFileTypeFilters | ( | ) | const |
Gets the filter string for a file dialog.
The order of creation using addFileType determines which of the duplicate entries get into open file dialog filter list. Duplicates can appear when an entry is created using a mime type.
|
static |
Gets the filter string for the open file dialog.
The order of creation using addFileType determines which of the duplicate entries get into open file dialog filter list. Duplicates can appear when an entry is created using a mime type.
|
pure virtual |
Gets the library filename.
Implemented in sf::CodeEditorAppModule, sf::TextEditorAppModule, sf::LayoutEditorAppModule, sf::ProjectAppModule, sf::ScriptAppModule, sf::ServiceAppModule, and sf::UnitConversionAppModule.
|
static |
Gets a list model from the available instances.
file_only | True when only Modules handling files are to listed. |
parent | Owning object. |
|
static |
Gets the named module map.
|
pure virtual |
Gets the description of this instance.
Implemented in sf::CodeEditorAppModule, sf::TextEditorAppModule, sf::LayoutEditorAppModule, sf::ProjectAppModule, sf::ScriptAppModule, sf::ServiceAppModule, and sf::UnitConversionAppModule.
QSettings * sf::AppModuleInterface::getSettings | ( | ) | const |
Gets the settings class passed on creation.
|
virtual |
Gets svg icon resource name and can be overridden to change the default.
Reimplemented in sf::CodeEditorAppModule, sf::TextEditorAppModule, sf::LayoutEditorAppModule, sf::ProjectAppModule, sf::ScriptAppModule, sf::ServiceAppModule, and sf::UnitConversionAppModule.
bool sf::AppModuleInterface::hasFileTypes | ( | ) | const |
Gets if the instance has file handling types.
|
pure virtual |
Called when al modules are loaded or when a module added.
stage | Determines initialization or uninitialization. |
Implemented in sf::CodeEditorAppModule, sf::TextEditorAppModule, sf::LayoutEditorAppModule, sf::ProjectAppModule, sf::ScriptAppModule, sf::ServiceAppModule, and sf::UnitConversionAppModule.
|
static |
Initializes all uninitialized instances or visa versa.
stage | Determines what is done. |
|
static |
Creates instances of all available/loaded interface implementations.
MultiDocInterface * sf::AppModuleInterface::openFile | ( | const QString & | filename, |
AppModuleInterface * | ami = nullptr |
||
) | const |
Makes the application open a file.
filename | Name of file to open. |
ami | Force file, even when empty to open using this module. |
|
static |
Determined if this module handles this mime type.
|
static |
Holds a callback to open a file in the application.