| 140 | } |
| 141 | |
| 142 | void |
| 143 | LogDialog::onMessage(Suscan::LoggerMessage msg) |
| 144 | { |
| 145 | int newRow = this->ui->logTableWidget->rowCount(); |
| 146 | |
| 147 | this->msgVec.push_back(msg); |
| 148 | this->ui->logTableWidget->insertRow(newRow); |
| 149 | |
| 150 | this->ui->logTableWidget->setItem( |
| 151 | newRow, |
| 152 | 1, |
| 153 | new QTableWidgetItem( |
| 154 | QDateTime::fromTime_t( |
| 155 | static_cast<unsigned int>(msg.time.tv_sec)).toString())); |
| 156 | |
| 157 | this->ui->logTableWidget->setItem( |
| 158 | newRow, |
| 159 | 0, |
| 160 | LogDialog::makeSeverityItem(msg.severity)); |
| 161 | |
| 162 | this->ui->logTableWidget->setItem( |
| 163 | newRow, |
| 164 | 3, |
| 165 | new QTableWidgetItem(QString::fromStdString(msg.domain))); |
| 166 | |
| 167 | this->ui->logTableWidget->setItem( |
| 168 | newRow, |
| 169 | 2, |
| 170 | new QTableWidgetItem(QString::fromStdString(msg.message).trimmed())); |
| 171 | |
| 172 | this->ui->logTableWidget->setItem( |
| 173 | newRow, |
| 174 | 4, |
| 175 | new QTableWidgetItem(QString::fromStdString(msg.function))); |
| 176 | |
| 177 | this->ui->logTableWidget->setItem( |
| 178 | newRow, |
| 179 | 5, |
| 180 | new QTableWidgetItem(QString::number(msg.line))); |
| 181 | |
| 182 | this->ui->logTableWidget->resizeColumnsToContents(); |
| 183 | |
| 184 | if (this->ui->autoScrollButton->isChecked()) |
| 185 | this->ui->logTableWidget->scrollToBottom(); |
| 186 | |
| 187 | if (msg.severity == SU_LOG_SEVERITY_CRITICAL || |
| 188 | msg.severity == SU_LOG_SEVERITY_ERROR) |
| 189 | this->errorFound = true; |
| 190 | } |
| 191 | |
| 192 | void |
| 193 | LogDialog::onClear(void) |