Screenrecorder
Credit goes to Neokii! https: //github.com/neokii Co-Authored-By: neokii <3665951+neokii@users.noreply.github.com>
This commit is contained in:
@@ -444,8 +444,17 @@ AnnotatedCameraWidget::AnnotatedCameraWidget(VisionStreamType type, QWidget* par
|
||||
main_layout->setMargin(UI_BORDER_SIZE);
|
||||
main_layout->setSpacing(0);
|
||||
|
||||
// Neokii screen recorder
|
||||
QHBoxLayout *top_right_layout = new QHBoxLayout();
|
||||
top_right_layout->setSpacing(0);
|
||||
recorder_btn = new ScreenRecorder(this);
|
||||
top_right_layout->addWidget(recorder_btn);
|
||||
|
||||
experimental_btn = new ExperimentalButton(this);
|
||||
main_layout->addWidget(experimental_btn, 0, Qt::AlignTop | Qt::AlignRight);
|
||||
top_right_layout->addWidget(experimental_btn);
|
||||
|
||||
main_layout->addLayout(top_right_layout, 0);
|
||||
main_layout->setAlignment(top_right_layout, Qt::AlignTop | Qt::AlignRight);
|
||||
|
||||
map_settings_btn = new MapSettingsButton(this);
|
||||
main_layout->addWidget(map_settings_btn, 0, Qt::AlignBottom | Qt::AlignRight);
|
||||
@@ -962,8 +971,12 @@ void AnnotatedCameraWidget::drawLead(QPainter &painter, const cereal::RadarState
|
||||
}
|
||||
|
||||
void AnnotatedCameraWidget::paintGL() {
|
||||
}
|
||||
|
||||
void AnnotatedCameraWidget::paintEvent(QPaintEvent *event) {
|
||||
UIState *s = uiState();
|
||||
SubMaster &sm = *(s->sm);
|
||||
QPainter painter(this);
|
||||
const double start_draw_t = millis_since_boot();
|
||||
const cereal::ModelDataV2::Reader &model = sm["modelV2"].getModelV2();
|
||||
|
||||
@@ -1008,11 +1021,12 @@ void AnnotatedCameraWidget::paintGL() {
|
||||
} else {
|
||||
CameraWidget::updateCalibration(DEFAULT_CALIBRATION);
|
||||
}
|
||||
painter.beginNativePainting();
|
||||
CameraWidget::setFrameId(model.getFrameId());
|
||||
CameraWidget::paintGL();
|
||||
painter.endNativePainting();
|
||||
}
|
||||
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
painter.setPen(Qt::NoPen);
|
||||
|
||||
@@ -1110,6 +1124,15 @@ void AnnotatedCameraWidget::initializeFrogPilotWidgets() {
|
||||
connect(animationTimer, &QTimer::timeout, this, [this] {
|
||||
animationFrameIndex = (animationFrameIndex + 1) % totalFrames;
|
||||
});
|
||||
|
||||
// Initialize the timer for the screen recorder
|
||||
QTimer *record_timer = new QTimer(this);
|
||||
connect(record_timer, &QTimer::timeout, this, [this]() {
|
||||
if (this->recorder_btn) {
|
||||
this->recorder_btn->update_screen();
|
||||
}
|
||||
});
|
||||
record_timer->start(1000 / UI_FREQ);
|
||||
}
|
||||
|
||||
void AnnotatedCameraWidget::updateFrogPilotWidgets(QPainter &p) {
|
||||
|
||||
Reference in New Issue
Block a user