Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Publicaciones sobre kde (publicaciones antiguas, página 19)

Rethinking my fax solution

I de­cid­ed to re­do most of it, be­cause I think I fig­ured out a bet­ter way.

  1. Use efax in­­stead of mget­­ty+send­­fax

Af­ter al­l, efax works with my mo­dem and send­fax does­n't ;-)

  1. Write a gen­er­ic spool­ing thin­ga­­ma­jig for efax (this is easy)

  2. Re­write print­­­fax.­­pl in a sim­­pler way (done)

  3. Sim­­pli­­fy the win­­dows side.

For­get about a Qt ap­p. All that's need­ed is a prog­gie that lis­tens on a port, ac­cepts con­nec­tion­s. The con­nec­tion gives it a URL. It launch­es the de­fault brows­er with that URL.

If any­one read­ing this can write that pro­gram, I would re­al­ly like it. Use VB, use .NET, use Java, I don't care.

  1. Use the web app as the on­­ly in­­ter­­face.

What's miss­ing yet:

  • Writ­ing the queu­ing pro­­gram (should use same for­­mat as mget­­ty+send­­fax's)

  • The win­­dows "clien­t"

  • Mi­nor tweaks to the web app ( ba­si­­cal­­ly a form for the send­ing data)

And that's it.

Oth­er than the win­dows thing, it's about a day's work.

Further IUP/Qt advances: Canvas

I keep work­ing on it, which is nice. I have fin­ished the skele­ton of the im­ple­men­ta­tion of a Qt driv­er for the CD can­vas.

I had it kin­da work­ing with the gener­ic X driver, but it sucked a bit to have this lar­gish chunk of Mo­tif code I did­n't un­der­stand in the mid­dle of it al­l.

It has on­ly the most ba­sic stuff im­ple­ment­ed, and the scroll­bar stuff is not there, but it does draw and set col­ors ;-)

So, right now, the next step is get­ting the iup­con­trols li­brary up, but that should­n't be too hard, I think.

But, we'll see.

PS: If any­one reads this and wants to check it out, just email me, I can ship it.

Now I remember why I don't like C++

I have refac­tored IUP/Qt in­to a love­ly ob­ject hi­er­ar­chy. And I now re­mem­ber why I dis­like C++.

Here's the ba­sic prob­lem (code may be wrong, I don´t have the bro­ken ver­sions any­more):

I have a base class IOb­jec­t, that has stub set­ter­s/get­ters for all the IUP at­tributes.

For each kind of wid­get, I cre­ate a class that in­her­its from IOb­ject and the match­ing Qt wid­get (ex­am­ple: QDi­alog).

These have to be hooked in­to an Ihan­dle struc­ture through the use of a void * (re­mem­ber, that's C, I have that too ;-)

Now, this was my first naive ap­proach:

Ihandle *n;
IQDialog *d=new IQDialog();
n->handle=d; //handle is a void*

That com­piles ok. How­ev­er, when you try to call a d mem­ber lat­er (and I know I am us­ing old C cast­s... they had worked for me un­til to­day!) ...

((IObject *)(n->handle))set_title("Title here");

Blam­mo, seg­fault. Why? Be­cause in one of the as­sign­ments to/from void *, the point­er for some rea­son starts to point else­where.

Here´s what Glip­tic at #C++ sug­gest­ed, and it does work:

Ihandle *n;
IQDialog *d=new IQDialog();
n->handle=static_cast <void *>(static_cast < IObject *> (d));

Right, I have to cast it twice.

And here is how you get it back:

(static_cast < IObject * >(n->handle))->set_title ("Some title");

Is­n't this just ridicu­lous­ly weird for any­one com­ing from any oth­er lan­guage?

Or am I miss­ing some­thing com­plete­ly?

But the good news is, it works ok, and the Qt back­end now has a de­cent struc­ture to hack on.

IUP/Qt preview

Ok, here is ver­sion 0.0.1 of my Qt4 back­end for IUP . It's not very good, but a bunch of things work. A whole bunch more do not, of course.

I am show­ing this just be­cause I want to re­write it, be­cause I no­ticed that I am writ­ing it like it was Mo­tif stil­l, and I must un­der­stand this is ac­tu­al­ly C++ and Qt code ;-)

Us­ing it along with DI­UP you can write sil­ly Lin­ux/Win­dows/­Mac GUIs from D, or you can use C. No LUA yet.

You can down­load it here (click on the "Free" but­ton and wait a while).

You will need Qt4 and qmake to make it work.

IUP/Qt is advancing

I have call­backs (some), ge­om­e­try man­age­men­t, LED files load­ing (re­source files) and it seems no hard parts are left.

That would mean the re­main­ing work is routi­nary, even if it's a large amount of it.

It's nice that I can switch back and forth be­tween the Mo­tif and Qt im­ple­men­ta­tions just by set­ting LD_LI­BRARY_­PATH to com­pare :-)


Contents © 2000-2023 Roberto Alsina