]> Creatis software - clitk.git/commitdiff
Merge branch 'master' of /home/dsarrut/clitk3.server
authormpech <maxime.pech@insa-lyon.fr>
Tue, 17 May 2011 12:57:09 +0000 (14:57 +0200)
committermpech <maxime.pech@insa-lyon.fr>
Tue, 17 May 2011 12:57:09 +0000 (14:57 +0200)
22 files changed:
CMakeLists.txt
CTestConfig.cmake
DartConfiguration.tcl [new file with mode: 0644]
common/CMakeLists.txt
common/globals.h.in [new file with mode: 0644]
tests/CMakeLists.txt
tests/tools/CMakeLists.txt
tests/tools/clitkImageInfoTest.cxx
tests/tools/clitkWriteDicomSeriesTest.cxx
tests/tools/vvMainTest.cxx [new file with mode: 0644]
tests/vv/CMakeLists.txt [new file with mode: 0644]
tests/vv/vvMainTest.cxx [new file with mode: 0644]
tests/vv/vvRegisterFormTest.cxx [new file with mode: 0644]
vv/CMakeLists.txt
vv/qt_ui/vvRegisterForm.ui [new file with mode: 0644]
vv/vvCommon.h.in [new file with mode: 0644]
vv/vvMainWindow.cxx
vv/vvMainWindow.h
vv/vvRegisterForm.cxx [new file with mode: 0644]
vv/vvRegisterForm.h [new file with mode: 0644]
vv/vvUtils.cxx
vv/vvUtils.h

index ea1eb4728e6daccea44fcb8140191e72de16d31b..a340a36f8b1a988abd6a2aa778e8047d01eaacc6 100644 (file)
@@ -1,7 +1,7 @@
 #=========================================================
 # CLITK = Command Line ITK
-cmake_minimum_required(VERSION 2.4)
-cmake_policy(VERSION 2.4)
+cmake_minimum_required(VERSION 2.8)
+cmake_policy(VERSION 2.8)
 if(COMMAND cmake_policy)
     cmake_policy(SET CMP0003 NEW)
 endif(COMMAND cmake_policy)
@@ -12,6 +12,15 @@ PROJECT(clitk)
 INCLUDE(cmake/common.cmake)
 #=========================================================
 
+#=========================================================
+#Support for the CTest dashboard testing system
+OPTION(BUILD_TESTING "Build the testing tree" OFF)
+IF (BUILD_TESTING)
+  OPTION(CLITK_BUILD_TESTING "Test ITK" ON)
+  INCLUDE(CTest)
+ENDIF(BUILD_TESTING)
+#=========================================================
+
 #=========================================================
 # Find ITK (required)
 FIND_PACKAGE(ITK)
@@ -80,9 +89,9 @@ INCLUDE_DIRECTORIES(itk filters segmentation registration tools ${PROJECT_BINARY
 
 # Select what is compiled
 ADD_SUBDIRECTORY(common)
-add_subdirectory(tools)
-add_subdirectory(segmentation)
-add_subdirectory(registration)
+ADD_SUBDIRECTORY(tools)
+ADD_SUBDIRECTORY(segmentation)
+ADD_SUBDIRECTORY(registration)
 
 
 # Compilation options
@@ -98,15 +107,7 @@ ENDIF(CLITK_BUILD_VV)
 
 
 #=========================================================
-#Support for the CTest dashboard testing system
-OPTION(CLITK_BUILD_TESTING "Build the testing tree" OFF)
-#=========================================================
-IF (CLITK_BUILD_TESTING)
-  ENABLE_TESTING()
+# Build test when vv has been compiled
+IF(BUILD_TESTING)
   ADD_SUBDIRECTORY(tests)
-ENDIF(CLITK_BUILD_TESTING)
-#=========================================================
-
-
-#=========================================================
-
+ENDIF(BUILD_TESTING)
index 81c2402c7bf69dd79e15511501fee62f03eddbab..7d86bb044587843d6d7a6a0693537d2915efda33 100644 (file)
@@ -1,7 +1,12 @@
-set(CTEST_PROJECT_NAME "vv_itk4")
-set(CTEST_NIGHTLY_START_TIME "1:00:00 UTC")
-
-set(CTEST_DROP_METHOD "http")
-set(CTEST_DROP_SITE "www.cdash.org")
-set(CTEST_DROP_LOCATION "/CDash/submit.php?project=Insight")
+SET(CTEST_PROJECT_NAME "vv")
+SET(CTEST_NIGHTLY_START_TIME "00:00:00 EST")
 set(CTEST_DROP_SITE_CDASH TRUE)
+IF(NOT DEFINED CTEST_DROP_METHOD)
+  SET(CTEST_DROP_METHOD "http")
+ENDIF(NOT DEFINED CTEST_DROP_METHOD)
+
+IF(CTEST_DROP_METHOD STREQUAL "http")
+  SET(CTEST_DROP_SITE "localhost")
+  SET(CTEST_DROP_LOCATION "/cdash/submit.php?project=vv")
+  SET(CTEST_TRIGGER_SITE "")
+ENDIF(CTEST_DROP_METHOD STREQUAL "http")
diff --git a/DartConfiguration.tcl b/DartConfiguration.tcl
new file mode 100644 (file)
index 0000000..789d086
--- /dev/null
@@ -0,0 +1,90 @@
+# This file is configured by CMake automatically as DartConfiguration.tcl
+# If you choose not to use CMake, this file may be hand configured, by
+# filling in the required variables.
+
+
+# Configuration directories and files
+SourceDirectory: /home/mpech/workspace/vvSource
+BuildDirectory: /home/mpech/workspace/vvSource
+
+# Where to place the cost data store
+CostDataFile: 
+
+# Site is something like machine.domain, i.e. pragmatic.crd
+Site: russule
+
+# Build name is osname-revision-compiler, i.e. Linux-2.4.2-2smp-c++
+BuildName: Linux-c++
+
+# Submission information
+IsCDash: TRUE
+CDashVersion: 
+QueryCDashVersion: 
+DropSite: localhost
+DropLocation: /cdash/submit.php?project=vv
+DropSiteUser: 
+DropSitePassword: 
+DropSiteMode: 
+DropMethod: http
+TriggerSite: 
+ScpCommand: /usr/bin/scp
+
+# Dashboard start time
+NightlyStartTime: 00:00:00 EST
+
+# Commands for the build/test/submit cycle
+ConfigureCommand: "/usr/bin/cmake" "/home/mpech/workspace/vvSource"
+MakeCommand: /usr/bin/gmake -i
+DefaultCTestConfigurationType: Release
+
+# CVS options
+# Default is "-d -P -A"
+CVSCommand: /usr/bin/cvs
+CVSUpdateOptions: -d -A -P
+
+# Subversion options
+SVNCommand: /usr/bin/svn
+SVNUpdateOptions: 
+
+# Git options
+GITCommand: /usr/bin/git
+GITUpdateOptions: 
+GITUpdateCustom: 
+
+# Generic update command
+UpdateCommand: /usr/bin/git
+UpdateOptions: 
+UpdateType: git
+
+# Compiler info
+Compiler: /usr/bin/c++
+
+# Dynamic analysis and coverage
+PurifyCommand: 
+ValgrindCommand: 
+ValgrindCommandOptions: 
+MemoryCheckCommand: MEMORYCHECK_COMMAND-NOTFOUND
+MemoryCheckCommandOptions: 
+MemoryCheckSuppressionFile: 
+CoverageCommand: /usr/bin/gcov
+
+# Cluster commands
+SlurmBatchCommand: SLURM_SBATCH_COMMAND-NOTFOUND
+SlurmRunCommand: SLURM_SRUN_COMMAND-NOTFOUND
+
+# Testing options
+# TimeOut is the amount of time in seconds to wait for processes
+# to complete during testing.  After TimeOut seconds, the
+# process will be summarily terminated.
+# Currently set to 25 minutes
+TimeOut: 1500
+
+UseLaunchers: 
+CurlOptions: 
+# warning, if you add new options here that have to do with submit,
+# you have to update cmCTestSubmitCommand.cxx
+
+# For CTest submissions that timeout, these options
+# specify behavior for retrying the submission
+CTestSubmitRetryDelay: 5
+CTestSubmitRetryCount: 3
index 589d108cbeb90013f9d73c26eb971b95027c33d1..ebe4dff285808e01b16ec47eef0df5c969723bd3 100644 (file)
@@ -56,3 +56,9 @@ TARGET_LINK_LIBRARIES(clitkDicomRTStruct vtkHybrid)
 
 #ADD_LIBRARY(clitkCommonShared SHARED ${clitkCommon_SRC})
 #SET_TARGET_PROPERTIES(clitkCommonShared PROPERTIES COMPILE_FLAGS -fPIC)
+
+#passing environnment variable
+configure_file (
+ globals.h.in
+ globals.h
+)
diff --git a/common/globals.h.in b/common/globals.h.in
new file mode 100644 (file)
index 0000000..14395c0
--- /dev/null
@@ -0,0 +1,2 @@
+#define OS_NAME "@CMAKE_SYSTEM@"
+                              
\ No newline at end of file
index e15b097a4a7660dafa54b1cf983aee760684eb6a..59a01878ef3210de7d3bc7070ded39dcb4670904 100644 (file)
@@ -1,22 +1,37 @@
-# Tests are organized to mirror the clitk directory tree. 
-# Eacho subdirectory has its own CMakeLists.txt with the compiling directives
+macro(ADD_GOOGLE_TESTS executable)
+  foreach ( source ${ARGN} )
+    file(READ "${source}" contents)
+    string(REGEX MATCHALL "TEST_?F?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents})
+    foreach(hit ${found_tests})
+      string(REGEX REPLACE ".*\\(([A-Za-z_0-9]+)[, ]*([A-Za-z_0-9]+)\\).*" "\\1.\\2" test_name ${hit})
+      add_test(${test_name} ${executable} --gtest_filter=${test_name})
+    endforeach(hit)
+  endforeach()
+endmacro()
+SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/tests/bin)
+SET(BUILDNAME ${CMAKE_SYSTEM_NAME}${CMAKE_OSX_ARCHITECTURES} CACHE INTERNAL DOCSTRING)
+SET(CLITK_DATA_PATH ${PROJECT_BINARY_DIR}/tests/data/ CACHE STRING "dataTest path")
+#todo  test if data test path exists
 
-IF (CLITK_BUILD_TESTING)
+ADD_DEFINITIONS(-DCLITK_DATA_PATH=\"${CLITK_DATA_PATH}\")
 
-  set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/tests/bin)
-
-  # default data path is searched in the project source tree
-  FIND_PATH(CLITK_DATA_PATH data PATHS ${PROJECT_SOURCE_DIR})
-  IF (CLITK_DATA_PATH STREQUAL "CLITK_DATA_PATH-NOTFOUND" OR CLITK_DATA_PATH STREQUAL "")
-    MESSAGE("Data path must be given when tests are enabled.")
-  ENDIF (CLITK_DATA_PATH STREQUAL "CLITK_DATA_PATH-NOTFOUND" OR CLITK_DATA_PATH STREQUAL "")
-
-  set(CLITK_DATA_PATH ${CLITK_DATA_PATH}/data)
-  ADD_DEFINITIONS(-DCLITK_DATA_PATH='"${CLITK_DATA_PATH}"')
+add_library(gtest UNKNOWN IMPORTED)
+set(GTEST_DIR ${ITK_DIR}/../gtest/ CACHE STRING "gtestDir")
+#if windows gtestLibName=gtest.dll else libgtest.a
+set(gtestLibName libgtest.a)
+set(GTEST_LIB ${GTEST_DIR}/build/${gtestLibName})
+message(gtestlib name = ${GTEST_LIB})
+set_property(TARGET gtest PROPERTY IMPORTED_LOCATION "${GTEST_LIB}")
+include_directories(${GTEST_DIR}/include/)
 
+IF(CLITK_BUILD_TOOLS)
   ADD_SUBDIRECTORY(tools)
-  #ADD_SUBDIRECTORY(segmentation)
-  #ADD_SUBDIRECTORY(registration)
-  #ADD_SUBDIRECTORY(common)
+ENDIF()
+IF(CLITK_BUILD_VV)
+  ADD_SUBDIRECTORY(vv)
+ENDIF()
+#   ADD_SUBDIRECTORY(segmentation)
+#   ADD_SUBDIRECTORY(registration)
+#   ADD_SUBDIRECTORY(common)
+
 
-ENDIF(CLITK_BUILD_TESTING)
index 950194e4b0d9d898c538e3ff7135eea12dac97f3..ad57d590876a8ac5f1d4b6a7eeba817c35303a26 100644 (file)
@@ -1,17 +1,14 @@
-# Add test apps and test executions to this part
-# Test apps are compiled as any other app in the
-# project. Test executions are run using "make test"
-#
-IF(CLITK_BUILD_TESTING)
+include_directories(
+  ${PROJECT_SOURCE_DIR}/common
+  ${PROJECT_SOURCE_DIR}/tools
+  ${GTEST_DIR}/include
+)
 
-  # clitkImageInfo
-  ADD_EXECUTABLE(clitkImageInfoTest clitkImageInfoTest.cxx)
-  TARGET_LINK_LIBRARIES(clitkImageInfoTest ITKIO)
-  ADD_TEST(NAME clitkImageInfoTest COMMAND clitkImageInfoTest)
+FILE(GLOB srcs *.cxx)
+ADD_EXECUTABLE(toolsTest ${srcs})
+ADD_DEFINITIONS(-DTOOLS_PATH=\"${PROJECT_BINARY_DIR}/bin/\")
+target_link_libraries(toolsTest vvLib ${vvExternalLibs} gtest)
 
-  # clitkWriteDicomSeries
-  ADD_EXECUTABLE(clitkWriteDicomSeriesTest clitkWriteDicomSeriesTest.cxx)
-  TARGET_LINK_LIBRARIES(clitkWriteDicomSeriesTest ITKIO)
-  ADD_TEST(NAME clitkWriteDicomSeriesTest COMMAND clitkWriteDicomSeriesTest)
-
-ENDIF(CLITK_BUILD_TESTING)
+# Add all tests found in the source code, calling the executable to run them
+add_google_tests ( ${EXECUTABLE_OUTPUT_PATH}/toolsTest ${srcs})
+SET(BUILDNAME ${BUILDNAME}_tools CACHE INTERNAL DOCSTRING)
\ No newline at end of file
index e7cc921d49d54534c91570d8e8efd652d9ba5dbf..5e7476bc9add5f989fd1efd62fd42b2a1454c05c 100644 (file)
   - BSD        See included LICENSE.txt file
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
 ===========================================================================*/
-#include <cstdlib>
-#include <cstdio>
-
 #include <iostream>
 #include <sstream>
 #include <string>
-
+#include <fstream>
+#include "gtest/gtest.h"
+#include "stdio.h"
 #include <itksys/SystemTools.hxx>
-
-
-const size_t NUMTESTS=2;
-
-// test files
-const char mhd_files[NUMTESTS][128] = {
-  CLITK_DATA_PATH"/4d/mhd/00.mhd",
-  CLITK_DATA_PATH"/4d/mhd/bh.mhd"
-};
-
-// pre-written validation files. the idea
-// is that the output generated from the test
-// files match the verification files
-const char validation_files[NUMTESTS][128] = {
-  CLITK_DATA_PATH"/tools/clitkImageInfoTestValidate3D.out",
-  CLITK_DATA_PATH"/tools/clitkImageInfoTestValidate4D.out"
-};
-
-int main(int argc, char** argv)
-{
-  system("pwd");
+static inline void compare(std::string mhd, std::string ref){
+  std::ostringstream cmd_line;
+  ASSERT_TRUE(itksys::SystemTools::FileExists(mhd.c_str(), true));
+  cmd_line << TOOLS_PATH<<"clitkImageInfo " << mhd << " > clitkImageInfoTest.out";
+  std::cout << "Executing " << cmd_line.str() << std::endl;
+  system(cmd_line.str().c_str());
   
-  bool failed = false;
-  for (size_t i = 0; i < NUMTESTS; i++) {
-    std::ostringstream cmd_line;
-    cmd_line << "clitkImageInfo " << mhd_files[i] << " > clitkImageInfoTest.out";
-
-    std::cout << "Executing " << cmd_line.str() << std::endl;
-    system(cmd_line.str().c_str());
-    
-    // compare output with validation file
-    std::cout << "Validating output against " << validation_files[i] << std::endl;
-    bool differ = itksys::SystemTools::FilesDiffer("clitkImageInfoTest.out", validation_files[i]);
-    if (differ)
-    {
-      failed = true;
-      std::cout << "FAILED: Program output and reference do not match." << std::endl;
-    }
-    else
-    {
-      itksys::SystemTools::RemoveFile("clitkImageInfoTest.out");
-      std::cout << "PASSED" << std::endl;
-    }
-  }
-  return failed ? -1 : 0;
+  bool differ = itksys::SystemTools::FilesDiffer("clitkImageInfoTest.out", ref.c_str());
+  remove("clitkImageInfoTest.out");
+  EXPECT_FALSE(differ);
+}
+TEST(clitkImageInfoTest, main){
+  std::string mhd1=std::string(CLITK_DATA_PATH)+"4d/mhd/00.mhd";
+  std::string ref1=std::string(CLITK_DATA_PATH)+"tools/clitkImageInfoTestValidate3D.out";
+  compare(mhd1, ref1);
+  
+  std::string mhd2=std::string(CLITK_DATA_PATH)+"4d/mhd/bh.mhd";
+  std::string ref2=std::string(CLITK_DATA_PATH)+"tools/clitkImageInfoTestValidate4D.out";
+  compare(mhd2, ref2);
 }
\ No newline at end of file
index 6f53ef5f832435b398c94e2d5d5914a973bb57bd..bc63080a459b6c104046b75ae4aba47dab66c8d5 100644 (file)
   - BSD        See included LICENSE.txt file
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
 ===========================================================================*/
-#include <cstdlib>
-#include <cstdio>
-
 #include <iostream>
 #include <sstream>
-#include <cassert>
-
+#include "gtest/gtest.h"
 #include <itksys/SystemTools.hxx>
-
-const size_t NUMTESTS=1;
-
-const char mhd_files[NUMTESTS][128] = {
-  CLITK_DATA_PATH"/3d/mhd/00.mhd"
-};
-
-const char dcm_dirs[NUMTESTS][128] = {
-  CLITK_DATA_PATH"/3d/dcm/1.2.840.113704.1.111.536.1248695032.26"
-};
-
-int main(int argc, char** argv)
-{
-  bool failed = false;
-  for (size_t i = 0; i < NUMTESTS; i++) {
-    std::ostringstream cmd_line;
-    cmd_line << "clitkWriteDicomSeries -i " << mhd_files[i] << " -d " << dcm_dirs[i] << " -o dcm --verbose";
-
-    std::cout << "Executing " << cmd_line.str() << std::endl;
-    int err = system(cmd_line.str().c_str());
-    if (err != 0)
-    {
-      failed = true;
-      std::cout << "FAILED (errno = " << err << ")" << std::endl;
-    }
-    else
-    {
-      itksys::SystemTools::RemoveADirectory("dcm");
-      std::cout << "PASSED" << std::endl;
-    }
-  }
-  return failed ? -1 : 0;
+TEST(clitkWriteDicomSeriesTest, main){
+  
+  std::string fIn=std::string(CLITK_DATA_PATH)+"/3d/mhd/00.mhd";
+  std::string fOut=std::string(CLITK_DATA_PATH)+"/3d/dcm/1.2.840.113704.1.111.536.1248695032.26";
+  ASSERT_TRUE(itksys::SystemTools::FileExists(fIn.c_str(), true));
+  std::ostringstream cmd_line;
+  cmd_line << TOOLS_PATH <<"clitkWriteDicomSeries -i " << fIn << " -d " << fOut << " -o dcm --verbose";
+  EXPECT_TRUE(itksys::SystemTools::FileExists(fOut.c_str(), false));
+  EXPECT_TRUE(itksys::SystemTools::FileExists("dcm", false));
+  EXPECT_EQ(0, system(cmd_line.str().c_str()));
+  //does directory exists
+  itksys::SystemTools::RemoveADirectory("dcm");
 }
\ No newline at end of file
diff --git a/tests/tools/vvMainTest.cxx b/tests/tools/vvMainTest.cxx
new file mode 100644 (file)
index 0000000..9d00e8a
--- /dev/null
@@ -0,0 +1,5 @@
+#include "gtest/gtest.h"
+int main(int argc, char** argv){
+  ::testing::InitGoogleTest(&argc, argv);
+  return RUN_ALL_TESTS();
+}
diff --git a/tests/vv/CMakeLists.txt b/tests/vv/CMakeLists.txt
new file mode 100644 (file)
index 0000000..492e8f7
--- /dev/null
@@ -0,0 +1,22 @@
+include_directories(
+  ${PROJECT_SOURCE_DIR}/vv
+  ${PROJECT_BINARY_DIR}/vv
+  ${QT_INCLUDES}
+  ${QT_INCLUDE_DIR}
+  ${QT_QTGUI_INCLUDE_DIR}
+  ${QT_QTCORE_INCLUDE_DIR}
+  ${QT_QTNETWORK_INCLUDE_DIR}
+  ${PROJECT_SOURCE_DIR}/common
+  ${PROJECT_SOURCE_DIR}/tools
+  ${PROJECT_SOURCE_DIR}/segmentation
+  ${QT_LIBRARY_DIR}
+  ${GTEST_DIR}/include
+)
+
+FILE(GLOB srcs *.cxx)
+ADD_EXECUTABLE(vvTest ${srcs})
+target_link_libraries(vvTest vvLib ${vvExternalLibs} gtest)
+
+# Add all tests found in the source code, calling the executable to run them
+add_google_tests ( ${EXECUTABLE_OUTPUT_PATH}/vvTest ${srcs})
+SET(BUILDNAME ${BUILDNAME}_vv CACHE INTERNAL DOCSTRING)
diff --git a/tests/vv/vvMainTest.cxx b/tests/vv/vvMainTest.cxx
new file mode 100644 (file)
index 0000000..0efcdef
--- /dev/null
@@ -0,0 +1,8 @@
+#include "gtest/gtest.h"
+#include <iostream>
+#include <QApplication>
+int main(int argc, char** argv){
+  QApplication* q=new QApplication ( argc, argv );
+  ::testing::InitGoogleTest(&argc, argv);
+  return RUN_ALL_TESTS();
+}
diff --git a/tests/vv/vvRegisterFormTest.cxx b/tests/vv/vvRegisterFormTest.cxx
new file mode 100644 (file)
index 0000000..9537602
--- /dev/null
@@ -0,0 +1,52 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.fr/
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
+  - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================*/
+#include "vvRegisterForm.h"
+#include <QUrl>
+#include <QSettings>
+#include "gtest/gtest.h"
+#include "vvCommon.h"
+#include <stdio.h>
+#include <fstream>
+const std::string data_path = "/home/mpech/workspace/vvSource/tests/data/";
+TEST(vvRegisterForm, canPush){
+  QUrl url;
+  //the file exists with some old lines
+  vvRegisterForm* v=new vvRegisterForm(url, QString::fromStdString(data_path+".settingsCanPush.txt"), QSettings::NativeFormat);
+  std::ifstream inFile((data_path+".settingsCanPush.txt").c_str(), std::ifstream::in);
+  ASSERT_FALSE(inFile.fail());
+  EXPECT_TRUE(v->canPush());
+  
+  //the file doesn't exist
+  vvRegisterForm* v2=new vvRegisterForm(url, QString::fromStdString(data_path+".settings_notFound.txt"), QSettings::NativeFormat);
+  EXPECT_TRUE(v2->canPush());
+  
+  //the current version is the same
+  QString strSettings=QString::fromStdString(data_path+".settings2.txt");
+  QSettings settings(strSettings, QSettings::NativeFormat);
+  settings.setValue("vvVersion", VV_VERSION);
+  vvRegisterForm* v3=new vvRegisterForm(url, strSettings, QSettings::NativeFormat);
+  EXPECT_FALSE(v3->canPush());
+}
+TEST(vvRegisterForm, acquitPushed){
+  QUrl url;
+  vvRegisterForm* v=new vvRegisterForm(url, QString::fromStdString(data_path+".settingsAcquit.txt"), QSettings::NativeFormat);
+  ASSERT_TRUE(v->canPush());
+  v->acquitPushed();
+  EXPECT_FALSE(v->canPush());
+  remove((data_path+".settingsAcquit.txt").c_str());
+}
index ca6152b39b91137024b6170d8cc69745c4bd1cb3..4d5c36b1292e1c1ad4398697ccb3daae66aceebe 100644 (file)
@@ -7,6 +7,7 @@ if(COMMAND cmake_policy)
 endif(COMMAND cmake_policy)
 #=========================================================
 
+
 #=========================================================
 #List of vv tools to compile
 SET(vv_TOOLS
@@ -62,6 +63,7 @@ SET(vv_COMMON_WITH_UI
   vvToolSimpleInputSelectorWidget
   vvToolInputSelectorWidget
   vvToolStructureSetManager
+  vvRegisterForm
 )
 
 # All others sources
@@ -113,10 +115,12 @@ QT4_WRAP_CPP(vv_SRCS
   vvStructureSetActor.h
   vvROIActor.h
   vvToolCreatorBase.h
+  vvRegisterForm.h
   )
 
 QT4_WRAP_UI(vv_UI_CXX 
   qt_ui/vvHelpDialog.ui 
+  qt_ui/vvRegisterForm.ui 
   qt_ui/vvDocumentation.ui 
   qt_ui/vvDicomSeriesSelector.ui 
   qt_ui/vvDummyWindow.ui #For testing
@@ -130,13 +134,11 @@ foreach(tool ${vv_TOOLS} ${vv_COMMON_WITH_UI})
     QT4_WRAP_CPP(vv_SRCS ${tool}.h)
     QT4_WRAP_UI(vv_UI_CXX qt_ui/${tool}.ui)
 endforeach(tool)
-
 #Add the common source files
 foreach(tool ${vv_COMMON})
     SET(vv_SRCS ${vv_SRCS} ${tool}.cxx)
     QT4_WRAP_CPP(vv_SRCS ${tool}.h)
 endforeach(tool)
-
 # if Windows and Qt was built as a static lib then don't set QT_DLL flag
 SET(QT_STATIC 0)
 IF (WIN32)
@@ -184,22 +186,25 @@ IF(WIN32)
 ENDIF(WIN32)
 
 LINK_DIRECTORIES(${QT_LIBRARY_DIR})
-ADD_EXECUTABLE(vv ${vv_SRCS} vv.cxx ${vv_UI_CXX} ${EXE_ICON})
-ADD_DEPENDENCIES(vv clitkSegmentationGgoLib)
-TARGET_LINK_LIBRARIES(vv clitkDicomRTStruct)
-
 #=========================================================
 #Add each tool's dependencies
 foreach(tool ${vv_TOOLS})
-    target_link_libraries(vv ${${tool}_LIBS})
+  SET(toolLibs ${toolLibs} ${${tool}_LIBS})
 endforeach(tool)
-
 #=========================================================
 #Add Foundation Libraries (this should be after our libraries, since we depend
 #on them)
-TARGET_LINK_LIBRARIES(vv
-clitkCommon ${ITK_LIBRARIES} QVTK vtkHybrid)
+SET(foundationLibraries clitkCommon ${ITK_LIBRARIES} QVTK vtkHybrid)
 
+#=========================================================
+#Create binary and libs for tests
+SET(vvExternalLibs clitkSegmentationGgoLib clitkDicomRTStruct ${toolLibs} ${foundationLibraries} CACHE INTERNAL DOCSTRING)
+ADD_EXECUTABLE(vv ${vv_SRCS} vv.cxx ${vv_UI_CXX} ${EXE_ICON})
+ADD_DEPENDENCIES(vv clitkSegmentationGgoLib)
+IF(BUILD_TESTING)
+  target_link_libraries(vv ${vvExternalLibs})
+  add_library(vvLib ${vv_SRCS} vv.cxx ${vv_UI_CXX} ${EXE_ICON})
+ENDIF(BUILD_TESTING)
 #=========================================================
 # Install options (also used by CPack)
 IF(UNIX AND NOT APPLE)
@@ -256,3 +261,6 @@ ELSE(WIN32)
 ENDIF(WIN32)
 INCLUDE(CPack)
 #=========================================================
+#=========================================================
+configure_file(vvCommon.h.in vvCommon.h)
+#=========================================================
\ No newline at end of file
diff --git a/vv/qt_ui/vvRegisterForm.ui b/vv/qt_ui/vvRegisterForm.ui
new file mode 100644 (file)
index 0000000..d700b0c
--- /dev/null
@@ -0,0 +1,207 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>vvRegisterForm</class>
+ <widget class="QDialog" name="vvRegisterForm">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>389</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <widget class="QDialogButtonBox" name="buttonBox">
+   <property name="geometry">
+    <rect>
+     <x>40</x>
+     <y>260</y>
+     <width>341</width>
+     <height>32</height>
+    </rect>
+   </property>
+   <property name="orientation">
+    <enum>Qt::Horizontal</enum>
+   </property>
+   <property name="standardButtons">
+    <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="firstName">
+   <property name="geometry">
+    <rect>
+     <x>110</x>
+     <y>150</y>
+     <width>241</width>
+     <height>21</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label">
+   <property name="geometry">
+    <rect>
+     <x>40</x>
+     <y>150</y>
+     <width>71</width>
+     <height>20</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>First name</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_2">
+   <property name="geometry">
+    <rect>
+     <x>40</x>
+     <y>170</y>
+     <width>71</width>
+     <height>20</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Last name</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lastName">
+   <property name="geometry">
+    <rect>
+     <x>110</x>
+     <y>170</y>
+     <width>241</width>
+     <height>21</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="email">
+   <property name="geometry">
+    <rect>
+     <x>110</x>
+     <y>190</y>
+     <width>241</width>
+     <height>21</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="group">
+   <property name="geometry">
+    <rect>
+     <x>110</x>
+     <y>210</y>
+     <width>241</width>
+     <height>21</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_3">
+   <property name="geometry">
+    <rect>
+     <x>40</x>
+     <y>190</y>
+     <width>71</width>
+     <height>20</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Email</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_4">
+   <property name="geometry">
+    <rect>
+     <x>40</x>
+     <y>210</y>
+     <width>71</width>
+     <height>20</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Institute</string>
+   </property>
+  </widget>
+  <widget class="QTextBrowser" name="textBrowser">
+   <property name="geometry">
+    <rect>
+     <x>40</x>
+     <y>10</y>
+     <width>311</width>
+     <height>121</height>
+    </rect>
+   </property>
+   <property name="html">
+    <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Thank you for using vv!&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;We would like to know more about our vv users. Those informations are private and will not be shared to any other society.&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;The data which will be sent are the facultative input to fill below, and the operating system name.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_5">
+   <property name="geometry">
+    <rect>
+     <x>40</x>
+     <y>240</y>
+     <width>61</width>
+     <height>20</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>OS name</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="osName">
+   <property name="geometry">
+    <rect>
+     <x>110</x>
+     <y>240</y>
+     <width>241</width>
+     <height>20</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>OS name</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>vvRegisterForm</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>vvRegisterForm</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/vv/vvCommon.h.in b/vv/vvCommon.h.in
new file mode 100644 (file)
index 0000000..7ad04e6
--- /dev/null
@@ -0,0 +1,2 @@
+#define VV_VERSION "v@CPACK_PACKAGE_VERSION_MAJOR@.@CPACK_PACKAGE_VERSION_MINOR@.@CPACK_PACKAGE_VERSION_PATCH@"
+                              
\ No newline at end of file
index 18020b1cc3cb8b61b6d60ac4893bdc2845ea6156..5225a036664de71c6f85b9046904aa0a71ac28f1 100644 (file)
 #include <QInputDialog>
 #include <QTimer>
 #include "QTreePushButton.h"
+#include <QUrl>
+#include <QSettings>
 
 // VV include
 #include "vvMainWindow.h"
 #include "vvHelpDialog.h"
+#include "vvRegisterForm.h"
 #include "vvDocumentation.h"
 #include "vvProgressDialog.h"
 #include "vvQDicomSeriesSelector.h"
@@ -306,17 +309,10 @@ vvMainWindow::vvMainWindow():vvMainWindowBase()
 
   //Recently opened files
   std::list<std::string> recent_files = GetRecentlyOpenedImages();
+  recentlyOpenedFilesMenu=NULL;
   if ( !recent_files.empty() ) {
-    QMenu * rmenu = new QMenu("Recently opened files...");
-    rmenu->setIcon(QIcon(QString::fromUtf8(":/common/icons/open.png")));
-    menuFile->insertMenu(actionOpen_Image_With_Time,rmenu);
-    menuFile->insertSeparator(actionOpen_Image_With_Time);
-    for (std::list<std::string>::iterator i = recent_files.begin(); i!=recent_files.end(); i++) {
-      QAction* current=new QAction(QIcon(QString::fromUtf8(":/common/icons/open.png")),
-                                   (*i).c_str(),this);
-      rmenu->addAction(current);
-      connect(current,SIGNAL(triggered()),this,SLOT(OpenRecentImage()));
-    }
+    createRecentlyOpenedFilesMenu();
+    updateRecentlyOpenedFilesMenu(recent_files);
   }
 
   // Adding all new tools (insertion in the menu)
@@ -330,11 +326,17 @@ vvMainWindow::vvMainWindow():vvMainWindowBase()
   //timerMemory->setInterval(5);
   connect(timerMemory, SIGNAL(timeout()), this, SLOT(UpdateMemoryUsage()));
   timerMemory->start(2000);
-  
 }
 //------------------------------------------------------------------------------
 
-
+void vvMainWindow::show(){
+  vvMainWindowBase::show();
+  vvRegisterForm* registerForm = new vvRegisterForm(QUrl("http://localhost/vvregister/write.php"), getVVSettingsPath(), getSettingsOptionFormat());
+  if(registerForm->canPush()){
+    registerForm->show();
+    registerForm->acquitPushed();//too bad if there is not internet connection anymore.
+  }
+}
 //------------------------------------------------------------------------------
 void vvMainWindow::UpdateMemoryUsage()
 {
@@ -345,6 +347,35 @@ void vvMainWindow::UpdateMemoryUsage()
 //------------------------------------------------------------------------------
 
 
+//------------------------------------------------------------------------------
+void vvMainWindow::createRecentlyOpenedFilesMenu()
+{
+    recentlyOpenedFilesMenu = new QMenu("Recently opened files...");
+    recentlyOpenedFilesMenu->setIcon(QIcon(QString::fromUtf8(":/common/icons/open.png")));
+    menuFile->insertMenu(actionOpen_Image_With_Time,recentlyOpenedFilesMenu);
+    menuFile->insertSeparator(actionOpen_Image_With_Time);
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+
+void vvMainWindow::updateRecentlyOpenedFilesMenu(const std::list<std::string> &recent_files)
+{
+  if(recentlyOpenedFilesMenu==NULL){
+    createRecentlyOpenedFilesMenu();
+  }else{
+    recentlyOpenedFilesMenu->clear();
+  }
+  for (std::list<std::string>::const_iterator i = recent_files.begin(); i!=recent_files.end(); i++) {
+    QAction* current=new QAction(QIcon(QString::fromUtf8(":/common/icons/open.png")), i->c_str(),this);
+    recentlyOpenedFilesMenu->addAction(current);
+    connect(current,SIGNAL(triggered()),this,SLOT(OpenRecentImage()));
+  }
+}
+//------------------------------------------------------------------------------
+
+
 //------------------------------------------------------------------------------
 void vvMainWindow::ComputeMidPosition()
 {
@@ -790,6 +821,7 @@ void vvMainWindow::LoadImages(std::vector<std::string> files, vvImageReader::Loa
   if (files.size() == 1) {
     QFileInfo finfo=tr(files[0].c_str());
     AddToRecentlyOpenedImages(finfo.absoluteFilePath().toStdString());
+    updateRecentlyOpenedFilesMenu(GetRecentlyOpenedImages());
   }
   //init the progress events
   QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
index d95e7fa166e0468f68e12ee24b8f910e205293fb..22e2b55dccc3f77fca48f77b6f434c2207735f61 100644 (file)
@@ -152,7 +152,13 @@ public slots:
   }
   void UpdateRenderWindows();
   void UpdateMemoryUsage();
-
+  void show();
+  
+protected:
+  
+  void createRecentlyOpenedFilesMenu();
+  void updateRecentlyOpenedFilesMenu(const std::list<std::string> &files);
+  
 private:
 
   //variables
@@ -184,6 +190,7 @@ private:
   int GetImageDuplicateFilenameNumber(std::string filename);
 
   QMenu contextMenu;
+  QMenu* recentlyOpenedFilesMenu;
   //QMenu *AddSubImageMenu;
   std::vector<QAction*> contextActions;
   std::vector<QSlider*> horizontalSliders;
diff --git a/vv/vvRegisterForm.cxx b/vv/vvRegisterForm.cxx
new file mode 100644 (file)
index 0000000..839887f
--- /dev/null
@@ -0,0 +1,66 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.fr/
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
+  - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+#include <QApplication>
+
+#include "vvRegisterForm.h"
+#include <QNetworkRequest>
+#include <QDir>
+#include "common/globals.h"
+#include "vvCommon.h"
+#include "vvUtils.h"
+
+vvRegisterForm::vvRegisterForm(QUrl url, QString path, QSettings::Format format):url(url), settings(path, format){ 
+  manager = new QNetworkAccessManager(this);
+  setupUi(this);
+}
+
+void vvRegisterForm::sendData(){
+  QUrl url2(url);
+  url2.addQueryItem("name", firstName->text().toUtf8());
+  url2.addQueryItem("lastName", lastName->text().toUtf8());
+  url2.addQueryItem("email", email->text().toUtf8());
+  url2.addQueryItem("group", group->text().toUtf8());
+  url2.addQueryItem("os", osName->text().toUtf8());
+  url2.addQueryItem("vvVersion", VV_VERSION);
+  manager->get(QNetworkRequest(url2));
+}
+void vvRegisterForm::accept(){
+  sendData();
+  settings.setValue("name", firstName->text().toUtf8());
+  settings.setValue("lastName", lastName->text().toUtf8());
+  settings.setValue("email", email->text().toUtf8());
+  settings.setValue("group", group->text().toUtf8());
+  settings.setValue("os", osName->text().toUtf8());
+  QDialog::accept();
+}
+bool vvRegisterForm::canPush(){
+  ///maybe we show this dialog only for new major release, not for any patches?
+  return settings.value("vvVersion").toString().toStdString()<VV_VERSION;
+}
+void vvRegisterForm::acquitPushed(){
+  settings.setValue("vvVersion", VV_VERSION);
+}
+void vvRegisterForm::show(){
+ firstName->setText(settings.value("name").toString());
+ lastName->setText(settings.value("lastName").toString()); 
+ email->setText(settings.value("email").toString()); 
+ group->setText(settings.value("group").toString()); 
+  
+ osName->setText(QString::fromStdString(OS_NAME));
+ QDialog::show();
+}
\ No newline at end of file
diff --git a/vv/vvRegisterForm.h b/vv/vvRegisterForm.h
new file mode 100644 (file)
index 0000000..ab41f39
--- /dev/null
@@ -0,0 +1,44 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to: 
+  - University of LYON              http://www.universite-lyon.fr/
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
+  - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+#ifndef vvRegisterForm_h
+#define vvRegisterForm_h
+
+#include "ui_vvRegisterForm.h"
+#include <QUrl>
+#include <QSettings>
+#include <QNetworkAccessManager>
+class vvRegisterForm : public QDialog, private Ui::vvRegisterForm
+{
+    Q_OBJECT
+
+public:
+    vvRegisterForm(QUrl url, QString path, QSettings::Format format);
+    void sendData();
+    ~vvRegisterForm() {}
+    virtual bool canPush();
+    virtual void acquitPushed();
+public slots:
+  virtual void accept();
+  virtual void show();
+protected:
+  QUrl url;
+  QSettings settings;
+  QNetworkAccessManager* manager;
+};
+
+#endif
index 441b4b3731970f44b92e8a7a013b6f5219ebf3d8..e9920479ec0e2e62722bec6fbaa4aaf223972ae8 100644 (file)
   - BSD        See included LICENSE.txt file
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
 ===========================================================================**/
-#include <fstream>
+#include <sstream>
 #include <algorithm>
 #include <QDir>
-
 #include "clitkCommon.h"
 #include "vvUtils.h"
 
 const std::string vv_user_file=".vv_settings.txt";
+const std::string recentFileList="recentFiles";
 typedef std::list<std::string> FileListType;
 
+QString getVVSettingsPath(){
+  return QDir::homePath()+QString::fromStdString("/"+vv_user_file);
+}
+
+QSettings::Format getSettingsOptionFormat(){
+  return QSettings::NativeFormat;
+}
+
 ///Returns the last images opened by the user
 FileListType GetRecentlyOpenedImages()
 {
-  std::ifstream in((QDir::homePath().toStdString() + "/" + vv_user_file).c_str());
-  std::string current_file;
+  QSettings settings(getVVSettingsPath(), getSettingsOptionFormat());
   FileListType result;
-  in >> current_file;
-  while (in.good()) {
-    result.push_back(current_file);
-    in >> current_file;
-  }
-  in.close();
+  settings.beginGroup(QString::fromStdString(recentFileList));
+    QStringList keys = settings.childKeys();
+    for(int i=0; i<keys.size(); i++){
+      std::string value=settings.value(QString::fromStdString (keys[i].toStdString())).toString().toStdString();
+      result.push_back(value);
+    }
+  settings.endGroup();
   return result;
 }
 
 ///Adds an image to the list of recently opened images
 void AddToRecentlyOpenedImages(std::string filename)
 {
+  QSettings settings(getVVSettingsPath(), getSettingsOptionFormat());
   FileListType file_list = GetRecentlyOpenedImages();
+  
   FileListType::iterator i = std::find(file_list.begin(),file_list.end(),filename);
   if (i != file_list.end()) // avoid dupes
     file_list.erase(i);
   while (file_list.size() >= 6) //keep list to a reasonable size
     file_list.pop_back();
   file_list.push_front(filename);
-  std::ofstream out((QDir::homePath().toStdString() + "/" + vv_user_file).c_str(),std::ios_base::out | std::ios_base::trunc);
-  for (FileListType::iterator j = file_list.begin() ; j != file_list.end() ; j++)
-    out << (*j) << std::endl;
-  out.close();
+  
+  settings.beginGroup(QString::fromStdString(recentFileList));
+    int index=0;
+    for (FileListType::iterator j = file_list.begin() ; j != file_list.end() ; j++){
+      QString s=QString(index++);
+      settings.setValue(s, QString::fromStdString ( *j ));
+    }
+  settings.endGroup();
 }
+
index f8631dd8f09af720b639f25ad2a970d60f4ff1c6..5854b5b6141c6e6221acf7d4ddf4faf1b4d7a908 100644 (file)
@@ -19,6 +19,7 @@
 #define vvXXX_h
 #include <list>
 #include <string>
+#include <QSettings>
 
 ///Returns the last images opened by the user
 std::list<std::string> GetRecentlyOpenedImages();
@@ -26,4 +27,10 @@ std::list<std::string> GetRecentlyOpenedImages();
 ///Adds an image to the list of recently opened images
 void AddToRecentlyOpenedImages(std::string filename);
 
+///path to user settings
+QString getVVSettingsPath();
+
+///by default nativeFormat
+QSettings::Format getSettingsOptionFormat();
+
 #endif