Re: [SailfishDevel] Setting application screen orientation from C++

2014-07-30 Thread Piotr Tworek
Hi Thomas,

Thank you for the reply. I'm actually more interested in having the
content rotated automatically. Around two weeks ago Google released an
android game written in Qt/QML. The game is called VoltAir and is
available on github under Apache 2.0 license
(https://github.com/google/VoltAir). I've thought it'd be nice to port
it to Sailfish.

I took a stab at it and managed to get it to compile and run, but the
first problem I encountered was that the entire game expects to be run
in landscape mode, but on sailfish it was displayed in portrait mode.
Digging into the code I've found that on android the screen orientation
is set using manifest file. Sailfish doesn't seem to have anything like
that. What I did was essentially create a new main qml file which
created AplicationWindow with one Page setting the orientation to
Landscape | LandscapeInverted. This worked for the game UI, but not for
the content itself.

The content of the game is drawn underneath qml layer using opengl. I
don't know OpenGL to well, but I've figured out that If I can add a
rotation matrix to the right places this part should also work. I did
find a function which produces view matrix for the game and I added
rotation to that. It worked, but not everywhere. The game engine assumes
in a few places that the view matrix is only scale*translation. Under
such assumption it does access the matrix cells directly in several
places. When the view matrix is rotated the the expected data is in
different cells. I can fix those code parts, but this means sailfish
specific patch for the games becomes bigger and uglier.

Another problem with the current solution is that even though the window
contents are rotated the width() and height() getters for the window
still return values for portrait mode. This means another set of
sailfish ifdefs which swap width()/height() calls. It works, but does
not seem right.

I'll try to clean up my patches and push it to github. Maybe could look
at them and see if there is a better way of handling this problem on
sailfish.

/ptw

 Hey,
 
 2014-07-17 23:05 GMT+02:00 Piotr Tworek tworaz...@gmail.com:
 Is there a way to lock application screen orientation to landscape
 directly from Qt/C++ code? I know it's possible from QML, but I can't
 find any docs how the same can be done from C++.
 
 You can e.g. subclass QWindow to a custom class (so you can handle
 events, I call that QWindow subclass instance view in the code
 snippet below), then instantiate and show the window
 (.showFullScreen()) and then tell the system that the content is in
 landscape like this:
 
 // Switch to landscape mode
 view.reportContentOrientationChange(Qt::LandscapeOrientation);
 view.screen()-setOrientationUpdateMask(Qt::LandscapeOrientation);
 
 You still have a portrait window (in the sense that you have to
 rotate your content in your code, but that's always more efficent than
 having the compositor do a rotated readout of your window buffer, even
 if that's done in special 2D blitting hardware that can do
 multiple-of-90-degrees readouts in hardware), but you can render in
 landscape (in my case, I render everything in GL ES, so rotating is
 just applying some forward-rotation to the projection matrix and
 backward-rotation for handling input). What this will do is:
 
  1. It will make the volume bar appear in landscape orientation
  2. It will allow closing the window from the top relative to
 landscape orientation (right screen border on device)
  3. Everything else that a landscape window will do that I forgot here
 
 
 HTH :)
 Thomas
 ___
 SailfishOS.org Devel mailing list
 To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
 

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


[SailfishDevel] Setting application screen orientation from C++

2014-07-17 Thread Piotr Tworek
Hi,

Is there a way to lock application screen orientation to landscape
directly from Qt/C++ code? I know it's possible from QML, but I can't
find any docs how the same can be done from C++.

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


Re: [SailfishDevel] Notifications API

2014-07-07 Thread Piotr Tworek
This might not be the best solution, but for YTPlayer I've basically
added nemo-qml-plugin-notifications as a git submodule. To compile the
code I've created qmake pri file that I include in my main .pro file
(See:
https://github.com/tworaz/sailfish-ytplayer/blob/master/third_party/notifications.pri).
To make the module available in my app I've than register the
Notification type with qml in my main function
(https://github.com/tworaz/sailfish-ytplayer/blob/master/src/YTPlayer.cpp#L92).
The important part is to register it under harbour.myapp. Other
prefixes might violate harbour qml import restrictions.

/ptw

 Thanks for the clarification. :-)

 Can you give me a hint, how this could be done?


 Am 05.07.2014 23:06, schrieb Piotr Tworek:
 It's not forbidden however to ship your own copy of
 nemo-qml-plugin-notifications as part of your app :)

 Be aware, that nemomobile notifications API ist not allowed in harbour
 at the moment.

 Am 29.06.2014 17:54, schrieb Jonni Rainisto:
 https://github.com/nemomobile/mlite/blob/master/src/mnotification.h
 https://github.com/nemomobile/nemo-qml-plugin-notifications

 
 From: devel-boun...@lists.sailfishos.org
 [devel-boun...@lists.sailfishos.org] on behalf of Tomasz Sterna
 [to...@xiaoka.com]
 Sent: Sunday, June 29, 2014 6:26 PM
 To: devel@lists.sailfishos.org
 Subject: [SailfishDevel] Notifications API

 How do I send a notification that appears as that thin, blue line
 at the
 top of the launcher?

 i.e. the one after connecting USB, with lightning icon saying that the
 device is charging.



 -- 
 Tomasz Sterna:(){ :|:};:
 Instant Messaging ConsultantOpen Source Developer
 http://abadcafe.pl/   http://www.xiaoka.com/portfolio
 ___
 SailfishOS.org Devel mailing list
 To unsubscribe, please send a mail to
 devel-unsubscr...@lists.sailfishos.org
 ___
 SailfishOS.org Devel mailing list
 To unsubscribe, please send a mail to
 devel-unsubscr...@lists.sailfishos.org

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

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


Re: [SailfishDevel] XMLHttpRequest

2014-07-07 Thread Piotr Tworek
Hi,

It's probably not a good idea to ignore https verification errors in
your app. Still, if you insist on doing it you could probably subclass
QQmlNetworkAccessManagerFactory and override it's create method. This
should allow you to create a custom QNetworkAccessManager to be used by
QML engine. Than you can connect a slot to it's sslErrors signal and
call QNetworkReply::ignoreSslErros() on the reply argument of your slot.

/ptw

 Hi!

 I have searched for this question on Qt/QML but can't find any answer so far:

 Anyone knows if its possible to turn of ssl verification on https requests 
 when 
 using XMLHttpRequest object in QML?





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


Re: [SailfishDevel] Notifications API

2014-07-05 Thread Piotr Tworek
It's not forbidden however to ship your own copy of
nemo-qml-plugin-notifications as part of your app :)

 Be aware, that nemomobile notifications API ist not allowed in harbour
 at the moment.

 Am 29.06.2014 17:54, schrieb Jonni Rainisto:
 https://github.com/nemomobile/mlite/blob/master/src/mnotification.h
 https://github.com/nemomobile/nemo-qml-plugin-notifications

 
 From: devel-boun...@lists.sailfishos.org
 [devel-boun...@lists.sailfishos.org] on behalf of Tomasz Sterna
 [to...@xiaoka.com]
 Sent: Sunday, June 29, 2014 6:26 PM
 To: devel@lists.sailfishos.org
 Subject: [SailfishDevel] Notifications API

 How do I send a notification that appears as that thin, blue line at the
 top of the launcher?

 i.e. the one after connecting USB, with lightning icon saying that the
 device is charging.



 -- 
 Tomasz Sterna:(){ :|:};:
 Instant Messaging ConsultantOpen Source Developer
 http://abadcafe.pl/   http://www.xiaoka.com/portfolio
 ___
 SailfishOS.org Devel mailing list
 To unsubscribe, please send a mail to
 devel-unsubscr...@lists.sailfishos.org
 ___
 SailfishOS.org Devel mailing list
 To unsubscribe, please send a mail to
 devel-unsubscr...@lists.sailfishos.org

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