SyntaxHighlighter::SyntaxHighlighter(QTextEdit *parent) : Sonnet::Highlighter(parent) , tagBrush(KColorScheme::View,KColorScheme::VisitedText) , m_approved(true) // , fuzzyState(false) // , fromDocbook(docbook) { setAutomatic(false); highlightingRules.reserve(NUM_OF_RULES); HighlightingRule rule; //rule.format.setFontItalic(true); // tagFormat.setForeground(tagBrush.brush(QApplication::palette())); tagFormat.setForeground(tagBrush.brush(QApplication::palette())); //QTextCharFormat format; //tagFormat.setForeground(Qt::darkBlue); // if (!docbook) //support multiline tags // { // rule.format = tagFormat; // rule.pattern = QRegExp("<.+>"); // rule.pattern.setMinimal(true); // highlightingRules.append(rule); // } //entity rule.format.setForeground(Qt::darkMagenta); rule.pattern = QRegExp("(&[A-Za-z_:][A-Za-z0-9_\\.:-]*;)"); highlightingRules.append(rule); QString accel=Project::instance()->accel(); if (!accel.isEmpty()) { rule.format.setForeground(Qt::darkMagenta); rule.pattern = QRegExp(accel); highlightingRules.append(rule); } //\n \t \" rule.format.setForeground(Qt::darkGreen); rule.pattern = QRegExp("(\\\\[abfnrtv'\?\\\\])|(\\\\\\d+)|(\\\\x[\\dabcdef]+)"); highlightingRules.append(rule); //spaces settingsChanged(); connect(SettingsController::instance(),SIGNAL(generalSettingsChanged()),this, SLOT(settingsChanged())); }
void SettingsController::showSettingsDialog() { if (KConfigDialog::showDialog("lokalize_settings")) return; KConfigDialog *dialog = new KConfigDialog(m_mainWindowPtr, "lokalize_settings", Settings::self()); dialog->setFaceType(KPageDialog::List); // Identity QWidget *w = new QWidget(dialog); Ui_prefs_identity ui_prefs_identity; ui_prefs_identity.setupUi(w); KConfigGroup grp = Settings::self()->config()->group("Identity"); ui_prefs_identity.DefaultLangCode->setModel(LanguageListModel::instance()->sortModel()); ui_prefs_identity.DefaultLangCode->setCurrentIndex(LanguageListModel::instance()->sortModelRowForLangCode( grp.readEntry("DefaultLangCode", QLocale::system().name()) )); connect(ui_prefs_identity.DefaultLangCode,SIGNAL(activated(int)),ui_prefs_identity.kcfg_DefaultLangCode,SLOT(setLangCode(int))); ui_prefs_identity.kcfg_DefaultLangCode->hide(); dialog->addPage(w, i18nc("@title:tab","Identity"), "preferences-desktop-user"); //Editor w = new QWidget(dialog); Ui_prefs_editor ui_prefs_editor; ui_prefs_editor.setupUi(w); dialog->addPage(w, i18nc("@title:tab","Editing"), "accessories-text-editor"); //Font w = new QWidget(dialog); Ui_prefs_appearance ui_prefs_appearance; ui_prefs_appearance.setupUi(w); dialog->addPage(w, i18nc("@title:tab","Appearance"), "preferences-desktop-font"); //TM w = new QWidget(dialog); Ui_prefs_tm ui_prefs_tm; ui_prefs_tm.setupUi(w); dialog->addPage(w, i18nc("@title:tab","Translation Memory"), "configure"); connect(dialog,SIGNAL(settingsChanged(QString)),this,SIGNAL(generalSettingsChanged())); //Spellcheck #if 0 w = new Sonnet::ConfigWidget(Settings::self()->config(),dialog); w->setParent(this); dialog->addPage(w, i18nc("@title:tab","Spellcheck"), "spellcheck_setting"); connect(dialog,SIGNAL(okClicked()),w,SLOT(save())); connect(dialog,SIGNAL(applyClicked()),w,SLOT(save())); connect(dialog,SIGNAL(defaultClicked()),w,SLOT(slotDefault())); #endif //connect(dialog,SIGNAL(settingsChanged(const QString&)),m_view, SLOT(settingsChanged())); dialog->show(); // dialog->addPage(new General(0, "General"), i18n("General") ); // dialog->addPage(new Appearance(0, "Style"), i18n("Appearance") ); // connect(dialog, SIGNAL(settingsChanged(const QString&)), mainWidget, SLOT(loadSettings())); // connect(dialog, SIGNAL(settingsChanged(const QString&)), this, SLOT(loadSettings())); }