17#include <wx/statline.h>
18#include <wx/stattext.h>
19#include <wx/textctrl.h>
21#include "../UserPanel.h"
33 UserService& userService,
const wxString& projectName, wxWindow* parent,
40 new UserPanel(serviceConfig, authService, userService,
44 projectName, wxDefaultPosition,
45 wxDefaultSize, wxTE_PROCESS_ENTER };
48 if (!projectName.empty())
54 const wxString choices[] = {
XO(
"Private").Translation(),
55 XO(
"Unlisted").Translation(),
56 XO(
"Public").Translation() };
58 mSaveToCloud =
new wxButton {
this, wxID_ANY,
XO(
"Save").Translation() };
61 new wxButton {
this, wxID_ANY,
XO(
"Save to computer...").Translation() };
62 mCancel =
new wxButton {
this, wxID_ANY,
XO(
"Cancel").Translation() };
79std::pair<CloudProjectPropertiesDialog::Action, std::string>
82 UserService& userService,
const wxString& projectName, wxWindow* parent,
86 userService, projectName,
89 dialog.mSaveLocally->Show(allowLocalSave);
91 const auto resultCode = dialog.ShowModal();
94 resultCode == wxID_OK ?
98 return { action, dialog.GetProjectName() };
103 const bool canSubmit =
115 auto* topSizer =
new wxBoxSizer { wxVERTICAL };
117 constexpr auto spacerHeight = 8;
119 topSizer->AddSpacer(spacerHeight);
121 topSizer->Add(
mUserPanel, 0, wxEXPAND | wxLEFT | wxRIGHT, 16);
122 topSizer->AddSpacer(spacerHeight);
124 topSizer->Add(
new wxStaticLine {
this }, 0, wxEXPAND | wxLEFT | wxRIGHT, 16);
125 topSizer->AddSpacer(spacerHeight);
128 new wxStaticText {
this, wxID_ANY,
XO(
"Project Name").Translation() }, 0,
129 wxEXPAND | wxLEFT | wxRIGHT, 16);
130 topSizer->AddSpacer(spacerHeight);
132 topSizer->Add(
mProjectName, 0, wxEXPAND | wxLEFT | wxRIGHT, 16);
134 topSizer->AddSpacer(spacerHeight);
136 topSizer->AddSpacer(2 * spacerHeight);
138 auto buttonSizer =
new wxBoxSizer { wxHORIZONTAL };
141 buttonSizer->AddStretchSpacer();
142 buttonSizer->Add(
mCancel, 0, wxRIGHT, 4);
145 topSizer->Add(buttonSizer, 0, wxEXPAND | wxALL, 0);
146 topSizer->AddSpacer(spacerHeight);
148 SetMinSize({ 450, -1 });
169 mSaveLocally->Bind(wxEVT_BUTTON, [
this](
auto&) { EndModal(wxID_SAVE); });
170 mCancel->Bind(wxEVT_BUTTON, [
this](
auto&) { EndModal(wxID_CANCEL); });
176 if (!IsEscapeKey(evt))
182 EndModal(wxID_CANCEL);
189 const auto keyCode = evt.GetKeyCode();
190 if (keyCode != WXK_RETURN && keyCode != WXK_NUMPAD_ENTER)
207 result.Trim(
true).Trim(
false);
void SetupAccessibility(wxWindow *window)
Declare functions to perform UTF-8 to std::wstring conversions.
static bool SignIn(wxWindow *parent, Mode mode=Mode::SignIn)
void PopSuppressDialogs()
void PushSuppressDialogs()
Service responsible for OAuth authentication against the audio.com service.
Configuration for the audio.com.
bool IsAuthorized() const
Service for providing information about the user profile.
~CloudProjectPropertiesDialog() override
void OnUpdateCloudSaveState()
static std::pair< Action, std::string > Show(const ServiceConfig &serviceConfig, OAuthService &authService, UserService &userService, const wxString &projectName, wxWindow *parent, bool allowLocalSave, AudiocomTrace)
std::string GetProjectName() const
wxTextCtrl * mProjectName
CloudProjectPropertiesDialog(const ServiceConfig &serviceConfig, OAuthService &authService, UserService &userService, const wxString &projectName, wxWindow *parent, AudiocomTrace)
AuthorizationHandler & GetAuthorizationHandler()
OAuthService & GetOAuthService()
Returns the instance of the OAuthService.
std::string ToUTF8(const std::wstring &wstr)