Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

about.cpp

Go to the documentation of this file.
00001 //==============================================
00002 //  copyright            : (C) 2003 by Will Stokes
00003 //==============================================
00004 //  This program is free software; you can redistribute it 
00005 //  and/or modify it under the terms of the GNU General 
00006 //  Public License as published by the Free Software 
00007 //  Foundation; either version 2 of the License, or  
00008 //  (at your option) any later version.         
00009 //
00010 //  As a special exception, Will Stokes gives permission to 
00011 //  link this program with Qt non-commercial edition, and 
00012 //  distribute the resulting executable, without including the 
00013 //  source code for the Qt non-commercial edition in the 
00014 //  source distribution. 
00015 //==============================================
00016 
00017 //Systemwide includes
00018 #include <qlayout.h>
00019 #include <qlabel.h>
00020 #include <qfont.h>
00021 #include <qpixmap.h>
00022 #include <qtextbrowser.h>
00023 #include <qstringlist.h>
00024 #include <qdatetime.h>
00025  
00026 //Projectwide includes
00027 #include "about.h"
00028 #include "../config.h"
00029 
00030 #define DEFAULT_WIDTH 500
00031 #define DEFAULT_HEIGHT 400 
00032 //==============================================
00033 About::About( QWidget* parent,
00034               const char* name ) : 
00035               QDialog(parent,name)
00036 {
00037   //--
00038   //set window title
00039   setCaption( tr("About Album Shaper"));
00040   //--
00041   //set the background of the widget to be white
00042   setPaletteBackgroundColor( QColor(255, 255, 255) );
00043   //--
00044   //application logo
00045   albumShaperImage = new QPixmap( QString(IMAGE_PATH)+"albumShaper.png" );
00046   albumShaperLogo = new QLabel( this );
00047   albumShaperLogo->setPixmap( *albumShaperImage );
00048   //--
00049   //text labels
00050   QFont textFont( "Times", 12, QFont::Bold );
00051   
00052   progDesc = new QLabel( tr("Album Shaper 1.0a3, © 2003 Will Stokes"), this );
00053   progDesc->setFont( textFont );
00054   
00055   progURL = new QLabel( "http://albumshaper.sourceforge.net", this );
00056   progURL->setFont( textFont );
00057   //--
00058   //about scrollable box
00059   browser = new QTextBrowser( this ); 
00060   browser->setFrameStyle( QFrame::Panel | QFrame::Sunken );
00061   browser->mimeSourceFactory()->setFilePath( QStringList(TEXT_PATH) );
00062   browser->setSource( "about.html");
00063   //--
00064   grid = new QGridLayout( this, 5, 3, 0);
00065   grid->addWidget( albumShaperLogo,  0, 1, Qt::AlignCenter );
00066   grid->addWidget( progDesc,         2, 1, Qt::AlignCenter  );
00067   grid->addWidget( progURL,          3, 1, Qt::AlignCenter  );
00068   grid->addMultiCellWidget( browser, 4, 4, 0, 2 );
00069   //--
00070   //show birthday cake around Album Shaper's birthday (first release date - 4/3/2003)
00071   QDate currentDate = QDate::currentDate();
00072   if( currentDate.year() > 2003 && currentDate.month() == 4 && currentDate.day() <= 15)
00073   {
00074     QPixmap* cakeImage = new QPixmap( QString(EASTER_PATH)+"birthdayCake.png" );
00075     QLabel* cakeLogo = new QLabel(this);
00076     cakeLogo->setPixmap( *cakeImage );    
00077     QLabel* cakeLogo2 = new QLabel(this);
00078     cakeLogo2->setPixmap( *cakeImage );    
00079     QLabel* cakeMessage = new QLabel( QString( tr("Happy Birthday Album Shaper!") +  
00080                                                                         QString(" %1 ").arg(currentDate.year() - 2003) + 
00081                                                                         tr("Years Old!")), this ); 
00082     QFont birthdayFont( "Times", 12, QFont::Bold );
00083     cakeMessage->setFont(birthdayFont);  
00084     //-- 
00085     grid->addWidget( cakeLogo, 0, 0, Qt::AlignCenter );
00086     grid->addWidget( cakeLogo2, 0, 2, Qt::AlignCenter );
00087     grid->addMultiCellWidget( cakeMessage, 1, 1, 0, 2, Qt::AlignCenter );
00088   }  
00089   //--
00090   grid->setRowStretch( 4, 1 );  
00091   grid->setColStretch( 0, 1 );
00092   grid->setColStretch( 2, 1 );
00093   //--
00094   resize( DEFAULT_WIDTH, DEFAULT_HEIGHT );
00095   //-------------------------------
00096   //set window to not be resizeable
00097   this->show();
00098   setFixedSize(size());
00099   //-------------------------------
00100 }
00101 //==============================================
00102 void About::closeEvent( QCloseEvent* e)
00103 {
00104   aboutClosed();
00105   QWidget::closeEvent( e );
00106 }
00107 //==============================================

Generated on Thu Nov 13 00:10:53 2003 for AlbumShaper by doxygen 1.3.4