<commit_before>/*=========================================================================

Program:   Medical Imaging & Interaction Toolkit
Module:    $RCSfile$
Language:  C++
Date:      $Date$
Version:   $Revision$

Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/ for details.

This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.  See the above copyright notices for more information.

=========================================================================*/

#include "SampleApp.h"
#include "SampleAppConfig.h"

#include "mitkStatusBar.h"

#include "QmitkStdMultiWidget.h"
#include "QmitkSelectableGLWidget.h"
#include "QmitkCommonFunctionality.h"

#include "QmitkFunctionality.h"
#include "QmitkFunctionalityFactory.h"
#include "QmitkFctMediator.h"
#include "QmitkControlsRightFctLayoutTemplate.h"
#include "QmitkControlsLeftFctLayoutTemplate.h"

#include "QmitkSliderDialogBar.h"
#include "QmitkStandardViewsDialogBar.h"
#include "QmitkStereoOptionsDialogBar.h"

#include <qapplication.h>

#include <qlayout.h>

#include <qsplitter.h>

void RegisterFunctionalities();

SampleApp::SampleApp( QWidget* parent, const char* name, WFlags fl, const char* testingParameter ):
QmitkMainTemplate( parent, name, fl ), m_ControlsLeft ( false ), m_TestingParameter(testingParameter)
{
  RegisterFunctionalities();
  this->setCaption("MITK Application");
  std::cout << "Instantiating new SampleApp..." << std::endl;

  QmitkMainTemplate::CheckStatemachineDebugMode();

  QmitkMainTemplate::Initialize();

  parseCommandLine();
}
/*
*  Destroys the object and frees any allocated resources
*/
SampleApp::~SampleApp()
{
  // Make sure that all pending events are processed to avoid dangling
  // RenderingRequestEvents that would otherwise lead to an application
  // crash
  while ( qApp->hasPendingEvents() )
  {
    qApp->processEvents();
  }
  // no need to delete child widgets, Qt does it all for us
}

void SampleApp::InitializeFunctionality()
{
  //create and add functionalities. Functionalities are also invisible objects, which can be asked to 
  //create their different parts (main widget, control widget, toolbutton for selection).
  mitk::DataTreePreOrderIterator iterator(m_Tree);

  QmitkFunctionalityFactory& qff = QmitkFunctionalityFactory::GetInstance();
  if (!m_TestingParameter) 
  {
    // add separator
    qfm->AddSeparator();

    // add dialog bars
    QmitkSliderDialogBar *sliderDialogBar = new QmitkSliderDialogBar( m_MultiWidget, "slicerbar", m_MultiWidget );<commit_msg>COMP (#976): Instead of repeated event processing at application shutdown (see r15348), now events for QmitkRenderingManager are directly deleted<commit_after>/*=========================================================================

Program:   Medical Imaging & Interaction Toolkit
Module:    $RCSfile$
Language:  C++
Date:      $Date$
Version:   $Revision$

Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/ for details.

This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.  See the above copyright notices for more information.

=========================================================================*/

#include "SampleApp.h"
#include "SampleAppConfig.h"

#include "mitkStatusBar.h"

#include "QmitkStdMultiWidget.h"
#include "QmitkSelectableGLWidget.h"
#include "QmitkCommonFunctionality.h"
#include "QmitkRenderingManager.h"

#include "QmitkFunctionality.h"
#include "QmitkFunctionalityFactory.h"
#include "QmitkFctMediator.h"
#include "QmitkControlsRightFctLayoutTemplate.h"
#include "QmitkControlsLeftFctLayoutTemplate.h"

#include "QmitkSliderDialogBar.h"
#include "QmitkStandardViewsDialogBar.h"
#include "QmitkStereoOptionsDialogBar.h"

#include <qapplication.h>

#include <qlayout.h>

#include <qsplitter.h>

void RegisterFunctionalities();

SampleApp::SampleApp( QWidget* parent, const char* name, WFlags fl, const char* testingParameter ):
QmitkMainTemplate( parent, name, fl ), m_ControlsLeft ( false ), m_TestingParameter(testingParameter)
{
  RegisterFunctionalities();
  this->setCaption("MITK Application");
  std::cout << "Instantiating new SampleApp..." << std::endl;

  QmitkMainTemplate::CheckStatemachineDebugMode();

  QmitkMainTemplate::Initialize();

  parseCommandLine();
}
/*
*  Destroys the object and frees any allocated resources
*/
SampleApp::~SampleApp()
{
  // Make sure that all pending events are processed to avoid dangling
  // RenderingRequestEvents that would otherwise lead to an application
  // crash
  /*
  while ( qApp->hasPendingEvents() )
    {
      qApp->processEvents();
    }*/
  QmitkRenderingManager* renderingManager = dynamic_cast<QmitkRenderingManager*>(mitk::RenderingManager::GetInstance());
  if(renderingManager != NULL)
  {
    qApp->removePostedEvents(renderingManager);
  }
  // no need to delete child widgets, Qt does it all for us
}

void SampleApp::InitializeFunctionality()
{
  //create and add functionalities. Functionalities are also invisible objects, which can be asked to 
  //create their different parts (main widget, control widget, toolbutton for selection).
  mitk::DataTreePreOrderIterator iterator(m_Tree);

  QmitkFunctionalityFactory& qff = QmitkFunctionalityFactory::GetInstance();
  if (!m_TestingParameter) 
  {
    // add separator
    qfm->AddSeparator();

    // add dialog bars
    QmitkSliderDialogBar *sliderDialogBar = new QmitkSliderDialogBar( m_MultiWidget, "slicerbar", m_MultiWidget );
{'fraction_non_alphanumeric': 0.14453665283540804, 'fraction_numerical': 0.0013831258644536654, 'mean_word_length': 5.758177570093458, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5306083', 'n_tokens_mistral': 1680, 'n_tokens_neox': 1637, 'n_words': 464}