std::vector<Osp::Base::String> ActionsManager::split(Osp::Base::String toBeSplitted, char separator)
{
	std::vector<Osp::Base::String> res;

	int length = toBeSplitted.GetLength();
	int cursor = 0;


	while(cursor<length)
	{
		Osp::Base::String subString;
		bool charFound = false;

		for(int i=cursor;i<length && !charFound; i++)
		{
			mchar charToAdd;
			toBeSplitted.GetCharAt(i,charToAdd);

			if(charToAdd == separator)
				charFound = true;
			else
				subString.Append(charToAdd);

			cursor++;

		}

		res.push_back(subString);
	}
	return res;
}
void
FormMgr::SwitchToForm(RequestId requestId, Osp::Base::Collection::IList* pArgs)
{
	Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
	if (requestId == REQUEST_MAINFORM) {
		FMainForm* pExeForm = new FMainForm();
		pExeForm->Initialize();
		pFrame->AddControl(*pExeForm);
		pFrame->SetCurrentForm(*pExeForm);
		pExeForm->Draw();
		pExeForm->Show();
		if (__pPreviousForm != null)
			pFrame->RemoveControl(*__pPreviousForm);
		__pPreviousForm = pExeForm;
	} else if (requestId == REQUEST_CAMERAFORM) {
		Integer * arg1 = static_cast<Integer*>(pArgs->GetAt(0));
		int sinterval = arg1->ToInt();
		Osp::Graphics::Dimension * arg2 = static_cast<Osp::Graphics::Dimension*>(pArgs->GetAt(1));
		Osp::Graphics::Dimension sresolution;
		sresolution.SetSize(arg2->width,arg2->height);
		Integer * arg3 = static_cast<Integer*>(pArgs->GetAt(2));
		int sstopafter = arg3->ToInt();
		FCameraForm* pExeForm = new FCameraForm();
		pExeForm->Initialize();
		pFrame->AddControl(*pExeForm);
		pFrame->SetCurrentForm(*pExeForm);
		pExeForm->Draw();
		pExeForm->Show();
		pExeForm->StartCamera(sinterval, sresolution, sstopafter);
		if (__pPreviousForm != null)
			pFrame->RemoveControl(*__pPreviousForm);
		__pPreviousForm = pExeForm;
	} else if (requestId == REQUEST_PLAYERFORM) {
		Osp::Base::String filename = L"";
		bool autoplay = false;
		Osp::Base::String * arg1 = static_cast<Osp::Base::String*>(pArgs->GetAt(0));
		if (pArgs->GetCount() >= 2) {
			Osp::Base::Boolean * arg2 = static_cast<Osp::Base::Boolean*>(pArgs->GetAt(1));
			autoplay = arg2->ToBool();
		}
		filename.Append(*arg1);
		FPlayer* pExeForm = new FPlayer();
		pExeForm->Initialize();
		pFrame->AddControl(*pExeForm);
		pFrame->SetCurrentForm(*pExeForm);
		pExeForm->Draw();
		pExeForm->Show();
		pExeForm->LoadFile(filename, autoplay);
		if (__pPreviousForm != null)
			pFrame->RemoveControl(*__pPreviousForm);
		__pPreviousForm = pExeForm;
	}
}
Exemple #3
0
void
ShareMenu::OnAppControlCompleted(const Osp::Base::String& appControlId, const Osp::Base::String& operationId, const Osp::Base::Collection::IList* pResultList)
{
	Osp::Base::String* pBTResult = null;
	if(appControlId.Equals(APPCONTROL_PROVIDER_BLUETOOTH)
			&& operationId.Equals(APPCONTROL_OPERATION_PICK))
	{
		pBTResult = (Osp::Base::String*)pResultList->GetAt(0);
		if(pBTResult->Equals(String(APPCONTROL_RESULT_SUCCEEDED)))
		{
			BluetoothDevice* pBTDevice = BluetoothDevice::GetInstanceFromAppControlResultN(*pResultList);

			if(pBTDevice)
			{

				if(!__pBTOppClient)
					__pBTOppClient = new BluetoothOppClient();

				result res = E_SUCCESS;
				String filePath(__shareContent);

				if(__isLink == true)
				{

					filePath = L"/Home/";
					filePath.Append(Application::GetInstance()->GetAppName());
					filePath.Append(".txt");

					File tempFile;
					tempFile.Construct(filePath, L"w+", true);
					tempFile.Write(__shareContent);

				}

				__pBTOppClient->Construct(*this);
				res = __pBTOppClient->PushFile(*pBTDevice, filePath);
				if(res != E_SUCCESS)
				{
					AppLog("PushFile FAILED");
				}
			}
			else
			{
				AppLog("No Device from BT AppControl");
			}
		}
		else if(pBTResult->Equals(String(APPCONTROL_RESULT_FAILED)))
		{
			AppLog("Bluetooth list failed.");
		}
	}
}
void FPlaylistForm::FillListItems() {
	curplayingitemid = -1;
	int curplayingitemindex = -1;
	UList_->SetTextOfEmptyList(L"Empty playlist");
	Osp::Base::Collection::IEnumerator * pEnum;
	FMainForm *pMainForm = static_cast<FMainForm *>(Application::GetInstance()->GetAppFrame()->GetFrame()->GetControl("FMainForm"));
	if (pMainForm->isstreaming) {
		pEnum = pMainForm->playliststream->GetEnumeratorN();
	} else {
		pEnum = publicfunc_->playlist->GetEnumeratorN();
	}
	PlayListItem * playlistitem_ = null;
	int listitemindex = 1;
	while (pEnum->MoveNext() == E_SUCCESS) {
		playlistitem_ = static_cast<PlayListItem *> (pEnum->GetCurrent());
		if (pMainForm->isstreaming) {
			playlistitem_->iscurrent = (pMainForm->streamingcurrentitemindex == (listitemindex-1));
		}
		Osp::Base::String artist = playlistitem_->artist;
		Osp::Base::String title = playlistitem_->title;
		artist.Trim();
		title.Trim();
		if ((title == L"") && (artist == L"")) {
			title = publicfunc_->GetTitleFromUri(playlistitem_->uri);
			artist = "Unknown artist - without metadata";
		}
		if (artist == L"") {
			artist = L"Unknown artist";
		}
		if (title == L"") {
			title = L"Unknown title";
		}
		if (playlistitem_->iscurrent) {
			AddListItem(listitemindex, artist, title, currenticon);
			curplayingitemid = listitemindex;
			curplayingitemindex = listitemindex-1;
		} else {
			AddListItem(listitemindex, artist, title, null);
		}
		listitemindex++;
	}
	delete pEnum;
	if (curplayingitemindex > 1) {
		UList_->ScrollToTop(curplayingitemindex-1);
	} else {
		UList_->ScrollToTop();
	}
	this->RequestRedraw();
}
void FStroski::SearchAction(Osp::Base::String searchqstr) {
    if (searchqstr != this->searchq) {
        if ((searchqstr.GetLength() < 2) && (searchqstr != "")) {
            MessageBox msgbox;
            int modalResult = 0;
            msgbox.Construct("Search", "For search you need to input at least 2 characters!", MSGBOX_STYLE_OK, 10000);
            msgbox.ShowAndWait(modalResult);
        } else {
            this->searchq = searchqstr;
            if (this->searchq.GetLength() > 0)
                this->searchq.Replace("\n"," ");
            pExList->RemoveAllItems();
            CarExpenseData data_;
            int searchwfoundi1(-1),searchwfoundi2(-1);
            Osp::Base::String lowercasedsearchq, lowercased1, lowercased2, tmps;
            bool isresult;
            this->searchq.ToLower(lowercasedsearchq);
            if (carconclass_->GetExpenseDataListStart(carconclass_->SelectedCar.ID)) {
                while (carconclass_->GetExpenseDataListGetData(data_)) {
                    if (this->searchq.GetLength() > 0) {
                        lowercased1 = L"";
                        lowercased2 = L"";
                        data_.Caption.ToLower(lowercased1);
                        data_.Remark.ToLower(lowercased2);
                        if (lowercased1 == L"") lowercased1.Append(L" ");
                        if (lowercased2 == L"") lowercased2.Append(L" ");
                        if ((lowercased1.IndexOf(lowercasedsearchq,0,searchwfoundi1) == E_SUCCESS) || (lowercased2.IndexOf(lowercasedsearchq,0,searchwfoundi2) == E_SUCCESS)) {
                            isresult = true;
                            if (searchwfoundi1 > 0) {
                                tmps = L"";
                                lowercased1.SubString(searchwfoundi1-1,1,tmps);
                                isresult = (tmps == " ");
                            }
                            if (searchwfoundi2 > 0) {
                                tmps = L"";
                                lowercased2.SubString(searchwfoundi2-1,1,tmps);
                                isresult = (tmps == " ");
                            }
                            if (isresult)
                                AddListItemSearch(data_.Caption, controlhandler_->DateFormater(data_.time, true), controlhandler_->CurrencyFormater(data_.Price), data_.Remark, data_.ID, searchwfoundi1, searchwfoundi2);
                        }
                    } else {
                        AddListItem(data_.Caption, controlhandler_->DateFormater(data_.time, true), controlhandler_->CurrencyFormater(data_.Price), data_.ID);
                    }
                }
                carconclass_->GetExpenseDataListEnd();
            }
            pExList->RequestRedraw();
            if (this->searchq.GetLength() > 0) {
                SetSoftkeyActionId(SOFTKEY_1, ID_CLEARSEARCH);
                pExList->SetTextOfEmptyList(L"No search result");
            } else {
                SetSoftkeyActionId(SOFTKEY_1, ID_BACK);
                pExList->SetTextOfEmptyList(L"No items in list.");
            }
            this->RequestRedraw(true);
        }
    }
}
Exemple #6
0
bool
WebForm::OnLoadingRequested (const Osp::Base::String& url, WebNavigationType type) {
	AppLogDebug("URL REQUESTED %S", url.GetPointer());
	if(url.StartsWith("gap://", 0)) {
//		__cordovaCommand = null;

		__cordovaCommand = new String(url);
		//	FIXME: for some reason this does not work if we return true. Web freezes.
//		__pWeb->StopLoading();
//		String* test;
//		test = __pWeb->EvaluateJavascriptN(L"'test'");
//		AppLogDebug("String is %S", test->GetPointer());
//		delete test;
//		return true;
		return false;
	} else if(url.StartsWith("http://", 0) || url.StartsWith("https://", 0)) {
		AppLogDebug("Non Cordova command. External URL. Launching WebBrowser");
		LaunchBrowser(url);
		return false;
	}

	return false;
}
void SimpleCache::BuildPathForCacheDirectory(Osp::Base::String &dirPath) {
	dirPath = L"/Home";
	dirPath.Append("/");
	dirPath.Append(_cacheName);
}
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();

	}
}
Exemple #9
0
 result DrawElement(const Osp::Graphics::Canvas& canvas, const Osp::Graphics::Rectangle& rect, CustomListItemStatus itemStatus)
 {
     result r = E_SUCCESS;

     Canvas* pCanvas = const_cast<Canvas*>(&canvas);

     pCanvas->SetLineWidth(1);
     if (itemStatus == CUSTOM_LIST_ITEM_STATUS_SELECTED) {
    	 pCanvas->FillRectangle(Color(4,58,99), rect);
     }
     pCanvas->SetForegroundColor(Color::COLOR_WHITE);

     Font fontcol1;
     fontcol1.Construct(Osp::Graphics::FONT_STYLE_PLAIN, 36);
     Font fontcol2;
     fontcol2.Construct(Osp::Graphics::FONT_STYLE_PLAIN, 28);
     Font fontcol3;
     fontcol3.Construct(Osp::Graphics::FONT_STYLE_PLAIN, 36);
     Font fontcol4;
     fontcol4.Construct(Osp::Graphics::FONT_STYLE_PLAIN, 28);

     EnrichedText texteelcol1;
     texteelcol1.Construct(Dimension(280, 50));
     texteelcol1.SetHorizontalAlignment(Osp::Graphics::TEXT_ALIGNMENT_LEFT);
     texteelcol1.SetVerticalAlignment(Osp::Graphics::TEXT_ALIGNMENT_TOP);
     texteelcol1.SetTextAbbreviationEnabled(true);
     if ((searchq.GetLength() > 0) && (col1s.GetLength() > 0)) {
     TextElement * textelcol1b = new TextElement();
     textelcol1b->Construct(L" ");
     if (col1b.GetLength() > 0) {
     textelcol1b->SetText(col1b);
     textelcol1b->SetTextColor(Color::COLOR_WHITE);
     textelcol1b->SetFont(fontcol1);
     texteelcol1.Add(*textelcol1b);
     }
     TextElement * textelcol1s = new TextElement();
     textelcol1s->Construct(col1s);
     textelcol1s->SetTextColor(Color(237,255,0));
     textelcol1s->SetFont(fontcol1);
     texteelcol1.Add(*textelcol1s);
     TextElement * textelcol1a = new TextElement();
     textelcol1a->Construct(L" ");
     if (col1a.GetLength() > 0) {
     textelcol1a->SetText(col1a);
     textelcol1a->SetTextColor(Color::COLOR_WHITE);
     textelcol1a->SetFont(fontcol1);
     texteelcol1.Add(*textelcol1a);
     }
     pCanvas->DrawText(Point(20,15), texteelcol1);
     delete textelcol1b;
     delete textelcol1s;
     delete textelcol1a;
     } else {
     TextElement textelcol1;
     textelcol1.Construct(col1);
     textelcol1.SetTextColor(Color::COLOR_WHITE);
     textelcol1.SetFont(fontcol1);
     texteelcol1.Add(textelcol1);
     pCanvas->DrawText(Point(20,15), texteelcol1);
     }

	 EnrichedText texteelcol2;
     texteelcol2.Construct(Dimension(280, 40));
     texteelcol2.SetHorizontalAlignment(Osp::Graphics::TEXT_ALIGNMENT_LEFT);
     texteelcol2.SetVerticalAlignment(Osp::Graphics::TEXT_ALIGNMENT_TOP);
     texteelcol2.SetTextAbbreviationEnabled(true);
     TextElement textelcol2;
     textelcol2.Construct(col2);
     if (itemStatus == CUSTOM_LIST_ITEM_STATUS_SELECTED) {
     textelcol2.SetTextColor(Color::COLOR_WHITE);
     } else {
     textelcol2.SetTextColor(Color(10, 73, 136));
     }
     textelcol2.SetFont(fontcol2);
     texteelcol2.Add(textelcol2);
     if ((searchq.GetLength() > 0) && (col4.GetLength() > 0)) {
    	 pCanvas->DrawText(Point(20,53), texteelcol2);
     } else {
    	 pCanvas->DrawText(Point(20,60), texteelcol2);
     }

     EnrichedText texteelcol3;
     texteelcol3.Construct(Dimension(160, 70));
     texteelcol3.SetHorizontalAlignment(Osp::Graphics::TEXT_ALIGNMENT_RIGHT);
     texteelcol3.SetVerticalAlignment(Osp::Graphics::TEXT_ALIGNMENT_MIDDLE);
     TextElement textelcol3;
     textelcol3.Construct(col3);
     textelcol3.SetTextColor(Color::COLOR_WHITE);
     textelcol3.SetFont(fontcol3);
     texteelcol3.Add(textelcol3);
	 pCanvas->DrawText(Point(300,15), texteelcol3);

	 if ((searchq.GetLength() > 0) && (col4.GetLength() > 0)) {
	 EnrichedText texteelcol4;
     texteelcol4.Construct(Dimension(430, 60));
     texteelcol4.SetHorizontalAlignment(Osp::Graphics::TEXT_ALIGNMENT_LEFT);
     texteelcol4.SetVerticalAlignment(Osp::Graphics::TEXT_ALIGNMENT_TOP);
     texteelcol4.SetTextAbbreviationEnabled(true);
     texteelcol4.SetTextWrapStyle(TEXT_WRAP_WORD_WRAP);
     if ((searchq.GetLength() > 0) && (col4s.GetLength() > 0)) {
     TextElement * textelcol4b = new TextElement();
     textelcol4b->Construct(L" ");
     if (col4b.GetLength() > 0) {
     textelcol4b->SetText(col4b);
     textelcol4b->SetTextColor(Color(220, 220, 220));
     textelcol4b->SetFont(fontcol4);
     texteelcol4.Add(*textelcol4b);
     }
     TextElement * textelcol4s = new TextElement();
     textelcol4s->Construct(col4s);
     textelcol4s->SetTextColor(Color(237,255,0));
     textelcol4s->SetFont(fontcol4);
     texteelcol4.Add(*textelcol4s);
     TextElement * textelcol4a = new TextElement();
     textelcol4a->Construct(L" ");
     if (col4a.GetLength() > 0) {
     textelcol4a->SetText(col4a);
     textelcol4a->SetTextColor(Color(220, 220, 220));
     textelcol4a->SetFont(fontcol4);
     texteelcol4.Add(*textelcol4a);
     }
     pCanvas->DrawText(Point(20,85), texteelcol4);
     delete textelcol4b;
     delete textelcol4s;
     delete textelcol4a;
     } else {
     TextElement textelcol4;
     textelcol4.Construct(col4);
     textelcol4.SetTextColor(Color(220, 220, 220));
     textelcol4.SetFont(fontcol4);
     texteelcol4.Add(textelcol4);
	 pCanvas->DrawText(Point(20,85), texteelcol4);
     }
	 }

     pCanvas->DrawLine(Point(rect.x, rect.height - 1), Point(rect.width, rect.height - 1));
     return r;
 }