bool Controller::startVideo() { if( camera->handle() == 0 ) { return( false ); } /* * Camera must be set to movie shooting mode. * On some cameras video mode is a shooting mode; * on others it is a separate switch. */ if( (camera->getShootingMode() != kEdsAEMode_Movie) && (camera->getEvfMode() != 2) ) { emit eventReport( new Event( Event::NotVideoMode ) ); return( false ); } /* * Get current record mode. * Nothing to do if already recording a movie. */ int recordMode = camera->getRecordMode(); if( recordMode == Map::RecordModeStart ) { return( true ); } /* * Save video on camera (as cannot transfer directly to PC). * Remember the current setting so it can be restored when * video recording is terminated. */ saveSaveTo = camera->getSaveTo(); if( !setPropertyCommand( kEdsPropID_SaveTo, kEdsSaveTo_Camera ) ) { setPropertyCommand( kEdsPropID_SaveTo, saveSaveTo ); return( false ); } int result = EDS_ERR_OK; /* * Begin movie shooting. */ uint recordStart = Map::RecordModeStart; result = EdsSetPropertyData( camera->handle(), kEdsPropID_Record, 0, sizeof(recordStart), &recordStart ); /* * Will also be set through a callback from the camera. */ if( result == EDS_ERR_OK ) { camera->setRecordMode( Map::RecordModeStart ); } return( result == EDS_ERR_OK ); }
/* * Given a bulb shutter speed and a lower ISO, * take a test shot using a higher ISO and a * correspondingly lower shutter speed. The * shutter speed is in seconds. */ void Controller::highISOtest( int shutterSpeed ) { if( camera->handle() == 0 ) { return; } int saveISO; int ISO; int maxISO; /* * Save current ISO value. */ saveISO = camera->getISO(); if( saveISO == 0 ) { emit eventReport( new Event( Event::ISOAuto ) ); return; } /* * Get max ISO value. */ int n, *v; camera->getISO_List( &n, &v ); maxISO = Map::toISO( v[n-1] ); /* * Determine shutter speed and ISO value for test shot. */ ISO = Map::toISO( saveISO ); while( (shutterSpeed >= 4) && (ISO < maxISO) ) { shutterSpeed = (int)ceil(shutterSpeed/2.0); ISO *= 2; } /* * Take picture with new ISO and shutter speed. */ setPropertyCommand( kEdsPropID_ISOSpeed, Map::fromISO( ISO ) ); bulbShutterTime = 1000 * shutterSpeed; // milliseconds bulbOpenShutter(); /* * Restore ISO to its original setting. */ setPropertyCommand( kEdsPropID_ISOSpeed, saveISO ); }
void Controller::stopVideo() { int result = EDS_ERR_OK; /* * Check whether already not in movie recording mode. */ if( camera->getRecordMode() == Map::RecordModeStop ) { return; } /* * Stop movie shooting. */ uint recordStop = Map::RecordModeStop; result = EdsSetPropertyData( camera->handle(), kEdsPropID_Record, 0, sizeof(recordStop), &recordStop ); /* * Will also be set through a callback from the camera. */ if( result == EDS_ERR_OK ) { camera->setRecordMode( Map::RecordModeStop ); } /* * Restore the previous setting for destination of images. */ setPropertyCommand( kEdsPropID_SaveTo, saveSaveTo ); }
void ActionEditor::editAction(QAction *action) { if (!action) return; NewActionDialog dlg(this); dlg.setWindowTitle(tr("Edit action")); ActionData oldActionData; QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), action); oldActionData.name = action->objectName(); oldActionData.text = action->text(); oldActionData.toolTip = textPropertyValue(sheet, QLatin1String(toolTipPropertyC)); oldActionData.icon = qvariant_cast<PropertySheetIconValue>(sheet->property(sheet->indexOf(QLatin1String(iconPropertyC)))); oldActionData.keysequence = ActionModel::actionShortCut(sheet); oldActionData.checkable = action->isCheckable(); dlg.setActionData(oldActionData); if (!dlg.exec()) return; // figure out changes and whether to start a macro const ActionData newActionData = dlg.actionData(); const unsigned changeMask = newActionData.compare(oldActionData); if (changeMask == 0u) return; const bool severalChanges = (changeMask != ActionData::TextChanged) && (changeMask != ActionData::NameChanged) && (changeMask != ActionData::ToolTipChanged) && (changeMask != ActionData::IconChanged) && (changeMask != ActionData::CheckableChanged) && (changeMask != ActionData::KeysequenceChanged); QDesignerFormWindowInterface *fw = formWindow(); QUndoStack *undoStack = fw->commandHistory(); if (severalChanges) fw->beginCommand(QStringLiteral("Edit action")); if (changeMask & ActionData::NameChanged) undoStack->push(createTextPropertyCommand(QLatin1String(objectNamePropertyC), newActionData.name, action, fw)); if (changeMask & ActionData::TextChanged) undoStack->push(createTextPropertyCommand(QLatin1String(textPropertyC), newActionData.text, action, fw)); if (changeMask & ActionData::ToolTipChanged) undoStack->push(createTextPropertyCommand(QLatin1String(toolTipPropertyC), newActionData.toolTip, action, fw)); if (changeMask & ActionData::IconChanged) undoStack->push(setIconPropertyCommand(newActionData.icon, action, fw)); if (changeMask & ActionData::CheckableChanged) undoStack->push(setPropertyCommand(QLatin1String(checkablePropertyC), newActionData.checkable, false, action, fw)); if (changeMask & ActionData::KeysequenceChanged) undoStack->push(setKeySequencePropertyCommand(newActionData.keysequence, action, fw)); if (severalChanges) fw->endCommand(); }
void Controller::startSequence( ShotSeq *shotSeq ) { if( camera->handle() == 0 ) { doSeq = false; emit eventReport( new Event( Event::SequenceCancelledNoConnection ) ); return; } if( (camera->getMirrorLockup() == 1) && !doLive ) { doSeq = false; emit eventReport( new Event( Event::SequenceCancelledMirrorLockup ) ); return; } if( (shotSeq->type == ShotSeq::FocusBracketing) && (camera->getEvfOutputDevice() == 0) ) { doSeq = false; emit eventReport( new Event( Event::SequenceCancelledNotEvfMode ) ); return; } this->shotSeq = shotSeq; doSeq = true; emit eventReport( new Event( Event::SequenceInitiated, shotSeq->type ) ); if( shotSeq->type == ShotSeq::ExposureBracketingManual ) { /* * Exposure bracketing in Manual shooting mode. * Keep aperture constant, adjust shutter speed. */ for( int i = 0; (i < shotSeq->frames) && doSeq; i++ ) { setPropertyCommand( kEdsPropID_Tv, shotSeq->bracket[i] ); takePictureCommand(); QCoreApplication::processEvents(); } // restore shutter speed to its original setting setPropertyCommand( kEdsPropID_Tv, shotSeq->bracket[0] ); } else if( shotSeq->type == ShotSeq::ExposureBracketingAv ) { /* * Exposure bracketing in Av shooting mode. * Keep aperture constant, adjust shutter speed * by changing exposure compensation. */ for( int i = 0; (i < shotSeq->frames) && doSeq; i++ ) { setPropertyCommand( kEdsPropID_ExposureCompensation, shotSeq->bracket[i] ); takePictureCommand(); QCoreApplication::processEvents(); } // restore exposure compensation to its original setting setPropertyCommand( kEdsPropID_ExposureCompensation, shotSeq->bracket[0] ); } else if( shotSeq->type == ShotSeq::FocusBracketing ) { /* * Focus bracketing. */ //const int latency = 333; // 100 is sufficient for USM lens const int latency = 3333; // 100 is sufficient for USM lens for( int i = 0; (i < shotSeq->frames) && doSeq; i++ ) { if( shotSeq->bracket[i] != 0 ) { focusAdjustment( shotSeq->bracket[i] ); } Sleep( latency ); takePictureCommand(); /* * The camera becomes unstable if focus adjustments * are attempted while the shutter is open. This is * an inelegant but simple fix. */ QApplication::setOverrideCursor( Qt::BusyCursor ); int l = Map::toShutterSpeed( camera->getTv() ); // break into 100 millisecond chunks l = l/100; for( int i = 0; i <= l; i++ ) { QCoreApplication::processEvents(); Sleep( 100 ); } QCoreApplication::processEvents(); QApplication::restoreOverrideCursor(); } } else if( shotSeq->type == ShotSeq::Interval ) { /* * Interval shooting. Delay til first shot. */ QTimer::singleShot( shotSeq->delay, this, SLOT(firstShot()) ); } else if( shotSeq->type == ShotSeq::Stitch ) { /* * Panorama shooting. */ doSeq = true; } else { doSeq = false; emit eventReport( new Event( Event::SequenceCancelled ) ); } }