#include <welcomeWindow.h>
Inheritance diagram for WelcomeWindow:
Definition at line 26 of file 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. |
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.
00031 : 00032 QDialog(parent,name) 00033 { 00034 //-------------------------------------------------------------- 00035 //set window title 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 //set text rects of icons 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 //PLATFORM_SPECIFIC_CODE 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 } //==============================================
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] |
Item* WelcomeWindow::help [private] |
Items* WelcomeWindow::items [private] |
QLabel* WelcomeWindow::sideImage [private] |
Item * WelcomeWindow::upcoming [private] |
Item * WelcomeWindow::updates [private] |
QLabel* WelcomeWindow::welcomeMessage [private] |
QLabel* WelcomeWindow::welcomeTitle [private] |