Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkRedoAction.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include "QmitkRedoAction.h"
18 
19 #include "internal/org_mitk_gui_qt_application_Activator.h"
20 
21 #include <mitkWorkbenchUtil.h>
22 
23 #include <mitkUndoController.h>
25 
26 #include <berryIPreferences.h>
27 
28 class QmitkRedoActionPrivate
29 {
30 public:
31 
32  void init ( berry::IWorkbenchWindow* window, QmitkRedoAction* action )
33  {
34  m_Window = window;
35  action->setText("&Redo");
36  action->setToolTip("execute the last action that was undone again (not supported by all modules)");
37 
38  QObject::connect(action, SIGNAL(triggered(bool)), action, SLOT(Run()));
39  }
40 
41  berry::IWorkbenchWindow* m_Window;
42 };
43 
45  : QAction(0), d(new QmitkRedoActionPrivate)
46 {
47  d->init(window.GetPointer(), this);
48 }
49 
51  : QAction(0), d(new QmitkRedoActionPrivate)
52 {
53  d->init(window.GetPointer(), this);
54  this->setIcon(icon);
55 }
56 
58  : QAction(0), d(new QmitkRedoActionPrivate)
59 {
60  d->init(window, this);
61  this->setIcon(icon);
62 }
63 
65 {
66 }
67 
69 {
71  if (model)
72  {
73  if (mitk::VerboseLimitedLinearUndo* verboseundo = dynamic_cast<mitk::VerboseLimitedLinearUndo*>( model ))
74  {
76  verboseundo->GetRedoDescriptions();
77  if (descriptions.size() >= 1)
78  {
79  MITK_INFO << "Redo " << descriptions.front().second;
80  }
81  }
82  model->Redo();
83  }
84  else
85  {
86  MITK_ERROR << "No undo model instantiated";
87  }
88 }
virtual bool Redo()=0
#define MITK_INFO
Definition: mitkLogMacros.h:22
#define MITK_ERROR
Definition: mitkLogMacros.h:24
QmitkRedoAction(berry::IWorkbenchWindow::Pointer window)
superclass for all UndoModels
Definition: mitkUndoModel.h:36
A limited linear undo model providing GUI elements with stack status information. ...
ObjectType * GetPointer() const
static UndoModel * GetCurrentUndoModel()
gives access to the currently used UndoModel Introduced to access special functions of more specific ...
std::vector< StackDescriptionItem > StackDescription
virtual void Run()