MCPcopy Create free account
hub / github.com/audacity/audacity / UserPanel

Method UserPanel

modules/sharing/mod-cloud-audiocom/ui/UserPanel.cpp:53–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51} // namespace
52
53UserPanel::UserPanel(
54 const ServiceConfig& serviceConfig, OAuthService& authService,
55 UserService& userService, bool linkButtonVisible, AudiocomTrace trace,
56 wxWindow* parent, const wxPoint& pos, const wxSize& size)
57 : wxPanelWrapper { parent, wxID_ANY, pos, size }
58 , mServiceConfig { serviceConfig }
59 , mAuthService { authService }
60 , mUserService { userService }
61 , mAudiocomTrace { trace }
62 , mUserDataChangedSubscription { userService.Subscribe(
63 [this](const auto&) { UpdateUserData(); }) }
64 , mLinkButtonVisible { linkButtonVisible }
65{
66 GetAuthorizationHandler().PushSuppressDialogs();
67 mUserImage = safenew UserImage(this, avatarSize);
68 mUserImage->SetLabel(anonymousText); // for screen readers
69 mUserName = safenew wxStaticText(
70 this,
71 wxID_ANY,
72 anonymousText.Translation() );
73
74 mLinkButton =
75 safenew wxButton(this, wxID_ANY, XXO("Sign in").Translation());
76 mLinkButton->Bind(wxEVT_BUTTON, [this](auto) { OnLinkButtonPressed(); });
77
78 mLinkButton->Show(mLinkButtonVisible);
79
80 auto sizer = safenew wxBoxSizer { wxHORIZONTAL };
81
82 sizer->Add(mUserImage, 0, wxALIGN_CENTER_VERTICAL);
83 sizer->AddSpacer(8);
84 sizer->Add(mUserName, 0, wxALIGN_CENTER_VERTICAL);
85 sizer->AddStretchSpacer();
86 sizer->Add(mLinkButton, 0, wxALIGN_CENTER_VERTICAL);
87
88 SetSizerAndFit(sizer);
89 UpdateUserData();
90}
91
92UserPanel::~UserPanel() = default;
93

Callers

nothing calls this directly

Calls 12

PushSuppressDialogsMethod · 0.80
TranslationMethod · 0.80
BindMethod · 0.80
AddSpacerMethod · 0.80
AddStretchSpacerMethod · 0.80
UserImageClass · 0.70
wxStaticTextClass · 0.70
wxButtonClass · 0.70
SubscribeMethod · 0.45
SetLabelMethod · 0.45
ShowMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected