5 #include "clitkCommon.h"
8 const std::string vv_user_file=".vv_settings.txt";
9 typedef std::list<std::string> FileListType;
11 ///Returns the last images opened by the user
12 FileListType GetRecentlyOpenedImages()
14 std::ifstream in((QDir::homePath().toStdString() + "/" + vv_user_file).c_str());
15 std::string current_file;
20 result.push_back(current_file);
27 ///Adds an image to the list of recently opened images
28 void AddToRecentlyOpenedImages(std::string filename)
30 FileListType file_list = GetRecentlyOpenedImages();
31 FileListType::iterator i = std::find(file_list.begin(),file_list.end(),filename);
32 if (i != file_list.end()) // avoid dupes
34 while (file_list.size() >= 6) //keep list to a reasonable size
36 file_list.push_front(filename);
37 std::ofstream out((QDir::homePath().toStdString() + "/" + vv_user_file).c_str(),std::ios_base::out | std::ios_base::trunc);
38 for (FileListType::iterator j = file_list.begin() ; j != file_list.end() ; j++)
39 out << (*j) << std::endl;