Permalink
Browse files

you can now select no camera. fixes #86

  • Loading branch information...
1 parent 7c67f50 commit 711db6d18ec14b2592efc2375b11eb7468f5875f Zach Hoeken committed Jul 25, 2013
Showing with 12 additions and 8 deletions.
  1. +5 −8 controllers/bot.php
  2. +7 −0 views/bot/driver_form.php
View
@@ -294,6 +294,8 @@ public function edit()
if ($this->args('webcam_contrast'))
$config->webcam->contrast = (int)$this->args('webcam_contrast');
}
+ else
+ unset($config->webcam);
//save it all to the bot as json.
$bot->set('driver_config', json::encode($config));
@@ -883,15 +885,10 @@ public function driver_form()
//okay, no webcam settings.
else
{
- //did we only get one webcam?
- if (is_object($devices) && !empty($devices->cameras) && count($devices->cameras) == 1)
- {
- $this->set('webcam_id', $devices->cameras[0]->id);
- $this->set('webcam_name', $devices->cameras[0]->name);
- $this->set('webcam_device', $devices->cameras[0]->device);
- }
-
//some default webcam settings.
+ $this->set('webcam_id', '');
+ $this->set('webcam_name', '');
+ $this->set('webcam_device', '');
$this->set('webcam_brightness', 50);
$this->set('webcam_contrast', 50);
}
@@ -69,6 +69,13 @@
<span class="muted">Click on an image to select your webcam or enter it manually below.</span>
</label>
<div class="controls">
+ <div class="span3 webcam_preview <?= (!$webcam_device) ? 'active' : ''?>" id="webcam_preview_foo" onclick="set_webcam('foo')">
+ <input type="hidden" id="webcam_id_foo" value="">
+ <input type="hidden" id="webcam_name_foo" value="">
+ <input type="hidden" id="webcam_device_foo" value="">
+ <span class="webcam_name">No Camera</span>
+ <img src="/img/colorbars.gif">
+ </div>
<? foreach ($devices->camera_files AS $idx => $file_id): ?>
<? $s3 = new S3File($file_id); ?>
<div class="span3 webcam_preview <?= ($devices->cameras[$idx]->device == $webcam_device) ? 'active' : ''?>" id="webcam_preview_<?=$idx?>" onclick="set_webcam(<?=$idx?>)">

0 comments on commit 711db6d

Please sign in to comment.