ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/AE/Installer/trunk/source/main_window.cpp
(Generate patch)

Comparing AE/Installer/trunk/source/main_window.cpp (file contents):
Revision 390 by gumby, Mon Jul 6 14:02:56 2009 UTC vs.
Revision 394 by gumby, Mon Jul 6 17:53:15 2009 UTC

# Line 1 | Line 1
1 + #ifndef NTDDI_VERSION          
2 + #define NTDDI_VERSION NTDDI_WIN7
3 + #endif
4 + #ifdef WIN32
5 + #include <windows.h>
6 + #include <shobjidl.h>
7 + HWND Handle;
8 +
9 + ITaskbarList *pTaskbarList;
10 + ITaskbarList3 *pTaskbarList3;
11 + #endif
12 +
13   /*
14   AE/Mod Installer
15   by Gumby and Iritscen
# Line 58 | Line 70 | using namespace std;
70   #include "boost/date_time/date_parsing.hpp"
71   #include "boost/date_time/posix_time/posix_time.hpp"
72  
73 + string escapePath(string input) {
74 +        
75 +        string output;
76 +        string escape_me = "& ;()|<>\"'\\#*?$";
77 +        for(int i = 0; i < input.size(); i++)  {
78 +                for(int j = 0; j < escape_me.size(); j++) if (input[i] == escape_me[j]) output += '\\';
79 +                output += input[i];
80 +        }
81 +        return output;
82 + }
83 +
84   int globalizeData(void)
85   {
86          busy = 1;
# Line 338 | Line 361 | int globalizeData(void)
361                  // or we could just include it in the zip in the proper place already.
362  
363                  copy("../../persist.dat","../persist.dat");
364 <                copy("../../keyconfig.txt","../keyconfig.txt");
364 >                copy("../../keyconfig.txt","../keyconfig.txt");
365   #ifndef WIN32
366                  /* On Mac only, set the current GDF to the AE GDF by writing to Oni's global preferences file (thankfully a standard OS X ".plist" XML file).
367                     If there are no Oni prefs (only possible if Oni has not been run even once), then the above line will fail silently, no harm done,
368                     and when the user does run Oni for the first time, using the copy of the app in the AE GDF, Oni will set the prefs to use that GDF at that point */
369 <                path fullAEpath = system_complete("."); // get full path for Installer
369 >                string fullAEpath = escapePath(system_complete(".").parent_path().parent_path().string()); // get full path for Installer
370                  char prefsCommand[300] = "defaults write com.godgames.oni RetailInstallationPath -string '";
371 <                strcat(prefsCommand, fullAEpath.parent_path().parent_path().string().c_str()); // get path of edition/ folder (Oni wants the folder that *contains* the GDF)
371 >                strcat(prefsCommand, fullAEpath.c_str()); // get path of edition/ folder (Oni wants the folder that *contains* the GDF)
372                  strcat(prefsCommand, "'"); // path string is enclosed in single quotes to avoid the need to escape UNIX-unfriendly characters
373                  system(prefsCommand);
374                  
# Line 1120 | Line 1143 | void MainWindow::CreateControls()
1143      Mods_CheckboxList->Connect(Mods_CheckboxList1, wxEVT_CREATE, wxWindowCreateEventHandler(MainWindow::ModList_OnCreate), NULL, this);
1144          ////@end MainWindow content construction
1145  
1146 +        Handle = (HWND)GetHWND();
1147 +        ::CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList, (void **)&pTaskbarList);
1148 +
1149 +
1150          if ( exists( "../../GameDataFolder/level0_Final.sep" ) ) {
1151                  strImportOption = "-import:sep";
1152                  splitInstances = NOT_SPLIT;
# Line 1388 | Line 1415 | void MainWindow::OnInstallButtonClick( w
1415  
1416   void setProgressBar( int i ) {
1417          //TheProgressBar->SetValue(
1418 + #ifdef WIN32
1419 +        
1420 +
1421 +
1422 + if (SUCCEEDED(pTaskbarList->QueryInterface(IID_ITaskbarList3, (void **)&pTaskbarList3)))
1423 + {
1424 +        
1425 +        pTaskbarList3->SetProgressValue(Handle,i, 1000);
1426 +        if ( i == 0 ) {
1427  
1428 +        pTaskbarList3->SetProgressState(Handle,TBPF_NOPROGRESS);
1429 +        }
1430 + }
1431 +
1432 +
1433 + #endif
1434          TheProgressBar->SetValue(i);
1435  
1436   }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)