Revision: 191
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=191&view=rev
Author:   rorthomas
Date:     2009-04-20 10:47:50 +0000 (Mon, 20 Apr 2009)

Log Message:
-----------
added update button for windows version

Modified Paths:
--------------
    trunk/build/configurator/source/configurator.cpp

Modified: trunk/build/configurator/source/configurator.cpp
===================================================================
--- trunk/build/configurator/source/configurator.cpp    2009-04-20 10:11:25 UTC 
(rev 190)
+++ trunk/build/configurator/source/configurator.cpp    2009-04-20 10:47:50 UTC 
(rev 191)
@@ -244,6 +244,7 @@
        void OnButAddKey(wxCommandEvent& event);
        void OnButDeleteKey(wxCommandEvent& event);
        void OnButClearCache(wxCommandEvent& event);
+       void OnButUpdateRoR(wxCommandEvent& event);
        void OnSimpleSliderScroll(wxScrollEvent& event);
        void OnSimpleSlider2Scroll(wxScrollEvent& event);
 
@@ -787,6 +788,7 @@
        command_delete_key,
        command_testevents,
        clear_cache,
+       update_ror,
        EVC_LANG,
        SCROLL1,
        SCROLL2,
@@ -810,6 +812,7 @@
        EVT_BUTTON(command_restore, MyDialog::OnButRestore)
        EVT_BUTTON(net_test, MyDialog::OnTestNet)
        EVT_BUTTON(clear_cache, MyDialog::OnButClearCache)
+       EVT_BUTTON(update_ror, MyDialog::OnButUpdateRoR)
        EVT_HTML_LINK_CLICKED(main_html, MyDialog::OnLinkClicked)
        //EVT_SCROLL(MyDialog::OnSightRangeScroll)
        EVT_COMMAND_SCROLL_CHANGED(SCROLL1, MyDialog::OnSimpleSliderScroll)
@@ -1628,6 +1631,11 @@
        //wxButton *clearcachebut=
        new wxButton(advancedPanel, clear_cache, _("Clear cache"), wxPoint(125, 
180));
 
+       // update button only for windows users
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+       new wxButton(advancedPanel, update_ror, _("Check for updates"), 
wxPoint(330, 280));
+#endif
+
        dText = new wxStaticText(advancedPanel, -1, _("Language:"), wxPoint(10, 
230));
 
        wxArrayString choices;
@@ -2669,6 +2677,37 @@
        SetDefaults();
 }
 
+void MyDialog::OnButUpdateRoR(wxCommandEvent& event)
+{
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+       PROCESS_INFORMATION pi;
+       STARTUPINFO si;
+       DWORD               dwCode  =   0;
+       ZeroMemory(&si,sizeof(STARTUPINFO));
+       si.cb           =   sizeof(STARTUPINFO);
+       si.dwFlags      =   STARTF_USESHOWWINDOW;
+       si.wShowWindow  =   SW_SHOWNORMAL;
+
+       char path[2048];
+       getcwd(path, 2048);
+       strcat(path, "\\update.exe");
+       logfile->AddLine(conv(path));logfile->Write();
+
+       int buffSize = (int)strlen(path) + 1;
+       LPWSTR wpath = new wchar_t[buffSize];
+       MultiByteToWideChar(CP_ACP, 0, path, buffSize, wpath, buffSize);
+
+       CreateProcess(NULL, wpath, NULL, NULL, false, NORMAL_PRIORITY_CLASS, 
NULL, NULL, &si, &pi);
+       // we want to exit to be able to update the configurator!
+       exit(0);
+#else
+       wxMessageDialog *w = new wxMessageDialog(this, _("Warning"), _("The 
update service is currently only available for windows users."), wxOK, 
wxDefaultPosition);
+       w->ShowModal();
+       delete(w);
+#endif
+
+}
+
 void MyDialog::OnButClearCache(wxCommandEvent& event)
 {
        wxFileName cfn;


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

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Rigsofrods-devel mailing list
Rigsofrods-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to