forked from FredTingaud/FSM-Editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSettings.h
74 lines (63 loc) · 2.11 KB
/
Settings.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#pragma once
#include <QString>
class FSMReader;
class FSMWriter;
class QTextDocument;
/**
* @brief Override to customize the editor.
*
* This class passes the code generator and other parameters that make sense for
* developer embedding the editor.
* Default values are provided everywhere it makes sense.
*/
class Settings
{
public:
/**
* @return The writer used to save the FSM chart.
*/
virtual FSMWriter& getWriter() = 0;
/**
* @return The reader used to load files written by the FSMWriter.
*/
virtual FSMReader& getReader() = 0;
/**
* We use a QTextEdit to edit code. It can display code with syntax highlighting.
*/
virtual void initializeCodeHighlighter(QTextDocument* document);
/**
* @return the file extension used for chart files. @Default is "fsm".
*/
virtual QString getExportExtension() const;
/**
* @return the organization name used to store data in registry between sessions.
*/
virtual QString getOrganizationName() const;
/**
* @return the application name used to store data in registry between sessions.
*/
virtual QString getApplicationName() const;
/**
* Validates whether the new state name is correctly formed for export.
* @return the error message if any. Empty string for no error.
* @Default accepts everything.
*/
virtual QString validateStateName(const QString& name);
/**
* Validates whether the code of an element is correctly formed for export.
* @return the error message if any. Empty string for no error.
* @Default validates whether the number of opening and closing curly braces are equal.
*/
virtual QString validateCode(const QString& valid);
/**
* @return whether the top level menu is visible.
* It could make sense to hide it when the editor is embedded.
*/
virtual bool showMenu();
/**
* @return Whether the "New", "Open" and "Save" actions are accessible.
* When the editor is embedded, it can be convenient to hide them and drive
* open/save at a higher level.
*/
virtual bool showFileActions();
};