#include <welcomeWindow.h>
Public Member Functions | |
WelcomeWindow (QWidget *parent=0, const char *name=0) | |
Private Slots | |
void | itemClicked (QIconViewItem *item) |
Private Attributes | |
QGridLayout * | grid |
QLabel * | sideImage |
QLabel * | welcomeTitle |
QLabel * | welcomeMessage |
Items * | items |
Item * | help |
Item * | updates |
Item * | upcoming |
QPushButton * | closeButton |
Close button. |
Definition at line 26 of file welcomeWindow.h.
WelcomeWindow::WelcomeWindow | ( | QWidget * | parent = 0 , |
|
const char * | name = 0 | |||
) |
Definition at line 30 of file welcomeWindow.cpp.
References ALBUMSHAPER_VERSION, closeButton, grid, help, IMAGE_PATH, itemClicked(), items, sideImage, upcoming, updates, welcomeMessage, welcomeTitle, and WIDGET_SPACING.
00032 : 00033 QDialog(parent,name) 00034 { 00035 //-------------------------------------------------------------- 00036 //set window title 00037 setCaption( tr("Welcome to Album Shaper")); 00038 //-- 00039 sideImage = new QLabel( this ); 00040 sideImage->setPixmap( QPixmap( QString(IMAGE_PATH) + "miscImages/welcome.png" ) ); 00041 sideImage->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); 00042 //-- 00043 QFrame* itemsFrame = new QFrame(this); 00044 00045 welcomeTitle = new QLabel( QString(tr("Welcome to Album Shaper %1")).arg(ALBUMSHAPER_VERSION), itemsFrame ); 00046 QFont textFont = welcomeTitle->font(); 00047 textFont.setWeight(QFont::Bold); 00048 textFont.setPointSize( textFont.pointSize() + 2 ); 00049 welcomeTitle->setFont( textFont ); 00050 //-- 00051 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 ); 00052 welcomeMessage->setAlignment( Qt::AlignLeft | Qt::WordBreak | Qt::BreakAnywhere ); 00053 //-- 00054 items = new Items(itemsFrame); 00055 items->setItemTextPos( QIconView::Right ); 00056 items->setMaxItemWidth(500); 00057 items->setFrameShape ( QFrame::NoFrame ); 00058 items->setSelectionMode( QIconView::NoSelection ) ; 00059 00060 items->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); 00061 00062 items->setSpacing( WIDGET_SPACING ); 00063 00064 connect( items, SIGNAL(clicked(QIconViewItem*)), this, SLOT(itemClicked(QIconViewItem*)) ); 00065 00066 help = new Item( items, QPixmap(QString(IMAGE_PATH)+"welcomeImages/handbook.png"), 00067 tr("Read short tutorials which cover all of the program's ins and outs.") ); 00068 updates = new Item( items, QPixmap(QString(IMAGE_PATH)+"welcomeImages/updates.png"), 00069 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.") ); 00070 upcoming = new Item( items, QPixmap(QString(IMAGE_PATH)+"welcomeImages/upcoming.png"), 00071 tr("Take advantage of the power of open source development! Read about ongoing improvements and communicate with developers working on the project.") ); 00072 00073 //set text rects of icons 00074 int maxWidth = 0; 00075 QIconViewItem *item; 00076 for( item = items->firstItem(); item != NULL; item = item->nextItem() ) 00077 { 00078 if(item->textRect().width() > maxWidth) 00079 maxWidth = item->textRect().width(); 00080 } 00081 for( item = items->firstItem(); item != NULL; item = item->nextItem() ) 00082 { 00083 ((Item*)item)->setTextWidth( maxWidth ); 00084 } 00085 00086 00087 //-- 00088 closeButton = new QPushButton( 00089 //PLATFORM_SPECIFIC_CODE 00090 #ifndef Q_OS_MACX 00091 QPixmap(QString(IMAGE_PATH)+"buttonIcons/button_ok.png"), 00092 #endif 00093 tr("Close"), 00094 itemsFrame ); 00095 closeButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); 00096 closeButton->setDefault(true); 00097 connect( closeButton, SIGNAL(clicked()), SLOT(close()) ); 00098 //-- 00099 setPaletteBackgroundColor( white ); 00100 closeButton->setEraseColor( white ); 00101 //-- 00102 QGridLayout* grid = new QGridLayout( this, 1, 2, 0); 00103 grid->addWidget( sideImage, 0, 0 ); 00104 grid->addWidget( itemsFrame, 0, 1 ); 00105 00106 QGridLayout* itemsGrid = new QGridLayout( itemsFrame, 4, 3, 0 ); 00107 00108 itemsGrid->addMultiCellWidget( welcomeTitle, 0, 0, 0, 2 ); 00109 itemsGrid->addMultiCellWidget( welcomeMessage, 1, 1, 0, 2 ); 00110 itemsGrid->addMultiCellWidget( items, 2, 2, 0, 2 ); 00111 itemsGrid->addWidget( closeButton, 3, 1 ); 00112 00113 itemsGrid->setRowStretch( 2, 1 ); 00114 itemsGrid->setColStretch( 0, 1 ); 00115 itemsGrid->setColStretch( 2, 1 ); 00116 00117 itemsGrid->setMargin(WIDGET_SPACING); 00118 itemsGrid->setSpacing(WIDGET_SPACING); 00119 //-- 00120 this->show(); 00121 setFixedSize(size()); 00122 //------------------------------- }
void WelcomeWindow::itemClicked | ( | QIconViewItem * | item | ) | [private, slot] |
Definition at line 124 of file welcomeWindow.cpp.
References TitleWidget::aboutProgram(), TitleWidget::help(), help, UPCOMING, upcoming, UPDATES, and updates.
Referenced by WelcomeWindow().
00125 { 00126 if(item == NULL) 00127 return; 00128 00129 TitleWidget* tw = ((Window*)qApp->mainWidget())->getTitle(); 00130 00131 //help 00132 if(item == help) 00133 { 00134 tw->help(); 00135 return; 00136 } 00137 //updates 00138 else if(item == updates) 00139 { 00140 tw->aboutProgram(UPDATES); 00141 return; 00142 } 00143 //upcoming 00144 else if(item == upcoming) 00145 { 00146 tw->aboutProgram(UPCOMING); 00147 return; 00148 } 00149 }
QPushButton* WelcomeWindow::closeButton [private] |
QGridLayout* WelcomeWindow::grid [private] |
Definition at line 37 of file welcomeWindow.h.
Referenced by WelcomeWindow().
Item* WelcomeWindow::help [private] |
Definition at line 44 of file welcomeWindow.h.
Referenced by itemClicked(), and WelcomeWindow().
Items* WelcomeWindow::items [private] |
Definition at line 43 of file welcomeWindow.h.
Referenced by WelcomeWindow().
QLabel* WelcomeWindow::sideImage [private] |
Definition at line 39 of file welcomeWindow.h.
Referenced by WelcomeWindow().
Item * WelcomeWindow::upcoming [private] |
Definition at line 44 of file welcomeWindow.h.
Referenced by itemClicked(), and WelcomeWindow().
Item * WelcomeWindow::updates [private] |
Definition at line 44 of file welcomeWindow.h.
Referenced by itemClicked(), and WelcomeWindow().
QLabel* WelcomeWindow::welcomeMessage [private] |
Definition at line 41 of file welcomeWindow.h.
Referenced by WelcomeWindow().
QLabel* WelcomeWindow::welcomeTitle [private] |
Definition at line 40 of file welcomeWindow.h.
Referenced by WelcomeWindow().