Skip to content

Commit 5da7067

Browse files
wyu71lzwind
andauthored
fix: improve C++ standard compliance and debug logging (#107)
- Remove explicit C++11 standard flag to use project default (C++17) - Enhance command logging readability by joining arguments with spaces - Move checkFcitx5Process to private slots section for proper Qt organization Log: improve C++ standard compliance and debug logging Co-authored-by: lzwind <100665065+lzwind@users.noreply.github.com>
1 parent c2664d5 commit 5da7067

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/fcitx5helper/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if (CMAKE_BUILD_TYPE MATCHES Debug)
1111
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -Wextra")
1212
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -pthread")
1313
# Enable Qt builtin debug mode
14-
add_definitions("-DQT_MESSAGELOGCONTEXT -std=c++11")
14+
add_definitions("-DQT_MESSAGELOGCONTEXT")
1515
else()
1616
# -Wl, -O2 Enable linker optimizations
1717
# -Wl, --gc-sections Remove unused code resulting from -fdsta-sections and

src/fcitx5helper/processmonitor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ static QString getCurrentUserName() {
1919

2020

2121
bool ProcessMonitor::exeCommand(const QString &cmd, const QStringList &args, QString &output, QString &err) {
22-
qDebug() << "Executing command:" << cmd << args;
22+
qDebug() << "Executing command:" << cmd << args.join(" ");
2323
QProcess process;
2424
process.setProgram(cmd);
2525
process.setArguments(args);
@@ -31,7 +31,7 @@ bool ProcessMonitor::exeCommand(const QString &cmd, const QStringList &args, QSt
3131

3232
bool success = (process.exitStatus() == QProcess::NormalExit && process.exitCode() == 0);
3333
if (!success) {
34-
qWarning() << "Command failed:" << cmd << args << "Error:" << err;
34+
qWarning() << "Command failed:" << cmd << args.join(" ") << "Error:" << err;
3535
}
3636
qDebug() << "Command execution result:" << success;
3737
return success;

src/fcitx5helper/processmonitor.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ class ProcessMonitor : public QObject
1717

1818
static bool exeCommand(const QString &cmd, const QStringList &args, QString &output, QString &err);
1919

20+
private Q_SLOTS:
21+
void checkFcitx5Process();
22+
2023
private:
2124
QTimer m_timer;
2225
QString m_previousProcessID;
23-
24-
void checkFcitx5Process();
2526
};
2627

2728
#endif // PROCESSMONITOR_H

0 commit comments

Comments
 (0)