Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkPythonSnippets Class Reference

a widget that holds snippets and serializes the snippets to a certain places More...

#include <QmitkPythonSnippets.h>

Inheritance diagram for QmitkPythonSnippets:
Collaboration diagram for QmitkPythonSnippets:

Public Types

typedef QMap< QString, QString > QStringMap
 typedef for string map More...
 

Signals

void PasteCommandRequested (const QString &command)
 this class whishes to paste sth command More...
 

Public Member Functions

 QmitkPythonSnippets (const QString &_AutoSaveFileName="", QWidget *parent=0)
 
virtual ~QmitkPythonSnippets ()
 delete d pointer More...
 

Static Public Member Functions

static bool LoadStringMap (const QString &filename, QStringMap &oldMap)
 read string map from xml file More...
 

Static Public Attributes

static const QString DEFAULT_SNIPPET_FILE
 
static const QString SNIPPETS_ROOT_XML_ELEMENT_NAME
 
static const QString SNIPPETS_XML_ELEMENT_NAME
 

Protected Slots

void on_PasteSnippet_triggered (bool checked=false)
 emits PasteCommandRequested signal More...
 
void on_RenameSnippet_triggered (bool checked=false)
 ask for name as long as it exists, call update() More...
 
void on_AddSnippet_triggered (bool checked=false)
 ask for name, create snippet, call update() More...
 
void on_RemoveSnippet_triggered (bool checked=false)
 remove the current snippet, call update() More...
 
void on_RestoreDefaultSnippets_triggered (bool checked=false)
 call LoadStringMap with d->m_DefaultSnippetsAutoSaveFileName More...
 
void on_Name_currentIndexChanged (int i)
 update action state (enable/disable), update text box More...
 
void on_Content_textChanged ()
 save changed snippet More...
 
void on_SaveSnippets_triggered (bool checked=false)
 ask for file, save snippets More...
 
void on_LoadSnippets_triggered (bool checked=false)
 ask for file, load snippets (do not replace) More...
 

Protected Member Functions

void SaveStringMap (const QString &filename, const QStringMap &map) const
 write string map to xml file More...
 
QString CreateUniqueName (const QString &name) const
 creates a name which does not exist in the list More...
 
void Update (const QString &name="")
 

Detailed Description

a widget that holds snippets and serializes the snippets to a certain places

Definition at line 27 of file QmitkPythonSnippets.h.

Member Typedef Documentation

typedef QMap<QString, QString> QmitkPythonSnippets::QStringMap

typedef for string map

Definition at line 37 of file QmitkPythonSnippets.h.

Constructor & Destructor Documentation

QmitkPythonSnippets::QmitkPythonSnippets ( const QString &  _AutoSaveFileName = "",
QWidget *  parent = 0 
)

build ui here the snippets will be loaded from _AutoSaveFileName if not empty and readable otherwise the default snippets will be loaded

Definition at line 64 of file QmitkPythonSnippets.cpp.

References DEFAULT_SNIPPET_FILE, LoadStringMap(), and Update().

QmitkPythonSnippets::~QmitkPythonSnippets ( )
virtual

delete d pointer

Definition at line 159 of file QmitkPythonSnippets.cpp.

Member Function Documentation

QString QmitkPythonSnippets::CreateUniqueName ( const QString &  name) const
protected

creates a name which does not exist in the list

Definition at line 231 of file QmitkPythonSnippets.cpp.

Referenced by on_AddSnippet_triggered().

bool QmitkPythonSnippets::LoadStringMap ( const QString &  filename,
QmitkPythonSnippets::QStringMap oldMap 
)
static
void QmitkPythonSnippets::on_AddSnippet_triggered ( bool  checked = false)
protectedslot

ask for name, create snippet, call update()

Definition at line 210 of file QmitkPythonSnippets.cpp.

References CreateUniqueName(), MITK_DEBUG, SaveStringMap(), and Update().

void QmitkPythonSnippets::on_Content_textChanged ( )
protectedslot

save changed snippet

Definition at line 451 of file QmitkPythonSnippets.cpp.

References MITK_DEBUG, and SaveStringMap().

void QmitkPythonSnippets::on_LoadSnippets_triggered ( bool  checked = false)
protectedslot

ask for file, load snippets (do not replace)

Definition at line 474 of file QmitkPythonSnippets.cpp.

References LoadStringMap(), SaveStringMap(), and Update().

void QmitkPythonSnippets::on_Name_currentIndexChanged ( int  i)
protectedslot

update action state (enable/disable), update text box

Definition at line 278 of file QmitkPythonSnippets.cpp.

References MITK_DEBUG.

void QmitkPythonSnippets::on_PasteSnippet_triggered ( bool  checked = false)
protectedslot

emits PasteCommandRequested signal

Definition at line 164 of file QmitkPythonSnippets.cpp.

References PasteCommandRequested().

void QmitkPythonSnippets::on_RemoveSnippet_triggered ( bool  checked = false)
protectedslot

remove the current snippet, call update()

Definition at line 244 of file QmitkPythonSnippets.cpp.

References SaveStringMap(), and Update().

void QmitkPythonSnippets::on_RenameSnippet_triggered ( bool  checked = false)
protectedslot

ask for name as long as it exists, call update()

Definition at line 169 of file QmitkPythonSnippets.cpp.

References SaveStringMap(), and Update().

void QmitkPythonSnippets::on_RestoreDefaultSnippets_triggered ( bool  checked = false)
protectedslot

call LoadStringMap with d->m_DefaultSnippetsAutoSaveFileName

Definition at line 262 of file QmitkPythonSnippets.cpp.

References DEFAULT_SNIPPET_FILE, LoadStringMap(), SaveStringMap(), and Update().

void QmitkPythonSnippets::on_SaveSnippets_triggered ( bool  checked = false)
protectedslot

ask for file, save snippets

Definition at line 464 of file QmitkPythonSnippets.cpp.

References SaveStringMap().

void QmitkPythonSnippets::PasteCommandRequested ( const QString &  command)
signal

this class whishes to paste sth command

Referenced by on_PasteSnippet_triggered().

void QmitkPythonSnippets::SaveStringMap ( const QString &  filename,
const QStringMap map 
) const
protected
void QmitkPythonSnippets::Update ( const QString &  name = "")
protected

update combo box if name is passed, the according element will be selected

Definition at line 427 of file QmitkPythonSnippets.cpp.

References MITK_DEBUG.

Referenced by on_AddSnippet_triggered(), on_LoadSnippets_triggered(), on_RemoveSnippet_triggered(), on_RenameSnippet_triggered(), on_RestoreDefaultSnippets_triggered(), and QmitkPythonSnippets().

Member Data Documentation

const QString QmitkPythonSnippets::DEFAULT_SNIPPET_FILE
static
const QString QmitkPythonSnippets::SNIPPETS_ROOT_XML_ELEMENT_NAME
static

Definition at line 33 of file QmitkPythonSnippets.h.

Referenced by SaveStringMap().

const QString QmitkPythonSnippets::SNIPPETS_XML_ELEMENT_NAME
static

Definition at line 34 of file QmitkPythonSnippets.h.

Referenced by LoadStringMap(), and SaveStringMap().


The documentation for this class was generated from the following files: