const char* CLocale::getLanguage() { if (s_strSysLanguage.size() == 0) { #ifdef SCUT_IPHONE setLanguage(ScutUtility::getIphoneSysLanguage().c_str()); #endif #ifdef SCUT_ANDROID char * p = getLanguageJNI(); if (p) { setLanguage(p); free(p); } #endif #ifdef SCUT_WIN32 if (s_strSysLanguage.size() == 0) { s_strSysLanguage = "zh_CN"; } #endif } return s_strSysLanguage.c_str(); }
// Try to guess if a *.h file is C or C++, return FALSE if file is not *.h, TRUE otherwise. bool SciDoc::SetLanguageForHeader(const FXString &fn) { if (FXPath::extension(fn)=="h") { FXString fnbase=FXPath::stripExtension(fn); // Check for matching source file and set language accordingly if found... if (FXStat::exists(fnbase+".c")) { setLanguage("c"); } else if (FXStat::exists(fnbase+".cpp")||FXStat::exists(fnbase+".cxx")||FXStat::exists(fnbase+".cc")) { setLanguage("cpp"); } else { // Take a wild guess - if the file contains the word "class" it's probably C++ const char *content=(const char*)(sendMessage(SCI_GETCHARACTERPOINTER,0,0)); #ifdef FOX_1_7_50_OR_NEWER if (FXRex("\\<class\\>").search(content,strlen(content),0,strlen(content))>=0) { #else if (FXRex("\\<class\\>").match(content)) { #endif setLanguage("cpp"); } else { setLanguage("c"); } } return true; } else { return false;
MisliDesktopGui::MisliDesktopGui(int argc, char *argv[]) : QApplication(argc,argv) { QWidget dummyWidget; //so I can use the static functions below misliWindow = NULL; translator = NULL; clearSettingsOnExit = false; int user_reply; //Set some creditentials setQuitOnLastWindowClosed(false); setOrganizationName("p10"); //this is needed for proper settings access in windows setApplicationName("misli"); setApplicationVersion("2.0.0"); //Construct the splash screen splash = new QSplashScreen(QPixmap(":/img/icon.png")); splash->show(); //Init the settings settings = new QSettings; //Check if there's a series of failed starts and suggest clearing the settings if(failedStarts()>=2){ user_reply = QMessageBox::question(&dummyWidget,tr("Warning"),tr("There have been two unsuccessful starts of the program. Clearing the program settings will probably solve the issue . Persistent program crashes are mostly caused by corrupted notefiles , so you can try to manually narrow out the problematic notefile (remove the notefiles from the work directories one by one). The last one edited is probably the problem (you can try to correct it manually with a text editor to avoid loss of data).\n Do you want to clear the settings?")); if(user_reply==QMessageBox::Ok){ //if the user pressed Ok settings->clear(); settings->sync(); exit(0); } } //Assume we won't start successfully , if we do - the value gets -1-ed on close setFailedStarts(failedStarts()+1); if(firstProgramStart()){ QString newLanguage = QInputDialog::getItem(&dummyWidget,tr("Set the language"),tr("Language:/Език:"),QStringList()<<"English"<<"Български",0,false); if(newLanguage=="English") setLanguage("en"); if(newLanguage=="Български") setLanguage("bg"); } updateTranslator(); //Construct the misli instance class misliInstance = new MisliInstance(false); //Connections connect(this,SIGNAL(languageChanged(QString)),this,SLOT(updateTranslator())); connect(this,SIGNAL(aboutToQuit()),this,SLOT(stuffToDoBeforeQuitting())); //Start worker thread as soon as the main loop starts (so that we first show the splash screen and then start work) workerThread.start(); misliInstance->loadStoredDirs(); misliWindow = new MisliWindow(this); splash->finish(misliWindow); misliWindow->showMaximized(); }
void LanguageTag::setBcp47(const string & bcp) { size_t splitPos = bcp.find("-x-"); if (splitPos != string::npos) { setLanguage(bcp.substr(0, splitPos)); setPrivateUse(bcp.substr(splitPos + 2)); } else { setLanguage(bcp); } }
// --------------------------------------------------- void TextDoc::setLanguage (const QString& FileName) { QFileInfo Info (FileName); QString ext = Info.extension (false); if (ext == "vhd" || ext == "vhdl") setLanguage (LANG_VHDL); else if (ext == "v") setLanguage (LANG_VERILOG); else if (ext == "va") setLanguage (LANG_VERILOGA); else if (ext == "m" || ext == "oct") setLanguage (LANG_OCTAVE); else setLanguage (LANG_NONE); }
void DialogOptions::saveOptions() { setLanguage(); setOverwriteMode(); close(); }
/*! * \brief TextDoc::save saves the current document and it settings * \return true/false if the document was opened with success */ int TextDoc::save () { saveSettings (); QFile file (DocName); if (!file.open (QIODevice::WriteOnly)) return -1; setLanguage (DocName); QTextStream stream (&file); stream << toPlainText(); document()->setModified (false); slotSetChanged (); file.close (); QFileInfo Info (DocName); lastSaved = Info.lastModified (); /// clear highlighted lines on save \see MessageDock::slotCursor() QList<QTextEdit::ExtraSelection> extraSelections; this->setExtraSelections(extraSelections); refreshLanguage(); return 0; }
/* Use lookahead=2 */ Smt2Input::Smt2Input(AntlrInputStream& inputStream, InputLanguage lang) : AntlrInput(inputStream, 2) { pANTLR3_INPUT_STREAM input = inputStream.getAntlr3InputStream(); assert( input != NULL ); d_pSmt2Lexer = Smt2LexerNew(input); if( d_pSmt2Lexer == NULL ) { throw ParserException("Failed to create SMT2 lexer."); } setAntlr3Lexer( d_pSmt2Lexer->pLexer ); pANTLR3_COMMON_TOKEN_STREAM tokenStream = getTokenStream(); assert( tokenStream != NULL ); d_pSmt2Parser = Smt2ParserNew(tokenStream); if( d_pSmt2Parser == NULL ) { throw ParserException("Failed to create SMT2 parser."); } setAntlr3Parser(d_pSmt2Parser->pParser); setLanguage(lang); }
//! \brief SpellChecker::setLanguage switches to the given language if possible //! \param language The new language use "en" or "en_US". If more than one //! exists, the first one in the directory listing is used //! \return true if switching the language succeded bool SpellChecker::setLanguage(const QString &language) { Q_D(SpellChecker); qDebug() << "spellechecker.cpp in setLanguage() lang=" << language << "dictPath=" << dictPath(); QDir dictDir(dictPath()); QStringList affMatches = dictDir.entryList(QStringList(language+"*.aff")); QStringList dicMatches = dictDir.entryList(QStringList(language+"*.dic")); if (affMatches.isEmpty() || dicMatches.isEmpty()) { QString lang = language; lang.truncate(2); qWarning() << "Did not find a dictionary for" << language << " - checking for " << lang; if (language.length() > 2) { return setLanguage(lang); } qWarning() << "No dictionary found for" << language << "turning off spellchecking"; d->clear(); return false; } d->aff_file = dictPath() + "/" + affMatches[0]; d->dic_file = dictPath() + "/" + dicMatches[0]; qDebug() << "spellechecker.cpp in setLanguage() aff_file=" << d->aff_file << "dic_file=" << d->dic_file; if (enabled()) { setEnabled(false); return setEnabled(true); } else { return true; } }
App::App(QObject *parent) : QObject(parent) { Controller *controller = new Controller(this); MainWindow *mw = new MainWindow(0); mw->hide(); if (!controller->initAR()) { mw->error(tr("Unable to find any usable cameras. " "Check if they are connected"), tr("Camera error")); QApplication::quit(); } mw->showFullScreen(); connect(controller, SIGNAL(setStatus(IplImage*,IplImage*,QList<Model3D*>*)), mw, SLOT(setStatus(IplImage*,IplImage*,QList<Model3D*>*))); connect(controller, SIGNAL(refresh(int,int)), mw, SLOT(refreshValues(int,int))); connect(mw, SIGNAL(languageChanged(QLocale::Language)), controller, SLOT(setLanguage(QLocale::Language))); connect(mw, SIGNAL(nextCamera()), controller, SLOT(nextCamera())); connect(mw, SIGNAL(toggleDebug()), controller, SLOT(toggleDebug())); }
// let the "programming language" for a group depend on what is inserted into it. // First item that has an associated languages determines the language for the whole group. void GroupDef::updateLanguage(const Definition *d) { if (getLanguage()==SrcLangExt_Unknown && d->getLanguage()!=SrcLangExt_Unknown) { setLanguage(d->getLanguage()); } }
// Parse emacs modeline FXbool Modeline::parseEmacsModeline(const FXchar* s){ FXString key; FXString val; while(*s!='\0'){ while(*s==';' || *s=='\t' || *s==' ') s++; if(*s=='\0' || (*s=='-' && *(s+1)=='*' && *(s+2)=='-')) break; key=FXString::null; val=FXString::null; while(*s!='\0' && *s!=':' && *s!=';' && *s!='\t' && *s!=' '){ key+=*s++; } while(*s=='\t' || *s==' ') s++; if(*s=='\0') break; if(*s!=':') continue; s++; while(*s=='\t' || *s==' ') s++; if(*s=='\0') break; while(*s!='\0' && *s!=';' && *s!='\t' && *s!=' '){ val+=*s++; } if(comparecase(key,"Mode")==0){ setLanguage(val); } else if(key=="tab-width"){ setTabWidth(val.toInt()); } else if(key=="indent-tabs-mode"){ setTabMode(val=="nil"); } else if(key=="autowrap"){ setWrapMode(val!="nil"); } } return true; }
FormExample::FormExample() : WContainerWidget() { WContainerWidget *langLayout = this->addWidget(cpp14::make_unique<WContainerWidget>()); langLayout->setContentAlignment(AlignmentFlag::Right); langLayout->addWidget(cpp14::make_unique<WText>(tr("language"))); const char *lang[] = { "en", "nl" }; for (int i = 0; i < 2; ++i) { WText *t = langLayout->addWidget(cpp14::make_unique<WText>(lang[i])); t->setMargin(5); t->clicked().connect(std::bind(&FormExample::changeLanguage, this, t)); languageSelects_.push_back(t); } /* * Start with the reported locale, if available */ setLanguage(wApp->locale().name()); Form *form = this->addWidget(cpp14::make_unique<Form>()); form->setMargin(20); }
Country::Country(LANGUAGES lang) { m_Linguist = new QTranslator(); setLanguage(lang); }
/// Updates font settings according to request void Font::update(Font const & newfont, Language const * document_language, bool toggleall) { bits_.update(newfont.fontInfo(), toggleall); if (newfont.language() == language() && toggleall) if (language() == document_language) setLanguage(default_language); else setLanguage(document_language); else if (newfont.language() == reset_language) setLanguage(document_language); else if (newfont.language() != ignore_language) setLanguage(newfont.language()); }
void init18N(int argc, char *argv[]) { int i; int languageId = -1; setlocale(LC_NUMERIC, ""); for (i = 1 ; i < argc ; i++) { if (strcmp(argv[i], "-language") == 0) { languageId = i + 1; if (languageId >= argc) { SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, "You must specify a language to use with -language. Using default."); } } } setLanguage("tbftss", languageId == -1 ? NULL : argv[languageId]); SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Numeric is %s", setlocale(LC_NUMERIC, "C")); SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "atof(2.75) is %f", atof("2.75")); }
void Cutegram::init_languages() { QDir dir(p->translationsPath); QStringList languages = dir.entryList( QDir::Files ); if( !languages.contains("lang-en.qm") ) languages.prepend("lang-en.qm"); for( int i=0 ; i<languages.size() ; i++ ) { QString locale_str = languages[i]; locale_str.truncate( locale_str.lastIndexOf('.') ); locale_str.remove( 0, locale_str.indexOf('-') + 1 ); QLocale locale(locale_str); QString lang = QString("%1 (%2)").arg(QLocale::languageToString(locale.language()), QLocale::countryToString(locale.country())); QVariant data = p->translationsPath + "/" + languages[i]; p->languages.insert( lang, data ); p->locales.insert( lang , locale ); if( lang == AsemanApplication::settings()->value("General/Language","English (UnitedStates)").toString() ) setLanguage( lang ); } }
SpellChecker::SpellChecker(QTextEdit *textEdit): m_textEdit(textEdit) { m_regExp = new QRegExp("[^\\s]*"); //m_cursor= new QTextCursor(m_textEdit->document()); spell_config1 = new_aspell_config(); spell_config2 = new_aspell_config(); aspell_config_replace(spell_config1, "lang", m_lang1.toAscii()); aspell_config_replace(spell_config2, "lang", m_lang2.toAscii()); aspell_config_replace(spell_config1, "encoding", "utf-8"); aspell_config_replace(spell_config2, "encoding", "utf-8"); m_map = new StringMap(); m_map->insert("ara", "ar"); m_map->insert("ruseng", "ru"); m_map->insert("rus", "ru"); m_map->insert("bul", "bg"); m_map->insert("cze", "cs"); m_map->insert("dan", "da"); m_map->insert("dut", "nl"); m_map->insert("nld", "nl"); m_map->insert("ell", "el"); m_map->insert("eng", "en"); m_map->insert("est", "et"); m_map->insert("fin", "fi"); m_map->insert("fra", "fr"); m_map->insert("ger", "de"); m_map->insert("deu", "de"); m_map->insert("deu-frak", "de-alt"); m_map->insert("heb", "he"); m_map->insert("hin", "hi"); m_map->insert("hrv", "hr"); m_map->insert("hun", "hu"); m_map->insert("ind", "in"); m_map->insert("isl", "is"); m_map->insert("ita", "it"); m_map->insert("lav", "lv"); m_map->insert("lit", "lt"); m_map->insert("mkd", "mk"); m_map->insert("msa", "ms"); m_map->insert("nor", "no"); m_map->insert("pol", "pl"); m_map->insert("por", "pt_PT"); m_map->insert("rum", "ro"); //m_map->insert("rus", "ru"); m_map->insert("ron", "ro"); m_map->insert("slo", "sl"); m_map->insert("slk", "sk"); m_map->insert("spa", "es"); m_map->insert("srp", "sr"); m_map->insert("swa", "sw"); m_map->insert("swe", "sv"); m_map->insert("swef", "sv"); m_map->insert("tur", "tr"); m_map->insert("ukr", "uk"); m_map->insert("vie", "vi"); spell_checker1 = 0; spell_checker2 = 0; setLanguage("ruseng"); dictList = new QStringList(); }
void VideoTrackPrivateAVFObjC::resetPropertiesFromTrack() { setSelected(m_impl->enabled()); setKind(m_impl->videoKind()); setId(m_impl->id()); setLabel(m_impl->label()); setLanguage(m_impl->language()); }
/** * * * @author FloSoft */ const std::string Languages::setLanguage(unsigned int i) { const Language l = getLanguage(i); setLanguage(l.code); return l.code; }
void AgrosApplication::setLocale() { QSettings settings; // language QString locale = settings.value("General/Language", QLocale::system().name()).value<QString>(); setLanguage(locale); }
void Buffer::setFileInfo(const QFileInfo& fileInfo) { if (m_fileInfo != fileInfo) { m_fileInfo = fileInfo; // Set up the lexer for the buffer setLanguage(Language::fromFilename(m_fileInfo.fileName())); emit fileInfoChanged(fileInfo); } }
/* TextEditor::TextEditor * TextEditor class constructor *******************************************************************/ TextEditor::TextEditor(wxWindow* parent, int id) : wxStyledTextCtrl(parent, id), timer_update(this) { // Init variables language = nullptr; ct_argset = 0; ct_function = nullptr; ct_start = 0; bm_cursor_last_pos = -1; panel_fr = nullptr; call_tip = new SCallTip(this); choice_jump_to = nullptr; jump_to_calculator = nullptr; // Set tab width SetTabWidth(txed_tab_width); // Line numbers by default SetMarginType(0, wxSTC_MARGIN_NUMBER); SetMarginWidth(0, TextWidth(wxSTC_STYLE_LINENUMBER, "9999")); // Folding margin setupFoldMargin(); // Border margin SetMarginWidth(2, 4); // Register icons for autocompletion list RegisterImage(1, Icons::getIcon(Icons::TEXT_EDITOR, "key")); RegisterImage(2, Icons::getIcon(Icons::TEXT_EDITOR, "const")); RegisterImage(3, Icons::getIcon(Icons::TEXT_EDITOR, "func")); // Init w/no language setLanguage(nullptr); // Setup various configurable properties setup(); // Add to text styles editor list StyleSet::addEditor(this); // Bind events Bind(wxEVT_KEY_DOWN, &TextEditor::onKeyDown, this); Bind(wxEVT_KEY_UP, &TextEditor::onKeyUp, this); Bind(wxEVT_STC_CHARADDED, &TextEditor::onCharAdded, this); Bind(wxEVT_STC_UPDATEUI, &TextEditor::onUpdateUI, this); Bind(wxEVT_STC_CALLTIP_CLICK, &TextEditor::onCalltipClicked, this); Bind(wxEVT_STC_DWELLSTART, &TextEditor::onMouseDwellStart, this); Bind(wxEVT_STC_DWELLEND, &TextEditor::onMouseDwellEnd, this); Bind(wxEVT_LEFT_DOWN, &TextEditor::onMouseDown, this); Bind(wxEVT_KILL_FOCUS, &TextEditor::onFocusLoss, this); Bind(wxEVT_ACTIVATE, &TextEditor::onActivate, this); Bind(wxEVT_STC_MARGINCLICK, &TextEditor::onMarginClick, this); Bind(wxEVT_COMMAND_JTCALCULATOR_COMPLETED, &TextEditor::onJumpToCalculateComplete, this); Bind(wxEVT_STC_MODIFIED, &TextEditor::onModified, this); Bind(wxEVT_TIMER, &TextEditor::onUpdateTimer, this); Bind(wxEVT_STC_STYLENEEDED, &TextEditor::onStyleNeeded, this); }
QCharsetMatch::QCharsetMatch(const QString name, const QString language, const qint32 confidence) : d_ptr(new QCharsetMatchPrivate) { Q_D(QCharsetMatch); d->q_ptr = this; setName(name); setLanguage(language); setConfidence(confidence); }
AudioStream::AudioStream(std::string langCode, std::string language, std::string format, std::string quantization, std::string frequency, unsigned int channels) { setLangCode(langCode); setLanguage(language); setFormat(format); setQuantization(quantization); setFrequency(frequency); setChannels(channels); }
void AudioTrackPrivateMediaSourceAVFObjC::resetPropertiesFromTrack() { m_trackID = m_impl->trackID(); setKind(m_impl->audioKind()); setId(m_impl->id()); setLabel(m_impl->label()); setLanguage(m_impl->language()); }
void MInputContext::connectInputMethodServer() { connect(imServer, SIGNAL(connected()), this, SLOT(onDBusConnection())); connect(imServer, SIGNAL(disconnected()), this, SLOT(onDBusDisconnection())); // Hook up incoming communication from input method server connect(imServer, SIGNAL(activationLostEvent()), this, SLOT(activationLostEvent())); connect(imServer, SIGNAL(imInitiatedHide()), this, SLOT(imInitiatedHide())); connect(imServer, SIGNAL(commitString(QString,int,int,int)), this, SLOT(commitString(QString,int,int,int))); connect(imServer, SIGNAL(updatePreedit(QString,QList<Maliit::PreeditTextFormat>,int,int,int)), this, SLOT(updatePreedit(QString,QList<Maliit::PreeditTextFormat>,int,int,int))); connect(imServer, SIGNAL(keyEvent(int,int,int,QString,bool,int,Maliit::EventRequestType)), this, SLOT(keyEvent(int,int,int,QString,bool,int,Maliit::EventRequestType))); connect(imServer, SIGNAL(updateInputMethodArea(QRect)), this, SLOT(updateInputMethodArea(QRect))); connect(imServer, SIGNAL(setGlobalCorrectionEnabled(bool)), this, SLOT(setGlobalCorrectionEnabled(bool))); connect(imServer, SIGNAL(getPreeditRectangle(QRect&,bool&)), this, SLOT(getPreeditRectangle(QRect&,bool&))); connect(imServer, SIGNAL(invokeAction(QString,QKeySequence)), this, SLOT(onInvokeAction(QString,QKeySequence))); connect(imServer, SIGNAL(setRedirectKeys(bool)), this, SLOT(setRedirectKeys(bool))); connect(imServer, SIGNAL(setDetectableAutoRepeat(bool)), this, SLOT(setDetectableAutoRepeat(bool))); connect(imServer, SIGNAL(setSelection(int,int)), this, SLOT(setSelection(int,int))); connect(imServer, SIGNAL(getSelection(QString&,bool&)), this, SLOT(getSelection(QString&, bool&))); connect(imServer, SIGNAL(setLanguage(QString)), this, SLOT(setLanguage(QString))); }
void SpellCheck::configChanged() { if (m_spellingDialog) { m_spellingDialog->resize(config().readEntry("dialogSize", m_spellingDialog->size())); } if (m_textEdit) { setLanguage(config().readEntry("dictionary", m_textEdit->highlighter()->currentLanguage())); } }
void VideoTrackPrivateAVFObjC::resetPropertiesFromTrack() { // Don't call this->setSelected() because it also sets the enabled state of the // AVPlayerItemTrack VideoTrackPrivateAVF::setSelected(m_impl->enabled()); setKind(m_impl->videoKind()); setId(m_impl->id()); setLabel(m_impl->label()); setLanguage(m_impl->language()); }
void SkPaintOptionsAndroid::unflatten(SkReadBuffer& buffer) { fFontVariant = (FontVariant)buffer.readUInt(); SkString tag; buffer.readString(&tag); #ifdef SKLANG_OPT setLanguage(tag); #else fLanguage = SkLanguage(tag); #endif fUseFontFallbacks = buffer.readBool(); }