mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 21:26:41 +00:00 
			
		
		
		
	Fix incompatible encoding names in ContentModel (bug uncovered by 41c17bccb6)
				
					
				
			This commit is contained in:
		
							parent
							
								
									f9a39138cc
								
							
						
					
					
						commit
						4d39d77eaa
					
				
					 2 changed files with 3 additions and 1 deletions
				
			
		|  | @ -23,6 +23,7 @@ ContentSelectorModel::ContentModel::ContentModel(QObject *parent) : | ||||||
| 
 | 
 | ||||||
| void ContentSelectorModel::ContentModel::setEncoding(const QString &encoding) | void ContentSelectorModel::ContentModel::setEncoding(const QString &encoding) | ||||||
| { | { | ||||||
|  |     mEncoding = encoding; | ||||||
|     if (encoding == QLatin1String("win1252")) |     if (encoding == QLatin1String("win1252")) | ||||||
|         mCodec = QTextCodec::codecForName("windows-1252"); |         mCodec = QTextCodec::codecForName("windows-1252"); | ||||||
| 
 | 
 | ||||||
|  | @ -449,7 +450,7 @@ void ContentSelectorModel::ContentModel::addFiles(const QString &path) | ||||||
|         try { |         try { | ||||||
|             ESM::ESMReader fileReader; |             ESM::ESMReader fileReader; | ||||||
|             ToUTF8::Utf8Encoder encoder = |             ToUTF8::Utf8Encoder encoder = | ||||||
|             ToUTF8::calculateEncoding(QString(mCodec->name()).toStdString()); |             ToUTF8::calculateEncoding(mEncoding.toStdString()); | ||||||
|             fileReader.setEncoder(&encoder); |             fileReader.setEncoder(&encoder); | ||||||
|             fileReader.open(dir.absoluteFilePath(path).toStdString()); |             fileReader.open(dir.absoluteFilePath(path).toStdString()); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -64,6 +64,7 @@ namespace ContentSelectorModel | ||||||
|         ContentFileList mFiles; |         ContentFileList mFiles; | ||||||
|         QHash<QString, Qt::CheckState> mCheckStates; |         QHash<QString, Qt::CheckState> mCheckStates; | ||||||
|         QTextCodec *mCodec; |         QTextCodec *mCodec; | ||||||
|  |         QString mEncoding; | ||||||
| 
 | 
 | ||||||
|     public: |     public: | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue