maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   Jolla developing (https://talk.maemo.org/showthread.php?t=94734)

Makkara 2015-03-14 19:02

Jolla developing
 
Hello

Is there any documentation and/or tutorial for Jolla?
If I watch QML tutorials, will they work at least almost the same way when creating a Jolla app?

Thanks

-noob

tmi 2015-03-14 19:50

Re: Jolla developing
 
https://sailfishos.org/develop/ should get you started.
The SDK has some examples and studying other people's code (e.g. from Github) is one way to learn. Here's one collection of open source apps https://github.com/sailfishapps

coderus 2015-03-14 19:53

Re: Jolla developing
 
Quote:

Originally Posted by Makkara (Post 1464069)
Hello

Is there any documentation and/or tutorial for Jolla?
If I watch QML tutorials, will they work at least almost the same way when creating a Jolla app?

Thanks

-noob

Yes you can start with Digia articles about Qt5/QtQuick2 and it will apply to SailfishOS also, you just need to use native Sailfish Silica UI components instead of desktop QtQuick.Controls.

max_power 2015-03-15 18:21

Re: Jolla developing
 
You can also take a look at a demo application on github https://github.com/amarchen/helloworld-pro-sailfish

llelectronics 2015-03-15 22:21

Re: Jolla developing
 
There are also several videos about it on youtube. Just search for Jolla SDK and you will find a few. Some old ones but as a basic start still good enough.

zeebra 2015-03-18 21:16

Re: Jolla developing
 
Is it a requirement to use an SDK to develop programs/apps for Jolla?

SDK is really a really big no no in general. Does Jolla not have the tools to install for example GCC?

One of the worst things about Nokia N900 is the lack of libc and core GNU components.

As far as I know Mer is GNU and not busybox, right?

Does Jolla support libc/make/gcc?

If not, then Jolla is no better than N9 which was pretty bad compared to N900 which again was not perfect. The natural way forward from N900 which used Busybox was ofcourse full GNU and replace GTK with QT and keep everything else.

This unfortunately did not happen, which still makes Nokia N900 king of mobile devices in 2015, which is quite sad considering it was released in 2008.

The mobile marked sucks!

MartinK 2015-03-18 23:10

Re: Jolla developing
 
Quote:

Originally Posted by zeebra (Post 1464382)
Is it a requirement to use an SDK to develop programs/apps for Jolla?

No, you don't have to:
https://together.jolla.com/question/...h-on-sailfish/

In short, you can comfortably develop QML only or Python & QML applications directly on the device. And you can use the Mer OBS with the Sailfish OS target to build stuff that needs to be compiled (it is quite easy to reuse packaging from other RPM based distros such as Fedora).

Not sure about installing compilers & co. directly on the device but I don't think anything technical should be preventing that as long as the needed packages are available.

juiceme 2015-03-19 12:54

Re: Jolla developing
 
Of course you can install the usual compilers and tools to Jolla, it is a Mer-Linux-distribution after all.
If it wasn't so, how would you be able to compile your kernel on it, huh??

[nemo@Jolla ~]$
[nemo@Jolla ~]$ gcc --version
gcc (Linaro GCC 4.6-2013.05) 4.6.4 20130412 (Mer 4.6.4-1)
Copyright © 2011 Free Software Foundation, Inc.
Tämä ohjelma on vapaaohjelmisto; Katsokaa kopiointiehdot lähdekoodista.
Tällä ohjelmistolla EI OLE TAKUUTA; ei edes KAUPALLISESTI HYVÄKSYTTÄVÄSTÄ
LAADUSTA tai SOPIVUUDESTA TIETTYYN TARKOITUKSEEN.
[nemo@Jolla ~]$

aegis 2015-03-19 14:33

Re: Jolla developing
 
Quote:

Originally Posted by zeebra (Post 1464382)
SDK is really a really big no no in general

OK, why is it a really big no no?

I couldn't imagine anything worse than having to develop on device with no tools.

juiceme 2015-03-19 16:44

Re: Jolla developing
 
Quote:

Originally Posted by aegis (Post 1464435)
OK, why is it a really big no no?

I think he means, it is an overkill if you just want to create console applications. For that no "SDK" is needed, just standard toolchains is perfect.


Quote:

Originally Posted by aegis (Post 1464435)
I couldn't imagine anything worse than having to develop on device with no tools.

Sure, but tools come in many sizes and shapes. There are some "SDK's" that I hate like hell because they come diagonally in your way when you are trying to accomplish something. The SFOS SDK is actually quite nice.

javispedro 2015-03-19 17:51

Re: Jolla developing
 
Quote:

Originally Posted by zeebra (Post 1464382)
One of the worst things about Nokia N900 is the lack of libc and core GNU components.

As far as I know Mer is GNU and not busybox, right?

Does Jolla support libc/make/gcc?

"lack of libc"?

Not only you can install gcc/make on it, but it's also much cleaner than on the N900 -- where the compilers in the official SDK repo had some problems thanks to scratchbox1 contamination.


Quote:

Originally Posted by juiceme (Post 1464443)
The SFOS SDK is actually quite nice.

I don't think it's precisely the most "integrated" one (being a VM). I'd wish one could use the scratchbox2 tarballs on any distribution (e.g. by putting required Mer-specific host binaries on a special prefix?). But at least you can put it in a chroot, which IMHO makes it "nicer".

pycage 2015-03-20 07:41

Re: Jolla developing
 
Quote:

Originally Posted by zeebra (Post 1464382)
One of the worst things about Nokia N900 is the lack of libc and core GNU components.

The lack of bash doesn't mean the lack of libc. N900, N9, and Jolla all have proper libc, unlike Android. The choice of busybox only affects you if you want to do shell scripts on the N900.

Quote:

Originally Posted by zeebra (Post 1464382)
Does Jolla support libc/make/gcc?

The same as Mer. You can install the whole toolchain from the mer-tools repository.

Quote:

Originally Posted by zeebra (Post 1464382)
This unfortunately did not happen, which still makes Nokia N900 king of mobile devices in 2015, which is quite sad considering it was released in 2008.

The N900 was released in late 2009, almost 2010.

pichlo 2015-10-13 17:35

Re: Jolla developing
 
Wasn't sure where to ask so I ask here. Seems just a good a place as any, short of starting a new thread.

I am trying to build an existing Harmattan application on Sailfish. I have absolutely zero time and incentive to faff around with SDKs so I am building it on the phone itself. Please bear that in mind and please, please, please avoid answers of the "use the SDK" type. If I cannot build it on the phone itself, I cannot build it at all. Simple as that.

So, here it goes. I have the Harmattan sources. QMake gives me:

Code:

Project ERROR: Unknown module(s) in QT: declarative
I am sure there will be more problems later but one at a time.
'pkcon search name declarative' gives me a loooong list, containing amongst others...

Code:

Installed      qt5-qtdeclarative-5.2.1+git39-1.32.3.armv7hl    Qt Declarative library
Available      qt5-qtdeclarative-5.2.1+git39-1.32.3.source    Qt Declarative library

I assume I need the 'sources' package but how do I get it on the phone?
(Yes, I am such a noob! :o)

tiempjuuh 2015-10-13 18:33

Re: Jolla developing
 
Code:

pkcon install <name of package>
I personally prefer zypper to manage the packages, then it will be
Code:

zypper in <name of package>

pycage 2015-10-13 18:42

Re: Jolla developing
 
Quote:

Originally Posted by pichlo (Post 1485414)
Wasn't sure where to ask so I ask here. Seems just a good a place as any, short of starting a new thread.

I am trying to build an existing Harmattan application on Sailfish. I have absolutely zero time and incentive to faff around with SDKs so I am building it on the phone itself. Please bear that in mind and please, please, please avoid answers of the "use the SDK" type. If I cannot build it on the phone itself, I cannot build it at all. Simple as that.

So, here it goes. I have the Harmattan sources. QMake gives me:

Code:

Project ERROR: Unknown module(s) in QT: declarative
I am sure there will be more problems later but one at a time.
'pkcon search name declarative' gives me a loooong list, containing amongst others...

Code:

Installed      qt5-qtdeclarative-5.2.1+git39-1.32.3.armv7hl    Qt Declarative library
Available      qt5-qtdeclarative-5.2.1+git39-1.32.3.source    Qt Declarative library

I assume I need the 'sources' package but how do I get it on the phone?
(Yes, I am such a noob! :o)

You need the 'devel' package for qt5-qtdeclarative to build it.

Oh, and the "use the SDK" answer is really what you want to hear. The SDK is a Sailfish system, too. That means, you could add the SDK-specific packages to your phone (a not so good idea on the phone's struggling btrfs filesystem IMHO) and build natively on your phone instead of in the SDK.

pichlo 2015-10-13 19:13

Re: Jolla developing
 
Quote:

Originally Posted by pycage (Post 1485424)
You need the 'devel' package for qt5-qtdeclarative to build it.

I know that much, but I have that installed already.

Quote:

Oh, and the "use the SDK" answer is really what you want to hear.
Trust me, I really don't.

pichlo 2015-10-14 12:42

Re: Jolla developing
 
Never mind, I found my answer.

coderus 2015-10-14 12:50

Re: Jolla developing
 
you should not use declarative module in Qt5, use QT += quick and QT += qml instead

coderus 2015-10-14 12:53

Re: Jolla developing
 
And the best place to solve dev questions is #sailfishos freenode irc channel :)

pichlo 2015-10-14 13:02

Re: Jolla developing
 
Quote:

Originally Posted by coderus (Post 1485507)
you should not use declarative module in Qt5, use QT += quick and QT += qml instead

Yes, that's what my link says ;)

Quote:

Originally Posted by coderus (Post 1485508)
And the best place to solve dev questions is #sailfishos freenode irc channel :)

I know, but I don't have time to hang around on IRC 24/7 :(

coderus 2015-10-14 13:14

Re: Jolla developing
 
You shouldn't be online 24/7 if you can't: http://www.merproject.org/logs/%23sailfishos/

pichlo 2015-10-14 13:28

Re: Jolla developing
 
Thanks, coderus. It's not just the 24/7 presence, I find IRC generally a pain to use. It's kinda OK for an immediate interaction but otherwise... Too much irrelevant info ("XY has joined/left"), no threading, no easy search... Basically if I have a question that has been already asked and answered 200 times, the only way to get the answer is to get online and ask again, hoping that someone who knows the answer is also online. It's just way too much effort.

Mailing lists are only marginally better. The best medium for getting answers are Usenet newsgroups, but very few youngsters even know such a thing exists.

juiceme 2015-10-14 20:30

Re: Jolla developing
 
Quote:

Originally Posted by pichlo (Post 1485513)
Thanks, coderus. It's not just the 24/7 presence, I find IRC generally a pain to use. It's kinda OK for an immediate interaction but otherwise... Too much irrelevant info ("XY has joined/left"), no threading, no easy search... Basically if I have a question that has been already asked and answered 200 times, the only way to get the answer is to get online and ask again, hoping that someone who knows the answer is also online. It's just way too much effort.

Mailing lists are only marginally better. The best medium for getting answers are Usenet newsgroups, but very few youngsters even know such a thing exists.

IRC is what passes for "social networks" IMHO. The status changes (N.N. has left etc) and other background noise can be filtered out by your IRC client if you so desire.
The best way you can use IRC is to have a 24/7 server that is logged on to the channels you are intrested on, and ircnotify set up to email a ping to you if something that interests you happens...)

As for usenet, yes, that is the coolest thing since fridges :D
As it happens I run our company-internal news server (inn2), with a fair amount of traffic (301 articles posted last week, just checked now)

reinob 2015-10-15 09:19

Re: Jolla developing
 
Quote:

Originally Posted by juiceme (Post 1485556)
As for usenet, yes, that is the coolest thing since fridges :D

Off-topic alarm! :)

news is what got me hooked on the internet (well, gopher and e-mail as well). I always found it (and still find it) much more comfortable and elegant to use than "modern" internet forums. I especially hate the jolla forum. I really cannot find my way around it.

pichlo 2015-10-29 11:34

Re: Jolla developing
 
Another silly question. (My QML is not very good. I have done some Qt but I am mostly an embedded dev novadays and my idea of a UI is flashing an LED through GPIO ;))

How does one iterate through a string in QML? The QML documentation on the topic is rather sparse and I find the Qt discussion forum even worse to navigate than TJC, however unlikely that may seem.

Basically, I want to check if all characters in a string are from a given set. I tried...
  • foreach - no joy, my QML was rejected. Maybe I just did not hit the right syntax.
  • QString::contains - that one was accepted but always returned true, no matter what I tried feeding it.

Eventually I had to resort to a nested for loop, but there must be a better way.

Please note that this is for editing a QML for a Sailfish patch, i.e. I do not have the option to change the C++ source. Only pure QML please.

velox 2015-10-29 12:18

Re: Jolla developing
 
Quote:

Originally Posted by pichlo (Post 1487080)
How does one iterate through a string in QML?

QML supports JavaScript Functions, so if you have a string property on your QML Component you could add something like (may contain typos or other errors)

Code:

Component.onCompleted {
    //split makes an array out of the string
    yourProperty.split().forEach(function(el,iterator){
        //single character available in "el"
    })
}

does that help?

edit: But you might consider using regex on that string… should be even easier… or even something like if(string.indexOf(substring) > -1)

pichlo 2015-10-29 12:54

Re: Jolla developing
 
I tried this, but it would always return true, no matter what the contents of text was.

Code:

property string alphabet: "abcdefgh"
property string text

function isInAlphabet() {
    for (var i = 0; i < text.length; ++i) {
        if (!alphabet.contains(text[i])
            return false
    }
    return true
}

Replacing alphabet.contains() with my own function (another for loop) worked.
I have not tried indexOf() but if contains() did not work I am skeptical indexOf() would.

Thanks, I will try your forEach syntax when I get some time (in the next couple of hours or so).

EDIT1: Yey, your forEach works! :cool::cool::cool:
EDIT2: No, it doesn't. I forgot to save the file (:o) and it was still picking up my old version. D'oh!
EDIT3: Thank you for your regex suggestion but my alphabet is more complex than that and contains some Unicode characters that give me even more headache ;)

velox 2015-10-29 13:24

Re: Jolla developing
 
oh, by the way, regex would look something like this:
Code:

if (string.search(/[^a-zA-Z]+/) === -1) {
    // only characters
}

Regular Expressions are around since basically forever and pretty fast in every implementation I can think of. Google "JS string match" for an even better alternative (match vs search, there's a difference).


All times are GMT. The time now is 19:03.

vBulletin® Version 3.8.8