Making cross-environnment applications
*Linux Newbie Programmer here :)
I've been making applications for Windows and Mac and now it's time i start making apps for Linux. But here's the thing about Linux.. More than 1 Desktop Environment exist and so i'm wondering if the application that i will make will or will not work on all desktop environments (KDE, GNOME, Xfce etc.) And what is the best tool to make applications for Linux? I've heard of KDevelop.. is it any good? I'm using openSuSE 11 with KDE 4... |
KDE is based on the Qt libraries; GNOME and Xfce are based on GTK+. As long as the GTK+ and/or Qt libraries exist on the system, you can use the application, whatever your desktop environment or window manager choice be.
|
Quote:
It's just that i'm making applications with Qt toolkit and there is this one linux newbie using Ubuntu with GNOME and he doesn't know more than duble-clicking my application to open it :D |
I can't say for Ubuntu, but in Mandriva at least, the minimal GTK and QT packages are almost always installed, for such cases, and sometimes even the minimal Gnome and KDE packages.
And anyone not using Ubuntu or Mandriva (known to be newbie-friendly) surely knows at least how to use the package-manager. Speaking of that, you may want to explore LSB, which should ease cross-distribution working. Yves. |
Hah - unfortunately, no. You could have a "starter" script which will act as the launch point for your program: it would check to see if there is a Qt package installed - if not, install it using "apt-get" or "aptitude", then it would run your program.
Checking if Qt is installed would be a one-liner, something easy like grepping a DPKG list, or something...sorry I cannot be more specific on how to do a non-interactive command-line test for Qt's existence on a Debian-based system. Quote:
|
Now, of course besides the mainstream GTK and QT, there are many other graphical toolkits / widgets out there: wxWidgets, fltk, etc. Search here for more:
http://freshmeat.net/browse/851/ http://freshmeat.net/browse/810/ Also keep in mind that there exist a (substantial) group of users who dislike GUIs (including me), so don't feel like you have to use these to make simple programs that do menial tasks. I know that's probably how it works in Window$. |
H_TeXMeX_H -
You wouldn't happen to know of any eye-candy-ish C/C++ GUI toolkits for DOS (that's right: MS-DOS, or ROM-DOS), would you? TIA .. PSM PS: Quote:
|
Quote:
For text editor you can use vim, jedit, emacs, etc. - they should be available on all 3 platforms. For build tool you can use "gnu make", "gnu build tools"("autotools"), scons (www.scons.org), or qmake (part of Qt package, only for Qt-based applications). I'd recommend to use scons or qmake. There will be a problem with autotools on windows (you'll need MSys (www.mingw.org) or cygwin to build applications that use them), and although hand-written makefiles are quite portable, they might not be flexible enough for large projects. There are probably other build systems, like "Jam" but I never used them. If you really want IDE available on all platforms, then there should be eclipse, netbeans (haven't used it), anjuta and codeblocks. List of all ides is available on en.wikipedia.org. |
Another Question
So how does Firefox (for example) get it to be cross-environment? I mean it runs on GNOME and KDE and i have never installed GTK+ or Qt... how can i make something like that?? |
GTK+ and Qt are probably already installed on your system given OpenSuSE usually installs both libraries anyways.
Also, Firefox is built in something called XULRunner. As a side thought, I think it would be cool if there was a library out there that let you build a graphical application using generic classes or types, and then upon compiling, the user/administrator would decide whether they want to build it using Qt or GTK+ (or both with added -qt and -gtk suffixes?). Maybe something like this already exists...? It would cut down on a lot of re-writing and provide a nice layer/library for beginning programmers to use, in Linux, BSD and UNIX. |
Indienick - I don't think Firefox is "built in XULRunner". Here's the link:
https://developer.mozilla.org/en/XULRunner QueenZ - here's an example Firefox. It's running on Suse 9.3 (an admittedly old Firefox, running on an admittedly old version of Suse). As you can see from the "ldd" output (you can run the Linux command "ldd" on any executable to see what shared libraries it needs), this Firefox needs GTK runtime (and a ton of other stuff!) to work: Quote:
|
Quote:
http://members.chello.at/theodor.lauppert/dos/gui.htm Back to the OP, I forgot to mention an IDE to use. Well, you can use any, but I'd recommend at least that it have syntax highlighting. I use geany, but there are plenty more to choose from: http://freshmeat.net/browse/65/ |
Quote:
Firefox needs GTK and you have it installed. If you want to distribute application without too many external dependencies, either use static linking, or include dependencies into installer, or use only commonly used libraries (probably the hardest way). |
OK, so does it mean that if i don't have GTK+ libraries installed then i can't install Firefox??
|
Quote:
|
But why does it need GTK libraries instead of Qt libraries???
|
?? Do you know programing? Gtk has its own API, Qt has its own API, and they are different…
Or did I not understand the question? |
Then is Firefox made on GTK+? And why isn't it made on Qt?
and if i make a Qt application then i need to install Qt libraries on ubuntu to run my qt application? |
Exactly yes. As for why… Why is Colin McRae Rally done on win32 and directX instead of glibc and SDL? Who knows… Each developer/company has their preferences.
Yves. |
OK, so you guys said that most distros have gtk+ libraries already installed with them? Right? Do most distros also have Qt libraries installed with them? Is GTK+ more popular than Qt? (That's 3 questions..) :)
|
Quote:
Quote:
Quote:
There is two version of Qt - Qt 3 and Qt 4. Qt 3 is installed if distribution uses KDE 3 or if there are packages that require it, Qt 4 is installed if distribution uses Kde 4, or if there are applications that require it. Normally distributions has both libraries installed. Anyway, I wouldn't rely on popularity to pick GUI toolkit. Qt 4 is best known (to me) gui toolkit for C++. Gtk is suitable for C programming. Use library you most comfortable with. Stop worrying about dependencies. Your distribution have automatic dependency checking - i.e. if you make *.deb that specifies that your software requires Qt 4, package manager will download and install Qt 4 if necessary. Use whatever library you want, just specify dependencies in README or INSTALL document (for people that build from source), and within your *.deb package, and you will be fine. |
Quote:
You should worry about dependencies especially with qt, because as ErV says there is qt3 and qt4. Many distributions have only one installed, and although there exist packages for the other consider the fact that a full install of qt4 is about 900 MB in size. Please do take into account these factors, because it will dictate your user base. Personally I will not install qt4 just to run 1 program, nor will I install qt3 if most programs have already been ported to qt4. IMO, qt is not the best option, unless you want to make KDE-specific programs. I would use GTK+ because it doesn't have any correlation with a window manager (unlike KDE-QT). I can say that 99 % of desktop Linux users have GTK+ installed. You can't get around it because so many programs depend on GTK+. If you want to program in C++, then use gtkmm, most people will have that installed as well. Note: I am biased against KDE and QT, they are bloated s***, IMO. |
Quote:
Unless newbie will go berzerk and gather few hundreds of external dependencies (which is unlikely), it isn't important. The more important thing is to pick reasonable gui toolkit which won't drive you nuts later. Quote:
By removing documents, examples, demos and debug versions of libraries, installation size can be easily reduced to 79 megabytes (and probably even further - by killing Qt assistant, designer, stripping all binaries and so on). This is uncompressed size, in *.tar.bz2 it will be 23 megabytes. This is the size it will take for user package. Another thing is that Qt application can be deployed with all required Qt 4 libraries (on Windows platform, for example), and basic app will need only three or four of them. Or you could use static linking, as Opera did. See installation size of opera static package on linux, for example - no installation of Qt is required to run opera. Also Qt 3 and Qt 4 don't conflict. Quote:
It is more flexible, and it allows to create nicer-looking applications (which is important in certain situation). Take a look at qtdemo (included in full installation - example of all available technologies), for example. I never seen anything even close to that being developed in GTK. Qt 4 doesn't limit what you can do. You can make any widget you can think of. And it is fast, and has opengl support. Quote:
Qt 4 doesn't have correlation with window manager. To develop KDE application you use another set of libraries. Qt != KDE, as GTK != Gnome. You can make purely KDE or purely Gnome application, and it will be hell to build on some systems (example: GnuCash on slackware), but they won't be purely Qt or purely GTK applications. Besides, upgrading GTK+ is much more "fun" than upgrading Qt. GTK has 3 or 4 external dependencies that has to be built in certain order (pango, cairo and something else). Qt 4 has no such dependencies. Besides certain gtk plugins make life even funnier (gdkpixelbuf, I think?). I wouldn't use GTK unless i have to develop GUI using pure C only. No offfence, but it doesn't look to me like you have much experience in Qt 4 programming. So I'd recommend to keep aside. |
I know QT != KDE, but all KDE apps use qt. GNOME uses GTK but also a ton of other dependencies.
You're right I have never used qt4, but then I never made any quality-based comment on it. |
Quote:
From programmer's point of view - even if they have made custom preprocessor, their signal/slot model makes a lot of sense, and whole library is pretty clean/easy to use. The only problem with Qt 4 is its' license - you can't create closed-source application with it for free (but I heard something about Nokia changing licensing term to LGPL in future, so this problem might soon disappear), only GPL-licensed software. Several other toolkits have less restrictive licenses (wxWidgets, fox toolkit), but they don't even stand close to Qt in terms of quality. |
Quote:
|
All times are GMT -5. The time now is 11:26 PM. |