Revision: 1315
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=1315&view=rev
Author:   rorthomas
Date:     2010-04-11 11:25:06 +0000 (Sun, 11 Apr 2010)

Log Message:
-----------
added "view changelog" in the last page of the installer dialog
new way of getting the current version information

Modified Paths:
--------------
    trunk/source/installer/ConfigManager.cpp
    trunk/source/installer/ConfigManager.h
    trunk/source/installer/wizard.cpp
    trunk/source/installer/wizard.h
    trunk/source/installer/wthread.h

Modified: trunk/source/installer/ConfigManager.cpp
===================================================================
--- trunk/source/installer/ConfigManager.cpp    2010-04-10 18:22:15 UTC (rev 
1314)
+++ trunk/source/installer/ConfigManager.cpp    2010-04-11 11:25:06 UTC (rev 
1315)
@@ -62,6 +62,24 @@
        dlerror=0;
 }
 
+int ConfigManager::getCurrentVersionInfo()
+{
+       // get the most recent version information
+       WsyncDownload *wsdl = new WsyncDownload();
+       std::vector< std::vector< std::string > > list;
+       int res = wsdl->downloadConfigFile(WSYNC_MAIN_SERVER, 
WSYNC_VERSION_INFO, list);
+       delete(wsdl);
+       if(!res && list.size()>0 && list[0].size()>0)
+       {
+               currVersion = list[0][0];
+               return 0;
+       } else
+       {
+               currVersion = std::string();
+       }
+       return 1;
+}
+
 int ConfigManager::writeVersionInfo()
 {
        wxString fn = getInstallationPath() + wxT("\\version");
@@ -114,8 +132,9 @@
                                s.platform  = conv(olist[i]["platform"]);
                                s.path      = conv(olist[i]["path"]);
 
-                               if(olist[i]["version"].size() > 0 && 
currVersion.empty())
-                                       currVersion = olist[i]["version"];
+                               // OLD version of getting the version, now 
obsolete
+                               //if(olist[i]["version"].size() > 0 && 
currVersion.empty())
+                               //      currVersion = olist[i]["version"];
 
                                s.icon      = 
(olist[i]["type"]=="0")?wxBitmap(mainpack_xpm):wxBitmap(extrapack_xpm);
                                s.checked   = (olist[i]["checked"] == "1");
@@ -616,6 +635,12 @@
        executeBinary(wxT("keysheet.pdf"), wxT("open"));
 }
 
+void ConfigManager::viewChangelog()
+{
+       wxString changeLogURL = 
wxT("http://wiki.rigsofrods.com/pages/Changelog#";) + conv(currVersion);
+       wxLaunchDefaultBrowser(changeLogURL);
+}
+
 void ConfigManager::executeBinary(wxString filename, wxString action, wxString 
parameters, wxString cwDir, bool prependCWD)
 {
 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32

Modified: trunk/source/installer/ConfigManager.h
===================================================================
--- trunk/source/installer/ConfigManager.h      2010-04-10 18:22:15 UTC (rev 
1314)
+++ trunk/source/installer/ConfigManager.h      2010-04-11 11:25:06 UTC (rev 
1315)
@@ -105,11 +105,13 @@
        void installRuntime();
        void startConfigurator();
        void viewManual();
+       void viewChangelog();
        void executeBinary(wxString filename, wxString action = wxT("runas"), 
wxString parameters = wxString(), wxString cwDir = wxT("cwd"), bool 
prependCWD=true);
        int createShortcut(wxString linkTarget, wxString workingDirectory, 
wxString linkFile, wxString linkDescription);
        void createProgramLinks(bool desktop, bool startmenu);
 
        int writeVersionInfo();
+       int getCurrentVersionInfo();
 private:
        int statupMode;
        wxString installPath;

Modified: trunk/source/installer/wizard.cpp
===================================================================
--- trunk/source/installer/wizard.cpp   2010-04-10 18:22:15 UTC (rev 1314)
+++ trunk/source/installer/wizard.cpp   2010-04-11 11:25:06 UTC (rev 1315)
@@ -660,11 +660,20 @@
 
 bool StreamsPage::OnEnter(bool forward)
 {
+       int res1 = CONFIG->getCurrentVersionInfo();
+       if(res1)
+       {
+               wxMessageBox(_T("The program could not connect to the central 
Streams server in order to receive the latest version information.\nThe service 
may be temporarily unavailable, or you have no network connection."), 
_T("Network error"), wxICON_ERROR | wxOK, this);
+               exit(1);
+       }
+
        int res = CONFIG->getOnlineStreams();
        if(res)
        {
                wxMessageBox(_T("The program could not connect to the central 
Streams server.\nThe service may be temporarily unavailable, or you have no 
network connection."), _T("Network error"), wxICON_ERROR | wxOK, this);
+               exit(1);
        }
+
        wxSizerItemList::compatibility_iterator node = 
scrwsz->GetChildren().GetFirst();
        while (node)
        {
@@ -879,11 +888,14 @@
        wxGridSizer *wxg = new wxGridSizer(3, 2, 2, 5);
 
     wxStaticText *txt;
+       /*
+       // removed for now
        // download time
        txt = new wxStaticText(this, wxID_ANY, _T("Download time: "));
        wxg->Add(txt, 0, wxALL|wxEXPAND, 0);
        txt_dltime = new wxStaticText(this, wxID_ANY, _T("n/a"));
        wxg->Add(txt_dltime, 0, wxALL|wxEXPAND, 0);
+       */
 
        // download time
        txt = new wxStaticText(this, wxID_ANY, _T("Remaining time: "));
@@ -930,7 +942,7 @@
        mainSizer->Add(10, 10);
     // important to be able to load web URLs
     wxFileSystem::AddHandler( new wxInternetFSHandler );
-    htmlinfo = new HtmlWindow(this, wxID_ANY, wxDefaultPosition, wxSize(50, 
50));
+    htmlinfo = new HtmlWindow(this, wxID_ANY, wxDefaultPosition, wxSize(50, 
50), wxBORDER_NONE);
        mainSizer->Add(htmlinfo, 0, wxALL|wxEXPAND);
     htmlinfo->SetPage(_("."));
     timer = new wxTimer(this, ID_TIMER);
@@ -1144,6 +1156,10 @@
 
        chk_configurator = new wxCheckBox(this, wxID_ANY, _T("Run the 
Configurator"));
        mainSizer->Add(chk_configurator, 0, wxALL|wxALIGN_LEFT, 5);
+
+       chk_changelog = new wxCheckBox(this, wxID_ANY, _T("View the 
Changelog"));
+       mainSizer->Add(chk_changelog, 0, wxALL|wxALIGN_LEFT, 5);
+
 #else
        // TODO: add linux options
        mainSizer->Add(tst=new wxStaticText(this, wxID_ANY, _T("Thank you for 
downloading Rigs of Rods.\n")), 0, wxALL, 5);
@@ -1173,6 +1189,11 @@
        chk_configurator->SetValue(true);
        if(CONFIG->getPersistentConfig(wxT("installer.run_configurator")) == 
wxT("no"))
                chk_configurator->SetValue(false);
+
+       chk_changelog->SetValue(true);
+       if(CONFIG->getPersistentConfig(wxT("installer.view_changelog")) == 
wxT("no"))
+               chk_changelog->SetValue(false);
+       
 #endif // OGRE_PLATFORM
        return true;
 }
@@ -1185,7 +1206,9 @@
        CONFIG->setPersistentConfig(wxT("installer.create_desktop_shortcuts"), 
chk_desktop->IsChecked()?wxT("yes"):wxT("no"));
        
CONFIG->setPersistentConfig(wxT("installer.create_start_menu_shortcuts"), 
chk_startmenu->IsChecked()?wxT("yes"):wxT("no"));
        CONFIG->setPersistentConfig(wxT("installer.run_configurator"), 
chk_configurator->IsChecked()?wxT("yes"):wxT("no"));
+       CONFIG->setPersistentConfig(wxT("installer.view_changelog"), 
chk_changelog->IsChecked()?wxT("yes"):wxT("no"));
 
+       
        if(chk_desktop->IsChecked() || chk_startmenu->IsChecked())
                CONFIG->createProgramLinks(chk_desktop->IsChecked(), 
chk_startmenu->IsChecked());
 
@@ -1201,6 +1224,9 @@
        if(chk_viewmanual->IsChecked())
                CONFIG->viewManual();
 
+       if(chk_changelog->IsChecked())
+               CONFIG->viewChangelog();
+       
 #endif // OGRE_PLATFORM
        return true;
 }

Modified: trunk/source/installer/wizard.h
===================================================================
--- trunk/source/installer/wizard.h     2010-04-10 18:22:15 UTC (rev 1314)
+++ trunk/source/installer/wizard.h     2010-04-11 11:25:06 UTC (rev 1315)
@@ -193,7 +193,7 @@
 {
 protected:
        wxWizard *wizard;
-       wxCheckBox *chk_runtime, *chk_configurator, *chk_desktop, 
*chk_startmenu, *chk_viewmanual, *chk_upgrade_configs;
+       wxCheckBox *chk_runtime, *chk_configurator, *chk_desktop, 
*chk_startmenu, *chk_viewmanual, *chk_upgrade_configs, *chk_changelog;
 public:
        LastPage(wxWizard *parent);
        bool OnEnter(bool forward);

Modified: trunk/source/installer/wthread.h
===================================================================
--- trunk/source/installer/wthread.h    2010-04-10 18:22:15 UTC (rev 1314)
+++ trunk/source/installer/wthread.h    2010-04-11 11:25:06 UTC (rev 1315)
@@ -30,8 +30,9 @@
 #define API_REPOSEARCH "/reposearch/"
 #define REPO_DOWNLOAD  "/files/mirror/geoselect/"
 
-#define WSYNC_MAIN_SERVER "wsync.rigsofrods.com"
-#define WSYNC_MAIN_DIR    "/"
+#define WSYNC_MAIN_SERVER  "wsync.rigsofrods.com"
+#define WSYNC_MAIN_DIR     "/"
+#define WSYNC_VERSION_INFO "/version"
 
 #define WMO_FULL     0x00000001
 #define WMO_NODELETE 0x00000010


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Rigsofrods-devel mailing list
Rigsofrods-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to