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 31 of file UpdatePopupDialog.cpp.

32 : wxDialogWrapper (parent, -1, XC("Update Audacity", "update dialog"),
33 wxDefaultPosition, wxDefaultSize,
34 wxCAPTION),
35 mVersionPatch(versionPatch)
36{
37 ShuttleGui S (this, eIsCreating);
38 S.SetBorder (5);
39 S.StartVerticalLay (wxEXPAND, 1);
40 {
41 S.AddWindow (AddHtmlContent (S.GetParent()));
42
43 S.StartHorizontalLay (wxEXPAND, 0);
44 {
45 S.SetBorder (5);
46
47 if (configurableNotification)
48 {
49 S.Id(DontShowID).AddCheckBox(
50 XO("Don't show this again at start up"),
52 }
53
54 S.Prop(1).AddSpace(1, 0, 1);
55
56 S.Id (wxID_NO).AddButton (XC ("&Skip", "update dialog"));
57 S.Id (wxID_YES).AddButton (XC("&Install update", "update dialog"));
58
59 S.SetBorder (5);
60 }
61 S.EndHorizontalLay();
62 }
63 S.EndVerticalLay();
64
65 Layout();
66 Fit();
67 Center();
68
69 wxSize sz = GetSize();
70 const auto maxHeight = std::max(1, wxDisplay().GetGeometry().GetHeight() - 100);
71 const auto minHeight = std::min({ sz.y, 600, maxHeight });
72 SetSizeHints(sz.x, minHeight, wxDefaultCoord, maxHeight);
73}
int min(int a, int b)
XO("Cut/Copy/Paste")
#define XC(s, c)
Definition: Internat.h:37
StickySetting< BoolSetting > DefaultUpdatesCheckingFlag
Definition: Prefs.cpp:63
@ eIsCreating
Definition: ShuttleGui.h:37
#define S(N)
Definition: ToChars.cpp:64
@ DontShowID
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
HtmlWindow * AddHtmlContent(wxWindow *parent)
const VersionPatch & mVersionPatch

References DefaultUpdatesCheckingFlag, DontShowID, eIsCreating, min(), S, XC, and XO().

Here is the call graph for this function:

◆ ~UpdatePopupDialog()

UpdatePopupDialog::~UpdatePopupDialog ( )
virtual

Definition at line 75 of file UpdatePopupDialog.cpp.

76{
77 ;
78}

Member Function Documentation

◆ AddHtmlContent()

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

Definition at line 95 of file UpdatePopupDialog.cpp.

96{
97 wxStringOutputStream o;
98 wxTextOutputStream informationStr (o);
99
100#if AUDACITY_BUILD_LEVEL == 0
101 const auto versionPostfix = " Alpha";
102#elif AUDACITY_BUILD_LEVEL == 1
103 const auto versionPostfix = " Beta";
104#else
105 const auto versionPostfix = "";
106#endif
107
108 informationStr
109 << wxT("<html><body><h3>")
110 // i18n-hint Substitution of version number for %s.
111 << XC("Audacity %s is available!", "update dialog")
112 .Format(
113 mVersionPatch.version.GetString() + versionPostfix)
114 .Translation()
115 << wxT("</h3><h5>")
116 << XC("Changelog", "update dialog")
117 << wxT("</h5><p>");
118
119 informationStr << wxT("<ul>");
120 for (auto& logLine : mVersionPatch.changelog)
121 {
122 informationStr << wxT("<li>");
123 // We won't to translate downloaded text.
124 informationStr << logLine;
125 informationStr << wxT("</li>");
126 }
127 informationStr << wxT("</ul></p>");
128
129 informationStr << wxT("<p>");
130 informationStr << wxT("<a href = \"https://github.com/audacity/audacity/releases\">");
131 informationStr << XC("Read more on GitHub", "update dialog");
132 informationStr << wxT("</a>");
133 informationStr << wxT("</p>");
134
135 informationStr << wxT("</body></html>");
136
137 HtmlWindow* html = safenew LinkingHtmlWindow (parent, -1,
138 wxDefaultPosition,
139 wxSize (500, -1),
140 wxHW_SCROLLBAR_AUTO | wxSUNKEN_BORDER);
141
142 html->SetBorders (20);
143 html->SetPage (o.GetString());
144
145 wxHtmlContainerCell* cell = html->GetInternalRepresentation();
146
147 cell->Layout (500);
148
149 const wxSize size = wxSize (500, cell->GetHeight());
150
151 html->SetMinSize (size);
152 html->SetMaxSize (size);
153 html->SetSize (size);
154
155 return html;
156}
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:60
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 90 of file UpdatePopupDialog.cpp.

91{
92 DefaultUpdatesCheckingFlag->Write(!event.IsChecked());
93}

References DefaultUpdatesCheckingFlag.

◆ OnSkip()

void UpdatePopupDialog::OnSkip ( wxCommandEvent &  event)

Definition at line 85 of file UpdatePopupDialog.cpp.

86{
87 EndModal (wxID_NO);
88}

◆ OnUpdate()

void UpdatePopupDialog::OnUpdate ( wxCommandEvent &  event)

Definition at line 80 of file UpdatePopupDialog.cpp.

81{
82 EndModal (wxID_YES);
83}

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: