Audacity 3.2.0
UserPanel.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*!********************************************************************
3
4 Audacity: A Digital Audio Editor
5
6 UserPanel.h
7
8 Dmitry Vedenko
9
10**********************************************************************/
11#pragma once
12
13#include "NetworkUtils.h"
14#include "Observer.h"
15#include "wxPanelWrapper.h"
16
17class wxStaticText;
18class wxButton;
19enum class AudiocomTrace;
20
22{
23class ServiceConfig;
24class OAuthService;
25class UserService;
26class UserImage;
27
29{
31};
32
33class UserPanel final
34 : public wxPanelWrapper
35 , public Observer::Publisher<UserPanelStateChangedMessage>
36{
37public:
38
39 // TODO this will use different text depending on user panel location,
40 // due to discrepancies in cloud login flow, to be unified
41 enum class LinkMode {
42 Link,
43 SignIn,
44 };
45
47 const ServiceConfig& serviceConfig, OAuthService& authService,
48 UserService& userService, LinkMode linkMode, AudiocomTrace,
49 wxWindow* parent = nullptr, const wxPoint& pos = wxDefaultPosition,
50 const wxSize& size = wxDefaultSize);
51
52 ~UserPanel() override;
53
54 bool IsAuthorized() const;
55
56private:
57 void OnStateChanged(bool isAuthorized);
58 void UpdateUserData();
60 void SetAnonymousState();
61
66
68 wxStaticText* mUserName {};
69 wxButton* mLinkButton {};
70
72
73 bool mIsAuthorized { false };
75}; // class UserPanel
76
77} // namespace audacity::cloud::audiocom
AudiocomTrace
Definition: ExportUtils.h:27
An object that sends messages to an open-ended list of subscribed callbacks.
Definition: Observer.h:108
A move-only handle representing a connection to a Publisher.
Definition: Observer.h:70
Service responsible for OAuth authentication against the audio.com service.
Definition: OAuthService.h:43
Configuration for the audio.com.
Definition: ServiceConfig.h:25
const ServiceConfig & mServiceConfig
Definition: UserPanel.h:62
UserPanel(const ServiceConfig &serviceConfig, OAuthService &authService, UserService &userService, LinkMode linkMode, AudiocomTrace, wxWindow *parent=nullptr, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
Definition: UserPanel.cpp:52
Observer::Subscription mUserDataChangedSubscription
Definition: UserPanel.h:71
void OnStateChanged(bool isAuthorized)
Definition: UserPanel.cpp:99
const AudiocomTrace mAudiocomTrace
Definition: UserPanel.h:65
Service for providing information about the user profile.
Definition: UserService.h:28