/**************************************************************************** ** Form implementation generated from reading ui file 'qrulebook.ui' ** ** Created: Sat Dec 7 18:06:52 2002 ** by: The User Interface Compiler (uic) ** ** WARNING! You must not use the .ui anymore ** or all changes made in this file will be lost! ****************************************************************************/ #include "qrulebook.h" #include "variables.h" #include #include #include #include #include #include #include #include /* * Constructs a rulebook which is a child of 'parent', with the * name 'name' and widget flags set to 'f'. * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ QRuleBook::QRuleBook(QWidget* parent, const char* name ) : QDialog( parent, name, true ) { if ( !name ) setName( "rulebook" ); resize( 584, 480 ); setCaption( "Spacehulk rulebook" ); rulebookLayout = new QVBoxLayout( this, 11, 6, "rulebookLayout"); textpanel = new QTextBrowser( this, "textpanel" ); rulebookLayout->addWidget( textpanel ); Layout3 = new QHBoxLayout( 0, 0, 6, "Layout3"); QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); Layout3->addItem( spacer ); ok = new QPushButton( this, "ok" ); ok->setText( "Close" ); Layout3->addWidget( ok ); QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); Layout3->addItem( spacer_2 ); rulebookLayout->addLayout( Layout3 ); // signals and slots connections connect( ok, SIGNAL( clicked() ), this, SLOT( accept() ) ); // tab order // Textpanel initialisation. QString info(""); // char filename[255]; //sprintf(filename,"%s%cdoc%crulebook.html", DATA_DIR, DIR_DELIMITER, // DIR_DELIMITER); QString filename(DATA_DIR); filename += DIR_DELIMITER; filename += "rulebook.html"; QFile f(filename); if ( f.open(IO_ReadOnly) ) { // file opened successfully QTextStream t( &f ); // use a text stream while ( !t.eof() ) { // until end of file... info += t.readLine(); // line of text excluding '\n' info += '\n'; } f.close(); } textpanel->setText(info); } /* * Destroys the object and frees any allocated resources */ QRuleBook::~QRuleBook() { // no need to delete child widgets, Qt does it all for us }