SailfishOS first application: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
'''English''' | [[SailfishOS first application Polish|Polski]]
[[Category:SailfishOS::Introduction_tutorial]]


_________________________________________<br /> Article is part 2 of [[wiki/Category:SailfishOS::Introduction tutorial|Introduction Tutorial]].<br />[[wiki/SailfishOS SDK Installation|&lt; Go To Part 1]] ||| [[wiki/SailfishOS using app in emulator basics|Go To Part 3 &gt;]]<br /> _________________________________________
[toc align_right=&quot;yes&amp;quot; depth=&quot;2&amp;quot;]


=First application=
'''English''' | [[:SailfishOS_first_application_Polish|Polski]]


''if you don’t have the <span class="caps">SDK</span> installed and running yet, follow the'' [[wiki/SailfishOS SDK Installation|installation guide.]]
''''_<br />Article is part 2 of &quot;Introduction Tutorial&amp;quot;:/wiki/Category:SailfishOS::Introduction_tutorial.<br />&quot;&lt; Go To Part 1&amp;quot;:/wiki/SailfishOS_SDK_Installation ||| &quot;Go To Part 3 &gt;&quot;:/wiki/SailfishOS_using_app_in_emulator_basics<br />''''_


==1.Launch Sailfish OS <span class="caps">IDE</span>==
= First application =


You can launch from the ‘SailfishOS <span class="caps">IDE</span>’ entry in the system menu (or from ~/SailfishOS/bin/qtcreator if you’re a linux terminal person).
''if you don't have the SDK installed and running yet, follow the'' &quot;installation guide.&quot;:/wiki/SailfishOS_SDK_Installation


As an example, on Ubuntu, open the dash, type in ‘sailfish’. Click on the ‘SailfishOS <span class="caps">IDE</span>’ icon to launch the <span class="caps">IDE</span>.
== 1.Launch Sailfish OS IDE ==


==2. Create a Sailfish UI project==
You can launch from the 'SailfishOS IDE' entry in the system menu (or from ~/SailfishOS/bin/qtcreator if you're a linux terminal person).


The <span class="caps">SDK</span> comes with a Sailfish UI template project that makes it very easy to get started. Dialog windows shown in screenshots may vary between diffrent versions/systems so treat them as a example.
As an example, on Ubuntu, open the dash, type in 'sailfish'. Click on the 'SailfishOS IDE' icon to launch the IDE.


# In the <span class="caps">IDE</span>, click on File→New File or Project
== 2. Create a Sailfish UI project ==
# Select Applications→SailfishOS Qt Quick Application.<br />[[Image:wmXnFos.png|Select application screenshot]]
 
# Give a name to your project. Ensure it is created somewhere under your home directory and click Next. <br />[[Image:woU1BS0.png|Nameapplication screenshot]]
The SDK comes with a Sailfish UI template project that makes it very easy to get started. Dialog windows shown in screenshots may vary between diffrent versions/systems so treat them as a example.
# Select MerSDK-SailfishOS-i486-x86 or MerSDK-SailfishOS-armv7hl kit and click Next. <br />''What’s the diffrence? Generally MerSDK-SailfishOS-i486-x86 kit is used when deploying your application on emulator, the second kit is used when deploying application on Mer <span class="caps">ARM</span> device.''<br />[[Image:LV3atKp.png|Select kit screenshot]]
 
# You can edit the short description of your project or just click Next<br />[[Image:7YPwbVc.png|Edit description screenshot]]
# In the IDE, click on File→New File or Project
# You can add version control to your project(in example <span class="caps">GIT</span> or <span class="caps">SVN</span>)<br />[[Image:lprPc7M.png|Add version controll system screenshot]]
# Select Applications→SailfishOS Qt Quick Application.<br />[[Image:http://i.imgur.com/wmXnFos.png?2|Select application screenshot]]
# Give a name to your project. Ensure it is created somewhere under your home directory and click Next.<br />[[Image:http://i.imgur.com/woU1BS0.png?2|Nameapplication screenshot]]
# Select MerSDK-SailfishOS-i486-x86 or MerSDK-SailfishOS-armv7hl kit and click Next.<br />''What's the diffrence? Generally MerSDK-SailfishOS-i486-x86 kit is used when deploying your application on emulator, the second kit is used when deploying application on Mer ARM device.''<br />[[Image:http://i.imgur.com/LV3atKp.png?2|Select kit screenshot]]
# You can edit the short description of your project or just click Next<br />[[Image:http://i.imgur.com/7YPwbVc.png?2|Edit description screenshot]]
# You can add version control to your project(in example GIT or SVN)<br />[[Image:http://i.imgur.com/lprPc7M.png?2|Add version controll system screenshot]]
# Click Finish
# Click Finish
# The project template is imported into your project and opened in the editor.<br />[[Image:OYyvFEK.png|Glance at project template screenshot]]
# The project template is imported into your project and opened in the editor.<br />[[Image:http://i.imgur.com/OYyvFEK.png?2|Glance at project template screenshot]]


==3. Launch the Mer build machine and Emulator==
== 3. Launch the Mer build machine and Emulator ==


The SailfishOS <span class="caps">SDK</span> uses a Mer build machine to compile your code and another virtual machine to run an emulator. If these are not running when you attempt to build or deploy an application you will be asked to start them.
The SailfishOS SDK uses a Mer build machine to compile your code and another virtual machine to run an emulator. If these are not running when you attempt to build or deploy an application you will be asked to start them.


''Note: The Mer build machine needs access to your source code to compile it and by default your home directory is shared this is why the project should be in your home.''
''Note: The Mer build machine needs access to your source code to compile it and by default your home directory is shared - this is why the project should be in your home.''


When a Sailfish OS project is open, the <span class="caps">SDK</span> automatically displays two control buttons in the left toolbar for starting/stopping the Mer build machine and Emulator.<br />[[Image:0vAckoW.png|Mer build toolbar screenshot]]
When a Sailfish OS project is open, the SDK automatically displays two control buttons in the left toolbar for starting/stopping the Mer build machine and Emulator.<br />[[Image:http://i.imgur.com/0vAckoW.png|Mer build toolbar screenshot]]


===3.1. Click on the [[Image:nSniuw6.png|launch Mer Build Engine icon screenshot]] icon to launch Mer Build Engine.===
=== 3.1. Click on the [[Image:http://i.imgur.com/nSniuw6.png|launch Mer Build Engine icon screenshot]] icon to launch Mer Build Engine. ===


The Mer Build Engine is started in the background and the icon will turn gray until the machine has booted up.
The Mer Build Engine is started in the background and the icon will turn gray until the machine has booted up.


===3.2.— Click on the [[Image:zzawOqw.png| launch the emulator icon screenshot]] icon to launch the emulator.===
=== 3.2.— Click on the [[Image:http://i.imgur.com/zzawOqw.png| launch the emulator icon screenshot]] icon to launch the emulator. ===


A new VirtualBox window opens and boots up the emulator.<br />[[Image:SP9eCDT.png| working emulator screenshot]]
A new VirtualBox window opens and boots up the emulator.<br />[[Image:http://i.imgur.com/SP9eCDT.png?1| working emulator screenshot]]


==4. Successful connection==
== 4. Successful connection ==


When the QtCreator can successfully connect to both the emulator and Mer build machine, the icons are updated as shown below.
When the QtCreator can successfully connect to both the emulator and Mer build machine, the icons are updated as shown below.


Before connection:<br />[[Image:ifAYFRi.png| Before connection screenshot]]
Before connection:<br />[[Image:http://i.imgur.com/ifAYFRi.png| Before connection screenshot]]
 
Connection established:<br />[[Image:tQe3Og8.png| Connection established screenshot]]
 
==5. Build and Deploy the app==


Press the [[Image:aI9ECKM.png| play/run button screenshot]] play/run button in the toolbar to compile and run the project on the emulator.
Connection established:<br />[[Image:http://i.imgur.com/tQe3Og8.png| Connection established screenshot]]


That’s it. Congratulations! You just ran your first SailfishOS application. It should be running in the emulator as shown below:<br />[[Image:wJ4tqvy.png| working emulator screenshot]]
== 5. Build and Deploy the app ==


_________________________________________<br /> Article is part 2 of [[wiki/Category:SailfishOS::Introduction tutorial|Introduction Tutorial]].<br />[[wiki/SailfishOS SDK Installation|&lt; Go To Part 1]] ||| [[wiki/SailfishOS using app in emulator basics|Go To Part 3 &gt;]]<br /> _________________________________________
Press the [[Image:http://i.imgur.com/aI9ECKM.png| play/run button screenshot]] play/run button in the toolbar to compile and run the project on the emulator.


===Categories:===
That's it. Congratulations! You just ran your first SailfishOS application. It should be running in the emulator as shown below:<br />[[Image:http://i.imgur.com/wJ4tqvy.png?1| working emulator screenshot]]


* [[:Category:SailfishOS|SailfishOS]]
''''_<br />Article is part 2 of &quot;Introduction Tutorial&amp;quot;:/wiki/Category:SailfishOS::Introduction_tutorial.<br />&quot;&lt; Go To Part 1&amp;quot;:/wiki/SailfishOS_SDK_Installation ||| &quot;Go To Part 3 &gt;&quot;:/wiki/SailfishOS_using_app_in_emulator_basics<br />''''_
** [[:Category:SailfishOS::Introduction tutorial|Introduction_tutorial]]

Revision as of 10:10, 24 February 2015


[toc align_right="yes&quot; depth="2&quot;]

English | Polski

'_
Article is part 2 of "Introduction Tutorial&quot;:/wiki/Category:SailfishOS::Introduction_tutorial.
"< Go To Part 1&quot;:/wiki/SailfishOS_SDK_Installation ||| "Go To Part 3 >":/wiki/SailfishOS_using_app_in_emulator_basics
'
_

First application

if you don't have the SDK installed and running yet, follow the "installation guide.":/wiki/SailfishOS_SDK_Installation

1.Launch Sailfish OS IDE

You can launch from the 'SailfishOS IDE' entry in the system menu (or from ~/SailfishOS/bin/qtcreator if you're a linux terminal person).

As an example, on Ubuntu, open the dash, type in 'sailfish'. Click on the 'SailfishOS IDE' icon to launch the IDE.

2. Create a Sailfish UI project

The SDK comes with a Sailfish UI template project that makes it very easy to get started. Dialog windows shown in screenshots may vary between diffrent versions/systems so treat them as a example.

  1. In the IDE, click on File→New File or Project
  2. Select Applications→SailfishOS Qt Quick Application.
    Select application screenshot
  3. Give a name to your project. Ensure it is created somewhere under your home directory and click Next.
    Nameapplication screenshot
  4. Select MerSDK-SailfishOS-i486-x86 or MerSDK-SailfishOS-armv7hl kit and click Next.
    What's the diffrence? Generally MerSDK-SailfishOS-i486-x86 kit is used when deploying your application on emulator, the second kit is used when deploying application on Mer ARM device.
    Select kit screenshot
  5. You can edit the short description of your project or just click Next
    Edit description screenshot
  6. You can add version control to your project(in example GIT or SVN)
    Add version controll system screenshot
  7. Click Finish
  8. The project template is imported into your project and opened in the editor.
    Glance at project template screenshot

3. Launch the Mer build machine and Emulator

The SailfishOS SDK uses a Mer build machine to compile your code and another virtual machine to run an emulator. If these are not running when you attempt to build or deploy an application you will be asked to start them.

Note: The Mer build machine needs access to your source code to compile it and by default your home directory is shared - this is why the project should be in your home.

When a Sailfish OS project is open, the SDK automatically displays two control buttons in the left toolbar for starting/stopping the Mer build machine and Emulator.
Mer build toolbar screenshot

3.1. Click on the launch Mer Build Engine icon screenshot icon to launch Mer Build Engine.

The Mer Build Engine is started in the background and the icon will turn gray until the machine has booted up.

3.2.— Click on the launch the emulator icon screenshot icon to launch the emulator.

A new VirtualBox window opens and boots up the emulator.
working emulator screenshot

4. Successful connection

When the QtCreator can successfully connect to both the emulator and Mer build machine, the icons are updated as shown below.

Before connection:
Before connection screenshot

Connection established:
Connection established screenshot

5. Build and Deploy the app

Press the play/run button screenshot play/run button in the toolbar to compile and run the project on the emulator.

That's it. Congratulations! You just ran your first SailfishOS application. It should be running in the emulator as shown below:
working emulator screenshot

'_
Article is part 2 of "Introduction Tutorial&quot;:/wiki/Category:SailfishOS::Introduction_tutorial.
"< Go To Part 1&quot;:/wiki/SailfishOS_SDK_Installation ||| "Go To Part 3 >":/wiki/SailfishOS_using_app_in_emulator_basics
'
_