commit d0ae94627238944cc4fc8ca6674fd23dd2be3834 parent 0d2514e018d1077c32b8ff1388f990e9de1e8c18 Author: Alexander Kojevnikov <alexander@kojevnikov.com> Date: Tue, 21 Aug 2012 22:22:50 -0700 Get the latest version from the website Diffstat:
M | src/spek-window.cc | | | 15 | ++++++++++++++- |
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/spek-window.cc b/src/spek-window.cc @@ -22,6 +22,8 @@ #include <wx/artprov.h> #include <wx/dnd.h> #include <wx/filename.h> +#include <wx/protocol/http.h> +#include <wx/sstream.h> #include "spek-preferences.hh" #include "spek-spectrogram.hh" @@ -350,7 +352,18 @@ static void * check_version(void *p) } // Get the version number. - wxString version = wxT("0.8.1"); //Platform.read_line ("http://www.spek-project.org/version"); + wxString version; + wxHTTP http; + if (http.Connect(wxT("spek-project.org"))) { + wxInputStream *stream = http.GetInputStream(wxT("/version")); + if (stream) { + wxStringOutputStream out(&version); + stream->Read(out); + version.Trim(); + delete stream; + } + } + if (version.IsEmpty()) { return NULL; }