3#include <QAbstractItemModel>
33 explicit Parameters(QSettings* settings, QObject* parent)
61 static void instantiate(QSettings* settings, QObject* parent);
108 typedef QMap<QString, AppModuleInterface*>
Map;
124 [[nodiscard]]
virtual QString
getName()
const = 0;
250 [[nodiscard]]
static QAbstractItemModel*
getListModel(
bool file_only, QObject* parent);
304 QSettings* _settings;
308 QList<AppModuleFileType> _fileTypes;
#define SF_DECL_IFACE(InterfaceType, ParamType, FuncName)
Declares a public static function in the class where it is used. Where: InterfaceType: Global typenam...
Definition TClassRegistration.h:71
#define _AMI_CLASS
Definition ami/iface/global.h:35
Base/Interface class for application modules.
Definition AppModuleInterface.h:26
virtual QString getName() const =0
Gets the description of this instance.
bool hasFileTypes() const
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.
AppModuleInterface(const Parameters &)
Constructor for passing general structure for derived classes.
MultiDocInterface * createChild(QWidget *parent) const
Calls createChild() and assigns this creating instance for reference.
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.
virtual QString getDescription() const =0
Gets the description of this instance.
virtual MultiDocInterface * createWidget(QWidget *parent) const
Creates child of the passed parent (i.e. QMdiArea).
MultiDocInterface * openFile(const QString &filename, AppModuleInterface *ami=nullptr) const
Makes the application open a file.
virtual DockWidgetList createDockingWidgets(QWidget *parent)
Creates docking widgets having the passed parent.
TClosure< MultiDocInterface *, const QString &, AppModuleInterface * > OpenFileClosure
Type definition for the callback closure.
Definition AppModuleInterface.h:285
QString getFileTypeFilters() const
Gets the filter string for a file dialog.
static QString getFileTypeFilters(bool all_files)
Gets the filter string for the open file dialog.
QMap< QString, AppModuleInterface * > Map
Definition AppModuleInterface.h:108
void addFileType(const QString &name, const QString &suffix)
Adds a file type handled by this instance.
InitializeStage
Definition AppModuleInterface.h:67
@ Initialize
Definition AppModuleInterface.h:71
@ Finalize
Definition AppModuleInterface.h:73
static size_t initializeInstances(InitializeStage stage)
Initializes all uninitialized instances or visa versa.
~AppModuleInterface() override
Virtual destructor for derived classes.
static AppModuleInterface * findByFile(const QString &filename)
Find the instance handling the file using the file suffix.
QSettings * getSettings() const
Gets the settings class passed on creation.
void addFileType(const QString &mime)
Adds a file type handled by this instance.
static OpenFileClosure callbackOpenFile
Holds a callback to open a file in the application.
Definition AppModuleInterface.h:289
static DockWidgetList createAllDockingWidgets(QWidget *parent)
Creates all docking widgets of the loaded modules by calling createDockingWidgets().
virtual void documentActivated(MultiDocInterface *iface, bool yn) const
Called from main window when a document is activated or deactivated.
virtual void addPropertyPages(PropertySheetDialog *sheet)=0
Adds module property pages to the passed sheet.
static const Map & getMap()
Gets the named module map.
virtual void initialize(InitializeStage stage)=0
Called when al modules are loaded or when a module added.
MenuType
Definition AppModuleInterface.h:92
@ View
Definition AppModuleInterface.h:94
@ Settings
Definition AppModuleInterface.h:93
virtual void addToolBars(QMainWindow *mainWindow)
Adds toolbars to the passed main window.
virtual void addMenuItems(MenuType menuType, QMenu *menu)
Adds menu items for the passed type of menu.
void addFileType(const QMimeType &mime)
Adds a file type using the passed QMimeType instance.
QList< QDockWidget * > DockWidgetList
Type definition for containing dock widgets.
Definition AppModuleInterface.h:154
static QAbstractItemModel * getListModel(bool file_only, QObject *parent)
Gets a list model from the available instances.
static AppModuleInterface * selectDialog(const QString &title, QSettings *settings, QWidget *parent=nullptr)
Determined if this module handles this mime type.
static void instantiate(QSettings *settings, QObject *parent)
Creates instances of all available/loaded interface implementations.
static void addAllToolBars(QMainWindow *mainWindow)
Creates all toolbars of the loaded modules by calling addToolBars().
Interface for MDI document widgets handling files.
Definition MultiDocInterface.h:41
Dialog containing multiple property pages.
Definition qt/PropertySheetDialog.h:14
Encapsulates the std::function() template.
Definition TClosure.h:14
Definition Application.h:10
Structure for passing parameters to derived classes loaded and created at run-time.
Definition AppModuleInterface.h:32
QObject * _parent
Parent object.
Definition AppModuleInterface.h:45
Parameters(QSettings *settings, QObject *parent)
Definition AppModuleInterface.h:33
QSettings * _settings
Settings of application.
Definition AppModuleInterface.h:41