1 Star 0 Fork 7

kylinsoft-contributor/kylin-status-manager

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.cpp 1.96 KB
一键复制 编辑 原始数据 按行查看 历史
/*
* kylin-status-manager
*
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Authors: wangguixi <wangguixi@kylinos.cn>
*
*/
#include <ukui-log4qt.h>
#include <QCoreApplication>
#include <QCommandLineOption>
#include <QCommandLineParser>
#include <QtSingleApplication>
#include <QTranslator>
#include "StatusManager/statusmanager.h"
#include "DbusManager/dbusservice.h"
int main(int argc, char *argv[])
{
QtSingleApplication a("kylin-status-manager", argc, argv);
if (a.isRunning())
{
a.sendMessage("raise_window_noop");
return EXIT_SUCCESS;
}
QTranslator translator;
translator.load("usr/share/kylin-status-manager/zh.qm");
a.installTranslator(&translator);
QCommandLineParser parser;
QCommandLineOption logOption("log", "open log");
parser.addOption(logOption);
parser.process(a);
if (QCoreApplication::arguments().length() > 1) {
QString opt = QCoreApplication::arguments().at(1);
if (opt == "--log" || opt == "l"){
StatusManager au;
DBusService dbus {&au};
a.setActivationWindow(&au);//单例
return a.exec();
}
}else {
initUkuiLog4qt("kylin-status-manager");
StatusManager au;
DBusService dbus {&au};
a.setActivationWindow(&au);//单例
return a.exec();
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kylinsoft-contributor/kylin-status-manager.git
git@gitee.com:kylinsoft-contributor/kylin-status-manager.git
kylinsoft-contributor
kylin-status-manager
kylin-status-manager
openkylin/yangtze

搜索帮助

0d507c66 1850385 C8b1a773 1850385