这是一个用来监控本地文件夹变化的服务
w1146869587
2021-11-09 f5e3a3a6785cd9305c476eadf329c8ae00161add
watch db
6个文件已添加
17个文件已修改
634 ■■■■■ 已修改文件
bak/mb_watch_user.db 补丁 | 查看 | 原始文档 | blame | 历史
bak/mbwatch.txt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
mbwatch/mbbackupdirop.cpp 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mbwatch/mbbackupdirop.h 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mbwatch/mbfileutil.cpp 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mbwatch/mbfileutil.h 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mbwatch/mbmdware.cpp 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mbwatch/mbmdware.h 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mbwatch/mbtasklog.cpp 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mbwatch/mbtasklog.h 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mbwatch/mbtaskmgr.cpp 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mbwatch/mbtaskmgr.h 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mbwatch/mbwatch.pro 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mbwatch/mbwatchconst.cpp 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mbwatch/mbwatchconst.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mbwatch/mbwatchdb.cpp 301 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mbwatch/mbwatchdb.h 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mbwatch/mbwatchmain.cpp 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mbwatch/mbwatchmain.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mbwatch/mbwatchmgr.cpp 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mbwatch/mbwatchmgr.h 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mbwatch/mbwatchuserdb.cpp 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
mbwatch/mbwatchusermgr.cpp 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
bak/mb_watch_user.db
Binary files differ
bak/mbwatch.txt
@@ -1,4 +1,4 @@
CREATE TABLE TN_WATCH_USER (
CREATE TABLE TN_USER (
    CN_S_LOGIN       VARCHAR (128) NOT NULL,
    CN_S_SERVER_ID   VARCHAR (128) NOT NULL,
    CN_S_BACKUP_DIR  VARCHAR (512) NOT NULL,
mbwatch/mbbackupdirop.cpp
New file
@@ -0,0 +1,17 @@
#include "mbbackupdirop.h"
QString     CMD_DELETE  = "Delete";
QString  CMD_NEW     = "New";
QString  CMD_MODIFY  = "Modify";
QString  CMD_RENAME  = "Rename";
CMBBackupdirOp::CMBBackupdirOp()
{
}
CMBBackupdirOp::~CMBBackupdirOp()
{
}
mbwatch/mbbackupdirop.h
New file
@@ -0,0 +1,17 @@
#ifndef MBBACKUPDIROP_H
#define MBBACKUPDIROP_H
#include <QObject>
class CMBBackupdirOp
{
public:
    CMBBackupdirOp();
    ~CMBBackupdirOp();
public:
    static QString    CMD_DELETE;
    static QString  CMD_NEW;
    static QString  CMD_MODIFY;
    static QString    CMD_RENAME;
};
#endif // MBBACKUPDIROP_H
mbwatch/mbfileutil.cpp
@@ -23,6 +23,11 @@
    return strLastTime;
}
QString CMBFileUtil::getPath(QString fileName)
{
    int nPos = fileName.lastIndexOf("/");
    return fileName.mid(0,nPos);
}
bool CMBFileUtil::createLevelDir(QString path)
{
@@ -30,3 +35,38 @@
    return folder.mkpath(path);
}
QString CMBFileUtil::genSvrPath(QString rootPath, QString fileName, QString svrPath)
{
     QString tmpSvrPath,retSvrPath;
    retSvrPath = svrPath;
    tmpSvrPath = getPath(fileName);
    tmpSvrPath = tmpSvrPath.replace(rootPath, "");
    tmpSvrPath += "/";
    // 去除前后斜杠
    tmpSvrPath = trimedSlash(tmpSvrPath);
    svrPath    = trimedSlash(svrPath);
    if( !tmpSvrPath.isEmpty() ){
         retSvrPath = svrPath + "/" + tmpSvrPath;
    }
    retSvrPath = trimedSlash(retSvrPath);
    return retSvrPath;
}
QString CMBFileUtil::trimedSlash(QString str)
{
    int nStartPos = str.indexOf("/");
    int nPos = str.lastIndexOf("/");
    if( nPos == str.length() -1 ){
        str = str.left(nPos);
    }
    if( nStartPos == 0 ){
        str = str.right(str.length()-1);
    }
    return str;
}
mbwatch/mbfileutil.h
@@ -14,8 +14,11 @@
    CMBFileUtil();
    ~CMBFileUtil();
public:
    static QString getPath(QString fileName);
    static QString lastModifiedTime(QString fileName);
    static bool    createLevelDir(QString path);
    static QString genSvrPath(QString rootPath, QString fileName, QString svrPath);
    static QString trimedSlash(QString str);
};
#endif // MBFILEUTIL_H
mbwatch/mbmdware.cpp
New file
@@ -0,0 +1,11 @@
#include "mbmdware.h"
CMBMdware::CMBMdware()
{
}
CMBMdware::~CMBMdware()
{
}
mbwatch/mbmdware.h
New file
@@ -0,0 +1,18 @@
#ifndef MBMDWARE_H
#define MBMDWARE_H
#include <QObject>
#include <QJsonArray>
class  CMBMdware : public QObject
{
    Q_OBJECT
public:
    CMBMdware();
    ~CMBMdware();
signals:
    void sigErrInfo( QString errInfo ); // 错误信息
};
#endif // MBMDWARE_H
mbwatch/mbtasklog.cpp
@@ -1,18 +1,92 @@
#include "mbtasklog.h"
#include <QMutex>
#include <QDir>
#include "mbfileutil.h"
CMBTaskLog::CMBTaskLog()
{
    m_pMdWare = NULL;
    m_pWatchDb = new CMBWatchDb();
}
CMBTaskLog::~CMBTaskLog()
{
    if( m_pWatchDb ){
        delete m_pWatchDb;
        m_pWatchDb = NULL;
    }
}
void CMBTaskLog::set(QString logDbPath, QString backupDir, QString svrPath)
{
    m_logDbPath = logDbPath;
    m_backupDir = backupDir;
    m_svrPath = svrPath;
}
void CMBTaskLog::setMdWare(CMBMdware *pMdWare)
{
    m_pMdWare = pMdWare;
}
// 查找文件
bool CMBTaskLog::findFile(const QString &path,QString &errInfo)
{
    int i = 0;
    bool bIsDir = false;
    QDir dir(path);
    if(!dir.exists())
    {
        return false;
    }
    dir.setFilter(QDir::Dirs | QDir::Files);
    dir.setSorting(QDir::DirsFirst);//文件夹排在前面
    QFileInfoList list = dir.entryInfoList();
    do
    {
        QFileInfo fileInfo = list.at(i);
        if(fileInfo.fileName() == "." | fileInfo.fileName() == "..")
        {
            ++i;
            continue;
        }
        bIsDir = fileInfo.isDir();
        if(bIsDir)
        {
            if(!findFile(fileInfo.filePath(),errInfo))
                return false;
        }
        else
        {
            QString  fileName    = fileInfo.absoluteFilePath();
            QString  svrPath     = CMBFileUtil::genSvrPath(m_backupDir,fileName, m_svrPath);
            QString  lastMdfTime = CMBFileUtil::lastModifiedTime(fileName);
            m_pWatchDb->insertBackupDirDB(fileName,"",svrPath,lastMdfTime);
        }
        ++i;
    }while(i < list.size());
    return true;
}
void CMBTaskLog::run()
{
    QString errInfo;
    if(!m_pWatchDb->init(m_logDbPath,errInfo)){
        emit m_pMdWare->sigErrInfo(errInfo);
        return ;
    }
    // 遍历文件夹 备份文件夹
    if(!findFile(m_backupDir,errInfo)){
        emit m_pMdWare->sigErrInfo(errInfo);
        return ;
    }
}
@@ -21,3 +95,5 @@
mbwatch/mbtasklog.h
@@ -4,6 +4,8 @@
#include <QRunnable>
#include <QWaitCondition>
#include <QMutex>
#include "mbwatchdb.h"
#include "mbmdware.h"
/************************************************************************/
/*   日志任务,用来记录备份目录下的文件变化                                    */
@@ -14,6 +16,20 @@
public:
    CMBTaskLog();
    ~CMBTaskLog();
private:
    QString     m_logDbPath;
    QString     m_backupDir;
    QString     m_svrPath;
private:
    CMBWatchDb *m_pWatchDb;
private:
    CMBMdware  *m_pMdWare;
public:
    void             setMdWare(CMBMdware *pMdWare);
public:
    void             set(QString logDbPath, QString backupDir, QString svrPath);
private:
    bool             findFile(const QString &path,QString &errInfo);
public:
    virtual          void run();
};
mbwatch/mbtaskmgr.cpp
@@ -1,9 +1,11 @@
#include "mbtaskmgr.h"
#include "mbtasklog.h"
CMBTaskMgr::CMBTaskMgr()
{
    m_pMdWare = NULL;
    //线程池最多1个线程
    m_threadPool.setMaxThreadCount(1);
    m_threadPool.setMaxThreadCount(3);
}
CMBTaskMgr::~CMBTaskMgr()
@@ -11,14 +13,24 @@
}
void CMBTaskMgr::setMdWare(CMBMdware *pMdWare)
{
    m_pMdWare = pMdWare;
}
void CMBTaskMgr::stopThread()
{
    m_threadPool.waitForDone(100); // 100毫秒
}
void CMBTaskMgr::logTask(QString login, QString svrID, QString backupDir, QString svrPath)
void CMBTaskMgr::logTask(QString logDbPath, QString backupDir, QString svrPath)
{
    CMBTaskLog *pTask = new CMBTaskLog();
    pTask->setMdWare(m_pMdWare);
    pTask->set(logDbPath, backupDir, svrPath);
    pTask->setAutoDelete(true);
    m_threadPool.start(pTask);
}
mbwatch/mbtaskmgr.h
@@ -2,6 +2,7 @@
#define MBTASKMGR_H
#include <QThreadPool>
#include "mbmdware.h"
/************************************************************************/
@@ -14,11 +15,14 @@
    ~CMBTaskMgr();
private:
    QThreadPool     m_threadPool;
private:
    CMBMdware      *m_pMdWare;
public:
    void             setMdWare(CMBMdware *pMdWare);
public:
    void             stopThread();
public:
    void             logTask( QString login, QString svrID,
                               QString backupDir, QString svrPath );
    void             logTask(QString logDbPath, QString backupDir, QString svrPath);
};
mbwatch/mbwatch.pro
@@ -14,12 +14,15 @@
SOURCES += \
        main.cpp \
        mbbackupdirop.cpp \
        mbcommfunc.cpp \
        mbfileutil.cpp \
        mbmdware.cpp \
        mbtasklog.cpp \
        mbtaskmgr.cpp \
        mbwatchapp.cpp \
        mbwatchconst.cpp \
        mbwatchdb.cpp \
        mbwatchfile.cpp \
        mbwatchmain.cpp \
        mbwatchmgr.cpp \
@@ -28,12 +31,15 @@
        mbwatchusermgr.cpp
HEADERS += \
    mbbackupdirop.h \
    mbcommfunc.h \
    mbfileutil.h \
    mbmdware.h \
    mbtasklog.h \
    mbtaskmgr.h \
    mbwatchapp.h \
    mbwatchconst.h \
    mbwatchdb.h \
    mbwatchfile.h \
    mbwatchmain.h \
    mbwatchmgr.h \
@@ -52,3 +58,6 @@
include(efsw.pri)
mbwatch/mbwatchconst.cpp
@@ -41,3 +41,10 @@
    watchUser = watchUser.replace("//","/");
    return watchUser;
}
QString CMBWatchConst::getLogDBPath(QString svrID, QString login)
{
    QString logDBPath = QString("%1/watch/mb_watch_%2_%3.db").arg(getExePath(),svrID,login);
    logDBPath = logDBPath.replace("//","/");
    return logDBPath;
}
mbwatch/mbwatchconst.h
@@ -17,6 +17,7 @@
    QString getDataPath();
    QString getWatchPath();
    QString getWatchUserDB();
    QString getLogDBPath(QString svrID,QString login);
};
#endif // MBWATCHCONST_H
mbwatch/mbwatchdb.cpp
New file
@@ -0,0 +1,301 @@
#include "mbwatchdb.h"
#include <QRandomGenerator>
#include <QSqlError>
#include <QSqlQuery>
#include <QDebug>
#include "mbfileutil.h"
CMBWatchDb::CMBWatchDb()
{
    m_logTableName = "TN_LOG";
    m_backupDirTableName = "TN_BACKUPDIR";
}
CMBWatchDb::~CMBWatchDb()
{
}
QSqlDatabase CMBWatchDb::openDataBase()
{
    quint32 value = QRandomGenerator::global()->generate();
    QSqlDatabase db;
    if ( true == QSqlDatabase::contains(QString::number(value)))
    {
        db = QSqlDatabase::database(QString::number(value));
    }
    else
    {
        db = QSqlDatabase::addDatabase("QSQLITE", QString::number(value));
        db.setDatabaseName(m_path);
    }
    if (false == db.open())
    {
        qDebug() << db.lastError().text();
    }
    return db;
}
void CMBWatchDb::closeDataBase(QString connectionName)
{
    if( QSqlDatabase::contains(connectionName) ){
       QSqlDatabase::removeDatabase(connectionName);
    }
}
bool CMBWatchDb::execSql(QString sql, QString &errInfo)
{
    QMutexLocker locker(&m_mutex);
    QString connectionName;
    {
        QSqlDatabase db = openDataBase();
        connectionName = db.connectionName();
        QSqlQuery query(db);
        query.prepare(sql);
        if( !query.exec()){
            errInfo = query.lastError().text();
            return false;
        }
        query.clear();
    }
    closeDataBase(connectionName);
    return true;
}
bool CMBWatchDb::execSql(QSqlDatabase &db, QString sql, QString &errInfo)
{
    QSqlQuery query(db);
    query.prepare(sql);
    if( !query.exec()){
        errInfo = query.lastError().text();
        return false;
    }
    query.clear();
    return true;
}
bool CMBWatchDb::getTmpFiledSql(QString sql, QString &tmpValue, QString &errInfo)
{
    QMutexLocker locker(&m_mutex);
    QString connectionName;
    {
        QSqlDatabase db = openDataBase();
        connectionName = db.connectionName();
        QSqlQuery query(db);
        query.prepare(sql);
        if( !query.exec()){
            errInfo = query.lastError().text();
            return false;
        }
        while(query.next())
        {
            tmpValue = query.value("TmpFiled").toString();
        }
        query.clear();
    }
    closeDataBase(connectionName);
    return true;
}
bool CMBWatchDb::exsitSql(QString sql, bool &bExsit, QString &errInfo)
{
    QMutexLocker locker(&m_mutex);
    bExsit = false;
    QString connectionName;
    {
        QSqlDatabase db = openDataBase();
        connectionName = db.connectionName();
        QSqlQuery query(db);
        query.prepare(sql);
        if( !query.exec()){
            errInfo = query.lastError().text();
            return false;
        }
        // 获取大小
        int initialPos = query.at();
        int nCount = 0;
        if (query.last())
            nCount = query.at() + 1;
        else
            nCount = 0;
        query.seek(initialPos);
        // end 获取大小
        if( nCount >= 1 ){
            bExsit = true;
        }
        query.clear();
    }
    closeDataBase(connectionName);
    return true;
}
bool CMBWatchDb::isTableExist(QString table)
{
    QMutexLocker locker(&m_mutex);
    bool bExsit = false;
    QString sql = QString("select * from sqlite_master where name='%1'").arg(table);
    QString connectionName;
    {
        QSqlDatabase db = openDataBase();
        connectionName = db.connectionName();
        QSqlQuery query(db);
        query.prepare(sql);
        query.exec(sql);
        bExsit = query.next();
        query.clear();
    }
    closeDataBase(connectionName);
    return bExsit;
}
bool CMBWatchDb::createLogTable(QString &errInfo)
{
    QString sql;
    sql = QString("CREATE TABLE %1 ("
                   "CN_S_FILE_NAME      VARCHAR (128) PRIMARY KEY NOT NULL,"
                   "CN_T_LAST_MODFIY    DATE    NOT NULL"
               ")").arg(m_logTableName);
    if( isTableExist(m_logTableName) )
        return true;
    if(!execSql(sql,errInfo))
        return false;
    return true;
}
bool CMBWatchDb::createBackupTable(QString &errInfo)
{
    QString sql;
    sql = QString("CREATE TABLE %1 ("
                   "CN_G_ID             VARCHAR (128) PRIMARY KEY NOT NULL,"
                   "CN_S_FILE_NAME      VARCHAR (128) NOT NULL,"
                   "CN_S_NEWFILE_NAME   VARCHAR (128),"
                   "CN_S_SERVERPATH     VARCHAR (128),"
                   "CN_S_OP_TYPE        TEXT (128),"
                   "CN_T_CREATE         DATE (128)"
               ")").arg(m_backupDirTableName);
    if( isTableExist(m_backupDirTableName) )
        return true;
    if(!execSql(sql,errInfo))
        return false;
    return true;
}
bool CMBWatchDb::init(QString path,QString &errInfo)
{
    m_path = path;
    // 创建数据库
    QString filePath = CMBFileUtil::getPath(path);
    CMBFileUtil::createLevelDir(filePath);
    if( !createLogTable(errInfo) )
        return false;
    if(!createBackupTable(errInfo) )
        return false;
    return true;
}
bool CMBWatchDb::loadDB(QSqlQuery &query)
{
    while(query.next())
    {
//        QString login     = query.value("CN_S_LOGIN").toString();
//        QString svrID     = query.value("CN_S_SERVER_ID").toString();
//        QString backupDir = query.value("CN_S_BACKUP_DIR").toString();
//        QString svrPath   = query.value("CN_S_SERVER_PATH").toString();
//        QString isLogin   = query.value("CN_S_ISLOGIN").toString();
    }
    return true;
}
bool CMBWatchDb::queryDB(QString &errInfo)
{
    QMutexLocker locker(&m_mutex);
    QString connectionName,sql;
    //sql = QString("select * from %1 where CN_S_ISLOGIN='Y'").arg(m_tableName);
    {
        QSqlDatabase db = openDataBase();
        connectionName = db.connectionName();
        QSqlQuery query(db);
        query.prepare(sql);
        if( !query.exec()){
            errInfo = query.lastError().text();
            return false;
        }
        if(!loadDB(query))
            return false;
        query.clear();
    }
    closeDataBase(connectionName);
    return true;
}
bool CMBWatchDb::insertBackupDirDB(QString opType, QString fileName, QString newFileName, QString svrPath, QString lastMdfTime)
{
    return true;
}
// 自已决定,操作类型
bool CMBWatchDb::insertBackupDirDB(QString fileName, QString newFileName,
                                   QString svrPath, QString lastMdfTime)
{
    QString opType;
    return true;
}
mbwatch/mbwatchdb.h
New file
@@ -0,0 +1,50 @@
#ifndef MBWATCHDB_H
#define MBWATCHDB_H
#include <QObject>
#include <QSqlDatabase>
#include <QMutex>
/***********************************************************
*
*  mb_watch_xxxxxxxxxx_xxx.db
*
************************************************************/
class CMBWatchDb
{
public:
    CMBWatchDb();
    ~CMBWatchDb();
private:
    QMutex           m_mutex;
private:
    QString          m_path;
    QString          m_logTableName;
    QString          m_backupDirTableName;
private:
    QSqlDatabase openDataBase();
    void         closeDataBase(QString connectionName);
private:
    bool         execSql( QString sql,QString &errInfo );  // 执行sql
    bool         execSql(QSqlDatabase &db,QString sql,QString &errInfo );  // 执行sql
    bool         getTmpFiledSql( QString sql,QString &tmpValue,QString &errInfo );  // 获取tmp字段的值
    bool         exsitSql( QString sql,bool &bExsit,QString &errInfo );
    bool         isTableExist(QString table);
private:
    bool         createLogTable(QString &errInfo);
    bool         createBackupTable(QString &errInfo);
public:
    bool         init(QString path,QString &errInfo);
private:
    bool         loadDB(QSqlQuery &query);
public:
    bool         queryDB(QString &errInfo);
public:
    bool         insertBackupDirDB(QString opType,QString fileName,
                                   QString newFileName,QString svrPath,
                                   QString lastMdfTime);
    bool         insertBackupDirDB(QString fileName,
                                   QString newFileName,QString svrPath,
                                   QString lastMdfTime);
};
#endif // MBWATCHDB_H
mbwatch/mbwatchmain.cpp
@@ -35,11 +35,13 @@
void CMBWatchMain::conn()
{
     connect(m_pWatchFile,SIGNAL(sigFileChange(QString)),this,SLOT(onSigFileChange(QString)));
     connect(m_pMgr->getMdWare(),SIGNAL(sigErrInfo(QString)),this,SLOT(onSigErrInfo(QString)));
}
void CMBWatchMain::disConn()
{
    disconnect(m_pWatchFile);
    disconnect(m_pMgr->getMdWare());
}
void CMBWatchMain::start()
@@ -79,7 +81,7 @@
        return ;
    }
    // 比较 日志,写
    QString login, svrID, backupDir, svrPath;
    QString login, svrID, backupDir, svrPath,logDBPath;
    CMBWatchUserVector::iterator    it;
    CMBWatchUser *pUser = NULL;
@@ -95,7 +97,9 @@
        backupDir = pUser->getBackupDir();
        svrPath   = pUser->getSvrPath();
        m_pMgr->getTaskMgr()->logTask(login, svrID, backupDir, svrPath);
        logDBPath =  m_pMgr->getConst()->getLogDBPath(svrID, login);
        m_pMgr->getTaskMgr()->logTask(logDBPath, backupDir, svrPath);
    }
}
@@ -106,3 +110,8 @@
    //
}
void CMBWatchMain::onSigErrInfo(QString errInfo)
{
    std::cout << errInfo.toStdString() << std::endl;
}
mbwatch/mbwatchmain.h
@@ -25,6 +25,7 @@
    void init();
public slots:
    void onSigFileChange(QString fileName);
    void onSigErrInfo(QString errInfo);
};
#endif // MBWATCHMAIN_H
mbwatch/mbwatchmgr.cpp
@@ -3,7 +3,10 @@
CMBWatchMgr::CMBWatchMgr()
{
    m_pConst     = new CMBWatchConst();
    m_pTaskMgr   = new CMBTaskMgr();
    m_pMdWare    = new CMBMdware();
    m_pTaskMgr->setMdWare(m_pMdWare);
    m_pUserMgr   = new CMBWatchUserMgr();
    m_pUserDb    = new CMBWatchUserDb();
@@ -28,6 +31,11 @@
        delete m_pTaskMgr;
        m_pTaskMgr = NULL;
    }
    if( m_pMdWare ){
        delete m_pMdWare;
        m_pMdWare = NULL;
    }
}
CMBWatchConst *CMBWatchMgr::getConst()
@@ -45,6 +53,11 @@
    return m_pTaskMgr;
}
CMBMdware *CMBWatchMgr::getMdWare()
{
    return m_pMdWare;
}
bool CMBWatchMgr::init(QString &errInfo)
{
    QString watchUserDB = m_pConst->getWatchUserDB();
mbwatch/mbwatchmgr.h
@@ -3,6 +3,7 @@
#include "mbwatchconst.h"
#include "mbwatchuserdb.h"
#include "mbtaskmgr.h"
#include "mbmdware.h"
class CMBWatchMgr
{
@@ -16,10 +17,12 @@
    CMBWatchUserMgr  *m_pUserMgr;
private:
    CMBTaskMgr       *m_pTaskMgr;
    CMBMdware        *m_pMdWare;
public:
    CMBWatchConst    *getConst();
    CMBWatchUserMgr  *getUserMgr();
    CMBTaskMgr       *getTaskMgr();
    CMBMdware        *getMdWare();
public:
    bool           init(QString &errInfo);
public:
mbwatch/mbwatchuserdb.cpp
@@ -7,7 +7,7 @@
CMBWatchUserDb::CMBWatchUserDb()
{
    m_pMgr      = NULL;
    m_tableName = "TN_WATCH_USER";
    m_tableName = "TN_USER";
}
CMBWatchUserDb::~CMBWatchUserDb()
mbwatch/mbwatchusermgr.cpp
@@ -12,8 +12,6 @@
bool CMBWatchUserMgr::add(CMBWatchUser *pUser)
{
    QMutexLocker locker(&m_mutex);
    if( NULL == pUser )
        return false;
@@ -23,8 +21,10 @@
    if(is(login, svrID))
        return false;
    {
    QMutexLocker locker(&m_mutex);
    m_vector.append(pUser);
    }
    return true;
}
@@ -67,8 +67,6 @@
bool CMBWatchUserMgr::is(QString login, QString svrID)
{
    QMutexLocker locker(&m_mutex);
    CMBWatchUser *pUser = get(login, svrID);
    if( NULL == pUser )
        return false;