AlbumShaper  1.0a3
Signals | Public Member Functions | Private Slots | Private Member Functions | Private Attributes
HelpWindow Class Reference

Help window widget. More...

#include <helpWindow.h>

Inheritance diagram for HelpWindow:
Inheritance graph
[legend]
Collaboration diagram for HelpWindow:
Collaboration graph
[legend]

List of all members.

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

Detailed Description

Help window widget.

Definition at line 26 of file helpWindow.h.


Constructor & Destructor Documentation

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

Definition at line 39 of file helpWindow.cpp.

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

                                                          : QDialog(parent,name)
{
  //determine necessary encoding for reading and writing to html files
  QTextStream::Encoding fileEncoding;
  QString savingCharSet;
  QString loadingCharSet;

  //Mac OSX -> Use UTF16
  #if defined(Q_OS_MACX)
  fileEncoding = QTextStream::Unicode;
  savingCharSet = "utf16";
  loadingCharSet = "UTF-16";
  
  //Other UNIX or Windows with Unicode support -> Use UTF8
  #elif !defined(Q_WS_WIN) || (defined(Q_WS_WIN) && defined(UNICODE))
  fileEncoding = QTextStream::UnicodeUTF8;
  savingCharSet = "utf8";
  loadingCharSet = "UTF-8";

  //Windows without Unicode support (Win95/98/ME) -> Use Latin-1
  #else
  fileEncoding = QTextStream::Latin1;
  savingCharSet = "latin-1";
  loadingCharSet = "latin-1";
  #endif
  //-------------------------------------------------------------
  //generate html pages
  WhatsNew::generateHTML    (fileEncoding, savingCharSet);
  Importing::generateHTML   (fileEncoding, savingCharSet);
  Annotating::generateHTML  (fileEncoding, savingCharSet);
  Framing::generateHTML     (fileEncoding, savingCharSet);
  Enhancing::generateHTML   (fileEncoding, savingCharSet);
  ProTools::generateHTML    (fileEncoding, savingCharSet);
  Manipulating::generateHTML(fileEncoding, savingCharSet);
  LoadSave::generateHTML    (fileEncoding, savingCharSet);
  Shortcuts::generateHTML   (fileEncoding, savingCharSet);
  
  resize( 800, 400 );
  setPaletteBackgroundColor( QColor(255,255,255) );

  //set window title
  setCaption( tr("Album Shaper Help"));
  //--
  //create billboard widget
  billboard = new ALabel( this, "helpBillboard", NULL,
                                  APPEAR_IMMEDIATELY, SLIDE_OUT_LEFT );
  billboard->setPixmap( QPixmap( QString(IMAGE_PATH)+"helpImages/helpBillboard.png") );
  currentPage = BILLBOARD;
  connect( billboard, SIGNAL(pixmapRemoved()),
           this, SLOT(showFirstSelection()) );

  //construct special mime source factory for loading html files for the contents and content frames
  loadingMimeSource = new QMimeSourceFactory();
  loadingMimeSource->setExtensionType("html",QString("text/html;charset=%1").arg(loadingCharSet) );

  //create contents widget
  Contents* contents = new Contents(fileEncoding, savingCharSet, loadingMimeSource, this);
  connect( contents, SIGNAL(setPage(HELP_PAGE)),
           this, SLOT(setPage(HELP_PAGE)) );

  //create widget for holding content
  content = new QTextBrowser( this );
  content->setHScrollBarMode( QScrollView::Auto );
  content->setVScrollBarMode( QScrollView::Auto );
  content->setFrameStyle( QFrame::NoFrame );
  content->setMimeSourceFactory( loadingMimeSource );
  
  //PLATFORM_SPECIFIC_CODE
  //mac os x puts in a size grip that can interfere with the updates icon, in order
  //to avoid this we manually place the size grip ourselves
  //windows users expect a grip too, but qt doesn't put one in by default. we'll add
  //it for them too. :-)
#if defined(Q_OS_MACX) || defined(Q_OS_WIN)
  content->setCornerWidget( new QSizeGrip(this) );
#endif
    
  content->hide();
  //--
  //place items in grid layout
  QGridLayout* grid = new QGridLayout( this, 4, 3, 0);
  grid->addMultiCellWidget( billboard, 0,2, 0,0, Qt::AlignHCenter | Qt::AlignTop );
  grid->addWidget( contents, 1,1 );
  grid->addMultiCellWidget( content, 0,2, 2,2 );

  grid->setRowSpacing( 0, QMAX(billboard->sizeHint().height() - 
                               contents->minimumSizeHint().height(), 0)/2 );
  grid->setColSpacing( 1, contents->minimumSizeHint().width() );
  grid->setRowStretch( 1, 1 );
  grid->setColStretch( 2, 1 );
  //--
  //PLATFORM_SPECIFIC_CODE - Close Button
#if (!defined(Q_OS_WIN) && !defined(Q_OS_MACX))
  QPushButton* closeButton = new QPushButton( tr("Close"), this );
  closeButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
  closeButton->setDefault(true);
  connect( closeButton, SIGNAL(clicked()), SLOT(close()) );
  grid->addMultiCellWidget( closeButton, 3,3, 0,2, Qt::AlignCenter );
#endif  
  //--
}
HelpWindow::~HelpWindow ( )

Definition at line 140 of file helpWindow.cpp.

References loadingMimeSource.


Member Function Documentation

void HelpWindow::closed ( ) [signal]

Referenced by closeEvent(), and reject().

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

Definition at line 146 of file helpWindow.cpp.

References closed().

{
  QWidget::closeEvent( e );
  emit closed();
}
void HelpWindow::reject ( ) [private, slot]

Definition at line 152 of file helpWindow.cpp.

References closed().

{
  QDialog::reject();
  emit closed();
}
void HelpWindow::setPage ( HELP_PAGE  page) [private, slot]

Definition at line 158 of file helpWindow.cpp.

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

Referenced by HelpWindow().

{
  //if billboard stillshown first remove it.
  if( currentPage == BILLBOARD )
  {
    billboard->removePixmap();
    currentPage = page;
    
    //show page only once billboard has finished sliding away to the left
  }
  else
  {
    currentPage = page;
    showCurrentPage();
  }
}
void HelpWindow::showCurrentPage ( ) [private, slot]
void HelpWindow::showFirstSelection ( ) [private, slot]

Definition at line 175 of file helpWindow.cpp.

References content, and showCurrentPage().

Referenced by HelpWindow().

{
  content->show();
  showCurrentPage();
}

Member Data Documentation

Definition at line 46 of file helpWindow.h.

Referenced by HelpWindow(), and setPage().

Definition at line 47 of file helpWindow.h.

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

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: