Changeset View
Changeset View
Standalone View
Standalone View
src/schema/kateschemaconfig.cpp
Show First 20 Lines • Show All 318 Lines • ▼ Show 20 Line(s) | 313 | { | |||
---|---|---|---|---|---|
319 | ui->clear(); | 319 | ui->clear(); | ||
320 | ui->addColorItems(m_schemas[m_currentSchema]); | 320 | ui->addColorItems(m_schemas[m_currentSchema]); | ||
321 | 321 | | |||
322 | blockSignals(blocked); | 322 | blockSignals(blocked); | ||
323 | } | 323 | } | ||
324 | 324 | | |||
325 | void KateSchemaConfigColorTab::exportSchema(KConfigGroup &config) | 325 | void KateSchemaConfigColorTab::exportSchema(KConfigGroup &config) | ||
326 | { | 326 | { | ||
327 | QVector<KateColorItem> items = ui->colorItems(); | 327 | const QVector<KateColorItem> items = ui->colorItems(); | ||
328 | foreach (const KateColorItem &item, items) { | 328 | for (const KateColorItem &item : items) { | ||
329 | QColor c = item.useDefault ? item.defaultColor : item.color; | 329 | QColor c = item.useDefault ? item.defaultColor : item.color; | ||
330 | config.writeEntry(item.key, c); | 330 | config.writeEntry(item.key, c); | ||
331 | } | 331 | } | ||
332 | } | 332 | } | ||
333 | 333 | | |||
334 | void KateSchemaConfigColorTab::apply() | 334 | void KateSchemaConfigColorTab::apply() | ||
335 | { | 335 | { | ||
336 | schemaChanged(m_currentSchema); | 336 | schemaChanged(m_currentSchema); | ||
▲ Show 20 Lines • Show All 666 Lines • ▼ Show 20 Line(s) | 978 | { | |||
1003 | 1003 | | |||
1004 | // | 1004 | // | ||
1005 | // export Highlighting Text Styles | 1005 | // export Highlighting Text Styles | ||
1006 | // | 1006 | // | ||
1007 | // force a load of all Highlighting Text Styles | 1007 | // force a load of all Highlighting Text Styles | ||
1008 | QStringList hlList; | 1008 | QStringList hlList; | ||
1009 | m_highlightTab->loadAllHlsForSchema(m_currentSchema); | 1009 | m_highlightTab->loadAllHlsForSchema(m_currentSchema); | ||
1010 | 1010 | | |||
1011 | QList<int> hls = m_highlightTab->hlsForSchema(m_currentSchema); | 1011 | const QList<int> hls = m_highlightTab->hlsForSchema(m_currentSchema); | ||
1012 | 1012 | | |||
1013 | int cnt = 0; | 1013 | int cnt = 0; | ||
1014 | QProgressDialog progress(i18n("Exporting schema"), QString(), 0, hls.count(), this); | 1014 | QProgressDialog progress(i18n("Exporting schema"), QString(), 0, hls.count(), this); | ||
1015 | progress.setWindowModality(Qt::WindowModal); | 1015 | progress.setWindowModality(Qt::WindowModal); | ||
1016 | foreach (int hl, hls) { | 1016 | for (int hl : hls) { | ||
1017 | hlList << KateHlManager::self()->getHl(hl)->name(); | 1017 | hlList << KateHlManager::self()->getHl(hl)->name(); | ||
1018 | m_highlightTab->exportHl(m_currentSchema, hl, &cfg); | 1018 | m_highlightTab->exportHl(m_currentSchema, hl, &cfg); | ||
1019 | progress.setValue(++cnt); | 1019 | progress.setValue(++cnt); | ||
1020 | if (progress.wasCanceled()) { | 1020 | if (progress.wasCanceled()) { | ||
1021 | break; | 1021 | break; | ||
1022 | } | 1022 | } | ||
1023 | } | 1023 | } | ||
1024 | progress.setValue(hls.count()); | 1024 | progress.setValue(hls.count()); | ||
▲ Show 20 Lines • Show All 150 Lines • ▼ Show 20 Line(s) | 1111 | { | |||
1175 | for (int i = 0; i < hlCount; ++i) { | 1175 | for (int i = 0; i < hlCount; ++i) { | ||
1176 | nameToId.insert(KateHlManager::self()->modeList().at(i).name(), i); | 1176 | nameToId.insert(KateHlManager::self()->modeList().at(i).name(), i); | ||
1177 | } | 1177 | } | ||
1178 | 1178 | | |||
1179 | // may take some time, as we have > 200 highlightings | 1179 | // may take some time, as we have > 200 highlightings | ||
1180 | int cnt = 0; | 1180 | int cnt = 0; | ||
1181 | QProgressDialog progress(i18n("Importing schema"), QString(), 0, highlightings.count(), this); | 1181 | QProgressDialog progress(i18n("Importing schema"), QString(), 0, highlightings.count(), this); | ||
1182 | progress.setWindowModality(Qt::WindowModal); | 1182 | progress.setWindowModality(Qt::WindowModal); | ||
1183 | foreach (const QString &hl, highlightings) { | 1183 | for (const QString &hl : highlightings) { | ||
1184 | if (nameToId.contains(hl)) { | 1184 | if (nameToId.contains(hl)) { | ||
1185 | const int i = nameToId[hl]; | 1185 | const int i = nameToId[hl]; | ||
1186 | m_highlightTab->importHl(fromSchemaName, schemaName, i, &cfg); | 1186 | m_highlightTab->importHl(fromSchemaName, schemaName, i, &cfg); | ||
1187 | } | 1187 | } | ||
1188 | progress.setValue(++cnt); | 1188 | progress.setValue(++cnt); | ||
1189 | } | 1189 | } | ||
1190 | progress.setValue(highlightings.count()); | 1190 | progress.setValue(highlightings.count()); | ||
1191 | } | 1191 | } | ||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | |||||
1245 | void KateSchemaConfigPage::refillCombos(const QString &schemaName, const QString &defaultSchemaName) | 1245 | void KateSchemaConfigPage::refillCombos(const QString &schemaName, const QString &defaultSchemaName) | ||
1246 | { | 1246 | { | ||
1247 | schemaCombo->blockSignals(true); | 1247 | schemaCombo->blockSignals(true); | ||
1248 | defaultSchemaCombo->blockSignals(true); | 1248 | defaultSchemaCombo->blockSignals(true); | ||
1249 | 1249 | | |||
1250 | // reinitialize combo boxes | 1250 | // reinitialize combo boxes | ||
1251 | schemaCombo->clear(); | 1251 | schemaCombo->clear(); | ||
1252 | defaultSchemaCombo->clear(); | 1252 | defaultSchemaCombo->clear(); | ||
1253 | QList<KateSchema> schemaList = KTextEditor::EditorPrivate::self()->schemaManager()->list(); | 1253 | const QList<KateSchema> schemaList = KTextEditor::EditorPrivate::self()->schemaManager()->list(); | ||
1254 | foreach (const KateSchema &s, schemaList) { | 1254 | for (const KateSchema &s : schemaList) { | ||
1255 | schemaCombo->addItem(s.translatedName(), s.rawName); | 1255 | schemaCombo->addItem(s.translatedName(), s.rawName); | ||
1256 | defaultSchemaCombo->addItem(s.translatedName(), s.rawName); | 1256 | defaultSchemaCombo->addItem(s.translatedName(), s.rawName); | ||
1257 | } | 1257 | } | ||
1258 | 1258 | | |||
1259 | // set the correct indexes again, fallback to always existing "Normal" | 1259 | // set the correct indexes again, fallback to always existing "Normal" | ||
1260 | int schemaIndex = schemaCombo->findData(schemaName); | 1260 | int schemaIndex = schemaCombo->findData(schemaName); | ||
1261 | if (schemaIndex == -1) { | 1261 | if (schemaIndex == -1) { | ||
1262 | schemaIndex = schemaCombo->findData(QLatin1String("Normal")); | 1262 | schemaIndex = schemaCombo->findData(QLatin1String("Normal")); | ||
▲ Show 20 Lines • Show All 118 Lines • Show Last 20 Lines |