#include "Job.h"
#include "P4Client.h"
namespace Perforce {
Job::JobListCache Job::_joblistCache;
const JobList& Job::getJobs()
{
_joblistCache.updateCacheIfNecessary();
return _joblistCache.getCache();
}
void Job::JobListCache::updateCache()
{
char* p[] = { "-l" };
RunP4Command( 1, p, "jobs", this );
}
void Job::JobListCache::HandleError( Error* err )
{
ASSERT( 0 && "Error updateing joblist cache" );
}
void Job::JobListCache::OutputStat( StrDict* varList )
{
Job* j = new Job();
j->_description = varList->GetVar( "Description" )->Text();
replaceNewlinesWithSpaces( j->_description );
j->_name = varList->GetVar( "Job" )->Text();
QString temp = varList->GetVar( "ReportedDate" )->Text();
j->_date.setTime_t( temp.toInt() );
j->_reportedBy = varList->GetVar( "ReportedBy" )->Text();
j->_status = varList->GetVar( "Status" )->Text();
_cache.append( j );
}
} // end namespace