void pConsole::executeCommand( const QString& command, bool writeCommand, bool showPrompt ) { const QStringList clearCommands = QStringList( "clear" ) << "cls"; if ( clearCommands.contains( command, Qt::CaseInsensitive ) ) { clear(); if ( showPrompt ) { displayPrompt(); } return; } // write command to execute if ( writeCommand ) { if ( !currentCommand().isEmpty() ) { displayPrompt(); } insertPlainText( command ); } // execute command int res; QString strRes = interpretCommand( command, &res ); // write output in different colors if needed if ( res == 0 ) { useColor( ctOutput ); } else { useColor( ctError ); } if ( !strRes.isEmpty() ) { appendPlainText( strRes ); } useColor( ctCommand ); // display the prompt again if needed if ( showPrompt ) { displayPrompt(); } }
void Model::draw() { useColor(); useMatrix(); for(auto & m : model_meshes) m->draw(); }
// Formatted i/o void Client::sendFormattedText(const QString &aText, const QString &aColorKey, const QString &aMxpVerb) { if(parentAccount_.expired()) { //falling back to the raw text, but it should not happen sendRawText(aText); return; } auto account = parentAccount_.lock(); //mxp if(account->useMXP() && aMxpVerb.length()) { sendRawText("<send href='"); sendRawText(aMxpVerb); sendRawText("'>"); } //color //reset if not specified if(account->useColor()) { QString color = account->customColor(aColorKey); if(!color.length()) color = account->customColor(Account::RESET); sendRawText(color); } //finally the text itself sendRawText(aText); if(account->useColor()) { //reset color just in case to avoid color bleed QString color = account->customColor(Account::RESET); sendRawText(color); } //closing mxp tag if(account->useMXP() && aMxpVerb.length()) { sendRawText("</send>send>"); } }
void Model::draw() { if (!disable_properties) { useColor(); useMatrix(); useTextures(); } for(auto & m : model_meshes) m->draw(); }