Tizen 2.0 Release 2.0_release
authorHyungKyu Song <hk76.song@samsung.com>
Fri, 15 Feb 2013 06:11:26 +0000 (15:11 +0900)
committerHyungKyu Song <hk76.song@samsung.com>
Fri, 15 Feb 2013 06:11:26 +0000 (15:11 +0900)
18 files changed:
LICENSE.Flora [new file with mode: 0644]
NOTICE [new file with mode: 0644]
description.xml [new file with mode: 0755]
project/data/nofile.dummy [new file with mode: 0644]
project/home/nofile.dummy [new file with mode: 0644]
project/inc/Stopwatch.h [new file with mode: 0644]
project/inc/StopwatchForm.h [new file with mode: 0644]
project/inc/StopwatchFrame.h [new file with mode: 0644]
project/manifest.xml [new file with mode: 0755]
project/shared/data/nofile.dummy [new file with mode: 0644]
project/shared/res/screen-density-xhigh/mainmenu.png [new file with mode: 0644]
project/shared/trusted/nofile.dummy [new file with mode: 0644]
project/src/Stopwatch.cpp [new file with mode: 0644]
project/src/StopwatchEntry.cpp [new file with mode: 0644]
project/src/StopwatchForm.cpp [new file with mode: 0644]
project/src/StopwatchFrame.cpp [new file with mode: 0644]
sample.xml [new file with mode: 0755]
screenshot.png [new file with mode: 0644]

diff --git a/LICENSE.Flora b/LICENSE.Flora
new file mode 100644 (file)
index 0000000..9c95663
--- /dev/null
@@ -0,0 +1,206 @@
+Flora License
+
+Version 1.0, May, 2012
+
+http://floralicense.org/license/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction,
+and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by
+the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and
+all other entities that control, are controlled by, or are
+under common control with that entity. For the purposes of
+this definition, "control" means (i) the power, direct or indirect,
+to cause the direction or management of such entity,
+whether by contract or otherwise, or (ii) ownership of fifty percent (50%)
+or more of the outstanding shares, or (iii) beneficial ownership of
+such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity
+exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications,
+including but not limited to software source code, documentation source,
+and configuration files.
+
+"Object" form shall mean any form resulting from mechanical
+transformation or translation of a Source form, including but
+not limited to compiled object code, generated documentation,
+and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form,
+made available under the License, as indicated by a copyright notice
+that is included in or attached to the work (an example is provided
+in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form,
+that is based on (or derived from) the Work and for which the editorial
+revisions, annotations, elaborations, or other modifications represent,
+as a whole, an original work of authorship. For the purposes of this License,
+Derivative Works shall not include works that remain separable from,
+or merely link (or bind by name) to the interfaces of, the Work and
+Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original
+version of the Work and any modifications or additions to that Work or
+Derivative Works thereof, that is intentionally submitted to Licensor
+for inclusion in the Work by the copyright owner or by an individual or
+Legal Entity authorized to submit on behalf of the copyright owner.
+For the purposes of this definition, "submitted" means any form of
+electronic, verbal, or written communication sent to the Licensor or
+its representatives, including but not limited to communication on
+electronic mailing lists, source code control systems, and issue
+tracking systems that are managed by, or on behalf of, the Licensor
+for the purpose of discussing and improving the Work, but excluding
+communication that is conspicuously marked or otherwise designated
+in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity
+on behalf of whom a Contribution has been received by Licensor and
+subsequently incorporated within the Work.
+
+"Tizen Certified Platform" shall mean a software platform that complies
+with the standards set forth in the Compatibility Definition Document
+and passes the Compatibility Test Suite as defined from time to time
+by the Tizen Technical Steering Group and certified by the Tizen
+Association or its designated agent.
+
+2. Grant of Copyright License.  Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+copyright license to reproduce, prepare Derivative Works of,
+publicly display, publicly perform, sublicense, and distribute the
+Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License.  Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+(except as stated in this section) patent license to make, have made,
+use, offer to sell, sell, import, and otherwise transfer the Work
+solely as incorporated into a Tizen Certified Platform, where such
+license applies only to those patent claims licensable by such
+Contributor that are necessarily infringed by their Contribution(s)
+alone or by combination of their Contribution(s) with the Work solely
+as incorporated into a Tizen Certified Platform to which such
+Contribution(s) was submitted. If You institute patent litigation
+against any entity (including a cross-claim or counterclaim
+in a lawsuit) alleging that the Work or a Contribution incorporated
+within the Work constitutes direct or contributory patent infringement,
+then any patent licenses granted to You under this License for that
+Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution.  You may reproduce and distribute copies of the
+Work or Derivative Works thereof pursuant to the copyright license
+above, in any medium, with or without modifications, and in Source or
+Object form, provided that You meet the following conditions:
+
+  1. You must give any other recipients of the Work or Derivative Works
+     a copy of this License; and
+  2. You must cause any modified files to carry prominent notices stating
+     that You changed the files; and
+  3. You must retain, in the Source form of any Derivative Works that
+     You distribute, all copyright, patent, trademark, and attribution
+     notices from the Source form of the Work, excluding those notices
+     that do not pertain to any part of the Derivative Works; and
+  4. If the Work includes a "NOTICE" text file as part of its distribution,
+     then any Derivative Works that You distribute must include a readable
+     copy of the attribution notices contained within such NOTICE file,
+     excluding those notices that do not pertain to any part of
+     the Derivative Works, in at least one of the following places:
+     within a NOTICE text file distributed as part of the Derivative Works;
+     within the Source form or documentation, if provided along with the
+     Derivative Works; or, within a display generated by the Derivative Works,
+     if and wherever such third-party notices normally appear.
+     The contents of the NOTICE file are for informational purposes only
+     and do not modify the License.
+
+You may add Your own attribution notices within Derivative Works
+that You distribute, alongside or as an addendum to the NOTICE text
+from the Work, provided that such additional attribution notices
+cannot be construed as modifying the License. You may add Your own
+copyright statement to Your modifications and may provide additional or
+different license terms and conditions for use, reproduction, or
+distribution of Your modifications, or for any such Derivative Works
+as a whole, provided Your use, reproduction, and distribution of
+the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+any Contribution intentionally submitted for inclusion in the Work
+by You to the Licensor shall be under the terms and conditions of
+this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify
+the terms of any separate license agreement you may have executed
+with Licensor regarding such Contributions.
+
+6. Trademarks.  This License does not grant permission to use the trade
+names, trademarks, service marks, or product names of the Licensor,
+except as required for reasonable and customary use in describing the
+origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+agreed to in writing, Licensor provides the Work (and each
+Contributor provides its Contributions) on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied, including, without limitation, any warranties or conditions
+of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+PARTICULAR PURPOSE. You are solely responsible for determining the
+appropriateness of using or redistributing the Work and assume any
+risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+whether in tort (including negligence), contract, or otherwise,
+unless required by applicable law (such as deliberate and grossly
+negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special,
+incidental, or consequential damages of any character arising as a
+result of this License or out of the use or inability to use the
+Work (including but not limited to damages for loss of goodwill,
+work stoppage, computer failure or malfunction, or any and all
+other commercial damages or losses), even if such Contributor
+has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+the Work or Derivative Works thereof, You may choose to offer,
+and charge a fee for, acceptance of support, warranty, indemnity,
+or other liability obligations and/or rights consistent with this
+License. However, in accepting such obligations, You may act only
+on Your own behalf and on Your sole responsibility, not on behalf
+of any other Contributor, and only if You agree to indemnify,
+defend, and hold each Contributor harmless for any liability
+incurred by, or claims asserted against, such Contributor by reason
+of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Flora License to your work
+
+To apply the Flora License to your work, attach the following
+boilerplate notice, with the fields enclosed by brackets "[]"
+replaced with your own identifying information. (Don't include
+the brackets!) The text should be enclosed in the appropriate
+comment syntax for the file format. We also recommend that a
+file or class name and description of purpose be included on the
+same "printed page" as the copyright notice for easier
+identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Flora License, Version 1.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://floralicense.org/license/
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..3997999
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,4 @@
+Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Flora License, Version 1.
+Please, see the LICENSE file for Flora License terms and conditions.
+
diff --git a/description.xml b/description.xml
new file mode 100755 (executable)
index 0000000..2191256
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?> 
+<?xml-stylesheet type="text/xsl" href="../../../../description.xsl"?>
+
+<Overview version="0.17.1">
+  <SampleName> Stopwatch </SampleName>
+  <SampleVersion>1.0</SampleVersion>
+  <Preview>screenshot.png</Preview>
+  <Description>The Stopwatch sample application demonstrates how you can operate (start, lap, stop, reset, and restart) a stopwatch.
+
+</Description>
+</Overview>
diff --git a/project/data/nofile.dummy b/project/data/nofile.dummy
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/project/home/nofile.dummy b/project/home/nofile.dummy
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/project/inc/Stopwatch.h b/project/inc/Stopwatch.h
new file mode 100644 (file)
index 0000000..80ab39f
--- /dev/null
@@ -0,0 +1,72 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef _STOPWATCH_H__\r
+#define _STOPWATCH_H__\r
+\r
+#include <FBase.h>\r
+#include <FGraphics.h>\r
+#include <FApp.h>\r
+#include <FUi.h>\r
+#include <FUix.h>\r
+#include <FSystem.h>\r
+#include <FMedia.h>\r
+\r
+class Stopwatch
+       : public Tizen::App::Application
+       , public Tizen::System::IScreenEventListener
+{\r
+public:\r
+       // The application must have a factory method that creates an instance of the application.\r
+       static Tizen::App::Application* CreateInstance(void);\r
+\r
+public:
+       Stopwatch(void);\r
+       ~Stopwatch(void);\r
+\r
+public:
+       // Called when the application is initializing.
+       virtual bool OnAppInitializing(Tizen::App::AppRegistry& appRegistry);
+\r
+       // Called when the application initializing is finished.
+       virtual bool OnAppInitialized(void);
+\r
+       // Called when the application is requested to terminate.
+       virtual bool OnAppWillTerminate(void);
+\r
+       // Called when the application is terminating.
+       virtual bool OnAppTerminating(Tizen::App::AppRegistry& appRegistry, bool forcedTermination = false);
+\r
+       // Called when the application's frame moves to the top of the screen.
+       virtual void OnForeground(void);
+\r
+       // Called when this application's frame is moved from top of the screen to the background.
+       virtual void OnBackground(void);
+\r
+       // Called when the system memory is not sufficient to run the UiApp any further.
+       virtual void OnLowMemory(void);
+\r
+       // Called when the battery level changes.
+       virtual void OnBatteryLevelChanged(Tizen::System::BatteryLevel batteryLevel);
+
+       // Called when the screen turns on.
+       virtual void OnScreenOn(void);
+
+       // Called when the screen turns off.
+       virtual void OnScreenOff(void);
+};\r
+\r
+#endif // _STOPWATCH_H__
diff --git a/project/inc/StopwatchForm.h b/project/inc/StopwatchForm.h
new file mode 100644 (file)
index 0000000..b0abcc2
--- /dev/null
@@ -0,0 +1,69 @@
+//\r
+// Tizen C++ SDK
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Flora License, Version 1.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+//     http://floralicense.org/license/\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an AS IS BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+
+#include "Stopwatch.h"\r
+\r
+class StopwatchForm
+       : public Tizen::Ui::Controls::Form
+       , public Tizen::Ui::IActionEventListener
+       , public Tizen::Ui::Controls::IListViewItemProvider
+       , public Tizen::Base::Runtime::ITimerEventListener
+{\r
+public:\r
+       StopwatchForm(void);\r
+       virtual ~StopwatchForm(void);\r
+\r
+       bool Initialize(void);\r
+       void InsertItem(void);\r
+       void SetTimer(void);\r
+       void SetButtonState(void);\r
+       void CreateButtons(void);\r
+\r
+       virtual result OnInitializing(void);
+       virtual result OnTerminating(void);
+       virtual result OnDraw(void);
+       virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
+       virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+\r
+       //IListViewItemProvider
+       virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth);
+       virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase *pItem, int itemWidth);
+       virtual int GetItemCount(void);
+\r
+private:\r
+       Tizen::Ui::Controls::ListView* __pList;\r
+       Tizen::Base::Runtime::Timer* __pTimer;\r
+\r
+       Tizen::Ui::Controls::Button* __pBtnStart;\r
+       Tizen::Ui::Controls::Button* __pBtnRecord;\r
+       Tizen::Ui::Controls::Button* __pBtnStop;\r
+       Tizen::Ui::Controls::Button* __pBtnReset;\r
+       Tizen::Ui::Controls::Button* __pBtnRestart;\r
+       Tizen::Ui::Controls::Label*     __pTextLabel;
+\r
+       Tizen::Base::String __watchText;\r
+       Tizen::Base::Collection::ArrayList* __pWatchTextList;\r
+\r
+       int __stat;\r
+       int __watchTextPointX;\r
+       int __watchTextPointY;\r
+\r
+       long long __startTick;\r
+       long long __stopTick;\r
+       long long __restartTick;\r
+       long long __tmpTick;\r
+};\r
diff --git a/project/inc/StopwatchFrame.h b/project/inc/StopwatchFrame.h
new file mode 100644 (file)
index 0000000..71eb649
--- /dev/null
@@ -0,0 +1,19 @@
+#ifndef _STOPWATCH_FRAME_H_
+#define _STOPWATCH_FRAME_H_
+
+#include <FBase.h>
+#include <FUi.h>
+
+class StopwatchFrame
+       : public Tizen::Ui::Controls::Frame
+{
+public:
+       StopwatchFrame(void);
+       virtual ~StopwatchFrame(void);
+
+public:
+       virtual result OnInitializing(void);
+       virtual result OnTerminating(void);
+};
+
+#endif //_STOPWATCH_FRAME_H_
diff --git a/project/manifest.xml b/project/manifest.xml
new file mode 100755 (executable)
index 0000000..e9aa425
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<Manifest xmlns="http://schemas.tizen.org/2012/12/manifest">
+    <Id>$(manifestAppId)</Id>
+    <Version>2.0.0</Version>
+    <Type>C++App</Type>
+    <Author/>
+    <Descriptions>
+        <Description Locale="eng-GB"/>
+    </Descriptions>
+    <Requirements>
+        <Feature Name="http://tizen.org/feature/platform.core.cpu.arch">x86</Feature>
+        <Feature Name="http://tizen.org/feature/platform.core.fpu.arch">vfpv3</Feature>
+    </Requirements>
+    <Apps>
+        <ApiVersion>2.0</ApiVersion>
+        <Privileges>
+            <Privilege>http://tizen.org/privilege/power</Privilege>
+        </Privileges>
+        <UiApp Main="True" MenuIconVisible="True" Name="$(projectName)">
+            <UiScalability BaseScreenSize="Normal" CoordinateSystem="Logical" LogicalCoordinate="480"/>
+            <UiTheme SystemTheme="White"/>
+            <DisplayNames>
+                <DisplayName Locale="eng-GB">$(projectName)</DisplayName>
+            </DisplayNames>
+            <Icons>
+                <Icon Section="MainMenu" Type="Xhigh">mainmenu.png</Icon>
+            </Icons>
+            <LaunchConditions/>
+            <Notifications/>
+        </UiApp>
+    </Apps>
+</Manifest>
+
diff --git a/project/shared/data/nofile.dummy b/project/shared/data/nofile.dummy
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/project/shared/res/screen-density-xhigh/mainmenu.png b/project/shared/res/screen-density-xhigh/mainmenu.png
new file mode 100644 (file)
index 0000000..983c883
Binary files /dev/null and b/project/shared/res/screen-density-xhigh/mainmenu.png differ
diff --git a/project/shared/trusted/nofile.dummy b/project/shared/trusted/nofile.dummy
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/project/src/Stopwatch.cpp b/project/src/Stopwatch.cpp
new file mode 100644 (file)
index 0000000..0a60214
--- /dev/null
@@ -0,0 +1,109 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "Stopwatch.h"\r
+#include "StopwatchFrame.h"\r
+\r
+using namespace Tizen::System;\r
+using namespace Tizen::App;\r
+using namespace Tizen::Ui;\r
+using namespace Tizen::Ui::Controls;\r
+using namespace Tizen::Base;\r
+\r
+Stopwatch::Stopwatch(void)\r
+{\r
+}\r
+\r
+Stopwatch::~Stopwatch(void)\r
+{\r
+}\r
+\r
+Application*\r
+Stopwatch::CreateInstance(void)\r
+{\r
+       // You can create the instance through another constructor.\r
+       return new (std::nothrow) Stopwatch();
+}\r
+\r
+bool\r
+Stopwatch::OnAppInitializing(AppRegistry& appRegistry)\r
+{\r
+       return true;
+}
+\r
+bool
+Stopwatch::OnAppInitialized(void)
+{
+       StopwatchFrame* pStopwatchFrame = new StopwatchFrame();
+       pStopwatchFrame->Construct();
+       pStopwatchFrame->SetName(L"Stopwatch");
+       AddFrame(*pStopwatchFrame);
+\r
+       Tizen::System::PowerManager::KeepCpuAwake(true);
+
+       return true;\r
+}\r
+\r
+bool\r
+Stopwatch::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)\r
+{\r
+       Tizen::System::PowerManager::KeepCpuAwake(false);
+
+       return true;
+}
+
+bool
+Stopwatch::OnAppWillTerminate(void)
+{
+       return true;\r
+}\r
+\r
+void\r
+Stopwatch::OnForeground(void)\r
+{\r
+}\r
+\r
+void\r
+Stopwatch::OnBackground(void)\r
+{\r
+}\r
+\r
+void\r
+Stopwatch::OnLowMemory(void)\r
+{\r
+}\r
+\r
+void\r
+Stopwatch::OnBatteryLevelChanged(BatteryLevel batteryLevel)\r
+{\r
+}\r
+\r
+void\r
+Stopwatch::OnScreenOn (void)\r
+{\r
+       // TODO:\r
+       // Get the released resources or resume the operations that were paused or stopped in OnScreenOff().\r
+}\r
+\r
+void\r
+Stopwatch::OnScreenOff (void)\r
+{\r
+       // TODO:\r
+       //  Unless there is a strong reason to do otherwise, release resources (such as 3D, media, and sensors) to allow the device to enter the sleep mode to save the battery.\r
+       // Invoking a lengthy asynchronous method within this listener method can be risky, because it is not guaranteed to invoke a callback before the device enters the sleep mode.\r
+       // Similarly, do not perform lengthy operations in this listener method. Any operation must be a quick one.\r
+}\r
diff --git a/project/src/StopwatchEntry.cpp b/project/src/StopwatchEntry.cpp
new file mode 100644 (file)
index 0000000..5615b34
--- /dev/null
@@ -0,0 +1,62 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**\r
+ * This file contains the Tizen C++ application entry point.\r
+ */\r
+#include "Stopwatch.h"\r
+\r
+using namespace Tizen::Base;\r
+using namespace Tizen::Base::Collection;\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif // __cplusplus\r
+\r
+_EXPORT_ int OspMain(int argc, char *pArgv[]);\r
+\r
+/**\r
+ * The entry function of Tizen C++ application called by the operating system.\r
+ */\r
+int\r
+OspMain(int argc, char *pArgv[])\r
+{\r
+       result r = E_SUCCESS;\r
+\r
+       AppLog("Application started.");\r
+       ArrayList* pArgs = new (std::nothrow) ArrayList();
+       pArgs->Construct();\r
+       for (int i = 0; i < argc; i++)\r
+               pArgs->Add(*(new (std::nothrow) String(pArgv[i])));
+\r
+       r = Tizen::App::Application::Execute(Stopwatch::CreateInstance, pArgs);\r
+       if (IsFailed(r))\r
+       {\r
+               AppLogException("Application execution failed-[%s].", GetErrorMessage(r));\r
+               r &= 0x0000FFFF;\r
+       }\r
+\r
+       pArgs->RemoveAll(true);\r
+       delete pArgs;\r
+       AppLog("Application finished.");\r
+\r
+       return static_cast<int>(r);\r
+}\r
+#ifdef __cplusplus\r
+}\r
+#endif // __cplusplus\r
diff --git a/project/src/StopwatchForm.cpp b/project/src/StopwatchForm.cpp
new file mode 100644 (file)
index 0000000..a296b24
--- /dev/null
@@ -0,0 +1,445 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "StopwatchForm.h"\r
+\r
+using namespace Tizen::App;\r
+using namespace Tizen::Base;\r
+using namespace Tizen::Base::Runtime;\r
+using namespace Tizen::Base::Collection;\r
+using namespace Tizen::Graphics;\r
+using namespace Tizen::Media;\r
+using namespace Tizen::Ui;\r
+using namespace Tizen::Ui::Controls;\r
+\r
+static const int ID_BTN_START = 100;
+static const int ID_BTN_RECORD = 101;
+static const int ID_BTN_STOP = 102;
+static const int ID_BTN_RESET = 103;
+static const int ID_BTN_RESTART = 104;
+
+static const int TIMER_START = 200;
+static const int TIMER_STOP = 202;
+static const int TIMER_RESTART = 203;
+static const int TIMER_RESET = 204;
+
+static const int ID_FORMAT_RECORD = 300;
+static const int INTERVAL = 10;
+
+StopwatchForm::StopwatchForm(void)\r
+       : __pList(null)
+       , __pTimer(null)
+       , __pBtnStart(null)
+       , __pBtnRecord(null)
+       , __pBtnStop(null)
+       , __pBtnReset(null)
+       , __pBtnRestart(null)
+       , __pTextLabel(null)
+       , __watchText("00:00:00")
+       , __pWatchTextList(null)
+       , __stat(0)
+       , __startTick(0)
+       , __stopTick(0)
+       , __restartTick(0)
+       , __tmpTick(0)
+{\r
+}\r
+\r
+StopwatchForm::~StopwatchForm(void)\r
+{\r
+       delete __pWatchTextList;\r
+}\r
+\r
+bool\r
+StopwatchForm::Initialize(void)\r
+{\r
+       Construct(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_HEADER);\r
+       return true;\r
+}\r
+\r
+result\r
+StopwatchForm::OnInitializing(void)\r
+{\r
+\r
+       Header * pHeader = Form::GetHeader();\r
+       pHeader->SetTitleText("STOPWATCH");\r
+\r
+       // Get X Position of "00:00:00"\r
+       Dimension tempDim;\r
+       Font font;\r
+       font.Construct(FONT_STYLE_PLAIN | FONT_STYLE_BOLD, 100);\r
+       font.GetTextExtent(__watchText, __watchText.GetLength(), tempDim);\r
+       __watchTextPointX = (this->GetWidth() - tempDim.width)/2;\r
+       __watchTextPointY = 110;\r
+\r
+       // Create List\r
+       __pList = new (std::nothrow) ListView();
+       __pList->Construct(Rectangle(0, 125, 480, 385), true, false);\r
+       __pList->SetTextOfEmptyList("No Item");\r
+       __pList->SetItemProvider(*this);\r
+       AddControl(*__pList);\r
+\r
+       // Create WatchTextList\r
+       __pWatchTextList = new (std::nothrow) ArrayList();
+       __pWatchTextList->Construct();\r
+\r
+       // Create Timer\r
+       __pTimer = new (std::nothrow) Timer();
+       __pTimer->Construct(*this);\r
+\r
+       // Create Buttons\r
+       CreateButtons();\r
+\r
+       __pTextLabel = new (std::nothrow) Label();
+       __pTextLabel->Construct(Rectangle(0, 0, 480, 125), __watchText);
+       __pTextLabel->SetTextConfig(100, LABEL_TEXT_STYLE_BOLD);
+       AddControl(*__pTextLabel);
+\r
+       return E_SUCCESS;\r
+}\r
+\r
+result\r
+StopwatchForm::OnTerminating(void)\r
+{\r
+       if (__pTimer)\r
+       {\r
+               __pTimer->Cancel();\r
+               delete __pTimer;\r
+       }\r
+       if (__pWatchTextList)\r
+       {
+               __pWatchTextList->RemoveAll(true);\r
+       }
+\r
+       return E_SUCCESS;\r
+}\r
+\r
+void\r
+StopwatchForm::CreateButtons()\r
+{\r
+       // Create Start Button\r
+       __pBtnStart =  new (std::nothrow) Button();
+       __pBtnStart->Construct(Rectangle(30, 520, 420, 50), L"Start");
+       __pBtnStart->SetActionId(ID_BTN_START);\r
+       __pBtnStart->AddActionEventListener(*this);\r
+       AddControl(*__pBtnStart);\r
+\r
+       // Create Stop Button\r
+       __pBtnStop =  new (std::nothrow) Button();
+       __pBtnStop->Construct(Rectangle(250, 520, 200, 50), L"Stop");
+       __pBtnStop->SetActionId(ID_BTN_STOP);\r
+       __pBtnStop->AddActionEventListener(*this);\r
+       AddControl(*__pBtnStop);\r
+\r
+       // Create Record Button\r
+       __pBtnRecord = new (std::nothrow) Button();
+       __pBtnRecord->Construct(Rectangle(30, 520, 200, 50), L"Lap");
+       __pBtnRecord->SetActionId(ID_BTN_RECORD);\r
+       __pBtnRecord->AddActionEventListener(*this);\r
+       AddControl(*__pBtnRecord);\r
+\r
+       // Create Reset Button\r
+       __pBtnReset = new (std::nothrow) Button();
+       __pBtnReset->Construct(Rectangle(30, 520, 200, 50), L"Reset");
+       __pBtnReset->SetActionId(ID_BTN_RESET);\r
+       __pBtnReset->AddActionEventListener(*this);\r
+       AddControl(*__pBtnReset);\r
+\r
+       // Create Restart Button\r
+       __pBtnRestart = new (std::nothrow) Button();
+       __pBtnRestart->Construct(Rectangle(250, 520, 200, 50), L"Restart");
+       __pBtnRestart->SetActionId(ID_BTN_RESTART);\r
+       __pBtnRestart->AddActionEventListener(*this);\r
+       AddControl(*__pBtnRestart);\r
+\r
+       // Set Show State\r
+       __pBtnStart->SetShowState(true);\r
+       __pBtnReset->SetShowState(false);\r
+       __pBtnRestart->SetShowState(false);\r
+       __pBtnStop->SetShowState(false);\r
+       __pBtnRecord->SetShowState(false);\r
+}\r
+\r
+void\r
+StopwatchForm::InsertItem(void)\r
+{\r
+       if (__pWatchTextList)
+       {\r
+               __pWatchTextList->InsertAt(*(new (std::nothrow) String(__watchText)), 0);
+               if (__pWatchTextList->GetCount() > 10)\r
+               {
+                       __pWatchTextList->RemoveAt(10, true);\r
+               }
+       }\r
+       __pList->ScrollToItem(0, LIST_SCROLL_ITEM_ALIGNMENT_TOP);
+\r
+       __pList->UpdateList();\r
+}\r
+\r
+result\r
+StopwatchForm::OnDraw(void)\r
+{\r
+       __pTextLabel->SetText(__watchText);
+       __pTextLabel->Draw();
+       __pTextLabel->Show();
+\r
+       return E_SUCCESS;\r
+}\r
+\r
+void\r
+StopwatchForm::SetTimer(void)\r
+{\r
+       long long tick ;\r
+\r
+       // Get current tick value\r
+       Tizen::Base::TimeSpan uptime(0);
+       result r = Tizen::System::SystemTime::GetUptime(uptime);
+       if (IsFailed(r))
+       {\r
+               AppLog("System uptime not available\n");\r
+               return ;\r
+       }\r
+       tick = uptime.GetTicks();\r
+       if(__stat == TIMER_START)\r
+       {
+               tick -= __startTick;\r
+       }
+       else if(__stat == TIMER_RESTART)\r
+       {
+               tick = tick - __tmpTick - __startTick;\r
+       }
+       else\r
+       {
+               return;\r
+       }
+\r
+       TimeSpan span = static_cast<long>(tick);\r
+\r
+       // Set StopWatch String\r
+       __watchText.Clear();\r
+\r
+       if(span.GetMinutes() < 10)\r
+       {
+               __watchText.Append("0");\r
+       }
+       __watchText.Append(span.GetMinutes());\r
+       __watchText.Append(":");
+       if(span.GetSeconds() < 10)\r
+       {
+               __watchText.Append("0");\r
+       }
+       __watchText.Append(span.GetSeconds());\r
+       __watchText.Append(":");\r
+       if(span.GetMilliseconds() / 10 < 10)\r
+       {
+               __watchText.Append("0");\r
+       }
+       __watchText.Append(span.GetMilliseconds() / 10);\r
+\r
+       __pTextLabel->SetText(__watchText);
+       __pTextLabel->Invalidate(false);
+       __pTextLabel->Show();
+\r
+       return;\r
+}\r
+\r
+void\r
+StopwatchForm::OnTimerExpired(Timer&  timer)
+{\r
+       SetTimer();\r
+\r
+       if(__stat == TIMER_STOP || __stat == TIMER_RESET)\r
+       {
+               return;\r
+       }
+\r
+       result r = __pTimer->Start(INTERVAL);
+       if (IsFailed(r))\r
+       {\r
+               AppLog("Timer Start Fail.\n");\r
+               return;\r
+       }\r
+}\r
+\r
+void\r
+StopwatchForm::OnActionPerformed(const Control& source, int actionId)\r
+{\r
+       long long tick ;\r
+       Tizen::Base::TimeSpan  uptime(0);
+       result r = Tizen::System::SystemTime::GetUptime(uptime);
+       if (IsFailed(r))
+       {\r
+               AppLog("System uptime not available\n");\r
+               return ;\r
+       }\r
+       tick = uptime.GetTicks();\r
+       TimeSpan span = static_cast<long>(tick);\r
+       switch(actionId)\r
+       {\r
+               case ID_BTN_START:
+               {
+                       __startTick = uptime.GetTicks();
+                       __stat = TIMER_START;
+                       SetButtonState();
+                       __pTimer->Start(INTERVAL);
+                       break;
+               }
+               case ID_BTN_RESTART:
+               {
+                       __restartTick = uptime.GetTicks();
+                       if (__stat == TIMER_STOP)
+                       {
+                               __tmpTick += __restartTick - __stopTick;
+                       }
+                       __stat = TIMER_RESTART;
+                       SetButtonState();
+                       __pTimer->Start(INTERVAL);
+                       break;
+               }
+               case ID_BTN_RECORD:
+               {
+                       if (__stat == TIMER_START)
+                       {
+                               tick -= __startTick;
+                       }
+                       else if(__stat == TIMER_RESTART)
+                       {
+                               tick = tick - __tmpTick - __startTick;
+                       }
+                       else
+                       {
+                               return;
+                       }
+\r
+                       span = static_cast<long>(tick);
+
+                       // Set StopWatch String
+                       __watchText.Clear();
+                       if (span.GetMinutes() < 10)
+                       {
+                               __watchText.Append("0");
+                       }
+                       __watchText.Append(span.GetMinutes());
+                       __watchText.Append(":");
+                       if (span.GetSeconds() < 10)
+                       {
+                               __watchText.Append("0");
+                       }
+                       __watchText.Append(span.GetSeconds());
+                       __watchText.Append(":");
+                       if (span.GetMilliseconds() / 10 < 10)
+                       {
+                               __watchText.Append("0");
+                       }
+                       __watchText.Append(span.GetMilliseconds() / 10);
+
+                       InsertItem();
+                       break;
+               }
+               case ID_BTN_STOP:
+               {
+                       __stopTick = uptime.GetTicks();
+                       __stat = TIMER_STOP;
+                       SetButtonState();
+                       break;
+               }
+               case ID_BTN_RESET:
+               {
+                       __stat = TIMER_RESET;
+                       SetButtonState();
+
+                       __startTick = 0;
+                       __stopTick = 0;
+                       __restartTick = 0;
+                       __tmpTick = 0;
+                       __watchText.Replace(__watchText, "00:00:00");
+
+                       if (__pWatchTextList)
+                       {
+                               __pWatchTextList->RemoveAll(true);
+                               __pList->UpdateList();
+                       }
+                       break;
+               }
+               default:
+                       break;
+       }\r
+       Draw();\r
+}\r
+\r
+void\r
+StopwatchForm::SetButtonState()\r
+{\r
+       if (__stat == TIMER_START)
+       {\r
+               __pBtnStart->SetShowState(false);\r
+               __pBtnStop->SetShowState(true);\r
+               __pBtnRecord->SetShowState(true);\r
+       }\r
+       else if(__stat == TIMER_RESTART)\r
+       {\r
+               __pBtnReset->SetShowState(false);\r
+               __pBtnRestart->SetShowState(false);\r
+               __pBtnStop->SetShowState(true);\r
+               __pBtnRecord->SetShowState(true);\r
+       }\r
+       else if (__stat == TIMER_STOP)
+       {\r
+               __pBtnStop->SetShowState(false);\r
+               __pBtnRecord->SetShowState(false);\r
+               __pBtnReset->SetShowState(true);\r
+               __pBtnRestart->SetShowState(true);\r
+       }\r
+       else if (__stat == TIMER_RESET)
+       {\r
+               __pBtnReset->SetShowState(false);\r
+               __pBtnRestart->SetShowState(false);\r
+               __pBtnStart->SetShowState(true);\r
+       }\r
+}\r
+\r
+int\r
+StopwatchForm::GetItemCount(void)\r
+{\r
+       if (__pWatchTextList)
+       {
+               return __pWatchTextList->GetCount();\r
+       }
+\r
+       return 0;\r
+}\r
+\r
+Tizen::Ui::Controls::ListItemBase*\r
+StopwatchForm::CreateItem(int index, int itemWidth)\r
+{\r
+       String* pItemText = null;\r
+       pItemText = static_cast<String *>(__pWatchTextList->GetAt(index));\r
+\r
+       CustomItem* pItem = new (std::nothrow) CustomItem();
+       pItem->Construct(Tizen::Graphics::Dimension(itemWidth,74), LIST_ANNEX_STYLE_NORMAL);
+       pItem->AddElement(Rectangle(10, 10, 460, 74), ID_FORMAT_RECORD, *pItemText, true);
+\r
+       return pItem;\r
+}\r
+\r
+bool\r
+StopwatchForm::DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)\r
+{\r
+       delete pItem;\r
+       pItem = null;\r
+       return true;\r
+}\r
diff --git a/project/src/StopwatchFrame.cpp b/project/src/StopwatchFrame.cpp
new file mode 100644 (file)
index 0000000..51446ae
--- /dev/null
@@ -0,0 +1,49 @@
+#include "StopwatchFrame.h"
+#include "StopwatchForm.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+
+StopwatchFrame::StopwatchFrame(void)
+{
+}
+
+StopwatchFrame::~StopwatchFrame(void)
+{
+}
+
+result
+StopwatchFrame::OnInitializing(void)
+{
+       result r = E_SUCCESS;
+
+       // Create a form
+       StopwatchForm* pStopwatchForm = new StopwatchForm();
+       pStopwatchForm->Initialize();
+
+       // Add the form to the frame
+       AddControl(*pStopwatchForm);
+
+       // Set the current form
+       SetCurrentForm(*pStopwatchForm);
+
+       // Draw the form
+       pStopwatchForm->Invalidate(true);
+
+       // TODO: Add your initialization code here
+
+       return r;
+}
+
+result
+StopwatchFrame::OnTerminating(void)
+{
+       result r = E_SUCCESS;
+
+       // TODO: Add your termination code here
+
+       return r;
+}
+
+
diff --git a/sample.xml b/sample.xml
new file mode 100755 (executable)
index 0000000..611571b
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template>
+                
+       <slp-property>
+               <property-group>
+                       <sample-name>Stopwatch</sample-name>
+                       <category>Sample</category>
+                       <sdk-version>1.00</sdk-version>
+                       <project-type>org.tizen.nativecpp.buildArtefactType.app</project-type>                  
+                       <sample-description>description.xml</sample-description>
+               </property-group>
+       </slp-property>
+       
+       <process type="org.tizen.nativeappcommon.TizenCopyFolder">
+               <simple name="projectName" value="$(projectName)"/>
+               <simple name="folderPath" value="project"/>
+               <complex-array name="replaceableFiles">
+                 <element>
+                               <simple name="sourcePath" value="manifest.xml"/>
+                               <simple name="targetPath" value="manifest.xml"/>
+                               <simple name="replaceable" value = "true"/>
+                       </element>
+               </complex-array>
+       </process>
+       <process type="org.tizen.nativecpp.SetDefaultFrameworks">
+               <simple name="projectName" value="$(projectName)"/>
+               <complex-array name="frameworkList">
+                       <element>
+                               <simple name="framework" value="osp"/>
+                       </element>
+                       <element>
+                               <simple name="framework" value="osp-compat"/>
+                       </element>
+               </complex-array>
+       </process>
+       
+</template>
diff --git a/screenshot.png b/screenshot.png
new file mode 100644 (file)
index 0000000..12a1692
Binary files /dev/null and b/screenshot.png differ