Audacity 3.2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
UpdatePopupDialog Class Referencefinal

Show dialog window with update information for the user. More...

#include <UpdatePopupDialog.h>

Inheritance diagram for UpdatePopupDialog:
[legend]
Collaboration diagram for UpdatePopupDialog:
[legend]

Public Member Functions

 UpdatePopupDialog (wxWindow *parent, const VersionPatch &versionPatch, bool configurableNotification)
 
virtual ~UpdatePopupDialog ()
 
void OnUpdate (wxCommandEvent &event)
 
void OnSkip (wxCommandEvent &event)
 
void OnDontShow (wxCommandEvent &event)
 
- Public 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 ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxDialog >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Private Member Functions

HtmlWindowAddHtmlContent (wxWindow *parent)
 

Private Attributes

const VersionPatchmVersionPatch
 

Detailed Description

Show dialog window with update information for the user.

Definition at line 21 of file UpdatePopupDialog.h.

Constructor & Destructor Documentation

◆ UpdatePopupDialog()

UpdatePopupDialog::UpdatePopupDialog ( wxWindow *  parent,
const VersionPatch versionPatch,
bool  configurableNotification 
)
explicit

Definition at line 30 of file UpdatePopupDialog.cpp.

31 : wxDialogWrapper (parent, -1, XC("Update Audacity", "update dialog"),
32 wxDefaultPosition, wxDefaultSize,
33 wxCAPTION),
34 mVersionPatch(versionPatch)
35{
36 ShuttleGui S (this, eIsCreating);
37 S.SetBorder (5);
38 S.StartVerticalLay (wxEXPAND, 1);
39 {
40 S.AddWindow (AddHtmlContent (S.GetParent()));
41
42 S.StartHorizontalLay (wxEXPAND, 0);
43 {
44 S.SetBorder (5);
45
46 if (configurableNotification)
47 {
48 S.Id(DontShowID).AddCheckBox(
49 XO("Don't show this again at start up"),
51 }
52
53 S.Prop(1).AddSpace(1, 0, 1);
54
55 S.Id (wxID_NO).AddButton (XC ("&Skip", "update dialog"));
56 S.Id (wxID_YES).AddButton (XC("&Install update", "update dialog"));
57
58 S.SetBorder (5);
59 }
60 S.EndHorizontalLay();
61 }
62 S.EndVerticalLay();
63
64 Layout();
65 Fit();
66 Center();
67}
XO("Cut/Copy/Paste")
#define XC(s, c)
Definition: Internat.h:37
BoolSetting DefaultUpdatesCheckingFlag
Definition: Prefs.cpp:65
@ eIsCreating
Definition: ShuttleGui.h:39
#define S(N)
Definition: ToChars.cpp:64
@ DontShowID
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined *‍/
Definition: Prefs.h:200
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:628
HtmlWindow * AddHtmlContent(wxWindow *parent)
const VersionPatch & mVersionPatch

References DefaultUpdatesCheckingFlag, DontShowID, eIsCreating, Setting< T >::Read(), S, XC, and XO().

Here is the call graph for this function:

◆ ~UpdatePopupDialog()

UpdatePopupDialog::~UpdatePopupDialog ( )
virtual

Definition at line 69 of file UpdatePopupDialog.cpp.

70{
71 ;
72}

Member Function Documentation

◆ AddHtmlContent()

HtmlWindow * UpdatePopupDialog::AddHtmlContent ( wxWindow *  parent)
private

Definition at line 89 of file UpdatePopupDialog.cpp.

90{
91 wxStringOutputStream o;
92 wxTextOutputStream informationStr (o);
93
94 informationStr
95 << wxT("<html><body><h3>")
96 // i18n-hint Substitution of version number for %s.
97 << XC("Audacity %s is available!", "update dialog").Format(mVersionPatch.version.GetString()).Translation()
98 << wxT("</h3><h5>")
99 << XC("Changelog", "update dialog")
100 << wxT("</h5><p>");
101
102 informationStr << wxT("<ul>");
103 for (auto& logLine : mVersionPatch.changelog)
104 {
105 informationStr << wxT("<li>");
106 // We won't to translate downloaded text.
107 informationStr << logLine;
108 informationStr << wxT("</li>");
109 }
110 informationStr << wxT("</ul></p>");
111
112 informationStr << wxT("<p>");
113 informationStr << wxT("<a href = \"https://github.com/audacity/audacity/releases\">");
114 informationStr << XC("Read more on GitHub", "update dialog");
115 informationStr << wxT("</a>");
116 informationStr << wxT("</p>");
117
118 informationStr << wxT("</body></html>");
119
120 HtmlWindow* html = safenew LinkingHtmlWindow (parent, -1,
121 wxDefaultPosition,
122 wxSize (500, -1),
123 wxHW_SCROLLBAR_AUTO | wxSUNKEN_BORDER);
124
125 html->SetBorders (20);
126 html->SetPage (o.GetString());
127
128 wxHtmlContainerCell* cell = html->GetInternalRepresentation();
129
130 cell->Layout (500);
131
132 const wxSize size = wxSize (500, cell->GetHeight());
133
134 html->SetMinSize (size);
135 html->SetMaxSize (size);
136 html->SetSize (size);
137
138 return html;
139}
wxT("CloseDown"))
#define safenew
Definition: MemoryX.h:10
HtmlWindow Class.
Definition: HtmlWindow.h:37
An HtmlWindow that handles linked clicked - usually the link will go to our own local copy of the man...
Definition: HelpSystem.h:126
wxString GetString() const
Make string with version by MakeString() from instance values.
Definition: VersionId.cpp:46
VersionId version
Definition: VersionPatch.h:20
wxArrayString changelog
Definition: VersionPatch.h:21

References VersionPatch::changelog, VersionId::GetString(), mVersionPatch, safenew, size, VersionPatch::version, wxT(), and XC.

Here is the call graph for this function:

◆ OnDontShow()

void UpdatePopupDialog::OnDontShow ( wxCommandEvent &  event)

Definition at line 84 of file UpdatePopupDialog.cpp.

85{
86 DefaultUpdatesCheckingFlag.Write(!event.IsChecked());
87}
bool Write(const T &value)
Write value to config and return true if successful.
Definition: Prefs.h:252

References DefaultUpdatesCheckingFlag, and Setting< T >::Write().

Here is the call graph for this function:

◆ OnSkip()

void UpdatePopupDialog::OnSkip ( wxCommandEvent &  event)

Definition at line 79 of file UpdatePopupDialog.cpp.

80{
81 EndModal (wxID_NO);
82}

◆ OnUpdate()

void UpdatePopupDialog::OnUpdate ( wxCommandEvent &  event)

Definition at line 74 of file UpdatePopupDialog.cpp.

75{
76 EndModal (wxID_YES);
77}

Member Data Documentation

◆ mVersionPatch

const VersionPatch& UpdatePopupDialog::mVersionPatch
private

Definition at line 37 of file UpdatePopupDialog.h.

Referenced by AddHtmlContent().


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