| 141 | } |
| 142 | |
| 143 | void MoodLampManager::updateColors() |
| 144 | { |
| 145 | DEBUG_HIGH_LEVEL << Q_FUNC_INFO << m_isLiquidMode << m_liquidModeSpeed; |
| 146 | |
| 147 | QRgb rgb; |
| 148 | |
| 149 | if (m_isLiquidMode) |
| 150 | { |
| 151 | static int red = 0; |
| 152 | static int green = 0; |
| 153 | static int blue = 0; |
| 154 | |
| 155 | static int redNew = 0; |
| 156 | static int greenNew = 0; |
| 157 | static int blueNew = 0; |
| 158 | |
| 159 | if (red == redNew && green == greenNew && blue == blueNew) |
| 160 | { |
| 161 | m_delay = generateDelay(m_liquidModeSpeed); |
| 162 | QColor colorNew = generateColor(); |
| 163 | |
| 164 | redNew = colorNew.red(); |
| 165 | greenNew = colorNew.green(); |
| 166 | blueNew = colorNew.blue(); |
| 167 | |
| 168 | DEBUG_HIGH_LEVEL << Q_FUNC_INFO << colorNew; |
| 169 | } |
| 170 | |
| 171 | if (redNew != red) { if (red > redNew) --red; else ++red; } |
| 172 | if (greenNew != green){ if (green > greenNew) --green; else ++green; } |
| 173 | if (blueNew != blue) { if (blue > blueNew) --blue; else ++blue; } |
| 174 | |
| 175 | rgb = qRgb(red, green, blue); |
| 176 | } |
| 177 | else |
| 178 | { |
| 179 | rgb = m_currentColor.rgb(); |
| 180 | } |
| 181 | |
| 182 | if (m_rgbSaved != rgb || m_isSendDataOnlyIfColorsChanged == false) |
| 183 | { |
| 184 | fillColors(rgb); |
| 185 | emit updateLedsColors(m_colors); |
| 186 | } |
| 187 | |
| 188 | if (m_isMoodLampEnabled && m_isLiquidMode) |
| 189 | { |
| 190 | m_timer.start(m_delay); |
| 191 | } |
| 192 | |
| 193 | m_rgbSaved = rgb; |
| 194 | } |
| 195 | |
| 196 | int MoodLampManager::generateDelay(int speed) |
| 197 | { |