LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   creating graphical front ends to commandline programs (http://www.linuxquestions.org/questions/programming-9/creating-graphical-front-ends-to-commandline-programs-142195/)

seidren 02-04-2004 09:52 AM

creating graphical front ends to commandline programs
 
Could anyone please explain to me, how are those graphical front ends such as k3b, grip, xcdroast etc work.

How do they get the information from the command line program (cdrecord etc..)

I searched the net and found articles on using tcl/tk to build frontends, but the programs I mentioned do not use tcl/tk. I would like to use C/C++ to make the frontends.

I would like to experiment with buildng gui frontends. Can anyone please shed some light.

Thanks,
Denesh.

jtshaw 02-04-2004 10:11 AM

They probably use system calls to execute the programs, capture there output, and parse it for updating there status fields in the gui. At least that is what I would do. But perhaps that is because I don't know a better way.

I am pretty sure programs like grip actually call the cdparanioa programs, and the encoder programs, and whatnot.

seidren 02-05-2004 07:39 AM

What you said is quite sensible... But what if the user has a different version of the backend software and the output of this is different from other versions... Do the frontend programs have to be able to parse all different backends??

Anyway how do you read the output of another program. Can anyone point me to a HOWTO or a sample program etc... I will be glad to try some examples.

Thanks.

synna 02-05-2004 12:41 PM

I think there are some classes in the boost (http://www.boost.org), I know that with wxWindows you can do it with a class like wxProcess. You can access an input stream and/or output stream of the process. If you don't want to use a library, I think you must use some pipe. If i'm correct, RealTimeBattle (it's a program) use it.

jtshaw 02-05-2004 12:50 PM

There really isn't a good answer for the version stuff. Well, there is and there isn't. I think a program like grip assumes you have at least a certain version of a tool (and most likely checks for it when you run ./configure before building it). People try pretty hard to make new versions of software backwards compatible with old versions. Most good developers make sure to make lots of announcements before drastically changing anything, especially one something like an audio encoder.

As far as reading a programs output, you can redirect it's output to a buffer you are reading from.

acid_kewpie 02-05-2004 02:21 PM

Wrapper UI's, like my own http://acidrip.sf.net work by doing what they need to do to get the results... sorry to sound dumb but there are oads of ways to access certain bits of information, generally it's though parsing the output of system calls and such....

you're asking about compatability etc... hell you're making the front end yourself, it is as compatible as you make it... there is no specification you have to conform to...

i'll tell you know though... generally C / C++ suck at text parsing, they're not desgined for it. you might want to look at a scripting language instead... perl or python for example.


All times are GMT -5. The time now is 03:18 PM.