Units Conversion

339 views
Skip to first unread message

Ryan Kroetch

unread,
Sep 13, 2009, 3:44:40 PM9/13/09
to speedcrunch
I would love if Speedcrunch had the ability to convert units similar
to what is possible in google or some graphing calculators.

Is there anyone currently doing work towards unit conversion? I would
be interested in helping out anyone already working on unit-
conversions.

Helder Correia

unread,
Sep 13, 2009, 5:26:36 PM9/13/09
to speed...@googlegroups.com

Hi Ryan

Your question is somewhat related to this:
http://code.google.com/p/speedcrunch/issues/detail?id=153&q=unit

So the answer is that we need a new parser, but we struggle a lot to
find the time to fix/implement other things. If you can help there,
brilliant :)

Another option in the meantime is a dock/dialog where the user has a
simple interface to convert from one unit to another. Of course power
users like me would prefer the Google way...

On a totally unrelated topic, I'd like to apologize for the SPAM that
we haev received on the list recently. Messages from new users will
now be moderated by me before making it to the list.

Helder

Frederic Da Vitoria

unread,
Sep 14, 2009, 3:01:08 AM9/14/09
to speed...@googlegroups.com
2009/9/13 Helder Correia <helder.pere...@gmail.com>

About Spam: I wonder why (/if?) Google Groups is unable to filter them automatically. GMail does it perfectly, so that spam from the SC group is correctly tagged as spam. If Google Mail can do it, why does Google Groups not do it too?

--
Frederic Da Vitoria
(davitof)

Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org

Ryan Kroetch

unread,
Sep 15, 2009, 10:23:43 PM9/15/09
to speedcrunch
A units-conversion dock sounds like a suitable solution for now, and
something I can handle.
I've never worked with an OSS project before though, and do have some
questions.

From looking at the mainline, it seems like the prefered library
choice would be something copied into the tree, or home-spun in the
widget?
Looking around, I can only see a few libraries that are compatible
license-wise (boost has a little something that might be helpful, or
KDE has one used in the KRunner unit conversion (http://websvn.kde.org/
tags/KDE/4.3.1/kdeplasma-addons/libs/conversion/) that looks very
nice.

Would it be prefered to write this sort of thing from scratch within
the widget, or an internal library, or use an already existing library
merged into the project?

Other than that, I'll get right on hacking a conversion dock widget
into the speedcrunch mainline and see what happens.

On Sep 13, 3:26 pm, Helder Correia <helder.pereira.corr...@gmail.com>
wrote:

Ariya Hidayat

unread,
Sep 16, 2009, 9:02:55 AM9/16/09
to speed...@googlegroups.com
> From looking at the mainline, it seems like the prefered library
> choice would be something copied into the tree, or home-spun in the
> widget?
> Looking around, I can only see a few libraries that are compatible
> license-wise (boost has a little something that might be helpful, or
> KDE has one used in the KRunner unit conversion (http://websvn.kde.org/
> tags/KDE/4.3.1/kdeplasma-addons/libs/conversion/) that looks very
> nice.

That was from Petri Damstén, who happened to contribute to SpeedCrunch, too.

AFAICS it's been imported to kdelibs, i.e.
http://websvn.kde.org/trunk/KDE/kdelibs/kunitconversion/

--
Ariya Hidayat
http://www.linkedin.com/in/ariyahidayat

Ryan Kroetch

unread,
Sep 17, 2009, 12:31:33 AM9/17/09
to speedcrunch
I am looking into un-KDE'ing the conversion library in KDELibs to use
behind-the-scenes.
But before the behind-the-scenes stuff gets worked on, I put together
this little UI of a unit conversion dock.

http://speedcrunch.googlegroups.com/web/speedcrunch_units_initial.jpg

Instead of just listing the units, I think it will be a tree-view with
units children of categories when All is selected in the category
combobox.
The filter line-edits will have text that says something similar to
"Search units" which is replaced by nothing when the user puts those
line-edits into focus (KDE does this alot, and the limited horizontal
space makes it hard to match with the Search _______ style elsewhere
in speedcrunch)

Any comments suggestions on the UI or any suggestions on how to
persue the actual behind-the-scenes conversions are more than welcome.

Thanks,
Ryan Kroetch

Helder Correia

unread,
Sep 17, 2009, 5:59:59 PM9/17/09
to speed...@googlegroups.com
Hi Ryan

> I am looking into un-KDE'ing the conversion library in KDELibs to use
> behind-the-scenes.

That's great!

> But before the behind-the-scenes stuff gets worked on, I put together
> this little UI of a unit conversion dock.
> http://speedcrunch.googlegroups.com/web/speedcrunch_units_initial.jpg

Are you thinking of presenting the converted value in the same line
edit where the user inputs the original one? Because I don't see a
result section.

> Instead of just listing the units, I think it will be a tree-view with
> units children of categories when All is selected in the category
> combobox.

I'm sure you can write code along the one from the other docs that
have a search field.

Also, please be sure you follow the same design as the other docks:
create an independent unit conversion widget that can be then inserted
in a dock. Exception made for the math book, which I'll change when I
find the time.

Thank you for your effort.

Ryan Kroetch

unread,
Sep 17, 2009, 6:09:53 PM9/17/09
to speedcrunch
Thanks for the response, Helder

> Are you thinking of presenting the converted value in the same line
> edit where the user inputs the original one? Because I don't see a
> result section.

My thoughts on the result were to push it directly to the input text-
edit similar to how the rest of the variable and function docks work
now.

> I'm sure you can write code along the one from the other docs that
> have a search field.

Right now, as both of the views will be showing the same units it is
implemented using Qt's model-view classes with a QSortFilterProxyModel
in-between the model and the display widgets to filter / sort. My idea
is to have the model retrieve all the unit properties from the library
and also probably handle category filtering internally.
This feels a little overkill, but really simplifies having two widgets
showing the same thing through filters, and so far is staying really
clean in code.

> Also, please be sure you follow the same design as the other docks:
> create an independent unit conversion widget that can be then inserted
> in a dock. Exception made for the math book, which I'll change when I
> find the time.

Already pretty much an exact copy of the "variables" dock with all the
appropriate actions / menus, so that is already covered.

> Thank you for your effort.

And thank you for the good code example, I think my Qt skills have
already improved in just a few hours of working with the codebase.

Helder Correia

unread,
Sep 17, 2009, 6:24:19 PM9/17/09
to speed...@googlegroups.com
On Fri, Sep 18, 2009 at 00:09, Ryan Kroetch <ryan.k...@gmail.com> wrote:
> My thoughts on the result were to push it directly to the input text-
> edit similar to how the rest of the variable and function docks work
> now.

I like the idea, but I'm not sure whether the users will be 100% happy
with that. Maybe one just needs to perform a quick an independent
conversion most of times. But let's hope we get comments from our
users on this mailing list.

> This feels a little overkill, but really simplifies having two widgets
> showing the same thing through filters, and so far is staying really
> clean in code.

Sounds good.

> Already pretty much an exact copy of the "variables" dock with all the
> appropriate actions / menus, so that is already covered.

Cool stuff :)

> And thank you for the good code example, I think my Qt skills have
> already improved in just a few hours of working with the codebase.

I'm glad that all the effort put into writing good and clean code
instead of just a good application is attracting new developers, and
allowing them to learn even. Thank you once again.

Reply all
Reply to author
Forward
0 new messages