#ifndef CCOMMONTOOLS_H
#define CCOMMONTOOLS_H

#include <QWidget>
#include <QString>

#include "opencv2/opencv.hpp"

#include <vector>


#define RELEASE_PTR(ptr) {if(ptr != nullptr) {delete ptr;ptr=nullptr;}}

struct CameraInfo
{
    std::wstring name;
    std::wstring vid;
    std::wstring pid;
    std::wstring detail;
    bool IsBusy;
};

namespace CCommonTools
{
    bool IsWow64();
    int getDisplayNumber();
    QString get_cpuId();
	QString Arab2Sinogram(int num);
    QString getUuid();
    qint64 getTimeStamp();
    void createDir(QString sDir);
    bool isUseRDP();//是否使用远程桌面
    void getAllAppNameList(QStringList &appList, QStringList sCheckApps, QStringList sCheckNames); //获取进程列表
    int listCameraDevices(std::vector<CameraInfo> &list);
    int listCameraDevices(std::vector<CameraInfo>& list, QStringList &CameraList, QStringList checkCameraLiist);//获取摄像头信息
    QString fileMd5(QString sFileName);//获取文件MD5值
    void topMostSlot(QWidget *widget, bool bTopMost);
    QImage Mat2QImage(const cv::Mat& mat);
    bool checkMat(cv::Mat& mat); //检查摄像头是否断开 true：正常 false：断开
    void genRandomNumber(QList<int> &listRandom, int nSize);//生成1-size随机数
    int genRandomNumber(int nForm, int nTo);//生成范围类随机数
    QString getImageRawBase64Str(QString sBase64Image);
}

#endif // CCOMMONTOOLS_H
