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 deprecation
10 
11 #include <QList>
12 #include <QMap>
13 #include <QObject>
14 #include <QPointer>
15 #include <QString>
16 
17 class QAction;
18 
19 class PQPYTHON_EXPORT pqPythonMacroSupervisor : public QObject
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 
86  static QStringList getMacrosFilePaths();
87 
88  static QStringList getSupportedIconFormats()
89  {
90  return QStringList() << ".svg"
91  << ".png";
92  }
93 
94 Q_SIGNALS:
95 
99  void executeScriptRequested(const QString& fileName);
100 
104  void onAddedMacro();
105 
109  void onEditMacro(const QString& fileName);
110 
111 public Q_SLOTS:
112 
118  void addMacro(const QString& macroName, const QString& fileName);
119  void addMacro(const QString& fileName);
120 
127  void removeMacro(const QString& fileName);
128 
132  void updateMacroList();
133 
134 protected Q_SLOTS:
135 
140  void onMacroTriggered();
141 
146  void onDeleteMacroTriggered();
147 
152  void onEditMacroTriggered();
153 
154 protected: // NOLINT(readability-redundant-access-specifiers)
160  void addWidgetForMacros(QWidget* widget, int actionType); // 0:run, 1:edit, 2:delete
161 
165  void resetActions();
166 
167 private:
168  class pqInternal;
169  pqInternal* Internal;
170 };
171 
172 #endif // ifndef pqPythonMacroSupervisor_h
pqPythonMacroSupervisor
Definition: pqPythonMacroSupervisor.h:19
pqPythonMacroSupervisor::getSupportedIconFormats
static QStringList getSupportedIconFormats()
Definition: pqPythonMacroSupervisor.h:88
vtkParaViewDeprecation.h
PARAVIEW_DEPRECATED_IN_5_12_0
#define PARAVIEW_DEPRECATED_IN_5_12_0(reason)
Definition: vtkParaViewDeprecation.h:100