X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src2%2FcreaImageIOWxGimmickView.cpp;h=447b35bc298a4a9a99a7e6e2f552f7138836614c;hb=e13ea6551e8721b11998dc33ddccf3f89458f173;hp=a77f9a7fe9de9bdc1726f0db2b1d01a3b22868ee;hpb=60067c5195c2aff6e7de8faef1cecf25f32802e4;p=creaImageIO.git diff --git a/src2/creaImageIOWxGimmickView.cpp b/src2/creaImageIOWxGimmickView.cpp index a77f9a7..447b35b 100644 --- a/src2/creaImageIOWxGimmickView.cpp +++ b/src2/creaImageIOWxGimmickView.cpp @@ -20,6 +20,7 @@ using namespace crea; #include "icons/synchronize.xpm" #include "icons/settings.xpm" #include "icons/tools.xpm" +//#include "icons/import.xpm" #include #include @@ -423,9 +424,10 @@ namespace creaImageIO mProgressDialog = new wxProgressDialog(_T("Adding directory"), _T(""), - 1000, + NumberFilesToAdd(dirname,recurse), this, - wxPD_ELAPSED_TIME | + wxPD_ELAPSED_TIME | + wxPD_SMOOTH | // wxPD_ESTIMATED_TIME | // wxPD_REMAINING_TIME | wxPD_CAN_ABORT ); @@ -442,6 +444,33 @@ namespace creaImageIO mViewer->StartPlayer(); } + + //================================================= + // Determines number of files potentially to add to database + int WxGimmickView::NumberFilesToAdd(const std::string &dirpath, bool recursive) + { + int nb = 0; + if ( !boost::filesystem::exists( dirpath ) ) return nb; + boost::filesystem::directory_iterator end_itr; // default construction yields past-the-end + for ( boost::filesystem::directory_iterator itr( dirpath ); itr != end_itr; ++itr ) + { + // If is directory & recurse : do recurse + if ( boost::filesystem::is_directory(itr->status()) ) + { + if (recursive) + { + nb += NumberFilesToAdd(itr->string(), recursive); + } + } + else + { + nb++; + } + } + return nb; + + } + //================================================= // Test a directory to know if contains sub-directory to analyze bool WxGimmickView::isNeedRecursive(std::string i_name) @@ -715,6 +744,38 @@ namespace creaImageIO dial->ShowModal(); } //================================================= + void WxGimmickView::OnImportExport(wxCommandEvent &Event) + { + wxBusyCursor busy; + // Test if one image is selected => export + // if not =>import + if (GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))]) + { + ExportImages(); + } + else + { + ImportImages(); + } + } + + void WxGimmickView::ExportImages() + { + //Archive selection: name, emplacement + //same process than copy local but to a zip + // if settings are yes "always ask for descriptor addition", ask + // if settings are yes, adding descriptor + } + + void WxGimmickView::ImportImages() + { + //Find the *.zip + //dezip + // Contain a descriptor.text + // create a new database, and add to database + // if not, add to current database + // + } //================================================= //AndresDonadio