Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
MultiDocInterface.h
Go to the documentation of this file.
1#pragma once
2
3#include <QObject>
4#include <QString>
5#include <QWidget>
6#include <ami/iface/global.h>
7
8namespace sf
9{
10
11// Forward declaration.
12class AppModuleInterface;
13
21{
22 Q_OBJECT
23
24 public:
25 /*
26 * Most signals from class QPlainTextEdit are implemented.
27 */
28 Q_SIGNAL void textChanged();
29 Q_SIGNAL void undoAvailable(bool b);
30 Q_SIGNAL void redoAvailable(bool b);
31 Q_SIGNAL void copyAvailable(bool b);
32 Q_SIGNAL void selectionChanged();
33 Q_SIGNAL void cursorPositionChanged();
34 Q_SIGNAL void modificationChanged(bool);
35};
36
41{
42 public:
54 virtual void setConnections(QWidget* editor);
55
59 virtual void newFile() = 0;
60
64 virtual bool loadFile(const QString& fileName) = 0;
65
69 virtual bool save() = 0;
70
74 virtual bool saveAs() = 0;
75
79 [[nodiscard]] virtual QString userFriendlyCurrentFile() const = 0;
80
84 [[nodiscard]] virtual QString currentFile() const = 0;
85
89 [[nodiscard]] virtual bool isModified() const = 0;
90
94 [[nodiscard]] virtual bool hasSelection() const = 0;
95
99 [[nodiscard]] virtual bool isUndoRedoEnabled() const = 0;
100
104 [[nodiscard]] virtual bool isUndoAvailable() const = 0;
105
109 [[nodiscard]] virtual bool isRedoAvailable() const = 0;
110
114 virtual void cut() = 0;
115
119 virtual void copy() = 0;
120
124 virtual void paste() = 0;
125
129 virtual void undo() = 0;
130
134 virtual void redo() = 0;
135
144 [[nodiscard]] virtual bool canClose() const;
145
149 [[nodiscard]] QString getFileTypeFilters() const;
150
154 virtual void stateSaveRestore(bool save);
155
159 void activate(bool);
160
170 virtual void develop();
171
172 private:
176 QWidget* _editor{nullptr};
180 const AppModuleInterface* _module{nullptr};
181
182 friend AppModuleInterface;
183};
184
185}// namespace sf
#define _AMI_CLASS
Definition ami/iface/global.h:35
Base/Interface class for application modules.
Definition AppModuleInterface.h:26
Class to connect signals to the clients of a document. Since the class sf::MultiDocInterface cannot i...
Definition MultiDocInterface.h:21
Q_SIGNAL void selectionChanged()
Q_SIGNAL void copyAvailable(bool b)
Q_SIGNAL void modificationChanged(bool)
Q_SIGNAL void redoAvailable(bool b)
Q_SIGNAL void cursorPositionChanged()
Q_SIGNAL void undoAvailable(bool b)
Interface for MDI document widgets handling files.
Definition MultiDocInterface.h:41
virtual QString currentFile() const =0
Pure virtual needs to be implemented.
virtual void develop()
Virtual function which is called during development only fro an action.
virtual bool isRedoAvailable() const =0
Pure virtual needs to be implemented.
virtual void stateSaveRestore(bool save)
Saves or restores the state of the MDI instance.
virtual void undo()=0
Pure virtual needs to be implemented.
virtual void redo()=0
Pure virtual needs to be implemented.
virtual void setConnections(QWidget *editor)
Sets the editor to operate on.
virtual void paste()=0
Pure virtual needs to be implemented.
virtual bool hasSelection() const =0
Pure virtual needs to be implemented.
virtual void newFile()=0
Pure virtual needs to be implemented.
MultiDocInterface()
Default constructor.
void activate(bool)
Called by application when this document is activated deactivated.
virtual bool save()=0
Pure virtual needs to be implemented.
virtual bool isModified() const =0
Pure virtual needs to be implemented.
virtual bool loadFile(const QString &fileName)=0
Pure virtual needs to be implemented.
virtual void cut()=0
Pure virtual needs to be implemented.
virtual QString userFriendlyCurrentFile() const =0
Pure virtual needs to be implemented.
virtual bool isUndoAvailable() const =0
Pure virtual needs to be implemented.
virtual bool isUndoRedoEnabled() const =0
Pure virtual needs to be implemented.
virtual void copy()=0
Pure virtual needs to be implemented.
MultiDocInterfaceSignals mdiSignals
Instance to connect signal handlers onto.
Definition MultiDocInterface.h:164
virtual bool saveAs()=0
Pure virtual needs to be implemented.
virtual bool canClose() const
When the document is modified this function shows a message box with 3 options to save or not or to c...
QString getFileTypeFilters() const
Definition Application.h:10