Audacity 3.2.0
Public Member Functions | Private Attributes | List of all members
audacity::cloud::audiocom::sync::CloudLocationDialog Class Referencefinal

#include <CloudLocationDialog.h>

Inheritance diagram for audacity::cloud::audiocom::sync::CloudLocationDialog:
[legend]
Collaboration diagram for audacity::cloud::audiocom::sync::CloudLocationDialog:
[legend]

Public Member Functions

 CloudLocationDialog (wxWindow *parent, LocationDialogType type)
 
 ~CloudLocationDialog () override
 
LocationDialogResult ShowDialog ()
 

Private Attributes

LocationDialogType mType
 
bool mDoNotShow
 

Additional Inherited Members

- Private Member Functions inherited from wxDialogWrapper
 wxDialogWrapper ()
 
 wxDialogWrapper (wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const TranslatableString &name=XO("Dialog"))
 
bool Create (wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const TranslatableString &name=XO("Dialog"))
 
void SetTitle (const TranslatableString &title)
 
void SetLabel (const TranslatableString &title)
 
void SetName (const TranslatableString &title)
 
void SetName ()
 
- Private Member Functions inherited from wxTabTraversalWrapper< wxDialog >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Detailed Description

Definition at line 30 of file CloudLocationDialog.h.

Constructor & Destructor Documentation

◆ CloudLocationDialog()

audacity::cloud::audiocom::sync::CloudLocationDialog::CloudLocationDialog ( wxWindow *  parent,
LocationDialogType  type 
)

Definition at line 138 of file CloudLocationDialog.cpp.

140 : wxDialogWrapper { parent, wxID_ANY,
141 XO("Audacity"), wxDefaultPosition,
142 { 442, -1 }, wxDEFAULT_DIALOG_STYLE }
143 , mType { type }
144{
145 auto& description = type == LocationDialogType::Save ?
148
149 wxFont titleFont = GetFont();
150 titleFont.SetWeight(wxFONTWEIGHT_BOLD);
151 titleFont.SetPixelSize({ 0, 18 });
152
153 wxFont descriptionFont = GetFont();
154 descriptionFont.SetPixelSize({ 0, 14 });
155
156 auto title = safenew wxStaticText(
157 this, wxID_ANY, description.DialogTitle.Translation());
158 title->SetFont(titleFont);
159
160 auto saveToCloudImage =
161 safenew wxStaticBitmap(this, wxID_ANY, **description.RemoteImage);
162
163 auto saveToCloudTitle = safenew wxStaticText(
164 this, wxID_ANY, description.RemoteTitle.Translation());
165 saveToCloudTitle->SetFont(titleFont);
166
167 auto saveToCloudDescription = safenew wxStaticText(
168 this, wxID_ANY, description.RemoteDescription.Translation());
169 saveToCloudDescription->SetFont(descriptionFont);
170 saveToCloudDescription->Wrap(GetWrapWidth());
171
172 auto saveToCloudButton =
173 CreateButton(this, descriptionFont, description.RemoteButtonLabel);
174
175 auto saveToComputerImage =
176 safenew wxStaticBitmap(this, wxID_ANY, **description.LocalImage);
177
178 auto saveToComputerTitle = safenew wxStaticText(
179 this, wxID_ANY, description.LocalTitle.Translation());
180 saveToComputerTitle->SetFont(titleFont);
181
182 auto saveToComputerDescription = safenew wxStaticText(
183 this, wxID_ANY, description.LocalDescription.Translation());
184 saveToComputerDescription->SetFont(descriptionFont);
185 saveToComputerDescription->Wrap(GetWrapWidth());
186
187 auto saveToComputerButton =
188 CreateButton(this, descriptionFont, description.LocalButtonTitle);
189
190 auto rememberChoiceCheckbox = safenew wxCheckBox(
191 this, wxID_ANY,
192 description.DoNotShowLabel.Translation());
193
194 mDoNotShow = description.LocationMode.ReadEnum() != CloudLocationMode::Ask;
195 rememberChoiceCheckbox->SetValue(mDoNotShow);
196
197 auto sizer = safenew wxBoxSizer(wxVERTICAL);
198
199 sizer->Add(title, wxSizerFlags {}.CenterHorizontal().Border(wxTOP, 16));
200
201 auto topSizer = safenew wxBoxSizer(wxHORIZONTAL);
202
203 auto cloudSizer = SetupVerticalSizer(
204 saveToCloudImage, saveToCloudTitle, saveToCloudDescription,
205 saveToCloudButton);
206
207 topSizer->Add(cloudSizer.release(), wxSizerFlags {}.Expand());
208
209 auto computerSizer = SetupVerticalSizer(
210 saveToComputerImage, saveToComputerTitle, saveToComputerDescription,
211 saveToComputerButton);
212
213 topSizer->Add(
214 computerSizer.release(), wxSizerFlags {}.Expand().Border(wxLEFT, 8));
215
216 sizer->Add(topSizer, wxSizerFlags {}.Expand().Border(wxALL, 16));
217
218 sizer->Add(safenew wxStaticLine(this), wxSizerFlags {}.Expand());
219
220 sizer->Add(rememberChoiceCheckbox, wxSizerFlags {}.Border(wxALL, 16));
221
222 SetSizerAndFit(sizer);
223 SetupAccessibility(this);
224
225 Center();
226
227 Bind(
228 wxEVT_CHAR_HOOK,
229 [this](auto& evt)
230 {
231 if (!IsEscapeKey(evt))
232 {
233 evt.Skip();
234 return;
235 }
236
237 EndModal(wxID_CANCEL);
238 });
239
240 rememberChoiceCheckbox->Bind(
241 wxEVT_CHECKBOX, [this, rememberChoiceCheckbox](auto)
242 { mDoNotShow = rememberChoiceCheckbox->GetValue(); });
243
244 saveToCloudButton->Bind(wxEVT_BUTTON, [this](auto) { EndModal(wxID_SAVE); });
245 saveToComputerButton->Bind(
246 wxEVT_BUTTON, [this](auto) { EndModal(wxID_OK); });
247}
void SetupAccessibility(wxWindow *window)
XO("Cut/Copy/Paste")
#define safenew
Definition: MemoryX.h:10
static const auto title
std::unique_ptr< wxBoxSizer > SetupVerticalSizer(wxStaticBitmap *image, wxStaticText *title, wxStaticText *description, wxButton *button)
wxButton * CreateButton(wxWindow *parent, const wxFont &font, const TranslatableString &label)

◆ ~CloudLocationDialog()

audacity::cloud::audiocom::sync::CloudLocationDialog::~CloudLocationDialog ( )
override

Definition at line 249 of file CloudLocationDialog.cpp.

250{
251}

Member Function Documentation

◆ ShowDialog()

LocationDialogResult audacity::cloud::audiocom::sync::CloudLocationDialog::ShowDialog ( )

Definition at line 253 of file CloudLocationDialog.cpp.

254{
255 auto& description = mType == LocationDialogType::Save ?
258
259 if (description.LocationMode.ReadEnum() != CloudLocationMode::Ask)
260 return description.LocationMode.ReadEnum() == CloudLocationMode::Cloud ?
263
264 const auto result = ShowModal();
265
266 if (result == wxID_OK)
267 {
268 if (mDoNotShow)
269 {
270 description.LocationMode.WriteEnum(CloudLocationMode::Local);
271 gPrefs->Flush();
272 }
274 }
275
276 if (result == wxID_SAVE)
277 {
278 if (mDoNotShow)
279 {
280 description.LocationMode.WriteEnum(
281 description.RememberChoiceMode == ChoiceMode::User ?
284 gPrefs->Flush();
285 }
286
288 }
289
291}
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
Enum ReadEnum() const
Definition: Prefs.h:534
virtual bool Flush() noexcept=0

References audacity::cloud::audiocom::sync::anonymous_namespace{CloudLocationDialog.cpp}::ExportDialogDescription, audacity::BasicSettings::Flush(), gPrefs, audacity::cloud::audiocom::sync::anonymous_namespace{CloudLocationDialog.cpp}::DialogDescription::LocationMode, EnumSetting< Enum >::ReadEnum(), and audacity::cloud::audiocom::sync::anonymous_namespace{CloudLocationDialog.cpp}::SaveDialogDescription.

Referenced by anonymous_namespace{CloudProjectFileIOExtensions.cpp}::IOExtension::OnSave().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mDoNotShow

bool audacity::cloud::audiocom::sync::CloudLocationDialog::mDoNotShow
private

Definition at line 40 of file CloudLocationDialog.h.

◆ mType

LocationDialogType audacity::cloud::audiocom::sync::CloudLocationDialog::mType
private

Definition at line 39 of file CloudLocationDialog.h.


The documentation for this class was generated from the following files: