14#include <wx/textctrl.h>
15#include <wx/statline.h>
16#include <wx/weakref.h>
34 parent, wxID_ANY,
XO(
"Link account"), wxDefaultPosition, { 480, -1 },
35 wxDEFAULT_DIALOG_STYLE)
36 , mAudiocomTrace(trace)
44 s.StartInvisiblePanel(16);
47 s.AddFixedText(
XO(
"Enter token to link your account"));
52 mToken->SetName(
XO(
"Token").Translation());
57 s.AddWindow(
safenew wxStaticLine { s.GetParent() }, wxEXPAND);
61 s.StartHorizontalLay(wxEXPAND, 0);
65 s.AddButton(
XXO(
"&Cancel"))
66 ->Bind(wxEVT_BUTTON, [
this](
auto) { Close(); });
74 s.EndInvisiblePanel();
94 wxWeakRef<LinkWithTokenDialog> weakDialog(
this);
100 [weakDialog, token = std::string(accessToken), trace]() {
105 auto parent = weakDialog->GetParent();
108 LinkSucceededDialog successDialog { parent };
109 successDialog.ShowModal();
115 LinkFailedDialog errorDialog(weakDialog, trace);
117 if (wxID_RETRY != errorDialog.ShowModal())
126void LinkWithTokenDialog::OnTextChanged()
128 mContinueButton->Enable(!mToken->GetValue().empty());
150 wxT(
"LinkAccount"),
XXO(
"L&ink audio.com account..."),
Toolkit-neutral facade for basic user interface services.
Declare functions to perform UTF-8 to std::wstring conversions.
constexpr CommandFlag AlwaysEnabledFlag
@ LinkAudiocomAccountHelpMenu
XXO("&Cut/Copy/Paste Toolbar")
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
Generates classes whose instances register items at construction.
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Holds a msgid for the translation catalog; may also bind format arguments.
void PopSuppressDialogs()
void PushSuppressDialogs()
const AudiocomTrace mAudiocomTrace
wxButton * mContinueButton
LinkWithTokenDialog(AudiocomTrace, wxWindow *parent=nullptr)
~LinkWithTokenDialog() override
bool HandleLinkURI(std::string_view uri, AudiocomTrace, AuthSuccessCallback completedHandler)
Handle the OAuth callback.
bool Begin(const FilePath &dataDir)
void OnLinkAccount(const CommandContext &)
AuthorizationHandler & GetAuthorizationHandler()
OAuthService & GetOAuthService()
Returns the instance of the OAuthService.
std::string ToUTF8(const std::wstring &wstr)