Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
lzwind authored Oct 20, 2023
2 parents de5bf80 + 45212dd commit b7929a5
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 8 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/call-build-distribution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,4 @@ on:
jobs:
check_job:
uses: linuxdeepin/.github/.github/workflows/build-distribution.yml@master
secrets:
BUILD_GPG_PRIVATE_KEY: ${{ secrets.BUILD_GPG_PRIVATE_KEY }}
BUILD_SSH_PRIVATE_KEY: ${{ secrets.BUILD_SSH_PRIVATE_KEY }}
WEBDAV_PASSWD: ${{ secrets.WEBDAV_PASSWD }}
WEBDAV_USER: ${{ secrets.WEBDAV_USER }}
secrets: inherit
3 changes: 1 addition & 2 deletions .github/workflows/call-clacheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ concurrency:
jobs:
clacheck:
uses: linuxdeepin/.github/.github/workflows/cla-check.yml@master
secrets:
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/cppcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- run: export
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
Expand Down
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ add_executable(dmanHelper
dbus/manual_search_adapter.h
dbus/manual_search_proxy.cpp
dbus/manual_search_proxy.h
dbus/dmanwatcher.cpp
dbus/dmanwatcher.h
base/command.cpp
base/command.h
controller/helpermanager.cpp
Expand Down
3 changes: 3 additions & 0 deletions src/app/dman_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "dbus/dbus_consts.h"
#include "dbus/manual_search_adapter.h"
#include "dbus/manual_search_proxy.h"
#include "dbus/dmanwatcher.h"

#include <DLog>
#include "base/utils.h"
Expand Down Expand Up @@ -50,6 +51,8 @@ int main(int argc, char **argv)
}
#endif

// 后端服务dmanHelper自检,若前端dman应用不存在,则后端dmanHelper退出
DManWatcher watcher;
ManualSearchProxy search_obj;
ManualSearchAdapter adapter(&search_obj);

Expand Down
42 changes: 42 additions & 0 deletions src/dbus/dmanwatcher.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#include "dmanwatcher.h"

#include <QProcess>
#include <QCoreApplication>
#include <QDebug>

DManWatcher::DManWatcher():m_Timer(new QTimer (this))
{

connect(m_Timer,&QTimer::timeout,this,&DManWatcher::onTimeOut);
m_Timer->start(5000);
}

/**
* @brief 定时监控客户端
*/
void DManWatcher::onTimeOut()
{
QString cmd, outPut;
//判断dman客户端是否存在,如果不存在退出服务。
cmd = QString("ps aux | grep -w dman$");
outPut= executCmd(cmd);
int ret = outPut.length();
if (!ret)
QCoreApplication::exit(0);
}

/**
* @brief 执行外部命令
* @param strCmd:外部命令字符串
*/
QString DManWatcher::executCmd(const QString &strCmd)
{
QProcess proc;
proc.start("bash", QStringList() << "-c" << strCmd);
proc.waitForFinished(-1);
return proc.readAllStandardOutput();
}
29 changes: 29 additions & 0 deletions src/dbus/dmanwatcher.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#ifndef DMANWATCHER_H
#define DMANWATCHER_H

#include <QObject>
#include <QTimer>

/**
* @class DManWatcher
* @brief 监控客户端类
*/
class DManWatcher :public QObject
{
Q_OBJECT
public:
explicit DManWatcher();

public Q_SLOTS:
void onTimeOut();
private:
QString executCmd(const QString &strCmd);
private:
QTimer *m_Timer=nullptr;
};

#endif // DMANWATCHER_H
2 changes: 2 additions & 0 deletions src/view/theme_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "view/theme_proxy.h"
#include <DApplicationHelper>

DGUI_USE_NAMESPACE

ThemeProxy::ThemeProxy(QObject *parent)
: QObject(parent)
{
Expand Down

0 comments on commit b7929a5

Please sign in to comment.