// static void LLFloaterInventoryBackupSettings::onClickNext_continued(void* userdata, AIDirPicker* dirpicker) { LLFloaterInventoryBackupSettings* floater = (LLFloaterInventoryBackupSettings*)userdata; LLInventoryBackupOrder* order = floater->mOrder; if (!dirpicker->hasDirname()) { floater->close(); return; } std::string dirname = dirpicker->getDirname(); // Make local directory tree LLFile::mkdir(dirname); std::vector<LLInventoryCategory*>::iterator _cat_iter = order->mCats.begin(); std::vector<LLInventoryCategory*>::iterator _cat_end = order->mCats.end(); for( ; _cat_iter != _cat_end; ++_cat_iter) { std::string path = dirname + OS_SEP + LLInventoryBackup::getPath(*_cat_iter, order->mCats); LLFile::mkdir(path); } // Go go backup floater LLFloaterInventoryBackup* backup_floater = new LLFloaterInventoryBackup(dirname, order->mCats, order->mItems); backup_floater->center(); // Close myself floater->close(); }
// static void LLFloaterInventoryBackupSettings::onClickNext(void* userdata) { LLFloaterInventoryBackupSettings* floater = (LLFloaterInventoryBackupSettings*)userdata; LLInventoryBackupOrder* order = floater->mOrder; // Apply changes to filters order->mDownloadAnimations = floater->childGetValue("chk_animations"); order->mDownloadCallingCards = floater->childGetValue("chk_callingcards"); order->mDownloadGestures = floater->childGetValue("chk_gestures"); order->mDownloadLandmarks = floater->childGetValue("chk_landmarks"); order->mDownloadNotecards = floater->childGetValue("chk_notecards"); order->mDownloadObjects = floater->childGetValue("chk_objects"); //order->mDownloadOthers = floater->childGetValue("chk_others"); order->mDownloadScripts = floater->childGetValue("chk_scripts"); order->mDownloadSounds = floater->childGetValue("chk_sounds"); order->mDownloadTextures = floater->childGetValue("chk_textures"); order->mDownloadWearables = floater->childGetValue("chk_wearables"); // Make filters std::map<LLAssetType::EType, bool> type_remove; type_remove[LLAssetType::AT_ANIMATION] = !order->mDownloadAnimations; type_remove[LLAssetType::AT_BODYPART] = !order->mDownloadWearables; type_remove[LLAssetType::AT_CALLINGCARD] = !order->mDownloadCallingCards; type_remove[LLAssetType::AT_CLOTHING] = !order->mDownloadWearables; type_remove[LLAssetType::AT_GESTURE] = !order->mDownloadGestures; type_remove[LLAssetType::AT_IMAGE_JPEG] = !order->mDownloadTextures; type_remove[LLAssetType::AT_IMAGE_TGA] = !order->mDownloadTextures; type_remove[LLAssetType::AT_LANDMARK] = !order->mDownloadLandmarks; type_remove[LLAssetType::AT_LSL_TEXT] = !order->mDownloadScripts; type_remove[LLAssetType::AT_NOTECARD] = !order->mDownloadNotecards; type_remove[LLAssetType::AT_OBJECT] = !order->mDownloadObjects; type_remove[LLAssetType::AT_SCRIPT] = !order->mDownloadScripts; type_remove[LLAssetType::AT_SOUND] = !order->mDownloadSounds; type_remove[LLAssetType::AT_SOUND_WAV] = !order->mDownloadSounds; type_remove[LLAssetType::AT_TEXTURE] = !order->mDownloadTextures; type_remove[LLAssetType::AT_TEXTURE_TGA] = !order->mDownloadTextures; // Apply filters std::vector<LLInventoryItem*>::iterator item_iter = order->mItems.begin(); for( ; item_iter != order->mItems.end(); ) { if(type_remove[(*item_iter)->getType()]) order->mItems.erase(item_iter); else ++item_iter; } if(order->mItems.size() < 1) { LLSD args; args["ERROR_MESSAGE"] = "No items passed the filter \\o/"; LLNotifications::instance().add("ErrorMessage", args); return; } // Get dir name AIDirPicker* dirpicker = new AIDirPicker("New Folder"); dirpicker->run(boost::bind(&LLFloaterInventoryBackupSettings::onClickNext_continued, userdata, dirpicker)); }
// static void LLFloaterInventoryBackupSettings::onClickNext(void* userdata) { LLFloaterInventoryBackupSettings* floater = (LLFloaterInventoryBackupSettings*)userdata; LLInventoryBackupOrder* order = floater->mOrder; // Apply changes to filters order->mDownloadAnimations = floater->childGetValue("chk_animations"); order->mDownloadCallingCards = floater->childGetValue("chk_callingcards"); order->mDownloadGestures = floater->childGetValue("chk_gestures"); order->mDownloadLandmarks = floater->childGetValue("chk_landmarks"); order->mDownloadNotecards = floater->childGetValue("chk_notecards"); order->mDownloadObjects = floater->childGetValue("chk_objects"); //order->mDownloadOthers = floater->childGetValue("chk_others"); order->mDownloadScripts = floater->childGetValue("chk_scripts"); order->mDownloadSounds = floater->childGetValue("chk_sounds"); order->mDownloadTextures = floater->childGetValue("chk_textures"); order->mDownloadWearables = floater->childGetValue("chk_wearables"); // Make filters std::map<LLAssetType::EType, bool> type_remove; type_remove[LLAssetType::AT_ANIMATION] = !order->mDownloadAnimations; type_remove[LLAssetType::AT_BODYPART] = !order->mDownloadWearables; type_remove[LLAssetType::AT_CALLINGCARD] = !order->mDownloadCallingCards; type_remove[LLAssetType::AT_CLOTHING] = !order->mDownloadWearables; type_remove[LLAssetType::AT_GESTURE] = !order->mDownloadGestures; type_remove[LLAssetType::AT_IMAGE_JPEG] = !order->mDownloadTextures; type_remove[LLAssetType::AT_IMAGE_TGA] = !order->mDownloadTextures; type_remove[LLAssetType::AT_LANDMARK] = !order->mDownloadLandmarks; type_remove[LLAssetType::AT_LSL_TEXT] = !order->mDownloadScripts; type_remove[LLAssetType::AT_NOTECARD] = !order->mDownloadNotecards; type_remove[LLAssetType::AT_OBJECT] = !order->mDownloadObjects; type_remove[LLAssetType::AT_SCRIPT] = !order->mDownloadScripts; type_remove[LLAssetType::AT_SOUND] = !order->mDownloadSounds; type_remove[LLAssetType::AT_SOUND_WAV] = !order->mDownloadSounds; type_remove[LLAssetType::AT_TEXTURE] = !order->mDownloadTextures; type_remove[LLAssetType::AT_TEXTURE_TGA] = !order->mDownloadTextures; // Apply filters std::vector<LLInventoryItem*>::iterator item_iter = order->mItems.begin(); for( ; item_iter != order->mItems.end(); ) { if(type_remove[(*item_iter)->getType()]) order->mItems.erase(item_iter); else ++item_iter; } if(order->mItems.size() < 1) { LLSD args; args["ERROR_MESSAGE"] = "No items passed the filter \\o/"; LLNotifications::instance().add("ErrorMessage", args); return; } // Get dir name LLDirPicker& picker = LLDirPicker::instance(); std::string filename = "New Folder"; if (!picker.getDir(&filename)) { floater->close(); return; } filename = picker.getDirName(); // Make local directory tree LLFile::mkdir(filename); std::vector<LLInventoryCategory*>::iterator _cat_iter = order->mCats.begin(); std::vector<LLInventoryCategory*>::iterator _cat_end = order->mCats.end(); for( ; _cat_iter != _cat_end; ++_cat_iter) { std::string path = filename + OS_SEP + LLInventoryBackup::getPath(*_cat_iter, order->mCats); LLFile::mkdir(path); } // Go go backup floater LLFloaterInventoryBackup* backup_floater = new LLFloaterInventoryBackup(filename, order->mCats, order->mItems); backup_floater->center(); // Close myself floater->close(); }