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

51 lines
1.4 KiB
C++

#include <QCoreApplication>
#include <QTextCodec>
#include "../common/utils.h"
#include "../common/mydefine.h"
#include "backupmanager_adaptor.h"
// test begin
#include <QDebug>
#include "../common/reflect.h"
#include "mymountproxy.h"
// test end
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);
// test begin
//MyMountProxy * proxy = (MyMountProxy*)Reflect::createObject("MyMountProxy");
//proxy->mountBackupPartition();
qDebug() << QString("测试 begin");
BackupWrapper backupWrapper;
MyBackupManager manager;
manager.checkEnv(backupWrapper);
qDebug() << QString("测试 end");
// test end
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();
}