diff --git a/include/wx/versioninfo.h b/include/wx/versioninfo.h index 277e3e146a..436fcbbba6 100644 --- a/include/wx/versioninfo.h +++ b/include/wx/versioninfo.h @@ -23,15 +23,21 @@ public: int major = 0, int minor = 0, int micro = 0, + int revision = 0, const wxString& description = wxString(), const wxString& copyright = wxString()) - : m_name(name) - , m_description(description) - , m_copyright(copyright) { - m_major = major; - m_minor = minor; - m_micro = micro; + Init(name, major, minor, micro, revision, description, copyright); + } + + // This constructor exists for backward compatibility (before the revision + // part was added). + wxVersionInfo(const wxString& name, + int major, int minor, int micro, + const wxString& description, + const wxString& copyright = wxString()) + { + Init(name, major, minor, micro, 0, description, copyright); } // Default copy ctor, assignment operator and dtor are ok. @@ -42,6 +48,7 @@ public: int GetMajor() const { return m_major; } int GetMinor() const { return m_minor; } int GetMicro() const { return m_micro; } + int GetRevision() const { return m_revision; } wxString ToString() const { @@ -52,8 +59,12 @@ public: { wxString str; str << m_name << ' ' << GetMajor() << '.' << GetMinor(); - if ( GetMicro() ) + if ( GetMicro() || GetRevision() ) + { str << '.' << GetMicro(); + if ( GetRevision() ) + str << '.' << GetRevision(); + } return str; } @@ -65,13 +76,28 @@ public: const wxString& GetCopyright() const { return m_copyright; } private: + void Init(const wxString& name, + int major, int minor, int micro, int revision, + const wxString& description, + const wxString& copyright) + { + m_name = name; + m_description = description; + m_copyright = copyright; + m_major = major; + m_minor = minor; + m_micro = micro; + m_revision = revision; + } + wxString m_name, m_description, m_copyright; int m_major, m_minor, - m_micro; + m_micro, + m_revision; }; #endif // _WX_VERSIONINFO_H_ diff --git a/interface/wx/versioninfo.h b/interface/wx/versioninfo.h index ff733b0fb5..b2e9ff5e88 100644 --- a/interface/wx/versioninfo.h +++ b/interface/wx/versioninfo.h @@ -35,6 +35,9 @@ public: @param major The major version component. @param minor The minor version component. @param micro The micro version component, 0 by default. + @param revision The revision version component, also known as "build + number". This component is also 0 by default and is only available + since wxWidgets 3.2.0. @param description Free form description of this version, none by default. @param copyright Copyright string, none by default. @@ -43,6 +46,7 @@ public: int major = 0, int minor = 0, int micro = 0, + int revision = 0, const wxString& description = wxString(), const wxString& copyright = wxString()); @@ -70,10 +74,23 @@ public: /** Get the micro version, or release number. + This is the third component of the version. + @return Micro version, or release number. */ int GetMicro() const; + /** + Get the revision version, or build number. + + This is the fourth component of the version. + + @return Revision version, or build number. + + @since 3.2.0 + */ + int GetRevision() const; + /** Get the string representation of this version object. @@ -87,9 +104,11 @@ public: /** Get the string representation. - The micro component of the version is ignored/not used if it is 0. + The micro and revision components of the version are ignored/not used + if they are both zero. If the revision component is non-zero all four + parts will be used even if the micro component is zero. - @return The version string in the form "name major.minor[.micro]". + @return The version string in the form "name major.minor[.micro[.revision]]". */ wxString GetVersionString() const; diff --git a/src/msw/webview_edge.cpp b/src/msw/webview_edge.cpp index 14738d3b30..5302691d2c 100644 --- a/src/msw/webview_edge.cpp +++ b/src/msw/webview_edge.cpp @@ -980,7 +980,8 @@ wxVersionInfo wxWebViewFactoryEdge::GetVersionInfo() { long major = 0, minor = 0, - micro = 0; + micro = 0, + revision = 0; if (wxWebViewEdgeImpl::Initialize()) { @@ -996,10 +997,11 @@ wxVersionInfo wxWebViewFactoryEdge::GetVersionInfo() tk.GetNextToken().ToLong(&major); tk.GetNextToken().ToLong(&minor); tk.GetNextToken().ToLong(µ); + tk.GetNextToken().ToLong(&revision); } } - return wxVersionInfo("Microsoft Edge WebView2", major, minor, micro); + return wxVersionInfo("Microsoft Edge WebView2", major, minor, micro, revision); } // ---------------------------------------------------------------------------- diff --git a/src/msw/webview_ie.cpp b/src/msw/webview_ie.cpp index ae092a0477..45afae0013 100644 --- a/src/msw/webview_ie.cpp +++ b/src/msw/webview_ie.cpp @@ -60,7 +60,8 @@ wxVersionInfo wxWebViewFactoryIE::GetVersionInfo() key.QueryValue("Version", value); long major = 0, minor = 0, - micro = 0; + micro = 0, + revision = 0; wxStringTokenizer tk(value, ". "); // Ignore the return value because if the version component is missing // or invalid (i.e. non-numeric), the only thing we can do is to ignore @@ -68,7 +69,8 @@ wxVersionInfo wxWebViewFactoryIE::GetVersionInfo() tk.GetNextToken().ToLong(&major); tk.GetNextToken().ToLong(&minor); tk.GetNextToken().ToLong(µ); - return wxVersionInfo("Internet Explorer", major, minor, micro); + tk.GetNextToken().ToLong(&revision); + return wxVersionInfo("Internet Explorer", major, minor, micro, revision); } //Convenience function for error conversion