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

Contents Class Reference

#include <contents.h>

Inheritance diagram for Contents:

[legend]
Collaboration diagram for Contents:
[legend]
List of all members.

Signals

void setPage (HELP_PAGE page)

Public Member Functions

 Contents (QTextStream::Encoding type, QString saveCharSet, QMimeSourceFactory *loadingMimeSource, QWidget *parent=0, const char *name=0)
QSize minimumSizeHint () const

Private Slots

void handleAnchorClick (const QString &name, const QString &link)

Private Member Functions

QString filename ()
void generateHTML (QTextStream::Encoding type, QString charSet)
void printLink (QTextStream &stream, QString text, HELP_PAGE anchor, QString anchorString)

Private Attributes

QSize optimalSize
HELP_PAGE currentPage
QTextStream::Encoding type
QString saveCharSet

Constructor & Destructor Documentation

Contents::Contents QTextStream::Encoding  type,
QString  saveCharSet,
QMimeSourceFactory *  loadingMimeSource,
QWidget parent = 0,
const char *  name = 0
 

Definition at line 23 of file contents.cpp.

References BILLBOARD, Contents(), currentPage, filename(), generateHTML(), handleAnchorClick(), and optimalSize.

Referenced by Contents().

00025 : QTextBrowser(parent,name) 00026 { 00027 this->type = type; 00028 this->saveCharSet = saveCharSet; 00029 this->setMimeSourceFactory( loadingMimeSource ); 00030 00031 //generate HTML 00032 currentPage = BILLBOARD; 00033 generateHTML(type, saveCharSet); 00034 //-- 00035 //set browser and load contents 00036 setHScrollBarMode( QScrollView::AlwaysOff ); 00037 setVScrollBarMode( QScrollView::AlwaysOff ); 00038 setFrameStyle( QFrame::NoFrame ); 00039 setSource( filename() ); 00040 00041 //------ 00042 //determine optimal size 00043 int minH = heightForWidth( 1000 ); 00044 int w; 00045 for(w=1; w<1000; w++) 00046 { 00047 if(heightForWidth(w) == minH ) break; 00048 } 00049 00050 optimalSize = QSize( w, heightForWidth(w) ); 00051 //------ 00052 //handle anchor clicks 00053 connect( this, SIGNAL(anchorClicked(const QString&, const QString&)), 00054 this, SLOT(handleAnchorClick(const QString&, const QString&)) ); 00055 //------ 00056 }


Member Function Documentation

QString Contents::filename  )  [private]
 

Definition at line 97 of file contents.cpp.

References TEMP_DIR.

Referenced by Contents(), and generateHTML().

00098 { 00099 return QString("%1/helpContents.html").arg(TEMP_DIR); 00100 }

void Contents::generateHTML QTextStream::Encoding  type,
QString  charSet
[private]
 

Definition at line 102 of file contents.cpp.

References ANNOTATING_ALBUMS, ENHANCING, filename(), FRAMING, generateHTML(), IMPORTING_AND_ORGANIZING, KEYBOARD_SHORTCUTS, MANIPULATING, printLink(), PRO_TOOLS, SAVING_AND_LOADING, and WHATS_NEW.

Referenced by Contents(), generateHTML(), and handleAnchorClick().

00103 { 00104 //create/open html file 00105 QFile file( filename() ); 00106 if(file.open(IO_WriteOnly)) 00107 { 00108 //----- 00109 QTextStream stream; 00110 stream.setEncoding( type ); 00111 stream.setDevice( &file ); 00112 //----- 00113 stream << "<html><head>\n"; 00114 stream << "<meta http-equiv='Content-Type' content='text/html; charset=" << charSet << "'>\n"; 00115 stream << "</head><body>\n"; 00116 stream << "<center><table><tr><td>\n"; 00117 stream << "<font face='Arial, sans-serif' size='+1'><b>\n"; 00118 //----- 00119 printLink( stream, QString(tr("What's New")), WHATS_NEW, "WHATS_NEW" ); 00120 //----- 00121 stream << "<p>" << tr("Tutorials:") << "\n"; 00122 //------ 00123 stream << "<font size='+0'><ul>\n"; 00124 00125 stream << "<li>\n"; 00126 printLink( stream, QString(tr("Import & Organize")), 00127 IMPORTING_AND_ORGANIZING, "IMPORTING_AND_ORGANIZING" ); 00128 //------ 00129 stream << "<li>\n"; 00130 printLink( stream, QString(tr("Annotating Albums")), 00131 ANNOTATING_ALBUMS, "ANNOTATING_ALBUMS" ); 00132 //------ 00133 stream << "<li>" << tr("Editing Photos:") << "\n"; 00134 00135 stream << "<ol>\n"; 00136 stream << "<li>\n"; 00137 printLink( stream, QString(tr("Framing")), 00138 FRAMING, "FRAMING" ); 00139 00140 stream << "<li>\n"; 00141 printLink( stream, QString(tr("Fix it Fast")), 00142 ENHANCING, "ENHANCING" ); 00143 00144 stream << "<li>\n"; 00145 printLink( stream, QString(tr("Pro Tools")), 00146 PRO_TOOLS, "PRO_TOOLS" ); 00147 00148 stream << "<li>\n"; 00149 printLink( stream, QString(tr("Manipulations")), 00150 MANIPULATING, "MANIPULATING" ); 00151 stream << "</ol>\n"; 00152 //------ 00153 stream << "<li>\n"; 00154 printLink( stream, QString(tr("Saving & Loading")), 00155 SAVING_AND_LOADING, "SAVING_AND_LOADING" ); 00156 //------ 00157 stream << "</ul></font>\n"; 00158 //------ 00159 printLink( stream, QString(tr("Keyboard Shortcuts")), KEYBOARD_SHORTCUTS, "KEYBOARD_SHORTCUTS" ); 00160 //------ 00161 stream << "</b></font>\n"; 00162 stream << "</td></tr></table></center>\n"; 00163 stream << "</body></html>\n"; 00164 file.close(); 00165 } 00166 }

void Contents::handleAnchorClick const QString &  name,
const QString &  link
[private, slot]
 

Definition at line 63 of file contents.cpp.

References ANNOTATING_ALBUMS, currentPage, ENHANCING, FRAMING, generateHTML(), handleAnchorClick(), HELP_PAGE, IMPORTING_AND_ORGANIZING, INVALID, KEYBOARD_SHORTCUTS, MANIPULATING, PRO_TOOLS, saveCharSet, SAVING_AND_LOADING, setPage(), type, and WHATS_NEW.

Referenced by Contents(), and handleAnchorClick().

00064 { 00065 HELP_PAGE nextPage = INVALID; 00066 00067 //only handle clicking on anchors with actual names 00068 if( name.isNull() ) return; 00069 else if(name.compare("WHATS_NEW") == 0) 00070 nextPage = WHATS_NEW; 00071 else if(name.compare("IMPORTING_AND_ORGANIZING") == 0) 00072 nextPage = IMPORTING_AND_ORGANIZING; 00073 else if(name.compare("ANNOTATING_ALBUMS") == 0) 00074 nextPage = ANNOTATING_ALBUMS; 00075 else if(name.compare("FRAMING") == 0) 00076 nextPage = FRAMING; 00077 else if(name.compare("ENHANCING") == 0) 00078 nextPage = ENHANCING; 00079 else if(name.compare("PRO_TOOLS") == 0) 00080 nextPage = PRO_TOOLS; 00081 else if(name.compare("MANIPULATING") == 0) 00082 nextPage = MANIPULATING; 00083 else if(name.compare("SAVING_AND_LOADING") == 0) 00084 nextPage = SAVING_AND_LOADING; 00085 else if(name.compare("KEYBOARD_SHORTCUTS") == 0) 00086 nextPage = KEYBOARD_SHORTCUTS; 00087 00088 if(nextPage != INVALID) 00089 { 00090 currentPage = nextPage; 00091 generateHTML(type, saveCharSet); 00092 reload(); 00093 emit setPage( currentPage ); 00094 } 00095 }

QSize Contents::minimumSizeHint  )  const
 

Definition at line 58 of file contents.cpp.

References optimalSize.

Referenced by HelpWindow::HelpWindow().

00059 { 00060 return optimalSize; 00061 }

void Contents::printLink QTextStream &  stream,
QString  text,
HELP_PAGE  anchor,
QString  anchorString
[private]
 

Definition at line 168 of file contents.cpp.

References CURR_COLOR, currentPage, LINK_COLOR, and printLink().

Referenced by generateHTML(), and printLink().

00169 { 00170 if( currentPage != anchor ) 00171 { 00172 stream << "<font color='" << LINK_COLOR << "'>"; 00173 stream << "<a name='" << anchorString << "'>"; 00174 } 00175 else 00176 { 00177 stream << "<font color='" << CURR_COLOR << "'>"; 00178 } 00179 00180 stream << text << "\n"; 00181 00182 if( currentPage != anchor ) 00183 { 00184 stream << "</a>"; 00185 } 00186 stream << "</font>\n"; 00187 }

void Contents::setPage HELP_PAGE  page  )  [signal]
 

Referenced by handleAnchorClick().


Member Data Documentation

HELP_PAGE Contents::currentPage [private]
 

Definition at line 56 of file contents.h.

Referenced by Contents(), handleAnchorClick(), and printLink().

QSize Contents::optimalSize [private]
 

Definition at line 52 of file contents.h.

Referenced by Contents(), and minimumSizeHint().

QString Contents::saveCharSet [private]
 

Definition at line 59 of file contents.h.

Referenced by handleAnchorClick().

QTextStream::Encoding Contents::type [private]
 

Definition at line 58 of file contents.h.

Referenced by handleAnchorClick().


The documentation for this class was generated from the following files:
Generated on Sun Mar 4 19:43:05 2007 for AlbumShaper by doxygen 1.3.7