[sword-devel] InstallMgr questions...

Troy A. Griffitts scribe at crosswire.org
Thu Sep 24 20:48:04 MST 2009


Dear Nic,

Have a look at the c-tor to InstallMgr which takes a StatusReporter
object.  You can pass your own status reporter subclass to this to
report status to your user however you'd like.  Here is a simple example
(not checked for syntax):

class MyStatusReporter : public StatusReporter {
private:
     SomeGUI *someGUI;
public:
     MyStatusReporter(SomeGUI *gui) : someGUI(gui) {}

     /** called before stages of a batch download */
     void preStatus(long totalBytes, long completedBytes, const char
*message) {
           someGUI->getTotalStatusBar()->setMax(totalBytes);
           someGUI->getTotalStatusBar()->setProgress(completedBytes);
           someGUI->getMessageBox()->setText(message);
     }

     /** frequently called throughout a download, to report status */
     void statusUpdate(double dtTotal, double dlNow) {
           someGUI->getStageStatusBar()->setMax(totalBytes);
           someGUI->getStateStatusBar()->setProgress(completedBytes);
     }
};

Hope this helps.

	-Troy.



Nic Carter wrote:
> 
> Hi team, I have a couple of questions that aren't connected to the
> discussion from May in any way at all (/me hears a large collective
> sigh!)...  :)
> 
> Firstly, I was trying to get it to work and had issues where it uses a
> tmp file & so had to move the tmp file for it to work.  I have a
> suggested way that this could be done & have attached a couple of
> patches for ftplibftpt.cpp/h.  Hopefully they are ok?  If not, I can
> simply apply them whenever I check out a new version of sword...  ;)
> [FYI, on the iPhone everything is sandboxed & an app doesn't even have
> read access to lots of the file system, let alone write, so instead of
> using the cwd I need to get the ftplib to use a location that is
> rw-able...  :)  ]
> 
> My other question is to do with user feedback.  I can't see any way of
> providing feedback for how an install is progressing?  What I'd love is
> some sort of % in order to provide feedback to the user of how far along
> we are through an install of a module, so they know it hasn't hung... 
> I'm not concerned if it's detailed or simple, but something would be
> nice...  :)
> If there's something built-in & I've just failed to find it, please just
> point me in the right direction...  :)
> 
> 
> thanks, ybic
>     nic...  :)
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page




More information about the sword-devel mailing list