// Creates an instance of Popup
__pPopup = new Tizen::Ui::Controls::Popup();
__pPopup->Construct(true, Tizen::Graphics::Dimension(570, 250));
- __pPopup->SetTitleText(L"Exit application?");
-
- // Creates an instance of Button to close the popup.
- Button* pYesButton = new Button();
- pYesButton->Construct(Tizen::Graphics::Rectangle(10, 50, 250, 80), L"Yes");
- pYesButton->SetActionId(ID_BUTTON_YES);
- pYesButton->AddActionEventListener(*this);
-
- Button* pNoButton = new Button();
- pNoButton->Construct(Tizen::Graphics::Rectangle(270, 50, 250, 80), L"No");
- pNoButton->SetActionId(ID_BUTTON_NO);
- pNoButton->AddActionEventListener(*this);
-
- // Adds the button to the popup
- __pPopup->AddControl(*pYesButton);
- __pPopup->AddControl(*pNoButton);
__pPanel = new PanelButton();
__pPanel->Initialize(this);
__pForm->Initialize();
__pForm->AddControl(*__pPanel);
pAppFrame->AddControl(*__pForm);
-
GLtools::initGL(__pForm);
+ __pForm->SendUserEvent(TouchForm::REQUEST_ACTIVATE, null);
__pTracker = new Tracker();
- CameraTools::StartCamera(*__pTracker, Tracker::DESIRED_CAMERA_WIDTH, Tracker::DESIRED_CAMERA_HEIGHT);
-
- __pTracker->Init(__pForm);
- CameraTools::Restart();
-
- __pForm->SendUserEvent(TouchForm::REQUEST_ACTIVATE, null);
+ if(!CameraTools::StartCamera(*__pTracker, Tracker::DESIRED_CAMERA_WIDTH, Tracker::DESIRED_CAMERA_HEIGHT))
+ {
+ delete __pTracker;
+ __pTracker = null;
+
+ __pPopup->SetTitleText(L"No camera");
+
+ // Creates an instance of Button to close the popup.
+ Button* pYesButton = new Button();
+ pYesButton->Construct(Tizen::Graphics::Rectangle(140, 50, 250, 80), L"OK");
+ pYesButton->SetActionId(ID_BUTTON_YES);
+ pYesButton->AddActionEventListener(*this);
+
+ // Adds the button to the popup
+ __pPopup->AddControl(*pYesButton);
+
+ __pPopup->SetShowState(true);
+ __pPopup->Show();
+ }
+ else
+ {
+ __pPopup->SetTitleText(L"Exit application?");
+
+ // Creates an instance of Button to close the popup.
+ Button* pYesButton = new Button();
+ pYesButton->Construct(Tizen::Graphics::Rectangle(10, 50, 250, 80), L"Yes");
+ pYesButton->SetActionId(ID_BUTTON_YES);
+ pYesButton->AddActionEventListener(*this);
+
+ Button* pNoButton = new Button();
+ pNoButton->Construct(Tizen::Graphics::Rectangle(270, 50, 250, 80), L"No");
+ pNoButton->SetActionId(ID_BUTTON_NO);
+ pNoButton->AddActionEventListener(*this);
+
+ // Adds the button to the popup
+ __pPopup->AddControl(*pYesButton);
+ __pPopup->AddControl(*pNoButton);
+
+ __pTracker->Init(__pForm);
+ CameraTools::Restart();
+ }
return true;
}
bool
QrCodeRecognizer::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
{
- __pTracker->DoRendering(false);
CameraTools::StopCamera();
GLtools::destroyGL();
+ if(__pTracker)
+ {
+ __pTracker->DoRendering(false);
+ delete __pTracker;
+ }
- delete __pTracker;
return true;
}
break;
case PanelButton::ID_BUTTON_EXIT:
{
-// __pPopup->SetShowState(true);
- __pTracker->Terminate();
-// __pPopup->Show();
+ __pPopup->SetShowState(true);
+ __pPopup->Show();
}
break;
case PanelButton::ID_BUTTON_EXECUTE:
break;
case ID_BUTTON_YES:
- //Crushing application without this
+ //Crushing application without this
+ if(__pPopup)
+ {
delete __pPopup;
+ }
+ if(__pTracker)
+ {
__pTracker->Terminate();
+ }
+ else
+ {
+ Tizen::App::Application::GetInstance()->Terminate();
+ }
break;
case ID_BUTTON_NO:
__pPopup->SetShowState(false);