[SailfishDevel] Resolution-independent in-app icons

2016-07-20 Thread Osmo Salomaa

Hello,

SFOS has standard sizes for application launcher icons and Silica has 
stock icons, whose sizes (I assume) vary by device, but how should I 
handle custom in-app icons, e.g. a position icon in a map application, 
so that it would look right on different pixel-density screens?


I tried using a large PNG or SVG and having QML scale that to one of the 
Theme.iconSize* constants, but the result of such downscaling is not 
smooth, even when using Image's smooth=true. Additionally the QML 
documentation says there's a possibly significant performace cost to 
smooth scaling. This implies that I'd need different size PNGs on 
different devices and show those 1:1 without scaling.


So, is there some SFOS image resizing script I can run on RPM's 
post-install to generate the right size icons from SVGs or large PNGs? 
Or should I just roll my own solution that packs in icons of different 
sizes and loads the closest match at runtime?


--
Osmo Salomaa 
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


Re: [SailfishDevel] Resolution-independent in-app icons

2016-07-21 Thread Osmo Salomaa

On 21.07.2016 14:30, Joona Petrell wrote:

We use Jolla 1 as our base configuration, other devices are scaled
from there.

>

z1.0 small 32x32, medium 64x64, large 96x96, app icon 86x86
z1.25 small 40x40, medium 80x80, large 120x120, app icon 108x108
z1.5 small 48x48 medium 96x96, large 144x144, app icon 128x128
z1.5-large small 48x48, medium 72x72, large 108x108, app icon 128x128 (tablet)
z1.75 small 56x56, medium 112x112, large 168x168, app icon 150x150
z2.0 small 64x64, medium 128x128, large 192x192, app icon 172x172


Thanks. This was very helpful. I assume these z-values are the same as 
Theme.pixelRatio?


For anyone interested, below is what I ended up doing, at least for now. 
A Python script to generate PNGs from SVGs, e.g. position.svg to 
posit...@1.00.png, posit...@1.25.png, etc. and a JavaScript function for 
use in QML to load the closest match. My current need was just icons on 
a map, meaning I don't have to match Sailfish's standard sizes, I just 
wanted the icons to scale relative to the pixel ratio. Tested on Jolla 1 
and tablet, seemed to work as expected.


#!/usr/bin/env python3
import glob, os, xml.dom.minidom
for svg in glob.glob("*.svg"):
doc = xml.dom.minidom.parse(svg)
doc = doc.getElementsByTagName("svg")[0]
width = int(doc.getAttribute("width"))
height = int(doc.getAttribute("height"))
assert width > 0 and height > 0
for ratio in [1.00, 1.25, 1.50, 1.75, 2.00]:
png = "{}@{:.2f}.png".format(svg[:-4], ratio)
os.system("inkscape -f {} -e {} -C -w {:.0f} -h {:.0f}"
  .format(svg, png, ratio*width, ratio*height))

function getIcon(name) {
var ratios = [1.00, 1.25, 1.50, 1.75, 2.00];
var minIndex = -1, minDiff = 1000;
for (var i = 0; i < ratios.length; i++) {
var diff = Math.abs(Theme.pixelRatio - ratios[i]);
minIndex = diff < minDiff ? i : minIndex;
minDiff = Math.min(minDiff, diff);
}
var ratio = ratios[minIndex].toFixed(2);
return "icons/%1@%2.png".arg(name).arg(ratio);
}

--
Osmo Salomaa 
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


Re: [SailfishDevel] Recommended replacement for a spinner?

2016-11-01 Thread Osmo Salomaa

On 01.11.2016 21:15, Marcin Mielniczuk wrote:

In my app I'd like to present the user a spinner to let them choose an
arbitrary integer.

What is a recommended replacement for this in Sailfish Silica? A
TextField with IntValidator? Or is there anything better?


Add inputMethodHints and it should be good.

TextField {
inputMethodHints: Qt.ImhDigitsOnly
}

Silica does offer a slider, but it's probably bad if the integer is 
indeed arbitrary, as you'd need to set a minimum and maximum, and a 
linear scale between them might not be appropriate.


--
Osmo Salomaa 
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


Re: [SailfishDevel] [Reminder] Sailfish OS Open Source Community Collaboration Meeting 9th of January 2017

2017-01-08 Thread Osmo Salomaa

On 08.01.2017 16:57, James Noori wrote:

So far there is only 1 topic announced and that usually means we are going to 
postpone the meeting, but I am going to send this reminder out instead and wait 
for more topics to get announced.


I added "QtLocation and Qt 5.6 licensing in general".

--
Osmo Salomaa 
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] QtLocation | Qt 5.6

2017-01-09 Thread Osmo Salomaa

On 09.01.2017 13:01, rinigus wrote:

from reading the meeting transcript it seems that we still don't have
straight answer regarding QtLocation 5.6 ("checking at the moment").


They were not wordy, but my interpretation is that nothing has changed regarding QtLocation 
being allowed in store apps once it's upgraded to a stable release, i.e. >= 5.6. 
"Aiming to have solution for it in the first quarter of 2017" doesn't sound too 
bad, I was worried we were at a dead end.


However, I don't see the changes in the source code indicating exclusive
role of LGPLv3 among LGPL licenses. The LGPLv2.1 license is still there for
QtLocation module (see https://github.com/qt/qtlocation).


Indeed. There's a license change commit in the source 2016-01-20, but that's 
saying it would be from 5.7 onwards. And that commit is not in the 5.6 branch.

https://github.com/qt/qtlocation/commit/71dabb5dc330a47d91ee917ca60c871a88e8a42a

Reading various other unclear sources, I see 5.5, 5.6 and 5.7 all mentioned for 
the change -- maybe it was pushed back a few times? I have found no web page 
that would actually list the licenses under which Qt modules are available. Can 
anyone from Jolla comment? Do you have better information?

--
Osmo Salomaa 
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] Missing /usr/bin/sailfish-qml on the phone

2017-10-19 Thread Osmo Salomaa
On Fri, Oct 20, 2017, at 00:41, Slava Monich wrote:
> ... but you can install an rpm by somehow transferring it to the phone 
> (e.g. by downloading it with the browser) and then tapping it in 
> Settings -> Transfers. You would have to allow installing untrusted 
> software first on the Settings -> Untrusted software page.
> 
> I don't think this has anything to do with "pkcon refresh".

I constantly keep running into reports from users where the dependencies
cannot be found and the solution always is "pkcon refresh". As far as I
know that happens both with OpenRepos + Warehouse and the manual way you
describe. Please try to do something about this, it's annoying to tell
users they need developer mode and command line just to install an RPM.

https://together.jolla.com/question/132628
https://github.com/otsaloma/poor-maps/issues/57

-- 
Osmo Salomaa 
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] QML translations don't work

2018-03-08 Thread Osmo Salomaa
On Thu, Mar 8, 2018, at 20:21, Yann Büchau wrote:
> Now my question is, what am I doing wrong so QML stuff won't translate? 
> My QML is just the python-sample with some strings wrapped with qsTr(). 

What's your translation call like? Note that the context argument needs to 
match what is in the translation file. If you happened to copy the Pan Transit 
style of converting gettext po-files to Qt linguist files, then the context 
will be empty. I use the following helper function for QML translations: 
https://github.com/otsaloma/pan-transit/blob/master/qml/pan-transit.qml#L40

-- 
Osmo Salomaa 
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] Map applications in Harbour

2018-04-07 Thread Osmo Salomaa
On Sat, Apr 7, 2018, at 16:16, rinigus wrote:
> 2: WhoGo Maps (and sports app Laufhelden) use Mapbox GL for showing maps.
> This is done via QML plugin https://github.com/rinigus/mapbox-gl-qml . The
> plugin is based on recent QtLocation code and my own development on the
> basis of it.

Also, it seems that the Qt version of Mapbox GL native is fairly new and has 
seen significant updates and fixes in new versions, so there's a significant 
benefit in having a separate package for this as getting it via a Qt LTS 
release means quite a long delay. Do you have a list of the Mapbox GL version 
you package vs. in Qt 5.9 and 5.12?

> Finally, regarding online/offline maps and EU network charges. The privacy,
> network coverage redundancy, and requirements for OSM Scout Server have
> been addressed during the meeting by community members. However, while
> network access is much cheaper in EU, don't forget that online maps require
> a server on the other side. There are few commercial solutions, but, they
> are not cheap. @otsaloma had to install his own server to go around these
> costs.

And still my custom solution is not even close to the quality of Mapbox's maps, 
in part due to my lack of design skills, in part due the low detail level of 
tiles from OpenMapTiles.com. It would be best to have some kind of a platform 
solution as Mapbox's maps are unreasonably expensive for a hobby project once 
past the free plan. It's likely worth asking if Mapbox would be interested in 
some kind of a deal, getting some exposure and testing for their Qt version.

-- 
Osmo Salomaa 
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

[SailfishDevel] QtMobility and Python bindings

2013-07-17 Thread Osmo Salomaa
Hello friends,

I have taken a look at the Sailfish SDK with the intent of investigating
prospects of developing applications in Python. I didn't manage to find
the Python bindings for QtMobility using zypper and the default SDK
repositories. I also tried to find them for my desktop system running
Debian unstable, but it seems Debian removed pyside-mobility a year ago
due to being dead upstream and failing to build from source [1].

So, what's the status of QtMobility and Python? Has someone picked up
maintainership? Will it be included in a newer version of the Sailfish
SDK? Is there a development repository where I could find this kind of
stuff (like extras-devel was at Maemo)?

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=671356

-- 
Osmo Salomaa 
___
SailfishOS.org Devel mailing list


Re: [SailfishDevel] QtMobility and Python bindings

2013-07-17 Thread Osmo Salomaa
17.07.2013 22:12, Martin Kolman wrote:
> The pyside-qtmobility build[1] I have in home:MartinK:nemo project
> or Mer OBS worked last time I've tried it.

Thanks. Importing QtMobility at a Python prompt works.

What I was planning on doing first was trying out QGraphicsGeoMap. The
(unnecessarily complicated) example [1] I found segfaults already at the
QtMobility imports. Being a Python programmer, investigating import-time
segfaults isn't really my thing.

[1]
http://qt.gitorious.org/pyside/pyside-examples/blobs/master/mobility/location/mapviewer.py

> Jolla announced a few days ago that the first Sailfish running device
> will be running Wayland and Qt5 only[3][4], dropping X11 and with it
> Qt4 support. This is unfortunately quite an issue for Python
> application development, as there are currently no Python bindings
> supporting Qt5 & QtQuick 1.0 or 2.0[5].

> Hopefully, the situation might improve on PyQt get's QtQuick 2.0
> support (no timeline for that just yet though), but PyQt packaging
> and PySide -> PyQt conversion would still be needed. Also in contrast
> to the LGPL PySide, PyQt is GPL only, which might be an issue to some
> developers.

> In comparison, while there has been some recent activity in the
> PySide project, it has been so far limited to bugfixing and work on
> Qt5 support has not yet been started.

Not being familiar with Qt, I thought (or hoped) Nokia's weight had
already resolved the Python binding problem and that PySide was somewhat
an official and maintained part of Qt. I guess I was wrong. A useless
battle continues.

I guess I better hold off on writing any Python code. In addition to
what you mention, I suppose there's a switch to Python 3 around the
corner (or at least should be by now).

-- 
Osmo Salomaa 
___
SailfishOS.org Devel mailing list


[SailfishDevel] qmlscene & error handling

2013-12-15 Thread Osmo Salomaa

Hello,

I'm writing an application using QML and PyOtherSide. I'm new to Qt, 
QML, PyOtherSide and all the rest apart from Python.


I ssh into the emulator and use 'qmlscene main.qml' to run my 
application. I'm wondering about qmlscene's error handling. I create QML 
objects dynamically based on data sent from the Python side. If I have 
an error in my QML code, qmlscene seems to just silently stop executing 
code at the offending point. I'd expect an error message, maybe even a 
crash. Why don't I get that?


Two examples of these ignored errors: (1) I was referring to an object 
by its id apparently out of scope, solved by moving the Python block 
from under ApplicationWindow to under Page and (2) I mistyped a method 
call, 'addItem' instead of 'addMapItem'.


--
Osmo Salomaa 
___
SailfishOS.org Devel mailing list


Re: [SailfishDevel] qmlscene & error handling

2013-12-15 Thread Osmo Salomaa

15.12.2013 18:30, Wim de Vries wrote:

I don't  know about Python, but QML is giving no feedback at all (even
console.log does not work) since the SDK update.
See " no output from console.log" topic above. Possibly related.


I'm still on the previous version. console.log works.

--
Osmo Salomaa 
___
SailfishOS.org Devel mailing list


Re: [SailfishDevel] (QtLocation 5.0) Coordinate is not a type

2013-12-22 Thread Osmo Salomaa

23.12.2013 00:30, Bob Jelica wrote:

I’m not quite finished with the tutorial, but since you seem to be in
dire need of instructions, here goes:
https://github.com/b0bben/SailfishOS_MapTutorial

> App works, docs are work-in-progress.


Holla at me if you’re having trouble with anything.


Thanks, this works and helps a lot. I had some half-working code of my 
own, but it stopped working with the latest version of the SDK.


A couple notes and questions.

It seems setting a zoomLevel value normally doesn't work. The map always 
seems to start at the default zoom level. It does work however, if I set 
it under Component.onCompleted.


Is there a way to zoom in and out with the emulator? I keep trying to 
use the mouse scroll wheel.


Are the Nokia maps in Qt to stay or an unmaintained relic? I notice the 
tiles are not the same as at here.com, but some older version.


Is there any way to define tile sources in QML? The Qt Location Map 
Plugin API seems a gigantic OO monster for the simple usual case of 
wanting to specify a custom tile URL.


--
Osmo Salomaa 
___
SailfishOS.org Devel mailing list


[SailfishDevel] RPM-packaging for Python/QML applications

2013-12-29 Thread Osmo Salomaa

Hello,

Does anyone have an example of RPM-packaging for a PyOtherSide or pure 
QML application?


I'm not familiar with RPM. In the case of PyOtherSide should I write 
YAML or directly a spec file?


Looking at a couple non-C++ Sailfish applications on GitHub, I see them 
using minimal C++ ('SailfishApp::main(argc, argv)'). Why such a 
travestry instead of a shell script calling qmlscene or sailfish-qml?


--
Osmo Salomaa 
___
SailfishOS.org Devel mailing list


Re: [SailfishDevel] prefered way to build rpm package for a project written in python/pyotherside?

2014-03-05 Thread Osmo Salomaa

05.03.2014 23:13, Boris Pohler wrote:

I wrote my first little program using python/pyotherside. I develop
directly on the jolla-device (no sdk) and would like to build a rpm
package to distribute to openrepos (and later to harbour, if python is
accepted). What is the prefered (easiest) way?


If it's pure Python and QML, the package will be noarch and you can 
build the RPM on any system, e.g. your desktop system. You just need a 
spec file and then run rpmbuild.


I build helsinki-transit-live packages myself on a Debian desktop 
system. I have split the file copying to a Makefile and the spec file 
just calls "make install" (but you can just as well put the copy 
commands in the spec file if that's easier). If building on a non-RPM 
system, you can use "rpmbuild --nodeps" to avoid stopping at checking 
BuildRequires.


https://github.com/otsaloma/helsinki-transit-live
(see RELEASING, Makefile and rpm/*.spec)

--
Osmo Salomaa 
___
SailfishOS.org Devel mailing list


[SailfishDevel] Profiling QML

2014-05-01 Thread Osmo Salomaa

Hello list,

I write code in Python + QML with PyOtherSide. I know my Python well 
enough and am not worried its speed, but quite the opposite for QML and 
Javascript. I'd like to see which lines of code or which functions take 
how much execution time (which I assume implies battery use as well). 
Date.now has served me well for particular spots, but I'd like to take a 
look at the big picture.


Is there a command line QML profiler available? There's apparently some 
GUI one in the emulator IDE, but I couldn't figure out, can I use that 
without C++ and all that IDE project fluff?


--
Osmo Salomaa 
___
SailfishOS.org Devel mailing list


Re: [SailfishDevel] QtLocation/Map does nothing ?

2014-10-15 Thread Osmo Salomaa

Hi,

15.10.2014, 22:57, Kim Foder kirjoitti:

Im the QML file I have implemented the as follows:

 Map {
 id: map
 enabled: true
 anchors.fill: parent // parent is for test purposes
 // 400 * 400 pixels
 center: QtPositioning.coordinate(55,10)
 zoomLevel: 7
 Plugin {
   id: plugin
   allowExperimental: true
   preferred: ["osm"]
   required.mapping: Plugin.AnyMappingFeatures
   required.geocoding: Plugin.AnyGeocodingFeatures
 }
 }

Any ideas?


You need to assign the plugin to the plugin property. And it should be 
enough to just give the name parameter. Try


Map {
...
plugin: Plugin { name: "osm" }
}

Also, you might need to set the zoom level under onCompleted.

https://bugreports.qt-project.org/browse/QTBUG-40779

--
Osmo Salomaa 
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


Re: [SailfishDevel] How to detect when an app are restored from minimized

2015-01-23 Thread Osmo Salomaa

24.01.2015, 01:04, Kim Foder kirjoitti:

I believe this is because of the change where the context is freed when
the app is minimized, so I added a call to var getContext("2d") to my
onPaint event, and the app can paint on the canvas again.


I noticed the same, it changed with Uitukka/Qt5.2. Adding an 
onContextChanged handler worked for me.


Canvas {
id: canvas
onContextChanged: {
if (!canvas.context) return;
// Initialize context properties here...
canvas.requestPaint();
    }
}

--
Osmo Salomaa 
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


Re: [SailfishDevel] Sailfishos.org site renewal!

2015-01-31 Thread Osmo Salomaa

31.01.2015, 15:26, Kimmo Lindholm kirjoitti:

As said below;


Currently the SDK includes Tutorial, Design and API Documentation,
and these are not available on the website.


Start SDK, click help on sidebar, last item from contents "Sailfish
silica reference"


Thanks, but many of us dynamic-language folks don't use and don't want 
to use the SDK (much) at all.


I hope documentation quickly returns to the website as well.

I personally have a scrape of the old documentation (indexed for use 
with Emacs and helm-dash), so I'm fine, but others might not be fine.


--
Osmo Salomaa 
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


Re: [SailfishDevel] QtFeedback 5.0 not allowed? Really?

2015-04-30 Thread Osmo Salomaa
On Thu, Apr 30, 2015, at 01:49, Martin Kolman wrote:
> Also what about QtPositioning ? I know that the pull request for RPM 
> validator has already been merged a while ago,
> but when I recently tried to submit an application using QtPositioning 
> to Harbour, I got a reply that is actually still not yet allowed...

I too submitted an application to Harbour once RPM validator was
updated. I could easily clone the repository and run the validator and
thought Harbour QA could as well...

On Thu, Apr 30, 2015, at 08:57, Reto Zingg wrote:
> the new APIs get allowed once the matching SDK is out. As 
> communicated earlier QtPosition will be allowed with 1.1.4.x

Not that it was communicated, but eventually I did figure that out. I
understand SDK release and update are good times to make an
announcement, but continuing to block QtPositioning seems rather
pointless, especially since we don't use the SDK and the allowed version
of QtPositioning is already in Sailfish OS.

-- 
Osmo Salomaa 
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


Re: [SailfishDevel] Opening messaging app from qml.

2015-07-21 Thread Osmo Salomaa

Hello,

21.07.2015, 14:36, neotericdevelo...@gmail.com kirjoitti:

I tried to open default messaging app using the below code(qml). But
its not invoking the msg app.

Qt.openUrlExternally("sms:?body=msgtosend");

I also tried this one by providing dummy phone number.

Qt.openUrlExternally("sms:0123456789?body=msgtosend"); Still not
working.


When I last checked, your second example should work, the first one not. 
The recipient is needed.


https://together.jolla.com/question/84134/

--
Osmo Salomaa 
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


Re: [SailfishDevel] About applications presenting a map interface

2015-09-03 Thread Osmo Salomaa

Hello,

03.09.2015, 08:14, juice kirjoitti:

I see that currently QtLocation and QtPositioning are still not
allowed in Harbour. This seems to me that I cannot use a Map object
in QML.


QtPositioning is allowed, but QtLocation not. You conclusion is correct 
though -- you cannot use Map. Jolla seems to want to wait for QtLocation 
to be released as a stable part of Qt. It is a "technology preview" in 
Qt 5.5.



What is approved the method to present a map interface (openmaps for
example) in an application and still have it possible to submit the
application to the store?


You need to bundle something in and ship it with your application.

Effectively, Jolla is currently telling application authors to either 
(1) not write applications with maps, (2) not ship via the official 
store or (3) to bundle their own map component.


If option (3) is least bad for you, you can take a look at the several 
map applications already at the Jolla store, some of which are open 
source. Each of them bundle a different legacy map component that is 
clearly less native, less smooth and less performant than QtLocation. 
The QML PinchMap [1] is probably the easiest solution. If you don't need 
something quite ready yet, but want a modern solution, take a look at 
Mapbox GL [2].


Best would be if you could convince Jolla to allow QtLocation. I suspect 
their stability worries are exaggerated, especially compared to the lack 
of stability worries of those legacy components.


[1] https://lists.sailfishos.org/pipermail/devel/2014-December/005405.html
[2] https://www.mapbox.com/blog/qmapboxgl/

--
Osmo Salomaa 
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


Re: [SailfishDevel] SailfishOS SDK 1510 and launcher icon for tablet version

2015-10-20 Thread Osmo Salomaa

On 20.10.2015 12:53, Luca Donaggio wrote:

Launcher icon for the tablet version of any app should by 128x128 px and
have to be deployed in /usr/share/icons/hicolor/128x128/apps/appname.png,


This is the first time I hear this. Is this documented somewhere? Also, 
is there documentation or recommendations about how to handle in-app 
icon sizes to accomodate both phone and tablet users? Can and should we 
load SVG icons in QML?


--
Osmo Salomaa 
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org