mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Add support for printing more information in diagnosis log
Also yacreaderlibraryserver can now print this with the --system-info option This will help when giving support to users.
This commit is contained in:
parent
a3f3149764
commit
1c48f05398
@ -106,7 +106,8 @@ HEADERS += ../common/comic.h \
|
||||
../common/exit_check.h \
|
||||
../common/scroll_management.h \
|
||||
../common/opengl_checker.h \
|
||||
../common/pdf_comic.h
|
||||
../common/pdf_comic.h \
|
||||
../common/global_info_provider.h \
|
||||
|
||||
!CONFIG(no_opengl) {
|
||||
HEADERS += ../common/gl/yacreader_flow_gl.h \
|
||||
@ -143,7 +144,8 @@ SOURCES += ../common/comic.cpp \
|
||||
../common/yacreader_global_gui.cpp \
|
||||
../common/exit_check.cpp \
|
||||
../common/scroll_management.cpp \
|
||||
../common/opengl_checker.cpp
|
||||
../common/opengl_checker.cpp \
|
||||
../common/global_info_provider.cpp \
|
||||
|
||||
!CONFIG(no_opengl) {
|
||||
SOURCES += ../common/gl/yacreader_flow_gl.cpp \
|
||||
|
@ -154,7 +154,8 @@ HEADERS += comic_flow.h \
|
||||
db/reading_list.h \
|
||||
db/query_parser.h \
|
||||
current_comic_view_helper.h \
|
||||
ip_config_helper.h
|
||||
ip_config_helper.h \
|
||||
../common/global_info_provider.h \
|
||||
|
||||
!CONFIG(no_opengl) {
|
||||
HEADERS += ../common/gl/yacreader_flow_gl.h
|
||||
@ -240,7 +241,8 @@ SOURCES += comic_flow.cpp \
|
||||
db/reading_list.cpp \
|
||||
current_comic_view_helper.cpp \
|
||||
db/query_parser.cpp \
|
||||
ip_config_helper.cpp
|
||||
ip_config_helper.cpp \
|
||||
../common/global_info_provider.cpp \
|
||||
|
||||
!CONFIG(no_opengl) {
|
||||
SOURCES += ../common/gl/yacreader_flow_gl.cpp
|
||||
|
@ -69,6 +69,7 @@ HEADERS += ../YACReaderLibrary/library_creator.h \
|
||||
../YACReaderLibrary/db/query_parser.h \
|
||||
../YACReaderLibrary/db/search_query.h \
|
||||
../YACReaderLibrary/libraries_update_coordinator.h \
|
||||
../common/global_info_provider.h \
|
||||
|
||||
|
||||
SOURCES += ../YACReaderLibrary/library_creator.cpp \
|
||||
@ -100,6 +101,7 @@ SOURCES += ../YACReaderLibrary/library_creator.cpp \
|
||||
../YACReaderLibrary/db/query_parser.cpp \
|
||||
../YACReaderLibrary/db/search_query.cpp \
|
||||
../YACReaderLibrary/libraries_update_coordinator.cpp \
|
||||
../common/global_info_provider.cpp \
|
||||
|
||||
include(../YACReaderLibrary/server/server.pri)
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "yacreader_global.h"
|
||||
#include "yacreader_libraries.h"
|
||||
#include "yacreader_local_server.h"
|
||||
#include "global_info_provider.h"
|
||||
|
||||
#include "libraries_update_coordinator.h"
|
||||
|
||||
@ -88,6 +89,7 @@ int main(int argc, char **argv)
|
||||
parser.addPositionalArgument("command", "The command to execute. [start, create-library, update-library, add-library, remove-library, list-libraries, set-port, rescan-xml-info]");
|
||||
parser.addOption({ "loglevel", "Set log level. Valid values: trace, info, debug, warn, error.", "loglevel", "info" });
|
||||
parser.addOption({ "port", "Set server port (temporary). Valid values: 1-65535", "port" });
|
||||
parser.addOption({ "system-info", "Prints detailed information about the system environment, including OS version, hardware specifications, and available resources." });
|
||||
parser.parse(app.arguments());
|
||||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
@ -100,6 +102,15 @@ int main(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (parser.isSet("system-info")) {
|
||||
auto globalInfo = YACReader::getGlobalInfo();
|
||||
for (const auto &line : globalInfo.split("\n")) {
|
||||
qout << line << Qt::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
QSettings *settings = new QSettings(settingsPath, QSettings::IniFormat);
|
||||
settings->beginGroup("libraryConfig");
|
||||
|
||||
@ -444,8 +455,10 @@ void messageHandler(QtMsgType type, const QMessageLogContext &context, const QSt
|
||||
void logSystemAndConfig()
|
||||
{
|
||||
QLOG_INFO() << "---------- System & configuration ----------";
|
||||
QLOG_INFO() << "OS:" << QSysInfo::prettyProductName() << "Version: " << QSysInfo::productVersion();
|
||||
QLOG_INFO() << "Kernel:" << QSysInfo::kernelType() << QSysInfo::kernelVersion() << "Architecture:" << QSysInfo::currentCpuArchitecture();
|
||||
auto globalInfo = YACReader::getGlobalInfo();
|
||||
for (const auto &line : globalInfo.split("\n")) {
|
||||
QLOG_INFO() << line;
|
||||
}
|
||||
QLOG_INFO() << "Libraries: " << DBHelper::getLibraries().getLibraries();
|
||||
QLOG_INFO() << "--------------------------------------------";
|
||||
}
|
||||
|
51
common/global_info_provider.cpp
Normal file
51
common/global_info_provider.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
#include "global_info_provider.h"
|
||||
|
||||
#include <QtCore>
|
||||
#include <QImageReader>
|
||||
#include <QPaintDevice>
|
||||
|
||||
#ifdef YACREADER_LIBRARY
|
||||
#include <QSqlDatabase>
|
||||
#endif
|
||||
|
||||
QString YACReader::getGlobalInfo()
|
||||
{
|
||||
QString text;
|
||||
|
||||
text.append("SYSTEM INFORMATION\n");
|
||||
text.append(QString("Qt version: %1\n").arg(qVersion()));
|
||||
text.append(QString("Build ABI: %1\n").arg(QSysInfo::buildAbi()));
|
||||
text.append(QString("build CPU architecture: %1\n").arg(QSysInfo::buildCpuArchitecture()));
|
||||
text.append(QString("CPU architecture: %1\n").arg(QSysInfo::currentCpuArchitecture()));
|
||||
text.append(QString("Kernel type: %1\n").arg(QSysInfo::kernelType()));
|
||||
text.append(QString("Kernel version: %1\n").arg(QSysInfo::kernelVersion()));
|
||||
text.append(QString("Product info: %1\n").arg(QSysInfo::prettyProductName()));
|
||||
|
||||
text.append("\nAPP INFORMATION\n");
|
||||
text.append(QString("Image formats supported: %1\n").arg(QImageReader::supportedImageFormats().join(", ")));
|
||||
// append if sqlite driver is available
|
||||
#ifdef YACREADER_LIBRARY
|
||||
text.append(QString("SQLite driver available: %1\n").arg(QSqlDatabase::isDriverAvailable("QSQLITE") ? "yes" : "no"));
|
||||
#endif
|
||||
|
||||
#ifdef use_unarr
|
||||
text.append("Compression backend: unarr (no RAR5 support)\n");
|
||||
#elif defined use_libarchive
|
||||
text.append("Compression backend: libarchive\n");
|
||||
#else
|
||||
text.append("Compression backend: 7zip\n");
|
||||
#endif
|
||||
|
||||
// print pdf backend used, poppler, pdfkit, pdfium
|
||||
#ifdef NO_PDF
|
||||
text.append("PDF support: None\n");
|
||||
#elif defined USE_PDFKIT
|
||||
text.append("PDF support: PDFKit\n");
|
||||
#elif defined USE_PDFIUM
|
||||
text.append("PDF support: PDFium\n");
|
||||
#else
|
||||
text.append("PDF support: Poppler\n");
|
||||
#endif
|
||||
|
||||
return text;
|
||||
}
|
12
common/global_info_provider.h
Normal file
12
common/global_info_provider.h
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef GLOBAL_INFO_PROVIDER_H
|
||||
#define GLOBAL_INFO_PROVIDER_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
namespace YACReader {
|
||||
|
||||
QString getGlobalInfo();
|
||||
|
||||
}
|
||||
|
||||
#endif // GLOBAL_INFO_PROVIDER_H
|
@ -1,6 +1,7 @@
|
||||
#include "help_about_dialog.h"
|
||||
|
||||
#include "opengl_checker.h"
|
||||
#include "global_info_provider.h"
|
||||
|
||||
#include <QtCore>
|
||||
#include <QVBoxLayout>
|
||||
@ -97,54 +98,12 @@ QString HelpAboutDialog::fileToString(const QString &path)
|
||||
|
||||
void HelpAboutDialog::loadSystemInfo()
|
||||
{
|
||||
QString text;
|
||||
|
||||
text.append("SYSTEM INFORMATION\n");
|
||||
text.append(QString("Qt version: %1\n").arg(qVersion()));
|
||||
text.append(QString("Build ABI: %1\n").arg(QSysInfo::buildAbi()));
|
||||
text.append(QString("build CPU architecture: %1\n").arg(QSysInfo::buildCpuArchitecture()));
|
||||
text.append(QString("CPU architecture: %1\n").arg(QSysInfo::currentCpuArchitecture()));
|
||||
text.append(QString("Kernel type: %1\n").arg(QSysInfo::kernelType()));
|
||||
text.append(QString("Kernel version: %1\n").arg(QSysInfo::kernelVersion()));
|
||||
text.append(QString("Product info: %1\n").arg(QSysInfo::prettyProductName()));
|
||||
|
||||
// QProcess systemInfoProcess;
|
||||
// QString tempOutput;
|
||||
|
||||
// if (QSysInfo::kernelType() == "winnt") {
|
||||
// QString cpuname = "wmic cpu get name";
|
||||
// systemInfoProcess.start("cmd", QList<QString>() << "/C" << cpuname);
|
||||
// systemInfoProcess.waitForFinished();
|
||||
// tempOutput = QString(systemInfoProcess.readAllStandardOutput()).replace("\n", " ");
|
||||
// text.append(QString("CPU: %1\n").arg(tempOutput));
|
||||
// }
|
||||
|
||||
// if (QSysInfo::kernelType() == "linux") {
|
||||
// QString cpuname = "cat /proc/cpuinfo | grep 'model name' | uniq";
|
||||
// systemInfoProcess.start("bash", QList<QString>() << "-c" << cpuname);
|
||||
// systemInfoProcess.waitForFinished();
|
||||
// tempOutput = systemInfoProcess.readAllStandardOutput();
|
||||
// text.append(QString("CPU: %1\n").arg(tempOutput));
|
||||
// }
|
||||
auto text = YACReader::getGlobalInfo();
|
||||
|
||||
auto openGLChecker = OpenGLChecker();
|
||||
text.append("\nGRAPHIC INFORMATION\n");
|
||||
text.append(QString("Screen pixel ratio: %1\n").arg(devicePixelRatioF()));
|
||||
text.append(QString("OpenGL version: %1\n").arg(openGLChecker.textVersionDescription()));
|
||||
|
||||
// if (QSysInfo::kernelType() == "winnt") {
|
||||
// QString gpu = "wmic PATH Win32_videocontroller get VideoProcessor";
|
||||
// systemInfoProcess.start("cmd", QList<QString>() << "/C" << gpu);
|
||||
// systemInfoProcess.waitForFinished();
|
||||
// tempOutput = systemInfoProcess.readAllStandardOutput();
|
||||
// text.append(QString("GPU: %1\n").arg(tempOutput));
|
||||
|
||||
// QString gpuram = "wmic PATH Win32_VideoController get AdapterRAM";
|
||||
// systemInfoProcess.start("cmd", QList<QString>() << "/C" << gpuram);
|
||||
// systemInfoProcess.waitForFinished();
|
||||
// tempOutput = systemInfoProcess.readAllStandardOutput();
|
||||
// text.append(QString("GPU RAM: %1\n").arg(tempOutput));
|
||||
// }
|
||||
|
||||
systemInfoText->setText(text);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user