Changeset View
Changeset View
Standalone View
Standalone View
src/vimode/config/configtab.cpp
Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Line(s) | 86 | const Mappings::MappingRecursion recursion = recursive->checkState() == Qt::Checked ? | |||
---|---|---|---|---|---|
88 | Mappings::NonRecursive; | 88 | Mappings::NonRecursive; | ||
89 | m_mappings->add(mode, from->text(), to->text(), recursion); | 89 | m_mappings->add(mode, from->text(), to->text(), recursion); | ||
90 | } | 90 | } | ||
91 | } | 91 | } | ||
92 | } | 92 | } | ||
93 | 93 | | |||
94 | void ConfigTab::reloadTab(QTableWidget *mappingsTable, Mappings::MappingMode mode) | 94 | void ConfigTab::reloadTab(QTableWidget *mappingsTable, Mappings::MappingMode mode) | ||
95 | { | 95 | { | ||
96 | const QStringList &l = m_mappings->getAll(mode); | 96 | const QStringList l = m_mappings->getAll(mode); | ||
97 | mappingsTable->setRowCount(l.size()); | 97 | mappingsTable->setRowCount(l.size()); | ||
98 | 98 | | |||
99 | int i = 0; | 99 | int i = 0; | ||
100 | foreach (const QString &f, l) { | 100 | for (const QString &f : l) { | ||
101 | QTableWidgetItem *from = new QTableWidgetItem(KeyParser::self()->decodeKeySequence(f)); | 101 | QTableWidgetItem *from = new QTableWidgetItem(KeyParser::self()->decodeKeySequence(f)); | ||
102 | QString s = m_mappings->get(mode, f); | 102 | QString s = m_mappings->get(mode, f); | ||
103 | QTableWidgetItem *to = new QTableWidgetItem(KeyParser::self()->decodeKeySequence(s)); | 103 | QTableWidgetItem *to = new QTableWidgetItem(KeyParser::self()->decodeKeySequence(s)); | ||
104 | QTableWidgetItem *recursive = new QTableWidgetItem(); | 104 | QTableWidgetItem *recursive = new QTableWidgetItem(); | ||
105 | recursive->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable); | 105 | recursive->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable); | ||
106 | const bool isRecursive = m_mappings->isRecursive(mode, f); | 106 | const bool isRecursive = m_mappings->isRecursive(mode, f); | ||
107 | recursive->setCheckState(isRecursive ? Qt::Checked : Qt::Unchecked); | 107 | recursive->setCheckState(isRecursive ? Qt::Checked : Qt::Unchecked); | ||
108 | 108 | | |||
▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Line(s) | 188 | { | |||
190 | QTableWidget *mappingsTable = ui->tblNormalModeMappings; | 190 | QTableWidget *mappingsTable = ui->tblNormalModeMappings; | ||
191 | if (ui->tabMappingModes->currentIndex() == 1) { | 191 | if (ui->tabMappingModes->currentIndex() == 1) { | ||
192 | mappingsTable = ui->tblInsertModeMappings; | 192 | mappingsTable = ui->tblInsertModeMappings; | ||
193 | } else if (ui->tabMappingModes->currentIndex() == 2) { | 193 | } else if (ui->tabMappingModes->currentIndex() == 2) { | ||
194 | mappingsTable = ui->tblVisualModeMappings; | 194 | mappingsTable = ui->tblVisualModeMappings; | ||
195 | } | 195 | } | ||
196 | 196 | | |||
197 | // And remove the selected rows. | 197 | // And remove the selected rows. | ||
198 | QList<QTableWidgetSelectionRange> l = mappingsTable->selectedRanges(); | 198 | const QList<QTableWidgetSelectionRange> l = mappingsTable->selectedRanges(); | ||
199 | foreach (const QTableWidgetSelectionRange &range, l) { | 199 | for (const QTableWidgetSelectionRange &range : l) { | ||
200 | for (int i = 0; i < range.bottomRow() - range.topRow() + 1; i++) { | 200 | for (int i = 0; i < range.bottomRow() - range.topRow() + 1; i++) { | ||
201 | mappingsTable->removeRow(range.topRow()); | 201 | mappingsTable->removeRow(range.topRow()); | ||
202 | } | 202 | } | ||
203 | } | 203 | } | ||
204 | } | 204 | } | ||
205 | 205 | | |||
206 | void ConfigTab::importNormalMappingRow() | 206 | void ConfigTab::importNormalMappingRow() | ||
207 | { | 207 | { | ||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |