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

Program:   Medical Imaging & Interaction Toolkit
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/copyright.html 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 "QmitkStoreSCPLauncher.h"
#include <QDir>
#include <QMessageBox>
#include <QProcessEnvironment>
#include <mitklogmacros.h>
//#include <QStringListIterator>

QmitkStoreSCPLauncher::QmitkStoreSCPLauncher(QmitkStoreSCPLauncherBuilder* builder) 
: m_StoreSCP(new QProcess())
{
    connect( m_StoreSCP, SIGNAL(error(QProcess::ProcessError)),this, SLOT(OnProcessError(QProcess::ProcessError)));
    connect( m_StoreSCP, SIGNAL(stateChanged(QProcess::ProcessState)),this, SLOT(OnStateChanged(QProcess::ProcessState)));
    SetArgumentList(builder);
}

QmitkStoreSCPLauncher::~QmitkStoreSCPLauncher()
{
    m_StoreSCP->kill();
    delete m_StoreSCP;
}

void QmitkStoreSCPLauncher::StartStoreSCP()
{
    QString storeSCP;
    storeSCP.append(GetPathToExecutable());
    storeSCP.append(QString("/storescp.exe"));
    m_StoreSCP->start(storeSCP,m_ArgumentList);
}

QString QmitkStoreSCPLauncher::GetPathToExecutable()
{
    QDir root;
    QString currentPath =  root.currentPath();
    currentPath = currentPath.split("MITK").at(0);
    currentPath.append("MITK/DCMTK-install/bin");
    return currentPath;
}

void QmitkStoreSCPLauncher::OnProcessError(QProcess::ProcessError err)
{
	switch(err)
	{
	case QProcess::FailedToStart:
        QMessageBox::information(0,"FailedToStart",QString("FailedToStart:\n").append(m_StoreSCP->errorString()));
		break;
	case QProcess::Crashed:
        QMessageBox::information(0,"Crashed",QString("Crashed:\n").append(m_StoreSCP->errorString()));
		break;
	case QProcess::Timedout:
        QMessageBox::information(0,"Timedout",QString("Timedout:\n").append(m_StoreSCP->errorString()));
		break;
	case QProcess::WriteError:
        QMessageBox::information(0,"WriteError",QString("WriteError:\n").append(m_StoreSCP->errorString()));
		break;
	case QProcess::ReadError:
        QMessageBox::information(0,"ReadError",QString("ReadError:\n").append(m_StoreSCP->errorString()));
		break;
	case QProcess::UnknownError:
        QMessageBox::information(0,"UnknownError",QString("UnknownError:\n").append(m_StoreSCP->errorString()));
		break;
	default:
        QMessageBox::information(0,"default",QString("default:\n").append(m_StoreSCP->errorString()));
		break;
	}
}

void QmitkStoreSCPLauncher::OnStateChanged(QProcess::ProcessState status)
{
	switch(status)
	{
	case QProcess::NotRunning:
        QMessageBox::information(0,"NotRunning",QString("NotRunning:\n").append(m_StoreSCP->errorString()));
		break;
	case QProcess::Starting:
		QMessageBox::information(0,"Starting",QString("Starting"));
		break;
	case QProcess::Running:
		QMessageBox::information(0,"Running",QString("Running"));
		break;
	default:
		QMessageBox::information(0,"default",QString("default:\n").append(m_StoreSCP->errorString()));
		break;
	}
}
<commit_msg>converted debug messageboxes into MITK_INFO<commit_after>/*=========================================================================

Program:   Medical Imaging & Interaction Toolkit
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/copyright.html 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 "QmitkStoreSCPLauncher.h"
#include <QDir>
#include <QMessageBox>
#include <QProcessEnvironment>
#include <mitklogmacros.h>
//#include <QStringListIterator>

QmitkStoreSCPLauncher::QmitkStoreSCPLauncher(QmitkStoreSCPLauncherBuilder* builder) 
: m_StoreSCP(new QProcess())
{
    connect( m_StoreSCP, SIGNAL(error(QProcess::ProcessError)),this, SLOT(OnProcessError(QProcess::ProcessError)));
    connect( m_StoreSCP, SIGNAL(stateChanged(QProcess::ProcessState)),this, SLOT(OnStateChanged(QProcess::ProcessState)));
    SetArgumentList(builder);
}

QmitkStoreSCPLauncher::~QmitkStoreSCPLauncher()
{
    m_StoreSCP->kill();
    delete m_StoreSCP;
}

void QmitkStoreSCPLauncher::StartStoreSCP()
{
    QString storeSCP;
    storeSCP.append(GetPathToExecutable());
    storeSCP.append(QString("/storescp.exe"));
    m_StoreSCP->start(storeSCP,m_ArgumentList);
}

QString QmitkStoreSCPLauncher::GetPathToExecutable()
{
    QDir root;
    QString currentPath =  root.currentPath();
    currentPath = currentPath.split("MITK").at(0);
    currentPath.append("MITK/DCMTK-install/bin");
    return currentPath;
}

void QmitkStoreSCPLauncher::OnProcessError(QProcess::ProcessError err)
{
	switch(err)
	{
	case QProcess::FailedToStart:
        MITK_INFO << QString("Failed to start storage provider: ").append(m_StoreSCP->errorString()).toStdString();
		break;
	case QProcess::Crashed:
        MITK_INFO << QString("Storage provider crashed: ").append(m_StoreSCP->errorString()).toStdString();
		break;
	case QProcess::Timedout:
        MITK_INFO << QString("Storage provider timeout: ").append(m_StoreSCP->errorString()).toStdString();
		break;
	case QProcess::WriteError:
        MITK_INFO << QString("Storage provider write error: ").append(m_StoreSCP->errorString()).toStdString();
		break;
	case QProcess::ReadError:
        MITK_INFO << QString("Storage provider read error: ").append(m_StoreSCP->errorString()).toStdString();
		break;
	case QProcess::UnknownError:
        MITK_INFO << QString("Storage provider unknown error: ").append(m_StoreSCP->errorString()).toStdString();
		break;
	default:
        MITK_INFO << QString("Storage provider unknown error: ").append(m_StoreSCP->errorString()).toStdString();
		break;
	}
}

void QmitkStoreSCPLauncher::OnStateChanged(QProcess::ProcessState status)
{
	switch(status)
	{
	case QProcess::NotRunning:
        MITK_INFO << QString("Storage provider not running: ").append(m_StoreSCP->errorString()).toStdString();
		break;
	case QProcess::Starting:
		MITK_INFO << QString("Starting storage provider").toStdString();
		break;
	case QProcess::Running:
        MITK_INFO << QString("Running storage provider").toStdString();
		break;
	default:
		MITK_INFO << QString("Storage provider unknown error: ").append(m_StoreSCP->errorString()).toStdString();
		break;
	}
}

{'fraction_non_alphanumeric': 0.17159336697909156, 'fraction_numerical': 0.0018745493871665465, 'mean_word_length': 6.474137931034483, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, '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': '2497552', 'n_tokens_mistral': 2208, 'n_tokens_neox': 2131, 'n_words': 372}