Medical Imaging Interaction Toolkit  2023.12.99-63768887
Medical Imaging Interaction Toolkit
QmitkPythonSnippets.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef QmitkPythonSnippets_h
14 #define QmitkPythonSnippets_h
15 
16 #include <QWidget>
17 #include <QMap>
18 #include <MitkQtPythonExports.h>
19 struct QmitkPythonSnippetsData;
20 
23 class MITKQTPYTHON_EXPORT QmitkPythonSnippets: public QWidget
24 {
25  Q_OBJECT
26 
27  public:
28  static const QString DEFAULT_SNIPPET_FILE;
29  static const QString SNIPPETS_ROOT_XML_ELEMENT_NAME;
30  static const QString SNIPPETS_XML_ELEMENT_NAME;
33  typedef QMap<QString, QString> QStringMap;
38  QmitkPythonSnippets( const QString& _AutoSaveFileName="", QWidget* parent=nullptr );
41  ~QmitkPythonSnippets() override;
44  static bool LoadStringMap( const QString& filename, QStringMap& oldMap );
45 
46 signals:
49  void PasteCommandRequested(const QString& command);
50 
51  protected slots:
54  void on_PasteSnippet_triggered( bool checked = false );
57  void on_RenameSnippet_triggered( bool checked = false );
60  void on_AddSnippet_triggered( bool checked = false );
63  void on_RemoveSnippet_triggered( bool checked = false );
66  void on_RestoreDefaultSnippets_triggered( bool checked = false );
69  void on_Name_currentIndexChanged( int i );
72  void on_Content_textChanged();
75  void on_SaveSnippets_triggered( bool checked = false );
78  void on_LoadSnippets_triggered( bool checked = false );
79 
80  protected:
83  void SaveStringMap( const QString& filename, const QStringMap& map ) const;
86  QString CreateUniqueName(const QString &name) const;
90  void Update(const QString &name = "");
91  private:
94  QmitkPythonSnippetsData* d;
95 };
96 
97 
98 
99 
100 #endif
QmitkPythonSnippets
a widget that holds snippets and serializes the snippets to a certain places
Definition: QmitkPythonSnippets.h:23
QmitkPythonSnippets::QStringMap
QMap< QString, QString > QStringMap
typedef for string map
Definition: QmitkPythonSnippets.h:33
QmitkPythonSnippets::SNIPPETS_XML_ELEMENT_NAME
static const QString SNIPPETS_XML_ELEMENT_NAME
Definition: QmitkPythonSnippets.h:30
map
Definition: mitkFastSymmetricForcesDemonsMultiResDefaultRegistrationAlgorithm_ProfileResource.h:26
QmitkPythonSnippets::DEFAULT_SNIPPET_FILE
static const QString DEFAULT_SNIPPET_FILE
Definition: QmitkPythonSnippets.h:28
QmitkPythonSnippets::SNIPPETS_ROOT_XML_ELEMENT_NAME
static const QString SNIPPETS_ROOT_XML_ELEMENT_NAME
Definition: QmitkPythonSnippets.h:29