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 
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  PARAVIEW_DEPRECATED_IN_5_12_0("User pqIconListModel::getSupportedIconFormats instead.")
91  static QStringList getSupportedIconFormats();
92 
93 Q_SIGNALS:
94 
98  void executeScriptRequested(const QString& fileName);
99 
103  void onAddedMacro();
104 
108  void onEditMacro(const QString& fileName);
109 
110 public Q_SLOTS:
111 
117  void addMacro(const QString& macroName, const QString& fileName);
118  void addMacro(const QString& fileName);
119 
126  void removeMacro(const QString& fileName);
127 
131  void updateMacroList();
132 
133 protected Q_SLOTS:
134 
139  void onMacroTriggered();
140 
145  void onDeleteMacroTriggered();
146 
151  void onEditMacroTriggered();
152 
153 protected: // NOLINT(readability-redundant-access-specifiers)
159  void addWidgetForMacros(QWidget* widget, int actionType); // 0:run, 1:edit, 2:delete
160 
164  void resetActions();
165 
166 private:
167  class pqInternal;
168  pqInternal* Internal;
169 };
170 
171 #endif // ifndef pqPythonMacroSupervisor_h
#define PARAVIEW_DEPRECATED_IN_5_12_0(reason)
#define PQPYTHON_EXPORT