QTfrontend/model/gameSchemeModel.cpp
branch0.9.24
changeset 13556 0c8deb338990
parent 13272 5984e8c6cbeb
child 13853 46e1c1069ac2
--- a/QTfrontend/model/gameSchemeModel.cpp	Tue Jul 24 20:46:22 2018 +0200
+++ b/QTfrontend/model/gameSchemeModel.cpp	Thu Jul 26 14:18:23 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);