pqPythonMacroSupervisor.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 #ifndef pqPythonMacroSupervisor_h
5 #define pqPythonMacroSupervisor_h
6 
7 #include "pqPythonModule.h"
8 
9 #include <QList>
10 #include <QMap>
11 #include <QObject>
12 #include <QPointer>
13 #include <QString>
14 
15 class QAction;
16 
18 {
19  Q_OBJECT
20 public:
21  pqPythonMacroSupervisor(QObject* p = nullptr);
22  ~pqPythonMacroSupervisor() override;
23 
29  void addWidgetForRunMacros(QWidget* widget);
30 
36  void addWidgetForEditMacros(QWidget* widget);
37 
43  void addWidgetForDeleteMacros(QWidget* widget);
44 
49  QAction* getMacro(const QString& fileName);
50 
55  static QMap<QString, QString> getStoredMacros();
56 
61  static void hideFile(const QString& fileName);
62 
66  static QString macroNameFromFileName(const QString& fileName);
67 
68  static void setNameForMacro(const QString& macroPath, const QString& name);
69 
73  static QString macroToolTipFromFileName(const QString& fileName);
74 
75  static void setTooltipForMacro(const QString& macroPath, const QString& name);
76 
81  static QString iconPathFromFileName(const QString& fileName);
82 
83  static void setIconForMacro(const QString& macroPath, const QString& iconPath);
84 
88  static QStringList getMacrosFilePaths();
89 
90 Q_SIGNALS:
91 
95  void executeScriptRequested(const QString& fileName);
96 
100  void onAddedMacro();
101 
105  void onEditMacro(const QString& fileName);
106 
107 public Q_SLOTS:
108 
114  void addMacro(const QString& macroName, const QString& tip, const QString& fileName);
115  void addMacro(const QString& macroName, const QString& fileName);
116  void addMacro(const QString& fileName);
117 
124  void removeMacro(const QString& fileName);
125 
129  void updateMacroList();
130 
131 protected Q_SLOTS:
132 
137  void onMacroTriggered();
138 
143  void onDeleteMacroTriggered();
144 
149  void onEditMacroTriggered();
150 
151 protected: // NOLINT(readability-redundant-access-specifiers)
157  void addWidgetForMacros(QWidget* widget, int actionType); // 0:run, 1:edit, 2:delete
158 
162  void resetActions();
163 
164 private:
165  class pqInternal;
166  pqInternal* Internal;
167 };
168 
169 #endif // ifndef pqPythonMacroSupervisor_h
#define PQPYTHON_EXPORT
name