/* * Copyright (C) 2019 Tianjin KYLIN Information Technology 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, 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 #include #include #include "xatom-helper.h" #include #include "gsettingsubject.h" #include "clockdbusadaptor.h" #include "dbusupdateclockadaptor.h" #include "dbusdeleteclockbyidadaptor.h" #include "dbusselectclockbyidadaptor.h" #include "ClockInterface.h" #include /*! * \brief myMessageOutput * 日志打印输出 */ void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) { // 加锁 static QMutex mutex; mutex.lock(); qDebug()<= QT_VERSION_CHECK(5, 12, 0)) QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); #endif #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); #endif //构造单例 利用本地连接qlocalsocket作为判断的公共访问资源 SingleApplication a(argc, argv); //支持主题框架图标 a.setWindowIcon(QIcon::fromTheme("kylin-alarm-clock")); //此属性保存关闭最后一个窗口时应用程序是否隐式退出。默认值为true。 a.setQuitOnLastWindowClosed(false); //如果没在运行 if (!a.isRunning()) { Clock w; a.w = &w; //发布dbus接口 QObject obj; publishDbusInterface(&w,&obj); QObject updateObj; publishDbusUpdateClock(&w,&updateObj); QObject deleteObj; publishDbusDeleteClock(&w,&deleteObj); QObject selectObj; publishDbusSelectClock(&w,&selectObj); // 添加窗管协议。显示的位置 XAtomHelper::setStandardWindowHint(w.winId()); w.show(); return a.exec(); } return 0; }