From c53e2dbb778c04a992a58c2d8a81ade5ed465764 Mon Sep 17 00:00:00 2001 From: James Crook Date: Sat, 25 Feb 2017 22:30:23 +0000 Subject: [PATCH] Bug 1597 - Enh: Greater clarity over status of versions needed - For ALPHA builds we do a check version with the Welcome screen (if welcome screen is enabled). - A 'Check Online' in the About box provides a new route to check version - Check Version now passes CommitId and Build Date/Time to identify a version. To actually close the bug we need the javascript on the server page to put up informative messages. --- .gitignore | 1 + .travis.yml | 2 +- mac/scripts/get_gitident.sh | 2 +- src/AboutDialog.cpp | 45 +++++++++++++++++++++++++++++-------- src/AboutDialog.h | 2 ++ src/AudacityApp.cpp | 6 ++++- src/Menus.cpp | 11 ++++++++- src/Menus.h | 1 + src/RevisionIdent.h | 24 +++++++++----------- 9 files changed, 67 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index 94dbdd90d..7f7e325bb 100644 --- a/.gitignore +++ b/.gitignore @@ -56,6 +56,7 @@ lib-src/twolame/doc/html/Doxyfile lib-src/twolame/libtwolame/config.h locale/POTFILES src/audacity.desktop +src/RevisionIdent.h src/configunix.h src/configwin.h *.pc diff --git a/.travis.yml b/.travis.yml index 65840be3a..f63d87a93 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ addons: before_install: - sudo apt-get update -qq - sudo apt-get install -y libwxgtk3.0-dev libgtk2.0-dev - - git show -s --format="wxT(\"[[http://github.com/audacity/audacity/commit/%H|%h]] of %cd\")" | tee ./src/RevisionIdent.h + - git show -s --format="#define REV_LONG \"%H\"%n#define REV_TIME \"%cd\"%n" | tee ./src/RevisionIdent.h - export CXX="g++-4.9" CC="gcc-4.9" - FLAGS="-w -std=gnu++11" - export CFLAGS="$CFLAGS $FLAGS" diff --git a/mac/scripts/get_gitident.sh b/mac/scripts/get_gitident.sh index ff0eb73ea..194d57efc 100755 --- a/mac/scripts/get_gitident.sh +++ b/mac/scripts/get_gitident.sh @@ -1,2 +1,2 @@ -git show -s --format="wxT(\"[[http://github.com/audacity/audacity/commit/%H|%h]] of %cd\")" | tee ../src/RevisionIdent.h +git show -s --format="#define REV_LONG \"%H\"%n#define REV_TIME \"%cd\"%n" | tee ../src/RevisionIdent.h touch ../src/AboutDialog.cpp diff --git a/src/AboutDialog.cpp b/src/AboutDialog.cpp index 239f4e2dc..99a20467f 100644 --- a/src/AboutDialog.cpp +++ b/src/AboutDialog.cpp @@ -45,9 +45,37 @@ hold information about one contributor to Audacity. #include "AllThemeResources.h" #include "../images/AudacityLogoWithName.xpm" +#include "RevisionIdent.h" + +// RevisionIdent.h may contain #defines like these ones: +//#define REV_LONG "28864acb238cb3ca71dda190a2d93242591dd80e" +//#define REV_TIME "Sun Apr 12 12:40:22 2015 +0100" + + +#ifndef REV_TIME +#define REV_TIME "unknown date and time" +#endif + +#ifdef REV_LONG +#define REV_IDENT wxString( "[[http://github.com/audacity/audacity/commit/" )+ REV_LONG + "|" + wxString( REV_LONG ).Left(6) + "]] of " + REV_TIME +#else +#define REV_IDENT wxT("No revision identifier was provided") +#endif extern wxString FormatHtmlText( const wxString & Text ); +// Function to give the xtra arguments to put on the version check string. +const wxString VerCheckArgs(){ + + wxString result = wxString("from_ver=") + AUDACITY_VERSION_STRING; +#ifdef REV_LONG + wxString timeStr = wxString( __DATE__ ) + wxString( __TIME__ ); + result += wxString("&ComitId=")+wxString(REV_LONG).Left(6) + "&Time=" + timeStr; +#endif + result.Replace(" ",""); + return result; +} + void AboutDialog::CreateCreditsList() { // The Audacity Team: developers and support @@ -409,6 +437,13 @@ void AboutDialog::PopulateInformationPage( ShuttleGui & S ) informationStr = wxT("

"); informationStr += _("Build Information"); informationStr += wxT("

\n"); + // Only for debug builds, for now. +#if __WXDEBUG__ + informationStr += wxT("
"); + informationStr += wxString("[[http://www.audacityteam.org/download/?") + VerCheckArgs() + "|" + + _("Check Online") + "]]"; + informationStr += wxT("
\n"); +#endif // top level heading informationStr += wxT("

"); informationStr += _("File Format Support"); @@ -583,15 +618,7 @@ void AboutDialog::PopulateInformationPage( ShuttleGui & S ) // Current date AddBuildinfoRow(&informationStr, _("Program build date: "), __TDATE__); - -// Uncomment the next two lines to test hyperlinks work from here. -// AddBuildinfoRow(&informationStr, wxT("Link Test:"), -// wxT("[[https:www.audacityteam.org|Click bait]]") ); - - AddBuildinfoRow(&informationStr, _("Commit Id:"), -#include "RevisionIdent.h" -); - + AddBuildinfoRow(&informationStr, _("Commit Id:"), REV_IDENT ); #ifdef __WXDEBUG__ AddBuildinfoRow(&informationStr, _("Build type:"), _("Debug build")); #else diff --git a/src/AboutDialog.h b/src/AboutDialog.h index abc9cf49a..3973e8754 100644 --- a/src/AboutDialog.h +++ b/src/AboutDialog.h @@ -18,6 +18,8 @@ #include #include "widgets/wxPanelWrapper.h" +extern const wxString VerCheckArgs(); + class ShuttleGui; struct AboutDialogCreditItem { diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index aed427513..6b31fb651 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -1519,8 +1519,12 @@ bool AudacityApp::OnInit() } } - if( project->mShowSplashScreen ) + if( project->mShowSplashScreen ){ + // This may do a check-for-updates at every start up. + // Mainly this is to tell users of ALPHAS who don't know that they have an ALPHA. + project->MayCheckForUpdates(); project->OnHelpWelcome(); + } // JKC 10-Sep-2007: Enable monitoring from the start. // (recommended by lprod.org). diff --git a/src/Menus.cpp b/src/Menus.cpp index ea8f9ce06..3b1426bd4 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -6848,7 +6848,16 @@ void AudacityProject::OnManual() void AudacityProject::OnCheckForUpdates() { - ::OpenInDefaultBrowser( wxString( wxT("http://audacityteam.org/download/?from_ver=")) + AUDACITY_VERSION_STRING ); + wxString Args = VerCheckArgs(); + ::OpenInDefaultBrowser( wxString( wxT("http://audacityteam.org/download/?")) + Args); +} + +// Only does the update checks if it's an ALPHA build and not disabled by preferences. +void AudacityProject::MayCheckForUpdates() +{ +#if IS_ALPHA + OnCheckForUpdates(); +#endif } void AudacityProject::OnShowLog() diff --git a/src/Menus.h b/src/Menus.h index 0a027054e..002e780e4 100644 --- a/src/Menus.h +++ b/src/Menus.h @@ -417,6 +417,7 @@ void OnAbout(); void OnQuickHelp(); void OnManual(); void OnCheckForUpdates(); +void MayCheckForUpdates(); void OnShowLog(); void OnHelpWelcome(); void OnBenchmark(); diff --git a/src/RevisionIdent.h b/src/RevisionIdent.h index 6f8785b51..9a2632ccd 100644 --- a/src/RevisionIdent.h +++ b/src/RevisionIdent.h @@ -11,22 +11,18 @@ \file RevisionIdent.h - This entire file will be replaced by the revision identifier string - based on the branch SHA when the automated build system builds - Audacity. That striing will look something like: - - "7f2e839 of - Thu Apr 9 20:03:11 2015 +0100" + This entire file will be replaced by the revision identifier #defines + These will be used by Audacity to: + a) Give a link to the commit in the about box + b) Identify the revision for Update checking. *//********************************************************************/ -// The commented out string below is like the one the build servers -// will replace this file with. -//wxT("28864ac of Sun Apr 12 12:40:22 2015 +0100") +// The commented out #defines below are like the one the build servers +// will replace this file with: +// #define REV_LONG "28864acb238cb3ca71dda190a2d93242591dd80e" +// #define REV_TIME "Sun Apr 12 12:40:22 2015 +0100" - -// The string below is what you get if -// the build system does not replace this file. -wxT("No revision identifier was provided") +// If the above are not defined, Audacity will say: +// "No revision identifier was provided"