Example #1
0
void Log::Add(const std::string& mesg)
{
    std::thread::id tid = std::this_thread::get_id();
    QColor color = ds::ThreadColor(tid);
    _buffer.push_back( std::make_pair(mesg, color) );
#ifdef QT_DEBUG
    qDebug() << mesg.c_str() << color;
#endif
    emit SendMesg(mesg.c_str(), color);
    if (_buffer.size() > MAXLEN) _buffer.clear();
}
Example #2
0
void MainMenu::on_toolButton_taida1_toggled(bool checked)
{
  struct MdMesg mmsg;
  mmsg.slave = 1;
  if(checked)
    {
      mmsg.value = ui->lineEdit_taida1->text().toFloat();

      qDebug()<<"checked";
    }
  else
    {
      mmsg.value = 0;
      qDebug()<<"unchecked";
    }
  emit SendMesg(mmsg);
}
Example #3
0
void Log::SendBuffer()
{
    std::lock_guard<std::mutex> lock(_mutex);
    for (const auto& it : _buffer)
        emit SendMesg(it.first.c_str(), it.second);
}