SUSE Linux 10.0 Unleashed

KDevelop began as an IDE to rapidly produce C++ code for use in KDE projects. Since its inception it has grown to support 13 compiled and scripting languages. It is not part of the standard SUSE Linux installation, but you can install the necessary packages in YaST.

KDevelop automates many of the tasks needed to create new programs. In fact, you won't even need to write anything yourself to produce a "Hello World" program in several languages! You will, however, get a sense of how such a program is built in the real-world KDE environment. Let's walk through the process of creating quality, free GUI software for KDE.

Begin by opening KDevelop; it's located in the KDE menu under Development, Integrated Environment. A clean screen appears. Go to the Project menu and select New Project. A wizard appears. You'll see the array of available languages and default projects. Open the C++ tree and then the KDE branch. Scroll down to Simple KDE Application. When you select this option, a screenshot and description will display in the right panel, as shown in Figure 28.2.

Figure 28.2. Select a project and name it in the first KDevelop New Project Wizard screen.

Name the project KHello. Note that the Final Location line will revise itself. If you don't already have a source directory in your home directory, use the Browse button to create one. Click Next to continue.

The second screen sets general information about you, the developer, and defines the license this program will carry. By default, KDevelop selects the GPL, but you can use the drop-down menu (as shown in Figure 28.3) to choose another license if you like.

Figure 28.3. Choose from a variety of open-source licenses.

KDevelop pulls your name and email address from your KDE settings, but these fields are completely editable. It is a very good idea to include a valid email address, if not necessarily your primary one, with your free software, so users can contact you with bug reports and the like. Click Next to continue.

The third and fourth screens set up your header file and your program template. Both include the standard GPL announcement, regardless of what license you selected in the previous screen. You may want to edit or delete this if you are using a different license (you may also add other text to your header file or CPP file in these templates). When you are finished editing the templates, click Finish to create HelloWorld.cpp.

KDevelop displays its code in what it calls the IDEAl user interface (see Figure 28.4). You can adjust this in the Settings if it's not to your liking.

Figure 28.4. KDevelop generates a complete "Hello World" KDE program in C++ and displays it in this window.

If you use Execute Program from the Build menu, KDevelop will ask to run Automake and Configure first. This is good practice. KDevelop will do that and then run the application.

After the program runs, click the File Selector tab on the left side of the KDevelop window. These files were all created by the wizard and are standard pieces of Linux applications. Click any file and it will open in the editor. In your real programs, be nice to your users. Modify the INSTALL file if users need to do something unusual to get your program working. Include README information and NEWS on this version's progress. If you have specific plans for the program, by all means share those plans in the TODO file.

Категории