Give terrasync a buffered log.
This commit is contained in:
@@ -60,6 +60,7 @@
|
||||
#include <simgear/misc/strutils.hxx>
|
||||
#include <simgear/threads/SGQueue.hxx>
|
||||
#include <simgear/misc/sg_dir.hxx>
|
||||
#include <simgear/debug/BufferedLogCallback.hxx>
|
||||
|
||||
#ifdef HAVE_SVN_CLIENT_H
|
||||
# ifdef HAVE_LIBSVN_CLIENT_1
|
||||
@@ -683,6 +684,10 @@ SGTerraSync::SGTerraSync(SGPropertyNode_ptr root) :
|
||||
_userCbData(NULL)
|
||||
{
|
||||
_svnThread = new SvnThread();
|
||||
_log = new BufferedLogCallback(SG_TERRAIN, SG_INFO);
|
||||
_log->truncateAt(255);
|
||||
|
||||
sglog().addCallback(_log);
|
||||
}
|
||||
|
||||
SGTerraSync::~SGTerraSync()
|
||||
@@ -690,6 +695,8 @@ SGTerraSync::~SGTerraSync()
|
||||
_tiedProperties.Untie();
|
||||
delete _svnThread;
|
||||
_svnThread = NULL;
|
||||
sglog().removeCallback(_log);
|
||||
delete _log;
|
||||
}
|
||||
|
||||
void SGTerraSync::init()
|
||||
|
||||
@@ -31,6 +31,8 @@ namespace simgear
|
||||
{
|
||||
const int NOWHERE = -9999;
|
||||
|
||||
class BufferedLogCallback;
|
||||
|
||||
typedef void (*SGTerraSyncCallback)(void* userData, long tileIndex);
|
||||
|
||||
class SGTerraSync : public SGSubsystem
|
||||
@@ -49,6 +51,10 @@ public:
|
||||
bool schedulePosition(int lat, int lon);
|
||||
void setTileRefreshCb(SGTerraSyncCallback refreshCb, void* userData = NULL);
|
||||
|
||||
/// retrive the associated log object, for displaying log
|
||||
/// output somewhere (a UI, presumably)
|
||||
BufferedLogCallback* log() const
|
||||
{ return _log; }
|
||||
protected:
|
||||
void syncAirportsModels();
|
||||
void syncArea(int lat, int lon);
|
||||
@@ -67,6 +73,7 @@ private:
|
||||
SGTerraSyncCallback _refreshCb;
|
||||
void* _userCbData;
|
||||
simgear::TiedPropertyList _tiedProperties;
|
||||
BufferedLogCallback* _log;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user