Allow setting long version field in About dialog.
Long version is constructed by concatenating "Version " with the short version but can be overridden for the platforms which use it (currently MSW and OS X). Closes 11027. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61534 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -384,6 +384,7 @@ All (GUI):
|
|||||||
- Added wxTextWrapper helper class useful for wrapping lines of text.
|
- Added wxTextWrapper helper class useful for wrapping lines of text.
|
||||||
- Added EVT_DATAVIEW_CACHE_HINT() event (Trigve).
|
- Added EVT_DATAVIEW_CACHE_HINT() event (Trigve).
|
||||||
- Added wxLB_NO_SB style (implemented for MSW only; Dario Senic).
|
- Added wxLB_NO_SB style (implemented for MSW only; Dario Senic).
|
||||||
|
- Added long version field to wxAboutDialogInfo (Jeff Tupper).
|
||||||
|
|
||||||
GTK:
|
GTK:
|
||||||
|
|
||||||
|
@@ -36,10 +36,20 @@ public:
|
|||||||
wxString GetName() const
|
wxString GetName() const
|
||||||
{ return m_name.empty() ? wxTheApp->GetAppDisplayName() : m_name; }
|
{ return m_name.empty() ? wxTheApp->GetAppDisplayName() : m_name; }
|
||||||
|
|
||||||
// version of the program, in free format (but without "version" word)
|
// version should contain program version without "version" word (e.g.,
|
||||||
void SetVersion(const wxString& version) { m_version = version; }
|
// "1.2" or "RC2") while longVersion may contain the full version including
|
||||||
|
// "version" word (e.g., "Version 1.2" or "Release Candidate 2")
|
||||||
|
//
|
||||||
|
// if longVersion is empty, it is automatically constructed from version
|
||||||
|
//
|
||||||
|
// generic and gtk native: use short version only, as a suffix to the
|
||||||
|
// program name msw and osx native: use long version
|
||||||
|
void SetVersion(const wxString& version,
|
||||||
|
const wxString& longVersion = wxString());
|
||||||
|
|
||||||
bool HasVersion() const { return !m_version.empty(); }
|
bool HasVersion() const { return !m_version.empty(); }
|
||||||
const wxString& GetVersion() const { return m_version; }
|
const wxString& GetVersion() const { return m_version; }
|
||||||
|
const wxString& GetLongVersion() const { return m_longVersion; }
|
||||||
|
|
||||||
// brief, but possibly multiline, description of the program
|
// brief, but possibly multiline, description of the program
|
||||||
void SetDescription(const wxString& desc) { m_description = desc; }
|
void SetDescription(const wxString& desc) { m_description = desc; }
|
||||||
@@ -135,6 +145,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
wxString m_name,
|
wxString m_name,
|
||||||
m_version,
|
m_version,
|
||||||
|
m_longVersion,
|
||||||
m_description,
|
m_description,
|
||||||
m_copyright,
|
m_copyright,
|
||||||
m_licence;
|
m_licence;
|
||||||
|
@@ -148,10 +148,19 @@ public:
|
|||||||
void SetTranslators(const wxArrayString& translators);
|
void SetTranslators(const wxArrayString& translators);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set the version of the program. The version is in free format, i.e. not
|
Set the version of the program. The word "version" shouldn't be included
|
||||||
necessarily in the @c x.y.z form but it shouldn't contain the "version" word.
|
in @a version. Example @a version values: "1.2" and "RC2". In about dialogs
|
||||||
|
with more space set aside for version information, @a longVersion is used.
|
||||||
|
Example @a longVersion values: "Version 1.2" and "Release Candidate 2".
|
||||||
|
If @a version is non-empty but @a longVersion is empty, a long version
|
||||||
|
is constructed automatically, using @a version (by simply prepending
|
||||||
|
"Version " to @a version).
|
||||||
|
|
||||||
|
The generic about dialog and native GTK+ dialog use @a version only,
|
||||||
|
as a suffix to the program name. The native MSW and OS X about dialogs
|
||||||
|
use the long version.
|
||||||
*/
|
*/
|
||||||
void SetVersion(const wxString& version);
|
void SetVersion(const wxString& version, const wxString& longVersion = wxString());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set the web site for the program and its description (which defaults to @a url
|
Set the web site for the program and its description (which defaults to @a url
|
||||||
|
@@ -1689,7 +1689,13 @@ void MyFrame::ShowProgress( wxCommandEvent& WXUNUSED(event) )
|
|||||||
static void InitAboutInfoMinimal(wxAboutDialogInfo& info)
|
static void InitAboutInfoMinimal(wxAboutDialogInfo& info)
|
||||||
{
|
{
|
||||||
info.SetName(wxT("Dialogs Sample"));
|
info.SetName(wxT("Dialogs Sample"));
|
||||||
info.SetVersion(wxVERSION_NUM_DOT_STRING_T);
|
info.SetVersion(wxVERSION_NUM_DOT_STRING,
|
||||||
|
wxString::Format
|
||||||
|
(
|
||||||
|
"%s version %s",
|
||||||
|
wxMINOR_VERSION % 2 ? "Development" : "Stable",
|
||||||
|
wxVERSION_NUM_DOT_STRING
|
||||||
|
));
|
||||||
info.SetDescription(wxT("This sample shows different wxWidgets dialogs"));
|
info.SetDescription(wxT("This sample shows different wxWidgets dialogs"));
|
||||||
info.SetCopyright(wxT("(C) 1998-2006 wxWidgets dev team"));
|
info.SetCopyright(wxT("(C) 1998-2006 wxWidgets dev team"));
|
||||||
info.AddDeveloper(wxT("Vadim Zeitlin"));
|
info.AddDeveloper(wxT("Vadim Zeitlin"));
|
||||||
|
@@ -109,6 +109,29 @@ wxString wxAboutDialogInfo::GetCopyrightToDisplay() const
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxAboutDialogInfo::SetVersion(const wxString& version,
|
||||||
|
const wxString& longVersion)
|
||||||
|
{
|
||||||
|
if ( version.empty() )
|
||||||
|
{
|
||||||
|
m_version.clear();
|
||||||
|
|
||||||
|
wxASSERT_MSG( longVersion.empty(),
|
||||||
|
"long version should be empty if version is");
|
||||||
|
|
||||||
|
m_longVersion.clear();
|
||||||
|
}
|
||||||
|
else // setting valid version
|
||||||
|
{
|
||||||
|
m_version = version;
|
||||||
|
|
||||||
|
if ( longVersion.empty() )
|
||||||
|
m_longVersion = _("Version ") + m_version;
|
||||||
|
else
|
||||||
|
m_longVersion = longVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxGenericAboutDialog
|
// wxGenericAboutDialog
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -51,7 +51,7 @@ void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent)
|
|||||||
if ( info.HasVersion() )
|
if ( info.HasVersion() )
|
||||||
{
|
{
|
||||||
msg << wxT('\n');
|
msg << wxT('\n');
|
||||||
msg << wxString::Format(_("Version %s"), info.GetVersion());
|
msg << info.GetLongVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
msg << wxT("\n\n");
|
msg << wxT("\n\n");
|
||||||
|
@@ -69,10 +69,7 @@ void wxAboutBox(const wxAboutDialogInfo& info, wxWindow *parent)
|
|||||||
opts.Set(kHIAboutBoxNameKey, info.GetName());
|
opts.Set(kHIAboutBoxNameKey, info.GetName());
|
||||||
|
|
||||||
if ( info.HasVersion() )
|
if ( info.HasVersion() )
|
||||||
{
|
opts.Set(kHIAboutBoxVersionKey,info.GetLongVersion());
|
||||||
opts.Set(kHIAboutBoxVersionKey,
|
|
||||||
wxString::Format(_("Version %s"), info.GetVersion()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( info.HasCopyright() )
|
if ( info.HasCopyright() )
|
||||||
opts.Set(kHIAboutBoxCopyrightKey, info.GetCopyrightToDisplay());
|
opts.Set(kHIAboutBoxCopyrightKey, info.GetCopyrightToDisplay());
|
||||||
|
@@ -87,8 +87,7 @@ void wxAboutBox(const wxAboutDialogInfo& info, wxWindow *parent)
|
|||||||
if ( info.HasVersion() )
|
if ( info.HasVersion() )
|
||||||
{
|
{
|
||||||
opts.Set(CFSTR("Version"),info.GetVersion());
|
opts.Set(CFSTR("Version"),info.GetVersion());
|
||||||
opts.Set(CFSTR("ApplicationVersion"),
|
opts.Set(CFSTR("ApplicationVersion"),info.GetLongVersion());
|
||||||
wxString::Format(_("Version %s"), info.GetVersion()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( info.HasCopyright() )
|
if ( info.HasCopyright() )
|
||||||
|
Reference in New Issue
Block a user