mirror of
https://github.com/jellyfin/jellyfin-desktop.git
synced 2026-10-26 16:45:24 +00:00
Bring back old debug info
This commit is contained in:
1 parent
069e73f122
commit
eb5e07edc8
2 files changed
+75
No files matched your search
@@ -7,12 +7,18 @@
|
||||
#include "taskbar/TaskbarComponent.h"
|
||||
#include "input/InputComponent.h"
|
||||
#include "utils/Utils.h"
|
||||
#include "system/SystemComponent.h"
|
||||
|
||||
#include <QCursor>
|
||||
#include <QEvent>
|
||||
#include <QGuiApplication>
|
||||
#include <QScreen>
|
||||
#include <QDebug>
|
||||
#include <QQmlProperty>
|
||||
|
||||
#include <QOpenGLContext>
|
||||
#include <QOpenGLFunctions>
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
WindowManager& WindowManager::Get()
|
||||
@@ -142,6 +148,16 @@ void WindowManager::initializeWindow(QQuickWindow* window)
|
||||
connect(m_webView, SIGNAL(zoomFactorChanged()), this, SLOT(onZoomFactorChanged()));
|
||||
enforceZoom();
|
||||
}
|
||||
|
||||
m_infoTimer = new QTimer(this);
|
||||
m_infoTimer->setInterval(1000);
|
||||
|
||||
m_systemDebugInfo = SystemComponent::Get().debugInformation();
|
||||
|
||||
connect(m_infoTimer, &QTimer::timeout, this, &WindowManager::updateDebugInfo);
|
||||
connect(m_window, &QQuickWindow::beforeSynchronizing, this, &WindowManager::updateOpenGLInfo, static_cast<Qt::ConnectionType>(Qt::DirectConnection|Qt::SingleShotConnection));
|
||||
|
||||
QQmlProperty(m_window, "showDebugLayer").connectNotifySignal(this, SLOT(onShowDebugLayerChanged()));
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -881,6 +897,57 @@ void WindowManager::onZoomFactorChanged()
|
||||
enforceZoom();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void WindowManager::updateDebugInfo()
|
||||
{
|
||||
QString debugInfo = m_systemDebugInfo;
|
||||
debugInfo += DisplayComponent::Get().debugInformation();
|
||||
debugInfo += m_openglInfo;
|
||||
|
||||
QString infoString;
|
||||
QDebug info(&infoString);
|
||||
info << "Qt windowing info:\n";
|
||||
info << " FS: " << m_window->visibility() << "\n";
|
||||
info << " Geo: " << m_window->geometry() << "\n";
|
||||
for (QScreen* scr : QGuiApplication::screens())
|
||||
{
|
||||
info << " Screen" << scr->name() << scr->geometry() << "\n";
|
||||
}
|
||||
info << "\n";
|
||||
debugInfo += infoString;
|
||||
|
||||
m_window->setProperty("debugInfo", debugInfo);
|
||||
m_window->setProperty("videoInfo", PlayerComponent::Get().videoInformation());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void WindowManager::onShowDebugLayerChanged() {
|
||||
if(m_window->property("showDebugLayer").toBool()) {
|
||||
m_infoTimer->start();
|
||||
updateDebugInfo();
|
||||
} else {
|
||||
m_infoTimer->stop();
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void WindowManager::updateOpenGLInfo() {
|
||||
m_openglInfo = "";
|
||||
QOpenGLContext* glctx = QOpenGLContext::currentContext();
|
||||
if (glctx && glctx->isValid())
|
||||
{
|
||||
m_openglInfo += "\nOpenGL:\n";
|
||||
GLenum syms[4] = {GL_VENDOR, GL_RENDERER, GL_VERSION, GL_SHADING_LANGUAGE_VERSION};
|
||||
for (auto sym : syms)
|
||||
{
|
||||
auto s = glctx->functions()->glGetString(sym);
|
||||
if (s)
|
||||
m_openglInfo += QString(" ") + QString::fromUtf8(s) + "\n";
|
||||
}
|
||||
m_openglInfo += "\n";
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void WindowManager::enforceZoom()
|
||||
{
|
||||
|
||||
@@ -69,6 +69,9 @@ private slots:
|
||||
void updateWindowState(bool saveGeo = true);
|
||||
void saveGeometrySlot();
|
||||
void onZoomFactorChanged();
|
||||
void updateDebugInfo();
|
||||
void onShowDebugLayerChanged();
|
||||
void updateOpenGLInfo();
|
||||
|
||||
private:
|
||||
// Geometry (separate size/position)
|
||||
@@ -117,6 +120,11 @@ private:
|
||||
// initial size tracking to detect if size changed from default
|
||||
QSize m_initialSize;
|
||||
QSize m_initialScreenSize;
|
||||
|
||||
// debug info
|
||||
QString m_systemDebugInfo;
|
||||
QString m_openglInfo;
|
||||
QTimer* m_infoTimer;
|
||||
};
|
||||
|
||||
#endif // WINDOWMANAGER_H
|
||||
Reference in new issue
Block a user