This commit is contained in:
curtis
2024-11-26 16:21:02 +08:00
parent a8eaaf6d0e
commit 2ea5d0b7eb
35 changed files with 1321 additions and 29 deletions

View File

@@ -14,6 +14,7 @@
#include <QObject>
#include "fescontroldialog.h"
#include <QSettings>
#include "BCIManager.h"
void outputMessage(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
@@ -22,17 +23,17 @@ void outputMessage(QtMsgType type, const QMessageLogContext &context, const QStr
QString text;
switch(type)
{
case QtDebugMsg:
text = QString("Debug:");
break;
case QtWarningMsg:
text = QString("Warning:");
break;
case QtCriticalMsg:
text = QString("Critical:");
break;
case QtFatalMsg:
text = QString("Fatal:");
case QtDebugMsg:
text = QString("Debug:");
break;
case QtWarningMsg:
text = QString("Warning:");
break;
case QtCriticalMsg:
text = QString("Critical:");
break;
case QtFatalMsg:
text = QString("Fatal:");
}
QString context_info = QString("File:(%1) Line:(%2)").arg(QString(context.file)).arg(context.line);
QString current_date_time = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss ddd");
@@ -56,7 +57,7 @@ void SetProcessAutoRunSelf(const QString &appPath)
//注册表路径需要使用双反斜杠如果是32位系统要使用QSettings::Registry32Format
QSettings settings("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
QSettings::Registry64Format);
//以程序名称作为注册表中的键
//以程序名称作为注册表中的键
//根据键获取对应的值(程序路径)
QFileInfo fInfo(appPath);
QString name = fInfo.baseName();
@@ -70,7 +71,7 @@ void SetProcessAutoRunSelf(const QString &appPath)
{
settings.setValue(name, newPath);
qDebug() <<"添加快捷启动注册表HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run,";
qDebug() << "添加快捷启动注册表HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run,";
}
}
@@ -86,16 +87,19 @@ int main(int argc, char *argv[])
//SetProcessAutoRunSelf(qApp->applicationFilePath());
#ifdef DEBUGON
qInstallMessageHandler(outputMessage);
qInstallMessageHandler(outputMessage);
#endif
BCIManager::registerQMLType();
//数据库读取
if(!CDatabaseInterface::getInstance()->openDB("./DependFile/DBFile/UpLow.db","QSQLITE"))
qDebug()<<"UpLow.db open failed!";
if(!CDatabaseInterface::getInstance()->openDB("./DependFile/DBFile/UpLow.db", "QSQLITE"))
{
qDebug() << "UpLow.db open failed!";
}
//配置文件读取
if(!ReadConfig::getInstance()->readConfigFile())
{
qDebug()<<"配置文件读取失败";
qDebug() << "配置文件读取失败";
return -1;
}
@@ -129,15 +133,16 @@ int main(int argc, char *argv[])
CMainWindow w;
if(sharedMemory.create(1))
{
QObject::connect(&w,SIGNAL(signalShowCompleted()),&login,SLOT(slotShowCompleted()));
QObject::connect(&w, SIGNAL(signalShowCompleted()), &login, SLOT(slotShowCompleted()));
login.setWindowModality(Qt::WindowModal);//
login.exec(); //
w.show();
}
QObject::connect(&a,&QApplication::aboutToQuit,[](){
FesControlDialog::getInstance()->turnoffDevice(1,1);
QObject::connect(&a, &QApplication::aboutToQuit, []()
{
FesControlDialog::getInstance()->turnoffDevice(1, 1);
});