bool ExportTemplate::updateAvailable() const { if (remoteVersion().isEmpty() || !isInstalled()) return false; return remoteVersion().toFloat() > version().toFloat(); }
void FlashySlideShowStarterFrame::CheckNewVersion(wxCommandEvent& event) { fprintf(stderr,"Checking for a new Version of Flashy Slideshows ( running %s ) \n ",AutoVersion::FULLVERSION_STRING); int i=0; //Inform the user that the program will block for a while..! i=system("notify-send \"Please Wait while checking for a new version.. \n It might take a while..\"&"); if (i!=0) { fprintf(stderr,"Could not inform user in a nice GUI friendly way that it might take a while to check for a new verison\n"); } StatusBar1->SetStatusText(wxT("Please Wait while checking for a newer version ( this might take a while )..")); fprintf(stderr,"Please Wait while checking for a newer version ( this might take a while )..\n "); //Thanks @c00kiemon5ter , the next commandline one liner will put the FULLVERSION_STRING of the git repo inside char * output //FILE * fp = popen("wget -qO- https://raw.github.com/AmmarkoV/FlashySlideshows/master/src/version.h | grep FULLVERSION_STRING | awk -F\\\" '/\"/{ print $2 }'", "r"); int size_of_output = 512; char output[512]; FILE * fp = popen("wget -qO- https://raw.github.com/AmmarkoV/FlashySlideshows/master/src/version.h | sed -n '/FULLVERSION_STRING/s,.*\"\\(.\\+\\)\".*,\\1,p'", "r"); if (fp == 0 ) { fprintf(stderr,"Failed to run check for new version \n"); wxMessageBox(wxT("Failed to run check for new version \n"),wxT("New Version exists"),wxICON_ASTERISK); return; } i=0; while (fgets(output, size_of_output , fp) != 0) { //We should trim the trailing new line character ( if it exists ) UnixTrimEndingNewLine(output); wxString ourVersion(AutoVersion::FULLVERSION_STRING, wxConvUTF8); wxString remoteVersion(output, wxConvUTF8); ++i; fprintf(stderr,"Our Version : `%s` , Remote Version : `%s` \n",AutoVersion::FULLVERSION_STRING,output); if (strcmp(AutoVersion::FULLVERSION_STRING,output)!=0) { wxString outmsg; outmsg<<wxT("You are currently running version "); outmsg<<ourVersion; outmsg<<wxT(", there is a newer version "); outmsg<<remoteVersion; outmsg<<wxT(" you can download at https://www.github.com/AmmarkoV/FlashySlideshows"); wxMessageBox(outmsg,wxT("A New Version is availiable"),wxICON_WARNING); fprintf(stderr,"A new version of flashy slideshows exists.."); StatusBar1->SetStatusText(wxT("A new version of flashy slideshows exists..")); } else { wxString outmsg; outmsg<<wxT("You already have the latest version ("); outmsg<<ourVersion; outmsg<<wxT(") of FlashySlideshows"); wxMessageBox(outmsg,wxT("Version up to date"),wxICON_INFORMATION); fprintf(stderr,"Our version of flashy slideshows is up to date.."); StatusBar1->SetStatusText(wxT("Your version of flashy slideshows is up to date..")); } break; } pclose(fp); }