| 1 |
|
/* |
| 2 |
|
AE/Mod Installer |
| 3 |
– |
v1.0 |
| 3 |
|
by Gumby and Iritscen |
| 4 |
|
*/ |
| 5 |
|
|
| 6 |
+ |
// To-do: - Disable Install button when nothing (new) is selected |
| 7 |
+ |
// - Institute lots of checks into file-handling |
| 8 |
+ |
// - Clear mod info fields when mod is de-selected |
| 9 |
+ |
|
| 10 |
|
#define DEBUG |
| 11 |
|
#include <stdio.h> |
| 12 |
|
//#include <conio.h> |
| 45 |
|
string strImportOption = "-import:sep"; |
| 46 |
|
const char* strClsCmd = "clear"; |
| 47 |
|
const char* strPauseCmd = "read -n 1 -p \"Press any key to continue\""; |
| 48 |
+ |
void Sleep(int ms) { sleep( ms / 1000 ); } |
| 49 |
|
#endif |
| 50 |
|
|
| 51 |
|
using namespace boost::filesystem; |
| 782 |
|
writeInstalledMods(installedMods); |
| 783 |
|
setProgressBar(1000); |
| 784 |
|
setStatusArea("Done!"); |
| 785 |
< |
sleep(1000); |
| 785 |
> |
Sleep(1000); |
| 786 |
|
setProgressBar(0); |
| 783 |
– |
|
| 787 |
|
} |
| 788 |
|
|
| 789 |
|
void writeInstalledMods(vector<string> installedMods) |
| 1035 |
|
/* |
| 1036 |
|
* Control creation for MainWindow |
| 1037 |
|
*/ |
| 1038 |
< |
wxStatusBar* TheStatusBar; |
| 1038 |
> |
wxStatusBar **TheStatusBar; |
| 1039 |
|
wxButton* TheInstallButton; |
| 1040 |
|
wxGauge* TheProgressBar; |
| 1041 |
|
void MainWindow::CreateControls() |
| 1042 |
|
{ |
| 1043 |
|
////@begin MainWindow content construction |
| 1044 |
+ |
// Generated by DialogBlocks, 31/05/2009 19:03:55 (unregistered) |
| 1045 |
+ |
|
| 1046 |
|
MainWindow* itemFrame1 = this; |
| 1047 |
|
|
| 1048 |
|
wxMenuBar* menuBar = new wxMenuBar; |
| 1128 |
|
itemStaticLine17->Show(false); |
| 1129 |
|
itemBoxSizer11->Add(itemStaticLine17, 0, wxGROW|wxALL, 5); |
| 1130 |
|
|
| 1131 |
< |
descriptionText = new wxTextCtrl( itemPanel10, Description_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxTE_RICH|wxTE_RICH2 ); |
| 1131 |
> |
descriptionText = new wxTextCtrl( itemPanel10, Description_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxTE_RICH|wxTE_AUTO_URL ); |
| 1132 |
|
descriptionText->SetName(_T("DescriptionName")); |
| 1133 |
|
descriptionText->SetBackgroundColour(wxColour(240, 240, 240)); |
| 1134 |
|
itemBoxSizer11->Add(descriptionText, 1, wxGROW|wxLEFT|wxRIGHT, 5); |
| 1145 |
|
wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL); |
| 1146 |
|
itemBoxSizer2->Add(itemBoxSizer20, 0, wxGROW|wxALL, 0); |
| 1147 |
|
|
| 1148 |
< |
ProgressBar = new wxGauge( itemFrame1, ProgressBar_Gauge, 1000, wxDefaultPosition, wxDefaultSize, wxGA_SMOOTH ); |
| 1148 |
> |
ProgressBar = new wxGauge( itemFrame1, ProgressBar_Gauge, 1000, wxDefaultPosition, wxSize(-1, 30), wxGA_SMOOTH ); |
| 1149 |
|
ProgressBar->SetValue(0); |
| 1150 |
|
itemBoxSizer20->Add(ProgressBar, 1, wxGROW|wxALL, 0); |
| 1151 |
|
|
| 1152 |
< |
InstallButton = new wxButton( itemFrame1, Install_Button, _("Install!"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 1152 |
> |
InstallButton = new wxButton( itemFrame1, Install_Button, _("Install!"), wxDefaultPosition, wxSize(-1, 30), 0 ); |
| 1153 |
|
itemBoxSizer20->Add(InstallButton, 0, wxGROW|wxALL, 0); |
| 1154 |
|
|
| 1155 |
|
wxBoxSizer* itemBoxSizer23 = new wxBoxSizer(wxVERTICAL); |
| 1221 |
|
Mods_CheckboxList->Append(globalPackages[i].name.c_str()); |
| 1222 |
|
if( binary_search(globalInstalledMods.begin(), globalInstalledMods.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i); |
| 1223 |
|
} |
| 1224 |
< |
TheStatusBar = StatusArea; |
| 1224 |
> |
TheStatusBar = &StatusArea; |
| 1225 |
|
TheInstallButton = InstallButton; |
| 1226 |
|
TheProgressBar = ProgressBar; |
| 1227 |
|
OptionsPanel->Hide(); |
| 1341 |
|
void MainWindow::OnModsCheckboxList1Selected( wxCommandEvent& event ) |
| 1342 |
|
{ |
| 1343 |
|
//event.GetSelection |
| 1344 |
< |
titleText->SetLabel(wxT(globalPackages[event.GetSelection()].name.c_str())); |
| 1345 |
< |
creatorText->SetLabel(globalPackages[event.GetSelection()].creator.c_str()); |
| 1346 |
< |
descriptionText->SetLabel(globalPackages[event.GetSelection()].readme.c_str()); |
| 1344 |
> |
titleText->SetValue(globalPackages[event.GetSelection()].name.c_str()); |
| 1345 |
> |
creatorText->SetValue(globalPackages[event.GetSelection()].creator.c_str()); |
| 1346 |
> |
descriptionText->SetValue(globalPackages[event.GetSelection()].readme.c_str()); |
| 1347 |
|
|
| 1348 |
< |
creatorText->Refresh(); |
| 1348 |
> |
//creatorText->Refresh(); |
| 1349 |
|
} |
| 1350 |
|
|
| 1351 |
|
|
| 1427 |
|
//MainWindow::MainWindow().Hide(); |
| 1428 |
|
// boost::thread thrd2(recompileAll(localPackages) ); |
| 1429 |
|
//MainWindow::MainWindow().Show(); |
| 1430 |
< |
recompile packages(localPackages); |
| 1431 |
< |
boost::thread thrd(packages); |
| 1430 |
> |
#ifdef WIN32 |
| 1431 |
> |
recompile packages(localPackages); |
| 1432 |
> |
boost::thread thrd(packages); |
| 1433 |
> |
#else |
| 1434 |
> |
this->Disable(); |
| 1435 |
> |
recompileAll(localPackages); |
| 1436 |
> |
this->Enable(); |
| 1437 |
> |
#endif |
| 1438 |
|
|
| 1439 |
|
} |
| 1440 |
|
|
| 1441 |
|
|
| 1442 |
|
} |
| 1443 |
|
|
| 1444 |
< |
void setStatusArea( string s ) { |
| 1445 |
< |
TheStatusBar->SetStatusText(_(s.c_str())); |
| 1444 |
> |
/*void setStatusArea( string s ) { |
| 1445 |
> |
//TheStatusBar = MainWindow::StatusArea; |
| 1446 |
> |
(**TheStatusBar).SetStatusText(_(s.c_str()), 0); |
| 1447 |
|
|
| 1448 |
|
//MainWindow::MainWindow().SetSize(MainWindow::MainWindow().GetRect().GetWidth(), MainWindow::MainWindow().GetRect().GetHeight()+1); |
| 1449 |
|
|
| 1451 |
|
//StatusBar->SetLabel(s); |
| 1452 |
|
//->SetLabel(s); |
| 1453 |
|
|
| 1454 |
< |
} |
| 1454 |
> |
}*/ |
| 1455 |
|
|
| 1456 |
|
void setProgressBar( int i ) { |
| 1457 |
|
//TheProgressBar->SetValue( |
| 1645 |
|
setStatusArea("Done!"); |
| 1646 |
|
} |
| 1647 |
|
|
| 1648 |
+ |
|
| 1649 |
+ |
/* |
| 1650 |
+ |
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton |
| 1651 |
+ |
*/ |
| 1652 |
+ |
|
| 1653 |
+ |
/*void MainWindow::OnSeparatedRadioButtonSelected( wxCommandEvent& event ) |
| 1654 |
+ |
{ |
| 1655 |
+ |
////@begin wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton in MainWindow. |
| 1656 |
+ |
// Before editing this code, remove the block markers. |
| 1657 |
+ |
event.Skip(); |
| 1658 |
+ |
////@end wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton in MainWindow. |
| 1659 |
+ |
}*/ |
| 1660 |
+ |
|