X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src2%2FcreaImageIOGimmick.cpp;h=8d1583ccac4ddd4fd75b62d39535e32e8cd05e8f;hb=71365e2ce56b1ccf93054818d5d5cf64bcbaafb4;hp=b7cc5f7b5ad1874e36fdd725515fdf2d569a3faa;hpb=f4bdead5143dc3d816f1c2f2bd9786a21c843760;p=creaImageIO.git diff --git a/src2/creaImageIOGimmick.cpp b/src2/creaImageIOGimmick.cpp index b7cc5f7..8d1583c 100644 --- a/src2/creaImageIOGimmick.cpp +++ b/src2/creaImageIOGimmick.cpp @@ -1,18 +1,19 @@ #include -#include +#include #include #include namespace creaImageIO { - + + //============================================================== Gimmick::Gimmick() + : mImageAdder(0) { - crea::MessageManager::RegisterMessageType("Gimmick!", - "Gimmick",1); + RegisterGimmickMessageTypes(); } //============================================================== @@ -27,55 +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(); - + mSynchronizer=0; // 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) + { + GimmickMessage(2,"Adding files to '"<SetTreeHandler(handler); + } + mSynchronizer->Synchronize(update); + + } + + //======================================================================== + /// + void Gimmick::Print(const std::string& d) + { + GetTreeHandler(d)->GetTree().Print(); + } + //======================================================================== + }