[sword-svn] r509 - in branches/BCB5: . apps/InstallMgr
scribe at crosswire.org
scribe at crosswire.org
Tue Nov 2 11:01:09 MST 2010
Author: scribe
Date: 2010-11-02 11:01:09 -0700 (Tue, 02 Nov 2010)
New Revision: 509
Modified:
branches/BCB5/apps/InstallMgr/InfoFrm.dfm
branches/BCB5/apps/InstallMgr/InstallManager.bpr
branches/BCB5/apps/InstallMgr/InstallManager.cpp
branches/BCB5/apps/InstallMgr/InstallManager.res
branches/BCB5/apps/InstallMgr/MainFrm.cpp
branches/BCB5/apps/InstallMgr/MainFrm.dfm
branches/BCB5/apps/InstallMgr/MainFrm.h
branches/BCB5/apps/InstallMgr/RemoteMntFrm.cpp
branches/BCB5/apps/InstallMgr/StatusFrm.cpp
branches/BCB5/sword.bpr
branches/BCB5/sword.res
Log:
Fixed a number of bugs.
Added remote repo sync.
Added Tools|migrate modules options.
Modified: branches/BCB5/apps/InstallMgr/InfoFrm.dfm
===================================================================
(Binary files differ)
Modified: branches/BCB5/apps/InstallMgr/InstallManager.bpr
===================================================================
--- branches/BCB5/apps/InstallMgr/InstallManager.bpr 2010-10-25 09:58:04 UTC (rev 508)
+++ branches/BCB5/apps/InstallMgr/InstallManager.bpr 2010-11-02 18:01:09 UTC (rev 509)
@@ -6,8 +6,7 @@
<PROJECT value="..\..\stage\InstallManager.exe"/>
<OBJFILES value="InstallManager.obj MainFrm.obj StatusFrm.obj RemoteMntFrm.obj InfoFrm.obj
cipherfrm.obj UninstallFrm.obj ..\..\swwinlog.obj
- ..\..\..\sword\src\mgr\installmgr.obj ..\..\..\sword\src\mgr\curlftpt.obj
- ..\..\..\sword\src\mgr\ftptrans.obj UnsuFrm.obj"/>
+ ..\..\..\sword\src\mgr\installmgr.obj UnsuFrm.obj"/>
<RESFILES value="InstallManager.res"/>
<IDLFILES value=""/>
<IDLGENFILES value=""/>
@@ -30,7 +29,7 @@
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
<RELEASELIBPATH value="$(BCB)\lib\release"/>
<LINKER value="ilink32"/>
- <USERDEFINES value="VCL;_ICU_;_ICUSWORD_;CURLAVAILABLE;USBINARY"/>
+ <USERDEFINES value="VCL;_ICU_;_ICUSWORD_;USBINARY"/>
<SYSDEFINES value="NO_STRICT"/>
<MAINSOURCE value="InstallManager.cpp"/>
<INCLUDEPATH value="curl\lib;..\..\..\sword\src\mgr;..\..;..\..\..\sword\include;curl\include;$(BCB)\include;$(BCB)\include\vcl"/>
@@ -60,7 +59,7 @@
AutoIncBuild=1
MajorVer=1
MinorVer=6
-Release=0
+Release=2
Build=0
Debug=0
PreRelease=0
@@ -73,13 +72,13 @@
[Version Info Keys]
CompanyName=CrossWire Bible Society
FileDescription=SWORD Installation Manager
-FileVersion=1.6.0.0
+FileVersion=1.6.2.0
InternalName=InstallMgr
-LegalCopyright=Copyright 1990-2009 by CrossWire Bible Society
+LegalCopyright=Copyright 1990-2010 by CrossWire Bible Society
LegalTrademarks=
OriginalFilename=
ProductName=The SWORD Project
-ProductVersion=1.6.0RC2
+ProductVersion=1.6.2RC1
Comments=Seek Jesus who exchanges temporary for eternal
[HistoryLists\hlIncludePath]
@@ -119,10 +118,10 @@
[HistoryLists\hlConditionals]
Count=12
-Item0=VCL;_ICU_;_ICUSWORD_;CURLAVAILABLE;USBINARY
-Item1=VCL;_ICU_;_ICUSWORD_;CURLAVAILABLE;USBINARY;_DEBUG
-Item2=VCL;_ICU_;_ICUSWORD_;USBINARY;_DEBUG
-Item3=VCL;_ICU_;_ICUSWORD_;USBINARY
+Item0=VCL;_ICU_;_ICUSWORD_;USBINARY
+Item1=VCL;_ICU_;_ICUSWORD_;USBINARY;_DEBUG
+Item2=VCL;_ICU_;_ICUSWORD_;CURLAVAILABLE;USBINARY;_DEBUG
+Item3=VCL;_ICU_;_ICUSWORD_;CURLAVAILABLE;USBINARY
Item4=VCL
Item5=VCL;_DEBUG
Item6=VCL;__STDC__ true
Modified: branches/BCB5/apps/InstallMgr/InstallManager.cpp
===================================================================
--- branches/BCB5/apps/InstallMgr/InstallManager.cpp 2010-10-25 09:58:04 UTC (rev 508)
+++ branches/BCB5/apps/InstallMgr/InstallManager.cpp 2010-11-02 18:01:09 UTC (rev 509)
@@ -16,8 +16,6 @@
USELIB("..\..\..\sword\lib\libsword.lib");
USELIB("..\..\..\icu-sword\as_is\borland\icuuc.lib");
USELIB("..\..\..\icu-sword\as_is\borland\icuin.lib");
-USEUNIT("..\..\..\sword\src\mgr\curlftpt.cpp");
-USEUNIT("..\..\..\sword\src\mgr\ftptrans.cpp");
USELIB("..\..\clucene\clucene.lib");
USEFORM("UnsuFrm.cpp", UnsuForm);
//---------------------------------------------------------------------------
Modified: branches/BCB5/apps/InstallMgr/InstallManager.res
===================================================================
(Binary files differ)
Modified: branches/BCB5/apps/InstallMgr/MainFrm.cpp
===================================================================
--- branches/BCB5/apps/InstallMgr/MainFrm.cpp 2010-10-25 09:58:04 UTC (rev 508)
+++ branches/BCB5/apps/InstallMgr/MainFrm.cpp 2010-11-02 18:01:09 UTC (rev 509)
@@ -70,6 +70,8 @@
" \\par\\par }";
InfoForm->info +=
"Enable? [no] ";
+
+ InfoForm->yesEdit->Visible = true;
confirmed = (InfoForm->ShowModal() == mrOk);
}
return confirmed;
@@ -117,22 +119,44 @@
__fastcall TMainForm::TMainForm(TComponent* Owner)
: TForm(Owner) {
- try {
- manager = new SWMgr();
- installCnt = 0;
- defSelected = false;
- }
- catch (...) {
- FileMgr::createPathAndFile("./mods.d/globals.conf");
- manager = new SWMgr();
- }
+ installCnt = 0;
+ defSelected = false;
+
+
+ // migrate really old data
if (FileMgr::existsFile("./InstallMgr.conf")) {
FileMgr::copyFile("./InstallMgr.conf", "installMgr/InstallMgr.conf");
FileMgr::removeFile("./InstallMgr.conf");
}
+
+ manager = new SWMgr();
+ if (!manager->config) {
+ SWBuf envallusersdir = getenv("ALLUSERSPROFILE");
+ if (envallusersdir.length()) {
+ dataRootPath = envallusersdir;
+ if ((!dataRootPath.endsWith("\\")) && (!dataRootPath.endsWith("/")))
+ dataRootPath += "/";
+ dataRootPath += "Application Data/sword/";
+ }
+ else {
+ dataRootPath = "./";
+ }
+ SWBuf path = dataRootPath + "mods.d/globals.conf";
+
+ int fd = FileMgr::createPathAndFile(path);
+ SWBuf globals = "[Globals]\nAutoInstall=./newmods/\n";
+ write(fd, globals.c_str(), globals.size());
+ close(fd);
+ delete manager;
+ manager = new SWMgr();
+ }
+ else {
+ dataRootPath = manager->prefixPath;
+ }
+
statusReporter = new WinStatusReporter();
- installMgr = new InstallMgrWin("./installMgr", statusReporter);
+ installMgr = new InstallMgrWin((dataRootPath+"installMgr").c_str(), statusReporter);
localMgr = 0;
}
@@ -585,7 +609,7 @@
if (installMgr->isUserDisclaimerConfirmed()) {
RemoteMntForm->ShowModal();
delete installMgr;
- installMgr = new InstallMgrWin("./installMgr");
+ installMgr = new InstallMgrWin((dataRootPath+"installMgr").c_str(), statusReporter);
refreshPageControl();
}
}
@@ -596,7 +620,6 @@
InstallSourceTab *ist = 0;
SectionMap::iterator module;
ConfigEntMap::iterator entry, entryEnd;
- SWBuf sourceDir;
if (PageControl1->ActivePage != PageControl1->Pages[0]) {
ist = (InstallSourceTab *) PageControl1->ActivePage->Controls[0];
@@ -607,11 +630,7 @@
TTreeNode *node = tree->Selected;
if (node) {
if (node->Parent) {
- if (ist)
- sourceDir = (SWBuf)"./installMgr/" + ist->is->source;
- else sourceDir = getLocalDir();
- SWMgr *mgr = new SWMgr(sourceDir.c_str());
-
+ SWMgr *mgr = (ist) ? ist->is->getMgr() : new SWMgr(getLocalDir());
module = mgr->config->Sections.find((const char *)node->Data);
if (module != mgr->config->Sections.end()) {
@@ -630,25 +649,32 @@
if (entry != targetSection->second.end())
targetVersion = entry->second;
}
+ bool showAllChanges = false;
if (SWVersion(targetVersion.c_str()) < SWVersion("1.0")) {
- InfoForm->info = "\\pard{\\b * Additional Module Available for Install. } \\par ";
+ InfoForm->info = (SWBuf)"\\pard{\\b * Module Available for Install: \\tab " + sourceVersion + " } \\par ";
+ showAllChanges = true;
}
else {
- InfoForm->info = (SWBuf)"\\pard{\\b + Upgraded Module Available for Install.}\\par\\tab Current Version: \\tab " + targetVersion + " \\par\\tab Upgrade Version:\\tab " + sourceVersion + " \\par ";
- bool changes = false;
- for (entry = module->second.begin(); entry != module->second.end(); entry++) {
- if (!strncmp(entry->first.c_str(), "History_", 8)) {
- if (SWVersion(&entry->first.c_str()[8]) > SWVersion(targetVersion.c_str())) {
- if (!changes) {
- changes = true;
- InfoForm->info += "\\par{\\b Changes: }\\par ";
- }
- InfoForm->info += "\\tab ";
- InfoForm->info += entry->second.c_str();
- InfoForm->info += "\\par ";
- }
- }
- }
+ InfoForm->info = (SWBuf)"\\pard{\\b + Module Available for Update.}\\par\\tab Current Version: \\tab " + targetVersion + " \\par\\tab Upgrade Version:\\tab " + sourceVersion + " \\par ";
+ }
+
+ InfoForm->info += " \\par \\par \\pard ";
+
+ bool headingPrinted = false;
+ for (entry = module->second.begin(); entry != module->second.end(); entry++) {
+ if (!strncmp(entry->first.c_str(), "History_", 8)) {
+ if (showAllChanges || SWVersion(&entry->first.c_str()[8]) > SWVersion(targetVersion.c_str())) {
+ if (!headingPrinted) {
+ headingPrinted = true;
+ if (showAllChanges)
+ InfoForm->info += "\\par{\\b History: }\\par ";
+ else InfoForm->info += "\\par{\\b Changes: }\\par ";
+ }
+ InfoForm->info += "\\tab ";
+ InfoForm->info += (SWBuf)(entry->first.c_str()+8) + " \\tab "+ entry->second.c_str();
+ InfoForm->info += "\\par ";
+ }
+ }
}
entry = module->second.find("About");
@@ -657,9 +683,11 @@
InfoForm->info += entry->second.c_str();
}
InfoForm->Caption = "Module Information";
+ InfoForm->yesEdit->Visible = false;
InfoForm->ShowModal();
}
- delete mgr;
+ if (!ist)
+ delete mgr;
}
}
}
@@ -735,6 +763,7 @@
InfoForm->info += "The modules you are about to enable are copyrighted and will require an unlock key to use. \\par\\par\\pard ";
InfoForm->info += "CrossWire does not publicly distribute unlock keys for any module. You will need to obtain these keys directly from publisher of the module.\\par\\par\\pard ";
InfoForm->info += "\t-CrossWire Bible Society. ";
+ InfoForm->yesEdit->Visible = false;
InfoForm->ShowModal();
}
fillAllSourceTrees();
@@ -762,5 +791,87 @@
delete installMgr;
}
+
//---------------------------------------------------------------------------
+void __fastcall TMainForm::BuildPortableApp1Click(TObject *Sender)
+{
+ if (dataRootPath != "./") {
+ // migrate old data
+ if (FileMgr::existsDir(dataRootPath+"mods.d")) {
+ FileMgr::copyDir(dataRootPath+"mods.d", "./mods.d");
+ }
+ if (FileMgr::existsDir(dataRootPath+"modules")) {
+ FileMgr::copyDir(dataRootPath+"modules", "./modules");
+ }
+ SWBuf path = dataRootPath;
+ path.replaceBytes("\\", '/');
+ InfoForm->info = (SWBuf)"Library has been copied locally from: " + path + "\\par\\par\\pard ";
+ InfoForm->info += "You may now copy your SWORD program folder to a USB stick or other portable media to use as a self-contained portable app.";
+ delete manager;
+ manager = new SWMgr();
+ dataRootPath = manager->prefixPath;
+ delete installMgr;
+ installMgr = new InstallMgrWin((dataRootPath+"installMgr").c_str(), statusReporter);
+ fillInstallTree();
+ refreshPageControl();
+ }
+ else {
+ InfoForm->info = (SWBuf)"Library is already local at: " + dataRootPath;
+ }
+ InfoForm->Caption = "Build Portable App";
+ InfoForm->yesEdit->Visible = false;
+ InfoForm->ShowModal();
+}
+
+
+//---------------------------------------------------------------------------
+void __fastcall TMainForm::MigrateBookLibraryPubliclytoLocalMachine1Click(
+ TObject *Sender)
+{
+ if (dataRootPath == "./") {
+ SWBuf envallusersdir = getenv("ALLUSERSPROFILE");
+ if (envallusersdir.length()) {
+ delete manager;
+ delete installMgr;
+ dataRootPath = envallusersdir;
+ if ((!dataRootPath.endsWith("\\")) && (!dataRootPath.endsWith("/")))
+ dataRootPath += "/";
+ dataRootPath += "Application Data/sword";
+ if (!FileMgr::existsDir(dataRootPath)) FileMgr::createParent(dataRootPath+"/mods.d/globals.conf");
+ // migrate old data
+ if (FileMgr::existsDir("./mods.d")) {
+ FileMgr::copyDir("./mods.d", dataRootPath+"/mods.d");
+ FileMgr::removeDir("./mods.d");
+ // odd "ReadOnly" flag is set and SWORD's ::remove can't actually remove without "Permission Denied" error
+ RemoveDirectory("./mods.d");
+ }
+ if (FileMgr::existsDir("./modules")) {
+ FileMgr::copyDir("./modules", dataRootPath+"/modules");
+ FileMgr::removeDir("./modules");
+ // this still doesn't work because subdirs exist, but mods.d is the important one.
+ RemoveDirectory("./modules");
+ }
+
+ manager = new SWMgr();
+ dataRootPath = manager->prefixPath;
+ installMgr = new InstallMgrWin((dataRootPath+"installMgr").c_str(), statusReporter);
+ fillInstallTree();
+ refreshPageControl();
+ }
+ SWBuf path = dataRootPath;
+ path.replaceBytes("\\", '/');
+ InfoForm->info = (SWBuf)"Library has been migrated to: " + path + "\\par\\par\\pard";
+ InfoForm->info += "You may now use other SWORD programs with this library";
+ }
+ else {
+ SWBuf path = dataRootPath;
+ path.replaceBytes("\\", '/');
+ InfoForm->info = (SWBuf)"Library is already public at: " + path;
+ }
+ InfoForm->Caption = "Migrate SWORD Library to Public Area";
+ InfoForm->yesEdit->Visible = false;
+ InfoForm->ShowModal();
+}
+//---------------------------------------------------------------------------
+
Modified: branches/BCB5/apps/InstallMgr/MainFrm.dfm
===================================================================
(Binary files differ)
Modified: branches/BCB5/apps/InstallMgr/MainFrm.h
===================================================================
--- branches/BCB5/apps/InstallMgr/MainFrm.h 2010-10-25 09:58:04 UTC (rev 508)
+++ branches/BCB5/apps/InstallMgr/MainFrm.h 2010-11-02 18:01:09 UTC (rev 509)
@@ -99,6 +99,9 @@
TMenuItem *LockedModules1;
TMenuItem *Help1;
TMenuItem *Contents1;
+ TMenuItem *Tool1;
+ TMenuItem *BuildPortableApp1;
+ TMenuItem *MigrateBookLibraryPubliclytoLocalMachine1;
void __fastcall LocalPath1Click(TObject *Sender);
void __fastcall FormCreate(TObject *Sender);
void __fastcall Button5Click(TObject *Sender);
@@ -114,6 +117,9 @@
void __fastcall LockedModules1Click(TObject *Sender);
void __fastcall Contents1Click(TObject *Sender);
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
+ void __fastcall BuildPortableApp1Click(TObject *Sender);
+ void __fastcall MigrateBookLibraryPubliclytoLocalMachine1Click(
+ TObject *Sender);
private: // User declarations
@@ -132,6 +138,7 @@
__fastcall ~TMainForm();
void __fastcall RefreshRemoteSource(TObject *Sender);
int selectAll(TTreeView *tree, bool sel);
+ SWBuf dataRootPath;
SWMgr *localMgr;
WinStatusReporter *statusReporter;
InstallMgrWin *installMgr;
Modified: branches/BCB5/apps/InstallMgr/RemoteMntFrm.cpp
===================================================================
--- branches/BCB5/apps/InstallMgr/RemoteMntFrm.cpp 2010-10-25 09:58:04 UTC (rev 508)
+++ branches/BCB5/apps/InstallMgr/RemoteMntFrm.cpp 2010-11-02 18:01:09 UTC (rev 509)
@@ -34,7 +34,7 @@
{
ConfigEntMap::iterator loop, end;
delete config; // for reloads
- config = new SWConfig("./installMgr/InstallMgr.conf");
+ config = new SWConfig((MainForm->dataRootPath+"installMgr/InstallMgr.conf").c_str());
ListBox1->Clear();
loop = config->Sections["Sources"].lower_bound("FTPSource");
end = config->Sections["Sources"].upper_bound("FTPSource");
@@ -156,7 +156,10 @@
void __fastcall TRemoteMntForm::SpeedButton5Click(TObject *Sender)
{
MainForm->installMgr->refreshRemoteSourceConfiguration();
- FormShow(0);
+ for (InstallSourceMap::iterator it = MainForm->installMgr->sources.begin(); it != MainForm->installMgr->sources.end(); ++it) {
+ MainForm->installMgr->refreshRemoteSource(it->second);
+ }
+ FormShow(0);
}
//---------------------------------------------------------------------------
Modified: branches/BCB5/apps/InstallMgr/StatusFrm.cpp
===================================================================
--- branches/BCB5/apps/InstallMgr/StatusFrm.cpp 2010-10-25 09:58:04 UTC (rev 508)
+++ branches/BCB5/apps/InstallMgr/StatusFrm.cpp 2010-11-02 18:01:09 UTC (rev 509)
@@ -117,7 +117,6 @@
void __fastcall TStatusForm::PreDownload2(void)
{
// StatusForm->buffer = "Downloading: ";
-// StatusForm->buffer += src.c_str();
StatusForm->actionBar->Caption = StatusForm->buffer.c_str();
StatusForm->statusBar->Caption = "";
StatusForm->Repaint();
Modified: branches/BCB5/sword.bpr
===================================================================
--- branches/BCB5/sword.bpr 2010-10-25 09:58:04 UTC (rev 508)
+++ branches/BCB5/sword.bpr 2010-11-02 18:01:09 UTC (rev 509)
@@ -30,7 +30,7 @@
PreviewForm.dfm PrintFrm.dfm entryprvfrm.dfm"/>
<LIBFILES value="..\icu-sword\as_is\borland\icudatab.lib
..\icu-sword\as_is\borland\icuuc.lib ..\icu-sword\as_is\borland\icuin.lib
- ..\sword\lib\libsword.lib clucene\clucene.lib apps\InstallMgr\libcurl.lib"/>
+ ..\sword\lib\libsword.lib clucene\clucene.lib"/>
<LIBRARIES value="TNGImage.lib bcbie50.lib vcljpg50.lib nmfast50.lib vclbde50.lib
vcldb50.lib vclx50.lib vcl50.lib"/>
<SPARELIBS value="vcl50.lib vclx50.lib vcldb50.lib vclbde50.lib nmfast50.lib vcljpg50.lib
Modified: branches/BCB5/sword.res
===================================================================
(Binary files differ)
More information about the sword-cvs
mailing list