ADDED: KiCad update check
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15026
This commit is contained in:
parent
0a67dd3fdd
commit
c8f646efb1
|
@ -56,8 +56,7 @@ add_custom_target(
|
|||
add_library( singletop STATIC EXCLUDE_FROM_ALL
|
||||
eda_doc.cpp
|
||||
kiway.cpp
|
||||
kiway_holder.cpp
|
||||
)
|
||||
kiway_holder.cpp )
|
||||
|
||||
|
||||
# A shared library used by multiple *.kiface files and one or two program
|
||||
|
@ -265,6 +264,8 @@ set( COMMON_DLG_SRCS
|
|||
dialogs/panel_grid_settings_base.cpp
|
||||
dialogs/panel_mouse_settings.cpp
|
||||
dialogs/panel_mouse_settings_base.cpp
|
||||
dialogs/panel_packages_and_updates.cpp
|
||||
dialogs/panel_packages_and_updates_base.cpp
|
||||
dialogs/panel_setup_netclasses.cpp
|
||||
dialogs/panel_setup_netclasses_base.cpp
|
||||
dialogs/panel_setup_severities.cpp
|
||||
|
@ -618,7 +619,6 @@ target_link_libraries( common
|
|||
nlohmann_json
|
||||
pybind11::embed
|
||||
compoundfilereader
|
||||
pcm_settings
|
||||
Boost::headers
|
||||
# Database support needs these two
|
||||
nanodbc # for now; maybe hoist out of common
|
||||
|
|
|
@ -292,13 +292,35 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind
|
|||
|
||||
rightSizer->Add( 0, 15, 0, wxEXPAND, 5 );
|
||||
|
||||
m_staticText24 = new wxStaticText( this, wxID_ANY, _("Session"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText24 = new wxStaticText( this, wxID_ANY, _("Update Check"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText24->Wrap( -1 );
|
||||
rightSizer->Add( m_staticText24, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 13 );
|
||||
|
||||
m_staticline5 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
rightSizer->Add( m_staticline5, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
wxBoxSizer* bUpdateSizer;
|
||||
bUpdateSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_cbUpdateCheck = new wxCheckBox( this, wxID_ANY, _("Check for KiCad updates on launch"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_cbUpdateCheck->SetValue(true);
|
||||
m_cbUpdateCheck->SetToolTip( _("If checked, launching a project will also launch tools such as the schematic and board editors with previously open files") );
|
||||
|
||||
bUpdateSizer->Add( m_cbUpdateCheck, 0, wxALL, 5 );
|
||||
|
||||
|
||||
rightSizer->Add( bUpdateSizer, 0, wxEXPAND|wxLEFT|wxTOP, 5 );
|
||||
|
||||
|
||||
rightSizer->Add( 0, 15, 0, wxEXPAND, 5 );
|
||||
|
||||
m_staticText241 = new wxStaticText( this, wxID_ANY, _("Session"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText241->Wrap( -1 );
|
||||
rightSizer->Add( m_staticText241, 0, wxLEFT|wxRIGHT|wxTOP, 13 );
|
||||
|
||||
m_staticline51 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
rightSizer->Add( m_staticline51, 0, wxBOTTOM|wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSessionSizer;
|
||||
bSessionSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
|
|
@ -2919,7 +2919,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Session</property>
|
||||
<property name="label">Update Check</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
|
@ -3006,6 +3006,210 @@
|
|||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxLEFT|wxTOP</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bUpdateSizer</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">1</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Check for KiCad updates on launch</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_cbUpdateCheck</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip">If checked, launching a project will also launch tools such as the schematic and board editors with previously open files</property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">15</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">13</property>
|
||||
<property name="flag">wxLEFT|wxRIGHT|wxTOP</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Session</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticText241</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticLine" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticline51</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxLI_HORIZONTAL</property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxLEFT|wxEXPAND</property>
|
||||
|
|
|
@ -86,6 +86,9 @@ class PANEL_COMMON_SETTINGS_BASE : public RESETTABLE_PANEL
|
|||
wxCheckBox* m_NonImmediateActions;
|
||||
wxStaticText* m_staticText24;
|
||||
wxStaticLine* m_staticline5;
|
||||
wxCheckBox* m_cbUpdateCheck;
|
||||
wxStaticText* m_staticText241;
|
||||
wxStaticLine* m_staticline51;
|
||||
wxCheckBox* m_cbRememberOpenFiles;
|
||||
wxStaticText* m_staticTextautosave;
|
||||
wxSpinCtrl* m_SaveTime;
|
||||
|
|
|
@ -22,14 +22,15 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "panel_pcm_settings.h"
|
||||
#include "panel_packages_and_updates.h"
|
||||
|
||||
#include <pgm_base.h>
|
||||
#include <settings/kicad_settings.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <widgets/ui_common.h>
|
||||
|
||||
PANEL_PCM_SETTINGS::PANEL_PCM_SETTINGS( wxWindow* parent ) : PANEL_PCM_SETTINGS_BASE( parent )
|
||||
PANEL_PACKAGES_AND_UPDATES::PANEL_PACKAGES_AND_UPDATES( wxWindow* parent ) :
|
||||
PANEL_PACKAGES_AND_UPDATES_BASE( parent )
|
||||
{
|
||||
wxSize minSize = m_libPrefix->GetMinSize();
|
||||
int minWidth = m_libPrefix->GetTextExtent( wxT( "XXX.XXX" ) ).GetWidth();
|
||||
|
@ -38,12 +39,13 @@ PANEL_PCM_SETTINGS::PANEL_PCM_SETTINGS( wxWindow* parent ) : PANEL_PCM_SETTINGS_
|
|||
}
|
||||
|
||||
|
||||
bool PANEL_PCM_SETTINGS::TransferDataToWindow()
|
||||
bool PANEL_PACKAGES_AND_UPDATES::TransferDataToWindow()
|
||||
{
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
KICAD_SETTINGS* settings = mgr.GetAppSettings<KICAD_SETTINGS>();
|
||||
|
||||
m_updateCheck->SetValue( settings->m_PcmUpdateCheck );
|
||||
m_cbKicadUpdate->SetValue( settings->m_KiCadUpdateCheck );
|
||||
m_cbPcmUpdate->SetValue( settings->m_PcmUpdateCheck );
|
||||
m_libAutoAdd->SetValue( settings->m_PcmLibAutoAdd );
|
||||
m_libAutoRemove->SetValue( settings->m_PcmLibAutoRemove );
|
||||
m_libPrefix->SetValue( settings->m_PcmLibPrefix );
|
||||
|
@ -52,12 +54,13 @@ bool PANEL_PCM_SETTINGS::TransferDataToWindow()
|
|||
}
|
||||
|
||||
|
||||
bool PANEL_PCM_SETTINGS::TransferDataFromWindow()
|
||||
bool PANEL_PACKAGES_AND_UPDATES::TransferDataFromWindow()
|
||||
{
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
KICAD_SETTINGS* settings = mgr.GetAppSettings<KICAD_SETTINGS>();
|
||||
|
||||
settings->m_PcmUpdateCheck = m_updateCheck->GetValue();
|
||||
settings->m_KiCadUpdateCheck = m_cbKicadUpdate->GetValue();
|
||||
settings->m_PcmUpdateCheck = m_cbPcmUpdate->GetValue();
|
||||
settings->m_PcmLibAutoAdd = m_libAutoAdd->GetValue();
|
||||
settings->m_PcmLibAutoRemove = m_libAutoRemove->GetValue();
|
||||
settings->m_PcmLibPrefix = m_libPrefix->GetValue();
|
|
@ -22,18 +22,18 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef PANEL_PCM_SETTINGS_H_
|
||||
#define PANEL_PCM_SETTINGS_H_
|
||||
#ifndef PANEL_PACKAGES_AND_SETTINGS_H_
|
||||
#define PANEL_PACKAGES_AND_SETTINGS_H_
|
||||
|
||||
#include "panel_pcm_settings_base.h"
|
||||
#include "panel_packages_and_updates_base.h"
|
||||
|
||||
class PANEL_PCM_SETTINGS : public PANEL_PCM_SETTINGS_BASE
|
||||
class PANEL_PACKAGES_AND_UPDATES : public PANEL_PACKAGES_AND_UPDATES_BASE
|
||||
{
|
||||
public:
|
||||
PANEL_PCM_SETTINGS( wxWindow* parent );
|
||||
PANEL_PACKAGES_AND_UPDATES( wxWindow* parent );
|
||||
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
};
|
||||
|
||||
#endif // PANEL_PCM_SETTINGS_H_
|
||||
#endif // PANEL_PACKAGES_AND_SETTINGS_H_
|
|
@ -5,18 +5,41 @@
|
|||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "panel_pcm_settings_base.h"
|
||||
#include "panel_packages_and_updates_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PANEL_PCM_SETTINGS_BASE::PANEL_PCM_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
|
||||
PANEL_PACKAGES_AND_UPDATES_BASE::PANEL_PACKAGES_AND_UPDATES_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
|
||||
{
|
||||
wxBoxSizer* bSizer1;
|
||||
bSizer1 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_generalLabel = new wxStaticText( this, wxID_ANY, _("General"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_generalLabel->Wrap( -1 );
|
||||
bSizer1->Add( m_generalLabel, 0, wxTOP|wxRIGHT|wxLEFT, 13 );
|
||||
bSizer1->Add( m_generalLabel, 0, wxLEFT|wxRIGHT|wxTOP, 13 );
|
||||
|
||||
|
||||
bSizer1->Add( 0, 0, 0, wxEXPAND, 5 );
|
||||
|
||||
m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizer1->Add( m_staticline3, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
wxBoxSizer* bSizer41;
|
||||
bSizer41 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_cbKicadUpdate = new wxCheckBox( this, wxID_ANY, _("Check for KiCad updates on startup"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_cbKicadUpdate->SetValue(true);
|
||||
bSizer41->Add( m_cbKicadUpdate, 0, wxLEFT, 5 );
|
||||
|
||||
|
||||
bSizer1->Add( bSizer41, 0, wxEXPAND|wxLEFT|wxTOP, 5 );
|
||||
|
||||
|
||||
bSizer1->Add( 0, 20, 0, wxEXPAND, 5 );
|
||||
|
||||
m_pcmLabel = new wxStaticText( this, wxID_ANY, _("Plugin and Content Manager"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_pcmLabel->Wrap( -1 );
|
||||
bSizer1->Add( m_pcmLabel, 0, wxTOP|wxRIGHT|wxLEFT, 13 );
|
||||
|
||||
|
||||
bSizer1->Add( 0, 3, 0, wxEXPAND, 5 );
|
||||
|
@ -27,9 +50,9 @@ PANEL_PCM_SETTINGS_BASE::PANEL_PCM_SETTINGS_BASE( wxWindow* parent, wxWindowID i
|
|||
wxBoxSizer* bSizer4;
|
||||
bSizer4 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_updateCheck = new wxCheckBox( this, wxID_ANY, _("Check for package updates on startup"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_updateCheck->SetValue(true);
|
||||
bSizer4->Add( m_updateCheck, 0, wxLEFT, 5 );
|
||||
m_cbPcmUpdate = new wxCheckBox( this, wxID_ANY, _("Check for package updates on startup"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_cbPcmUpdate->SetValue(true);
|
||||
bSizer4->Add( m_cbPcmUpdate, 0, wxLEFT, 5 );
|
||||
|
||||
|
||||
bSizer1->Add( bSizer4, 0, wxEXPAND|wxTOP|wxLEFT, 5 );
|
||||
|
@ -39,7 +62,7 @@ PANEL_PCM_SETTINGS_BASE::PANEL_PCM_SETTINGS_BASE( wxWindow* parent, wxWindowID i
|
|||
|
||||
m_staticText4 = new wxStaticText( this, wxID_ANY, _("Library package handling"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText4->Wrap( -1 );
|
||||
bSizer1->Add( m_staticText4, 0, wxTOP|wxRIGHT|wxLEFT, 13 );
|
||||
bSizer1->Add( m_staticText4, 0, wxLEFT|wxRIGHT|wxTOP, 13 );
|
||||
|
||||
|
||||
bSizer1->Add( 0, 3, 0, wxEXPAND, 5 );
|
||||
|
@ -80,6 +103,6 @@ PANEL_PCM_SETTINGS_BASE::PANEL_PCM_SETTINGS_BASE( wxWindow* parent, wxWindowID i
|
|||
bSizer1->Fit( this );
|
||||
}
|
||||
|
||||
PANEL_PCM_SETTINGS_BASE::~PANEL_PCM_SETTINGS_BASE()
|
||||
PANEL_PACKAGES_AND_UPDATES_BASE::~PANEL_PACKAGES_AND_UPDATES_BASE()
|
||||
{
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="17"/>
|
||||
<object class="Project" expanded="true">
|
||||
<property name="class_decoration">; </property>
|
||||
<property name="class_decoration"></property>
|
||||
<property name="code_generation">C++</property>
|
||||
<property name="disconnect_events">1</property>
|
||||
<property name="disconnect_mode">source_name</property>
|
||||
|
@ -11,13 +11,13 @@
|
|||
<property name="embedded_files_path">res</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="event_generation">connect</property>
|
||||
<property name="file">panel_pcm_settings_base</property>
|
||||
<property name="file">panel_packages_and_updates_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="image_path_wrapper_function_name"></property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">panel_pcm_settings_base</property>
|
||||
<property name="name">panel_packages_and_updates_base</property>
|
||||
<property name="namespace"></property>
|
||||
<property name="path">.</property>
|
||||
<property name="precompiled_header"></property>
|
||||
|
@ -44,7 +44,7 @@
|
|||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">PANEL_PCM_SETTINGS_BASE</property>
|
||||
<property name="name">PANEL_PACKAGES_AND_UPDATES_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">-1,-1</property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
|
@ -60,7 +60,7 @@
|
|||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">13</property>
|
||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="flag">wxLEFT|wxRIGHT|wxTOP</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -120,6 +120,223 @@
|
|||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="spacer" expanded="true">
|
||||
<property name="height">0</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND | wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticLine" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticline3</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxLI_HORIZONTAL</property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxLEFT|wxTOP</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="true">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizer41</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">1</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Check for KiCad updates on startup</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_cbKicadUpdate</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="spacer" expanded="true">
|
||||
<property name="height">20</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">13</property>
|
||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Plugin and Content Manager</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_pcmLabel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
|
@ -240,7 +457,7 @@
|
|||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_updateCheck</property>
|
||||
<property name="name">m_cbPcmUpdate</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
|
@ -277,7 +494,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">13</property>
|
||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="flag">wxLEFT|wxRIGHT|wxTOP</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
|
@ -26,16 +26,19 @@
|
|||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class PANEL_PCM_SETTINGS_BASE
|
||||
/// Class PANEL_PACKAGES_AND_UPDATES_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class PANEL_PCM_SETTINGS_BASE : public wxPanel
|
||||
class PANEL_PACKAGES_AND_UPDATES_BASE : public wxPanel
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_generalLabel;
|
||||
wxStaticLine* m_staticline3;
|
||||
wxCheckBox* m_cbKicadUpdate;
|
||||
wxStaticText* m_pcmLabel;
|
||||
wxStaticLine* m_staticline1;
|
||||
wxCheckBox* m_updateCheck;
|
||||
wxCheckBox* m_cbPcmUpdate;
|
||||
wxStaticText* m_staticText4;
|
||||
wxStaticLine* m_staticline2;
|
||||
wxCheckBox* m_libAutoAdd;
|
||||
|
@ -45,9 +48,9 @@ class PANEL_PCM_SETTINGS_BASE : public wxPanel
|
|||
|
||||
public:
|
||||
|
||||
PANEL_PCM_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
|
||||
PANEL_PACKAGES_AND_UPDATES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
|
||||
|
||||
~PANEL_PCM_SETTINGS_BASE();
|
||||
~PANEL_PACKAGES_AND_UPDATES_BASE();
|
||||
|
||||
};
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
#include <panel_hotkeys_editor.h>
|
||||
#include <paths.h>
|
||||
#include <confirm.h>
|
||||
#include <panel_pcm_settings.h>
|
||||
#include <panel_packages_and_updates.h>
|
||||
#include <pgm_base.h>
|
||||
#include <settings/app_settings.h>
|
||||
#include <settings/common_settings.h>
|
||||
|
@ -1203,8 +1203,8 @@ if( ADVANCED_CFG::GetCfg().m_EnableGit && false )
|
|||
book->AddLazyPage(
|
||||
[]( wxWindow* aParent ) -> wxWindow*
|
||||
{
|
||||
return new PANEL_PCM_SETTINGS( aParent );
|
||||
}, _( "Plugin and Content Manager" ) );
|
||||
return new PANEL_PACKAGES_AND_UPDATES( aParent );
|
||||
}, _( "Packages and Updates" ) );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
|
|
|
@ -362,15 +362,11 @@ bool HTTP_LIB_CONNECTION::SelectAll( const HTTP_LIB_CATEGORY& aCategory,
|
|||
|
||||
bool HTTP_LIB_CONNECTION::checkServerResponse( std::unique_ptr<KICAD_CURL_EASY>& aCurl )
|
||||
{
|
||||
|
||||
long http_code = 0;
|
||||
|
||||
curl_easy_getinfo( aCurl->GetCurl(), CURLINFO_RESPONSE_CODE, &http_code );
|
||||
|
||||
if( http_code != 200 )
|
||||
int statusCode = aCurl->GetResponseStatusCode();
|
||||
if( statusCode != 200 )
|
||||
{
|
||||
m_lastError += wxString::Format( _( "API responded with error code: %s" ) + "\n",
|
||||
httpErrorCodeDescription( http_code ) );
|
||||
httpErrorCodeDescription( statusCode ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -251,6 +251,15 @@ bool KICAD_CURL_EASY::SetPostFields(
|
|||
}
|
||||
|
||||
|
||||
bool KICAD_CURL_EASY::SetPostFields( const std::string& aField )
|
||||
{
|
||||
if( setOption<const char*>( CURLOPT_COPYPOSTFIELDS, aField.c_str() ) != CURLE_OK )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool KICAD_CURL_EASY::SetURL( const std::string& aURL )
|
||||
{
|
||||
if( setOption<const char*>( CURLOPT_URL, aURL.c_str() ) == CURLE_OK )
|
||||
|
@ -340,3 +349,12 @@ int KICAD_CURL_EASY::GetTransferTotal( uint64_t& aDownloadedBytes ) const
|
|||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int KICAD_CURL_EASY::GetResponseStatusCode()
|
||||
{
|
||||
long http_code = 0;
|
||||
curl_easy_getinfo( m_CURL, CURLINFO_RESPONSE_CODE, &http_code );
|
||||
|
||||
return static_cast<int>( http_code );
|
||||
}
|
|
@ -222,6 +222,10 @@ public:
|
|||
panel->Destroy();
|
||||
|
||||
m_panelMap.erase( it );
|
||||
|
||||
// ensure the window contents get shifted as needed
|
||||
m_scrolledWindow->Layout();
|
||||
Layout();
|
||||
}
|
||||
|
||||
if( m_panelMap.size() == 0 )
|
||||
|
|
|
@ -324,6 +324,9 @@ COMMON_SETTINGS::COMMON_SETTINGS() :
|
|||
m_params.emplace_back( new PARAM<bool>( "do_not_show_again.data_collection_prompt",
|
||||
&m_DoNotShowAgain.data_collection_prompt, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "do_not_show_again.update_check_prompt",
|
||||
&m_DoNotShowAgain.update_check_prompt, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "session.remember_open_files",
|
||||
&m_Session.remember_open_files, false ) );
|
||||
|
||||
|
|
|
@ -42,7 +42,13 @@ KICAD_SETTINGS::KICAD_SETTINGS() :
|
|||
m_params.emplace_back(
|
||||
new PARAM_LIST<wxString>( "system.open_projects", &m_OpenProjects, {} ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "system.check_for_updates", &m_updateCheck, 0 ) );
|
||||
m_params.emplace_back(
|
||||
new PARAM<wxString>( "system.last_update_check_time", &m_lastUpdateCheckTime, "" ) );
|
||||
|
||||
m_params.emplace_back(
|
||||
new PARAM<wxString>( "system.last_received_update", &m_lastReceivedUpdate, "" ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "system.check_for_kicad_updates", &m_KiCadUpdateCheck, true ) );
|
||||
|
||||
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>(
|
||||
"pcm.repositories",
|
||||
|
|
|
@ -99,6 +99,14 @@ public:
|
|||
*/
|
||||
bool SetPostFields( const std::vector<std::pair<std::string, std::string>>& aFields );
|
||||
|
||||
/**
|
||||
* Set the post content body to the string, usually used for json rather than the typical key/value pair
|
||||
*
|
||||
* @param aField is the string body to send
|
||||
* @return True if successful, false if not.
|
||||
*/
|
||||
bool SetPostFields( const std::string& aField );
|
||||
|
||||
/**
|
||||
* Set the request URL.
|
||||
*
|
||||
|
@ -140,6 +148,7 @@ public:
|
|||
|
||||
CURL* GetCurl() { return m_CURL; }
|
||||
|
||||
int GetResponseStatusCode();
|
||||
|
||||
private:
|
||||
/**
|
||||
|
|
|
@ -133,6 +133,7 @@ public:
|
|||
bool env_var_overwrite_warning;
|
||||
bool scaled_3d_models_warning;
|
||||
bool data_collection_prompt;
|
||||
bool update_check_prompt;
|
||||
};
|
||||
|
||||
struct NETCLASS_PANEL
|
||||
|
|
|
@ -36,22 +36,6 @@ public:
|
|||
|
||||
int m_LeftWinWidth;
|
||||
|
||||
/**
|
||||
* @brief General setting for various update checks
|
||||
*
|
||||
* A one time popup asks user to allow/disallow update checks on startup.
|
||||
* This is currently used by PCM.
|
||||
*
|
||||
* See enum below for meaning of values.
|
||||
*/
|
||||
int m_updateCheck;
|
||||
|
||||
enum UPDATE_CHECK
|
||||
{
|
||||
UNINITIALIZED = 0,
|
||||
NOT_ALLOWED = 1,
|
||||
ALLOWED = 2
|
||||
};
|
||||
|
||||
std::vector<wxString> m_OpenProjects;
|
||||
|
||||
|
@ -68,6 +52,10 @@ public:
|
|||
// Generated library nickname prefix
|
||||
wxString m_PcmLibPrefix;
|
||||
|
||||
bool m_KiCadUpdateCheck;
|
||||
wxString m_lastUpdateCheckTime;
|
||||
wxString m_lastReceivedUpdate;
|
||||
|
||||
protected:
|
||||
virtual std::string getLegacyFrameName() const override { return "KicadFrame"; }
|
||||
};
|
||||
|
|
|
@ -16,6 +16,8 @@ include_directories(
|
|||
)
|
||||
|
||||
set( KICAD_SRCS
|
||||
dialogs/dialog_update_check_prompt_base.cpp
|
||||
dialogs/dialog_update_check_prompt.cpp
|
||||
dialogs/dialog_template_selector_base.cpp
|
||||
dialogs/dialog_template_selector.cpp
|
||||
dialogs/panel_kicad_launcher_base.cpp
|
||||
|
@ -29,6 +31,7 @@ set( KICAD_SRCS
|
|||
project_tree_pane.cpp
|
||||
project_tree.cpp
|
||||
project_tree_item.cpp
|
||||
update_manager.cpp
|
||||
tools/kicad_manager_actions.cpp
|
||||
tools/kicad_manager_control.cpp
|
||||
)
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2023 Mark Roszko <mark.roszko@gmail.com>
|
||||
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <dialogs/dialog_update_check_prompt.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <settings/kicad_settings.h>
|
||||
#include <pgm_base.h>
|
||||
|
||||
DIALOG_UPDATE_CHECK_PROMPT::DIALOG_UPDATE_CHECK_PROMPT( wxWindow* aWindow ) :
|
||||
DIALOG_UPDATE_CHECK_PROMPT_BASE( aWindow )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_UPDATE_CHECK_PROMPT::TransferDataFromWindow()
|
||||
{
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
KICAD_SETTINGS* settings = mgr.GetAppSettings<KICAD_SETTINGS>();
|
||||
|
||||
settings->m_PcmUpdateCheck = m_cbPCMUpdates->GetValue();
|
||||
settings->m_KiCadUpdateCheck = m_cbKiCadUpdates->GetValue();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_UPDATE_CHECK_PROMPT::TransferDataToWindow()
|
||||
{
|
||||
// Since this is a first time start dialog, just default to both checks true
|
||||
m_cbPCMUpdates->SetValue( true );
|
||||
m_cbKiCadUpdates->SetValue( true );
|
||||
|
||||
return true;
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2023 Mark Roszko <mark.roszko@gmail.com>
|
||||
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef DIALOG_UPDATE_CHECK_PROMPT_H
|
||||
#define DIALOG_UPDATE_CHECK_PROMPT_H
|
||||
|
||||
#include <dialogs/dialog_update_check_prompt_base.h>
|
||||
|
||||
class DIALOG_UPDATE_CHECK_PROMPT : public DIALOG_UPDATE_CHECK_PROMPT_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_UPDATE_CHECK_PROMPT( wxWindow* aParent );
|
||||
|
||||
protected:
|
||||
bool TransferDataFromWindow() override;
|
||||
bool TransferDataToWindow() override;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,65 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dialog_update_check_prompt_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_UPDATE_CHECK_PROMPT_BASE::DIALOG_UPDATE_CHECK_PROMPT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bSizerMain;
|
||||
bSizerMain = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizer4;
|
||||
fgSizer4 = new wxFlexGridSizer( 0, 2, 10, 0 );
|
||||
fgSizer4->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
wxBoxSizer* bSizer4;
|
||||
bSizer4 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_messageLine1 = new wxStaticText( this, wxID_ANY, _("Would you like to automatically check for updates on startup?"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_messageLine1->Wrap( -1 );
|
||||
bSizer4->Add( m_messageLine1, 0, wxALL, 5 );
|
||||
|
||||
m_cbKiCadUpdates = new wxCheckBox( this, wxID_ANY, _("KiCad"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer4->Add( m_cbKiCadUpdates, 0, wxALL, 5 );
|
||||
|
||||
m_cbPCMUpdates = new wxCheckBox( this, wxID_ANY, _("Plugin and Content Manager"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer4->Add( m_cbPCMUpdates, 0, wxALL, 5 );
|
||||
|
||||
|
||||
fgSizer4->Add( bSizer4, 1, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
|
||||
fgSizer4->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_sdbSizer = new wxStdDialogButtonSizer();
|
||||
m_sdbSizerOK = new wxButton( this, wxID_OK );
|
||||
m_sdbSizer->AddButton( m_sdbSizerOK );
|
||||
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
|
||||
m_sdbSizer->AddButton( m_sdbSizerCancel );
|
||||
m_sdbSizer->Realize();
|
||||
|
||||
fgSizer4->Add( m_sdbSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( fgSizer4, 1, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizerMain );
|
||||
this->Layout();
|
||||
bSizerMain->Fit( this );
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
}
|
||||
|
||||
DIALOG_UPDATE_CHECK_PROMPT_BASE::~DIALOG_UPDATE_CHECK_PROMPT_BASE()
|
||||
{
|
||||
}
|
|
@ -0,0 +1,313 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="16" />
|
||||
<object class="Project" expanded="1">
|
||||
<property name="class_decoration"></property>
|
||||
<property name="code_generation">C++</property>
|
||||
<property name="disconnect_events">1</property>
|
||||
<property name="disconnect_mode">source_name</property>
|
||||
<property name="disconnect_php_events">0</property>
|
||||
<property name="disconnect_python_events">0</property>
|
||||
<property name="embedded_files_path">res</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="event_generation">connect</property>
|
||||
<property name="file">dialog_update_check_prompt_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="image_path_wrapper_function_name"></property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">dialog_update_check_prompt_base</property>
|
||||
<property name="namespace"></property>
|
||||
<property name="path">.</property>
|
||||
<property name="precompiled_header"></property>
|
||||
<property name="relative_path">1</property>
|
||||
<property name="skip_lua_events">1</property>
|
||||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_array_enum">0</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
<property name="aui_managed">0</property>
|
||||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||
<property name="bg"></property>
|
||||
<property name="center">wxBOTH</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="event_handler">impl_virtual</property>
|
||||
<property name="extra_style"></property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">DIALOG_UPDATE_CHECK_PROMPT_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">-1,-1</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE</property>
|
||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||
<property name="title">Check for Updates</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="two_step_creation">0</property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerMain</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxALL</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxFlexGridSizer" expanded="1">
|
||||
<property name="cols">2</property>
|
||||
<property name="flexible_direction">wxBOTH</property>
|
||||
<property name="growablecols"></property>
|
||||
<property name="growablerows"></property>
|
||||
<property name="hgap">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">fgSizer4</property>
|
||||
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
|
||||
<property name="permission">none</property>
|
||||
<property name="rows">0</property>
|
||||
<property name="vgap">10</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxRIGHT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizer4</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Would you like to automatically check for updates on startup?</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_messageLine1</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">KiCad</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_cbKiCadUpdates</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Plugin and Content Manager</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_cbPCMUpdates</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">0</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxStdDialogButtonSizer" expanded="1">
|
||||
<property name="Apply">0</property>
|
||||
<property name="Cancel">1</property>
|
||||
<property name="ContextHelp">0</property>
|
||||
<property name="Help">0</property>
|
||||
<property name="No">0</property>
|
||||
<property name="OK">1</property>
|
||||
<property name="Save">0</property>
|
||||
<property name="Yes">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_sdbSizer</property>
|
||||
<property name="permission">protected</property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</wxFormBuilder_Project>
|
|
@ -0,0 +1,50 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_UPDATE_CHECK_PROMPT_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_UPDATE_CHECK_PROMPT_BASE : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_messageLine1;
|
||||
wxCheckBox* m_cbKiCadUpdates;
|
||||
wxCheckBox* m_cbPCMUpdates;
|
||||
wxStdDialogButtonSizer* m_sdbSizer;
|
||||
wxButton* m_sdbSizerOK;
|
||||
wxButton* m_sdbSizerCancel;
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_UPDATE_CHECK_PROMPT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Check for Updates"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
|
||||
|
||||
~DIALOG_UPDATE_CHECK_PROMPT_BASE();
|
||||
|
||||
};
|
||||
|
|
@ -34,6 +34,7 @@
|
|||
#include <bitmaps.h>
|
||||
#include <build_version.h>
|
||||
#include <dialogs/panel_kicad_launcher.h>
|
||||
#include <dialogs/dialog_update_check_prompt.h>
|
||||
#include <eda_base_frame.h>
|
||||
#include <executable_names.h>
|
||||
#include <file_history.h>
|
||||
|
@ -66,6 +67,7 @@
|
|||
#include <wx/dnd.h>
|
||||
#include <wx/process.h>
|
||||
#include <atomic>
|
||||
#include <update_manager.h>
|
||||
|
||||
|
||||
#include <../pcbnew/plugins/kicad/pcb_plugin.h> // for SEXPR_BOARD_FILE_VERSION def
|
||||
|
@ -944,20 +946,12 @@ void KICAD_MANAGER_FRAME::OnIdle( wxIdleEvent& aEvent )
|
|||
|
||||
KICAD_SETTINGS* settings = kicadSettings();
|
||||
|
||||
if( settings->m_updateCheck == KICAD_SETTINGS::UPDATE_CHECK::UNINITIALIZED )
|
||||
if( !Pgm().GetCommonSettings()->m_DoNotShowAgain.update_check_prompt )
|
||||
{
|
||||
if( wxMessageBox( _( "Would you like to automatically check for plugin updates on startup?" ),
|
||||
_( "Check for updates" ), wxICON_QUESTION | wxYES_NO, this )
|
||||
== wxYES )
|
||||
{
|
||||
settings->m_updateCheck = KICAD_SETTINGS::UPDATE_CHECK::ALLOWED;
|
||||
settings->m_PcmUpdateCheck = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
settings->m_updateCheck = KICAD_SETTINGS::UPDATE_CHECK::NOT_ALLOWED;
|
||||
settings->m_PcmUpdateCheck = false;
|
||||
}
|
||||
auto prompt = new DIALOG_UPDATE_CHECK_PROMPT( this );
|
||||
prompt->ShowModal();
|
||||
|
||||
Pgm().GetCommonSettings()->m_DoNotShowAgain.update_check_prompt = true;
|
||||
}
|
||||
|
||||
if( KIPLATFORM::POLICY::GetPolicyBool( POLICY_KEY_PCM ) != KIPLATFORM::POLICY::PBOOL::DISABLED
|
||||
|
@ -968,6 +962,12 @@ void KICAD_MANAGER_FRAME::OnIdle( wxIdleEvent& aEvent )
|
|||
|
||||
m_pcm->RunBackgroundUpdate();
|
||||
}
|
||||
|
||||
if( !m_updateManager && settings->m_KiCadUpdateCheck )
|
||||
{
|
||||
m_updateManager = std::make_unique<UPDATE_MANAGER>();
|
||||
m_updateManager->CheckForUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ class PANEL_KICAD_LAUNCHER;
|
|||
class PLUGIN_CONTENT_MANAGER;
|
||||
class PROJECT_TREE;
|
||||
class PROJECT_TREE_PANE;
|
||||
class UPDATE_MANAGER;
|
||||
|
||||
/**
|
||||
* The main KiCad project manager frame. It is not a KIWAY_PLAYER.
|
||||
|
@ -206,6 +207,7 @@ private:
|
|||
std::shared_ptr<PLUGIN_CONTENT_MANAGER> m_pcm;
|
||||
BITMAP_BUTTON* m_pcmButton;
|
||||
int m_pcmUpdateCount;
|
||||
std::unique_ptr<UPDATE_MANAGER> m_updateManager;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -8,11 +8,6 @@ include_directories( BEFORE ${INC_BEFORE} )
|
|||
|
||||
add_compile_definitions( PCM )
|
||||
|
||||
set ( PCM_SETTINGS_SRCS
|
||||
dialogs/panel_pcm_settings_base.cpp
|
||||
dialogs/panel_pcm_settings.cpp
|
||||
)
|
||||
|
||||
set ( PCM_DLG_SRCS
|
||||
dialogs/dialog_manage_repositories_base.cpp
|
||||
dialogs/dialog_manage_repositories.cpp
|
||||
|
@ -48,24 +43,6 @@ target_link_libraries( pcm
|
|||
nlohmann_json_schema_validator
|
||||
)
|
||||
|
||||
add_library( pcm_settings STATIC
|
||||
${PCM_SETTINGS_SRCS}
|
||||
)
|
||||
|
||||
# This is a circular dependency but it's not a problem for static libs.
|
||||
# Refactoring this would need separating kicad_settings, settings manager
|
||||
# and pgm_base out of common.
|
||||
target_link_libraries( pcm_settings
|
||||
common
|
||||
core
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
pcm_settings
|
||||
PUBLIC dialogs
|
||||
PRIVATE $<TARGET_PROPERTY:common,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
|
||||
# Copy the schema to the build directory when building outside the source tree
|
||||
# to allow for proper running of kicad from the build directory.
|
||||
if( NOT (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR} ) )
|
||||
|
|
|
@ -0,0 +1,252 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2023 Mark Roszko <mark.roszko@gmail.com>
|
||||
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <update_manager.h>
|
||||
#include <pgm_base.h>
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#include "settings/settings_manager.h"
|
||||
#include "settings/kicad_settings.h"
|
||||
#include <notifications_manager.h>
|
||||
|
||||
#include <kicad_curl/kicad_curl.h>
|
||||
#include <kicad_curl/kicad_curl_easy.h>
|
||||
#include <progress_reporter.h>
|
||||
|
||||
#include <nlohmann_json/nlohmann/json.hpp>
|
||||
#include <core/json_serializers.h>
|
||||
|
||||
#include <wx/log.h>
|
||||
#include <wx/event.h>
|
||||
#include <wx/filefn.h>
|
||||
#include <wx/translation.h>
|
||||
#include <wx/notifmsg.h>
|
||||
|
||||
#include <background_jobs_monitor.h>
|
||||
|
||||
#include <core/thread_pool.h>
|
||||
|
||||
#include <build_version.h>
|
||||
|
||||
|
||||
struct UPDATE_REQUEST
|
||||
{
|
||||
wxString platform;
|
||||
wxString arch;
|
||||
wxString current_version;
|
||||
wxString lang;
|
||||
wxString last_check;
|
||||
};
|
||||
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE( UPDATE_REQUEST, platform, arch, current_version, lang,
|
||||
last_check )
|
||||
|
||||
struct UPDATE_RESPONSE
|
||||
{
|
||||
wxString version;
|
||||
wxString release_date;
|
||||
wxString details_url;
|
||||
wxString downloads_url;
|
||||
};
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE( UPDATE_RESPONSE, version, release_date, details_url,
|
||||
downloads_url )
|
||||
|
||||
#define UPDATE_QUERY_ENDPOINT wxS( "https://downloads.kicad.org/api/v1/update" )
|
||||
|
||||
|
||||
UPDATE_MANAGER::UPDATE_MANAGER() : m_working( false )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int UPDATE_MANAGER::PostRequest( const wxString& aUrl, std::string aRequestBody,
|
||||
std::ostream* aOutput, PROGRESS_REPORTER* aReporter,
|
||||
const size_t aSizeLimit )
|
||||
{
|
||||
bool size_exceeded = false;
|
||||
|
||||
TRANSFER_CALLBACK callback = [&]( size_t dltotal, size_t dlnow, size_t ultotal, size_t ulnow )
|
||||
{
|
||||
if( aSizeLimit > 0 && ( dltotal > aSizeLimit || dlnow > aSizeLimit ) )
|
||||
{
|
||||
size_exceeded = true;
|
||||
|
||||
// Non zero return means abort.
|
||||
return true;
|
||||
}
|
||||
|
||||
if( aReporter )
|
||||
{
|
||||
if( dltotal > 1000 )
|
||||
{
|
||||
aReporter->SetCurrentProgress( dlnow / (double) dltotal );
|
||||
aReporter->Report( wxString::Format( _( "Downloading %lld/%lld kB" ), dlnow / 1000,
|
||||
dltotal / 1000 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( aReporter )
|
||||
aReporter->SetCurrentProgress( 0.0 );
|
||||
}
|
||||
|
||||
return !aReporter->KeepRefreshing();
|
||||
}
|
||||
else
|
||||
return false;
|
||||
};
|
||||
|
||||
KICAD_CURL_EASY curl;
|
||||
curl.SetHeader( "Accept", "application/json" );
|
||||
curl.SetHeader( "Content-Type", "application/json" );
|
||||
curl.SetHeader( "charset", "utf-8" );
|
||||
curl.SetOutputStream( aOutput );
|
||||
curl.SetURL( aUrl.ToUTF8().data() );
|
||||
curl.SetPostFields( aRequestBody );
|
||||
curl.SetFollowRedirects( true );
|
||||
curl.SetTransferCallback( callback, 250000L );
|
||||
|
||||
int code = curl.Perform();
|
||||
|
||||
if( aReporter && !aReporter->IsCancelled() )
|
||||
aReporter->SetCurrentProgress( 1.0 );
|
||||
|
||||
if( code != CURLE_OK )
|
||||
{
|
||||
if( aReporter )
|
||||
{
|
||||
if( code == CURLE_ABORTED_BY_CALLBACK && size_exceeded )
|
||||
aReporter->Report( _( "Download is too large." ) );
|
||||
else if( code != CURLE_ABORTED_BY_CALLBACK )
|
||||
aReporter->Report( wxString( curl.GetErrorText( code ) ) );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return curl.GetResponseStatusCode();
|
||||
}
|
||||
|
||||
|
||||
void UPDATE_MANAGER::CheckForUpdate()
|
||||
{
|
||||
if( m_working )
|
||||
return;
|
||||
|
||||
m_working = false;
|
||||
|
||||
m_updateBackgroundJob = Pgm().GetBackgroundJobMonitor().Create( _( "Update Check" ) );
|
||||
|
||||
auto update_check = [&]() -> void
|
||||
{
|
||||
std::stringstream update_json_stream;
|
||||
std::stringstream request_json_stream;
|
||||
|
||||
wxString aUrl = UPDATE_QUERY_ENDPOINT;
|
||||
m_updateBackgroundJob->m_reporter->SetNumPhases( 1 );
|
||||
m_updateBackgroundJob->m_reporter->Report( _( "Requesting update info" ) );
|
||||
|
||||
UPDATE_REQUEST requestContent;
|
||||
|
||||
|
||||
// These platform keys are specific to the downloads site
|
||||
#if defined( __WXWINDOWS__ )
|
||||
requestContent.platform = "windows";
|
||||
|
||||
#if defined( KICAD_BUILD_ARCH_X64 )
|
||||
requestContent.arch = "amd64";
|
||||
#elif defined( KICAD_BUILD_ARCH_X86 )
|
||||
requestContent.arch = "i686";
|
||||
#elif defined( KICAD_BUILD_ARCH_ARM )
|
||||
requestContent.arch = "arm";
|
||||
#elif defined( KICAD_BUILD_ARCH_ARM64 )
|
||||
requestContent.arch = "arm64";
|
||||
#endif
|
||||
#elif defined( __WXOSX__ )
|
||||
requestContent.platform = "macos";
|
||||
requestContent.arch = "unified";
|
||||
#else
|
||||
//everything else gets lumped as linux
|
||||
requestContent.platform = "linux";
|
||||
requestContent.arch = "";
|
||||
#endif
|
||||
// requestContent.current_version = GetMajorMinorPatchVersion();
|
||||
requestContent.current_version = "7.0.8";
|
||||
requestContent.lang = Pgm().GetLanguageTag();
|
||||
|
||||
KICAD_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<KICAD_SETTINGS>();
|
||||
|
||||
requestContent.last_check = settings->m_lastUpdateCheckTime;
|
||||
|
||||
nlohmann::json requestJson = nlohmann::json( requestContent );
|
||||
request_json_stream << requestJson;
|
||||
|
||||
int responseCode =
|
||||
PostRequest( aUrl, request_json_stream.str(), &update_json_stream, NULL, 20480 );
|
||||
|
||||
// Check that the response is 200 (content provided)
|
||||
// We can also return 204 for no update
|
||||
if( responseCode == 200 )
|
||||
{
|
||||
nlohmann::json update_json;
|
||||
UPDATE_RESPONSE response;
|
||||
|
||||
try
|
||||
{
|
||||
update_json_stream >> update_json;
|
||||
response = update_json.get<UPDATE_RESPONSE>();
|
||||
|
||||
if( response.version != settings->m_lastReceivedUpdate )
|
||||
{
|
||||
wxString notificationDesc =
|
||||
wxString::Format( _( "KiCad %s was released on %s" ), response.version,
|
||||
response.release_date );
|
||||
|
||||
Pgm().GetNotificationsManager().CreateOrUpdate(
|
||||
wxS( "kicad_update" ), _( "Update Available" ), notificationDesc,
|
||||
response.details_url );
|
||||
|
||||
settings->m_lastReceivedUpdate = response.version;
|
||||
}
|
||||
}
|
||||
catch( const std::exception& e )
|
||||
{
|
||||
wxLogError( wxString::Format( _( "Unable to parse update response: %s" ),
|
||||
e.what() ) );
|
||||
}
|
||||
}
|
||||
|
||||
settings->m_lastUpdateCheckTime = wxDateTime::Now().FormatISOCombined();
|
||||
|
||||
Pgm().GetBackgroundJobMonitor().Remove( m_updateBackgroundJob );
|
||||
m_updateBackgroundJob = nullptr;
|
||||
m_working = false;
|
||||
};
|
||||
|
||||
thread_pool& tp = GetKiCadThreadPool();
|
||||
tp.push_task( update_check );
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2023 Mark Roszko <mark.roszko@gmail.com>
|
||||
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
|
||||
class PROGRESS_REPORTER;
|
||||
struct BACKGROUND_JOB;
|
||||
|
||||
class UPDATE_MANAGER
|
||||
{
|
||||
public:
|
||||
UPDATE_MANAGER();
|
||||
|
||||
void CheckForUpdate();
|
||||
int PostRequest( const wxString& aUrl, std::string aRequestBody, std::ostream* aOutput,
|
||||
PROGRESS_REPORTER* aReporter, const size_t aSizeLimit );
|
||||
|
||||
private:
|
||||
std::atomic<bool> m_working;
|
||||
std::shared_ptr<BACKGROUND_JOB> m_updateBackgroundJob;
|
||||
};
|
Loading…
Reference in New Issue