AlbumShaper
1.0a3
|
Help window widget. More...
#include <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 | |
ALabel * | billboard |
QTextBrowser * | content |
HELP_PAGE | currentPage |
QMimeSourceFactory * | loadingMimeSource |
Help window widget.
Definition at line 26 of file helpWindow.h.
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.
{ delete loadingMimeSource; loadingMimeSource = NULL; }
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] |
Definition at line 181 of file helpWindow.cpp.
References ANNOTATING_ALBUMS, content, currentPage, ENHANCING, Shortcuts::filename(), ProTools::filename(), Importing::filename(), Annotating::filename(), WhatsNew::filename(), LoadSave::filename(), Manipulating::filename(), Framing::filename(), Enhancing::filename(), FRAMING, IMPORTING_AND_ORGANIZING, KEYBOARD_SHORTCUTS, MANIPULATING, PRO_TOOLS, SAVING_AND_LOADING, and WHATS_NEW.
Referenced by setPage(), and showFirstSelection().
{ if( currentPage == KEYBOARD_SHORTCUTS ) content->setSource( Shortcuts::filename() ); else if( currentPage == WHATS_NEW ) content->setSource( WhatsNew::filename() ); else if( currentPage == IMPORTING_AND_ORGANIZING ) content->setSource( Importing::filename() ); else if( currentPage == ANNOTATING_ALBUMS ) content->setSource( Annotating::filename() ); else if( currentPage == FRAMING ) content->setSource( Framing::filename() ); else if( currentPage == ENHANCING ) content->setSource( Enhancing::filename() ); else if( currentPage == PRO_TOOLS ) content->setSource( ProTools::filename() ); else if( currentPage == MANIPULATING ) content->setSource( Manipulating::filename() ); else if( currentPage == SAVING_AND_LOADING ) content->setSource( LoadSave::filename() ); else content->setText(""); content->setFocus(); }
void HelpWindow::showFirstSelection | ( | ) | [private, slot] |
Definition at line 175 of file helpWindow.cpp.
References content, and showCurrentPage().
Referenced by HelpWindow().
{ content->show(); showCurrentPage(); }
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().