MCPcopy Create free account
hub / github.com/ccMSC/ckb / newSelection

Method newSelection

src/ckb/kblightwidget.cpp:72–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72void 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
99void KbLightWidget::changeColor(QColor newColor){
100 if(light){

Callers

nothing calls this directly

Calls 6

colorMapMethod · 0.80
setSelectedKeysMethod · 0.80
colorMethod · 0.45
countMethod · 0.45
isMouseMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected