| 1113 | } |
| 1114 | |
| 1115 | void SamplingBar::update_device_list() |
| 1116 | { |
| 1117 | struct ds_device_base_info *array = NULL; |
| 1118 | int dev_count = 0; |
| 1119 | int select_index = 0; |
| 1120 | |
| 1121 | dsv_info("Update device list."); |
| 1122 | |
| 1123 | array = _session->get_device_list(dev_count, select_index); |
| 1124 | |
| 1125 | if (array == NULL) |
| 1126 | { |
| 1127 | dsv_err("Get deivce list error!"); |
| 1128 | return; |
| 1129 | } |
| 1130 | |
| 1131 | _updating_device_list = true; |
| 1132 | struct ds_device_base_info *p = NULL; |
| 1133 | ds_device_handle cur_dev_handle = NULL_HANDLE; |
| 1134 | |
| 1135 | _device_selector.clear(); |
| 1136 | |
| 1137 | for (int i = 0; i < dev_count; i++) |
| 1138 | { |
| 1139 | p = (array + i); |
| 1140 | _device_selector.addItem(QString(p->name), QVariant::fromValue((unsigned long long)p->handle)); |
| 1141 | |
| 1142 | if (i == select_index) |
| 1143 | cur_dev_handle = p->handle; |
| 1144 | } |
| 1145 | free(array); |
| 1146 | |
| 1147 | _device_selector.setCurrentIndex(select_index); |
| 1148 | |
| 1149 | if (cur_dev_handle != _last_device_handle){ |
| 1150 | update_sample_rate_list(); |
| 1151 | _last_device_handle = cur_dev_handle; |
| 1152 | } |
| 1153 | |
| 1154 | _last_device_index = select_index; |
| 1155 | int width = _device_selector.sizeHint().width(); |
| 1156 | _device_selector.setFixedWidth(min(width + 15, _device_selector.maximumWidth())); |
| 1157 | _device_selector.view()->setMinimumWidth(width + 30); |
| 1158 | |
| 1159 | _updating_device_list = false; |
| 1160 | } |
| 1161 | |
| 1162 | void SamplingBar::config_device() |
| 1163 | { |
no test coverage detected