00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include <qlayout.h>
00014 #include <qpixmap.h>
00015 #include <qlabel.h>
00016 #include <qfont.h>
00017 #include <qpushbutton.h>
00018 #include <qpushbutton.h>
00019 #include <qapplication.h>
00020
00021
00022 #include "welcomeWindow.h"
00023 #include "items.h"
00024 #include "item.h"
00025 #include "../window.h"
00026 #include "../titleWidget.h"
00027 #include "../../config.h"
00028
00029
00030 WelcomeWindow::WelcomeWindow( QWidget* parent,
00031 const char* name ) :
00032 QDialog(parent,name)
00033 {
00034
00035
00036 setCaption( tr("Welcome to Album Shaper"));
00037
00038 sideImage = new QLabel( this );
00039 sideImage->setPixmap( QPixmap( QString(IMAGE_PATH) + "miscImages/welcome.png" ) );
00040 sideImage->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
00041
00042 QFrame* itemsFrame = new QFrame(this);
00043
00044 welcomeTitle = new QLabel( QString(tr("Welcome to Album Shaper %1")).arg(ALBUMSHAPER_VERSION), itemsFrame );
00045 QFont textFont = welcomeTitle->font();
00046 textFont.setWeight(QFont::Bold);
00047 textFont.setPointSize( textFont.pointSize() + 2 );
00048 welcomeTitle->setFont( textFont );
00049
00050 welcomeMessage = new QLabel( QString(tr("It appears you are a new Album Shaper user! Before you begin creating photo albums, you may want to explore the following features of this program:" ) ), itemsFrame );
00051 welcomeMessage->setAlignment( Qt::AlignLeft | Qt::WordBreak | Qt::BreakAnywhere );
00052
00053 items = new Items(itemsFrame);
00054 items->setItemTextPos( QIconView::Right );
00055 items->setMaxItemWidth(500);
00056 items->setFrameShape ( QFrame::NoFrame );
00057 items->setSelectionMode( QIconView::NoSelection ) ;
00058
00059 items->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
00060
00061 items->setSpacing( WIDGET_SPACING );
00062
00063 connect( items, SIGNAL(clicked(QIconViewItem*)), this, SLOT(itemClicked(QIconViewItem*)) );
00064
00065 help = new Item( items, QPixmap(QString(IMAGE_PATH)+"welcomeImages/handbook.png"),
00066 tr("Read short tutorials which cover all of the program's ins and outs.") );
00067 updates = new Item( items, QPixmap(QString(IMAGE_PATH)+"welcomeImages/updates.png"),
00068 tr("Keep up to date. If a new version of Album Shaper is available you'll see a pulsing light bulb appear in the bottom right corner of the application.") );
00069 upcoming = new Item( items, QPixmap(QString(IMAGE_PATH)+"welcomeImages/upcoming.png"),
00070 tr("Take advantage of the power of open source development! Read about ongoing improvements and communicate with developers working on the project.") );
00071
00072
00073 int maxWidth = 0;
00074 QIconViewItem *item;
00075 for( item = items->firstItem(); item != NULL; item = item->nextItem() )
00076 {
00077 if(item->textRect().width() > maxWidth)
00078 maxWidth = item->textRect().width();
00079 }
00080 for( item = items->firstItem(); item != NULL; item = item->nextItem() )
00081 {
00082 ((Item*)item)->setTextWidth( maxWidth );
00083 }
00084
00085
00086
00087 closeButton = new QPushButton(
00088
00089 #ifndef Q_OS_MACX
00090 QPixmap(QString(IMAGE_PATH)+"buttonIcons/button_ok.png"),
00091 #endif
00092 tr("Close"),
00093 itemsFrame );
00094 closeButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
00095 closeButton->setDefault(true);
00096 connect( closeButton, SIGNAL(clicked()), SLOT(close()) );
00097
00098 setPaletteBackgroundColor( white );
00099 closeButton->setEraseColor( white );
00100
00101 QGridLayout* grid = new QGridLayout( this, 1, 2, 0);
00102 grid->addWidget( sideImage, 0, 0 );
00103 grid->addWidget( itemsFrame, 0, 1 );
00104
00105 QGridLayout* itemsGrid = new QGridLayout( itemsFrame, 4, 3, 0 );
00106
00107 itemsGrid->addMultiCellWidget( welcomeTitle, 0, 0, 0, 2 );
00108 itemsGrid->addMultiCellWidget( welcomeMessage, 1, 1, 0, 2 );
00109 itemsGrid->addMultiCellWidget( items, 2, 2, 0, 2 );
00110 itemsGrid->addWidget( closeButton, 3, 1 );
00111
00112 itemsGrid->setRowStretch( 2, 1 );
00113 itemsGrid->setColStretch( 0, 1 );
00114 itemsGrid->setColStretch( 2, 1 );
00115
00116 itemsGrid->setMargin(WIDGET_SPACING);
00117 itemsGrid->setSpacing(WIDGET_SPACING);
00118
00119 this->show();
00120 setFixedSize(size());
00121
00122 }
00123
00124 void WelcomeWindow::itemClicked(QIconViewItem* item)
00125 {
00126 if(item == NULL)
00127 return;
00128
00129 TitleWidget* tw = ((Window*)qApp->mainWidget())->getTitle();
00130
00131
00132 if(item == help)
00133 {
00134 tw->help();
00135 return;
00136 }
00137
00138 else if(item == updates)
00139 {
00140 tw->aboutProgram(UPDATES);
00141 return;
00142 }
00143
00144 else if(item == upcoming)
00145 {
00146 tw->aboutProgram(UPCOMING);
00147 return;
00148 }
00149 }
00150