mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-18 17:10:55 +02:00
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/UpdateManager.cpp
|
||||||
update/UpdatePopupDialog.h
|
update/UpdatePopupDialog.h
|
||||||
update/UpdatePopupDialog.cpp
|
update/UpdatePopupDialog.cpp
|
||||||
|
prefs/ApplicationPrefs.h
|
||||||
|
prefs/ApplicationPrefs.cpp
|
||||||
>
|
>
|
||||||
|
|
||||||
Experimental.cmake
|
Experimental.cmake
|
||||||
|
107
src/prefs/ApplicationPrefs.cpp
Normal file
107
src/prefs/ApplicationPrefs.cpp
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
43
src/prefs/ApplicationPrefs.h
Normal file
43
src/prefs/ApplicationPrefs.h
Normal file
@ -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,
|
PathStart,
|
||||||
{
|
{
|
||||||
{wxT(""),
|
{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")},
|
{wxT("/Tracks"), wxT("TracksBehaviors,Spectrum")},
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user