MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / retranslateUi

Method retranslateUi

DSView/pv/toolbars/samplingbar.cpp:150–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148 }
149
150 void SamplingBar::retranslateUi()
151 {
152 bool bDev = _device_agent->have_instance();
153
154 if (bDev)
155 {
156 if (_device_agent->is_demo())
157 {
158 _device_type.setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_TOOLBAR_DEVICE_TYPE_DEMO), "Demo"));
159 }
160 else if (_device_agent->is_file())
161 {
162 _device_type.setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_TOOLBAR_DEVICE_TYPE_FILE), "File"));
163 }
164 else
165 {
166 int usb_speed = LIBUSB_SPEED_HIGH;
167 _device_agent->get_config_int32(SR_CONF_USB_SPEED, usb_speed);
168
169 if (usb_speed == LIBUSB_SPEED_HIGH)
170 _device_type.setText("USB 2.0");
171 else if (usb_speed == LIBUSB_SPEED_SUPER)
172 _device_type.setText("USB 3.0");
173 else
174 _device_type.setText("USB UNKNOWN");
175 }
176 }
177 _configure_button.setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_TOOLBAR_DEVICE_OPTION), "Options"));
178 _mode_button.setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_TOOLBAR_CAPTURE_MODE), "Mode"));
179
180 int mode = _device_agent->get_work_mode();
181 bool is_working = _session->is_working();
182
183 auto str_start = L_S(STR_PAGE_TOOLBAR, S_ID(IDS_TOOLBAR_RUN_START), "Start");
184 auto str_stop = L_S(STR_PAGE_TOOLBAR, S_ID(IDS_TOOLBAR_RUN_STOP), "Stop");
185 auto str_single = L_S(STR_PAGE_TOOLBAR, S_ID(IDS_TOOLBAR_ONE_SINGLE), "Single");
186 auto str_instant = L_S(STR_PAGE_TOOLBAR, S_ID(IDS_TOOLBAR_ONE_INSTANT), "Instant");
187 auto str_one_stop = L_S(STR_PAGE_TOOLBAR, S_ID(IDS_TOOLBAR_ONE_STOP), "Stop");
188
189 if (_is_run_as_instant)
190 {
191 if (bDev && mode == DSO)
192 _instant_button.setText(is_working ? str_one_stop : str_single);
193 else
194 _instant_button.setText(is_working ? str_one_stop : str_instant);
195
196 _run_stop_button.setText(str_start);
197 }
198 else
199 {
200 _run_stop_button.setText(is_working ? str_stop: str_start);
201
202 if (bDev && mode == DSO)
203 _instant_button.setText(str_single);
204 else
205 _instant_button.setText(str_instant);
206 }
207

Callers

nothing calls this directly

Calls 6

have_instanceMethod · 0.80
is_demoMethod · 0.80
get_config_int32Method · 0.80
get_work_modeMethod · 0.80
is_workingMethod · 0.80
is_fileMethod · 0.45

Tested by

no test coverage detected