Exemplo n.º 1
0
/**
 * Check if the max video duration value given by the user is valid.
 * @return True if data is valid, false otherwise.
 */
bool SettingsScreen::isMaxVideoDurationValid()
{
	int resultSyscall = MA_CAPTURE_RES_OK;
	bool returnValue = true;

	String maxDuration = mMaxDurationEditBox->getText();
	// If user didn't provide a value just ignore this option.
	if (maxDuration.length() != 0)
	{
		resultSyscall = maCaptureSetProperty(
			MA_CAPTURE_MAX_DURATION,
			maxDuration.c_str());
		if (resultSyscall != MA_CAPTURE_RES_OK)
		{
			returnValue = false;
			mMaxDurationEditBox->setFontColor(RED_COLOR);
		}
		else
		{
			mMaxDurationEditBox->setFontColor(BLACK_COLOR);
		}
	}

	return returnValue;
}
Exemplo n.º 2
0
/**
 * This method is called when a list view item is clicked.
 * @param listView The list view object that generated the event.
 * @param listViewItem The ListViewItem object that was clicked.
 */
void FlashModeScreen::listViewItemClicked(
    ListView* listView,
    ListViewItem* listViewItem)
{
	if ( mListView == listView )
	{
		mFlashAutoListItem->setBackgroundColor(UNSELECTED_QUALITY_COLOR);
		mFlashOnListItem->setBackgroundColor(UNSELECTED_QUALITY_COLOR);
		mFlashOffListItem->setBackgroundColor(UNSELECTED_QUALITY_COLOR);
		int selectedFlashMode;

		if (listViewItem == mFlashAutoListItem)
		{
			selectedFlashMode = MA_CAPTURE_FLASH_AUTO;
			mFlashAutoListItem->setBackgroundColor(SELECTED_QUALITY_COLOR);
		}
		else if (listViewItem == mFlashOnListItem)
		{
			selectedFlashMode = MA_CAPTURE_FLASH_ON;
			mFlashOnListItem->setBackgroundColor(SELECTED_QUALITY_COLOR);
		}
		else if (listViewItem == mFlashOffListItem)
		{
			selectedFlashMode = MA_CAPTURE_FLASH_OFF;
			mFlashOffListItem->setBackgroundColor(SELECTED_QUALITY_COLOR);
		}

		// Set the selected video quality.
		String value = MAUtil::integerToString(selectedFlashMode);
		int syscallResult = maCaptureSetProperty(
			MA_CAPTURE_FLASH,
			value.c_str());
		printf("maCaptureSetProperty(MA_CAPTURE_FLASH) - %d", syscallResult);
	}
}
Exemplo n.º 3
0
/**
 * This method is called when the state of the check box was changed
 * by the user.
 * @param checkBox The check box object that generated the event.
 * @param state True if the check box is checked, false otherwise.
 */
void SettingsScreen::checkBoxStateChanged(
    CheckBox* checkBox,
    bool state)
{
	if (checkBox == mCameraRollCheckBox)
	{
		MAUtil::String value = state ? "true" : "false";
		int syscallResult = maCaptureSetProperty(
			MA_CAPTURE_CAMERA_ROLL,
			value.c_str());
		printf("maCaptureSetProperty(MA_CAPTURE_CAMERA_ROLL) = %d", syscallResult);
	}
	else if (checkBox == mCameraControlsCheckBox)
	{
		MAUtil::String value = state ? "true" : "false";
		int syscallResult = maCaptureSetProperty(
			MA_CAPTURE_CAMERA_CONTROLS,
			value.c_str());
		printf("maCaptureSetProperty(MA_CAPTURE_CAMERA_CONTROLS) = %d", syscallResult);
	}
}
Exemplo n.º 4
0
/**
 * This method is called when a list view item is clicked.
 * @param listView The list view object that generated the event.
 * @param listViewItem The ListViewItem object that was clicked.
 */
void VideoQualityScreen::listViewItemClicked(
    ListView* listView,
    ListViewItem* listViewItem)
{
	if ( mListView == listView )
	{
		mQualityHighListItem->setBackgroundColor(UNSELECTED_QUALITY_COLOR);
		if ( isIOS() )
		{
			mQualityMediumListItem->setBackgroundColor(UNSELECTED_QUALITY_COLOR);
		}
		mQualityLowListItem->setBackgroundColor(UNSELECTED_QUALITY_COLOR);
		int selectedQuality;

		if (listViewItem == mQualityLowListItem)
		{
			selectedQuality = MA_CAPTURE_VIDEO_QUALITY_LOW;
			mQualityLowListItem->setBackgroundColor(SELECTED_QUALITY_COLOR);
		}
		else if (listViewItem == mQualityHighListItem)
		{
			selectedQuality = MA_CAPTURE_VIDEO_QUALITY_HIGH;
			mQualityHighListItem->setBackgroundColor(SELECTED_QUALITY_COLOR);
		}
		else if (listViewItem == mQualityMediumListItem)
		{
			selectedQuality = MA_CAPTURE_VIDEO_QUALITY_MEDIUM;
			mQualityMediumListItem->setBackgroundColor(SELECTED_QUALITY_COLOR);
		}

		// Set the selected video quality.
		String value = MAUtil::integerToString(selectedQuality);
		int syscallResult = maCaptureSetProperty(
			MA_CAPTURE_VIDEO_QUALITY,
			value.c_str());
		printf("maCaptureSetProperty(MA_CAPTURE_VIDEO_QUALITY) - %d", syscallResult);
	}
}
Exemplo n.º 5
0
	/**
	 * Implementation of capture API:s exposed to JavaScript.
	 * @return true if message was handled, false if not.
	 */
	void PhoneGapCapture::handleMessage(JSONMessage& message)
	{
		if(message.getParam("action") == "captureVideo")
		{
			int duration = message.getArgsFieldInt("duration");
			if(duration > 0)
			{
				char durationString[16];
				maCaptureSetProperty(MA_CAPTURE_MAX_DURATION, itoa(duration,durationString,10));
			}

			mCaptureCallBack = message.getParam("PhoneGapCallBackId");

			int result = maCaptureAction(MA_CAPTURE_ACTION_RECORD_VIDEO);

			if(result == MA_CAPTURE_RES_CAMERA_NOT_AVAILABLE)
			{
				//Camera was busy by another app
				mMessageHandler->callError(
					mCaptureCallBack,
					PHONEGAP_CALLBACK_STATUS_ERROR,
					"{\"code\":\"CAPTURE_APPLICATION_BUSY\"}",
					false);
			}
			else if(result == MA_CAPTURE_RES_VIDEO_NOT_SUPPORTED)
			{
				//No camera
				mMessageHandler->callError(
					mCaptureCallBack,
					PHONEGAP_CALLBACK_STATUS_ERROR,
					"{\"code\":\"CAPTURE_NOT_SUPPORTED\"}",
					false);
			}
		}
		else if(message.getParam("action") == "captureImage")
		{
			mCaptureCallBack = message.getParam("PhoneGapCallBackId");

			int result = maCaptureAction(MA_CAPTURE_ACTION_TAKE_PICTURE);

			if(result == MA_CAPTURE_RES_CAMERA_NOT_AVAILABLE)
			{
				//Camera was busy by another app
				mMessageHandler->callError(
					mCaptureCallBack,
					PHONEGAP_CALLBACK_STATUS_ERROR,
					"{\"code\":\"CAPTURE_APPLICATION_BUSY\"}",
					false);
			}
			if(result == MA_CAPTURE_RES_PICTURE_NOT_SUPPORTED)
			{
				//No camera
				mMessageHandler->callError(
					mCaptureCallBack,
					PHONEGAP_CALLBACK_STATUS_ERROR,
					"{\"code\":\"CAPTURE_NOT_SUPPORTED\"}",
					false);
			}
		}
		else if(message.getParam("action") == "captureAudio")
		{
			//MoSync does not support audio capture
			mMessageHandler->callError(
				mCaptureCallBack,
				PHONEGAP_CALLBACK_STATUS_ERROR,
				"{\"code\":\"CAPTURE_NOT_SUPPORTED\"}",
				false);
		}
	}