| 146 | } |
| 147 | |
| 148 | void KbWidget::modeChanged(bool spontaneous){ |
| 149 | int index = device->currentProfile()->indexOf(device->currentMode()); |
| 150 | if(index < 0) |
| 151 | return; |
| 152 | // Update tabs |
| 153 | ui->lightWidget->setLight(device->currentLight()); |
| 154 | ui->bindWidget->setBind(device->currentBind(), device->currentProfile()); |
| 155 | ui->kPerfWidget->setPerf(device->currentPerf(), device->currentProfile()); |
| 156 | ui->mPerfWidget->setPerf(device->currentPerf(), device->currentProfile()); |
| 157 | // Update selection |
| 158 | if(spontaneous) |
| 159 | ui->modesList->setCurrentRow(index); |
| 160 | // Connect signals |
| 161 | if(currentMode) |
| 162 | disconnect(currentMode, SIGNAL(updated()), this, SLOT(modeUpdate())); |
| 163 | currentMode = device->currentMode(); |
| 164 | connect(currentMode, SIGNAL(updated()), this, SLOT(modeUpdate())); |
| 165 | modeUpdate(); |
| 166 | } |
| 167 | |
| 168 | void KbWidget::on_modesList_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous){ |
| 169 | if(!current) |
nothing calls this directly
no test coverage detected