Add application preferences with update checkbox.
This commit is contained in:
parent
d6f95c8575
commit
d9ab95a4b2
|
@ -993,6 +993,8 @@ list( APPEND SOURCES
|
|||
update/UpdateManager.cpp
|
||||
update/UpdatePopupDialog.h
|
||||
update/UpdatePopupDialog.cpp
|
||||
prefs/ApplicationPrefs.h
|
||||
prefs/ApplicationPrefs.cpp
|
||||
>
|
||||
|
||||
Experimental.cmake
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
ApplicationPrefs.cpp
|
||||
|
||||
Anton Gerasimov
|
||||
|
||||
|
||||
*******************************************************************//**
|
||||
|
||||
\class ApplicationPrefs
|
||||
\brief A PrefsPanel to enable/disable certain general application options like checking updates, etc.
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
|
||||
#include "ApplicationPrefs.h"
|
||||
|
||||
#include <wx/defs.h>
|
||||
|
||||
#include "../Prefs.h"
|
||||
#include "../ShuttleGui.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
enum { CheckingUpdatesID = wxID_HIGHEST + 1 };
|
||||
|
||||
BEGIN_EVENT_TABLE(ApplicationPrefs, PrefsPanel)
|
||||
EVT_CHECKBOX(CheckingUpdatesID, ApplicationPrefs::OnCheckingUpdates)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
ApplicationPrefs::ApplicationPrefs(wxWindow * parent, wxWindowID winid)
|
||||
: PrefsPanel(parent, winid, XO("Application"))
|
||||
{
|
||||
Populate();
|
||||
}
|
||||
|
||||
ApplicationPrefs::~ApplicationPrefs()
|
||||
{
|
||||
}
|
||||
|
||||
ComponentInterfaceSymbol ApplicationPrefs::GetSymbol()
|
||||
{
|
||||
return WARNINGS_PREFS_PLUGIN_SYMBOL;
|
||||
}
|
||||
|
||||
TranslatableString ApplicationPrefs::GetDescription()
|
||||
{
|
||||
return XO("Preferences for Application");
|
||||
}
|
||||
|
||||
wxString ApplicationPrefs::HelpPageName()
|
||||
{
|
||||
return "Application_Preferences";
|
||||
}
|
||||
|
||||
void ApplicationPrefs::Populate()
|
||||
{
|
||||
//------------------------- Main section --------------------
|
||||
// Now construct the GUI itself.
|
||||
// Use 'eIsCreatingFromPrefs' so that the GUI is
|
||||
// initialised with values from gPrefs.
|
||||
ShuttleGui S(this, eIsCreatingFromPrefs);
|
||||
PopulateOrExchange(S);
|
||||
// ----------------------- End of main section --------------
|
||||
}
|
||||
|
||||
void ApplicationPrefs::PopulateOrExchange(ShuttleGui & S)
|
||||
{
|
||||
S.SetBorder(2);
|
||||
S.StartScroller();
|
||||
|
||||
S.StartStatic(XO("Update Audacity"));
|
||||
{
|
||||
// TODO: replace `false` to UpdateManager::GetInstance().isUpdatesChakingEnabled()
|
||||
// and XO("Check for Updates...") need remove endian after translation.
|
||||
S.Id(CheckingUpdatesID).AddCheckBox(
|
||||
XO("Check for Updates"), false);
|
||||
}
|
||||
S.EndStatic();
|
||||
S.EndScroller();
|
||||
}
|
||||
|
||||
bool ApplicationPrefs::Commit()
|
||||
{
|
||||
ShuttleGui S(this, eIsSavingToPrefs);
|
||||
PopulateOrExchange(S);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ApplicationPrefs::OnCheckingUpdates(wxCommandEvent& event)
|
||||
{
|
||||
event.IsChecked();
|
||||
// TODO: add UpdateManager::GetInstance().enableUpdatesChaking(event.IsChecked())
|
||||
}
|
||||
|
||||
namespace{
|
||||
PrefsPanel::Registration sAttachment{ "Application",
|
||||
[](wxWindow *parent, wxWindowID winid, AudacityProject *)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
return safenew ApplicationPrefs(parent, winid);
|
||||
}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
ApplicationPrefs.h
|
||||
|
||||
Anton Gerasimov
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_APPLICATION_PREFS__
|
||||
#define __AUDACITY_APPLICATION_PREFS__
|
||||
|
||||
#include <wx/defs.h>
|
||||
|
||||
#include "PrefsPanel.h"
|
||||
|
||||
class ShuttleGui;
|
||||
|
||||
#define WARNINGS_PREFS_PLUGIN_SYMBOL ComponentInterfaceSymbol{ XO("Application") }
|
||||
|
||||
class ApplicationPrefs final : public PrefsPanel
|
||||
{
|
||||
public:
|
||||
ApplicationPrefs(wxWindow * parent, wxWindowID winid);
|
||||
~ApplicationPrefs();
|
||||
ComponentInterfaceSymbol GetSymbol() override;
|
||||
TranslatableString GetDescription() override;
|
||||
|
||||
bool Commit() override;
|
||||
wxString HelpPageName() override;
|
||||
|
||||
void OnCheckingUpdates(wxCommandEvent& event);
|
||||
|
||||
private:
|
||||
void Populate();
|
||||
void PopulateOrExchange(ShuttleGui & S) override;
|
||||
|
||||
public:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
|
@ -115,7 +115,7 @@ PrefsPanel::Factories
|
|||
PathStart,
|
||||
{
|
||||
{wxT(""),
|
||||
wxT("Device,Playback,Recording,Quality,GUI,Tracks,ImportExport,Directories,Warnings,Effects,KeyConfig,Mouse")
|
||||
wxT("Device,Playback,Recording,Quality,GUI,Tracks,ImportExport,Directories,Warnings,Effects,KeyConfig,Mouse,Application")
|
||||
},
|
||||
{wxT("/Tracks"), wxT("TracksBehaviors,Spectrum")},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue