mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-08-03 10:49:25 +08:00
ui: move Error Troubleshoot to Device menu (#102)
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QDateTime>
|
||||
|
||||
#include "selfdrive/ui/qt/offroad/networking.h"
|
||||
|
||||
@@ -187,6 +189,19 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) {
|
||||
QString pin = f.readAll();
|
||||
addItem(new LabelControl(tr("Fleet Manager PIN"), pin));
|
||||
|
||||
// Error Troubleshoot
|
||||
auto errorBtn = new ButtonControl(
|
||||
tr("Error Troubleshoot"), tr("VIEW"),
|
||||
tr("Display error from the tmux session when an error has occurred from a system process."));
|
||||
QFileInfo file("/data/community/crashes/error.txt");
|
||||
QDateTime modifiedTime = file.lastModified();
|
||||
QString modified_time = modifiedTime.toString("yyyy-MM-dd hh:mm:ss ");
|
||||
connect(errorBtn, &ButtonControl::clicked, [=]() {
|
||||
const std::string txt = util::read_file("/data/community/crashes/error.txt");
|
||||
ConfirmationDialog::rich(modified_time + QString::fromStdString(txt), this);
|
||||
});
|
||||
addItem(errorBtn);
|
||||
|
||||
// offroad-only buttons
|
||||
|
||||
auto dcamBtn = new ButtonControl(tr("Driver Camera"), tr("PREVIEW"),
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include <QFileInfo>
|
||||
#include <QDateTime>
|
||||
|
||||
#include "common/watchdog.h"
|
||||
#include "selfdrive/ui/qt/api.h"
|
||||
@@ -86,22 +84,6 @@ SPGeneralPanel::SPGeneralPanel(QWidget *parent) : QWidget(parent) {
|
||||
"../assets/offroad/icon_network.png"
|
||||
));
|
||||
|
||||
// General: Error Troubleshoot
|
||||
auto errorBtn = new ButtonControl(
|
||||
tr("Error Troubleshoot"),
|
||||
tr("VIEW"),
|
||||
tr("Display error from the tmux session when an error has occurred from a system process.")
|
||||
);
|
||||
QFileInfo file("/data/community/crashes/error.txt");
|
||||
QDateTime modifiedTime = file.lastModified();
|
||||
QString modified_time = modifiedTime.toString("yyyy-MM-dd hh:mm:ss ");
|
||||
connect(errorBtn, &ButtonControl::clicked, [=]() {
|
||||
const std::string txt = util::read_file("/data/community/crashes/error.txt");
|
||||
ConfirmationDialog::rich(modified_time + QString::fromStdString(txt), this);
|
||||
});
|
||||
main_layout->addWidget(horizontal_line());
|
||||
main_layout->addWidget(errorBtn);
|
||||
|
||||
// General: Debug snapshot on screen center tap
|
||||
main_layout->addWidget(horizontal_line());
|
||||
main_layout->addWidget(new ParamControl(
|
||||
|
||||
Reference in New Issue
Block a user