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

Method LoadStreamItems

src/render_panel/devices/app_stream_list.cpp:733–777  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

731 }
732
733 void AppStreamList::LoadStreamItems() {
734 context_->PostUITask([=, this]() {
735 {
736 auto db_mgr = context_->GetStreamDBManager();
737 std::lock_guard<std::mutex> guard(streams_mtx_);
738 streams_ = db_mgr->GetAllStreamsSortByCreatedTime();
739
740 // bench test
741 // auto fn_rand_a_upper_char = []() -> char {
742 // char c = 'A' + rand() % 26;
743 // return c;
744 // };
745 // for (int i = 0; i < 100; i++) {
746 // auto st = std::make_shared<spvr::SpvrStream>();
747 // st->stream_name_ = std::format("Desktop: {}", i+1);
748 // st->stream_host_ = std::format("192.168.1.{}", i+5);
749 // st->desktop_name_ = StringUtil::ToUpperCpy(std::format("DESKTOP-{}{}{}{}{}", fn_rand_a_upper_char(), fn_rand_a_upper_char(), fn_rand_a_upper_char(), fn_rand_a_upper_char(), fn_rand_a_upper_char()));
750 // streams_.push_back(st);
751 // }
752
753 int count = stream_list_->count();
754 for (int i = 0; i < count; i++) {
755 auto item = stream_list_->takeItem(0);
756 delete item;
757 }
758
759 int index = 0;
760 for (auto& stream : streams_) {
761 stream->device_id_ = settings_->GetDeviceId();
762 AddItem(stream, index++);
763 }
764
765 if (!streams_.empty()) {
766 stream_content_->HideEmptyTip();
767 }
768 else {
769 stream_content_->ShowEmptyTip();
770 }
771 }
772
773 // update to stream state checker
774 cat streams = CopyStreams();
775 state_checker_->UpdateCurrentStreamItems(streams);
776 });
777 }
778
779 void AppStreamList::RequestBindDevices() {
780 auto user_mgr = grApp->GetUserManager();

Callers 2

InitMethod · 0.95
StreamContentMethod · 0.80

Calls 7

GetStreamDBManagerMethod · 0.80
PostUITaskMethod · 0.45
GetDeviceIdMethod · 0.45
HideEmptyTipMethod · 0.45
ShowEmptyTipMethod · 0.45

Tested by

no test coverage detected