qmlFrontend/qml/qmlFrontend/GameConfig.qml
branchqmlfrontend
changeset 10452 03519fd9f98d
parent 10450 bf9e30b4ef9b
child 10454 2b590e7972b1
equal deleted inserted replaced
10450:bf9e30b4ef9b 10452:03519fd9f98d
   103             radius: 8
   103             radius: 8
   104             border.width: 2
   104             border.width: 2
   105             border.color: "#eaea00"
   105             border.color: "#eaea00"
   106 
   106 
   107             Row {
   107             Row {
   108                 Text { text: name }
   108                 Rectangle {
   109             }
   109                     height: 20
   110 
   110                     width: height
   111             MouseArea {
   111                     color: teamColor
   112                  z: 1
   112                     border.width: 2
   113                  anchors.fill: parent
   113                     border.color: "#eaea00"                    
   114                  onClicked: HWEngine.tryRemoveTeam(name)
   114 
   115             }
   115                     MouseArea {
       
   116                         z: 1
       
   117                         anchors.fill: parent
       
   118                         onClicked: HWEngine.changeTeamColor(name, 1)
       
   119                    }
       
   120                 }
       
   121 
       
   122                 Text { text: name
       
   123                     MouseArea {
       
   124                         z: 1
       
   125                         anchors.fill: parent
       
   126                         onClicked: HWEngine.tryRemoveTeam(name)
       
   127                    }
       
   128                 }
       
   129             }
       
   130 
       
   131 
   116         }
   132         }
   117 
   133 
   118         Connections {
   134         Connections {
   119             target: HWEngine
   135             target: HWEngine
   120             onPlayingTeamAdded: playingTeamsModel.append({"aiLevel": aiLevel, "name": teamName, "local": isLocal})
   136             onPlayingTeamAdded: playingTeamsModel.append({
       
   137                                                              "aiLevel": aiLevel
       
   138                                                              , "name": teamName
       
   139                                                              , "local": isLocal
       
   140                                                              , "teamColor": "#000000"
       
   141                                                          })
   121             onPlayingTeamRemoved: {
   142             onPlayingTeamRemoved: {
   122                 var i = playingTeamsModel.count - 1;
   143                 var i = playingTeamsModel.count - 1;
   123                 while ((i >= 0) && (playingTeamsModel.get(i).name !== teamName)) --i
   144                 while ((i >= 0) && (playingTeamsModel.get(i).name !== teamName)) --i
   124 
   145 
   125                 if(i >= 0) playingTeamsModel.remove(i, 1)
   146                 if(i >= 0) playingTeamsModel.remove(i, 1)
       
   147             }
       
   148             onTeamColorChanged: {
       
   149                 var i = playingTeamsModel.count - 1;
       
   150                 while ((i >= 0) && (playingTeamsModel.get(i).name !== teamName)) --i
       
   151 
       
   152                 if(i >= 0) playingTeamsModel.setProperty(i, "teamColor", colorValue)
   126             }
   153             }
   127         }
   154         }
   128     }
   155     }
   129 
   156 
   130     ListView {
   157     ListView {