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();
90 wxWeakRef<LinkAccountDialog> weakDialog(
this);
94 [weakDialog](
auto accessToken)
97 [weakDialog, token = std::string(accessToken)]()
103 auto parent = weakDialog->GetParent();
106 LinkSucceededDialog successDialog { parent };
107 successDialog.ShowModal();
113 LinkFailedDialog errorDialog(weakDialog);
115 if (wxID_RETRY != errorDialog.ShowModal())
124void LinkAccountDialog::OnTextChanged()
126 mContinueButton->Enable(!mToken->GetValue().empty());
132#include "../../commands/CommandContext.h"
133#include "../../commands/CommandManager.h"
147 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,...
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
~LinkAccountDialog() override
LinkAccountDialog(wxWindow *parent=nullptr)
void 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 &)
std::string ToUTF8(const std::wstring &wstr)
AuthorizationHandler & GetAuthorizationHandler()
OAuthService & GetOAuthService()
Returns the instance of the OAuthService.