Audacity  3.0.3
UpdateNoticeDialog.cpp
Go to the documentation of this file.
1 
2 /*!********************************************************************
3 
4  Audacity: A Digital Audio Editor
5 
6  @file UpdateNoticeDialog.cpp
7  @brief Declare a dialog to notify the user about automatic update checking.
8 
9  Dmitry Vedenko
10  **********************************************************************/
11 
12 #include "UpdateNoticeDialog.h"
13 
14 #include <wx/button.h>
15 #include <wx/stattext.h>
16 
17 #include "ShuttleGui.h"
18 #include "CodeConversions.h"
19 #include "prefs/PrefsDialog.h"
21 
22 
23 static const auto title =
24  /* i18n-hint: Title of the app update notice dialog. */
25  XO("App update checking");
26 
27 static const auto firstParagraph =
28  /* i18-hint: The first paragraph of app update notice dialog. */
29  XO("To stay up to date, you will receive an in-app notification whenever there is a new version of Audacity available to download.");
30 
31 static const auto secondParagraph =
32  /* i18-hint: The second paragraph of app update notice dialog */
33  XO("In order to protect your privacy, Audacity does not collect any personal information. However, app update checking does require network access.");
34 
35 static const auto thirdParagraph =
36  /* i18-hint: Hint to the user about how to turn the app update off. %s is replaced with "Preferences > Application" link*/
37  XO("You can turn off app update checking at any time in %s.");
38 
39 
40 BEGIN_EVENT_TABLE(UpdateNoticeDialog, wxDialogWrapper)
44 
46 
49  /* i18n-hint: Title of the app update notice dialog. */
50  parent, -1, XO("App updates"), wxDefaultPosition, wxDefaultSize,
51  wxCAPTION | wxCLOSE_BOX)
52 {
53  ShuttleGui S(this, eIsCreating);
54 
55  S.StartVerticalLay();
56  {
57  S.AddSpace(0, 16);
58 
59  S.StartHorizontalLay(wxEXPAND, 0);
60  {
61  S.AddSpace(24, 0);
62 
63  S.StartPanel();
64  {
65  S.SetBorder(8);
66 
67  wxStaticText* titleCtrl = S.AddVariableText(title, false, 0, 500);
68 
69  wxFont font = titleCtrl->GetFont().MakeLarger().MakeBold();
70 
71  titleCtrl->SetFont(font);
72 
73  S.AddFixedText(firstParagraph, false, 500);
74 
75  S.AddFixedText(secondParagraph, false, 500);
76 
77  S.AddSpace(0, 8);
78 
79  /* i18n-hint: %s will be replaced with "our Privacy Policy" */
80  AccessibleLinksFormatter privacyPolicy(XO("See %s for more info."));
81 
82  privacyPolicy.FormatLink(
83  /* i18n-hint: Title of hyperlink to the privacy policy. This is an object of "See". */
84  wxT("%s"), XO("our Privacy Policy"),
85  "https://www.audacityteam.org/about/desktop-privacy-notice/");
86 
87  privacyPolicy.Populate(S);
88 
89  AccessibleLinksFormatter preferencesMessage(thirdParagraph);
90 
91  preferencesMessage.FormatLink(
92  // i18n-hint: a page in the Preferences dialog; use same name
93  wxT("%s"), XO("Preferences > Application"), [this]() {
94  GlobalPrefsDialog dialog(this /* parent */, nullptr);
95 
96  dialog.SelectPageByName(XO("Application").Translation());
97  dialog.ShowModal();
98  });
99 
100  preferencesMessage.Populate(S);
101  }
102  S.EndPanel();
103 
104  S.AddSpace(24, 0);
105  }
106  S.EndHorizontalLay();
107 
108  S.StartHorizontalLay(wxEXPAND);
109  {
110  S.AddSpace(1, 0, 1);
111 
112  S.Id(wxID_OK).AddButton(XO("&OK"))->SetFocus();
113 
114  S.AddSpace(8, 0);
115  }
116  S.EndHorizontalLay();
117  }
118 
119  S.EndVerticalLay();
120 
121  Fit();
122  Layout();
123 
124  Center();
125 }
126 
127 void UpdateNoticeDialog::OnOk(wxCommandEvent&)
128 {
129  EndModal(wxOK);
130 }
131 
132 void UpdateNoticeDialog::OnSize(wxSizeEvent&)
133 {
134  Fit();
135  Layout();
136 }
secondParagraph
static const auto secondParagraph
Definition: UpdateNoticeDialog.cpp:31
PrefsDialog::ShowModal
int ShowModal() override
Definition: PrefsDialog.cpp:596
EVT_BUTTON
EVT_BUTTON(wxID_NO, DependencyDialog::OnNo) EVT_BUTTON(wxID_YES
eIsCreating
@ eIsCreating
Definition: ShuttleGui.h:38
ShuttleGuiBase::StartVerticalLay
void StartVerticalLay(int iProp=1)
Definition: ShuttleGui.cpp:1184
PrefsDialog.h
ShuttleGui::AddSpace
wxSizerItem * AddSpace(int width, int height, int prop=0)
Definition: ShuttleGui.cpp:2459
XO
#define XO(s)
Definition: Internat.h:31
ShuttleGuiBase::StartPanel
wxPanel * StartPanel(int iStyle=0)
Definition: ShuttleGui.cpp:990
ShuttleGuiBase::EndPanel
void EndPanel()
Definition: ShuttleGui.cpp:1018
ShuttleGui::Id
ShuttleGui & Id(int id)
Definition: ShuttleGui.cpp:2274
firstParagraph
static const auto firstParagraph
Definition: UpdateNoticeDialog.cpp:27
ShuttleGuiBase::EndHorizontalLay
void EndHorizontalLay()
Definition: ShuttleGui.cpp:1177
ShuttleGuiBase::StartHorizontalLay
void StartHorizontalLay(int PositionFlags=wxALIGN_CENTRE, int iProp=1)
Definition: ShuttleGui.cpp:1167
ShuttleGuiBase::EndVerticalLay
void EndVerticalLay()
Definition: ShuttleGui.cpp:1203
ShuttleGuiBase::AddFixedText
void AddFixedText(const TranslatableString &Str, bool bCenter=false, int wrapWidth=0)
Definition: ShuttleGui.cpp:440
PrefsDialog::SelectPageByName
void SelectPageByName(const wxString &pageName)
Definition: PrefsDialog.cpp:778
ShuttleGui.h
UpdateNoticeDialog::OnSize
void OnSize(wxSizeEvent &)
Definition: UpdateNoticeDialog.cpp:132
title
static const auto title
Definition: UpdateNoticeDialog.cpp:23
ShuttleGuiBase::AddButton
wxButton * AddButton(const TranslatableString &Text, int PositionFlags=wxALIGN_CENTRE, bool setDefault=false)
Definition: ShuttleGui.cpp:360
UpdateNoticeDialog::OnOk
void OnOk(wxCommandEvent &)
Definition: UpdateNoticeDialog.cpp:127
wxDialogWrapper
Definition: wxPanelWrapper.h:81
IMPLEMENT_CLASS
IMPLEMENT_CLASS(ControlToolBar, ToolBar)
GlobalPrefsDialog
Definition: PrefsDialog.h:81
UpdateNoticeDialog.h
Define a dialog to notify the user about automatic update checking.
ShuttleGuiBase::SetBorder
void SetBorder(int Border)
Definition: ShuttleGui.h:489
CodeConversions.h
Declare functions to preform UTF-8 to std::wstring conversions.
ShuttleGuiBase::AddVariableText
wxStaticText * AddVariableText(const TranslatableString &Str, bool bCenter=false, int PositionFlags=0, int wrapWidth=0)
Definition: ShuttleGui.cpp:463
END_EVENT_TABLE
END_EVENT_TABLE()
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631
thirdParagraph
static const auto thirdParagraph
Definition: UpdateNoticeDialog.cpp:35
UpdateNoticeDialog
Dialog, that notifies the users about automatic updates checking.
Definition: UpdateNoticeDialog.h:21