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 "vtkParaViewDeprecation.h" // for PARAVIEW_DEPRECATED_IN_5_12_0
10 
11 #include <QList>
12 #include <QMap>
13 #include <QObject>
14 #include <QPointer>
15 #include <QString>
16 
17 class QAction;
18 
20 {
21  Q_OBJECT
22 public:
23  pqPythonMacroSupervisor(QObject* p = nullptr);
24  ~pqPythonMacroSupervisor() override;
25 
31  void addWidgetForRunMacros(QWidget* widget);
32 
38  void addWidgetForEditMacros(QWidget* widget);
39 
45  void addWidgetForDeleteMacros(QWidget* widget);
46 
51  QAction* getMacro(const QString& fileName);
52 
57  static QMap<QString, QString> getStoredMacros();
58 
63  PARAVIEW_DEPRECATED_IN_5_12_0("Use hideFile instead.")
64  static void removeStoredMacro(const QString& fileName);
65 
70  static void hideFile(const QString& fileName);
71 
75  static QString macroNameFromFileName(const QString& fileName);
76 
77  static void setNameForMacro(const QString& macroPath, const QString& name);
78 
82  static QString macroToolTipFromFileName(const QString& fileName);
83 
84  static void setTooltipForMacro(const QString& macroPath, const QString& name);
85 
90  static QString iconPathFromFileName(const QString& fileName);
91 
92  static void setIconForMacro(const QString& macroPath, const QString& iconPath);
93 
97  static QStringList getMacrosFilePaths();
98 
99  PARAVIEW_DEPRECATED_IN_5_12_0("User pqIconListModel::getSupportedIconFormats instead.")
100  static QStringList getSupportedIconFormats();
101 
102 Q_SIGNALS:
103 
107  void executeScriptRequested(const QString& fileName);
108 
112  void onAddedMacro();
113 
117  void onEditMacro(const QString& fileName);
118 
119 public Q_SLOTS:
120 
126  void addMacro(const QString& macroName, const QString& tip, const QString& fileName);
127  void addMacro(const QString& macroName, const QString& fileName);
128  void addMacro(const QString& fileName);
129 
136  void removeMacro(const QString& fileName);
137 
141  void updateMacroList();
142 
143 protected Q_SLOTS:
144 
149  void onMacroTriggered();
150 
155  void onDeleteMacroTriggered();
156 
161  void onEditMacroTriggered();
162 
163 protected: // NOLINT(readability-redundant-access-specifiers)
169  void addWidgetForMacros(QWidget* widget, int actionType); // 0:run, 1:edit, 2:delete
170 
174  void resetActions();
175 
176 private:
177  class pqInternal;
178  pqInternal* Internal;
179 };
180 
181 #endif // ifndef pqPythonMacroSupervisor_h
#define PARAVIEW_DEPRECATED_IN_5_12_0(reason)
#define PQPYTHON_EXPORT
name