QTfrontend/model/gameSchemeModel.cpp
changeset 13559 a5a8488e2485
parent 13277 5984e8c6cbeb
child 13858 46e1c1069ac2
--- a/QTfrontend/model/gameSchemeModel.cpp	Tue Jul 24 20:46:22 2018 +0200
+++ b/QTfrontend/model/gameSchemeModel.cpp	Thu Jul 26 00:18:59 2018 +0200
@@ -856,9 +856,15 @@
 
 bool GameSchemeModel::hasScheme(QString name)
 {
+    return hasScheme(name, -1);
+}
+
+bool GameSchemeModel::hasScheme(QString name, int ignoreID)
+{
+    QString nameLower = name.toLower();
     for(int i=0; i<schemes.size(); i++)
     {
-        if(schemes[i][0] == name)
+        if(((ignoreID == -1) || (i != ignoreID)) && (schemes[i][0].toString().toLower() == nameLower))
         {
             return true;
         }
@@ -866,6 +872,11 @@
     return false;
 }
 
+bool GameSchemeModel::renameScheme(int index, QString newName)
+{
+    return setData(QAbstractItemModel::createIndex(index, 0), QVariant(newName));
+}
+
 Qt::ItemFlags GameSchemeModel::flags(const QModelIndex & index) const
 {
     Q_UNUSED(index);