#include "P4Client.h"
#include "ConfigOptions.h"
#include "qperforceWindow.h"
#include "error.h"
#include <qapplication.h>
static ClientApi gP4Client;
Error gError;
void InitialzeClient( const char* p4Port )
{
Error err;
qDebug ("Initializing client");
gP4Client.SetPort( const_cast<char *>(p4Port) );
gP4Client.SetProtocol( "tag", "" );
gP4Client.Init( &err );
if (err.Test()) {
qDebug ("error initializing client.");
}
}
void RunP4Command( int argc, char* p[], const char* func, ClientUser* ui )
{
if (argc > 0) {
ASSERT( p != NULL );
}
ASSERT( ui != NULL );
if (!gP4Client.Dropped()) {
QApplication::setOverrideCursor( Qt::waitCursor );
if (ConfigOptions::getInstance()->showP4Commands()) {
QString msg;
QString cmd = "p4 " + QString( func );
for (int i = 0; i < argc; ++i) {
cmd += " " + QString( p[i] );
}
msg.sprintf( "<img src=\"img.exec\" height=12 width=12/> "
"<b>Executing:</b> <code>%s</code>",
cmd.latin1() );
qperforceWindow* win = qperforceWindow::getInstance();
win->appendUserMessage( msg );
}
gP4Client.SetArgv( argc, p );
gP4Client.Run( const_cast<char *>(func), ui );
QApplication::restoreOverrideCursor();
}
}