m_ui->receiveText->appendHtml(QString("<font color=\"%1\">%2</font>\n").arg(QColor(Qt::red).name(),tr("WARNING: You have NOT enabled auto-hold (stops updating the console if huge amounts of serial data arrive). Updating the console consumes significant CPU load, so if you receive more than about 5 KB/s of serial data, make sure to enable auto-hold if not using the console.")));
m_ui->receiveText->appendHtml(QString("<font color=\"%1\">%2</font>\n").arg(QGC::colorGreen.name(),tr("Link %1 is connected.").arg(currLink->getName())));
}else{
m_ui->connectButton->setText(tr("Connect"));
m_ui->receiveText->appendHtml(QString("<font color=\"%1\">%2</font>\n").arg(QGC::colorOrange.name(),tr("Link %1 is unconnected.").arg(currLink->getName())));
}
}
/** @brief Handle the connect button */
voidDebugConsole::handleConnectButton()
{
if(currLink){
if(currLink->isConnected()){
LinkManager::instance()->disconnect(currLink);
}else{
LinkManager::instance()->connectLink(currLink);
}
}
}
voidDebugConsole::keyPressEvent(QKeyEvent*event)
{
if(event->key()==Qt::Key_Up){
cycleCommandHistory(true);
}elseif(event->key()==Qt::Key_Down){
cycleCommandHistory(false);
}else{
QWidget::keyPressEvent(event);
}
}
voidDebugConsole::cycleCommandHistory(boolup)
{
// Only cycle if there is a history
if(commandHistory.length()>0){
// Store current command if we're not in history yet