#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 |
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, Shortcuts::generateHTML(), LoadSave::generateHTML(), Manipulating::generateHTML(), ProTools::generateHTML(), Enhancing::generateHTML(), Framing::generateHTML(), Annotating::generateHTML(), Importing::generateHTML(), WhatsNew::generateHTML(), 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->setFrameStyle( QFrame::NoFrame ); 00104 content->setMimeSourceFactory( loadingMimeSource ); 00105 00106 //PLATFORM_SPECIFIC_CODE 00107 //mac os x puts in a size grip that can interfere with the updates icon, in order 00108 //to avoid this we manually place the size grip ourselves 00109 //windows users expect a grip too, but qt doesn't put one in by default. we'll add 00110 //it for them too. :-) 00111 #if defined(Q_OS_MACX) || defined(Q_OS_WIN) 00112 content->setCornerWidget( new QSizeGrip(this) ); 00113 #endif 00114 00115 content->hide(); 00116 //-- 00117 //place items in grid layout 00118 QGridLayout* grid = new QGridLayout( this, 4, 3, 0); 00119 grid->addMultiCellWidget( billboard, 0,2, 0,0, Qt::AlignHCenter | Qt::AlignTop ); 00120 grid->addWidget( contents, 1,1 ); 00121 grid->addMultiCellWidget( content, 0,2, 2,2 ); 00122 00123 grid->setRowSpacing( 0, QMAX(billboard->sizeHint().height() - 00124 contents->minimumSizeHint().height(), 0)/2 ); 00125 grid->setColSpacing( 1, contents->minimumSizeHint().width() ); 00126 grid->setRowStretch( 1, 1 ); 00127 grid->setColStretch( 2, 1 ); 00128 //-- 00129 //PLATFORM_SPECIFIC_CODE - Close Button 00130 #if (!defined(Q_OS_WIN) && !defined(Q_OS_MACX)) 00131 QPushButton* closeButton = new QPushButton( tr("Close"), this ); 00132 closeButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); 00133 closeButton->setDefault(true); 00134 connect( closeButton, SIGNAL(clicked()), SLOT(close()) ); 00135 grid->addMultiCellWidget( closeButton, 3,3, 0,2, Qt::AlignCenter ); 00136 #endif 00137 //-- 00138 }
HelpWindow::~HelpWindow | ( | ) |
Definition at line 140 of file helpWindow.cpp.
References loadingMimeSource.
00141 { 00142 delete loadingMimeSource; 00143 loadingMimeSource = NULL; 00144 }
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().
00147 { 00148 QWidget::closeEvent( e ); 00149 emit closed(); 00150 }
void HelpWindow::reject | ( | ) | [private, slot] |
Definition at line 152 of file helpWindow.cpp.
References closed().
00153 { 00154 QDialog::reject(); 00155 emit closed(); 00156 }
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().
00159 { 00160 //if billboard stillshown first remove it. 00161 if( currentPage == BILLBOARD ) 00162 { 00163 billboard->removePixmap(); 00164 currentPage = page; 00165 00166 //show page only once billboard has finished sliding away to the left 00167 } 00168 else 00169 { 00170 currentPage = page; 00171 showCurrentPage(); 00172 } 00173 }
void HelpWindow::showCurrentPage | ( | ) | [private, slot] |
Definition at line 181 of file helpWindow.cpp.
References ANNOTATING_ALBUMS, content, currentPage, ENHANCING, LoadSave::filename(), Manipulating::filename(), ProTools::filename(), Enhancing::filename(), Framing::filename(), Annotating::filename(), Importing::filename(), WhatsNew::filename(), Shortcuts::filename(), FRAMING, IMPORTING_AND_ORGANIZING, KEYBOARD_SHORTCUTS, MANIPULATING, PRO_TOOLS, SAVING_AND_LOADING, and WHATS_NEW.
Referenced by setPage(), and showFirstSelection().
00182 { 00183 if( currentPage == KEYBOARD_SHORTCUTS ) 00184 content->setSource( Shortcuts::filename() ); 00185 else if( currentPage == WHATS_NEW ) 00186 content->setSource( WhatsNew::filename() ); 00187 00188 else if( currentPage == IMPORTING_AND_ORGANIZING ) 00189 content->setSource( Importing::filename() ); 00190 else if( currentPage == ANNOTATING_ALBUMS ) 00191 content->setSource( Annotating::filename() ); 00192 else if( currentPage == FRAMING ) 00193 content->setSource( Framing::filename() ); 00194 else if( currentPage == ENHANCING ) 00195 content->setSource( Enhancing::filename() ); 00196 else if( currentPage == PRO_TOOLS ) 00197 content->setSource( ProTools::filename() ); 00198 else if( currentPage == MANIPULATING ) 00199 content->setSource( Manipulating::filename() ); 00200 else if( currentPage == SAVING_AND_LOADING ) 00201 content->setSource( LoadSave::filename() ); 00202 else 00203 content->setText(""); 00204 00205 content->setFocus(); 00206 }
void HelpWindow::showFirstSelection | ( | ) | [private, slot] |
Definition at line 175 of file helpWindow.cpp.
References content, and showCurrentPage().
Referenced by HelpWindow().
00176 { 00177 content->show(); 00178 showCurrentPage(); 00179 }
ALabel* HelpWindow::billboard [private] |
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] |