//
// 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 "SubmittedChangeList.h"
#include "P4Client.h"
#include <qpixmap.h>
#include <qregexp.h>
#include <qstringlist.h>
namespace Perforce {
SubmittedChangeList::SubmittedChangeListCache
SubmittedChangeList::_submittedChangeListCache;
const SubmittedChangeListList& SubmittedChangeList::getSubmittedChangeLists()
{
_submittedChangeListCache.updateCacheIfNecessary();
return _submittedChangeListCache.getCache();
}
void SubmittedChangeList::SubmittedChangeListCache::updateCache()
{
char* p[] = { "-m", "100", "-l", "-s", "submitted" };
RunP4Command( 5, p, "changes", this );
}
void SubmittedChangeList::SubmittedChangeListCache::OutputStat( StrDict* varList )
{
SubmittedChangeList* cl = new SubmittedChangeList();
QString temp = varList->GetVar( "time" )->Text();
cl->_date.setTime_t( temp.toInt() );
cl->_description = varList->GetVar( "desc" )->Text();
cl->_description.replace( QRegExp("[\r\n]"), " " );
temp = varList->GetVar( "change" )->Text();
cl->_number = temp.toInt();
cl->_user = varList->GetVar( "user" )->Text();
_cache.append( cl );
}
void SubmittedChangeList::SubmittedChangeListCache::HandleError( Error* err )
{
ASSERT( "ERROR" );
}
} // end namespace