Changeset View
Changeset View
Standalone View
Standalone View
src/document/katedocument.cpp
Show First 20 Lines • Show All 4622 Lines • ▼ Show 20 Line(s) | 4601 | { | |||
---|---|---|---|---|---|
4623 | } | 4623 | } | ||
4624 | 4624 | | |||
4625 | for (auto v : qAsConst(m_views)) { | 4625 | for (auto v : qAsConst(m_views)) { | ||
4626 | v->config()->configEnd(); | 4626 | v->config()->configEnd(); | ||
4627 | v->renderer()->config()->configEnd(); | 4627 | v->renderer()->config()->configEnd(); | ||
4628 | } | 4628 | } | ||
4629 | } | 4629 | } | ||
4630 | 4630 | | |||
4631 | void KTextEditor::DocumentPrivate::readVariableLine(QString t, bool onlyViewAndRenderer) | 4631 | void KTextEditor::DocumentPrivate::readVariableLine(const QString &t, bool onlyViewAndRenderer) | ||
4632 | { | 4632 | { | ||
4633 | static const QRegularExpression kvLine(QStringLiteral("kate:(.*)")); | 4633 | static const QRegularExpression kvLine(QStringLiteral("kate:(.*)")); | ||
4634 | static const QRegularExpression kvLineWildcard(QStringLiteral("kate-wildcard\\((.*)\\):(.*)")); | 4634 | static const QRegularExpression kvLineWildcard(QStringLiteral("kate-wildcard\\((.*)\\):(.*)")); | ||
4635 | static const QRegularExpression kvLineMime(QStringLiteral("kate-mimetype\\((.*)\\):(.*)")); | 4635 | static const QRegularExpression kvLineMime(QStringLiteral("kate-mimetype\\((.*)\\):(.*)")); | ||
4636 | static const QRegularExpression kvVar(QStringLiteral("([\\w\\-]+)\\s+([^;]+)")); | 4636 | static const QRegularExpression kvVar(QStringLiteral("([\\w\\-]+)\\s+([^;]+)")); | ||
4637 | 4637 | | |||
4638 | // simple check first, no regex | 4638 | // simple check first, no regex | ||
4639 | // no kate inside, no vars, simple... | 4639 | // no kate inside, no vars, simple... | ||
▲ Show 20 Lines • Show All 198 Lines • ▼ Show 20 Line(s) | |||||
4838 | // At this point spaceIndent is -1 if it was never set, | 4838 | // At this point spaceIndent is -1 if it was never set, | ||
4839 | // 0 if it was set to off, and 1 if it was set to on. | 4839 | // 0 if it was set to off, and 1 if it was set to on. | ||
4840 | // Note that if onlyViewAndRenderer was requested, spaceIndent is -1. | 4840 | // Note that if onlyViewAndRenderer was requested, spaceIndent is -1. | ||
4841 | if (!replaceTabsSet && spaceIndent >= 0) { | 4841 | if (!replaceTabsSet && spaceIndent >= 0) { | ||
4842 | m_config->setReplaceTabsDyn(spaceIndent > 0); | 4842 | m_config->setReplaceTabsDyn(spaceIndent > 0); | ||
4843 | } | 4843 | } | ||
4844 | } | 4844 | } | ||
4845 | 4845 | | |||
4846 | void KTextEditor::DocumentPrivate::setViewVariable(QString var, QString val) | 4846 | void KTextEditor::DocumentPrivate::setViewVariable(const QString &var, const QString &val) | ||
4847 | { | 4847 | { | ||
4848 | bool state; | 4848 | bool state; | ||
4849 | int n; | 4849 | int n; | ||
4850 | QColor c; | 4850 | QColor c; | ||
4851 | for (auto v : qAsConst(m_views)) { | 4851 | for (auto v : qAsConst(m_views)) { | ||
4852 | // First, try the new config interface | 4852 | // First, try the new config interface | ||
4853 | QVariant help(val); // Special treatment to catch "on"/"off" | 4853 | QVariant help(val); // Special treatment to catch "on"/"off" | ||
4854 | if (checkBoolValue(val, &state)) { | 4854 | if (checkBoolValue(val, &state)) { | ||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | 4898 | { | |||
4906 | static const auto falseValues = {QLatin1String("0"), QLatin1String("off"), QLatin1String("false")}; | 4906 | static const auto falseValues = {QLatin1String("0"), QLatin1String("off"), QLatin1String("false")}; | ||
4907 | if (contains(falseValues, val)) { | 4907 | if (contains(falseValues, val)) { | ||
4908 | *result = false; | 4908 | *result = false; | ||
4909 | return true; | 4909 | return true; | ||
4910 | } | 4910 | } | ||
4911 | return false; | 4911 | return false; | ||
4912 | } | 4912 | } | ||
4913 | 4913 | | |||
4914 | bool KTextEditor::DocumentPrivate::checkIntValue(QString val, int *result) | 4914 | bool KTextEditor::DocumentPrivate::checkIntValue(const QString &val, int *result) | ||
4915 | { | 4915 | { | ||
4916 | bool ret(false); | 4916 | bool ret(false); | ||
4917 | *result = val.toInt(&ret); | 4917 | *result = val.toInt(&ret); | ||
4918 | return ret; | 4918 | return ret; | ||
4919 | } | 4919 | } | ||
4920 | 4920 | | |||
4921 | bool KTextEditor::DocumentPrivate::checkColorValue(QString val, QColor &c) | 4921 | bool KTextEditor::DocumentPrivate::checkColorValue(const QString &val, QColor &c) | ||
4922 | { | 4922 | { | ||
4923 | c.setNamedColor(val); | 4923 | c.setNamedColor(val); | ||
4924 | return c.isValid(); | 4924 | return c.isValid(); | ||
4925 | } | 4925 | } | ||
4926 | 4926 | | |||
4927 | // KTextEditor::variable | 4927 | // KTextEditor::variable | ||
4928 | QString KTextEditor::DocumentPrivate::variable(const QString &name) const | 4928 | QString KTextEditor::DocumentPrivate::variable(const QString &name) const | ||
4929 | { | 4929 | { | ||
▲ Show 20 Lines • Show All 1143 Lines • Show Last 20 Lines |