XCA_application::XCA_application(int &argc, char *argv[]) :QApplication(argc, argv) { qtTr = NULL; xcaTr = NULL; mainw = NULL; QFile file(getUserSettingsDir() + QDir::separator() + "defaultlang"); if (file.open(QIODevice::ReadOnly)) { lang = QLocale(QString(file.read(128))); } langAvail << QLocale::system(); langAvail << QString("en"); QDirIterator qmIt(getPrefix(), QStringList() << "*.qm", QDir::Files); while (qmIt.hasNext()) { XcaTranslator t; qmIt.next(); QString language = qmIt.fileInfo().baseName().mid(4, -1); if (t.load(language, "xca", getPrefix())) langAvail << QLocale(language); } setupLanguage(lang); #ifdef Q_OS_MAC QStringList libp = libraryPaths(); libp.prepend(applicationDirPath() + "/../Plugins"); setLibraryPaths(libp); #endif tableFont = QFont("Courier", QApplication::font().pointSize() #if defined (Q_OS_WIN32) +1 #else +2 #endif ); installEventFilter(this); }
void OptionsDialog::InitOptionsDialog() { ui->_chkAutoSave->setChecked(_settings->GetAutoSave()); ui->_chkAutoUpdate->setChecked(_settings->GetAutoUpdate()); ui->_txtUpdateUrl->setText(_settings->GetUpdateURL()); ui->_chkFirstLoc->setChecked(_settings->GetCreateFirstLoc()); ui->_txtNameFirsLoc->setText(_settings->GetFirstLocName()); ui->_chkDescOfLoc->setChecked(_settings->GetShowShortLocsDescs()); ui->_chkOpeningLoc->setChecked(_settings->GetOpenNewLoc()); ui->_chkOpeningAct->setChecked(_settings->GetOpenNewAct()); ui->_chkOnLocActIcons->setChecked(_settings->GetShowLocsIcons()); ui->_chkLocDescVisible->setChecked(_settings->GetLocDescVisible()); ui->_chkLocActsVisible->setChecked(_settings->GetLocActsVisible()); ui->_chkOpenLastGame->setChecked(_settings->GetOpenLastGame()); ui->_chkSaveGameWithPassword->setChecked(_settings->GetSaveGameWithPassword()); ui->_txtFontBase->setText(_settings->GetFont(SYNTAX_BASE).family()); ui->_txtFontBase->setFont(_settings->GetFont(SYNTAX_BASE)); ui->_txtFontBase->SetBackColor(_settings->GetTextBackColor()); ui->_txtFontBase->SetFontColor(_settings->GetColor(SYNTAX_BASE)); ui->_txtFontStatements->setText(_settings->GetFont(SYNTAX_STATEMENTS).family()); ui->_txtFontStatements->setFont(_settings->GetFont(SYNTAX_STATEMENTS)); ui->_txtFontStatements->SetBackColor(_settings->GetTextBackColor()); ui->_txtFontStatements->SetFontColor(_settings->GetColor(SYNTAX_STATEMENTS)); ui->_txtFontFunctions->setText(_settings->GetFont(SYNTAX_FUNCTIONS).family()); ui->_txtFontFunctions->setFont(_settings->GetFont(SYNTAX_FUNCTIONS)); ui->_txtFontFunctions->SetBackColor(_settings->GetTextBackColor()); ui->_txtFontFunctions->SetFontColor(_settings->GetColor(SYNTAX_FUNCTIONS)); ui->_txtFontSysVariables->setText(_settings->GetFont(SYNTAX_SYS_VARIABLES).family()); ui->_txtFontSysVariables->setFont(_settings->GetFont(SYNTAX_SYS_VARIABLES)); ui->_txtFontSysVariables->SetBackColor(_settings->GetTextBackColor()); ui->_txtFontSysVariables->SetFontColor(_settings->GetColor(SYNTAX_SYS_VARIABLES)); ui->_txtFontStrings->setText(_settings->GetFont(SYNTAX_STRINGS).family()); ui->_txtFontStrings->setFont(_settings->GetFont(SYNTAX_STRINGS)); ui->_txtFontStrings->SetBackColor(_settings->GetTextBackColor()); ui->_txtFontStrings->SetFontColor(_settings->GetColor(SYNTAX_STRINGS)); ui->_txtFontNumbers->setText(_settings->GetFont(SYNTAX_NUMBERS).family()); ui->_txtFontNumbers->setFont(_settings->GetFont(SYNTAX_NUMBERS)); ui->_txtFontNumbers->SetBackColor(_settings->GetTextBackColor()); ui->_txtFontNumbers->SetFontColor(_settings->GetColor(SYNTAX_NUMBERS)); ui->_txtFontOptsBrts->setText(_settings->GetFont(SYNTAX_OPERATIONS).family()); ui->_txtFontOptsBrts->setFont(_settings->GetFont(SYNTAX_OPERATIONS)); ui->_txtFontOptsBrts->SetBackColor(_settings->GetTextBackColor()); ui->_txtFontOptsBrts->SetFontColor(_settings->GetColor(SYNTAX_OPERATIONS)); ui->_txtFontMarks->setText(_settings->GetFont(SYNTAX_LABELS).family()); ui->_txtFontMarks->setFont(_settings->GetFont(SYNTAX_LABELS)); ui->_txtFontMarks->SetBackColor(_settings->GetTextBackColor()); ui->_txtFontMarks->SetFontColor(_settings->GetColor(SYNTAX_LABELS)); ui->_txtFontComments->setText(_settings->GetFont(SYNTAX_COMMENTS).family()); ui->_txtFontComments->setFont(_settings->GetFont(SYNTAX_COMMENTS)); ui->_txtFontComments->SetBackColor(_settings->GetTextBackColor()); ui->_txtFontComments->SetFontColor(_settings->GetColor(SYNTAX_COMMENTS)); ui->_colorBaseBack->SetBackColor(_settings->GetBaseBackColor()); ui->_colorTextBack->SetBackColor(_settings->GetTextBackColor()); ui->_colorBaseFont->SetBackColor(_settings->GetColor(SYNTAX_BASE)); ui->_colorStatements->SetBackColor(_settings->GetColor(SYNTAX_STATEMENTS)); ui->_colorFunctions->SetBackColor(_settings->GetColor(SYNTAX_FUNCTIONS)); ui->_colorSysVariables->SetBackColor(_settings->GetColor(SYNTAX_SYS_VARIABLES)); ui->_colorStrings->SetBackColor(_settings->GetColor(SYNTAX_STRINGS)); ui->_colorNumbers->SetBackColor(_settings->GetColor(SYNTAX_NUMBERS)); ui->_colorOptsBrts->SetBackColor(_settings->GetColor(SYNTAX_OPERATIONS)); ui->_colorMarks->SetBackColor(_settings->GetColor(SYNTAX_LABELS)); ui->_colorComments->SetBackColor(_settings->GetColor(SYNTAX_COMMENTS)); ui->_txtPathsPlayer->setText(_settings->GetPlayerPath()); QString pathToQm = QApplication::applicationDirPath() + QDir::separator() + "langs"; QDirIterator qmIt(pathToQm, QStringList() << "*.qm", QDir::Files); while(qmIt.hasNext()) { qmIt.next(); QString fname = qmIt.fileInfo().baseName(); QLocale locale(fname.replace("qgen_", "")); ui->_cmbLang->addItem(locale.nativeLanguageName(), locale); } for(int i = 0; i < ui->_cmbLang->count(); i++) { if (ui->_cmbLang->itemData(i) == _control->GetSettings()->GetLocale()) { ui->_cmbLang->setCurrentIndex(i); } } ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false); }