|
@@ -280,13 +280,12 @@ QStringList m_permissions = {
|
|
|
void clearAllCaches() {
|
|
void clearAllCaches() {
|
|
|
#ifndef WIN32
|
|
#ifndef WIN32
|
|
|
QDir dir;
|
|
QDir dir;
|
|
|
-
|
|
|
|
|
// ========== 1. 标准缓存位置 ==========
|
|
// ========== 1. 标准缓存位置 ==========
|
|
|
QStringList cacheLocations = {
|
|
QStringList cacheLocations = {
|
|
|
QStandardPaths::writableLocation(QStandardPaths::CacheLocation),
|
|
QStandardPaths::writableLocation(QStandardPaths::CacheLocation),
|
|
|
QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation),
|
|
QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation),
|
|
|
- QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation),
|
|
|
|
|
- QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)
|
|
|
|
|
|
|
+ // QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation),
|
|
|
|
|
+ // QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// ========== 2. Android特定缓存位置 ==========
|
|
// ========== 2. Android特定缓存位置 ==========
|
|
@@ -352,71 +351,8 @@ void clearAllCaches() {
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
int main(int argc, char *argv[])
|
|
|
{
|
|
{
|
|
|
-#if 0
|
|
|
|
|
- // ========== 第一阶段:在任何Qt对象创建前先清理所有缓存 ==========
|
|
|
|
|
- // 这是解决"第一次正常,第二次花屏"的关键!
|
|
|
|
|
- clearAllCaches();
|
|
|
|
|
-
|
|
|
|
|
- // ========== 全志A133P ARM32渲染修复(终极版)==========
|
|
|
|
|
- // 在QGuiApplication创建前设置环境变量
|
|
|
|
|
-
|
|
|
|
|
- // ========== 核心图形API配置 ==========
|
|
|
|
|
- qputenv("QSG_RHI_BACKEND", "opengl");
|
|
|
|
|
- qputenv("QSG_RENDERING_BACKEND", "opengl");
|
|
|
|
|
- qputenv("QT_QUICK_BACKEND", "opengl");
|
|
|
|
|
-
|
|
|
|
|
- // ========== OpenGL ES版本强制配置(全志A133P关键)==========
|
|
|
|
|
- qputenv("QT_OPENGL_FORCE_GLES2", "1"); // 强制使用OpenGL ES 2.0
|
|
|
|
|
- qputenv("QT_OPENGL_NO_ES3", "1"); // 禁用OpenGL ES 3.0
|
|
|
|
|
- qputenv("QT_OPENGL_NO_ES31", "1"); // 禁用OpenGL ES 3.1
|
|
|
|
|
- qputenv("QT_OPENGL_NO_ES32", "1"); // 禁用OpenGL ES 3.2
|
|
|
|
|
-
|
|
|
|
|
- // ========== 渲染循环配置 ==========
|
|
|
|
|
- qputenv("QSG_RENDER_LOOP", "basic"); // 使用basic渲染循环,ARM32更稳定
|
|
|
|
|
-
|
|
|
|
|
- // ========== 颜色格式配置(解决花屏关键)==========
|
|
|
|
|
- qputenv("QT_OPENGL_NO_BGRA", "1");
|
|
|
|
|
- qputenv("QT_QPA_EGLFS_FORCE888", "1"); // 强制24位色深
|
|
|
|
|
-
|
|
|
|
|
- // ========== 缓冲和缓存禁用(避免ARM32兼容性问题)==========
|
|
|
|
|
- qputenv("QSG_DISABLE_DEPTH_BUFFER", "1"); // 禁用深度缓冲
|
|
|
|
|
- qputenv("QSG_DISABLE_STENCIL_BUFFER", "1"); // 禁用模板缓冲
|
|
|
|
|
- qputenv("QSG_DISABLE_ATLAS", "1"); // 禁用纹理图集
|
|
|
|
|
- qputenv("QSG_DISABLE_MIPMAP", "1"); // 禁用MIP映射
|
|
|
|
|
-
|
|
|
|
|
- // ========== 所有类型的缓存完全禁用 ==========
|
|
|
|
|
- qputenv("QML_DISABLE_DISK_CACHE", "1"); // 禁用QML磁盘缓存
|
|
|
|
|
- qputenv("QML_FORCE_DISK_CACHE", "0");
|
|
|
|
|
- qputenv("QSG_RHI_DISABLE_PIPELINE_CACHE", "1"); // 禁用RHI管线缓存
|
|
|
|
|
- qputenv("QT_GL_USE_DISK_SHADER_CACHE", "0"); // 禁用磁盘着色器缓存
|
|
|
|
|
- qputenv("QSG_DISTANCEFIELD_CACHE_SIZE", "0"); // 禁用距离场缓存
|
|
|
|
|
- qputenv("QSG_TEXTURE_CACHE_SIZE", "0"); // 禁用纹理缓存
|
|
|
|
|
- qputenv("QSG_SHADER_CACHE_SIZE", "0"); // 禁用着色器缓存
|
|
|
|
|
-
|
|
|
|
|
- // ========== 更多缓存禁用设置 ==========
|
|
|
|
|
- qputenv("QT_DISABLE_SHADER_CACHE", "1"); // 禁用Qt着色器缓存
|
|
|
|
|
- qputenv("QT_DISABLE_OPENGL_SHADER_CACHE", "1"); // 禁用OpenGL着色器缓存
|
|
|
|
|
- qputenv("QSG_DISABLE_VBO_CACHE", "1"); // 禁用VBO缓存
|
|
|
|
|
-
|
|
|
|
|
- // ========== 渲染风格和质量(降低为最兼容级别)==========
|
|
|
|
|
- qputenv("QSG_SIMPLE_STYLE", "1"); // 使用简单渲染风格
|
|
|
|
|
- qputenv("QT_QUICK_CONTROLS_STYLE", "Basic");
|
|
|
|
|
- qputenv("QSG_ANTIALIASING_METHOD", "disabled"); // 禁用抗锯齿
|
|
|
|
|
-
|
|
|
|
|
- // ========== 调试和信息输出 ==========
|
|
|
|
|
- qputenv("QSG_INFO", "1");
|
|
|
|
|
- qputenv("QSG_VISUALIZE", "0");
|
|
|
|
|
-
|
|
|
|
|
- // ========== 软件渲染器禁用(确保使用硬件加速)==========
|
|
|
|
|
- qputenv("QSG_SOFTWARE_RENDERER", "0");
|
|
|
|
|
-
|
|
|
|
|
- // ========== EGL配置优化(全志A133P特定)==========
|
|
|
|
|
- qputenv("QT_QPA_EGLFS_ALWAYS_SET_MODE", "1");
|
|
|
|
|
- qputenv("QT_QPA_EGLFS_INTEGRATION", "none");
|
|
|
|
|
-#endif
|
|
|
|
|
// ========== Android权限申请 ==========
|
|
// ========== Android权限申请 ==========
|
|
|
// 在应用启动时申请所有必要的权限
|
|
// 在应用启动时申请所有必要的权限
|
|
|
-
|
|
|
|
|
// 使用正确的API逐个申请权限
|
|
// 使用正确的API逐个申请权限
|
|
|
for (const QString &permission : m_permissions) {
|
|
for (const QString &permission : m_permissions) {
|
|
|
QtAndroidPrivate::checkPermission(permission);
|
|
QtAndroidPrivate::checkPermission(permission);
|
|
@@ -426,20 +362,12 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
|
|
sendBroadcastFromQt("sleep");
|
|
sendBroadcastFromQt("sleep");
|
|
|
QGuiApplication app(argc, argv);
|
|
QGuiApplication app(argc, argv);
|
|
|
-
|
|
|
|
|
// ========== 第二阶段:QGuiApplication创建后再次清理缓存 ==========
|
|
// ========== 第二阶段:QGuiApplication创建后再次清理缓存 ==========
|
|
|
// 有些缓存只有在QGuiApplication创建后才能正确访问
|
|
// 有些缓存只有在QGuiApplication创建后才能正确访问
|
|
|
clearAllCaches();
|
|
clearAllCaches();
|
|
|
LOG("Second cache clear completed!");
|
|
LOG("Second cache clear completed!");
|
|
|
-
|
|
|
|
|
- // ========== 全志A133P窗口配置优化(关键) ==========
|
|
|
|
|
- QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
|
|
|
|
|
- LOG("Graphics API forced: OpenGL");
|
|
|
|
|
- QQuickWindow::setDefaultAlphaBuffer(false); // 禁用透明缓冲
|
|
|
|
|
- //QQuickWindow::setPersistentOpenGLContext(false); // 不使用持久化GL上下文
|
|
|
|
|
- QQuickWindow::setSceneGraphBackend("opengl");
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
MyCppClass myCppClass;
|
|
MyCppClass myCppClass;
|
|
|
|
|
|
|
|
#if WIN32
|
|
#if WIN32
|
|
@@ -479,7 +407,12 @@ int main(int argc, char *argv[])
|
|
|
if(param::imei.isEmpty()){
|
|
if(param::imei.isEmpty()){
|
|
|
sendBroadcastFromQt("imei");
|
|
sendBroadcastFromQt("imei");
|
|
|
QTimer::singleShot(1000, [&]() {
|
|
QTimer::singleShot(1000, [&]() {
|
|
|
- sqlConfig->UpdateData(param::table_mqtt,"imei",param::imei);
|
|
|
|
|
|
|
+ sqlConfig->OpenDb();
|
|
|
|
|
+ if(sqlConfig->isTableExist(param::table_mqtt)){
|
|
|
|
|
+ LOG("Update imei:{}",param::imei.toStdString());
|
|
|
|
|
+ sqlConfig->UpdateData(param::table_mqtt,"imei",param::imei);
|
|
|
|
|
+ }
|
|
|
|
|
+ sqlConfig->CloseDb();
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
if(!sqlConfig->isTableExist(param::table_mqtt_other))
|
|
if(!sqlConfig->isTableExist(param::table_mqtt_other))
|
|
@@ -656,12 +589,12 @@ int main(int argc, char *argv[])
|
|
|
sqlConfig->UpdateData(param::table_camera,"stitch_photonum",QString::number(param::stitch_photonum));
|
|
sqlConfig->UpdateData(param::table_camera,"stitch_photonum",QString::number(param::stitch_photonum));
|
|
|
}
|
|
}
|
|
|
sqlConfig->CloseDb();
|
|
sqlConfig->CloseDb();
|
|
|
-
|
|
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
QObject::connect(&mqttHandler,&MqttHandler::signal_imei_change,[&](QString NEW_IMEI){
|
|
QObject::connect(&mqttHandler,&MqttHandler::signal_imei_change,[&](QString NEW_IMEI){
|
|
|
sqlConfig->OpenDb();
|
|
sqlConfig->OpenDb();
|
|
|
if(sqlConfig->isTableExist(param::table_mqtt)){
|
|
if(sqlConfig->isTableExist(param::table_mqtt)){
|
|
|
- qDebug() << "UpdateData imei !!!!!";
|
|
|
|
|
|
|
+ LOG("Update Data imei:{}",NEW_IMEI.toStdString());
|
|
|
sqlConfig->UpdateData(param::table_mqtt,"imei",NEW_IMEI);
|
|
sqlConfig->UpdateData(param::table_mqtt,"imei",NEW_IMEI);
|
|
|
}
|
|
}
|
|
|
sqlConfig->CloseDb();
|
|
sqlConfig->CloseDb();
|