CS321 -- Lab 3: The Graphics Shell



->Courses
->CS321
-->Presentation
-->Lab 1
-->Lab 2
->Lab 3
-->Lab 4
-->Lab 5
-->Lab 6
-->Lab 7
-->Lab 8
->Electronic Submission
->Old Exams
->C++ Examples
->Unix Help
->Software
->Tentative Schedule
->Course Policies

[Courses]
[Rich][Home][Rich]
[Author]

Fall Quarter 2001

Purpose

The purpose of this lab is to develop independent learning skills through researching reference material associated with developing the framework for a graphical shell application.

Acknowledgement

This lab was developed by Dr. Henry Welch.

General Lab Information

To simplify development of graphical programs and to provide a more robust and uniform interface for products. A specialized graphical shell has been developed by Dr. Henry Welch for CS321. It uses Qt to provide a simple graphical user interface (GUI) with a drawing area, buttons, menu, and command line. Your project WILL BE REQUIRED to work within this shell.

Laptop Linux Users

To use the shell you will need to replace your Imakefile from lab 2 with the Imakefile in /usr/local/cs321 on concord. (You should already have cs321.cpp copied for the procedures in lab 2.) Once you have replaced the Imakefile with the one from concord, you will need to make one change:

#define CS321PATH /usr/local/cs321/
should be changed to
#define CS321PATH /mnt/win_d/cs321/

Concord Users

To use the shell the only files you need in your own directories are the Imakefile, Imake.tmpl, and cs321.cpp. After copying these files use the Imakefile (imake) to generate the Makefile which can be used (make cs321) to build the shell and then run it (./cs321).

Become familiar with the various features of the GUI shell and note that it simply generates event-driven call backs which do little more than cout before returning. (i.e., There is no functionality yet.)

You are to derive a class from the Shell class to add some functionality that supports the drawing of white pixels on the black background of the drawing area. As a minimum you will need to link in your container and shape class work (NOTE: you will find it necessary to update some of this previous work) and override the following virtual functions of Shell:

  • HelpText - to document your command line syntax and mouse usage
  • CmdParse - to parse the command line
  • Draw - the real workhorse (see below)
  • The constructors and destructors as appropriate

Draw is activated whenever any event occurs in the drawing window. This includes button presses and motions of the mouse, resizing, and exposures (when any part of the window is suddenly uncovered). When the drawing window is initially created by the GUI shell it will automatically generate an exposure event. For the present, ignore the resize event. When an exposure event occurs simply redraw all the points in your container using the QPainter methods. When a button press occurs (actually press or release, your choice) you will have to access the QEvent to determine the mouse information contained therein. After determining the mouse location create a point object and add it to your container and draw it.

Upon referencing QPainter you will find that you need a QWidget. The appropriate one is the protected drawArea member of the Shell class.

I will be more than happy to consult with you on an individual basis, but I have purposely left many of the details for you to research on your own.

More information on Qt can be found in the following places:

  • TrollTech Web Site
  • The concord man pages (e.g., man QPainter).
  • Qt Programming in 24 Hours, Sams, 2000.
  • Programming with Qt, Dalheimer, O'Reilly & Associates, Inc., 1999. [Be careful, much of this book was written for Qt 1.4, and we are using Qt 2.1.1. This is especially true for any text/string methods. If in doubt trust the sources above.]

Application demonstration

You should demonstrate the successful operation of your application before or during week 5 lab.

Lab report (due 11pm, the day prior to week 5 lab)

Your lab report should be self-contained. That is, it should be possible for someone to understand what you did and why without seeing anything other than your report and any previous reports that you have submitted. Your report should include:

  • Purpose
  • Problem Statement
  • Procedure -- what approach you used to solve the problem
  • Discussion including:
    • A tally of the number of new Non-commented Lines Of Code (NLOC) written for this lab assignment. You should use the CLC perl script on your code. Note: The first line of the file should be:
      #!/usr/bin/perl
      . If possible, break the NLOC down into the various features you needed to implement.
    • A summary of your activity log indicating how much time you spent on each phase of the assignment. Please report the time in the following categories:
      • Designing
      • Coding
      • Debugging (before you think it's working)
      • Testing (after you think it's working)
      • Report writing
      • Other
    • A narrative describing any specific problems you encountered and how you solved them.
  • Conclusions (what you learned, suggestions of how the lab could be improved, things you would have done differently, etc.)
  • Documented source code (clearly identifying any changes made since your last submission)
    You may wish to use gensrc, a shell script which will produce an XML document that may be used as a starting point for your report. The file will include all of the source code files (provided you modify the script appropriately... edit gensrc for details on how to do this.)
  • Be sure to address any areas concern from previous submissions.

As with any report you submit, correct spelling and grammar are required. In addition, your report should be submitted electronically following the Electronic Submission Guidelines. (You may wish to consult the sample report before submitting your report.) Be sure to keep copies of all your files, in case something gets lost. It may be wise to keep a diskette backup as well.

If you have any questions, consult the instructor.

© 1998-2001 Dr. Christopher C. Taylor Office: CC-27C Phone: 277-7339 Last Updated: September 19, 2001
I am responsible for all content posted on these pages; MSOE is welcome to share these opinions but may not want to.