| 1094 | } |
| 1095 | |
| 1096 | void Ui::OpenRGBDevicePage::UpdateMode() |
| 1097 | { |
| 1098 | /*-----------------------------------------------------*\ |
| 1099 | | Read selected mode | |
| 1100 | \*-----------------------------------------------------*/ |
| 1101 | int current_mode = ui->ModeBox->currentIndex(); |
| 1102 | |
| 1103 | if(current_mode >= 0) |
| 1104 | { |
| 1105 | int current_speed = 0; |
| 1106 | int current_brightness = 0; |
| 1107 | bool current_per_led = ui->PerLEDCheck->isChecked(); |
| 1108 | bool current_mode_specific = ui->ModeSpecificCheck->isChecked(); |
| 1109 | bool current_random = ui->RandomCheck->isChecked(); |
| 1110 | int current_dir_idx = ui->DirectionBox->currentIndex(); |
| 1111 | int current_direction = 0; |
| 1112 | bool supports_dir_lr = ( device->modes[(unsigned int)current_mode].flags & MODE_FLAG_HAS_DIRECTION_LR ); |
| 1113 | bool supports_dir_ud = ( device->modes[(unsigned int)current_mode].flags & MODE_FLAG_HAS_DIRECTION_UD ); |
| 1114 | bool supports_dir_hv = ( device->modes[(unsigned int)current_mode].flags & MODE_FLAG_HAS_DIRECTION_HV ); |
| 1115 | |
| 1116 | /*-----------------------------------------------------*\ |
| 1117 | | If DirectionBox is enabled, set the direction values | |
| 1118 | \*-----------------------------------------------------*/ |
| 1119 | if(ui->DirectionBox->isEnabled()) |
| 1120 | { |
| 1121 | if(supports_dir_hv) |
| 1122 | { |
| 1123 | if(supports_dir_lr && supports_dir_ud) |
| 1124 | { |
| 1125 | current_direction = current_dir_idx; |
| 1126 | } |
| 1127 | else if(supports_dir_lr || supports_dir_ud) |
| 1128 | { |
| 1129 | current_direction = current_dir_idx + 2; |
| 1130 | } |
| 1131 | else |
| 1132 | { |
| 1133 | current_direction = current_dir_idx + 4; |
| 1134 | } |
| 1135 | } |
| 1136 | |
| 1137 | if(supports_dir_ud) |
| 1138 | { |
| 1139 | if(supports_dir_lr) |
| 1140 | { |
| 1141 | current_direction = current_dir_idx; |
| 1142 | } |
| 1143 | else |
| 1144 | { |
| 1145 | current_direction = current_dir_idx + 2; |
| 1146 | } |
| 1147 | } |
| 1148 | |
| 1149 | if((supports_dir_lr) |
| 1150 | &&(current_dir_idx < 2)) |
| 1151 | { |
| 1152 | current_direction = current_dir_idx; |
| 1153 | } |
no test coverage detected