Merge bitcoin-core/gui#72: util: Log static plugins meta data and used style

957895c715f86feaa26c806e5fa8ebb77430a926 util: Log static plugins meta data and style (Hennadii Stepanov)

Pull request description:

  This PR is a follow-up of https://github.com/bitcoin/bitcoin/pull/17826, and adds additional info about the imported static plugins and the used style to the `debug.log` I found useful for testing (e.g., with `QT_QPA_PLATFORM`, `QT_QPA_PLATFORMTHEME`, `QT_STYLE_OVERRIDE` variables) and debugging issues (e.g., https://github.com/bitcoin/bitcoin/pull/19716#issuecomment-674052881).

  The excerpt from the log:
  ```
  2020-11-15T18:41:45Z [main] Bitcoin Core version v0.20.99.0-f0b933f78 (release build)
  2020-11-15T18:41:45Z [main] Qt 5.9.8 (static), plugin=xcb (static)
  2020-11-15T18:41:45Z [main] Static plugins:
  2020-11-15T18:41:45Z [main]  QXcbIntegrationPlugin, version 329992
  2020-11-15T18:41:45Z [main] Style: fusion / QFusionStyle
  ...
  ```

ACKs for top commit:
  jarolrod:
    ACK 957895c715f86feaa26c806e5fa8ebb77430a926, Tested on macOS 11.1
  jonasschnelli:
    utACK 957895c715f86feaa26c806e5fa8ebb77430a926

Tree-SHA512: 0e46db7560f380fbda8ce5e53faa5d419a456e90ca595ce46be8e3030c99d3a113586edad1988a97e9bf0279e944f975968ed1156817bc16723ed31c64850239
This commit is contained in:
Jonas Schnelli 2021-01-28 10:14:28 +01:00 committed by Konstantin Akimov
parent 317777e7d7
commit 368c65d050
No known key found for this signature in database
GPG Key ID: 2176C4A5D01EA524

View File

@ -50,12 +50,14 @@
#include <QFontDatabase>
#include <QFontMetrics>
#include <QGuiApplication>
#include <QJsonObject>
#include <QKeyEvent>
#include <QLineEdit>
#include <QList>
#include <QLocale>
#include <QMenu>
#include <QMouseEvent>
#include <QPluginLoader>
#include <QPointer>
#include <QProgressDialog>
#include <QScreen>
@ -1814,6 +1816,20 @@ void LogQtInfo()
const std::string plugin_link{"dynamic"};
#endif
LogPrintf("Qt %s (%s), plugin=%s (%s)\n", qVersion(), qt_link, QGuiApplication::platformName().toStdString(), plugin_link);
const auto static_plugins = QPluginLoader::staticPlugins();
if (static_plugins.empty()) {
LogPrintf("No static plugins.\n");
} else {
LogPrintf("Static plugins:\n");
for (const QStaticPlugin& p : static_plugins) {
QJsonObject meta_data = p.metaData();
const std::string plugin_class = meta_data.take(QString("className")).toString().toStdString();
const int plugin_version = meta_data.take(QString("version")).toInt();
LogPrintf(" %s, version %d\n", plugin_class, plugin_version);
}
}
LogPrintf("Style: %s / %s\n", QApplication::style()->objectName().toStdString(), QApplication::style()->metaObject()->className());
LogPrintf("System: %s, %s\n", QSysInfo::prettyProductName().toStdString(), QSysInfo::buildAbi().toStdString());
for (const QScreen* s : QGuiApplication::screens()) {
LogPrintf("Screen: %s %dx%d, pixel ratio=%.1f\n", s->name().toStdString(), s->size().width(), s->size().height(), s->devicePixelRatio());