X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src2%2FcreaImageIOGimmick.cpp;h=ced62fa28882e1d5ca1b9e6f6fd49dc631a3a642;hb=fc165c73bc8482c01caeee7c67405962f846a9b6;hp=a9f72644144b8171a78cf9fbea4e736e3246bd48;hpb=f08880c40f6304be640c7f8702bbbe96f8d50b40;p=creaImageIO.git diff --git a/src2/creaImageIOGimmick.cpp b/src2/creaImageIOGimmick.cpp index a9f7264..ced62fa 100644 --- a/src2/creaImageIOGimmick.cpp +++ b/src2/creaImageIOGimmick.cpp @@ -1,19 +1,19 @@ #include -#include -#include +#include #include #include namespace creaImageIO { - + + //============================================================== Gimmick::Gimmick() + : mImageAdder(0) { - crea::MessageManager::RegisterMessageType("Gimmick!", - "Gimmick",1); + RegisterGimmickMessageTypes(); } //============================================================== @@ -28,56 +28,53 @@ namespace creaImageIO //============================================================== - bool Gimmick::Initialize() + void Gimmick::Initialize() { // Create the UserSettings dir if does not exist - if (!CreateUserSettingsDirectory()) return false; + CreateUserSettingsDirectory(); // Sets the current directory to the home dir mCurrentDirectory = GetHomeDirectory(); // Create local database handler mLocalDatabase = new SQLiteTreeHandler(GetLocalDatabasePath()); + // Add it to the TreeHandlerMap + mTreeHandlerMap["Local database"] = mLocalDatabase; + // Create or open local database if (! boost::filesystem::exists( GetLocalDatabasePath() ) ) { - creaMessage("Gimmick!",1, - "[Gimmick!] Local database '"<GetTree().GetDescriptor().CreateDefault(); if ( ! mLocalDatabase->Create(true) ) { - creaMessage("Gimmick!",1, - "[Gimmick!] !! ERROR CREATING '"<SetAttribute(0,"Name","Local database"); } else { /// Open and test it - creaMessage("Gimmick!",1, - "[Gimmick!] Opening local database '" - <Open(true) ) { - creaMessage("Gimmick!",1, - "[Gimmick!] !! ERROR OPENING '"<second; + } + + + //======================================================================== + /// Add the files to the tree handler + void Gimmick::AddFiles(const std::string& d, + const std::vector& filenames) { - ImageFinder finder(mLocalDatabase); - if (finder.IsHandledFile(f)) finder.AddFile(f); - + GimmickMessage(2,"Adding files to '"<GetTree().Print(); + GetTreeHandler(d)->GetTree().Print(); } //========================================================================