14#include <wx/textctrl.h>
15#include <wx/statline.h>
16#include <wx/weakref.h>
33 parent, wxID_ANY,
XO(
"Link account"), wxDefaultPosition, { 480, -1 },
34 wxDEFAULT_DIALOG_STYLE)
42 s.StartInvisiblePanel(16);
45 s.AddFixedText(
XO(
"Enter token to link your account"));
50 mToken->SetName(
XO(
"Token").Translation());
51 mToken->Bind(wxEVT_TEXT, [
this](
auto) { OnTextChanged(); });
55 s.AddWindow(
safenew wxStaticLine { s.GetParent() }, wxEXPAND);
59 s.StartHorizontalLay(wxEXPAND, 0);
63 s.AddButton(
XXO(
"&Cancel"))
64 ->Bind(wxEVT_BUTTON, [
this](
auto) { Close(); });
66 mContinueButton = s.AddButton(
XXO(
"C&ontinue"));
67 mContinueButton->Disable();
68 mContinueButton->Bind(wxEVT_BUTTON, [
this](
auto) { OnContinue(); });
72 s.EndInvisiblePanel();
92 wxWeakRef<LinkWithTokenDialog> weakDialog(
this);
96 [weakDialog](
auto accessToken)
99 [weakDialog, token = std::string(accessToken)]()
105 auto parent = weakDialog->GetParent();
108 LinkSucceededDialog successDialog { parent };
109 successDialog.ShowModal();
115 LinkFailedDialog errorDialog(weakDialog);
117 if (wxID_RETRY != errorDialog.ShowModal())
126void LinkWithTokenDialog::OnTextChanged()
128 mContinueButton->Enable(!mToken->GetValue().empty());
148 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
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()
wxButton * mContinueButton
~LinkWithTokenDialog() override
LinkWithTokenDialog(wxWindow *parent=nullptr)
bool HandleLinkURI(std::string_view uri, std::function< void(std::string_view)> 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)