static gboolean inputActivate(GtkWidget *widget, GdkEvent *event, gpointer data) { char *command = (char *) gtk_entry_get_text(GTK_ENTRY(input)); appendMessage(command, MESSAGE_IN); if(!$(bool, lua, evaluateLua)(command)) { GString *err = g_string_new("Lua error: "); char *ret = $(char *, lua, popLuaString)(); g_string_append(err, ret); appendMessage(err->str, MESSAGE_LOG); free(ret); g_string_free(err, true); } else {
void AbstractMaemoRunControl::handleInitialCleanupFinished() { if (m_stoppedByUser) { emit appendMessage(this, tr("Initial cleanup canceled by user."), false); emit finished(); } else if (m_initialCleaner->hasError()) { handleError(tr("Error running initial cleanup: %1.") .arg(m_initialCleaner->error())); emit finished(); } else { emit appendMessage(this, tr("Initial cleanup done."), false); startInternal(); } }
void LocalApplicationRunControl::processExited(int exitCode) { QString msg = tr("%1 exited with code %2") .arg(QDir::toNativeSeparators(m_executable)).arg(exitCode); appendMessage(msg, NormalMessageFormat); emit finished(); }
//! constructor Console::Console( Widget* parent, int id, const Rect& rectangle ) : Widget( parent, id, rectangle ), consoleHistoryIndex_(0), toggle_visible_(NONE), _d(new Impl) { calculateConsoleRect(ui()->rootWidget()->size()); //calculate the console rectangle hide(); cursorPos_ = 1; setFont( Font::create("default",12).withColor(ColorList::yellow) ); _opacity = 0; _logger = SmartPtr<ConsoleLogger>(new ConsoleLogger()); _logger->drop(); _logger->console = this; _d->bg = Picture(size(),0,true); Logger::registerWriter(TEXT(ConsoleLogger), _logger.object() ); Widget::setVisible(false); resizeMessages(); registerDefaultCommands_(); appendMessage( "Console initialized" ); //append a message _updateCommandRect(); }
void Console::handleCommandString( const std::string& wstr) //! handle the current command string { if(wstr.size() > 0 ) //check if it is a command { std::string cmdLine = wstr; //append the message std::string msg = ">> Command : "; msg += cmdLine; appendMessage( msg ); //parsing logic StringArray args; std::string cmdName; ConsoleParser parser(cmdLine); if( parser.parse(cmdName,args) ) { Dispatch(cmdName,args,this); } else { std::string errorMessage = "The command syntax is incorrect or it could not be parsed"; LogError(errorMessage); } } else { } }
void UOscFunctionLibrary::SendOsc(FName Address, const TArray<FOscDataElemStruct> & Data, int32 TargetIndex) { if(!isValidAddress(Address)) { return; } static_assert(sizeof(uint8) == sizeof(char), "Cannot cast uint8 to char"); osc::OutboundPacketStream output((char *)GlobalBuffer.GetData(), GlobalBuffer.Max()); check(reinterpret_cast<const void *>(GlobalBuffer.GetData()) == reinterpret_cast<const void *>(output.Data())); appendMessage(output, Address, Data); if(output.State() == osc::OUT_OF_BUFFER_MEMORY_ERROR) { GlobalBuffer.Reserve(GlobalBuffer.Max() * 2); // not enough memory: double the size SendOsc(Address, Data, TargetIndex); // try again return; } if(output.State() == osc::SUCCESS) { GetMutableDefault<UOscSettings>()->Send(GlobalBuffer.GetData(), output.Size(), TargetIndex); } else { UE_LOG(LogOSC, Error, TEXT("OSC Send Message Error: %s"), osc::errorString(output.State())); } }
bool ChatSession::wakeupContact() { int msec = awakeDelay.elapsed(); if (msec < 30000) { QString plainText = tr("You can't use alarm clock so often!"); QTextDocument doc(plainText); RtfExporter rtfExporter(&doc); QByteArray rtf = rtfExporter.toRtf(); Message* msg = new Message(Message::Error, MESSAGE_FLAG_RTF | MESSAGE_FLAG_ALARM, plainText, rtf, 0x00FFFFFF); appendMessage(msg, false); return false; } QString plainText = tr("Wake up!"); QTextDocument doc(plainText); RtfExporter rtfExporter(&doc); QByteArray rtf = rtfExporter.toRtf(); Message* msg = new Message(Message::Outgoing, MESSAGE_FLAG_RTF | MESSAGE_FLAG_ALARM, plainText, rtf, 0x00FFFFFF); Task* task = new Tasks::SendMessage(m_contact, msg, m_account->client()); connect(task, SIGNAL(done(quint32, bool)), this, SLOT(slotMessageStatus(quint32, bool))); if (task->exec()) { awakeDelay.start(); return true; } return false; }
void QuazaaIRC::numericMessageReceived(QString sender, uint code, QStringList list) { switch (code) { case Irc::Rfc::RPL_NAMREPLY: emit channelNames(list); break; case Irc::Rfc::RPL_BOUNCE: { for (int i = 0 ; i<list.size() ; ++i) { QString opt = list.at(i); if (opt.startsWith("PREFIX=", Qt::CaseInsensitive)) { QString prefstr = opt.split("=")[1]; QString modes = prefstr.mid(1, prefstr.indexOf(")")-1); QString mprefs = prefstr.right(modes.length()); emit setPrefixes(modes, mprefs); } } } default: { // append to status list.removeFirst(); emit appendMessage(qobject_cast<Irc::Buffer*>(QObject::sender()), sender, "[" + QString::number(code) + "] " + list.join(" "), QuazaaIRC::Status); } } }
void LogMessagesViewer::appendMessages() { wxCriticalSectionLocker lock( _messagesCS ); if ( _messages.empty() ) { return; } BeginBatch(); int row = GetNumberRows(); AppendRows( _messages.size() ); do { appendMessage( _messages.front(), row ); _messages.pop(); ++row; } while ( !_messages.empty() ); AutoSizeColumns(); EndBatch(); MakeCellVisible( GetNumberRows()-1, 0 ); }
void JDMainWin::incomingMessage(const QString &message, JDCommands::Command command) { switch(command) { case JDCommands::CommandLs: parse(message); break; case JDCommands::CommandRm: case JDCommands::CommandMkDir: case JDCommands::CommandMv: QTimer::singleShot(100, this, SLOT(refresh())); break; case JDCommands::CommandGet: case JDCommands::CommandCd: case JDCommands::CommandSend: case JDCommands::CommandHash: case JDCommands::CommandLang: case JDCommands::CommandPwd: case JDCommands::CommandHelp: case JDCommands::CommandIntro: case JDCommands::CommandDu: case JDCommands::CommandLink: case JDCommands::CommandNoCommand: break; } appendMessage(message, false); }
void ApplicationLauncher::readStandardError() { QByteArray data = d->m_guiProcess.readAllStandardError(); QString msg = d->m_outputCodec->toUnicode( data.constData(), data.length(), &d->m_errorCodecState); emit appendMessage(msg, Utils::StdErrFormatSameLine); }
void gajim::loadMessages(const QString &path) { QDir dir = path; QFileInfo info(dir.filePath("logs.db")); if(!info.exists()) return; QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); db.setDatabaseName(info.absoluteFilePath()); if(!db.open()) return; setProtocol("jabber"); setAccount(m_account); QSqlQuery jid_query("SELECT jid_id, jid FROM jids", db); setMaxValue(jid_query.size()); int num = 0; while(jid_query.next()) { QString jid_id = jid_query.value(0).toString(); QString jid = jid_query.value(1).toString(); setContact(jid); static QString query_str = "SELECT time, message, kind FROM logs " "WHERE jid_id = %1 AND (kind = 4 OR kind = 6) " "ORDER BY time ASC"; QSqlQuery query(query_str.arg(jid_id), db); while(query.next()) { Message message; message.setTime(QDateTime::fromTime_t(query.value(0).toInt())); message.setIncoming(query.value(2).toInt() == 4); message.setText(query.value(1).toString()); appendMessage(message); } setValue(++num); } }
ChatDialog::ChatDialog(QWidget *parent) : QDialog(parent) { setupUi(this); // Meme generator setup lineEdit_2->setFocusPolicy(Qt::StrongFocus); connect(lineEdit_2, SIGNAL(returnPressed()), this, SLOT(memeReturnedPressed())); memeGenLayout->setPixmap(QPixmap(memepath+memefile)); std::default_random_engine rand (100); this->qme =new QEncryption(rand()); this->qmg =new QmemeGeneration(); lineEdit->setFocusPolicy(Qt::StrongFocus); textEdit->setFocusPolicy(Qt::NoFocus); textEdit->setReadOnly(true); listWidget->setFocusPolicy(Qt::NoFocus); connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(returnPressed())); connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(returnPressed())); connect(&client, SIGNAL(newMessage(QString,QString)), this, SLOT(appendMessage(QString,QString))); connect(&client, SIGNAL(newParticipant(QString)), this, SLOT(newParticipant(QString))); connect(&client, SIGNAL(participantLeft(QString)), this, SLOT(participantLeft(QString))); myNickName = client.nickName(); newParticipant(myNickName); tableFormat.setBorder(0); QTimer::singleShot(10 * 1000, this, SLOT(showInformation())); }
void ChatDlg::incomingMessage(const Message &m) { if (m.body().isEmpty()) { // Event message if (m.containsEvent(CancelEvent)) { setContactChatState(XMPP::StatePaused); } else if (m.containsEvent(ComposingEvent)) { setContactChatState(XMPP::StateComposing); } if (m.chatState() != XMPP::StateNone) { setContactChatState(m.chatState()); } } else { // Normal message // Check if user requests event messages sendComposingEvents_ = m.containsEvent(ComposingEvent); if (!m.eventId().isEmpty()) { eventId_ = m.eventId(); } if (m.containsEvents() || m.chatState() != XMPP::StateNone) { setContactChatState(XMPP::StateActive); } else { setContactChatState(XMPP::StateNone); } appendMessage(m); } }
ChatDialog::ChatDialog(QWidget *parent) : QDialog(parent),ui(new Ui::ChatDialog) { ui->setupUi(this); lineEdit->setFocusPolicy(Qt::StrongFocus); //textEdit->setFocusPolicy(Qt::NoFocus); //textEdit->setReadOnly(true); //listWidget->setFocusPolicy(Qt::NoFocus); connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(returnPressed())); connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(returnPressed())); connect(&client, SIGNAL(newMessage(QString,QString)), this, SLOT(appendMessage(QString,QString))); // connect(&client, SIGNAL(newParticipant(QString)), // this, SLOT(newParticipant(QString))); // connect(&client, SIGNAL(participantLeft(QString)), // this, SLOT(participantLeft(QString))); myNickName = client.nickName(); // newParticipant(myNickName); // tableFormat.setBorder(0); // QTimer::singleShot(10 * 1000, this, SLOT(showInformation())); ui->widget->setClient(&client); }
//-------------------------------------------------------------- void ofApp::sendLine(int i) { LedLine &line = ledLine[i]; //ofPixels pixelCrop; line.src->cropTo(line.pixelCrop, 0 , line.offset, line.Xsize, line.size); ofBuffer imgAsBuffer; imgAsBuffer.clear(); imgAsBuffer.append((const char*)line.pixelCrop.getData(),line.nbPix*3); ofxOscMessage m; m.setAddress(line.address); m.addBlobArg(imgAsBuffer); // this code comes from ofxOscSender::sendMessage in ofxOscSender.cpp static const int OUTPUT_BUFFER_SIZE = 16384; char buffer[OUTPUT_BUFFER_SIZE]; osc::OutboundPacketStream p( buffer, OUTPUT_BUFFER_SIZE ); // serialise the message p << osc::BeginBundleImmediate; appendMessage( m, p ); p << osc::EndBundle; ofx::IO::ByteBuffer toEncode(p.Data(),p.Size()); try { line.dev->dev.send(toEncode); } catch ( serial::SerialException e) { ofLogError("sendLine") << "failed to send data : " << e.what(); line.dev->setup(); } }
ChatDialog::ChatDialog(QWidget *parent) : QDialog(parent) { setupUi(this); lineEdit->setFocusPolicy(Qt::StrongFocus); textEdit->setFocusPolicy(Qt::NoFocus); textEdit->setReadOnly(true); listWidget->setFocusPolicy(Qt::NoFocus); connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(returnPressed())); #ifdef Q_OS_SYMBIAN connect(sendButton, SIGNAL(clicked()), this, SLOT(returnPressed())); #endif connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(returnPressed())); connect(&client, SIGNAL(newMessage(QString,QString)), this, SLOT(appendMessage(QString,QString))); connect(&client, SIGNAL(newParticipant(QString)), this, SLOT(newParticipant(QString))); connect(&client, SIGNAL(participantLeft(QString)), this, SLOT(participantLeft(QString))); myNickName = client.nickName(); newParticipant(myNickName); tableFormat.setBorder(0); QTimer::singleShot(10 * 1000, this, SLOT(showInformation())); }
void ofApp::setDither(int i, int dither) { // check for waiting messages LedLine line = ledLine[i]; ofxOscMessage n; n.setAddress("/b"); n.addIntArg(dither); // this code come from ofxOscSender::sendMessage in ofxOscSender.cpp static const int OUTPUT_BUFFER_SIZE = 16384; char buffer[OUTPUT_BUFFER_SIZE]; osc::OutboundPacketStream p( buffer, OUTPUT_BUFFER_SIZE ); // serialise the message p << osc::BeginBundleImmediate; appendMessage( n, p ); p << osc::EndBundle; ofx::IO::ByteBuffer toEncode(p.Data(),p.Size()); try { line.dev->dev.send(toEncode); } catch ( serial::SerialException e) { ofLogError("sendLine") << "failed to send data : " << e.what(); line.dev->setup(); } }
void WaveformClient::readMessage () { std::cout << "in WaveformClient readMessage" << std::endl; QDataStream in(tcpSocket); in.setVersion(QDataStream::Qt_4_0); if (blockSize == 0) { if (tcpSocket->bytesAvailable() < (int)sizeof(quint16)) { std::cout << "bytes available " << tcpSocket->bytesAvailable() << " is less than quint16 size " << (int)sizeof(quint16)<< std::endl; return; } in >> blockSize; std::cout << "blocksize " << blockSize << std::endl; } if (tcpSocket->bytesAvailable() < blockSize) { std::cout << "bytes available " << tcpSocket->bytesAvailable() << " is less than blocksize " << blockSize << std::endl; return; } blockSize = 0; QString tmpString; in >> tmpString; std::stringstream ss; ss << tmpString.toStdString(); boost::archive::text_iarchive archive(ss); archive >> receivedMessage; std::cout << "received message [" << tmpString.toStdString() << "]" << std::endl; std::cout << "received message [" << receivedMessage.seq_id << "]" << std::endl; QTimer::singleShot(0, this, SLOT(appendMessage())); }
void AndroidRunControl::handleRemoteProcessFinished(const QString &error) { appendMessage(error, Utils::ErrorMessageFormat); disconnect(m_runner, 0, this, 0); m_running = false; emit finished(); }
void ApplicationLauncher::consoleProcessError(const QString &error) { emit appendMessage(error + QLatin1Char('\n'), Utils::ErrorMessageFormat); if (d->m_processRunning && d->m_consoleProcess.applicationPID() == 0) { d->m_processRunning = false; emit processExited(-1); } }
void ChatChannel::send(const QString &text) { Message message(text); message.setIncoming(false); message.setChatUnit(m_unit); message.setTime(QDateTime::currentDateTime()); appendMessage(message); }
void LocalApplicationRunControl::start() { m_applicationLauncher.start(m_runMode, m_executable, m_commandLineArguments); emit started(); QString msg = tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable)); appendMessage(msg, NormalMessageFormat); }
// // Cause the held message of this type to get sent now // void Controller::sendHeldMessage( int message ) { HeldMessageMap::iterator iter = m_heldMessages.find( message ); if ( iter == m_heldMessages.end() ) return; appendMessage( message, iter->second.value, iter->second.data, iter->second.flags ); m_heldMessages.erase( iter ); }
void QtChatHistoryWidget::addMessage(const QString& html,const QtChatTheme::Position & pos) { if(pos == QtChatTheme::Next){ appendNextMessage(html); }else{ appendMessage(html); } }
void Dialog::caseMessage( af::Msg * msg) { //AFINFO("void Dialog::caseMessage( Msg msg)\n"); if( msg == NULL) { AFERROR("Dialog::caseMessage: msg == NULL\n"); return; } #ifdef AFOUTPUT msg->stdOut(); #endif switch( msg->type()) { case af::Msg::TClientExitRequest: case af::Msg::TVersionMismatch: case af::Msg::TMagicMismatch: { emit stop(); break; } case af::Msg::TTalkId: { if( talk->getId()) { if( msg->int32() != talk->getId()) connectionLost(); } else { if( msg->int32()) { talk->setId( msg->int32()); qthreadClientUp->setUpMsg( new af::Msg( af::Msg::TTalkUpdateId, talk->getId(), true)); } else connectionLost(); } break; } case af::Msg::TTalksList: { upOnline( *msg); break; } case af::Msg::TTalkData: { af::MCTalkmessage amsg( msg); std::string user, text; amsg.getUser( user); amsg.getText( text); appendMessage( afqt::stoq( user), afqt::stoq( text)); break; } default: AFERROR("Dialog::caseMessage Unknown message recieved.\n"); msg->stdOut(); } delete msg; }
void LocalApplicationRunControl::start() { emit started(); if (m_executable.isEmpty()) { appendMessage(tr("No executable specified.") + QLatin1Char('\n'), Utils::ErrorMessageFormat); emit finished(); } else if (!QFileInfo::exists(m_executable)) { appendMessage(tr("Executable %1 does not exist.").arg(QDir::toNativeSeparators(m_executable)) + QLatin1Char('\n'), Utils::ErrorMessageFormat); emit finished(); } else { m_running = true; QString msg = tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable)) + QLatin1Char('\n'); appendMessage(msg, Utils::NormalMessageFormat); m_applicationLauncher.start(m_runMode, m_executable, m_commandLineArguments); setApplicationProcessHandle(ProcessHandle(m_applicationLauncher.applicationPID())); } }
bool ChatSession::sendMessage(Message* msg) { Task* task = new Tasks::SendMessage(m_contact, msg, m_account->client()); connect(task, SIGNAL(done(quint32, bool)), this, SLOT(slotMessageStatus(quint32, bool))); appendMessage(msg); return task->exec(); }
void QtChatHistoryWidget::insertStatusMessage(const QString & message, const QTime& time) { QString html = _theme->getStatusMessage(); _theme->setKeywordValue(html, "message", QtChatUtils::fixHTMLforJavascript(message)); _theme->setKeywordValue(html, "time", time.toString("HH:mm")); _theme->setKeywordValue(html, "shortTime", time.toString("HH:mm")); _lastSenderName = ""; //VOXOX - CJC - 2009.09.17 Force to be a new message after adding a status message appendMessage(html); }
static void listener_ircSend(void *subject, const char *event, void *data, va_list args) { IrcConnection *connection = subject; char *message = va_arg(args, char *); if(irc == connection) { appendMessage("*status", message, MESSAGE_SEND); } }