Пример #1
0
void EditorPage::store( Manager *s )
{
    s->beginGroup("IDE/editor");

    s->setValue("spaceIndent", ui->spaceIndent->isChecked());
    s->setValue("indentWidth", ui->indentWidth->value());
    s->setValue("stepForwardEvaluation", ui->stepForwardEvaluation->isChecked());

    s->setValue("blinkDuration", ui->blinkDuration->value());

    QFont f = constructFont();
    s->setValue("font", f.toString());

    s->beginGroup("colors");

    s->setValue("background", ui->bgColor->color());
    s->setValue("text", ui->textColor->color());
    s->setValue("matchingBrackets", ui->bracketColor->color());
    s->setValue("evaluatedCodeText", ui->evalCodeFg->color());
    s->setValue("evaluatedCodeBackground", ui->evalCodeBg->color());
    s->setValue("lineNumbers", ui->lineNumbersFg->color());
    s->setValue("lineNumbersBackground", ui->lineNumbersBg->color());

    s->endGroup(); // colors

    s->beginGroup("highlighting");

    int formatCount = ui->textFormatList->count();
    for(int i = 0; i < formatCount; ++i)
    {
        QString name = ui->textFormatList->name(i);
        QTextCharFormat fm = ui->textFormatList->format(i);
        s->setValue(name.toLower(), QVariant::fromValue<QTextCharFormat>(fm));
    }

    s->endGroup(); // highlighting

    s->endGroup();
}
void EditorPage::updateFontPreview()
{
    if (ui->tabs->currentWidget() == ui->colorsTab)
        ui->textFormats->setFont( constructFont() );
}