diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 43ad5f23..ce4f6f9c 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -39,9 +39,10 @@ Settings *Settings::s_pSetting = nullptr; CustemBackend::CustemBackend(const QString &filepath, QObject *parent) - : DSettingsBackend (parent) + : DSettingsBackend (parent), + m_settings (new QSettings(filepath, QSettings::IniFormat)) { - m_settings = new QSettings(filepath, QSettings::IniFormat); + } void CustemBackend::doSync() diff --git a/src/encodes/detectcode.cpp b/src/encodes/detectcode.cpp index fca20944..3bb6ef2c 100644 --- a/src/encodes/detectcode.cpp +++ b/src/encodes/detectcode.cpp @@ -39,7 +39,7 @@ QByteArray DetectCode::GetFileEncodingFormat(QString filepath, QByteArray conten QByteArray ucharDetectdRet; QByteArrayList icuDetectRetList; QByteArray detectRet; - float chardetconfidence = 0; + float chardetconfidence = 0.0f; /* chardet识别编码 */ QString str(content); @@ -54,7 +54,7 @@ QByteArray DetectCode::GetFileEncodingFormat(QString filepath, QByteArray conten ucharDetectdRet = charDetectedResult.toLatin1(); /* uchardet识别编码 */ - if (ucharDetectdRet == "unknown" || ucharDetectdRet == "???" || ucharDetectdRet.isEmpty()) { + if (ucharDetectdRet.contains("unknown") || ucharDetectdRet.contains("???") || ucharDetectdRet.isEmpty()) { ucharDetectdRet = DetectCode::UchardetCode(filepath); } @@ -62,7 +62,7 @@ QByteArray DetectCode::GetFileEncodingFormat(QString filepath, QByteArray conten icuDetectTextEncoding(filepath, icuDetectRetList); detectRet = selectCoding(ucharDetectdRet, icuDetectRetList); - if(detectRet == "ASCII" || detectRet.isEmpty()) { + if(detectRet.contains("ASCII") || detectRet.isEmpty()) { detectRet = "UTF-8"; }