chore: update files of project

This commit is contained in:
x-tools-author 2024-04-07 13:46:37 +08:00
parent 1e3c5e9032
commit ba5e78c3b2
2 changed files with 13 additions and 13 deletions

View File

@ -45,7 +45,7 @@ set(BUILD_TESTING OFF)
set(BUILD_SHARED_LIBS OFF)
if(${CMAKE_BUILD_TYPE} STREQUAL "Release")
add_compile_definitions(X_TOOLS_USING_GLOG)
add_compile_definitions(X_TOOLS_USING_GOOGLE_LOG)
endif()
add_compile_definitions(X_TOOLS_IMPORT_MODULE_MDNS)
add_compile_definitions(X_TOOLS_IMPORT_MODULE_QRCODE)

View File

@ -19,15 +19,15 @@
#include "xToolsMainWindow.h"
#include "xToolsSettings.h"
#ifdef X_TOOLS_USING_GLOG
#ifdef X_TOOLS_USING_GOOGLE_LOG
#include "glog/logging.h"
#endif
#ifdef X_TOOLS_ENABLE_HIGH_DPI_POLICY
#include "xToolsDataStructure.h"
#endif
#ifdef X_TOOLS_USING_GLOG
static void xToolsInitGoogleLogging(char* argv0)
#ifdef X_TOOLS_USING_GOOGLE_LOG
static void xToolsInitGoogleLogging(char *argv0)
{
QString logPath = xToolsSettings::instance()->settingsPath();
logPath += "/log";
@ -55,7 +55,7 @@ static void xToolsInitGoogleLogging(char* argv0)
}
#endif
#ifdef X_TOOLS_USING_GLOG
#ifdef X_TOOLS_USING_GOOGLE_LOG
static void xToolsShutdownGoogleLogging()
{
#ifndef QT_DEBUG
@ -64,11 +64,11 @@ static void xToolsShutdownGoogleLogging()
}
#endif
#ifdef X_TOOLS_USING_GLOG
static void qtLogToGoogleLog(QtMsgType type, const QMessageLogContext& context, const QString& msg)
#ifdef X_TOOLS_USING_GOOGLE_LOG
static void qtLogToGoogleLog(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
QByteArray localMsg = msg.toUtf8();
const char* file = context.file ? context.file : "";
const char *file = context.file ? context.file : "";
const int line = context.line;
switch (type) {
@ -108,7 +108,7 @@ static void xToolsInitApp(const QString &appName)
static void xToolsInstallMessageHandler()
{
#ifdef X_TOOLS_USING_GLOG
#ifdef X_TOOLS_USING_GOOGLE_LOG
qInstallMessageHandler(qtLogToGoogleLog);
#endif
}
@ -138,7 +138,7 @@ static void xToolsInitHdpi()
int policy = xToolsSettings::instance()->hdpiPolicy();
if (!xToolsDataStructure::isValidHighDpiPolicy(policy)) {
qWarning() << "The value of hdpi policy is not specified, set to default value:"
<< QGuiApplication::highDpiScaleFactorRoundingPolicy();
<< QGuiApplication::highDpiScaleFactorRoundingPolicy();
return;
}
@ -156,7 +156,7 @@ static void xToolsInitAppStyle()
qInfo() << "The current style of application is:" << qPrintable(style);
if (style.isEmpty()) {
qWarning() << "The application style is not specified, the default style is:"
<< qPrintable(QApplication::style()->objectName());
<< qPrintable(QApplication::style()->objectName());
} else if (keys.contains(style) || keys.contains(style.toLower())) {
qInfo() << "The current style of application is:" << qPrintable(style);
QApplication::setStyle(QStyleFactory::create(style));
@ -166,7 +166,7 @@ static void xToolsInitAppStyle()
static void sakDoSomethingBeforeAppCreated(char *argv[], const QString &appName)
{
xToolsInitApp(appName);
#ifdef X_TOOLS_USING_GLOG
#ifdef X_TOOLS_USING_GOOGLE_LOG
xToolsInitGoogleLogging(argv[0]);
xToolsInstallMessageHandler();
#else
@ -178,7 +178,7 @@ static void sakDoSomethingBeforeAppCreated(char *argv[], const QString &appName)
static void sakDoSomethingAfterAppExited()
{
#ifdef X_TOOLS_USING_GLOG
#ifdef X_TOOLS_USING_GOOGLE_LOG
xToolsShutdownGoogleLogging();
#endif
}