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

62 lines
1.6 KiB
C++
Executable File

#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"
#include "parsebackuplist.h"
void testXml()
{
ParseBackupList parse("/backup/snapshots/backuplist.xml");
}
// 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
qDebug() << QString("测试 begin");
// MyMountProxy * proxy = (MyMountProxy*)Reflect::createObject("MyMountProxy");
// proxy->mountBackupPartition();
// BackupWrapper backupWrapper;
// backupWrapper.m_backupName = "赵民勇test";
// backupWrapper.m_backupPaths << "/";
// backupWrapper.m_backupExcludePaths = Utils::getFromExcludePathsFile();
// MyBackupManager manager;
// manager.goBackup(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();
}