yhkylin-backup-tools/backup-daemon/main.cpp

33 lines
885 B
C++
Raw Normal View History

2021-08-06 10:20:03 +08:00
#include <QCoreApplication>
#include <QTextCodec>
#include "../common/utils.h"
#include "../common/mydefine.h"
#include "backupmanager_adaptor.h"
int main(int argc, char *argv[])
{
// 以防客户端传入的参数中的中文信息乱码
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
QCoreApplication a(argc, argv);
a.setApplicationName("backup-daemon");
a.setApplicationVersion("4.0.14");
// 初始化日志
2023-03-17 17:59:26 +08:00
Utils::initSysRootPath();
2021-08-06 10:20:03 +08:00
qInstallMessageHandler(Utils::customMessageHandler);
2021-11-11 16:03:58 +08:00
Utils::initSystemInfo();
2021-08-06 10:20:03 +08:00
MyBackupManager backupManager;
new ManagerAdaptor(&backupManager);
2021-08-06 10:20:03 +08:00
QDBusConnection conn = QDBusConnection::systemBus();
if (!conn.registerService("com.kylin.backup")) {
qDebug() << conn.lastError().message();
}
conn.registerObject("/", &backupManager);
2021-08-06 10:20:03 +08:00
return a.exec();
}