20 #ifndef __WORKSPACE_H__ 21 #define __WORKSPACE_H__ 23 #include <unordered_map> 76 Workspace(
const QString& n,
const QString& p,
bool d,
bool r)
77 : _name(n), _path(p), _dirty(d), _readOnly(r) {}
80 void setPath(
const QString& s) { _path = s; }
82 void setName(
const QString& s) { _name = s; }
85 void rename(
const QString& s);
121 static void initWorkspaces();
125 static void refreshWorkspaces();
127 static QString makeUserWorkspacePath(
const QString& name);
128 static void readWorkspaceFile(
const QString&
path, std::function<
void(
XmlReader&)> readWorkspace);
129 static void retranslate(QList<Workspace*>& workspacesList);
130 static void retranslateAll();
133 for (
auto w : m_workspaces) {
134 if (w->name() ==
name)
141 for (
auto w : m_workspaces) {
142 if (w->translatableName() ==
name)
148 static void remove(
Workspace* workspace);
150 if (isWorkspacesListDirty || m_workspaces.isEmpty())
156 if (isWorkspacesListDirty || m_visibleWorkspaces.isEmpty())
158 return m_visibleWorkspaces;
165 static void initCurrentWorkspace();
166 static bool isDefaultWorkspace(
Workspace* workspace);
167 static bool isDefaultEditedWorkspace(
Workspace* workspace);
168 static QString defaultWorkspaceTranslatableName(
const QString& editedWorkspaceName);
170 static void clearWorkspaces();
static void addActionAndString(QAction *action, QString string)
Definition: workspace.cpp:1315
Definition: workspace.h:34
QString _sourceWorkspaceName
Definition: workspace.h:52
static std::vector< QString > defaultEditedWorkspaces
Definition: workspace.h:174
QString name() const
Definition: workspace.h:81
bool _dirty
Definition: workspace.h:54
static void writeMenuBar(XmlWriter &xml, QMenuBar *mb=0)
Definition: workspace.cpp:580
QString path() const
Definition: workspace.h:79
const QString & translatableName() const
Definition: workspace.h:83
bool getSaveMenuBar()
Definition: workspace.h:111
bool _readOnly
Definition: workspace.h:55
bool readOnly() const
Definition: workspace.h:92
static QAction * findActionFromString(QString string)
Definition: workspace.cpp:1361
void save()
Definition: workspace.cpp:1112
void setName(const QString &s)
Definition: workspace.h:82
Definition: workspace.h:119
bool saveComponents
Definition: workspace.h:59
static void writeGlobalToolBar()
Definition: workspace.cpp:490
Workspace()
Definition: workspace.cpp:306
QTimer _saveTimer
Definition: workspace.h:57
static Workspace * currentWorkspace()
Definition: workspace.h:162
void setPath(const QString &s)
Definition: workspace.h:80
static QList< QPair< QMenu *, QString > > menuToStringList
Definition: workspace.h:38
static void addRemainingFromMenu(QMenu *menu)
Definition: workspace.cpp:1344
void read()
Definition: workspace.cpp:670
static const QList< Workspace * > & workspaces()
Definition: workspace.h:149
void readMenu(XmlReader &e, QMenu *menu)
Definition: workspace.cpp:892
static bool isWorkspacesListDirty
Definition: workspace.h:180
static void writeMenu(XmlWriter &xml, QMenu *menu)
Definition: workspace.cpp:611
static Workspace * m_currentWorkspace
Definition: workspace.h:179
static void addRemainingFromMenuBar(QMenuBar *mb)
Definition: workspace.cpp:1327
static Workspace * findByName(const QString &name)
Definition: workspace.h:132
void setReadOnly(bool val)
Definition: workspace.h:93
void setSaveToolbars(bool s)
Definition: workspace.h:110
std::unique_ptr< PaletteTree > getPaletteTree() const
Definition: workspace.cpp:707
static const QList< Workspace * > & visibleWorkspaces()
Definition: workspace.h:155
static void setCurrentWorkspace(Workspace *currWorkspace)
Definition: workspace.h:163
void write()
Definition: workspace.cpp:341
static void writeGlobalGUIState()
Definition: workspace.cpp:540
static void addMenuAndString(QMenu *menu, QString string)
Definition: workspace.cpp:1387
void setSourceWorkspaceName(const QString &sourceWorkspaceName)
Definition: workspace.h:97
static QList< Workspace * > m_workspaces
Definition: workspace.h:177
bool dirty() const
Definition: workspace.h:86
void setSaveMenuBar(bool s)
Definition: workspace.h:112
static void writeGlobalMenuBar(QMenuBar *mb)
Definition: workspace.cpp:451
Definition: aeolus.cpp:26
QString _path
Definition: workspace.h:53
void setSaveComponents(bool s)
Definition: workspace.h:108
QString sourceWorkspaceName()
Definition: workspace.h:98
void readGlobalGUIState()
Definition: workspace.cpp:1035
Definition: xmlwriter.h:26
void ensureWorkspaceSaved()
Definition: workspace.cpp:1065
static QMenu * findMenuFromString(QString string)
Definition: workspace.cpp:1399
static QList< Workspace * > m_visibleWorkspaces
Definition: workspace.h:178
QString _name
Definition: workspace.h:50
Workspace(const QString &n, const QString &p, bool d, bool r)
Definition: workspace.h:76
static QList< QPair< QAction *, QString > > actionToStringList
Definition: workspace.h:37
Definition: xmlreader.h:28
void rename(const QString &s)
Definition: workspace.cpp:1425
QString _translatableName
Definition: workspace.h:51
const Workspace * sourceWorkspace() const
Definition: workspace.cpp:1249
static std::vector< QString > defaultWorkspaces
Definition: workspace.h:173
bool getSaveComponents()
Definition: workspace.h:107
bool saveToolbars
Definition: workspace.h:60
void setTranslatableName(QString trName)
Definition: workspace.h:84
void readGlobalMenuBar()
Definition: workspace.cpp:917
static QString findStringFromMenu(QMenu *menu)
Definition: workspace.cpp:1412
bool getSaveToolbars()
Definition: workspace.h:109
void reset()
Reset the workspace to the state of the source workspace.
Definition: workspace.cpp:697
void readGlobalToolBar()
Definition: workspace.cpp:971
static QString findStringFromAction(QAction *action)
Definition: workspace.cpp:1374
static Workspace * findByTranslatableName(const QString &name)
Definition: workspace.h:140
void setDirty()
Definition: workspace.h:72
bool saveMenuBar
Definition: workspace.h:61