Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Import] avoid crash at empty Import #8

Open
wants to merge 1 commit into
base: APHP
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 8 additions & 17 deletions src/QtDcmManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,6 @@

#include <QtDcmManager.h>

namespace {
QString dateToString(const QDate & date) {
if (date == QDate()) {
return "*";
}
return date.toString("yyyyMMdd");
}

}

class QtDcmManagerPrivate
{

Expand Down Expand Up @@ -429,11 +419,11 @@ void QtDcmManager::findImagesDicomdir ( const QString &uid )

void QtDcmManager::moveSelectedSeries()
{
if ( !d->tempDir.exists() ) {
if ( !d->tempDir.exists() || d->dataToImport.count()==0 )
{
return;
}

// Uhh
qApp->processEvents();

switch (d->mode) {
Expand Down Expand Up @@ -789,7 +779,7 @@ void QtDcmManager::updateProgressBar ( int i )

void QtDcmManager::createTemporaryDirs()
{
//Creation d'un répertoire temporaire pour la série
//Create a temporary directory for the series
QDir tempDir = QDir ( QDir::tempPath() );

//Use Quuid to generate the temporary directory
Expand Down Expand Up @@ -825,16 +815,17 @@ void QtDcmManager::generateCurrentSerieDir()

void QtDcmManager::deleteCurrentSerieDir()
{
// Suppression des fichiers temporaires
// Remove temporary files
const QStringList listFiles = d->currentSerieDir.entryList ( QDir::Files, QDir::Name );

for ( int i = 0; i < listFiles.size(); i++ ) {
d->currentSerieDir.remove ( listFiles.at ( i ) );
}

// Suppression du répertoire temporaire
if ( !d->tempDir.rmdir ( d->serieId ) ) {
qDebug() << tr ( "Probleme lors de la suppression du répertoire temporaire" );
// Remove temporary repertory
if ( !d->tempDir.rmdir ( d->serieId ) )
{
qDebug() << tr ( "Error removing temporary directory" );
}
}

Expand Down