本文整理汇总了C++中setLanguage函数的典型用法代码示例。如果您正苦于以下问题:C++ setLanguage函数的具体用法?C++ setLanguage怎么用?C++ setLanguage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setLanguage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setLanguage
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();
}
示例2: setLanguage
// 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;
示例3: QApplication
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();
}
示例4: setLanguage
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);
}
}
示例5: Info
// ---------------------------------------------------
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);
}
示例6: setLanguage
void DialogOptions::saveOptions()
{
setLanguage();
setOverwriteMode();
close();
}
示例7: saveSettings
/*!
* \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;
}
示例8: AntlrInput
/* 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);
}
示例9: Q_D
//! \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;
}
}
示例10: QObject
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()));
}
示例11: setLanguage
// 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());
}
}
示例12: while
// 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;
}
示例13: WContainerWidget
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);
}
示例14: QTranslator
Country::Country(LANGUAGES lang)
{
m_Linguist = new QTranslator();
setLanguage(lang);
}
示例15: setLanguage
/// 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());
}