equal
deleted
inserted
replaced
736 schemes.append(hedgeeditor); |
736 schemes.append(hedgeeditor); |
737 |
737 |
738 if (!QDir(cfgdir->absolutePath() + "/Schemes").exists()) { |
738 if (!QDir(cfgdir->absolutePath() + "/Schemes").exists()) { |
739 QDir().mkdir(cfgdir->absolutePath() + "/Schemes"); |
739 QDir().mkdir(cfgdir->absolutePath() + "/Schemes"); |
740 } |
740 } |
|
741 QStringList predefSchemesNamesLower; |
|
742 for (int i = 0; i < predefSchemesNames.size(); ++i) |
|
743 { |
|
744 predefSchemesNamesLower.append(predefSchemesNames[i].toLower()); |
|
745 } |
741 if (!QDir(directory).exists()) { |
746 if (!QDir(directory).exists()) { |
742 QDir().mkdir(directory); |
747 QDir().mkdir(directory); |
743 |
748 |
744 qDebug("No /Schemes/Game directory found. Trying to import game schemes from schemes.ini."); |
749 qDebug("No /Schemes/Game directory found. Trying to import game schemes from schemes.ini."); |
745 |
750 |
749 for (int i = 0; i < size; ++i) |
754 for (int i = 0; i < size; ++i) |
750 { |
755 { |
751 legacyFileConfig.setArrayIndex(i); |
756 legacyFileConfig.setArrayIndex(i); |
752 |
757 |
753 QString schemeName = legacyFileConfig.value(spNames[0]).toString(); |
758 QString schemeName = legacyFileConfig.value(spNames[0]).toString(); |
754 if (!schemeName.isNull() && !predefSchemesNames.contains(schemeName)) |
759 if (!schemeName.isNull() && !predefSchemesNamesLower.contains(schemeName.toLower())) |
755 { |
760 { |
756 QList<QVariant> scheme; |
761 QList<QVariant> scheme; |
757 QFile file(directory + "/" + schemeName + ".hwg"); |
762 QFile file(directory + "/" + schemeName + ".hwg"); |
758 |
763 |
759 // Add keys to scheme info and create file |
764 // Add keys to scheme info and create file |
791 |
796 |
792 // Chop off file name suffix |
797 // Chop off file name suffix |
793 QString schemeName = scheme_dir[i]; |
798 QString schemeName = scheme_dir[i]; |
794 if (schemeName.endsWith(".hwg", Qt::CaseInsensitive)) { |
799 if (schemeName.endsWith(".hwg", Qt::CaseInsensitive)) { |
795 schemeName.chop(4); |
800 schemeName.chop(4); |
|
801 } |
|
802 // Don't load scheme if name collides with default scheme |
|
803 if (predefSchemesNamesLower.contains(schemeName.toLower())) { |
|
804 qWarning("Game scheme \"%s\" not loaded from file, name collides with a default scheme!", qPrintable(schemeName)); |
|
805 continue; |
796 } |
806 } |
797 // Parse game scheme file |
807 // Parse game scheme file |
798 if (file.open(QIODevice::ReadOnly)) { |
808 if (file.open(QIODevice::ReadOnly)) { |
799 QTextStream stream(&file); |
809 QTextStream stream(&file); |
800 QString line, key, value; |
810 QString line, key, value; |