Add a KICAD_TEST_NOTI env var for a fake notification on launch
This commit is contained in:
parent
5cbe3c5d42
commit
a0ebedc0ac
|
@ -120,19 +120,11 @@ public:
|
|||
|
||||
m_hlDismiss->Bind( wxEVT_HYPERLINK, &NOTIFICATION_PANEL::onDismiss, this );
|
||||
|
||||
Bind( wxEVT_SET_FOCUS, &NOTIFICATION_PANEL::onFocusSet, this );
|
||||
|
||||
SetSizer( mainSizer );
|
||||
Layout();
|
||||
}
|
||||
|
||||
private:
|
||||
void onFocusSet( wxFocusEvent& aEvent )
|
||||
{
|
||||
// hmmph
|
||||
|
||||
}
|
||||
|
||||
void onDetails( wxHyperlinkEvent& aEvent )
|
||||
{
|
||||
wxString url = aEvent.GetURL();
|
||||
|
@ -287,6 +279,12 @@ void NOTIFICATIONS_MANAGER::Load()
|
|||
// failed to load the json
|
||||
return;
|
||||
}
|
||||
|
||||
if( wxGetEnv( wxT( "KICAD_TEST_NOTI" ), nullptr ) )
|
||||
{
|
||||
CreateOrUpdate( wxS( "test" ), wxS( "Test Notification" ), wxS( "Test please ignore" ),
|
||||
wxS( "https://kicad.org" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -301,11 +299,13 @@ void NOTIFICATIONS_MANAGER::Save()
|
|||
}
|
||||
|
||||
|
||||
void NOTIFICATIONS_MANAGER::Create( const wxString& aKey,
|
||||
void NOTIFICATIONS_MANAGER::CreateOrUpdate( const wxString& aKey,
|
||||
const wxString& aTitle,
|
||||
const wxString& aDescription,
|
||||
const wxString& aHref )
|
||||
{
|
||||
wxCHECK_RET( !aKey.IsEmpty(), wxS( "Notification key must not be empty" ) );
|
||||
|
||||
auto it = std::find_if( m_notifications.begin(), m_notifications.end(),
|
||||
[&]( const NOTIFICATION& noti )
|
||||
{
|
||||
|
|
|
@ -55,14 +55,15 @@ public:
|
|||
NOTIFICATIONS_MANAGER();
|
||||
|
||||
/**
|
||||
* Creates a notification with the given parameters
|
||||
* @param aKey is a unique key for the notification, this allows removing
|
||||
* Creates a notification with the given parameters or updates an existing one with the same key
|
||||
*
|
||||
* @param aKey is a unique key for the notification, this allows removing or updating the same notification
|
||||
* @param aTitle is the displayed title for the event
|
||||
* @param aDescription is the text that displays underneath the title and has slightly more info
|
||||
* them later programtically in case a notificaiton is no logner required
|
||||
* @param aHref is link to external or internal content
|
||||
*/
|
||||
void Create( const wxString& aKey, const wxString& aTitle, const wxString& aDescription,
|
||||
void CreateOrUpdate( const wxString& aKey, const wxString& aTitle, const wxString& aDescription,
|
||||
const wxString& aHref = wxEmptyString );
|
||||
|
||||
/**
|
||||
|
|
|
@ -289,7 +289,7 @@ void KICAD_MANAGER_FRAME::CreatePCM()
|
|||
|
||||
if( aUpdateCount > 0 )
|
||||
{
|
||||
Pgm().GetNotificationsManager().Create(
|
||||
Pgm().GetNotificationsManager().CreateOrUpdate(
|
||||
wxS( "pcm" ),
|
||||
_( "PCM Updates Available" ),
|
||||
wxString::Format( _( "%d package update(s) avaliable" ), aUpdateCount ),
|
||||
|
|
Loading…
Reference in New Issue