Revision: 1525
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=1525&view=rev
Author:   rorthomas
Date:     2010-08-21 12:54:14 +0000 (Sat, 21 Aug 2010)

Log Message:
-----------
added file association to installer

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

Modified: trunk/source/installer/ConfigManager.cpp
===================================================================
--- trunk/source/installer/ConfigManager.cpp    2010-08-21 12:29:48 UTC (rev 
1524)
+++ trunk/source/installer/ConfigManager.cpp    2010-08-21 12:54:14 UTC (rev 
1525)
@@ -354,6 +354,32 @@
        return 0;
 }
 
+void ConfigManager::associateViewerFileTypes(std::string type)
+{
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+       // add the icon
+       wxRegKey *pRegKey = new wxRegKey(wxT("HKEY_CLASSES_ROOT\\" + type + 
"\\DefaultIcon"));
+       if(!pRegKey->Exists())
+               pRegKey->Create();
+
+       pRegKey->SetValue("", installPath + "\\RoRViewer.exe,0");
+
+       // add the action
+       pRegKey = new wxRegKey(wxT("HKEY_CLASSES_ROOT\\" + type + 
"\\shell\\open\\command"));
+       if(!pRegKey->Exists())
+               pRegKey->Create();
+
+       pRegKey->SetValue("", installPath + "\\RoRViewer.exe \"%1\" ");
+#else
+       // TODO: implement
+#endif //OGRE_PLATFORM
+}
+int ConfigManager::associateFileTypes()
+{
+       associateViewerFileTypes(".mesh");
+       return 0;
+}
+
 void ConfigManager::saveStreamSubscription()
 {
        if(!streams.size()) return;

Modified: trunk/source/installer/ConfigManager.h
===================================================================
--- trunk/source/installer/ConfigManager.h      2010-08-21 12:29:48 UTC (rev 
1524)
+++ trunk/source/installer/ConfigManager.h      2010-08-21 12:54:14 UTC (rev 
1525)
@@ -84,6 +84,8 @@
        void saveStreamSubscription(wxString streamPath, bool value);
        void clearStreamSubscription();
        void streamSubscriptionDebug();
+       int  associateFileTypes();
+       void associateViewerFileTypes(std::string type);
 
        // registry things
        wxString getPersistentConfig(wxString name);

Modified: trunk/source/installer/wizard.cpp
===================================================================
--- trunk/source/installer/wizard.cpp   2010-08-21 12:29:48 UTC (rev 1524)
+++ trunk/source/installer/wizard.cpp   2010-08-21 12:54:14 UTC (rev 1525)
@@ -1263,6 +1263,9 @@
        chk_changelog = new wxCheckBox(this, wxID_ANY, _T("View the 
Changelog"));
        mainSizer->Add(chk_changelog, 0, wxALL|wxALIGN_LEFT, 5);
 
+       chk_filetypes = new wxCheckBox(this, wxID_ANY, _T("Associate file 
types"));
+       mainSizer->Add(chk_filetypes, 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);
@@ -1296,6 +1299,11 @@
        chk_changelog->SetValue(true);
        if(CONFIG->getPersistentConfig(wxT("installer.view_changelog")) == 
wxT("no"))
                chk_changelog->SetValue(false);
+
+       chk_filetypes->SetValue(true);
+       if(CONFIG->getPersistentConfig(wxT("installer.associate_filetypes")) == 
wxT("no"))
+               chk_filetypes->SetValue(false);
+
        
 #endif // OGRE_PLATFORM
        return true;
@@ -1310,6 +1318,7 @@
        
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"));
+       CONFIG->setPersistentConfig(wxT("installer.associate_filetypes"), 
chk_filetypes->IsChecked()?wxT("yes"):wxT("no"));
 
        
        if(chk_desktop->IsChecked() || chk_startmenu->IsChecked())
@@ -1329,7 +1338,10 @@
 
        if(chk_changelog->IsChecked())
                CONFIG->viewChangelog();
-       
+
+       if(chk_filetypes->IsChecked())
+               CONFIG->associateFileTypes();
+
 #endif // OGRE_PLATFORM
        return true;
 }

Modified: trunk/source/installer/wizard.h
===================================================================
--- trunk/source/installer/wizard.h     2010-08-21 12:29:48 UTC (rev 1524)
+++ trunk/source/installer/wizard.h     2010-08-21 12:54:14 UTC (rev 1525)
@@ -200,7 +200,7 @@
 {
 protected:
        wxWizard *wizard;
-       wxCheckBox *chk_runtime, *chk_configurator, *chk_desktop, 
*chk_startmenu, *chk_viewmanual, *chk_upgrade_configs, *chk_changelog;
+       wxCheckBox *chk_runtime, *chk_configurator, *chk_desktop, 
*chk_startmenu, *chk_viewmanual, *chk_upgrade_configs, *chk_changelog, 
*chk_filetypes;
 public:
        LastPage(wxWizard *parent);
        bool OnEnter(bool forward);


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

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Rigsofrods-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to