Commit 53ad15f4 authored by promayon's avatar promayon

FIXED Step #1.2 reintegration à Nico(c) debug prefix trick and other memory leak fixed


git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@735 ec899d31-69d1-42ba-9299-647d76f65fb3
parent f28b5154
......@@ -17,8 +17,7 @@ DEFAULT
# to solve the dll incompatibility between debug and relase version of QVTK.dll and ITKCommon.dll
if ( MSVC )
create_default_target_launcher_special(
"camitk-imp"
EXTERNAL_COMMAND "${CAMITK_BIN_DIR}$(OutDir)/camitk-imp.exe"
RUNTIME_LIBRARY_DIRS "${CAMITK_BIN_DIR}$(OutDir)" "%VTK_DIR%/bin/$(OutDir)" "%ITK_DIR%/bin/$(OutDir)"
"camitk-imp-debug"
EXTERNAL_COMMAND "${CAMITK_BIN_DIR}$(OutDir)/camitk-imp-debug.exe"
)
endif()
......@@ -106,23 +106,58 @@ set(CAMITK_INCLUDE_DIRECTORIES
${VTK_INCLUDE_DIRS}
)
# postfix for MSVC debug version
set(CAMITK_DEBUG_POSTFIX "-debug")
# basic list of all lib needed for linking with CamiTK core
set (CAMITK_LIBRARIES
${QT_LIBRARIES}
vtkCommon
vtkFiltering
vtkGenericFiltering
vtkGraphics
vtkHybrid
vtkImaging
vtkIO
vtkRendering
vtkVolumeRendering
vtkftgl
vtkWidgets
QVTK
qtpropertybrowser
)
if(MSVC)
set(CAMITK_LIBRARIES
${QT_LIBRARIES}
debug ${VTK_DIR}/vtkCommon${CAMITK_DEBUG_POSTFIX}
optimized vtkCommon
debug ${VTK_DIR}/vtkFiltering${CAMITK_DEBUG_POSTFIX}
optimized vtkFiltering
debug ${VTK_DIR}/vtkGenericFiltering${CAMITK_DEBUG_POSTFIX}
optimized vtkGenericFiltering
debug ${VTK_DIR}/vtkGraphics${CAMITK_DEBUG_POSTFIX}
optimized vtkGraphics
debug ${VTK_DIR}/vtkHybrid${CAMITK_DEBUG_POSTFIX}
optimized vtkHybrid
debug ${VTK_DIR}/vtkImaging${CAMITK_DEBUG_POSTFIX}
optimized vtkImaging
debug ${VTK_DIR}/vtkIO${CAMITK_DEBUG_POSTFIX}
optimized vtkIO
debug ${VTK_DIR}/vtkRendering${CAMITK_DEBUG_POSTFIX}
optimized vtkRendering
debug ${VTK_DIR}/vtkVolumeRendering${CAMITK_DEBUG_POSTFIX}
optimized vtkVolumeRendering
debug ${VTK_DIR}/vtkftgl${CAMITK_DEBUG_POSTFIX}
optimized vtkftgl
debug ${VTK_DIR}/vtkWidgets${CAMITK_DEBUG_POSTFIX}
optimized vtkWidgets
debug ${VTK_DIR}/QVTK${CAMITK_DEBUG_POSTFIX}
optimized QVTK
debug ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qtpropertybrowser${CAMITK_DEBUG_POSTFIX}
optimized qtpropertybrowser
)
else()
set(CAMITK_LIBRARIES
${QT_LIBRARIES}
vtkCommon
vtkFiltering
vtkGenericFiltering
vtkGraphics
vtkHybrid
vtkImaging
vtkIO
vtkRendering
vtkVolumeRendering
vtkftgl
vtkWidgets
QVTK
qtpropertybrowser
)
endif()
mark_as_advanced (CAMITK_CORE_LIB CAMITK_LINK_DIRECTORIES CAMITK_INCLUDE_DIRECTORIES CAMITK_LIBRARIES)
......
......@@ -133,10 +133,13 @@ macro(camitk_extension)
foreach(CEP_LIBRARIES_NEEDED ${${EXTENSION_NAME_CMAKE}_NEEDS_CEP_LIBRARIES})
string(TOUPPER ${CEP_LIBRARIES_NEEDED} ${CEP_LIBRARIES_NEEDED}_INTERNAL)
set(CEP_LIBRARY_${${CEP_LIBRARIES_NEEDED}_INTERNAL} ON CACHE BOOL "Required by action extension ${EXTENSION_NAME}" FORCE )
set(CEP_LIBRARIES ${CEP_LIBRARIES} ${CEP_LIBRARIES_NEEDED})
# TODO camitk_include_directories(CEP_LIBRARIES ${CEP_LIBRARIES_NEEDED})
# TODO this macro, should just do the following:
# TODO other availabler parameters : COMPONENT and ACTION
if (MSVC)
set(CEP_LIBRARIES ${CEP_LIBRARIES} debug ${CEP_LIBRARIES_NEEDED}${CAMITK_DEBUG_POSTFIX}
optimized ${CEP_LIBRARIES_NEEDED}
)
else()
set(CEP_LIBRARIES ${CEP_LIBRARIES} ${CEP_LIBRARIES_NEEDED})
endif()
include_directories(${CAMITK_INCLUDE_DIR}/${CEP_LIBRARIES_NEEDED})
include_directories(${CAMITK_USER_INCLUDE_DIR}/${CEP_LIBRARIES_NEEDED})
include_directories(${CAMITK_BUILD_INCLUDE_DIR}/${CEP_LIBRARIES_NEEDED})
......@@ -149,7 +152,46 @@ macro(camitk_extension)
# ITK is required
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})
set(ITK_LIBRARIES ITKBasicFilters ITKCommon ITKIO)
if (MSVC)
set(ITK_LIBRARIES
debug ITKBasicFilters${CAMITK_DEBUG_POSTFIX}
optimized ITKBasicFilters
debug ITKCommon${CAMITK_DEBUG_POSTFIX}
optimized ITKCommon
debug ITKIO${CAMITK_DEBUG_POSTFIX}
optimized ITKIO
debug ITKNrrdIO${CAMITK_DEBUG_POSTFIX}.lib
debug itkgdcm${CAMITK_DEBUG_POSTFIX}.lib
debug itkjpeg12${CAMITK_DEBUG_POSTFIX}.lib
debug itkjpeg16${CAMITK_DEBUG_POSTFIX}.lib
debug itkopenjpeg${CAMITK_DEBUG_POSTFIX}.lib
debug itkpng${CAMITK_DEBUG_POSTFIX}.lib
debug itktiff${CAMITK_DEBUG_POSTFIX}.lib
debug itkjpeg8${CAMITK_DEBUG_POSTFIX}.lib
debug ITKSpatialObject${CAMITK_DEBUG_POSTFIX}.lib
debug itkvnl_inst${CAMITK_DEBUG_POSTFIX}.lib
debug itkvnl_algo${CAMITK_DEBUG_POSTFIX}.lib
debug itkv3p_netlib${CAMITK_DEBUG_POSTFIX}.lib
debug itkvnl${CAMITK_DEBUG_POSTFIX}.lib
debug itkvcl${CAMITK_DEBUG_POSTFIX}.lib
debug itkv3p_lsqr${CAMITK_DEBUG_POSTFIX}.lib
debug ITKMetaIO${CAMITK_DEBUG_POSTFIX}.lib
debug itksys${CAMITK_DEBUG_POSTFIX}.lib
debug ITKDICOMParser${CAMITK_DEBUG_POSTFIX}.lib
debug ITKEXPAT${CAMITK_DEBUG_POSTFIX}.lib
debug ITKniftiio${CAMITK_DEBUG_POSTFIX}.lib
debug ITKznz${CAMITK_DEBUG_POSTFIX}.lib
debug itkzlib${CAMITK_DEBUG_POSTFIX}.lib
debug snmpapi.lib
debug rpcrt4.lib
debug ws2_32.lib
debug comctl32.lib
debug wsock32.lib
debug opengl32.lib
)
else()
set(ITK_LIBRARIES ITKBasicFilters ITKCommon ITKIO)
endif()
else()
set(ITK_LIBRARIES "")
endif()
......@@ -231,8 +273,14 @@ macro(camitk_extension)
foreach(COMPONENT_NEEDED ${${EXTENSION_NAME_CMAKE}_NEEDS_COMPONENT_EXTENSION})
string(TOUPPER ${COMPONENT_NEEDED} ${COMPONENT_NEEDED}_INTERNAL)
set(COMPONENT_${${COMPONENT_NEEDED}_INTERNAL} ON CACHE BOOL "Required by extension ${EXTENSION_NAME}" FORCE )
set(COMPONENT_EXTENSION_LIBRARIES ${COMPONENT_EXTENSION_LIBRARIES} ${COMPONENT_NEEDED})
# TODO use camitk_include_directories
if (MSVC)
set(COMPONENT_EXTENSION_LIBRARIES ${COMPONENT_EXTENSION_LIBRARIES}
debug ${CAMITK_BUILD_PRIVATE_LIB_DIR}/components/${COMPONENT_NEEDED}${CAMITK_DEBUG_POSTFIX}
optimized ${COMPONENT_NEEDED}
)
else()
set(COMPONENT_EXTENSION_LIBRARIES ${COMPONENT_EXTENSION_LIBRARIES} ${COMPONENT_NEEDED})
endif()
include_directories(${CAMITK_INCLUDE_DIR}/components/${COMPONENT_NEEDED})
include_directories(${CAMITK_USER_INCLUDE_DIR}/components/${COMPONENT_NEEDED})
include_directories(${CAMITK_BUILD_INCLUDE_DIR}/components/${COMPONENT_NEEDED})
......@@ -245,9 +293,14 @@ macro(camitk_extension)
foreach(ACTION_NEEDED ${${EXTENSION_NAME_CMAKE}_NEEDS_ACTION_EXTENSION})
string(TOUPPER ${ACTION_NEEDED} ${ACTION_NEEDED}_INTERNAL)
set(ACTION_${${ACTION_NEEDED}_INTERNAL} ON CACHE BOOL "Required by extension ${EXTENSION_NAME}" FORCE )
set(ACTION_EXTENSION_LIBRARIES ${ACTION_EXTENSION_LIBRARIES} ${ACTION_NEEDED})
# TODO use camitk_include_directories
include_directories(${CAMITK_INCLUDE_DIR}/actions/${ACTION_NEEDED})
if (MSVC)
set(ACTION_EXTENSION_LIBRARIES ${ACTION_EXTENSION_LIBRARIES}
debug ${CAMITK_BUILD_PRIVATE_LIB_DIR}/actions/${ACTION_NEEDED}${CAMITK_DEBUG_POSTFIX}
optimized ${ACTION_NEEDED}
)
else()
set(ACTION_EXTENSION_LIBRARIES ${ACTION_EXTENSION_LIBRARIES} ${ACTION_NEEDED})
endif()
include_directories(${CAMITK_INCLUDE_DIR}/actions/${ACTION_NEEDED})
include_directories(${CAMITK_USER_INCLUDE_DIR}/actions/${ACTION_NEEDED})
include_directories(${CAMITK_BUILD_INCLUDE_DIR}/actions/${ACTION_NEEDED})
......@@ -288,10 +341,20 @@ macro(camitk_extension)
PROPERTIES OUTPUT_NAME ${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}
)
# Output directory (all extensions are private)
set_target_properties(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s)
set_target_properties(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s
LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s
LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s
)
# Output directory (for dll plateform, this is still the same, extensions are private)
set_target_properties(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s)
set_target_properties(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s
)
if (MSVC)
set_target_properties(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} PROPERTIES DEBUG_POSTFIX ${CAMITK_DEBUG_POSTFIX})
endif()
# see http://www.cmake.org/pipermail/cmake/2012-April/049889.html
# target properties (outputname and remove soname)
# set_property(TARGET ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} PROPERTY NO_SONAME 1)
......@@ -299,13 +362,14 @@ macro(camitk_extension)
if (NOT CAMITK_VERSION_PATCH)
set(CAMITK_VERSION_PATCH 0)
endif()
# set so name
set(${TYPE_EXTENSION_CMAKE}_LIBRARY_PROPERTIES ${${TYPE_EXTENSION_CMAKE}_LIBRARY_PROPERTIES}
VERSION "${CAMITK_VERSION_MAJOR}.${CAMITK_VERSION_MINOR}.${CAMITK_VERSION_PATCH}"
SOVERSION "${CAMITK_VERSION_MAJOR}"
)
# set the library specific info (SONAME...)
set_target_properties(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} PROPERTIES ${${TYPE_EXTENSION_CMAKE}_LIBRARY_PROPERTIES} LINK_INTERFACE_LIBRARIES "")
set_target_properties(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} PROPERTIES ${${TYPE_EXTENSION_CMAKE}_LIBRARY_PROPERTIES} LINK_INTERFACE_LIBRARIES "")
# CEP libraries dependencies
if(${EXTENSION_NAME_CMAKE}_NEEDS_CEP_LIBRARIES)
......
......@@ -61,9 +61,8 @@ macro(camitk_extension_project)
if ( MSVC )
create_default_target_launcher_special(
${CEP_DEFAULT_APPLICATION}
EXTERNAL_COMMAND "${CAMITK_BIN_DIR}$(OutDir)/${CEP_DEFAULT_APPLICATION}.exe"
RUNTIME_LIBRARY_DIRS "${CAMITK_BIN_DIR}$(OutDir)" "%VTK_DIR%/bin/$(OutDir)" "%ITK_DIR%/bin/$(OutDir)"
${CEP_DEFAULT_APPLICATION}-debug
EXTERNAL_COMMAND "${CAMITK_BIN_DIR}$(OutDir)/${CEP_DEFAULT_APPLICATION}-debug.exe"
)
endif()
......
......@@ -121,8 +121,16 @@ macro(camitk_library)
# install the lib directly in lib
if (${DEFAULT_LIBRARY_NAME_CMAKE}_PUBLIC)
if (WIN32)
set_target_properties(${LIBRARY_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CAMITK_BUILD_BIN_DIR})
set_target_properties(${LIBRARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CAMITK_BUILD_BIN_DIR})
set_target_properties(${LIBRARY_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CAMITK_BUILD_BIN_DIR}
LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_BIN_DIR}
LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_BIN_DIR}
)
set_target_properties(${LIBRARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CAMITK_BUILD_BIN_DIR}
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_BIN_DIR}
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_BIN_DIR}
)
set_target_properties(${LIBRARY_NAME} PROPERTIES DEBUG_POSTFIX ${CAMITK_DEBUG_POSTFIX})
else()
set_target_properties(${LIBRARY_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CAMITK_BUILD_PUBLIC_LIB_DIR})
endif()
......
......@@ -38,15 +38,23 @@ camitk_sub_project_add(CORELIB ${CAMITK_CORE_LIB})
set_target_properties(${CAMITK_CORE_LIB} PROPERTIES ${CAMITKCORE_LIBRARY_PROPERTIES} LINK_INTERFACE_LIBRARIES "")
if (WIN32 AND MSVC)
# property required for camitk file association on windows platform compilation with Visual Studio
set_target_properties(${CAMITK_CORE_LIB} PROPERTIES COMPILE_FLAGS "/Zc:wchar_t-")
set_target_properties(${CAMITK_CORE_LIB} PROPERTIES COMPILE_FLAGS "/Zc:wchar_t-"
DEBUG_POSTFIX ${CAMITK_DEBUG_POSTFIX}
)
endif()
target_link_libraries(${CAMITK_CORE_LIB} ${CAMITK_LIBRARIES})
# output directory
if (WIN32)
set_target_properties(${CAMITK_CORE_LIB} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CAMITK_BUILD_BIN_DIR})
set_target_properties(${CAMITK_CORE_LIB} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CAMITK_BUILD_BIN_DIR})
if (WIN32 AND MSVC)
set_target_properties(${CAMITK_CORE_LIB} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CAMITK_BUILD_BIN_DIR}
LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_BIN_DIR}
LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_BIN_DIR}
)
set_target_properties(${CAMITK_CORE_LIB} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CAMITK_BUILD_BIN_DIR}
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_BIN_DIR}
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_BIN_DIR}
)
else()
set_target_properties(${CAMITK_CORE_LIB} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CAMITK_BUILD_PUBLIC_LIB_DIR})
endif()
......
......@@ -31,4 +31,5 @@ namespace camitk
const char * Core::version = "@CAMITK_VERSION_STRING@";
const char * Core::shortVersion = "@CAMITK_SHORT_VERSION_STRING@";
const char * Core::soVersion = "@CAMITK_VERSION_MAJOR@";
const char * Core::debugPostfix = "@CAMITK_DEBUG_POSTFIX@";
}
......@@ -220,6 +220,14 @@ const QString Core::getCurrentWorkingDir() {
return QDir::currentPath();
}
// ------------- isDebugBuild (static) -----------------
const bool Core::isDebugBuild() {
#ifdef QT_DEBUG
return true;
#else
return false;
#endif
}
......
......@@ -128,27 +128,27 @@ public:
/// get all the action directories
static const QStringList getActionDirectories();
/** Get a valid camitk test data directory name. It returns the first valid
* test data directory that is found. Checking is done in this particular order:
* 1. current working directory (build install tree)
* 2. user config directory (user install tree)
* 3. CAMITK_DIR (global install tree)
*
*
* If none of this three directories is valid, return user's home directory.
*
* A test data directory is valid if it exists and contains a least one file.
*
*
* @return a null QString, checkable with isNull(), if no test data directory found
*/
static const QString getTestDataDir();
/// get more information about installation, etc...
static const QString getConfig();
/// get all important paths
static const QString getPaths();
/// get the CAMITK_DIR (where camitk-imp is installed)
static const QString getGlobalInstallDir();
......@@ -157,8 +157,17 @@ public:
/// get the current working directory (during dev, this should be the build directory, which is an installation directory)
static const QString getCurrentWorkingDir();
///@}
/// @name runtime build information
///@{
/// get the type of build we are running, Debug or Release
/// @return true if running in Debug, elsewhere false for Release build.
static const bool isDebugBuild();
///@}
/// @name miscallaneous utility method or variables
///@{
/// complete version string
......@@ -167,6 +176,8 @@ public:
static const char *shortVersion;
/// version used for so name
static const char *soVersion;
/// debug postfix used on MSVC to distinguished between release and debug version
static const char *debugPostfix;
///@}
///@cond
......@@ -195,7 +206,8 @@ public:
*/
static const QString getCoreLibDir();
///@endcond
};
}
......
......@@ -92,14 +92,13 @@ void ExtensionManager::loadComponentExtension(QDir extensionsDir) {
<< "application library paths=" << Application::instance()->libraryPaths().join(",").toStdString()
);
// try to load all Components in the directory
QStringList pluginFile;
// linux: .so, windows: .dll, macOs: .dylib
pluginFile << "*.so." + QString(Core::soVersion) << "*.dll" << "*.dylib";
// loop to load component plugin, taking into account internal dependencies (i.e. dependency between
// one component and another one.
QStringList pluginFileNames = extensionsDir.entryList(pluginFile, QDir::Files);
QStringList pluginFileNames = extensionsDir.entryList(getExtensionFilter(), QDir::Files);
if (Core::isDebugBuild()) {
pluginFileNames.replaceInStrings(QString(Core::debugPostfix),"").removeDuplicates();
}
// if there is more than 5 dependency levels, then you have two choices:
// - consider simplifying your component
// - increase maxNumberOfTries
......@@ -298,7 +297,7 @@ void ExtensionManager::autoloadActionExtensions() {
//-- load all installed action extensions
foreach(QString dir, Core::getActionDirectories()) {
loadActionExtension(QDir(dir));
}
}
//-- user extensions
QSettings & settings = Application::getSettings();
......@@ -317,14 +316,14 @@ void ExtensionManager::loadActionExtension(QDir actionsDir) {
QMessageBox::information(NULL, "ExtensionManager Autoload Error", "Cannot access to actions directory:<br/><tt>" + actionsDir.absolutePath() + "</tt><br/>Directory does not exist!");
}
else {
// try to load all Components in the directory
QStringList extensionFile;
extensionFile << "*.so." + QString(Core::soVersion) << "*.dll" << "*.dylib";
// loop to load action extension, taking into account internal dependencies (i.e. dependency between
// one action and another one.
int i = 0;
QStringList extensionFileNames = actionsDir.entryList(extensionFile, QDir::Files);
QStringList extensionFileNames = actionsDir.entryList(getExtensionFilter(), QDir::Files);
if (Core::isDebugBuild()) {
extensionFileNames.replaceInStrings(QString(Core::debugPostfix),"").removeDuplicates();
}
// if there is more than 5 dependency levels, then you have two choices:
// - consider simplifying your component
// - increase maxNumberOfTries
......@@ -405,13 +404,12 @@ void ExtensionManager::unloadAllActionExtensions() {
}
// -------------------- registerFileExtension --------------------
void ExtensionManager::registerFileExtension(QString fileExtension)
{
void ExtensionManager::registerFileExtension(QString fileExtension) {
// we get the application name and its binary path for the association
QString appName = QApplication::applicationName(); // used for windows registry
QString appFilePath = QApplication::applicationFilePath(); // needed for associating file for opening command
#ifdef WIN32
#ifdef WIN32
// WINDOWS ONLY
appFilePath.replace("/", "\\");
// Associate the file extension with the current application for opening
......@@ -423,14 +421,14 @@ void ExtensionManager::registerFileExtension(QString fileExtension)
registry->setValue("Default", "\"" + appFilePath + "\", 0");
registry = new QSettings("HKEY_CURRENT_USER\\Software\\Classes\\camitk-" + appName + "." + fileExtension + "\\shell\\Open\\command", QSettings::NativeFormat);
registry->setValue("Default", "\"" + appFilePath + "\" %1");
registry->setValue("Default", "\"" + appFilePath + "\" %1");
registry = new QSettings("HKEY_CURRENT_USER\\Software\\Classes\\." + fileExtension + "\\ShellNew", QSettings::NativeFormat);
registry->setValue("Default", "");
registry = new QSettings("HKEY_CURRENT_USER\\Software\\Classes\\." + fileExtension, QSettings::NativeFormat);
registry->setValue("Default", "camitk-" + appName + "." + fileExtension);
#endif
#endif
// TODO : associate file opening on Linux & MacOS
}
......@@ -441,15 +439,27 @@ bool ExtensionManager::promptRegisterFileExtensions(QStringList fileExtensions)
// Prompt the user if he wishes those file extension to be associated with this application for default file opening.
QMessageBox msgBox;
msgBox.setWindowTitle(tr("Associate new file extensions for opening."));
msgBox.setText(tr("New component extension(s) allow(s) this application to handle new file type(s) : \n\n")
+ fileExtensions.join(", ") + "\n\n"
+ tr("Do you want this/these file type(s) to be opened by default with this application")
+ " (" + QApplication::applicationName() + ") ?\n");
msgBox.setText(tr("New component extension(s) allow(s) this application to handle new file type(s) : \n\n")
+ fileExtensions.join(", ") + "\n\n"
+ tr("Do you want this/these file type(s) to be opened by default with this application")
+ " (" + QApplication::applicationName() + ") ?\n");
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::Yes);
return (msgBox.exec() == QMessageBox::Yes);
}
// -------------------- getExtensionFilter --------------------
QStringList ExtensionManager::getExtensionFilter() {
// try to load all Components in the directory
QStringList pluginFilter;
// linux: .so, windows: .dll, macOs: .dylib
pluginFilter << "*.so." + QString(Core::soVersion) << "*.dylib";
if (Core::isDebugBuild())
pluginFilter << "*" + QString(Core::debugPostfix) +".dll";
else
pluginFilter << "*.dll";
return pluginFilter;
}
}
......@@ -166,6 +166,9 @@ private:
* @param directory the install directory
*/
static void loadActionExtension(QDir directory);
/// return the extensions file filter
static QStringList getExtensionFilter();
};
}
......
......@@ -682,6 +682,10 @@ void RendererWidget::updateAxes() {
vtkSmartPointer<vtkTransform> transform = vtkTransform::New();
transform->Identity();
transform->Scale(maxLength, maxLength, maxLength);
// free the last user transform used. Not freeing it, caused a memory leak on each viewer->refresh() call
annotatedCube->GetAssembly()->GetUserTransform()->Delete();
annotatedCube->GetAssembly()->SetUserTransform(transform);
}
......
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