diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-26 21:04:57 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-26 21:04:57 +0000 |
commit | bf7f88413be3831a9372d323d02fc0335b9f9188 (patch) | |
tree | 516fdef9206245b40a14f99b4e3d9ef9289196e0 /src/gvcore/imageviewcontroller.cpp | |
parent | e238aa77b1fb3c2f55aef2ef2c91ce52166d2cc8 (diff) | |
download | gwenview-bf7f88413be3831a9372d323d02fc0335b9f9188.tar.gz gwenview-bf7f88413be3831a9372d323d02fc0335b9f9188.zip |
TQt4 port Gwenview
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/gwenview@1233720 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/gvcore/imageviewcontroller.cpp')
-rw-r--r-- | src/gvcore/imageviewcontroller.cpp | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/src/gvcore/imageviewcontroller.cpp b/src/gvcore/imageviewcontroller.cpp index cc88687..1ec4218 100644 --- a/src/gvcore/imageviewcontroller.cpp +++ b/src/gvcore/imageviewcontroller.cpp @@ -20,12 +20,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include <imageviewcontroller.moc> -// Qt -#include <qcursor.h> -#include <qlayout.h> -#include <qpopupmenu.h> -#include <qvbox.h> -#include <qwidgetstack.h> +// TQt +#include <tqcursor.h> +#include <tqlayout.h> +#include <tqpopupmenu.h> +#include <tqvbox.h> +#include <tqwidgetstack.h> // KDE #include <kaction.h> @@ -64,11 +64,11 @@ namespace Gwenview { */ class XMLGUIBuilder : public KXMLGUIBuilder { public: - XMLGUIBuilder(QWidget* parent) : KXMLGUIBuilder(parent) {} + XMLGUIBuilder(TQWidget* tqparent) : KXMLGUIBuilder(tqparent) {} - virtual QWidget* createContainer(QWidget *parent, int index, const QDomElement &element, int &id) { + virtual TQWidget* createContainer(TQWidget *tqparent, int index, const TQDomElement &element, int &id) { if (element.tagName().lower() == "toolbar") { - return KXMLGUIBuilder::createContainer(parent, index, element, id); + return KXMLGUIBuilder::createContainer(tqparent, index, element, id); } else { return 0; } @@ -89,17 +89,17 @@ struct ImageViewController::Private { Document* mDocument; KActionCollection* mActionCollection; - QWidget* mContainer; + TQWidget* mContainer; KToolBar* mToolBar; KXMLGUIFactory* mFactory; XMLGUIBuilder* mBuilder; - QWidgetStack* mStack; + TQWidgetStack* mStack; ImageView* mImageView; KActionPtrList mImageViewActions; // Hide cursor stuff - QTimer* mAutoHideTimer; + TQTimer* mAutoHideTimer; bool mCursorHidden; KParts::ReadOnlyPart* mPlayerPart; @@ -111,7 +111,7 @@ struct ImageViewController::Private { void setXMLGUIClient(KXMLGUIClient* client) { - QPtrList<KXMLGUIClient> list=mFactory->clients(); + TQPtrList<KXMLGUIClient> list=mFactory->clients(); KXMLGUIClient* oldClient=list.getFirst(); if (oldClient) { mFactory->removeClient(oldClient); @@ -144,17 +144,17 @@ struct ImageViewController::Private { } mPlayerPart=0; - QString mimeType=KMimeType::findByURL(mDocument->url())->name(); + TQString mimeType=KMimeType::findByURL(mDocument->url())->name(); KService::Ptr service = KServiceTypeProfile::preferredService(mimeType, "KParts/ReadOnlyPart"); if (!service) { kdWarning() << "Couldn't find a KPart for " << mimeType << endl; return; } - QString library=service->library(); + TQString library=service->library(); Q_ASSERT(!library.isNull()); LOG("Library:" << library); - mPlayerPart = KParts::ComponentFactory::createPartInstanceFromService<KParts::ReadOnlyPart>(service, mStack, 0, mStack, 0); + mPlayerPart = KParts::ComponentFactory::createPartInstanceFromService<KParts::ReadOnlyPart>(service, TQT_TQWIDGET(mStack), 0, TQT_TQOBJECT(mStack), 0); if (!mPlayerPart) { kdWarning() << "Failed to instantiate KPart from library " << library << endl; return; @@ -219,7 +219,7 @@ struct ImageViewController::Private { void updateFullScreenBarPosition() { - int mouseY=mStack->mapFromGlobal(QCursor::pos()).y(); + int mouseY=mStack->mapFromGlobal(TQCursor::pos()).y(); bool visible = mFullScreenBar->y()==0; if (visible && mouseY>mFullScreenBar->height()) { @@ -264,23 +264,23 @@ struct ImageViewController::Private { //------------------------------------------------------------------------ -ImageViewController::ImageViewController(QWidget* parent, Document* document, KActionCollection* actionCollection) -: QObject(parent) { +ImageViewController::ImageViewController(TQWidget* tqparent, Document* document, KActionCollection* actionCollection) +: TQObject(tqparent) { d=new Private; d->mImageViewController=this; d->mDocument=document; d->mActionCollection=actionCollection; - d->mAutoHideTimer=new QTimer(this); + d->mAutoHideTimer=new TQTimer(this); d->mCursorHidden=false; - d->mContainer=new QWidget(parent); + d->mContainer=new TQWidget(tqparent); d->mContainer->setMinimumWidth(1); // Make sure we can resize the toolbar smaller than its minimum size - QVBoxLayout* layout=new QVBoxLayout(d->mContainer); + TQVBoxLayout* tqlayout=new TQVBoxLayout(d->mContainer); d->mToolBar=new KToolBar(d->mContainer, "", true); - layout->add(d->mToolBar); - d->mStack=new QWidgetStack(d->mContainer); - layout->add(d->mStack); + tqlayout->add(d->mToolBar); + d->mStack=new TQWidgetStack(d->mContainer); + tqlayout->add(d->mStack); d->mImageView=new ImageView(d->mStack, document, actionCollection); d->mStack->addWidget(d->mImageView); @@ -294,22 +294,22 @@ ImageViewController::ImageViewController(QWidget* parent, Document* document, KA d->mFullScreen=false; d->mFullScreenBar=0; - connect(d->mDocument,SIGNAL(loaded(const KURL&)), - this,SLOT(slotLoaded()) ); + connect(d->mDocument,TQT_SIGNAL(loaded(const KURL&)), + this,TQT_SLOT(slotLoaded()) ); - connect(d->mImageView, SIGNAL(requestContextMenu(const QPoint&)), - this, SLOT(openImageViewContextMenu(const QPoint&)) ); + connect(d->mImageView, TQT_SIGNAL(requestContextMenu(const TQPoint&)), + this, TQT_SLOT(openImageViewContextMenu(const TQPoint&)) ); - connect(d->mImageView, SIGNAL(requestHintDisplay(const QString&)), - this, SIGNAL(requestHintDisplay(const QString&)) ); + connect(d->mImageView, TQT_SIGNAL(requestHintDisplay(const TQString&)), + this, TQT_SIGNAL(requestHintDisplay(const TQString&)) ); - connect(d->mAutoHideTimer,SIGNAL(timeout()), - this,SLOT(slotAutoHide()) ); + connect(d->mAutoHideTimer,TQT_SIGNAL(timeout()), + this,TQT_SLOT(slotAutoHide()) ); // Forward Image view signals - connect(d->mImageView, SIGNAL(selectPrevious()), SIGNAL(selectPrevious()) ); - connect(d->mImageView, SIGNAL(selectNext()), SIGNAL(selectNext()) ); - connect(d->mImageView, SIGNAL(doubleClicked()), SIGNAL(doubleClicked()) ); + connect(d->mImageView, TQT_SIGNAL(selectPrevious()), TQT_SIGNAL(selectPrevious()) ); + connect(d->mImageView, TQT_SIGNAL(selectNext()), TQT_SIGNAL(selectNext()) ); + connect(d->mImageView, TQT_SIGNAL(doubleClicked()), TQT_SIGNAL(doubleClicked()) ); } @@ -320,7 +320,7 @@ ImageViewController::~ImageViewController() { void ImageViewController::setFocus() { - QWidget* view; + TQWidget* view; if (d->mPlayerPart) { view = d->mPlayerPart->widget(); } else { @@ -351,7 +351,7 @@ void ImageViewController::setFullScreen(bool fullScreen) { } } else { d->mAutoHideTimer->stop(); - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); d->mCursorHidden=false; } @@ -387,23 +387,23 @@ void ImageViewController::setImageViewActions(const KActionPtrList& actions) { void ImageViewController::slotAutoHide() { if (d->mFullScreenBar) { // Do not auto hide if the cursor is over the bar - QPoint pos=d->mFullScreenBar->mapFromGlobal(QCursor::pos()); - if (d->mFullScreenBar->rect().contains(pos)) { + TQPoint pos=d->mFullScreenBar->mapFromGlobal(TQCursor::pos()); + if (TQT_TQRECT_OBJECT(d->mFullScreenBar->rect()).tqcontains(pos)) { d->restartAutoHideTimer(); return; } } // Only hide cursor if we are not over a dialog - QWidget* widget = KApplication::kApplication()->activeWindow(); - if (!widget || !widget->inherits("QDialog")) { - QApplication::setOverrideCursor(blankCursor); + TQWidget* widget = TQT_TQWIDGET(KApplication::kApplication()->activeWindow()); + if (!widget || !widget->inherits(TQDIALOG_OBJECT_NAME_STRING)) { + TQApplication::setOverrideCursor(blankCursor); d->mCursorHidden=true; } } -QWidget* ImageViewController::widget() const { +TQWidget* ImageViewController::widget() const { return d->mContainer; } @@ -417,16 +417,16 @@ void ImageViewController::updateFromSettings() { * This event filter monitors mouse moves and make sure the position of the * fullscreen bar is updated. */ -bool ImageViewController::eventFilter(QObject* object, QEvent* event) { +bool ImageViewController::eventFilter(TQObject* object, TQEvent* event) { if (!d->mFullScreen) return false; - if (!event->type()==QEvent::MouseMove) return false; + if (!event->type()==TQEvent::MouseMove) return false; // Check we must filter this object. This is an application filter, so we // have to check we are not dealing with another object. bool isAChildOfStack=false; - QObject* parentObject; - for (parentObject=object->parent(); parentObject; parentObject=parentObject->parent()) { - if (parentObject==d->mStack) { + TQObject* tqparentObject; + for (tqparentObject=object->tqparent(); tqparentObject; tqparentObject=tqparentObject->tqparent()) { + if (TQT_BASE_OBJECT(tqparentObject)==TQT_BASE_OBJECT(d->mStack)) { isAChildOfStack=true; break; } @@ -435,15 +435,15 @@ bool ImageViewController::eventFilter(QObject* object, QEvent* event) { d->updateFullScreenBarPosition(); - if (event->type()==QEvent::MouseMove) { + if (event->type()==TQEvent::MouseMove) { d->mCursorHidden=false; d->restartAutoHideTimer(); } if (d->mCursorHidden) { - QApplication::setOverrideCursor(blankCursor,true); + TQApplication::setOverrideCursor(blankCursor,true); } else { - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); } return false; @@ -453,14 +453,14 @@ bool ImageViewController::eventFilter(QObject* object, QEvent* event) { /** * Little helper to plug an action if it exists */ -inline void plugAction(QPopupMenu* menu, KActionCollection* actionCollection, const char* actionName) { +inline void plugAction(TQPopupMenu* menu, KActionCollection* actionCollection, const char* actionName) { KAction* action=actionCollection->action(actionName); if (action) action->plug(menu); } -void ImageViewController::openImageViewContextMenu(const QPoint& pos) { - QPopupMenu menu(d->mImageView); +void ImageViewController::openImageViewContextMenu(const TQPoint& pos) { + TQPopupMenu menu(d->mImageView); bool noImage=d->mDocument->filename().isEmpty(); bool validImage=!d->mDocument->isNull(); @@ -490,7 +490,7 @@ void ImageViewController::openImageViewContextMenu(const QPoint& pos) { if (validImage) { menu.insertSeparator(); - QPopupMenu* editMenu=new QPopupMenu(&menu); + TQPopupMenu* editMenu=new TQPopupMenu(&menu); plugAction(editMenu, d->mActionCollection, "rotate_left"); plugAction(editMenu, d->mActionCollection, "rotate_right"); plugAction(editMenu, d->mActionCollection, "mirror"); |