#include "ConnectionInfo.h" #include "IUpdateable.h" #include "P4Client.h" #include <qstring.h> #include <qstringlist.h> namespace Perforce { ConnectionInfo::ConnectionInfoUI ConnectionInfo::_connectionInfoUI; const ConnectionInfo ConnectionInfo::getConnectionInfo() { return _connectionInfoUI.getConnectionInfo(); } void ConnectionInfo::ConnectionInfoUI::OutputInfo( char level, char* data ) { if (_info == NULL) { _info = new ConnectionInfo(); } QString s( data ); qDebug( "Reading: %s", data ); if (s.find("Client name:") >= 0) { _info->_name = QStringList::split( ":", s )[ 1 ]; } else if (s.find("Client host:") >= 0) { _info->_host = QStringList::split( ":", s )[ 1 ]; } else if (s.find("Client root:") >= 0) { _info->_root = QStringList::split( ":", s )[ 1 ]; } else if (s.find("Current directory:") >= 0) { _info->_currentDir = QStringList::split( ":", s )[ 1 ]; } else if (s.find("Client address:") >= 0) { _info->_clientAddress = QStringList::split( ":", s )[ 1 ]; } else if (s.find("Server address:") >= 0) { _info->_serverAddress = QStringList::split( ":", s )[ 1 ]; } else if (s.find("Server root:") >= 0) { _info->_serverRoot = QStringList::split( ":", s )[ 1 ]; } else if (s.find("Server date:") >= 0) { // TODO: fully parse date. // QStringList l = QStringList::split( ":", s )[ 1 ]; // _info->_date.setTime_t( _info->_stringDate = QStringList::split( ":", s )[ 1 ]; } else if (s.find("Server version:") >= 0) { _info->_serverVersion = QStringList::split( ":", s )[ 1 ]; } else if (s.find("Server license:") >= 0) { _info->_description = QStringList::split( ":", s )[ 1 ]; } else if (s.find("User name:") >= 0) { _info->_userName = QStringList::split( ":", s )[ 1 ]; } } const QString ConnectionInfo::toString() const { QString s; QString nl( "<br> " ); return s.append( " User Name: " ) .append( getUserName() ).append( nl ) .append( "Client Name: " ).append( getClientName() ).append( nl ) .append( "Client Root:" ).append( getClientRoot() ).append( nl ) .append( "Client Address: ").append( getClientAddress() ).append( nl ) // .append( "Client Version: ").append( getClientVersion() ).append( nl ) .append( "Current Directory: ").append( getCurrentDir() ).append( nl ) .append( "Client Address: " ).append( getClientAddress() ).append( nl ) .append( "Server Address: " ).append( getServerAddress() ).append( nl ) .append( "Server Root: " ).append( getServerRoot() ).append( nl ) .append( "Server Date: " ).append( getStringDate() ).append( nl ) .append( "Server Version: " ).append( getServerVersion() ).append( nl ) .append( "Server License: " ).append( getServerLicense() ).append( nl ); } void ConnectionInfo::ConnectionInfoUI::HandleError( Error* err ) { ASSERT( 0 && "Failed to get connection info." ); } const ConnectionInfo ConnectionInfo::ConnectionInfoUI::getConnectionInfo() { char* p[] = { "" }; RunP4Command( 0, p, "info", this ); return *this->_info; } } // end namespace
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 2141 | Jacob Gladish |
Begun adding toolbar buttons, and added connection info. Added some missing files from project. |