fix: 检测UOS开发者模式

This commit is contained in:
2022-12-29 11:55:36 +08:00
parent 2ab4ebc0e3
commit fc658f324d
6 changed files with 169 additions and 98 deletions

View File

@@ -10,6 +10,8 @@
DCORE_USE_NAMESPACE
DWIDGET_USE_NAMESPACE
#define UOSCheckFile "/var/lib/deepin/developer-mode/enabled"
int main(int argc, char *argv[])
{
// Get build time
@@ -67,6 +69,27 @@ int main(int argc, char *argv[])
qputenv("QT_QPA_PLATFORM", "dxcb");
}
// Check UOS developer mode.
QFile UOSDevelopFile(UOSCheckFile);
if (UOSDevelopFile.exists() && isDeepinOS)
{
config.setValue("UOS/isUOS", true);
QTextStream UOStextStream(&UOSDevelopFile);
QString lineData = UOStextStream.readLine();
bool devmode = lineData.toInt();
qDebug() << "UOS Developer Mode Status:" << devmode;
config.setValue("UOS/EnableDeveloperMode", devmode);
}
else
{
if (config.contains("UOS/isUOS"))
{
config.remove("UOS/isUOS");
config.remove("UOS/EnableDeveloperMode");
}
}
config.sync(); // 写入更改至 config.ini并同步最新内容
// 龙芯机器配置,使得 DApplication 能正确加载 QTWEBENGINE
qputenv("DTK_FORCE_RASTER_WIDGETS", "FALSE");
// qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-features=UseModernMediaControls");