代码拉取完成,页面将自动刷新
同步操作将从 Vanishi/DS 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include "mainwindow.h"
#include "ComMessageBox.h"
#include "Api.h"
#include "Utils.h"
#include <QApplication>
#include <QSharedMemory>
#include <windows.h>
#include <QDate>
#include <qtwebenginecoreglobal.h>
#include <QsLog.h>
#include <QDebug>
using namespace QsLogging;
void initLogger(const QString &logDir){
if(Utils::mkDirs(logDir)){
Logger& logger = Logger::instance();
logger.setLoggingLevel(QsLogging::TraceLevel);
// QString timeStr = QDate::currentDate().toString("yyyy-MM-dd");
// QDateTime time = QDateTime::fromString(timeStr,"yyyy-MM-dd");
QString logFile = QString("%1/run.log").arg(logDir);
DestinationPtr des(
DestinationFactory::MakeFileDestination(logFile,
EnableLogRotation,
MaxSizeBytes(1*1024*1024),
MaxOldLogCount(1)));
logger.addDestination(des);
QLOG_INFO()<<"initLogger() success logDir="<<logDir;
}else{
QLOG_INFO()<<"initLogger() error logDir="<<logDir;
}
}
LONG ApplicationCrashHandler(EXCEPTION_POINTERS *pException){
EXCEPTION_RECORD* record = pException->ExceptionRecord;
QString errCode(QString::number(record->ExceptionCode,16)),errAdr(QString::number((uint)record->ExceptionAddress,16)),errMod;
QString crashMsg = QString("抱歉,软件发生了崩溃,请重启。错误代码:%1,错误地址:%2").
arg(errCode).arg(errAdr);
Api::reportCrash(crashMsg);
ComMessageBox::error(NULL,crashMsg);
return EXCEPTION_EXECUTE_HANDLER;
}
int main(int argc, char *argv[])
{
QCoreApplication::setOrganizationName("any12345");
QCoreApplication::setOrganizationDomain("www.any12345.com");
QCoreApplication::setApplicationName("DS");
QCoreApplication::setApplicationVersion("1.7");
SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER)ApplicationCrashHandler);//注冊异常捕获函数
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Floor);
#elif (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
QApplication a(argc, argv);
a.setWindowIcon(QIcon(QStringLiteral(":/res/images/logo.png")));
QFile qss(":/res/qss/style.qss");
qss.open(QFile::ReadOnly);
a.setStyleSheet(qss.readAll());
qss.close();
QSharedMemory shared("DS");
if(shared.attach()){
ComMessageBox::error(NULL,"软件已经在运行中");
return 0;
}
shared.create(1);
// 获取程序当前地址,需要在QApplication初始化之后获取,否则获取的地址错误
// QString logDir = QDir::homePath()+"/AppData/Local/DS/logs";
QString logDir = QApplication::applicationDirPath() + "/logs";
// Utils::clearLogDir(logDir);
initLogger(logDir);
QString vInfo = QString("DS V%1,qwebengine V%2 chromium V%3 chromiumSP V%4").
arg(QCoreApplication::applicationVersion()).
arg(qWebEngineVersion()).
arg(qWebEngineChromiumVersion()).
arg(qWebEngineChromiumSecurityPatchVersion());
qDebug()<< vInfo;
QLOG_INFO()<< vInfo;
MainWindow mainWindow;
mainWindow.show();
return a.exec();
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。