diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-21 04:48:07 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-21 04:48:07 +0000 |
commit | 0525bd68b1324389d0825761afec5d2ed252a9a5 (patch) | |
tree | 8a1cb1649c11510a8a8c9fbacc353bfdad74bad2 /src/renderer.h | |
parent | 5cce0292935a57e7fab4417d428637fcb84315a9 (diff) | |
download | kbookreader-0525bd68b1324389d0825761afec5d2ed252a9a5.tar.gz kbookreader-0525bd68b1324389d0825761afec5d2ed252a9a5.zip |
TQt4 port kbookreader
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kbookreader@1242484 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/renderer.h')
-rw-r--r-- | src/renderer.h | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/src/renderer.h b/src/renderer.h index 23263ca..11f5cf1 100644 --- a/src/renderer.h +++ b/src/renderer.h @@ -20,15 +20,15 @@ #ifndef RENDERER_H #define RENDERER_H -#include <qstringlist.h> -#include <qfont.h> -#include <qstring.h> -#include <qobject.h> -#include <qsize.h> -#include <qtimer.h> +#include <tqstringlist.h> +#include <tqfont.h> +#include <tqstring.h> +#include <tqobject.h> +#include <tqsize.h> +#include <tqtimer.h> #include <vector> #include <memory> -class QStringList; +class TQStringList; class TextLine { @@ -63,39 +63,40 @@ private: * \brief Renders input text into list of word wrapped strings * \author Alexandr Nemish <[email protected]> */ -class Renderer : public QObject +class Renderer : public TQObject { Q_OBJECT + TQ_OBJECT public: Renderer(); ~Renderer(); /// \brief Loads and renders list of strings - void load(const QStringList & list); + void load(const TQStringList & list); /// \brief Renders loaded list of strings void render(); /// \brief Clears all rendered data void clear(); /// \brief Draws page - void drawPage(QPainter & paint, QRect rect, int pageNumber); + void drawPage(TQPainter & paint, TQRect rect, int pageNumber); //Getters /// \brief Returns whether the text is empty bool isEmpty() const { return m_text.empty(); }; /// \brief Returns current font - QFont font() const { return m_font; } + TQFont font() const { return m_font; } /// \brief Returns current paragraph offset in pixels int paraOffset() const { return m_paraOffset; } /// \brief Returns the number of pages int pageCount() const { return m_pageCount; } /// \brief Returns page size in pixels - QSize pageSize() const { return m_pageSize; } + TQSize pageSize() const { return m_pageSize; } //Setters /// \brief Sets current font - void setFont(const QFont & font); + void setFont(const TQFont & font); /// \brief Sets current paragraph offset in pixels void setParaOffset(int offset); /// \brief Sets size of a page - void setPageSize(const QSize & size); + void setPageSize(const TQSize & size); bool busy() const { return m_isRendering; } signals: @@ -103,8 +104,8 @@ signals: private slots: void timeout(); private: - typedef QStringList::const_iterator TStringIter; - typedef std::vector<QString> TParagraphs; + typedef TQStringList::const_iterator TStringIter; + typedef std::vector<TQString> TParagraphs; typedef TParagraphs::size_type TIndex; typedef std::vector<TextLine> TLines; //make it non-copyable @@ -113,12 +114,12 @@ private: /// \brief Renders input paragraph into list of wrapped lines void parseParagraph(TIndex idx); /// \brief Returns width of string in pixels - int width(const QString & a_string) const; + int width(const TQString & a_string) const; void addLine(TextLine line); - int wordAt(const QString & str, int len); - QString getWord(const QString & str, int idx); + int wordAt(const TQString & str, int len); + TQString getWord(const TQString & str, int idx); /// \brief Draws justified string - void drawLine(QPainter& paint, int x, int y, const TLines::size_type idx); + void drawLine(TQPainter& paint, int x, int y, const TLines::size_type idx); void cancel(); TParagraphs m_text; @@ -126,13 +127,13 @@ private: int m_pageCount; int m_linesPerPage; int m_paraOffset; - QFont m_font; - std::auto_ptr<QFontMetrics> m_fontMetrics; - QSize m_pageSize; + TQFont m_font; + std::auto_ptr<TQFontMetrics> m_fontMetrics; + TQSize m_pageSize; bool m_isStartAdded; TIndex m_curParagraph; bool m_isRendering; - QTimer m_timer; + TQTimer m_timer; }; #endif |