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 <config.h>
#include <boost/version.hpp>
#include <kiplatform/app.h>
// kicad_curl.h must be included before wx headers, to avoid
// 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
wxString version;
version << GetBuildVersion()
version << ( KIPLATFORM::APP::IsOperatingSystemUnsupported() ? "(UNSUPPORTED)"
: GetBuildVersion() )
#ifdef DEBUG
<< ", debug"
#else

View File

@ -24,6 +24,7 @@
*/
#include <eda_base_frame.h>
#include <kiplatform/app.h>
#include <project.h>
#include <common.h>
#include <reporter.h>
@ -31,6 +32,7 @@
#include <mutex>
#include <wx/config.h>
#include <wx/log.h>
#include <wx/msgdlg.h>
#include <wx/process.h>
#include <wx/stdpaths.h>
#include <wx/url.h>
@ -604,3 +606,20 @@ long long TimestampDir( const wxString& aDirPath, const wxString& aFilespec )
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 <build_version.h>
#include <common.h>
#include <kiplatform/app.h>
#include <pgm_base.h>
#include <eda_base_frame.h>
@ -67,7 +68,8 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
/* KiCad build version */
wxString version;
version << GetBuildVersion()
version << ( KIPLATFORM::APP::IsOperatingSystemUnsupported() ? "(UNSUPPORTED)"
: GetBuildVersion() )
#ifdef DEBUG
<< ", debug"
#else

View File

@ -40,6 +40,7 @@
#include <wx/filedlg.h>
#include <wx/tooltip.h>
#include <common.h>
#include <config_params.h>
#include <confirm.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)
SetLanguage( tmp, true );
// Now that translations are available, inform the user if the OS is unsupported
WarnUserIfOperatingSystemUnsupported();
loadCommonSettings();
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 )
{
if( WarnUserIfOperatingSystemUnsupported() )
return 0;
wxString version = GetVersionInfoData( m_frame->GetAboutTitle(), false, true );
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 );
/**
* 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_

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 )
{
// Not implemented on this platform

View File

@ -36,6 +36,14 @@ namespace KIPLATFORM
*/
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
*

View File

@ -23,7 +23,6 @@
#include <wx/log.h>
#include <wx/string.h>
#include <wx/window.h>
#include <wx/msgdlg.h>
#include <windows.h>
#include <strsafe.h>
@ -39,21 +38,23 @@ bool KIPLATFORM::APP::Init()
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF );
#endif
return true;
}
bool KIPLATFORM::APP::IsOperatingSystemUnsupported()
{
#if defined( PYTHON_VERSION_MAJOR ) && ( ( PYTHON_VERSION_MAJOR == 3 && PYTHON_VERSION_MINOR >= 8 ) \
|| PYTHON_VERSION_MAJOR > 3 )
// 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
// python will crash us if we continue).
if( !IsWindows8OrGreater() )
{
wxMessageBox( _( "Windows 7 and older is no longer supported by KiCad and its "
"dependencies." ), _( "Unsupported Operating System" ),
wxOK | wxICON_ERROR );
return false;
}
// attempt to hack around it. A normal user will never get here because the Python DLL
// is missing dependencies - and because it is not dynamically loaded, KiCad will not even
// 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.
return !IsWindows8OrGreater();
#else
return false;
#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 )
{
// Not implemented on this platform