From add670e93279449d0086762ac92d515b011638ec Mon Sep 17 00:00:00 2001 From: Xun Li Date: Thu, 28 Apr 2016 16:24:44 -0700 Subject: [PATCH 01/10] add autoupdate feature (testing) --- .../macosx/GeoDa.xcodeproj/project.pbxproj | 6 + DialogTools/AutoUpdateDlg.cpp | 181 ++++++++++++++++ DialogTools/AutoUpdateDlg.h | 56 +++++ GeoDa.cpp | 8 + GeoDa.h | 1 + rc/GdaAppResources.cpp | 205 +++++++++--------- rc/menus.xrc | 3 + 7 files changed, 360 insertions(+), 100 deletions(-) create mode 100644 DialogTools/AutoUpdateDlg.cpp create mode 100644 DialogTools/AutoUpdateDlg.h diff --git a/BuildTools/macosx/GeoDa.xcodeproj/project.pbxproj b/BuildTools/macosx/GeoDa.xcodeproj/project.pbxproj index dc08d6024..d04595296 100644 --- a/BuildTools/macosx/GeoDa.xcodeproj/project.pbxproj +++ b/BuildTools/macosx/GeoDa.xcodeproj/project.pbxproj @@ -30,6 +30,7 @@ A1E78139178A90A100CC1037 /* OGRDatasourceProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1E78133178A90A100CC1037 /* OGRDatasourceProxy.cpp */; }; A1E7813A178A90A100CC1037 /* OGRFieldProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1E78135178A90A100CC1037 /* OGRFieldProxy.cpp */; }; A1E7813B178A90A100CC1037 /* OGRLayerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1E78137178A90A100CC1037 /* OGRLayerProxy.cpp */; }; + A1EBC88F1CD2B2FD001DCFE9 /* AutoUpdateDlg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1EBC88D1CD2B2FD001DCFE9 /* AutoUpdateDlg.cpp */; }; A1EF332F18E35D8300E19375 /* LocaleSetupDlg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1EF332D18E35D8300E19375 /* LocaleSetupDlg.cpp */; }; A1F1BA5C178D3B46005A46E5 /* GdaCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1F1BA5A178D3B46005A46E5 /* GdaCache.cpp */; }; A1F1BA99178D46B8005A46E5 /* cache.sqlite in CopyFiles */ = {isa = PBXBuildFile; fileRef = A1F1BA98178D46B8005A46E5 /* cache.sqlite */; }; @@ -266,6 +267,8 @@ A1E78136178A90A100CC1037 /* OGRFieldProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OGRFieldProxy.h; sourceTree = ""; }; A1E78137178A90A100CC1037 /* OGRLayerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OGRLayerProxy.cpp; sourceTree = ""; }; A1E78138178A90A100CC1037 /* OGRLayerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OGRLayerProxy.h; sourceTree = ""; }; + A1EBC88D1CD2B2FD001DCFE9 /* AutoUpdateDlg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AutoUpdateDlg.cpp; sourceTree = ""; }; + A1EBC88E1CD2B2FD001DCFE9 /* AutoUpdateDlg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoUpdateDlg.h; sourceTree = ""; }; A1EF332D18E35D8300E19375 /* LocaleSetupDlg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LocaleSetupDlg.cpp; sourceTree = ""; }; A1EF332E18E35D8300E19375 /* LocaleSetupDlg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocaleSetupDlg.h; sourceTree = ""; }; A1F1BA5A178D3B46005A46E5 /* GdaCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GdaCache.cpp; sourceTree = ""; }; @@ -747,6 +750,8 @@ DD7974FE0F1D296F00496A84 /* DialogTools */ = { isa = PBXGroup; children = ( + A1EBC88D1CD2B2FD001DCFE9 /* AutoUpdateDlg.cpp */, + A1EBC88E1CD2B2FD001DCFE9 /* AutoUpdateDlg.h */, A1AC05BD1C8645F300B6FE5F /* AdjustYAxisDlg.cpp */, A1AC05BE1C8645F300B6FE5F /* AdjustYAxisDlg.h */, A1B13EE21C3EDFF90064AD87 /* BasemapConfDlg.cpp */, @@ -1269,6 +1274,7 @@ DDD140540F310324009F7F13 /* AbstractShape.cpp in Sources */, DD5FA1DA0F320DD50055A0E5 /* ShapeFileHdr.cpp in Sources */, A1B13EE31C3EDFF90064AD87 /* BasemapConfDlg.cpp in Sources */, + A1EBC88F1CD2B2FD001DCFE9 /* AutoUpdateDlg.cpp in Sources */, DDB0E42C10B34DBB00F96D57 /* AddIdVariable.cpp in Sources */, DD00ADE811138A2C008FE572 /* TemplateFrame.cpp in Sources */, DDAA6540117F9B5D00D1010C /* Project.cpp in Sources */, diff --git a/DialogTools/AutoUpdateDlg.cpp b/DialogTools/AutoUpdateDlg.cpp new file mode 100644 index 000000000..7a7af7893 --- /dev/null +++ b/DialogTools/AutoUpdateDlg.cpp @@ -0,0 +1,181 @@ +/** + * GeoDa TM, Copyright (C) 2011-2015 by Luc Anselin - all rights reserved + * + * This file is part of GeoDa. + * + * GeoDa is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GeoDa is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "stdio.h" +#include +#include +#include "curl/curl.h" + + +#include "../logger.h" +#include "../GeneralWxUtils.h" +#include "AutoUpdateDlg.h" + +using namespace std; + +size_t write_to_string(void *ptr, size_t size, size_t count, void *stream) { + ((string*)stream)->append((char*)ptr, 0, size*count); + return size*count; +} + +size_t write_to_file(void *ptr, size_t size, size_t nmemb, void* userdata) +{ + FILE* stream = (FILE*)userdata; + if (!stream) + { + printf("!!! No stream\n"); + return 0; + } + + size_t written = fwrite((FILE*)ptr, size, nmemb, stream); + return written; +} + +string ReadUrlContent(const char* url) +{ + + string response; + + CURL* curl = curl_easy_init(); + CURLcode res; + if (curl) { + curl_easy_setopt(curl, CURLOPT_URL, url); + + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_to_string); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response); + + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + + } + return response; +} + +wxString AutoUpdate::CheckUpdate() +{ + wxString checklist = GetCheckList(); + + // get current version numbers + + return ""; +} + +wxString AutoUpdate::GetCheckList() +{ + wxString checklistUrl = "http://geodacenter.github.io/updates/checklist"; + // download checklist.txt + if ( GeneralWxUtils::isWindows()) { + if (GeneralWxUtils::isX86()) { + checklistUrl += ".win32.txt"; + } else { + checklistUrl += ".win64.txt"; + } + } else if (GeneralWxUtils::isMac()) { + checklistUrl += ".macosx.txt"; + } else { + // we don't support auto update on other platforms + return ""; + } + + return ReadUrlContent(checklistUrl); +} + +AutoUpdateDlg::AutoUpdateDlg(wxWindow* parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size ) +: wxDialog(parent, id, title, pos, size) +{ + + LOG_MSG("Entering AutoUpdateDlg::AutoUpdateDlg(..)"); + + // check update + wxString checklist = AutoUpdate::GetCheckList(); + + wxString url_update_description; + + wxPanel* panel = new wxPanel(this); + panel->SetBackgroundColour(*wxWHITE); + + wxStaticText* lbl = new wxStaticText(panel, wxID_ANY, "A newer version of GeoDa is found. Do you want to update to version 1.8.4?"); + wxHyperlinkCtrl* whatsnew = new wxHyperlinkCtrl(panel, wxID_ANY, "Check what's new in this update.", url_update_description); + prg_bar = new wxGauge(panel, wxID_ANY, 100); + + + prg_bar->Hide(); + + wxBoxSizer* lbl_box = new wxBoxSizer(wxVERTICAL); + lbl_box->AddSpacer(20); + lbl_box->Add(lbl, 1, wxALIGN_CENTER | wxEXPAND |wxALL, 10); + lbl_box->Add(whatsnew, 1, wxALIGN_LEFT | wxEXPAND |wxALL, 10); + lbl_box->Add(prg_bar, 1, wxEXPAND |wxALL, 10); + + + wxButton* btn_save_dummy = new wxButton(panel, wxID_ANY, "Cancel"); + wxButton* btn_apply = new wxButton(panel, wxID_ANY, "Update"); + wxBoxSizer* btn_box = new wxBoxSizer(wxHORIZONTAL); + btn_box->Add(btn_save_dummy, 1, wxALIGN_CENTER |wxEXPAND| wxALL, 10); + btn_box->Add(btn_apply, 1, wxALIGN_CENTER | wxEXPAND | wxALL, 10); + + wxBoxSizer* box = new wxBoxSizer(wxVERTICAL); + box->Add(lbl_box, 0, wxALIGN_TOP | wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 10); + box->Add(btn_box, 0, wxALIGN_CENTER| wxLEFT | wxRIGHT | wxTOP, 30); + + panel->SetSizerAndFit(box); + + wxBoxSizer* sizerAll = new wxBoxSizer(wxVERTICAL); + sizerAll->Add(panel, 1, wxEXPAND|wxALL); + SetSizer(sizerAll); + SetAutoLayout(true); + + SetParent(parent); + SetPosition(pos); + Centre(); + LOG_MSG("Exiting AutoUpdateDlg::AutoUpdateDlg(..)"); +} + + +void AutoUpdateDlg::OnOkClick( wxCommandEvent& event ) +{ + // read the file line by line + // download the file + // replace the old file + + EndDialog(wxID_OK); +} + +void AutoUpdateDlg::OnCancelClick( wxCommandEvent& event ) +{ + + + EndDialog(wxID_CANCEL); +} \ No newline at end of file diff --git a/DialogTools/AutoUpdateDlg.h b/DialogTools/AutoUpdateDlg.h new file mode 100644 index 000000000..21a240406 --- /dev/null +++ b/DialogTools/AutoUpdateDlg.h @@ -0,0 +1,56 @@ +/** + * GeoDa TM, Copyright (C) 2011-2015 by Luc Anselin - all rights reserved + * + * This file is part of GeoDa. + * + * GeoDa is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GeoDa is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef __GEODA_CENTER_AUTOUPDATE_DLG_H__ +#define __GEODA_CENTER_AUTOUPDATE_DLG_H__ + + +#include +#include +#include +#include +#include +#include +#include + + +namespace AutoUpdate { + wxString CheckUpdate(); + + wxString GetCheckList(); +} + +class AutoUpdateDlg: public wxDialog +{ +public: + AutoUpdateDlg(wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& title = "GeoDa Update Dialog", + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxSize(500,220)); + +private: + + wxGauge* prg_bar; + + void OnOkClick( wxCommandEvent& event ); + void OnCancelClick( wxCommandEvent& event ); + +}; + +#endif diff --git a/GeoDa.cpp b/GeoDa.cpp index 18131e2b2..7b70436dd 100644 --- a/GeoDa.cpp +++ b/GeoDa.cpp @@ -101,6 +101,7 @@ #include "DialogTools/WeightsManDlg.h" #include "DialogTools/PublishDlg.h" #include "DialogTools/BasemapConfDlg.h" +#include "DialogTools/AutoUpdateDlg.h" #include "Explore/CatClassification.h" #include "Explore/CovSpView.h" @@ -1181,6 +1182,7 @@ EVT_MENU(GdaConst::ID_PLOTS_PER_VIEW_ALL, GdaFrame::OnPlotsPerViewAll) EVT_MENU(XRCID("ID_DISPLAY_STATUS_BAR"), GdaFrame::OnDisplayStatusBar) EVT_MENU(XRCID("wxID_ABOUT"), GdaFrame::OnHelpAbout) +EVT_MENU(XRCID("wxID_CHECKUPDATES"), GdaFrame::OnCheckUpdates) END_EVENT_TABLE() @@ -5639,6 +5641,12 @@ void GdaFrame::OnDisplayStatusBar(wxCommandEvent& event) t->OnDisplayStatusBar(event); } +void GdaFrame::OnCheckUpdates(wxCommandEvent& WXUNUSED(event) ) +{ + AutoUpdateDlg dlg(this); + dlg.ShowModal(); +} + void GdaFrame::OnHelpAbout(wxCommandEvent& WXUNUSED(event) ) { wxDialog dlg; diff --git a/GeoDa.h b/GeoDa.h index bc4a54bad..9dfcb8905 100644 --- a/GeoDa.h +++ b/GeoDa.h @@ -620,6 +620,7 @@ class GdaFrame: public wxFrame void OnDisplayStatusBar(wxCommandEvent& event); void OnHelpAbout(wxCommandEvent& event); + void OnCheckUpdates(wxCommandEvent& event); void OnTableSetLocale(wxCommandEvent& event); void OnEncodingUTF8(wxCommandEvent& event); diff --git a/rc/GdaAppResources.cpp b/rc/GdaAppResources.cpp index cc92827ba..0e1d4e9f6 100644 --- a/rc/GdaAppResources.cpp +++ b/rc/GdaAppResources.cpp @@ -20171,7 +20171,7 @@ static unsigned char xml_res_file_8[] = { 76,79,83,69,95,66,79,88,60,47,115,116,121,108,101,62,10,32,32,60,47,111, 98,106,101,99,116,62,10,60,47,114,101,115,111,117,114,99,101,62,10}; -static size_t xml_res_size_9 = 159673; +static size_t xml_res_size_9 = 159785; static unsigned char xml_res_file_9[] = { 60,63,120,109,108,32,118,101,114,115,105,111,110,61,34,49,46,48,34,32,101, 110,99,111,100,105,110,103,61,34,73,83,79,45,56,56,53,57,45,49,53,34,63, @@ -21038,110 +21038,115 @@ static unsigned char xml_res_file_9[] = { 32,60,108,97,98,101,108,62,38,97,109,112,59,72,101,108,112,60,47,108,97, 98,101,108,62,10,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97, 115,115,61,34,119,120,77,101,110,117,73,116,101,109,34,32,110,97,109,101, -61,34,119,120,73,68,95,65,66,79,85,84,34,62,10,32,32,32,32,32,32,32,32, -60,108,97,98,101,108,62,65,98,111,117,116,32,71,101,111,68,97,60,47,108, -97,98,101,108,62,10,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10, -32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,60,47,111,98,106,101, -99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34, -119,120,77,101,110,117,34,32,110,97,109,101,61,34,73,68,95,68,69,70,65, -85,76,84,95,77,69,78,85,95,79,80,84,73,79,78,83,34,62,10,32,32,32,32,60, -108,97,98,101,108,62,79,112,116,105,111,110,115,60,47,108,97,98,101,108, -62,10,32,32,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99, -116,32,99,108,97,115,115,61,34,119,120,77,101,110,117,34,32,110,97,109, -101,61,34,73,68,95,51,68,95,80,76,79,84,95,86,73,69,87,95,77,69,78,85,95, -79,80,84,73,79,78,83,34,62,10,32,32,32,32,60,111,98,106,101,99,116,32,99, -108,97,115,115,61,34,119,120,77,101,110,117,34,32,110,97,109,101,61,34, -73,68,95,77,69,78,85,34,62,10,32,32,32,32,32,32,60,108,97,98,101,108,62, -67,111,108,111,114,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,60,111, -98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,77,101,110,117,73, -116,101,109,34,32,110,97,109,101,61,34,73,68,95,83,69,76,69,67,84,65,66, -76,69,95,70,73,76,76,95,67,79,76,79,82,34,62,10,32,32,32,32,32,32,32,32, -60,108,97,98,101,108,62,80,111,105,110,116,32,67,111,108,111,114,60,47, -108,97,98,101,108,62,10,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62, -10,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34, -119,120,77,101,110,117,73,116,101,109,34,32,110,97,109,101,61,34,73,68, -95,72,73,71,72,76,73,71,72,84,95,67,79,76,79,82,34,62,10,32,32,32,32,32, -32,32,32,60,108,97,98,101,108,62,72,105,103,104,108,105,103,104,116,32, -67,111,108,111,114,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,60,47, +61,34,119,120,73,68,95,67,72,69,67,75,85,80,68,65,84,69,83,34,62,10,32, +32,32,32,32,32,32,32,60,108,97,98,101,108,62,67,104,101,99,107,32,85,112, +100,97,116,101,115,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,60,47, 111,98,106,101,99,116,62,10,32,32,32,32,32,32,60,111,98,106,101,99,116, 32,99,108,97,115,115,61,34,119,120,77,101,110,117,73,116,101,109,34,32, -110,97,109,101,61,34,73,68,95,67,65,78,86,65,83,95,66,65,67,75,71,82,79, -85,78,68,95,67,79,76,79,82,34,62,10,32,32,32,32,32,32,32,32,60,108,97,98, -101,108,62,66,97,99,107,103,114,111,117,110,100,32,67,111,108,111,114,60, -47,108,97,98,101,108,62,10,32,32,32,32,32,32,60,47,111,98,106,101,99,116, -62,10,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,60,108, -97,98,101,108,62,79,112,116,105,111,110,115,60,47,108,97,98,101,108,62, -10,32,32,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116, -32,99,108,97,115,115,61,34,119,120,77,101,110,117,34,32,110,97,109,101, -61,34,73,68,95,66,79,88,95,78,69,87,95,80,76,79,84,95,86,73,69,87,95,77, -69,78,85,95,79,80,84,73,79,78,83,34,62,10,32,32,32,32,60,111,98,106,101, -99,116,32,99,108,97,115,115,61,34,119,120,77,101,110,117,34,32,110,97,109, -101,61,34,73,68,95,77,69,78,85,34,62,10,32,32,32,32,32,32,60,108,97,98, -101,108,62,72,105,110,103,101,60,47,108,97,98,101,108,62,10,32,32,32,32, -32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,77,101, -110,117,73,116,101,109,34,32,110,97,109,101,61,34,73,68,95,79,80,84,73, -79,78,83,95,72,73,78,71,69,95,49,53,34,62,10,32,32,32,32,32,32,32,32,60, -108,97,98,101,108,62,49,46,53,60,47,108,97,98,101,108,62,10,32,32,32,32, -32,32,32,32,60,99,104,101,99,107,97,98,108,101,62,49,60,47,99,104,101,99, -107,97,98,108,101,62,10,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62, -10,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34, -119,120,77,101,110,117,73,116,101,109,34,32,110,97,109,101,61,34,73,68, -95,79,80,84,73,79,78,83,95,72,73,78,71,69,95,51,48,34,62,10,32,32,32,32, -32,32,32,32,60,108,97,98,101,108,62,51,46,48,60,47,108,97,98,101,108,62, -10,32,32,32,32,32,32,32,32,60,99,104,101,99,107,97,98,108,101,62,49,60, -47,99,104,101,99,107,97,98,108,101,62,10,32,32,32,32,32,32,60,47,111,98, -106,101,99,116,62,10,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32, -32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,77,101, -110,117,73,116,101,109,34,32,110,97,109,101,61,34,73,68,95,68,73,83,80, -76,65,89,95,83,84,65,84,73,83,84,73,67,83,34,62,10,32,32,32,32,32,32,60, -108,97,98,101,108,62,68,105,115,112,108,97,121,32,83,116,97,116,105,115, -116,105,99,115,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,60,99,104, -101,99,107,97,98,108,101,62,49,60,47,99,104,101,99,107,97,98,108,101,62, -10,32,32,32,32,32,32,60,99,104,101,99,107,101,100,62,48,60,47,99,104,101, -99,107,101,100,62,10,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32, -32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,77,101, -110,117,73,116,101,109,34,32,110,97,109,101,61,34,73,68,95,83,72,79,87, -95,65,88,69,83,34,62,10,32,32,32,32,32,32,60,108,97,98,101,108,62,83,104, -111,119,32,86,101,114,116,105,99,97,108,32,65,120,105,115,60,47,108,97, -98,101,108,62,10,32,32,32,32,32,32,60,99,104,101,99,107,97,98,108,101,62, -49,60,47,99,104,101,99,107,97,98,108,101,62,10,32,32,32,32,32,32,60,99, -104,101,99,107,101,100,62,49,60,47,99,104,101,99,107,101,100,62,10,32,32, -32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,60,111,98,106,101,99, -116,32,99,108,97,115,115,61,34,115,101,112,97,114,97,116,111,114,34,47, -62,10,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119, -120,77,101,110,117,34,32,110,97,109,101,61,34,73,68,95,77,69,78,85,34,62, -10,32,32,32,32,32,32,60,108,97,98,101,108,62,67,111,108,111,114,60,47,108, -97,98,101,108,62,10,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108, +110,97,109,101,61,34,119,120,73,68,95,65,66,79,85,84,34,62,10,32,32,32, +32,32,32,32,32,60,108,97,98,101,108,62,65,98,111,117,116,32,71,101,111, +68,97,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,60,47,111,98,106, +101,99,116,62,10,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,60, +47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108, +97,115,115,61,34,119,120,77,101,110,117,34,32,110,97,109,101,61,34,73,68, +95,68,69,70,65,85,76,84,95,77,69,78,85,95,79,80,84,73,79,78,83,34,62,10, +32,32,32,32,60,108,97,98,101,108,62,79,112,116,105,111,110,115,60,47,108, +97,98,101,108,62,10,32,32,60,47,111,98,106,101,99,116,62,10,32,32,60,111, +98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,77,101,110,117,34, +32,110,97,109,101,61,34,73,68,95,51,68,95,80,76,79,84,95,86,73,69,87,95, +77,69,78,85,95,79,80,84,73,79,78,83,34,62,10,32,32,32,32,60,111,98,106, +101,99,116,32,99,108,97,115,115,61,34,119,120,77,101,110,117,34,32,110, +97,109,101,61,34,73,68,95,77,69,78,85,34,62,10,32,32,32,32,32,32,60,108, +97,98,101,108,62,67,111,108,111,114,60,47,108,97,98,101,108,62,10,32,32, +32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120, +77,101,110,117,73,116,101,109,34,32,110,97,109,101,61,34,73,68,95,83,69, +76,69,67,84,65,66,76,69,95,70,73,76,76,95,67,79,76,79,82,34,62,10,32,32, +32,32,32,32,32,32,60,108,97,98,101,108,62,80,111,105,110,116,32,67,111, +108,111,114,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,60,47,111,98, +106,101,99,116,62,10,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108, 97,115,115,61,34,119,120,77,101,110,117,73,116,101,109,34,32,110,97,109, -101,61,34,73,68,95,83,69,76,69,67,84,65,66,76,69,95,70,73,76,76,95,67,79, -76,79,82,34,62,10,32,32,32,32,32,32,32,32,60,108,97,98,101,108,62,80,111, -105,110,116,32,67,111,108,111,114,60,47,108,97,98,101,108,62,10,32,32,32, +101,61,34,73,68,95,72,73,71,72,76,73,71,72,84,95,67,79,76,79,82,34,62,10, +32,32,32,32,32,32,32,32,60,108,97,98,101,108,62,72,105,103,104,108,105, +103,104,116,32,67,111,108,111,114,60,47,108,97,98,101,108,62,10,32,32,32, 32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,60,111,98, 106,101,99,116,32,99,108,97,115,115,61,34,119,120,77,101,110,117,73,116, -101,109,34,32,110,97,109,101,61,34,73,68,95,72,73,71,72,76,73,71,72,84, -95,67,79,76,79,82,34,62,10,32,32,32,32,32,32,32,32,60,108,97,98,101,108, -62,72,105,103,104,108,105,103,104,116,32,67,111,108,111,114,60,47,108,97, -98,101,108,62,10,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32, -32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119, -120,77,101,110,117,73,116,101,109,34,32,110,97,109,101,61,34,73,68,95,67, -65,78,86,65,83,95,66,65,67,75,71,82,79,85,78,68,95,67,79,76,79,82,34,62, -10,32,32,32,32,32,32,32,32,60,108,97,98,101,108,62,66,97,99,107,103,114, -111,117,110,100,32,67,111,108,111,114,60,47,108,97,98,101,108,62,10,32, -32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,60,47,111, -98,106,101,99,116,62,10,32,32,32,32,60,111,98,106,101,99,116,32,99,108, -97,115,115,61,34,119,120,77,101,110,117,73,116,101,109,34,32,110,97,109, -101,61,34,73,68,95,68,73,83,80,76,65,89,95,83,84,65,84,85,83,95,66,65,82, -34,62,10,32,32,32,32,32,32,60,108,97,98,101,108,62,83,104,111,119,32,83, -116,97,116,117,115,32,66,97,114,60,47,108,97,98,101,108,62,10,32,32,32, -32,32,32,60,99,104,101,99,107,97,98,108,101,62,49,60,47,99,104,101,99,107, -97,98,108,101,62,10,32,32,32,32,32,32,60,99,104,101,99,107,101,100,62,49, -60,47,99,104,101,99,107,101,100,62,10,32,32,32,32,60,47,111,98,106,101, -99,116,62,10,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115, -61,34,115,101,112,97,114,97,116,111,114,34,47,62,10,32,32,32,32,60,111, -98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,77,101,110,117,73, -116,101,109,34,32,110,97,109,101,61,34,73,68,95,83,65,86,69,95,83,69,76, -69,67,84,69,68,95,84,79,95,67,79,76,85,77,78,34,62,10,32,32,32,32,32,32, -60,108,97,98,101,108,62,83,97,118,101,32,83,101,108,101,99,116,105,111, +101,109,34,32,110,97,109,101,61,34,73,68,95,67,65,78,86,65,83,95,66,65, +67,75,71,82,79,85,78,68,95,67,79,76,79,82,34,62,10,32,32,32,32,32,32,32, +32,60,108,97,98,101,108,62,66,97,99,107,103,114,111,117,110,100,32,67,111, +108,111,114,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,60,47,111,98, +106,101,99,116,62,10,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32, +32,32,60,108,97,98,101,108,62,79,112,116,105,111,110,115,60,47,108,97,98, +101,108,62,10,32,32,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106, +101,99,116,32,99,108,97,115,115,61,34,119,120,77,101,110,117,34,32,110, +97,109,101,61,34,73,68,95,66,79,88,95,78,69,87,95,80,76,79,84,95,86,73, +69,87,95,77,69,78,85,95,79,80,84,73,79,78,83,34,62,10,32,32,32,32,60,111, +98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,77,101,110,117,34, +32,110,97,109,101,61,34,73,68,95,77,69,78,85,34,62,10,32,32,32,32,32,32, +60,108,97,98,101,108,62,72,105,110,103,101,60,47,108,97,98,101,108,62,10, +32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119, +120,77,101,110,117,73,116,101,109,34,32,110,97,109,101,61,34,73,68,95,79, +80,84,73,79,78,83,95,72,73,78,71,69,95,49,53,34,62,10,32,32,32,32,32,32, +32,32,60,108,97,98,101,108,62,49,46,53,60,47,108,97,98,101,108,62,10,32, +32,32,32,32,32,32,32,60,99,104,101,99,107,97,98,108,101,62,49,60,47,99, +104,101,99,107,97,98,108,101,62,10,32,32,32,32,32,32,60,47,111,98,106,101, +99,116,62,10,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115, +115,61,34,119,120,77,101,110,117,73,116,101,109,34,32,110,97,109,101,61, +34,73,68,95,79,80,84,73,79,78,83,95,72,73,78,71,69,95,51,48,34,62,10,32, +32,32,32,32,32,32,32,60,108,97,98,101,108,62,51,46,48,60,47,108,97,98,101, +108,62,10,32,32,32,32,32,32,32,32,60,99,104,101,99,107,97,98,108,101,62, +49,60,47,99,104,101,99,107,97,98,108,101,62,10,32,32,32,32,32,32,60,47, +111,98,106,101,99,116,62,10,32,32,32,32,60,47,111,98,106,101,99,116,62, +10,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119, +120,77,101,110,117,73,116,101,109,34,32,110,97,109,101,61,34,73,68,95,68, +73,83,80,76,65,89,95,83,84,65,84,73,83,84,73,67,83,34,62,10,32,32,32,32, +32,32,60,108,97,98,101,108,62,68,105,115,112,108,97,121,32,83,116,97,116, +105,115,116,105,99,115,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32, +60,99,104,101,99,107,97,98,108,101,62,49,60,47,99,104,101,99,107,97,98, +108,101,62,10,32,32,32,32,32,32,60,99,104,101,99,107,101,100,62,48,60,47, +99,104,101,99,107,101,100,62,10,32,32,32,32,60,47,111,98,106,101,99,116, +62,10,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119, +120,77,101,110,117,73,116,101,109,34,32,110,97,109,101,61,34,73,68,95,83, +72,79,87,95,65,88,69,83,34,62,10,32,32,32,32,32,32,60,108,97,98,101,108, +62,83,104,111,119,32,86,101,114,116,105,99,97,108,32,65,120,105,115,60, +47,108,97,98,101,108,62,10,32,32,32,32,32,32,60,99,104,101,99,107,97,98, +108,101,62,49,60,47,99,104,101,99,107,97,98,108,101,62,10,32,32,32,32,32, +32,60,99,104,101,99,107,101,100,62,49,60,47,99,104,101,99,107,101,100,62, +10,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,60,111,98, +106,101,99,116,32,99,108,97,115,115,61,34,115,101,112,97,114,97,116,111, +114,34,47,62,10,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115, +61,34,119,120,77,101,110,117,34,32,110,97,109,101,61,34,73,68,95,77,69, +78,85,34,62,10,32,32,32,32,32,32,60,108,97,98,101,108,62,67,111,108,111, +114,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,60,111,98,106,101,99, +116,32,99,108,97,115,115,61,34,119,120,77,101,110,117,73,116,101,109,34, +32,110,97,109,101,61,34,73,68,95,83,69,76,69,67,84,65,66,76,69,95,70,73, +76,76,95,67,79,76,79,82,34,62,10,32,32,32,32,32,32,32,32,60,108,97,98,101, +108,62,80,111,105,110,116,32,67,111,108,111,114,60,47,108,97,98,101,108, +62,10,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32, +32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,77,101,110, +117,73,116,101,109,34,32,110,97,109,101,61,34,73,68,95,72,73,71,72,76,73, +71,72,84,95,67,79,76,79,82,34,62,10,32,32,32,32,32,32,32,32,60,108,97,98, +101,108,62,72,105,103,104,108,105,103,104,116,32,67,111,108,111,114,60, +47,108,97,98,101,108,62,10,32,32,32,32,32,32,60,47,111,98,106,101,99,116, +62,10,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61, +34,119,120,77,101,110,117,73,116,101,109,34,32,110,97,109,101,61,34,73, +68,95,67,65,78,86,65,83,95,66,65,67,75,71,82,79,85,78,68,95,67,79,76,79, +82,34,62,10,32,32,32,32,32,32,32,32,60,108,97,98,101,108,62,66,97,99,107, +103,114,111,117,110,100,32,67,111,108,111,114,60,47,108,97,98,101,108,62, +10,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,60,47, +111,98,106,101,99,116,62,10,32,32,32,32,60,111,98,106,101,99,116,32,99, +108,97,115,115,61,34,119,120,77,101,110,117,73,116,101,109,34,32,110,97, +109,101,61,34,73,68,95,68,73,83,80,76,65,89,95,83,84,65,84,85,83,95,66, +65,82,34,62,10,32,32,32,32,32,32,60,108,97,98,101,108,62,83,104,111,119, +32,83,116,97,116,117,115,32,66,97,114,60,47,108,97,98,101,108,62,10,32, +32,32,32,32,32,60,99,104,101,99,107,97,98,108,101,62,49,60,47,99,104,101, +99,107,97,98,108,101,62,10,32,32,32,32,32,32,60,99,104,101,99,107,101,100, +62,49,60,47,99,104,101,99,107,101,100,62,10,32,32,32,32,60,47,111,98,106, +101,99,116,62,10,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115, +115,61,34,115,101,112,97,114,97,116,111,114,34,47,62,10,32,32,32,32,60, +111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,77,101,110,117, +73,116,101,109,34,32,110,97,109,101,61,34,73,68,95,83,65,86,69,95,83,69, +76,69,67,84,69,68,95,84,79,95,67,79,76,85,77,78,34,62,10,32,32,32,32,32, +32,60,108,97,98,101,108,62,83,97,118,101,32,83,101,108,101,99,116,105,111, 110,60,47,108,97,98,101,108,62,10,32,32,32,32,60,47,111,98,106,101,99,116, 62,10,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119, 120,77,101,110,117,73,116,101,109,34,32,110,97,109,101,61,34,73,68,95,67, diff --git a/rc/menus.xrc b/rc/menus.xrc index 66439a7c1..5dbd3276c 100644 --- a/rc/menus.xrc +++ b/rc/menus.xrc @@ -488,6 +488,9 @@ + + + From 93e14d3065f09d7046a57f36914ce97def30cd35 Mon Sep 17 00:00:00 2001 From: Xun Li Date: Fri, 29 Apr 2016 12:38:24 -0700 Subject: [PATCH 02/10] update autoupdate feature --- BuildTools/macosx/run.sh | 1 + DialogTools/AutoUpdateDlg.cpp | 181 +++++++++++++++++++++++++++++++--- DialogTools/AutoUpdateDlg.h | 6 +- version.h | 4 +- 4 files changed, 174 insertions(+), 18 deletions(-) diff --git a/BuildTools/macosx/run.sh b/BuildTools/macosx/run.sh index ccdbb3e0d..d5bc9f5fe 100755 --- a/BuildTools/macosx/run.sh +++ b/BuildTools/macosx/run.sh @@ -7,4 +7,5 @@ export FileGDB_HOME=FHOME export DYLD_LIBRARY_PATH=$GEODA_HOME/plugins:$ORACLE_HOME:$FileGDB_HOME:$DYLD_LIBRARY_PATH export GEODA_GDAL_DATA=$GEODA_HOME/../Resources/gdaldata export GEODA_OGR_DRIVER_PATH=$GEODA_HOME/../Resources/plugins +chmod +x "$GEODA_HOME/GeoDa" exec "$GEODA_HOME/GeoDa" diff --git a/DialogTools/AutoUpdateDlg.cpp b/DialogTools/AutoUpdateDlg.cpp index 7a7af7893..9f79cc8ee 100644 --- a/DialogTools/AutoUpdateDlg.cpp +++ b/DialogTools/AutoUpdateDlg.cpp @@ -20,6 +20,8 @@ #include +#include +#include #include #include #include @@ -28,6 +30,9 @@ #include #include #include +#include +#include +#include #include "stdio.h" #include @@ -35,8 +40,10 @@ #include "curl/curl.h" +#include "../version.h" #include "../logger.h" #include "../GeneralWxUtils.h" +#include "../GdaException.h" #include "AutoUpdateDlg.h" using namespace std; @@ -79,13 +86,85 @@ string ReadUrlContent(const char* url) return response; } -wxString AutoUpdate::CheckUpdate() +bool DownloadUrl(const char* url, const char* filepath) +{ + FILE* fp; + CURL* curl = curl_easy_init(); + CURLcode res; + if (curl) { + fp = fopen(filepath, "wb"); + if (fp) { + curl_easy_setopt(curl, CURLOPT_URL, url); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_to_file); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp); + curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 5L); + + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + fclose(fp); + if ( res ) { + // download error + return false; + } + return true; + } + } + return false; +} + +bool AutoUpdate::CheckUpdate() { wxString checklist = GetCheckList(); + wxStringTokenizer tokenizer(checklist, '\n'); + + if (!tokenizer.HasMoreTokens()) return false; + wxString version = tokenizer.GetNextToken(); + + wxString version_regex = "^[0-9]\\.[0-9]\\.[0-9]+$"; + wxRegEx regex; + regex.Compile(version_regex); + if (!regex.Matches(version)) { + return false; + } // get current version numbers + wxStringTokenizer ver_tokenizer(version, "."); + int update_major = wxAtoi(ver_tokenizer.GetNextToken()); + int update_minor = wxAtoi(ver_tokenizer.GetNextToken()); + int update_build = wxAtoi(ver_tokenizer.GetNextToken()); - return ""; + if (update_major < Gda::version_major) return false; + if (update_major > Gda::version_major) return true; + // update_major == version_major + if (update_minor < Gda::version_minor) return false; + if (update_minor > Gda::version_minor) return true; + // update_minor == version_minor + if (update_build > Gda::version_build) return true; + return false; +} + +wxString AutoUpdate::GetVersion(wxString checklist) +{ + wxStringTokenizer tokenizer(checklist, '\n'); + + if (!tokenizer.HasMoreTokens()) return ""; + + wxString version = tokenizer.GetNextToken(); + + return version; +} + +wxString AutoUpdate::GetUpdateUrl(wxString checklist) +{ + wxStringTokenizer tokenizer(checklist, '\n'); + + if (!tokenizer.HasMoreTokens()) return ""; + wxString version = tokenizer.GetNextToken(); + + if (!tokenizer.HasMoreTokens()) return ""; + wxString updateUrl = tokenizer.GetNextToken(); + + return updateUrl; } wxString AutoUpdate::GetCheckList() @@ -118,15 +197,18 @@ AutoUpdateDlg::AutoUpdateDlg(wxWindow* parent, LOG_MSG("Entering AutoUpdateDlg::AutoUpdateDlg(..)"); - // check update - wxString checklist = AutoUpdate::GetCheckList(); + // check update, suppose CheckUpdate() return true + checklist = AutoUpdate::GetCheckList(); + wxString version = AutoUpdate::GetVersion(checklist); + wxString url_update_description = AutoUpdate::GetUpdateUrl(checklist); + + wxString update_text = "A newer version of GeoDa is found. Do you want to update to version "; + update_text += version + "?"; - wxString url_update_description; - wxPanel* panel = new wxPanel(this); panel->SetBackgroundColour(*wxWHITE); - wxStaticText* lbl = new wxStaticText(panel, wxID_ANY, "A newer version of GeoDa is found. Do you want to update to version 1.8.4?"); + wxStaticText* lbl = new wxStaticText(panel, wxID_ANY, update_text); wxHyperlinkCtrl* whatsnew = new wxHyperlinkCtrl(panel, wxID_ANY, "Check what's new in this update.", url_update_description); prg_bar = new wxGauge(panel, wxID_ANY, 100); @@ -140,11 +222,11 @@ AutoUpdateDlg::AutoUpdateDlg(wxWindow* parent, lbl_box->Add(prg_bar, 1, wxEXPAND |wxALL, 10); - wxButton* btn_save_dummy = new wxButton(panel, wxID_ANY, "Cancel"); - wxButton* btn_apply = new wxButton(panel, wxID_ANY, "Update"); + wxButton* btn_cancel= new wxButton(panel, wxID_ANY, "Cancel"); + wxButton* btn_update= new wxButton(panel, wxID_ANY, "Update"); wxBoxSizer* btn_box = new wxBoxSizer(wxHORIZONTAL); - btn_box->Add(btn_save_dummy, 1, wxALIGN_CENTER |wxEXPAND| wxALL, 10); - btn_box->Add(btn_apply, 1, wxALIGN_CENTER | wxEXPAND | wxALL, 10); + btn_box->Add(btn_cancel, 1, wxALIGN_CENTER |wxEXPAND| wxALL, 10); + btn_box->Add(btn_update, 1, wxALIGN_CENTER | wxEXPAND | wxALL, 10); wxBoxSizer* box = new wxBoxSizer(wxVERTICAL); box->Add(lbl_box, 0, wxALIGN_TOP | wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 10); @@ -160,17 +242,88 @@ AutoUpdateDlg::AutoUpdateDlg(wxWindow* parent, SetParent(parent); SetPosition(pos); Centre(); + + btn_update->Connect(wxEVT_BUTTON, wxCommandEventHandler(AutoUpdateDlg::OnOkClick), NULL, this); + btn_cancel->Connect(wxEVT_BUTTON, wxCommandEventHandler(AutoUpdateDlg::OnCancelClick), NULL, this); + LOG_MSG("Exiting AutoUpdateDlg::AutoUpdateDlg(..)"); } void AutoUpdateDlg::OnOkClick( wxCommandEvent& event ) { + bool success = false; + // read the file line by line - // download the file - // replace the old file + std::queue lines; + wxStringTokenizer tokenizer(checklist, '\n'); + while ( tokenizer.HasMoreTokens() ) + { + wxString token = tokenizer.GetNextToken(); + lines.push(token); + } + + int n = (int)lines.size(); + + if (n > 1 && (n-1) % 3 == 0) { + lines.pop(); // version + + wxString exePath = wxStandardPaths::Get().GetExecutablePath(); + wxFileName exeFile(exePath); + wxString exeDir = exeFile.GetPathWithSep(); + + try { + while (lines.size() >= 3) { + // download the file, check the file + wxString file_name = lines.front(); + lines.pop(); + wxString file_url = lines.front(); + lines.pop(); + wxString file_size = lines.front(); + lines.pop(); + + file_name = exeDir + file_name; + wxString update_file_name = file_name + ".update"; + wxString backup_file_name = file_name + ".backup"; + int size = wxAtoi(file_size); + + + if (DownloadUrl(file_url.mb_str(), update_file_name.mb_str())){ + // check file size + wxFileName updateFile(update_file_name); + wxULongLong update_size = updateFile.GetSize(); + + if (update_size != size ) + throw GdaException(""); + + // replace the old file + wxRenameFile(file_name, backup_file_name); + wxRename(update_file_name, file_name); + + success = true; + } + } + } catch(...) { + // raise warning message + success = false; + } + } - EndDialog(wxID_OK); + if (success) { + wxMessageDialog msgDlg(this, + "Please restart GeoDa to finish installing updates.", + "Update GeoDa completed", + wxOK |wxICON_INFORMATION); + msgDlg.ShowModal(); + EndDialog(wxID_OK); + } else { + // raise warning message + wxMessageDialog msgDlg(this, + "Please check your network connection, or contact GeoDa support team.", + "Update GeoDa failed", + wxOK |wxICON_ERROR); + msgDlg.ShowModal(); + } } void AutoUpdateDlg::OnCancelClick( wxCommandEvent& event ) diff --git a/DialogTools/AutoUpdateDlg.h b/DialogTools/AutoUpdateDlg.h index 21a240406..018388f47 100644 --- a/DialogTools/AutoUpdateDlg.h +++ b/DialogTools/AutoUpdateDlg.h @@ -30,9 +30,11 @@ namespace AutoUpdate { - wxString CheckUpdate(); + bool CheckUpdate(); wxString GetCheckList(); + wxString GetVersion(wxString checklist); + wxString GetUpdateUrl(wxString checklist); } class AutoUpdateDlg: public wxDialog @@ -45,7 +47,7 @@ class AutoUpdateDlg: public wxDialog const wxSize& size = wxSize(500,220)); private: - + wxString checklist; wxGauge* prg_bar; void OnOkClick( wxCommandEvent& event ); diff --git a/version.h b/version.h index 25467927d..ec54c622f 100644 --- a/version.h +++ b/version.h @@ -1,10 +1,10 @@ namespace Gda { const int version_major = 1; const int version_minor = 8; - const int version_build = 2; + const int version_build = 4; const int version_year = 2016; const int version_month = 4; - const int version_day = 26; + const int version_day = 29; const int version_night = 0; const int version_type = 1; // 0: alpha, 1: beta, 2: release } From bcbd382d9ccfd0de78f1f6dcc104886d4d11c516 Mon Sep 17 00:00:00 2001 From: Xun Li Date: Fri, 29 Apr 2016 15:35:17 -0700 Subject: [PATCH 03/10] update autoUpdate feature --- DialogTools/AutoUpdateDlg.cpp | 51 ++++++++++++++++++++++++----------- DialogTools/AutoUpdateDlg.h | 6 ++++- GeoDa.cpp | 44 +++++++++++++++++++++++++----- GeoDa.h | 4 +++ version.h | 2 +- 5 files changed, 82 insertions(+), 25 deletions(-) diff --git a/DialogTools/AutoUpdateDlg.cpp b/DialogTools/AutoUpdateDlg.cpp index 9f79cc8ee..cfd029aa9 100644 --- a/DialogTools/AutoUpdateDlg.cpp +++ b/DialogTools/AutoUpdateDlg.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include "stdio.h" #include @@ -78,6 +79,7 @@ string ReadUrlContent(const char* url) curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_to_string); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response); + //curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 1L); res = curl_easy_perform(curl); curl_easy_cleanup(curl); @@ -112,19 +114,20 @@ bool DownloadUrl(const char* url, const char* filepath) return false; } -bool AutoUpdate::CheckUpdate() +// return Version or empty string +wxString AutoUpdate::CheckUpdate() { wxString checklist = GetCheckList(); wxStringTokenizer tokenizer(checklist, '\n'); - if (!tokenizer.HasMoreTokens()) return false; + if (!tokenizer.HasMoreTokens()) return ""; wxString version = tokenizer.GetNextToken(); wxString version_regex = "^[0-9]\\.[0-9]\\.[0-9]+$"; wxRegEx regex; regex.Compile(version_regex); if (!regex.Matches(version)) { - return false; + return ""; } // get current version numbers @@ -133,14 +136,14 @@ bool AutoUpdate::CheckUpdate() int update_minor = wxAtoi(ver_tokenizer.GetNextToken()); int update_build = wxAtoi(ver_tokenizer.GetNextToken()); - if (update_major < Gda::version_major) return false; - if (update_major > Gda::version_major) return true; + if (update_major < Gda::version_major) return ""; + if (update_major > Gda::version_major) return version; // update_major == version_major - if (update_minor < Gda::version_minor) return false; - if (update_minor > Gda::version_minor) return true; + if (update_minor < Gda::version_minor) return ""; + if (update_minor > Gda::version_minor) return version; // update_minor == version_minor - if (update_build > Gda::version_build) return true; - return false; + if (update_build > Gda::version_build) return version; + return ""; } wxString AutoUpdate::GetVersion(wxString checklist) @@ -199,7 +202,7 @@ AutoUpdateDlg::AutoUpdateDlg(wxWindow* parent, // check update, suppose CheckUpdate() return true checklist = AutoUpdate::GetCheckList(); - wxString version = AutoUpdate::GetVersion(checklist); + version = AutoUpdate::GetVersion(checklist); wxString url_update_description = AutoUpdate::GetUpdateUrl(checklist); wxString update_text = "A newer version of GeoDa is found. Do you want to update to version "; @@ -213,7 +216,6 @@ AutoUpdateDlg::AutoUpdateDlg(wxWindow* parent, prg_bar = new wxGauge(panel, wxID_ANY, 100); - prg_bar->Hide(); wxBoxSizer* lbl_box = new wxBoxSizer(wxVERTICAL); lbl_box->AddSpacer(20); @@ -223,9 +225,11 @@ AutoUpdateDlg::AutoUpdateDlg(wxWindow* parent, wxButton* btn_cancel= new wxButton(panel, wxID_ANY, "Cancel"); + wxButton* btn_skip = new wxButton(panel, wxID_ANY, "Skip"); wxButton* btn_update= new wxButton(panel, wxID_ANY, "Update"); wxBoxSizer* btn_box = new wxBoxSizer(wxHORIZONTAL); btn_box->Add(btn_cancel, 1, wxALIGN_CENTER |wxEXPAND| wxALL, 10); + btn_box->Add(btn_skip, 1, wxALIGN_CENTER | wxEXPAND | wxALL, 10); btn_box->Add(btn_update, 1, wxALIGN_CENTER | wxEXPAND | wxALL, 10); wxBoxSizer* box = new wxBoxSizer(wxVERTICAL); @@ -243,7 +247,10 @@ AutoUpdateDlg::AutoUpdateDlg(wxWindow* parent, SetPosition(pos); Centre(); + prg_bar->Hide(); + btn_update->Connect(wxEVT_BUTTON, wxCommandEventHandler(AutoUpdateDlg::OnOkClick), NULL, this); + btn_skip->Connect(wxEVT_BUTTON, wxCommandEventHandler(AutoUpdateDlg::OnSkipClick), NULL, this); btn_cancel->Connect(wxEVT_BUTTON, wxCommandEventHandler(AutoUpdateDlg::OnCancelClick), NULL, this); LOG_MSG("Exiting AutoUpdateDlg::AutoUpdateDlg(..)"); @@ -264,14 +271,18 @@ void AutoUpdateDlg::OnOkClick( wxCommandEvent& event ) } int n = (int)lines.size(); - + int jobs = (n-1) / 3 + 1; + wxProgressDialog progressDlg("", "Downloading updates...", + jobs, this, wxPD_APP_MODAL | wxPD_AUTO_HIDE); + progressDlg.Update(1); if (n > 1 && (n-1) % 3 == 0) { lines.pop(); // version wxString exePath = wxStandardPaths::Get().GetExecutablePath(); wxFileName exeFile(exePath); wxString exeDir = exeFile.GetPathWithSep(); - + + int current_job = 2; try { while (lines.size() >= 3) { // download the file, check the file @@ -302,13 +313,14 @@ void AutoUpdateDlg::OnOkClick( wxCommandEvent& event ) success = true; } + progressDlg.Update(current_job++); } } catch(...) { // raise warning message success = false; } } - + if (success) { wxMessageDialog msgDlg(this, "Please restart GeoDa to finish installing updates.", @@ -328,7 +340,14 @@ void AutoUpdateDlg::OnOkClick( wxCommandEvent& event ) void AutoUpdateDlg::OnCancelClick( wxCommandEvent& event ) { - - EndDialog(wxID_CANCEL); +} + +void AutoUpdateDlg::OnSkipClick( wxCommandEvent& event ) +{ + EndDialog(wxID_NO); +} +wxString AutoUpdateDlg::GetVersion() +{ + return version; } \ No newline at end of file diff --git a/DialogTools/AutoUpdateDlg.h b/DialogTools/AutoUpdateDlg.h index 018388f47..174bb58ee 100644 --- a/DialogTools/AutoUpdateDlg.h +++ b/DialogTools/AutoUpdateDlg.h @@ -30,7 +30,7 @@ namespace AutoUpdate { - bool CheckUpdate(); + wxString CheckUpdate(); wxString GetCheckList(); wxString GetVersion(wxString checklist); @@ -46,11 +46,15 @@ class AutoUpdateDlg: public wxDialog const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(500,220)); + wxString GetVersion(); + private: wxString checklist; wxGauge* prg_bar; + wxString version; void OnOkClick( wxCommandEvent& event ); + void OnSkipClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event ); }; diff --git a/GeoDa.cpp b/GeoDa.cpp index 7b70436dd..1d1e2cf56 100644 --- a/GeoDa.cpp +++ b/GeoDa.cpp @@ -27,6 +27,8 @@ #include #include +#include +#include #include #include @@ -198,6 +200,7 @@ bool GdaApp::OnInit(void) if (!wxApp::OnInit()) return false; + // initialize OGR connection OGRDataAdapter::GetInstance(); if (!GeneralWxUtils::isMac()) { @@ -1409,7 +1412,6 @@ GdaFrame::GdaFrame(const wxString& title, const wxPoint& pos, } //exp_menu->AppendSubMenu(html_menu, GdaConst::html_submenu_title); } - wxObject* tb_obj = wxXmlResource::Get()->LoadObject(this, "ToolBar", "wxAuiToolBar"); wxAuiToolBar* tb1 = (wxAuiToolBar*)tb_obj; @@ -1418,19 +1420,18 @@ GdaFrame::GdaFrame(const wxString& title, const wxPoint& pos, tb1->Realize(); tb1->Connect(wxEVT_SIZE, wxSizeEventHandler(GdaFrame::OnSize), NULL, this); - toolbar_list.push_front(tb1); - gda_frame = this; - - SetMenusToDefault(); UpdateToolbarAndMenus(); SetEncodingCheckmarks(wxFONTENCODING_UTF8); + // check update in a new thread + CallAfter(&GdaFrame::CheckUpdate); + LOG_MSG("Exiting GdaFrame::GdaFrame"); } @@ -1441,6 +1442,26 @@ GdaFrame::~GdaFrame() LOG_MSG("Exiting GdaFrame::~GdaFrame()"); } +void GdaFrame::CheckUpdate() +{ + wxString version = AutoUpdate::CheckUpdate(); + if (!version.IsEmpty()) { + wxString skip_version; + std::vector items = OGRDataAdapter::GetInstance().GetHistory("no_update_version"); + if (items.size()>0) + skip_version = items[0]; + + if (skip_version == version) + return; + + AutoUpdateDlg updateDlg(NULL); + if (updateDlg.ShowModal() == wxID_NO) { + OGRDataAdapter::GetInstance().AddEntry("no_update_version", + std::string(version.mb_str())); + } + } +} + void GdaFrame::OnSize(wxSizeEvent& event) { BOOST_FOREACH( wxAuiToolBar* tb, toolbar_list ) { @@ -5643,8 +5664,17 @@ void GdaFrame::OnDisplayStatusBar(wxCommandEvent& event) void GdaFrame::OnCheckUpdates(wxCommandEvent& WXUNUSED(event) ) { - AutoUpdateDlg dlg(this); - dlg.ShowModal(); + wxString version = AutoUpdate::CheckUpdate(); + if (!version.IsEmpty()) { + AutoUpdateDlg dlg(this); + dlg.ShowModal(); + } else { + wxMessageDialog msgDlg(this, + "Your GeoDa is already up-to-date.", + "No update required", + wxOK |wxICON_INFORMATION); + msgDlg.ShowModal(); + } } void GdaFrame::OnHelpAbout(wxCommandEvent& WXUNUSED(event) ) diff --git a/GeoDa.h b/GeoDa.h index 9dfcb8905..3f6f87ccb 100644 --- a/GeoDa.h +++ b/GeoDa.h @@ -63,6 +63,7 @@ class GdaApp: public wxApp virtual void MacOpenFiles(const wxArrayString& fileNames); static const wxCmdLineEntryDesc globalCmdLineDesc[]; + private: wxString cmd_line_proj_file_name; wxSingleInstanceChecker* checker; @@ -672,9 +673,12 @@ class GdaFrame: public wxFrame static int sqlite3_GetHtmlMenuItemsCB(void *data, int argc, char **argv, char **azColName); + void CheckUpdate(); private: static void SetProjectOpen(bool open); + + bool hasUpdate; static GdaFrame* gda_frame; static Project* project_p; diff --git a/version.h b/version.h index ec54c622f..464d01a1b 100644 --- a/version.h +++ b/version.h @@ -1,7 +1,7 @@ namespace Gda { const int version_major = 1; const int version_minor = 8; - const int version_build = 4; + const int version_build = 3; const int version_year = 2016; const int version_month = 4; const int version_day = 29; From 68cc43378eb63665353cd1b7ba2b96f649ffc4f8 Mon Sep 17 00:00:00 2001 From: Xun Li Date: Fri, 29 Apr 2016 15:45:14 -0700 Subject: [PATCH 04/10] Add Skip to AutoUpdate --- DialogTools/AutoUpdateDlg.cpp | 12 ++++++++---- DialogTools/AutoUpdateDlg.h | 2 +- GeoDa.cpp | 10 +++++++--- rc/dialogs.xrc | 4 ++-- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/DialogTools/AutoUpdateDlg.cpp b/DialogTools/AutoUpdateDlg.cpp index cfd029aa9..07c38247f 100644 --- a/DialogTools/AutoUpdateDlg.cpp +++ b/DialogTools/AutoUpdateDlg.cpp @@ -191,6 +191,7 @@ wxString AutoUpdate::GetCheckList() } AutoUpdateDlg::AutoUpdateDlg(wxWindow* parent, + bool showSkip, wxWindowID id, const wxString& title, const wxPoint& pos, @@ -223,13 +224,17 @@ AutoUpdateDlg::AutoUpdateDlg(wxWindow* parent, lbl_box->Add(whatsnew, 1, wxALIGN_LEFT | wxEXPAND |wxALL, 10); lbl_box->Add(prg_bar, 1, wxEXPAND |wxALL, 10); - + wxButton* btn_skip = NULL; wxButton* btn_cancel= new wxButton(panel, wxID_ANY, "Cancel"); - wxButton* btn_skip = new wxButton(panel, wxID_ANY, "Skip"); + if (showSkip) + btn_skip = new wxButton(panel, wxID_ANY, "Skip"); wxButton* btn_update= new wxButton(panel, wxID_ANY, "Update"); wxBoxSizer* btn_box = new wxBoxSizer(wxHORIZONTAL); btn_box->Add(btn_cancel, 1, wxALIGN_CENTER |wxEXPAND| wxALL, 10); - btn_box->Add(btn_skip, 1, wxALIGN_CENTER | wxEXPAND | wxALL, 10); + if (showSkip) { + btn_box->Add(btn_skip, 1, wxALIGN_CENTER | wxEXPAND | wxALL, 10); + btn_skip->Connect(wxEVT_BUTTON, wxCommandEventHandler(AutoUpdateDlg::OnSkipClick), NULL, this); + } btn_box->Add(btn_update, 1, wxALIGN_CENTER | wxEXPAND | wxALL, 10); wxBoxSizer* box = new wxBoxSizer(wxVERTICAL); @@ -250,7 +255,6 @@ AutoUpdateDlg::AutoUpdateDlg(wxWindow* parent, prg_bar->Hide(); btn_update->Connect(wxEVT_BUTTON, wxCommandEventHandler(AutoUpdateDlg::OnOkClick), NULL, this); - btn_skip->Connect(wxEVT_BUTTON, wxCommandEventHandler(AutoUpdateDlg::OnSkipClick), NULL, this); btn_cancel->Connect(wxEVT_BUTTON, wxCommandEventHandler(AutoUpdateDlg::OnCancelClick), NULL, this); LOG_MSG("Exiting AutoUpdateDlg::AutoUpdateDlg(..)"); diff --git a/DialogTools/AutoUpdateDlg.h b/DialogTools/AutoUpdateDlg.h index 174bb58ee..a9b4aa3e0 100644 --- a/DialogTools/AutoUpdateDlg.h +++ b/DialogTools/AutoUpdateDlg.h @@ -40,7 +40,7 @@ namespace AutoUpdate { class AutoUpdateDlg: public wxDialog { public: - AutoUpdateDlg(wxWindow* parent, + AutoUpdateDlg(wxWindow* parent, bool showSkip = false, wxWindowID id = wxID_ANY, const wxString& title = "GeoDa Update Dialog", const wxPoint& pos = wxDefaultPosition, diff --git a/GeoDa.cpp b/GeoDa.cpp index 1d1e2cf56..5c3350cda 100644 --- a/GeoDa.cpp +++ b/GeoDa.cpp @@ -1453,8 +1453,9 @@ void GdaFrame::CheckUpdate() if (skip_version == version) return; - - AutoUpdateDlg updateDlg(NULL); + + bool showSkip = true; + AutoUpdateDlg updateDlg(NULL, showSkip); if (updateDlg.ShowModal() == wxID_NO) { OGRDataAdapter::GetInstance().AddEntry("no_update_version", std::string(version.mb_str())); @@ -5735,7 +5736,10 @@ void GdaFrame::OnHelpAbout(wxCommandEvent& WXUNUSED(event) ) } vl_s << " " << Gda::version_year; if (vl) vl->SetLabelText(vl_s); - + + wxButton* btn_update = dynamic_cast(wxWindow::FindWindowById(XRCID("ID_CHECKUPDATES"), &dlg)); + + btn_update->Connect(wxEVT_BUTTON, wxCommandEventHandler(GdaFrame::OnCheckUpdates), NULL, this); dlg.ShowModal(); } diff --git a/rc/dialogs.xrc b/rc/dialogs.xrc index 13dac2650..b53b8bd96 100644 --- a/rc/dialogs.xrc +++ b/rc/dialogs.xrc @@ -801,8 +801,8 @@ 10,2d - - + + wxHORIZONTAL From 1bc90bd36a78a563f68d79605a6a10f2eaf6e74c Mon Sep 17 00:00:00 2001 From: Xun Li Date: Fri, 29 Apr 2016 16:32:08 -0700 Subject: [PATCH 05/10] update autoUpdate feature for windows --- BuildTools/windows/GeoDa.vcxproj | 6 ++++-- BuildTools/windows/GeoDa.vcxproj.filters | 6 ++++++ BuildTools/windows/installer/32bit/GeoDa.iss | 3 +++ BuildTools/windows/installer/64bit/GeoDa.iss | 2 ++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/BuildTools/windows/GeoDa.vcxproj b/BuildTools/windows/GeoDa.vcxproj index 05a8343cf..6e37531c5 100644 --- a/BuildTools/windows/GeoDa.vcxproj +++ b/BuildTools/windows/GeoDa.vcxproj @@ -135,7 +135,7 @@ C:\OSGeo4W\include;temp\boost_1_57_0;temp\wxWidgets-3.0.2\include;temp\wxWidgets-3.0.2\lib\vc_dll\mswu;temp\json_spirit_v4.08;%(AdditionalIncludeDirectories) - WIN32;DEBUG;_WINDOWS;__WXMSW__;__NO_VC_CRTDBG__;WXUSINGDLL;UNICODE;%(PreprocessorDefinitions) + WIN32;_WINDOWS;__WXMSW__;__NO_VC_CRTDBG__;WXUSINGDLL;UNICODE;%(PreprocessorDefinitions) MultiThreadedDLL @@ -162,7 +162,7 @@ C:\OSGeo4W\include;temp\boost_1_57_0;temp\wxWidgets-3.0.2\include;temp\wxWidgets-3.0.2\lib\vc_x64_dll\mswu;temp\json_spirit_v4.08;%(AdditionalIncludeDirectories) - WIN32;DEBUG;_WINDOWS;__WXMSW__;__NO_VC_CRTDBG__;WXUSINGDLL;UNICODE;%(PreprocessorDefinitions) + WIN32;_WINDOWS;__WXMSW__;__NO_VC_CRTDBG__;WXUSINGDLL;UNICODE;%(PreprocessorDefinitions) MultiThreadedDLL @@ -203,6 +203,7 @@ + @@ -267,6 +268,7 @@ + diff --git a/BuildTools/windows/GeoDa.vcxproj.filters b/BuildTools/windows/GeoDa.vcxproj.filters index a404432ab..86c17239f 100644 --- a/BuildTools/windows/GeoDa.vcxproj.filters +++ b/BuildTools/windows/GeoDa.vcxproj.filters @@ -618,6 +618,9 @@ DialogTools + + DialogTools + @@ -1127,5 +1130,8 @@ DialogTools + + DialogTools + \ No newline at end of file diff --git a/BuildTools/windows/installer/32bit/GeoDa.iss b/BuildTools/windows/installer/32bit/GeoDa.iss index 440834216..e4d40686a 100644 --- a/BuildTools/windows/installer/32bit/GeoDa.iss +++ b/BuildTools/windows/installer/32bit/GeoDa.iss @@ -84,6 +84,9 @@ Root: "HKCU"; Subkey: "Software\Microsoft\Internet Explorer\Main\FeatureControl\ ;Local Machine Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION"; ValueType: dword; ValueName: "GeoDa.exe"; ValueData: "$2AF9" +;run as admin +Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\"; ValueType: String; ValueName: "{app}\GeoDa.exe"; ValueData: "RUNASADMIN"; Flags: uninsdeletekeyifempty uninsdeletevalue; MinVersion: 0,6.1 + [Code] function IsX64: Boolean; begin diff --git a/BuildTools/windows/installer/64bit/GeoDa.iss b/BuildTools/windows/installer/64bit/GeoDa.iss index 3ea596b12..be91b3dd7 100644 --- a/BuildTools/windows/installer/64bit/GeoDa.iss +++ b/BuildTools/windows/installer/64bit/GeoDa.iss @@ -98,6 +98,8 @@ Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\ ;64 Bit Mode Root: "HKLM"; Subkey: "SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION"; ValueType: dword; ValueName: "GeoDa.exe"; ValueData: "$2AF9"; Check: IsWin64 +;run as admin +Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\"; ValueType: String; ValueName: "{app}\GeoDa.exe"; ValueData: "RUNASADMIN"; Flags: uninsdeletekeyifempty uninsdeletevalue; MinVersion: 0,6.1 [Code] function IsX64: Boolean; From 5940e9e94be0e93ff3b6c5b637f9cdd8f8b24709 Mon Sep 17 00:00:00 2001 From: Xun Li Date: Fri, 29 Apr 2016 16:32:40 -0700 Subject: [PATCH 06/10] remove clean button;update autoUpdate --- DialogTools/AutoUpdateDlg.cpp | 5 +- rc/GdaAppResources.cpp | 88 +++++++++++++++++------------------ 2 files changed, 47 insertions(+), 46 deletions(-) diff --git a/DialogTools/AutoUpdateDlg.cpp b/DialogTools/AutoUpdateDlg.cpp index 07c38247f..f439b2b96 100644 --- a/DialogTools/AutoUpdateDlg.cpp +++ b/DialogTools/AutoUpdateDlg.cpp @@ -275,12 +275,13 @@ void AutoUpdateDlg::OnOkClick( wxCommandEvent& event ) } int n = (int)lines.size(); - int jobs = (n-1) / 3 + 1; + int jobs = (n-2) / 3 + 1; // skip first and second lines wxProgressDialog progressDlg("", "Downloading updates...", jobs, this, wxPD_APP_MODAL | wxPD_AUTO_HIDE); progressDlg.Update(1); - if (n > 1 && (n-1) % 3 == 0) { + if (n > 2 && (n-2) % 3 == 0) { lines.pop(); // version + lines.pop(); // description page wxString exePath = wxStandardPaths::Get().GetExecutablePath(); wxFileName exeFile(exePath); diff --git a/rc/GdaAppResources.cpp b/rc/GdaAppResources.cpp index 0e1d4e9f6..66b53dbcc 100644 --- a/rc/GdaAppResources.cpp +++ b/rc/GdaAppResources.cpp @@ -1712,7 +1712,7 @@ static unsigned char xml_res_file_5[] = { 16,48,4,12,1,67,192,16,48,4,12,1,67,160,133,35,240,255,75,175,9,51,209, 227,12,205,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_6 = 334488; +static size_t xml_res_size_6 = 334491; static unsigned char xml_res_file_6[] = { 60,63,120,109,108,32,118,101,114,115,105,111,110,61,34,49,46,48,34,32,101, 110,99,111,100,105,110,103,61,34,117,116,102,45,56,34,63,62,10,60,114,101, @@ -3444,51 +3444,51 @@ static unsigned char xml_res_file_6[] = { 116,32,99,108,97,115,115,61,34,115,105,122,101,114,105,116,101,109,34,62, 10,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108, 97,115,115,61,34,119,120,66,117,116,116,111,110,34,32,110,97,109,101,61, -34,73,68,95,67,76,69,65,78,95,67,65,67,72,69,34,62,10,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,60,108,97,98,101,108,62,67,108,101,97,110,32,67, -97,99,104,101,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,32,32,32, -32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,32,32, -60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,60,111, -114,105,101,110,116,62,119,120,72,79,82,73,90,79,78,84,65,76,60,47,111, -114,105,101,110,116,62,10,32,32,32,32,32,32,32,32,60,47,111,98,106,101, -99,116,62,10,32,32,32,32,32,32,32,32,60,102,108,97,103,62,119,120,84,79, -80,124,119,120,66,79,84,84,79,77,124,119,120,65,76,73,71,78,95,67,69,78, -84,82,69,60,47,102,108,97,103,62,10,32,32,32,32,32,32,32,32,60,98,111,114, -100,101,114,62,49,53,60,47,98,111,114,100,101,114,62,10,32,32,32,32,32, -32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,60,47,111,98,106,101,99, -116,62,10,32,32,32,32,60,116,105,116,108,101,62,65,98,111,117,116,32,71, -101,111,68,97,60,47,116,105,116,108,101,62,10,32,32,32,32,60,99,101,110, -116,101,114,101,100,62,49,60,47,99,101,110,116,101,114,101,100,62,10,32, -32,32,32,60,115,116,121,108,101,62,119,120,67,65,80,84,73,79,78,124,119, -120,83,89,83,84,69,77,95,77,69,78,85,124,119,120,67,76,79,83,69,95,66,79, -88,60,47,115,116,121,108,101,62,10,32,32,60,47,111,98,106,101,99,116,62, -10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,68, -105,97,108,111,103,34,32,110,97,109,101,61,34,73,68,68,95,82,65,78,68,79, -77,73,90,65,84,73,79,78,34,32,115,117,98,99,108,97,115,115,61,34,82,97, -110,100,111,109,105,122,97,116,105,111,110,68,108,103,34,62,10,32,32,32, -32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,117,116, -116,111,110,34,32,110,97,109,101,61,34,73,68,95,67,76,79,83,69,34,62,10, -32,32,32,32,32,32,60,115,105,122,101,62,53,48,44,49,53,100,60,47,115,105, -122,101,62,10,32,32,32,32,32,32,60,112,111,115,62,52,48,48,44,55,100,60, -47,112,111,115,62,10,32,32,32,32,32,32,60,108,97,98,101,108,62,38,97,109, -112,59,67,108,111,115,101,60,47,108,97,98,101,108,62,10,32,32,32,32,60, -47,111,98,106,101,99,116,62,10,32,32,32,32,60,111,98,106,101,99,116,32, -99,108,97,115,115,61,34,119,120,66,117,116,116,111,110,34,32,110,97,109, -101,61,34,73,68,95,79,75,34,62,10,32,32,32,32,32,32,60,115,105,122,101, -62,53,48,44,49,53,100,60,47,115,105,122,101,62,10,32,32,32,32,32,32,60, -112,111,115,62,52,48,48,44,50,55,100,60,47,112,111,115,62,10,32,32,32,32, -32,32,60,108,97,98,101,108,62,38,97,109,112,59,82,117,110,60,47,108,97, -98,101,108,62,10,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32, -32,60,115,105,122,101,62,52,55,48,44,50,48,48,100,60,47,115,105,122,101, -62,10,32,32,32,32,60,116,105,116,108,101,62,82,97,110,100,111,109,105,122, -97,116,105,111,110,60,47,116,105,116,108,101,62,10,32,32,32,32,60,99,101, +34,73,68,95,67,72,69,67,75,85,80,68,65,84,69,83,34,62,10,32,32,32,32,32, +32,32,32,32,32,32,32,32,32,60,108,97,98,101,108,62,67,104,101,99,107,32, +85,112,100,97,116,101,115,60,47,108,97,98,101,108,62,10,32,32,32,32,32, +32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32, +32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,32, +32,60,111,114,105,101,110,116,62,119,120,72,79,82,73,90,79,78,84,65,76, +60,47,111,114,105,101,110,116,62,10,32,32,32,32,32,32,32,32,60,47,111,98, +106,101,99,116,62,10,32,32,32,32,32,32,32,32,60,102,108,97,103,62,119,120, +84,79,80,124,119,120,66,79,84,84,79,77,124,119,120,65,76,73,71,78,95,67, +69,78,84,82,69,60,47,102,108,97,103,62,10,32,32,32,32,32,32,32,32,60,98, +111,114,100,101,114,62,49,53,60,47,98,111,114,100,101,114,62,10,32,32,32, +32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,60,47,111,98,106, +101,99,116,62,10,32,32,32,32,60,116,105,116,108,101,62,65,98,111,117,116, +32,71,101,111,68,97,60,47,116,105,116,108,101,62,10,32,32,32,32,60,99,101, 110,116,101,114,101,100,62,49,60,47,99,101,110,116,101,114,101,100,62,10, 32,32,32,32,60,115,116,121,108,101,62,119,120,67,65,80,84,73,79,78,124, -119,120,67,76,79,83,69,95,66,79,88,60,47,115,116,121,108,101,62,10,32,32, -60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99, -108,97,115,115,61,34,119,120,68,105,97,108,111,103,34,32,110,97,109,101, -61,34,73,68,95,65,88,73,83,95,76,65,66,69,76,95,80,82,69,67,73,83,73,79, -78,95,68,76,71,34,32,115,117,98,99,108,97,115,115,61,34,65,120,105,115, +119,120,83,89,83,84,69,77,95,77,69,78,85,124,119,120,67,76,79,83,69,95, +66,79,88,60,47,115,116,121,108,101,62,10,32,32,60,47,111,98,106,101,99, +116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119, +120,68,105,97,108,111,103,34,32,110,97,109,101,61,34,73,68,68,95,82,65, +78,68,79,77,73,90,65,84,73,79,78,34,32,115,117,98,99,108,97,115,115,61, +34,82,97,110,100,111,109,105,122,97,116,105,111,110,68,108,103,34,62,10, +32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120, +66,117,116,116,111,110,34,32,110,97,109,101,61,34,73,68,95,67,76,79,83, +69,34,62,10,32,32,32,32,32,32,60,115,105,122,101,62,53,48,44,49,53,100, +60,47,115,105,122,101,62,10,32,32,32,32,32,32,60,112,111,115,62,52,48,48, +44,55,100,60,47,112,111,115,62,10,32,32,32,32,32,32,60,108,97,98,101,108, +62,38,97,109,112,59,67,108,111,115,101,60,47,108,97,98,101,108,62,10,32, +32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,60,111,98,106,101, +99,116,32,99,108,97,115,115,61,34,119,120,66,117,116,116,111,110,34,32, +110,97,109,101,61,34,73,68,95,79,75,34,62,10,32,32,32,32,32,32,60,115,105, +122,101,62,53,48,44,49,53,100,60,47,115,105,122,101,62,10,32,32,32,32,32, +32,60,112,111,115,62,52,48,48,44,50,55,100,60,47,112,111,115,62,10,32,32, +32,32,32,32,60,108,97,98,101,108,62,38,97,109,112,59,82,117,110,60,47,108, +97,98,101,108,62,10,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32, +32,32,60,115,105,122,101,62,52,55,48,44,50,48,48,100,60,47,115,105,122, +101,62,10,32,32,32,32,60,116,105,116,108,101,62,82,97,110,100,111,109,105, +122,97,116,105,111,110,60,47,116,105,116,108,101,62,10,32,32,32,32,60,99, +101,110,116,101,114,101,100,62,49,60,47,99,101,110,116,101,114,101,100, +62,10,32,32,32,32,60,115,116,121,108,101,62,119,120,67,65,80,84,73,79,78, +124,119,120,67,76,79,83,69,95,66,79,88,60,47,115,116,121,108,101,62,10, +32,32,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116, +32,99,108,97,115,115,61,34,119,120,68,105,97,108,111,103,34,32,110,97,109, +101,61,34,73,68,95,65,88,73,83,95,76,65,66,69,76,95,80,82,69,67,73,83,73, +79,78,95,68,76,71,34,32,115,117,98,99,108,97,115,115,61,34,65,120,105,115, 76,97,98,101,108,80,114,101,99,105,115,105,111,110,68,108,103,34,62,10, 32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120, 66,111,120,83,105,122,101,114,34,62,10,32,32,32,32,32,32,60,111,98,106, From d5ea6e39024d91cfcf68fdb04e772a248fe08ed5 Mon Sep 17 00:00:00 2001 From: Xun Li Date: Fri, 29 Apr 2016 16:36:36 -0700 Subject: [PATCH 07/10] update ubuntu script autoUpdate --- BuildTools/macosx/run.sh | 1 + BuildTools/ubuntu/run.sh | 2 ++ BuildTools/ubuntu/run_geoda.sh | 2 ++ 3 files changed, 5 insertions(+) diff --git a/BuildTools/macosx/run.sh b/BuildTools/macosx/run.sh index d5bc9f5fe..339f5d2a9 100755 --- a/BuildTools/macosx/run.sh +++ b/BuildTools/macosx/run.sh @@ -7,5 +7,6 @@ export FileGDB_HOME=FHOME export DYLD_LIBRARY_PATH=$GEODA_HOME/plugins:$ORACLE_HOME:$FileGDB_HOME:$DYLD_LIBRARY_PATH export GEODA_GDAL_DATA=$GEODA_HOME/../Resources/gdaldata export GEODA_OGR_DRIVER_PATH=$GEODA_HOME/../Resources/plugins +chmod +x "$GEODA_HOME/../Resources/plugins/*.so" chmod +x "$GEODA_HOME/GeoDa" exec "$GEODA_HOME/GeoDa" diff --git a/BuildTools/ubuntu/run.sh b/BuildTools/ubuntu/run.sh index b1079231c..e59fd9b79 100755 --- a/BuildTools/ubuntu/run.sh +++ b/BuildTools/ubuntu/run.sh @@ -6,4 +6,6 @@ GEODA_HOME=$(cd "$(dirname "$0")"; pwd) export LD_LIBRARY_PATH=$GEODA_HOME/plugins:$ORACLE_HOME:$LD_LIBRARY_PATH export GDAL_DATA=$GEODA_HOME/gdaldata export OGR_DRIVER_PATH=$GEODA_HOME/plugins +chmod +x "$GEODA_HOME/plugins/*.so" +chmod +x "$GEODA_HOME/GeoDa" exec "$GEODA_HOME/GeoDa" diff --git a/BuildTools/ubuntu/run_geoda.sh b/BuildTools/ubuntu/run_geoda.sh index 911628fa3..88e495f7d 100755 --- a/BuildTools/ubuntu/run_geoda.sh +++ b/BuildTools/ubuntu/run_geoda.sh @@ -6,4 +6,6 @@ GEODA_HOME=/usr/local/geoda export LD_LIBRARY_PATH=$GEODA_HOME/plugins:$ORACLE_HOME:$LD_LIBRARY_PATH export GDAL_DATA=$GEODA_HOME/gdaldata export OGR_DRIVER_PATH=$GEODA_HOME/plugins +chmod +x "$GEODA_HOME/plugins/*.so" +chmod +x "$GEODA_HOME/GeoDa" exec "$GEODA_HOME/GeoDa" From f19f85f56b6059aadaf922aa29b8b2374c4f5c9b Mon Sep 17 00:00:00 2001 From: Xun Li Date: Fri, 29 Apr 2016 17:08:29 -0700 Subject: [PATCH 08/10] enhance ticket #412 handle checklist file with or w/o wrapper --- DialogTools/AutoUpdateDlg.cpp | 31 +++++++++++++++++++++++++------ DialogTools/AutoUpdateDlg.h | 2 +- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/DialogTools/AutoUpdateDlg.cpp b/DialogTools/AutoUpdateDlg.cpp index f439b2b96..81e076c94 100644 --- a/DialogTools/AutoUpdateDlg.cpp +++ b/DialogTools/AutoUpdateDlg.cpp @@ -118,9 +118,15 @@ bool DownloadUrl(const char* url, const char* filepath) wxString AutoUpdate::CheckUpdate() { wxString checklist = GetCheckList(); - wxStringTokenizer tokenizer(checklist, '\n'); + wxStringTokenizer tokenizer; - if (!tokenizer.HasMoreTokens()) return ""; + tokenizer.SetString(checklist, "\r\n"); + if (!tokenizer.HasMoreTokens()) { + tokenizer.SetString(checklist, "\n"); + if (!tokenizer.HasMoreTokens()) { + return ""; + } + } wxString version = tokenizer.GetNextToken(); wxString version_regex = "^[0-9]\\.[0-9]\\.[0-9]+$"; @@ -148,10 +154,15 @@ wxString AutoUpdate::CheckUpdate() wxString AutoUpdate::GetVersion(wxString checklist) { - wxStringTokenizer tokenizer(checklist, '\n'); - - if (!tokenizer.HasMoreTokens()) return ""; + wxStringTokenizer tokenizer; + tokenizer.SetString(checklist, "\r\n"); + if (!tokenizer.HasMoreTokens()) { + tokenizer.SetString(checklist, "\n"); + if (!tokenizer.HasMoreTokens()) { + return ""; + } + } wxString version = tokenizer.GetNextToken(); return version; @@ -159,7 +170,15 @@ wxString AutoUpdate::GetVersion(wxString checklist) wxString AutoUpdate::GetUpdateUrl(wxString checklist) { - wxStringTokenizer tokenizer(checklist, '\n'); + wxStringTokenizer tokenizer; + + tokenizer.SetString(checklist, "\r\n"); + if (!tokenizer.HasMoreTokens()) { + tokenizer.SetString(checklist, "\n"); + if (!tokenizer.HasMoreTokens()) { + return ""; + } + } if (!tokenizer.HasMoreTokens()) return ""; wxString version = tokenizer.GetNextToken(); diff --git a/DialogTools/AutoUpdateDlg.h b/DialogTools/AutoUpdateDlg.h index a9b4aa3e0..1b6a13d77 100644 --- a/DialogTools/AutoUpdateDlg.h +++ b/DialogTools/AutoUpdateDlg.h @@ -44,7 +44,7 @@ class AutoUpdateDlg: public wxDialog wxWindowID id = wxID_ANY, const wxString& title = "GeoDa Update Dialog", const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxSize(500,220)); + const wxSize& size = wxSize(510,220)); wxString GetVersion(); From 3eff395dd31896c003fbade1f4ac0003cb37995a Mon Sep 17 00:00:00 2001 From: Xun Li Date: Fri, 29 Apr 2016 17:27:23 -0700 Subject: [PATCH 09/10] update script --- DialogTools/AutoUpdateDlg.cpp | 61 ++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/DialogTools/AutoUpdateDlg.cpp b/DialogTools/AutoUpdateDlg.cpp index 81e076c94..75cee608b 100644 --- a/DialogTools/AutoUpdateDlg.cpp +++ b/DialogTools/AutoUpdateDlg.cpp @@ -284,30 +284,39 @@ void AutoUpdateDlg::OnOkClick( wxCommandEvent& event ) { bool success = false; - // read the file line by line - std::queue lines; - wxStringTokenizer tokenizer(checklist, '\n'); - while ( tokenizer.HasMoreTokens() ) - { - wxString token = tokenizer.GetNextToken(); - lines.push(token); - } - - int n = (int)lines.size(); - int jobs = (n-2) / 3 + 1; // skip first and second lines - wxProgressDialog progressDlg("", "Downloading updates...", - jobs, this, wxPD_APP_MODAL | wxPD_AUTO_HIDE); - progressDlg.Update(1); - if (n > 2 && (n-2) % 3 == 0) { - lines.pop(); // version - lines.pop(); // description page - - wxString exePath = wxStandardPaths::Get().GetExecutablePath(); - wxFileName exeFile(exePath); - wxString exeDir = exeFile.GetPathWithSep(); + try { + // read the file line by line + std::queue lines; + + wxStringTokenizer tokenizer; - int current_job = 2; - try { + tokenizer.SetString(checklist, "\r\n"); + if (!tokenizer.HasMoreTokens()) { + tokenizer.SetString(checklist, "\n"); + if (!tokenizer.HasMoreTokens()) { + throw GdaException(""); + } + } + while ( tokenizer.HasMoreTokens() ) + { + wxString token = tokenizer.GetNextToken(); + lines.push(token); + } + + int n = (int)lines.size(); + int jobs = (n-2) / 3 + 1; // skip first and second lines + wxProgressDialog progressDlg("", "Downloading updates...", + jobs, this, wxPD_APP_MODAL | wxPD_AUTO_HIDE); + progressDlg.Update(1); + if (n > 2 && (n-2) % 3 == 0) { + lines.pop(); // version + lines.pop(); // description page + + wxString exePath = wxStandardPaths::Get().GetExecutablePath(); + wxFileName exeFile(exePath); + wxString exeDir = exeFile.GetPathWithSep(); + + int current_job = 2; while (lines.size() >= 3) { // download the file, check the file wxString file_name = lines.front(); @@ -339,10 +348,10 @@ void AutoUpdateDlg::OnOkClick( wxCommandEvent& event ) } progressDlg.Update(current_job++); } - } catch(...) { - // raise warning message - success = false; } + } catch(...) { + // raise warning message + success = false; } if (success) { From ac65e1217af6ab62481eecd95975d07163449f3a Mon Sep 17 00:00:00 2001 From: lixun910 Date: Fri, 29 Apr 2016 21:24:18 -0600 Subject: [PATCH 10/10] update autoUpdate for osx 10.6 --- .../GeoDa-leopard.xcodeproj/project.pbxproj | 6 +++ DialogTools/AutoUpdateDlg.cpp | 6 ++- DialogTools/AutoUpdateDlg.h | 2 +- GeoDamake.opt | 40 +++++++++---------- 4 files changed, 30 insertions(+), 24 deletions(-) diff --git a/BuildTools/macosx/GeoDa-leopard.xcodeproj/project.pbxproj b/BuildTools/macosx/GeoDa-leopard.xcodeproj/project.pbxproj index b4a995ba1..e7a9ad2c6 100644 --- a/BuildTools/macosx/GeoDa-leopard.xcodeproj/project.pbxproj +++ b/BuildTools/macosx/GeoDa-leopard.xcodeproj/project.pbxproj @@ -16,6 +16,7 @@ A14CB4661C866E110082B436 /* BasemapConfDlg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A14CB4631C866E110082B436 /* BasemapConfDlg.cpp */; }; A14CB46E1C86705B0082B436 /* PublishDlg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A14CB46C1C86705B0082B436 /* PublishDlg.cpp */; }; A16BA470183D626200D3B7DA /* DatasourceDlg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A16BA46E183D626200D3B7DA /* DatasourceDlg.cpp */; }; + A16D406E1CD4233A0025C64C /* AutoUpdateDlg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A16D406C1CD4233A0025C64C /* AutoUpdateDlg.cpp */; }; A186F0A11C16508A00AEBA13 /* GdaCartoDB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A186F09F1C16508A00AEBA13 /* GdaCartoDB.cpp */; }; A19F51501756A11E006E31B4 /* plugins in Resources */ = {isa = PBXBuildFile; fileRef = A19F514D1756A11E006E31B4 /* plugins */; }; A1B04ADD1B1921710045AA6F /* basemap_cache in CopyFiles */ = {isa = PBXBuildFile; fileRef = A1B04ADC1B1921710045AA6F /* basemap_cache */; }; @@ -239,6 +240,8 @@ A14CB46D1C86705B0082B436 /* PublishDlg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PublishDlg.h; sourceTree = ""; }; A16BA46E183D626200D3B7DA /* DatasourceDlg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DatasourceDlg.cpp; sourceTree = ""; }; A16BA46F183D626200D3B7DA /* DatasourceDlg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatasourceDlg.h; sourceTree = ""; }; + A16D406C1CD4233A0025C64C /* AutoUpdateDlg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AutoUpdateDlg.cpp; sourceTree = ""; }; + A16D406D1CD4233A0025C64C /* AutoUpdateDlg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoUpdateDlg.h; sourceTree = ""; }; A171FBFE1792332A000DD5A0 /* GdaException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GdaException.h; sourceTree = ""; }; A17336821C06917B00579354 /* WeightsManInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WeightsManInterface.h; path = VarCalc/WeightsManInterface.h; sourceTree = ""; }; A186F09F1C16508A00AEBA13 /* GdaCartoDB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GdaCartoDB.cpp; sourceTree = ""; }; @@ -743,6 +746,8 @@ DD7974FE0F1D296F00496A84 /* DialogTools */ = { isa = PBXGroup; children = ( + A16D406C1CD4233A0025C64C /* AutoUpdateDlg.cpp */, + A16D406D1CD4233A0025C64C /* AutoUpdateDlg.h */, A14CB46C1C86705B0082B436 /* PublishDlg.cpp */, A14CB46D1C86705B0082B436 /* PublishDlg.h */, A14CB4611C866E110082B436 /* AdjustYAxisDlg.cpp */, @@ -1405,6 +1410,7 @@ A14CB4651C866E110082B436 /* AdjustYAxisDlg.cpp in Sources */, A14CB4661C866E110082B436 /* BasemapConfDlg.cpp in Sources */, A14CB46E1C86705B0082B436 /* PublishDlg.cpp in Sources */, + A16D406E1CD4233A0025C64C /* AutoUpdateDlg.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/DialogTools/AutoUpdateDlg.cpp b/DialogTools/AutoUpdateDlg.cpp index 75cee608b..01afeea64 100644 --- a/DialogTools/AutoUpdateDlg.cpp +++ b/DialogTools/AutoUpdateDlg.cpp @@ -225,8 +225,10 @@ AutoUpdateDlg::AutoUpdateDlg(wxWindow* parent, version = AutoUpdate::GetVersion(checklist); wxString url_update_description = AutoUpdate::GetUpdateUrl(checklist); - wxString update_text = "A newer version of GeoDa is found. Do you want to update to version "; - update_text += version + "?"; + wxString update_text; + update_text << "A newer version of GeoDa is found. Do you want to update to version "; + update_text << version; + update_text << "?"; wxPanel* panel = new wxPanel(this); panel->SetBackgroundColour(*wxWHITE); diff --git a/DialogTools/AutoUpdateDlg.h b/DialogTools/AutoUpdateDlg.h index 1b6a13d77..730e39cc4 100644 --- a/DialogTools/AutoUpdateDlg.h +++ b/DialogTools/AutoUpdateDlg.h @@ -44,7 +44,7 @@ class AutoUpdateDlg: public wxDialog wxWindowID id = wxID_ANY, const wxString& title = "GeoDa Update Dialog", const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxSize(510,220)); + const wxSize& size = wxSize(580,220)); wxString GetVersion(); diff --git a/GeoDamake.opt b/GeoDamake.opt index d238de47c..abeb5ac73 100644 --- a/GeoDamake.opt +++ b/GeoDamake.opt @@ -2,35 +2,33 @@ GeoDa_ROOT = $(GEODA_HOME)/../.. TARGET = GeoDa -CC = /usr/bin/gcc -CXX = /usr/bin/g++ -LD = /usr/bin/g++ +CC = gcc +CXX = g++ -Os -arch x86_64 +LD = g++ -arch x86_64 RM = /bin/rm -f -WXLIBS = $(shell $(GEODA_HOME)/libraries/bin/wx-config --libs xrc,stc,richtext,ribbon,propgrid,aui,gl,html,webview,qa,adv,core,xml,net,base) +WXLIBS = $(shell $(GEODA_HOME)/libraries/bin/wx-config --libs xrc,stc,richtext,ribbon,propgrid,aui,gl,html,qa,adv,core,webview,xml,net,base) WX_HEADER = $(shell $(GEODA_HOME)/libraries/bin/wx-config --cppflags) -LIBS = $(WXLIBS) \ - $(GEODA_HOME)/temp/CLAPACK-3.2.1/lapack.a \ - $(GEODA_HOME)/temp/CLAPACK-3.2.1/libf2c.a \ - $(GEODA_HOME)/temp/CLAPACK-3.2.1/blas.a \ - $(GEODA_HOME)/temp/CLAPACK-3.2.1/tmglib.a \ - $(GEODA_HOME)/libraries/include/boost/stage/lib/libboost_thread.a \ - $(GEODA_HOME)/libraries/include/boost/stage/lib/libboost_system.a \ - $(GEODA_HOME)/libraries/lib/libjson_spirit.a \ - -L$(GEODA_HOME)/libraries/lib -lgdal -lcurl -lcares \ - -L/usr/lib/x86_64-linux-gnu -lGL -lGLU -lglut -lrt -lidn -lssl -lrtmp -# Note: Library -lrtmp causes a missing library problem at runtime on -# Ubuntu 14.10 and later. +LIBS = $(WXLIBS) \ + $(GEODA_HOME)/temp/CLAPACK-3.2.1/blas.a \ + $(GEODA_HOME)/temp/CLAPACK-3.2.1/F2CLIBS/libf2c.a \ + $(GEODA_HOME)/temp/CLAPACK-3.2.1/lapack.a \ + -L/usr/lib -liconv \ + -L$(GEODA_HOME)/libraries/lib -lgdal -lcurl \ + $(GEODA_HOME)/libraries/include/boost/stage/lib/libboost_thread.a \ + $(GEODA_HOME)/libraries/include/boost/stage/lib/libboost_system.a \ + $(GEODA_HOME)/libraries/lib/libjson_spirit.a + BOOST_HEADER = -I$(GEODA_HOME)/libraries/include/boost -GDAL_HEADER = -I$(GEODA_HOME)/libraries/include -I/usr/include +GDAL_HEADER = -I$(GEODA_HOME)/libraries/include -CPPFLAGS = -I$(GeoDa_ROOT) -CFLAGS = -O2 -Wdeclaration-after-statement $(USER_DEFS) $(GDAL_HEADER) -CXXFLAGS = -O2 $(USER_DEFS) $(WX_HEADER) $(BOOST_HEADER) $(GDAL_HEADER) -LDFLAGS = +CPPFLAGS = -I$(GeoDa_ROOT) $(USER_LOG) +CFLAGS = -Os -arch x86_64 -Wall -Wdeclaration-after-statement $(USER_DEFS) $(GDAL_HEADER) +CXXFLAGS = -Os -arch x86_64 -Wall $(USER_DEFS) $(WX_HEADER) $(BOOST_HEADER) $(GDAL_HEADER) +LDFLAGS = -arch x86_64 OBJ_EXT = o