From 0525bd68b1324389d0825761afec5d2ed252a9a5 Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 21 Jul 2011 04:48:07 +0000 Subject: [PATCH] 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 --- src/bookmark.cpp | 2 +- src/bookmark.h | 18 ++-- src/bookmarksdlg.cpp | 82 +++++++++--------- src/bookmarksdlg.h | 45 +++++----- src/bookreader.cpp | 116 ++++++++++++------------- src/bookreader.h | 13 +-- src/bookreader_client.cpp | 14 +-- src/bookreaderiface.h | 2 +- src/bookwidget.cpp | 176 +++++++++++++++++++------------------- src/bookwidget.h | 71 +++++++-------- src/renderer.cpp | 46 +++++----- src/renderer.h | 49 +++++------ src/settingsdlg.ui | 34 ++++---- src/theme.cpp | 22 ++--- src/theme.h | 18 ++-- 15 files changed, 356 insertions(+), 352 deletions(-) diff --git a/src/bookmark.cpp b/src/bookmark.cpp index e438dc3..053bb82 100644 --- a/src/bookmark.cpp +++ b/src/bookmark.cpp @@ -19,7 +19,7 @@ ***************************************************************************/ #include "bookmark.h" -Bookmark::Bookmark(int page, const QString& name, QDateTime dateTime): +Bookmark::Bookmark(int page, const TQString& name, TQDateTime dateTime): m_page(page), m_name(name), m_dateTime(dateTime) diff --git a/src/bookmark.h b/src/bookmark.h index b144b2a..77c2ef3 100644 --- a/src/bookmark.h +++ b/src/bookmark.h @@ -20,8 +20,8 @@ #ifndef BOOKMARK_H #define BOOKMARK_H -#include -#include +#include +#include #include class Bookmark; @@ -32,26 +32,26 @@ typedef std::vector Bookmarks; class Bookmark { public: - Bookmark(int page, const QString& name = QString::null, - QDateTime dateTime = QDateTime::currentDateTime()); + Bookmark(int page, const TQString& name = TQString(), + TQDateTime dateTime = TQDateTime::tqcurrentDateTime()); ~Bookmark(); void setPage(unsigned int page) { m_page = page; } unsigned int page() const { return m_page; } - const QString & name() const { return m_name; } - const QDateTime & dateTime() const { return m_dateTime; } + const TQString & name() const { return m_name; } + const TQDateTime & dateTime() const { return m_dateTime; } bool operator < (const Bookmark& rhs) const { return (m_page < rhs.m_page); } - void setName(const QString& theValue) + void setName(const TQString& theValue) { m_name = theValue; } private: unsigned int m_page; - QString m_name; - QDateTime m_dateTime; + TQString m_name; + TQDateTime m_dateTime; }; #endif diff --git a/src/bookmarksdlg.cpp b/src/bookmarksdlg.cpp index f3bd823..772664b 100644 --- a/src/bookmarksdlg.cpp +++ b/src/bookmarksdlg.cpp @@ -18,83 +18,83 @@ ***************************************************************************/ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include "bookmarksdlg.h" /* - * Constructs a BookmarksDlg as a child of 'parent', with the + * Constructs a BookmarksDlg as a child of 'tqparent', with the * name 'name' and widget flags set to 'f'. * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ -BookmarksDlg::BookmarksDlg(const Bookmarks& bms, QWidget* parent, +BookmarksDlg::BookmarksDlg(const Bookmarks& bms, TQWidget* tqparent, const char* name, bool modal, WFlags fl) - : QDialog(parent, name, modal, fl), + : TQDialog(tqparent, name, modal, fl), m_bookmarks(bms) { if ( !name ) setName( "BookmarksDlg" ); setSizeGripEnabled(TRUE); - BookmarksDlgLayout = new QVBoxLayout( this, 11, 6, "BookmarksDlgLayout"); + BookmarksDlgLayout = new TQVBoxLayout( this, 11, 6, "BookmarksDlgLayout"); - layout3 = new QHBoxLayout( 0, 0, 6, "layout3"); + tqlayout3 = new TQHBoxLayout( 0, 0, 6, "tqlayout3"); - bookmarksTable = new QTable(3, 2, this, "bookmarksList" ); + bookmarksTable = new TQTable(3, 2, this, "bookmarksList" ); bookmarksTable->horizontalHeader()->setLabel(0, "Title"); bookmarksTable->horizontalHeader()->setLabel(1, "Page number"); // bookmarksTable->setLeftMargin(0); bookmarksTable->setColumnStretchable(0, true); - bookmarksTable->setSelectionMode(QTable::SingleRow); - layout3->addWidget( bookmarksTable ); + bookmarksTable->setSelectionMode(TQTable::SingleRow); + tqlayout3->addWidget( bookmarksTable ); - layout2 = new QVBoxLayout( 0, 0, 6, "layout2"); + tqlayout2 = new TQVBoxLayout( 0, 0, 6, "tqlayout2"); - addButton = new QPushButton( this, "addButton" ); - layout2->addWidget( addButton ); + addButton = new TQPushButton( this, "addButton" ); + tqlayout2->addWidget( addButton ); - deleteButton = new QPushButton( this, "deleteButton" ); - layout2->addWidget( deleteButton ); - Horizontal_Spacing2_2 = new QSpacerItem( 20, 60, QSizePolicy::Minimum, QSizePolicy::Expanding ); - layout2->addItem( Horizontal_Spacing2_2 ); - layout3->addLayout( layout2 ); - BookmarksDlgLayout->addLayout( layout3 ); + deleteButton = new TQPushButton( this, "deleteButton" ); + tqlayout2->addWidget( deleteButton ); + Horizontal_Spacing2_2 = new TQSpacerItem( 20, 60, TQSizePolicy::Minimum, TQSizePolicy::Expanding ); + tqlayout2->addItem( Horizontal_Spacing2_2 ); + tqlayout3->addLayout( tqlayout2 ); + BookmarksDlgLayout->addLayout( tqlayout3 ); - Layout1 = new QHBoxLayout( 0, 0, 6, "Layout1"); + Layout1 = new TQHBoxLayout( 0, 0, 6, "Layout1"); - buttonHelp = new QPushButton( this, "buttonHelp" ); + buttonHelp = new TQPushButton( this, "buttonHelp" ); buttonHelp->setAutoDefault( TRUE ); Layout1->addWidget( buttonHelp ); - Horizontal_Spacing2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Horizontal_Spacing2 = new TQSpacerItem( 20, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum ); Layout1->addItem( Horizontal_Spacing2 ); - buttonOk = new QPushButton( this, "buttonOk" ); + buttonOk = new TQPushButton( this, "buttonOk" ); buttonOk->setAutoDefault( TRUE ); buttonOk->setDefault( TRUE ); Layout1->addWidget( buttonOk ); - buttonCancel = new QPushButton( this, "buttonCancel" ); + buttonCancel = new TQPushButton( this, "buttonCancel" ); buttonCancel->setAutoDefault( TRUE ); Layout1->addWidget( buttonCancel ); BookmarksDlgLayout->addLayout( Layout1 ); languageChange(); - resize( QSize(400, 267).expandedTo(minimumSizeHint()) ); + resize( TQSize(400, 267).expandedTo(tqminimumSizeHint()) ); clearWState( WState_Polished ); updateBookmarks(); // signals and slots connections - connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); - connect(addButton, SIGNAL(clicked()), this, SLOT(addBookmark())); - connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteBookmark())); - connect(bookmarksTable, SIGNAL(valueChanged(int, int)), this, SLOT(valueChanged(int, int))); + connect(buttonOk, TQT_SIGNAL(clicked()), this, TQT_SLOT(accept())); + connect(buttonCancel, TQT_SIGNAL(clicked()), this, TQT_SLOT(reject())); + connect(addButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(addBookmark())); + connect(deleteButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(deleteBookmark())); + connect(bookmarksTable, TQT_SIGNAL(valueChanged(int, int)), this, TQT_SLOT(valueChanged(int, int))); } /* @@ -102,7 +102,7 @@ BookmarksDlg::BookmarksDlg(const Bookmarks& bms, QWidget* parent, */ BookmarksDlg::~BookmarksDlg() { - // no need to delete child widgets, Qt does it all for us + // no need to delete child widgets, TQt does it all for us } /* @@ -115,11 +115,11 @@ void BookmarksDlg::languageChange() addButton->setText( tr2i18n( "Add" ) ); deleteButton->setText( tr2i18n( "Delete" ) ); buttonHelp->setText( tr2i18n( "&Help" ) ); - buttonHelp->setAccel( QKeySequence( tr2i18n( "F1" ) ) ); + buttonHelp->setAccel( TQKeySequence( tr2i18n( "F1" ) ) ); buttonOk->setText( tr2i18n( "&OK" ) ); - buttonOk->setAccel( QKeySequence( QString::null ) ); + buttonOk->setAccel( TQKeySequence( TQString() ) ); buttonCancel->setText( tr2i18n( "Ca&ncel" ) ); - buttonCancel->setAccel( QKeySequence( tr2i18n( "Alt+N" ) ) ); + buttonCancel->setAccel( TQKeySequence( tr2i18n( "Alt+N" ) ) ); } void BookmarksDlg::addBookmark() @@ -147,7 +147,7 @@ void BookmarksDlg::updateBookmarks() const Bookmark& bm = m_bookmarks[i]; bookmarksTable->setNumRows(i+1); bookmarksTable->setText(i, 0, bm.name()); - bookmarksTable->setText(i, 1, QString::number(bm.page())); + bookmarksTable->setText(i, 1, TQString::number(bm.page())); } } @@ -167,7 +167,7 @@ void BookmarksDlg::valueChanged(int row, int col) bm.setPage(page); else //return old value - bookmarksTable->setText(row, col, QString::number(bm.page())); + bookmarksTable->setText(row, col, TQString::number(bm.page())); } } diff --git a/src/bookmarksdlg.h b/src/bookmarksdlg.h index 79d8df2..c79c583 100644 --- a/src/bookmarksdlg.h +++ b/src/bookmarksdlg.h @@ -20,43 +20,44 @@ #ifndef BOOKMARKSDLG_H #define BOOKMARKSDLG_H -#include -#include +#include +#include #include #include "bookmark.h" -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QSpacerItem; -class QTable; -class QPushButton; +class TQVBoxLayout; +class TQHBoxLayout; +class TQGridLayout; +class TQSpacerItem; +class TQTable; +class TQPushButton; -class BookmarksDlg : public QDialog +class BookmarksDlg : public TQDialog { Q_OBJECT + TQ_OBJECT public: - BookmarksDlg(const Bookmarks& bms, QWidget* parent = 0, + BookmarksDlg(const Bookmarks& bms, TQWidget* tqparent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~BookmarksDlg(); const Bookmarks& bookmarks() const { return m_bookmarks; } - QTable* bookmarksTable; - QPushButton* addButton; - QPushButton* deleteButton; - QPushButton* buttonHelp; - QPushButton* buttonOk; - QPushButton* buttonCancel; + TQTable* bookmarksTable; + TQPushButton* addButton; + TQPushButton* deleteButton; + TQPushButton* buttonHelp; + TQPushButton* buttonOk; + TQPushButton* buttonCancel; protected: - QVBoxLayout* BookmarksDlgLayout; - QHBoxLayout* layout3; - QVBoxLayout* layout2; - QSpacerItem* Horizontal_Spacing2_2; - QHBoxLayout* Layout1; - QSpacerItem* Horizontal_Spacing2; + TQVBoxLayout* BookmarksDlgLayout; + TQHBoxLayout* tqlayout3; + TQVBoxLayout* tqlayout2; + TQSpacerItem* Horizontal_Spacing2_2; + TQHBoxLayout* Layout1; + TQSpacerItem* Horizontal_Spacing2; protected slots: virtual void languageChange(); diff --git a/src/bookreader.cpp b/src/bookreader.cpp index 662d283..9687e56 100644 --- a/src/bookreader.cpp +++ b/src/bookreader.cpp @@ -42,12 +42,12 @@ #include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include "bookreader.h" #include "settings.h" @@ -55,10 +55,10 @@ #include "bookmarksdlg.h" namespace { -QStringList listEncodings() +TQStringList listEncodings() { - const QStringList encodings(KGlobal::charsets()->availableEncodingNames()); - QStringList availEncodings; + const TQStringList encodings(KGlobal::charsets()->availableEncodingNames()); + TQStringList availEncodings; for (unsigned int i=0; i < encodings.count(); ++i) { bool found = false; @@ -79,7 +79,7 @@ BookReader::BookReader() m_printer(0) { - QPixmap splash(KGlobal::dirs()->findResource("appdata", + TQPixmap splash(KGlobal::dirs()->findResource("appdata", "themes/default/splash.png")); m_splash = new KSplashScreen(splash); m_splash->show(); @@ -99,19 +99,19 @@ BookReader::BookReader() // automatically save settings if changed: window size, toolbar // position, icon size, etc. Also to add actions for the statusbar // toolbar, and keybindings if necessary. - KStdAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), actionCollection()); + KStdAction::keyBindings(guiFactory(), TQT_SLOT(configureShortcuts()), actionCollection()); createStandardStatusBarAction(); setStandardToolBarMenuEnabled( true ); - KStdAction::configureToolbars(this, SLOT(configureToolbars() ), actionCollection()); - createGUI(QString::null, false); + KStdAction::configureToolbars(TQT_TQOBJECT(this), TQT_SLOT(configureToolbars() ), actionCollection()); + createGUI(TQString(), false); initialGeometrySet(); setAutoSaveSettings(); // allow the view to change the statusbar and caption - connect(m_view, SIGNAL(signalChangeStatusbar(const QString&)), - this, SLOT(changeStatusbar(const QString&))); - connect(m_view, SIGNAL(signalChangeCaption(const QString&)), - this, SLOT(changeCaption(const QString&))); + connect(m_view, TQT_SIGNAL(signalChangeStatusbar(const TQString&)), + TQT_TQOBJECT(this), TQT_SLOT(changeStatusbar(const TQString&))); + connect(m_view, TQT_SIGNAL(signalChangeCaption(const TQString&)), + TQT_TQOBJECT(this), TQT_SLOT(changeCaption(const TQString&))); readSettings(); m_splash->finish(m_view); @@ -125,7 +125,7 @@ BookReader::~BookReader() void BookReader::load(const KURL& url) { - QString target; + TQString target; // download the contents if(!KIO::NetAccess::download(url, target, this)) { @@ -141,29 +141,29 @@ void BookReader::load(const KURL& url) void BookReader::setupActions() { -// KStdAction::openNew(this, SLOT(fileNew()), actionCollection()); - KStdAction::open(this, SLOT(fileOpen()), actionCollection()); - recentFilesAction = KStdAction::openRecent(this, SLOT(slotURLSelected(const KURL &)), +// KStdAction::openNew(TQT_TQOBJECT(this), TQT_SLOT(fileNew()), actionCollection()); + KStdAction::open(TQT_TQOBJECT(this), TQT_SLOT(fileOpen()), actionCollection()); + recentFilesAction = KStdAction::openRecent(TQT_TQOBJECT(this), TQT_SLOT(slotURLSelected(const KURL &)), actionCollection()); - KStdAction::save(this, SLOT(fileSave()), actionCollection()); - KStdAction::saveAs(this, SLOT(fileSaveAs()), actionCollection()); - KStdAction::print(this, SLOT(filePrint()), actionCollection()); - KStdAction::quit(kapp, SLOT(quit()), actionCollection()); + KStdAction::save(TQT_TQOBJECT(this), TQT_SLOT(fileSave()), actionCollection()); + KStdAction::saveAs(TQT_TQOBJECT(this), TQT_SLOT(fileSaveAs()), actionCollection()); + KStdAction::print(TQT_TQOBJECT(this), TQT_SLOT(filePrint()), actionCollection()); + KStdAction::quit(TQT_TQOBJECT(kapp), TQT_SLOT(quit()), actionCollection()); - KStdAction::firstPage(this, SLOT(gotoFirstPage()), actionCollection()); - KStdAction::prior(this, SLOT(prevPage()), actionCollection()); - KStdAction::next(this, SLOT(nextPage()), actionCollection()); - KStdAction::lastPage(this, SLOT(gotoLastPage()), actionCollection()); + KStdAction::firstPage(TQT_TQOBJECT(this), TQT_SLOT(gotoFirstPage()), actionCollection()); + KStdAction::prior(TQT_TQOBJECT(this), TQT_SLOT(prevPage()), actionCollection()); + KStdAction::next(TQT_TQOBJECT(this), TQT_SLOT(nextPage()), actionCollection()); + KStdAction::lastPage(TQT_TQOBJECT(this), TQT_SLOT(gotoLastPage()), actionCollection()); - KStdAction::addBookmark(this, SLOT(addBookmark()), actionCollection()); - KStdAction::editBookmarks(this, SLOT(editBookmarks()), actionCollection()); + KStdAction::addBookmark(TQT_TQOBJECT(this), TQT_SLOT(addBookmark()), actionCollection()); + KStdAction::editBookmarks(TQT_TQOBJECT(this), TQT_SLOT(editBookmarks()), actionCollection()); - KStdAction::gotoPage(this, SLOT(gotoPage()), actionCollection()); + KStdAction::gotoPage(TQT_TQOBJECT(this), TQT_SLOT(gotoPage()), actionCollection()); - m_fullScreenAction = KStdAction::fullScreen(this, SLOT(fullScreen()), + m_fullScreenAction = KStdAction::fullScreen(TQT_TQOBJECT(this), TQT_SLOT(fullScreen()), actionCollection(), this); - KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection()); + KStdAction::preferences(TQT_TQOBJECT(this), TQT_SLOT(optionsPreferences()), actionCollection()); KConfig *config = kapp->config(); recentFilesAction->loadEntries(config); @@ -172,7 +172,7 @@ void BookReader::setupActions() // how to insert a custom menu and menu item /* KAction *custom = new KAction( i18n( "Cus&tom Menuitem" ), 0, - this, SLOT( optionsPreferences() ), + TQT_TQOBJECT(this), TQT_SLOT( optionsPreferences() ), actionCollection(), "custom_action" );*/ } @@ -195,7 +195,7 @@ void BookReader::readProperties(KConfig */*config*/) // the app is being restored. read in here whatever you wrote // in 'saveProperties' -// QString url = config->readPathEntry("lastURL"); +// TQString url = config->readPathEntry("lastURL"); // int currentPage = config->readEntry("currentPage").toInt(); /* Disable forawhile if (!url.isEmpty()) @@ -206,16 +206,16 @@ void BookReader::readProperties(KConfig */*config*/) */ } -void BookReader::dragEnterEvent(QDragEnterEvent *event) +void BookReader::dragEnterEvent(TQDragEnterEvent *event) { // accept uri drops only event->accept(KURLDrag::canDecode(event)); } -void BookReader::dropEvent(QDropEvent *event) +void BookReader::dropEvent(TQDropEvent *event) { // this is a very simplistic implementation of a drop event. we - // will only accept a dropped URL. the Qt dnd code can do *much* + // will only accept a dropped URL. the TQt dnd code can do *much* // much more, so please read the docs there KURL::List urls; @@ -237,7 +237,7 @@ void BookReader::fileOpen() // button is clicked /* // this brings up the generic open dialog - KURL url = KURLRequesterDlg::getURL(QString::null, this, i18n("Open Location") ); + KURL url = KURLRequesterDlg::getURL(TQString(), this, i18n("Open Location") ); */ // standard filedialog KEncodingFileDialog::Result res = @@ -276,14 +276,14 @@ void BookReader::filePrint() if (!m_printer) m_printer = new KPrinter; if (m_printer->setup(this)) { - // setup the printer. with Qt, you always "print" to a - // QPainter.. whether the output medium is a pixmap, a screen, + // setup the printer. with TQt, you always "print" to a + // TQPainter.. whether the output medium is a pixmap, a screen, // or paper - QPainter p; + TQPainter p; p.begin(m_printer); // we let our view do the actual printing - QPaintDeviceMetrics metrics(m_printer); + TQPaintDeviceMetrics metrics(m_printer); //m_view->print( &p, metrics.height(), metrics.width() ); // and send the result to the printer @@ -300,11 +300,11 @@ void BookReader::optionsPreferences() KDialogBase::IconList); SettingsWidget *general = new SettingsWidget(0, "General"); - const QStringList encodings(listEncodings()); + const TQStringList encodings(listEncodings()); - QString curEncoding(encodings[Settings::defaultEncoding()]); + TQString curEncoding(encodings[Settings::defaultEncoding()]); if (curEncoding.isEmpty()) - curEncoding = QString::fromLatin1(KGlobal::locale()->encoding()); + curEncoding = TQString::tqfromLatin1(KGlobal::locale()->encoding()); general->kcfg_DefaultEncoding->clear(); general->kcfg_DefaultEncoding->insertStringList(encodings); @@ -313,17 +313,17 @@ void BookReader::optionsPreferences() general->kcfg_DefaultEncoding->setCurrentItem(i); dialog->addPage(general, i18n("General"), "settings"); - connect(dialog, SIGNAL(settingsChanged()), this, SLOT(loadSettings())); + connect(dialog, TQT_SIGNAL(settingsChanged()), TQT_TQOBJECT(this), TQT_SLOT(loadSettings())); dialog->show(); } -void BookReader::changeStatusbar(const QString& text) +void BookReader::changeStatusbar(const TQString& text) { // display the text on the statusbar statusBar()->message(text); } -void BookReader::changeCaption(const QString& text) +void BookReader::changeCaption(const TQString& text) { // display the text on the caption setCaption(text); @@ -388,9 +388,9 @@ void BookReader::fullScreen() void BookReader::loadLastUrl() { KConfig * config = kapp->config(); - QSize size = config->readSizeEntry("size"); + TQSize size = config->readSizeEntry("size"); lastURL = config->readEntry("lastURL"); - connect(m_view, SIGNAL(loadingFinished()), this, SLOT(loadLastURLSetPage())); + connect(m_view, TQT_SIGNAL(loadingFinished()), TQT_TQOBJECT(this), TQT_SLOT(loadLastURLSetPage())); if (!lastURL.isEmpty()) { // kdDebug() << "loadLastUrl: initial size = " << m_view->size() << endl; @@ -405,7 +405,7 @@ void BookReader::loadLastUrl() void BookReader::loaded(int loaded) { //m_loaded = loaded; - m_splash->message(tr("Loading: %1 - %2%").arg(lastURL.fileName()).arg(loaded)); + m_splash->message(tqtr("Loading: %1 - %2%").tqarg(lastURL.fileName()).tqarg(loaded)); } void BookReader::gotoFirstPage() @@ -446,7 +446,7 @@ void BookReader::loadLastURLSetPage() void BookReader::addBookmark() { bool isOk; - QString name = KInputDialog::getText(tr("Add bookmark"), + TQString name = KInputDialog::getText(tr("Add bookmark"), tr("Bookmark name"), tr("Here"), &isOk); if (isOk) { @@ -465,13 +465,13 @@ void BookReader::updateBookmarks() m_bookmarkActions.setAutoDelete(true); const Bookmarks & bms = m_view->bookmarks(); - QSignalMapper *bookmarkMapper = new QSignalMapper(this); - connect(bookmarkMapper, SIGNAL(mapped(int)), this, SLOT(gotoBookmark(int))); + TQSignalMapper *bookmarkMapper = new TQSignalMapper(TQT_TQOBJECT(this)); + connect(bookmarkMapper, TQT_SIGNAL(mapped(int)), TQT_TQOBJECT(this), TQT_SLOT(gotoBookmark(int))); for (Bookmarks::size_type i = 0; i < 9 && i < bms.size(); ++i) { const Bookmark & bm = bms[i]; KAction * action = new KAction(bm.name(), ALT+Key_1 + i); - connect(action, SIGNAL(activated()), bookmarkMapper, SLOT(map())); + connect(action, TQT_SIGNAL(activated()), bookmarkMapper, TQT_SLOT(map())); m_bookmarkActions.append(action); bookmarkMapper->setMapping(action, i); } @@ -500,7 +500,7 @@ void BookReader::editBookmarks() { /// @todo implement me BookmarksDlg dialog(m_view->bookmarks()); - if (dialog.exec() == QDialog::Accepted) + if (dialog.exec() == TQDialog::Accepted) { m_view->setBookmarks(dialog.bookmarks()); updateBookmarks(); diff --git a/src/bookreader.h b/src/bookreader.h index 989d099..01773b0 100644 --- a/src/bookreader.h +++ b/src/bookreader.h @@ -45,6 +45,7 @@ class KSplashScreen; class BookReader : public KMainWindow { Q_OBJECT + TQ_OBJECT public: /** * Default Constructor @@ -65,10 +66,10 @@ public: protected: /** - * Overridden virtuals for Qt drag 'n drop (XDND) + * Overridden virtuals for TQt drag 'n drop (XDND) */ - virtual void dragEnterEvent(QDragEnterEvent *event); - virtual void dropEvent(QDropEvent *event); + virtual void dragEnterEvent(TQDragEnterEvent *event); + virtual void dropEvent(TQDropEvent *event); virtual bool queryExit(); protected: @@ -94,8 +95,8 @@ private slots: void optionsPreferences(); void slotURLSelected(const KURL &); void fullScreen(); - void changeStatusbar(const QString& text); - void changeCaption(const QString& text); + void changeStatusbar(const TQString& text); + void changeCaption(const TQString& text); void loadSettings(); void loaded(int); void gotoFirstPage(); @@ -117,7 +118,7 @@ private: //Actions KRecentFilesAction * recentFilesAction; KToggleFullScreenAction * m_fullScreenAction; - QPtrList m_bookmarkActions; + TQPtrList m_bookmarkActions; KURL lastURL; KSplashScreen * m_splash; KPrinter * m_printer; diff --git a/src/bookreader_client.cpp b/src/bookreader_client.cpp index d07eb27..d9cc8d7 100644 --- a/src/bookreader_client.cpp +++ b/src/bookreader_client.cpp @@ -21,8 +21,8 @@ #include #include -#include -#include +#include +#include int main(int argc, char **argv) { @@ -33,13 +33,13 @@ int main(int argc, char **argv) client->attach(); // do a 'send' for now - QByteArray data; - QDataStream ds(data, IO_WriteOnly); + TQByteArray data; + TQDataStream ds(data, IO_WriteOnly); if (argc > 1) - ds << QString(argv[1]); + ds << TQString(argv[1]); else - ds << QString("http://www.kde.org"); - client->send("bookreader", "BookReaderIface", "openURL(QString)", data); + ds << TQString("http://www.kde.org"); + client->send("bookreader", "BookReaderIface", "openURL(TQString)", data); return app.exec(); } diff --git a/src/bookreaderiface.h b/src/bookreaderiface.h index 6f733ec..630b487 100644 --- a/src/bookreaderiface.h +++ b/src/bookreaderiface.h @@ -30,7 +30,7 @@ class BookReaderIface : virtual public DCOPObject public: k_dcop: - virtual void openURL(QString url) = 0; + virtual void openURL(TQString url) = 0; }; #endif // _BOOKREADERIFACE_H_ diff --git a/src/bookwidget.cpp b/src/bookwidget.cpp index 8eec9df..880219b 100644 --- a/src/bookwidget.cpp +++ b/src/bookwidget.cpp @@ -16,15 +16,15 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include -#include -#include +#include +#include +#include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include "bookwidget.h" @@ -33,12 +33,12 @@ #include "renderer.h" //#include "ktextprogressdlg.h" -class QStringList; -class QRect; -class QPixmap; +class TQStringList; +class TQRect; +class TQPixmap; -BookWidget::BookWidget(QWidget *parent, const char *name) - : QWidget(parent, name), +BookWidget::BookWidget(TQWidget *tqparent, const char *name) + : TQWidget(tqparent, name), m_modified(true), m_currentPage(0), m_left_margin(0), @@ -61,11 +61,11 @@ BookWidget::BookWidget(QWidget *parent, const char *name) Theme::self()->loadTheme("default"); - setWFlags(Qt::WNoAutoErase); - setFocusPolicy(QWidget::StrongFocus); + setWFlags(TQt::WNoAutoErase); + setFocusPolicy(TQ_StrongFocus); - connect(&m_timer, SIGNAL(timeout()), this, SLOT(loadLine())); - connect(m_renderer.get(), SIGNAL(renderingFinished()), this, SLOT(renderingFinished())); + connect(&m_timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(loadLine())); + connect(m_renderer.get(), TQT_SIGNAL(renderingFinished()), this, TQT_SLOT(renderingFinished())); } @@ -80,10 +80,10 @@ void BookWidget::openURL(const KURL & url) if (! m_file.open(IO_ReadOnly)) return; ///@todo Write encoding detection - m_stream.reset(new QTextStream(&m_file)); - m_textLines.reset(new QStringList); - QString name(encoding()); - QTextCodec *codec = QTextCodec::codecForName(encoding()); // get the codec + m_stream.reset(new TQTextStream(&m_file)); + m_textLines.reset(new TQStringList); + TQString name(encoding()); + TQTextCodec *codec = TQTextCodec::codecForName(encoding()); // get the codec if (codec) m_stream->setCodec(codec); //show progress dialog @@ -92,7 +92,7 @@ void BookWidget::openURL(const KURL & url) m_progressDlg->setLabel("Loading file " + m_url.path()); m_progressDlg->setAllowCancel(true); m_progressDlg->progressBar()->setTotalSteps(0); - connect(m_progressDlg.get(), SIGNAL(cancelClicked()), SLOT(cancelLoading())); + connect(m_progressDlg.get(), TQT_SIGNAL(cancelClicked()), TQT_SLOT(cancelLoading())); KDialog::centerOnScreen(m_progressDlg.get()); m_progressDlg->show(); //start timer for processing gui events @@ -103,90 +103,90 @@ void BookWidget::openURL(const KURL & url) emit signalChangeStatusbar(m_url.prettyURL()); } -QString BookWidget::currentURL() +TQString BookWidget::currentURL() { return m_url.path(); } -void BookWidget::drawContent(QPainter& paint) +void BookWidget::drawContent(TQPainter& paint) { - const QRect lrect (rectLeftPage()); - const QRect rrect(rectRightPage()); + const TQRect lrect (rectLeftPage()); + const TQRect rrect(rectRightPage()); const unsigned int curPage = currentPage(); //draw pages m_renderer->drawPage(paint, lrect, curPage); m_renderer->drawPage(paint, rrect, curPage + 1); } -void BookWidget::drawPageNumbers(QPainter & paint) +void BookWidget::drawPageNumbers(TQPainter & paint) { if (m_renderer->isEmpty()) return; - const QRect lrect (rectLeftPage()); - const QRect rrect(rectRightPage()); - const QString number = QString::number(currentPage() + 2); + const TQRect lrect (rectLeftPage()); + const TQRect rrect(rectRightPage()); + const TQString number = TQString::number(currentPage() + 2); // setup font - QFont pageFont(font()); + TQFont pageFont(font()); int pointSize = 10; pageFont.setPointSize(pointSize); pageFont.setBold(false); pageFont.setItalic(false); pageFont.setUnderline(false); paint.setFont(pageFont); - const QFontMetrics fm(pageFont); + const TQFontMetrics fm(pageFont); const int width = fm.width(number); //paint page numbers const int offset = 8; - paint.drawText(lrect.left(), QWidget::height() - offset, - QString::number(currentPage() + 1)); + paint.drawText(lrect.left(), TQWidget::height() - offset, + TQString::number(currentPage() + 1)); paint.drawText(rrect.left() + rrect.width() - width, - QWidget::height() - offset, number); + TQWidget::height() - offset, number); } -void BookWidget::drawBookmark(QPainter & paint, Bookmark const& bm) +void BookWidget::drawBookmark(TQPainter & paint, Bookmark const& bm) { - const QRect lrect (rectLeftPage()); - const QRect rrect(rectRightPage()); - const QPixmap & bookmarkImage = Theme::self()->bookmarkPixmap(); + const TQRect lrect (rectLeftPage()); + const TQRect rrect(rectRightPage()); + const TQPixmap & bookmarkImage = Theme::self()->bookmarkPixmap(); const int width = bookmarkImage.width(); - paint.drawPixmap(QWidget::width()/2 - width/2, 0, bookmarkImage); + paint.drawPixmap(TQWidget::width()/2 - width/2, 0, bookmarkImage); if (!bm.name().isEmpty()) { paint.save(); - paint.translate(QWidget::width()/2., 20.); + paint.translate(TQWidget::width()/2., 20.); paint.rotate(90.); - const QString text = bm.name() + " (" + bm.dateTime().toString(Qt::LocalDate) + ")"; + const TQString text = bm.name() + " (" + bm.dateTime().toString(Qt::LocalDate) + ")"; paint.drawText(0, 0, text); paint.restore(); } } -void BookWidget::paintEvent(QPaintEvent* event) +void BookWidget::paintEvent(TQPaintEvent* event) { // use cached page pixmap if the page wasn't modified if (!modified()) { - QRect rect(event->rect()); + TQRect rect(event->rect()); bitBlt(this, rect.x(), rect.y(), &m_cachePixmap, rect.x(), rect.y(), rect.width(), rect.height()); return; } // do full painting otherwise setupPageSize(); - const QRect lrect (rectLeftPage()); - const QRect rrect(rectRightPage()); + const TQRect lrect (rectLeftPage()); + const TQRect rrect(rectRightPage()); const unsigned int curPage = currentPage(); - QPixmap pm(size()); - QPainter paint(&pm); + TQPixmap pm(size()); + TQPainter paint(&pm); //draw background image - const QPixmap & image = Theme::self()->bgPixmap(QWidget::size()); + const TQPixmap & image = Theme::self()->bgPixmap(TQWidget::size()); paint.drawPixmap(0, 0, image); if (m_renderer->busy()) { - QFont f(font()); + TQFont f(font()); f.setPointSize(20); paint.setFont(f); - const QFontMetrics fm(f); - QString text = tr("Rendering..."); + const TQFontMetrics fm(f); + TQString text = tr("Rendering..."); const int w = fm.width(text); const int h = fm.height(); const int dx = (lrect.width() - w) / 2; @@ -215,37 +215,37 @@ void BookWidget::paintEvent(QPaintEvent* event) void BookWidget::setupPageSize() { - QSize size((width() - m_left_margin - m_right_margin - 2 * m_middle_margin) / 2, + TQSize size((width() - m_left_margin - m_right_margin - 2 * m_middle_margin) / 2, (height() - m_top_margin - m_bottom_margin)); m_renderer->setPageSize(size); } -void BookWidget::mousePressEvent(QMouseEvent * event) +void BookWidget::mousePressEvent(TQMouseEvent * event) { - if (event->button() == LeftButton) + if (event->button() == Qt::LeftButton) { - if (rectLeftPage().contains(event->pos())) + if (rectLeftPage().tqcontains(event->pos())) { prevPage(); } - else if (rectRightPage().contains(event->pos())) + else if (rectRightPage().tqcontains(event->pos())) { nextPage(); } } - QWidget::mousePressEvent(event); + TQWidget::mousePressEvent(event); } -const QRect BookWidget::rectLeftPage() const +const TQRect BookWidget::rectLeftPage() const { - return QRect(m_left_margin, m_top_margin, + return TQRect(m_left_margin, m_top_margin, m_renderer->pageSize().width(), m_renderer->pageSize().height()); } -const QRect BookWidget::rectRightPage() const +const TQRect BookWidget::rectRightPage() const { - return QRect(m_left_margin + 2 * m_middle_margin + m_renderer->pageSize().width(), + return TQRect(m_left_margin + 2 * m_middle_margin + m_renderer->pageSize().width(), m_top_margin, m_renderer->pageSize().width(), m_renderer->pageSize().height()); @@ -277,7 +277,7 @@ void BookWidget::lastPage() setCurrentPage(m_renderer->pageCount() - 1); } -void BookWidget::wheelEvent(QWheelEvent * e) +void BookWidget::wheelEvent(TQWheelEvent * e) { e->accept(); if (e->delta() > 0) @@ -285,7 +285,7 @@ void BookWidget::wheelEvent(QWheelEvent * e) else nextPage(); } -void BookWidget::resizeEvent(QResizeEvent * e) +void BookWidget::resizeEvent(TQResizeEvent * e) { m_modified = true; setupPageSize(); @@ -293,18 +293,18 @@ void BookWidget::resizeEvent(QResizeEvent * e) // //if size become lower recalc current page // if (currentPage() > m_renderer->pageCount()) // lastPage(); - QWidget::resizeEvent(e); + TQWidget::resizeEvent(e); } -QSize BookWidget::minimumSizeHint() const +TQSize BookWidget::tqminimumSizeHint() const { - return QSize(400, 300); + return TQSize(400, 300); } -void BookWidget::setFont(const QFont & font) +void BookWidget::setFont(const TQFont & font) { m_modified = true; - QWidget::setFont(font); + TQWidget::setFont(font); m_renderer->setFont(font); update(); } @@ -325,27 +325,27 @@ void BookWidget::setCurrentPage(int number) update(); } -void BookWidget::keyPressEvent(QKeyEvent * e) +void BookWidget::keyPressEvent(TQKeyEvent * e) { - if (e->key() == Qt::Key_Right || e->key() == Qt::Key_Down - || e->key() == Qt::Key_Space) + if (e->key() == TQt::Key_Right || e->key() == TQt::Key_Down + || e->key() == TQt::Key_Space) { nextPage(); } - else if (e->key() == Qt::Key_Left || e->key() == Qt::Key_Up) + else if (e->key() == TQt::Key_Left || e->key() == TQt::Key_Up) { prevPage(); } - else if (e->key() == Qt::Key_Home) + else if (e->key() == TQt::Key_Home) { firstPage(); } - else if (e->key() == Qt::Key_End) + else if (e->key() == TQt::Key_End) { lastPage(); } - QWidget::keyPressEvent(e); + TQWidget::keyPressEvent(e); } void BookWidget::loadLine() @@ -378,7 +378,7 @@ void BookWidget::cancelLoading() { m_timer.stop(); if (parentWidget()) - parentWidget()->setCaption(""); + TQT_TQWIDGET(parentWidget())->setCaption(""); //clean up m_progressDlg->hide(); m_stream.reset(0); @@ -401,17 +401,17 @@ void BookWidget::setEncoding(int a_encoding) m_encoding = a_encoding; } -void BookWidget::setEncodings(const QStringList & a_encodings) +void BookWidget::setEncodings(const TQStringList & a_encodings) { m_encodings = a_encodings; } -void BookWidget::setEncoding(const QString & a_encoding) +void BookWidget::setEncoding(const TQString & a_encoding) { - m_encoding = (m_encodings.findIndex(a_encoding)); + m_encoding = (m_encodings.tqfindIndex(a_encoding)); } -void BookWidget::addBookmark(const QString& name) +void BookWidget::addBookmark(const TQString& name) { m_bookmarks.push_back(Bookmark(currentPage(), name)); std::sort(m_bookmarks.begin(), m_bookmarks.end()); @@ -423,13 +423,13 @@ void BookWidget::addBookmark(const QString& name) void BookWidget::saveBookmarks( ) { - const QString fileName = "bookreader/" + m_url.fileName(); - QFile::remove(KGlobal::dirs()->findResource("appdata", m_url.fileName())); + const TQString fileName = "bookreader/" + m_url.fileName(); + TQFile::remove(KGlobal::dirs()->findResource("appdata", m_url.fileName())); KConfig config(fileName, false, false, "data"); for (Bookmarks::size_type i = 0; i < m_bookmarks.size(); ++i) { const Bookmark & bm = m_bookmarks[i]; - config.setGroup(tr("Bookmark %1").arg(i)); + config.setGroup(tqtr("Bookmark %1").tqarg(i)); config.writeEntry("page", bm.page()); config.writeEntry("name", bm.name()); config.writeEntry("dateTime", bm.dateTime()); @@ -439,16 +439,16 @@ void BookWidget::saveBookmarks( ) void BookWidget::loadBookmarks() { m_bookmarks.clear(); - const QString fileName = "bookreader/" + m_url.fileName(); + const TQString fileName = "bookreader/" + m_url.fileName(); KConfig config(fileName, true, false, "data"); - QStringList groups = config.groupList(); - typedef QStringList::const_iterator IT; + TQStringList groups = config.groupList(); + typedef TQStringList::const_iterator IT; for (IT it = groups.constBegin(); it != groups.constEnd(); ++it) { config.setGroup(*it); - const QString name = config.readEntry("name"); + const TQString name = config.readEntry("name"); const unsigned int page = config.readUnsignedNumEntry("page"); - const QDateTime dateTime = config.readDateTimeEntry("dateTime"); + const TQDateTime dateTime = config.readDateTimeEntry("dateTime"); const Bookmark bm(page, name, dateTime); m_bookmarks.push_back(bm); } diff --git a/src/bookwidget.h b/src/bookwidget.h index 8089b3d..37e46f9 100644 --- a/src/bookwidget.h +++ b/src/bookwidget.h @@ -19,37 +19,38 @@ #ifndef BOOKWIDGET_H #define BOOKWIDGET_H -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include "renderer.h" #include "bookmark.h" -class QStringList; -class QRect; +class TQStringList; +class TQRect; class KProgressDialog; /** */ -class BookWidget : public QWidget +class BookWidget : public TQWidget { Q_OBJECT + TQ_OBJECT public: - BookWidget(QWidget *parent = 0, const char *name = 0); + BookWidget(TQWidget *tqparent = 0, const char *name = 0); ~BookWidget(); virtual void openURL(const KURL & url); - virtual QString currentURL(); - void paintEvent (QPaintEvent *); - void setFont( const QFont & ); + virtual TQString currentURL(); + void paintEvent (TQPaintEvent *); + void setFont( const TQFont & ); void setParaOffset(int offset); void setCurrentPage(int number); int currentPage() const { return m_currentPage; }; @@ -58,14 +59,14 @@ public: void prevPage(); void firstPage(); void lastPage(); - QSize minimumSizeHint () const; + TQSize tqminimumSizeHint () const; void setupPageSize(); void setEncoding(int); - void setEncoding(const QString & a_encoding); - void setEncodings(const QStringList & a_encodings); - QString encoding() const { return m_encodings[m_encoding]; } + void setEncoding(const TQString & a_encoding); + void setEncodings(const TQStringList & a_encodings); + TQString encoding() const { return m_encodings[m_encoding]; } //const TextThread * thread() const {return m_thread;} - void addBookmark(const QString& name); + void addBookmark(const TQString& name); void saveBookmarks(); void loadBookmarks(); void setBookmarks(const Bookmarks& bms); @@ -74,26 +75,26 @@ signals: /** * Use this signal to change the content of the statusbar */ - void signalChangeStatusbar(const QString& text); + void signalChangeStatusbar(const TQString& text); /** * Use this signal to change the content of the caption */ - void signalChangeCaption(const QString& text); + void signalChangeCaption(const TQString& text); void loaded(int); void loadingFinished(); protected: - const QRect rectLeftPage() const; - const QRect rectRightPage() const; - void mousePressEvent(QMouseEvent *); - void keyPressEvent (QKeyEvent * e); - void resizeEvent (QResizeEvent * e); - void wheelEvent (QWheelEvent * e); + const TQRect rectLeftPage() const; + const TQRect rectRightPage() const; + void mousePressEvent(TQMouseEvent *); + void keyPressEvent (TQKeyEvent * e); + void resizeEvent (TQResizeEvent * e); + void wheelEvent (TQWheelEvent * e); void clearAll(); - void drawContent(QPainter& paint); - void drawPageNumbers(QPainter& paint); - void drawBookmark(QPainter& paint, Bookmark const& bm); + void drawContent(TQPainter& paint); + void drawPageNumbers(TQPainter& paint); + void drawBookmark(TQPainter& paint, Bookmark const& bm); bool modified() const { return m_modified; }; private slots: @@ -104,20 +105,20 @@ private slots: private: KURL m_url; bool m_modified; - QPixmap m_cachePixmap; + TQPixmap m_cachePixmap; int m_currentPage; int m_left_margin; int m_right_margin; int m_top_margin; int m_bottom_margin; int m_middle_margin; - QFile m_file; - QTimer m_timer; - QStringList m_encodings; + TQFile m_file; + TQTimer m_timer; + TQStringList m_encodings; int m_encoding; std::auto_ptr m_renderer; - std::auto_ptr m_stream; - std::auto_ptr m_textLines; + std::auto_ptr m_stream; + std::auto_ptr m_textLines; std::auto_ptr m_progressDlg; Bookmarks m_bookmarks; }; diff --git a/src/renderer.cpp b/src/renderer.cpp index a04b0d0..fcc6eb7 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -18,8 +18,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include -#include -#include +#include +#include #include #include #include @@ -29,11 +29,11 @@ Renderer::Renderer(): m_pageCount(0), m_linesPerPage(0), m_paraOffset(50), - m_fontMetrics(new QFontMetrics(m_font)), + m_fontMetrics(new TQFontMetrics(m_font)), m_curParagraph(0), m_isRendering(false) { - connect(&m_timer, SIGNAL(timeout()), this, SLOT(timeout())); + connect(&m_timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(timeout())); } @@ -45,13 +45,13 @@ Renderer::~Renderer() * If the list is empty do nothing. * \param a_list List of strings to render */ -void Renderer::load(const QStringList & a_list) +void Renderer::load(const TQStringList & a_list) { if (a_list.isEmpty()) return; m_text.clear(); - QString string; + TQString string; TStringIter it(a_list.constBegin()); while (it != a_list.constEnd()) @@ -61,7 +61,7 @@ void Renderer::load(const QStringList & a_list) //process string until paragraph ends while (++it != a_list.constEnd()) { - QChar const ch((*it)[0]); + TQChar const ch((*it)[0]); //insert empty lines if ((*it).isEmpty()) break; @@ -96,7 +96,7 @@ void Renderer::render() cancel(); clear(); m_isRendering = true; - m_linesPerPage = m_pageSize.height() / (QFontMetrics(font()).height()); + m_linesPerPage = m_pageSize.height() / (TQFontMetrics(font()).height()); m_timer.start(0, false); } @@ -142,11 +142,11 @@ void Renderer::clear() void Renderer::parseParagraph(TIndex paraIndex) { //Don't parse empty lines - const QString a_string(m_text[paraIndex]); + const TQString a_string(m_text[paraIndex]); if (a_string.isEmpty()) return; - QString string(a_string); + TQString string(a_string); const int avgCharWidth = m_fontMetrics->width(" "); //calc approx string width unsigned int avgLen = m_pageSize.width() / avgCharWidth; @@ -248,7 +248,7 @@ void Renderer::parseParagraph(TIndex paraIndex) addLine(TextLine(paraIndex, begin, begin + len, TextLine::PARA_END)); } -int Renderer::width(const QString & a_string) const +int Renderer::width(const TQString & a_string) const { int w = m_fontMetrics->width(a_string); return m_isStartAdded ? w : w + paraOffset(); @@ -262,7 +262,7 @@ void Renderer::addLine(TextLine line) m_isStartAdded = true; } -int Renderer::wordAt(const QString & string, int len) +int Renderer::wordAt(const TQString & string, int len) { while (--len >= 0) if (string[len] == ' ') @@ -270,18 +270,18 @@ int Renderer::wordAt(const QString & string, int len) return 0; } -QString Renderer::getWord(const QString & a_string, int a_idx) +TQString Renderer::getWord(const TQString & a_string, int a_idx) { int idx = a_idx; while (a_string[++idx] != ' ' && idx < a_string.length()); - return QString(a_string.mid(a_idx, idx - a_idx)); + return TQString(a_string.mid(a_idx, idx - a_idx)); } /** * Draws page number \c pageNumber on \c paint * bounding \c rect rectangle */ -void Renderer::drawPage(QPainter & paint, QRect rect, int pageNumber) +void Renderer::drawPage(TQPainter & paint, TQRect rect, int pageNumber) { int height = m_fontMetrics->height(); int line = 1; @@ -298,12 +298,12 @@ void Renderer::drawPage(QPainter & paint, QRect rect, int pageNumber) drawLine(paint, rect.left(), rect.top() + line * height, idx); } -void Renderer::drawLine(QPainter & paint, int x, int y, const TLines::size_type index) +void Renderer::drawLine(TQPainter & paint, int x, int y, const TLines::size_type index) { const TextLine textLine(m_lines[index]); const int length = textLine.size(); - const QString & paragraph = m_text[textLine.paragraphIndex()]; - const QString string = paragraph.mid(textLine.begin(), textLine.size()); + const TQString & paragraph = m_text[textLine.paragraphIndex()]; + const TQString string = paragraph.mid(textLine.begin(), textLine.size()); // indent paragraph if (textLine.isParaStart()) @@ -332,7 +332,7 @@ void Renderer::drawLine(QPainter & paint, int x, int y, const TLines::size_type //count spaces std::vector spaces; spaces.reserve(50); - while (((pos = string.find(' ', off)) != -1) && (pos < length)) + while (((pos = string.tqfind(' ', off)) != -1) && (pos < length)) { spaces.push_back(pos); off = pos + 1; @@ -349,7 +349,7 @@ void Renderer::drawLine(QPainter & paint, int x, int y, const TLines::size_type // calc average space width const double avgLen = ((double)(pageWidth - curWidth) / spacesCount); int start = 0; - QString tmp; + TQString tmp; for (std::vector::size_type i = 0; i < spacesCount; ++i) { pos = spaces[i]; @@ -367,11 +367,11 @@ void Renderer::drawLine(QPainter & paint, int x, int y, const TLines::size_type * Sets current font to \c font and re-renders text. * You don't need to directly call render(). */ -void Renderer::setFont(const QFont & font) +void Renderer::setFont(const TQFont & font) { if (font == m_font) return; m_font = font; - m_fontMetrics.reset(new QFontMetrics(m_font)); + m_fontMetrics.reset(new TQFontMetrics(m_font)); render(); } @@ -390,7 +390,7 @@ void Renderer::setParaOffset(int offset) * Sets current page size to \c size. * \note It don't call render() after changing. */ -void Renderer::setPageSize(const QSize & size) +void Renderer::setPageSize(const TQSize & size) { m_pageSize = size; } 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 -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include -class QStringList; +class TQStringList; class TextLine { @@ -63,39 +63,40 @@ private: * \brief Renders input text into list of word wrapped strings * \author Alexandr Nemish */ -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 TParagraphs; + typedef TQStringList::const_iterator TStringIter; + typedef std::vector TParagraphs; typedef TParagraphs::size_type TIndex; typedef std::vector 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 m_fontMetrics; - QSize m_pageSize; + TQFont m_font; + std::auto_ptr m_fontMetrics; + TQSize m_pageSize; bool m_isStartAdded; TIndex m_curParagraph; bool m_isRendering; - QTimer m_timer; + TQTimer m_timer; }; #endif diff --git a/src/settingsdlg.ui b/src/settingsdlg.ui index a2a3db8..4f8797d 100644 --- a/src/settingsdlg.ui +++ b/src/settingsdlg.ui @@ -1,6 +1,6 @@ SettingsWidget - + SettingsDlg @@ -25,7 +25,7 @@ 0 - + frame3 @@ -39,15 +39,15 @@ unnamed - + - layout2 + tqlayout2 unnamed - + textLabel1 @@ -65,15 +65,15 @@ - + - layout3 + tqlayout3 unnamed - + textLabel1_2 @@ -81,7 +81,7 @@ Paragraph Offset - + kcfg_ParaOffset @@ -91,15 +91,15 @@ - + - layout8 + tqlayout8 unnamed - + textLabel1_3 @@ -107,7 +107,7 @@ Default encoding - + kcfg_DefaultEncoding @@ -117,7 +117,7 @@ - + kcfg_LoadLastUrl @@ -138,7 +138,7 @@ Expanding - + 20 30 @@ -157,9 +157,9 @@ kcfg_ParaOffset_valueChanged(const QString&) - + kcfg_ParaOffset_valueChanged(const QString&) - + kfontrequester.h diff --git a/src/theme.cpp b/src/theme.cpp index d6e868c..9bfd824 100644 --- a/src/theme.cpp +++ b/src/theme.cpp @@ -17,9 +17,9 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include -#include -#include +#include +#include +#include #include #include #include "theme.h" @@ -37,19 +37,19 @@ Theme * Theme::self() return theme; } -void Theme::loadTheme(const QString& name) +void Theme::loadTheme(const TQString& name) { - const QString themePath = "themes/" + name; //FIXME: Add 'name' check. Could be a hole. - QString bgPath = KGlobal::dirs()->findResource("appdata", themePath + "/bg.png"); - QString bookmarkPath = KGlobal::dirs()->findResource("appdata", themePath + "/bookmark.png"); - m_bgPixmap = QPixmap(bgPath); + const TQString themePath = "themes/" + name; //FIXME: Add 'name' check. Could be a hole. + TQString bgPath = KGlobal::dirs()->findResource("appdata", themePath + "/bg.png"); + TQString bookmarkPath = KGlobal::dirs()->findResource("appdata", themePath + "/bookmark.png"); + m_bgPixmap = TQPixmap(bgPath); m_bgResizedPixmap = m_bgPixmap; - m_bookmarkPixmap = QPixmap(bookmarkPath); + m_bookmarkPixmap = TQPixmap(bookmarkPath); } -const QPixmap & Theme::bgPixmap(QSize size) const +const TQPixmap & Theme::bgPixmap(TQSize size) const { - if (size == QSize(0, 0) || size == m_bgPixmap.size()) + if (size == TQSize(0, 0) || size == m_bgPixmap.size()) return m_bgPixmap; if (size == m_bgResizedPixmap.size()) return m_bgResizedPixmap; diff --git a/src/theme.h b/src/theme.h index fae0f45..c1f181c 100644 --- a/src/theme.h +++ b/src/theme.h @@ -20,8 +20,8 @@ #ifndef BOOKREADER_THEME_H #define BOOKREADER_THEME_H -#include -#include +#include +#include class Theme @@ -29,18 +29,18 @@ class Theme public: static Theme * self(); /// \brief Loads theme with given name. Default is "default". :) - void loadTheme(const QString& name = "default"); - const QPixmap & bgPixmap(QSize size = QSize(0,0)) const; - const QPixmap & bookmarkPixmap() const { return m_bookmarkPixmap; } - //const QFont & font() const {return m_font;} + void loadTheme(const TQString& name = "default"); + const TQPixmap & bgPixmap(TQSize size = TQSize(0,0)) const; + const TQPixmap & bookmarkPixmap() const { return m_bookmarkPixmap; } + //const TQFont & font() const {return m_font;} private: static Theme * theme; Theme(); Theme(const Theme &); Theme & operator = (const Theme&); - QPixmap m_bgPixmap; - mutable QPixmap m_bgResizedPixmap; - QPixmap m_bookmarkPixmap; + TQPixmap m_bgPixmap; + mutable TQPixmap m_bgResizedPixmap; + TQPixmap m_bookmarkPixmap; }; #endif