MCPcopy Create free account
hub / github.com/RGAA-Software/GoDesk / GenStream

Method GenStream

src/render_panel/devices/create_stream_dialog.cpp:312–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

310 }
311
312 bool CreateStreamDialog::GenStream() {
313 auto host = ed_host_->text().toStdString();
314 auto port = std::atoi(ed_port_->text().toStdString().c_str());
315 auto name = ed_name_->text().toStdString();
316 auto bitrate = [this]() -> int {
317 if (ed_bitrate_) {
318 return std::atoi(ed_bitrate_->text().toStdString().c_str());
319 } else {
320 return 0;
321 }
322 } ();
323
324 if (host.empty() || port == 0) {
325 TcDialog dialog(tcTr("id_tips"), tcTr("id_input_necessary_info"), this);
326 dialog.exec();
327 return false;
328 }
329
330 auto func_update_stream = [&](std::shared_ptr<spvr::SpvrStream>& item) {
331 item->stream_name_ = name.empty() ? host : name;
332 item->stream_host_ = host;
333 item->stream_port_ = port;
334 item->encode_bps_ = bitrate;
335 item->encode_fps_ = cb_fps_ ? std::atoi(cb_fps_->currentText().toStdString().c_str()) : 0;
336 item->clipboard_enabled_ = true;
337 };
338
339 if (stream_item_ && stream_item_->IsValid()) {
340 func_update_stream(stream_item_);
341 context_->SendAppMessage(StreamItemUpdated {
342 .item_ = stream_item_,
343 });
344 }
345 else {
346 std::shared_ptr<spvr::SpvrStream> item = std::make_shared<spvr::SpvrStream>();
347 func_update_stream(item);
348 context_->SendAppMessage(StreamItemAdded {
349 .item_ = item,
350 .auto_start_ = true,
351 });
352 }
353 return true;
354 }
355
356 void CreateStreamDialog::paintEvent(QPaintEvent *event) {
357 TcCustomTitleBarDialog::paintEvent(event);

Callers

nothing calls this directly

Calls 2

IsValidMethod · 0.45
SendAppMessageMethod · 0.45

Tested by

no test coverage detected