Example #1
0
void
FSettings::OnActionPerformed(const Osp::Ui::Control& source, int actionId)
{
	if (actionId == ASAVE) {
		int tmpval;
		int setlimit = 0;
		int setday = 1;
		Osp::Ui::Controls::EditField * tmpef;
		tmpef = static_cast<Osp::Ui::Controls::EditField *>(this->GetControl(L"limitel", true));
		if (Osp::Base::Integer::Parse(tmpef->GetText(), setlimit) != E_SUCCESS) {
			setlimit = 0;
		}
		if (Application::GetInstance()->GetAppRegistry()->Get(L"limit", tmpval) == E_KEY_NOT_FOUND) {
			Application::GetInstance()->GetAppRegistry()->Add(L"limit", setlimit);
		} else {
			Application::GetInstance()->GetAppRegistry()->Set(L"limit", setlimit);
		}
		tmpef = static_cast<Osp::Ui::Controls::EditField *>(this->GetControl(L"dayel", true));
		if (Osp::Base::Integer::Parse(tmpef->GetText(), setday) != E_SUCCESS) {
			setday = 1;
		}
		if (Application::GetInstance()->GetAppRegistry()->Get(L"day", tmpval) == E_KEY_NOT_FOUND) {
			Application::GetInstance()->GetAppRegistry()->Add(L"day", setday);
		} else {
			Application::GetInstance()->GetAppRegistry()->Set(L"day", setday);
		}
		Application::GetInstance()->GetAppRegistry()->Save();
		Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
		FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
		pFormMgr->TransitionDirection = pFormMgr->TRANSITIONRIGHT;
		pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
	} else if (actionId == ACANCEL) {
		Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
		FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
		pFormMgr->TransitionDirection = pFormMgr->TRANSITIONLEFT;
		pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
	}

	DateTime today, nextrundate;

	Osp::System::SystemTime::GetCurrentTime(Osp::System::WALL_TIME, today);
	int dayinm = 1;
	if (Application::GetInstance()->GetAppRegistry()->Get(L"day", dayinm) != E_SUCCESS) {
		dayinm = 1;
	}
	nextrundate.SetValue(today.GetYear(),today.GetMonth(),dayinm,0,0,0);
	if (today.GetDay() >= dayinm) {
		nextrundate.AddMonths(1);
	}

	AppManager * appmgr = Osp::App::AppManager::GetInstance();
	if (appmgr->IsAppLaunchRegistered() == true) {
		appmgr->UnregisterAppLaunch();
	}
	appmgr->RegisterAppLaunch(L"DateTime='" + nextrundate.ToString() + "'", null, AppManager::LAUNCH_OPTION_DEFAULT);

	AppLog("set next run %S", nextrundate.ToString().GetPointer());

}
Example #2
0
void
CropForm::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId,
		const Tizen::Base::String& operationId,
		const Tizen::App::AppCtrlResult appControlResult,
		const Tizen::Base::Collection::IMap* pResultList)
{
	if (appId.Equals(L"tizen.filemanager", true) && operationId.Equals(L"http://tizen.org/appcontrol/operation/pick", true))
	{
		AppCtrlResult selectResult = appControlResult;
		if (selectResult == APP_CTRL_RESULT_SUCCEEDED)
		{
			//Get the file name
			result r ;
			String filename;
			String* pFilePath ;
			pFilePath = (String*)(Tizen::Base::String*)pResultList->GetValue(String(L"path"));
			LoadImage(pFilePath);
		}
		else
		{
			result r;
			Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
			Form *pForm = (Form*)pFrame->GetControl(MAIN_FORM_NAME, false);
			if(pForm)
			{
				r = pFrame->SetCurrentForm(*pForm);
				pForm->Draw();
				pForm->Show();
				pFrame->RemoveControl(*this);
			}
		}
	}
}
Example #3
0
void
InfoForm::OnFormBackRequested(Osp::Ui::Controls::Form& form)
{
	Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
	FormManager *pFormMgr = static_cast<FormManager *>(pFrame->GetControl("FormManager"));
	if (pFormMgr != null) {
		pFormMgr->SendUserEvent(FormManager::REQUEST_ITEMLIST, null);
	}
}
Example #4
0
void
CategoryItemForm::OnFormBackRequested(Osp::Ui::Controls::Form& form)
{
	__pFooter->SetBackButtonEnabled(false);
	Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
	FormManager *pFormMgr = static_cast<FormManager *>(pFrame->GetControl("FormManager"));
	if (pFormMgr != null) {
		pFormMgr->SendUserEvent(FormManager::REQUEST_CATEGORYLISTBACK, null);
	}
}
void
FSettingsForm::OnActionPerformed(const Control& source, int actionId)
{
	if (actionId == ABACK) {
		Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
		FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
		pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
	}
	if (actionId == ASAVE) {
		Osp::Ui::Controls::CheckButton * chkel;
		chkel = static_cast<CheckButton *>(GetControl(L"IDPC_CHECKBUTTON1", true));
		flashenable = chkel->IsSelected();
		chkel = static_cast<CheckButton *>(GetControl(L"IDPC_CHECKBUTTON2", true));
		shuttersound = chkel->IsSelected();
		SaveSettings(isolevel, exposure, brightness, contrast, flashenable, shuttersound);
		Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
		FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
		pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
	}
}
Example #6
0
void
CategoryItemForm::OnActionPerformed(const Osp::Ui::Control& source, int actionId)
{
	ItemListForm::OnActionPerformed(source, actionId);

	if(actionId == SOFTKEY_BACK) {
		Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
		FormManager *pFormMgr = static_cast<FormManager *>(pFrame->GetControl("FormManager"));
		if (pFormMgr != null) {
			pFormMgr->SendUserEvent(FormManager::REQUEST_CATEGORYLISTBACK, null);
		}
	}

	if(actionId == SOFTKEY_INFO) {
			Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
			FormManager *pFormMgr = static_cast<FormManager *>(pFrame->GetControl("FormManager"));
			if (pFormMgr != null) {
				pFormMgr->SendUserEvent(FormManager::REQUEST_INFO, null);
			}
		}
}
Example #7
0
void
CropForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
{
	if(actionId == ID_FOOTERITEMCROP)
	{

		__Croprectangle.x = __x_min ;
		__Croprectangle.y = __y_min ;
		__Croprectangle.width = __x_max - __x_min;
		__Croprectangle.height = __y_max - __y_min;

		if ((__Croprectangle.width <= 0) || (__Croprectangle.height <= 0))
		{
			MessageBox messageBox;
			messageBox.Construct(L"Noting to crop", L"Please select region using finger to crop.", MSGBOX_STYLE_OK, 3000);
			int modalResult = 0;
			messageBox.ShowAndWait(modalResult);
			return;
		}

		Bitmap *pBitmapCroped = new Bitmap();
		pBitmapCroped->Construct(*__pBitmapOriginal,__Croprectangle);
		Image img;
		result r = img.Construct();

		if(!IsFailed(r))
		{
			img.EncodeToFile(*pBitmapCroped, IMG_FORMAT_JPG, USER_CROPPED_FILE_PATH, true);

			AppLogDebug("Save_location : %S", USER_CROPPED_FILE_PATH.GetPointer());

			Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
			Form *pForm = (Form*)pFrame->GetControl(MAIN_FORM_NAME, false);
			if(pForm)
			{
				pFrame->SetCurrentForm(*pForm);
				pForm->SendUserEvent(CROPPING_COMPLETE, null);
				pForm->Draw();
				pForm->Show();
				pFrame->RemoveControl(*this);
			}
		}

		delete pBitmapCroped;
	}
}
Example #8
0
void
CropForm::OnFormBackRequested (Tizen::Ui::Controls::Form &source)
{

	Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
	Form *pForm = (Form*)pFrame->GetControl(MAIN_FORM_NAME, false);
	if(pForm)
	{
		pFrame->SetCurrentForm(*pForm);
		pForm->Draw();
		pForm->Show();
		pFrame->RemoveControl(*this);
	}


/*	SceneManager* pSceneManager = SceneManager::GetInstance();
	AppAssert(pSceneManager);
	pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_DEPTH_OUT));*/
}
void ItemForm::OnFormBackRequested(Osp::Ui::Controls::Form & source) {
	AppLog("OnFormBackRequested()");
	Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();

	MainForm * pForm = static_cast<MainForm*> (pFrame->GetControl(kMainFormNameString));
/*
    pFrame->SetCurrentForm(*pForm);
    pForm->Draw();
    pForm->Show();
*/

	FrameAnimator * pAnimator = pFrame->GetFrameAnimator();
	pAnimator->SetFormTransitionAnimation(FRAME_ANIMATOR_FORM_TRANSITION_ANIMATION_TRANSLATE_RIGHT,
			                              800,
			                              ANIMATION_INTERPOLATOR_EASE_IN_OUT);

	pAnimator->SetCurrentForm(*pForm);

}
Example #10
0
void
UserProfileForm::OnActionPerformed(const Control& source, int actionId)
{
	Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
	FormManager *pFormManager = static_cast<FormManager *>(pFrame->GetControl(L"FormManager"));
	switch (actionId)
	{
	case ID_BUTTON_FRIENDS_CLICKED:

		if (pFormManager == null)
			return;
		pFormManager->SendUserEvent(FormManager::REQUEST_FRIENDSFORM, null);
		break;

	case ID_BUTTON_LOGOUT_CLICKED:

		if (pFormManager == null)
			return;
		pFormManager->SendUserEvent(FormManager::REQUEST_MAINFORM, null);
		break;
	}
}
Example #11
0
void
FCarAddEdit::OnActionPerformed(const Control& source, int actionId)
{
	Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
	if (actionId == ID_CANCEL){
		bool issaved = false;
		if (!this->detailmode) {
		if (CheckIfDataChanged()) {
			MessageBox msgbox;
			int modalResult = 0;
			msgbox.Construct("Confirm cancel", "Car data changed. Save data?", MSGBOX_STYLE_YESNO, 10000);
			msgbox.ShowAndWait(modalResult);
			if (modalResult == MSGBOX_RESULT_YES) {
				if (Save() == false) {
					return;
				} else {
					issaved = true;
				}
			}
		}
		}
		if (this->formtype == 2) {
			FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
			if (issaved) {
				carconclass_->SetLastSelectedID(this->itemid);
				FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
				pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
			} else {
				ArrayList * list = new ArrayList;
				list->Construct();
				list->Add(*(new Integer(2)));
				pFormMgr->SendUserEvent(FormMgr::REQUEST_SETTINGSFORM, list);
			}
		} else {
		if ((!this->detailform) || (this->detailmode)) {
			FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
			ArrayList * list = new ArrayList;
			list->Construct();
			list->Add(*(new Integer(this->itemid)));
			pFormMgr->SendUserEvent(FormMgr::REQUEST_CARSELECTFORM, list);
		} else {
			OnActionPerformed(source, ID_DETAIL);
		}
		}
	} else if (actionId == ID_SAVE) {
		if (Save() == false) {
			return;
		}
		if (this->formtype == 2) {
		carconclass_->SetLastSelectedID(this->itemid);
		FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
		pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
		} else {
		if (!this->detailform) {
			FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
			ArrayList * list = new ArrayList;
			list->Construct();
			list->Add(*(new Integer(this->itemid)));
			pFormMgr->SendUserEvent(FormMgr::REQUEST_CARSELECTFORM, list);
		} else {
			OnActionPerformed(source, ID_DETAIL);
		}
		}
	} else if (actionId == ID_SELECTFUELTYPEPOPUPOK) {
		fueltypesselectedarray_.RemoveAll();
		int checkeditemindex;
		int fueltypeid;
		checkeditemindex = pListSelectFuelTypes_->GetFirstCheckedItemIndex();
		while (checkeditemindex > -1) {
			fueltypeid = pListSelectFuelTypes_->GetItemIdAt(checkeditemindex);
			fueltypesselectedarray_.Add(fueltypeid);
			checkeditemindex = pListSelectFuelTypes_->GetNextCheckedItemIndexAfter(checkeditemindex);
		}
		controlhandler_->SetValue(this,L"CB_4_fueltypestring", GetFuelTypesString());
		pPopup_->SetShowState(false);
		this->SetFocus();
		RequestRedraw(true);
	} else if (actionId == ID_ADDNEWFUELTYPEPOPUPCANCEL) {
		pAddnewfueltypepopup_->SetShowState(false);
		this->SetFocus();
		RequestRedraw(true);
	} else if (actionId == ID_ADDNEWFUELTYPEPOPUPSAVE) {
		Osp::Ui::Controls::EditField *pAddnewfueltypepopupEditField_ = static_cast<EditField *>(pAddnewfueltypepopup_->GetControl(L"IDC_EDITFIELD1"));
		String tmps = pAddnewfueltypepopupEditField_->GetText();
		tmps.Trim();
		if (tmps == "") {
			MessageBox msgbox;
			int modalResult = 0;
			msgbox.Construct("Empty value!", "Input fuel type caption!", MSGBOX_STYLE_OK, 10000);
			msgbox.ShowAndWait(modalResult);
		} else {
			FuelTypeData fueltypedata_;
			fueltypedata_.Caption = tmps;
			fueltypedata_.ID = 0;
			carconclass_->SaveFuelTypeData(fueltypedata_);
			pListSelectFuelTypes_->AddItem(&fueltypedata_.Caption, null, null, null, fueltypedata_.ID);
			int selecteditemindex = pListSelectFuelTypes_->GetItemIndexFromItemId(fueltypedata_.ID);
			if (selecteditemindex > -1) {
				pListSelectFuelTypes_->SetItemChecked(selecteditemindex, true);
			}
			pListSelectFuelTypes_->ScrollToBottom();
			pAddnewfueltypepopup_->SetShowState(false);
			RequestRedraw(true);
		}
	} else if (actionId == ID_SELECTFUELTYPEPOPUPADD) {
		Osp::Ui::Controls::EditField *pAddnewfueltypepopupEditField_ = static_cast<EditField *>(pAddnewfueltypepopup_->GetControl(L"IDC_EDITFIELD1"));
		pAddnewfueltypepopupEditField_->SetText(L"");
		pAddnewfueltypepopup_->SetShowState(true);
		pAddnewfueltypepopup_->Show();
	} else if (actionId == ID_BUTTON_EDITFIELD_DONE) {
		int actiondone = controlhandler_->ActionDone(this, source);
		if ((actiondone == ControlHandler::ACTIONDONERESULT_HIDEKEYPAD) || (actiondone == ControlHandler::ACTIONDONERESULT_OPENCOMBOBOX)) {
			ScrollPanel * vpScrollPanel = static_cast<ScrollPanel *> (GetControl(L"IDC_SCROLLPANEL1"));
			vpScrollPanel->CloseOverlayWindow();
		}
		if (actiondone == ControlHandler::ACTIONDONERESULT_OPENCOMBOBOX) {
			pPopup_->SetShowState(true);
			pPopup_->Show();
		}
	} else if (actionId == ID_BUTTON_EDITFIELD_CLOSE) {
		ScrollPanel * vpScrollPanel = static_cast<ScrollPanel *> (GetControl(L"IDC_SCROLLPANEL1"));
		vpScrollPanel->CloseOverlayWindow();
	} else if ((actionId == ID_EDIT) || (actionId == ID_DETAIL)) {
		this->SetFocus();
		if (actionId == ID_DETAIL) {
			ReloadSavedData();
		}
		this->detailmode = (actionId == ID_DETAIL);
		DetailEditMode();
		RequestRedraw(true);
	}
}
Example #12
0
void FPlayer::OnActionPerformed(const Osp::Ui::Control& source, int actionId) {
	if (actionId == ABACK) {
		Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
		FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
		pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
	} else if (actionId == APLAYPAUSE) {
		HideControlsTimer_->Cancel();
		infobtn->SetShowState(pPlayerThread_->playing);
		deletebtn->SetShowState(pPlayerThread_->playing);
		exportbtn->SetShowState(pPlayerThread_->playing);
		//editbtn->SetShowState(pPlayerThread_->playing);
		nextframebtn->SetShowState(pPlayerThread_->playing);
		prevframebtn->SetShowState(pPlayerThread_->playing);
		speedbtn->SetShowState(pPlayerThread_->playing);
		if (pPlayerThread_->playing == true) {
			playpausebtn->SetNormalBackgroundBitmap(*playpausebtnbmpn_);
			playpausebtn->SetPressedBackgroundBitmap(*playpausebtnbmps_);
			controlsarevisible = true;
			backbtn->SetShowState(true);
			playpausebtn->SetShowState(true);
		} else {
			playpausebtn->SetNormalBackgroundBitmap(*playpausepausebtnbmpn_);
			playpausebtn->SetPressedBackgroundBitmap(*playpausepausebtnbmps_);
		}
		RedrawDisplayBuffer(displaybuffer_->GetBounds());
		this->RequestRedraw();
		if (pPlayerThread_->playing != true) {
			Osp::System::PowerManager::KeepScreenOnState(true, false);
			HideControlsTimer_->Start(2000);
		} else {
			Osp::System::PowerManager::KeepScreenOnState(false, true);
		}
		pPlayerThread_->SendUserEvent(pPlayerThread_->THREAD_PLAYPAUSE, null);
	} else if (actionId == APREVFRAME) {
		if (pPlayerThread_->playing != true) {
			pPlayerThread_->SendUserEvent(pPlayerThread_->THREAD_PREVFRAME, null);
		}
	} else if (actionId == ANEXTFRAME) {
		if (pPlayerThread_->playing != true) {
			pPlayerThread_->SendUserEvent(pPlayerThread_->THREAD_NEXTFRAME, null);
		}
	} else if (actionId == ADELETEVIDEO) {
		if (pPlayerThread_->playing != true) {
			MessageBox msgbox;
			int modalResult = 0;
			msgbox.Construct("Delete?", "Do you want to delete video?", MSGBOX_STYLE_YESNO, 0);
			msgbox.ShowAndWait(modalResult);
			if (modalResult == MSGBOX_RESULT_YES) {
				Osp::Base::String filename = pPlayerThread_->filename;
				pPlayerThread_->Stop();
				pPlayerThread_->Join();
				delete pPlayerThread_;
				pPlayerThread_ = null;
				if (Osp::Io::File::IsFileExist(filename)) {
					Osp::Io::File::Remove(filename);
				}
				Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
				FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
				pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
			}
		}
	} else if (actionId == ASHOWINFO) {
		if (pPlayerThread_->playing != true) {
			Osp::Base::String strvalue;

			Osp::Ui::Controls::Label * infopopuplresel_ = static_cast<Label *>(infopopup_->GetControl(L"LBLRES"));
			Osp::Ui::Controls::Label * infopopupstimeel_ = static_cast<Label *>(infopopup_->GetControl(L"LBLSTIME"));
			Osp::Ui::Controls::Label * infopopupetimeel_ = static_cast<Label *>(infopopup_->GetControl(L"LBLETIME"));
			Osp::Ui::Controls::Label * infopopupframesel_ = static_cast<Label *>(infopopup_->GetControl(L"LBLFRAMES"));
			Osp::Ui::Controls::Label * infopopupfilesizeel_ = static_cast<Label *>(infopopup_->GetControl(L"LBLFILESIZE"));
			Osp::Ui::Controls::Label * infopopupftimeel_ = static_cast<Label *>(infopopup_->GetControl(L"LBLFTIME"));
			Osp::Ui::Controls::Label * infopopupframenel_ = static_cast<Label *>(infopopup_->GetControl(L"LBLFRAMEN"));
			Osp::Ui::Controls::Label * infopopupframesizeel_ = static_cast<Label *>(infopopup_->GetControl(L"LBLFRAMESIZE"));

			infopopuplresel_->SetText(Osp::Base::Integer::ToString(pPlayerThread_->resolution.width) + L"x" + Osp::Base::Integer::ToString(pPlayerThread_->resolution.height));
			infopopupstimeel_->SetText(pPlayerThread_->startframetime.ToString());
			infopopupetimeel_->SetText(pPlayerThread_->endframetime.ToString());
			infopopupframesel_->SetText(Osp::Base::Integer::ToString(pPlayerThread_->framescount));

			if (pPlayerThread_->filesize > 1048576) {
				strvalue = L"";
				strvalue.Format(25,L"%.2f",(double)(pPlayerThread_->filesize / 1048576.0f));
				strvalue.Append(L" Mb");
			} else {
				strvalue = L"";
				strvalue.Append((int)(pPlayerThread_->filesize / 1024));
				strvalue.Append(L" Kb");
			}
			infopopupfilesizeel_->SetText(strvalue);

			infopopupftimeel_->SetText(pPlayerThread_->curframedatetime.ToString());
			infopopupframenel_->SetText(Osp::Base::Integer::ToString(pPlayerThread_->curframe));

			if (pPlayerThread_->curframesize > 1048576) {
				strvalue = L"";
				strvalue.Format(25,L"%.2f",(double)(pPlayerThread_->curframesize / 1048576.0f));
				strvalue.Append(L" Mb");
			} else {
				strvalue = L"";
				strvalue.Append((int)(pPlayerThread_->curframesize / 1024));
				strvalue.Append(L" Kb");
			}
			infopopupframesizeel_->SetText(strvalue);

			infopopup_->SetShowState(true);
			infopopup_->Show();
		}
	} else if (actionId == ACLOSEINFO) {
		infopopup_->SetShowState(false);
		this->RequestRedraw();
	} else if (actionId == AEXPORT) {
		if (pPlayerThread_->playing != true) {
			if (exportfilenameset == false) {
				Osp::Ui::Controls::EditField * exportpopupfilenameel_ = static_cast<EditField *>(exportpopup_->GetControl(L"IDC_EDITFIELD1"));
				Osp::Base::String outfn;
				outfn = Osp::Io::File::GetFileName(pPlayerThread_->filename);
				outfn.Replace(L".tlv", L".avi");
				exportpopupfilenameel_->SetText(outfn);
				exportpopupfilenameel_->RequestRedraw();
				exportfilenameset = true;
			}
			exportpopup_->SetShowState(true);
			exportpopup_->Show();
		}
	} else if (actionId == AEXPORTTYPESWITCH) {
		Osp::Ui::Controls::EditField * exportpopupfilenameel_ = static_cast<EditField *>(exportpopup_->GetControl(L"IDC_EDITFIELD1"));
		Osp::Base::String outfn;
		outfn = Osp::Io::File::GetFileName(pPlayerThread_->filename);
		Osp::Ui::Controls::Button * exportpopupswitchbtn_ = static_cast<Button *>(exportpopup_->GetControl(L"IDC_BUTTON5"));
		Osp::Ui::Controls::Label * exportpopupswitchlabel_ = static_cast<Label *>(exportpopup_->GetControl(L"IDC_LABEL2"));
		if (exporttotype == EXPORTTYPE_VIDEO) {
			exporttotype = EXPORTTYPE_FRAME;
		} else if (exporttotype == EXPORTTYPE_FRAME) {
			exporttotype = EXPORTTYPE_VIDEO;
		}
		if (exporttotype == EXPORTTYPE_VIDEO) {
			exportpopupswitchlabel_->SetText(L"Video file");
			exportpopupswitchbtn_->SetText(L"Frame image");
			outfn.Replace(L".tlv", L".avi");
		} else if (exporttotype == EXPORTTYPE_FRAME) {
			exportpopupswitchlabel_->SetText(L"Frame image");
			exportpopupswitchbtn_->SetText(L"Video file");
			outfn.Replace(L".tlv", L".jpg");
		}
		exportpopupswitchlabel_->Draw();
		exportpopupswitchlabel_->Show();
		exportpopupswitchbtn_->Draw();
		exportpopupswitchbtn_->Show();
		exportpopupfilenameel_->SetText(outfn);
		exportpopupfilenameel_->RequestRedraw();
	} else if (actionId == AEDIT) {
		if (pPlayerThread_->playing != true) {
			//open edit form
		}
	} else if (actionId == AEXPORTCANCEL) {
		exportpopup_->SetShowState(false);
		this->RequestRedraw();
	} else if ((actionId == AEXPORTSAVE) || (actionId == AEXPORTSAVESD)) {
		String setfilename;
		Osp::Ui::Controls::EditField * exportpopupfilenameel_ = static_cast<EditField *>(exportpopup_->GetControl(L"IDC_EDITFIELD1"));
		setfilename = exportpopupfilenameel_->GetText();
		setfilename.Trim();
		if (setfilename == L"") {
			MessageBox msgbox;
			int modalResult = 0;
			msgbox.Construct("Invalid filename", "Please enter file name!", MSGBOX_STYLE_OK, 10000);
			msgbox.ShowAndWait(modalResult);
			return;
		}
		exportfilename = L"";
		if (actionId == AEXPORTSAVESD) {
			exportfilename = L"/Storagecard/Media/";
		} else {
			exportfilename = L"/Media/";
		}
		exporttempfilename = L"/Home/";
		if (exporttotype == EXPORTTYPE_VIDEO) {
			exportfilename.Append(L"Others/" + setfilename);
			exporttempfilename.Append(L"export.avi");
			if (Osp::Io::File::GetFileExtension(exportfilename) != L"avi") {
				exportfilename = exportfilename + L".avi";
				exportpopupfilenameel_->SetText(setfilename + L".avi");
				exportpopupfilenameel_->RequestRedraw();
			}
		} else if (exporttotype == EXPORTTYPE_FRAME) {
			exportfilename.Append(L"Images/" + setfilename);
			exporttempfilename.Append(L"export.jpg");
			if (Osp::Io::File::GetFileExtension(exportfilename) != L"jpg") {
				exportfilename = exportfilename + L".jpg";
				exportpopupfilenameel_->SetText(setfilename + L".jpg");
				exportpopupfilenameel_->RequestRedraw();
			}
		}
		if (Osp::Io::File::IsFileExist(exportfilename) == true) {
			MessageBox msgbox;
			int modalResult = 0;
			msgbox.Construct("File name exists", "File with that filename already exists!", MSGBOX_STYLE_OK, 10000);
			msgbox.ShowAndWait(modalResult);
			return;
		}
		if (exporttotype == EXPORTTYPE_VIDEO) {
			MessageBox msgbox;
			int modalResult = 0;
			msgbox.Construct("Notice", "Video file will not be playable on Wave phone's player, export only for playing on other media players (PC,Youtube,...).\nVideo will be exported in Others folder.", MSGBOX_STYLE_OKCANCEL, 60000);
			msgbox.ShowAndWait(modalResult);
			if (modalResult == MSGBOX_RESULT_CANCEL) {
				return;
			}
		}
		if (Osp::Io::File::IsFileExist(exporttempfilename)) {
			Osp::Io::File::Remove(exporttempfilename);
		}
		exportpopup_->SetShowState(false);
		this->RequestRedraw();

		savingpopup_->SetShowState(true);
		Osp::Ui::Controls::Progress * savingpopupprogressel_ = static_cast<Progress *>(savingpopup_->GetControl(L"IDC_PROGRESS1"));
		savingpopupprogressel_->SetValue(0);
		savingpopup_->Show();

		/*TimeLapseClass * TimeLapseClass_ = new TimeLapseClass();

		if (exporttotype == EXPORTTYPE_VIDEO) {
			TimeLapseClass_->ExportToMJPEGfile(pPlayerThread_->filename, tempfilename);
		} else if (exporttotype == EXPORTTYPE_FRAME) {
			TimeLapseClass_->ExportToJPEGframefile(pPlayerThread_->filename, pPlayerThread_->curframefilepos, tempfilename);
		}

		delete TimeLapseClass_;*/

		pExportThread_ = new FExportThread;
		pExportThread_->Construct();
		pExportThread_->filename = pPlayerThread_->filename;
		pExportThread_->filenameout = exporttempfilename;
		pExportThread_->framefilepos = pPlayerThread_->curframefilepos;
		pExportThread_->Start();
		ExportProgressRefTimer_->Start(500);

		if (exporttotype == EXPORTTYPE_VIDEO) {
			pExportThread_->SendUserEvent(pExportThread_->THREAD_EXPORTMJPEG, null);
		} else if (exporttotype == EXPORTTYPE_FRAME) {
			pExportThread_->SendUserEvent(pExportThread_->THREAD_EXPORTFRAME, null);
		}

	} else if (actionId == THREADCALLBACK_EXPORTPROGRESSUPDATE) {
		if (pExportThread_ != null) {
			double progress = ((double)pExportThread_->TimeLapseClass_->exportfileframecurno / (double)pExportThread_->TimeLapseClass_->exportfileframescount);
			if (progress > 1) progress = 1;
			if (progress < 1) {
				ExportProgressRefTimer_->Start(500);
			}
			int progressint = (int)(progress * 100.0f);
			if (progressint < 0) progressint = 0;
			if (progressint > 100) progressint = 100;
			Osp::Ui::Controls::Progress * savingpopupprogressel_ = static_cast<Progress *>(savingpopup_->GetControl(L"IDC_PROGRESS1"));
			savingpopupprogressel_->SetValue(progressint);
			savingpopupprogressel_->Draw();
			savingpopupprogressel_->Show();
		}
	} else if (actionId == THREADCALLBACK_EXPORTDONE) {
		ExportProgressRefTimer_->Cancel();
		Osp::Ui::Controls::Progress * savingpopupprogressel_ = static_cast<Progress *>(savingpopup_->GetControl(L"IDC_PROGRESS1"));
		savingpopupprogressel_->SetValue(100);
		savingpopupprogressel_->Draw();
		savingpopupprogressel_->Show();

		pExportThread_->Stop();
		pExportThread_->Join();
		delete pExportThread_;
		pExportThread_ = null;

		ContentId contentId;
		ContentManager contentManager;
		contentManager.Construct();
		if (Osp::Content::ContentManagerUtil::CopyToMediaDirectory(exporttempfilename, exportfilename) != E_SUCCESS) {
			savingpopup_->SetShowState(false);
			this->RequestRedraw();
			MessageBox msgbox;
			int modalResult = 0;
			msgbox.Construct("Error", "Error saving file! Maybe out of disk space.", MSGBOX_STYLE_OK, 10000);
			msgbox.ShowAndWait(modalResult);
			return;
		}
		if (Osp::Io::File::IsFileExist(exporttempfilename)) {
			Osp::Io::File::Remove(exporttempfilename);
		}

		if (exporttotype == EXPORTTYPE_VIDEO) {
			VideoContentInfo videoContentInfo;
			videoContentInfo.Construct(exportfilename);
			contentId = contentManager.CreateContent(videoContentInfo);
			videoContentInfo.SetAuthor(L"Timelapse");
			videoContentInfo.SetDescription(L"Timelapse app");
			videoContentInfo.SetKeyword(L"Timelapse");
			contentManager.UpdateContent(videoContentInfo);
		} else if (exporttotype == EXPORTTYPE_FRAME) {
			ImageContentInfo imageContentInfo;
			imageContentInfo.Construct(exportfilename);
			contentId = contentManager.CreateContent(imageContentInfo);
			imageContentInfo.SetAuthor(L"Timelapse");
			imageContentInfo.SetDescription(L"Timelapse app");
			imageContentInfo.SetKeyword(L"Timelapse");
			contentManager.UpdateContent(imageContentInfo);
		}
		savingpopup_->SetShowState(false);
		this->RequestRedraw();
		MessageBox msgbox;
		int modalResult = 0;
		msgbox.Construct("Saved", L"File saved to:\n" + exportfilename, MSGBOX_STYLE_OK, 10000);
		msgbox.ShowAndWait(modalResult);
	} else if (actionId == ASPEEDCHANGE) {
		if ((int)pPlayerThread_->fileinfo_.playframerate == 10) {
			pPlayerThread_->SetFrameRate(15);
		} else if ((int)pPlayerThread_->fileinfo_.playframerate == 15) {
			pPlayerThread_->SetFrameRate(20);
		} else if ((int)pPlayerThread_->fileinfo_.playframerate == 20) {
			pPlayerThread_->SetFrameRate(25);
		} else if ((int)pPlayerThread_->fileinfo_.playframerate == 25) {
			pPlayerThread_->SetFrameRate(30);
		} else {
			pPlayerThread_->SetFrameRate(10);
		}

		delete speedbtnbmpn_;
		delete speedbtnbmps_;
		speedbtnbmpn_ = CreateSpeedBtnBmp(164, Osp::Base::Integer::ToString((int)pPlayerThread_->fileinfo_.playframerate) + L" fps", false);
		speedbtnbmps_ = CreateSpeedBtnBmp(164, Osp::Base::Integer::ToString((int)pPlayerThread_->fileinfo_.playframerate) + L" fps", true);
		speedbtn->SetNormalBackgroundBitmap(*speedbtnbmpn_);
		speedbtn->SetPressedBackgroundBitmap(*speedbtnbmps_);
		this->RequestRedraw();

	}
}
Example #13
0
void
FTrip::OnActionPerformed(const Control& source, int actionId)
{
	Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
	if ((actionId == ID_EDIT) || (actionId == ID_DETAIL)) {
		if (this->selecteditemid > 0) {
			FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
			ArrayList * list = new ArrayList;
			list->Construct();
			list->Add(*(new Integer(this->selecteditemid)));
			if (actionId == ID_EDIT) {
				pFormMgr->SendUserEvent(FormMgr::REQUEST_TRIPADDEDIT, list);
			} else {
				pFormMgr->SendUserEvent(FormMgr::REQUEST_TRIPDETAIL, list);
			}
		} else {
			MessageBox msgbox;
			int modalResult = 0;
			msgbox.Construct("Record not selected!", "Please select record you want to edit.", MSGBOX_STYLE_OK, 10000);
			msgbox.ShowAndWait(modalResult);
		}
	} else if (actionId == ID_DELETE) {
		if (this->selecteditemid > 0) {
			MessageBox msgbox;
			int modalResult = 0;
			if (carconclass_->DeleteTripData(this->selecteditemid, true) == false) {
				msgbox.Construct("Can't delete trip!", "Trip is selected in reference table!", MSGBOX_STYLE_OK, 10000);
				msgbox.ShowAndWait(modalResult);
			} else {
				msgbox.Construct("Delete trip?", "Do you really want to delete trp?", MSGBOX_STYLE_YESNO, 10000);
				msgbox.ShowAndWait(modalResult);
				if (modalResult == MSGBOX_RESULT_YES) {
					Osp::Ui::Controls::Popup* pPopup_;
					pPopup_ = new Popup();
					Dimension dim(300, 50);
					pPopup_->Construct(true, dim);
					pPopup_->SetTitleText(L"Deleting please wait...");
					pPopup_->SetShowState(true);
					pPopup_->Show();
					carconclass_->DeleteTripData(this->selecteditemid);
					int selecteditemindex = pExList->GetItemIndexFromItemId(this->selecteditemid);
					if (selecteditemindex > -1) {
						pExList->RemoveItemAt(selecteditemindex);
					}
					this->selecteditemid = 0;
					pPopup_->SetShowState(false);
					delete pPopup_;
					RequestRedraw(true);
				}
			}
		} else {
			MessageBox msgbox;
			int modalResult = 0;
			msgbox.Construct("Record not selected!", "Please select record you want to delete.", MSGBOX_STYLE_OK, 10000);
			msgbox.ShowAndWait(modalResult);
		}
	} else if (actionId == ID_ADD) {
		FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
		pFormMgr->SendUserEvent(FormMgr::REQUEST_TRIPADDEDIT, null);
	} else if (actionId == ID_BACK) {
		FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
		pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
	} else if (actionId == ID_CLEARSEARCH) {
		SearchAction(L"");
	}
}
void
FPlaylistForm::OnActionPerformed(const Control& source, int actionId)
{
	if (actionId == APLAY) {
		FMainForm *pMainForm = static_cast<FMainForm *>(Application::GetInstance()->GetAppFrame()->GetFrame()->GetControl("FMainForm"));
		int playlistitemscount = 0;
		if (pMainForm->isstreaming) {
			playlistitemscount = pMainForm->playliststream->GetCount();
		} else {
			playlistitemscount = publicfunc_->playlist->GetCount();
		}
		if ((curselitemid > 0) && (curselitemid <= playlistitemscount)) {
			if (publicfunc_->sendingcommand == false) {
				//if (curplayingitemid != curselitemid) {
					PlayListItem * playlistitem_;
					if (pMainForm->isstreaming) {
						playlistitem_ = static_cast<PlayListItem *> (pMainForm->playliststream->GetAt(curselitemid-1));
						pMainForm->StreamingPlayListPlayItem(curselitemid-1);
					} else {
						playlistitem_ = static_cast<PlayListItem *> (publicfunc_->playlist->GetAt(curselitemid-1));
						publicfunc_->SendCommand(L"pl_play&id=" + Osp::Base::Integer::ToString(playlistitem_->id));
					}
					int listitemindex = -1;
					if (curplayingitemid >= 0) {
						PlayListItem * playlistitemold_;
						if (pMainForm->isstreaming) {
							playlistitemold_ = static_cast<PlayListItem *> (pMainForm->playliststream->GetAt(curplayingitemid-1));
						} else {
							playlistitemold_ = static_cast<PlayListItem *> (publicfunc_->playlist->GetAt(curplayingitemid-1));
						}
						listitemindex = UList_->GetItemIndexFromItemId(curplayingitemid);
						if (listitemindex >= 0) {
							CustomListItem* pItem = const_cast <CustomListItem*>(UList_->GetItemAt(listitemindex));
							pItem->SetElement(ID_LIST_ICON, L"");
							UList_->RefreshItem(listitemindex);
						}
					}
					listitemindex = UList_->GetItemIndexFromItemId(curselitemid);
					if (listitemindex >= 0) {
						CustomListItem* pItem = const_cast <CustomListItem*>(UList_->GetItemAt(listitemindex));
						pItem->SetElement(ID_LIST_ICON, *currenticon, currenticon);
						UList_->RefreshItem(listitemindex);
					}
					this->RequestRedraw();
					curplayingitemid = curselitemid;
				//}
			}
		}
	} else if (actionId == AREMOVE) {
		FMainForm *pMainForm = static_cast<FMainForm *>(Application::GetInstance()->GetAppFrame()->GetFrame()->GetControl("FMainForm"));
		int playlistitemscount = 0;
		if (pMainForm->isstreaming) {
			playlistitemscount = pMainForm->playliststream->GetCount();
		} else {
			playlistitemscount = publicfunc_->playlist->GetCount();
		}
		if ((curselitemid > 0) && (curselitemid <= playlistitemscount)) {
			if (publicfunc_->sendingcommand == false) {
				if (curplayingitemid == curselitemid) {
					curplayingitemid = -1;
				}
				PlayListItem * playlistitem_;
				if (pMainForm->isstreaming) {
					playlistitem_ = static_cast<PlayListItem *> (pMainForm->playliststream->GetAt(curselitemid-1));
					pMainForm->StreamingPlayListRemoveItem(curselitemid-1);

					UList_->RemoveAllItems();
					FillListItems();
				} else {
					playlistitem_ = static_cast<PlayListItem *> (publicfunc_->playlist->GetAt(curselitemid-1));
					publicfunc_->SendCommand(L"pl_delete&id=" + Osp::Base::Integer::ToString(playlistitem_->id));
					publicfunc_->playlist->RemoveAt(curselitemid-1,true);

					UList_->RemoveAllItems();
					FillListItems();

				}
			}
		}
	} else if (actionId == ACLEAR) {
		MessageBox msgbox;
		int modalResult = 0;
		msgbox.Construct("Clear playlist?", "Do you want to clear playlist?", MSGBOX_STYLE_YESNO, 0);
		msgbox.ShowAndWait(modalResult);
		if (modalResult == MSGBOX_RESULT_YES) {
			FMainForm *pMainForm = static_cast<FMainForm *>(Application::GetInstance()->GetAppFrame()->GetFrame()->GetControl("FMainForm"));
			if (pMainForm->isstreaming) {
				pMainForm->StreamingPlayListClear();
			}
			UList_->RemoveAllItems();
			publicfunc_->ClearPlayList();
			FillListItems();
		}
	} else if (actionId == AADD) {
		Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
		FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
		pFormMgr->SendUserEvent(FormMgr::REQUEST_BROWSEFORMADDTOPLAYLIST, null);
	} else if (actionId == ABACK) {
		Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
		FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
		pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
	}
}