feat: Display camera info in debug window
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
#include "DebugWindow.h"
|
||||
#include "Camera.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QTextEdit>
|
||||
#include <QString>
|
||||
|
||||
DebugWindow::DebugWindow(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
@@ -20,3 +22,27 @@ DebugWindow::DebugWindow(QWidget *parent)
|
||||
DebugWindow::~DebugWindow()
|
||||
{
|
||||
}
|
||||
|
||||
void DebugWindow::updateCameraInfo(const Camera* camera)
|
||||
{
|
||||
if (!camera) {
|
||||
m_textEdit->setText("Camera not available.");
|
||||
return;
|
||||
}
|
||||
|
||||
QString info;
|
||||
info += "Camera Info:\n";
|
||||
info += "----------------\n";
|
||||
info += QString("Rotation (X, Y): (%1, %2)\n").arg(camera->xRotation()).arg(camera->yRotation());
|
||||
info += QString("Zoom: %1\n").arg(camera->zoom());
|
||||
info += QString("Pan (X, Y): (%1, %2)\n").arg(camera->panX()).arg(camera->panY());
|
||||
info += QString("UI Camera Distance: %1\n").arg(camera->uiCameraDistance());
|
||||
info += "\n";
|
||||
info += "Saved State:\n";
|
||||
info += "----------------\n";
|
||||
info += QString("Rotation (X, Y): (%1, %2)\n").arg(camera->savedXRot()).arg(camera->savedYRot());
|
||||
info += QString("Zoom: %1\n").arg(camera->savedZoom());
|
||||
info += QString("Pan (X, Y): (%1, %2)\n").arg(camera->savedPanX()).arg(camera->savedPanY());
|
||||
|
||||
m_textEdit->setText(info);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <QDialog>
|
||||
|
||||
class QTextEdit;
|
||||
class Camera;
|
||||
|
||||
class DebugWindow : public QDialog
|
||||
{
|
||||
@@ -13,6 +14,8 @@ public:
|
||||
explicit DebugWindow(QWidget *parent = nullptr);
|
||||
~DebugWindow();
|
||||
|
||||
void updateCameraInfo(const Camera* camera);
|
||||
|
||||
private:
|
||||
QTextEdit* m_textEdit;
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "Feature.h"
|
||||
#include "ApplicationController.h"
|
||||
#include "DebugWindow.h"
|
||||
#include "Camera.h"
|
||||
|
||||
#include <QMenuBar>
|
||||
#include <QMenu>
|
||||
@@ -157,6 +158,8 @@ MainWindow::MainWindow(ApplicationController* appController, QWidget *parent)
|
||||
connect(m_viewport, &ViewportWidget::planeSelected, m_appController, &ApplicationController::onPlaneSelected);
|
||||
connect(m_viewport, &ViewportWidget::toolDeactivated, m_appController, [this]() { m_appController->setActiveTool(ApplicationController::ToolType::None); });
|
||||
|
||||
connect(m_viewport->camera(), &Camera::cameraChanged, this, &MainWindow::updateDebugInfo);
|
||||
|
||||
m_debugWindow = new DebugWindow(this);
|
||||
if (QProcessEnvironment::systemEnvironment().value("DEBUG") == "true") {
|
||||
showDebugWindow();
|
||||
@@ -197,9 +200,15 @@ bool MainWindow::saveAs()
|
||||
|
||||
void MainWindow::showDebugWindow()
|
||||
{
|
||||
updateDebugInfo();
|
||||
m_debugWindow->show();
|
||||
}
|
||||
|
||||
void MainWindow::updateDebugInfo()
|
||||
{
|
||||
m_debugWindow->updateCameraInfo(m_viewport->camera());
|
||||
}
|
||||
|
||||
void MainWindow::enterSketchMode()
|
||||
{
|
||||
m_tabWidget->removeTab(m_tabWidget->indexOf(m_toolsTab));
|
||||
|
||||
@@ -28,6 +28,7 @@ private slots:
|
||||
void saveSketch();
|
||||
|
||||
void showDebugWindow();
|
||||
void updateDebugInfo();
|
||||
|
||||
void enterSketchMode();
|
||||
void exitSketchMode();
|
||||
|
||||
Reference in New Issue
Block a user