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

HelpWindow Class Reference

#include <helpWindow.h>

Inheritance diagram for HelpWindow:

Inheritance graph
[legend]
Collaboration diagram for HelpWindow:

Collaboration graph
[legend]
List of all members.

Detailed Description

Help window widget.

Definition at line 26 of file helpWindow.h.

Signals

void closed ()

Public Member Functions

 HelpWindow (QWidget *parent=0, const char *name=0)
 ~HelpWindow ()

Private Slots

void setPage (HELP_PAGE page)
void showFirstSelection ()
void showCurrentPage ()
void reject ()

Private Member Functions

void closeEvent (QCloseEvent *e)

Private Attributes

ALabelbillboard
QTextBrowsercontent
HELP_PAGE currentPage
QMimeSourceFactory * loadingMimeSource


Constructor & Destructor Documentation

HelpWindow::HelpWindow QWidget parent = 0,
const char *  name = 0
 

Definition at line 39 of file helpWindow.cpp.

References APPEAR_IMMEDIATELY, billboard, content, currentPage, Shortcuts::generateHTML(), LoadSave::generateHTML(), Manipulating::generateHTML(), ProTools::generateHTML(), Enhancing::generateHTML(), Framing::generateHTML(), Annotating::generateHTML(), Importing::generateHTML(), WhatsNew::generateHTML(), HELP_PAGE, IMAGE_PATH, loadingMimeSource, Contents::minimumSizeHint(), setPage(), ALabel::setPixmap(), showFirstSelection(), and SLIDE_OUT_LEFT.

00039                                                           : QDialog(parent,name)
00040 {
00041   //determine necessary encoding for reading and writing to html files
00042   QTextStream::Encoding fileEncoding;
00043   QString savingCharSet;
00044   QString loadingCharSet;
00045 
00046   //Mac OSX -> Use UTF16
00047   #if defined(Q_OS_MACX)
00048   fileEncoding = QTextStream::Unicode;
00049   savingCharSet = "utf16";
00050   loadingCharSet = "UTF-16";
00051   
00052   //Other UNIX or Windows with Unicode support -> Use UTF8
00053   #elif !defined(Q_WS_WIN) || (defined(Q_WS_WIN) && defined(UNICODE))
00054   fileEncoding = QTextStream::UnicodeUTF8;
00055   savingCharSet = "utf8";
00056   loadingCharSet = "UTF-8";
00057 
00058   //Windows without Unicode support (Win95/98/ME) -> Use Latin-1
00059   #else
00060   fileEncoding = QTextStream::Latin1;
00061   savingCharSet = "latin-1";
00062   loadingCharSet = "latin-1";
00063   #endif
00064   //-------------------------------------------------------------
00065   //generate html pages
00066   WhatsNew::generateHTML    (fileEncoding, savingCharSet);
00067   Importing::generateHTML   (fileEncoding, savingCharSet);
00068   Annotating::generateHTML  (fileEncoding, savingCharSet);
00069   Framing::generateHTML     (fileEncoding, savingCharSet);
00070   Enhancing::generateHTML   (fileEncoding, savingCharSet);
00071   ProTools::generateHTML    (fileEncoding, savingCharSet);
00072   Manipulating::generateHTML(fileEncoding, savingCharSet);
00073   LoadSave::generateHTML    (fileEncoding, savingCharSet);
00074   Shortcuts::generateHTML   (fileEncoding, savingCharSet);
00075   
00076   resize( 800, 400 );
00077   setPaletteBackgroundColor( QColor(255,255,255) );
00078 
00079   //set window title
00080   setCaption( tr("Album Shaper: Help"));
00081   //--
00082   //create billboard widget
00083   billboard = new ALabel( this, "helpBillboard", NULL,
00084                                   APPEAR_IMMEDIATELY, SLIDE_OUT_LEFT );
00085   billboard->setPixmap( QPixmap( QString(IMAGE_PATH)+"helpImages/helpBillboard.png") );
00086   currentPage = BILLBOARD;
00087   connect( billboard, SIGNAL(pixmapRemoved()),
00088            this, SLOT(showFirstSelection()) );
00089 
00090   //construct special mime source factory for loading html files for the contents and content frames
00091   loadingMimeSource = new QMimeSourceFactory();
00092   loadingMimeSource->setExtensionType("html",QString("text/html;charset=%1").arg(loadingCharSet) );
00093 
00094   //create contents widget
00095   Contents* contents = new Contents(fileEncoding, savingCharSet, loadingMimeSource, this);
00096   connect( contents, SIGNAL(setPage(HELP_PAGE)),
00097            this, SLOT(setPage(HELP_PAGE)) );
00098 
00099   //create widget for holding content
00100   content = new QTextBrowser( this );
00101   content->setHScrollBarMode( QScrollView::Auto );
00102   content->setVScrollBarMode( QScrollView::Auto );
00103   content->setMimeSourceFactory( loadingMimeSource );
00104   
00105   //PLATFORM_SPECIFIC_CODE
00106   //mac os x puts in a size grip that can interfere with the updates icon, in order
00107   //to avoid this we manually place the size grip ourselves
00108   //windows users expect a grip too, but qt doesn't put one in by default. we'll add
00109   //it for them too. :-)
00110 #if defined(Q_OS_MACX) || defined(Q_OS_WIN)
00111   content->setCornerWidget( new QSizeGrip(this) );
00112 #endif
00113     
00114   content->hide();
00115   //--
00116   //place items in grid layout
00117   QGridLayout* grid = new QGridLayout( this, 4, 3, 0);
00118   grid->addMultiCellWidget( billboard, 0,2, 0,0, Qt::AlignHCenter | Qt::AlignTop );
00119   grid->addWidget( contents, 1,1 );
00120   grid->addMultiCellWidget( content, 0,2, 2,2 );
00121 
00122   grid->setRowSpacing( 0, QMAX(billboard->sizeHint().height() - 
00123                                contents->minimumSizeHint().height(), 0)/2 );
00124   grid->setColSpacing( 1, contents->minimumSizeHint().width() );
00125   grid->setRowStretch( 1, 1 );
00126   grid->setColStretch( 2, 1 );
00127   //--
00128   //PLATFORM_SPECIFIC_CODE - Close Button
00129 #if (!defined(Q_OS_WIN) && !defined(Q_OS_MACX))
00130   QPushButton* closeButton = new QPushButton( tr("Close"), this );
00131   closeButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
00132   closeButton->setDefault(true);
00133   connect( closeButton, SIGNAL(clicked()), SLOT(close()) );
00134   grid->addMultiCellWidget( closeButton, 3,3, 0,2, Qt::AlignCenter );
00135 #endif  
00136   //--
00137 }

HelpWindow::~HelpWindow  ) 
 

Definition at line 139 of file helpWindow.cpp.

References loadingMimeSource.

00140 {
00141   delete loadingMimeSource;
00142   loadingMimeSource = NULL;
00143 }


Member Function Documentation

void HelpWindow::closed  )  [signal]
 

Referenced by closeEvent(), and reject().

void HelpWindow::closeEvent QCloseEvent *  e  )  [private]
 

Definition at line 145 of file helpWindow.cpp.

References closed().

00146 {
00147   QWidget::closeEvent( e );
00148   emit closed();
00149 }

void HelpWindow::reject  )  [private, slot]
 

Definition at line 151 of file helpWindow.cpp.

References closed().

00152 {
00153   QDialog::reject();
00154   emit closed();
00155 }

void HelpWindow::setPage HELP_PAGE  page  )  [private, slot]
 

Definition at line 157 of file helpWindow.cpp.

References billboard, currentPage, ALabel::removePixmap(), and showCurrentPage().

Referenced by HelpWindow().

00158 {
00159   //if billboard stillshown first remove it.
00160   if( currentPage == BILLBOARD )
00161   {
00162     billboard->removePixmap();
00163     currentPage = page;
00164     
00165     //show page only once billboard has finished sliding away to the left
00166   }
00167   else
00168   {
00169     currentPage = page;
00170     showCurrentPage();
00171   }
00172 }

void HelpWindow::showCurrentPage  )  [private, slot]
 

Definition at line 180 of file helpWindow.cpp.

References content, and currentPage.

Referenced by setPage(), and showFirstSelection().

00181 {
00182   if( currentPage == KEYBOARD_SHORTCUTS )
00183     content->setSource( Shortcuts::filename() );
00184   else if( currentPage == WHATS_NEW )
00185     content->setSource( WhatsNew::filename() );
00186 
00187   else if( currentPage == IMPORTING_AND_ORGANIZING )
00188     content->setSource( Importing::filename() );
00189   else if( currentPage == ANNOTATING_ALBUMS )
00190     content->setSource( Annotating::filename() );
00191   else if( currentPage == FRAMING )
00192     content->setSource( Framing::filename() );
00193   else if( currentPage == ENHANCING )
00194     content->setSource( Enhancing::filename() );
00195   else if( currentPage == PRO_TOOLS )
00196     content->setSource( ProTools::filename() );
00197   else if( currentPage == MANIPULATING )
00198     content->setSource( Manipulating::filename() );
00199   else if( currentPage == SAVING_AND_LOADING )
00200     content->setSource( LoadSave::filename() );
00201   else
00202     content->setText("");
00203   
00204   content->setFocus();
00205 }

void HelpWindow::showFirstSelection  )  [private, slot]
 

Definition at line 174 of file helpWindow.cpp.

References content, and showCurrentPage().

Referenced by HelpWindow().

00175 {
00176   content->show();
00177   showCurrentPage();
00178 }


Member Data Documentation

ALabel* HelpWindow::billboard [private]
 

Definition at line 46 of file helpWindow.h.

Referenced by HelpWindow(), and setPage().

QTextBrowser* HelpWindow::content [private]
 

Definition at line 47 of file helpWindow.h.

Referenced by HelpWindow(), showCurrentPage(), and showFirstSelection().

HELP_PAGE HelpWindow::currentPage [private]
 

Definition at line 49 of file helpWindow.h.

Referenced by HelpWindow(), setPage(), and showCurrentPage().

QMimeSourceFactory* HelpWindow::loadingMimeSource [private]
 

Definition at line 51 of file helpWindow.h.

Referenced by HelpWindow(), and ~HelpWindow().


The documentation for this class was generated from the following files:
Generated on Sat Apr 2 05:44:58 2005 for AlbumShaper by  doxygen 1.3.9.1