mirror of https://github.com/BOINC/boinc.git
Merge pull request #1768 from AenBleidd/ClientVersionCheck
MGR: Client version check
This commit is contained in:
commit
98d908d186
|
@ -238,7 +238,7 @@ struct CLIENT_STATE {
|
|||
// --------------- acct_setup.cpp:
|
||||
PROJECT_INIT project_init;
|
||||
PROJECT_ATTACH project_attach;
|
||||
void new_version_check();
|
||||
void new_version_check(bool force = false);
|
||||
void all_projects_list_check();
|
||||
double new_version_check_time;
|
||||
double all_projects_list_check_time;
|
||||
|
|
|
@ -87,15 +87,15 @@ static void show_newer_version_msg(const char* new_vers) {
|
|||
if (cc_config.client_new_version_text.empty()) {
|
||||
msg_printf_notice(0, true,
|
||||
"http://boinc.berkeley.edu/manager_links.php?target=notice&controlid=download",
|
||||
"%s (%s) <a href=%s>%s</a>",
|
||||
_("A new version of BOINC is available."),
|
||||
"%s (%s). <a href=%s>%s</a>",
|
||||
_("A new version of BOINC is available"),
|
||||
new_vers,
|
||||
cc_config.client_download_url.c_str(),
|
||||
_("Download")
|
||||
);
|
||||
} else {
|
||||
msg_printf_notice(0, true, NULL,
|
||||
"%s (%s) <a href=%s>%s</a>",
|
||||
"%s (%s). <a href=%s>%s</a>",
|
||||
cc_config.client_new_version_text.c_str(),
|
||||
new_vers,
|
||||
cc_config.client_download_url.c_str(),
|
||||
|
@ -140,8 +140,8 @@ void newer_version_startup_check() {
|
|||
|
||||
#define NEW_VERSION_CHECK_PERIOD (14*86400)
|
||||
|
||||
void CLIENT_STATE::new_version_check() {
|
||||
if ((new_version_check_time == 0) ||
|
||||
void CLIENT_STATE::new_version_check(bool force) {
|
||||
if (force || (new_version_check_time == 0) ||
|
||||
(now - new_version_check_time > NEW_VERSION_CHECK_PERIOD)) {
|
||||
// get_current_version_op.handle_reply()
|
||||
// updates new_version_check_time
|
||||
|
|
|
@ -1000,6 +1000,8 @@ static void handle_acct_mgr_rpc_poll(GUI_RPC_CONN& grc) {
|
|||
}
|
||||
|
||||
static void handle_get_newer_version(GUI_RPC_CONN& grc) {
|
||||
gstate.new_version_check(true);
|
||||
|
||||
grc.mfout.printf(
|
||||
"<newer_version>%s</newer_version>\n"
|
||||
"<download_url>%s</download_url>\n",
|
||||
|
|
|
@ -196,6 +196,7 @@ BEGIN_EVENT_TABLE (CAdvancedFrame, CBOINCBaseFrame)
|
|||
EVT_MENU(ID_HELPBOINCMANAGER, CAdvancedFrame::OnHelpBOINC)
|
||||
EVT_MENU(ID_HELPBOINCWEBSITE, CAdvancedFrame::OnHelpBOINC)
|
||||
EVT_MENU(wxID_ABOUT, CAdvancedFrame::OnHelpAbout)
|
||||
EVT_MENU(ID_CHECK_VERSION, CAdvancedFrame::OnCheckVersion)
|
||||
EVT_HELP(wxID_ANY, CAdvancedFrame::OnHelp)
|
||||
// Custom Events & Timers
|
||||
EVT_FRAME_CONNECT(CAdvancedFrame::OnConnect)
|
||||
|
@ -686,6 +687,21 @@ bool CAdvancedFrame::CreateMenu() {
|
|||
);
|
||||
menuHelp->AppendSeparator();
|
||||
|
||||
strMenuName.Printf(
|
||||
_("Check for new %s version"),
|
||||
pSkinAdvanced->GetApplicationShortName().c_str()
|
||||
);
|
||||
strMenuDescription.Printf(
|
||||
_("Check for new %s version"),
|
||||
pSkinAdvanced->GetApplicationShortName().c_str()
|
||||
);
|
||||
menuHelp->Append(
|
||||
ID_CHECK_VERSION,
|
||||
strMenuName,
|
||||
strMenuDescription
|
||||
);
|
||||
menuHelp->AppendSeparator();
|
||||
|
||||
strMenuName.Printf(
|
||||
_("&About %s..."),
|
||||
pSkinAdvanced->GetApplicationName().c_str()
|
||||
|
@ -1666,6 +1682,13 @@ void CAdvancedFrame::OnHelpAbout(wxCommandEvent& WXUNUSED(event)) {
|
|||
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnHelpAbout - Function End"));
|
||||
}
|
||||
|
||||
void CAdvancedFrame::OnCheckVersion(wxCommandEvent& WXUNUSED(event)) {
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnCheckVersion - Function Begin"));
|
||||
|
||||
wxGetApp().GetDocument()->CheckForVersionUpdate(true);
|
||||
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnCheckVersion - Function End"));
|
||||
}
|
||||
|
||||
void CAdvancedFrame::OnRefreshView(CFrameEvent& WXUNUSED(event)) {
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnRefreshView - Function Begin"));
|
||||
|
|
|
@ -88,6 +88,7 @@ public:
|
|||
void OnHelp( wxHelpEvent& event );
|
||||
void OnHelpBOINC( wxCommandEvent& event );
|
||||
void OnHelpAbout( wxCommandEvent& event );
|
||||
void OnCheckVersion( wxCommandEvent& event );
|
||||
|
||||
void OnRefreshState( wxTimerEvent& event );
|
||||
void OnFrameRender( wxTimerEvent& event );
|
||||
|
|
|
@ -95,6 +95,7 @@
|
|||
#define ID_HELPBOINC 6035 // Locked: Used by manager_links.php
|
||||
#define ID_HELPBOINCWEBSITE 6024 // Locked: Used by manager_links.php
|
||||
#define ID_HELPBOINCMANAGER 6025 // Locked: Used by manager_links.php
|
||||
#define ID_CHECK_VERSION 6026
|
||||
//#define wxID_ABOUT
|
||||
|
||||
// Views
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "BOINCTaskBar.h"
|
||||
#include "DlgEventLog.h"
|
||||
#include "Events.h"
|
||||
#include "SkinManager.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/wait.h>
|
||||
|
@ -164,6 +165,7 @@ void CNetworkConnection::Poll() {
|
|||
if (!retval) {
|
||||
wxLogTrace(wxT("Function Status"), wxT("CNetworkConnection::Poll - Connection Success"));
|
||||
SetStateSuccess(m_strNewComputerName, m_strNewComputerPassword);
|
||||
m_pDocument->CheckForVersionUpdate();
|
||||
} else if (ERR_AUTHENTICATOR == retval) {
|
||||
wxLogTrace(wxT("Function Status"), wxT("CNetworkConnection::Poll - RPC Authorization - ERR_AUTHENTICATOR"));
|
||||
SetStateErrorAuthentication();
|
||||
|
@ -1278,6 +1280,31 @@ bool CMainDocument::IsUserAuthorized() {
|
|||
return true;
|
||||
}
|
||||
|
||||
void CMainDocument::CheckForVersionUpdate(bool showMessage) {
|
||||
std::string version, url;
|
||||
wxString message, title;
|
||||
title.Printf(_("Version Update"));
|
||||
wxString applicationName = wxGetApp().GetSkinManager()->GetAdvanced()->GetApplicationName();
|
||||
if (IsConnected()) {
|
||||
rpc.get_newer_version(version, url);
|
||||
|
||||
if (!showMessage)
|
||||
return;
|
||||
|
||||
if (!version.empty() && !url.empty()) {
|
||||
message.Printf("%s: %s", _("A new version of BOINC is available for downloading here"), url);
|
||||
}
|
||||
else {
|
||||
message.Printf("%s", _("No new version available for downloading"), url);
|
||||
}
|
||||
}
|
||||
else {
|
||||
message.Printf("%s is not connected to the client", applicationName);
|
||||
}
|
||||
if (showMessage) {
|
||||
wxGetApp().SafeMessageBox(message, title);
|
||||
}
|
||||
}
|
||||
|
||||
int CMainDocument::CachedProjectStatusUpdate(bool bForce) {
|
||||
int i = 0;
|
||||
|
|
|
@ -167,6 +167,8 @@ public:
|
|||
|
||||
bool IsUserAuthorized();
|
||||
|
||||
void CheckForVersionUpdate(bool showMessage = false);
|
||||
|
||||
CNetworkConnection* m_pNetworkConnection;
|
||||
CBOINCClientManager* m_pClientManager;
|
||||
AsyncRPC rpc;
|
||||
|
|
|
@ -84,6 +84,7 @@ BEGIN_EVENT_TABLE(CSimpleFrame, CBOINCBaseFrame)
|
|||
EVT_MENU(ID_HELPBOINCMANAGER, CSimpleFrame::OnHelpBOINC)
|
||||
EVT_MENU(ID_HELPBOINCWEBSITE, CSimpleFrame::OnHelpBOINC)
|
||||
EVT_MENU(wxID_ABOUT, CSimpleFrame::OnHelpAbout)
|
||||
EVT_MENU(ID_CHECK_VERSION, CSimpleFrame::OnCheckVersion)
|
||||
EVT_MENU(ID_EVENTLOG, CSimpleFrame::OnEventLog)
|
||||
EVT_MOVE(CSimpleFrame::OnMove)
|
||||
#ifdef __WXMAC__
|
||||
|
@ -258,6 +259,21 @@ CSimpleFrame::CSimpleFrame(wxString title, wxIconBundle* icons, wxPoint position
|
|||
);
|
||||
menuHelp->AppendSeparator();
|
||||
|
||||
strMenuName.Printf(
|
||||
_("Check for new %s version"),
|
||||
pSkinAdvanced->GetApplicationShortName().c_str()
|
||||
);
|
||||
strMenuDescription.Printf(
|
||||
_("Check for new %s version"),
|
||||
pSkinAdvanced->GetApplicationShortName().c_str()
|
||||
);
|
||||
menuHelp->Append(
|
||||
ID_CHECK_VERSION,
|
||||
strMenuName,
|
||||
strMenuDescription
|
||||
);
|
||||
menuHelp->AppendSeparator();
|
||||
|
||||
strMenuName.Printf(
|
||||
_("&About %s..."),
|
||||
pSkinAdvanced->GetApplicationName().c_str()
|
||||
|
@ -611,6 +627,14 @@ void CSimpleFrame::OnHelpAbout(wxCommandEvent& /*event*/) {
|
|||
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnHelpAbout - Function End"));
|
||||
}
|
||||
|
||||
void CSimpleFrame::OnCheckVersion(wxCommandEvent& WXUNUSED(event)) {
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnCheckVersion - Function Begin"));
|
||||
|
||||
wxGetApp().GetDocument()->CheckForVersionUpdate(true);
|
||||
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnCheckVersion - Function End"));
|
||||
}
|
||||
|
||||
|
||||
void CSimpleFrame::OnHelp(wxHelpEvent& event) {
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnHelp - Function Begin"));
|
||||
|
|
|
@ -114,6 +114,7 @@ public:
|
|||
void OnHelp( wxHelpEvent& event );
|
||||
void OnHelpBOINC( wxCommandEvent& event );
|
||||
void OnHelpAbout( wxCommandEvent& event );
|
||||
void OnCheckVersion( wxCommandEvent& event );
|
||||
|
||||
void OnProjectsAttachToProject(wxCommandEvent& event);
|
||||
|
||||
|
|
|
@ -2372,14 +2372,19 @@ int RPC_CLIENT::get_newer_version(std::string& version, std::string& version_dow
|
|||
RPC rpc(this);
|
||||
|
||||
version = "";
|
||||
version_download_url = "";
|
||||
|
||||
retval = rpc.do_rpc("<get_newer_version/>\n");
|
||||
if (!retval) {
|
||||
while (rpc.fin.fgets(buf, 256)) {
|
||||
if (!version.empty() && !version_download_url.empty()) {
|
||||
break;
|
||||
}
|
||||
if (parse_str(buf, "<newer_version>", version)) {
|
||||
return ERR_XML_PARSE;
|
||||
continue;
|
||||
}
|
||||
if (parse_str(buf, "<download_url>", version_download_url)) {
|
||||
return ERR_XML_PARSE;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue