Fix localization of OS unsupported message, disallow bug reports from W7

This commit is contained in:
david-beinder 2021-06-09 03:02:10 +02:00 committed by Seth Hillbrand
parent de95edb5ad
commit 053bd66650
10 changed files with 75 additions and 14 deletions

View File

@ -26,6 +26,7 @@
#include <wx/wx.h> #include <wx/wx.h>
#include <config.h> #include <config.h>
#include <boost/version.hpp> #include <boost/version.hpp>
#include <kiplatform/app.h>
// kicad_curl.h must be included before wx headers, to avoid // kicad_curl.h must be included before wx headers, to avoid
// conflicts for some defines, at least on Windows // conflicts for some defines, at least on Windows
@ -87,7 +88,8 @@ wxString GetVersionInfoData( const wxString& aTitle, bool aHtml, bool aBrief )
#define OFF "OFF" << eol #define OFF "OFF" << eol
wxString version; wxString version;
version << GetBuildVersion() version << ( KIPLATFORM::APP::IsOperatingSystemUnsupported() ? "(UNSUPPORTED)"
: GetBuildVersion() )
#ifdef DEBUG #ifdef DEBUG
<< ", debug" << ", debug"
#else #else

View File

@ -24,6 +24,7 @@
*/ */
#include <eda_base_frame.h> #include <eda_base_frame.h>
#include <kiplatform/app.h>
#include <project.h> #include <project.h>
#include <common.h> #include <common.h>
#include <reporter.h> #include <reporter.h>
@ -31,6 +32,7 @@
#include <mutex> #include <mutex>
#include <wx/config.h> #include <wx/config.h>
#include <wx/log.h> #include <wx/log.h>
#include <wx/msgdlg.h>
#include <wx/process.h> #include <wx/process.h>
#include <wx/stdpaths.h> #include <wx/stdpaths.h>
#include <wx/url.h> #include <wx/url.h>
@ -604,3 +606,20 @@ long long TimestampDir( const wxString& aDirPath, const wxString& aFilespec )
return timestamp; return timestamp;
} }
bool WarnUserIfOperatingSystemUnsupported()
{
if( !KIPLATFORM::APP::IsOperatingSystemUnsupported() )
return false;
wxMessageDialog dialog( NULL, _( "This operating system is not supported "
"by KiCad and its dependencies." ),
_( "Unsupported Operating System" ),
wxOK | wxICON_EXCLAMATION );
dialog.SetExtendedMessage( _( "Any issues with KiCad on this system cannot "
"be reported to the official bugtracker." ) );
dialog.ShowModal();
return true;
}

View File

@ -36,6 +36,7 @@
#include <bitmaps.h> #include <bitmaps.h>
#include <build_version.h> #include <build_version.h>
#include <common.h> #include <common.h>
#include <kiplatform/app.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <eda_base_frame.h> #include <eda_base_frame.h>
@ -67,7 +68,8 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
/* KiCad build version */ /* KiCad build version */
wxString version; wxString version;
version << GetBuildVersion() version << ( KIPLATFORM::APP::IsOperatingSystemUnsupported() ? "(UNSUPPORTED)"
: GetBuildVersion() )
#ifdef DEBUG #ifdef DEBUG
<< ", debug" << ", debug"
#else #else

View File

@ -40,6 +40,7 @@
#include <wx/filedlg.h> #include <wx/filedlg.h>
#include <wx/tooltip.h> #include <wx/tooltip.h>
#include <common.h>
#include <config_params.h> #include <config_params.h>
#include <confirm.h> #include <confirm.h>
#include <core/arraydim.h> #include <core/arraydim.h>
@ -282,6 +283,9 @@ bool PGM_BASE::InitPgm( bool aHeadless )
// (if the value contains some non ASCII7 chars, the env var is not initialized) // (if the value contains some non ASCII7 chars, the env var is not initialized)
SetLanguage( tmp, true ); SetLanguage( tmp, true );
// Now that translations are available, inform the user if the OS is unsupported
WarnUserIfOperatingSystemUnsupported();
loadCommonSettings(); loadCommonSettings();
ReadPdfBrowserInfos(); // needs GetCommonSettings() ReadPdfBrowserInfos(); // needs GetCommonSettings()

View File

@ -288,6 +288,9 @@ int COMMON_CONTROL::Donate( const TOOL_EVENT& aEvent )
int COMMON_CONTROL::ReportBug( const TOOL_EVENT& aEvent ) int COMMON_CONTROL::ReportBug( const TOOL_EVENT& aEvent )
{ {
if( WarnUserIfOperatingSystemUnsupported() )
return 0;
wxString version = GetVersionInfoData( m_frame->GetAboutTitle(), false, true ); wxString version = GetVersionInfoData( m_frame->GetAboutTitle(), false, true );
wxString message; wxString message;

View File

@ -111,4 +111,12 @@ const wxString ResolveUriByEnvVars( const wxString& aUri, PROJECT* aProject );
long long TimestampDir( const wxString& aDirPath, const wxString& aFilespec ); long long TimestampDir( const wxString& aDirPath, const wxString& aFilespec );
/**
* Checks if the operating system is explicitly unsupported and displays a disclaimer message box
*
* @return true if the operating system is unsupported
*/
bool WarnUserIfOperatingSystemUnsupported();
#endif // INCLUDE__COMMON_H_ #endif // INCLUDE__COMMON_H_

View File

@ -48,6 +48,13 @@ bool KIPLATFORM::APP::Init()
} }
bool KIPLATFORM::APP::IsOperatingSystemUnsupported()
{
// Not implemented on this platform
return false;
}
bool KIPLATFORM::APP::RegisterApplicationRestart( const wxString& aCommandLine ) bool KIPLATFORM::APP::RegisterApplicationRestart( const wxString& aCommandLine )
{ {
// Not implemented on this platform // Not implemented on this platform

View File

@ -36,6 +36,14 @@ namespace KIPLATFORM
*/ */
bool Init(); bool Init();
/**
* Checks if the Operating System is explicitly unsupported and we want to prevent
* users from sending bug reports and show them a disclaimer on startup.
*
* @return true if unsupported
*/
bool IsOperatingSystemUnsupported();
/** /**
* Registers the application for restart with the OS with the given command line string to pass as args * Registers the application for restart with the OS with the given command line string to pass as args
* *

View File

@ -23,7 +23,6 @@
#include <wx/log.h> #include <wx/log.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/window.h> #include <wx/window.h>
#include <wx/msgdlg.h>
#include <windows.h> #include <windows.h>
#include <strsafe.h> #include <strsafe.h>
@ -39,21 +38,23 @@ bool KIPLATFORM::APP::Init()
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF ); _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF );
#endif #endif
return true;
}
bool KIPLATFORM::APP::IsOperatingSystemUnsupported()
{
#if defined( PYTHON_VERSION_MAJOR ) && ( ( PYTHON_VERSION_MAJOR == 3 && PYTHON_VERSION_MINOR >= 8 ) \ #if defined( PYTHON_VERSION_MAJOR ) && ( ( PYTHON_VERSION_MAJOR == 3 && PYTHON_VERSION_MINOR >= 8 ) \
|| PYTHON_VERSION_MAJOR > 3 ) || PYTHON_VERSION_MAJOR > 3 )
// Python 3.8 switched to Windows 8+ API, we do not support Windows 7 and will not // Python 3.8 switched to Windows 8+ API, we do not support Windows 7 and will not
// attempt to hack around it. Gracefully inform the user and refuse to start (because // attempt to hack around it. A normal user will never get here because the Python DLL
// python will crash us if we continue). // is missing dependencies - and because it is not dynamically loaded, KiCad will not even
if( !IsWindows8OrGreater() ) // start without patching Python or its WinAPI dependency. This is just to create a nag dialog
{ // for those who run patched Python and prevent them from submitting bug reports.
wxMessageBox( _( "Windows 7 and older is no longer supported by KiCad and its " return !IsWindows8OrGreater();
"dependencies." ), _( "Unsupported Operating System" ), #else
wxOK | wxICON_ERROR );
return false; return false;
}
#endif #endif
return true;
} }

View File

@ -30,6 +30,13 @@ bool KIPLATFORM::APP::Init()
} }
bool KIPLATFORM::APP::IsOperatingSystemUnsupported()
{
// Not implemented on this platform
return false;
}
bool KIPLATFORM::APP::RegisterApplicationRestart( const wxString& aCommandLine ) bool KIPLATFORM::APP::RegisterApplicationRestart( const wxString& aCommandLine )
{ {
// Not implemented on this platform // Not implemented on this platform