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)
43 
45 
48  /* i18n-hint: Title of the app update notice dialog. */
49  parent, -1, XO("App updates"), wxDefaultPosition, wxDefaultSize,
50  wxCAPTION | wxCLOSE_BOX)
51 {
52  ShuttleGui S(this, eIsCreating);
53 
54  S.StartVerticalLay();
55  {
56  S.AddSpace(0, 16);
57 
59  {
60  S.AddSpace(24, 0);
61 
62  S.StartPanel();
63  {
64  S.SetBorder(8);
65 
66  wxStaticText* titleCtrl = S.AddVariableText(title, false, 0, 500);
67 
68  wxFont font = titleCtrl->GetFont().MakeLarger().MakeBold();
69 
70  titleCtrl->SetFont(font);
71 
72  S.AddFixedText(firstParagraph, false, 500);
73 
74  S.AddFixedText(secondParagraph, false, 500);
75 
76  S.AddSpace(0, 8);
77 
78  /* i18n-hint: %s will be replaced with "our Privacy Policy" */
79  AccessibleLinksFormatter privacyPolicy(XO("See %s for more info."));
80 
81  privacyPolicy.FormatLink(
82  /* i18n-hint: Title of hyperlink to the privacy policy. This is an object of "See". */
83  wxT("%s"), XO("our Privacy Policy"),
84  "https://www.audacityteam.org/about/desktop-privacy-notice/");
85 
86  privacyPolicy.Populate(S);
87 
88  AccessibleLinksFormatter preferencesMessage(thirdParagraph);
89 
90  preferencesMessage.FormatLink(
91  // i18n-hint: a page in the Preferences dialog; use same name
92  wxT("%s"), XO("Preferences > Application"), [this]() {
93  GlobalPrefsDialog dialog(this /* parent */, nullptr);
94 
95  dialog.SelectPageByName(XO("Application").Translation());
96  dialog.ShowModal();
97  });
98 
99  preferencesMessage.Populate(S);
100  }
101  S.EndPanel();
102 
103  S.AddSpace(24, 0);
104  }
105  S.EndHorizontalLay();
106 
107  S.StartHorizontalLay(wxEXPAND, 0);
108  {
109  S.AddSpace(1, 0, 1);
110 
111  S.Id(wxID_OK).AddButton(XO("&OK"))->SetFocus();
112 
113  S.AddSpace(8, 0);
114  }
115  S.EndHorizontalLay();
116  }
117 
118  S.EndVerticalLay();
119 
120  Layout();
121  Fit();
122  Center();
123 }
124 
125 void UpdateNoticeDialog::OnOk(wxCommandEvent&)
126 {
127  EndModal(wxOK);
128 }
secondParagraph
static const auto secondParagraph
Definition: UpdateNoticeDialog.cpp:31
PrefsDialog::ShowModal
int ShowModal() override
Definition: PrefsDialog.cpp:595
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:2447
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:777
ShuttleGui.h
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
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
UpdateNoticeDialog::OnOk
void OnOk(wxCommandEvent &event)
Definition: UpdateNoticeDialog.cpp:125
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