@@ -71,6 +71,7 @@ Config::Config(QObject *parent)
7171#ifdef DTKCORE_CLASS_DConfigFile
7272 dconfig = DConfig::create (" org.deepin.editor" , " org.deepin.editor" );
7373 if (dconfig->isValid ()) {
74+ qDebug () << " DConfig is valid" ;
7475 // 默认提高GB18030识别率
7576 improveGB18030 = !dconfig->value (g_keyDisableImproveGB18030).toBool ();
7677 qInfo () << qPrintable (" DConfig::ImproveGB18030:" ) << improveGB18030;
@@ -82,15 +83,19 @@ Config::Config(QObject *parent)
8283 qInfo () << qPrintable (" DConfig::defaultEncoding" ) << encoding;
8384
8485 connect (dconfig, &DConfig::valueChanged, this , [this ](const QString &key) {
86+ qDebug () << " Config value changed for key:" << key;
8587 if (key == g_keyDisableImproveGB18030) {
8688 this ->improveGB18030 = !this ->dconfig ->value (g_keyDisableImproveGB18030).toBool ();
8789 qInfo () << qPrintable (" DConfig::ImproveGB18030 changed:" ) << improveGB18030;
90+ qDebug () << " improveGB18030 changed to" << this ->improveGB18030 ;
8891 } else if (key == g_keyEnablePatchedIconv) {
8992 this ->patchedIconv = dconfig->value (g_keyEnablePatchedIconv).toBool ();
9093 qInfo () << qPrintable (" DConfig::enablePatchedIconv changed:" ) << patchedIconv;
94+ qDebug () << " patchedIconv changed to" << this ->patchedIconv ;
9195 } else if (key == g_keyDefaultEncoding) {
9296 this ->encoding = dconfig->value (g_keyDefaultEncoding).toByteArray ().toUpper ();
9397 qInfo () << qPrintable (" DConfig::defaultEncoding changed:" ) << encoding;
98+ qDebug () << " encoding changed to" << this ->encoding ;
9499 }
95100 });
96101
@@ -103,22 +108,26 @@ Config::Config(QObject *parent)
103108
104109 // 检测当前iconv使用的GB18030编码是否为2005标准(2005标准强制使用上层补丁版本)
105110 iocnvUse2005Standard = detectIconvUse2005Standard ();
111+ qDebug () << " Leaving Config::Config" ;
106112}
107113
108114Config::~Config ()
109115{
110116 qDebug () << " Destroying Config instance" ;
111117#ifdef DTKCORE_CLASS_DConfigFile
112118 if (dconfig) {
119+ qDebug () << " Deleting dconfig" ;
113120 delete dconfig;
114121 }
115122#endif
123+ qDebug () << " Leaving Config::~Config" ;
116124}
117125
118126Config *Config::instance ()
119127{
120128 qDebug () << " Getting Config singleton instance" ;
121129 static Config config;
130+ qDebug () << " Leaving Config::instance" ;
122131 return &config;
123132}
124133
@@ -127,6 +136,7 @@ Config *Config::instance()
127136 */
128137bool Config::enableImproveGB18030 () const
129138{
139+ qDebug () << " Entering Config::enableImproveGB18030, returning" << improveGB18030;
130140 return improveGB18030;
131141}
132142
@@ -136,6 +146,7 @@ bool Config::enableImproveGB18030() const
136146 */
137147bool Config::enablePatchedIconv () const
138148{
149+ qDebug () << " Entering Config::enablePatchedIconv, returning" << (patchedIconv || iocnvUse2005Standard);
139150 return patchedIconv || iocnvUse2005Standard;
140151}
141152
@@ -144,5 +155,11 @@ bool Config::enablePatchedIconv() const
144155 */
145156QByteArray Config::defaultEncoding () const
146157{
147- return encoding.isEmpty () ? QByteArray (" UTF-8" ) : encoding;
158+ qDebug () << " Entering Config::defaultEncoding" ;
159+ if (encoding.isEmpty ()) {
160+ qDebug () << " Encoding is empty, returning UTF-8" ;
161+ return QByteArray (" UTF-8" );
162+ }
163+ qDebug () << " Returning configured encoding:" << encoding;
164+ return encoding;
148165}
0 commit comments