Re: [Interest] HLS Streaming in Qt?

2014-10-16 Thread Mandeep Sandhu
Qt, natively does not support HLS. It'll depend on the backend that
QtMultimedia uses on a particular platform.

So check if the iOS backend supports (which it ideally should as HLS is
from Apple too). I haven't played with QtMultimedia in a while so I'm not
sure if juts passing an m3u8 url will work out of the box.

HTH,
-mandeep


On Thu, Oct 16, 2014 at 3:17 AM, Eckerle Andreas ecke...@pearl.de wrote:

  Dear all,



 I would like to make an app for iOS and android featuring a HLS stream.



 Does Qt support HLS streaming maybe using a QML component?

 Especially on Android HLS support seems to be limited with Android
 versions below 4.4 so just opening a webView and using HTML5 video object
 will probably not work with many devices running with android 4.1 -4.3



 Does maybe someone knows a link to an example of how to do HLS streaming
 with Qt?



 Thanks and best regards,

 Andreas



 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Parallel state and local transactions issue

2014-10-14 Thread Mandeep Sandhu

 For both GUI and Controller parallel states, local transactions are used.
 Local transactions are a particular type of transactions which means that
 any sub-state contained in the source state can reach the target state, and
 this is represented by the First state's incoming arrow. Its a
 specification suitable to reduce the number of transactions, like parallel
 states.
 So, as you can see, for both GUI and Controller, the First state is
 reachable from any parallel substate.
 The problem is that whenever I trigger this transaction, the specific
 parallel state exits (which may be correct), but even its container exits
 (Parallel-container), causing exiting even for the other parallel state
 (which is not a good behavior imho).


Exiting parallel state when any of the 'sibling' state exists is, IMO, as
per the hierarchical statechart specs (CMIIW).

Although, it's still not clear to me from your diagram as to how do you do
a transition from, say, 'third' state to 'first' state. If the the arrows
are representing transitions, I see a transition set on the GUI state
(which should be parent of all 3 states within it) whose target state is
'first'. I assume you're sending an event which triggers _this_ transition?
Is GUI also the top-level parallel state?

It'll be good if you can send a small example showing the implementation of
this diagram. That way we can see how the various transitions have been set.

HTH,
-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Parallel state and local transactions issue

2014-10-13 Thread Mandeep Sandhu
From your state machine (SM) diagram it's not clear how GUI SM transitions
from 'third' to 'first' state. Do you have a transition from third state to
first state?

Note, if you're exiting _any_ of the parallel SMs and then re-entering it
(which seems to be your case), then ALL parallel SMs will exit and
re-enter. This might explain why the controller SM is ending up in first
state when you exit the GUI SM.

HTH,
-mandeep


On Mon, Oct 13, 2014 at 3:32 AM, Alessandro Lonardi 
alessandro.lona...@edalab.it wrote:

 Hi,
 I'm having a trouble with a state machine particular case (using Qt 5.3).
 My state machine has two parallel macro-states. One is meant to model the
 GUI evolution, the other one is meant to model the controller evolution.
 Since in both states there's a complex structure, for practicability, I use
 a local transition to reach some important states from any other states.
 I've provided a simplified schematic at http://gdurl.com/l9km. As you see
 for both Controller and GUI sub-states, the first state is reachable from
 any other state.
 Using this state machine structure, whenever a local transition triggers,
 it will cause an exit() from the Parallel-container state, resetting the
 other independent parallel state. For instance, with reference to the
 proposed example, suppose to be in Controller's Second state and in the GUI
 Third state. If the GUI local transaction is triggered (to reach its First
 state), even for the Controller parallel state that happens, since the
 Parallel-Container for some reason exits and re-enters in itself (which
 should not happen since the local transactions doesn't start from it).
 In order to make the thing working anyway, I've made a wrapper state for
 each parallel state (i.e. GUI-wrapper and Controller-wrapper), which
 intercepts the exit, without involving the other parallel states into a
 reset a caused by a global Parallel-container exiting and re-entering.
 I think that this is an issue worthy of discussion.

 Hope that helps, and thanks in advance for any clearance.
 Alessandro.

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] problem converting QVariant UserType to Int

2014-08-26 Thread Mandeep Sandhu

 Output:
 =
 UserTypeClass ctor 0x7fff6aa02710 3 - 3
 UserTypeClass copy 0x7fff6aa02710 to 0x194eb20 3 (UserType copied into
 QVariant)
 UserTypeClass::toInt 0x7fff6aa026f0 false 26537440 (1st conversion
 failed, where did 26537440 come from?)

Seems like uninitialized value from a THIRD UserTypeClass @
0x7fff6aa026f0. I'm curious as to where this 3rd object came from?!

 UserTypeClass::toInt 0x194eb20 true 3 (second attempt seems correct, I
 expect 3.)
 main(): value = 3
 =

 The call to value.toInt(b) in main generates a call to
 QVariant::qNumVariantToHelper, which can do 2 attempts to make the
 conversion, both of which call back to UserTypeClass::toInt():

 from QVariant.cpp:

 template typename T
 inline T qNumVariantToHelper(const QVariant::Private d,
 const HandlersManager handlerManager, bool *ok, const T val)
 {
 ...some code omitted...

 T ret = 0;
 if ((d.type = QMetaType::User || t = QMetaType::User)
  QMetaType::convert(val, d.type, ret, t)) {
 return ret;
 }

 if (!handlerManager[d.type]-convert(d, t, ret, ok)  ok)
 *ok = false;
 return ret;
 }


 The first conversion attempt fails because UserTypeClass::toInt() finds
 m_Data  3. I had to contrive that restriction to demonstrate the
 problem. Since I am able to return false, the second conversion is tried
 next and it turns out to be the correct one. Note that 'this' from the
 copy of UserTypeClass (line 2 of output) is the same as 'this' from the
 second attempt at conversion (line 4 of output).

 Am I doing this correctly? What is the difference between the two
 conversion attempts in QVariant::qNumVariantToHelper?


 Thanks,

 glenn
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Gstreamer support

2014-08-08 Thread Mandeep Sandhu
On Fri, Aug 8, 2014 at 8:00 AM, Nikos Chantziaras rea...@gmail.com wrote:
 On 08/08/14 17:46, pritam.ghang...@gmail.com wrote:
 Got that working. Configure script looks for Gstreamer only if phonon is
 enabled.

 Video through Phonon might not be the best experience. You might want to
 look into QtGStreamer instead. it's provides by GStreamer itself:

http://gstreamer.freedesktop.org/modules/qt-gstreamer.html

 I had much more success with it than with Phonon and got very solid
 video playback. Phonon video, especially in Qt 4, is extremely glitchy.

Unlike Phonon, which is a multimedia framework with different backends
(one of which is GStreamer) QtGstreamer is a Qt binding for Gstreamer
and provides all the low level access you'd expect when using
GStreamer directly. I would say its a tad cumbersome to use, but you
get full control over everything and IMO better suited for embedded
systems.

-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Gstreamer support

2014-08-07 Thread Mandeep Sandhu
On Thu, Aug 7, 2014 at 7:38 AM, pritam.ghang...@gmail.com
pritam.ghang...@gmail.com wrote:
 Hi

 I am compiling Qt for an embedded broadcom 97405 platform.
 Final target is to get html5 video tag working.

 The whole build system and paltfrom is a little dated and I am stuck with qt
 4.8.1
 Intially I was getting

 GStreamer support : no in configure output

You can add '-v' option to configure and see which test is failing
that results in this output. From there it should just be matter of
seeing the test program and figuring out what it needs.

HTH,
-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Can't download file with QNetworkAccessManager: connection closed

2014-06-08 Thread Mandeep Sandhu
On Sun, Jun 8, 2014 at 4:08 PM, Nikos Chantziaras rea...@gmail.com wrote:
 On 08/06/14 07:48, Thiago Macieira wrote:
 Em dom 08 jun 2014, às 06:05:20, Nikos Chantziaras escreveu:
 It fails even without the redirection. I only used sf.net instead of
 sourceforge.net in order to make the code smaller for posting here. So
 this will also fail:

 QNetworkRequest request(QUrl(http://qtads.sourceforge.net/COPYING;));

 I can reproduce it here. Traffic sniffing and strace reveal it's a server 
 bug. The
 server closed the connection.
[...]
 $ curl -A Mozilla/5.0 http://qtads.sourceforge.net/COPYING
 curl: (56) Recv failure: Connection reset by peer

 Like I said, server bug.

 Thanks, Thiago. It seems Mozilla/5.0 is the only user-agent this happens
 with. Could it be that there's some reason to reject connections with
 that user-agent? If yes, it might be a good idea to change the default
 user-agent set by Qt.

I thought Mozilla/5.0 was used to specifically _avoid_ such issues!!
Ironically it seems to be the cause of one now!

-mandeep


 I reported this in SF's tracker:

https://sourceforge.net/p/forge/site-support/7857/

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] BUG? QTimer in QThread

2014-05-13 Thread Mandeep Sandhu
On Tue, May 13, 2014 at 5:33 PM, Filip Piechocki fpiecho...@gmail.com wrote:
 I would like to mention, that in the first email the thread is never started
 and without starting the thread I would not expect much to happen in this
 thread :)

I was about to say the same! :)

-mandeep



 BR,
 Filip Piechocki


 On Tue, May 13, 2014 at 2:00 PM, Mandeep Sandhu
 mandeepsandhu@gmail.com wrote:

  Thanks Mandeep, the problem was caused by the timer starting in the
  constructor and then moved by moveToThread, as André pointed out. I
  don't
  really understand why is it so, but well, it works :)

 I'm glad it worked for you, although the example I sent you starts the
 timer in the c'tor only (and later moveTothread is called) and still
 works. Could it be a Qt-on-Mac issue (maybe you can compile my example
 on your setup and test)?

 -mandeep

 
 
  Thanks!
 

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Debugging tip for QNetworkReply

2014-05-06 Thread Mandeep Sandhu
On Tue, May 6, 2014 at 12:43 AM, Jason Kretzer ja...@gocodigo.com wrote:
 Turns out, a bug on the portal.  However, I would not have seen that had 
 someone not mentioned looking at the logs for portal.  It was a bug where 
 under certain

You can actually. Just look for the
QNetworkRequest::HttpStatusCodeAttribute in the incoming reply. It'll
have the HTTP status code (in your case this would've been 302).

-mandeep




circumstances a redirect is issued(302).

 Thank you every one.

 -Jason

 ////
 Jason R. Kretzer
 Lead Application Developer
 ja...@gocodigo.com
 606.792.0079
 ////

 On May 5, 2014, at 3:40 AM, Mandeep Sandhu mandeepsandhu@gmail.com 
 wrote:

 So there's a sizable difference between the file that works (600KB)
 and the one that doesn't (55MB).

 * Could it be a memory issue on your system? Have you tested higher
 sizes after which it starts failing?
 * What does reply-error() return when this problem occurs (you had
 mentioned the error 'string', but not the exact error code)?
 * Does the webserver run on the same machine or is it over the network?
 * What HTTP status code does the webserver respond with for the failed
 request (it'll probably be there in the logs)

 If it's possible, you could run a packet sniffer and check which side
 (client or server) closes the connection first.

 Also, it's best to check reply-error() before proceeding to write the file.

 HTH,
 -mandeep


 On Mon, May 5, 2014 at 1:12 AM, Jason Kretzer ja...@gocodigo.com wrote:
 Windows 7 Professional
 Qt V5.2.1
 Mime is application/zip
 -- will check on the logs and get back
 Size of the zip that works is ~600kb.

 -Jason

 -Original Message-
 From: Mandeep Sandhu [mailto:mandeepsandhu@gmail.com]
 Sent: Sunday, May 04, 2014 3:25 AM
 To: Jason Kretzer
 Cc: Thiago Macieira; interest@qt-project.org
 Subject: Re: [Interest] Debugging tip for QNetworkReply

 A couple of questions to help debug further.

 * What platform are you running this on and what's the version of Qt?
 * What is the MIME type set by the webserver when responding to your 
 request (you can check it by dumping the headers received)
 * According to the webserver logs, how much data was returned for the 
 problematic zip file?
 * Whats the size of the zip that works?


 -mandeep


 On Sat, May 3, 2014 at 11:47 PM, Jason Kretzer ja...@gocodigo.com wrote:
 The zip that fails and is unreadable is a 1k file.  The zip that I am 
 attempting to download is ~55MB.  The 1k zip also cannot be opened by a 
 zip program nor a text editor.  Is there a way I can tell what the failure 
 is?  Perhaps, I can use wireshark to see the traffic and see the http 
 response codes from the server. They should be 200, I would think since I 
 can use a browser and get the zip(s) that way.  Perhaps a way to look 
 through the request/reply objects to see what is going on?

 -Jason

 -Original Message-
 From: interest-bounces+jason=gocodigo@qt-project.org
 [mailto:interest-bounces+jason=gocodigo@qt-project.org] On Behalf
 Of Thiago Macieira
 Sent: Friday, May 02, 2014 5:05 PM
 To: interest@qt-project.org
 Subject: Re: [Interest] Debugging tip for QNetworkReply

 Em sex 02 maio 2014, às 10:45:16, Jason Kretzer escreveu:
 I am using the following code to download zip files from a url.  The
 only thing that changes is the “id” in the url(one for each zip).
 Anyway, the code always works on one of the zip files, but never
 works on the other.  Both zips are on the server.  Both zips are
 downloadable, if I access the url(s) from a web browser.  What I am
 looking for is primarily direction on how to go about effectively
 debugging this.  I tried using
 reply-errorString() right after loop.exec() — but it returns only
 reply-“Unknown
 Error” whether the download is successful or not.  It should also be
 noted that on failure a file is created but is not a readable zip file.

 Why is it not readable? Is the file too short? Is it corrupted? Please 
 compare the result with what was supposed to be there.

 --
 Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Debugging tip for QNetworkReply

2014-05-05 Thread Mandeep Sandhu
So there's a sizable difference between the file that works (600KB)
and the one that doesn't (55MB).

* Could it be a memory issue on your system? Have you tested higher
sizes after which it starts failing?
* What does reply-error() return when this problem occurs (you had
mentioned the error 'string', but not the exact error code)?
* Does the webserver run on the same machine or is it over the network?
* What HTTP status code does the webserver respond with for the failed
request (it'll probably be there in the logs)

If it's possible, you could run a packet sniffer and check which side
(client or server) closes the connection first.

Also, it's best to check reply-error() before proceeding to write the file.

HTH,
-mandeep


On Mon, May 5, 2014 at 1:12 AM, Jason Kretzer ja...@gocodigo.com wrote:
 Windows 7 Professional
 Qt V5.2.1
 Mime is application/zip
 -- will check on the logs and get back
 Size of the zip that works is ~600kb.

 -Jason

 -Original Message-
 From: Mandeep Sandhu [mailto:mandeepsandhu@gmail.com]
 Sent: Sunday, May 04, 2014 3:25 AM
 To: Jason Kretzer
 Cc: Thiago Macieira; interest@qt-project.org
 Subject: Re: [Interest] Debugging tip for QNetworkReply

 A couple of questions to help debug further.

 * What platform are you running this on and what's the version of Qt?
 * What is the MIME type set by the webserver when responding to your request 
 (you can check it by dumping the headers received)
 * According to the webserver logs, how much data was returned for the 
 problematic zip file?
 * Whats the size of the zip that works?


 -mandeep


 On Sat, May 3, 2014 at 11:47 PM, Jason Kretzer ja...@gocodigo.com wrote:
 The zip that fails and is unreadable is a 1k file.  The zip that I am 
 attempting to download is ~55MB.  The 1k zip also cannot be opened by a zip 
 program nor a text editor.  Is there a way I can tell what the failure is?  
 Perhaps, I can use wireshark to see the traffic and see the http response 
 codes from the server. They should be 200, I would think since I can use a 
 browser and get the zip(s) that way.  Perhaps a way to look through the 
 request/reply objects to see what is going on?

 -Jason

 -Original Message-
 From: interest-bounces+jason=gocodigo@qt-project.org
 [mailto:interest-bounces+jason=gocodigo@qt-project.org] On Behalf
 Of Thiago Macieira
 Sent: Friday, May 02, 2014 5:05 PM
 To: interest@qt-project.org
 Subject: Re: [Interest] Debugging tip for QNetworkReply

 Em sex 02 maio 2014, às 10:45:16, Jason Kretzer escreveu:
 I am using the following code to download zip files from a url.  The
 only thing that changes is the “id” in the url(one for each zip).
 Anyway, the code always works on one of the zip files, but never
 works on the other.  Both zips are on the server.  Both zips are
 downloadable, if I access the url(s) from a web browser.  What I am
 looking for is primarily direction on how to go about effectively
 debugging this.  I tried using
 reply-errorString() right after loop.exec() — but it returns only
 reply-“Unknown
 Error” whether the download is successful or not.  It should also be
 noted that on failure a file is created but is not a readable zip file.

 Why is it not readable? Is the file too short? Is it corrupted? Please 
 compare the result with what was supposed to be there.

 --
 Thiago Macieira - thiago.macieira (AT) intel.com
   Software Architect - Intel Open Source Technology Center

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Debugging tip for QNetworkReply

2014-05-04 Thread Mandeep Sandhu
A couple of questions to help debug further.

* What platform are you running this on and what's the version of Qt?
* What is the MIME type set by the webserver when responding to your
request (you can check it by dumping the headers received)
* According to the webserver logs, how much data was returned for the
problematic zip file?
* Whats the size of the zip that works?


-mandeep


On Sat, May 3, 2014 at 11:47 PM, Jason Kretzer ja...@gocodigo.com wrote:
 The zip that fails and is unreadable is a 1k file.  The zip that I am 
 attempting to download is ~55MB.  The 1k zip also cannot be opened by a zip 
 program nor a text editor.  Is there a way I can tell what the failure is?  
 Perhaps, I can use wireshark to see the traffic and see the http response 
 codes from the server. They should be 200, I would think since I can use a 
 browser and get the zip(s) that way.  Perhaps a way to look through the 
 request/reply objects to see what is going on?

 -Jason

 -Original Message-
 From: interest-bounces+jason=gocodigo@qt-project.org 
 [mailto:interest-bounces+jason=gocodigo@qt-project.org] On Behalf Of 
 Thiago Macieira
 Sent: Friday, May 02, 2014 5:05 PM
 To: interest@qt-project.org
 Subject: Re: [Interest] Debugging tip for QNetworkReply

 Em sex 02 maio 2014, às 10:45:16, Jason Kretzer escreveu:
 I am using the following code to download zip files from a url.  The
 only thing that changes is the “id” in the url(one for each zip).
 Anyway, the code always works on one of the zip files, but never works
 on the other.  Both zips are on the server.  Both zips are
 downloadable, if I access the url(s) from a web browser.  What I am
 looking for is primarily direction on how to go about effectively
 debugging this.  I tried using
 reply-errorString() right after loop.exec() — but it returns only
 reply-“Unknown
 Error” whether the download is successful or not.  It should also be
 noted that on failure a file is created but is not a readable zip file.

 Why is it not readable? Is the file too short? Is it corrupted? Please 
 compare the result with what was supposed to be there.

 --
 Thiago Macieira - thiago.macieira (AT) intel.com
   Software Architect - Intel Open Source Technology Center

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] One MediaPlayer on two VideoOutput elements?

2014-05-02 Thread Mandeep Sandhu
On Fri, May 2, 2014 at 12:52 PM, Neuer User auslands...@gmx.de wrote:
 Just wanted to try out the QmlVideoTee example, but it seems I am
 missing something:

 qabstractvideosurface.h: No such file or directory
  #include qabstractvideosurface.h

Try this instead:

#include QAbstractVideoSurface

Qt headers that users use are w/o the .h suffix.

HTH,
-mandeep


^

 Where do I find that file?

 Cheers

 Michael

 Am 30.04.2014 17:22, schrieb Lopes Yoann:
 On Apr 30, 2014, at 12:36 PM, Neuer User wrote:

 Hi

 I need to show an RTSP video played by a MediaPlayer element on two
 different VideoOutput elements. I can't get it to work. Only the last
 VideoOutput in the code works.

 Am I doing something wrong? Or is this just not expected to work? If so,
 how should I achieve this? I don't want to use shader elements as this
 certainly reduces performance a lot.

 It's currently a limitation. The fact that it can be done in QML is 
 misleading, it's more clear with the C++ API where you can only set a video 
 output on a media source, and not the other way around.
 We should support this in a future release, it doesn't involve many changes.

 In the meantime the easiest solution, as you mentioned, is to use the 
 ShaderEffect element.

 There are other (hack-ish) solutions to do this but it requires more work. 
 Here's an example doing just that: https://github.com/marseyeah/QmlVideoTee



 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] One MediaPlayer on two VideoOutput elements?

2014-05-02 Thread Mandeep Sandhu
Replying to the list...

On Fri, May 2, 2014 at 2:43 PM, Neuer User auslands...@gmx.de wrote:
 Am 02.05.2014 11:04, schrieb Mandeep Sandhu:
 On Fri, May 2, 2014 at 12:52 PM, Neuer User auslands...@gmx.de wrote:
 Just wanted to try out the QmlVideoTee example, but it seems I am
 missing something:

 qabstractvideosurface.h: No such file or directory
  #include qabstractvideosurface.h
 Try this instead:

 #include QAbstractVideoSurface

 Qt headers that users use are w/o the .h suffix.

 HTH,
 -mandeep

 Thanks. I just got it working by adding:

 QT += qml multimedia

 to the .pro file.

 What would be the preferred solution? This way or your suggestion?

Both actually! :) The module include that you did (QT += ...) is a
MUST as that tells qmake which other 'extension' modules your app
needs (for linking and header includes). By default only the QtCore
and QtGui are part of the QT config.

As for the include header, it's standard practice in Qt application
code to include C++ style headers (i.e w/o .h suffix) and use the
camel-case notation for header name.

HTH,
-mandeep



^

 Where do I find that file?

 Cheers

 Michael

 Am 30.04.2014 17:22, schrieb Lopes Yoann:
 On Apr 30, 2014, at 12:36 PM, Neuer User wrote:

 Hi

 I need to show an RTSP video played by a MediaPlayer element on two
 different VideoOutput elements. I can't get it to work. Only the last
 VideoOutput in the code works.

 Am I doing something wrong? Or is this just not expected to work? If so,
 how should I achieve this? I don't want to use shader elements as this
 certainly reduces performance a lot.
 It's currently a limitation. The fact that it can be done in QML is 
 misleading, it's more clear with the C++ API where you can only set a 
 video output on a media source, and not the other way around.
 We should support this in a future release, it doesn't involve many 
 changes.

 In the meantime the easiest solution, as you mentioned, is to use the 
 ShaderEffect element.

 There are other (hack-ish) solutions to do this but it requires more work. 
 Here's an example doing just that: https://github.com/marseyeah/QmlVideoTee


 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QNAM timeout is way too long

2014-04-21 Thread Mandeep Sandhu
On Mon, Apr 21, 2014 at 10:58 PM, Scott Aron Bloom
scott.bl...@onshorecs.com wrote:
 I have code, that sends a http request via  QNetworkAccessManager.
 Unfortunately, there are times, where the network on the machine will be up,
 but the connection to the internet is down.. Or the internet is up, but the
 backend server is down.  Meaning, there is no way for my application to
 “know” don’t bother trying to connect.

If you're running on a Linux system, you could try changing the
default TCP timeout by changing /proc/sys/net/ipv4/tcp_syn_retries or
/proc/sys/net/ipv4/tcp_keepalive_time depending on what stage you're
getting stuck at. Although this would be a platform specific hack and
would affect other applications too.

-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Which thread implementation is best to trigger external library via timers

2014-04-10 Thread Mandeep Sandhu
 1. Subclassing QThread: I've read you should avoid that, so I don't really
 consider it

Not really. Search the archives, where we've had this discussion
numerous times before! :) The conclusion was that there's no 1 right
or wrong way. It has to be taken on a case-by-case basis.

 2. Move it to thread: networkWorker-moveToThread(thread);
 3. High level API's: QtConcurrent/QRunning

 The requirements are:
 - Run infinite - stop only when requested
 - Needs to run threads event loop
 - Able to call slots via queued events
 and the most critical part
 - direct function calls synchronized via Mutexes from main thread

 I've decided to use option 2 but wonder about the following two questions:
 - If I have moved NetworkWorker into its own thread, in which thread is
 QTimer running and can I be sure even when the main thread is overloaded,
 the worker thread still emits and delivers QTimer events?

I think, QTimer will run in whatever thread it's parent is in and
since NetworkWorker will parentless (for moveTothread() to work
properly) it should run in the worker thread. Though you might want to
start it _after_ moving NetworkWorker to the new thread so that timer
events are delivered to it's event loop.

 - There are some methods I still have to call from the main thread, because
 I cannot really connect them via queued signal/slots. E.g. getIP() const or
 getKnownServers() const. So I still need to call it from a place in the main
 thread to get data out of the object:
 QString ip = networkWorker-getIP();
 Is this still safe to use (of course getIP() is synchronized via a mutex) or
 are there any other cleaner solutions?

It should be ok, if the resource access is serialized with a mutex.

I couldn't gather from your explanation as to why you need an event
loop in the thread? There are no signals being emitted by the worker.
If getIP() is ok being a direct call, and if there's only the main
thread trying to set values, then I guess even setIP() could be a
direct call (serialzed access via mutex ofcourse).

Just my 2 cents.

HTH,
-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Which thread implementation is best to trigger external library via timers

2014-04-10 Thread Mandeep Sandhu
 A example looks like:
 Timer to ping the server on regular basis:
 - QTimer::timeout connected to slot sendPing();
 - when the pong is received, the signal void pongReceived is emitted, this
 can be evaluated by the application.

 But as said, there are methods in the worker, I need return data
 immediately, e.g. getKnownServers, isConnected etc.
 Your answer helped me already a lot. Thank you very much. So I'll go for
 this approach.

You've chosen the right option of moveToThread() then.

Good luck,
-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Compile a console app for the Raspberry Pi

2014-04-10 Thread Mandeep Sandhu
Have you tried the instructions here?

http://qt-project.org/wiki/RaspberryPi_Beginners_guide

HTH,
-mandeep


On Thu, Apr 10, 2014 at 5:14 PM, Petko Ditchev pditc...@gmail.com wrote:
   Hello everyone, I thinking now about how to approach the problem in
 the title. I have a small console app (a filter for mic input) that uses
 Qt libs, and I want to deploy it on the Pi. It uses some Qt5 features so
 Qt4 from the repos isn't an option. I was thinking about building it
 statically, but I'm not sure what the steps for that are (on ARM). So is
 that the process :
 1.Cross-compile Qt5 libs (with --static) to be compatible with the RPi CPU.
 2.Build the app with that Qt lib.
 3.Deploy to the Pi
 4.Benefit

 Or am I missing something?

 Petko
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Json support for Qt5 QML - code review needed

2014-04-07 Thread Mandeep Sandhu
Qt5 already has Json support in the form of QJsonDocument and co.

Do you use QJson* classes underneath as well or you've implemented
your own JSON parsing?

Couldn't JSONPath be modelled using the existing QJson* classes?

I could volunteer for reviewing too if you can point to us your repo/code.

-mandeep


On Sat, Apr 5, 2014 at 7:00 PM, Jay Sprenkle jspren...@gmail.com wrote:
 Good morning,

 I'm looking for a code review for an open source project.

 I've implemented Json support for use with Qt5 QML. It's in several parts.


 A C++ version of JsonPath. If you've used XPath then this should be
 familiar. JsonPath is XPath for JSON. QJsonPath allows selecting arbitrary
 subsets of a json object given a search string.
 A QML item to translate a JSON string, apply JsonPath and provide a Qt
 QJsonDocument.
 A QML item to take a QJsonDocument and provide a Qt list model that you can
 use with Qt's standard control ListView.


 Used together you can request data from an arbitrary web service (or file),
 pull out a subset, and display it using the Qt controls.

 The code works but I think someone with better knowledge of Qt's model/view
 system could help make it better. Any takers?

 Thanks

 Jay


 --
 --
 Psychiatrist to patient: Don't worry. You're not deluded. You only think
 you are.



 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QThread

2014-03-24 Thread Mandeep Sandhu
On Tue, Mar 25, 2014 at 2:49 AM, Alan Ezust alan.ez...@gmail.com wrote:
 If you're using Qt 5.2 or later, there is a new API you can use.

 Call isInterruptionRequested() in your loop,

  http://qt-project.org/doc/qt-5/qthread.html#isInterruptionRequested

 And call requestInterruption() from outside.

 http://qt-project.org/doc/qt-5/qthread.html#requestInterruption

 I guess this makes it possible for you to avoid the whole atomic/volatile
 thing alltogether.

Hmmm...this looks handy!

Thanks for pointing it out.

-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] dynamic library question

2014-03-18 Thread Mandeep Sandhu

 However, if KSP is enabled, the kernel might realise the pages are identical
 and drop one copy. I would recommend you don't depend on it, so simply don't
 duplicate the files.

 Doesn't KSP scan only the pages that have been explictly marked as
 mergeable via madvise? Why would the dynamic linker use such flag on
 the libraries it maps into memory? (It would be pointless in the vast
 majority of the cases except in OP's scenario?)

Just to be clear, you guys are talking about KSM (kernel samepage
merging) right?

-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Q_PROPERTY, Subclass and calling SuperClasses signal

2014-02-27 Thread Mandeep Sandhu

 https://bugreports.qt-project.org/browse/QTBUG-7684?focusedCommentId=124122page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel

 So it seems that moc can not support something that is perfectly legal to
 do?


The link you pointed out already mentions that you need to declare the
NOTIFY signal in the same class as the one declaring the property. So thats
the main issue here. I guess you will have to rejig your base class.

BTW, why would you want to have just the signal in the base class and not
the property itself? Is the base class like an interface?

-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QtProperty System

2014-02-21 Thread Mandeep Sandhu
On Fri, Feb 21, 2014 at 1:31 PM, Graham Labdon 
graham.lab...@avalonsciences.com wrote:

 Hi
 I have been reading about Qt's property system, in particular the NOTIFY
 optional specifier.
 Can NOTIFY be used with non Qml/QtQuick applications?


Yes you can.

NOTIFY is not specific to Qml, rather it's just a way of specifying a
'property changed' signal (similar to read/write functions for a property).

-mandeep




 Thanks
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] metaObject from class name

2014-02-14 Thread Mandeep Sandhu
On Fri, Feb 14, 2014 at 4:20 PM, Graham Labdon 
graham.lab...@avalonsciences.com wrote:


 Hi
 In my application I have a class name as a string
 This is the name of a class derived from QObject.
 Now what I would like to do is the get metaObject for this class from the
 string

 Is this at all possible?


I don't think that that's possible. You could store the static meta object
in hashmap with the class name as the key, but then this would require you
to know all possible class names before-hand.

HTH,
-mandeep




 Many thanks

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Brightness QT API on embedded linux

2014-02-13 Thread Mandeep Sandhu
Your screen driver for the embedded h/w should have something for it. Maybe
a sysfs interface or ioctl.

HTH,
-mandeep


On Thu, Feb 13, 2014 at 3:55 PM, Bo Thorsen bthor...@ics.com wrote:

 Den 13-02-2014 06:53, Ramakanthreddy Kesireddy skrev:
  Hi,
 
  Am current using Qt4.8.5 sdk on embedded linux using linux framebuffer
  plugin as backend.
 
  Is there any QT API to change the brightness of underlying system?

 No, unfortunately not. You have to go to Linux specific help pages for
 this.

 Bo.

 --
 Bo Thorsen, European Engineering Manager, ICS
 Meet me at our quickstarts across Europe in March.
 London, Dublin, Copenhagen, Hamburg, Munich and Zurich.
 See this page: http://ics.com/qt-quickstart
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Ip-Cam MJPEG with QT 4.8

2014-02-11 Thread Mandeep Sandhu
Do you have GStreamer ported to your particular embedded h/w?

Qt uses GStreamer for all the multimedia heavy-lifting on Linux based
systems. So if you have GStreamer plugins working for your h/w then it
should work via Qt too as thats what Qt'll be using internally.

-mandeep



On Wed, Feb 12, 2014 at 12:02 AM, Simone cjb.sw.nos...@gmail.com wrote:

 Hello,

 does somebody know how to display a video stream from an IP camera, which
 support MJPEG format?



 Is it possible with QT 4.8 ?

 My target system is an embedded linux device.



 Thanks

 Simone

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Confusion regarding Qt 5 build on Windows

2014-02-10 Thread Mandeep Sandhu
Thx Guys!

For now, I've disabled widgets too.

-mandeep


On Mon, Feb 10, 2014 at 2:36 PM, Koehne Kai kai.koe...@digia.com wrote:



  -Original Message-
  From: interest-bounces+kai.koehne=digia@qt-project.org
  [mailto:interest-bounces+kai.koehne=digia@qt-project.org] On Behalf
  Of Mandeep Sandhu
  Sent: Monday, February 10, 2014 9:57 AM
  To: Interest@qt-project.org
  Subject: Re: [Interest] Confusion regarding Qt 5 build on Windows
 
 
 
Isn't GUI as super-set of the Widgets module?

 No, widgets is a module that depends on gui.

  As in, if I don't want
  GUI, I don't want Widgets too, right? I was expecting both to be
 disabled.
  What am I missing here?

 Nothing, just that the Windows configure is apparently missing a sanity
 check here, i.e.

 https://codereview.qt-project.org/#change,77762

  Apparently, I was missing somethingthe -no-widgets option. I think
 I
  forgot that in the new modularized structure of Qt, widgets is a separate
  module.
 
 
  But still, shouldn't the QWidgets headers be generated? Or is -no-gui
 with
  widgets enabled not a valid option?

 It's not a valid option. I guess that is sanity checked in the qmake logic
 somewhere, otherwise the build should've failed much before the autotests :)

 Regards

 Kai

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] https://github.com/ayoy/qoauth support OAuth2?

2014-02-09 Thread Mandeep Sandhu
On Sun, Feb 9, 2014 at 1:16 PM, tangk ta...@lemote.com wrote:

 hi all:
 The package with https://github.com/ayoy/qoauth support OAuth2.0
 protocol or OAuth1?


It looks like this supports only OAuth 1.

Have a look at O2, which has support for OAuth 2 and specialization classes
for Facebook, Twitter etc which makes connecting to these services very
easy.

https://github.com/pipacs/o2

HTH,
-mandeep



 thanks very much.
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] New window in Qt makes the application activate

2014-02-03 Thread Mandeep Sandhu

 As part of a (partly mistaken) emulation of some ancient Macintosh API's I
 was calling QWidget::activateWindow(). If the application is not active,
 that both makes the window active, and it makes the application active. I
 guess it's debatable whether activateWindow() should activate the
 application. I expected that it would just make the window the active
 window (painted with active appearance, ready to accept focus, title bar
 buttons with active appearance, etc.) or ready to be the active window when
 the application activated. The application can be activated via a click in
 the Dock icon, which doesn't select a window to be the active window, so
 whatever was active (or made active when the application is not active?)
 previously now becomes the active window.


Wow...so much active-ity in this para! :) Maybe we can refer this to the
Guinness Records for the most number of occurrences of a word! :P

BTW, thanks for sharing the solution.

-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QEventLoop -- not sure I am correctly using this

2013-12-04 Thread Mandeep Sandhu

 //now some condition occurs, I want the worker on the inside to start
 doing its thing
 manager-startWorker();


I assume your worker object (which runs inside another thread) will have
public slots to start/stop its work.

If so, you can either connect a signal from the main thread to these slots
or use the invokeMethod API to call these slots on some event. Since the
worker object resides in a different thread, your slot invocation will be
queued and will get run in the worker thread's context.

HTH,
-mandeep




 …
 …
 …
 //now some other condition occurs, I want the worker on the inside to stop
 doing its thing
 manager-stopWorker();


 Alternatively, through the signal/slot mechanism.  Regardless, will the
 above pull it out of its thread?

 Thanks,

 -Jason

 *- - - - - - - - - - - - - - - - - - - - - - -*
 *Jason R. **Kretzer*

 *Application Developer*
 *Google # 606-887-9011 606-887-9011*
 *Cell # 606-792-0079 606-792-0079*
 *ja...@gocodigo.com ja...@gocodigo.com*

 *“quidquid latine dictum sit altum videtur”*



 On Dec 4, 2013, at 12:46 AM, Mandeep Sandhu mandeepsandhu@gmail.com
 wrote:


 On Tue, Dec 3, 2013 at 10:39 PM, Jason Kretzer ja...@gocodigo.com wrote:

 Ah, I see!  Now I understand what you mean.

 I rewrote my “player” object to use a Qtimer that fires every 1 second
 and is started/stopped according to signals.  However, it still has the
 same problem where the timer won’t fire sometimes for extended periods.  I
 guess that means something in the overall eventloop is blocking it.  So, I
 believe I will try to implement it in the worker kind of format you have
 below where I can put the timer in a thread.


 Also, as Thiago already suggested, while you're debugging, print out the
 thread ID from the worker thread and main thread objects just so that you
 know that they're running in different threads.

 -mandeep




 I appreciate the help!

 -Jason

  *- - - - - - - - - - - - - - - - - - - - - - -*
 *Jason R. **Kretzer*

 *Application Developer*
 *Google # 606-887-9011 606-887-9011*
 *Cell # 606-792-0079 606-792-0079*
 *ja...@gocodigo.com ja...@gocodigo.com*

 *“quidquid latine dictum sit altum videtur”*


 image001.png

 On Dec 2, 2013, at 11:58 PM, Mandeep Sandhu mandeepsandhu@gmail.com
 wrote:

 Hi Jason,


 As Andre pointed out, have an 'outer' class manage the worker object
 and thread for you instead of doing it from within your worker.

 Eg:

 SomeManagerClass::SomeManagerClass(QObject *parent) : QObject(parent)
 {
worker = new MyWorker(); // parentless
workerThread = new QThread(); // parentless

// Move worker object to new thread
worker-moveToThread(workerThread);

connect(worker, SIGNAL(workFinished()), this, SLOT(onWorkFinished()));

workerThread-start();
 }
 ...
 ...
 SomeManagerClass::~SomeManagerClass()
 {
workerThread-quit();
workerThread-wait();
 }

 As for you event loop, I don't see any obvious issues.

 I guess the reason you decided to wait for 1 second using an ev loop,
 rather than have a slot handle the timeout was to make the code look
 simple (synchronous)?

 What platform are you running this on?

 -mandeep


 On Tue, Dec 3, 2013 at 1:59 AM,  an...@familiesomers.nl wrote:

 Hi,

 It looks to me, that you're indeed doing it wrong. It seems you're
 trying to let your backgroundtaskmanager both manage a thread and be
 _in_ that thread. That is not the way to go. I'd separate the two
 issues. If you want the backgroundTaskManager to run in it's own thread,
 then either just make it a front for a backend implementation that you
 move to a thread managed by backgroundTaskManager, or just let let the
 whole backgroundTaskManager be unconcerned with what thread it runs in,
 and have whoever creates/owns/manages it be responsible for moving it to
 a separate thread if that is desirable.

 Then about your use of QEventLoop: no, I'd not use it this way.
 QEventLoop is not meant as an escape to 'pause' execution of your
 method. If you want to wait for about a minute, why not use a QTimer
 directly? I don't see a need for QEventLoop here at all.

 As to why your setup doesn't work and your eventloop seems blocked
 during your background task: I guess you gave your BackgroundTaskManager
 a parent object? That won't work. A whole parent/child tree must live in
 the same thread. So, I guess your BackgroundTaskManager did not actually
 get moved to the thread at all.

 André


 Jason Kretzer schreef op 02.12.2013 20:27:

 Maybe that last bit would be a bit more clear.

 The first qDebug statement writes out — I have it set to give the
 time when it is written as well — but the qDebug does not write
 until after the heavy task is completed in backgroundtaskmanager. Any
 other time, this performs as expected, ticking along every second.

 -Jason

 _- - - - - - - - - - - - - - - - - - - - - - -_
 _JASON R. __KRETZER_
 _ _
 _APPLICATION DEVELOPER_
 _Google # 606-887-9011_
 _Cell # 606-792-0079_
 _Jason@gocodigo.com_
 _ _
 _“QUIDQUID

Re: [Interest] QEventLoop -- not sure I am correctly using this

2013-12-03 Thread Mandeep Sandhu
On Tue, Dec 3, 2013 at 10:39 PM, Jason Kretzer ja...@gocodigo.com wrote:

 Ah, I see!  Now I understand what you mean.

 I rewrote my “player” object to use a Qtimer that fires every 1 second and
 is started/stopped according to signals.  However, it still has the same
 problem where the timer won’t fire sometimes for extended periods.  I guess
 that means something in the overall eventloop is blocking it.  So, I
 believe I will try to implement it in the worker kind of format you have
 below where I can put the timer in a thread.


Also, as Thiago already suggested, while you're debugging, print out the
thread ID from the worker thread and main thread objects just so that you
know that they're running in different threads.

-mandeep




 I appreciate the help!

 -Jason

 *- - - - - - - - - - - - - - - - - - - - - - -*
 *Jason R. **Kretzer*

 *Application Developer*
 *Google # 606-887-9011 606-887-9011*
 *Cell # 606-792-0079 606-792-0079*
 *ja...@gocodigo.com ja...@gocodigo.com*

 *“quidquid latine dictum sit altum videtur”*



 On Dec 2, 2013, at 11:58 PM, Mandeep Sandhu mandeepsandhu@gmail.com
 wrote:

 Hi Jason,


 As Andre pointed out, have an 'outer' class manage the worker object
 and thread for you instead of doing it from within your worker.

 Eg:

 SomeManagerClass::SomeManagerClass(QObject *parent) : QObject(parent)
 {
worker = new MyWorker(); // parentless
workerThread = new QThread(); // parentless

// Move worker object to new thread
worker-moveToThread(workerThread);

connect(worker, SIGNAL(workFinished()), this, SLOT(onWorkFinished()));

workerThread-start();
 }
 ...
 ...
 SomeManagerClass::~SomeManagerClass()
 {
workerThread-quit();
workerThread-wait();
 }

 As for you event loop, I don't see any obvious issues.

 I guess the reason you decided to wait for 1 second using an ev loop,
 rather than have a slot handle the timeout was to make the code look
 simple (synchronous)?

 What platform are you running this on?

 -mandeep


 On Tue, Dec 3, 2013 at 1:59 AM,  an...@familiesomers.nl wrote:

 Hi,

 It looks to me, that you're indeed doing it wrong. It seems you're
 trying to let your backgroundtaskmanager both manage a thread and be
 _in_ that thread. That is not the way to go. I'd separate the two
 issues. If you want the backgroundTaskManager to run in it's own thread,
 then either just make it a front for a backend implementation that you
 move to a thread managed by backgroundTaskManager, or just let let the
 whole backgroundTaskManager be unconcerned with what thread it runs in,
 and have whoever creates/owns/manages it be responsible for moving it to
 a separate thread if that is desirable.

 Then about your use of QEventLoop: no, I'd not use it this way.
 QEventLoop is not meant as an escape to 'pause' execution of your
 method. If you want to wait for about a minute, why not use a QTimer
 directly? I don't see a need for QEventLoop here at all.

 As to why your setup doesn't work and your eventloop seems blocked
 during your background task: I guess you gave your BackgroundTaskManager
 a parent object? That won't work. A whole parent/child tree must live in
 the same thread. So, I guess your BackgroundTaskManager did not actually
 get moved to the thread at all.

 André


 Jason Kretzer schreef op 02.12.2013 20:27:

 Maybe that last bit would be a bit more clear.

 The first qDebug statement writes out — I have it set to give the
 time when it is written as well — but the qDebug does not write
 until after the heavy task is completed in backgroundtaskmanager. Any
 other time, this performs as expected, ticking along every second.

 -Jason

 _- - - - - - - - - - - - - - - - - - - - - - -_
 _JASON R. __KRETZER_
 _ _
 _APPLICATION DEVELOPER_
 _Google # 606-887-9011_
 _Cell # 606-792-0079_
 _Jason@gocodigo.com_
 _ _
 _“QUIDQUID LATINE DICTUM SIT ALTUM VIDETUR”_
 _ _

 On Dec 2, 2013, at 2:14 PM, Jason Kretzer ja...@gocodigo.com wrote:

 Good Day,

 I have in my application, two classes. When the application starts
 up, one of the classes -backgroundtaskmanager - gets instantiated.
 In the constructor, a QTimer is started to timeout every 5 minutes
 and call runTasks. The instantiation is then moved to a separate
 thread so that it can run without impacting the rest of the
 application.

 Here are the contents of the constructor.

 QTimer* timer = new QTimer(this);
 connect(timer, SIGNAL(timeout()), this, SLOT(runTasks()));
 timer-start(30); //fiveminutes
 thread = new QThread();
 this-moveToThread(thread);
 thread-start();

 The second class -player- is instantiated in the main thread. Once
 it is instantiated, it begins doing other tasks. Basically, a method
 is called with the following code. This code is designed to make the
 while loop delay for one second before executing the rest of the
 loop (one second-ish, I know it is not perfect but it has good
 enough resolution for what I need).

 while(!taskQueue.isEmpty()) {
 qDebug()  “BEFORE

Re: [Interest] QNetworkAccessManager and HTTP persistent connection

2013-11-28 Thread Mandeep Sandhu
On Thu, Nov 28, 2013 at 12:26 PM, iMath 2281570...@qq.com wrote:
 Thank you for your prompt!
 I think I should give my question a clear description.
 The Connection:keep-alive  is in the  reply header, when I call close() of
 the reply, the connection is still on ,I wonder how can I send a second
 request to the server using this connection in such  case ?

 If I just simply make a second request like the following

  manager-get(QNetworkRequest(QUrl(url)));

Are you sending your next request to the same host or a different one?
And if it's a different one is it the first request to that host?

-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QNetworkAccessManager and HTTP persistent connection

2013-11-27 Thread Mandeep Sandhu
Please reply to the whole list and not to me individually. Maybe
someone on this list might have a more specific answer.

Both pipelined and persistent connections use a single TCP connection.

But in pipelining, the client can send multiple requests WITHOUT
WAITING for a response from the server whereas in persistent
connections the second (or subsequent) responses are sent only after
receiving response of the previous request:
http://en.wikipedia.org/wiki/HTTP_pipelining

If the server has not sent a Connection: Close then closing the
connection from the client _might_ to be a bug.

How are you ascertaining that the client is initiating the close? Does
the packet sniffer show the client sending a FIN packet?

-mandeep



On Wed, Nov 27, 2013 at 12:21 PM, iMath 2281570...@qq.com wrote:
 HTTP persistent connection, also called HTTP keep-alive, or HTTP connection
 reuse, is the idea of using a single TCP connection to send and receive
 multiple HTTP requests/responses, as opposed to opening a new connection for
 every single request/response
 pair.(http://en.wikipedia.org/wiki/HTTP_persistent_connection)

 Connection:keep-alive  is in the  response header.

  I want to send my a second http request using the same connection that was
 setup when the first HTTP request was made. how can this be achieved through
 Qt?


 -- Original --
 From:  Mandeep Sandhu;mandeepsandhu@gmail.com;
 Date:  Tue, Nov 26, 2013 08:50 PM
 To:  iMath2281570...@qq.com;
 Cc:  Interest@qt-project.orginterest@qt-project.org;
 Subject:  Re: [Interest] QNetworkAccessManager and HTTP persistent
 connection

 I think I was wrong in telling you that HTTP persistent connection was
 same as HTTP pipelining. They aren't.

 In HTTP pipelining multiple HTTP requests can be made w/o waiting for
 response of each connection. Whereas in HTTP persistent connection
 (default as you said in HTTP 1.1), the same TCP connection is used for
 sending HTTP request one-after-another.

 Can you check if the the outgoing HTTP request has the Connection:
 keep-alive set in its (HTTP) header. Also, I've read that sometimes
 webservers will send a Connection: Close header in its response in
 which case the client will close it's connection, so check if the
 webserver is playing nice with your request. Which webserver are you
 testing against?

 HTH,
 -mandeep



 On Tue, Nov 26, 2013 at 5:19 PM, iMath 2281570...@qq.com wrote:
 unfortunately ,it doesn't work on Qt4/WinXP
 I have set
 request.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute,
 true);

 but the attribute QNetworkRequest::HttpPipeliningWasUsedAttribute in the
 reply is false .
 -- Original --
 From:  Mandeep Sandhu;mandeepsandhu@gmail.com;
 Date:  Tue, Nov 26, 2013 02:14 PM
 To:  iMath2281570...@qq.com;
 Cc:  interestinterest@qt-project.org;
 Subject:  Re: [Interest] QNetworkAccessManager and HTTP persistent
 connection

 On Sat, Nov 23, 2013 at 7:15 PM, iMath 2281570...@qq.com wrote:
 HTTP 1.1 supports persistent connection by default, so I want to send my
 a
 second http request using the same connection that was setup when the
 first
 HTTP request was made. how can this be achieved through Qt?

 I think you meant HTTP pipelining (that's the jargon used inside Qt
 code). I'm not 100% sure but in Qt5, the default _should_ be to use
 HTTP pipelining.

 In any case, you can explcitly check in the reply object if pipelining
 was indeed used or not. Check for the
 QNetworkRequest::HttpPipeliningWasUsedAttribute attribute in your
 reply.

 Alternately, you can try and explicitly request this behaviour by
 setting the n/w request attribute:

 request.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute,
 true);

 If it still doesn't work, then it might be a bug. What platform are
 you running your on, BTW?

 HTH,
 -mandeep




 If I simply make the second request after the first one finished like the
 following

 QNetworkAccessManager *manager = new QNetworkAccessManager(this);
 connect(manager, SIGNAL(finished(QNetworkReply*)),
 this, SLOT(replyFinished(QNetworkReply*)));

 manager-get(QNetworkRequest(QUrl(http://qt-project.org;)));

 it seems a new TCP connection to the server will be initiated (I have
 checked with a network sniffer) The experiment also says: If the reply is
 deleteLater() or abort() within finished() signal, the connection will be
 closed.


 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qt HTTP access to Exchange

2013-11-27 Thread Mandeep Sandhu
 I have single stepped through all of the network code and I just can't
 find any place where this fails. It looks like Exchange just closes the
 socket without giving me an error.

You can confirm this with a packet sniffer to see which end initiated the close.


 My URL to the server is something like
 https://mail.somewhere/EWS/Exchange.asmx;. I sent this a post request
 with an XML body.

Just to eliminate the obvious, you're not getting any SSL errors right
(or being silently ignored)?


 I can see that the receiver requests the body data, but then the line is

How do you see the receiver request the body data? I think the POST
data is sent along in the request itself. The receiver will be
expecting the POST data to be present after the HTTP headers.

 silently dropped. The finished signal is emitted from the request and
 error() says there's no error.

 I have tried different things for the username and password. First
 attempt is to do the same as I do for usernames without a domain:

  url.setUserName(connector-userName());
  url.setPassword(connector-password());

 This doesn't work for usernames with domain info.

 I have also tried removing those, expecting a authenticationRequired or
 proxyAuthenticationRequired. No such call is coming.

 I have also tried url encoding the domain\username but that didn't work
 either.

The domain name might be case-sensitive, so you can verify if the
correct case is being used.

HTH,
-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qt HTTP access to Exchange

2013-11-27 Thread Mandeep Sandhu
 The domain name might be case-sensitive, so you can verify if the
 correct case is being used.


 The credentials are correct. I just don't know how to let Qt have them in
 the proper way.

Then it might be worth while to use a packet sniffer like wire-shark
(or some such) to see if the TCP connection is being abruptly closed
(by either client or server) or are you receiving some HTTP response
from the exchange server which then leads to the client closing the
connection.

MS Exchange is known to non-standard compliant behaviour so I wouldn't
be surprised if it's doing something unexpected! :)

HTH,
-mandeep




 Bo.

 --
 Bo Thorsen, European Engineering Manager, ICS
 Integrated Computer Solutions. Delivering World-Class Applications
 http://ics.com/services
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QNetworkAccessManager and HTTP persistent connection

2013-11-26 Thread Mandeep Sandhu
I think I was wrong in telling you that HTTP persistent connection was
same as HTTP pipelining. They aren't.

In HTTP pipelining multiple HTTP requests can be made w/o waiting for
response of each connection. Whereas in HTTP persistent connection
(default as you said in HTTP 1.1), the same TCP connection is used for
sending HTTP request one-after-another.

Can you check if the the outgoing HTTP request has the Connection:
keep-alive set in its (HTTP) header. Also, I've read that sometimes
webservers will send a Connection: Close header in its response in
which case the client will close it's connection, so check if the
webserver is playing nice with your request. Which webserver are you
testing against?

HTH,
-mandeep



On Tue, Nov 26, 2013 at 5:19 PM, iMath 2281570...@qq.com wrote:
 unfortunately ,it doesn't work on Qt4/WinXP
 I have set
 request.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true);

 but the attribute QNetworkRequest::HttpPipeliningWasUsedAttribute in the
 reply is false .
 -- Original --
 From:  Mandeep Sandhu;mandeepsandhu@gmail.com;
 Date:  Tue, Nov 26, 2013 02:14 PM
 To:  iMath2281570...@qq.com;
 Cc:  interestinterest@qt-project.org;
 Subject:  Re: [Interest] QNetworkAccessManager and HTTP persistent
 connection

 On Sat, Nov 23, 2013 at 7:15 PM, iMath 2281570...@qq.com wrote:
 HTTP 1.1 supports persistent connection by default, so I want to send my a
 second http request using the same connection that was setup when the
 first
 HTTP request was made. how can this be achieved through Qt?

 I think you meant HTTP pipelining (that's the jargon used inside Qt
 code). I'm not 100% sure but in Qt5, the default _should_ be to use
 HTTP pipelining.

 In any case, you can explcitly check in the reply object if pipelining
 was indeed used or not. Check for the
 QNetworkRequest::HttpPipeliningWasUsedAttribute attribute in your
 reply.

 Alternately, you can try and explicitly request this behaviour by
 setting the n/w request attribute:

 request.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true);

 If it still doesn't work, then it might be a bug. What platform are
 you running your on, BTW?

 HTH,
 -mandeep




 If I simply make the second request after the first one finished like the
 following

 QNetworkAccessManager *manager = new QNetworkAccessManager(this);
 connect(manager, SIGNAL(finished(QNetworkReply*)),
 this, SLOT(replyFinished(QNetworkReply*)));

 manager-get(QNetworkRequest(QUrl(http://qt-project.org;)));

 it seems a new TCP connection to the server will be initiated (I have
 checked with a network sniffer) The experiment also says: If the reply is
 deleteLater() or abort() within finished() signal, the connection will be
 closed.


 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QNetworkAccessManager and HTTP persistent connection

2013-11-25 Thread Mandeep Sandhu
On Sat, Nov 23, 2013 at 7:15 PM, iMath 2281570...@qq.com wrote:
 HTTP 1.1 supports persistent connection by default, so I want to send my a
 second http request using the same connection that was setup when the first
 HTTP request was made. how can this be achieved through Qt?

I think you meant HTTP pipelining (that's the jargon used inside Qt
code). I'm not 100% sure but in Qt5, the default _should_ be to use
HTTP pipelining.

In any case, you can explcitly check in the reply object if pipelining
was indeed used or not. Check for the
QNetworkRequest::HttpPipeliningWasUsedAttribute attribute in your
reply.

Alternately, you can try and explicitly request this behaviour by
setting the n/w request attribute:

request.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true);

If it still doesn't work, then it might be a bug. What platform are
you running your on, BTW?

HTH,
-mandeep




 If I simply make the second request after the first one finished like the
 following

 QNetworkAccessManager *manager = new QNetworkAccessManager(this);
 connect(manager, SIGNAL(finished(QNetworkReply*)),
 this, SLOT(replyFinished(QNetworkReply*)));

 manager-get(QNetworkRequest(QUrl(http://qt-project.org;)));

 it seems a new TCP connection to the server will be initiated (I have
 checked with a network sniffer) The experiment also says: If the reply is
 deleteLater() or abort() within finished() signal, the connection will be
 closed.


 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Best practices for settings

2013-11-18 Thread Mandeep Sandhu
On Mon, Nov 18, 2013 at 5:03 PM, Philipp Kursawe phil.kurs...@gmail.com wrote:
 I am also currently struggling how to wire up changes to QSettings with the
 lack of signals/slots. Some of my plugins depend on global app settings but
 with QSettings its impossible for them to get notified about changes in
 settings.
 I thought subclassing QSettings is a good idea, until I found it it does not
 use virtual functions I could overload.

How about writing a wrapper class with QProperties for all the
settings you want to store. This class internally uses QSettings for
writing them to persistent storage. You'll have to make it a singleton
though. The notifications can come from the usual property changed
signals.

This way you can also control which properties are read-only and which
ones can be changed.

HTH,
-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Best practices for settings

2013-11-18 Thread Mandeep Sandhu
On Mon, Nov 18, 2013 at 5:24 PM, André Somers an...@familiesomers.nl wrote:
 Tomasz Siekierda schreef op 17-11-2013 17:29:
 The settings class is a Singleton, and all options are accesible
 through member variables (private + getters and setters, or public -
 if you prefer). Although I personally believe Singletons are evil,
 they can be useful - and this is one of the place where the benefits
 outweight the problems.
 Singletons really are evil indeed. However, Qt already provides one, and
 you might as well use it: QApplication. We usually make our settings
 object a member of our own QApplication-derived Application class. That
 way, it is available where needed, but we don't have another singleton.

Do you provide any sort of access restrictions to the settings. Eg: if
some modules should only be able to read a particular setting and not
change it, where would you enforce this? in the module itself or
somewhere else or is this something not relevant in your context?

Thanks,
-mandeep


 André

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QProgressDialog not showing processEvents()

2013-11-17 Thread Mandeep Sandhu
 You have two viable approaches here:
 * break up the saving method into chunks. That is, do a small part of the
 work of the saving, queue the next piece of work to be done, and return to
 the eventloop. The eventloop will then trigger the next queued piece of the
 work being done. This way, there is no need for processEvents() at all.
 * move your saving code to a worker object, and execute it in a separate
 thread. Also, no need to use processEvents, as the heavy lifting is done
 outside of the GUI thread.

I'd too suggest the separate thread method as it's more generic and
will across different scenario's.

The only thing that you need to worry about is that your thread's
actions are in sync with what the GUI is showing. Eg: in case you
provide a cancel button, you'll have to inform the worker thread to
abort and wait for it to exit cleanly.

HTH,
-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Network configuration from qt under linux

2013-11-10 Thread Mandeep Sandhu
On Sun, Nov 10, 2013 at 7:25 AM,  nate.y...@gmail.com wrote:
 If your system can be customized, that will be easy.
 Install NetworkManager on your system.
 And use dbus to communicate with the NetworkManager daemon.

We too used NM for configuring network interfaces on our embedded
board. We had to cross-compile NM from source though it wasn't very
straightforward as NM had a lot of dependencies. We also had to change
some code to make it detect the ethernet interface on our board.

Communication was done over dbus using QtDbus.

HTH,
-mandeep



 At 2013-11-10 05:26:35,Simone cjb.sw.nos...@gmail.com wrote:
Hello,
We developed an application that need to configure all the network
 configurations from our GUI.
We must let the end user be able to configure the device network
 configuration from a user friendly interface, without doing it by command
 line :-)

Now, I have googled a bit but seems that qt don't support this, could you
 confirm it?
There is an alternative solution to do this?

Our system is based on an ARM cpu, and linux embedded (v2.6.35.3).
The parameters we want to be able to change are
- DHCP or STATIC mode
- IP addr.
- SUBNET
- DNS
- GATEWAY

Does someone have any suggestion?
Thanks so much
Simone

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest




 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] What for does qt5gui need OpenGL?

2013-11-08 Thread Mandeep Sandhu

 For Qt4 JSON support, I've used Eeli Reilins QtJSON and been very happy
 with it: https://github.com/da4c30ff/qt-json. I recommend it.

We've been using Flavio Castelli's QJson in our embedded project with
Qt4 and it's worked out well.
http://qjson.sourceforge.net/

HTH,
-mandeep



 Bo.

 --
 Bo Thorsen, European Engineering Manager, ICS
 Integrated Computer Solutions. Delivering World-Class Applications
 http://ics.com/services
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QtDBus interface design question

2013-11-07 Thread Mandeep Sandhu
 The only solution I can imagine is to pass the entire table in one DBus
 message, but how. I cannot pass the objects itself, because I cannot

How about returning an array of strings in the method call? Both
are valid DBus types and you could probably concatenate the various
properties using a delimiter and tokenize them at the receiver end.

I'm no dbus expert and have mostly used QtDbus to communicate with
existing services, like NetworkManager etc, so CMIIW! :)

HTH,
-mandeep

 transfer an QObject via DBus. Creating plain structs and pass them is an
 option but is rather dirty to me.

 How are DBus experts handling this? I know our DBus interface is quite
 complex and most others are far easier, but there must be a solution.
 I'm still a DBus noob, so any hint how to change the design would be
 very very welcome.

 Thanks very much
 Roland





 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Need help in testing a feature on OSX

2013-10-30 Thread Mandeep Sandhu
Hi All,

Is there a noble soul out there willing to spend some time in helping
me test out a feature on OSX?! :) The noble soul should have a working
qt source build setup on OSX.

I'm working on small feature for specifying custom DNS server to
QDnsLookup (QTBUG-30166). I wanted to test out the feature on OSX, but
I don't have a machine handy (it's tested on Windows and Linux).

Can someone with a working setup test the following patches for build failures?

https://codereview.qt-project.org/#change,66701
https://codereview.qt-project.org/#change,66702
https://codereview.qt-project.org/#change,68447

It would be even more awesome if someone got the time to test out the
change with the modified dnslookup example in this patchset! :)

For testing with an IPv4 nameserver address, run:

$ ./examples/network/dnslookup/dnslookup -s 8.8.8.8 www.google.com

For testing with an IPv6 nameserver address (if you have a working
IPv6 setup), run:

$ ./examples/network/dnslookup/dnslookup -s 2001:4860:4860:: www.google.com

In the output you should see a bunch of IPv4 address for the host name
passed (on Linux, to be doubly sure that the system configured
nameserver's are not being used, I used to comment out the entries in
/etc/resolv.conf).

Please let me know if you need more info.

Thanks for your time!

Regards,
-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qt based LRU container?

2013-10-20 Thread Mandeep Sandhu
I wrote a ordered map sometime back using a QHash and QLinkedList.

https://github.com/mandeepsandhu/qt-ordered-map

In the 'examples' section, I've implemented a simple LRU cache using
the ordered map.
https://github.com/mandeepsandhu/qt-ordered-map/tree/master/examples/lrucache

Once the capacity of the cache is reached and a new item is inserted,
we take the first element of the ordered map, which is the least
recently used item, and remove it.

You could easily modify this code to emit a signal when this eviction happens.

HTH,
-mandeep


On Sat, Oct 19, 2013 at 11:13 PM, Mark mark...@gmail.com wrote:
 Hi,

 Does anyone know of an LRU based container for Qt? I'm specifically
 looking for an implementation that notifies me when something gets
 removed due to LRU kicking in. QCache would be nearly OK for my needs,
 but it doesn't notify me when something drops out due to LRU kicking
 in.

 I prefer if the container itself is a list though a map/hash would
 work for me as well.

 Cheers,
 Mark
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] OSX newbie question on Qt5 src build

2013-10-16 Thread Mandeep Sandhu
Hi All,

I have a old iMac running OSX 10.5.8 (Xcode 3.1).

Is it possible to build Qt5 on it or is it tool old a version?

I'm following the guide here, but the minimum version of OSX/Xcode is
not mentioned (probably there isn't?):

http://qt-project.org/wiki/Building_Qt_5_from_Git

Any tip is appreciated.

Thanks,
-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] OSX newbie question on Qt5 src build

2013-10-16 Thread Mandeep Sandhu
On Wed, Oct 16, 2013 at 3:07 PM, Till Oliver Knoll
till.oliver.kn...@gmail.com wrote:
 Am 16.10.2013 um 09:35 schrieb Mandeep Sandhu mandeepsandhu@gmail.com:

 Hi All,

 I have a old iMac running OSX 10.5.8 (Xcode 3.1).

 Is it possible to build Qt5 on it or is it tool old a version?

 Given that not even Snow Leopard 10.6 is supported *for development* anymore 
 (but IIRC you can still *deploy* your Qt applications on 10.6) I don't think 
 you can compile Qt 5.x out of the box on OS X  10.7.

 Unless you are prepared to fiddle around with the sources (mostly the 
 Objective C sources which interface with the Cocoa etc. API, I assume) and/or 
 manually upgrade your compiler.


Thanks all for your quick inputs.

I was working on a network related feature in Qt5 and wanted to test
it on a *BDS platform. I had an old iMac handy so thought I could use
it for testing. But I guess now I need to pay Apple for upgrading the
OS on it! :/

-mandeep

 Cheers,
   Oliver
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] serialization of QStateMachine for recovery mode

2013-10-12 Thread Mandeep Sandhu

 Well, in general I would consider working with this approach and 
 automatically adding those transitions between the start state and all other 
 states. QTransition could be derived to QRecoveryTransition that throws only 
 if a QRecoveryEvent is posted.
 But then we would need to keep some kind of a reference to the current state 
 within the state machine. And I saw no opportunity to address the current 
 state in QSM. Automatically adding a unique ID might help here...


QSM has an API QStateMachine::configuration(). This doesn't exactly
give you the lowest level state the SM is currently in but ALL the
states (lowest + all it's parent states). I had similar requirement
where I wanted to know the lowest level child state the SM is in. So I
wrote a small state tracker so to speak, which had a state
property which was changed by the Qt SM using its property assignment
features.



 But as my intention is to use this approach in a work flow driven application 
 that takes care of building up a set of data I also will have to take care of 
 keeping data and state machine consistent.
 If some data would be lost but the state machine is recovered to a later 
 state then we would end up in an inconsistent state! So recovering any state 
 without check of data is critical.

 So my current approach is to recover the data and set up a special 
 QRecoveryState/-Transition connection with guards on data elements that once 
 an QRecoveryEvent is posted automatically goes all the way to the right state.

 Would that be a considerable approach?


You can also look at having a different initial state
(QAbstractState::setInitialState())  based on if the app started
normally or in recovery mode, but then you'd loose any history that
you might've had (if using history states in the SM).

HTH,
-mandeep



 Great discussion!

 Best Regards,
 Ingmar

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Interest Digest, Vol 25, Issue 32

2013-10-11 Thread Mandeep Sandhu
 P.S. ..second try again because of this horrible HTML mail mess most of
 the apps produce...


Actually all your mails are coming through to this ML even the HTML
formatted ones! :)

-mandeep



 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] serialization of QStateMachine for recovery mode

2013-10-10 Thread Mandeep Sandhu
On Fri, Oct 11, 2013 at 12:05 AM, Ingmar Wegner iweg...@gmx.de wrote:

 Hi list,
 we are planning of using QStateMachine (excellent work, guys!) for a
 workflow driven application (tasks).

 I am thinking of an architecture in which tasks have their own state
 machine (QState) that will be connected to the application state machine
 (QStateMachine) as sub states. (Has anyone done something like this so far?
 ...I guess so!)


Yes, we have done something similar. We've used QSM as a UI controller for
our embedded Qt application. I think QSM is one of the best but most
underrated features of Qt! :)



 I am thinking of separating state machine logic from the implementation of
 the actions (e.g. data driven algorithms) that are triggered by
 transitions; so a task and a task_state_machine class for each task.


The way we did it was that each of our UI widgets used a represent a state
of the QSM, and would be 'activated' when the QSM entered that state (via
onEntry() and onExit() callbacks). For states that have more complex
interactions, you can have a child state machine further mapping the
sub-states. You can also look at having parallel state machines for
reducing the number of inter-dependent states (see the ex in QSM docs).



 Critical here is the feature to serialize the application state machine
 and the intended task state machines as I want to have a fallback if
 somebody pulls the plug (crash recovery)! Once the application comes back
 on it shall check for a possible crash and if so recover the state it was
 in before the crash.

 I couldn’t find any documentation / blog / forum question on this so far
 so here it is.
 Has anybody yet considered doing something similar?


I don't think QSM provides this feature. The thing is that you might have
arrived at the current QSM state after a some set of events and transitions
when the app crashed. It'll be quite an overhead to store all this info in
the QSM, especially if history states were involved.

One lame way for restoring state would be to keep track of al the events
that were posted to the SM and sort of replay those events to the SM when
the app attempts a recovery (to reach the target state when the crash
happened). But this is not optimal as the event chain for a long running
app might be quite long.


 A fallback would be to rebuild the state by analyzing data that was
 serialized as regularly done for crash recovery.
 But this would make the state machine pattern complex!
 Any ideas / experiences?


What do you mean by 'data' here?

I don't think there's a way to directly jump to a nested state without
going through transitions from the top level state, but it's been a while
since I used QSM (used in 4.6/4.7) so I could be wrong here.

HTH,
-mandeep



 Best Regards,
 Ingmar






 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Looking for third party Qt libraries

2013-10-09 Thread Mandeep Sandhu
On Wed, Oct 9, 2013 at 11:51 AM, André Somers an...@familiesomers.nlwrote:

 Op 9-10-2013 7:34, Cornelius Schumacher schreef:
  On Tuesday 08 October 2013 06:48:38 BRM wrote:
  Cool - I don't have any at this time, but it's good information to have
 and
  I'm sure others here do; and yes, listing the license is perhaps the one
  change that would be good to do - even for the Open Source libraries.
  The license is already listed, but we should add some way of filtering
 for the
  license.
 
 Not only for the license, but on many other things. I, for one, do not
 like to go through a huge list of libraries one at a time. Rather, I'd
 like to use some keywords to search for libraries that seem to offer the
 component I'm after.


+1 to that.

We could have a 'tags' field in the manifest JSON which can be made
searchable or used in filters.

-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Install both Qt5 and Qt4.7 at one Ubuntu

2013-10-07 Thread Mandeep Sandhu
I think both Qt4 and 5 are there in the Ubuntu apt repos. Though I'm not
sure if they'll play nice if _both_ are installed from apt (eg which qmake
will be used?).

Maybe you can install one of them directly (eg: by downloading Qt5
pre-built binaries from qt-project.org) and the other one from apt.

Basically you just need to use the right qmake for building your apps. Eg:
you can have 'qmake5' point to the Qt5 qmake binary and use that for
building Qt5 apps while 'qmake' uses the Qt4 binary.

HTH,
-mandeep




On Mon, Oct 7, 2013 at 3:21 PM, Николай Шатохин n.shatok...@gmail.comwrote:

 Hello.

 I need Qt4.7 for developing apps for embedded systems and Qt5 for desktop
 apps. Is it possible to install it both in Ubuntu 13.04 without conflicts?

 Best regards,
 Nick

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Install both Qt5 and Qt4.7 at one Ubuntu

2013-10-07 Thread Mandeep Sandhu
On Mon, Oct 7, 2013 at 8:32 PM, Thiago Macieira
thiago.macie...@intel.comwrote:

 On segunda-feira, 7 de outubro de 2013 05:30:11, Jonathan Greig wrote:
  they should play nicely, look for qtchooser and use it to switch between
  the two:
 
  qtchooser -run-tool=qmake -qt=qt5
  make

 Or, more simply:

 qmake -qt5
 make


This syntax looks much simpler/cleaner. Thanks for the pointer.

-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qt on PS4 and SteamOS

2013-10-03 Thread Mandeep Sandhu
On Thu, Oct 3, 2013 at 5:57 PM, Phil Hannent p...@hannent.co.uk wrote:

 On 3 October 2013 05:07, Mandeep Sandhu mandeepsandhu@gmail.com
 wrote:
 
  On Wed, Oct 2, 2013 at 2:43 PM, Mojmír Svoboda
  mojmir.svob...@warhorsestudios.cz wrote:
 
  * Mandeep Sandhu mandeepsandhu@gmail.com [2013-09-30 16:08:44
  +0530]:
 
   As for PS4 I don't know what OS it runs. You might have to add a QPA
   plugin
   for it for running Qt on its graphics stack.
 
  It is a fork of FreeBSD, with OpenGL.
 
 
  Thanks for info. I'll remember this! :)
 
  So it should be possible to use Qt here.
 Caution should be taken with that, although parts of BSD have been
 seen in the development hardware for PS4 it isn't to say that it is
 BSD. Windows NT used to have a BSD network stack if my memory serves.

 As for the OpenGL part, well Sony have the libGCM library for graphics
 and the PSGL API, its build along the lines of OpenGL ES but optimised
 for their consoles. So you cannot expect it to be standards compliant.


Ok. though if their BSD variant can POSIX apps, then at least non-GUI part
(or Qtcore+Qtnetwork) can be expected to run at least.


 I would not expect a QPA for the PS4 any time soon.


If the gfx libs are proprietary then I gues there's not much hope for a QPA
plugin, unless somebody partners with them to make one.

-mandeep



 Phil
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QThread, correct exit.

2013-09-28 Thread Mandeep Sandhu
On Sat, Sep 28, 2013 at 3:14 PM, Alexander Syvak alexander@gmail.comwrote:

 Hello,

 how to correctly stop a QThread execution?

 I am using
 thread.quit();

 thread.terminate();


Don't terminate. Quitting and waiting should be sufficient.


 thread.wait(500);

 Without terminate() thread wait forever. Each thread is executing an event 
 loop only (object is moved into thread).


Is there anything else the thread could be stuck on? Busy looping
somewhere? Waiting for a syscall?

HTH,
-mandeep




 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QMapint64_t significantly slower than QMapint32_t

2013-09-23 Thread Mandeep Sandhu
On Sun, Sep 22, 2013 at 4:42 PM, Konstantin Tokarev annu...@yandex.ruwrote:


 22.09.2013, 13:24, Etienne Sandré-Chardonnal etienne.san...@m4x.org:
  I don't, I have very only strong conviction from tests on a big large
 program. I was hoping that someone had an idea about the cause... Would
 this help to make one?
  I did a quick test : inserting 1000 items in a QMapint32_t, int
 and QMapint64_t, int using rand() for key and value, measuring the delay
 with QDateTime::currentMsecsSinceEpoch.
  The int32 version took about 2100ms while the int64 took about 2300ms.
 
  So maybe this is only a memory cache issue. The difference is higher in
 my app (measured with a profiler), maybe because it decreases cache
 efficiency of other code parts.
 
  Using gcc 4.8.0 mingw64 rubenvb build, with Qt 4.8.1
  Etienne
 

 Now try std::mapint32_t, int and std::mapint64_t, int - red-black tree
 should work faster than QMap's skiplist.


Out of curiosity i tried measuring the insert, iteration and removal times
of QMap, QHash and std::map. The test included inserting numbers
(sequentially), iterating over all entries and then removing a random
number from it (Test app attached.).

Here are my results (g++ (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3, Intel core
i7, 1.2GHz, 8 GB RAM).

$ ./qtvsstl 1000

Timing insertion of 1000 items...
QMap : 1737 msecs
QHash : 821 msecs
STL map : 5458 msecs

Timing iteration over 1000 items...
QMap : 156 msecs
QHash : 202 msecs
STL map : 173 msecs

Timing removal of random item from 1000 items...
Map : 0 msecs
Hash : 0 msecs
STL map : 0 msecs

STL map seems to be the slowest for insertion.

I don't have the data handy, but some ppl say that skip lists perform
better than RB tree's for large data sets and are more 'friendly' to
concurrent programming. I'm not sure if thats the reason why Qt containers
use skip lists instead of Rb/AVL trees.

HTH,
-mandeep





 --
 Regards,
 Konstantin
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

#include QCoreApplication
#include QMap
#include QHash
#include QTime
#include QDebug

#include map

int main(int argc, char *argv[])
{
//QCoreApplication a(argc, argv);

int itemCount = 0;
bool ok = false;

if (argc  1) {
itemCount = QString(argv[1]).toInt(ok);
if (!ok) {
qWarning()  \nError! Enter a valid number.;
qDebug()  \nUsage:\n\t  *argv  number of items for testing\n;
return 1;
}
} else {
qDebug()  \nUsage:\n\t  *argv  number of items for testing\n;
return 1;
}
//Qt containers
QMapint, int qmap;
QHashint, int qhash;

//STL containers
std::mapint, int stlmap;

QTime timer;

qDebug()  Timing insertion of  itemCount  items...;

timer.start();
for (int i=0; iitemCount; i++) {
qmap.insert(i, i);
}
qDebug()  QMap :  timer.elapsed()  msecs;

timer.start();
for (int i=0; iitemCount; i++) {
qhash.insert(i, i);
}
qDebug()  QHash :  timer.elapsed()  msecs;

timer.start();
for (int i=0; iitemCount; i++) {
stlmap.insert(std::pairint, int(i, i));
}
qDebug()  STL map :  timer.elapsed()  msecs;

qDebug()  \nTiming iteration over  itemCount  items...;

int dummy = 0;
timer.start();
foreach (int val, qmap.values()) {
dummy += val;
}
qDebug()  QMap :  timer.elapsed()  msecs;

dummy = 0;
timer.start();
foreach (int val, qhash.values()) {
dummy += val;
}
qDebug()  QHash :  timer.elapsed()  msecs;

dummy = 0;
timer.start();
for (std::mapint, int::iterator it=stlmap.begin(); it!=stlmap.end(); ++it) {
dummy += it-second;
}
qDebug()  STL map :  timer.elapsed()  msecs;

qDebug()  \nTiming removal of random item from  itemCount  items...;

int rand = qrand() % itemCount;
timer.start();
qmap.remove(rand);
qDebug()  Map :  timer.elapsed()  msecs;

rand = qrand() % itemCount;
timer.start();
qhash.remove(rand);
qDebug()  Hash :  timer.elapsed()  msecs;

rand = qrand() % itemCount;
timer.start();
stlmap.erase(rand);
qDebug()  STL map :  timer.elapsed()  msecs;

//return a.exec();
return 0;
}
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] qmake exclude modules

2013-09-18 Thread Mandeep Sandhu
Will webkit work w/o network?

I think it depends on the network module. Same might be true for other
modules, but I'm not sure.

HTH,
-mandeep


On Wed, Sep 18, 2013 at 3:19 PM, Phil Hannent p...@hannent.co.uk wrote:

 Hi,

 I am trying to remove some Qt modules that I don't need at the moment,
 however qmake isn't outputting a Makefile with the expected syntax. In
 my .pro file I have:

 QT += core gui webkit

 greaterThan(QT_MAJOR_VERSION, 4) {
 message(Using QT5)
 QT += widgets
 QT += webkitwidgets
 QT -= printsupport
 QT -= sensors
 QT -= qml
 QT -= opengl
 QT -= quick
 QT -= network
 QT -= multimedia
 QT -= multimediawidgets
 }

 CONFIG   = qt warn_on debug_and_release

 So I am expecting things like QtSensors not to be in the includes or
 LIBS of the Makefile.Release however they are there. Is there some
 sort of dependency with webkit that drags in the other modules?

 Regards
 Phil
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Playing MP4 and FLV with QMediaPlayer

2013-09-11 Thread Mandeep Sandhu
 The trick is this, I can put this on several different machines - all are
 Windows 7 Pro:
 1.) machine 1 - development box, can play some mp4s but not others (all
 h264)
 2.) machine 2 - personal household box, will play the sampleFile mp4
 sometimes
 3.) machine 3 - COMPLETELY clean windows 7 pro install, aside from the
 code above, has nothing installed on it, NEVER plays the mp4.

 All 3 machines can play the sampleFile.mp4 in Windows Media Player.

 As a final note, none of these will play FLV either.

 Pointers anyone? What am I missing here?


QtMultimedia relies on 'backends' to work on different OS'. For Windows I
think it uses 'DirectShow'. Is that installed and working properly on the
machines you're trying?

Here's more detail on the state of art:
http://qt-project.org/wiki/Qt_Multimedia_Backends

Places where video is not playing, it's possible that there's no support
for the codec/container in the backend being used (DirectShow or some
other).

HTH,
-mandeep





 Thanks!

 -Jason





 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] MultiCast problem. QAbstractSocket::ShareAddress no effect?

2013-09-10 Thread Mandeep Sandhu
On Tue, Sep 10, 2013 at 5:39 PM, Guido Seifert warg...@gmx.de wrote:

 QAbstractSocket::AddressInUseError The bound address is already in use

 As I said: The QAbstractSocket::ShareAddress mode has not effect.


This SO QnA throws some light on the murky world of SO_REUSEADDR! :)

http://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t

Though according to this answer, it's possible to bind more than 1 UDP
socket to the exact same host:port combo as long as all of them use
SO_REUSEADDR _before_ binding (which is what your code is doing I think?).

Could be a regression as Thiago mentioned.

-mandeep



 Guido


 On Tue, 10 Sep 2013 17:31:13 +0530
 Mandeep Sandhu mandeepsandhu@gmail.com wrote:

  What does QAbstractSocket::error() say when the 2nd bind() call fails?
  Maybe that'll give some hint about the error.
 
  -mandeep
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qt Application deployment across platforms

2013-09-04 Thread Mandeep Sandhu
On Wed, Sep 4, 2013 at 12:07 PM, Ramakanthreddy Kesireddy 
ramakanthreddy.kesire...@techmahindra.com wrote:

  Hi,



 I would like to know if I develop a Qt application, can it be deployed
 across platforms like linux,OSX and Android  without recompiling for

 Specific platform like that of HTML5 application.?


It can be deployed w/o recompiling ...though there's no knowing whether
it'll work.



 Thanks and Regards,

 Ramakanth











 --

 DISCLAIMER:
 This email (including any attachments) is intended for the sole use of the
 intended recipient/s and may contain material that is CONFIDENTIAL AND
 PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
 distribution or forwarding of any or all of the contents in this message is
 STRICTLY PROHIBITED. If you are not the intended recipient, please contact
 the sender by email and delete all copies; your cooperation in this regard
 is appreciated.

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Qt based Ordered Map container

2013-09-03 Thread Mandeep Sandhu
Hi All,

Sometime (almost 2 yrs!) back we had a discussion here about having a new
container type in Qt which would be like a QMap, except that it stored keys
in their insertion order. This was mostly inspired by a Python
data-structure - OrderedDict (
http://docs.python.org/library/collections.html#collections.OrderedDict).

Recently, I had some free time on hand and so though of implementing it
using existing Qt containers. Here's the code for it:
https://github.com/mandeepsandhu/qt-ordered-map

It's not a core container in itself as it uses existing Qt containers for
most of the implementation (much like the Python implementation).

For storing the data I use a QHash and for keeping the key (insertion)
order, I use a QLinkedList. The value stored in the hash, is actually a
pair - of the user provided value and a QLinkedList _iterator_ which points
to the item inserted in the linklist. This makes it quite easy and fast to
delete items from these 2 containers in constant time.

The performance of this container is similar to QHash except when you want
all the values from it, as that requires first fetching the keys from the
linklist and then using that to fetch the values from the hash table.

It provides a sub-set of QMap API, complete with const and non-const
iterators (you can use 'foreach' for iterating over all the values in their
insert order).

In case you want to use such a container, please try it out and let me know
your feedback.

Thanks,
-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qt based Ordered Map container

2013-09-03 Thread Mandeep Sandhu
 In case you want to use such a container, please try it out and let me
know your feedback.


 You need to use Boost.MultiIndex.


Thanks for pointing this out. I haven't used Boost much so didn't know
about it.

This looks like quite a flexible container where it has different indexes
for the data stored within (like an RDBMS).

-mandeep




 --
 Regards,
 Konstantin

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QNAM::get() spawns three processess and opens file descriptors which I am unable to close

2013-08-28 Thread Mandeep Sandhu


 My problem is that, whenever I call manager-get(), this spawns 3
  processess, which I am unable to shut down. After a while (running many
 requests) there were a huge amount of running processess and open file
 descriptors. They are consuming RAM and running out of max open file
 descriptor limit...
 Every time I call manager-get(request) 3 new processess are spawnt.

 I am using Qt 4.8.4 on Debian 5.


You're not supposed to explicitly do anything with these threads. They're
probably started by QNAM for doing the network operations asynchronously
and a caller has no control over them.

How many such requests are you dispatching in parallel?

Looks like you're hitting your systems resource limit. You can either
increase this limit (using ulimit), or restrict the number of simultaneous
outgoing requests (by doing it in batches).

I don't see a bug here.

HTH,
-mandeep



 I have also checked the bugtracker and have found a few closed reports:
 https://bugreports.qt-project.org/browseMaybe you're running out of
 resouerce/QTBUG-20148https://bugreports.qt-project.org/browse/QTBUG-20148
 https://bugreports.qt-project.org/browse/QTBUG-20851

 _gs


 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QNAM::get() spawns three processess and opens file descriptors which I am unable to close

2013-08-28 Thread Mandeep Sandhu
On Wed, Aug 28, 2013 at 5:45 PM, gsmember gs gsmem...@hotmail.de wrote:

 Thanks for your reply,
 in gerneral I do one request after the other. Always with the same QNAM
 object.
 After a hour I have about 600 running processess and 1024 (which is the
 user limit) open file descriptors.


Do you have a sample program which illustrates this problem?

-mandeep





 --
 Date: Wed, 28 Aug 2013 16:31:34 +0530
 Subject: Re: [Interest] QNAM::get() spawns three processess and opens file
 descriptors which I am unable to close
 From: mandeepsandhu@gmail.com
 To: gsmem...@hotmail.de
 CC: interest@qt-project.org



 My problem is that, whenever I call manager-get(), this spawns 3
  processess, which I am unable to shut down. After a while (running many
 requests) there were a huge amount of running processess and open file
 descriptors. They are consuming RAM and running out of max open file
 descriptor limit...
 Every time I call manager-get(request) 3 new processess are spawnt.

 I am using Qt 4.8.4 on Debian 5.


 You're not supposed to explicitly do anything with these threads. They're
 probably started by QNAM for doing the network operations asynchronously
 and a caller has no control over them.

 How many such requests are you dispatching in parallel?

 Looks like you're hitting your systems resource limit. You can either
 increase this limit (using ulimit), or restrict the number of simultaneous
 outgoing requests (by doing it in batches).

 I don't see a bug here.

 HTH,
 -mandeep



 I have also checked the bugtracker and have found a few closed reports:
 https://bugreports.qt-project.org/browseMaybe you're running out of
 resouerce/QTBUG-20148https://bugreports.qt-project.org/browse/QTBUG-20148
 https://bugreports.qt-project.org/browse/QTBUG-20851

 _gs


 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest



___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Strange problem in template class (Iterator as value type of a QHash)

2013-08-23 Thread Mandeep Sandhu
Hi All,

I'm writing a template class which contains a QHash. Now if I try to store
an Iterator (of a QList) as the _value_ of this Hash then it fails to
compile.

Here's the sample code:

template typename K, typename V
class TemplateTest
{
public:
TemplateTest()
{
QHashK, QLinkedListV::iterator  h;
Q_UNUSED(h);
}

private:
K k;
V v;
};

Error:

templatetest.h:13: error: type/value mismatch at argument 2 in template
parameter list for 'templateclass Key, class T class QHash'
templatetest.h:13: error:   expected a type, got 'QLinkedListV::iterator'
templatetest.h:13: error: invalid type in declaration before ';' token

However, if I keep the value as a QList (remove iterator) it compile fine.

Whats the problem with storing a Iterator as the value?

Thanks,
-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Strange problem in template class (Iterator as value type of a QHash)

2013-08-23 Thread Mandeep Sandhu


 Error from Clang:

  error: template argument for template type parameter must be a type; did
 you forget 'typename'?


It' right, in that I need to use typename 'somewhere', I just didn't know
where (and why).

I finally fixed it doing a typedef of this dependent type, which also makes
it easy to type! :)


template typename K, typename V
class TemplateTest
{
typedef typename QLinkedListV::iterator iter;

public:
TemplateTest()
{
QHashK, iter  h;
Q_UNUSED(h);
}
...

There's a nice explanation about 'typename' keyword here:
http://pages.cs.wisc.edu/~driscoll/typename.html


 Note: use proper compiler next time.


Note:  Using g++, which is a _very_ proper compiler. It even has a
-pedantic switch! ;)

$ g++ --version
g++ (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3

Regards,
-mandeep



  Error:
 
  templatetest.h:13: error: type/value mismatch at argument 2 in template
 parameter list for 'templateclass Key, class T class QHash'
  templatetest.h:13: error:   expected a type, got
 'QLinkedListV::iterator'
  templatetest.h:13: error: invalid type in declaration before ';' token
 
  However, if I keep the value as a QList (remove iterator) it compile
 fine.
 
  Whats the problem with storing a Iterator as the value?
 
  Thanks,
  -mandeep
 
  ,
  ___
  Interest mailing list
  Interest@qt-project.org
  http://lists.qt-project.org/mailman/listinfo/interest


 --
 Regards,
 Konstantin

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Strange problem in template class (Iterator as value type of a QHash)

2013-08-23 Thread Mandeep Sandhu
On Fri, Aug 23, 2013 at 10:34 PM, Konstantin Tokarev annu...@yandex.ruwrote:


 23.08.2013, 20:39, Mandeep Sandhu mandeepsandhu@gmail.com:
  Error from Clang:
 
   error: template argument for template type parameter must be a type;
 did you forget 'typename'?
 
  It' right, in that I need to use typename 'somewhere', I just didn't
 know where (and why).

 Clang shows a caret where you need to insert typename. It just does not
 explain why.


Thanks for the info. I'll try Clang sometime.

Regards,
-mandeep



 --
 Regards,
 Konstantin

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Strange problem in template class (Iterator as value type of a QHash)

2013-08-23 Thread Mandeep Sandhu
On Fri, Aug 23, 2013 at 10:24 PM, Constantin Makshin cmaks...@gmail.comwrote:

 g++ isn't bad at all, but sometimes its error messages may be quite
 confusing/cryptic.

Agreed.

Rather in some cases it _did_ tell me that i needed to prefix 'typename' in
given line, but unfortunately in this stmt it chose a more cryptic message!
:/

-mandeep



 On Aug 23, 2013 8:39 PM, Mandeep Sandhu mandeepsandhu@gmail.com
 wrote:


 Error from Clang:

  error: template argument for template type parameter must be a type;
 did you forget 'typename'?


 It' right, in that I need to use typename 'somewhere', I just didn't know
 where (and why).

 I finally fixed it doing a typedef of this dependent type, which also
 makes it easy to type! :)


 template typename K, typename V
 class TemplateTest
 {
 typedef typename QLinkedListV::iterator iter;

 public:
 TemplateTest()
 {
 QHashK, iter  h;
 Q_UNUSED(h);
 }
 ...

 There's a nice explanation about 'typename' keyword here:
 http://pages.cs.wisc.edu/~driscoll/typename.html


 Note: use proper compiler next time.


 Note:  Using g++, which is a _very_ proper compiler. It even has a
 -pedantic switch! ;)

 $ g++ --version
 g++ (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3

 Regards,
 -mandeep



  Error:
 
  templatetest.h:13: error: type/value mismatch at argument 2 in
 template parameter list for 'templateclass Key, class T class QHash'
  templatetest.h:13: error:   expected a type, got
 'QLinkedListV::iterator'
  templatetest.h:13: error: invalid type in declaration before ';' token
 
  However, if I keep the value as a QList (remove iterator) it compile
 fine.
 
  Whats the problem with storing a Iterator as the value?
 
  Thanks,
  -mandeep
 
  ,
  ___
  Interest mailing list
  Interest@qt-project.org
  http://lists.qt-project.org/mailman/listinfo/interest


 --
 Regards,
 Konstantin



 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Difference between QUrl::fromEncoded and QUrl::fromPercentEncoding ?

2013-08-14 Thread Mandeep Sandhu
It seems completely understandable to me. A URL is:


 URL = [scheme :] [authority] [path] [? query] [# fragment]
 with
 authority = // [userinfo @] [host] [: port]

 (technically, a URL cannot have an empty scheme, but a URL reference can,
 and QUrl parses like that)

 Since the input had no :, there was no scheme. Since the input had no
 //,
 it also had no authority. That means everything from the beginning until
 ?
 or # was the path.

 Since there was no ? or #, everything in the input was parsed as path.


Ok. I thought the scheme, host etc was being interpreted _after_ decoding
the string.



  Also, if we are getting a percent encoded 'string' from external source,
  whats the correct way of making it into a QUrl?

 The URL was parsed correctly as it came. The question is why your external
 source gave you that URL which is not what you wanted it to be.


A Url like the one in this post is quite possible if it came as part of
another url (eg: a url encoded as a parameter).

Thanks for the clarification.

-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Difference between QUrl::fromEncoded and QUrl::fromPercentEncoding ?

2013-08-13 Thread Mandeep Sandhu
On Tue, Aug 13, 2013 at 4:14 PM, Richard Turner tur...@yiran.org wrote:

  Hi,
 QString str = 
 http%3A%2F%2F192.168.1.1%3A80%2Fservlet%2Fcom.mcdonalds.report.view.excel.ExcelReportServlet%3Ffile%3D4162%26columns%3D0%26srcType%3DdefineBean%26width%3D0%26height%3D0%26reportParamsId%3D101767%26cachedId%3D4163%26t_i_m_e%3D1376389959473pageStyle=0;
 QUrl downloadUrl1 = QUrl::fromEncoded(str.toUtf8());QUrl downloadUrl2 
 = QUrl::fromPercentEncoding(str.toUtf8());

 assert(downloadUrl1.toString() == downloadUrl2.toString());
 assert(downloadUrl1 == downloadUrl2);

 Why is the second assertion fails when the first assertion still passes? What 
 is the underlying difference between QUrl::fromEncoded and 
 QUrl::fromPercentEncoding?


I think you're using Qt4 since the first assert is passing (in Qt5 it
would've failed as the default arg to QUrl::toString() has changed).

QUrl::fromEncoded assumes the string is ASCII encoded only. Is there a
non-ASCII char somewhere in that url?

-mandeep




 Thanks!

 Richard


 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Difference between QUrl::fromEncoded and QUrl::fromPercentEncoding ?

2013-08-13 Thread Mandeep Sandhu
Hi Thiago,

On Tue, Aug 13, 2013 at 11:20 PM, Thiago Macieira thiago.macie...@intel.com
 wrote:

 On quarta-feira, 14 de agosto de 2013 00:35:47, Richard Turner wrote:
  OK. Now the problem is, when I use downloadUrl1(result from fromEncoded)
  to make a QNetworkRequest (HTTP GET), I always detect an error: Protocol
   is unknown.
  When I switch to use downloadUrl2, all is good.

 That was expected. Look at what your URL was:


 http%3A%2F%2F192.168.1.1%3A80%2Fservlet%2Fcom.mcdonalds.report.view.excel.ExcelReportServlet%3Ffile%3D4162%26columns%3D0%26srcType%3DdefineBean%26width%3D0%26height%3D0%26reportParamsId%3D101767%26cachedId%3D4163%26t_i_m_e%3D1376389959473pageStyle=0

 Try pasting that in a browser and see what happens.

 The behaviour differs because QUrl::fromEncoded tries to interpret that as
 a
 URL. It has no scheme, so the entire thing is the path of the URL. Since it



The docs of QUrl::fromEncoded() (Qt 4.8) state : input is assumed to be in
encoded form, containing only ASCII characters.

Why does it assumes the input to be only the path? Is the caller expected
to explicitly 'set' the scheme on a url returned by it? If so, the docs
statement looks incomplete.

However, in the above url if we decode all percent-encoded chars upto the
port, then the scheme starts getting detected. This behaviour seems
confusing at best.

Also, if we are getting a percent encoded 'string' from external source,
whats the correct way of making it into a QUrl?

QUrl url;
url.setUrl(QUrl::fromPercentEncoding(encodedUrlString));

Thanks,
-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Some questions on QSettings, qmlRegisterType() and setContextProperty

2013-08-11 Thread Mandeep Sandhu
Have a look at O2, a Qt based OAuth library to see if it'll work for you:

https://github.com/pipacs/o2

It works well with QML, works with Qt4  5, stores tokens in (customizable)
QSettings in an encrypted form and has good support for OAuth 1 and 2.

HTH,
-mandeep






On Sat, Aug 10, 2013 at 11:05 AM, Jayesh Bhoot mister.bh...@gmail.comwrote:

 Short, but informative reply. :)

 
  2., but calling init in C++ componentComplete() (derive from
  QQmlParserStatus as well) automatically, taking the input from
  properties set in QML.
 
 I want to clarify something here. The C++ OAuth2 class provides the data
 and logic to the OAuth2Browser QML window. It has a structure something
 like this:

 class OAuth2 : public QObject
 {
  Q_OBJECT
  Q_PROPERTY(QUrl oauthUrl READ oauthUrl)

 public:
  explicit OAuth2(QObject *parent = 0);
  explicit OAuth2(QString appId, QUrl redirectUrl, QStringList
 permissions, QObject *parent = 0);

  QUrl oauthUrl() const;

 signals:
  void oauthSucceeded(QString userAccessToken);
  void oauthFailed();

 public slots:
  void onBrowsingUrlChanged(const QUrl url);

 private:
  QString parseUserAccessToken(const QUrl url) const; // called by
 onBrowsingUrlChanged()

  static const QString m_oauthEndPoint;
  QString m_appId;
  QUrl m_redirectUrl;
  QStringList m_permissions;
  QString m_userAccessToken;
 };

 This is how the QML class uses it:

 Window {
  id: oauth2Browser
  width: 500
  height: 500

  ColumnLayout {
  anchors.fill: parent

  WebView {
  objectName: Browser
  id: browser
  Layout.fillHeight: true
  Layout.fillWidth: true

  url: oauth2.oauthUrl
  onUrlChanged: oauth2.onBrowsingUrlChanged(browser.url)
  }

  Label {
  id: loadingStatus
  Layout.fillWidth: true
  text: browser.loadProgress + % loaded.
  }
  }
 }

 Thus, its the C++ class that sets the properties, and not the QML window
 that does it. By your method, I assumes that I would have to derive OAuth2
  from QQmlParserStatus in order to track properties set by QML window.
 However, its the other way round - QML window takes data from an instance
 of the C++ class.
 How should I proceed then?

 Also, feel free to point out if my current design is flawed.

  qmlRegisterType is better than setContextProperty, because that way
  the flow is controlled from QML (and a lack of constructor arguments
  is correct for declarative design, you can do additional property
  based initialization in componentComplete). Good QML design has C++
  expose functionality to QML but lets QML control the entire UI flow
  (including window creation/handling).

 I agree with preferring qmlRegisterType over setContextProperty. But
 wouldn't your C++ QQmlParserStatus::componentComplete() approach work only
 if the data comes from QML to C++? I think that would be the case most of
 the time. But how should I handle the other way round, like in my case, or
 say, while grabbing data from database or application settings?


  1. Is exposing QSettings directly to QML UI a good idea?
 
  Directly? Not a good idea, but possible. The new Qt.labs.settings API
  aims to address this deficiency:
  https://codereview.qt-project.org/#change,59149

 I will look forward to using this.



 On Sat, 10 Aug 2013 03:34:19 +0530, Alan Alpert 4163654...@gmail.com
 wrote:

  On Fri, Aug 9, 2013 at 8:12 AM, Jayesh Bhoot mister.bh...@gmail.com
  wrote:
  I will try explaining my confusion through the application I am
  currently
  developing.
 
  My application (based on Qt5.1 + Qt Quick Controls) interacts with
  Facebook API to manage a Facebook Page. I am trying to keep the QML code
  (for UI) as separate as possible from the C++ core.
 
  Now, an OAuth2 implementation is required to be able to interact with
  Facebook API. For that, I have a C++ OAuth2 class, the constructor of
  which has the following signature:
 
  OAuth2::OAuth2(QString appId, QString redirectUrl, QStringList
  permissions);
 
  Now, as the OAuth process requires a browser, I have also implemented an
  OAuthBrowser.qml, which uses OAuth2 to complete an authorization.
 
  I have the following options to expose OAuth2 class to OAuth2Browser:
 
  1. Instantiate OAuth2 and use setContextProperty() to expose the
  instance
  to OAuth2Browser. However, this means my C++ code has to deal with the
  UI
  code. The more baffling issue is that OAuth2Browser is a secondary
  window.
  When a user clicks on a Authorize window on the MainWindow, then an
  AppController C++ object (connected to MainWindow) will launch the
  OAuth2Browser window. Thus, the instantiation code of OAuth2Browser
  would
  go deep down inside a AppController method. It would have been good if
  only main.cpp had to deal with the window creation.
 
  2. Use qmlRegisterType(). In this case, I can't pass 

Re: [Interest] Qt not resolving URLs

2013-08-06 Thread Mandeep Sandhu
On Tue, Aug 6, 2013 at 11:30 AM, Thiago Macieira
thiago.macie...@intel.comwrote:

 On terça-feira, 6 de agosto de 2013 11:17:35, Mandeep Sandhu wrote:
  On Tue, Aug 6, 2013 at 10:21 AM, Tom Isaacson
 tom.isaac...@navico.comwrote:
   I've added a simple browser page to my application using the demo code
 in
   Qt 4.8 as a base:
   [QTDIR]\demos\browser
  
   This works fine in Windows, but when I rebuild the app and try it on my
   embedded Linux device it fails. While experimenting I found I could
 load
   www.google.com by resolving the IP address and using that instead. I
   added the following code to my app:
   QHostInfo hostInfo = QHostInfo::fromName(m_url);
 
  Just to eliminate the obvious, m_url here contains a valid url?

 Or, better yet: does *not* contain a valid URL?


Oops, yes! It takes a host name or IP addr string as input.

-mandeep




 QHostInfo::fromName takes a host name. Not a URL.
 --
 Thiago Macieira - thiago.macieira (AT) intel.com
   Software Architect - Intel Open Source Technology Center

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] running directfb on desktop

2013-08-06 Thread Mandeep Sandhu
Some more info on the status of DirectFB with Qt5:
http://qt-project.org/wiki/DirectFBAndQt

-mandeep



On Tue, Aug 6, 2013 at 2:30 PM, Mandeep Sandhu
mandeepsandhu@gmail.comwrote:

 During Qt 4 days, you could use qvfb (Q Virtual Frambuffer) for running
 applications built for Qt embedded. I'm not sure if it's still valid as Qt5
 required openGL support.

 Maybe it's possible via the DirectFB openGL extension - DirectFBGL.

 HTH,
 -mandeep



 On Tue, Aug 6, 2013 at 2:14 PM, Juha Vuolle juvuo...@gmail.com wrote:

 Hi,

 was wondering if it is possible to run qt applications with directfb QPA
 on deskop?

 I just tried it but I seem to get segfault at directfb qpa backingstore
 constructor
 IDirectFBWindow *dfbWindow = static_castQDirectFbWindow
 *(window-handle())-dfbWindow();
 where window-handle() is null.

 Other than that there are not much errors in the startup logs (some
 joystick related warnings). I see a window flashing quickly.
 I was wondering if I'm missing some obvious stuff I need to setup for
 this to work?

 (My setup: lubuntu 13.04, self-compiled about 3 weeks old Qt 5)

 any hints appreciated,
  Juha

 if its any use:

  ./analogclock -platform directfb
~~| DirectFB 1.2.10 |~~
 (c) 2001-2008  The world wide DirectFB Open Source Community
 (c) 2000-2004  Convergence (integrated media) GmbH
   

 (*) DirectFB/Core: Single Application Core. (2012-05-21 06:43)
 (*) Direct/Thread: Started 'VT Switcher' (-1) [CRITICAL OTHER/OTHER 0/0]
 8388608...
 (*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: Power Button (1) 0.1 (directfb.org)
 (*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: Sleep Button (2) 0.1 (directfb.org)
 (*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: AT Translated Set 2 keyboard (3) 0.1 (directfb.org)
 (*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: VirtualBox USB Tablet (4) 0.1 (directfb.org)
 (*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: VirtualBox mouse integration (5) 0.1 (directfb.org)
 (*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: ImExPS/2 Generic Explorer Mouse (6) 0.1 (directfb.org
 )
 (*) Direct/Thread: Started 'Keyboard Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: Keyboard 0.9 (directfb.org)
 (*) Direct/Thread: Started 'Joystick Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
  (!!!)  *** ONCE [Joystick sends JS_EVENT_INIT events, make sure it has
 been calibrated using 'jscal -c'
 ] *** [../../../inputdrivers/joystick/joystick.c:99 in
 joystick_handle_event()]
 (*) DirectFB/Input: Joystick (1) 0.9 (directfb.org)
  (!!!)  *** WARNING [out of memory] *** [../../../src/core/input.c:1133
 in init_axes()]
 (*) Direct/Thread: Started 'Joystick Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: Joystick (2) 0.9 (directfb.org)
  (!!!)  *** WARNING [out of memory] *** [../../../src/core/input.c:1133
 in init_axes()]
 (*) Direct/Thread: Started 'PS/2 Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: IMPS/2 Mouse (1) 1.0 (directfb.org)
 (*) Direct/Thread: Started 'PS/2 Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: IMPS/2 Mouse (2) 1.0 (directfb.org)
 (*) DirectFB/Genefx: MMX detected and enabled
 (*) DirectFB/Graphics: MMX Software Rasterizer 0.6 (directfb.org)
 (*) DirectFB/Core/WM: Default 0.3 (directfb.org)
 (*) FBDev/Surface: Allocated 640x480 32 bit LUT8 buffer (index 0) at
 offset 0 and pitch 2560.
 (!) [11851:0.000] -- Caught signal 11 (at 0x10, invalid address) --




 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest



___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] running directfb on desktop

2013-08-06 Thread Mandeep Sandhu
During Qt 4 days, you could use qvfb (Q Virtual Frambuffer) for running
applications built for Qt embedded. I'm not sure if it's still valid as Qt5
required openGL support.

Maybe it's possible via the DirectFB openGL extension - DirectFBGL.

HTH,
-mandeep



On Tue, Aug 6, 2013 at 2:14 PM, Juha Vuolle juvuo...@gmail.com wrote:

 Hi,

 was wondering if it is possible to run qt applications with directfb QPA
 on deskop?

 I just tried it but I seem to get segfault at directfb qpa backingstore
 constructor
 IDirectFBWindow *dfbWindow = static_castQDirectFbWindow
 *(window-handle())-dfbWindow();
 where window-handle() is null.

 Other than that there are not much errors in the startup logs (some
 joystick related warnings). I see a window flashing quickly.
 I was wondering if I'm missing some obvious stuff I need to setup for this
 to work?

 (My setup: lubuntu 13.04, self-compiled about 3 weeks old Qt 5)

 any hints appreciated,
 Juha

 if its any use:

  ./analogclock -platform directfb
~~| DirectFB 1.2.10 |~~
 (c) 2001-2008  The world wide DirectFB Open Source Community
 (c) 2000-2004  Convergence (integrated media) GmbH
   

 (*) DirectFB/Core: Single Application Core. (2012-05-21 06:43)
 (*) Direct/Thread: Started 'VT Switcher' (-1) [CRITICAL OTHER/OTHER 0/0]
 8388608...
 (*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: Power Button (1) 0.1 (directfb.org)
 (*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: Sleep Button (2) 0.1 (directfb.org)
 (*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: AT Translated Set 2 keyboard (3) 0.1 (directfb.org)
 (*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: VirtualBox USB Tablet (4) 0.1 (directfb.org)
 (*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: VirtualBox mouse integration (5) 0.1 (directfb.org)
 (*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: ImExPS/2 Generic Explorer Mouse (6) 0.1 (directfb.org)
 (*) Direct/Thread: Started 'Keyboard Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: Keyboard 0.9 (directfb.org)
 (*) Direct/Thread: Started 'Joystick Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
  (!!!)  *** ONCE [Joystick sends JS_EVENT_INIT events, make sure it has
 been calibrated using 'jscal -c'
 ] *** [../../../inputdrivers/joystick/joystick.c:99 in
 joystick_handle_event()]
 (*) DirectFB/Input: Joystick (1) 0.9 (directfb.org)
  (!!!)  *** WARNING [out of memory] *** [../../../src/core/input.c:1133 in
 init_axes()]
 (*) Direct/Thread: Started 'Joystick Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: Joystick (2) 0.9 (directfb.org)
  (!!!)  *** WARNING [out of memory] *** [../../../src/core/input.c:1133 in
 init_axes()]
 (*) Direct/Thread: Started 'PS/2 Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: IMPS/2 Mouse (1) 1.0 (directfb.org)
 (*) Direct/Thread: Started 'PS/2 Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: IMPS/2 Mouse (2) 1.0 (directfb.org)
 (*) DirectFB/Genefx: MMX detected and enabled
 (*) DirectFB/Graphics: MMX Software Rasterizer 0.6 (directfb.org)
 (*) DirectFB/Core/WM: Default 0.3 (directfb.org)
 (*) FBDev/Surface: Allocated 640x480 32 bit LUT8 buffer (index 0) at
 offset 0 and pitch 2560.
 (!) [11851:0.000] -- Caught signal 11 (at 0x10, invalid address) --




 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] running directfb on desktop

2013-08-06 Thread Mandeep Sandhu
Maybe the answer lies in the way you compiled Qt5. What options did you
give for the platform plugin?

I myself have not used the QPA plugins, so can't say what the state of the
DirectFB QPA plugin is. Maybe somebody else can chime in?

Also, your DFB version is quite old which might causing problems. Is
upgrade to a newer version an option?

-mandeep


On Tue, Aug 6, 2013 at 3:43 PM, Juha Vuolle juvuo...@gmail.com wrote:

 Hi Mandeep,

 I had a quick look at the wiki which says the DFBGL is not used. I can see
 there is some related code in the DFB QPA but I don't see it being used.

 I think The other EGL - OpenGL integration mentioned on the wiki would
 require some tweaking into qdirectfb_egl.cpp or perhaps even at egl
 library.  For now it doesn't even compile for me (seems my directfb libs
 are a tad too old and missing an enum) but foremost the mesa egl API I'm
 using doesn't appreciate the
 m_eglSurface = eglCreateWindowSurface(dfbScreen-eglDisplay(), config,
 dfbSurface(), NULL);
 where the NativeWindowType is IDirectFbSurface*.

 thanks for the replies,
 Juha



 2013/8/6 Mandeep Sandhu mandeepsandhu@gmail.com

 Some more info on the status of DirectFB with Qt5:
 http://qt-project.org/wiki/DirectFBAndQt

 -mandeep



 On Tue, Aug 6, 2013 at 2:30 PM, Mandeep Sandhu 
 mandeepsandhu@gmail.com wrote:

 During Qt 4 days, you could use qvfb (Q Virtual Frambuffer) for running
 applications built for Qt embedded. I'm not sure if it's still valid as Qt5
 required openGL support.

 Maybe it's possible via the DirectFB openGL extension - DirectFBGL.

 HTH,
 -mandeep



 On Tue, Aug 6, 2013 at 2:14 PM, Juha Vuolle juvuo...@gmail.com wrote:

 Hi,

 was wondering if it is possible to run qt applications with directfb
 QPA on deskop?

 I just tried it but I seem to get segfault at directfb qpa backingstore
 constructor
 IDirectFBWindow *dfbWindow = static_castQDirectFbWindow
 *(window-handle())-dfbWindow();
 where window-handle() is null.

 Other than that there are not much errors in the startup logs (some
 joystick related warnings). I see a window flashing quickly.
 I was wondering if I'm missing some obvious stuff I need to setup for
 this to work?

 (My setup: lubuntu 13.04, self-compiled about 3 weeks old Qt 5)

 any hints appreciated,
  Juha

 if its any use:

  ./analogclock -platform directfb
~~| DirectFB 1.2.10
 |~~
 (c) 2001-2008  The world wide DirectFB Open Source Community
 (c) 2000-2004  Convergence (integrated media) GmbH
   

 (*) DirectFB/Core: Single Application Core. (2012-05-21 06:43)
 (*) Direct/Thread: Started 'VT Switcher' (-1) [CRITICAL OTHER/OTHER
 0/0] 8388608...
 (*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: Power Button (1) 0.1 (directfb.org)
 (*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: Sleep Button (2) 0.1 (directfb.org)
 (*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: AT Translated Set 2 keyboard (3) 0.1 (directfb.org)
 (*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: VirtualBox USB Tablet (4) 0.1 (directfb.org)
 (*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: VirtualBox mouse integration (5) 0.1 (directfb.org)
 (*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: ImExPS/2 Generic Explorer Mouse (6) 0.1 (
 directfb.org)
 (*) Direct/Thread: Started 'Keyboard Input' (-1) [INPUT OTHER/OTHER
 0/0] 8388608...
 (*) DirectFB/Input: Keyboard 0.9 (directfb.org)
 (*) Direct/Thread: Started 'Joystick Input' (-1) [INPUT OTHER/OTHER
 0/0] 8388608...
  (!!!)  *** ONCE [Joystick sends JS_EVENT_INIT events, make sure it has
 been calibrated using 'jscal -c'
 ] *** [../../../inputdrivers/joystick/joystick.c:99 in
 joystick_handle_event()]
 (*) DirectFB/Input: Joystick (1) 0.9 (directfb.org)
  (!!!)  *** WARNING [out of memory] *** [../../../src/core/input.c:1133
 in init_axes()]
 (*) Direct/Thread: Started 'Joystick Input' (-1) [INPUT OTHER/OTHER
 0/0] 8388608...
 (*) DirectFB/Input: Joystick (2) 0.9 (directfb.org)
  (!!!)  *** WARNING [out of memory] *** [../../../src/core/input.c:1133
 in init_axes()]
 (*) Direct/Thread: Started 'PS/2 Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: IMPS/2 Mouse (1) 1.0 (directfb.org)
 (*) Direct/Thread: Started 'PS/2 Input' (-1) [INPUT OTHER/OTHER 0/0]
 8388608...
 (*) DirectFB/Input: IMPS/2 Mouse (2) 1.0 (directfb.org)
 (*) DirectFB/Genefx: MMX detected and enabled
 (*) DirectFB/Graphics: MMX Software Rasterizer 0.6 (directfb.org)
 (*) DirectFB/Core/WM: Default 0.3 (directfb.org)
 (*) FBDev/Surface: Allocated 640x480 32 bit LUT8 buffer (index 0) at
 offset 0 and pitch 2560

Re: [Interest] Qt not resolving URLs

2013-08-05 Thread Mandeep Sandhu
On Tue, Aug 6, 2013 at 10:21 AM, Tom Isaacson tom.isaac...@navico.comwrote:

 I've added a simple browser page to my application using the demo code in
 Qt 4.8 as a base:
 [QTDIR]\demos\browser

 This works fine in Windows, but when I rebuild the app and try it on my
 embedded Linux device it fails. While experimenting I found I could load
 www.google.com by resolving the IP address and using that instead. I
 added the following code to my app:
 QHostInfo hostInfo = QHostInfo::fromName(m_url);


Just to eliminate the obvious, m_url here contains a valid url?

-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QTimer and QThread

2013-07-31 Thread Mandeep Sandhu
On Wed, Jul 31, 2013 at 2:31 PM, Alexander Syvak alexander@gmail.comwrote:

 Here's the snippet below from implementation of the run method. The class
 inherits a class inheriting QThread.
 ...
screenshot_qtmr = new QTimer;//(this);

 screenshot_qtmr-moveToThread(this);


This stmt is not necessary as the QTimer instance is created in the new
thread itself.

qDebug()  connect(screenshot_qtmr, SIGNAL(timeout()), this,
SLOT(on_screenshot_timeout()));

 qDebug()  connect(this, SIGNAL(kill_tmr()), screenshot_qtmr, 
 SLOT(stop()));


 The  on_screenshot_timeout() will get called in the context of main
thread, not this new thread. Hope thats what you intended.

 screenshot_qtmr-start(freq*1000);

 anal_qmr = new QTimer;//(this);

 anal_qmr-moveToThread(this);

 qDebug()  connect(anal_qmr, SIGNAL(timeout()), 
 SLOT(on_analize_timeout()));

 qDebug()  connect(this, SIGNAL(kill_tmr()), anal_qmr, SLOT(stop()));

 anal_qmr-start(state_analizer_tmr_interval);

 if ( !state_analizer_tmr_id ) return;




 exec();while ( !stop );


Whats the point of this while loop here? You'll return from exit if someone
calls exit() on it. Wouldn't you want to quit after that?

Your slot should get called, unless the timer has been stopped due to some
reason. Are you certain the timer is running (eg it's not been stopped by
the kill_tmr() signal)?

HTH,
-mandeep





 }

 Here's an ouput
 run() ./13_7_31_10_49_2_974

 ./13_7_31_10_49_2_974 exists

 ./13_7_31_10_49_2_974 has 'write' permission for other

 ./13_7_31_10_49_2_974/S0 directory was created

 true

 true

 true

 true

 run() ./13_7_31_10_49_2_974

 ./13_7_31_10_49_2_974 exists

 ./13_7_31_10_49_2_974 has 'write' permission for other

 ./13_7_31_10_49_2_974/S1 directory was created

 true

 true

 true

 true


 It never enters those method specified on timeout(). Why?



 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QTimer and QThread

2013-07-31 Thread Mandeep Sandhu
1) From QTimer documentation:

 *Qt uses the timer's **thread 
 affinityhttps://qt-project.org/doc/qt-4.8/qobject.html#thread
 ** to determine which thread will emit the 
 **timeout()https://qt-project.org/doc/qt-4.8/qtimer.html#timeout
 **signal. Because of this, you must start and stop the timer in its
 thread; it is not possible to start a timer from another thread.*

 But you starts timer from source thread. Timer will not starts.


From the same doc (just the prior sentence):

In multithreaded applications, you can use QTimer in any thread that has
an event loop. To start an event loop from a non-GUI thread, use
QThread::exec().

I think the OP's code satisfies the requirements. He has an event loop
running in the QThread and is calling start() from that thread.



 You should use something like:


 screenshot_qtmr = new QTimer;//(this);
 screenshot_qtmr-setInterval(freq*1000);

 screenshot_qtmr-moveToThread(this);
 qDebug()  connect(this, SIGNAL(started()), screenshot_qtmr, SLOT(start()));

 qDebug()  connect(screenshot_qtmr, SIGNAL(timeout()), this, 
 SLOT(on_screenshot_timeout()));

 qDebug()  connect(this, SIGNAL(kill_tmr()), screenshot_qtmr, SLOT(stop()));

 //screenshot_qtmr-start(freq*1000); // do not do it



 2) In you sample on_screenshot_timeout will be executed in main thread,
 maybe you need change

 connect(screenshot_qtmr, SIGNAL(timeout()), this, 
 SLOT(on_screenshot_timeout()));toconnect(screenshot_qtmr, SIGNAL(timeout()), 
 this, SLOT(on_screenshot_timeout()), Qt::DirectConnection);?


DirectConnection will only change in which thread context the slot gets
called, but it should still get called at least (provided the timer is
running)

-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QMap and thread-safe.

2013-07-26 Thread Mandeep Sandhu
On Fri, Jul 26, 2013 at 11:57 AM, Sze Howe Koh szehowe@gmail.comwrote:

 On 26 July 2013 12:57, Mandeep Sandhu mandeepsandhu@gmail.com wrote:
  On Thu, Jul 25, 2013 at 9:04 PM, Thiago Macieira 
 thiago.macie...@intel.com
  int inc(int foo)
  {
  return foo++; // not atomic anywhere
 
 
  Why? Because of the way foo is being received in this function, i.e by
  reference (so any operation on foo has and added level of indirection)?

 Because that's simply a shorthand for 3 separate operations. See

 http://stackoverflow.com/questions/10503737/is-increment-an-integer-atomic-in-x86


Well, thats why I asked the previous question, i.e if foo is of machine
word size or less, _then_ will the compiler generate the atomic fetch and
add instruction or will that have to be done explicitly by the programmer?

I understand that any (programming) language statement that results in
multiple processor instructions will not be atomic (I'm not considering
explicit lock being done in the program), since instruction from other
processes/threads can be scheduled in-between.

I guess I better write a small program and see for myself what are the
instructions generated for it! :)

-mandeep





 Regards,
 Sze-Howe

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QMap and thread-safe.

2013-07-26 Thread Mandeep Sandhu
On Fri, Jul 26, 2013 at 12:30 PM, Thiago Macieira thiago.macie...@intel.com
 wrote:

 On sexta-feira, 26 de julho de 2013 10:27:28, Mandeep Sandhu wrote:
   Doing both at the same time is not atomic anywhere unless you use
   specialised
   fetch-and-add instructions, which the compiler never generates for you.
 
  By both here, you mean fetch AND add, right?

 Right

  And in x86 such a operation
  (add) on a machine word is atomic w/o using special instructions?

 ADD is atomic, but usually an atomic increment is done with LOCK ADD, to
 ensure that no other processor is trying to access the same memory
 location.
 The compiler will never generate a LOCK.

 In other words, ADD is atomic for single-CPU operations. As soon as there's
 more than one CPU, it isn't enough.


Got it. Thanks for clearing this up!

-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QMap and thread-safe.

2013-07-25 Thread Mandeep Sandhu
On Thu, Jul 25, 2013 at 9:04 PM, Thiago Macieira
thiago.macie...@intel.comwrote:

 On quinta-feira, 25 de julho de 2013 13:40:55, Mandeep Sandhu wrote:
   If that increment was not atomically implemented (and to be honest,
 right
   now I don't know whether a foo++ is atomic - I don't think it is, is
   it?)
   and again two threads
 
  Atomicity of foo++ would depend on the data type of foo, right? Maybe if
  it's a short, the increment will be atomic. Thought the correct way would
  be to use atomic types (or maybe use the gcc atomic extensions).

 Incrementing an integer type the size of the machine's word or smaller is
 atomic on x86, but not on most RISC machines (machines with
 read-modify-update
 incrementing). Incrementing a type that is larger than the machine word,
 such
 as long long on x86, is not atomic.

 Retrieving the value of a type the size of a machine's word or smaller is
 usually atomic everywhere. It is on all architectures that Qt supports.

 Doing both at the same time is not atomic anywhere unless you use
 specialised
 fetch-and-add instructions, which the compiler never generates for you.


By both here, you mean fetch AND add, right? And in x86 such a operation
(add) on a machine word is atomic w/o using special instructions?

Eg if I had code like this running on a x86 machine:

short foo;
foo++;

Will the increment be atomic or do I have to explicitly make it so by doing
something extra?


 I'm being specific because foo++ can be both things and it's impossible to
 know
 if your code was retrieving the value before the increment:

 int inc(int foo)
 {
 return foo++; // not atomic anywhere


Why? Because of the way foo is being received in this function, i.e by
reference (so any operation on foo has and added level of indirection)?

Thanks,
-mandeep

}

 --
 Thiago Macieira - thiago.macieira (AT) intel.com
   Software Architect - Intel Open Source Technology Center

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qt signal when system is awakened

2013-07-24 Thread Mandeep Sandhu
I'm not aware of any such signal coming to Qt from the OS.

Does the session ID have an expiry time? If you can detect such a (expiry)
timeout, maybe you can initiate a re-fetch automatically (using timers)?

-mandeep


On Wed, Jul 24, 2013 at 10:46 AM, Tony Rietwyk t...@rightsoft.com.auwrote:

 Hi Everybody,

 My application connects to cloud servers and obtains a session id used in
 subsequent interactions.  Some clients are using the app on laptops.   They
 rarely shutdown their system, and just close the lid, which puts the OS
 (Windows or OSX) to sleep.   Hours or days later, they open the lid and see
 my app still running.  They perform some actions, then get an error when
 the
 app tries to continue the session with the cloud server.   I have
 temporarily increased the timeouts in the cloud service, but that is not
 very satisfactory.

 Is there a Qt signal when the system state changes to or from sleep or
 hibernate?

 How have others handled this situation?

 Thanks!

 Tony


 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QMap and thread-safe.

2013-07-24 Thread Mandeep Sandhu
On Wed, Jul 24, 2013 at 12:20 PM, André Somers an...@familiesomers.nlwrote:

 Op 23-7-2013 13:34, Giuseppe D'Angelo schreef:
  On 23 July 2013 13:25, Bill Crocker william.croc...@analog.com wrote:
  Hi all:
 
  The QMap class states that all member functons are reentrant, but
  if I populate a map at program start-up (with QStrings, let's say) and I
  do not change its contents from then on... I should be able to treat the
  member function ::contains() and any other member function which does
 not
  modify the map as thread-safe.
 
  Is true?
  Probably yes, although totally undocumented. (There has been some
  discussion before the release of 5.0 -- about whether we should make
  it official that using only const methods on containers makes them
  thread safe, but I don't remember the outcome...)
 
  HTH,
 Well, if I understood Herb Sutters talk[1] on this correctly, that
 basically *is* the meaning of const nowadays...

 André

 [1]

 http://channel9.msdn.com/posts/C-and-Beyond-2012-Herb-Sutter-You-dont-know-blank-and-blank


Thanks for sharing this link. It was very informative. (BTW, this applies
only to C++11)

Also, doesn't a const (old sense of the word) member function mean - I'm
not going to alter the state of the object ?

If so, that would make it thread-safe in the special scenario (mentioned by
OP) where only reads are being attempted, right? Can an implementation
make it thread-unsafe while still being const (again considering only the
special read-only scenario)?

-mandeep



 --
 You like Qt?
 I am looking for collegues to join me at i-Optics!

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QMap and thread-safe.

2013-07-24 Thread Mandeep Sandhu
A const method can't affect other threads, but other threads can

 affect a const method.

 Suppose a const function is reading a large data object. If the object
 wasn't locked, other threads could modify it while the first function
 is in the middle of reading it, potentially corrupting the result of
 the first function.


You're right. But I was asking about the specific senario the OP mentioned,
i.e with only readers operating on an object, no writers.

Thanks,
-mandeep



 Sze-Howe

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QMap and thread-safe.

2013-07-24 Thread Mandeep Sandhu
On Wed, Jul 24, 2013 at 8:40 PM, Thiago Macieira
thiago.macie...@intel.comwrote:

 On quarta-feira, 24 de julho de 2013 12:59:31, Mandeep Sandhu wrote:
  
 http://channel9.msdn.com/posts/C-and-Beyond-2012-Herb-Sutter-You-dont-know
   -blank-and-blank
  Thanks for sharing this link. It was very informative. (BTW, this applies
  only to C++11)

 It does not apply to anything.


What I meant with it applies to C++11, is that the C++11 standard library
now follows/respects the correct meaning of const, i.e all std lib's
const functions are thread safe and in turn they expect user defined
const functions to be thread-safe as well.

Though as you mentioned, is not enforced by the language.

The only thing thats tying it up with C++11 is that the correct
interpretation of const is being followed in the new C++11 std lib, isn't
this what he meant in the talk? CMIIW.



 This is an idea by Herb Sutter and, to be honest, I agree with him that
 const
 *should* mean that.

 But it doesn't. The language does not enforce anything. There's no way to
 guarantee that the user code in a const function is actually thread-safe.
 It's
 very easy to break out of the safety:

 const_cast
 mutable


But having a mutable in a const function is (logiaclly) right. Rather thats
how, Herb explains, one would implement a thread-safe const function.

On the other hand doing a const_cast, in a const function, looked more of a
work-around to make the compiler happy.

-mandeep




 --
 Thiago Macieira - thiago.macieira (AT) intel.com
   Software Architect - Intel Open Source Technology Center

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] DBus on X11 using Qt5

2013-07-24 Thread Mandeep Sandhu
On Wed, Jul 24, 2013 at 6:25 PM, Ramakanthreddy Kesireddy 
ramakanthreddy.kesire...@techmahindra.com wrote:



  Hi,

   I would like to understand why the below code snippet doesnot
 works(Filesystem path doesnot returns any) in Ubuntu 12.04 minimal version
 where as  It works fine in Ubuntu 12.04 desktop version on target tegra3
 device.


What is a Ubuntu minimal? Is this some build of Ubuntu w/o the desktop
components?

Have you tried getting a reply from the interface using dbus-send command?

Also, why not use a proxy object to talk to the service. Its a lot easier
and less error-prone.
See:
http://techbase.kde.org/Development/Tutorials/D-Bus/Accessing_Interfaces#Using_Classes_Generated_From_D-Bus_XML

HTH,
-mandeep






 QDBusMessage Reply;

 QDBusInterface* Connection= new

  QDBusInterface(DISK_SERV,HAL_MGR_PATH,DISK_SERV,QDBusConnection::systemBus(),
 this);



 Reply = Connection-call(EnumerateDevices);



 if( QDBusMessage::ReplyMessage == Reply.type())

 {

 QDBusArgument dbusarg = qvariant_castQDBusArgument(Reply.arguments()[0]);

 dbusarg.beginArray();



  while(!dbusarg.atEnd())

  {

QVariant variant = dbusarg.asVariant();

QDBusObjectPath dbusObjectPath = qvariant_castQDBusObjectPath

 (variant);



mFileSystemPaths.append(dbusObjectPath.path());

  }

  dbusarg.endArray();

 }



   delete Connection;



 Please let me know if there are any dependencies on DBUS for the above
 code to work

 On linux systems as this code retrieves the file system path like
 /dev/sda1 for example.



 Thanks and Regards,

 Ramakanth





 * *













 * *

















 *From:* Ramakanthreddy Kesireddy
 *Sent:* 17 July 2013 17:37
 *To:* interest@qt-project.org
 *Subject:* DBus on X11 using Qt5



 Hi,

 Please let me know how can we verify if DBus is working on X11(Ubuntu
 12.04 Minimal)
 or if there are any dependent packages to be installed for DBus.

 Iam using Qt5.0.2 sdk.

 Thanks and Regards,
 Ramakanth

 --

 DISCLAIMER:
 This email (including any attachments) is intended for the sole use of the
 intended recipient/s and may contain material that is CONFIDENTIAL AND
 PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
 distribution or forwarding of any or all of the contents in this message is
 STRICTLY PROHIBITED. If you are not the intended recipient, please contact
 the sender by email and delete all copies; your cooperation in this regard
 is appreciated.

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QMap and thread-safe.

2013-07-24 Thread Mandeep Sandhu
On Thu, Jul 25, 2013 at 10:36 AM, Thiago Macieira thiago.macie...@intel.com
 wrote:

 On quinta-feira, 25 de julho de 2013 10:00:20, Mandeep Sandhu wrote:
  What I meant with it applies to C++11, is that the C++11 standard
 library
  now follows/respects the correct meaning of const, i.e all std lib's
  const functions are thread safe and in turn they expect user defined
  const functions to be thread-safe as well.

 Ah, that changes things. Yes, if the Standard Library now enforces const
 member = thread-safe, that's great. It is how the Qt value-type classes
 have
 behaved since Qt 4.0, even though we haven't documented that.

 The big question is whether they're thread-safe among themselves, or if
 they
 are thread-safe even if another thread is calling a non-const method.

 I would not expect the latter case. It's extremely hard to do and, to be
 honest, does not have much value. One thing that we tell people is to treat
 the Qt value-type containers as they'd treat an int or char. In that
 case,
 if we apply the same logic about const container to const int, for
 which
 many reads are thread-safe, as long as no thread is doing a write, then the
 const methods are thread-safe as long as no non-const method is called.


Right, there's no way to guarantee thread-safety of const functions, when
non-const functions are being invoked by other threads.

Although one could make them explicitly thread-safe by using (mutex) locks.
But then there's nothing that const is helping us achieve here.



   very easy to break out of the safety:
   const_cast
   mutable
 
  But having a mutable in a const function is (logiaclly) right. Rather
 thats
  how, Herb explains, one would implement a thread-safe const function.
 
  On the other hand doing a const_cast, in a const function, looked more
 of a
  work-around to make the compiler happy.

 Both mean the same thing: they allow you to modify the internals inside a
 const method. If you don't do it carefully, you can cause problems.

 Take a very simple case of mutable:

 class String
 {
 ushort *utf16;
 mutable char *cached_latin1;

 public:
 char *latin1() const
 { if (!cached_latin1) cached_latin1 = toLatin1(); return
 cached_latin1; }
 };

 The function above is not thread-safe. If two threads at the same time call
 that function while cached_latin1 is null, both of them might allocate
 memory
 and one of them will probably leak the other's pointer.


Yeah, one would have to protect access to cached_latin1 using  a mutex lock.

Thanks,
-mandeep




 --
 Thiago Macieira - thiago.macieira (AT) intel.com
   Software Architect - Intel Open Source Technology Center

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] void pointers

2013-07-16 Thread Mandeep Sandhu
On Tue, Jul 16, 2013 at 9:19 PM, Phil Hannent p...@hannent.co.uk wrote:

 Hi,

 I have a codebase that is using a C library and Qt. I have some legacy
 code where structs from the C library are stored in a Qt/C++ class using:

 void *userData;

 Is this an example where I should replace the void * with a QSharedPointer
 or a QWeakPointer?


The answer would depend on whether you're sharing this pointer with other
classes and/or whether your class is taking ownership of this data.

If it's for private use within your Qt/C++ class then, as other have said,
you don't need a shared ptr.

However, if you're sharing this data with others, and they can potentially
delete it, then it's a good idea to keep it as a shared ptr.

CMIIW.

HTH,
-mandeep



 Regards
 Phil Hannent

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qt build system

2013-07-15 Thread Mandeep Sandhu
On Tue, Jul 16, 2013 at 2:38 AM, Christian Gagneraud chg...@gna.org wrote:

 On 16/07/13 08:57, Carl Schumann wrote:
  Hi,
 
  I am using Qt in an environment where there is already a build
  infrastructure in place.   Because of the amount of per-existing non-Qt
  code it is not feasible to build everything with qmake, e.g., because
  slot is actually a very common variable and argument name in our
  existing code base.
 
  Therefore, I am trying to add Qt build support to our existing build
  system only for the programs that need it.   I would like to understand
  what the motivation is for the second command in the link rule of the
  qmake-generated Makefile please:
  $(TARGET):  $(OBJECTS)
   $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
   { test -n $(DESTDIR)  DESTDIR=$(DESTDIR) || DESTDIR=.; } 
 test $$(gdb --version | sed -e 's,[^0-9]\+\([0-9]\)\.\([0-9]\).*,\1\2,;q')
 -gt 72  gdb --nx --batch --quiet -ex 'set confirm off' -ex save
 gdb-index $$DESTDIR -ex quit '$(TARGET)'  test -f $(TARGET).gdb-index 
 objcopy --add-section '.gdb_index=$(TARGET).gdb-index' --set-section-flags
 '.gdb_index=readonly' '$(TARGET)' '$(TARGET)'  rm -f $(TARGET).gdb-index
 || true
 Hi Carl,

 I'm not an expert with all of these, but obviously, the second command
 adds a GDB index section to the binary target if GDB version is greater
 than 7.2, according to [1], it speeds up GDB when debugging.
 The index is generated with gdb --nx --batch ... and the section added
 with objcopy --add-section ...


Also, this part is added in the Debug builds only.

-mandeep




 Hope this helps.

 Chris

 [1] http://sourceware.org/gdb/onlinedocs/gdb/Index-Files.html

  If it makes a difference this is Qt 4.8.4.
 
  Thanks for your time.
 
  Sincerely,
  Carl Schumann
  ___
  Interest mailing list
  Interest@qt-project.org
  http://lists.qt-project.org/mailman/listinfo/interest

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Qt 5.1 online installer issue: Unable to uncheck QtCreator from install options

2013-07-12 Thread Mandeep Sandhu
I'm trying to install Qt5.1 on my system (Ubuntu 13.04, 32-bit).

The issue is that when choosing the components to install, it's not letting
me uncheck the Tools option. I don't want to install the creator that
comes bundled (it's the older 2.7.2) as I want to install the latest 2.8
one separately.

Even if I click on Deselect All button, the Tools option still remains
enabled.

Any clues as to why this is happening and how to fix it?

Thanks,
-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qt 5.1 online installer issue: Unable to uncheck QtCreator from install options

2013-07-12 Thread Mandeep Sandhu
Thanks Sergio,

I've noted my observations on the bug report.

-mandeep



On Fri, Jul 12, 2013 at 5:10 PM, Sergio Ahumada sergio.ahum...@digia.comwrote:

 Hi,

 On 07/12/2013 01:22 PM, Mandeep Sandhu wrote:
  I'm trying to install Qt5.1 on my system (Ubuntu 13.04, 32-bit).
 
  The issue is that when choosing the components to install, it's not
  letting me uncheck the Tools option. I don't want to install the
  creator that comes bundled (it's the older 2.7.2) as I want to install
  the latest 2.8 one separately.
 
  Even if I click on Deselect All button, the Tools option still remains
  enabled.
 
  Any clues as to why this is happening and how to fix it?
 
  Thanks,
  -mandeep

 I think this is an KnownIssue, see
 https://bugreports.qt-project.org/browse/QTBUG-28101

 AFAIU, there are some technical problems why QtCreator needs to be
 mandatory, but I don't have the details. Maybe you can comment on the
 JIRA task.

 Cheers,
 --
 Sergio Ahumada
 Release Engineer - Digia, Qt
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Triggering Actions on Application Close

2013-07-10 Thread Mandeep Sandhu
Here's a good article on how to handle unix signals the Qt way (i.e via
it's event loop):

http://qt-project.org/doc/qt-4.8/unix-signals.html

HTH,
-mandeep



On Wed, Jul 10, 2013 at 5:53 PM, franki fra...@franki.eu.org wrote:

 Dnia wtorek, 9 lipca 2013 o 00:33:44 Mitchell Verter napisał(a):
  How do I trigger cleanup actions on application close?
 
  I need to write out temporary objects and a footer to a file whenever
  the Application is closed.
 
  I've tried several approaches, but none of them produces any result
  when I Force Quit by hitting the red button within QtCreator.
 
  More specifically, I have tried to connect:
 
  QObject::connect(myApplication, SIGNAL(aboutToQuit()),
  myMainWindow,  SLOT(closeFileSlot()));
 
  (note that I am using a QApplication rather than a QCoreApplication --
  I'm not sure if it makes a difference)
 
  and also
 
  connect(myMainWindow, SIGNAL(destroy()), myMainWindow,
  SLOT(closeFileSlot()));
 
  Neither of these approaches seems to successfully trigger the
  closeFileSlot() Any suggestions about what the right technique might be?

 Hi

 If you are doing this on Linux, I've made it like this:

 in header:

 #include signal.h
 ...
 public slots:
  void terminate(bool fromSignal);
 .
 };
 extern C void terminate_wrapper(int dummy);

 in cpp file:
 in main class constructor:

 GlobalVariable= (void*)this;
 signal(SIGTERM,terminate_wrapper);
 


 void MainClass::terminate(bool fromSignal) {
 qDebug()MainClass::terminate;
 ... close my services
 qApp-quit();
 }

 void terminate_wrapper(int dummy) {
 MainClass *myApp=(MainClass*)GlobalVariable;
 myApp-terminate(true);
 }

 So every time I hit red button in QtCreator it sends SIGTERM to
 application,
 my wrapper catches it and I can do clean up.

 regards
 Marek


 
  Thanks
  Mitchell
  ___
  Interest mailing list
  Interest@qt-project.org
  http://lists.qt-project.org/mailman/listinfo/interest
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Hiding a shared lib? Linux of course.

2013-07-04 Thread Mandeep Sandhu
On Fri, Jul 5, 2013 at 3:33 AM, Guido Seifert warg...@gmx.de wrote:

 Yep, I know the pains of the Qt3 - Qt4 transition. I still had to work
 with Qt3 programs two years ago. But when it comes to pain... if I may
 translate a German proverb:
 Better an end with pain than pain without end.


I like this proverb...will be good as an email signature! :P



 Guido

 
  The Qt 3 to 4 change is what taught us not to break everything. Despite
 the
  script, porting code was a painful process. KDE took 3½ years doing it,
 from
  the first Qt 4.0 betas in June 2004 to the actual KDE 4.0 release in Jan
 2008
  (requiring Qt 4.3 at the time). We had to support Qt 3 for an awfully
 long
  period of time -- 4 years -- after 4.0 was out.


 --
 Guido Seifert warg...@gmx.de
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Simple doubt on file i/o

2013-06-27 Thread Mandeep Sandhu
Hi,

I wanted to know if I'm doing file i/o the right way in one of my apps.

I'm writing  a small helper class for one of my applications which is
supposed to store data, in the form of key-value pairs, in a file. This is
very similar to QSettings but w/o any fancy groups/sections that it
provides. So lets assume that I have to use a file based approach only! :)

It provides 2 functions - get(key) and a set(key, value) and they behave
exactly like QMaps equivalent functions, i.e if the key exists, it'll
overwrite the value, else it'll add a new entry. This class takes either a
filename as input or a QFile itself.

Assumptions:There won't be much data written to the file (max 1-2 KB). The
set function will not be called very often (probably once or twice in the
lifetime of the app). The get fxn will be called a little more often.

Here's what I do in the 2 functions (skipping error condition checks keep
it simple):

get(key):
* Open the file in Read-Only mode.
* Parse the data and prepare a QMap of the key-value pairs.
* Close the file
* Return the value for the key

set(key, value):
* Open the file in Read-Only mode.
* Parse the data and prepare a QMap of the key-value pairs.
* Close the file
* Open the file in Write-Only  Truncate mode
* Insert the new key-value in the map
* Write the map
* Close the file

In the set function I'm opening the file twice - once to read it's content
and prepare the map and next I open it in truncate mode as I want to wipe
off the existing data and write the new data afresh.

Is there a simpler way to achieve what I'm doing with a file? I'm assuming
the 2 open-close calls in set() are ok as it won't be called very often.

Thoughts?

Thanks,
-mandeep
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Simple doubt on file i/o

2013-06-27 Thread Mandeep Sandhu
On Thu, Jun 27, 2013 at 12:58 PM, Arne Dirks arne.di...@iathh.de wrote:

 On 06/27/2013 08:56 AM, Mandeep Sandhu wrote:
  get(key):
  * Open the file in Read-Only mode.
  * Parse the data and prepare a QMap of the key-value pairs.
  * Close the file
  * Return the value for the key
 
  set(key, value):
  * Open the file in Read-Only mode.
  * Parse the data and prepare a QMap of the key-value pairs.
  * Close the file
  * Open the file in Write-Only  Truncate mode
  * Insert the new key-value in the map
  * Write the map
  * Close the file

 Is there a reason why you read the file every time you get/set
 something? Couldn't you read the file once during application startup,


Yes, there's a reason. The data fetched by the app is via a _relatively_
expensive network handshake with a remote service. The data returned is not
much and hence I thought it better to write it the moment i receive it.
There's a possibility that the app might be closed/crash due to some
external factors and if I have it in memory (as a map) then I'd have to the
network op all over again.

-mandeep



 store the data in a map and only write it out again when your
 application terminates, provided anything has changed at all?
 arne


 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Simple doubt on file i/o

2013-06-27 Thread Mandeep Sandhu
On Thu, Jun 27, 2013 at 1:01 PM, alexander golks a...@golks.de wrote:

  Thoughts?

 i would use a cache QMap, and keep it in sync just when needed.
 fill the cache from file on load/construction/first access, write the
 cache to
 file on destruction, thus you won't have any file access during
 setter/getter
 functions.

 you can do file handling in a thread to not block callers,
 you can force a write via timeout signal, e.g.
 do threaded sync to file after 5 seconds of last change to cache.


I agree with this method, though I believe it's a bit of an overkill for my
simplistic requirement.

Also, after the first access, the contents of the file will be cached in
the filesystem cache itself (which is in memory). Though there'll still be
the overhead of making a syscall to access that.

Thanks,
-mandeep


 and:
 pay attention to thread-safety if you need it.

 --
 /*
  *  An honest tale speeds best being plainly told.
  *  -- William Shakespeare, Henry VI
  */

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Simple doubt on file i/o

2013-06-27 Thread Mandeep Sandhu
On Thu, Jun 27, 2013 at 1:09 PM, Nishant Parashar nishsi...@gmail.comwrote:

 Since the data is very less. Read the file once during start-up of app and
 prepare the in-memory QMap. This QMap is used for any set/get calls by the
 app, don't read/write to file. Finally when we exit the app, write the QMap
 to file wiping out old contents.


The only problem here is that if the app unexpectedly quits, then I've lost
this data. As I mentioned earlier, since this data is fetched over the n/w
I'd rather commit it immediately.

Thanks,
-mandeep



 On 27 June 2013 12:26, Mandeep Sandhu mandeepsandhu@gmail.com wrote:

 Hi,

 I wanted to know if I'm doing file i/o the right way in one of my apps.

  I'm writing  a small helper class for one of my applications which is
 supposed to store data, in the form of key-value pairs, in a file. This is
 very similar to QSettings but w/o any fancy groups/sections that it
 provides. So lets assume that I have to use a file based approach only! :)

 It provides 2 functions - get(key) and a set(key, value) and they behave
 exactly like QMaps equivalent functions, i.e if the key exists, it'll
 overwrite the value, else it'll add a new entry. This class takes either a
 filename as input or a QFile itself.

 Assumptions:There won't be much data written to the file (max 1-2 KB).
 The set function will not be called very often (probably once or twice in
 the lifetime of the app). The get fxn will be called a little more often.

 Here's what I do in the 2 functions (skipping error condition checks keep
 it simple):

 get(key):
 * Open the file in Read-Only mode.
 * Parse the data and prepare a QMap of the key-value pairs.
 * Close the file
 * Return the value for the key

 set(key, value):
 * Open the file in Read-Only mode.
 * Parse the data and prepare a QMap of the key-value pairs.
 * Close the file
 * Open the file in Write-Only  Truncate mode
 * Insert the new key-value in the map
 * Write the map
 * Close the file

 In the set function I'm opening the file twice - once to read it's
 content and prepare the map and next I open it in truncate mode as I want
 to wipe off the existing data and write the new data afresh.

 Is there a simpler way to achieve what I'm doing with a file? I'm
 assuming the 2 open-close calls in set() are ok as it won't be called very
 often.

 Thoughts?

 Thanks,
 -mandeep


 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest



___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Simple doubt on file i/o

2013-06-27 Thread Mandeep Sandhu
On Thu, Jun 27, 2013 at 1:56 PM, André Hartmann
andre.hartm...@iseg-hv.dewrote:

 Hello,

  QSettings uses specific locations for storing its contents. I don't
  think one can specify which file to use to QSettings.

 Sure you can. Just use QSettings::IniFormat and see here:

 http://doc.qt.digia.com/4.6/qsettings.html#QSettings-4

 The only problem I can see is, if you want to store and read non-ASCII
 data. But if I remember correctly, you can also set the file encoding
 with setIniCodec() (since Qt 4.5)


Thanks André/René. I somehow missed this API in QSettings.

Regards,
-mandeep




 Regards,
 André

 
  My application already uses QSettings for storing app wide settings.
 
  The data I plan to store in the file is sensitive and I'd like to store
  it in a specific location only (like an encrypted partition). Another
  way is to store the data after encrypting it but I'm not doing that
  right now as I don't have a good management facility on my (embedded)
  platform.
 
  -mandeep
 
 
 
 
  André
 
  --
  You like Qt?
  I am looking for collegues to join me at i-Optics!
 
  ___
  Interest mailing list
  Interest@qt-project.org mailto:Interest@qt-project.org
  http://lists.qt-project.org/mailman/listinfo/interest
 
 
 
 
  ___
  Interest mailing list
  Interest@qt-project.org
  http://lists.qt-project.org/mailman/listinfo/interest
 
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Desktop deployment

2013-06-21 Thread Mandeep Sandhu
Hi,

We too use a custom build step for packaging all the
binaries/libraries/resources for deployment, though this step is done
outside of qmake from a top-level Makefile.

We are almost building a mini Linux distribution for our embedded product,
so the final packaging step involves copying all built stuff from different
sub-projects (many of which have their own build-systems) into a common
area which is used as-is for deployment.

We have a 'install' dir for almost all our projects (main app, Qt libs,
external libraries etc). The final packaging step involves cherry picking
the correct files from this install dir and copying it over in a
release dir (we also modify some files like qt.conf in this step to
reflect the directory structure in use in the release dir).

HTH,
-mandeep



On Thu, Jun 20, 2013 at 12:09 PM, Stephen King
stephen.k...@domino-uk.comwrote:



 Hi,

 We use a custom build step in our .pro file to copy everything into a
 single directory ready for deployment (onto WinCE in our case). I think
 that using qmake you have all of the information you need for example the
 QT variable holds which Qt modules you're using so you can use that to
 figure out which Qt Dlls to copy.

 Then again if you're doing everything in VisualStudio it might be easier
 to just create an installer for internal consumption from within VS, it's
 pretty easy to just drag in the dependencies.

 Regards,
 Steve


 -Original Message-
 From: interest-bounces+stephen.king=domino-uk@qt-project.org [mailto:
 interest-bounces+stephen.king=domino-uk@qt-project.org] On Behalf Of
 Yves Bailly
 Sent: 20 June 2013 07:13
 To: Interest@qt-project.org
 Subject: Re: [Interest] Desktop deployment

 Le 20/06/2013 01:16, Alex Malyushytskyy a écrit :
  I just wanted to point that you must to deploy all dependencies not only
 Qt.
  You will have to deploy VC CRTs at least if your application has no
 other dependencies.

 I'm perfectly aware of this. Here my problem is more in the case where I
 just want to copy my exe to someone's else computer (which already have
 already all the needed standard runtimes installed).
 Creating a full-fledged, customer-targeted installer is another matter,
 which is already nicely handled.

 Regards,

 --
   /- Yves Bailly - Software developer   -\
   \- Sescoi RD  - http://www.sescoi.fr -/ The possible is done. The
 impossible is being done. For miracles, thanks to allow a little delay.
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest
 
 Visit our website at http://www.domino-printing.com
 
 This Email and any files transmitted with it are intended only for the
 person or entity to which it is addressed and may contain confidential
 and/or privileged material. Any reading, redistribution, disclosure or
 other use of, or taking of any action in reliance upon, this information by
 persons or entities other than the intended recipient is prohibited.  If
 you are not the intended recipient please contact the sender immediately
 and delete the material from your computer.

 E-mail may be susceptible to data corruption, interception, viruses and
 unauthorised amendment and Domino UK Limited does not accept liability for
 any such corruption, interception, viruses or amendment or their
 consequences.
 
 Domino UK Limited. Registered in England. Registered Number:1750201.
 Registered Office Address: Trafalgar Way, Bar Hill, Cambridge, CB23 8TU.

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Terminating a QThread

2013-06-21 Thread Mandeep Sandhu
On Fri, Jun 21, 2013 at 1:36 PM, francois cellier f_cell...@yahoo.frwrote:

 Dear all,

 Even if I know that it can be dangerous to terminate a thread, I need to
 do it for my application.
 The function that run into the thread is like a long linear sequence of
 code that has not been designed in a signal/slot way. Moreover, in my
 thread, I need an eventloop as I use in it some TCP or UDP  Qt sockets.

 I have tried the worker approach with the following code and I did not
 find a way to terminate the thread :

 For my thread class :

1. ThreadEx::ThreadEx(QObject http://qt-project.org/doc/QObject.html
*parent) :
2. QThread http://qt-project.org/doc/QThread.html(parent)
3. {
4. }
5.
6. void ThreadEx::run()
7. {
8. QThread http://qt-project.org/doc/QThread.html::
setTerminationEnabled(true);
9. exec();
10. }



 For my worker class:

1. 
 ObjectInThread::ObjectInThread(QObjecthttp://qt-project.org/doc/QObject.html
*parent) :
2. QObject http://qt-project.org/doc/QObject.html(parent)
3. {
4. }
5.
6.
7. void ObjectInThread::run()
8. {
9.int compteur = 0;
10. //here i am using a loop instead of the long linear flow  but it
is not a loop  in the real code
11. while(1)
12. {
13. qDebug() compteur;
14. compteur++;
15. Sleep(1000);
16. }
17. }

 You use a condition variable in your loop here, which will exit out of the
run() function. This variable can be set from your stop() slot (protected
by a mutex if needed).
In your main(GUI) thread you can wait for your worker thread to exit:

m_thread-quit();
m_thread-wait();

HTH,
-mandeep


This should cleanly exit the thread.


 Moreover I tried the other way of using QThread that consists in
 inheriting the QThread class and overriding the run method with the code :

 void ThreadEx::run()
 {
 int compteur = 0;
 while(1)
 {
  qDebug() compteur;
  compteur++;
  sleep(1);
 }
 }

 In that case terminate works but I do not have an eventloop as I did not
 call the exec method.

 Is this the expected behaviour ?

 I am using Qt5.1 on centOS / RedHat 6.2. I have also tried this on Windows
 with no more success.

 Thanks for your help,
 François



 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


  1   2   >