QTfrontend/model/gameSchemeModel.cpp
branch0.9.24
changeset 13556 0c8deb338990
parent 13272 5984e8c6cbeb
child 13874 46e1c1069ac2
equal deleted inserted replaced
13552:54b9fd6f4e84 13556:0c8deb338990
   854         return defaultScheme.size();
   854         return defaultScheme.size();
   855 }
   855 }
   856 
   856 
   857 bool GameSchemeModel::hasScheme(QString name)
   857 bool GameSchemeModel::hasScheme(QString name)
   858 {
   858 {
       
   859     return hasScheme(name, -1);
       
   860 }
       
   861 
       
   862 bool GameSchemeModel::hasScheme(QString name, int ignoreID)
       
   863 {
       
   864     QString nameLower = name.toLower();
   859     for(int i=0; i<schemes.size(); i++)
   865     for(int i=0; i<schemes.size(); i++)
   860     {
   866     {
   861         if(schemes[i][0] == name)
   867         if(((ignoreID == -1) || (i != ignoreID)) && (schemes[i][0].toString().toLower() == nameLower))
   862         {
   868         {
   863             return true;
   869             return true;
   864         }
   870         }
   865     }
   871     }
   866     return false;
   872     return false;
       
   873 }
       
   874 
       
   875 bool GameSchemeModel::renameScheme(int index, QString newName)
       
   876 {
       
   877     return setData(QAbstractItemModel::createIndex(index, 0), QVariant(newName));
   867 }
   878 }
   868 
   879 
   869 Qt::ItemFlags GameSchemeModel::flags(const QModelIndex & index) const
   880 Qt::ItemFlags GameSchemeModel::flags(const QModelIndex & index) const
   870 {
   881 {
   871     Q_UNUSED(index);
   882     Q_UNUSED(index);