//
// QPerforce is a gui interface to the perforce revision control
// system. It is based on the qt library, and should be easily portable
// across any platform that has this toolkit available.
//
// Copyright (C) 2002 Jacob Gladish
//
//
#include "Change.h"
#include "P4Client.h"
#include <qpixmap.h>
#include <qregexp.h>
#include <qstringlist.h>
namespace Perforce {
Change::ChangesCache Change::_changesCache;
const ChangesList& Change::getChanges()
{
// TODO: add ability to install filter on cache
_changesCache.updateCacheIfNecessary();
return _changesCache.getCache();
}
void Change::ChangesCache::updateCache()
{
char* p[] = { "-m", "100", "-l", "-s", "submitted" };
RunP4Command( 5, p, "changes", this );
}
void Change::ChangesCache::OutputStat( StrDict* varList )
{
Change* cl = new Change();
QString temp = varList->GetVar( "time" )->Text();
cl->_date.setTime_t( temp.toInt() );
cl->_description = varList->GetVar( "desc" )->Text();
cl->_description.replace( QRegExp("[\r\n]"), " " );
cl->_name = varList->GetVar( "change" )->Text();
cl->_user = varList->GetVar( "user" )->Text();
_cache.append( cl );
}
void Change::ChangesCache::HandleError( Error* err )
{
ASSERT( "ERROR" );
}
} // end namespace