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

Method SubControlPanel

src/client/ui/float_sub_control_panel.cpp:22–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20{
21
22 SubControlPanel::SubControlPanel(const std::shared_ptr<ClientContext>& ctx, QWidget* parent) : BaseWidget(ctx, parent) {
23 this->setWindowFlags(Qt::FramelessWindowHint);
24 this->setStyleSheet("background:#00000000;");
25 int offset = 5;
26 setFixedSize(210, 256);
27 auto item_height = 38;
28 auto border_spacing = 10;
29 auto item_size = QSize(this->width() - 2*offset, item_height);
30 auto root_layout = new NoMarginVLayout();
31 root_layout->setContentsMargins(offset, offset, offset, offset);
32 //Clipboard
33 {
34 auto layout = new NoMarginHLayout();
35 auto widget = new QWidget(this);
36 widget->setLayout(layout);
37 widget->setFixedSize(item_size);
38 layout->addWidget(widget);
39
40 auto lbl = new TcLabel();
41 lbl->SetTextId("id_clipboard");
42 lbl->setStyleSheet(R"(font-weight:bold;)");
43 layout->addSpacing(border_spacing*2);
44 layout->addWidget(lbl);
45
46 layout->addStretch();
47
48 auto sb = new SwitchButton(this);
49 clibpboard_btn_ = sb;
50 sb->setFixedSize(35, 20);
51 sb->SetStatus(Settings::Instance()->clipboard_on_);
52 layout->addWidget(sb);
53 sb->SetClickCallback([=,this](bool enabled) {
54 Settings::Instance()->SetClipboardEnabled(enabled);
55 this->context_->SendAppMessage(MsgClientFloatControllerPanelUpdate{.update_type_ = MsgClientFloatControllerPanelUpdate::EUpdate::kClipboardSharedStatus});
56 });
57
58 layout->addSpacing(border_spacing);
59
60 root_layout->addSpacing(5);
61 root_layout->addWidget(widget);
62 }
63
64 // Only Viewing
65 {
66 auto layout = new NoMarginHLayout();
67 auto widget = new QWidget(this);
68 widget->setLayout(layout);
69 widget->setFixedSize(item_size);
70 layout->addWidget(widget);
71
72 auto lbl = new TcLabel();
73 lbl->SetTextId("id_only_viewing");
74 lbl->setStyleSheet(R"(font-weight:bold;)");
75 layout->addSpacing(border_spacing*2);
76 layout->addWidget(lbl);
77
78 layout->addStretch();
79

Callers

nothing calls this directly

Calls 6

SetClickCallbackMethod · 0.80
SetClipboardEnabledMethod · 0.80
PostMediaMessageMethod · 0.80
SetStatusMethod · 0.45
SendAppMessageMethod · 0.45
SetOnClickListenerMethod · 0.45

Tested by

no test coverage detected