30
30
<v-layout row wrap >
31
31
<v-flex xs12 lg6 >
32
32
<img :src =" webcamStream" />
33
-
34
- </v-flex >
33
+ </v-flex >
35
34
<v-flex xs12 lg6 >
36
35
<br >
37
36
<v-layout row wrap >
62
61
</v-flex >
63
62
<v-flex xs12 sm12 >
64
63
<br ><br ><br >
65
- <v-btn-toggle >
66
- <v-btn large color =" blue-grey darken-4" class =" white--text" v-on:click =" say()" >
67
- Pronuncia
68
- <v-icon dark >chat_bubble_outline</v-icon >
69
- </v-btn >
70
- </v-btn-toggle >
64
+ <v-btn large color =" blue-grey darken-1" v-on:click =" ttsdialog = true" class =" controlBtn" :disabled =" !ttsBtnEnabled" >
65
+ Pronuncia
66
+ <v-icon >chat_bubble_outline</v-icon >
67
+ </v-btn >
71
68
</v-flex >
72
69
<v-flex xs12 sm12 >
73
- <v-btn-toggle >
74
- <v-btn large color =" blue-grey darken-4" class =" white--text" v-on:click =" takePhoto()" :disabled =" !photoBtnEnabled" >
75
- Scatta foto
76
- <v-icon dark >camera_alt</v-icon >
77
- </v-btn >
78
- </v-btn-toggle >
70
+ <v-btn large color =" blue-grey darken-1" class =" controlBtn" v-on:click =" takePhoto()" :disabled =" !photoBtnEnabled" >
71
+ Scatta foto
72
+ <v-icon dark >camera_alt</v-icon >
73
+ </v-btn >
79
74
</v-flex >
80
75
<v-flex xs12 sm12 >
81
- <v-btn-toggle >
82
- <v-btn large color =" blue-grey darken-4" class =" white--text" v-on:click =" videoHandler()" :disabled =" !videoBtn.enabled" >
83
- {{ videoBtn.text }}
84
- <v-icon dark >{{ videoBtn.icon }} </v-icon >
85
- </v-btn >
86
- </v-btn-toggle >
76
+ <v-btn large color =" blue-grey darken-1" class =" controlBtn" v-on:click =" videoHandler()" :disabled =" !videoBtn.enabled" >
77
+ {{ videoBtn.text }}
78
+ <v-icon dark >{{ videoBtn.icon }} </v-icon >
79
+ </v-btn >
87
80
</v-flex >
88
81
<v-flex xs12 sm12 >
89
- <v-btn-toggle >
90
- <v-btn large color =" blue-grey darken-4" class =" white--text" v-on:click =" showGallery()" >
91
- Galleria
92
- <v-icon dark >photo_library</v-icon >
93
- </v-btn >
94
- </v-btn-toggle >
82
+ <v-btn large color =" blue-grey darken-1" class =" controlBtn" v-on:click =" showGallery()" >
83
+ Galleria
84
+ <v-icon dark >photo_library</v-icon >
85
+ </v-btn >
95
86
</v-flex >
96
87
</v-layout >
97
88
</v-flex >
111
102
Chiudi
112
103
</v-btn >
113
104
</v-snackbar >
105
+ <v-dialog v-model =" ttsdialog" width =" 600px" >
106
+ <v-card >
107
+ <v-card-title >
108
+ <span class =" headline" >Text to Speech</span >
109
+ </v-card-title >
110
+ <v-card-text >
111
+ <v-text-field v-model =" ttstext" label =" Frase da pronunciare" solo ></v-text-field >
112
+ </v-card-text >
113
+ <v-card-actions >
114
+ <v-spacer ></v-spacer >
115
+ <v-btn color =" gray darken-1" flat =" flat" @click =" ttsdialog=false" >Annulla</v-btn >
116
+ <v-btn color =" green darken-1" flat =" flat" @click =" say()" >Pronuncia</v-btn >
117
+ </v-card-actions >
118
+ </v-card >
119
+ </v-dialog >
114
120
</v-app >
115
121
</template >
116
122
<script >
@@ -121,12 +127,23 @@ export default {
121
127
name: ' HelloWorld' ,
122
128
methods: {
123
129
say () {
124
-
130
+ let CBv1 = this .$data .CBv1
131
+ let axios = this .$axios ;
132
+ axios .get (CBv1 + ' /bot' , { params: { ' cmd' : ' say' , ' param1' : this .$data .ttstext } })
133
+ .then (function (response ) {
134
+ this .$data .ttsBtnEnabled = false
135
+ this .$data .ttsdialog = false
136
+ this .$data .snackText = ' Sto pronunciando'
137
+ this .$data .snackbar = true
138
+ setTimeout (function () {
139
+ this .$data .ttsBtnEnabled = true
140
+ }.bind (this ), this .$data .ttstext .length * 200 )
141
+ }.bind (this ))
125
142
},
126
143
takePhoto () {
127
144
let CBv1 = this .$data .CBv1
128
145
let axios = this .$axios ;
129
- axios .get (CBv1, { params: { ' cmd' : ' take_photo' } })
146
+ axios .get (CBv1 + ' /bot ' , { params: { ' cmd' : ' take_photo' } })
130
147
.then (function (response ) {
131
148
this .$data .snackText = ' Foto scattata'
132
149
this .$data .snackbar = true
@@ -146,10 +163,11 @@ export default {
146
163
recordVideo () {
147
164
let CBv1 = this .$data .CBv1
148
165
let axios = this .$axios ;
149
- axios .get (CBv1, { params: { ' cmd' : ' video_rec' } })
166
+ axios .get (CBv1 + ' /bot ' , { params: { ' cmd' : ' video_rec' } })
150
167
.then (function (response ) {
151
168
this .$data .snackText = ' Registrazione Avviata'
152
169
this .$data .snackbar = true
170
+ this .$data .photoBtnEnabled = false
153
171
this .$data .videoBtn .text = ' Ferma registrazione video'
154
172
this .$data .videoBtn .icon = ' stop'
155
173
this .videoBtn .action = ' stop'
@@ -159,7 +177,7 @@ export default {
159
177
stopVideoRecording () {
160
178
let CBv1 = this .$data .CBv1
161
179
let axios = this .$axios ;
162
- axios .get (CBv1, { params: { ' cmd' : ' video_rec ' } })
180
+ axios .get (CBv1 + ' /bot ' , { params: { ' cmd' : ' video_stop ' } })
163
181
.then (function (response ) {
164
182
this .$data .snackText = ' Registrazione terminata'
165
183
this .$data .snackbar = true
@@ -169,6 +187,7 @@ export default {
169
187
this .$data .videoBtn .enabled = true
170
188
this .$data .videoBtn .text = ' Registra Video'
171
189
this .$data .videoBtn .icon = ' videocam'
190
+ this .$data .photoBtnEnabled = true
172
191
}.bind (this ), 1000 )
173
192
}.bind (this ))
174
193
},
@@ -278,13 +297,16 @@ export default {
278
297
},
279
298
data () {
280
299
return {
300
+ ttstext: null ,
301
+ ttsdialog: false ,
281
302
snackText: null ,
282
303
snackbar: false ,
283
304
webcamStream: process .env .CB_ENDPOINT + process .env .APIv1 + ' /video/stream' ,
284
305
CB : process .env .CB_ENDPOINT + process .env .APIv2 ,
285
306
CBv1: process .env .CB_ENDPOINT + process .env .APIv1 ,
286
307
status: null ,
287
308
pressDuration: null ,
309
+ ttsBtnEnabled: true ,
288
310
photoBtnEnabled: true ,
289
311
videoBtn: {
290
312
' text' : ' Registra Video' ,
@@ -306,4 +328,12 @@ export default {
306
328
</script >
307
329
<!-- Add "scoped" attribute to limit CSS to this component only -->
308
330
<style scoped>
331
+ .controlBtn {
332
+ color : white ;
333
+ margin : 2px 3px ;
334
+ padding-right : 25px ; /* 32 - icon additional margin */
335
+ }
336
+ .controlBtn .v-icon {
337
+ margin : 7px ;
338
+ }
309
339
</style >
0 commit comments