AlbumShaper 1.0a3
welcomeWindow.cpp
Go to the documentation of this file.
1//==============================================
2// copyright : (C) 2003-2005 by Will Stokes
3//==============================================
4// This program is free software; you can redistribute it
5// and/or modify it under the terms of the GNU General
6// Public License as published by the Free Software
7// Foundation; either version 2 of the License, or
8// (at your option) any later version.
9//==============================================
10
11//Systemwide includes
12
13#include <qlayout.h>
14#include <qpixmap.h>
15#include <qlabel.h>
16#include <qfont.h>
17#include <qpushbutton.h>
18#include <qpushbutton.h>
19#include <qapplication.h>
20//Added by qt3to4:
21#include <Q3GridLayout>
22#include <Q3Frame>
23
24//Projectwide includes
25#include "welcomeWindow.h"
26#include "items.h"
27#include "item.h"
28#include "../window.h"
29#include "../titleWidget.h"
30#include "../../config.h"
31
32//==============================================
34 const char* name ) :
35 QDialog(parent,name)
36{
37 //--------------------------------------------------------------
38 //set window title
39 setCaption( tr("Welcome to Album Shaper"));
40 //--
41 sideImage = new QLabel( this );
42 sideImage->setPixmap( QPixmap( QString(IMAGE_PATH) + "miscImages/welcome.png" ) );
43 sideImage->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
44 //--
45 Q3Frame* itemsFrame = new Q3Frame(this);
46
47 welcomeTitle = new QLabel( QString(tr("Welcome to Album Shaper %1")).arg(ALBUMSHAPER_VERSION), itemsFrame );
48 QFont textFont = welcomeTitle->font();
49 textFont.setWeight(QFont::Bold);
50 textFont.setPointSize( textFont.pointSize() + 2 );
51 welcomeTitle->setFont( textFont );
52 //--
53 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 );
54 welcomeMessage->setAlignment( Qt::AlignLeft | Qt::TextWordWrap | Qt::TextWrapAnywhere );
55 //--
56 items = new Items(itemsFrame);
57 items->setItemTextPos( Q3IconView::Right );
58 items->setMaxItemWidth(500);
59 items->setFrameShape ( Q3Frame::NoFrame );
60 items->setSelectionMode( Q3IconView::NoSelection ) ;
61
62 items->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
63
64 items->setSpacing( WIDGET_SPACING );
65
66 connect( items, SIGNAL(clicked(Q3IconViewItem*)), this, SLOT(itemClicked(Q3IconViewItem*)) );
67
68 help = new Item( items, QPixmap(QString(IMAGE_PATH)+"welcomeImages/handbook.png"),
69 tr("Read short tutorials which cover all of the program's ins and outs.") );
70 updates = new Item( items, QPixmap(QString(IMAGE_PATH)+"welcomeImages/updates.png"),
71 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.") );
72 upcoming = new Item( items, QPixmap(QString(IMAGE_PATH)+"welcomeImages/upcoming.png"),
73 tr("Take advantage of the power of open source development! Read about ongoing improvements and communicate with developers working on the project.") );
74
75 //set text rects of icons
76 int maxWidth = 0;
77 Q3IconViewItem *item;
78 for( item = items->firstItem(); item != NULL; item = item->nextItem() )
79 {
80 if(item->textRect().width() > maxWidth)
81 maxWidth = item->textRect().width();
82 }
83 for( item = items->firstItem(); item != NULL; item = item->nextItem() )
84 {
85 ((Item*)item)->setTextWidth( maxWidth );
86 }
87
88
89 //--
90 closeButton = new QPushButton(
91 //PLATFORM_SPECIFIC_CODE
92 #ifndef Q_OS_MACX
93 QPixmap(QString(IMAGE_PATH)+"buttonIcons/button_ok.png"),
94 #endif
95 tr("Close"),
96 itemsFrame );
97 closeButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
98 closeButton->setDefault(true);
99 connect( closeButton, SIGNAL(clicked()), SLOT(close()) );
100 //--
101 setPaletteBackgroundColor( Qt::white );
102 closeButton->setEraseColor( Qt::white );
103 //--
104 Q3GridLayout* grid = new Q3GridLayout( this, 1, 2, 0);
105 grid->addWidget( sideImage, 0, 0 );
106 grid->addWidget( itemsFrame, 0, 1 );
107
108 Q3GridLayout* itemsGrid = new Q3GridLayout( itemsFrame, 4, 3, 0 );
109
110 itemsGrid->addMultiCellWidget( welcomeTitle, 0, 0, 0, 2 );
111 itemsGrid->addMultiCellWidget( welcomeMessage, 1, 1, 0, 2 );
112 itemsGrid->addMultiCellWidget( items, 2, 2, 0, 2 );
113 itemsGrid->addWidget( closeButton, 3, 1 );
114
115 itemsGrid->setRowStretch( 2, 1 );
116 itemsGrid->setColStretch( 0, 1 );
117 itemsGrid->setColStretch( 2, 1 );
118
119 itemsGrid->setMargin(WIDGET_SPACING);
120 itemsGrid->setSpacing(WIDGET_SPACING);
121 //--
122 this->show();
123 setFixedSize(size());
124 //-------------------------------
125}
126//==============================================
128{
129 if(item == NULL)
130 return;
131
132 TitleWidget* tw = ((Window*)qApp->mainWidget())->getTitle();
133
134 //help
135 if(item == help)
136 {
137 tw->help();
138 return;
139 }
140 //updates
141 else if(item == updates)
142 {
144 return;
145 }
146 //upcoming
147 else if(item == upcoming)
148 {
150 return;
151 }
152}
153//==============================================
Definition item.h:28
Definition items.h:26
Widget which displays album name, description, representative image, and album shaper logo.
Definition titleWidget.h:57
void aboutProgram(int mode=ABOUT)
Pops up about dialog.
void help()
Pops up HelpWindow.
QLabel * sideImage
void itemClicked(Q3IconViewItem *item)
QPushButton * closeButton
Close button.
QLabel * welcomeTitle
Q3GridLayout * grid
WelcomeWindow(QWidget *parent=0, const char *name=0)
QLabel * welcomeMessage
Top level widget, encapsulates the title widget, the layout widget, and the toolbar widget.
Definition window.h:40
QString IMAGE_PATH
Definition config.cpp:18
#define WIDGET_SPACING
Definition config.h:31
#define ALBUMSHAPER_VERSION
Definition config.h:21
#define UPDATES
Definition titleWidget.h:45
#define UPCOMING
Definition titleWidget.h:46