From 40a5615d59b181dffe322f1360b535b51465d1a5 Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Sat, 8 May 2021 17:43:54 +0800 Subject: [PATCH 1/2] Remove ukui-log4qt model. --- src/main.cpp | 84 ++++++++++++++++++++++++------------------------ src/mainwindow.h | 1 + 2 files changed, 43 insertions(+), 42 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index aa5a701..cca0d2a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -62,50 +62,50 @@ using namespace Zeeker; //} -//void messageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) -//{ -// QByteArray localMsg = msg.toLocal8Bit(); -// QByteArray currentTime = QTime::currentTime().toString().toLocal8Bit(); +void messageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) +{ + QByteArray localMsg = msg.toLocal8Bit(); + QByteArray currentTime = QTime::currentTime().toString().toLocal8Bit(); -// bool showDebug = true; -//// QString logFilePath = QStandardPaths::writableLocation(QStandardPaths::TempLocation) + "/ukui-search.log"; -//// QString logFilePath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/.config/org.ukui/ukui-search/ukui-search.log"; -// QString logFilePath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/.config/org.ukui/ukui-search.log"; -// if (!QFile::exists(logFilePath)) { -// showDebug = false; -// } -// FILE *log_file = nullptr; + bool showDebug = true; +// QString logFilePath = QStandardPaths::writableLocation(QStandardPaths::TempLocation) + "/ukui-search.log"; +// QString logFilePath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/.config/org.ukui/ukui-search/ukui-search.log"; + QString logFilePath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/.config/org.ukui/ukui-search.log"; + if (!QFile::exists(logFilePath)) { + showDebug = false; + } + FILE *log_file = nullptr; -// if (showDebug) { -// log_file = fopen(logFilePath.toLocal8Bit().constData(), "a+"); -// } + if (showDebug) { + log_file = fopen(logFilePath.toLocal8Bit().constData(), "a+"); + } -// const char *file = context.file ? context.file : ""; -// const char *function = context.function ? context.function : ""; -// switch (type) { -// case QtDebugMsg: -// if (!log_file) { -// break; -// } -// fprintf(log_file, "Debug: %s: %s (%s:%u, %s)\n", currentTime.constData(), localMsg.constData(), file, context.line, function); -// break; -// case QtInfoMsg: -// fprintf(log_file? log_file: stdout, "Info: %s: %s (%s:%u, %s)\n", currentTime.constData(), localMsg.constData(), file, context.line, function); -// break; -// case QtWarningMsg: -// fprintf(log_file? log_file: stderr, "Warning: %s: %s (%s:%u, %s)\n", currentTime.constData(), localMsg.constData(), file, context.line, function); -// break; -// case QtCriticalMsg: -// fprintf(log_file? log_file: stderr, "Critical: %s: %s (%s:%u, %s)\n", currentTime.constData(), localMsg.constData(), file, context.line, function); -// break; -// case QtFatalMsg: -// fprintf(log_file? log_file: stderr, "Fatal: %s: %s (%s:%u, %s)\n", currentTime.constData(), localMsg.constData(), file, context.line, function); -// break; -// } + const char *file = context.file ? context.file : ""; + const char *function = context.function ? context.function : ""; + switch (type) { + case QtDebugMsg: + if (!log_file) { + break; + } + fprintf(log_file, "Debug: %s: %s (%s:%u, %s)\n", currentTime.constData(), localMsg.constData(), file, context.line, function); + break; + case QtInfoMsg: + fprintf(log_file? log_file: stdout, "Info: %s: %s (%s:%u, %s)\n", currentTime.constData(), localMsg.constData(), file, context.line, function); + break; + case QtWarningMsg: + fprintf(log_file? log_file: stderr, "Warning: %s: %s (%s:%u, %s)\n", currentTime.constData(), localMsg.constData(), file, context.line, function); + break; + case QtCriticalMsg: + fprintf(log_file? log_file: stderr, "Critical: %s: %s (%s:%u, %s)\n", currentTime.constData(), localMsg.constData(), file, context.line, function); + break; + case QtFatalMsg: + fprintf(log_file? log_file: stderr, "Fatal: %s: %s (%s:%u, %s)\n", currentTime.constData(), localMsg.constData(), file, context.line, function); + break; + } -// if (log_file) -// fclose(log_file); -//} + if (log_file) + fclose(log_file); +} void centerToScreen(QWidget* widget) { if(!widget) @@ -145,7 +145,7 @@ void searchMethod(FileUtils::SearchMethod sm){ */ int main(int argc, char *argv[]) { //Init log module - initUkuiLog4qt("ukui-search"); +// initUkuiLog4qt("ukui-search"); // Determine whether the home directory has been created, and if not, keep waiting. char *p_home = NULL; @@ -170,7 +170,7 @@ int main(int argc, char *argv[]) { } // Output log to file -// qInstallMessageHandler(messageOutput); + qInstallMessageHandler(messageOutput); // Register meta type qDebug() << "ukui-search main start"; diff --git a/src/mainwindow.h b/src/mainwindow.h index f82d2db..8de33fe 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include From 5e9c032b364201ee212a4d390015b3dfe3370e8f Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Mon, 10 May 2021 15:10:03 +0800 Subject: [PATCH 2/2] Update changelog. --- debian/changelog | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/debian/changelog b/debian/changelog index 66b1bf7..b4d18d9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,21 @@ +ukui-search (0.4.0+0508) v101; urgency=medium + + * Bug 49153. + * 任务 + * 其他改动: + * Android app can be search now. + - 新增搜索安卓兼容目录下应用功能。 + * Start ukui-control-center on settings button clicked. + - 点击设置按钮,跳转到控制面板。 + * Fix(frontend): Ssearch list & dialog will not refresh when fontsize changed. + - 修复了当弹出创建索引提示框时修改系统字体大小,会出现显示错乱的bug。 + * Fix: blacklist will not effective when search method is direct search. + -修复了当选择搜索方式为不创建索引搜索时黑名单无效的问题。 + * Discard ukui-log4qt for log printing. + -由于日志模块偶现卡死bug,移除了ukui-log4qt日志打印功能。 + + -- zhangpengfei Fri, 08 May 2021 15:35:06 +0800 + ukui-search (0.4.0+0422-1) v101; urgency=medium * Bug 45037,45035,47971,26454.