34 lines
979 B
C++
Executable File
34 lines
979 B
C++
Executable File
#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");
|
|
|
|
// 初始化日志
|
|
QString qsAppPath = QCoreApplication::applicationDirPath();
|
|
Utils::initSysRootPath(qsAppPath);
|
|
qInstallMessageHandler(Utils::customMessageHandler);
|
|
Utils::initSystemInfo();
|
|
|
|
MyBackupManager* backup_deamon = new MyBackupManager;
|
|
new ManagerAdaptor(backup_deamon);
|
|
QDBusConnection conn = QDBusConnection::systemBus();
|
|
|
|
if (!conn.registerService("com.kylin.backup")) {
|
|
qDebug() << conn.lastError().message();
|
|
}
|
|
|
|
conn.registerObject("/", backup_deamon);
|
|
|
|
return a.exec();
|
|
}
|