#include "cigarette.h"
#include <QtWidgets/QApplication>
#include <QPixmap>
#include <QSplashScreen>
#include <Windows.h>
#include <qmessagebox.h>
#if defined LICENSE_VERIFY
#pragma comment(lib,"CryptoToolLib.lib")
#include "CryptoToolLib.h"
#endif
//隐藏控制窗口
//#pragma comment( linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"" )
int main(int argc, char* argv[])
{
#if defined LICENSE_VERIFY
    if (!VerifyLicense())
    {
        exit(0);
    }
#endif

    qRegisterMetaType<cv::Mat>("cv::Mat");
    QApplication a(argc, argv);
#ifdef __DEBUGPATH
    QPixmap pixmap("splash.jpg");
#else
    QPixmap pixmap("D:/Release/splash.jpg");
#endif
#if defined EquipmentModel
    //比较设备型号文件-----------------------------------------------------------------------------
    string ider;
    string name = "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.5/include/thrust/async/flag.txt";//标志文件
    std::ifstream file_(name.c_str());
    if (file_.good())
    {
        getline(file_, ider);
        file_.close();

    }
    else
    {
        ider = "Default";
    }
    if(ider!= EquipmentModel)
    {
        QMessageBox::information(NULL, QStringLiteral("系统自检失败"), QStringLiteral("设备型号匹配失败"), QMessageBox::Ok);
        exit(0);
    }
    //比较设备型号标志文件-----------------------------------------------------------------------------
#else
#endif 

    
    QSplashScreen splash(pixmap);
    splash.show();
    a.processEvents();
    Cigarette w;
    //w.show();
    w.showFullScreen();
    splash.finish(&w);
    return a.exec();
}
