Calculator runner

Matteo Agostinelli agostinelli at gmail.com
Tue Oct 6 22:00:05 CEST 2009


In data martedì 6 ottobre 2009 20:56:07, Aaron J. Seigo ha scritto:
: > On October 6, 2009, Matteo Agostinelli wrote:
> > * how should I detect the presence of qalculate on the system? Should I
> > let CMake find the library and then use the preprocessor (#ifdef, ....)
> > thus making it a compile-time optional dependency?
> 
> yes, i think it should be compile time. easiest way would probably be to
> create two classes, one with a libqalculate implementation and one with the
> qscript implementation and use one or the other in the #ifdef.

Ok, so I will take this approach.

> > * it was mentioned that thread safety is important in this case. How can
> > I find out if libqalculate is thread safe?
> 
> the inexact way would be to try it out in krunner ;)
> 
> the more exact way requires looking at the code in libqalculate itself and
> seeing if any non-local state (e.g. global or class variables) exist and if
>  so if the code that uses them are protected against reentrancy issues.

I'll try following the more exact way ;)

> > * I think it would be nice if the runner respects the same settings of
> > the plasmoid (if it's being used). Is there a way to do this, apart from
> > reading the plasma-desktop-appletsrc file?
> 
> right now the settings aren't even kept between applets; if you want that,
> then you need to change the calls to m_applet->config() in
>  QalculateSettings to m_applet->globalConfig().
> 
> as for sharing the settings between plasmoids and runners in krunner, you'd
> have to do that manually in some fashion.
> 
> you can't, however, assume plasma-desktop-appletsrc exists. safest would be
>  to create a separate config file for qalculate usage in kde
>  (libqalculaterc?).

> > BTW, while looking at the code I found a bug in the runner. The
> > expression 'e+' is interpreted as '^' instead of '*10^'. So if you type
> > 2e+2 you currently get the wrong result (4 instead of 200). The same
> > applies to 'e-'.
> 
> please feel free to fix that :)

done :)

Matteo


More information about the Plasma-devel mailing list