Commit 45aa442a authored by mat's avatar mat
Browse files

FIXED crash when open or save for directory component (i.e., dicom)

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@165 ec899d31-69d1-42ba-9299-647d76f65fb3
parent 02987b4e
......@@ -83,51 +83,48 @@ Action::ApplyStatus SaveAsAction::apply() {
// check the extension
QString extension = QFileInfo ( compfileName ).completeSuffix();
// if no extension is found, look for the export of plugins which read directories
// if no extension is found, look for the export of plugins which write directories
if (!compfileName.isEmpty() && extension.isEmpty() ) {
foreach ( QString cpName, ExtensionManager::getDataDirectoryExtNames() ) {
const ComponentExtension * cp = ExtensionManager::getComponentExtension ( cpName );
foreach ( QString ext, cp->getFileExtensions()) {
filter += ExtensionManager::getComponentExtension ( ext )->getName() + " (*." + ext + ")";
}
filter += cpName + cp->getFileExtensions().join(" ");
}
}
else {
// If the selected component is of type ImageComponent, use all ImageComponentExtension
const ImageComponent * compAsImg = dynamic_cast<const ImageComponent *> ( comp );
if (compAsImg) {
foreach (ComponentExtension * pl, ExtensionManager::getComponentExtensions().values().toSet()) {
const ImageComponentExtension * imageExt = dynamic_cast<const ImageComponentExtension*> (pl);
// If the selected component is of type ImageComponent, use all ImageComponentExtension
const ImageComponent * compAsImg = dynamic_cast<const ImageComponent *> ( comp );
if (imageExt) {
foreach (QString ext, imageExt->getFileExtensions()) {
filter += ExtensionManager::getComponentExtension ( ext )->getName() + " (*." + ext + ")";
}
if (compAsImg) {
foreach (ComponentExtension * pl, ExtensionManager::getComponentExtensions().values().toSet()) {
const ImageComponentExtension * imageExt = dynamic_cast<const ImageComponentExtension*> (pl);
if (imageExt) {
foreach (QString ext, imageExt->getFileExtensions()) {
filter += ExtensionManager::getComponentExtension ( ext )->getName() + " (*." + ext + ")";
}
}
}
else {
// If the selected component is of type MeshComponent, use all MeshComponentExtension
const MeshComponent * compAsMesh = dynamic_cast<const MeshComponent *> ( comp );
}
else {
// If the selected component is of type MeshComponent, use all MeshComponentExtension
const MeshComponent * compAsMesh = dynamic_cast<const MeshComponent *> ( comp );
if (compAsMesh) {
foreach (ComponentExtension * pl, ExtensionManager::getComponentExtensions().values().toSet()) {
const ComponentExtension * meshExt = dynamic_cast<const MeshComponentExtension*> (pl);
if (compAsMesh) {
foreach (ComponentExtension * pl, ExtensionManager::getComponentExtensions().values().toSet()) {
const ComponentExtension * meshExt = dynamic_cast<const MeshComponentExtension*> (pl);
if (meshExt) {
foreach (QString ext, meshExt->getFileExtensions()) {
filter += ExtensionManager::getComponentExtension(ext)->getName() + " (*." + ext + ")";
}
if (meshExt) {
foreach (QString ext, meshExt->getFileExtensions()) {
filter += ExtensionManager::getComponentExtension(ext)->getName() + " (*." + ext + ")";
}
}
}
else {
// the selected component is neither ImageComponent or MeshComponent, just
// ask the component that instanciated it
foreach ( QString ext, ExtensionManager::getComponentExtension ( extension )->getFileExtensions() ) {
filter += ExtensionManager::getComponentExtension ( ext )->getName() + " (*." + ext + ")";
}
}
else {
// the selected component is neither ImageComponent or MeshComponent, just
// ask the component that instanciated it
foreach ( QString ext, ExtensionManager::getComponentExtension ( extension )->getFileExtensions() ) {
filter += ExtensionManager::getComponentExtension ( ext )->getName() + " (*." + ext + ")";
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment