#include <qpromptshow.h>
Class diagram for QPromptShow:
Public Members | |||
![]() | ![]() | QPromptShow ( int argc = 0, char** argv = 0) | |
![]() | ![]() | ~QPromptShow () | |
Public Slots | |||
![]() | ![]() | void | setOptions () |
![]() | ![]() | void | startShow () |
![]() | ![]() | void | nextPrompt () |
![]() | ![]() | void | endShow () |
Protected Members | |||
![]() | ![]() | QBigTextWidget* | display |
![]() | ![]() | QFileSelectWidget* | file_select |
![]() | ![]() | QPushButton* | start_button |
![]() | ![]() | QPushButton* | end_button |
![]() | ![]() | QPushButton* | options_button |
![]() | ![]() | QListBox* | section_list |
![]() | ![]() | ifstream* | infile |
Protected Slots | |||
![]() | ![]() | void | rescanFile ( const char* ) |
![]() | ![]() | int | nextSection () |
This class takes over the execution of the program and does all the stuff that should be done to make for a complete application.
The application accepts any given text file and allows showing it line by line with the lines beginning with #
treaten as comments and blank lines delimiting sections. At the end of each section is the appropriate message box is shown to the user.
QPromptShow::QPromptShow (int argc = 0, char ** argv = 0) |
Constructor.
Here the application's main window is being built. All the controls are placed in some layouts so that the display widget will always take the most of the availeble space with the control buttons in the top right corner and the file name selector at the bottom.
All the signals get connected here and if after QApplication argument's parsing something is left from the command line, tis value is put into the file selection control.
QPromptShow::~QPromptShow () |
Destructor.
void QPromptShow::setOptions () [slot]
|
Pop up the options dialog and set them appropriately.
Creates the QOptionsWidget, fills in the values according to the current state of display member and executes the option dialog. If the execution was successfull (user ended dialog with OK button), the modified data is placed back in to the display widget.
void QPromptShow::startShow () [slot]
|
Start showing the prompts.
Starts the prompt show. Apart from opening appropriate input file this function also disables the controls that cannot be used during the show (i.e. options button and file selector). Some other controls are reconnected and renamed for different purposes. In particular Start show button becomes Next button and Quit becomes Stop show. The function takes into consideration which section was selected in section list and skips to that section.
void QPromptShow::nextPrompt () [slot]
|
Show the next prompt.
This function displays the next line of the input file. If the line is empty it also shows the End of section message box. At the same time the section list is being updated to reflect the section in which we are. At the end of the file it shows End of the prompt file message box and calls endShow() function.
void QPromptShow::endShow () [slot]
|
Abort the current show.
This function closes the input file and restores the controls to the default state.
void QPromptShow::rescanFile (const char * name) [protected, slot]
|
Rescan the prompt file to update the sections list.
This function skims through specified file and looks for sections. They are then given names (numbers) and put into the section_list widget.
int QPromptShow::nextSection () [protected, slot]
|
Skip to next section.
The text in the input file is divided into sections, where the section ends with one or more empty lines (empty means here nothing but a whitespaces). This function in fact just scans the file looking for a next empty line in it. It does not update a section list widget nor the display itself.
QBigTextWidget* QPromptShow::display [protected]
|
Main display area.
QFileSelectWidget* QPromptShow::file_select [protected]
|
File select widget.
QPushButton* QPromptShow::start_button [protected]
|
Start show/next button.
QPushButton* QPromptShow::end_button [protected]
|
End show/quit button.
QPushButton* QPromptShow::options_button [protected]
|
Opyions button.
QListBox* QPromptShow::section_list [protected]
|
The list with available sections in the file.
ifstream* QPromptShow::infile [protected]
|
The file from which prompts are read.