| 70 | } |
| 71 | |
| 72 | void KbLightWidget::newSelection(QStringList selection){ |
| 73 | // Determine selected color (invalid color if no selection or if they're not all the same) |
| 74 | QColor selectedColor; |
| 75 | const QColorMap& colorMap = light->colorMap(); |
| 76 | foreach(const QString& key, selection){ |
| 77 | QColor color = colorMap.value(key); |
| 78 | if(!selectedColor.isValid()) |
| 79 | selectedColor = color; |
| 80 | else if(color != selectedColor){ |
| 81 | selectedColor = QColor(); |
| 82 | break; |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | currentSelection = selection; |
| 87 | ui->animWidget->setSelectedKeys(selection); |
| 88 | ui->bgButton->color(selectedColor); |
| 89 | int count = selection.count(); |
| 90 | if(count == 0){ |
| 91 | ui->selLabel->setText("Click to select"); |
| 92 | return; |
| 93 | } else if(count == 1) |
| 94 | ui->selLabel->setText(tr("1 %1 selected").arg(light->map().isMouse() ? "zone" : "key")); |
| 95 | else |
| 96 | ui->selLabel->setText(tr("%1 %2 selected").arg(count).arg(light->map().isMouse() ? "zones" : "keys")); |
| 97 | } |
| 98 | |
| 99 | void KbLightWidget::changeColor(QColor newColor){ |
| 100 | if(light){ |