Commit 4db65e9f authored by saubatn's avatar saubatn
Browse files

UPDATED Show only one filter per ImageComponent & MeshComponent (better...

UPDATED Show only one filter per ImageComponent & MeshComponent (better ergonomy for the filter of the SaveFileDialog).
Note, On Linux, filter filenames details don't appear (bug in Qt 4.8). Do not try to fix it, but wait for Qt 5.

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@1841 ec899d31-69d1-42ba-9299-647d76f65fb3
parent e54f1ac9
......@@ -95,9 +95,12 @@ Action::ApplyStatus SaveAsAction::apply() {
const ImageComponentExtension * imageExt = dynamic_cast<const ImageComponentExtension*> (pl);
if (imageExt) {
QString imgFilter = imageExt->getName() + " (";
foreach (QString ext, imageExt->getFileExtensions()) {
filter += ExtensionManager::getComponentExtension ( ext )->getName() + " (*." + ext + ")";
imgFilter += "*." + ext + " ";
}
imgFilter += ")";
filter += imgFilter;
}
}
}
......@@ -110,9 +113,12 @@ Action::ApplyStatus SaveAsAction::apply() {
const ComponentExtension * meshExt = dynamic_cast<const MeshComponentExtension*> (pl);
if (meshExt) {
QString meshFilter = meshExt->getName() + " (";
foreach (QString ext, meshExt->getFileExtensions()) {
filter += ExtensionManager::getComponentExtension(ext)->getName() + " (*." + ext + ")";
meshFilter += "*." + ext + ")";
}
meshFilter += ")";
filter += meshFilter;
}
}
}
......@@ -166,9 +172,14 @@ Action::ApplyStatus SaveAsAction::apply() {
// format filter list, sort
QStringList filterList(filter.toList());
filterList.sort();
QString test = filterList.join(";;");
QFileDialog saveFileDialog(NULL, tr ( "Save File As..." ), QFileInfo(compfileName).dir().canonicalPath() +"/"+ suggestedName, test);
saveFileDialog.setFileMode(QFileDialog::AnyFile);
saveFileDialog.setOption(QFileDialog::HideNameFilterDetails, false);
// get the file name
QString filename = QFileDialog::getSaveFileName ( NULL, tr ( "Save File As..." ), QFileInfo(compfileName).dir().canonicalPath() +"/"+ suggestedName, filterList.join(";;"));
QString filename = QFileDialog::getSaveFileName( NULL, tr ( "Save File As..." ), QFileInfo(compfileName).dir().canonicalPath() +"/"+ suggestedName, test);
if ( !filename.isEmpty() ) {
// rename the filename of the component and save
......
Supports Markdown
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