std::string JSCEnum::enumName() const { std::string result; const auto lPath = path(); if (lPath.size() > 2) { return lPath[1] + "_" + pathName(); } return pathName(); }
explicit SkFontStyleSet_Android(const FontFamily& family, const SkTypeface_FreeType::Scanner& scanner) { const SkString* cannonicalFamilyName = NULL; if (family.fNames.count() > 0) { cannonicalFamilyName = &family.fNames[0]; } // TODO? make this lazy for (int i = 0; i < family.fFonts.count(); ++i) { const FontFileInfo& fontFile = family.fFonts[i]; SkString pathName(family.fBasePath); pathName.append(fontFile.fFileName); SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(pathName.c_str())); if (!stream.get()) { SkDEBUGF(("Requested font file %s does not exist or cannot be opened.\n", pathName.c_str())); continue; } const int ttcIndex = fontFile.fIndex; SkString familyName; SkFontStyle style; bool isFixedWidth; if (!scanner.scanFont(stream.get(), ttcIndex, &familyName, &style, &isFixedWidth)) { SkDEBUGF(("Requested font file %s exists, but is not a valid font.\n", pathName.c_str())); continue; } int weight = fontFile.fWeight != 0 ? fontFile.fWeight : style.weight(); SkFontStyle::Slant slant = style.slant(); switch (fontFile.fStyle) { case FontFileInfo::Style::kAuto: slant = style.slant(); break; case FontFileInfo::Style::kNormal: slant = SkFontStyle::kUpright_Slant; break; case FontFileInfo::Style::kItalic: slant = SkFontStyle::kItalic_Slant; break; default: SkASSERT(false); break; } style = SkFontStyle(weight, style.width(), slant); const SkLanguage& lang = family.fLanguage; uint32_t variant = family.fVariant; if (kDefault_FontVariant == variant) { variant = kCompact_FontVariant | kElegant_FontVariant; } // The first specified family name overrides the family name found in the font. // TODO: SkTypeface_AndroidSystem::onCreateFamilyNameIterator should return // all of the specified family names in addition to the names found in the font. if (cannonicalFamilyName != NULL) { familyName = *cannonicalFamilyName; } fStyles.push_back().reset(SkNEW_ARGS(SkTypeface_AndroidSystem, (pathName, ttcIndex, style, isFixedWidth, familyName, lang, variant))); } }
void LLWLParamManager::savePreset(const std::string & name) { // bugfix for SL-46920: preventing filenames that break stuff. char * curl_str = curl_escape(name.c_str(), name.size()); std::string escaped_filename(curl_str); curl_free(curl_str); curl_str = NULL; escaped_filename += ".xml"; // make an empty llsd LLSD paramsData(LLSD::emptyMap()); std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", escaped_filename)); // fill it with LLSD windlight params paramsData = mParamList[name].getAll(); // write to file llofstream presetsXML(pathName); LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); presetsXML.close(); propagateParameters(); notifyObservers(); }
String Directory::MakePathName(bool addSepFlag, const char *pathNameTrail) const { String pathName(_name); for (Directory *pDirectory = GetParent(); pDirectory != nullptr; pDirectory = pDirectory->GetParent()) { // a "boundary container" directory may have an empty name if (*pDirectory->GetName() != '\0' || pDirectory->IsRootContainer()) { String str(pDirectory->GetName()); size_t len = str.size(); if (len == 0 || !IsFileSeparator(str[len - 1])) { str += pDirectory->GetSeparator(); } str += pathName; pathName = str; } } if (pathNameTrail != nullptr) { size_t len = pathName.size(); if (len == 0 || !IsFileSeparator(pathName[len - 1])) { pathName += GetSeparator(); } for (const char *p = pathNameTrail; *p != '\0'; p++) { char ch = IsFileSeparator(*p)? GetSeparator() : *p; pathName += ch; } } else if (addSepFlag && IsContainer() && !_name.empty()) { size_t len = pathName.size(); if (len > 0 && !IsFileSeparator(pathName[len - 1])) { pathName += GetSeparator(); } } return pathName; }
Directory *Directory_FileSys::DoNext(Environment &env) { WIN32_FIND_DATA findData; if (_hFind == INVALID_HANDLE_VALUE) { String pathName(MakePathName(false)); if (!pathName.empty()) pathName += GetSeparator(); pathName += "*.*"; _hFind = ::FindFirstFile(OAL::ToNativeString(pathName.c_str()).c_str(), &findData); if (_hFind == INVALID_HANDLE_VALUE) return nullptr; } else if (!::FindNextFile(_hFind, &findData)) { ::FindClose(_hFind); _hFind = INVALID_HANDLE_VALUE; return nullptr; } while (::strcmp(findData.cFileName, ".") == 0 || ::strcmp(findData.cFileName, "..") == 0) { if (!::FindNextFile(_hFind, &findData)) { ::FindClose(_hFind); _hFind = INVALID_HANDLE_VALUE; return nullptr; } } Type type = (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)? TYPE_Container : TYPE_Item; String fileName = OAL::FromNativeString(findData.cFileName); return new Directory_FileSys(Directory::Reference(this), fileName.c_str(), type, new OAL::FileStat(fileName.c_str(), findData)); }
void Mailbox::readSettings(QSettings *config) { _name = config->value("name").toString(); oldName = config->value("oldname").toString(); delimiter = config->value("delimiter").toString(); uid = config->value("uid").toString(); exists = config->value("exists", 0).toInt(); byUser = config->value("byuser").toBool(); deleted = config->value("deleted").toBool(); QString delItems(config->value("queuedelete").toString().trimmed()); if (!delItems.isEmpty()) delList = delItems.split( "," ); _localCopy = config->value("localcopy", false ).toBool(); _syncSetting = config->value("syncsettings", Sync_AllMessages).toInt(); serverUidList.clear(); QString str; for (int x = 1; x < (exists + 1); x++) { int theUid = config->value( QString::number(x) ).toInt(); str = QString::number(theUid); if ( !str.isEmpty() ) serverUidList.append( str ); } search->setFromFolder( pathName() ); if(_account && _account->accountType() == QMailAccount::IMAP) _displayName = decodeModUTF7(baseName()); else _displayName = _name; }
TInt CTestUtils::OpenMainLogL() { _LIT(KDisplayLogFile,"Log File %S\n"); TParse loglocation; TFileName logfile; TInt err=ResolveLogFile(KNullDesC, loglocation); if(err!=KErrNone) { TChar driveChar=RFs::GetSystemDriveChar(); TBuf<2> systemDrive; systemDrive.Append(driveChar); systemDrive.Append(KDriveDelimiter); TPath pathName(systemDrive) ; pathName.Append(KMsvTestFileDefaultOutputBase); iFs.MkDirAll(pathName); err=ResolveLogFile(KNullDesC, loglocation); } User::LeaveIfError(err); logfile.Copy(loglocation.FullName()); logfile.Delete(logfile.Length()-1,1); AppendVariantName(logfile); iRTest.Printf(KDisplayLogFile, &logfile); iFs.MkDirAll(logfile); iLogBuf=HBufC::NewL(KMaxLogLineLength); iLogBuf8=HBufC8::NewL(KMaxLogLineLength); return(iFile.Replace(iFs,logfile,EFileWrite|EFileShareAny)); }
void LLWLParamManager::savePresets(const std::string & fileName) { //Nobody currently calls me, but if they did, then its reasonable to write the data out to the user's folder //and not over the RO system wide version. LLSD paramsData(LLSD::emptyMap()); std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight", fileName)); for(std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.begin(); mIt != mParamList.end(); ++mIt) { paramsData[mIt->first] = mIt->second.getAll(); } llofstream presetsXML(pathName); LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); presetsXML.close(); propagateParameters(); }
void CMsvIndexContext::DoStoreConfigL() { // we only want to store the config file if it has changed, // we also don't care about UniqueIDs for the internal drive if(iConfig.iDebug!=iConfig.iDebugAsLoaded || iConfig.iDrive!=iConfig.iDriveAsLoaded || (iConfig.iDrive!=iServer.FileSession().GetSystemDrive() && iConfig.iUniqueID!=iConfig.iUniqueIDAsLoaded)) { TChar driveChar= iServer.FileSession().GetSystemDriveChar(); TBuf<2> systemDrive; systemDrive.Append(driveChar); systemDrive.Append(KDriveDelimiter); TPath pathName(systemDrive); pathName.Append(KServerINIFile); CDictionaryFileStore *store=CDictionaryFileStore::OpenLC(iServer.FileSession(),pathName,KNullUid); RDictionaryWriteStream stream; stream.AssignLC(*store, KUidMsvMessageDriveStream); stream.WriteUint8L(KMsvMessageDriveStreamVersionNumber); // version number stream << iConfig.iDrive.Name(); stream.WriteUint32L(iConfig.iUniqueID); stream.WriteInt8L(iConfig.iDebug); stream.CommitL(); store->CommitL(); CleanupStack::PopAndDestroy(2,store); // stream, store } }
void LLWLParamManager::loadPreset(const std::string & name,bool propagate) { // bugfix for SL-46920: preventing filenames that break stuff. char * curl_str = curl_escape(name.c_str(), name.size()); std::string escaped_filename(curl_str); curl_free(curl_str); curl_str = NULL; escaped_filename += ".xml"; std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", escaped_filename)); LL_DEBUGS2("AppInit", "Shaders") << "Loading WindLight sky setting from " << pathName << LL_ENDL; llifstream presetsXML; presetsXML.open(pathName.c_str()); // That failed, try loading from the users area instead. if(!presetsXML) { pathName=gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", escaped_filename); LL_DEBUGS2("AppInit", "Shaders")<< "Loading User WindLight sky setting from " << LL_ENDL; presetsXML.open(pathName.c_str()); } if (presetsXML) { LLSD paramsData(LLSD::emptyMap()); LLPointer<LLSDParser> parser = new LLSDXMLParser(); parser->parse(presetsXML, paramsData, LLSDSerialize::SIZE_UNLIMITED); std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.find(name); if(mIt == mParamList.end()) { addParamSet(name, paramsData); } else { setParamSet(name, paramsData); } presetsXML.close(); } else { llwarns << "Can't find " << name << llendl; return; } if(propagate) { getParamSet(name, mCurParams); propagateParameters(); } notifyObservers(); }
void LLWLParamManager::loadPreset(const std::string & name,bool propagate) { // Check if we already have the preset before we try loading it again. if(mParamList.find(name) != mParamList.end()) { if(propagate) { getParamSet(name, mCurParams); propagateParameters(); } return; } // bugfix for SL-46920: preventing filenames that break stuff. char * curl_str = curl_escape(name.c_str(), name.size()); std::string escaped_filename(curl_str); curl_free(curl_str); curl_str = NULL; escaped_filename += ".xml"; std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", escaped_filename)); LL_DEBUGS2("AppInit", "Shaders") << "Loading WindLight sky setting from " << pathName << LL_ENDL; llifstream presetsXML; presetsXML.open(pathName.c_str()); // That failed, try loading from the users area instead. if(!presetsXML) { pathName=gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", escaped_filename); LL_DEBUGS2("AppInit", "Shaders")<< "Loading User WindLight sky setting from " << LL_ENDL; presetsXML.open(pathName.c_str()); } if (presetsXML) { loadPresetXML(name, presetsXML); presetsXML.close(); } else { llwarns << "Can't find " << name << llendl; return; } if(propagate) { getParamSet(name, mCurParams); propagateParameters(); } notifyObservers(); }
LLPostProcess::LLPostProcess(void) : mVBO(NULL), mAllEffects(LLSD::emptyMap()), mScreenWidth(1), mScreenHeight(1) { mSceneRenderTexture = NULL ; mNoiseTexture = NULL ; /* Do nothing. Needs to be updated to use our current shader system, and to work with the move into llrender.*/ std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); LL_DEBUGS2("AppInit", "Shaders") << "Loading PostProcess Effects settings from " << pathName << LL_ENDL; llifstream effectsXML(pathName); if (effectsXML) { LLPointer<LLSDParser> parser = new LLSDXMLParser(); parser->parse(effectsXML, mAllEffects, LLSDSerialize::SIZE_UNLIMITED); } if (!mAllEffects.has("default")) { LLSD & defaultEffect = (mAllEffects["default"] = LLSD::emptyMap()); /*defaultEffect["enable_night_vision"] = LLSD::Boolean(false); defaultEffect["enable_color_filter"] = LLSD::Boolean(false);*/ /// NVG Defaults defaultEffect["brightness_multiplier"] = 3.0; defaultEffect["noise_size"] = 25.0; defaultEffect["noise_strength"] = 0.4; // TODO BTest potentially add this to tweaks? mNoiseTextureScale = 1.0f; /// Color Filter Defaults defaultEffect["gamma"] = 1.0; defaultEffect["brightness"] = 1.0; defaultEffect["contrast"] = 1.0; defaultEffect["saturation"] = 1.0; LLSD& contrastBase = (defaultEffect["contrast_base"] = LLSD::emptyArray()); contrastBase.append(1.0); contrastBase.append(1.0); contrastBase.append(1.0); contrastBase.append(0.5); defaultEffect["gauss_blur_passes"] = 2; } setSelectedEffect("default"); //*/ }
/** * Removes model from project and deletes its file. */ bool BaseModel::remove(){ bool succ = QFile::remove(pathName()); if(succ){ prj->removeModel(this); return true; } else if(!QFile::exists(pathName())){ prj->removeModel(this); return true; } QMessageBox msgBox; msgBox.setWindowTitle(tr("Delete")); msgBox.setText(tr("File can't be deleted.")); msgBox.setInformativeText(pathName()); msgBox.setIcon(QMessageBox::Critical); msgBox.exec(); return false; }
/** * Sets new model name, renames model file end emits rename signal. */ void BaseModel::rename(QString name){ bool succ = QFile::rename(pathName(), path() + "/" + name + ".xml"); if(succ){ QString oldName = mdlName; mdlName = name; save(); prj->save(); prj->emitModelRenamed(mdlName, oldName, mdlType); emit changed(ModelRenamed); return; } QMessageBox msgBox; msgBox.setWindowTitle(tr("Rename")); msgBox.setText(tr("File can't be renamed.")); msgBox.setInformativeText(pathName() + " -> " + path() + "/" + name + ".xml"); msgBox.setIcon(QMessageBox::Critical); msgBox.exec(); }
void LLWaterParamManager::loadPreset(const std::string & name,bool propagate) { // bugfix for SL-46920: preventing filenames that break stuff. std::string escaped_filename = LLWeb::curlEscape(name); escaped_filename += ".xml"; std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", escaped_filename)); llinfos << "Loading water settings from " << pathName << llendl; std::ifstream presetsXML; presetsXML.open(pathName.c_str()); // That failed, try loading from the users area instead. if(!presetsXML) { pathName=gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/water", escaped_filename); llinfos << "Loading User water setting from " << pathName << llendl; presetsXML.open(pathName.c_str()); } if (presetsXML) { LLSD paramsData(LLSD::emptyMap()); LLPointer<LLSDParser> parser = new LLSDXMLParser(); parser->parse(presetsXML, paramsData, LLSDSerialize::SIZE_UNLIMITED); std::map<std::string, LLWaterParamSet>::iterator mIt = mParamList.find(name); if(mIt == mParamList.end()) { addParamSet(name, paramsData); } else { setParamSet(name, paramsData); } presetsXML.close(); } else { llwarns << "Can't find " << name << llendl; return; } if(propagate) { getParamSet(name, mCurParams); propagateParameters(); } }
void LLPostProcess::saveEffectAs(std::string const & effectName) { mAllEffectInfo[effectName] = mSelectedEffectInfo; std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); //llinfos << "Saving PostProcess Effects settings to " << pathName << llendl; llofstream effectsXML(pathName); LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); formatter->format(mAllEffectInfo, effectsXML); }
StringBuffer getCompleteName(const char* dir, const StringBuffer& name) { if (name.find(dir) == 0) { // Filename contains the path from the first char -> it's already the complete name return name; } else { StringBuffer pathName(dir); pathName += "/"; pathName += name; return pathName; } }
bool KdevDoc::canCloseFrame(KdevView* pFrame) { if(!isLastView()) return true; bool ret=false; if(isModified()) { QString saveName; switch(QMessageBox::information(pFrame, title(), tr("The current file has been modified.\n" "Do you want to save it?"),QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel )) { case QMessageBox::Yes: if(title().contains(tr("Untitled"))) { saveName=QFileDialog::getSaveFileName(0, 0, pFrame); if(saveName.isEmpty()) return false; } else saveName=pathName(); if(!saveDocument(saveName)) { switch(QMessageBox::critical(pFrame, tr("I/O Error !"), tr("Could not save the current document !\n" "Close anyway ?"),QMessageBox::Yes ,QMessageBox::No)) { case QMessageBox::Yes: ret=true; case QMessageBox::No: ret=false; } } else ret=true; break; case QMessageBox::No: ret=true; break; case QMessageBox::Cancel: default: ret=false; break; } } else ret=true; return ret; }
LLPostProcess::LLPostProcess(void) : mVBO(NULL), mDepthTexture(0), mNoiseTexture(NULL), mScreenWidth(0), mScreenHeight(0), mNoiseTextureScale(0.f), mSelectedEffectInfo(LLSD::emptyMap()), mAllEffectInfo(LLSD::emptyMap()) { mShaders.push_back(new LLMotionShader()); mShaders.push_back(new LLColorFilterShader()); mShaders.push_back(new LLNightVisionShader()); mShaders.push_back(new LLGaussBlurShader()); mShaders.push_back(new LLPosterizeShader()); /* Do nothing. Needs to be updated to use our current shader system, and to work with the move into llrender.*/ std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); LL_DEBUGS2("AppInit", "Shaders") << "Loading PostProcess Effects settings from " << pathName << LL_ENDL; llifstream effectsXML(pathName); if (effectsXML) { LLPointer<LLSDParser> parser = new LLSDXMLParser(); parser->parse(effectsXML, mAllEffectInfo, LLSDSerialize::SIZE_UNLIMITED); } if (!mAllEffectInfo.has("default")) mAllEffectInfo["default"] = LLSD::emptyMap(); LLSD& defaults = mAllEffectInfo["default"]; for(std::list<LLPointer<LLPostProcessShader> >::iterator it=mShaders.begin();it!=mShaders.end();++it) { LLSD shader_defaults = (*it)->getDefaults(); for (LLSD::map_const_iterator it2 = defaults.beginMap();it2 != defaults.endMap();++it2) { if(!defaults.has(it2->first)) defaults[it2->first]=it2->second; } } for(std::list<LLPointer<LLPostProcessShader> >::iterator it=mShaders.begin();it!=mShaders.end();++it) { (*it)->loadSettings(defaults); } setSelectedEffect("default"); }
IxWrite *IxWrite::writeToFile(char const *name) { FILE *f = 0; std::string pathName(name); #if defined(_WINDOWS) std::replace(pathName.begin(), pathName.end(), '/', '\\'); #endif fopen_s(&f, pathName.c_str(), "wb"); if (!f) { throw std::runtime_error(std::string("Cannot write to file: ") + pathName); } IxWrite *ret = new IxWrite(); ret->handle_ = f; return ret; }
void LLWLDayCycle::loadDayCycle(const std::string & fileName) { // now load the file std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/days", fileName)); llinfos << "Loading DayCycle settings from " << pathName << llendl; llifstream day_cycle_xml(pathName); if (day_cycle_xml.is_open()) { // clear the first few things mTimeMap.clear(); // load and parse it LLSD day_data(LLSD::emptyArray()); LLPointer<LLSDParser> parser = new LLSDXMLParser(); parser->parse(day_cycle_xml, day_data, LLSDSerialize::SIZE_UNLIMITED); // add each key for(S32 i = 0; i < day_data.size(); ++i) { // make sure it's a two array if(day_data[i].size() != 2) { continue; } // check each param name exists in param manager bool success; LLWLParamSet pset; success = LLWLParamManager::instance()->getParamSet(day_data[i][1].asString(), pset); if(!success) { // alert the user LLSD args; args["SKY"] = day_data[i][1].asString(); LLNotifications::instance().add("WLMissingSky", args); continue; } // then add the key addKey((F32)day_data[i][0].asReal(), day_data[i][1].asString()); } day_cycle_xml.close(); } }
/** @SYMTestCaseID PIM-CONVERTERTEST-0001 */ void doMainL() { test.Start(KTest1); RFs fs; User::LeaveIfError(fs.Connect()); CleanupClosePushL(fs); TBufC<11> targetFile(_L("target file")); //======================================================== //path TBuf<17> path(_L(":\\testHtml\\*.*")); //single file TBuf<25> sourceFile; _LIT(KFileName, "test1.txt"); //======================================================== if(getPathL(path, fs)) { //CONVERT PATH TBuf<17> pathName(path); pathName.SetLength(pathName.Length()-3); convertPathL(path, pathName, fs, targetFile); //CONVERT SINGLE FILE sourceFile.Copy(pathName); sourceFile.Append(KFileName); synchronousL(sourceFile, targetFile); // asynchronousL(sourceFile, targetFile); //OOM TESTS // oomSynchronousL(sourceFile, targetFile); // oomAsynchronousL(sourceFile, targetFile); } //======================================================== CleanupStack::PopAndDestroy(); // fs REComSession::FinalClose(); //needed, otherwise you will get a memory leak test.End(); test.Close(); }
bool Foam::fileOperations::masterFileOperation::writeObject ( const regIOobject& io, IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp ) const { mkDir(io.path()); fileName pathName(io.objectPath()); autoPtr<Ostream> osPtr ( NewOFstream ( pathName, fmt, ver, cmp ) ); Ostream& os = osPtr(); // If any of these fail, return (leave error handling to Ostream class) if (!os.good()) { return false; } if (!io.writeHeader(os)) { return false; } // Write the data to the Ostream if (!io.writeData(os)) { return false; } IOobject::writeEndDivider(os); return true; }
// tab 1 void MainWindow::getLogo(const QString route) { QString projectDir = pathName(m_curFile); QString logoName = m_ui->project_logo->text(); if (route == "load") { QString tempName = logoName; if (! tempName.isEmpty() && ! QDir::isAbsolutePath(tempName) ) { tempName = projectDir + "/" + tempName; } } else if (route == "select") { logoName = getSingleFile(tr("Select Project Logo"), logoName); m_ui->project_logo->setText(logoName); } if (logoName.isEmpty()) { m_ui->project_logo_image->setText(tr("No Logo was selected")); } else { QString tempName = logoName; if (! tempName.isEmpty() && ! QDir::isAbsolutePath(tempName) ) { tempName = projectDir + "/" + tempName; } QFile fout(tempName); if (! fout.exists()) { m_ui->project_logo_image->setText(tr("Unable to find file: ") + tempName); } else { QPixmap pm(tempName); if (! pm.isNull()) { m_ui->project_logo_image->setPixmap(pm.scaledToHeight(55, Qt::SmoothTransformation)); } else { m_ui->project_logo_image->setText(tr("No preview is available for: ") + tempName); } } } }
void LLWLParamManager::savePreset(LLWLParamKey key) { llassert(key.scope == LLEnvKey::SCOPE_LOCAL && !key.name.empty()); // make an empty llsd LLSD paramsData(LLSD::emptyMap()); std::string pathName(getUserDir() + LLWeb::curlEscape(key.name) + ".xml"); // fill it with LLSD windlight params paramsData = mParamList[key].getAll(); // write to file llofstream presetsXML(pathName); LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); presetsXML.close(); propagateParameters(); }
void LLWaterParamManager::savePreset(const std::string & name) { llassert(!name.empty()); // make an empty llsd LLSD paramsData(LLSD::emptyMap()); std::string pathName(getUserDir() + LLURI::escape(name) + ".xml"); // fill it with LLSD windlight params paramsData = mParamList[name].getAll(); // write to file llofstream presetsXML(pathName.c_str()); LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); presetsXML.close(); propagateParameters(); }
void LLWaterParamManager::savePreset(const std::string & name) { std::string escaped_filename = LLCurl::escapeSafe(name); escaped_filename += ".xml"; // make an empty llsd LLSD paramsData(LLSD::emptyMap()); std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/water", escaped_filename)); // fill it with LLSD windlight params paramsData = mParamList[name].getAll(); // write to file llofstream presetsXML(pathName); LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); presetsXML.close(); propagateParameters(); }
void AscentDayCycleManager::savePreset(const std::string & name) { // bugfix for SL-46920: preventing filenames that break stuff. std::string escaped_filename = LLWeb::curlEscape(name); escaped_filename += ".xml"; // make an empty llsd LLSD paramsData(LLSD::emptyMap()); std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/days", escaped_filename)); // fill it with LLSD windlight params //paramsData = mParamList[name].getAll(); // write to file llofstream presetsXML(pathName); LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); presetsXML.close(); }
void LLWLDayCycle::saveDayCycle(const std::string & fileName) { // bugfix for SL-46920: preventing filenames that break stuff. char * curl_str = curl_escape(fileName.c_str(), fileName.size()); std::string escaped_filename(curl_str); curl_free(curl_str); curl_str = NULL; escaped_filename += ".xml"; std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/days", escaped_filename)); llinfos << "Saving Day Cycle preset from " << pathName << llendl; llofstream day_cycle_xml; day_cycle_xml.open(pathName.c_str()); // That failed, try loading from the users area instead. if(!day_cycle_xml) { pathName=gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/days", escaped_filename); llinfos << "Saving User Day Cycle preset from " << pathName << llendl; day_cycle_xml.open(pathName.c_str()); } LLSD day_data(LLSD::emptyArray()); for(std::map<F32, std::string>::const_iterator mIt = mTimeMap.begin(); mIt != mTimeMap.end(); ++mIt) { LLSD key(LLSD::emptyArray()); key.append(mIt->first); key.append(mIt->second); day_data.append(key); } LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); formatter->format(day_data, day_cycle_xml, LLSDFormatter::OPTIONS_PRETTY); day_cycle_xml.close(); }
void ScrapbookUI::makeHTML(){ char path[2000]; erase(); mvprintw(0,0, "Export to html"); mvprintw(1,0, "Enter the full path: "); echo(); getstr(path); QString pathName(path); QString htmlText = accountControl->getUser()->exportToHtml(); // if user cancels file selection if (pathName.isNull()) return; QFile file(pathName); if ( file.open(QIODevice::ReadWrite) ) { QTextStream stream( &file ); stream << htmlText << endl; } }