[Kde-java] KProgressTest program

KJ P kde-java@kde.org
Fri, 01 Mar 2002 09:50:00 +0000


Hello Richard

>particularly KDE-specific about starting a process. Is there a Java
>System.exec() or similar that could be used instead?
Yes I agree.  What I liked about KProcess was that you could start a process 
and block or not block.  The signals for when a process is finished I 
thought was good as well.  The System.exec() will work of course.

>Yes, the Qt examples are a good test for the bindings - I've fixed quite a 
>lot
>of bugs.
I can tell.  I will be trying them out this weekend.


I know it probably means nothing at all but while looking at the code of 
JavaSlot.cpp I thought that instead of testing the index < 
sizeof(javaToQtTypeSignatureMap)/sizeof(*javaToQtTypeSignatureMap) each and 
every time would it not be better to assign the length of the table to a 
variable and test against the variable instead of calculating every time as 
in the following:

const char *
JavaSlot::javaToQtSlotType(const char * javaTypeSignature, const char * 
signalString)
{
   int lenghtOfTable = 
sizeof(javaToQtTypeSignatureMap)/sizeof(*javaToQtTypeSignatureMap)

        for (   unsigned int index = 0;
                        index < lengthOfTable;
                        index++ )
        {
                if (    strcmp(javaTypeSignature, 
javaToQtTypeSignatureMap[index][0]) == 0
                                && (    signalString == 0
                                                || 
QObject::checkConnectArgs(signalString, (const QObject *) 0, 
javaToQtTypeSignatureMap[index][1]) ) )
                {
                        return javaToQtTypeSignatureMap[index][1];
                }
        }

        // If no matching C++ type signature is found, then just return the 
java one
        return javaTypeSignature;
}

I am not taking pot shots at the code it is just something that popped out 
at me while looking.  In c++ maybe it does not mean anything, it is just 
something I try to do in java programs to save some cpu cycles.  As the 
table grows in length this might help.

Regards


Kenneth

>From: Richard Dale <Richard_Dale@tipitina.demon.co.uk>
>Reply-To: kde-java@kde.org
>To: kde-java@kde.org
>Subject: Re: [Kde-java] KProgressTest program
>Date: Fri, 1 Mar 2002 02:44:41 +0000
>
>On Thursday 28 February 2002 12:44 am, KJ P wrote:
> > Here is a new one for the tests.
>Thanks, I've checked that one in.
>
> > You guys have been doing a lot on the Qt.  All sorts of new examples and
> > additions.
>Yes, the Qt examples are a good test for the bindings - I've fixed quite a 
>lot
>of bugs.
>
> > I have also been playing around with the KProcess.
> >
> > All works fine so far except.
> >
> >    - to load args it uses operators
> >         KProcess p1;
> >         p1 << "konsole" << "-e" << "args..";
> >
> >      to load the arguments for the executable.
> >
> >      I tried adding a method for the args but could not get it to work 
>at
> > all.
> >      The arguments list is marked as private so I can reference it.  I
> > tried using the << operator but that did not work at all.  Any ideas?
> >
> >    Also, the setExecutable method in the kprocess.cpp is marked as
> > depracated.  Since I have not been using KDE all that long how long do 
>the
> > deprecated methods usually last?
> >
> >    - The slots are not being fired.  I keep getting a recursive error 2
> > crash on beta2 and in 2.2.2 version of the bindings it was telling me
> > StringIndexOutOfBounds error.
>I spent a whole day trying to get KProcess to work properly once. The '<<'
>operators are pretty confusing and difficult to use - reinventing string
>concatenation really - can't see the point. Perhaps the best thing is to
>remove KProcess from the bindings, as there doesn't seem to be anything
>particularly KDE-specific about starting a process. Is there a Java
>System.exec() or similar that could be used instead?
>
>-- Richard
>_______________________________________________
>Kde-java mailing list
>Kde-java@mail.kde.org
>http://mail.kde.org/mailman/listinfo/kde-java




_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com